@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,157 +0,0 @@
1
- import responsivePropType from "../responsivePropType/index.js";
2
- import { handleBreakpoints } from "../breakpoints/index.js";
3
- import { getPath } from "../style/index.js";
4
- import merge from "../merge/index.js";
5
- import memoize from "../memoize/index.js";
6
- const properties = {
7
- m: 'margin',
8
- p: 'padding'
9
- };
10
- const directions = {
11
- t: 'Top',
12
- r: 'Right',
13
- b: 'Bottom',
14
- l: 'Left',
15
- x: ['Left', 'Right'],
16
- y: ['Top', 'Bottom']
17
- };
18
- const aliases = {
19
- marginX: 'mx',
20
- marginY: 'my',
21
- paddingX: 'px',
22
- paddingY: 'py'
23
- };
24
-
25
- // memoize() impact:
26
- // From 300,000 ops/sec
27
- // To 350,000 ops/sec
28
- const getCssProperties = memoize(prop => {
29
- // It's not a shorthand notation.
30
- if (prop.length > 2) {
31
- if (aliases[prop]) {
32
- prop = aliases[prop];
33
- } else {
34
- return [prop];
35
- }
36
- }
37
- const [a, b] = prop.split('');
38
- const property = properties[a];
39
- const direction = directions[b] || '';
40
- return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
41
- });
42
- export const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
43
- export const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
44
- const spacingKeys = [...marginKeys, ...paddingKeys];
45
- export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
46
- const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
47
- if (typeof themeSpacing === 'number' || typeof themeSpacing === 'string') {
48
- return val => {
49
- if (typeof val === 'string') {
50
- return val;
51
- }
52
- if (process.env.NODE_ENV !== 'production') {
53
- if (typeof val !== 'number') {
54
- console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${val}.`);
55
- }
56
- }
57
- if (typeof themeSpacing === 'string') {
58
- if (themeSpacing.startsWith('var(') && val === 0) {
59
- return 0;
60
- }
61
- if (themeSpacing.startsWith('var(') && val === 1) {
62
- return themeSpacing;
63
- }
64
- return `calc(${val} * ${themeSpacing})`;
65
- }
66
- return themeSpacing * val;
67
- };
68
- }
69
- if (Array.isArray(themeSpacing)) {
70
- return val => {
71
- if (typeof val === 'string') {
72
- return val;
73
- }
74
- const abs = Math.abs(val);
75
- if (process.env.NODE_ENV !== 'production') {
76
- if (!Number.isInteger(abs)) {
77
- console.error([`MUI: The \`theme.${themeKey}\` array type cannot be combined with non integer values.` + `You should either use an integer value that can be used as index, or define the \`theme.${themeKey}\` as a number.`].join('\n'));
78
- } else if (abs > themeSpacing.length - 1) {
79
- console.error([`MUI: The value provided (${abs}) overflows.`, `The supported values are: ${JSON.stringify(themeSpacing)}.`, `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`].join('\n'));
80
- }
81
- }
82
- const transformed = themeSpacing[abs];
83
- if (val >= 0) {
84
- return transformed;
85
- }
86
- if (typeof transformed === 'number') {
87
- return -transformed;
88
- }
89
- if (typeof transformed === 'string' && transformed.startsWith('var(')) {
90
- return `calc(-1 * ${transformed})`;
91
- }
92
- return `-${transformed}`;
93
- };
94
- }
95
- if (typeof themeSpacing === 'function') {
96
- return themeSpacing;
97
- }
98
- if (process.env.NODE_ENV !== 'production') {
99
- console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, 'It should be a number, an array or a function.'].join('\n'));
100
- }
101
- return () => undefined;
102
- }
103
- export function createUnarySpacing(theme) {
104
- return createUnaryUnit(theme, 'spacing', 8, 'spacing');
105
- }
106
- export function getValue(transformer, propValue) {
107
- if (typeof propValue === 'string' || propValue == null) {
108
- return propValue;
109
- }
110
- return transformer(propValue);
111
- }
112
- export function getStyleFromPropValue(cssProperties, transformer) {
113
- return propValue => cssProperties.reduce((acc, cssProperty) => {
114
- acc[cssProperty] = getValue(transformer, propValue);
115
- return acc;
116
- }, {});
117
- }
118
- function resolveCssProperty(props, keys, prop, transformer) {
119
- // Using a hash computation over an array iteration could be faster, but with only 28 items,
120
- // it's doesn't worth the bundle size.
121
- if (!keys.includes(prop)) {
122
- return null;
123
- }
124
- const cssProperties = getCssProperties(prop);
125
- const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
126
- const propValue = props[prop];
127
- return handleBreakpoints(props, propValue, styleFromPropValue);
128
- }
129
- function style(props, keys) {
130
- const transformer = createUnarySpacing(props.theme);
131
- return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
132
- }
133
- export function margin(props) {
134
- return style(props, marginKeys);
135
- }
136
- margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
137
- obj[key] = responsivePropType;
138
- return obj;
139
- }, {}) : {};
140
- margin.filterProps = marginKeys;
141
- export function padding(props) {
142
- return style(props, paddingKeys);
143
- }
144
- padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
145
- obj[key] = responsivePropType;
146
- return obj;
147
- }, {}) : {};
148
- padding.filterProps = paddingKeys;
149
- function spacing(props) {
150
- return style(props, spacingKeys);
151
- }
152
- spacing.propTypes = process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
153
- obj[key] = responsivePropType;
154
- return obj;
155
- }, {}) : {};
156
- spacing.filterProps = spacingKeys;
157
- export default spacing;
@@ -1,2 +0,0 @@
1
- export { default } from "./style.js";
2
- export * from "./style.js";
@@ -1,2 +0,0 @@
1
- export { default } from "./style.js";
2
- export * from "./style.js";
@@ -1,19 +0,0 @@
1
- import { CSSObject } from '@mui/styled-engine';
2
- import { StyleFunction } from "../Box/index.js";
3
- export type TransformFunction = (cssValue: unknown, userValue: unknown) => number | string | React.CSSProperties | CSSObject;
4
- export interface StyleOptions<PropKey> {
5
- cssProperty?: PropKey | keyof React.CSSProperties | false;
6
- prop: PropKey;
7
- /**
8
- * dot access in `Theme`
9
- */
10
- themeKey?: string;
11
- transform?: TransformFunction;
12
- }
13
- export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
14
- export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
15
- export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
16
- theme?: Theme;
17
- }> & {
18
- filterProps: string[];
19
- };
@@ -1,75 +0,0 @@
1
- import capitalize from '@mui/utils/capitalize';
2
- import responsivePropType from "../responsivePropType/index.js";
3
- import { handleBreakpoints } from "../breakpoints/index.js";
4
- export function getPath(obj, path, checkVars = true) {
5
- if (!path || typeof path !== 'string') {
6
- return null;
7
- }
8
-
9
- // Check if CSS variables are used
10
- if (obj && obj.vars && checkVars) {
11
- const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
12
- if (val != null) {
13
- return val;
14
- }
15
- }
16
- return path.split('.').reduce((acc, item) => {
17
- if (acc && acc[item] != null) {
18
- return acc[item];
19
- }
20
- return null;
21
- }, obj);
22
- }
23
- export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
24
- let value;
25
- if (typeof themeMapping === 'function') {
26
- value = themeMapping(propValueFinal);
27
- } else if (Array.isArray(themeMapping)) {
28
- value = themeMapping[propValueFinal] || userValue;
29
- } else {
30
- value = getPath(themeMapping, propValueFinal) || userValue;
31
- }
32
- if (transform) {
33
- value = transform(value, userValue, themeMapping);
34
- }
35
- return value;
36
- }
37
- function style(options) {
38
- const {
39
- prop,
40
- cssProperty = options.prop,
41
- themeKey,
42
- transform
43
- } = options;
44
-
45
- // false positive
46
- // eslint-disable-next-line react/function-component-definition
47
- const fn = props => {
48
- if (props[prop] == null) {
49
- return null;
50
- }
51
- const propValue = props[prop];
52
- const theme = props.theme;
53
- const themeMapping = getPath(theme, themeKey) || {};
54
- const styleFromPropValue = propValueFinal => {
55
- let value = getStyleValue(themeMapping, transform, propValueFinal);
56
- if (propValueFinal === value && typeof propValueFinal === 'string') {
57
- // Haven't found value
58
- value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
59
- }
60
- if (cssProperty === false) {
61
- return value;
62
- }
63
- return {
64
- [cssProperty]: value
65
- };
66
- };
67
- return handleBreakpoints(props, propValue, styleFromPropValue);
68
- };
69
- fn.propTypes = process.env.NODE_ENV !== 'production' ? {
70
- [prop]: responsivePropType
71
- } : {};
72
- fn.filterProps = [prop];
73
- return fn;
74
- }
75
- export default style;
@@ -1,269 +0,0 @@
1
- import { StandardCSSProperties } from "./StandardCssProperties.js";
2
- export interface AliasesCSSProperties {
3
- /**
4
- * The **`background-color`** CSS property sets the background color of an element.
5
- *
6
- * **Initial value**: `transparent`
7
- *
8
- * | Chrome | Firefox | Safari | Edge | IE |
9
- * | :----: | :-----: | :----: | :----: | :---: |
10
- * | **1** | **1** | **1** | **12** | **4** |
11
- *
12
- * @see https://developer.mozilla.org/docs/Web/CSS/background-color
13
- */
14
- bgcolor?: StandardCSSProperties['backgroundColor'];
15
- /**
16
- * The **`margin`** CSS property sets the margin on all four sides of an element. It is a shorthand for `margin-top`, `margin-right`, `margin-bottom`, and `margin-left`.
17
- *
18
- * | Chrome | Firefox | Safari | Edge | IE |
19
- * | :----: | :-----: | :----: | :----: | :---: |
20
- * | **1** | **1** | **1** | **12** | **3** |
21
- *
22
- * @see https://developer.mozilla.org/docs/Web/CSS/margin
23
- */
24
- m?: StandardCSSProperties['margin'];
25
- /**
26
- * The **`margin-top`** CSS property sets the margin on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
27
- *
28
- * **Initial value**: `0`
29
- *
30
- * | Chrome | Firefox | Safari | Edge | IE |
31
- * | :----: | :-----: | :----: | :----: | :---: |
32
- * | **1** | **1** | **1** | **12** | **3** |
33
- *
34
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-top
35
- */
36
- mt?: StandardCSSProperties['marginTop'];
37
- /**
38
- * The **`margin-right`** CSS property sets the margin on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
39
- *
40
- * **Initial value**: `0`
41
- *
42
- * | Chrome | Firefox | Safari | Edge | IE |
43
- * | :----: | :-----: | :----: | :----: | :---: |
44
- * | **1** | **1** | **1** | **12** | **3** |
45
- *
46
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-right
47
- */
48
- mr?: StandardCSSProperties['marginRight'];
49
- /**
50
- * The **`margin-bottom`** CSS property sets the margin on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
51
- *
52
- * **Initial value**: `0`
53
- *
54
- * | Chrome | Firefox | Safari | Edge | IE |
55
- * | :----: | :-----: | :----: | :----: | :---: |
56
- * | **1** | **1** | **1** | **12** | **3** |
57
- *
58
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
59
- */
60
- mb?: StandardCSSProperties['marginBottom'];
61
- /**
62
- * The **`margin-left`** CSS property sets the margin on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
63
- *
64
- * **Initial value**: `0`
65
- *
66
- * | Chrome | Firefox | Safari | Edge | IE |
67
- * | :----: | :-----: | :----: | :----: | :---: |
68
- * | **1** | **1** | **1** | **12** | **3** |
69
- *
70
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-left
71
- */
72
- ml?: StandardCSSProperties['marginLeft'];
73
- /**
74
- * The **`mx`** property is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin on the left and right side of an element. A positive value places it
75
- * farther from its neighbors, while a negative value places it closer.
76
- *
77
- * **Initial value**: `0`
78
- *
79
- * | Chrome | Firefox | Safari | Edge | IE |
80
- * | :----: | :-----: | :----: | :----: | :---: |
81
- * | **1** | **1** | **1** | **12** | **3** |
82
- *
83
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-left
84
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-right
85
- */
86
- mx?: StandardCSSProperties['marginLeft'];
87
- /**
88
- * The **`marginX`** property is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin on the left and right side of an element. A positive value
89
- * places it farther from its neighbors, while a negative value places it closer.
90
- *
91
- * **Initial value**: `0`
92
- *
93
- * | Chrome | Firefox | Safari | Edge | IE |
94
- * | :----: | :-----: | :----: | :----: | :---: |
95
- * | **1** | **1** | **1** | **12** | **3** |
96
- *
97
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-left
98
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-right
99
- */
100
- marginX?: StandardCSSProperties['marginLeft'];
101
- /**
102
- * The **`my`** property is shorthand for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin on the top and bottom of an element. A positive value places it
103
- * farther from its neighbors, while a negative value places it closer.
104
- *
105
- * **Initial value**: `0`
106
- *
107
- * | Chrome | Firefox | Safari | Edge | IE |
108
- * | :----: | :-----: | :----: | :----: | :---: |
109
- * | **1** | **1** | **1** | **12** | **3** |
110
- *
111
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-top
112
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
113
- */
114
- my?: StandardCSSProperties['marginTop'];
115
- /**
116
- * The **`marginY`** property is shorthand for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin on the top and bottom of an element. A positive value places
117
- * it farther from its neighbors, while a negative value places it closer.
118
- *
119
- * **Initial value**: `0`
120
- *
121
- * | Chrome | Firefox | Safari | Edge | IE |
122
- * | :----: | :-----: | :----: | :----: | :---: |
123
- * | **1** | **1** | **1** | **12** | **3** |
124
- *
125
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-top
126
- * @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
127
- */
128
- marginY?: StandardCSSProperties['marginTop'];
129
- /**
130
- * The **`padding`** CSS property sets the padding on all four sides of an element. It is a shorthand for `padding-top`, `padding-right`, `padding-bottom`, and `padding-left`.
131
- *
132
- * | Chrome | Firefox | Safari | Edge | IE |
133
- * | :----: | :-----: | :----: | :----: | :---: |
134
- * | **1** | **1** | **1** | **12** | **4** |
135
- *
136
- * @see https://developer.mozilla.org/docs/Web/CSS/padding
137
- */
138
- p?: StandardCSSProperties['padding'];
139
- /**
140
- * The **`padding-top`** CSS property sets the height of the padding at the top of an element.
141
- *
142
- * **Initial value**: `0`
143
- *
144
- * | Chrome | Firefox | Safari | Edge | IE |
145
- * | :----: | :-----: | :----: | :----: | :---: |
146
- * | **1** | **1** | **1** | **12** | **4** |
147
- *
148
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-top
149
- */
150
- pt?: StandardCSSProperties['paddingTop'];
151
- /**
152
- * The **`padding-right`** CSS property sets the width of the padding at the right side of an element.
153
- *
154
- * **Initial value**: `0`
155
- *
156
- * | Chrome | Firefox | Safari | Edge | IE |
157
- * | :----: | :-----: | :----: | :----: | :---: |
158
- * | **1** | **1** | **1** | **12** | **4** |
159
- *
160
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-right
161
- */
162
- pr?: StandardCSSProperties['paddingRight'];
163
- /**
164
- * The **`padding-bottom`** CSS property sets the height of the padding on the bottom of an element.
165
- *
166
- * **Initial value**: `0`
167
- *
168
- * | Chrome | Firefox | Safari | Edge | IE |
169
- * | :----: | :-----: | :----: | :----: | :---: |
170
- * | **1** | **1** | **1** | **12** | **4** |
171
- *
172
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
173
- */
174
- pb?: StandardCSSProperties['paddingBottom'];
175
- /**
176
- * The **`padding-left`** CSS property sets the width of the padding at the left side of an element.
177
- *
178
- * **Initial value**: `0`
179
- *
180
- * | Chrome | Firefox | Safari | Edge | IE |
181
- * | :----: | :-----: | :----: | :----: | :---: |
182
- * | **1** | **1** | **1** | **12** | **4** |
183
- *
184
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-left
185
- */
186
- pl?: StandardCSSProperties['paddingLeft'];
187
- /**
188
- * The **`px`** property is shorthand for the CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding at the left and right side of an element.
189
- *
190
- * **Initial value**: `0`
191
- *
192
- * | Chrome | Firefox | Safari | Edge | IE |
193
- * | :----: | :-----: | :----: | :----: | :---: |
194
- * | **1** | **1** | **1** | **12** | **4** |
195
- *
196
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-left
197
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-right
198
- */
199
- px?: StandardCSSProperties['paddingLeft'];
200
- /**
201
- * The **`paddingX`** property is shorthand for the CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding at the left and right sides of an element.
202
- *
203
- * **Initial value**: `0`
204
- *
205
- * | Chrome | Firefox | Safari | Edge | IE |
206
- * | :----: | :-----: | :----: | :----: | :---: |
207
- * | **1** | **1** | **1** | **12** | **4** |
208
- *
209
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-left
210
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-right
211
- */
212
- paddingX?: StandardCSSProperties['paddingLeft'];
213
- /**
214
- * The **`py`** property is shorthand for the CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding at the top and bottom of an element.
215
- *
216
- * **Initial value**: `0`
217
- *
218
- * | Chrome | Firefox | Safari | Edge | IE |
219
- * | :----: | :-----: | :----: | :----: | :---: |
220
- * | **1** | **1** | **1** | **12** | **4** |
221
- *
222
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-top
223
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
224
- */
225
- py?: StandardCSSProperties['paddingTop'];
226
- /**
227
- * The **`paddingY`** property is shorthand for the CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding at the top and bottom of an element.
228
- *
229
- * **Initial value**: `0`
230
- *
231
- * | Chrome | Firefox | Safari | Edge | IE |
232
- * | :----: | :-----: | :----: | :----: | :---: |
233
- * | **1** | **1** | **1** | **12** | **4** |
234
- *
235
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-top
236
- * @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
237
- */
238
- paddingY?: StandardCSSProperties['paddingTop'];
239
- /**
240
- * The **`typography`** property is shorthand for the CSS properties **`font-family`**, **`font-weight`**, **`font-size`**, **`line-height`**, **`letter-spacing`** and **`text-transform``**.
241
- * It takes the values defined under `theme.typography` and spreads them on the element.
242
- *
243
- * **Initial value**: `0`
244
- *
245
- * | Chrome | Firefox | Safari | Edge | IE |
246
- * | :----: | :-----: | :----: | :----: | :---: |
247
- * | **2** | **1** | **1** | **12** | **5.5** |
248
- *
249
- * @see https://developer.mozilla.org/docs/Web/CSS/font-family
250
- * @see https://developer.mozilla.org/docs/Web/CSS/font-weight
251
- * @see https://developer.mozilla.org/docs/Web/CSS/font-size
252
- * @see https://developer.mozilla.org/docs/Web/CSS/line-height
253
- * @see https://developer.mozilla.org/docs/Web/CSS/letter-spacing
254
- * @see https://developer.mozilla.org/docs/Web/CSS/text-transform
255
- */
256
- typography?: string;
257
- /**
258
- * The **`displayPrint`** property sets the display value for the element when the page is printed.
259
- *
260
- * **Initial value**: `inline`
261
- *
262
- * | Chrome | Firefox | Safari | Edge | IE |
263
- * | :----: | :-----: | :----: | :----: | :---: |
264
- * | **1** | **1** | **1** | **12** | **4** |
265
- *
266
- * @see https://developer.mozilla.org/docs/Web/CSS/display
267
- */
268
- displayPrint?: StandardCSSProperties['display'];
269
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,54 +0,0 @@
1
- import * as CSS from 'csstype';
2
- export interface OverwriteCSSProperties {
3
- /**
4
- * The **`border`** CSS property is shorthand for the CSS properties **`border-width`**, **`border-style`**, and **`border-color`**. It sets an element's border.
5
- *
6
- * **Initial value**: `none`
7
- *
8
- * | Chrome | Firefox | Safari | Edge | IE |
9
- * | :----: | :-----: | :----: | :----: | :---: |
10
- * | **1** | **1** | **1** | **12** | **4** |
11
- *
12
- * @see https://developer.mozilla.org/docs/Web/CSS/border
13
- */
14
- border?: CSS.Property.Border | number;
15
- /**
16
- * The **`box-shadow`** CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the
17
- * element for blur and spread radii, and by its color.
18
- *
19
- * **Initial value**: `none`
20
- *
21
- * | Chrome | Firefox | Safari | Edge | IE |
22
- * | :-----: | :-----: | :-----: | :----: | :---: |
23
- * | **10** | **4** | **5.1** | **12** | **9** |
24
- * | 1 _-x-_ | | 3 _-x-_ | | |
25
- *
26
- * @see https://developer.mozilla.org/docs/Web/CSS/box-shadow
27
- */
28
- boxShadow?: CSS.Property.BoxShadow | number;
29
- /**
30
- * The **`font-weight`** CSS property specifies the weight (or boldness) of the font. The font weights available to you will depend on the `font-family` you are using. Some fonts are only
31
- * available in `normal` and `bold`.
32
- *
33
- * **Initial value**: `normal`
34
- *
35
- * | Chrome | Firefox | Safari | Edge | IE |
36
- * | :----: | :-----: | :----: | :----: | :---: |
37
- * | **2** | **1** | **1** | **12** | **3** |
38
- *
39
- * @see https://developer.mozilla.org/docs/Web/CSS/font-weight
40
- */
41
- fontWeight?: CSS.Property.FontWeight | string;
42
- /**
43
- * The **`z-index`** CSS property sets the z-order of a positioned element and its descendants or flex items. Overlapping elements with a higher z-index cover those with a lower one.
44
- *
45
- * **Initial value**: `auto`
46
- *
47
- * | Chrome | Firefox | Safari | Edge | IE |
48
- * | :----: | :-----: | :----: | :----: | :---: |
49
- * | **1** | **1** | **1** | **12** | **4** |
50
- *
51
- * @see https://developer.mozilla.org/docs/Web/CSS/z-index
52
- */
53
- zIndex?: CSS.Property.ZIndex | string;
54
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import * as CSS from 'csstype';
2
- export type StandardCSSProperties = CSS.PropertiesFallback<number | string>;
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- import { StyleFunction } from "../Box/index.js";
2
- import { TransformFunction } from "../style/index.js";
3
- type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>>;
4
- export interface SxConfigRecord {
5
- cssProperty?: keyof React.CSSProperties | false;
6
- /**
7
- * dot access in `Theme`
8
- */
9
- themeKey?: string;
10
- transform?: TransformFunction;
11
- style?: SimpleStyleFunction<any>;
12
- }
13
- export type SxConfig = Record<string, SxConfigRecord>;
14
- declare const defaultSxConfig: SxConfig;
15
- export default defaultSxConfig;