@mui/styled-engine-sc 7.0.1 → 7.1.0

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,162 @@
1
1
  # [Versions](https://mui.com/versions/)
2
2
 
3
+ ## 7.1.0
4
+
5
+ <!-- generated comparing v7.0.2..master -->
6
+
7
+ _May 6, 2025_
8
+
9
+ A big thanks to the 21 contributors who made this release possible. Here are some highlights ✨:
10
+
11
+ - 🎉 Material UI now works with **Tailwind CSS v4**! Check out the [setup guide](https://mui.com/material-ui/integrations/tailwindcss/tailwindcss-v4/).
12
+
13
+ ### `@mui/material@7.1.0`
14
+
15
+ - [InputBase] Text cursor jumps several lines up when inserting text fragment with new line at the end (#45246) @yermartee
16
+ - [OutlinedInput] Add missing `notchedOutline` slot (#45917) @siriwatknp
17
+ - [Snackbar] Skip default `onClickAway` behavior when `defaultMuiPrevented` is provided (#45629) @sai6855
18
+ - [Avatar] Fix img slot types and add missing slots (#45483) @siriwatknp
19
+ - [Badge] Replace useSlotProps with useSlot hook (#45871) @sai6855
20
+ - [BottomNavigationAction] Add slots and slotProps (#45776) @sai6855
21
+ - [CardActionArea] Add slots and slotProps (#45866) @sai6855
22
+ - [useMediaQuery] Add warning and docs for using `useMediaQuery('print')` (#44790) @good-jinu
23
+ - Remove unnecessary clsx usages (#46084) @sai6855
24
+ - Corrected generic type definition in `SelectChangeEvent` (#45941) @SuyashShukla0007
25
+ - Fix theme object changes between renders (#45863) @siriwatknp
26
+
27
+ ### `@mui/material-nextjs@7.1.0`
28
+
29
+ - Add option to enable CSS layers for pages router (#45596) @siriwatknp
30
+ - Do not wrap `@layer` order rules in App Router (#45864) @Nayeem-XTREME
31
+
32
+ ### `@mui/system@7.1.0`
33
+
34
+ - Fix `@mui/system` types organization (#45860) @Janpot
35
+
36
+ ### `@mui/styled-engine@7.1.0`
37
+
38
+ - Infer `ownerState` from props in `styled` (#46083) @siriwatknp
39
+ - Fix style overrides variants type (#45478) @siriwatknp
40
+
41
+ ### Docs
42
+
43
+ - [Avatar] Add avatar upload demo (#45986) @Demianeen
44
+ - [Dialog] Remove deprecated props usage in demos (#45923) @sai6855
45
+ - [Menu] Update `paper` slot JSDoc default from `Paper` to `PopoverPaper` (#45722) @andreachiera
46
+ - [examples] Remove create-react-app usages (#45426) @CodeLeom
47
+ - Add `AccordionSummary` to the v5 breaking change migration (#45947) @siriwatknp
48
+ - Update CSS variable usage in migration guide for Pigment CSS (#46033) @sai6855
49
+ - Fix docs API dark mode color (#46086) @alexfauquette
50
+ - Add a guide for extending Material UI classes in Tailwind CSS (#46039) @siriwatknp
51
+ - Add `InitColorSchemeScript` docs and API (#45927) @siriwatknp
52
+ - Add Tailwind CSS v4 integration guide (#45906) @siriwatknp
53
+ - Fix 301 links to the system v6 (#45931) @oliviertassinari
54
+ - Add notification for MUI X v8 announcement (#45942) @joserodolfofreitas
55
+ - Fix som 301 redirections (ae84b35) @oliviertassinari
56
+ - Fix some 301 redirections (057384e) @oliviertassinari
57
+ - Fix logo is not centered on small screens (#45920) @crabsim
58
+ - Fix line break typo (a2a62d5) @oliviertassinari
59
+ - Fix markdown typo in templates.md (#45914) @scyzoryck
60
+ - Add Next.js App Router guide for custom classnames (#45852) @siriwatknp
61
+
62
+ ### Core
63
+
64
+ - [code-infra] Give a stable name to dev tool app (3889ded) @oliviertassinari
65
+ - [code-infra] Normalize author package in org (8135638) @oliviertassinari
66
+ - [code-infra] Correct some manually curated .d.ts files (#46054) @Janpot
67
+ - [code-infra] Align deps versions (#46048) @Janpot
68
+ - [code-infra] Fix dynamic import in imports resolver (#46046) @Janpot
69
+ - [code-infra] Eliminate `@mui/utils` deep imports (#46004) @Janpot
70
+ - [code-infra] Expand renovate.json for react types (#45935) @Janpot
71
+ - [code-infra] Make Argos upload script reusable (#45883) @Janpot
72
+ - [code-infra] Disallow redundant window prefixes for globals (#45880) @Janpot
73
+ - [code-infra] Remove type generation of modern build (#45912) @Janpot
74
+ - [code-infra] Clean up bundle size checker (#45622) @Janpot
75
+ - [code-infra] Fix `StrictMode` effects not being called twice in React 19 tests (#45812) @bernardobelchior
76
+ - [code-infra] Convert `@mui/utils` to typescript (#45671) @Janpot
77
+ - [docs-infra] Improve export into sandbox package.json (#46044) @oliviertassinari
78
+ - [docs-infra] Update feedback Node.js to v22 (#46064) @oliviertassinari
79
+ - [docs-infra] Normalize netlify.toml in org (b101d5c) @oliviertassinari
80
+ - [docs-infra] Uniformize Vale between repositories (0f79796) @oliviertassinari
81
+ - [docs-infra] Fix Vale no longer working (#46029) @oliviertassinari
82
+ - [docs-infra] Remove demo styling switch (#45926) @Janpot
83
+ - [docs-infra] StackBlitz WebContainer demos (#45924) @Janpot
84
+ - [docs-infra] Fix feedback management (#45872) @alexfauquette
85
+ - [test] Replace `playwright` with `@playwright/test` (#45998) @ZeeshanTamboli
86
+ - Fix internal version duplication (#46051) @oliviertassinari
87
+ - Avoid the need for `@mui/material/themeCssVarsAugmentation` (#46053) @Janpot
88
+ - Add security label to dependabot PRs (0a5c027) @oliviertassinari
89
+ - Remove unecessary versions (#46034) @oliviertassinari
90
+ - Remove redundant overrides resolver (#45970) @romgrk
91
+ - Fix duplicate branch reference (#45915) @oliviertassinari
92
+ - Fix outdated <link rel="shortcut icon" (#45916) @oliviertassinari
93
+ - Fix redirection chains (#45930) @oliviertassinari
94
+ - Run pnpm docs:sync-team (beee09f) @oliviertassinari
95
+ - Add `pkg.pr.new` publishing (#42984) @Aslemammad
96
+ - Remove @mui/base from the master branch (#45857) @mnajdova
97
+
98
+ All contributors of this release in alphabetical order: @alexfauquette, @andreachiera, @Aslemammad, @bernardobelchior, @CodeLeom, @crabsim, @Demianeen, @good-jinu, @Janpot, @joserodolfofreitas, @mnajdova, @Nayeem-XTREME, @oliviertassinari, @renovate[bot], @romgrk, @sai6855, @scyzoryck, @siriwatknp, @SuyashShukla0007, @yermartee, @ZeeshanTamboli
99
+
100
+ ## 7.0.2
101
+
102
+ _Apr 9, 2025_
103
+
104
+ A big thanks to the 12 contributors who made this release possible.
105
+
106
+ ### `@mui/material@7.0.2`
107
+
108
+ - [Autocomplete] Add ability to render custom single value (#45387) @ZeeshanTamboli
109
+ - [Autocomplete] Prevent shrink animation in controlled Autocomplete when initial `value` is provided (#45734) @imadx
110
+ - [AvatarGroup] Fix `spacing` prop ignoring value `0` (#45799) @Kartik-Murthy
111
+ - [Dialog] Deprecate composed classes (#45418) @sai6855
112
+
113
+ ### `@mui/material-nextjs@7.0.2`
114
+
115
+ - Fix nonce issues (#45794) @Janpot
116
+ - Add warnings to nextjs router integration (#45778) @Janpot
117
+
118
+ ### `@mui/styled-engine@7.0.2`
119
+
120
+ - Added caching to `StyledEngineProvider` to improve performance for running tests with Jest (#45846) @siriwatknp
121
+
122
+ ### Core
123
+
124
+ - [blog] Improve upvote video (0646444) @oliviertassinari
125
+ - [code-infra] Remove webpack aliases (#45841) @Janpot
126
+ - [code-infra] Remove .tsbuildinfo from build folder (#45727) @Janpot
127
+ - [code-infra] Stabilize theme viewer screenshot tests (#45768) @Janpot
128
+ - [code-infra] Remove modern bundles (#45808) @Janpot
129
+ - Update buildTypes script to optionally remove css imports (#45835) @brijeshb42
130
+ - Allow repo to be accepted as an argument for releaseTag (#45801) @brijeshb42
131
+ - Update scripts to support base-ui (#45784) @brijeshb42
132
+ - Sync scorecards.yml across codebase (4de5076) @oliviertassinari
133
+ - Remove baseUrl and skipLibCheck (#45806) @Janpot
134
+ - [docs-infra] Fix redirect styles pages (#45848) @siriwatknp
135
+ - [docs-infra] Remove false-positive Vale rules (#45843) @oliviertassinari
136
+ - [docs-infra] Make sure Next.js can find package.json through its aliases (#45840) @Janpot
137
+ - [docs-infra] Fix Next.js brand name coverage (6915f8d) @oliviertassinari
138
+ - [docs-infra] Fix layout shift between MIT and commercial pages (#45760) @oliviertassinari
139
+ - [docs-infra] Non breaking space for ESM (#45758) @oliviertassinari
140
+ - [support-infra] Remove dead 'workflow_call:' (#45736) @oliviertassinari
141
+ - [utils] Support cleanup callbacks in useForkRef (#45621) @DiegoAndai
142
+
143
+ ### Docs
144
+
145
+ - Fix pigment vite integration example (#44746) @brijeshb42
146
+ - Update migration instructions and codemod references for deprecated APIs (#45793) @sai6855
147
+ - Add TanStack Router routing example (#44930) @vetledv
148
+ - Fix layout shifting in icons page (#45779) @sai6855
149
+ - Fix migration instructions (#45762) @oliviertassinari
150
+ - Fix wrong TypeScript support version (#45761) @oliviertassinari
151
+ - Fix link to mui-joy/src/styles/components.d.ts (#45763) @oliviertassinari
152
+ - Fix 301 link (ae94c40) @oliviertassinari
153
+ - Fix 301 links (abd8f63) @oliviertassinari
154
+ - Fix 301 redirection (c7658de) @oliviertassinari
155
+ - [nextjs] Migrate from deprecated "legacyBehavior" prop (#44871) @oliviertassinari
156
+ - [nextjs] Document CSP for Next.js Pages Router (#45798) @Grohden
157
+
158
+ All contributors of this release in alphabetical order: @brijeshb42, @DiegoAndai, @Grohden, @imadx, @Janpot, @Kartik-Murthy, @oliviertassinari, @renovate[bot], @sai6855, @siriwatknp, @vetledv, @ZeeshanTamboli
159
+
3
160
  ## 7.0.1
4
161
 
5
162
  <!-- generated comparing v7.0.0..master -->
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v7.0.1
2
+ * @mui/styled-engine-sc v7.1.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/styled-engine-sc v7.0.1
2
+ * @mui/styled-engine-sc v7.1.0
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,7 +1,6 @@
1
1
  {
2
2
  "name": "@mui/styled-engine-sc",
3
- "version": "7.0.1",
4
- "private": false,
3
+ "version": "7.1.0",
5
4
  "author": "MUI Team",
6
5
  "description": "styled() API wrapper package for styled-components.",
7
6
  "main": "./index.js",
@@ -26,7 +25,7 @@
26
25
  "url": "https://opencollective.com/mui-org"
27
26
  },
28
27
  "dependencies": {
29
- "@babel/runtime": "^7.26.10",
28
+ "@babel/runtime": "^7.27.1",
30
29
  "@types/hoist-non-react-statics": "^3.3.6",
31
30
  "csstype": "^3.1.3",
32
31
  "hoist-non-react-statics": "^3.3.2",
@@ -43,6 +42,7 @@
43
42
  "engines": {
44
43
  "node": ">=14.0.0"
45
44
  },
45
+ "private": false,
46
46
  "module": "./esm/index.js",
47
47
  "exports": {
48
48
  "./package.json": "./package.json",
@@ -54,10 +54,6 @@
54
54
  "import": {
55
55
  "types": "./esm/index.d.ts",
56
56
  "default": "./esm/index.js"
57
- },
58
- "mui-modern": {
59
- "types": "./modern/index.d.ts",
60
- "default": "./modern/index.js"
61
57
  }
62
58
  },
63
59
  "./*": {
@@ -68,10 +64,6 @@
68
64
  "import": {
69
65
  "types": "./esm/*/index.d.ts",
70
66
  "default": "./esm/*/index.js"
71
- },
72
- "mui-modern": {
73
- "types": "./modern/*/index.d.ts",
74
- "default": "./modern/*/index.js"
75
67
  }
76
68
  },
77
69
  "./esm": null,
@@ -1,7 +0,0 @@
1
- import * as React from 'react';
2
- import { CSSObject, StyleFunction } from 'styled-components';
3
- export interface GlobalStylesProps<Theme extends object = {}> {
4
- defaultTheme?: object;
5
- styles: string | CSSObject | StyleFunction<Theme>;
6
- }
7
- export default function Global<Theme extends object = {}>(props: GlobalStylesProps<Theme>): React.JSX.Element;
@@ -1,20 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import { createGlobalStyle } from 'styled-components';
3
- function isEmpty(obj) {
4
- return obj === undefined || obj === null || Object.keys(obj).length === 0;
5
- }
6
- const GlobalStyles = createGlobalStyle(props => {
7
- const {
8
- styles,
9
- defaultTheme = {}
10
- } = props;
11
- if (typeof styles === 'function') {
12
- return styles(isEmpty(props.theme) ? defaultTheme : props.theme);
13
- }
14
- return styles;
15
- });
16
- export default GlobalStyles;
17
- GlobalStyles.propTypes = {
18
- defaultTheme: PropTypes.object,
19
- styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
20
- };
@@ -1,2 +0,0 @@
1
- export { default } from "./GlobalStyles.js";
2
- export * from "./GlobalStyles.js";
@@ -1 +0,0 @@
1
- export { default } from "./GlobalStyles.js";
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- export interface StyledEngineProviderProps {
3
- children?: React.ReactNode;
4
- injectFirst?: boolean;
5
- }
6
- export default function StyledEngineProvider(props: StyledEngineProviderProps): React.JSX.Element;
@@ -1,28 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- export default function StyledEngineProvider(props) {
3
- const {
4
- injectFirst,
5
- children
6
- } = props;
7
- if (injectFirst && typeof window !== 'undefined') {
8
- const head = document.head;
9
- if (!head.querySelector('[data-styled="active"]')) {
10
- const injectFirstNode = document.createElement('style');
11
- injectFirstNode.setAttribute('data-styled', 'active');
12
- head.insertBefore(injectFirstNode, head.firstChild);
13
- }
14
- }
15
- return children;
16
- }
17
- StyledEngineProvider.propTypes = {
18
- /**
19
- * Your component tree.
20
- */
21
- children: PropTypes.node,
22
- /**
23
- * By default, the styles are injected last in the <head> element of the page.
24
- * As a result, they gain more specificity than any other style sheet.
25
- * If you want to override MUI's styles, set this prop.
26
- */
27
- injectFirst: PropTypes.bool
28
- };
@@ -1,2 +0,0 @@
1
- export { default } from "./StyledEngineProvider.js";
2
- export * from "./StyledEngineProvider.js";
@@ -1 +0,0 @@
1
- export { default } from "./StyledEngineProvider.js";
package/modern/index.d.ts DELETED
@@ -1,193 +0,0 @@
1
- import * as React from 'react';
2
- import * as CSS from 'csstype';
3
- import * as hoistNonReactStatics from 'hoist-non-react-statics';
4
- type WithOptionalTheme<P extends {
5
- theme?: T | undefined;
6
- }, T> = OmitU<P, 'theme'> & {
7
- theme?: T | undefined;
8
- };
9
-
10
- // Helper type operators
11
- // Pick that distributes over union types
12
- export type PickU<T, K extends keyof T> = T extends any ? { [P in K]: T[P] } : never;
13
- export type OmitU<T, K extends keyof T> = T extends any ? PickU<T, Exclude<keyof T, K>> : never;
14
-
15
- // Any prop that has a default prop becomes optional, but its type is unchanged
16
- // Undeclared default props are augmented into the resulting allowable attributes
17
- // If declared props have indexed properties, ignore default props entirely as keyof gets widened
18
- // Wrap in an outer-level conditional type to allow distribution over props that are unions
19
- type Defaultize<P, D> = P extends any ? string extends keyof P ? P : PickU<P, Exclude<keyof P, keyof D>> & Partial<PickU<P, Extract<keyof P, keyof D>>> & Partial<PickU<D, Exclude<keyof D, keyof P>>> : never;
20
- export type IntrinsicElementsKeys = keyof React.JSX.IntrinsicElements;
21
- type ReactDefaultizedProps<C, P> = C extends {
22
- defaultProps: infer D;
23
- } ? Defaultize<P, D> : P;
24
- type MakeAttrsOptional<C extends string | React.ComponentType<any>, O extends object, A extends keyof P, P = React.ComponentPropsWithRef<C extends IntrinsicElementsKeys | React.ComponentType<any> ? C : never>> =
25
- // Distribute unions early to avoid quadratic expansion
26
- P extends any ? OmitU<ReactDefaultizedProps<C, P> & O, A> & Partial<PickU<P & O, A>> : never;
27
- export type StyledComponentProps<
28
- // The Component from whose props are derived
29
- C extends string | React.ComponentType<any>,
30
- // The Theme from the current context
31
- T extends object,
32
- // The other props added by the template
33
- O extends object,
34
- // The props that are made optional by .attrs
35
- A extends keyof any,
36
- // The Component passed with "forwardedAs" prop
37
- FAsC extends string | React.ComponentType<any> = C> =
38
- // Distribute O if O is a union type
39
- O extends object ? WithOptionalTheme<MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>, T> : never;
40
- export interface ThemeProps<T> {
41
- theme: T;
42
- }
43
- export type ThemedStyledProps<P, T> = P & ThemeProps<T>;
44
- export interface Keyframes {
45
- getName(): string;
46
- }
47
- export * from 'styled-components';
48
- export { default } from 'styled-components';
49
- export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
50
- export { default as GlobalStyles } from "./GlobalStyles/index.js";
51
- export * from "./GlobalStyles/index.js";
52
-
53
- /**
54
- * For internal usage in `@mui/system` package
55
- */
56
- // eslint-disable-next-line @typescript-eslint/naming-convention
57
- export function internal_mutateStyles(tag: React.ElementType, processor: (styles: any) => any): void;
58
-
59
- // Not needed anymore, but fixes https://github.com/mui/material-ui/issues/44112
60
- // TODO: Remove it in v7
61
- // eslint-disable-next-line @typescript-eslint/naming-convention
62
- export function internal_processStyles(tag: React.ElementType, processor: (styles: any) => any): void;
63
-
64
- // eslint-disable-next-line @typescript-eslint/naming-convention
65
- export function internal_serializeStyles<P>(styles: Interpolation<P>): object;
66
-
67
- // These are the same as the ones in @mui/styled-engine
68
- // CSS.PropertiesFallback are necessary so that we support spreading of the mixins. For example:
69
- // '@font-face'?: Fontface | Fontface[]
70
- export type CSSProperties = CSS.PropertiesFallback<number | string>;
71
- export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: CSSProperties[K] | Array<Extract<CSSProperties[K], string>> };
72
- export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
73
- export interface CSSOthersObject {
74
- [propertiesName: string]: unknown | CSSInterpolation;
75
- }
76
- export type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
77
- export interface ArrayCSSInterpolation extends Array<CSSInterpolation> {}
78
- export interface CSSOthersObjectForCSSObject {
79
- [propertiesName: string]: CSSInterpolation;
80
- }
81
-
82
- // Omit variants as a key, because we have a special handling for it
83
- export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
84
- interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
85
- variants: Array<{
86
- props: Props | ((props: Props) => boolean);
87
- style: CSSObject | ((args: Props extends {
88
- theme: any;
89
- } ? {
90
- theme: Props['theme'];
91
- } : any) => CSSObject);
92
- }>;
93
- }
94
- export type FalseyValue = undefined | null | false;
95
- export type Interpolation<P> = InterpolationValue | CSSObjectWithVariants<P> | InterpolationFunction<P> | FlattenInterpolation<P>;
96
- // cannot be made a self-referential interface, breaks WithPropNested
97
- // see https://github.com/microsoft/TypeScript/issues/34796
98
- export type FlattenInterpolation<P> = ReadonlyArray<Interpolation<P>>;
99
- export type InterpolationValue = string | number | FalseyValue | Keyframes | StyledComponentInterpolation | CSSObject;
100
- export type SimpleInterpolation = InterpolationValue | FlattenSimpleInterpolation;
101
- // adapter for compatibility with @mui/styled-engine
102
- export type CSSInterpolation = SimpleInterpolation;
103
- export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
104
- export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
105
-
106
- // abuse Pick to strip the call signature from ForwardRefExoticComponent
107
- type ForwardRefExoticBase<P> = PickU<React.ForwardRefExoticComponent<P>, keyof React.ForwardRefExoticComponent<any>>;
108
- type StyledComponentPropsWithAs<C extends string | React.ComponentType<any>, T extends object, O extends object, A extends keyof any, AsC extends string | React.ComponentType<any> = C, FAsC extends string | React.ComponentType<any> = C> = StyledComponentProps<C, T, O, A, FAsC> & {
109
- as?: AsC | undefined;
110
- forwardedAs?: FAsC | undefined;
111
- };
112
- export type StyledComponent<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object = {}, O extends object = {}, A extends keyof any = never> =
113
- // the "string" allows this to be used as an object key
114
- // I really want to avoid this if possible but it's the only way to use nesting with object styles...
115
- string & StyledComponentBase<C, T, O, A> & hoistNonReactStatics.NonReactStatics<C extends React.ComponentType<any> ? C : never>;
116
-
117
- // any doesn't count as assignable to never in the extends clause, and we default A to never
118
- export type AnyStyledComponent = StyledComponent<any, any, any, any> | StyledComponent<any, any, any> | React.FunctionComponent<any> | React.ComponentType<any>;
119
- export type StyledComponentInnerComponent<C extends AnyStyledComponent> = C extends StyledComponent<infer I, any, any, any> ? I : C extends StyledComponent<infer I, any, any> ? I : C;
120
- export type StyledComponentInnerOtherProps<C extends AnyStyledComponent> = C extends StyledComponent<any, any, infer O, any> ? O : C extends StyledComponent<any, any, infer O> ? O : never;
121
- export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<any, any, any, infer A> ? A : never;
122
- export interface StyledComponentBase<C extends string | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> extends ForwardRefExoticBase<StyledComponentProps<C, T, O, A>> {
123
- // add our own fake call signature to implement the polymorphic 'as' prop
124
- (props: StyledComponentProps<C, T, O, A> & {
125
- as?: never | undefined;
126
- forwardedAs?: never | undefined;
127
- }): React.ReactElement<StyledComponentProps<C, T, O, A>>;
128
- <AsC extends string | React.ComponentType<any> = C, FAsC extends string | React.ComponentType<any> = AsC>(props: StyledComponentPropsWithAs<AsC, T, O, A, AsC, FAsC>): React.ReactElement<StyledComponentPropsWithAs<AsC, T, O, A, AsC, FAsC>>;
129
- withComponent<WithC extends AnyStyledComponent>(component: WithC): StyledComponent<StyledComponentInnerComponent<WithC>, T, O & StyledComponentInnerOtherProps<WithC>, A | StyledComponentInnerAttrs<WithC>>;
130
- withComponent<WithC extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>>(component: WithC): StyledComponent<WithC, T, O, A>;
131
- }
132
-
133
- // remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
134
- type StyledComponentInterpolation = Pick<StyledComponentBase<any, any, any, any>, keyof StyledComponentBase<any, any>> | Pick<StyledComponentBase<any, any, any>, keyof StyledComponentBase<any, any>>;
135
-
136
- // These are typings coming from styled-components
137
- // They are adjusted to accept the extended options coming from mui
138
- type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
139
- type ThemedStyledComponentFactories<T extends object> = { [TTag in keyof React.JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T> };
140
- export type StyledComponentPropsWithRef<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>> = C extends AnyStyledComponent ? React.ComponentPropsWithRef<StyledComponentInnerComponent<C>> : React.ComponentPropsWithRef<C>;
141
-
142
- // Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
143
- export interface ThemedStyledFunctionBase<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> {
144
- (first: TemplateStringsArray): StyledComponent<C, T, O, A>;
145
- (first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>, ...other: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>>): StyledComponent<C, T, O, A>;
146
- <U extends object>(first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>, ...other: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O & U, T>>>): StyledComponent<C, T, O & U, A>;
147
- }
148
-
149
- // same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
150
- export interface ThemedStyledFunction<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> extends ThemedStyledFunctionBase<C, T, O, A> {}
151
- export type CreateStyledComponent<ComponentProps extends {}, SpecificComponentProps extends {} = {}, JSXProps extends {} = {}, T extends object = {}> = ThemedStyledFunction<React.ComponentType<ComponentProps>, T, SpecificComponentProps & JSXProps>;
152
-
153
- // Config to be used with withConfig
154
- export interface StyledConfig<O extends object = {}> {
155
- // TODO: Add all types from the original StyledComponentWrapperProperties
156
- componentId?: string;
157
- displayName?: string;
158
- label?: string;
159
- target?: string;
160
- shouldForwardProp?: ((prop: keyof O, defaultValidatorFn: (prop: keyof O) => boolean) => boolean) | undefined;
161
- }
162
-
163
- /** Same as StyledConfig but shouldForwardProp must be a type guard */
164
- export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
165
- componentId?: string;
166
- displayName?: string;
167
- label?: string;
168
- shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
169
- target?: string;
170
- }
171
-
172
- // same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
173
- export interface ThemedBaseStyledInterface<MUIStyledCommonProps extends object, MuiStyledOptions extends object, Theme extends object> extends ThemedStyledComponentFactories<Theme> {
174
- <C extends React.ComponentClass<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {
175
- ref?: React.Ref<InstanceType<C>>;
176
- }, Theme>;
177
- <C extends React.ComponentClass<React.ComponentProps<C>>>(component: C, options?: StyledConfig<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {
178
- ref?: React.Ref<InstanceType<C>>;
179
- }, Theme>;
180
- <C extends React.JSXElementConstructor<React.ComponentProps<C>>, ForwardedProps extends keyof React.ComponentProps<C> = keyof React.ComponentProps<C>>(component: C, options: FilteringStyledOptions<React.ComponentProps<C>, ForwardedProps> & MuiStyledOptions): CreateStyledComponent<Pick<PropsOf<C>, ForwardedProps> & MUIStyledCommonProps, {}, {}, Theme>;
181
- <C extends React.JSXElementConstructor<React.ComponentProps<C>>>(component: C, options?: StyledConfig<PropsOf<C> & MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<PropsOf<C> & MUIStyledCommonProps, {}, {}, Theme>;
182
- <Tag extends keyof React.JSX.IntrinsicElements, ForwardedProps extends keyof React.JSX.IntrinsicElements[Tag] = keyof React.JSX.IntrinsicElements[Tag]>(tag: Tag, options: FilteringStyledOptions<React.JSX.IntrinsicElements[Tag], ForwardedProps> & MuiStyledOptions): CreateStyledComponent<MUIStyledCommonProps, Pick<React.JSX.IntrinsicElements[Tag], ForwardedProps>, {}, Theme>;
183
- <Tag extends keyof React.JSX.IntrinsicElements>(tag: Tag, options?: StyledConfig<MUIStyledCommonProps> & MuiStyledOptions): CreateStyledComponent<MUIStyledCommonProps, React.JSX.IntrinsicElements[Tag], {}, Theme>;
184
- }
185
- export type CreateMUIStyled<MUIStyledCommonProps extends object = {}, MuiStyledOptions extends object = {}, T extends object = {}> = ThemedBaseStyledInterface<MUIStyledCommonProps, MuiStyledOptions, AnyIfEmpty<T>>;
186
- export type PropsOf<C extends keyof React.JSX.IntrinsicElements | React.JSXElementConstructor<any>> = React.JSX.LibraryManagedAttributes<C, React.ComponentProps<C>>;
187
- export interface MUIStyledComponent<ComponentProps extends {}, SpecificComponentProps extends {} = {}, JSXProps extends {} = {}> extends React.FC<ComponentProps & SpecificComponentProps & JSXProps> {
188
- withComponent<C extends React.ComponentClass<React.ComponentProps<C>>>(component: C): MUIStyledComponent<ComponentProps & PropsOf<C>, {}, {
189
- ref?: React.Ref<InstanceType<C>>;
190
- }>;
191
- withComponent<C extends React.ComponentType<React.ComponentProps<C>>>(component: C): MUIStyledComponent<ComponentProps & PropsOf<C>>;
192
- withComponent<Tag extends keyof React.JSX.IntrinsicElements>(tag: Tag): MUIStyledComponent<ComponentProps, React.JSX.IntrinsicElements[Tag]>;
193
- }
package/modern/index.js DELETED
@@ -1,60 +0,0 @@
1
- /**
2
- * @mui/styled-engine-sc v7.0.1
3
- *
4
- * @license MIT
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
- import scStyled from 'styled-components';
9
- export default function styled(tag, options) {
10
- let stylesFactory;
11
- if (options) {
12
- stylesFactory = scStyled(tag).withConfig({
13
- displayName: options.label,
14
- shouldForwardProp: options.shouldForwardProp
15
- });
16
- } else {
17
- stylesFactory = scStyled(tag);
18
- }
19
- if (process.env.NODE_ENV !== 'production') {
20
- const fn = (...styles) => {
21
- const component = typeof tag === 'string' ? `"${tag}"` : 'component';
22
- if (styles.length === 0) {
23
- console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join('\n'));
24
- } else if (styles.some(style => style === undefined)) {
25
- console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
26
- }
27
- return stylesFactory(...styles);
28
- };
29
- fn.withConfig = stylesFactory.withConfig;
30
- return fn;
31
- }
32
- return stylesFactory;
33
- }
34
-
35
- // eslint-disable-next-line @typescript-eslint/naming-convention
36
- export function internal_mutateStyles(tag, processor) {
37
- // Styled-components attaches an instance to `componentStyle`.
38
- // https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/StyledComponent.ts#L257
39
- //
40
- // The instance contains `rules` (the styles)
41
- // https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/ComponentStyle.ts#L23
42
- if (tag.componentStyle) {
43
- tag.componentStyle.rules = processor(tag.componentStyle.rules);
44
- }
45
- }
46
-
47
- // Not needed anymore, but fixes https://github.com/mui/material-ui/issues/44112
48
- // TODO: Remove it in v7
49
- // eslint-disable-next-line @typescript-eslint/naming-convention
50
- export function internal_processStyles(tag, processor) {
51
- return internal_mutateStyles(tag, processor);
52
- }
53
-
54
- // eslint-disable-next-line @typescript-eslint/naming-convention
55
- export function internal_serializeStyles(styles) {
56
- return styles;
57
- }
58
- export { ThemeContext, keyframes, css } from 'styled-components';
59
- export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
60
- export { default as GlobalStyles } from "./GlobalStyles/index.js";
@@ -1 +0,0 @@
1
- {"type":"module","sideEffects":false}