@mui/system 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.
Files changed (283) hide show
  1. package/Box/Box.d.ts +12 -31
  2. package/CHANGELOG.md +157 -0
  3. package/Grid/createGrid.js +1 -2
  4. package/InitColorSchemeScript/InitColorSchemeScript.js +1 -1
  5. package/Stack/createStack.js +1 -2
  6. package/borders/borders.d.ts +2 -1
  7. package/breakpoints/breakpoints.d.ts +1 -1
  8. package/compose/compose.d.ts +14 -1
  9. package/compose/index.d.ts +1 -1
  10. package/cssGrid/cssGrid.d.ts +2 -1
  11. package/cssVars/cssVarsParser.d.ts +1 -1
  12. package/display/display.d.ts +2 -1
  13. package/esm/Box/Box.d.ts +12 -31
  14. package/esm/Grid/createGrid.js +1 -2
  15. package/esm/InitColorSchemeScript/InitColorSchemeScript.js +1 -1
  16. package/esm/Stack/createStack.js +1 -2
  17. package/esm/borders/borders.d.ts +2 -1
  18. package/esm/breakpoints/breakpoints.d.ts +1 -1
  19. package/esm/compose/compose.d.ts +14 -1
  20. package/esm/compose/index.d.ts +1 -1
  21. package/esm/cssGrid/cssGrid.d.ts +2 -1
  22. package/esm/cssVars/cssVarsParser.d.ts +1 -1
  23. package/esm/display/display.d.ts +2 -1
  24. package/esm/flexbox/flexbox.d.ts +15 -1
  25. package/esm/index.d.ts +10 -0
  26. package/esm/index.js +1 -1
  27. package/esm/memoTheme.d.ts +1 -1
  28. package/esm/palette/palette.d.ts +2 -1
  29. package/esm/positions/positions.d.ts +2 -1
  30. package/esm/shadows/shadows.d.ts +2 -1
  31. package/esm/sizing/sizing.d.ts +2 -1
  32. package/esm/spacing/spacing.d.ts +2 -1
  33. package/esm/style/style.d.ts +5 -1
  34. package/esm/styleFunctionSx/defaultSxConfig.d.ts +1 -2
  35. package/esm/typography/typography.d.ts +2 -1
  36. package/esm/useMediaQuery/useMediaQuery.js +3 -0
  37. package/esm/useThemeProps/getThemeProps.d.ts +0 -5
  38. package/esm/version/index.js +3 -3
  39. package/flexbox/flexbox.d.ts +15 -1
  40. package/index.d.ts +10 -0
  41. package/index.js +1 -1
  42. package/memoTheme.d.ts +1 -1
  43. package/package.json +7 -15
  44. package/palette/palette.d.ts +2 -1
  45. package/positions/positions.d.ts +2 -1
  46. package/shadows/shadows.d.ts +2 -1
  47. package/sizing/sizing.d.ts +2 -1
  48. package/spacing/spacing.d.ts +2 -1
  49. package/style/style.d.ts +5 -1
  50. package/styleFunctionSx/defaultSxConfig.d.ts +1 -2
  51. package/typography/typography.d.ts +2 -1
  52. package/useMediaQuery/useMediaQuery.js +3 -0
  53. package/useThemeProps/getThemeProps.d.ts +0 -5
  54. package/version/index.js +3 -3
  55. package/modern/Box/Box.d.ts +0 -72
  56. package/modern/Box/Box.js +0 -30
  57. package/modern/Box/boxClasses.d.ts +0 -7
  58. package/modern/Box/boxClasses.js +0 -3
  59. package/modern/Box/index.d.ts +0 -4
  60. package/modern/Box/index.js +0 -3
  61. package/modern/CSSProperties.d.ts +0 -7
  62. package/modern/Container/Container.d.ts +0 -13
  63. package/modern/Container/Container.js +0 -61
  64. package/modern/Container/ContainerProps.d.ts +0 -40
  65. package/modern/Container/ContainerProps.js +0 -1
  66. package/modern/Container/containerClasses.d.ts +0 -22
  67. package/modern/Container/containerClasses.js +0 -7
  68. package/modern/Container/createContainer.d.ts +0 -18
  69. package/modern/Container/createContainer.js +0 -149
  70. package/modern/Container/index.d.ts +0 -4
  71. package/modern/Container/index.js +0 -3
  72. package/modern/DefaultPropsProvider/DefaultPropsProvider.d.ts +0 -18
  73. package/modern/DefaultPropsProvider/DefaultPropsProvider.js +0 -64
  74. package/modern/DefaultPropsProvider/index.d.ts +0 -1
  75. package/modern/DefaultPropsProvider/index.js +0 -1
  76. package/modern/GlobalStyles/GlobalStyles.d.ts +0 -17
  77. package/modern/GlobalStyles/GlobalStyles.js +0 -37
  78. package/modern/GlobalStyles/index.d.ts +0 -2
  79. package/modern/GlobalStyles/index.js +0 -2
  80. package/modern/Grid/Grid.d.ts +0 -13
  81. package/modern/Grid/Grid.js +0 -106
  82. package/modern/Grid/GridProps.d.ts +0 -103
  83. package/modern/Grid/GridProps.js +0 -1
  84. package/modern/Grid/createGrid.d.ts +0 -13
  85. package/modern/Grid/createGrid.js +0 -155
  86. package/modern/Grid/deleteLegacyGridProps.d.ts +0 -11
  87. package/modern/Grid/deleteLegacyGridProps.js +0 -41
  88. package/modern/Grid/gridClasses.d.ts +0 -20
  89. package/modern/Grid/gridClasses.js +0 -19
  90. package/modern/Grid/gridGenerator.d.ts +0 -42
  91. package/modern/Grid/gridGenerator.js +0 -193
  92. package/modern/Grid/index.d.ts +0 -7
  93. package/modern/Grid/index.js +0 -7
  94. package/modern/Grid/traverseBreakpoints.d.ts +0 -7
  95. package/modern/Grid/traverseBreakpoints.js +0 -42
  96. package/modern/InitColorSchemeScript/InitColorSchemeScript.d.ts +0 -51
  97. package/modern/InitColorSchemeScript/InitColorSchemeScript.js +0 -78
  98. package/modern/InitColorSchemeScript/index.d.ts +0 -2
  99. package/modern/InitColorSchemeScript/index.js +0 -1
  100. package/modern/RtlProvider/index.d.ts +0 -8
  101. package/modern/RtlProvider/index.js +0 -24
  102. package/modern/Stack/Stack.d.ts +0 -14
  103. package/modern/Stack/Stack.js +0 -62
  104. package/modern/Stack/StackProps.d.ts +0 -53
  105. package/modern/Stack/StackProps.js +0 -1
  106. package/modern/Stack/createStack.d.ts +0 -24
  107. package/modern/Stack/createStack.js +0 -173
  108. package/modern/Stack/index.d.ts +0 -5
  109. package/modern/Stack/index.js +0 -5
  110. package/modern/Stack/stackClasses.d.ts +0 -8
  111. package/modern/Stack/stackClasses.js +0 -7
  112. package/modern/ThemeProvider/ThemeProvider.d.ts +0 -24
  113. package/modern/ThemeProvider/ThemeProvider.js +0 -97
  114. package/modern/ThemeProvider/index.d.ts +0 -2
  115. package/modern/ThemeProvider/index.js +0 -1
  116. package/modern/borders/borders.d.ts +0 -14
  117. package/modern/borders/borders.js +0 -49
  118. package/modern/borders/index.d.ts +0 -2
  119. package/modern/borders/index.js +0 -2
  120. package/modern/breakpoints/breakpoints.d.ts +0 -19
  121. package/modern/breakpoints/breakpoints.js +0 -171
  122. package/modern/breakpoints/index.d.ts +0 -2
  123. package/modern/breakpoints/index.js +0 -2
  124. package/modern/colorManipulator/colorManipulator.d.ts +0 -25
  125. package/modern/colorManipulator/colorManipulator.js +0 -349
  126. package/modern/colorManipulator/index.d.ts +0 -1
  127. package/modern/colorManipulator/index.js +0 -1
  128. package/modern/compose/compose.d.ts +0 -2
  129. package/modern/compose/compose.js +0 -24
  130. package/modern/compose/index.d.ts +0 -1
  131. package/modern/compose/index.js +0 -1
  132. package/modern/createBox/createBox.d.ts +0 -9
  133. package/modern/createBox/createBox.js +0 -35
  134. package/modern/createBox/index.d.ts +0 -1
  135. package/modern/createBox/index.js +0 -1
  136. package/modern/createBreakpoints/createBreakpoints.d.ts +0 -78
  137. package/modern/createBreakpoints/createBreakpoints.js +0 -81
  138. package/modern/createBreakpoints/index.d.ts +0 -3
  139. package/modern/createBreakpoints/index.js +0 -3
  140. package/modern/createStyled/createStyled.d.ts +0 -27
  141. package/modern/createStyled/createStyled.js +0 -276
  142. package/modern/createStyled/index.d.ts +0 -2
  143. package/modern/createStyled/index.js +0 -2
  144. package/modern/createTheme/applyStyles.d.ts +0 -67
  145. package/modern/createTheme/applyStyles.js +0 -87
  146. package/modern/createTheme/createSpacing.d.ts +0 -10
  147. package/modern/createTheme/createSpacing.js +0 -31
  148. package/modern/createTheme/createTheme.d.ts +0 -54
  149. package/modern/createTheme/createTheme.js +0 -49
  150. package/modern/createTheme/index.d.ts +0 -4
  151. package/modern/createTheme/index.js +0 -3
  152. package/modern/createTheme/shape.d.ts +0 -6
  153. package/modern/createTheme/shape.js +0 -4
  154. package/modern/cssContainerQueries/cssContainerQueries.d.ts +0 -23
  155. package/modern/cssContainerQueries/cssContainerQueries.js +0 -69
  156. package/modern/cssContainerQueries/index.d.ts +0 -3
  157. package/modern/cssContainerQueries/index.js +0 -2
  158. package/modern/cssGrid/cssGrid.d.ts +0 -15
  159. package/modern/cssGrid/cssGrid.js +0 -85
  160. package/modern/cssGrid/index.d.ts +0 -2
  161. package/modern/cssGrid/index.js +0 -2
  162. package/modern/cssVars/createCssVarsProvider.d.ts +0 -141
  163. package/modern/cssVars/createCssVarsProvider.js +0 -338
  164. package/modern/cssVars/createCssVarsTheme.d.ts +0 -15
  165. package/modern/cssVars/createCssVarsTheme.js +0 -21
  166. package/modern/cssVars/createGetCssVar.d.ts +0 -5
  167. package/modern/cssVars/createGetCssVar.js +0 -22
  168. package/modern/cssVars/cssVarsParser.d.ts +0 -64
  169. package/modern/cssVars/cssVarsParser.js +0 -129
  170. package/modern/cssVars/getColorSchemeSelector.d.ts +0 -1
  171. package/modern/cssVars/getColorSchemeSelector.js +0 -26
  172. package/modern/cssVars/index.d.ts +0 -8
  173. package/modern/cssVars/index.js +0 -5
  174. package/modern/cssVars/localStorageManager.d.ts +0 -34
  175. package/modern/cssVars/localStorageManager.js +0 -51
  176. package/modern/cssVars/prepareCssVars.d.ts +0 -16
  177. package/modern/cssVars/prepareCssVars.js +0 -153
  178. package/modern/cssVars/prepareTypographyVars.d.ts +0 -4
  179. package/modern/cssVars/prepareTypographyVars.js +0 -11
  180. package/modern/cssVars/useCurrentColorScheme.d.ts +0 -56
  181. package/modern/cssVars/useCurrentColorScheme.js +0 -228
  182. package/modern/display/display.d.ts +0 -3
  183. package/modern/display/display.js +0 -27
  184. package/modern/display/index.d.ts +0 -2
  185. package/modern/display/index.js +0 -2
  186. package/modern/flexbox/flexbox.d.ts +0 -3
  187. package/modern/flexbox/flexbox.js +0 -43
  188. package/modern/flexbox/index.d.ts +0 -2
  189. package/modern/flexbox/index.js +0 -2
  190. package/modern/getThemeValue/getThemeValue.d.ts +0 -1
  191. package/modern/getThemeValue/getThemeValue.js +0 -51
  192. package/modern/getThemeValue/index.d.ts +0 -2
  193. package/modern/getThemeValue/index.js +0 -2
  194. package/modern/index.d.ts +0 -80
  195. package/modern/index.js +0 -75
  196. package/modern/memoTheme.d.ts +0 -12
  197. package/modern/memoTheme.js +0 -28
  198. package/modern/memoize/index.d.ts +0 -1
  199. package/modern/memoize/index.js +0 -1
  200. package/modern/memoize/memoize.d.ts +0 -1
  201. package/modern/memoize/memoize.js +0 -9
  202. package/modern/merge/index.d.ts +0 -1
  203. package/modern/merge/index.js +0 -1
  204. package/modern/merge/merge.d.ts +0 -1
  205. package/modern/merge/merge.js +0 -10
  206. package/modern/package.json +0 -1
  207. package/modern/palette/index.d.ts +0 -2
  208. package/modern/palette/index.js +0 -2
  209. package/modern/palette/palette.d.ts +0 -5
  210. package/modern/palette/palette.js +0 -26
  211. package/modern/positions/index.d.ts +0 -2
  212. package/modern/positions/index.js +0 -2
  213. package/modern/positions/positions.d.ts +0 -3
  214. package/modern/positions/positions.js +0 -22
  215. package/modern/preprocessStyles.d.ts +0 -5
  216. package/modern/preprocessStyles.js +0 -25
  217. package/modern/propsToClassKey/index.d.ts +0 -1
  218. package/modern/propsToClassKey/index.js +0 -1
  219. package/modern/propsToClassKey/propsToClassKey.d.ts +0 -1
  220. package/modern/propsToClassKey/propsToClassKey.js +0 -25
  221. package/modern/responsivePropType/index.d.ts +0 -1
  222. package/modern/responsivePropType/index.js +0 -1
  223. package/modern/responsivePropType/responsivePropType.d.ts +0 -2
  224. package/modern/responsivePropType/responsivePropType.js +0 -3
  225. package/modern/shadows/index.d.ts +0 -1
  226. package/modern/shadows/index.js +0 -1
  227. package/modern/shadows/shadows.d.ts +0 -3
  228. package/modern/shadows/shadows.js +0 -6
  229. package/modern/sizing/index.d.ts +0 -2
  230. package/modern/sizing/index.js +0 -2
  231. package/modern/sizing/sizing.d.ts +0 -12
  232. package/modern/sizing/sizing.js +0 -64
  233. package/modern/spacing/index.d.ts +0 -2
  234. package/modern/spacing/index.js +0 -2
  235. package/modern/spacing/spacing.d.ts +0 -19
  236. package/modern/spacing/spacing.js +0 -157
  237. package/modern/style/index.d.ts +0 -2
  238. package/modern/style/index.js +0 -2
  239. package/modern/style/style.d.ts +0 -19
  240. package/modern/style/style.js +0 -75
  241. package/modern/styleFunctionSx/AliasesCSSProperties.d.ts +0 -269
  242. package/modern/styleFunctionSx/AliasesCSSProperties.js +0 -1
  243. package/modern/styleFunctionSx/OverwriteCSSProperties.d.ts +0 -54
  244. package/modern/styleFunctionSx/OverwriteCSSProperties.js +0 -1
  245. package/modern/styleFunctionSx/StandardCssProperties.d.ts +0 -2
  246. package/modern/styleFunctionSx/StandardCssProperties.js +0 -1
  247. package/modern/styleFunctionSx/defaultSxConfig.d.ts +0 -15
  248. package/modern/styleFunctionSx/defaultSxConfig.js +0 -294
  249. package/modern/styleFunctionSx/extendSxProp.d.ts +0 -4
  250. package/modern/styleFunctionSx/extendSxProp.js +0 -51
  251. package/modern/styleFunctionSx/index.d.ts +0 -9
  252. package/modern/styleFunctionSx/index.js +0 -4
  253. package/modern/styleFunctionSx/styleFunctionSx.d.ts +0 -62
  254. package/modern/styleFunctionSx/styleFunctionSx.js +0 -127
  255. package/modern/styled/index.d.ts +0 -1
  256. package/modern/styled/index.js +0 -1
  257. package/modern/styled/styled.d.ts +0 -3
  258. package/modern/styled/styled.js +0 -3
  259. package/modern/typography/index.d.ts +0 -2
  260. package/modern/typography/index.js +0 -2
  261. package/modern/typography/typography.d.ts +0 -12
  262. package/modern/typography/typography.js +0 -37
  263. package/modern/useMediaQuery/index.d.ts +0 -2
  264. package/modern/useMediaQuery/index.js +0 -2
  265. package/modern/useMediaQuery/useMediaQuery.d.ts +0 -32
  266. package/modern/useMediaQuery/useMediaQuery.js +0 -118
  267. package/modern/useTheme/index.d.ts +0 -2
  268. package/modern/useTheme/index.js +0 -2
  269. package/modern/useTheme/useTheme.d.ts +0 -2
  270. package/modern/useTheme/useTheme.js +0 -9
  271. package/modern/useThemeProps/getThemeProps.d.ts +0 -16
  272. package/modern/useThemeProps/getThemeProps.js +0 -12
  273. package/modern/useThemeProps/index.d.ts +0 -3
  274. package/modern/useThemeProps/index.js +0 -2
  275. package/modern/useThemeProps/useThemeProps.d.ts +0 -14
  276. package/modern/useThemeProps/useThemeProps.js +0 -20
  277. package/modern/useThemeWithoutDefault/index.d.ts +0 -1
  278. package/modern/useThemeWithoutDefault/index.js +0 -1
  279. package/modern/useThemeWithoutDefault/useThemeWithoutDefault.d.ts +0 -1
  280. package/modern/useThemeWithoutDefault/useThemeWithoutDefault.js +0 -12
  281. package/modern/version/index.d.ts +0 -6
  282. package/modern/version/index.js +0 -6
  283. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,35 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import clsx from 'clsx';
