@mui/system 9.1.1 → 9.1.2
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/Box/Box.d.mts +15 -19
- package/Box/Box.d.ts +15 -19
- package/Box/Box.js +16 -1
- package/Box/Box.mjs +17 -1
- package/Box/index.js +12 -2
- package/Box/index.mjs +1 -0
- package/CHANGELOG.md +36 -0
- package/Container/index.d.mts +1 -1
- package/Container/index.d.ts +1 -1
- package/Grid/Grid.js +0 -1
- package/Grid/Grid.mjs +0 -1
- package/Grid/GridProps.d.mts +0 -1
- package/Grid/GridProps.d.ts +0 -1
- package/InitColorSchemeScript/InitColorSchemeScript.d.mts +2 -1
- package/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -1
- package/InitColorSchemeScript/InitColorSchemeScript.js +34 -1
- package/InitColorSchemeScript/InitColorSchemeScript.mjs +33 -1
- package/ThemeProvider/ThemeProvider.d.mts +9 -6
- package/ThemeProvider/ThemeProvider.d.ts +9 -6
- package/ThemeProvider/ThemeProvider.js +3 -2
- package/ThemeProvider/ThemeProvider.mjs +3 -2
- package/ThemeProvider/index.d.mts +1 -1
- package/ThemeProvider/index.d.ts +1 -1
- package/borders/borders.d.mts +14 -12
- package/borders/borders.d.ts +14 -12
- package/borders/borders.js +2 -4
- package/borders/borders.mjs +3 -4
- package/breakpoints/breakpoints.d.mts +13 -16
- package/breakpoints/breakpoints.d.ts +13 -16
- package/breakpoints/breakpoints.js +17 -16
- package/breakpoints/breakpoints.mjs +17 -16
- package/compose/compose.d.mts +3 -10
- package/compose/compose.d.ts +3 -10
- package/compose/compose.js +0 -2
- package/compose/compose.mjs +0 -2
- package/createBox/createBox.d.mts +4 -4
- package/createBox/createBox.d.ts +4 -4
- package/createBreakpoints/createBreakpoints.d.mts +3 -54
- package/createBreakpoints/createBreakpoints.d.ts +3 -54
- package/createBreakpoints/createBreakpoints.js +6 -8
- package/createBreakpoints/createBreakpoints.mjs +6 -8
- package/createBreakpoints/index.d.mts +0 -1
- package/createBreakpoints/index.d.ts +0 -1
- package/createTheme/shape.d.mts +2 -2
- package/createTheme/shape.d.ts +2 -2
- package/cssGrid/cssGrid.d.mts +13 -13
- package/cssGrid/cssGrid.d.ts +13 -13
- package/cssGrid/cssGrid.js +0 -8
- package/cssGrid/cssGrid.mjs +0 -9
- package/cssVars/createCssVarsProvider.js +2 -2
- package/cssVars/createCssVarsProvider.mjs +2 -2
- package/cssVars/useCurrentColorScheme.js +1 -0
- package/cssVars/useCurrentColorScheme.mjs +1 -0
- package/display/display.d.mts +49 -1
- package/display/display.d.ts +49 -1
- package/display/display.js +2 -1
- package/display/display.mjs +2 -1
- package/flexbox/flexbox.d.mts +14 -14
- package/flexbox/flexbox.d.ts +14 -14
- package/getThemeValue/getThemeValue.d.mts +2 -1
- package/getThemeValue/getThemeValue.d.ts +2 -1
- package/getThemeValue/getThemeValue.js +6 -2
- package/getThemeValue/getThemeValue.mjs +7 -3
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/memoize/memoize.d.mts +1 -1
- package/memoize/memoize.d.ts +1 -1
- package/package.json +59 -59
- package/palette/palette.d.mts +4 -3
- package/palette/palette.d.ts +4 -3
- package/palette/palette.js +1 -0
- package/palette/palette.mjs +2 -0
- package/positions/positions.d.mts +49 -1
- package/positions/positions.d.ts +49 -1
- package/positions/positions.js +2 -1
- package/positions/positions.mjs +2 -1
- package/propsToClassKey/propsToClassKey.d.mts +5 -0
- package/propsToClassKey/propsToClassKey.d.ts +5 -0
- package/propsToClassKey/propsToClassKey.js +1 -1
- package/propsToClassKey/propsToClassKey.mjs +1 -1
- package/shadows/shadows.d.mts +4 -4
- package/shadows/shadows.d.ts +4 -4
- package/sizing/sizing.d.mts +10 -10
- package/sizing/sizing.d.ts +10 -10
- package/sizing/sizing.js +7 -2
- package/sizing/sizing.mjs +5 -1
- package/spacing/spacing.d.mts +10 -14
- package/spacing/spacing.d.ts +10 -14
- package/spacing/spacing.js +17 -13
- package/spacing/spacing.mjs +16 -9
- package/styleFunctionSx/defaultSxConfig.d.mts +1 -1
- package/styleFunctionSx/defaultSxConfig.d.ts +1 -1
- package/styleFunctionSx/extendSxProp.d.mts +4 -2
- package/styleFunctionSx/extendSxProp.d.ts +4 -2
- package/styled/styled.d.mts +1 -1
- package/styled/styled.d.ts +1 -1
- package/typography/typography.d.mts +10 -10
- package/typography/typography.d.ts +10 -10
- package/useTheme/useTheme.d.mts +4 -2
- package/useTheme/useTheme.d.ts +4 -2
- package/useThemeProps/getThemeProps.d.mts +2 -2
- package/useThemeProps/getThemeProps.d.ts +2 -2
- package/useThemeProps/index.d.mts +1 -1
- package/useThemeProps/index.d.ts +1 -1
- package/useThemeProps/useThemeProps.js +7 -6
- package/useThemeProps/useThemeProps.mjs +7 -6
- package/useThemeWithoutDefault/useThemeWithoutDefault.d.mts +2 -1
- package/useThemeWithoutDefault/useThemeWithoutDefault.d.ts +2 -1
- package/useThemeWithoutDefault/useThemeWithoutDefault.js +2 -2
- package/useThemeWithoutDefault/useThemeWithoutDefault.mjs +2 -2
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { CSSObject } from '@mui/styled-engine';
|
|
2
|
-
import { Breakpoints } from "../createBreakpoints/createBreakpoints.mjs";
|
|
1
|
+
import type { CSSObject } from '@mui/styled-engine';
|
|
2
|
+
import type { Breakpoints } from "../createBreakpoints/createBreakpoints.mjs";
|
|
3
3
|
import type { Breakpoint, Theme } from "../createTheme/index.mjs";
|
|
4
|
-
import { ResponsiveStyleValue } from "../styleFunctionSx/index.mjs";
|
|
5
|
-
import { StyleFunction } from "../style/index.mjs";
|
|
6
|
-
export const DEFAULT_BREAKPOINTS: Breakpoints;
|
|
4
|
+
import type { ResponsiveStyleValue } from "../styleFunctionSx/index.mjs";
|
|
5
|
+
import type { StyleFunction } from "../style/index.mjs";
|
|
6
|
+
export declare const DEFAULT_BREAKPOINTS: Breakpoints;
|
|
7
|
+
export declare function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
|
|
8
|
+
export declare function iterateBreakpoints(target: any, theme: Theme | undefined, propValue: any, callback: (mediaKey: string | undefined, value: any, initialKey?: string) => any): any;
|
|
9
|
+
type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
declare function setupBreakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
11
|
+
export declare function mergeBreakpointsInOrder(breakpoints: Breakpoints, ...styles: CSSObject[]): CSSObject;
|
|
7
12
|
export interface ResolveBreakpointValuesOptions<T> {
|
|
8
13
|
values: ResponsiveStyleValue<T>;
|
|
9
14
|
breakpoints?: Breakpoints['values'] | undefined;
|
|
10
15
|
base?: Record<string, boolean> | undefined;
|
|
11
16
|
}
|
|
12
|
-
export function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
|
|
13
|
-
export function
|
|
14
|
-
export
|
|
15
|
-
export function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
|
|
16
|
-
export function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
|
|
17
|
-
type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @returns An enhanced stylefunction that considers breakpoints
|
|
21
|
-
*/
|
|
22
|
-
export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
17
|
+
export declare function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
|
|
18
|
+
export declare function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
|
|
19
|
+
export default setupBreakpoints;
|
|
@@ -1,22 +1,19 @@
|
|
|
1
|
-
import { CSSObject } from '@mui/styled-engine';
|
|
2
|
-
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
|
|
1
|
+
import type { CSSObject } from '@mui/styled-engine';
|
|
2
|
+
import type { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
|
|
3
3
|
import type { Breakpoint, Theme } from "../createTheme/index.js";
|
|
4
|
-
import { ResponsiveStyleValue } from "../styleFunctionSx/index.js";
|
|
5
|
-
import { StyleFunction } from "../style/index.js";
|
|
6
|
-
export const DEFAULT_BREAKPOINTS: Breakpoints;
|
|
4
|
+
import type { ResponsiveStyleValue } from "../styleFunctionSx/index.js";
|
|
5
|
+
import type { StyleFunction } from "../style/index.js";
|
|
6
|
+
export declare const DEFAULT_BREAKPOINTS: Breakpoints;
|
|
7
|
+
export declare function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
|
|
8
|
+
export declare function iterateBreakpoints(target: any, theme: Theme | undefined, propValue: any, callback: (mediaKey: string | undefined, value: any, initialKey?: string) => any): any;
|
|
9
|
+
type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
declare function setupBreakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
11
|
+
export declare function mergeBreakpointsInOrder(breakpoints: Breakpoints, ...styles: CSSObject[]): CSSObject;
|
|
7
12
|
export interface ResolveBreakpointValuesOptions<T> {
|
|
8
13
|
values: ResponsiveStyleValue<T>;
|
|
9
14
|
breakpoints?: Breakpoints['values'] | undefined;
|
|
10
15
|
base?: Record<string, boolean> | undefined;
|
|
11
16
|
}
|
|
12
|
-
export function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
|
|
13
|
-
export function
|
|
14
|
-
export
|
|
15
|
-
export function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
|
|
16
|
-
export function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
|
|
17
|
-
type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @returns An enhanced stylefunction that considers breakpoints
|
|
21
|
-
*/
|
|
22
|
-
export default function breakpoints<Props, BreakpointsInput extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<BreakpointsInput, Props>> & Props>;
|
|
17
|
+
export declare function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
|
|
18
|
+
export declare function hasBreakpoint(breakpoints: Breakpoints, value: any): boolean;
|
|
19
|
+
export default setupBreakpoints;
|
|
@@ -26,6 +26,7 @@ const EMPTY_THEME = {};
|
|
|
26
26
|
|
|
27
27
|
// The breakpoint **start** at this value.
|
|
28
28
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
29
|
+
/** @internal */
|
|
29
30
|
const values = exports.values = {
|
|
30
31
|
xs: 0,
|
|
31
32
|
// phone
|
|
@@ -38,7 +39,7 @@ const values = exports.values = {
|
|
|
38
39
|
xl: 1536 // large screen
|
|
39
40
|
};
|
|
40
41
|
const DEFAULT_BREAKPOINTS = exports.DEFAULT_BREAKPOINTS = (0, _createBreakpoints.default)({
|
|
41
|
-
values
|
|
42
|
+
values: values
|
|
42
43
|
});
|
|
43
44
|
const defaultContainerQueries = {
|
|
44
45
|
containerQueries: containerName => ({
|
|
@@ -80,9 +81,7 @@ function iterateBreakpoints(target, theme, propValue, callback) {
|
|
|
80
81
|
if (containerKey) {
|
|
81
82
|
buildBreakpoint(target, containerKey, propValue[key], key, callback);
|
|
82
83
|
}
|
|
83
|
-
}
|
|
84
|
-
// key is key
|
|
85
|
-
else if (key in breakpointValues) {
|
|
84
|
+
} else if (key in breakpointValues) {
|
|
86
85
|
const mediaKey = breakpoints.up(key);
|
|
87
86
|
buildBreakpoint(target, mediaKey, propValue[key], key, callback);
|
|
88
87
|
} else {
|
|
@@ -100,7 +99,6 @@ function buildBreakpoint(target, mediaKey, value, initialKey, callback) {
|
|
|
100
99
|
callback(mediaKey, value, initialKey);
|
|
101
100
|
}
|
|
102
101
|
function setupBreakpoints(styleFunction) {
|
|
103
|
-
// eslint-disable-next-line react/function-component-definition
|
|
104
102
|
const newStyleFunction = props => {
|
|
105
103
|
const theme = props.theme || {};
|
|
106
104
|
const base = styleFunction(props);
|
|
@@ -128,6 +126,8 @@ function setupBreakpoints(styleFunction) {
|
|
|
128
126
|
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
|
|
129
127
|
return newStyleFunction;
|
|
130
128
|
}
|
|
129
|
+
|
|
130
|
+
/** @internal */
|
|
131
131
|
function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
|
|
132
132
|
const {
|
|
133
133
|
internal_mediaKeys: mediaKeys
|
|
@@ -138,6 +138,8 @@ function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
|
|
|
138
138
|
}
|
|
139
139
|
return result;
|
|
140
140
|
}
|
|
141
|
+
|
|
142
|
+
/** @internal */
|
|
141
143
|
function removeUnusedBreakpoints(breakpoints, style) {
|
|
142
144
|
const breakpointKeys = breakpoints.internal_mediaKeys;
|
|
143
145
|
for (let i = 0; i < breakpointKeys.length; i += 1) {
|
|
@@ -154,11 +156,8 @@ function mergeBreakpointsInOrder(breakpoints, ...styles) {
|
|
|
154
156
|
return removeUnusedBreakpoints(breakpoints, mergedOutput);
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
|
|
158
|
-
// [1,2,3] => {xs: true, sm: true, md: true}
|
|
159
|
-
// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}
|
|
159
|
+
/** @internal */
|
|
160
160
|
function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
161
|
-
// fixed value
|
|
162
161
|
if (typeof breakpointValues !== 'object') {
|
|
163
162
|
return {};
|
|
164
163
|
}
|
|
@@ -179,11 +178,12 @@ function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
|
179
178
|
}
|
|
180
179
|
return base;
|
|
181
180
|
}
|
|
182
|
-
function resolveBreakpointValues({
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
181
|
+
function resolveBreakpointValues(options) {
|
|
182
|
+
const {
|
|
183
|
+
values: breakpointValues,
|
|
184
|
+
breakpoints: themeBreakpoints,
|
|
185
|
+
base: customBase
|
|
186
|
+
} = options;
|
|
187
187
|
const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
|
|
188
188
|
const keys = Object.keys(base);
|
|
189
189
|
if (keys.length === 0) {
|
|
@@ -194,8 +194,9 @@ function resolveBreakpointValues({
|
|
|
194
194
|
if (Array.isArray(breakpointValues)) {
|
|
195
195
|
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
|
|
196
196
|
previous = i;
|
|
197
|
-
} else if (typeof breakpointValues === 'object') {
|
|
198
|
-
|
|
197
|
+
} else if (typeof breakpointValues === 'object' && breakpointValues) {
|
|
198
|
+
const bv = breakpointValues;
|
|
199
|
+
acc[breakpoint] = bv[breakpoint] != null ? bv[breakpoint] : bv[previous];
|
|
199
200
|
previous = breakpoint;
|
|
200
201
|
} else {
|
|
201
202
|
acc[breakpoint] = breakpointValues;
|
|
@@ -9,6 +9,7 @@ const EMPTY_THEME = {};
|
|
|
9
9
|
|
|
10
10
|
// The breakpoint **start** at this value.
|
|
11
11
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
12
|
+
/** @internal */
|
|
12
13
|
export const values = {
|
|
13
14
|
xs: 0,
|
|
14
15
|
// phone
|
|
@@ -21,7 +22,7 @@ export const values = {
|
|
|
21
22
|
xl: 1536 // large screen
|
|
22
23
|
};
|
|
23
24
|
export const DEFAULT_BREAKPOINTS = createBreakpoints({
|
|
24
|
-
values
|
|
25
|
+
values: values
|
|
25
26
|
});
|
|
26
27
|
const defaultContainerQueries = {
|
|
27
28
|
containerQueries: containerName => ({
|
|
@@ -63,9 +64,7 @@ export function iterateBreakpoints(target, theme, propValue, callback) {
|
|
|
63
64
|
if (containerKey) {
|
|
64
65
|
buildBreakpoint(target, containerKey, propValue[key], key, callback);
|
|
65
66
|
}
|
|
66
|
-
}
|
|
67
|
-
// key is key
|
|
68
|
-
else if (key in breakpointValues) {
|
|
67
|
+
} else if (key in breakpointValues) {
|
|
69
68
|
const mediaKey = breakpoints.up(key);
|
|
70
69
|
buildBreakpoint(target, mediaKey, propValue[key], key, callback);
|
|
71
70
|
} else {
|
|
@@ -83,7 +82,6 @@ function buildBreakpoint(target, mediaKey, value, initialKey, callback) {
|
|
|
83
82
|
callback(mediaKey, value, initialKey);
|
|
84
83
|
}
|
|
85
84
|
function setupBreakpoints(styleFunction) {
|
|
86
|
-
// eslint-disable-next-line react/function-component-definition
|
|
87
85
|
const newStyleFunction = props => {
|
|
88
86
|
const theme = props.theme || {};
|
|
89
87
|
const base = styleFunction(props);
|
|
@@ -111,6 +109,8 @@ function setupBreakpoints(styleFunction) {
|
|
|
111
109
|
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
|
|
112
110
|
return newStyleFunction;
|
|
113
111
|
}
|
|
112
|
+
|
|
113
|
+
/** @internal */
|
|
114
114
|
export function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
|
|
115
115
|
const {
|
|
116
116
|
internal_mediaKeys: mediaKeys
|
|
@@ -121,6 +121,8 @@ export function createEmptyBreakpointObject(breakpoints = DEFAULT_BREAKPOINTS) {
|
|
|
121
121
|
}
|
|
122
122
|
return result;
|
|
123
123
|
}
|
|
124
|
+
|
|
125
|
+
/** @internal */
|
|
124
126
|
export function removeUnusedBreakpoints(breakpoints, style) {
|
|
125
127
|
const breakpointKeys = breakpoints.internal_mediaKeys;
|
|
126
128
|
for (let i = 0; i < breakpointKeys.length; i += 1) {
|
|
@@ -137,11 +139,8 @@ export function mergeBreakpointsInOrder(breakpoints, ...styles) {
|
|
|
137
139
|
return removeUnusedBreakpoints(breakpoints, mergedOutput);
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
|
|
141
|
-
// [1,2,3] => {xs: true, sm: true, md: true}
|
|
142
|
-
// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}
|
|
142
|
+
/** @internal */
|
|
143
143
|
export function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
144
|
-
// fixed value
|
|
145
144
|
if (typeof breakpointValues !== 'object') {
|
|
146
145
|
return {};
|
|
147
146
|
}
|
|
@@ -162,11 +161,12 @@ export function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
|
|
162
161
|
}
|
|
163
162
|
return base;
|
|
164
163
|
}
|
|
165
|
-
export function resolveBreakpointValues({
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
export function resolveBreakpointValues(options) {
|
|
165
|
+
const {
|
|
166
|
+
values: breakpointValues,
|
|
167
|
+
breakpoints: themeBreakpoints,
|
|
168
|
+
base: customBase
|
|
169
|
+
} = options;
|
|
170
170
|
const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
|
|
171
171
|
const keys = Object.keys(base);
|
|
172
172
|
if (keys.length === 0) {
|
|
@@ -177,8 +177,9 @@ export function resolveBreakpointValues({
|
|
|
177
177
|
if (Array.isArray(breakpointValues)) {
|
|
178
178
|
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
|
|
179
179
|
previous = i;
|
|
180
|
-
} else if (typeof breakpointValues === 'object') {
|
|
181
|
-
|
|
180
|
+
} else if (typeof breakpointValues === 'object' && breakpointValues) {
|
|
181
|
+
const bv = breakpointValues;
|
|
182
|
+
acc[breakpoint] = bv[breakpoint] != null ? bv[breakpoint] : bv[previous];
|
|
182
183
|
previous = breakpoint;
|
|
183
184
|
} else {
|
|
184
185
|
acc[breakpoint] = breakpointValues;
|
package/compose/compose.d.mts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { StyleFunction } from "../style/index.mjs";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* given a list of StyleFunction return the intersection of the props each individual
|
|
5
|
-
* StyleFunction requires.
|
|
6
|
-
*
|
|
7
|
-
* If `firstFn` requires { color: string } and `secondFn` requires { spacing: number }
|
|
8
|
-
* their composed function requires { color: string, spacing: number }
|
|
9
|
-
*/
|
|
1
|
+
import type { StyleFunction } from "../style/index.mjs";
|
|
10
2
|
type ComposedArg<T> = T extends Array<(arg: infer P) => any> ? P : never;
|
|
11
3
|
type ComposedOwnerState<T> = ComposedArg<T>;
|
|
12
4
|
export type ComposedStyleFunction<T extends Array<StyleFunction<any>>> = StyleFunction<ComposedOwnerState<T>> & {
|
|
13
5
|
filterProps: string[];
|
|
14
6
|
};
|
|
15
|
-
|
|
7
|
+
declare function compose<T extends Array<StyleFunction<any>>>(...styles: T): ComposedStyleFunction<T>;
|
|
8
|
+
export default compose;
|
package/compose/compose.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { StyleFunction } from "../style/index.js";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* given a list of StyleFunction return the intersection of the props each individual
|
|
5
|
-
* StyleFunction requires.
|
|
6
|
-
*
|
|
7
|
-
* If `firstFn` requires { color: string } and `secondFn` requires { spacing: number }
|
|
8
|
-
* their composed function requires { color: string, spacing: number }
|
|
9
|
-
*/
|
|
1
|
+
import type { StyleFunction } from "../style/index.js";
|
|
10
2
|
type ComposedArg<T> = T extends Array<(arg: infer P) => any> ? P : never;
|
|
11
3
|
type ComposedOwnerState<T> = ComposedArg<T>;
|
|
12
4
|
export type ComposedStyleFunction<T extends Array<StyleFunction<any>>> = StyleFunction<ComposedOwnerState<T>> & {
|
|
13
5
|
filterProps: string[];
|
|
14
6
|
};
|
|
15
|
-
|
|
7
|
+
declare function compose<T extends Array<StyleFunction<any>>>(...styles: T): ComposedStyleFunction<T>;
|
|
8
|
+
export default compose;
|
package/compose/compose.js
CHANGED
package/compose/compose.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OverridableComponent } from '@mui/types';
|
|
2
|
-
import { BoxTypeMap } from "../Box/index.mjs";
|
|
3
|
-
import { Theme as SystemTheme } from "../createTheme/index.mjs";
|
|
1
|
+
import type { OverridableComponent } from '@mui/types';
|
|
2
|
+
import type { BoxTypeMap } from "../Box/index.mjs";
|
|
3
|
+
import type { Theme as SystemTheme } from "../createTheme/index.mjs";
|
|
4
4
|
export default function createBox<T extends object = SystemTheme, AdditionalProps extends Record<string, unknown> = {}>(options?: {
|
|
5
5
|
themeId?: string | undefined;
|
|
6
|
-
defaultTheme
|
|
6
|
+
defaultTheme?: T | undefined;
|
|
7
7
|
defaultClassName?: string | undefined;
|
|
8
8
|
generateClassName?: ((componentName: string) => string) | undefined;
|
|
9
9
|
}): OverridableComponent<BoxTypeMap<AdditionalProps, 'div', T>>;
|
package/createBox/createBox.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { OverridableComponent } from '@mui/types';
|
|
2
|
-
import { BoxTypeMap } from "../Box/index.js";
|
|
3
|
-
import { Theme as SystemTheme } from "../createTheme/index.js";
|
|
1
|
+
import type { OverridableComponent } from '@mui/types';
|
|
2
|
+
import type { BoxTypeMap } from "../Box/index.js";
|
|
3
|
+
import type { Theme as SystemTheme } from "../createTheme/index.js";
|
|
4
4
|
export default function createBox<T extends object = SystemTheme, AdditionalProps extends Record<string, unknown> = {}>(options?: {
|
|
5
5
|
themeId?: string | undefined;
|
|
6
|
-
defaultTheme
|
|
6
|
+
defaultTheme?: T | undefined;
|
|
7
7
|
defaultClassName?: string | undefined;
|
|
8
8
|
generateClassName?: ((componentName: string) => string) | undefined;
|
|
9
9
|
}): OverridableComponent<BoxTypeMap<AdditionalProps, 'div', T>>;
|
|
@@ -1,68 +1,17 @@
|
|
|
1
|
-
import { OverridableStringUnion } from '@mui/types';
|
|
1
|
+
import type { OverridableStringUnion } from '@mui/types';
|
|
2
2
|
export interface BreakpointOverrides {}
|
|
3
3
|
export type Breakpoint = OverridableStringUnion<'xs' | 'sm' | 'md' | 'lg' | 'xl', BreakpointOverrides>;
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
|
|
7
|
-
// #host-reference
|
|
4
|
+
export declare const breakpointKeys: Breakpoint[];
|
|
8
5
|
export interface Breakpoints {
|
|
9
6
|
keys: Breakpoint[];
|
|
10
|
-
/**
|
|
11
|
-
* Each breakpoint (a key) matches with a fixed screen width (a value).
|
|
12
|
-
* @default {
|
|
13
|
-
* // extra-small
|
|
14
|
-
* xs: 0,
|
|
15
|
-
* // small
|
|
16
|
-
* sm: 600,
|
|
17
|
-
* // medium
|
|
18
|
-
* md: 900,
|
|
19
|
-
* // large
|
|
20
|
-
* lg: 1200,
|
|
21
|
-
* // extra-large
|
|
22
|
-
* xl: 1536,
|
|
23
|
-
* }
|
|
24
|
-
*/
|
|
25
7
|
values: { [key in Breakpoint]: number };
|
|
26
|
-
/**
|
|
27
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
28
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
|
|
29
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
|
|
30
|
-
*/
|
|
31
8
|
up: (key: Breakpoint | number) => string;
|
|
32
|
-
/**
|
|
33
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
34
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
|
|
35
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
|
|
36
|
-
*/
|
|
37
9
|
down: (key: Breakpoint | number) => string;
|
|
38
|
-
/**
|
|
39
|
-
* @param start - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
40
|
-
* @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
41
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
|
|
42
|
-
* the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
|
|
43
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
|
|
44
|
-
*/
|
|
45
10
|
between: (start: Breakpoint | number, end: Breakpoint | number) => string;
|
|
46
|
-
/**
|
|
47
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
48
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
|
|
49
|
-
* the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
|
|
50
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
|
|
51
|
-
*/
|
|
52
11
|
only: (key: Breakpoint) => string;
|
|
53
|
-
/**
|
|
54
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.).
|
|
55
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths stopping at
|
|
56
|
-
* the screen size given by the breakpoint key (exclusive) and starting at the screen size given by the next breakpoint key (inclusive).
|
|
57
|
-
*/
|
|
58
12
|
not: (key: Breakpoint) => string;
|
|
59
|
-
/**
|
|
60
|
-
* The unit used for the breakpoint's values.
|
|
61
|
-
* @default 'px'
|
|
62
|
-
*/
|
|
63
13
|
unit?: string | undefined;
|
|
64
14
|
/**
|
|
65
|
-
* Media query keys
|
|
66
15
|
* @ignore - Do not document.
|
|
67
16
|
*/
|
|
68
17
|
internal_mediaKeys: string[];
|
|
@@ -80,4 +29,4 @@ export interface BreakpointsOptions extends Partial<Breakpoints> {
|
|
|
80
29
|
*/
|
|
81
30
|
unit?: string | undefined;
|
|
82
31
|
}
|
|
83
|
-
export default function createBreakpoints(
|
|
32
|
+
export default function createBreakpoints(breakpoints: BreakpointsOptions): Breakpoints;
|
|
@@ -1,68 +1,17 @@
|
|
|
1
|
-
import { OverridableStringUnion } from '@mui/types';
|
|
1
|
+
import type { OverridableStringUnion } from '@mui/types';
|
|
2
2
|
export interface BreakpointOverrides {}
|
|
3
3
|
export type Breakpoint = OverridableStringUnion<'xs' | 'sm' | 'md' | 'lg' | 'xl', BreakpointOverrides>;
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
|
|
7
|
-
// #host-reference
|
|
4
|
+
export declare const breakpointKeys: Breakpoint[];
|
|
8
5
|
export interface Breakpoints {
|
|
9
6
|
keys: Breakpoint[];
|
|
10
|
-
/**
|
|
11
|
-
* Each breakpoint (a key) matches with a fixed screen width (a value).
|
|
12
|
-
* @default {
|
|
13
|
-
* // extra-small
|
|
14
|
-
* xs: 0,
|
|
15
|
-
* // small
|
|
16
|
-
* sm: 600,
|
|
17
|
-
* // medium
|
|
18
|
-
* md: 900,
|
|
19
|
-
* // large
|
|
20
|
-
* lg: 1200,
|
|
21
|
-
* // extra-large
|
|
22
|
-
* xl: 1536,
|
|
23
|
-
* }
|
|
24
|
-
*/
|
|
25
7
|
values: { [key in Breakpoint]: number };
|
|
26
|
-
/**
|
|
27
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
28
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
|
|
29
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
|
|
30
|
-
*/
|
|
31
8
|
up: (key: Breakpoint | number) => string;
|
|
32
|
-
/**
|
|
33
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
34
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
|
|
35
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
|
|
36
|
-
*/
|
|
37
9
|
down: (key: Breakpoint | number) => string;
|
|
38
|
-
/**
|
|
39
|
-
* @param start - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
40
|
-
* @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
41
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
|
|
42
|
-
* the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
|
|
43
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
|
|
44
|
-
*/
|
|
45
10
|
between: (start: Breakpoint | number, end: Breakpoint | number) => string;
|
|
46
|
-
/**
|
|
47
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
|
|
48
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
|
|
49
|
-
* the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
|
|
50
|
-
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
|
|
51
|
-
*/
|
|
52
11
|
only: (key: Breakpoint) => string;
|
|
53
|
-
/**
|
|
54
|
-
* @param key - A breakpoint key (`xs`, `sm`, etc.).
|
|
55
|
-
* @returns A media query string ready to be used with most styling solutions, which matches screen widths stopping at
|
|
56
|
-
* the screen size given by the breakpoint key (exclusive) and starting at the screen size given by the next breakpoint key (inclusive).
|
|
57
|
-
*/
|
|
58
12
|
not: (key: Breakpoint) => string;
|
|
59
|
-
/**
|
|
60
|
-
* The unit used for the breakpoint's values.
|
|
61
|
-
* @default 'px'
|
|
62
|
-
*/
|
|
63
13
|
unit?: string | undefined;
|
|
64
14
|
/**
|
|
65
|
-
* Media query keys
|
|
66
15
|
* @ignore - Do not document.
|
|
67
16
|
*/
|
|
68
17
|
internal_mediaKeys: string[];
|
|
@@ -80,4 +29,4 @@ export interface BreakpointsOptions extends Partial<Breakpoints> {
|
|
|
80
29
|
*/
|
|
81
30
|
unit?: string | undefined;
|
|
82
31
|
}
|
|
83
|
-
export default function createBreakpoints(
|
|
32
|
+
export default function createBreakpoints(breakpoints: BreakpointsOptions): Breakpoints;
|
|
@@ -8,6 +8,10 @@ exports.default = createBreakpoints;
|
|
|
8
8
|
// Sorted ASC by size. That's important.
|
|
9
9
|
// It can't be configured as it's used statically for propTypes.
|
|
10
10
|
const breakpointKeys = exports.breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
11
|
+
|
|
12
|
+
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
|
|
13
|
+
// #host-reference
|
|
14
|
+
|
|
11
15
|
const sortBreakpointsValues = values => {
|
|
12
16
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
13
17
|
key,
|
|
@@ -26,18 +30,12 @@ const sortBreakpointsValues = values => {
|
|
|
26
30
|
// Keep in mind that @media is inclusive by the CSS specification.
|
|
27
31
|
function createBreakpoints(breakpoints) {
|
|
28
32
|
const {
|
|
29
|
-
// The breakpoint **start** at this value.
|
|
30
|
-
// For instance with the first breakpoint xs: [xs, sm).
|
|
31
33
|
values = {
|
|
32
34
|
xs: 0,
|
|
33
|
-
// phone
|
|
34
35
|
sm: 600,
|
|
35
|
-
// tablet
|
|
36
36
|
md: 900,
|
|
37
|
-
// small laptop
|
|
38
37
|
lg: 1200,
|
|
39
|
-
|
|
40
|
-
xl: 1536 // large screen
|
|
38
|
+
xl: 1536
|
|
41
39
|
},
|
|
42
40
|
unit = 'px',
|
|
43
41
|
step = 5,
|
|
@@ -79,7 +77,7 @@ function createBreakpoints(breakpoints) {
|
|
|
79
77
|
mediaKeys.push(up(keys[i]));
|
|
80
78
|
}
|
|
81
79
|
return {
|
|
82
|
-
keys,
|
|
80
|
+
keys: keys,
|
|
83
81
|
values: sortedValues,
|
|
84
82
|
up,
|
|
85
83
|
down,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// Sorted ASC by size. That's important.
|
|
2
2
|
// It can't be configured as it's used statically for propTypes.
|
|
3
3
|
export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
4
|
+
|
|
5
|
+
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
|
|
6
|
+
// #host-reference
|
|
7
|
+
|
|
4
8
|
const sortBreakpointsValues = values => {
|
|
5
9
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
6
10
|
key,
|
|
@@ -19,18 +23,12 @@ const sortBreakpointsValues = values => {
|
|
|
19
23
|
// Keep in mind that @media is inclusive by the CSS specification.
|
|
20
24
|
export default function createBreakpoints(breakpoints) {
|
|
21
25
|
const {
|
|
22
|
-
// The breakpoint **start** at this value.
|
|
23
|
-
// For instance with the first breakpoint xs: [xs, sm).
|
|
24
26
|
values = {
|
|
25
27
|
xs: 0,
|
|
26
|
-
// phone
|
|
27
28
|
sm: 600,
|
|
28
|
-
// tablet
|
|
29
29
|
md: 900,
|
|
30
|
-
// small laptop
|
|
31
30
|
lg: 1200,
|
|
32
|
-
|
|
33
|
-
xl: 1536 // large screen
|
|
31
|
+
xl: 1536
|
|
34
32
|
},
|
|
35
33
|
unit = 'px',
|
|
36
34
|
step = 5,
|
|
@@ -72,7 +70,7 @@ export default function createBreakpoints(breakpoints) {
|
|
|
72
70
|
mediaKeys.push(up(keys[i]));
|
|
73
71
|
}
|
|
74
72
|
return {
|
|
75
|
-
keys,
|
|
73
|
+
keys: keys,
|
|
76
74
|
values: sortedValues,
|
|
77
75
|
up,
|
|
78
76
|
down,
|
package/createTheme/shape.d.mts
CHANGED
package/createTheme/shape.d.ts
CHANGED
package/cssGrid/cssGrid.d.mts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { PropsFor, SimpleStyleFunction } from "../style/index.mjs";
|
|
2
|
-
export const gap: SimpleStyleFunction<'gap'>;
|
|
3
|
-
export const columnGap: SimpleStyleFunction<'columnGap'>;
|
|
4
|
-
export const rowGap: SimpleStyleFunction<'rowGap'>;
|
|
5
|
-
export const gridColumn: SimpleStyleFunction<'gridColumn'>;
|
|
6
|
-
export const gridRow: SimpleStyleFunction<'gridRow'>;
|
|
7
|
-
export const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
|
|
8
|
-
export const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
|
|
9
|
-
export const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
|
|
10
|
-
export const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
|
|
11
|
-
export const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
|
|
12
|
-
export const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
|
|
13
|
-
export const gridArea: SimpleStyleFunction<'gridArea'>;
|
|
1
|
+
import type { PropsFor, SimpleStyleFunction } from "../style/index.mjs";
|
|
2
|
+
export declare const gap: SimpleStyleFunction<'gap'>;
|
|
3
|
+
export declare const columnGap: SimpleStyleFunction<'columnGap'>;
|
|
4
|
+
export declare const rowGap: SimpleStyleFunction<'rowGap'>;
|
|
5
|
+
export declare const gridColumn: SimpleStyleFunction<'gridColumn'>;
|
|
6
|
+
export declare const gridRow: SimpleStyleFunction<'gridRow'>;
|
|
7
|
+
export declare const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
|
|
8
|
+
export declare const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
|
|
9
|
+
export declare const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
|
|
10
|
+
export declare const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
|
|
11
|
+
export declare const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
|
|
12
|
+
export declare const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
|
|
13
|
+
export declare const gridArea: SimpleStyleFunction<'gridArea'>;
|
|
14
14
|
declare const grid: SimpleStyleFunction<'gap' | 'columnGap' | 'rowGap' | 'gridColumn' | 'gridRow' | 'gridAutoFlow' | 'gridAutoColumns' | 'gridAutoRows' | 'gridTemplateColumns' | 'gridTemplateRows' | 'gridTemplateAreas' | 'gridArea'>;
|
|
15
15
|
export type CssGridProps = PropsFor<typeof grid>;
|
|
16
16
|
export default grid;
|