@mui/styled-engine-sc 6.0.0-alpha.2 → 6.0.0-alpha.20

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/README.md CHANGED
@@ -7,4 +7,4 @@ It's designed for developers who would like to use `styled-components` as the ma
7
7
 
8
8
  <!-- #default-branch-switch -->
9
9
 
10
- Visit [https://mui.com/material-ui/guides/styled-components/](https://mui.com/material-ui/guides/styled-components/) to view the full documentation.
10
+ Visit [https://next.mui.com/material-ui/integrations/styled-components/](https://next.mui.com/material-ui/integrations/styled-components/) to view the full documentation.
package/index.d.ts CHANGED
@@ -108,7 +108,10 @@ export interface CSSObject
108
108
  Omit<CSSOthersObject, 'variants'> {}
109
109
 
110
110
  interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
111
- variants: Array<{ props: Props; variants: CSSObject }>;
111
+ variants: Array<{
112
+ props: Props | ((props: Props) => boolean);
113
+ style: CSSObject;
114
+ }>;
112
115
  }
113
116
 
114
117
  export type FalseyValue = undefined | null | false;
@@ -170,31 +173,21 @@ export type AnyStyledComponent =
170
173
  | React.FunctionComponent<any>
171
174
  | React.ComponentType<any>;
172
175
 
173
- export type StyledComponentInnerComponent<C extends AnyStyledComponent> = C extends StyledComponent<
174
- infer I,
175
- any,
176
- any,
177
- any
178
- >
179
- ? I
180
- : C extends StyledComponent<infer I, any, any>
181
- ? I
182
- : C;
176
+ export type StyledComponentInnerComponent<C extends AnyStyledComponent> =
177
+ C extends StyledComponent<infer I, any, any, any>
178
+ ? I
179
+ : C extends StyledComponent<infer I, any, any>
180
+ ? I
181
+ : C;
183
182
 
184
183
  export type StyledComponentInnerOtherProps<C extends AnyStyledComponent> =
185
184
  C extends StyledComponent<any, any, infer O, any>
186
185
  ? O
187
186
  : C extends StyledComponent<any, any, infer O>
188
- ? O
189
- : never;
190
- export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<
191
- any,
192
- any,
193
- any,
194
- infer A
195
- >
196
- ? A
197
- : never;
187
+ ? O
188
+ : never;
189
+ export type StyledComponentInnerAttrs<C extends AnyStyledComponent> =
190
+ C extends StyledComponent<any, any, any, infer A> ? A : never;
198
191
 
199
192
  export interface StyledComponentBase<
200
193
  C extends string | React.ComponentType<any>,
@@ -292,32 +285,85 @@ export interface StyledConfig<O extends object = {}> {
292
285
  // TODO: Add all types from the original StyledComponentWrapperProperties
293
286
  componentId?: string;
294
287
  displayName?: string;
288
+ label?: string;
289
+ target?: string;
295
290
  shouldForwardProp?:
296
291
  | ((prop: keyof O, defaultValidatorFn: (prop: keyof O) => boolean) => boolean)
297
292
  | undefined;
298
293
  }
299
294
 
295
+ /** Same as StyledConfig but shouldForwardProp must be a type guard */
296
+ export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
297
+ componentId?: string;
298
+ displayName?: string;
299
+ label?: string;
300
+ shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
301
+ target?: string;
302
+ }
303
+
300
304
  // same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
301
305
  export interface ThemedBaseStyledInterface<
302
306
  MUIStyledCommonProps extends object,
303
307
  MuiStyledOptions extends object,
