Skip to content

Commit 57f5ae0

Browse files
Version Packages (preview) (#2848)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 700a7b6 commit 57f5ae0

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

.changeset/pre.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
},
2626
"changesets": [
2727
"react-styles-remove-material-ui",
28+
"react-styles-theme-extensions",
2829
"storybook-styles-docs"
2930
]
3031
}

packages/styles/CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
# Change Log
22

3+
## 2.0.0-preview.2
4+
5+
### Minor Changes
6+
7+
- 0a1bf8d: Enhanced theme system with support for extending `FusionTheme` with custom properties, improved nested theme composition, and comprehensive documentation.
8+
9+
### Added
10+
- **Theme Extension Support**: `FusionTheme` now supports extending with custom properties using generics:
11+
```typescript
12+
type MyTheme = FusionTheme<{ colors: { primary: ColorStyleProperty } }>;
13+
```
14+
- **Custom Base Theme Merging**: `createTheme` now accepts an optional `baseTheme` parameter for merging with custom base themes:
15+
```typescript
16+
const extendedTheme = createTheme(
17+
{ colors: { ui: { background__danger: newColor } } },
18+
outerTheme,
19+
);
20+
```
21+
- **Deep Merging Improvements**: Enhanced `deepMerge` function properly handles nested theme properties, `Record` types, and `StyleProperty` instances
22+
- **Type Exports**: Explicitly exported `ThemeProviderProps`, `StylesProviderProps`, `FusionTheme`, `StyleDefinition`, and `createTheme` for better TypeScript support
23+
- **Complete TSDoc Documentation**: All exported functions, types, and interfaces now have comprehensive TSDoc comments with examples, parameter descriptions, and usage patterns
24+
- **Theme Extension Storybook Story**: New `ThemeExtension` story demonstrating how to extend themes with custom properties, including step-by-step examples for type definition, theme creation, and usage with `useTheme` and `makeStyles`
25+
26+
### Changed
27+
- `createTheme` signature now accepts optional `baseTheme` parameter (backward compatible)
28+
- Improved type inference for extended themes in `ThemeProvider`, `useTheme`, and `makeStyles`
29+
- Better handling of nested theme composition when using theme functions in nested `ThemeProvider` components
30+
- **Storybook Stories Updated**: All stories now use theme CSS values (`theme.colors.*.css`, `theme.spacing.*.css`, `theme.typography.*.style.*`) instead of hardcoded custom CSS, ensuring proper integration with Fusion design system tokens
31+
32+
### Technical Details
33+
- Deep merging now correctly handles `StyleProperty` instances (replaces instead of merging)
34+
- Theme composition works correctly with nested `ThemeProvider` components
35+
- All types are properly exported and documented with complete TSDoc comments
36+
- Typography properties accessed via `.style.fontSize`, `.style.fontWeight`, etc. for proper CSS value extraction
37+
- Color and spacing properties accessed via `.css` property for CSS variable or value string
38+
339
## 2.0.0-preview.1
440

541
### Major Changes

packages/styles/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@equinor/fusion-react-styles",
3-
"version": "2.0.0-preview.1",
3+
"version": "2.0.0-preview.2",
44
"description": "style lib inspired by @material-ui/styles",
55
"keywords": [
66
"styling",

0 commit comments

Comments
 (0)