@mui/styled-engine-sc 9.0.1 → 9.1.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 +122 -0
- package/GlobalStyles/GlobalStyles.d.mts +4 -3
- package/GlobalStyles/GlobalStyles.d.ts +4 -3
- package/GlobalStyles/GlobalStyles.js +2 -2
- package/GlobalStyles/GlobalStyles.mjs +2 -2
- package/GlobalStyles/index.d.mts +1 -1
- package/GlobalStyles/index.d.ts +1 -1
- package/LICENSE +1 -1
- package/StyledEngineProvider/StyledEngineProvider.d.mts +1 -1
- package/StyledEngineProvider/StyledEngineProvider.d.ts +1 -1
- package/StyledEngineProvider/StyledEngineProvider.js +2 -2
- package/StyledEngineProvider/StyledEngineProvider.mjs +2 -2
- package/StyledEngineProvider/index.d.mts +1 -1
- package/StyledEngineProvider/index.d.ts +1 -1
- package/index.d.mts +16 -73
- package/index.d.ts +16 -73
- package/index.js +56 -12
- package/index.mjs +54 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,127 @@
|
|
|
1
1
|
# [Versions](https://mui.com/material-ui/getting-started/versions/)
|
|
2
2
|
|
|
3
|
+
## 9.1.1
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v9.1.0..master -->
|
|
6
|
+
|
|
7
|
+
_Jun 11, 2026_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 9 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@9.1.1`
|
|
12
|
+
|
|
13
|
+
- [Autocomplete] Update fullWidth prop documentation (#48626) @vipin8797
|
|
14
|
+
- [ButtonBase] Fix focus ripple lingering after blur (#48650) @siriwatknp
|
|
15
|
+
- [InitColorSchemeScript] Server-render in tests for React 19.3 (#48604) @Janpot
|
|
16
|
+
- [Transition] Mount child in same commit when opening from unmounted (#48649) @siriwatknp
|
|
17
|
+
|
|
18
|
+
### `@mui/styled-engine@9.1.1`
|
|
19
|
+
|
|
20
|
+
- [styled-engine] Prevent enableCssLayer styles from being overridden by unlayered styles (#48603) @Janpot
|
|
21
|
+
|
|
22
|
+
### Docs
|
|
23
|
+
|
|
24
|
+
- Send SOURCE to Brevo on newsletter subscribe (#48633) @aemartos
|
|
25
|
+
- fix TypeScript heading capitalization (#48619) @ifer47
|
|
26
|
+
- Remove outdated security section (#48628) @oliviertassinari
|
|
27
|
+
- [legal] Update EULA links on website (#48642) @rluzists1
|
|
28
|
+
|
|
29
|
+
### Core
|
|
30
|
+
|
|
31
|
+
- Update dependencies to resolve Dependabot security alerts (#48641) @Janpot
|
|
32
|
+
- [core-docs] Pin StackBlitz demo vite to v7 and plugin-react to v5 (#48643) @Janpot
|
|
33
|
+
- [code-infra] Port codebase to use tsgo (#48616) @brijeshb42
|
|
34
|
+
- [docs-infra] Fix immutable cache headers for /\_next/static assets (#48655) @brijeshb42
|
|
35
|
+
- [docs-infra] Run link checker during docs build instead of as separate CI step (#48634) @Janpot
|
|
36
|
+
- [docs-infra] Support turbopack for docs (#48569) @brijeshb42
|
|
37
|
+
- [test] Cover docs landing-page composites with Argos (#48589) @LukasTy
|
|
38
|
+
|
|
39
|
+
All contributors of this release in alphabetical order: @aemartos, @brijeshb42, @ifer47, @Janpot, @LukasTy, @oliviertassinari, @rluzists1, @siriwatknp, @vipin8797
|
|
40
|
+
|
|
41
|
+
## 9.1.0
|
|
42
|
+
|
|
43
|
+
<!-- generated comparing v9.0.1..master -->
|
|
44
|
+
|
|
45
|
+
_Jun 8, 2026_
|
|
46
|
+
|
|
47
|
+
A big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
48
|
+
|
|
49
|
+
- ⚙️ Support for the [prefers-reduced-motion](https://mui.com/material-ui/transitions/#reduced-motion) setting.
|
|
50
|
+
- ♿️ Improved support for Windows High Contrast mode with the [enhanceHighContrast](https://mui.com/material-ui/customization/palette/#windows-high-contrast-mode) theme wrapper.
|
|
51
|
+
|
|
52
|
+
### `@mui/material@9.1.0`
|
|
53
|
+
|
|
54
|
+
- [autocomplete] Enable clearing highlight when mouse leaves popup (#48354) @mj12albert
|
|
55
|
+
- [autocomplete] Fix `freeSolo` controlled values cleared by initial `null` (#48611) @mj12albert
|
|
56
|
+
- [autocomplete] Fix item removal when it receives focus from VoiceOver before using Backspace (#48572) @silviuaavram
|
|
57
|
+
- [autocomplete] Fix `resetHighlightOnMouseLeave` JSdoc (#48536) @mj12albert
|
|
58
|
+
- [autocomplete] Guard against null inputRef during unmount (#48617) @noam3127
|
|
59
|
+
- [badge] Add `aria-hidden` to badge content and polish docs demos (#48471) @mj12albert
|
|
60
|
+
- [badge] Use inline CSS variables for anchorOrigin/overlap positioning (#48549) @siriwatknp
|
|
61
|
+
- [button] Fix customized flex gap styles (#48542) @mj12albert
|
|
62
|
+
- [dialog] Fix unwanted `DialogPaper` focus ring (#48535) @mj12albert
|
|
63
|
+
- [focus trap] Fix incorrect tab order when `tabIndex >= 1` (#48546) @mj12albert
|
|
64
|
+
- [progress] Show runtime errors only once (#48591) @silviuaavram
|
|
65
|
+
- [select] Allow spacebar to select elements (#48615) @silviuaavram
|
|
66
|
+
- [select] Support typeahead when closed (#48563) @mj12albert
|
|
67
|
+
- [step button] Choose higher contrast ripple color for dark mode focus (#48612) @silviuaavram
|
|
68
|
+
- [stepper] Include StepConnector inside Step element (#48492) @silviuaavram
|
|
69
|
+
- [stepper] Proper support for vertical alternativeLabel (#48485) @silviuaavram
|
|
70
|
+
- [tabs] Fix React 18 roving tabindex and dedupe invalid-value warning (#48605) @Janpot
|
|
71
|
+
- [theme] Add HighContrast theme enhancer (#48319) @silviuaavram
|
|
72
|
+
- [timeline item] Fix extra ::before spacing when TimelineOppositeContent is present (#46663) @tyalau
|
|
73
|
+
- [tooltip] Prevent stuck-open tooltip when child becomes disabled (#48606) @Janpot
|
|
74
|
+
- [transitions] Custom `Transition` component (#48325) @mj12albert
|
|
75
|
+
- [transitions] Support `prefers-reduced-motion` (#48357) @mj12albert
|
|
76
|
+
|
|
77
|
+
### `@mui/utils@9.1.0`
|
|
78
|
+
|
|
79
|
+
- [utils] Prevent prototype pollution in fastDeepAssign (#48580) @Janpot
|
|
80
|
+
|
|
81
|
+
### Docs
|
|
82
|
+
|
|
83
|
+
- [docs] Add function `slotProps` documentation (#48574) @mj12albert
|
|
84
|
+
- [docs] Clarify styled-components version compatibility (#48533) @nightt5879
|
|
85
|
+
- [docs] Fix broken URLs (#48520) @oliviertassinari
|
|
86
|
+
- [docs] Fix invalid JSON in Zed MCP setup example (#48490) @pavan-sh
|
|
87
|
+
- [docs] Mention release version for enhanceHighContrast (#48609) @silviuaavram
|
|
88
|
+
- [docs] Remove outdated MUI X v8 notification (#48600) @cherniavskii
|
|
89
|
+
- [docs] Remove redundant enhanceHighContrast information (#48632) @silviuaavram
|
|
90
|
+
- [docs-infra] Decrease loaded bundle size on docs (#48584) @brijeshb42
|
|
91
|
+
- [docs-infra] Drop multi-locale plumbing from API pages (#48370) @brijeshb42
|
|
92
|
+
- [docs-infra] Fix Cookie banner heading (#48529) @oliviertassinari
|
|
93
|
+
- [docs-infra] Infinitely cache all static assets (#48627) @brijeshb42
|
|
94
|
+
- [docs-infra] Remove outdated noSEOadvantage entries (#48527) @oliviertassinari
|
|
95
|
+
- [docs-infra] Restore build-only invariant throws via `NEXT_RUNTIME` guard (#48475) @Janpot
|
|
96
|
+
- [docs-infra] Test HTML validation in broken links checker (#48088) @Janpot
|
|
97
|
+
- [docs][icons] Fix Font Awesome Chip demo in dark mode (#48576) @siriwatknp
|
|
98
|
+
- [docs][icons] Remove redundant font awesome demo (#48493) @ZeeshanTamboli
|
|
99
|
+
- [docs][modal] Add nested modal guidance (#46507) @JakeSaterlay
|
|
100
|
+
- [docs][stepper] Fix focus management in examples (#48494) @silviuaavram
|
|
101
|
+
|
|
102
|
+
### Core
|
|
103
|
+
|
|
104
|
+
- Eslint markdown (#48371) @Janpot
|
|
105
|
+
- [agents] Fix some docs links (#48561) @silviuaavram
|
|
106
|
+
- [blog] Copy editing improvement on v9 announcement blog posts (#48543) @joserodolfofreitas
|
|
107
|
+
- [code-infra] Cleanup unused jss packages (#48590) @brijeshb42
|
|
108
|
+
- [code-infra] Collapse canary workflows into nightly and nightly-cron (#48556) @Janpot
|
|
109
|
+
- [code-infra] Convert @mui/private-theming to TypeScript (#48565) @Janpot
|
|
110
|
+
- [code-infra] Convert @mui/styled-engine to TypeScript (#48544) @Janpot
|
|
111
|
+
- [code-infra] Convert @mui/styled-engine-sc to TypeScript (#48577) @Janpot
|
|
112
|
+
- [code-infra] Fix duplicate resource_class in test_regressions CI job (#48601) @LukasTy
|
|
113
|
+
- [code-infra] Make @mui/internal-docs-utils compatible with TypeScript 6 (#48594) @Janpot
|
|
114
|
+
- [code-infra] Migrate CircleCI jobs to Gen2 resource classes (#48593) @LukasTy
|
|
115
|
+
- [code-infra] Parallelize visual regression screenshots (#48557) @Janpot
|
|
116
|
+
- [code-infra] Run nightly-cron on v7.x (#48579) @Janpot
|
|
117
|
+
- [core] Fix typescript@next typecheck (#48587) @Janpot
|
|
118
|
+
- [pnpm] Add security settings to pnpm-workspace.yaml (#48582) @Janpot
|
|
119
|
+
- [styled-engine-sc] Fix compatibility with Vite and Vitest (#48558) @mj12albert
|
|
120
|
+
- [test] Add axe-core tests for mui-material (#48341) @siriwatknp
|
|
121
|
+
- [test] Configure Tailwind CSS in the visual-regression app (#48575) @Janpot
|
|
122
|
+
|
|
123
|
+
All contributors of this release in alphabetical order: @brijeshb42, @cherniavskii, @JakeSaterlay, @Janpot, @joserodolfofreitas, @LukasTy, @mj12albert, @nightt5879, @noam3127, @oliviertassinari, @pavan-sh, @silviuaavram, @siriwatknp, @tyalau, @ZeeshanTamboli
|
|
124
|
+
|
|
3
125
|
## 9.0.1
|
|
4
126
|
|
|
5
127
|
<!-- generated comparing v9.0.0..master -->
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CSSObject, StyleFunction } from 'styled-components';
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type CSSObject, type StyleFunction } from 'styled-components';
|
|
3
3
|
export interface GlobalStylesProps<Theme extends object = {}> {
|
|
4
4
|
defaultTheme?: object | undefined;
|
|
5
5
|
styles: string | CSSObject | StyleFunction<Theme>;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
declare const GlobalStyles: <Theme extends object = {}>(props: GlobalStylesProps<Theme>) => React.JSX.Element;
|
|
8
|
+
export default GlobalStyles;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { CSSObject, StyleFunction } from 'styled-components';
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import { type CSSObject, type StyleFunction } from 'styled-components';
|
|
3
3
|
export interface GlobalStylesProps<Theme extends object = {}> {
|
|
4
4
|
defaultTheme?: object | undefined;
|
|
5
5
|
styles: string | CSSObject | StyleFunction<Theme>;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
declare const GlobalStyles: <Theme extends object = {}>(props: GlobalStylesProps<Theme>) => React.JSX.Element;
|
|
8
|
+
export default GlobalStyles;
|
|
@@ -21,7 +21,7 @@ const GlobalStyles = (0, _styledComponents.createGlobalStyle)(props => {
|
|
|
21
21
|
return styles;
|
|
22
22
|
});
|
|
23
23
|
var _default = exports.default = GlobalStyles;
|
|
24
|
-
GlobalStyles.propTypes = {
|
|
24
|
+
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptypes */ = {
|
|
25
25
|
defaultTheme: _propTypes.default.object,
|
|
26
26
|
styles: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.string, _propTypes.default.object, _propTypes.default.func])
|
|
27
|
-
};
|
|
27
|
+
} : void 0;
|
|
@@ -14,7 +14,7 @@ const GlobalStyles = createGlobalStyle(props => {
|
|
|
14
14
|
return styles;
|
|
15
15
|
});
|
|
16
16
|
export default GlobalStyles;
|
|
17
|
-
GlobalStyles.propTypes = {
|
|
17
|
+
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptypes */ = {
|
|
18
18
|
defaultTheme: PropTypes.object,
|
|
19
19
|
styles: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.object, PropTypes.func])
|
|
20
|
-
};
|
|
20
|
+
} : void 0;
|
package/GlobalStyles/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./GlobalStyles.mjs";
|
|
2
|
-
export * from "./GlobalStyles.mjs";
|
|
2
|
+
export type * from "./GlobalStyles.mjs";
|
package/GlobalStyles/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./GlobalStyles.js";
|
|
2
|
-
export * from "./GlobalStyles.js";
|
|
2
|
+
export type * from "./GlobalStyles.js";
|
package/LICENSE
CHANGED
|
@@ -21,7 +21,7 @@ function StyledEngineProvider(props) {
|
|
|
21
21
|
}
|
|
22
22
|
return children;
|
|
23
23
|
}
|
|
24
|
-
StyledEngineProvider.propTypes = {
|
|
24
|
+
process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes /* remove-proptypes */ = {
|
|
25
25
|
/**
|
|
26
26
|
* Your component tree.
|
|
27
27
|
*/
|
|
@@ -32,4 +32,4 @@ StyledEngineProvider.propTypes = {
|
|
|
32
32
|
* If you want to override MUI's styles, set this prop.
|
|
33
33
|
*/
|
|
34
34
|
injectFirst: _propTypes.default.bool
|
|
35
|
-
};
|
|
35
|
+
} : void 0;
|
|
@@ -14,7 +14,7 @@ export default function StyledEngineProvider(props) {
|
|
|
14
14
|
}
|
|
15
15
|
return children;
|
|
16
16
|
}
|
|
17
|
-
StyledEngineProvider.propTypes = {
|
|
17
|
+
process.env.NODE_ENV !== "production" ? StyledEngineProvider.propTypes /* remove-proptypes */ = {
|
|
18
18
|
/**
|
|
19
19
|
* Your component tree.
|
|
20
20
|
*/
|
|
@@ -25,4 +25,4 @@ StyledEngineProvider.propTypes = {
|
|
|
25
25
|
* If you want to override MUI's styles, set this prop.
|
|
26
26
|
*/
|
|
27
27
|
injectFirst: PropTypes.bool
|
|
28
|
-
};
|
|
28
|
+
} : void 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./StyledEngineProvider.mjs";
|
|
2
|
-
export * from "./StyledEngineProvider.mjs";
|
|
2
|
+
export type * from "./StyledEngineProvider.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from "./StyledEngineProvider.js";
|
|
2
|
-
export * from "./StyledEngineProvider.js";
|
|
2
|
+
export type * from "./StyledEngineProvider.js";
|
package/index.d.mts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
1
|
+
import { styled as scStyled } from 'styled-components';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import type * as CSS from 'csstype';
|
|
4
|
+
import type * as hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
|
+
export type * from 'styled-components';
|
|
4
6
|
type WithOptionalTheme<P extends {
|
|
5
7
|
theme?: T | undefined;
|
|
6
8
|
}, T> = OmitU<P, 'theme'> & {
|
|
7
9
|
theme?: T | undefined;
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
// Helper type operators
|
|
11
|
-
// Pick that distributes over union types
|
|
12
11
|
export type PickU<T, K extends keyof T> = T extends any ? { [P in K]: T[P] } : never;
|
|
13
12
|
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
13
|
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
14
|
export type IntrinsicElementsKeys = keyof React.JSX.IntrinsicElements;
|
|
21
15
|
type ReactDefaultizedProps<C, P> = C extends {
|
|
22
16
|
defaultProps: infer D;
|
|
23
17
|
} ? 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
|
-
|
|
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;
|
|
18
|
+
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>> = P extends any ? OmitU<ReactDefaultizedProps<C, P> & O, A> & Partial<PickU<P & O, A>> : never;
|
|
19
|
+
export type StyledComponentProps<C extends string | React.ComponentType<any>, T extends object, O extends object, A extends keyof any, FAsC extends string | React.ComponentType<any> = C> = O extends object ? WithOptionalTheme<MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>, T> : never;
|
|
40
20
|
export interface ThemeProps<T> {
|
|
41
21
|
theme: T;
|
|
42
22
|
}
|
|
@@ -44,29 +24,18 @@ export type ThemedStyledProps<P, T> = P & ThemeProps<T>;
|
|
|
44
24
|
export interface Keyframes {
|
|
45
25
|
getName(): string;
|
|
46
26
|
}
|
|
47
|
-
|
|
48
|
-
export
|
|
49
|
-
export { default as StyledEngineProvider } from "./StyledEngineProvider/index.mjs";
|
|
50
|
-
export { default as GlobalStyles } from "./GlobalStyles/index.mjs";
|
|
51
|
-
export * from "./GlobalStyles/index.mjs";
|
|
52
|
-
|
|
27
|
+
declare const _default: typeof scStyled;
|
|
28
|
+
export default _default;
|
|
53
29
|
/**
|
|
54
30
|
* For internal usage in `@mui/system` package
|
|
55
31
|
*/
|
|
56
|
-
|
|
57
|
-
export function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export
|
|
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[]
|
|
32
|
+
export declare function internal_mutateStyles(tag: React.ElementType, processor: (styles: any) => any): void;
|
|
33
|
+
export declare function internal_processStyles(tag: React.ElementType, processor: (styles: any) => any): void;
|
|
34
|
+
export declare function internal_serializeStyles<P>(styles: Interpolation<P>): object;
|
|
35
|
+
export { ThemeContext, keyframes, css } from 'styled-components';
|
|
36
|
+
export { default as StyledEngineProvider } from "./StyledEngineProvider/index.mjs";
|
|
37
|
+
export { default as GlobalStyles } from "./GlobalStyles/index.mjs";
|
|
38
|
+
export type { GlobalStylesProps } from "./GlobalStyles/index.mjs";
|
|
70
39
|
export type CSSProperties = CSS.PropertiesFallback<number | string>;
|
|
71
40
|
export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: CSSProperties[K] | Array<Extract<CSSProperties[K], string>> };
|
|
72
41
|
export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
|
|
@@ -78,8 +47,6 @@ export interface ArrayCSSInterpolation extends Array<CSSInterpolation> {}
|
|
|
78
47
|
export interface CSSOthersObjectForCSSObject {
|
|
79
48
|
[propertiesName: string]: CSSInterpolation;
|
|
80
49
|
}
|
|
81
|
-
|
|
82
|
-
// Omit variants as a key, because we have a special handling for it
|
|
83
50
|
export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
|
|
84
51
|
interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
85
52
|
variants: Array<{
|
|
@@ -93,17 +60,12 @@ interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
|
93
60
|
}
|
|
94
61
|
export type FalseyValue = undefined | null | false;
|
|
95
62
|
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
63
|
export type FlattenInterpolation<P> = ReadonlyArray<Interpolation<P>>;
|
|
99
64
|
export type InterpolationValue = string | number | FalseyValue | Keyframes | StyledComponentInterpolation | CSSObject;
|
|
100
65
|
export type SimpleInterpolation = InterpolationValue | FlattenSimpleInterpolation;
|
|
101
|
-
// adapter for compatibility with @mui/styled-engine
|
|
102
66
|
export type CSSInterpolation = SimpleInterpolation;
|
|
103
67
|
export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
|
|
104
68
|
export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
|
|
105
|
-
|
|
106
|
-
// abuse Pick to strip the call signature from ForwardRefExoticComponent
|
|
107
69
|
type ForwardRefExoticBase<P> = PickU<React.ForwardRefExoticComponent<P>, keyof React.ForwardRefExoticComponent<any>>;
|
|
108
70
|
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
71
|
as?: AsC | undefined;
|
|
@@ -111,16 +73,12 @@ type StyledComponentPropsWithAs<C extends string | React.ComponentType<any>, T e
|
|
|
111
73
|
};
|
|
112
74
|
export type StyledComponent<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object = {}, O extends object = {}, A extends keyof any = never> =
|
|
113
75
|
// 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
76
|
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
77
|
export type AnyStyledComponent = StyledComponent<any, any, any, any> | StyledComponent<any, any, any> | React.FunctionComponent<any> | React.ComponentType<any>;
|
|
119
78
|
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
79
|
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
80
|
export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<any, any, any, infer A> ? A : never;
|
|
122
81
|
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
82
|
(props: StyledComponentProps<C, T, O, A> & {
|
|
125
83
|
as?: never | undefined;
|
|
126
84
|
forwardedAs?: never | undefined;
|
|
@@ -129,37 +87,24 @@ export interface StyledComponentBase<C extends string | React.ComponentType<any>
|
|
|
129
87
|
withComponent<WithC extends AnyStyledComponent>(component: WithC): StyledComponent<StyledComponentInnerComponent<WithC>, T, O & StyledComponentInnerOtherProps<WithC>, A | StyledComponentInnerAttrs<WithC>>;
|
|
130
88
|
withComponent<WithC extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>>(component: WithC): StyledComponent<WithC, T, O, A>;
|
|
131
89
|
}
|
|
132
|
-
|
|
133
|
-
// remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
|
|
134
90
|
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
91
|
type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
|
|
139
92
|
type ThemedStyledComponentFactories<T extends object> = { [TTag in keyof React.JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T> };
|
|
140
93
|
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
94
|
export interface ThemedStyledFunctionBase<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> {
|
|
144
95
|
(first: TemplateStringsArray): StyledComponent<C, T, O, A>;
|
|
145
96
|
(first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>, ...other: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>>): StyledComponent<C, T, O, A>;
|
|
146
97
|
<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
98
|
}
|
|
148
|
-
|
|
149
|
-
// same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
|
|
150
99
|
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
100
|
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
101
|
export interface StyledConfig<O extends object = {}> {
|
|
155
|
-
// TODO: Add all types from the original StyledComponentWrapperProperties
|
|
156
102
|
componentId?: string | undefined;
|
|
157
103
|
displayName?: string | undefined;
|
|
158
104
|
label?: string | undefined;
|
|
159
105
|
target?: string | undefined;
|
|
160
106
|
shouldForwardProp?: ((prop: keyof O, defaultValidatorFn: (prop: keyof O) => boolean) => boolean) | undefined;
|
|
161
107
|
}
|
|
162
|
-
|
|
163
108
|
/** Same as StyledConfig but shouldForwardProp must be a type guard */
|
|
164
109
|
export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
|
|
165
110
|
componentId?: string | undefined;
|
|
@@ -168,8 +113,6 @@ export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Prop
|
|
|
168
113
|
shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
|
|
169
114
|
target?: string | undefined;
|
|
170
115
|
}
|
|
171
|
-
|
|
172
|
-
// same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
|
|
173
116
|
export interface ThemedBaseStyledInterface<MUIStyledCommonProps extends object, MuiStyledOptions extends object, Theme extends object> extends ThemedStyledComponentFactories<Theme> {
|
|
174
117
|
<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
118
|
ref?: React.Ref<InstanceType<C>> | undefined;
|
package/index.d.ts
CHANGED
|
@@ -1,42 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
1
|
+
import { styled as scStyled } from 'styled-components';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import type * as CSS from 'csstype';
|
|
4
|
+
import type * as hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
|
+
export type * from 'styled-components';
|
|
4
6
|
type WithOptionalTheme<P extends {
|
|
5
7
|
theme?: T | undefined;
|
|
6
8
|
}, T> = OmitU<P, 'theme'> & {
|
|
7
9
|
theme?: T | undefined;
|
|
8
10
|
};
|
|
9
|
-
|
|
10
|
-
// Helper type operators
|
|
11
|
-
// Pick that distributes over union types
|
|
12
11
|
export type PickU<T, K extends keyof T> = T extends any ? { [P in K]: T[P] } : never;
|
|
13
12
|
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
13
|
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
14
|
export type IntrinsicElementsKeys = keyof React.JSX.IntrinsicElements;
|
|
21
15
|
type ReactDefaultizedProps<C, P> = C extends {
|
|
22
16
|
defaultProps: infer D;
|
|
23
17
|
} ? 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
|
-
|
|
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;
|
|
18
|
+
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>> = P extends any ? OmitU<ReactDefaultizedProps<C, P> & O, A> & Partial<PickU<P & O, A>> : never;
|
|
19
|
+
export type StyledComponentProps<C extends string | React.ComponentType<any>, T extends object, O extends object, A extends keyof any, FAsC extends string | React.ComponentType<any> = C> = O extends object ? WithOptionalTheme<MakeAttrsOptional<C, O, A> & MakeAttrsOptional<FAsC, O, A>, T> : never;
|
|
40
20
|
export interface ThemeProps<T> {
|
|
41
21
|
theme: T;
|
|
42
22
|
}
|
|
@@ -44,29 +24,18 @@ export type ThemedStyledProps<P, T> = P & ThemeProps<T>;
|
|
|
44
24
|
export interface Keyframes {
|
|
45
25
|
getName(): string;
|
|
46
26
|
}
|
|
47
|
-
|
|
48
|
-
export
|
|
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
|
-
|
|
27
|
+
declare const _default: typeof scStyled;
|
|
28
|
+
export default _default;
|
|
53
29
|
/**
|
|
54
30
|
* For internal usage in `@mui/system` package
|
|
55
31
|
*/
|
|
56
|
-
|
|
57
|
-
export function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
export
|
|
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[]
|
|
32
|
+
export declare function internal_mutateStyles(tag: React.ElementType, processor: (styles: any) => any): void;
|
|
33
|
+
export declare function internal_processStyles(tag: React.ElementType, processor: (styles: any) => any): void;
|
|
34
|
+
export declare function internal_serializeStyles<P>(styles: Interpolation<P>): object;
|
|
35
|
+
export { ThemeContext, keyframes, css } from 'styled-components';
|
|
36
|
+
export { default as StyledEngineProvider } from "./StyledEngineProvider/index.js";
|
|
37
|
+
export { default as GlobalStyles } from "./GlobalStyles/index.js";
|
|
38
|
+
export type { GlobalStylesProps } from "./GlobalStyles/index.js";
|
|
70
39
|
export type CSSProperties = CSS.PropertiesFallback<number | string>;
|
|
71
40
|
export type CSSPropertiesWithMultiValues = { [K in keyof CSSProperties]: CSSProperties[K] | Array<Extract<CSSProperties[K], string>> };
|
|
72
41
|
export type CSSPseudos = { [K in CSS.Pseudos]?: unknown | CSSObject };
|
|
@@ -78,8 +47,6 @@ export interface ArrayCSSInterpolation extends Array<CSSInterpolation> {}
|
|
|
78
47
|
export interface CSSOthersObjectForCSSObject {
|
|
79
48
|
[propertiesName: string]: CSSInterpolation;
|
|
80
49
|
}
|
|
81
|
-
|
|
82
|
-
// Omit variants as a key, because we have a special handling for it
|
|
83
50
|
export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudos, Omit<CSSOthersObject, 'variants'> {}
|
|
84
51
|
interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
85
52
|
variants: Array<{
|
|
@@ -93,17 +60,12 @@ interface CSSObjectWithVariants<Props> extends Omit<CSSObject, 'variants'> {
|
|
|
93
60
|
}
|
|
94
61
|
export type FalseyValue = undefined | null | false;
|
|
95
62
|
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
63
|
export type FlattenInterpolation<P> = ReadonlyArray<Interpolation<P>>;
|
|
99
64
|
export type InterpolationValue = string | number | FalseyValue | Keyframes | StyledComponentInterpolation | CSSObject;
|
|
100
65
|
export type SimpleInterpolation = InterpolationValue | FlattenSimpleInterpolation;
|
|
101
|
-
// adapter for compatibility with @mui/styled-engine
|
|
102
66
|
export type CSSInterpolation = SimpleInterpolation;
|
|
103
67
|
export type FlattenSimpleInterpolation = ReadonlyArray<SimpleInterpolation>;
|
|
104
68
|
export type InterpolationFunction<P> = (props: P) => Interpolation<P>;
|
|
105
|
-
|
|
106
|
-
// abuse Pick to strip the call signature from ForwardRefExoticComponent
|
|
107
69
|
type ForwardRefExoticBase<P> = PickU<React.ForwardRefExoticComponent<P>, keyof React.ForwardRefExoticComponent<any>>;
|
|
108
70
|
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
71
|
as?: AsC | undefined;
|
|
@@ -111,16 +73,12 @@ type StyledComponentPropsWithAs<C extends string | React.ComponentType<any>, T e
|
|
|
111
73
|
};
|
|
112
74
|
export type StyledComponent<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object = {}, O extends object = {}, A extends keyof any = never> =
|
|
113
75
|
// 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
76
|
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
77
|
export type AnyStyledComponent = StyledComponent<any, any, any, any> | StyledComponent<any, any, any> | React.FunctionComponent<any> | React.ComponentType<any>;
|
|
119
78
|
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
79
|
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
80
|
export type StyledComponentInnerAttrs<C extends AnyStyledComponent> = C extends StyledComponent<any, any, any, infer A> ? A : never;
|
|
122
81
|
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
82
|
(props: StyledComponentProps<C, T, O, A> & {
|
|
125
83
|
as?: never | undefined;
|
|
126
84
|
forwardedAs?: never | undefined;
|
|
@@ -129,37 +87,24 @@ export interface StyledComponentBase<C extends string | React.ComponentType<any>
|
|
|
129
87
|
withComponent<WithC extends AnyStyledComponent>(component: WithC): StyledComponent<StyledComponentInnerComponent<WithC>, T, O & StyledComponentInnerOtherProps<WithC>, A | StyledComponentInnerAttrs<WithC>>;
|
|
130
88
|
withComponent<WithC extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>>(component: WithC): StyledComponent<WithC, T, O, A>;
|
|
131
89
|
}
|
|
132
|
-
|
|
133
|
-
// remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
|
|
134
90
|
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
91
|
type AnyIfEmpty<T extends object> = keyof T extends never ? any : T;
|
|
139
92
|
type ThemedStyledComponentFactories<T extends object> = { [TTag in keyof React.JSX.IntrinsicElements]: ThemedStyledFunctionBase<TTag, T> };
|
|
140
93
|
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
94
|
export interface ThemedStyledFunctionBase<C extends keyof React.JSX.IntrinsicElements | React.ComponentType<any>, T extends object, O extends object = {}, A extends keyof any = never> {
|
|
144
95
|
(first: TemplateStringsArray): StyledComponent<C, T, O, A>;
|
|
145
96
|
(first: TemplateStringsArray | CSSObject | InterpolationFunction<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>, ...other: Array<Interpolation<ThemedStyledProps<StyledComponentPropsWithRef<C> & O, T>>>): StyledComponent<C, T, O, A>;
|
|
146
97
|
<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
98
|
}
|
|
148
|
-
|
|
149
|
-
// same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
|
|
150
99
|
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
100
|
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
101
|
export interface StyledConfig<O extends object = {}> {
|
|
155
|
-
// TODO: Add all types from the original StyledComponentWrapperProperties
|
|
156
102
|
componentId?: string | undefined;
|
|
157
103
|
displayName?: string | undefined;
|
|
158
104
|
label?: string | undefined;
|
|
159
105
|
target?: string | undefined;
|
|
160
106
|
shouldForwardProp?: ((prop: keyof O, defaultValidatorFn: (prop: keyof O) => boolean) => boolean) | undefined;
|
|
161
107
|
}
|
|
162
|
-
|
|
163
108
|
/** Same as StyledConfig but shouldForwardProp must be a type guard */
|
|
164
109
|
export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Props = keyof Props> {
|
|
165
110
|
componentId?: string | undefined;
|
|
@@ -168,8 +113,6 @@ export interface FilteringStyledOptions<Props, ForwardedProps extends keyof Prop
|
|
|
168
113
|
shouldForwardProp?(propName: PropertyKey): propName is ForwardedProps;
|
|
169
114
|
target?: string | undefined;
|
|
170
115
|
}
|
|
171
|
-
|
|
172
|
-
// same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
|
|
173
116
|
export interface ThemedBaseStyledInterface<MUIStyledCommonProps extends object, MuiStyledOptions extends object, Theme extends object> extends ThemedStyledComponentFactories<Theme> {
|
|
174
117
|
<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
118
|
ref?: React.Ref<InstanceType<C>> | undefined;
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/styled-engine-sc v9.
|
|
2
|
+
* @mui/styled-engine-sc v9.1.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"use strict";
|
|
9
9
|
|
|
10
10
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
11
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
12
11
|
Object.defineProperty(exports, "__esModule", {
|
|
13
12
|
value: true
|
|
14
13
|
});
|
|
@@ -36,7 +35,7 @@ Object.defineProperty(exports, "css", {
|
|
|
36
35
|
return _styledComponents.css;
|
|
37
36
|
}
|
|
38
37
|
});
|
|
39
|
-
exports.default =
|
|
38
|
+
exports.default = void 0;
|
|
40
39
|
exports.internal_mutateStyles = internal_mutateStyles;
|
|
41
40
|
exports.internal_processStyles = internal_processStyles;
|
|
42
41
|
exports.internal_serializeStyles = internal_serializeStyles;
|
|
@@ -46,18 +45,34 @@ Object.defineProperty(exports, "keyframes", {
|
|
|
46
45
|
return _styledComponents.keyframes;
|
|
47
46
|
}
|
|
48
47
|
});
|
|
49
|
-
var _styledComponents =
|
|
48
|
+
var _styledComponents = require("styled-components");
|
|
50
49
|
var _StyledEngineProvider = _interopRequireDefault(require("./StyledEngineProvider"));
|
|
51
50
|
var _GlobalStyles = _interopRequireDefault(require("./GlobalStyles"));
|
|
51
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
52
|
+
|
|
53
|
+
// Re-export the full `styled-components` *type* surface, matching the
|
|
54
|
+
// hand-written `.d.ts` that this conversion replaces. Type-only: emits
|
|
55
|
+
// nothing at runtime. Local declarations below intentionally shadow some
|
|
56
|
+
// styled-components names (`Keyframes`, `Interpolation`, `StyledComponent`,
|
|
57
|
+
// `CSSObject`, …) — local declarations win over re-exports.
|
|
58
|
+
|
|
59
|
+
// Helper type operators
|
|
60
|
+
// Pick that distributes over union types
|
|
61
|
+
|
|
62
|
+
// Any prop that has a default prop becomes optional, but its type is unchanged
|
|
63
|
+
// Undeclared default props are augmented into the resulting allowable attributes
|
|
64
|
+
// If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
|
65
|
+
// Wrap in an outer-level conditional type to allow distribution over props that are unions
|
|
66
|
+
|
|
52
67
|
function styled(tag, options) {
|
|
53
68
|
let stylesFactory;
|
|
54
69
|
if (options) {
|
|
55
|
-
stylesFactory = (0, _styledComponents.
|
|
70
|
+
stylesFactory = (0, _styledComponents.styled)(tag).withConfig({
|
|
56
71
|
displayName: options.label,
|
|
57
72
|
shouldForwardProp: options.shouldForwardProp
|
|
58
73
|
});
|
|
59
74
|
} else {
|
|
60
|
-
stylesFactory = (0, _styledComponents.
|
|
75
|
+
stylesFactory = (0, _styledComponents.styled)(tag);
|
|
61
76
|
}
|
|
62
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
63
78
|
const fn = (...styles) => {
|
|
@@ -74,8 +89,10 @@ function styled(tag, options) {
|
|
|
74
89
|
}
|
|
75
90
|
return stylesFactory;
|
|
76
91
|
}
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
var _default = exports.default = styled;
|
|
93
|
+
/**
|
|
94
|
+
* For internal usage in `@mui/system` package
|
|
95
|
+
*/
|
|
79
96
|
function internal_mutateStyles(tag, processor) {
|
|
80
97
|
// Styled-components attaches an instance to `componentStyle`.
|
|
81
98
|
// https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/StyledComponent.ts#L257
|
|
@@ -89,12 +106,39 @@ function internal_mutateStyles(tag, processor) {
|
|
|
89
106
|
|
|
90
107
|
// Not needed anymore, but fixes https://github.com/mui/material-ui/issues/44112
|
|
91
108
|
// TODO: Remove it in v7
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
93
109
|
function internal_processStyles(tag, processor) {
|
|
94
110
|
return internal_mutateStyles(tag, processor);
|
|
95
111
|
}
|
|
96
|
-
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
98
112
|
function internal_serializeStyles(styles) {
|
|
99
113
|
return styles;
|
|
100
|
-
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// These are the same as the ones in @mui/styled-engine
|
|
117
|
+
// CSS.PropertiesFallback are necessary so that we support spreading of the mixins. For example:
|
|
118
|
+
// '@font-face'?: Fontface | Fontface[]
|
|
119
|
+
|
|
120
|
+
// Omit variants as a key, because we have a special handling for it
|
|
121
|
+
|
|
122
|
+
// cannot be made a self-referential interface, breaks WithPropNested
|
|
123
|
+
// see https://github.com/microsoft/TypeScript/issues/34796
|
|
124
|
+
|
|
125
|
+
// adapter for compatibility with @mui/styled-engine
|
|
126
|
+
|
|
127
|
+
// abuse Pick to strip the call signature from ForwardRefExoticComponent
|
|
128
|
+
|
|
129
|
+
// any doesn't count as assignable to never in the extends clause, and we default A to never
|
|
130
|
+
|
|
131
|
+
// remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
|
|
132
|
+
|
|
133
|
+
// These are typings coming from styled-components
|
|
134
|
+
// They are adjusted to accept the extended options coming from mui
|
|
135
|
+
|
|
136
|
+
// Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
|
|
137
|
+
|
|
138
|
+
// same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
|
|
139
|
+
|
|
140
|
+
// Config to be used with withConfig
|
|
141
|
+
|
|
142
|
+
/** Same as StyledConfig but shouldForwardProp must be a type guard */
|
|
143
|
+
|
|
144
|
+
// same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
|
package/index.mjs
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/styled-engine-sc v9.
|
|
2
|
+
* @mui/styled-engine-sc v9.1.1
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
9
|
+
import { styled as scStyled } from 'styled-components';
|
|
10
|
+
|
|
11
|
+
// Re-export the full `styled-components` *type* surface, matching the
|
|
12
|
+
// hand-written `.d.ts` that this conversion replaces. Type-only: emits
|
|
13
|
+
// nothing at runtime. Local declarations below intentionally shadow some
|
|
14
|
+
// styled-components names (`Keyframes`, `Interpolation`, `StyledComponent`,
|
|
15
|
+
// `CSSObject`, …) — local declarations win over re-exports.
|
|
16
|
+
|
|
17
|
+
// Helper type operators
|
|
18
|
+
// Pick that distributes over union types
|
|
19
|
+
|
|
20
|
+
// Any prop that has a default prop becomes optional, but its type is unchanged
|
|
21
|
+
// Undeclared default props are augmented into the resulting allowable attributes
|
|
22
|
+
// If declared props have indexed properties, ignore default props entirely as keyof gets widened
|
|
23
|
+
// Wrap in an outer-level conditional type to allow distribution over props that are unions
|
|
24
|
+
|
|
25
|
+
function styled(tag, options) {
|
|
10
26
|
let stylesFactory;
|
|
11
27
|
if (options) {
|
|
12
28
|
stylesFactory = scStyled(tag).withConfig({
|
|
@@ -31,8 +47,11 @@ export default function styled(tag, options) {
|
|
|
31
47
|
}
|
|
32
48
|
return stylesFactory;
|
|
33
49
|
}
|
|
50
|
+
export default styled;
|
|
34
51
|
|
|
35
|
-
|
|
52
|
+
/**
|
|
53
|
+
* For internal usage in `@mui/system` package
|
|
54
|
+
*/
|
|
36
55
|
export function internal_mutateStyles(tag, processor) {
|
|
37
56
|
// Styled-components attaches an instance to `componentStyle`.
|
|
38
57
|
// https://github.com/styled-components/styled-components/blob/da8151762dcf72735ffba358173d4c097f6d5888/packages/styled-components/src/models/StyledComponent.ts#L257
|
|
@@ -46,15 +65,42 @@ export function internal_mutateStyles(tag, processor) {
|
|
|
46
65
|
|
|
47
66
|
// Not needed anymore, but fixes https://github.com/mui/material-ui/issues/44112
|
|
48
67
|
// TODO: Remove it in v7
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
50
68
|
export function internal_processStyles(tag, processor) {
|
|
51
69
|
return internal_mutateStyles(tag, processor);
|
|
52
70
|
}
|
|
53
|
-
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
55
71
|
export function internal_serializeStyles(styles) {
|
|
56
72
|
return styles;
|
|
57
73
|
}
|
|
58
74
|
export { ThemeContext, keyframes, css } from 'styled-components';
|
|
59
75
|
export { default as StyledEngineProvider } from "./StyledEngineProvider/index.mjs";
|
|
60
|
-
export { default as GlobalStyles } from "./GlobalStyles/index.mjs";
|
|
76
|
+
export { default as GlobalStyles } from "./GlobalStyles/index.mjs";
|
|
77
|
+
|
|
78
|
+
// These are the same as the ones in @mui/styled-engine
|
|
79
|
+
// CSS.PropertiesFallback are necessary so that we support spreading of the mixins. For example:
|
|
80
|
+
// '@font-face'?: Fontface | Fontface[]
|
|
81
|
+
|
|
82
|
+
// Omit variants as a key, because we have a special handling for it
|
|
83
|
+
|
|
84
|
+
// cannot be made a self-referential interface, breaks WithPropNested
|
|
85
|
+
// see https://github.com/microsoft/TypeScript/issues/34796
|
|
86
|
+
|
|
87
|
+
// adapter for compatibility with @mui/styled-engine
|
|
88
|
+
|
|
89
|
+
// abuse Pick to strip the call signature from ForwardRefExoticComponent
|
|
90
|
+
|
|
91
|
+
// any doesn't count as assignable to never in the extends clause, and we default A to never
|
|
92
|
+
|
|
93
|
+
// remove the call signature from StyledComponent so Interpolation can still infer InterpolationFunction
|
|
94
|
+
|
|
95
|
+
// These are typings coming from styled-components
|
|
96
|
+
// They are adjusted to accept the extended options coming from mui
|
|
97
|
+
|
|
98
|
+
// Same as in styled-components, but copied here so that it would use the Interpolation & CSS typings from above
|
|
99
|
+
|
|
100
|
+
// same as ThemedStyledFunction in styled-components, but without attrs, and withConfig
|
|
101
|
+
|
|
102
|
+
// Config to be used with withConfig
|
|
103
|
+
|
|
104
|
+
/** Same as StyledConfig but shouldForwardProp must be a type guard */
|
|
105
|
+
|
|
106
|
+
// same as ThemedBaseStyledInterface in styled-components, but with added options & common props for MUI components
|