@mui/styled-engine-sc 5.14.12 → 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,70 @@
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
+
3
68
  ## 5.14.12
4
69
 
5
70
  <!-- generated comparing v5.14.11..master -->
@@ -10,6 +75,7 @@ A big thanks to the 17 contributors who made this release possible. Here are som
10
75
 
11
76
  - 🎨 Introduced color inversion utilities to Joy UI (#38916) @siriwatknp
12
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
13
79
 
14
80
  ### `@mui/material@5.14.12`
15
81
 
@@ -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';
@@ -83,6 +134,95 @@ export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
83
134
 
84
135
  export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
85
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
+
86
226
  // remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
87
227
  type StyledComponentInterpolation =
88
228
  | Pick<StyledComponentBase<any, any, any, any>, keyof StyledComponentBase<any, any>>
@@ -96,6 +236,12 @@ type ThemedStyledComponentFactories<T extends object> = {
96
236
  [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T>;
97
237
  };
98
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
+
99
245
  // Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
100
246
  export interface ThemedStyledFunctionBase<
101
247
  C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
@@ -128,6 +274,16 @@ export interface ThemedStyledFunction<
128
274
  A extends keyof any = never,
129
275
  > extends ThemedStyledFunctionBase<C, T, O, A> {}
130
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
+
131
287
  // same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
132
288
  export interface ThemedBaseStyledInterface<
133
289
  MUIStyledCommonProps extends object,
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.12
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.12
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.12
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/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v5.14.12
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.12",
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.",
@@ -31,13 +31,7 @@
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": {