@mui/system 5.15.7 → 5.15.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Box/Box.d.ts +2 -3
- package/CHANGELOG.md +124 -9
- package/colorManipulator.d.ts +1 -0
- package/colorManipulator.js +20 -0
- package/createStyled.js +80 -160
- package/esm/colorManipulator.js +19 -0
- package/esm/createStyled.js +81 -161
- package/index.js +1 -1
- package/legacy/colorManipulator.js +22 -0
- package/legacy/createStyled.js +85 -167
- package/legacy/index.js +1 -1
- package/modern/colorManipulator.js +19 -0
- package/modern/createStyled.js +80 -160
- package/modern/index.js +1 -1
- package/package.json +5 -5
- package/spacing.d.ts +10 -10
- package/styleFunctionSx/styleFunctionSx.d.ts +1 -1
package/Box/Box.d.ts
CHANGED
|
@@ -9,9 +9,8 @@ import {
|
|
|
9
9
|
AliasesCSSProperties,
|
|
10
10
|
} from '../styleFunctionSx';
|
|
11
11
|
|
|
12
|
-
export type PropsFor<SomeStyleFunction> =
|
|
13
|
-
? Props
|
|
14
|
-
: never;
|
|
12
|
+
export type PropsFor<SomeStyleFunction> =
|
|
13
|
+
SomeStyleFunction extends StyleFunction<infer Props> ? Props : never;
|
|
15
14
|
export type StyleFunction<Props> = (props: Props) => any;
|
|
16
15
|
export type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<
|
|
17
16
|
Partial<Record<PropKey, any>>
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,119 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## v5.15.9<!-- generated comparing v5.15.8..master -->
|
|
4
|
+
|
|
5
|
+
_Feb 8, 2024_
|
|
6
|
+
|
|
7
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- 🐛 A critical fix to remove non-published library usage in `@mui/material` peerDependencies.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@5.15.9`
|
|
12
|
+
|
|
13
|
+
- ​<!-- 11 -->[autocomplete] Avoid spread operator (#40968) @oliviertassinari
|
|
14
|
+
- ​<!-- 05 -->[material] Remove zero-runtime from peer dep (#41003) @brijeshb42
|
|
15
|
+
|
|
16
|
+
### `@mui/base@5.0.0-beta.36`
|
|
17
|
+
|
|
18
|
+
- ​<!-- 10 -->[base-ui] Update props using Array to ReadonlyArray type (#40754) @RaghavenderSingh
|
|
19
|
+
|
|
20
|
+
### `@mui/system@5.15.9`
|
|
21
|
+
|
|
22
|
+
- ​<!-- 02 -->[system] use `ReadonlyArray` for CSS related types (#40972) @siriwatknp
|
|
23
|
+
- ​<!-- 01 -->[zero] Migrate to use wyw-in-js instead of linaria (#40866) @brijeshb42
|
|
24
|
+
|
|
25
|
+
### Docs
|
|
26
|
+
|
|
27
|
+
- ​<!-- 06 -->[docs] Polish codemod git diff format @oliviertassinari
|
|
28
|
+
- ​<!-- 05 -->[material-ui][docs] Migrating from deprecated apis follow up (#40981) @DiegoAndai
|
|
29
|
+
|
|
30
|
+
### Core
|
|
31
|
+
|
|
32
|
+
- ​<!-- 09 -->[code-infra] Move next config to ESM (#40869) @Janpot
|
|
33
|
+
- ​<!-- 08 -->[code-infra] Update prettier (#40772) @Janpot
|
|
34
|
+
- ​<!-- 07 -->[code-infra] Add codemod for `light` prop removal (#40947) @sai6855
|
|
35
|
+
|
|
36
|
+
All contributors of this release in alphabetical order: @brijeshb42, @DiegoAndai, @Janpot, @oliviertassinari, @RaghavenderSingh, @sai6855, @siriwatknp
|
|
37
|
+
|
|
38
|
+
## v5.15.8<!-- generated comparing v5.15.7..master -->
|
|
39
|
+
|
|
40
|
+
_Feb 6, 2024_
|
|
41
|
+
|
|
42
|
+
A big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
|
|
43
|
+
|
|
44
|
+
- 💫 Added a redesigned [landing page template](https://mui.com/material-ui/getting-started/templates/landing-page/) (#37557) @zanivan
|
|
45
|
+
- ✨ Added support for Arrow Down/Up + Shift and Page Up/Down keys for faster stepping in the Slider component (#40676) @mnajdova
|
|
46
|
+
- many 🐛 bug fixes and 📚 documentation improvements
|
|
47
|
+
|
|
48
|
+
### `@mui/material@5.15.8`
|
|
49
|
+
|
|
50
|
+
- ​<!-- 36 -->[Avatar] Simplify valid children assertion (#40834) @oliviertassinari
|
|
51
|
+
|
|
52
|
+
### `@mui/codemod@5.15.8`
|
|
53
|
+
|
|
54
|
+
- ​<!-- 37 -->[Accordion] Update props actual.js test case (#40879) @DiegoAndai
|
|
55
|
+
- ​<!-- 12 -->Fix `findComponentJSX` util (#40855) @sai6855
|
|
56
|
+
|
|
57
|
+
### `@mui/system@5.15.8`
|
|
58
|
+
|
|
59
|
+
- ​<!-- 10 -->Add blend color manipulator (#40258) @romgrk
|
|
60
|
+
- ​<!-- 38 -->Support variants in `theme.styleOverrides` (#40690) @siriwatknp
|
|
61
|
+
- ​<!-- 02 -->[zero] Always replace the `createUseThemeProps` call (#40885) @siriwatknp
|
|
62
|
+
- ​<!-- 01 -->[zero] Add README with installation and basic usage (#40761) @brijeshb42
|
|
63
|
+
|
|
64
|
+
### `@mui/base@5.0.0-beta.34`
|
|
65
|
+
|
|
66
|
+
- ​<!-- 35 -->[Button] Add support for `hostElementName` prop to improve SSR (#40507) @mj12albert
|
|
67
|
+
- ​<!-- 30 -->[Menu] Use Popup instead of Popper (#40731) @michaldudak
|
|
68
|
+
- ​<!-- 29 -->[useNumberInput] Integrate useNumberInput with useControllableReducer (#40206) @mj12albert
|
|
69
|
+
- ​<!-- 11 -->[Slider] Add support for Arrow Down/Up + Shift and Page Up/Down keys (#40676) @mnajdova
|
|
70
|
+
|
|
71
|
+
### Docs
|
|
72
|
+
|
|
73
|
+
- ​<!-- 34 -->[base-ui] Update usage.md (#40916) @adebiyial
|
|
74
|
+
- ​<!-- 33 -->[base-ui] Improve Base UI traffic from Material UI (#40875) @oliviertassinari
|
|
75
|
+
- ​<!-- 32 -->[base-ui] Change Radio component terminology from Button to Group (#40888) @danilo-leal
|
|
76
|
+
- ​<!-- 42 -->[base-ui] Remove redundant "Styled" prefix (#40478) @oliviertassinari
|
|
77
|
+
- ​<!-- 48 -->[base-ui] Update listbox slot style in demo (#40952) @sai6855
|
|
78
|
+
- ​<!-- 14 -->[material-ui] Fix createTheme import and markdown format in the Next.js guide (#40895) @hsmtkk
|
|
79
|
+
- ​<!-- 13 -->[material-ui] Correct Google font CDN URL as Roboto 600 weight is not used (#40852) @xuhdev
|
|
80
|
+
- ​<!-- 14 -->[material-ui] Replace the Album template with a landing page (#37557) @zanivan
|
|
81
|
+
- ​<!-- 21 -->[material-ui] Add deprecations migration guide (#40767) @DiegoAndai
|
|
82
|
+
- ​<!-- 22 -->[material-ui] Improve aria-label throughout the Button Group demos (#40892) @danilo-leal
|
|
83
|
+
- ​<!-- 17 -->[joy-ui] Update the Overview callout (#40900) @danilo-leal
|
|
84
|
+
- ​<!-- 22 -->Fix image size and dark mode @oliviertassinari
|
|
85
|
+
- ​<!-- 21 -->Migrate links from legacy.reactjs.org to react.dev @oliviertassinari
|
|
86
|
+
- ​<!-- 20 -->Fix 301 links @oliviertassinari
|
|
87
|
+
- ​<!-- 19 -->Fix outdated link @oliviertassinari
|
|
88
|
+
- ​<!-- 18 -->Fix URL and typo in CONTRIBUTING.md (#40899) @Smileek
|
|
89
|
+
|
|
90
|
+
### Core
|
|
91
|
+
|
|
92
|
+
- ​<!-- 28 -->[blog] Optimize images for /blog/mui-x-v7-beta/ @oliviertassinari
|
|
93
|
+
- ​<!-- 27 -->[blog] Clarify barrel index tree-shaking @oliviertassinari
|
|
94
|
+
- ​<!-- 26 -->[code-infra] Simplify bug reproduction (#40833) @oliviertassinari
|
|
95
|
+
- ​<!-- 25 -->[code-infra] Prepare publishing @mui-internal/typescript-to-proptypes to npm (#40842) @michaldudak
|
|
96
|
+
- ​<!-- 40 -->[code-infra] Remove babel alias from the docs (#40792) @Janpot
|
|
97
|
+
- ​<!-- 24 -->[core] Use Google Font v2 API @oliviertassinari
|
|
98
|
+
- ​<!-- 23 -->[core] Add missing change to v5.15.7 changelog (#40872) @DiegoAndai
|
|
99
|
+
- ​<!-- 31 -->[core] Normalize `<meta name="viewport" />`` @oliviertassinari
|
|
100
|
+
- ​<!-- 28 -->[dependencies] Do not update envinfo test dependencies (#40950) @michaldudak
|
|
101
|
+
- ​<!-- 17 -->[docs-infra] Fix arbitrary gap between paragraphs in callouts (#40911) @oliviertassinari
|
|
102
|
+
- ​<!-- 16 -->[docs-infra] Allow developers to build their CodeSandbox export (#40878) @oliviertassinari
|
|
103
|
+
- ​<!-- 15 -->[docs-infra] Improve StackBlitz support (#40832) @oliviertassinari
|
|
104
|
+
- ​<!-- 21 -->[docs-infra] Improve support for absolute locale URL (#40940) @oliviertassinari
|
|
105
|
+
- ​<!-- 31 -->[Menu][base-ui] Fix improperly merged tests (#40896) @michaldudak
|
|
106
|
+
- ​<!-- 09 -->[utils] Use consistent build approach (#40837) @siriwatknp
|
|
107
|
+
- ​<!-- 08 -->[website] Fix React missing key console error @oliviertassinari
|
|
108
|
+
- ​<!-- 07 -->[website] Fix broken link @oliviertassinari
|
|
109
|
+
- ​<!-- 06 -->[website] Fix heading structure (#40912) @oliviertassinari
|
|
110
|
+
- ​<!-- 05 -->[website] Add Customer Support Agent role to careers page (#40890) @rluzists1
|
|
111
|
+
- ​<!-- 04 -->[website] Refine the Material UI homepage demo (#40881) @danilo-leal
|
|
112
|
+
- ​<!-- 03 -->[website] Use em-dash when relevant over hyphen @oliviertassinari
|
|
113
|
+
- ​<!-- 03 -->[zero] Fix build for demo next.js app (#40854) @brijeshb42
|
|
114
|
+
|
|
115
|
+
All contributors of this release in alphabetical order: @adebiyial, @brijeshb42, @danilo-leal, @DiegoAndai, @hsmtkk, @Janpot, @michaldudak, @mj12albert, @mnajdova, @oliviertassinari, @rluzists1, @romgrk, @sai6855, @siriwatknp, @Smileek, @xuhdev, @zanivan
|
|
116
|
+
|
|
3
117
|
## v5.15.7
|
|
4
118
|
|
|
5
119
|
<!-- generated comparing v5.15.6..master -->
|
|
@@ -48,6 +162,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
|
|
|
48
162
|
|
|
49
163
|
### Docs
|
|
50
164
|
|
|
165
|
+
- ​<!-- 57 -->[material-ui] Fix the icon preview dialog (#40863) @danilo-leal
|
|
51
166
|
- ​<!-- 53 -->[material-ui] Fix typo on styled-components guide (#40858) @dancielos
|
|
52
167
|
- ​<!-- 49 -->[base-ui] Fix CSS vars from the plain CSS theme stylesheet (#40762) @zanivan
|
|
53
168
|
- ​<!-- 31 -->[material-ui][Divider] Remove light prop references from docs (#40782) @sai6855
|
|
@@ -149,7 +264,7 @@ This release was mostly about 🐛 bug fixes and 📚 documentation improvements
|
|
|
149
264
|
- ​<!-- 19 -->[core] Polish issue templates @oliviertassinari
|
|
150
265
|
- ​<!-- 13 -->[docs-infra] Support markdown link in slots descriptions (#40679) @alexfauquette
|
|
151
266
|
- ​<!-- 08 -->[examples] Simplify Next.js example (#40661) @oliviertassinari
|
|
152
|
-
- ​<!-- 03 -->[website] Fix broken styles on Base
|
|
267
|
+
- ​<!-- 03 -->[website] Fix broken styles on Base UI page (#40683) @michaldudak
|
|
153
268
|
|
|
154
269
|
All contributors of this release in alphabetical order: @alexfauquette, @anle9650, @ANUGLYPLUGIN, @brijeshb42, @danilo-leal, @devhik0, @DiegoAndai, @DonikaV, @joserodolfofreitas, @michaldudak, @mj12albert, @mnajdova, @mohamedsaiedd, @oliviertassinari, @pcorpet, @sai6855, @zanivan
|
|
155
270
|
|
|
@@ -1630,7 +1745,7 @@ A big thanks to the 21 contributors who made this release possible. Here are som
|
|
|
1630
1745
|
### Core
|
|
1631
1746
|
|
|
1632
1747
|
- [changelog] Fix issues in highlight @oliviertassinari
|
|
1633
|
-
- [core] Remove redundant `@material-ui/` aliases from regression test
|
|
1748
|
+
- [core] Remove redundant `@material-ui/` aliases from regression test Webpack config (#38574) @ZeeshanTamboli
|
|
1634
1749
|
- [core] Fix CI error @oliviertassinari
|
|
1635
1750
|
- [core] Remove unnecessary Box (#38461) @oliviertassinari
|
|
1636
1751
|
- [core] Set GitHub Action top level permission @oliviertassinari
|
|
@@ -4767,7 +4882,7 @@ A big thanks to the 21 contributors who made this release possible. Here are som
|
|
|
4767
4882
|
- [docs] Fix typo in `Grid` docs (#34475) @Dustin-Digitar
|
|
4768
4883
|
- [docs] Fix typo in `Back to top` section in AppBar docs (#34479) @Dustin-Digitar
|
|
4769
4884
|
- [docs] Standardize all "Installation" pages (#34168) @samuelsycamore
|
|
4770
|
-
- [docs] Fix
|
|
4885
|
+
- [docs] Fix Webpack file name to the standard: `webpack.config.js` (#34446) @CodingItWrong
|
|
4771
4886
|
- [docs] Fix Select `onChange` call (#34408) @siriwatknp
|
|
4772
4887
|
- [docs] Notification for pickers blog - v5 stable (#34400) @joserodolfofreitas
|
|
4773
4888
|
- [docs] Improve social sharing of docs pages (#34346) @oliviertassinari
|
|
@@ -5442,7 +5557,7 @@ A big thanks to the 19 contributors who made this release possible. Here are som
|
|
|
5442
5557
|
- [docs] Update to React 18 (#33196) @mnajdova
|
|
5443
5558
|
- [docs] Simplify "Upload button" demo (#33326) @baharalidurrani
|
|
5444
5559
|
- [docs] Add "refine" demo to showcase (#33240) @omeraplak
|
|
5445
|
-
- [docs] Add
|
|
5560
|
+
- [docs] Add Webpack alias for legacy utils package (#33376) @jgbae
|
|
5446
5561
|
- [docs] Improve external link icons synonyms (#33257) @davidgarciab
|
|
5447
5562
|
- [examples] Update Base UI with Tailwind CSS to use the latest versions of the dependencies (#33401) @mnajdova
|
|
5448
5563
|
- [examples] Add Base UI example (#33154) @siriwatknp
|
|
@@ -8209,7 +8324,7 @@ A big thanks to the 14 contributors who made this release possible. Here are som
|
|
|
8209
8324
|
- ​<!-- 42 -->[core] Remove code handling JSS components (#28421) @eps1lon
|
|
8210
8325
|
- ​<!-- 41 -->[core] Remove unused dependencies (#28468) @eps1lon
|
|
8211
8326
|
- ​<!-- 40 -->[core] Ensure both docs bundles are analyzeable (#28410) @eps1lon
|
|
8212
|
-
- ​<!-- 39 -->[core] Switch to
|
|
8327
|
+
- ​<!-- 39 -->[core] Switch to Webpack 5 (#28248) @eps1lon
|
|
8213
8328
|
- ​<!-- 38 -->[core] Batch small changes (#28177) @oliviertassinari
|
|
8214
8329
|
- ​<!-- 37 -->[core] Update publish tag to latest (#28382) @mnajdova
|
|
8215
8330
|
- ​<!-- 19 -->[framer] Update @mui/\* dependencies (#28469) @eps1lon
|
|
@@ -8957,7 +9072,7 @@ A big thanks to the 17 contributors who made this release possible. Here are som
|
|
|
8957
9072
|
- [docs] Sort the size in a more logical order (#27186) @oliviertassinari
|
|
8958
9073
|
- [docs] Use actual link to paperbase (#27063) @eps1lon
|
|
8959
9074
|
- [docs] Use custom markdown loader for landing page (#27065) @eps1lon
|
|
8960
|
-
- [docs] Use
|
|
9075
|
+
- [docs] Use Webpack 5 (#27077) @eps1lon
|
|
8961
9076
|
- [examples] Fix CDN warning (#27229) @oliviertassinari
|
|
8962
9077
|
- [examples] Remove `StyledEngineProvider` as JSS is not used (#27133) @mnajdova
|
|
8963
9078
|
- [examples] Remove forgotten StyledEngineProvider (#27163) @oliviertassinari
|
|
@@ -9087,7 +9202,7 @@ A big thanks to the 13 contributors who made this release possible. Here are som
|
|
|
9087
9202
|
- ​<!-- 35 -->[docs] Fix /components/hidden merge conflict (#26997) @eps1lon
|
|
9088
9203
|
- ​<!-- 26 -->[docs] Fix 404 links (#26963) @oliviertassinari
|
|
9089
9204
|
- ​<!-- 24 -->[docs] Remove link that points to v4 blog post (#26960) @steveafrost
|
|
9090
|
-
- ​<!-- 16 -->[docs] Use custom
|
|
9205
|
+
- ​<!-- 16 -->[docs] Use custom Webpack loader for markdown (#26774) @eps1lon
|
|
9091
9206
|
- ​<!-- 11 -->[docs] Fix 301 links (#26942) @oliviertassinari
|
|
9092
9207
|
- ​<!-- 01 -->[docs] Add page for the `sx` prop (#26769) @mnajdova
|
|
9093
9208
|
- ​<!-- 52 -->[docs] pre-fill issue when a demo crashes (#27034) @eps1lon
|
|
@@ -11938,7 +12053,7 @@ A big thanks to the 18 contributors who made this release possible. Here are som
|
|
|
11938
12053
|
);
|
|
11939
12054
|
```
|
|
11940
12055
|
|
|
11941
|
-
This enforces emotion being injected first. [More details](https://mui.com/material-ui/
|
|
12056
|
+
This enforces emotion being injected first. [More details](https://mui.com/material-ui/integrations/interoperability/#css-injection-order) in the documentation.
|
|
11942
12057
|
|
|
11943
12058
|
- [Autocomplete] Rename `closeIcon` prop with `clearIcon` to avoid confusion (#23617) @akhilmhdh.
|
|
11944
12059
|
|
|
@@ -13187,7 +13302,7 @@ Here are some highlights ✨:
|
|
|
13187
13302
|
#### Breaking changes
|
|
13188
13303
|
|
|
13189
13304
|
- [Modal] Remove `onRendered` prop from Modal and Portal (#22464) @eps1lon
|
|
13190
|
-
Depending on your use case either use a [callback ref](https://
|
|
13305
|
+
Depending on your use case either use a [callback ref](https://react.dev/learn/manipulating-the-dom-with-refs#how-to-manage-a-list-of-refs-using-a-ref-callback) on the child element or an effect hook in the child component.
|
|
13191
13306
|
|
|
13192
13307
|
#### Changes
|
|
13193
13308
|
|
package/colorManipulator.d.ts
CHANGED
|
@@ -27,3 +27,4 @@ export function darken(color: string, coefficient: number): string;
|
|
|
27
27
|
export function private_safeDarken(color: string, coefficient: number, warning?: string): string;
|
|
28
28
|
export function lighten(color: string, coefficient: number): string;
|
|
29
29
|
export function private_safeLighten(color: string, coefficient: number, warning?: string): string;
|
|
30
|
+
export function blend(background: string, overlay: string, opacity: number, gamma?: number): string;
|
package/colorManipulator.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.alpha = alpha;
|
|
8
|
+
exports.blend = blend;
|
|
8
9
|
exports.colorChannel = void 0;
|
|
9
10
|
exports.darken = darken;
|
|
10
11
|
exports.decomposeColor = decomposeColor;
|
|
@@ -349,4 +350,23 @@ function private_safeEmphasize(color, coefficient, warning) {
|
|
|
349
350
|
}
|
|
350
351
|
return color;
|
|
351
352
|
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Blend a transparent overlay color with a background color, resulting in a single
|
|
357
|
+
* RGB color.
|
|
358
|
+
* @param {string} background - CSS color
|
|
359
|
+
* @param {string} overlay - CSS color
|
|
360
|
+
* @param {number} opacity - Opacity multiplier in the range 0 - 1
|
|
361
|
+
* @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.
|
|
362
|
+
*/
|
|
363
|
+
function blend(background, overlay, opacity, gamma = 1.0) {
|
|
364
|
+
const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);
|
|
365
|
+
const backgroundColor = decomposeColor(background);
|
|
366
|
+
const overlayColor = decomposeColor(overlay);
|
|
367
|
+
const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];
|
|
368
|
+
return recomposeColor({
|
|
369
|
+
type: 'rgb',
|
|
370
|
+
values: rgb
|
|
371
|
+
});
|
|
352
372
|
}
|
package/createStyled.js
CHANGED
|
@@ -7,14 +7,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = createStyled;
|
|
8
8
|
exports.shouldForwardProp = shouldForwardProp;
|
|
9
9
|
exports.systemDefaultTheme = void 0;
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var _styledEngine = _interopRequireWildcard(require("@mui/styled-engine"));
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _createTheme = _interopRequireDefault(require("./createTheme"));
|
|
15
|
-
var _propsToClassKey = _interopRequireDefault(require("./propsToClassKey"));
|
|
16
15
|
var _styleFunctionSx = _interopRequireDefault(require("./styleFunctionSx"));
|
|
17
|
-
const _excluded = ["
|
|
16
|
+
const _excluded = ["ownerState"],
|
|
17
|
+
_excluded2 = ["variants"],
|
|
18
|
+
_excluded3 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
|
|
18
19
|
/* eslint-disable no-underscore-dangle */
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -30,74 +31,6 @@ function isStringTag(tag) {
|
|
|
30
31
|
// it's a lowercase character
|
|
31
32
|
tag.charCodeAt(0) > 96;
|
|
32
33
|
}
|
|
33
|
-
const getStyleOverrides = (name, theme) => {
|
|
34
|
-
if (theme.components && theme.components[name] && theme.components[name].styleOverrides) {
|
|
35
|
-
return theme.components[name].styleOverrides;
|
|
36
|
-
}
|
|
37
|
-
return null;
|
|
38
|
-
};
|
|
39
|
-
const transformVariants = variants => {
|
|
40
|
-
let numOfCallbacks = 0;
|
|
41
|
-
const variantsStyles = {};
|
|
42
|
-
if (variants) {
|
|
43
|
-
variants.forEach(definition => {
|
|
44
|
-
let key = '';
|
|
45
|
-
if (typeof definition.props === 'function') {
|
|
46
|
-
key = `callback${numOfCallbacks}`;
|
|
47
|
-
numOfCallbacks += 1;
|
|
48
|
-
} else {
|
|
49
|
-
key = (0, _propsToClassKey.default)(definition.props);
|
|
50
|
-
}
|
|
51
|
-
variantsStyles[key] = definition.style;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
return variantsStyles;
|
|
55
|
-
};
|
|
56
|
-
const getVariantStyles = (name, theme) => {
|
|
57
|
-
let variants = [];
|
|
58
|
-
if (theme && theme.components && theme.components[name] && theme.components[name].variants) {
|
|
59
|
-
variants = theme.components[name].variants;
|
|
60
|
-
}
|
|
61
|
-
return transformVariants(variants);
|
|
62
|
-
};
|
|
63
|
-
const variantsResolver = (props, styles, variants) => {
|
|
64
|
-
const {
|
|
65
|
-
ownerState = {}
|
|
66
|
-
} = props;
|
|
67
|
-
const variantsStyles = [];
|
|
68
|
-
let numOfCallbacks = 0;
|
|
69
|
-
if (variants) {
|
|
70
|
-
variants.forEach(variant => {
|
|
71
|
-
let isMatch = true;
|
|
72
|
-
if (typeof variant.props === 'function') {
|
|
73
|
-
const propsToCheck = (0, _extends2.default)({}, props, ownerState);
|
|
74
|
-
isMatch = variant.props(propsToCheck);
|
|
75
|
-
} else {
|
|
76
|
-
Object.keys(variant.props).forEach(key => {
|
|
77
|
-
if (ownerState[key] !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
78
|
-
isMatch = false;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (isMatch) {
|
|
83
|
-
if (typeof variant.props === 'function') {
|
|
84
|
-
variantsStyles.push(styles[`callback${numOfCallbacks}`]);
|
|
85
|
-
} else {
|
|
86
|
-
variantsStyles.push(styles[(0, _propsToClassKey.default)(variant.props)]);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (typeof variant.props === 'function') {
|
|
90
|
-
numOfCallbacks += 1;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return variantsStyles;
|
|
95
|
-
};
|
|
96
|
-
const themeVariantsResolver = (props, styles, theme, name) => {
|
|
97
|
-
var _theme$components;
|
|
98
|
-
const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[name]) == null ? void 0 : _theme$components.variants;
|
|
99
|
-
return variantsResolver(props, styles, themeVariants);
|
|
100
|
-
};
|
|
101
34
|
|
|
102
35
|
// Update /system/styled/#api in case if this changes
|
|
103
36
|
function shouldForwardProp(prop) {
|
|
@@ -123,29 +56,51 @@ function defaultOverridesResolver(slot) {
|
|
|
123
56
|
}
|
|
124
57
|
return (props, styles) => styles[slot];
|
|
125
58
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
let optionalVariants;
|
|
139
|
-
if (resolvedStyles && resolvedStyles.variants) {
|
|
140
|
-
optionalVariants = resolvedStyles.variants;
|
|
141
|
-
delete resolvedStyles.variants;
|
|
59
|
+
function processStyleArg(callableStyle, _ref) {
|
|
60
|
+
let {
|
|
61
|
+
ownerState
|
|
62
|
+
} = _ref,
|
|
63
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
64
|
+
const resolvedStylesArg = typeof callableStyle === 'function' ? callableStyle((0, _extends2.default)({
|
|
65
|
+
ownerState
|
|
66
|
+
}, props)) : callableStyle;
|
|
67
|
+
if (Array.isArray(resolvedStylesArg)) {
|
|
68
|
+
return resolvedStylesArg.flatMap(resolvedStyle => processStyleArg(resolvedStyle, (0, _extends2.default)({
|
|
69
|
+
ownerState
|
|
70
|
+
}, props)));
|
|
142
71
|
}
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
|
|
72
|
+
if (!!resolvedStylesArg && typeof resolvedStylesArg === 'object' && Array.isArray(resolvedStylesArg.variants)) {
|
|
73
|
+
const {
|
|
74
|
+
variants = []
|
|
75
|
+
} = resolvedStylesArg,
|
|
76
|
+
otherStyles = (0, _objectWithoutPropertiesLoose2.default)(resolvedStylesArg, _excluded2);
|
|
77
|
+
let result = otherStyles;
|
|
78
|
+
variants.forEach(variant => {
|
|
79
|
+
let isMatch = true;
|
|
80
|
+
if (typeof variant.props === 'function') {
|
|
81
|
+
isMatch = variant.props((0, _extends2.default)({
|
|
82
|
+
ownerState
|
|
83
|
+
}, props));
|
|
84
|
+
} else {
|
|
85
|
+
Object.keys(variant.props).forEach(key => {
|
|
86
|
+
if ((ownerState == null ? void 0 : ownerState[key]) !== variant.props[key] && props[key] !== variant.props[key]) {
|
|
87
|
+
isMatch = false;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (isMatch) {
|
|
92
|
+
if (!Array.isArray(result)) {
|
|
93
|
+
result = [result];
|
|
94
|
+
}
|
|
95
|
+
result.push(typeof variant.style === 'function' ? variant.style((0, _extends2.default)({
|
|
96
|
+
ownerState
|
|
97
|
+
}, props)) : variant.style);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return result;
|
|
146
101
|
}
|
|
147
|
-
return
|
|
148
|
-
}
|
|
102
|
+
return resolvedStylesArg;
|
|
103
|
+
}
|
|
149
104
|
function createStyled(input = {}) {
|
|
150
105
|
const {
|
|
151
106
|
themeId,
|
|
@@ -174,7 +129,7 @@ function createStyled(input = {}) {
|
|
|
174
129
|
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
175
130
|
overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot))
|
|
176
131
|
} = inputOptions,
|
|
177
|
-
options = (0, _objectWithoutPropertiesLoose2.default)(inputOptions,
|
|
132
|
+
options = (0, _objectWithoutPropertiesLoose2.default)(inputOptions, _excluded3);
|
|
178
133
|
|
|
179
134
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
180
135
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
|
|
@@ -207,92 +162,57 @@ function createStyled(input = {}) {
|
|
|
207
162
|
shouldForwardProp: shouldForwardPropOption,
|
|
208
163
|
label
|
|
209
164
|
}, options));
|
|
210
|
-
const
|
|
211
|
-
const expressionsWithDefaultTheme = expressions ? expressions.map(stylesArg => {
|
|
212
|
-
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
213
|
-
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
214
|
-
// which are basically components used as a selectors.
|
|
215
|
-
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg) {
|
|
216
|
-
return props => muiStyledFunctionResolver({
|
|
217
|
-
styledArg: stylesArg,
|
|
218
|
-
props,
|
|
219
|
-
defaultTheme,
|
|
220
|
-
themeId
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
if ((0, _utils.isPlainObject)(stylesArg)) {
|
|
224
|
-
let transformedStylesArg = stylesArg;
|
|
225
|
-
let styledArgVariants;
|
|
226
|
-
if (stylesArg && stylesArg.variants) {
|
|
227
|
-
styledArgVariants = stylesArg.variants;
|
|
228
|
-
delete transformedStylesArg.variants;
|
|
229
|
-
transformedStylesArg = props => {
|
|
230
|
-
let result = stylesArg;
|
|
231
|
-
const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
|
|
232
|
-
variantStyles.forEach(variantStyle => {
|
|
233
|
-
result = (0, _utils.deepmerge)(result, variantStyle);
|
|
234
|
-
});
|
|
235
|
-
return result;
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
return transformedStylesArg;
|
|
239
|
-
}
|
|
240
|
-
return stylesArg;
|
|
241
|
-
}) : [];
|
|
242
|
-
let transformedStyleArg = styleArg;
|
|
243
|
-
if ((0, _utils.isPlainObject)(styleArg)) {
|
|
244
|
-
let styledArgVariants;
|
|
245
|
-
if (styleArg && styleArg.variants) {
|
|
246
|
-
styledArgVariants = styleArg.variants;
|
|
247
|
-
delete transformedStyleArg.variants;
|
|
248
|
-
transformedStyleArg = props => {
|
|
249
|
-
let result = styleArg;
|
|
250
|
-
const variantStyles = variantsResolver(props, transformVariants(styledArgVariants), styledArgVariants);
|
|
251
|
-
variantStyles.forEach(variantStyle => {
|
|
252
|
-
result = (0, _utils.deepmerge)(result, variantStyle);
|
|
253
|
-
});
|
|
254
|
-
return result;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
} else if (typeof styleArg === 'function' &&
|
|
165
|
+
const transformStyleArg = stylesArg => {
|
|
258
166
|
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
|
259
167
|
// component stays as a function. This condition makes sure that we do not interpolate functions
|
|
260
168
|
// which are basically components used as a selectors.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
169
|
+
if (typeof stylesArg === 'function' && stylesArg.__emotion_real !== stylesArg || (0, _utils.isPlainObject)(stylesArg)) {
|
|
170
|
+
return props => processStyleArg(stylesArg, (0, _extends2.default)({}, props, {
|
|
171
|
+
theme: resolveTheme({
|
|
172
|
+
theme: props.theme,
|
|
173
|
+
defaultTheme,
|
|
174
|
+
themeId
|
|
175
|
+
})
|
|
176
|
+
}));
|
|
269
177
|
}
|
|
178
|
+
return stylesArg;
|
|
179
|
+
};
|
|
180
|
+
const muiStyledResolver = (styleArg, ...expressions) => {
|
|
181
|
+
let transformedStyleArg = transformStyleArg(styleArg);
|
|
182
|
+
const expressionsWithDefaultTheme = expressions ? expressions.map(transformStyleArg) : [];
|
|
270
183
|
if (componentName && overridesResolver) {
|
|
271
184
|
expressionsWithDefaultTheme.push(props => {
|
|
272
185
|
const theme = resolveTheme((0, _extends2.default)({}, props, {
|
|
273
186
|
defaultTheme,
|
|
274
187
|
themeId
|
|
275
188
|
}));
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const resolvedStyleOverrides = {};
|
|
279
|
-
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
280
|
-
resolvedStyleOverrides[slotKey] = typeof slotStyle === 'function' ? slotStyle((0, _extends2.default)({}, props, {
|
|
281
|
-
theme
|
|
282
|
-
})) : slotStyle;
|
|
283
|
-
});
|
|
284
|
-
return overridesResolver(props, resolvedStyleOverrides);
|
|
189
|
+
if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) {
|
|
190
|
+
return null;
|
|
285
191
|
}
|
|
286
|
-
|
|
192
|
+
const styleOverrides = theme.components[componentName].styleOverrides;
|
|
193
|
+
const resolvedStyleOverrides = {};
|
|
194
|
+
// TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
|
|
195
|
+
Object.entries(styleOverrides).forEach(([slotKey, slotStyle]) => {
|
|
196
|
+
resolvedStyleOverrides[slotKey] = processStyleArg(slotStyle, (0, _extends2.default)({}, props, {
|
|
197
|
+
theme
|
|
198
|
+
}));
|
|
199
|
+
});
|
|
200
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
287
201
|
});
|
|
288
202
|
}
|
|
289
203
|
if (componentName && !skipVariantsResolver) {
|
|
290
204
|
expressionsWithDefaultTheme.push(props => {
|
|
205
|
+
var _theme$components;
|
|
291
206
|
const theme = resolveTheme((0, _extends2.default)({}, props, {
|
|
292
207
|
defaultTheme,
|
|
293
208
|
themeId
|
|
294
209
|
}));
|
|
295
|
-
|
|
210
|
+
const themeVariants = theme == null || (_theme$components = theme.components) == null || (_theme$components = _theme$components[componentName]) == null ? void 0 : _theme$components.variants;
|
|
211
|
+
return processStyleArg({
|
|
212
|
+
variants: themeVariants
|
|
213
|
+
}, (0, _extends2.default)({}, props, {
|
|
214
|
+
theme
|
|
215
|
+
}));
|
|
296
216
|
});
|
|
297
217
|
}
|
|
298
218
|
if (!skipSx) {
|
package/esm/colorManipulator.js
CHANGED
|
@@ -323,4 +323,23 @@ export function private_safeEmphasize(color, coefficient, warning) {
|
|
|
323
323
|
}
|
|
324
324
|
return color;
|
|
325
325
|
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Blend a transparent overlay color with a background color, resulting in a single
|
|
330
|
+
* RGB color.
|
|
331
|
+
* @param {string} background - CSS color
|
|
332
|
+
* @param {string} overlay - CSS color
|
|
333
|
+
* @param {number} opacity - Opacity multiplier in the range 0 - 1
|
|
334
|
+
* @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.
|
|
335
|
+
*/
|
|
336
|
+
export function blend(background, overlay, opacity, gamma = 1.0) {
|
|
337
|
+
const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);
|
|
338
|
+
const backgroundColor = decomposeColor(background);
|
|
339
|
+
const overlayColor = decomposeColor(overlay);
|
|
340
|
+
const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];
|
|
341
|
+
return recomposeColor({
|
|
342
|
+
type: 'rgb',
|
|
343
|
+
values: rgb
|
|
344
|
+
});
|
|
326
345
|
}
|