@mui/material 9.0.0-alpha.2 → 9.0.0-alpha.4

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 (352) hide show
  1. package/Accordion/Accordion.d.mts +0 -14
  2. package/Accordion/Accordion.d.ts +0 -14
  3. package/Accordion/Accordion.js +3 -25
  4. package/Accordion/Accordion.mjs +3 -25
  5. package/AccordionSummary/AccordionSummary.js +1 -1
  6. package/AccordionSummary/AccordionSummary.mjs +1 -1
  7. package/AccordionSummary/accordionSummaryClasses.d.mts +0 -5
  8. package/AccordionSummary/accordionSummaryClasses.d.ts +0 -5
  9. package/AccordionSummary/accordionSummaryClasses.js +1 -1
  10. package/AccordionSummary/accordionSummaryClasses.mjs +1 -1
  11. package/Alert/Alert.d.mts +0 -23
  12. package/Alert/Alert.d.ts +0 -23
  13. package/Alert/Alert.js +4 -36
  14. package/Alert/Alert.mjs +4 -36
  15. package/Alert/alertClasses.d.mts +0 -72
  16. package/Alert/alertClasses.d.ts +0 -72
  17. package/Alert/alertClasses.js +1 -1
  18. package/Alert/alertClasses.mjs +1 -1
  19. package/Autocomplete/Autocomplete.d.mts +26 -60
  20. package/Autocomplete/Autocomplete.d.ts +26 -60
  21. package/Autocomplete/Autocomplete.js +76 -119
  22. package/Autocomplete/Autocomplete.mjs +76 -119
  23. package/Avatar/Avatar.d.mts +0 -8
  24. package/Avatar/Avatar.d.ts +0 -8
  25. package/Avatar/Avatar.js +13 -35
  26. package/Avatar/Avatar.mjs +13 -35
  27. package/AvatarGroup/AvatarGroup.d.mts +0 -15
  28. package/AvatarGroup/AvatarGroup.d.ts +0 -15
  29. package/AvatarGroup/AvatarGroup.js +1 -18
  30. package/AvatarGroup/AvatarGroup.mjs +1 -18
  31. package/Backdrop/Backdrop.d.mts +1 -31
  32. package/Backdrop/Backdrop.d.ts +1 -31
  33. package/Backdrop/Backdrop.js +2 -42
  34. package/Backdrop/Backdrop.mjs +2 -42
  35. package/Badge/Badge.d.mts +0 -20
  36. package/Badge/Badge.d.ts +0 -20
  37. package/Badge/Badge.js +2 -35
  38. package/Badge/Badge.mjs +2 -35
  39. package/Box/Box.d.mts +1 -0
  40. package/Box/Box.d.ts +1 -0
  41. package/Button/Button.d.mts +1 -0
  42. package/Button/Button.d.ts +1 -0
  43. package/Button/Button.js +6 -6
  44. package/Button/Button.mjs +6 -6
  45. package/Button/buttonClasses.d.mts +0 -132
  46. package/Button/buttonClasses.d.ts +0 -132
  47. package/Button/buttonClasses.js +1 -1
  48. package/Button/buttonClasses.mjs +1 -1
  49. package/ButtonBase/ButtonBase.js +16 -2
  50. package/ButtonBase/ButtonBase.mjs +16 -2
  51. package/CHANGELOG.md +191 -0
  52. package/CardHeader/CardHeader.js +5 -1
  53. package/CardHeader/CardHeader.mjs +5 -1
  54. package/CircularProgress/CircularProgress.js +2 -2
  55. package/CircularProgress/CircularProgress.mjs +2 -2
  56. package/CircularProgress/circularProgressClasses.d.mts +0 -8
  57. package/CircularProgress/circularProgressClasses.d.ts +0 -8
  58. package/CircularProgress/circularProgressClasses.js +1 -1
  59. package/CircularProgress/circularProgressClasses.mjs +1 -1
  60. package/Divider/Divider.d.mts +1 -6
  61. package/Divider/Divider.d.ts +1 -6
  62. package/Divider/Divider.js +2 -18
  63. package/Divider/Divider.mjs +2 -18
  64. package/Divider/dividerClasses.d.mts +0 -4
  65. package/Divider/dividerClasses.d.ts +0 -4
  66. package/Divider/dividerClasses.js +1 -1
  67. package/Divider/dividerClasses.mjs +1 -1
  68. package/FormControlLabel/FormControlLabel.d.mts +1 -14
  69. package/FormControlLabel/FormControlLabel.d.ts +1 -14
  70. package/FormControlLabel/FormControlLabel.js +1 -13
  71. package/FormControlLabel/FormControlLabel.mjs +1 -13
  72. package/Input/Input.js +2 -1
  73. package/Input/Input.mjs +2 -1
  74. package/List/List.d.mts +1 -0
  75. package/List/List.d.ts +1 -0
  76. package/ListItemButton/ListItemButton.d.mts +1 -0
  77. package/ListItemButton/ListItemButton.d.ts +1 -0
  78. package/ListItemIcon/ListItemIcon.d.mts +1 -0
  79. package/ListItemIcon/ListItemIcon.d.ts +1 -0
  80. package/ListItemText/ListItemText.d.mts +1 -0
  81. package/ListItemText/ListItemText.d.ts +1 -0
  82. package/ListItemText/ListItemText.js +5 -1
  83. package/ListItemText/ListItemText.mjs +5 -1
  84. package/ListSubheader/ListSubheader.d.mts +1 -0
  85. package/ListSubheader/ListSubheader.d.ts +1 -0
  86. package/Menu/Menu.d.mts +0 -13
  87. package/Menu/Menu.d.ts +0 -13
  88. package/Menu/Menu.js +5 -44
  89. package/Menu/Menu.mjs +5 -44
  90. package/MenuItem/MenuItem.js +21 -1
  91. package/MenuItem/MenuItem.mjs +23 -1
  92. package/MenuList/MenuList.js +77 -109
  93. package/MenuList/MenuList.mjs +77 -109
  94. package/MobileStepper/MobileStepper.d.mts +0 -5
  95. package/MobileStepper/MobileStepper.d.ts +0 -5
  96. package/MobileStepper/MobileStepper.js +1 -10
  97. package/MobileStepper/MobileStepper.mjs +1 -10
  98. package/Paper/Paper.d.mts +1 -0
  99. package/Paper/Paper.d.ts +1 -0
  100. package/Popover/Popover.d.mts +4 -48
  101. package/Popover/Popover.d.ts +4 -48
  102. package/Popover/Popover.js +4 -64
  103. package/Popover/Popover.mjs +4 -64
  104. package/Popper/Popper.d.mts +0 -17
  105. package/Popper/Popper.d.ts +0 -17
  106. package/Popper/Popper.js +2 -26
  107. package/Popper/Popper.mjs +2 -26
  108. package/Popper/index.d.mts +1 -0
  109. package/Popper/index.d.ts +1 -0
  110. package/Popper/index.js +11 -2
  111. package/Popper/index.mjs +1 -0
  112. package/Select/SelectInput.js +50 -55
  113. package/Select/SelectInput.mjs +47 -52
  114. package/Select/index.d.mts +1 -0
  115. package/Select/index.d.ts +1 -0
  116. package/Select/index.js +12 -0
  117. package/Select/index.mjs +1 -0
  118. package/Select/utils/SelectFocusSourceContext.d.mts +4 -0
  119. package/Select/utils/SelectFocusSourceContext.d.ts +4 -0
  120. package/Select/utils/SelectFocusSourceContext.js +19 -0
  121. package/Select/utils/SelectFocusSourceContext.mjs +13 -0
  122. package/Select/utils/areEqualValues.d.mts +1 -0
  123. package/Select/utils/areEqualValues.d.ts +1 -0
  124. package/Select/utils/areEqualValues.js +14 -0
  125. package/Select/utils/areEqualValues.mjs +8 -0
  126. package/Select/utils/getOpenInteractionType.d.mts +1 -0
  127. package/Select/utils/getOpenInteractionType.d.ts +1 -0
  128. package/Select/utils/getOpenInteractionType.js +18 -0
  129. package/Select/utils/getOpenInteractionType.mjs +12 -0
  130. package/Select/utils/index.d.mts +4 -0
  131. package/Select/utils/index.d.ts +4 -0
  132. package/Select/utils/index.js +40 -0
  133. package/Select/utils/index.mjs +4 -0
  134. package/Select/utils/isEmpty.d.mts +1 -0
  135. package/Select/utils/isEmpty.d.ts +1 -0
  136. package/Select/utils/isEmpty.js +9 -0
  137. package/Select/utils/isEmpty.mjs +3 -0
  138. package/Slider/Slider.d.mts +109 -77
  139. package/Slider/Slider.d.ts +109 -77
  140. package/Slider/Slider.js +42 -119
  141. package/Slider/Slider.mjs +42 -119
  142. package/Slider/sliderClasses.d.mts +7 -7
  143. package/Slider/sliderClasses.d.ts +7 -7
  144. package/Slider/useSlider.js +50 -14
  145. package/Slider/useSlider.mjs +50 -14
  146. package/Snackbar/Snackbar.d.mts +1 -27
  147. package/Snackbar/Snackbar.d.ts +1 -27
  148. package/Snackbar/Snackbar.js +5 -58
  149. package/Snackbar/Snackbar.mjs +5 -58
  150. package/SpeedDial/SpeedDial.d.mts +0 -13
  151. package/SpeedDial/SpeedDial.d.ts +0 -13
  152. package/SpeedDial/SpeedDial.js +15 -40
  153. package/SpeedDial/SpeedDial.mjs +15 -40
  154. package/SpeedDialAction/SpeedDialAction.d.mts +0 -28
  155. package/SpeedDialAction/SpeedDialAction.d.ts +0 -28
  156. package/SpeedDialAction/SpeedDialAction.js +5 -46
  157. package/SpeedDialAction/SpeedDialAction.mjs +5 -46
  158. package/Step/Step.js +7 -5
  159. package/Step/Step.mjs +7 -5
  160. package/StepButton/StepButton.js +16 -6
  161. package/StepButton/StepButton.mjs +16 -6
  162. package/StepConnector/StepConnector.js +2 -2
  163. package/StepConnector/StepConnector.mjs +2 -2
  164. package/StepContent/StepContent.js +2 -2
  165. package/StepContent/StepContent.mjs +2 -2
  166. package/StepLabel/StepLabel.js +2 -2
  167. package/StepLabel/StepLabel.mjs +2 -2
  168. package/Stepper/Stepper.js +44 -7
  169. package/Stepper/Stepper.mjs +44 -7
  170. package/Stepper/StepperContext.d.mts +7 -0
  171. package/Stepper/StepperContext.d.ts +7 -0
  172. package/Stepper/StepperContext.js +2 -1
  173. package/Stepper/StepperContext.mjs +1 -0
  174. package/Stepper/index.d.mts +0 -1
  175. package/Stepper/index.d.ts +0 -1
  176. package/Tab/Tab.js +0 -1
  177. package/Tab/Tab.mjs +0 -1
  178. package/TablePagination/TablePagination.d.mts +1 -1
  179. package/TablePagination/TablePagination.d.ts +1 -1
  180. package/TablePagination/TablePagination.js +4 -2
  181. package/TablePagination/TablePagination.mjs +4 -2
  182. package/Tabs/Tabs.d.mts +2 -33
  183. package/Tabs/Tabs.d.ts +2 -33
  184. package/Tabs/Tabs.js +54 -135
  185. package/Tabs/Tabs.mjs +54 -135
  186. package/TextField/TextField.d.mts +6 -49
  187. package/TextField/TextField.d.ts +6 -49
  188. package/TextField/TextField.js +18 -53
  189. package/TextField/TextField.mjs +18 -53
  190. package/Tooltip/Tooltip.d.mts +1 -55
  191. package/Tooltip/Tooltip.d.ts +1 -55
  192. package/Tooltip/Tooltip.js +9 -87
  193. package/Tooltip/Tooltip.mjs +9 -87
  194. package/Typography/Typography.d.mts +1 -6
  195. package/Typography/Typography.d.ts +1 -6
  196. package/Typography/Typography.js +3 -19
  197. package/Typography/Typography.mjs +3 -19
  198. package/Typography/typographyClasses.d.mts +0 -5
  199. package/Typography/typographyClasses.d.ts +0 -5
  200. package/Typography/typographyClasses.js +1 -1
  201. package/Typography/typographyClasses.mjs +1 -1
  202. package/index.d.mts +0 -2
  203. package/index.d.ts +0 -2
  204. package/index.js +1 -9
  205. package/index.mjs +1 -2
  206. package/locale/amET.js +4 -1
  207. package/locale/amET.mjs +3 -1
  208. package/locale/arEG.js +4 -1
  209. package/locale/arEG.mjs +3 -1
  210. package/locale/arSA.js +4 -1
  211. package/locale/arSA.mjs +3 -1
  212. package/locale/arSD.js +4 -1
  213. package/locale/arSD.mjs +3 -1
  214. package/locale/beBY.js +4 -1
  215. package/locale/beBY.mjs +3 -1
  216. package/locale/bnBD.js +4 -1
  217. package/locale/bnBD.mjs +3 -1
  218. package/locale/caES.js +4 -1
  219. package/locale/caES.mjs +3 -1
  220. package/locale/csCZ.js +4 -1
  221. package/locale/csCZ.mjs +3 -1
  222. package/locale/daDK.js +4 -1
  223. package/locale/daDK.mjs +3 -1
  224. package/locale/deDE.js +4 -1
  225. package/locale/deDE.mjs +3 -1
  226. package/locale/elGR.js +4 -1
  227. package/locale/elGR.mjs +3 -1
  228. package/locale/esES.js +4 -1
  229. package/locale/esES.mjs +3 -1
  230. package/locale/etEE.js +4 -1
  231. package/locale/etEE.mjs +3 -1
  232. package/locale/faIR.js +4 -1
  233. package/locale/faIR.mjs +3 -1
  234. package/locale/fiFI.js +4 -1
  235. package/locale/fiFI.mjs +3 -1
  236. package/locale/frFR.js +4 -1
  237. package/locale/frFR.mjs +3 -1
  238. package/locale/heIL.js +4 -1
  239. package/locale/heIL.mjs +3 -1
  240. package/locale/hiIN.js +4 -1
  241. package/locale/hiIN.mjs +3 -1
  242. package/locale/hrHR.js +5 -1
  243. package/locale/hrHR.mjs +4 -1
  244. package/locale/isIS.js +4 -1
  245. package/locale/isIS.mjs +3 -1
  246. package/locale/itIT.js +4 -1
  247. package/locale/itIT.mjs +3 -1
  248. package/locale/jaJP.js +4 -1
  249. package/locale/jaJP.mjs +3 -1
  250. package/locale/khKH.js +4 -1
  251. package/locale/khKH.mjs +3 -1
  252. package/locale/kkKZ.js +4 -1
  253. package/locale/kkKZ.mjs +3 -1
  254. package/locale/koKR.js +4 -1
  255. package/locale/koKR.mjs +3 -1
  256. package/locale/kuCKB.js +4 -1
  257. package/locale/kuCKB.mjs +3 -1
  258. package/locale/kuLatn.js +4 -1
  259. package/locale/kuLatn.mjs +3 -1
  260. package/locale/mkMK.js +5 -1
  261. package/locale/mkMK.mjs +4 -1
  262. package/locale/msMS.js +5 -1
  263. package/locale/msMS.mjs +4 -1
  264. package/locale/myMY.js +5 -1
  265. package/locale/myMY.mjs +4 -1
  266. package/locale/nbNO.js +4 -1
  267. package/locale/nbNO.mjs +3 -1
  268. package/locale/neNP.js +5 -1
  269. package/locale/neNP.mjs +4 -1
  270. package/locale/nlNL.js +4 -1
  271. package/locale/nlNL.mjs +3 -1
  272. package/locale/nnNO.js +4 -1
  273. package/locale/nnNO.mjs +3 -1
  274. package/locale/plPL.js +4 -1
  275. package/locale/plPL.mjs +3 -1
  276. package/locale/psAF.js +4 -1
  277. package/locale/psAF.mjs +3 -1
  278. package/locale/ptBR.js +4 -1
  279. package/locale/ptBR.mjs +3 -1
  280. package/locale/ptPT.js +4 -1
  281. package/locale/ptPT.mjs +3 -1
  282. package/locale/roRO.js +4 -1
  283. package/locale/roRO.mjs +3 -1
  284. package/locale/ruRU.js +4 -1
  285. package/locale/ruRU.mjs +3 -1
  286. package/locale/siLK.js +4 -1
  287. package/locale/siLK.mjs +3 -1
  288. package/locale/skSK.js +4 -1
  289. package/locale/skSK.mjs +3 -1
  290. package/locale/srRS.js +5 -1
  291. package/locale/srRS.mjs +4 -1
  292. package/locale/svSE.js +4 -1
  293. package/locale/svSE.mjs +3 -1
  294. package/locale/thTH.js +4 -1
  295. package/locale/thTH.mjs +3 -1
  296. package/locale/tlTL.js +5 -1
  297. package/locale/tlTL.mjs +4 -1
  298. package/locale/trTR.js +4 -1
  299. package/locale/trTR.mjs +3 -1
  300. package/locale/ukUA.js +4 -1
  301. package/locale/ukUA.mjs +3 -1
  302. package/locale/urPK.js +4 -1
  303. package/locale/urPK.mjs +3 -1
  304. package/locale/utils/buildFormatNumber.d.mts +2 -0
  305. package/locale/utils/buildFormatNumber.d.ts +2 -0
  306. package/locale/utils/buildFormatNumber.js +23 -0
  307. package/locale/utils/buildFormatNumber.mjs +17 -0
  308. package/locale/viVN.js +4 -1
  309. package/locale/viVN.mjs +3 -1
  310. package/locale/zhCN.js +4 -1
  311. package/locale/zhCN.mjs +3 -1
  312. package/locale/zhHK.js +4 -1
  313. package/locale/zhHK.mjs +3 -1
  314. package/locale/zhTW.js +4 -1
  315. package/locale/zhTW.mjs +3 -1
  316. package/package.json +236 -236
  317. package/styles/components.d.mts +0 -5
  318. package/styles/components.d.ts +0 -5
  319. package/styles/overrides.d.mts +0 -2
  320. package/styles/overrides.d.ts +0 -2
  321. package/styles/props.d.mts +0 -2
  322. package/styles/props.d.ts +0 -2
  323. package/themeCssVarsAugmentation/index.js +5 -0
  324. package/themeCssVarsAugmentation/index.mjs +5 -0
  325. package/useAutocomplete/useAutocomplete.d.mts +0 -12
  326. package/useAutocomplete/useAutocomplete.d.ts +0 -12
  327. package/useAutocomplete/useAutocomplete.js +53 -28
  328. package/useAutocomplete/useAutocomplete.mjs +53 -28
  329. package/utils/index.d.mts +2 -0
  330. package/utils/index.d.ts +2 -0
  331. package/utils/index.js +14 -0
  332. package/utils/index.mjs +2 -0
  333. package/utils/useRovingTabIndex.d.mts +2 -0
  334. package/utils/useRovingTabIndex.d.ts +2 -0
  335. package/utils/useRovingTabIndex.js +9 -0
  336. package/utils/useRovingTabIndex.mjs +2 -0
  337. package/version/index.js +2 -2
  338. package/version/index.mjs +2 -2
  339. package/GridLegacy/GridLegacy.d.mts +0 -160
  340. package/GridLegacy/GridLegacy.d.ts +0 -160
  341. package/GridLegacy/GridLegacy.js +0 -601
  342. package/GridLegacy/GridLegacy.mjs +0 -588
  343. package/GridLegacy/GridLegacyContext.js +0 -17
  344. package/GridLegacy/GridLegacyContext.mjs +0 -12
  345. package/GridLegacy/gridLegacyClasses.d.mts +0 -48
  346. package/GridLegacy/gridLegacyClasses.d.ts +0 -48
  347. package/GridLegacy/gridLegacyClasses.js +0 -27
  348. package/GridLegacy/gridLegacyClasses.mjs +0 -19
  349. package/GridLegacy/index.d.mts +0 -4
  350. package/GridLegacy/index.d.ts +0 -4
  351. package/GridLegacy/index.js +0 -35
  352. package/GridLegacy/index.mjs +0 -3