5
- import styled from '@mui/styled-engine';
6
- import styleFunctionSx, { extendSxProp } from "../styleFunctionSx/index.js";
7
- import useTheme from "../useTheme/index.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export default function createBox(options = {}) {
10
- const {
11
- themeId,
12
- defaultTheme,
13
- defaultClassName = 'MuiBox-root',
14
- generateClassName
15
- } = options;
16
- const BoxRoot = styled('div', {
17
- shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
18
- })(styleFunctionSx);
19
- const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
20
- const theme = useTheme(defaultTheme);
21
- const {
22
- className,
23
- component = 'div',
24
- ...other
25
- } = extendSxProp(inProps);
26
- return /*#__PURE__*/_jsx(BoxRoot, {
27
- as: component,
28
- ref: ref,
29
- className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
30
- theme: themeId ? theme[themeId] || theme : theme,
31
- ...other
32
- });
33
- });
34
- return Box;
35
- }
@@ -1 +0,0 @@
1
- export { default } from "./createBox.js";
@@ -1 +0,0 @@
1
- export { default } from "./createBox.js";
@@ -1,78 +0,0 @@
1
- import { OverridableStringUnion } from '@mui/types';
2
- export interface BreakpointOverrides {}
3
- export type Breakpoint = OverridableStringUnion<'xs' | 'sm' | 'md' | 'lg' | 'xl', BreakpointOverrides>;
4
- export const keys: Breakpoint[];
5
-
6
- // Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
7
- // #host-reference
8
- export interface Breakpoints {
9
- 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
- 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
- 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
- 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
- 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
- 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
- not: (key: Breakpoint) => string;
59
- /**
60
- * The unit used for the breakpoint's values.
61
- * @default 'px'
62
- */
63
- unit?: string | undefined;
64
- }
65
- export interface BreakpointsOptions extends Partial<Breakpoints> {
66
- /**
67
- * The increment divided by 100 used to implement exclusive breakpoints.
68
- * For example, `step: 5` means that `down(500)` will result in `'(max-width: 499.95px)'`.
69
- * @default 5
70
- */
71
- step?: number | undefined;
72
- /**
73
- * The unit used for the breakpoint's values.
74
- * @default 'px'
75
- */
76
- unit?: string | undefined;
77
- }
78
- export default function createBreakpoints(options: BreakpointsOptions): Breakpoints;
@@ -1,81 +0,0 @@
1
- // Sorted ASC by size. That's important.
2
- // It can't be configured as it's used statically for propTypes.
3
- export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
4
- const sortBreakpointsValues = values => {
5
- const breakpointsAsArray = Object.keys(values).map(key => ({
6
- key,
7
- val: values[key]
8
- })) || [];
9
- // Sort in ascending order
10
- breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
11
- return breakpointsAsArray.reduce((acc, obj) => {
12
- return {
13
- ...acc,
14
- [obj.key]: obj.val
15
- };
16
- }, {});
17
- };
18
-
19
- // Keep in mind that @media is inclusive by the CSS specification.
20
- export default function createBreakpoints(breakpoints) {
21
- const {
22
- // The breakpoint **start** at this value.
23
- // For instance with the first breakpoint xs: [xs, sm).
24
- values = {
25
- xs: 0,
26
- // phone
27
- sm: 600,
28
- // tablet
29
- md: 900,
30
- // small laptop
31
- lg: 1200,
32
- // desktop
33
- xl: 1536 // large screen
34
- },
35
- unit = 'px',
36
- step = 5,
37
- ...other
38
- } = breakpoints;
39
- const sortedValues = sortBreakpointsValues(values);
40
- const keys = Object.keys(sortedValues);
41
- function up(key) {
42
- const value = typeof values[key] === 'number' ? values[key] : key;
43
- return `@media (min-width:${value}${unit})`;
44
- }
45
- function down(key) {
46
- const value = typeof values[key] === 'number' ? values[key] : key;
47
- return `@media (max-width:${value - step / 100}${unit})`;
48
- }
49
- function between(start, end) {
50
- const endIndex = keys.indexOf(end);
51
- return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`;
52
- }
53
- function only(key) {
54
- if (keys.indexOf(key) + 1 < keys.length) {
55
- return between(key, keys[keys.indexOf(key) + 1]);
56
- }
57
- return up(key);
58
- }
59
- function not(key) {
60
- // handle first and last key separately, for better readability
61
- const keyIndex = keys.indexOf(key);
62
- if (keyIndex === 0) {
63
- return up(keys[1]);
64
- }
65
- if (keyIndex === keys.length - 1) {
66
- return down(keys[keyIndex]);
67
- }
68
- return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
69
- }
70
- return {
71
- keys,
72
- values: sortedValues,
73
- up,
74
- down,
75
- between,
76
- only,
77
- not,
78
- unit,
79
- ...other
80
- };
81
- }
@@ -1,3 +0,0 @@
1
- /** This export is intended for internal integration with Pigment CSS */
2
- /* eslint-disable import/prefer-default-export */
3
- export { default as unstable_createBreakpoints } from "./createBreakpoints.js";
@@ -1,3 +0,0 @@
1
- /** This export is intended for internal integration with Pigment CSS */
2
- /* eslint-disable import/prefer-default-export */
3
- export { default as unstable_createBreakpoints } from "./createBreakpoints.js";
@@ -1,27 +0,0 @@
1
- import * as React from 'react';
2
- import { CreateMUIStyled as CreateMUIStyledStyledEngine, CSSInterpolation } from '@mui/styled-engine';
3
- import styleFunctionSx, { SxProps } from "../styleFunctionSx/index.js";
4
- import { Theme as DefaultTheme } from "../createTheme/index.js";
5
- export function shouldForwardProp(propName: PropertyKey): boolean;
6
- export interface MUIStyledCommonProps<Theme extends object = DefaultTheme> {
7
- theme?: Theme;
8
- as?: React.ElementType;
9
- sx?: SxProps<Theme>;
10
- }
11
- export interface MuiStyledOptions {
12
- name?: string;
13
- slot?: string;
14
- // The difference between Interpolation and CSSInterpolation is that the former supports functions based on props
15
- // If we want to support props in the overrides, we will need to change the CSSInterpolation to Interpolation<Props>
16
- overridesResolver?: (props: any, styles: Record<string, CSSInterpolation>) => CSSInterpolation;
17
- skipVariantsResolver?: boolean;
18
- skipSx?: boolean;
19
- }
20
- export type CreateMUIStyled<Theme extends object = DefaultTheme> = CreateMUIStyledStyledEngine<MUIStyledCommonProps<Theme>, MuiStyledOptions, Theme>;
21
- export default function createStyled<Theme extends object = DefaultTheme>(options?: {
22
- themeId?: string;
23
- defaultTheme?: Theme;
24
- rootShouldForwardProp?: (prop: PropertyKey) => boolean;
25
- slotShouldForwardProp?: (prop: PropertyKey) => boolean;
26
- styleFunctionSx?: typeof styleFunctionSx;
27
- }): CreateMUIStyled<Theme>;
@@ -1,276 +0,0 @@
1
- import styledEngineStyled, { internal_mutateStyles as mutateStyles } from '@mui/styled-engine';
2
- import { isPlainObject } from '@mui/utils/deepmerge';
3
- import capitalize from '@mui/utils/capitalize';
4
- import getDisplayName from '@mui/utils/getDisplayName';
5
- import createTheme from "../createTheme/index.js";
6
- import styleFunctionSx from "../styleFunctionSx/index.js";
7
- import preprocessStyles from "../preprocessStyles.js";
8
-
9
- /* eslint-disable no-underscore-dangle */
10
- /* eslint-disable no-labels */
11
- /* eslint-disable no-lone-blocks */
12
-
13
- export const systemDefaultTheme = createTheme();
14
-
15
- // Update /system/styled/#api in case if this changes
16
- export function shouldForwardProp(prop) {
17
- return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
18
- }
19
- function defaultOverridesResolver(slot) {
20
- if (!slot) {
21
- return null;
22
- }
23
- return (_props, styles) => styles[slot];
24
- }
25
- function attachTheme(props, themeId, defaultTheme) {
26
- props.theme = isObjectEmpty(props.theme) ? defaultTheme : props.theme[themeId] || props.theme;
27
- }
28
- function processStyle(props, style) {
29
- /*
30
- * Style types:
31
- * - null/undefined
32
- * - string
33
- * - CSS style object: { [cssKey]: [cssValue], variants }
34
- * - Processed style object: { style, variants, isProcessed: true }
35
- * - Array of any of the above
36
- */
37
-
38
- const resolvedStyle = typeof style === 'function' ? style(props) : style;
39
- if (Array.isArray(resolvedStyle)) {
40
- return resolvedStyle.flatMap(subStyle => processStyle(props, subStyle));
41
- }
42
- if (Array.isArray(resolvedStyle?.variants)) {
43
- let rootStyle;
44
- if (resolvedStyle.isProcessed) {
45
- rootStyle = resolvedStyle.style;
46
- } else {
47
- const {
48
- variants,
49
- ...otherStyles
50
- } = resolvedStyle;
51
- rootStyle = otherStyles;
52
- }
53
- return processStyleVariants(props, resolvedStyle.variants, [rootStyle]);
54
- }
55
- if (resolvedStyle?.isProcessed) {
56
- return resolvedStyle.style;
57
- }
58
- return resolvedStyle;
59
- }
60
- function processStyleVariants(props, variants, results = []) {
61
- let mergedState; // We might not need it, initialized lazily
62
-
63
- variantLoop: for (let i = 0; i < variants.length; i += 1) {
64
- const variant = variants[i];
65
- if (typeof variant.props === 'function') {
66
- mergedState ?? (mergedState = {
67
- ...props,
68
- ...props.ownerState,
69
- ownerState: props.ownerState
70
- });
71
- if (!variant.props(mergedState)) {
72
- continue;
73
- }
74
- } else {
75
- for (const key in variant.props) {
76
- if (props[key] !== variant.props[key] && props.ownerState?.[key] !== variant.props[key]) {
77
- continue variantLoop;
78
- }
79
- }
80
- }
81
- if (typeof variant.style === 'function') {
82
- mergedState ?? (mergedState = {
83
- ...props,
84
- ...props.ownerState,
85
- ownerState: props.ownerState
86
- });
87
- results.push(variant.style(mergedState));
88
- } else {
89
- results.push(variant.style);
90
- }
91
- }
92
- return results;
93
- }
94
- export default function createStyled(input = {}) {
95
- const {
96
- themeId,
97
- defaultTheme = systemDefaultTheme,
98
- rootShouldForwardProp = shouldForwardProp,
99
- slotShouldForwardProp = shouldForwardProp
100
- } = input;
101
- function styleAttachTheme(props) {
102
- attachTheme(props, themeId, defaultTheme);
103
- }
104
- const styled = (tag, inputOptions = {}) => {
105
- // If `tag` is already a styled component, filter out the `sx` style function
106
- // to prevent unnecessary styles generated by the composite components.
107
- mutateStyles(tag, styles => styles.filter(style => style !== styleFunctionSx));
108
- const {
109
- name: componentName,
110
- slot: componentSlot,
111
- skipVariantsResolver: inputSkipVariantsResolver,
112
- skipSx: inputSkipSx,
113
- // TODO v6: remove `lowercaseFirstLetter()` in the next major release
114
- // For more details: https://github.com/mui/material-ui/pull/37908
115
- overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
116
- ...options
117
- } = inputOptions;
118
-
119
- // if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
120
- const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
121
- // TODO v6: remove `Root` in the next major release
122
- // For more details: https://github.com/mui/material-ui/pull/37908
123
- componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
124
- const skipSx = inputSkipSx || false;
125
- let shouldForwardPropOption = shouldForwardProp;
126
-
127
- // TODO v6: remove `Root` in the next major release
128
- // For more details: https://github.com/mui/material-ui/pull/37908
129
- if (componentSlot === 'Root' || componentSlot === 'root') {
130
- shouldForwardPropOption = rootShouldForwardProp;
131
- } else if (componentSlot) {
132
- // any other slot specified
133
- shouldForwardPropOption = slotShouldForwardProp;
134
- } else if (isStringTag(tag)) {
135
- // for string (html) tag, preserve the behavior in emotion & styled-components.
136
- shouldForwardPropOption = undefined;
137
- }
138
- const defaultStyledResolver = styledEngineStyled(tag, {
139
- shouldForwardProp: shouldForwardPropOption,
140
- label: generateStyledLabel(componentName, componentSlot),
141
- ...options
142
- });
143
- const transformStyle = style => {
144
- // On the server Emotion doesn't use React.forwardRef for creating components, so the created
145
- // component stays as a function. This condition makes sure that we do not interpolate functions
146
- // which are basically components used as a selectors.
147
- if (typeof style === 'function' && style.__emotion_real !== style) {
148
- return function styleFunctionProcessor(props) {
149
- return processStyle(props, style);
150
- };
151
- }
152
- if (isPlainObject(style)) {
153
- const serialized = preprocessStyles(style);
154
- if (!serialized.variants) {
155
- return serialized.style;
156
- }
157
- return function styleObjectProcessor(props) {
158
- return processStyle(props, serialized);
159
- };
160
- }
161
- return style;
162
- };
163
- const muiStyledResolver = (...expressionsInput) => {
164
- const expressionsHead = [];
165
- const expressionsBody = expressionsInput.map(transformStyle);
166
- const expressionsTail = [];
167
-
168
- // Preprocess `props` to set the scoped theme value.
169
- // This must run before any other expression.
170
- expressionsHead.push(styleAttachTheme);
171
- if (componentName && overridesResolver) {
172
- expressionsTail.push(function styleThemeOverrides(props) {
173
- const theme = props.theme;
174
- const styleOverrides = theme.components?.[componentName]?.styleOverrides;
175
- if (!styleOverrides) {
176
- return null;
177
- }
178
- const resolvedStyleOverrides = {};
179
-
180
- // TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
181
- // eslint-disable-next-line guard-for-in
182
- for (const slotKey in styleOverrides) {
183
- resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey]);
184
- }
185
- return overridesResolver(props, resolvedStyleOverrides);
186
- });
187
- }
188
- if (componentName && !skipVariantsResolver) {
189
- expressionsTail.push(function styleThemeVariants(props) {
190
- const theme = props.theme;
191
- const themeVariants = theme?.components?.[componentName]?.variants;
192
- if (!themeVariants) {
193
- return null;
194
- }
195
- return processStyleVariants(props, themeVariants);
196
- });
197
- }
198
- if (!skipSx) {
199
- expressionsTail.push(styleFunctionSx);
200
- }
201
-
202
- // This function can be called as a tagged template, so the first argument would contain
203
- // CSS `string[]` values.
204
- if (Array.isArray(expressionsBody[0])) {
205
- const inputStrings = expressionsBody.shift();
206
-
207
- // We need to add placeholders in the tagged template for the custom functions we have
208
- // possibly added (attachTheme, overrides, variants, and sx).
209
- const placeholdersHead = new Array(expressionsHead.length).fill('');
210
- const placeholdersTail = new Array(expressionsTail.length).fill('');
211
- let outputStrings;
212
- // prettier-ignore
213
- {
214
- outputStrings = [...placeholdersHead, ...inputStrings, ...placeholdersTail];
215
- outputStrings.raw = [...placeholdersHead, ...inputStrings.raw, ...placeholdersTail];
216
- }
217
-
218
- // The only case where we put something before `attachTheme`
219
- expressionsHead.unshift(outputStrings);
220
- }
221
- const expressions = [...expressionsHead, ...expressionsBody, ...expressionsTail];
222
- const Component = defaultStyledResolver(...expressions);
223
- if (tag.muiName) {
224
- Component.muiName = tag.muiName;
225
- }
226
- if (process.env.NODE_ENV !== 'production') {
227
- Component.displayName = generateDisplayName(componentName, componentSlot, tag);
228
- }
229
- return Component;
230
- };
231
- if (defaultStyledResolver.withConfig) {
232
- muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
233
- }
234
- return muiStyledResolver;
235
- };
236
- return styled;
237
- }
238
- function generateDisplayName(componentName, componentSlot, tag) {
239
- if (componentName) {
240
- return `${componentName}${capitalize(componentSlot || '')}`;
241
- }
242
- return `Styled(${getDisplayName(tag)})`;
243
- }
244
- function generateStyledLabel(componentName, componentSlot) {
245
- let label;
246
- if (process.env.NODE_ENV !== 'production') {
247
- if (componentName) {
248
- // TODO v6: remove `lowercaseFirstLetter()` in the next major release
249
- // For more details: https://github.com/mui/material-ui/pull/37908
250
- label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
251
- }
252
- }
253
- return label;
254
- }
255
- function isObjectEmpty(object) {
256
- // eslint-disable-next-line
257
- for (const _ in object) {
258
- return false;
259
- }
260
- return true;
261
- }
262
-
263
- // https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
264
- function isStringTag(tag) {
265
- return typeof tag === 'string' &&
266
- // 96 is one less than the char code
267
- // for "a" so this is checking that
268
- // it's a lowercase character
269
- tag.charCodeAt(0) > 96;
270
- }
271
- function lowercaseFirstLetter(string) {
272
- if (!string) {
273
- return string;
274
- }
275
- return string.charAt(0).toLowerCase() + string.slice(1);
276
- }
@@ -1,2 +0,0 @@
1
- export { default } from "./createStyled.js";
2
- export * from "./createStyled.js";
@@ -1,2 +0,0 @@
1
- export { default } from "./createStyled.js";
2
- export * from "./createStyled.js";
@@ -1,67 +0,0 @@
1
- import { CSSObject } from '@mui/styled-engine';
2
- export interface ApplyStyles<K extends string> {
3
- (key: K, styles: CSSObject): CSSObject;
4
- }
5
- /**
6
- * A universal utility to style components with multiple color modes. Always use it from the theme object.
7
- * It works with:
8
- * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
9
- * - [CSS theme variables](https://mui.com/material-ui/customization/css-theme-variables/overview/)
10
- * - Zero-runtime engine
11
- *
12
- * Tips: Use an array over object spread and place `theme.applyStyles()` last.
13
- *
14
- * With the styled function:
15
- * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
16
- * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
17
- *
18
- * With the sx prop:
19
- * ✅ [{ background: '#e5e5e5' }, theme => theme.applyStyles('dark', { background: '#1c1c1c' })]
20
- * 🚫 { background: '#e5e5e5', ...theme => theme.applyStyles('dark', { background: '#1c1c1c' })}
21
- *
22
- * @example
23
- * 1. using with `styled`:
24
- * ```jsx
25
- * const Component = styled('div')(({ theme }) => [
26
- * { background: '#e5e5e5' },
27
- * theme.applyStyles('dark', {
28
- * background: '#1c1c1c',
29
- * color: '#fff',
30
- * }),
31
- * ]);
32
- * ```
33
- *
34
- * @example
35
- * 2. using with `sx` prop:
36
- * ```jsx
37
- * <Box sx={[
38
- * { background: '#e5e5e5' },
39
- * theme => theme.applyStyles('dark', {
40
- * background: '#1c1c1c',
41
- * color: '#fff',
42
- * }),
43
- * ]}
44
- * />
45
- * ```
46
- *
47
- * @example
48
- * 3. theming a component:
49
- * ```jsx
50
- * extendTheme({
51
- * components: {
52
- * MuiButton: {
53
- * styleOverrides: {
54
- * root: ({ theme }) => [
55
- * { background: '#e5e5e5' },
56
- * theme.applyStyles('dark', {
57
- * background: '#1c1c1c',
58
- * color: '#fff',
59
- * }),
60
- * ],
61
- * },
62
- * }
63
- * }
64
- * })
65
- *```
66
- */
67
- export default function applyStyles<K extends string>(key: K, styles: CSSObject): CSSObject;
@@ -1,87 +0,0 @@
1
- /**
2
- * A universal utility to style components with multiple color modes. Always use it from the theme object.
3
- * It works with:
4
- * - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
5
- * - [CSS theme variables](https://mui.com/material-ui/customization/css-theme-variables/overview/)
6
- * - Zero-runtime engine
7
- *
8
- * Tips: Use an array over object spread and place `theme.applyStyles()` last.
9
- *
10
- * With the styled function:
11
- * ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
12
- * 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
13
- *
14
- * With the sx prop:
15
- * ✅ [{ background: '#e5e5e5' }, theme => theme.applyStyles('dark', { background: '#1c1c1c' })]
16
- * 🚫 { background: '#e5e5e5', ...theme => theme.applyStyles('dark', { background: '#1c1c1c' })}
17
- *
18
- * @example
19
- * 1. using with `styled`:
20
- * ```jsx
21
- * const Component = styled('div')(({ theme }) => [
22
- * { background: '#e5e5e5' },
23
- * theme.applyStyles('dark', {
24
- * background: '#1c1c1c',
25
- * color: '#fff',
26
- * }),
27
- * ]);
28
- * ```
29
- *
30
- * @example
31
- * 2. using with `sx` prop:
32
- * ```jsx
33
- * <Box sx={[
34
- * { background: '#e5e5e5' },
35
- * theme => theme.applyStyles('dark', {
36
- * background: '#1c1c1c',
37
- * color: '#fff',
38
- * }),
39
- * ]}
40
- * />
41
- * ```
42
- *
43
- * @example
44
- * 3. theming a component:
45
- * ```jsx
46
- * extendTheme({
47
- * components: {
48
- * MuiButton: {
49
- * styleOverrides: {
50
- * root: ({ theme }) => [
51
- * { background: '#e5e5e5' },
52
- * theme.applyStyles('dark', {
53
- * background: '#1c1c1c',
54
- * color: '#fff',
55
- * }),
56
- * ],
57
- * },
58
- * }
59
- * }
60
- * })
61
- *```
62
- */
63
- export default function applyStyles(key, styles) {
64
- // @ts-expect-error this is 'any' type
65
- const theme = this;
66
- if (theme.vars) {
67
- if (!theme.colorSchemes?.[key] || typeof theme.getColorSchemeSelector !== 'function') {
68
- return {};
69
- }
70
- // If CssVarsProvider is used as a provider, returns '*:where({selector}) &'
71
- let selector = theme.getColorSchemeSelector(key);
72
- if (selector === '&') {
73
- return styles;
74
- }
75
- if (selector.includes('data-') || selector.includes('.')) {
76
- // '*' is required as a workaround for Emotion issue (https://github.com/emotion-js/emotion/issues/2836)
77
- selector = `*:where(${selector.replace(/\s*&$/, '')}) &`;
78
- }
79
- return {
80
- [selector]: styles
81
- };
82
- }
83
- if (theme.palette.mode === key) {
84
- return styles;
85
- }
86
- return {};
87
- }