304
- T extends object,
305
- > extends ThemedStyledComponentFactories<T> {
306
- <C extends AnyStyledComponent>(
308
+ Theme extends object,
309
+ > extends ThemedStyledComponentFactories<Theme> {
310
+ <
311
+ C extends React.ComponentClass<React.ComponentProps<C>>,
312
+ ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>,
313
+ >(
307
314
  component: C,
308
- options?: StyledConfig<any> & MuiStyledOptions,
309
- ): ThemedStyledFunction<
310
- StyledComponentInnerComponent<C>,
311
- T,
312
- StyledComponentInnerOtherProps<C> & MUIStyledCommonProps,
313
- StyledComponentInnerAttrs<C>
315
+ options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions,
316
+ ): CreateStyledComponent<
317
+ Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps,
318
+ {},
319
+ {
320
+ ref?: React.Ref<InstanceType<C>>;
321
+ },
322
+ Theme
323
+ >;
324
+
325
+ <C extends React.ComponentClass<React.ComponentProps<C>>>(
326
+ component: C,
327
+ options?: StyledConfig<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions,
328
+ ): CreateStyledComponent<
329
+ PropsOf<C> & MUIStyledCommonProps,
330
+ {},
331
+ {
332
+ ref?: React.Ref<InstanceType<C>>;
333
+ },
334
+ Theme
314
335
  >;
315
- <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(
316
- // unfortunately using a conditional type to validate that it can receive a `theme?: Theme`
317
- // causes tests to fail in TS 3.1
336
+
337
+ <
338
+ C extends React.JSXElementConstructor<React.ComponentProps<C>>,
339
+ ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>,
340
+ >(
341
+ component: C,
342
+ options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions,
343
+ ): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {}, Theme>;
344
+
345
+ <C extends React.JSXElementConstructor<React.ComponentProps<C>>>(
318
346
  component: C,
319
- options?: StyledConfig<any> & MuiStyledOptions,
320
- ): ThemedStyledFunction<C, T, MUIStyledCommonProps>;
347
+ options?: StyledConfig<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions,
348
+ ): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {}, Theme>;
349
+
350
+ <
351
+ Tag extends keyof JSX.IntrinsicElements,
352
+ ForwardedProps extends keyof JSX.IntrinsicElements[Tag] = keyof JSX.IntrinsicElements[Tag],
353
+ >(
354
+ tag: Tag,
355
+ options: FilteringStyledOptions<JSX.IntrinsicElements[Tag], ForwardedProps> & MuiStyledOptions,
356
+ ): CreateStyledComponent<
357
+ MUIStyledCommonProps,
358
+ Pick<JSX.IntrinsicElements[Tag], ForwardedProps>,
359
+ {},
360
+ Theme
361
+ >;
362
+
363
+ <Tag extends keyof JSX.IntrinsicElements>(
364
+ tag: Tag,
365
+ options?: StyledConfig<MUIStyledCommonProps> & MuiStyledOptions,
366
+ ): CreateStyledComponent<MUIStyledCommonProps, JSX.IntrinsicElements[Tag], {}, Theme>;
321
367
  }
322
368
 
323
369
  export type CreateMUIStyled<
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v6.0.0-alpha.2
2
+ * @mui/styled-engine-sc v6.0.0-alpha.20
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 v6.0.0-alpha.2
2
+ * @mui/styled-engine-sc v6.0.0-alpha.20
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 v6.0.0-alpha.2
2
+ * @mui/styled-engine-sc v6.0.0-alpha.20
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 v6.0.0-alpha.2
2
+ * @mui/styled-engine-sc v6.0.0-alpha.20
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -46,8 +46,8 @@ Object.defineProperty(exports, "keyframes", {
46
46
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
47
47
  var _StyledEngineProvider = _interopRequireDefault(require("./StyledEngineProvider"));
48
48
  var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
49
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
50
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
49
+ 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); }
50
+ 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 && {}.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; }
51
51
  function styled(tag, options) {
52
52
  let stylesFactory;
53
53
  if (options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine-sc",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-alpha.20",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "styled() API wrapper package for styled-components.",
@@ -20,14 +20,14 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/mui/material-ui/issues"
22
22
  },
23
- "homepage": "https://mui.com/material-ui/guides/styled-components/",
23
+ "homepage": "https://mui.com/material-ui/integrations/styled-components/",
24
24
  "funding": {
25
25
  "type": "opencollective",
26
- "url": "https://opencollective.com/mui"
26
+ "url": "https://opencollective.com/mui-org"
27
27
  },
28
28
  "dependencies": {
29
- "@babel/runtime": "^7.23.1",
30
- "csstype": "^3.1.2",
29
+ "@babel/runtime": "^7.24.4",
30
+ "csstype": "^3.1.3",
31
31
  "hoist-non-react-statics": "^3.3.2",
32
32
  "prop-types": "^15.8.1"
33
33
  },
@@ -36,7 +36,8 @@
36
36
  },
37
37
  "sideEffects": false,
38
38
  "publishConfig": {
39
- "access": "public"
39
+ "access": "public",
40
+ "directory": "build"
40
41
  },
41
42
  "engines": {
42
43
  "node": ">=12.0.0"