@@ -1,601 +0,0 @@
1
- "use strict";
2
- 'use client';
3
-
4
- // A grid component using the following libs as inspiration.
5
- //
6
- // For the implementation:
7
- // - https://getbootstrap.com/docs/4.3/layout/grid/
8
- // - https://github.com/kristoferjoseph/flexboxgrid/blob/master/src/css/flexboxgrid.css
9
- // - https://github.com/roylee0704/react-flexbox-grid
10
- // - https://material.angularjs.org/latest/layout/introduction
11
- //
12
- // Follow this flexbox Guide to better understand the underlying model:
13
- // - https://css-tricks.com/snippets/css/a-guide-to-flexbox/
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
15
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
16
- Object.defineProperty(exports, "__esModule", {
17
- value: true
18
- });
19
- exports.default = void 0;
20
- exports.generateColumnGap = generateColumnGap;
21
- exports.generateDirection = generateDirection;
22
- exports.generateGridLegacy = generateGridLegacy;
23
- exports.generateRowGap = generateRowGap;
24
- exports.resolveSpacingClasses = resolveSpacingClasses;
25
- exports.resolveSpacingStyles = resolveSpacingStyles;
26
- var React = _interopRequireWildcard(require("react"));
27
- var _propTypes = _interopRequireDefault(require("prop-types"));
28
- var _clsx = _interopRequireDefault(require("clsx"));
29
- var _system = require("@mui/system");
30
- var _styleFunctionSx = require("@mui/system/styleFunctionSx");
31
- var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
32
- var _requirePropFactory = _interopRequireDefault(require("../utils/requirePropFactory"));
33
- var _styled = _interopRequireDefault(require("../styles/styled"));
34
- var _DefaultPropsProvider = require("../DefaultPropsProvider");
35
- var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
36
- var _GridLegacyContext = _interopRequireDefault(require("./GridLegacyContext"));
37
- var _gridLegacyClasses = _interopRequireWildcard(require("./gridLegacyClasses"));
38
- var _jsxRuntime = require("react/jsx-runtime");
39
- let warnedOnce = false;
40
- function warnAboutDeprecatedGridLegacy() {
41
- if (!warnedOnce && process.env.NODE_ENV !== 'production') {
42
- warnedOnce = true;
43
- console.warn('MUI: The GridLegacy component is deprecated. See https://mui.com/material-ui/migration/upgrade-to-grid-v2/ for migration instructions.\n');
44
- }
45
- }
46
- function generateGridLegacy({
47
- theme,
48
- ownerState
49
- }) {
50
- let size;
51
- return theme.breakpoints.keys.reduce((globalStyles, breakpoint) => {
52
- // Use side effect over immutability for better performance.
53
- let styles = {};
54
- if (ownerState[breakpoint]) {
55
- size = ownerState[breakpoint];
56
- }
57
- if (!size) {
58
- return globalStyles;
59
- }
60
- if (size === true) {
61
- // For the auto layouting
62
- styles = {
63
- flexBasis: 0,
64
- flexGrow: 1,
65
- maxWidth: '100%'
66
- };
67
- } else if (size === 'auto') {
68
- styles = {
69
- flexBasis: 'auto',
70
- flexGrow: 0,
71
- flexShrink: 0,
72
- maxWidth: 'none',
73
- width: 'auto'
74
- };
75
- } else {
76
- const columnsBreakpointValues = (0, _system.unstable_resolveBreakpointValues)({
77
- values: ownerState.columns,
78
- breakpoints: theme.breakpoints.values
79
- });
80
- const columnValue = typeof columnsBreakpointValues === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues;
81
- if (columnValue === undefined || columnValue === null) {
82
- return globalStyles;
83
- }
84
- // Keep 7 significant numbers.
85
- const width = `${Math.round(size / columnValue * 10e7) / 10e5}%`;
86
- let more = {};
87
- if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
88
- const themeSpacing = theme.spacing(ownerState.columnSpacing);
89
- if (themeSpacing !== '0px') {
90
- const fullWidth = `calc(${width} + ${themeSpacing})`;
91
- more = {
92
- flexBasis: fullWidth,
93
- maxWidth: fullWidth
94
- };
95
- }
96
- }
97
-
98
- // Close to the bootstrap implementation:
99
- // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
100
- styles = {
101
- flexBasis: width,
102
- flexGrow: 0,
103
- maxWidth: width,
104
- ...more
105
- };
106
- }
107
-
108
- // No need for a media query for the first size.
109
- if (theme.breakpoints.values[breakpoint] === 0) {
110
- Object.assign(globalStyles, styles);
111
- } else {
112
- globalStyles[theme.breakpoints.up(breakpoint)] = styles;
113
- }
114
- return globalStyles;
115
- }, {});
116
- }
117
- function generateDirection({
118
- theme,
119
- ownerState
120
- }) {
121
- const directionValues = (0, _system.unstable_resolveBreakpointValues)({
122
- values: ownerState.direction,
123
- breakpoints: theme.breakpoints.values
124
- });
125
- return (0, _system.handleBreakpoints)({
126
- theme
127
- }, directionValues, propValue => {
128
- const output = {
129
- flexDirection: propValue
130
- };
131
- if (propValue.startsWith('column')) {
132
- output[`& > .${_gridLegacyClasses.default.item}`] = {
133
- maxWidth: 'none'
134
- };
135
- }
136
- return output;
137
- });
138
- }
139
-
140
- /**
141
- * Extracts zero value breakpoint keys before a non-zero value breakpoint key.
142
- * @example { xs: 0, sm: 0, md: 2, lg: 0, xl: 0 } or [0, 0, 2, 0, 0]
143
- * @returns [xs, sm]
144
- */
145
- function extractZeroValueBreakpointKeys({
146
- breakpoints,
147
- values
148
- }) {
149
- let nonZeroKey = '';
150
- Object.keys(values).forEach(key => {
151
- if (nonZeroKey !== '') {
152
- return;
153
- }
154
- if (values[key] !== 0) {
155
- nonZeroKey = key;
156
- }
157
- });
158
- const sortedBreakpointKeysByValue = Object.keys(breakpoints).sort((a, b) => {
159
- return breakpoints[a] - breakpoints[b];
160
- });
161
- return sortedBreakpointKeysByValue.slice(0, sortedBreakpointKeysByValue.indexOf(nonZeroKey));
162
- }
163
- function generateRowGap({
164
- theme,
165
- ownerState
166
- }) {
167
- const {
168
- container,
169
- rowSpacing
170
- } = ownerState;
171
- let styles = {};
172
- if (container && rowSpacing !== 0) {
173
- const rowSpacingValues = (0, _system.unstable_resolveBreakpointValues)({
174
- values: rowSpacing,
175
- breakpoints: theme.breakpoints.values
176
- });
177
- let zeroValueBreakpointKeys;
178
- if (typeof rowSpacingValues === 'object') {
179
- zeroValueBreakpointKeys = extractZeroValueBreakpointKeys({
180
- breakpoints: theme.breakpoints.values,
181
- values: rowSpacingValues
182
- });
183
- }
184
- styles = (0, _system.handleBreakpoints)({
185
- theme
186
- }, rowSpacingValues, (propValue, breakpoint) => {
187
- const themeSpacing = theme.spacing(propValue);
188
- if (themeSpacing !== '0px') {
189
- return {
190
- marginTop: `calc(-1 * ${themeSpacing})`,
191
- [`& > .${_gridLegacyClasses.default.item}`]: {
192
- paddingTop: themeSpacing
193
- }
194
- };
195
- }
196
- if (zeroValueBreakpointKeys?.includes(breakpoint)) {
197
- return {};
198
- }
199
- return {
200
- marginTop: 0,
201
- [`& > .${_gridLegacyClasses.default.item}`]: {
202
- paddingTop: 0
203
- }
204
- };
205
- });
206
- }
207
- return styles;
208
- }
209
- function generateColumnGap({
210
- theme,
211
- ownerState
212
- }) {
213
- const {
214
- container,
215
- columnSpacing
216
- } = ownerState;
217
- let styles = {};
218
- if (container && columnSpacing !== 0) {
219
- const columnSpacingValues = (0, _system.unstable_resolveBreakpointValues)({
220
- values: columnSpacing,
221
- breakpoints: theme.breakpoints.values
222
- });
223
- let zeroValueBreakpointKeys;
224
- if (typeof columnSpacingValues === 'object') {
225
- zeroValueBreakpointKeys = extractZeroValueBreakpointKeys({
226
- breakpoints: theme.breakpoints.values,
227
- values: columnSpacingValues
228
- });
229
- }
230
- styles = (0, _system.handleBreakpoints)({
231
- theme
232
- }, columnSpacingValues, (propValue, breakpoint) => {
233
- const themeSpacing = theme.spacing(propValue);
234
- if (themeSpacing !== '0px') {
235
- const negativeValue = `calc(-1 * ${themeSpacing})`;
236
- return {
237
- width: `calc(100% + ${themeSpacing})`,
238
- marginLeft: negativeValue,
239
- [`& > .${_gridLegacyClasses.default.item}`]: {
240
- paddingLeft: themeSpacing
241
- }
242
- };
243
- }
244
- if (zeroValueBreakpointKeys?.includes(breakpoint)) {
245
- return {};
246
- }
247
- return {
248
- width: '100%',
249
- marginLeft: 0,
250
- [`& > .${_gridLegacyClasses.default.item}`]: {
251
- paddingLeft: 0
252
- }
253
- };
254
- });
255
- }
256
- return styles;
257
- }
258
- function resolveSpacingStyles(spacing, breakpoints, styles = {}) {
259
- // undefined/null or `spacing` <= 0
260
- if (!spacing || spacing <= 0) {
261
- return [];
262
- }
263
- // in case of string/number `spacing`
264
- if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
265
- return [styles[`spacing-xs-${String(spacing)}`]];
266
- }
267
- // in case of object `spacing`
268
- const spacingStyles = [];
269
- breakpoints.forEach(breakpoint => {
270
- const value = spacing[breakpoint];
271
- if (Number(value) > 0) {
272
- spacingStyles.push(styles[`spacing-${breakpoint}-${String(value)}`]);
273
- }
274
- });
275
- return spacingStyles;
276
- }
277
-
278
- // Default CSS values
279
- // flex: '0 1 auto',
280
- // flexDirection: 'row',
281
- // alignItems: 'flex-start',
282
- // flexWrap: 'nowrap',
283
- // justifyContent: 'flex-start',
284
- const GridLegacyRoot = (0, _styled.default)('div', {
285
- name: 'MuiGridLegacy',
286
- slot: 'Root',
287
- overridesResolver: (props, styles) => {
288
- const {
289
- ownerState
290
- } = props;
291
- const {
292
- container,
293
- direction,
294
- item,
295
- spacing,
296
- wrap,
297
- zeroMinWidth,
298
- breakpoints
299
- } = ownerState;
300
- let spacingStyles = [];
301
-
302
- // in case of grid item
303
- if (container) {
304
- spacingStyles = resolveSpacingStyles(spacing, breakpoints, styles);
305
- }
306
- const breakpointsStyles = [];
307
- breakpoints.forEach(breakpoint => {
308
- const value = ownerState[breakpoint];
309
- if (value) {
310
- breakpointsStyles.push(styles[`grid-${breakpoint}-${String(value)}`]);
311
- }
312
- });
313
- return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth, ...spacingStyles, direction !== 'row' && styles[`direction-xs-${String(direction)}`], wrap !== 'wrap' && styles[`wrap-xs-${String(wrap)}`], ...breakpointsStyles];
314
- }
315
- })(
316
- // FIXME(romgrk): Can't use memoTheme here
317
- ({
318
- ownerState
319
- }) => ({
320
- boxSizing: 'border-box',
321
- ...(ownerState.container && {
322
- display: 'flex',
323
- flexWrap: 'wrap',
324
- width: '100%'
325
- }),
326
- ...(ownerState.item && {
327
- margin: 0 // For instance, it's useful when used with a `figure` element.
328
- }),
329
- ...(ownerState.zeroMinWidth && {
330
- minWidth: 0
331
- }),
332
- ...(ownerState.wrap !== 'wrap' && {
333
- flexWrap: ownerState.wrap
334
- })
335
- }), generateDirection, generateRowGap, generateColumnGap, generateGridLegacy);
336
- function resolveSpacingClasses(spacing, breakpoints) {
337
- // undefined/null or `spacing` <= 0
338
- if (!spacing || spacing <= 0) {
339
- return [];
340
- }
341
- // in case of string/number `spacing`
342
- if (typeof spacing === 'string' && !Number.isNaN(Number(spacing)) || typeof spacing === 'number') {
343
- return [`spacing-xs-${String(spacing)}`];
344
- }
345
- // in case of object `spacing`
346
- const classes = [];
347
- breakpoints.forEach(breakpoint => {
348
- const value = spacing[breakpoint];
349
- if (Number(value) > 0) {
350
- const className = `spacing-${breakpoint}-${String(value)}`;
351
- classes.push(className);
352
- }
353
- });
354
- return classes;
355
- }
356
- const useUtilityClasses = ownerState => {
357
- const {
358
- classes,
359
- container,
360
- direction,
361
- item,
362
- spacing,
363
- wrap,
364
- zeroMinWidth,
365
- breakpoints
366
- } = ownerState;
367
- let spacingClasses = [];
368
-
369
- // in case of grid item
370
- if (container) {
371
- spacingClasses = resolveSpacingClasses(spacing, breakpoints);
372
- }
373
- const breakpointsClasses = [];
374
- breakpoints.forEach(breakpoint => {
375
- const value = ownerState[breakpoint];
376
- if (value) {
377
- breakpointsClasses.push(`grid-${breakpoint}-${String(value)}`);
378
- }
379
- });
380
- const slots = {
381
- root: ['root', container && 'container', item && 'item', zeroMinWidth && 'zeroMinWidth', ...spacingClasses, direction !== 'row' && `direction-xs-${String(direction)}`, wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...breakpointsClasses]
382
- };
383
- return (0, _composeClasses.default)(slots, _gridLegacyClasses.getGridLegacyUtilityClass, classes);
384
- };
385
-
386
- /**
387
- * @deprecated Use the [`Grid`](https://mui.com/material-ui/react-grid/) component instead.
388
- */
389
- const GridLegacy = /*#__PURE__*/React.forwardRef(function GridLegacy(inProps, ref) {
390
- const themeProps = (0, _DefaultPropsProvider.useDefaultProps)({
391
- props: inProps,
392
- name: 'MuiGridLegacy'
393
- });
394
- const {
395
- breakpoints
396
- } = (0, _useTheme.default)();
397
- const props = (0, _styleFunctionSx.extendSxProp)(themeProps);
398
- const {
399
- className,
400
- columns: columnsProp,
401
- columnSpacing: columnSpacingProp,
402
- component = 'div',
403
- container = false,
404
- direction = 'row',
405
- item = false,
406
- rowSpacing: rowSpacingProp,
407
- spacing = 0,
408
- wrap = 'wrap',
409
- zeroMinWidth = false,
410
- ...other
411
- } = props;
412
- React.useEffect(() => {
413
- warnAboutDeprecatedGridLegacy();
414
- }, []);
415
- const rowSpacing = rowSpacingProp || spacing;
416
- const columnSpacing = columnSpacingProp || spacing;
417
- const columnsContext = React.useContext(_GridLegacyContext.default);
418
-
419
- // columns set with default breakpoint unit of 12
420
- const columns = container ? columnsProp || 12 : columnsContext;
421
- const breakpointsValues = {};
422
- const otherFiltered = {
423
- ...other
424
- };
425
- breakpoints.keys.forEach(breakpoint => {
426
- if (other[breakpoint] != null) {
427
- breakpointsValues[breakpoint] = other[breakpoint];
428
- delete otherFiltered[breakpoint];
429
- }
430
- });
431
- const ownerState = {
432
- ...props,
433
- columns,
434
- container,
435
- direction,
436
- item,
437
- rowSpacing,
438
- columnSpacing,
439
- wrap,
440
- zeroMinWidth,
441
- spacing,
442
- ...breakpointsValues,
443
- breakpoints: breakpoints.keys
444
- };
445
- const classes = useUtilityClasses(ownerState);
446
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridLegacyContext.default.Provider, {
447
- value: columns,
448
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridLegacyRoot, {
449
- ownerState: ownerState,
450
- className: (0, _clsx.default)(classes.root, className),
451
- as: component,
452
- ref: ref,
453
- ...otherFiltered
454
- })
455
- });
456
- });
457
- process.env.NODE_ENV !== "production" ? GridLegacy.propTypes /* remove-proptypes */ = {
458
- // ┌────────────────────────────── Warning ──────────────────────────────┐
459
- // │ These PropTypes are generated from the TypeScript type definitions. │
460
- // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
461
- // └─────────────────────────────────────────────────────────────────────┘
462
- /**
463
- * The content of the component.
464
- */
465
- children: _propTypes.default.node,
466
- /**
467
- * Override or extend the styles applied to the component.
468
- */
469
- classes: _propTypes.default.object,
470
- /**
471
- * @ignore
472
- */
473
- className: _propTypes.default.string,
474
- /**
475
- * The number of columns.
476
- * @default 12
477
- */
478
- columns: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.number), _propTypes.default.number, _propTypes.default.object]),
479
- /**
480
- * Defines the horizontal space between the type `item` components.
481
- * It overrides the value of the `spacing` prop.
482
- */
483
- columnSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
484
- /**
485
- * The component used for the root node.
486
- * Either a string to use a HTML element or a component.
487
- */
488
- component: _propTypes.default.elementType,
489
- /**
490
- * If `true`, the component will have the flex *container* behavior.
491
- * You should be wrapping *items* with a *container*.
492
- * @default false
493
- */
494
- container: _propTypes.default.bool,
495
- /**
496
- * Defines the `flex-direction` style property.
497
- * It is applied for all screen sizes.
498
- * @default 'row'
499
- */
500
- direction: _propTypes.default.oneOfType([_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), _propTypes.default.object]),
501
- /**
502
- * If `true`, the component will have the flex *item* behavior.
503
- * You should be wrapping *items* with a *container*.
504
- * @default false
505
- */
506
- item: _propTypes.default.bool,
507
- /**
508
- * If a number, it sets the number of columns the grid item uses.
509
- * It can't be greater than the total number of columns of the container (12 by default).
510
- * If 'auto', the grid item's width matches its content.
511
- * If false, the prop is ignored.
512
- * If true, the grid item's width grows to use the space available in the grid container.
513
- * The value is applied for the `lg` breakpoint and wider screens if not overridden.
514
- * @default false
515
- */
516
- lg: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
517
- /**
518
- * If a number, it sets the number of columns the grid item uses.
519
- * It can't be greater than the total number of columns of the container (12 by default).
520
- * If 'auto', the grid item's width matches its content.
521
- * If false, the prop is ignored.
522
- * If true, the grid item's width grows to use the space available in the grid container.
523
- * The value is applied for the `md` breakpoint and wider screens if not overridden.
524
- * @default false
525
- */
526
- md: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
527
- /**
528
- * Defines the vertical space between the type `item` components.
529
- * It overrides the value of the `spacing` prop.
530
- */
531
- rowSpacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
532
- /**
533
- * If a number, it sets the number of columns the grid item uses.
534
- * It can't be greater than the total number of columns of the container (12 by default).
535
- * If 'auto', the grid item's width matches its content.
536
- * If false, the prop is ignored.
537
- * If true, the grid item's width grows to use the space available in the grid container.
538
- * The value is applied for the `sm` breakpoint and wider screens if not overridden.
539
- * @default false
540
- */
541
- sm: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
542
- /**
543
- * Defines the space between the type `item` components.
544
- * It can only be used on a type `container` component.
545
- * @default 0
546
- */
547
- spacing: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string]),
548
- /**
549
- * The system prop that allows defining system overrides as well as additional CSS styles.
550
- */
551
- sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
552
- /**
553
- * Defines the `flex-wrap` style property.
554
- * It's applied for all screen sizes.
555
- * @default 'wrap'
556
- */
557
- wrap: _propTypes.default.oneOf(['nowrap', 'wrap-reverse', 'wrap']),
558
- /**
559
- * If a number, it sets the number of columns the grid item uses.
560
- * It can't be greater than the total number of columns of the container (12 by default).
561
- * If 'auto', the grid item's width matches its content.
562
- * If false, the prop is ignored.
563
- * If true, the grid item's width grows to use the space available in the grid container.
564
- * The value is applied for the `xl` breakpoint and wider screens if not overridden.
565
- * @default false
566
- */
567
- xl: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
568
- /**
569
- * If a number, it sets the number of columns the grid item uses.
570
- * It can't be greater than the total number of columns of the container (12 by default).
571
- * If 'auto', the grid item's width matches its content.
572
- * If false, the prop is ignored.
573
- * If true, the grid item's width grows to use the space available in the grid container.
574
- * The value is applied for all the screen sizes with the lowest priority.
575
- * @default false
576
- */
577
- xs: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number, _propTypes.default.bool]),
578
- /**
579
- * If `true`, it sets `min-width: 0` on the item.
580
- * Refer to the limitations section of the documentation to better understand the use case.
581
- * @default false
582
- */
583
- zeroMinWidth: _propTypes.default.bool
584
- } : void 0;
585
- if (process.env.NODE_ENV !== 'production') {
586
- const requireProp = (0, _requirePropFactory.default)('GridLegacy', GridLegacy);
587
- // eslint-disable-next-line no-useless-concat
588
- GridLegacy['propTypes' + ''] = {
589
- // eslint-disable-next-line react/forbid-foreign-prop-types
590
- ...GridLegacy.propTypes,
591
- direction: requireProp('container'),
592
- lg: requireProp('item'),
593
- md: requireProp('item'),
594
- sm: requireProp('item'),
595
- spacing: requireProp('container'),
596
- wrap: requireProp('container'),
597
- xs: requireProp('item'),
598
- zeroMinWidth: requireProp('item')
599
- };
600
- }
601
- var _default = exports.default = GridLegacy;