@mui/styled-engine-sc 5.14.11 → 6.0.0-alpha.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,152 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 5.14.13
4
+
5
+ <!-- generated comparing v5.14.12..master -->
6
+
7
+ _Oct 10, 2023_
8
+
9
+ A big thanks to the 22 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🚀 Added support for `styled-components` v6 (#39042) @mnajdova
12
+
13
+ ### `@mui/material@5.14.13`
14
+
15
+ - [Checkbox] Fix checkbox hover bg with extendTheme (#39319) @brijeshb42
16
+ - [Chip] Outlined Chip variant is wider than the Filled counterpart (#39342) @chirag3003
17
+ - [Select] Add notice about select's a11y improvement on v5.14.12 changelog (#39310) @DiegoAndai
18
+ - [Typography] Color prop check for primitive type (#39071) @DarhkVoyd
19
+ - [Pagination] Fix background color on hover and keyboard focus when using CSS theme variables (#39220) @ValkonX33
20
+ - [Popper] Add missing `styleOverrides` Popper type in theme (#39154) @axelbostrom
21
+ - [Slider] Support all default palette colors in TypeScript (#39058) @gugudwt
22
+
23
+ ### `@mui/base@5.0.0-beta.19`
24
+
25
+ - [Menu] Add the anchor prop (#39297) @michaldudak
26
+
27
+ ### `@mui/material-next@6.0.0-alpha.105`
28
+
29
+ - [Menu] Copy v5 Menu components (#39301) @mnajdova
30
+
31
+ ### `@mui/joy@5.0.0-beta.10`
32
+
33
+ - [Autocomplete] Add `type=button` to clear button (#39263) @brijeshb42
34
+ - [Button] Fix the text wrap issue (#38696) @atharva3333
35
+ - [Drawer] Apply color inversion to content slot instead (#39312) @siriwatknp
36
+ - [Switch] Fix missing class name (#39327) @Bestwebdesign
37
+
38
+ ### `@mui/styled-engine-sc@6.0.0-alpha.1`
39
+
40
+ - &#8203;<!-- 03 -->[system] Add support for `styled-components` v6 (#39042) @mnajdova
41
+
42
+ ### Docs
43
+
44
+ - [joy-ui] Adjust the templates page card design (#39369) @danilo-leal
45
+ - Rename the Data Grid "Quick filter" to "Search" (#37724) @alexfauquette
46
+ - Remove obsolete translations (#39221) @mbrookes
47
+ - Update link to add custom color in palette (#39359) @ZeeshanTamboli
48
+ - Denser code demo @oliviertassinari
49
+ - Set up MD3 experiments pages (#39323) @mj12albert
50
+ - [Drawer] Fix right anchored persistent drawer intercepts click when it is closed (#39318) @ZeeshanTamboli
51
+ - [joy-ui] Revise the Color Inversion page (#39306) @danilo-leal
52
+ - [joy-ui] Remove redundant `error` prop from input validation demo (#39280) @sai6855
53
+ - [material-ui] Rename themed components doc, fix typos (#39368) @samuelsycamore
54
+ - [material-ui] Adjust the Material You Chip section (#39325) @danilo-leal
55
+ - [system] Add documentation on how to augment custom theme types for the `sx` prop callback (#39259) @3xp10it3r
56
+ - [joy-ui][Input] Add debounce input demo (#39300) @sai6855
57
+
58
+ ### Core
59
+
60
+ - [docs-infra] Improve the open diamond sponsor spot callout (#39332) @danilo-leal
61
+ - [docs-infra] Fix Code Sandbox download issue (#39317) @ARJ2160
62
+ - [docs-infra] Remove overflow: hidden for demo gradient bg (#39225) @oliviertassinari
63
+ - [website] Fix footer responsiveness (#39355) @danilo-leal
64
+ - [website] Host Figma redirections in the store for now @oliviertassinari
65
+
66
+ All contributors of this release in alphabetical order: @3xp10it3r, @alexfauquette, @ARJ2160, @atharva3333, @axelbostrom, @Bestwebdesign, @brijeshb42, @chirag3003, @danilo-leal, @DarhkVoyd, @DiegoAndai, @gugudwt, @mbrookes, @michaldudak, @mj12albert, @mnajdova, @oliviertassinari, @sai6855, @samuelsycamore, @siriwatknp, @ValkonX33, @ZeeshanTamboli
67
+
68
+ ## 5.14.12
69
+
70
+ <!-- generated comparing v5.14.11..master -->
71
+
72
+ _Oct 3, 2023_
73
+
74
+ A big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
75
+
76
+ - 🎨 Introduced color inversion utilities to Joy UI (#38916) @siriwatknp
77
+ - 🚀 Added Chip and related TextField components to Material You @DiegoAndai, @mj12albert
78
+ - 🏗️ Improve the Select's component a11y by adding the combobox role and aria-controls attribute (#38785) @xulingzhihou. If your tests require selecting the trigger element by the "button" role, then you'll have to change it to use the "combobox" role instead
79
+
80
+ ### `@mui/material@5.14.12`
81
+
82
+ - [DialogActions] Apply margin-left when children is not of `button` type (#39189) @sai6855
83
+ - [Select] Improve a11y by adding combobox role and aria-controls attribute (#38785) @xulingzhihou
84
+ - [Select] Fix MenuProps slotProps forwarding (#39177) @DiegoAndai
85
+ - [TextField] Polish types in Textfield demo (#39140) @sai6855
86
+ - [ButtonGroup] Fix rendering with conditional elements (#38989) @ZeeshanTamboli
87
+
88
+ ### `@mui/system@5.14.12`
89
+
90
+ - [system] Add support for `variants` in the styled() util (#39073) @mnajdova
91
+ - [Box] Add missing logical spacing property types (#39169) @Semigradsky
92
+
93
+ ### `@mui/base@5.0.0-beta.18`
94
+
95
+ - [useSlider] Align externalProps handling (#38854) @mj12albert
96
+ - [useTabs] Align external props handling for useTab/useTabPanel/useTabsList (#39037) @mj12albert
97
+ - [test] Fix import paths in useTab tests (#39291) @mj12albert
98
+
99
+ ### `@mui/material-next@6.0.0-alpha.104`
100
+
101
+ - [Chip] Add Material You Chip component (#38927) @DiegoAndai
102
+ - [Divider] Copy v5 Divider (#39197) @mj12albert
103
+ - [FilledInput] Copy v5 FilledInput (#39040) @mj12albert
104
+ - [FormControl] Add FormControl component (#39032) @mj12albert
105
+ - [Select] Copy Select files from v5 (#39188) @DiegoAndai
106
+ - [TextField] Copy v5 TextField's inner components (#39166) @mj12albert
107
+
108
+ ### `@mui/joy@5.0.0-beta.9`
109
+
110
+ - Introduce color inversion utilities (#38916) @siriwatknp
111
+ - Replace margin with `gap` property (#39147) @siriwatknp
112
+ - [CssBaseline] use Joy `GlobalStyles` (#39278) @siriwatknp
113
+ - [Drawer] Apply content styles from theme to content slot (#39199) @sai6855
114
+ - [List] Add gap and missing active styles (#39146) @siriwatknp
115
+ - [Switch] Slight adjustments to the design (#39276) @danilo-leal
116
+
117
+ ### Docs
118
+
119
+ - [docs] Update Autocomplete demo for React 18 (#39162) @oliviertassinari
120
+ - [docs-infra] Tweak feedback footer section design (#36556) @danilo-leal
121
+ - [docs-infra] Improve code syntax highlight (#39181) @oliviertassinari
122
+ - [docs][base] Add Tailwind CSS + plain CSS demo on the TextArea page (#39046) @alisasanib
123
+ - [docs][base-ui] Fix style for root div of multiline input (#39182) @ttlpta
124
+ - [docs][base-ui] Improve Select's country select demo (#38983) @oliviertassinari
125
+ - [docs][joy-ui] Add scrollable tabs example (#39260) @siriwatknp
126
+ - [docs][joy-ui] Match `Autocomplete` github label demo to actual github label dropdown (#39228) @sai6855
127
+ - [docs][joy-ui] Refine the Rental dashboard template (#39059) @zanivan
128
+ - [docs][joy-ui] Removed incomplete sentence in the Aspect Ratio page (#39227) @Erik-McKelvey
129
+ - [docs][joy-ui] Fix typo in the Accordion page (#39226) @Erik-McKelvey
130
+ - [docs][joy-ui] Update and standardize template Sidemenus (#39271) @zanivan
131
+ - [docs][joy-ui] Add a roadmap page (#39163) @danilo-leal
132
+ - [docs][material-ui] Replace `Box` with `Stack` in applicable demos (#39174) @sai6855
133
+ - [docs][material-ui] Add small polish to the Templates page (#39224) @danilo-leal
134
+ - [docs][material-ui] Small revision to the Icons page (#38840) @danilo-leal
135
+
136
+ ### Core
137
+
138
+ - Add next lint config to eslint (#39183) @Janpot
139
+ - [core] Update eslint rules (#39178) @romgrk
140
+ - [core] Fix Greg GitHub slug @oliviertassinari
141
+ - [core] Priority Support casing normalization @oliviertassinari
142
+ - [website] Add Heat map in pricing page (#39269) @oliviertassinari
143
+ - [website] Update `React Engineer - xCharts` Ashby link (#39172) @DanailH
144
+ - [website] Add Charts to the pricing table (#38680) @alexfauquette
145
+ - [website] Polish career experience @oliviertassinari
146
+ - [website] Simplify the Core products file (#39194) @danilo-leal
147
+
148
+ All contributors of this release in alphabetical order: @alexfauquette, @brijeshb42, @DanailH, @danilo-leal, @DiegoAndai, @Erik-McKelvey, @Janpot, @mj12albert, @mnajdova, @oliviertassinari, @romgrk, @sai6855, @Semigradsky, @siriwatknp, @xulingzhihou, @zanivan, @ZeeshanTamboli
149
+
3
150
  ## 5.14.11
4
151
 
5
152
  <!-- generated comparing v5.14.10..master -->
@@ -1,9 +1,11 @@
1
1
  import * as React from 'react';
2
- import { CSSObject, InterpolationFunction } from 'styled-components';
2
+ import { CSSObject, StyleFunction } from 'styled-components';
3
3
 
4
- export interface GlobalStylesProps<Theme = {}> {
4
+ export interface GlobalStylesProps<Theme extends object = {}> {
5
5
  defaultTheme?: object;
6
- styles: string | CSSObject | InterpolationFunction<Theme>;
6
+ styles: string | CSSObject | StyleFunction<Theme>;
7
7
  }
8
8
 
9
- export default function Global<Theme = {}>(props: GlobalStylesProps<Theme>): React.ReactElement;
9
+ export default function Global<Theme extends object = {}>(
10
+ props: GlobalStylesProps<Theme>,
11
+ ): React.ReactElement;
package/index.d.ts CHANGED
@@ -1,17 +1,68 @@
1
1
  import * as React from 'react';
2
2
  import * as CSS from 'csstype';
3
- import {
4
- AnyStyledComponent,
5
- StyledConfig,
6
- StyledComponent,
7
- StyledComponentPropsWithRef,
8
- StyledComponentInnerComponent,
9
- StyledComponentInnerOtherProps,
10
- StyledComponentInnerAttrs,
11
- ThemedStyledProps,
12
- StyledComponentBase,
13
- Keyframes,
14
- } from 'styled-components';
3
+ import * as hoistNonReactStatics from 'hoist-non-react-statics';
4
+
5
+ type WithOptionalTheme<P extends { theme?: T | undefined }, T> = OmitU<P, 'theme'> & {
6
+ theme?: T | undefined;
7
+ };
8
+
9
+ // Helper type operators
10
+ // Pick that distributes over union types
11
+ export type PickU<T, K extends keyof T> = T extends any ? { [P in K]: T[P] } : never;
12
+ export type OmitU<T, K extends keyof T> = T extends any ? PickU<T, Exclude<keyof T, K>> : never;
13
+
14
+ // Any prop that has a default prop becomes optional, but its type is unchanged
15
+ // Undeclared default props are augmented into the resulting allowable attributes
16
+ // If declared props have indexed properties, ignore default props entirely as keyof gets widened
17
+ // Wrap in an outer-level conditional type to allow distribution over props that are unions
18
+ type Defaultize<P, D> = P extends any
19
+ ? string extends keyof P
20
+ ? P
21
+ : PickU<P, Exclude<keyof P, keyof D>> &
22
+ Partial<PickU<P, Extract<keyof P, keyof D>>> &
23
+ Partial<PickU<D, Exclude<keyof D, keyof P>>>
24
+ : never;
25
+
26
+ export type IntrinsicElementsKeys = keyof JSX.IntrinsicElements;
27
+ type ReactDefaultizedProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;
28
+
29
+ type MakeAttrsOptional<
30
+ C extends string | React.ComponentType<any>,
31
+ O extends object,
32
+ A extends keyof P,
33
+ P = React.ComponentPropsWithRef<
34
+ C extends IntrinsicElementsKeys | React.ComponentType<any> ? C : never
35
+ >,
36
+ > =
37
+ // Distribute unions early to avoid quadratic expansion
38
+ P extends any ? OmitU<ReactDefaultizedProps<C, P> & O, A> & Partial<PickU<P & O, A>> : never;
39
+
40
+ export type StyledComponentProps<
41
+ // The Component from whose props are derived
42
+ C extends string | React.ComponentType<any>,
43
+ // The Theme from the current context
44
+ T extends object,
45
+ // The other props added by the template
46
+ O extends object,
47
+ // The props that are made optional by .attrs
48
+ A extends keyof any,
49
+ // The Component passed with "forwardedAs" prop
50
+ FAsC extends string | React.ComponentType<any> = C,
51
+ > =
52
+ // Distribute O if O is a union type
53
+ O extends object
54
+ ? WithOptionalTheme<MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>, T>
55
+ : never;
56
+
57
+ export interface ThemeProps<T> {
58
+ theme: T;
59
+ }
60
+
61
+ export type ThemedStyledProps<P, T> = P & ThemeProps<T>;
62
+
63
+ export interface Keyframes {
64
+ getName(): string;
65
+ }
15
66
 
16
67
  export * from 'styled-components';
17
68
  export { default } from 'styled-components';
@@ -50,11 +101,20 @@ export interface CSSOthersObjectForCSSObject {
50
101
  [propertiesName: string]: CSSInterpolation;
51
102
  }
52
103
 
53
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, CSSOthersObject {}
104
+ // Omit variants as a key, because we have a special handling for it
105
+ export interface CSSObject
106
+ extends CSSPropertiesWithMultiValues,
107
+ CSSPseudos,
108
+ Omit<CSSOthersObject, 'variants'> {}
109
+
110
+ interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
111
+ variants: Array<{ props: Props; variants: CSSObject }>;
112
+ }
54
113
 
55
114
  export type FalseyValue = undefined | null | false;
56
115
  export type Interpolation<P> =
57
116
  | InterpolationValue
117
+ | CSSObjectWithVariants<P>
58
118
  | InterpolationFunction<P>
59
119
  | FlattenInterpolation<P>;
60
120
  // cannot be made a self-referential interface, breaks WithPropNested
@@ -74,6 +134,95 @@ export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
74
134
 
75
135
  export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
76
136
 
137
+ // abuse Pick to strip the call signature from ForwardRefExoticComponent
138
+ type ForwardRefExoticBase<P> = PickU<
139
+ React.ForwardRefExoticComponent<P>,
140
+ keyof React.ForwardRefExoticComponent<any>
141
+ >;
142
+
143
+ type StyledComponentPropsWithAs<
144
+ C extends string | React.ComponentType<any>,
145
+ T extends object,
146
+ O extends object,
147
+ A extends keyof any,
148
+ AsC extends string | React.ComponentType<any> = C,
149
+ FAsC extends string | React.ComponentType<any> = C,
150
+ > = StyledComponentProps<C, T, O, A, FAsC> & {
151
+ as?: AsC | undefined;
152
+ forwardedAs?: FAsC | undefined;
153
+ };
154
+
155
+ export type StyledComponent<
156
+ C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
157
+ T extends object,
158
+ O extends object = {},
159
+ A extends keyof any = never,
160
+ > = // the "string" allows this to be used as an object key
161
+ // I really want to avoid this if possible but it's the only way to use nesting with object styles...
162
+ string &
163
+ StyledComponentBase<C, T, O, A> &
164
+ hoistNonReactStatics.NonReactStatics<C extends React.ComponentType<any> ? C : never>;
165
+
166
+ // any doesn't count as assignable to never in the extends clause, and we default A to never
167
+ export type AnyStyledComponent =
168
+ | StyledComponent<any, any, any, any>
169
+ | StyledComponent<any, any, any>;
170
+
171
+ export type StyledComponentInnerComponent<C extends React.ComponentType<any>> =
172
+ C extends StyledComponent<infer I, any, any, any>
173
+ ? I
174
+ : C extends StyledComponent<infer I, any, any>
175
+ ? I
176
+ : C;
177
+
178
+ export type StyledComponentInnerOtherProps<C extends AnyStyledComponent> =
179
+ C extends StyledComponent<any, any, infer O, any>
180
+ ? O
181
+ : C extends StyledComponent<any, any, infer O>
182
+ ? O
183
+ : never;
184
+ export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<
185
+ any,
186
+ any,
187
+ any,
188
+ infer A
189
+ >
190
+ ? A
191
+ : never;
192
+
193
+ export interface StyledComponentBase<
194
+ C extends string | React.ComponentType<any>,
195
+ T extends object,
196
+ O extends object = {},
197
+ A extends keyof any = never,
198
+ > extends ForwardRefExoticBase<StyledComponentProps<C, T, O, A>> {
199
+ // add our own fake call signature to implement the polymorphic 'as' prop
200
+ (
201
+ props: StyledComponentProps<C, T, O, A> & {
202
+ as?: never | undefined;
203
+ forwardedAs?: never | undefined;
204
+ },
205
+ ): React.ReactElement<StyledComponentProps<C, T, O, A>>;
206
+ <
207
+ AsC extends string | React.ComponentType<any> = C,
208
+ FAsC extends string | React.ComponentType<any> = AsC,
209
+ >(
210
+ props: StyledComponentPropsWithAs<AsC, T, O, A, AsC, FAsC>,
211
+ ): React.ReactElement<StyledComponentPropsWithAs<AsC, T, O, A, AsC, FAsC>>;
212
+
213
+ withComponent<WithC extends AnyStyledComponent>(
214
+ component: WithC,
215
+ ): StyledComponent<
216
+ StyledComponentInnerComponent<WithC>,
217
+ T,
218
+ O & StyledComponentInnerOtherProps<WithC>,
219
+ A | StyledComponentInnerAttrs<WithC>
220
+ >;
221
+ withComponent<WithC extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(
222
+ component: WithC,
223
+ ): StyledComponent<WithC, T, O, A>;
224
+ }
225
+
77
226
  // remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
78
227
  type StyledComponentInterpolation =
79
228
  | Pick<StyledComponentBase<any, any, any, any>, keyof StyledComponentBase<any, any>>
@@ -87,6 +236,12 @@ type ThemedStyledComponentFactories<T extends object> = {
87
236
  [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
88
237
  };
89
238
 
239
+ export type StyledComponentPropsWithRef<
240
+ C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
241
+ > = C extends AnyStyledComponent
242
+ ? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>>
243
+ : React.ComponentPropsWithRef<C>;
244
+
90
245
  // Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
91
246
  export interface ThemedStyledFunctionBase<
92
247
  C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
@@ -119,6 +274,16 @@ export interface ThemedStyledFunction<
119
274
  A extends keyof any = never,
120
275
  > extends ThemedStyledFunctionBase<C, T, O, A> {}
121
276
 
277
+ // Config to be used with withConfig
278
+ export interface StyledConfig<O extends object = {}> {
279
+ // TODO: Add all types from the original StyledComponentWrapperProperties
280
+ componentId?: string;
281
+ displayName?: string;
282
+ shouldForwardProp?:
283
+ | ((prop: keyof O, defaultValidatorFn: (prop: keyof O) => boolean) => boolean)
284
+ | undefined;
285
+ }
286
+
122
287
  // same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
123
288
  export interface ThemedBaseStyledInterface<
124
289
  MUIStyledCommonProps extends object,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.11
2
+ * @mui/styled-engine-sc v6.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.11
2
+ * @mui/styled-engine-sc v6.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.11
2
+ * @mui/styled-engine-sc v6.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -20,8 +20,7 @@ const GlobalStyles = (0, _styledComponents.createGlobalStyle)(props => {
20
20
  }
21
21
  return styles;
22
22
  });
23
- var _default = GlobalStyles;
24
- exports.default = _default;
23
+ var _default = exports.default = GlobalStyles;
25
24
  GlobalStyles.propTypes = {
26
25
  defaultTheme: _propTypes.default.object,
27
26
  styles: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string, _propTypes.default.object, _propTypes.default.func])
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.11
2
+ * @mui/styled-engine-sc v6.0.0-alpha.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine-sc",
3
- "version": "5.14.11",
3
+ "version": "6.0.0-alpha.1",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "styled() API wrapper package for styled-components.",
@@ -26,18 +26,12 @@
26
26
  "url": "https://opencollective.com/mui"
27
27
  },
28
28
  "dependencies": {
29
- "@babel/runtime": "^7.22.15",
29
+ "@babel/runtime": "^7.23.1",
30
30
  "csstype": "^3.1.2",
31
31
  "prop-types": "^15.8.1"
32
32
  },
33
33
  "peerDependencies": {
34
- "@types/styled-components": "^5.1.14",
35
- "styled-components": "^5.3.1"
36
- },
37
- "peerDependenciesMeta": {
38
- "@types/styled-components": {
39
- "optional": true
40
- }
34
+ "styled-components": "^6.0.0"
41
35
  },
42
36
  "sideEffects": false,
43
37
  "publishConfig": {