@mui/material 9.0.0-alpha.3 → 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 (302) 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 +10 -60
  20. package/Autocomplete/Autocomplete.d.ts +10 -60
  21. package/Autocomplete/Autocomplete.js +33 -99
  22. package/Autocomplete/Autocomplete.mjs +33 -99
  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/Button/Button.js +6 -6
  40. package/Button/Button.mjs +6 -6
  41. package/Button/buttonClasses.d.mts +0 -132
  42. package/Button/buttonClasses.d.ts +0 -132
  43. package/Button/buttonClasses.js +1 -1
  44. package/Button/buttonClasses.mjs +1 -1
  45. package/ButtonBase/ButtonBase.js +16 -2
  46. package/ButtonBase/ButtonBase.mjs +16 -2
  47. package/CHANGELOG.md +154 -0
  48. package/CircularProgress/CircularProgress.js +2 -2
  49. package/CircularProgress/CircularProgress.mjs +2 -2
  50. package/CircularProgress/circularProgressClasses.d.mts +0 -8
  51. package/CircularProgress/circularProgressClasses.d.ts +0 -8
  52. package/CircularProgress/circularProgressClasses.js +1 -1
  53. package/CircularProgress/circularProgressClasses.mjs +1 -1
  54. package/Divider/Divider.d.mts +0 -6
  55. package/Divider/Divider.d.ts +0 -6
  56. package/Divider/Divider.js +2 -18
  57. package/Divider/Divider.mjs +2 -18
  58. package/Divider/dividerClasses.d.mts +0 -4
  59. package/Divider/dividerClasses.d.ts +0 -4
  60. package/Divider/dividerClasses.js +1 -1
  61. package/Divider/dividerClasses.mjs +1 -1
  62. package/FormControlLabel/FormControlLabel.d.mts +1 -14
  63. package/FormControlLabel/FormControlLabel.d.ts +1 -14
  64. package/FormControlLabel/FormControlLabel.js +1 -13
  65. package/FormControlLabel/FormControlLabel.mjs +1 -13
  66. package/Input/Input.js +2 -1
  67. package/Input/Input.mjs +2 -1
  68. package/Menu/Menu.d.mts +0 -13
  69. package/Menu/Menu.d.ts +0 -13
  70. package/Menu/Menu.js +5 -44
  71. package/Menu/Menu.mjs +5 -44
  72. package/MenuItem/MenuItem.js +21 -1
  73. package/MenuItem/MenuItem.mjs +23 -1
  74. package/MenuList/MenuList.js +2 -4
  75. package/MenuList/MenuList.mjs +2 -4
  76. package/MobileStepper/MobileStepper.d.mts +0 -5
  77. package/MobileStepper/MobileStepper.d.ts +0 -5
  78. package/MobileStepper/MobileStepper.js +1 -10
  79. package/MobileStepper/MobileStepper.mjs +1 -10
  80. package/Popover/Popover.d.mts +4 -48
  81. package/Popover/Popover.d.ts +4 -48
  82. package/Popover/Popover.js +4 -64
  83. package/Popover/Popover.mjs +4 -64
  84. package/Popper/Popper.d.mts +0 -17
  85. package/Popper/Popper.d.ts +0 -17
  86. package/Popper/Popper.js +2 -26
  87. package/Popper/Popper.mjs +2 -26
  88. package/Popper/index.d.mts +1 -0
  89. package/Popper/index.d.ts +1 -0
  90. package/Popper/index.js +11 -2
  91. package/Popper/index.mjs +1 -0
  92. package/Select/SelectInput.js +50 -55
  93. package/Select/SelectInput.mjs +47 -52
  94. package/Select/index.d.mts +1 -0
  95. package/Select/index.d.ts +1 -0
  96. package/Select/index.js +12 -0
  97. package/Select/index.mjs +1 -0
  98. package/Select/utils/SelectFocusSourceContext.d.mts +4 -0
  99. package/Select/utils/SelectFocusSourceContext.d.ts +4 -0
  100. package/Select/utils/SelectFocusSourceContext.js +19 -0
  101. package/Select/utils/SelectFocusSourceContext.mjs +13 -0
  102. package/Select/utils/areEqualValues.d.mts +1 -0
  103. package/Select/utils/areEqualValues.d.ts +1 -0
  104. package/Select/utils/areEqualValues.js +14 -0
  105. package/Select/utils/areEqualValues.mjs +8 -0
  106. package/Select/utils/getOpenInteractionType.d.mts +1 -0
  107. package/Select/utils/getOpenInteractionType.d.ts +1 -0
  108. package/Select/utils/getOpenInteractionType.js +18 -0
  109. package/Select/utils/getOpenInteractionType.mjs +12 -0
  110. package/Select/utils/index.d.mts +4 -0
  111. package/Select/utils/index.d.ts +4 -0
  112. package/Select/utils/index.js +40 -0
  113. package/Select/utils/index.mjs +4 -0
  114. package/Select/utils/isEmpty.d.mts +1 -0
  115. package/Select/utils/isEmpty.d.ts +1 -0
  116. package/Select/utils/isEmpty.js +9 -0
  117. package/Select/utils/isEmpty.mjs +3 -0
  118. package/Slider/Slider.d.mts +109 -77
  119. package/Slider/Slider.d.ts +109 -77
  120. package/Slider/Slider.js +42 -119
  121. package/Slider/Slider.mjs +42 -119
  122. package/Slider/sliderClasses.d.mts +7 -7
  123. package/Slider/sliderClasses.d.ts +7 -7
  124. package/Slider/useSlider.js +50 -14
  125. package/Slider/useSlider.mjs +50 -14
  126. package/Snackbar/Snackbar.d.mts +1 -27
  127. package/Snackbar/Snackbar.d.ts +1 -27
  128. package/Snackbar/Snackbar.js +5 -58
  129. package/Snackbar/Snackbar.mjs +5 -58
  130. package/SpeedDial/SpeedDial.d.mts +0 -13
  131. package/SpeedDial/SpeedDial.d.ts +0 -13
  132. package/SpeedDial/SpeedDial.js +15 -40
  133. package/SpeedDial/SpeedDial.mjs +15 -40
  134. package/SpeedDialAction/SpeedDialAction.d.mts +0 -28
  135. package/SpeedDialAction/SpeedDialAction.d.ts +0 -28
  136. package/SpeedDialAction/SpeedDialAction.js +5 -46
  137. package/SpeedDialAction/SpeedDialAction.mjs +5 -46
  138. package/TablePagination/TablePagination.d.mts +1 -1
  139. package/TablePagination/TablePagination.d.ts +1 -1
  140. package/TablePagination/TablePagination.js +4 -2
  141. package/TablePagination/TablePagination.mjs +4 -2
  142. package/Tabs/Tabs.d.mts +2 -33
  143. package/Tabs/Tabs.d.ts +2 -33
  144. package/Tabs/Tabs.js +8 -38
  145. package/Tabs/Tabs.mjs +8 -38
  146. package/TextField/TextField.d.mts +6 -49
  147. package/TextField/TextField.d.ts +6 -49
  148. package/TextField/TextField.js +18 -53
  149. package/TextField/TextField.mjs +18 -53
  150. package/Tooltip/Tooltip.d.mts +1 -55
  151. package/Tooltip/Tooltip.d.ts +1 -55
  152. package/Tooltip/Tooltip.js +9 -87
  153. package/Tooltip/Tooltip.mjs +9 -87
  154. package/Typography/Typography.d.mts +0 -6
  155. package/Typography/Typography.d.ts +0 -6
  156. package/Typography/Typography.js +3 -19
  157. package/Typography/Typography.mjs +3 -19
  158. package/Typography/typographyClasses.d.mts +0 -5
  159. package/Typography/typographyClasses.d.ts +0 -5
  160. package/Typography/typographyClasses.js +1 -1
  161. package/Typography/typographyClasses.mjs +1 -1
  162. package/index.d.mts +0 -2
  163. package/index.d.ts +0 -2
  164. package/index.js +1 -9
  165. package/index.mjs +1 -2
  166. package/locale/amET.js +4 -1
  167. package/locale/amET.mjs +3 -1
  168. package/locale/arEG.js +4 -1
  169. package/locale/arEG.mjs +3 -1
  170. package/locale/arSA.js +4 -1
  171. package/locale/arSA.mjs +3 -1
  172. package/locale/arSD.js +4 -1
  173. package/locale/arSD.mjs +3 -1
  174. package/locale/beBY.js +4 -1
  175. package/locale/beBY.mjs +3 -1
  176. package/locale/bnBD.js +4 -1
  177. package/locale/bnBD.mjs +3 -1
  178. package/locale/caES.js +4 -1
  179. package/locale/caES.mjs +3 -1
  180. package/locale/csCZ.js +4 -1
  181. package/locale/csCZ.mjs +3 -1
  182. package/locale/daDK.js +4 -1
  183. package/locale/daDK.mjs +3 -1
  184. package/locale/deDE.js +4 -1
  185. package/locale/deDE.mjs +3 -1
  186. package/locale/elGR.js +4 -1
  187. package/locale/elGR.mjs +3 -1
  188. package/locale/esES.js +4 -1
  189. package/locale/esES.mjs +3 -1
  190. package/locale/etEE.js +4 -1
  191. package/locale/etEE.mjs +3 -1
  192. package/locale/faIR.js +4 -1
  193. package/locale/faIR.mjs +3 -1
  194. package/locale/fiFI.js +4 -1
  195. package/locale/fiFI.mjs +3 -1
  196. package/locale/frFR.js +4 -1
  197. package/locale/frFR.mjs +3 -1
  198. package/locale/heIL.js +4 -1
  199. package/locale/heIL.mjs +3 -1
  200. package/locale/hiIN.js +4 -1
  201. package/locale/hiIN.mjs +3 -1
  202. package/locale/hrHR.js +5 -1
  203. package/locale/hrHR.mjs +4 -1
  204. package/locale/isIS.js +4 -1
  205. package/locale/isIS.mjs +3 -1
  206. package/locale/itIT.js +4 -1
  207. package/locale/itIT.mjs +3 -1
  208. package/locale/jaJP.js +4 -1
  209. package/locale/jaJP.mjs +3 -1
  210. package/locale/khKH.js +4 -1
  211. package/locale/khKH.mjs +3 -1
  212. package/locale/kkKZ.js +4 -1
  213. package/locale/kkKZ.mjs +3 -1
  214. package/locale/koKR.js +4 -1
  215. package/locale/koKR.mjs +3 -1
  216. package/locale/kuCKB.js +4 -1
  217. package/locale/kuCKB.mjs +3 -1
  218. package/locale/kuLatn.js +4 -1
  219. package/locale/kuLatn.mjs +3 -1
  220. package/locale/mkMK.js +5 -1
  221. package/locale/mkMK.mjs +4 -1
  222. package/locale/msMS.js +5 -1
  223. package/locale/msMS.mjs +4 -1
  224. package/locale/myMY.js +5 -1
  225. package/locale/myMY.mjs +4 -1
  226. package/locale/nbNO.js +4 -1
  227. package/locale/nbNO.mjs +3 -1
  228. package/locale/neNP.js +5 -1
  229. package/locale/neNP.mjs +4 -1
  230. package/locale/nlNL.js +4 -1
  231. package/locale/nlNL.mjs +3 -1
  232. package/locale/nnNO.js +4 -1
  233. package/locale/nnNO.mjs +3 -1
  234. package/locale/plPL.js +4 -1
  235. package/locale/plPL.mjs +3 -1
  236. package/locale/psAF.js +4 -1
  237. package/locale/psAF.mjs +3 -1
  238. package/locale/ptBR.js +4 -1
  239. package/locale/ptBR.mjs +3 -1
  240. package/locale/ptPT.js +4 -1
  241. package/locale/ptPT.mjs +3 -1
  242. package/locale/roRO.js +4 -1
  243. package/locale/roRO.mjs +3 -1
  244. package/locale/ruRU.js +4 -1
  245. package/locale/ruRU.mjs +3 -1
  246. package/locale/siLK.js +4 -1
  247. package/locale/siLK.mjs +3 -1
  248. package/locale/skSK.js +4 -1
  249. package/locale/skSK.mjs +3 -1
  250. package/locale/srRS.js +5 -1
  251. package/locale/srRS.mjs +4 -1
  252. package/locale/svSE.js +4 -1
  253. package/locale/svSE.mjs +3 -1
  254. package/locale/thTH.js +4 -1
  255. package/locale/thTH.mjs +3 -1
  256. package/locale/tlTL.js +5 -1
  257. package/locale/tlTL.mjs +4 -1
  258. package/locale/trTR.js +4 -1
  259. package/locale/trTR.mjs +3 -1
  260. package/locale/ukUA.js +4 -1
  261. package/locale/ukUA.mjs +3 -1
  262. package/locale/urPK.js +4 -1
  263. package/locale/urPK.mjs +3 -1
  264. package/locale/utils/buildFormatNumber.d.mts +2 -0
  265. package/locale/utils/buildFormatNumber.d.ts +2 -0
  266. package/locale/utils/buildFormatNumber.js +23 -0
  267. package/locale/utils/buildFormatNumber.mjs +17 -0
  268. package/locale/viVN.js +4 -1
  269. package/locale/viVN.mjs +3 -1
  270. package/locale/zhCN.js +4 -1
  271. package/locale/zhCN.mjs +3 -1
  272. package/locale/zhHK.js +4 -1
  273. package/locale/zhHK.mjs +3 -1
  274. package/locale/zhTW.js +4 -1
  275. package/locale/zhTW.mjs +3 -1
  276. package/package.json +6 -20
  277. package/styles/components.d.mts +0 -5
  278. package/styles/components.d.ts +0 -5
  279. package/styles/overrides.d.mts +0 -2
  280. package/styles/overrides.d.ts +0 -2
  281. package/styles/props.d.mts +0 -2
  282. package/styles/props.d.ts +0 -2
  283. package/useAutocomplete/useAutocomplete.d.mts +0 -12
  284. package/useAutocomplete/useAutocomplete.d.ts +0 -12
  285. package/useAutocomplete/useAutocomplete.js +29 -28
  286. package/useAutocomplete/useAutocomplete.mjs +29 -28
  287. package/version/index.js +2 -2
  288. package/version/index.mjs +2 -2
  289. package/GridLegacy/GridLegacy.d.mts +0 -160
  290. package/GridLegacy/GridLegacy.d.ts +0 -160
  291. package/GridLegacy/GridLegacy.js +0 -601
  292. package/GridLegacy/GridLegacy.mjs +0 -588
  293. package/GridLegacy/GridLegacyContext.js +0 -17
  294. package/GridLegacy/GridLegacyContext.mjs +0 -12
  295. package/GridLegacy/gridLegacyClasses.d.mts +0 -48
  296. package/GridLegacy/gridLegacyClasses.d.ts +0 -48
  297. package/GridLegacy/gridLegacyClasses.js +0 -27
  298. package/GridLegacy/gridLegacyClasses.mjs +0 -19
  299. package/GridLegacy/index.d.mts +0 -4
  300. package/GridLegacy/index.d.ts +0 -4
  301. package/GridLegacy/index.js +0 -35
  302. package/GridLegacy/index.mjs +0 -3
package/Popper/Popper.js CHANGED
@@ -42,8 +42,6 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
42
42
  const {
43
43
  anchorEl,
44
44
  component,
45
- components,
46
- componentsProps,
47
45
  container,
48
46
  disablePortal,
49
47
  keepMounted,
@@ -57,7 +55,6 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
57
55
  slotProps,
58
56
  ...other
59
57
  } = props;
60
- const RootComponent = slots?.root ?? components?.Root;
61
58
  const otherProps = {
62
59
  anchorEl,
63
60
  container,
@@ -74,10 +71,8 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
74
71
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(PopperRoot, {
75
72
  as: component,
76
73
  direction: isRtl ? 'rtl' : 'ltr',
77
- slots: {
78
- root: RootComponent
79
- },
80
- slotProps: slotProps ?? componentsProps,
74
+ slots: slots,
75
+ slotProps: slotProps,
81
76
  ...otherProps,
82
77
  ref: ref
83
78
  });
@@ -103,25 +98,6 @@ process.env.NODE_ENV !== "production" ? Popper.propTypes /* remove-proptypes */
103
98
  * Either a string to use a HTML element or a component.
104
99
  */
105
100
  component: _propTypes.default.elementType,
106
- /**
107
- * The components used for each slot inside the Popper.
108
- * Either a string to use a HTML element or a component.
109
- *
110
- * @deprecated use the `slots` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
111
- * @default {}
112
- */
113
- components: _propTypes.default.shape({
114
- Root: _propTypes.default.elementType
115
- }),
116
- /**
117
- * The props used for each slot inside the Popper.
118
- *
119
- * @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
120
- * @default {}
121
- */
122
- componentsProps: _propTypes.default.shape({
123
- root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
124
- }),
125
101
  /**
126
102
  * An HTML element or function that returns one.
127
103
  * The `container` will have the portal children appended to it.
package/Popper/Popper.mjs CHANGED
@@ -35,8 +35,6 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
35
35
  const {
36
36
  anchorEl,
37
37
  component,
38
- components,
39
- componentsProps,
40
38
  container,
41
39
  disablePortal,
42
40
  keepMounted,
@@ -50,7 +48,6 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
50
48
  slotProps,
51
49
  ...other
52
50
  } = props;
53
- const RootComponent = slots?.root ?? components?.Root;
54
51
  const otherProps = {
55
52
  anchorEl,
56
53
  container,
@@ -67,10 +64,8 @@ const Popper = /*#__PURE__*/React.forwardRef(function Popper(inProps, ref) {
67
64
  return /*#__PURE__*/_jsx(PopperRoot, {
68
65
  as: component,
69
66
  direction: isRtl ? 'rtl' : 'ltr',
70
- slots: {
71
- root: RootComponent
72
- },
73
- slotProps: slotProps ?? componentsProps,
67
+ slots: slots,
68
+ slotProps: slotProps,
74
69
  ...otherProps,
75
70
  ref: ref
76
71
  });
@@ -96,25 +91,6 @@ process.env.NODE_ENV !== "production" ? Popper.propTypes /* remove-proptypes */
96
91
  * Either a string to use a HTML element or a component.
97
92
  */
98
93
  component: PropTypes.elementType,
99
- /**
100
- * The components used for each slot inside the Popper.
101
- * Either a string to use a HTML element or a component.
102
- *
103
- * @deprecated use the `slots` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
104
- * @default {}
105
- */
106
- components: PropTypes.shape({
107
- Root: PropTypes.elementType
108
- }),
109
- /**
110
- * The props used for each slot inside the Popper.
111
- *
112
- * @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
113
- * @default {}
114
- */
115
- componentsProps: PropTypes.shape({
116
- root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
117
- }),
118
94
  /**
119
95
  * An HTML element or function that returns one.
120
96
  * The `container` will have the portal children appended to it.
@@ -1,4 +1,5 @@
1
1
  export { default } from "./Popper.mjs";
2
2
  export * from "./Popper.mjs";
3
+ export { default as popperClasses } from "./popperClasses.mjs";
3
4
  export * from "./popperClasses.mjs";
4
5
  export { PopperPlacementType } from "./BasePopper.types.mjs";
package/Popper/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default } from "./Popper.js";
2
2
  export * from "./Popper.js";
3
+ export { default as popperClasses } from "./popperClasses.js";
3
4
  export * from "./popperClasses.js";
4
5
  export { PopperPlacementType } from "./BasePopper.types.js";
package/Popper/index.js CHANGED
@@ -1,18 +1,27 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
- var _exportNames = {};
8
+ var _exportNames = {
9
+ popperClasses: true
10
+ };
8
11
  Object.defineProperty(exports, "default", {
9
12
  enumerable: true,
10
13
  get: function () {
11
14
  return _Popper.default;
12
15
  }
13
16
  });
17
+ Object.defineProperty(exports, "popperClasses", {
18
+ enumerable: true,
19
+ get: function () {
20
+ return _popperClasses.default;
21
+ }
22
+ });
14
23
  var _Popper = _interopRequireDefault(require("./Popper"));
15
- var _popperClasses = require("./popperClasses");
24
+ var _popperClasses = _interopRequireWildcard(require("./popperClasses"));
16
25
  Object.keys(_popperClasses).forEach(function (key) {
17
26
  if (key === "default" || key === "__esModule") return;
18
27
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
package/Popper/index.mjs CHANGED
@@ -1,2 +1,3 @@
1
1
  export { default } from "./Popper.mjs";
2
+ export { default as popperClasses } from "./popperClasses.mjs";
2
3
  export * from "./popperClasses.mjs";
@@ -25,6 +25,8 @@ var _slotShouldForwardProp = _interopRequireDefault(require("../styles/slotShoul
25
25
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
26
26
  var _useControlled = _interopRequireDefault(require("../utils/useControlled"));
27
27
  var _selectClasses = _interopRequireWildcard(require("./selectClasses"));
28
+ var _utils2 = require("./utils");
29
+ var _SelectFocusSourceContext = require("./utils/SelectFocusSourceContext");
28
30
  var _jsxRuntime = require("react/jsx-runtime");
29
31
  var _span;
30
32
  const SelectSelect = (0, _zeroStyled.styled)(_NativeSelectInput.StyledSelectSelect, {
@@ -81,17 +83,6 @@ const SelectNativeInput = (0, _zeroStyled.styled)('input', {
81
83
  width: '100%',
82
84
  boxSizing: 'border-box'
83
85
  });
84
- function areEqualValues(a, b) {
85
- if (typeof b === 'object' && b !== null) {
86
- return a === b;
87
- }
88
-
89
- // The value could be a number, the DOM will stringify it anyway.
90
- return String(a) === String(b);
91
- }
92
- function isEmpty(display) {
93
- return display == null || typeof display === 'string' && !display.trim();
94
- }
95
86
  const useUtilityClasses = ownerState => {
96
87
  const {
97
88
  classes,
@@ -169,6 +160,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
169
160
  current: isOpenControlled
170
161
  } = React.useRef(openProp != null);
171
162
  const [menuMinWidthState, setMenuMinWidthState] = React.useState();
163
+ const [openInteractionType, setOpenInteractionType] = React.useState(null);
172
164
  const handleRef = (0, _useForkRef.default)(ref, inputRefProp);
173
165
  const handleDisplayRef = React.useCallback(node => {
174
166
  displayRef.current = node;
@@ -237,11 +229,15 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
237
229
  }, [labelId]);
238
230
  const update = (openParam, event) => {
239
231
  if (openParam) {
232
+ setOpenInteractionType((0, _utils2.getOpenInteractionType)(event));
240
233
  if (onOpen) {
241
234
  onOpen(event);
242
235
  }
243
- } else if (onClose) {
244
- onClose(event);
236
+ } else {
237
+ setOpenInteractionType(null);
238
+ if (onClose) {
239
+ onClose(event);
240
+ }
245
241
  }
246
242
  if (!isOpenControlled) {
247
243
  setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
@@ -377,12 +373,12 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
377
373
  if (!Array.isArray(value)) {
378
374
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : (0, _formatMuiErrorMessage.default)(2));
379
375
  }
380
- selected = value.some(v => areEqualValues(v, child.props.value));
376
+ selected = value.some(v => (0, _utils2.areEqualValues)(v, child.props.value));
381
377
  if (selected && computeDisplay) {
382
378
  displayMultiple.push(child.props.children);
383
379
  }
384
380
  } else {
385
- selected = areEqualValues(value, child.props.value);
381
+ selected = (0, _utils2.areEqualValues)(value, child.props.value);
386
382
  if (selected && computeDisplay) {
387
383
  displaySingle = child.props.children;
388
384
  }
@@ -459,15 +455,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
459
455
  error
460
456
  };
461
457
  const classes = useUtilityClasses(ownerState);
462
- const paperProps = {
463
- ...MenuProps.PaperProps,
464
- ...(typeof MenuProps.slotProps?.paper === 'function' ? MenuProps.slotProps.paper(ownerState) : MenuProps.slotProps?.paper)
465
- };
466
- const listProps = {
467
- ...MenuProps.MenuListProps,
468
- ...(typeof MenuProps.slotProps?.list === 'function' ? MenuProps.slotProps.list(ownerState) : MenuProps.slotProps?.list)
469
- };
458
+ const menuPaperSlotProps = typeof MenuProps.slotProps?.paper === 'function' ? MenuProps.slotProps.paper(ownerState) : MenuProps.slotProps?.paper;
459
+ const menuListSlotProps = typeof MenuProps.slotProps?.list === 'function' ? MenuProps.slotProps.list(ownerState) : MenuProps.slotProps?.list;
470
460
  const listboxId = (0, _useId.default)();
461
+ const nativeInputId = (0, _useId.default)();
471
462
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
472
463
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SelectSelect, {
473
464
  as: "div",
@@ -493,7 +484,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
493
484
  // The id is required for proper a11y
494
485
  ,
495
486
  id: buttonId,
496
- children: isEmpty(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
487
+ children: (0, _utils2.isEmpty)(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
497
488
  _span || (_span = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
498
489
  className: "notranslate",
499
490
  "aria-hidden": true,
@@ -512,44 +503,48 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
512
503
  autoFocus: autoFocus,
513
504
  required: required,
514
505
  ...other,
506
+ id: other.id ?? nativeInputId,
515
507
  ownerState: ownerState
516
508
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(SelectIcon, {
517
509
  as: IconComponent,
518
510
  className: classes.icon,
519
511
  ownerState: ownerState
520
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
521
- id: `menu-${name || ''}`,
522
- anchorEl: anchorElement,
523
- open: open,
524
- onClose: handleClose,
525
- anchorOrigin: {
526
- vertical: 'bottom',
527
- horizontal: 'center'
528
- },
529
- transformOrigin: {
530
- vertical: 'top',
531
- horizontal: 'center'
532
- },
533
- ...MenuProps,
534
- slotProps: {
535
- ...MenuProps.slotProps,
536
- list: {
537
- 'aria-labelledby': labelId,
538
- role: 'listbox',
539
- 'aria-multiselectable': multiple ? 'true' : undefined,
540
- disableListWrap: true,
541
- id: listboxId,
542
- ...listProps
512
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectFocusSourceContext.SelectFocusSourceProvider, {
513
+ value: openInteractionType,
514
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
515
+ id: `menu-${name || ''}`,
516
+ anchorEl: anchorElement,
517
+ open: open,
518
+ onClose: handleClose,
519
+ anchorOrigin: {
520
+ vertical: 'bottom',
521
+ horizontal: 'center'
522
+ },
523
+ transformOrigin: {
524
+ vertical: 'top',
525
+ horizontal: 'center'
543
526
  },
544
- paper: {
545
- ...paperProps,
546
- style: {
547
- minWidth: menuMinWidth,
548
- ...(paperProps != null ? paperProps.style : null)
527
+ ...MenuProps,
528
+ slotProps: {
529
+ ...MenuProps.slotProps,
530
+ list: {
531
+ 'aria-labelledby': labelId,
532
+ role: 'listbox',
533
+ 'aria-multiselectable': multiple ? 'true' : undefined,
534
+ disableListWrap: true,
535
+ id: listboxId,
536
+ ...menuListSlotProps
537
+ },
538
+ paper: {
539
+ ...menuPaperSlotProps,
540
+ style: {
541
+ minWidth: menuMinWidth,
542
+ ...menuPaperSlotProps?.style
543
+ }
549
544
  }
550
- }
551
- },
552
- children: items
545
+ },
546
+ children: items
547
+ })
553
548
  })]
554
549
  });
555
550
  });
@@ -19,6 +19,8 @@ import slotShouldForwardProp from "../styles/slotShouldForwardProp.mjs";
19
19
  import useForkRef from "../utils/useForkRef.mjs";
20
20
  import useControlled from "../utils/useControlled.mjs";
21
21
  import selectClasses, { getSelectUtilityClasses } from "./selectClasses.mjs";
22
+ import { areEqualValues, isEmpty, getOpenInteractionType } from "./utils/index.mjs";
23
+ import { SelectFocusSourceProvider } from "./utils/SelectFocusSourceContext.mjs";
22
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
25
  const SelectSelect = styled(StyledSelectSelect, {
24
26
  name: 'MuiSelect',
@@ -74,17 +76,6 @@ const SelectNativeInput = styled('input', {
74
76
  width: '100%',
75
77
  boxSizing: 'border-box'
76
78
  });
77
- function areEqualValues(a, b) {
78
- if (typeof b === 'object' && b !== null) {
79
- return a === b;
80
- }
81
-
82
- // The value could be a number, the DOM will stringify it anyway.
83
- return String(a) === String(b);
84
- }
85
- function isEmpty(display) {
86
- return display == null || typeof display === 'string' && !display.trim();
87
- }
88
79
  const useUtilityClasses = ownerState => {
89
80
  const {
90
81
  classes,
@@ -162,6 +153,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
162
153
  current: isOpenControlled
163
154
  } = React.useRef(openProp != null);
164
155
  const [menuMinWidthState, setMenuMinWidthState] = React.useState();
156
+ const [openInteractionType, setOpenInteractionType] = React.useState(null);
165
157
  const handleRef = useForkRef(ref, inputRefProp);
166
158
  const handleDisplayRef = React.useCallback(node => {
167
159
  displayRef.current = node;
@@ -230,11 +222,15 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
230
222
  }, [labelId]);
231
223
  const update = (openParam, event) => {
232
224
  if (openParam) {
225
+ setOpenInteractionType(getOpenInteractionType(event));
233
226
  if (onOpen) {
234
227
  onOpen(event);
235
228
  }
236
- } else if (onClose) {
237
- onClose(event);
229
+ } else {
230
+ setOpenInteractionType(null);
231
+ if (onClose) {
232
+ onClose(event);
233
+ }
238
234
  }
239
235
  if (!isOpenControlled) {
240
236
  setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
@@ -452,15 +448,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
452
448
  error
453
449
  };
454
450
  const classes = useUtilityClasses(ownerState);
455
- const paperProps = {
456
- ...MenuProps.PaperProps,
457
- ...(typeof MenuProps.slotProps?.paper === 'function' ? MenuProps.slotProps.paper(ownerState) : MenuProps.slotProps?.paper)
458
- };
459
- const listProps = {
460
- ...MenuProps.MenuListProps,
461
- ...(typeof MenuProps.slotProps?.list === 'function' ? MenuProps.slotProps.list(ownerState) : MenuProps.slotProps?.list)
462
- };
451
+ const menuPaperSlotProps = typeof MenuProps.slotProps?.paper === 'function' ? MenuProps.slotProps.paper(ownerState) : MenuProps.slotProps?.paper;
452
+ const menuListSlotProps = typeof MenuProps.slotProps?.list === 'function' ? MenuProps.slotProps.list(ownerState) : MenuProps.slotProps?.list;
463
453
  const listboxId = useId();
454
+ const nativeInputId = useId();
464
455
  return /*#__PURE__*/_jsxs(React.Fragment, {
465
456
  children: [/*#__PURE__*/_jsx(SelectSelect, {
466
457
  as: "div",
@@ -505,44 +496,48 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
505
496
  autoFocus: autoFocus,
506
497
  required: required,
507
498
  ...other,
499
+ id: other.id ?? nativeInputId,
508
500
  ownerState: ownerState
509
501
  }), /*#__PURE__*/_jsx(SelectIcon, {
510
502
  as: IconComponent,
511
503
  className: classes.icon,
512
504
  ownerState: ownerState
513
- }), /*#__PURE__*/_jsx(Menu, {
514
- id: `menu-${name || ''}`,
515
- anchorEl: anchorElement,
516
- open: open,
517
- onClose: handleClose,
518
- anchorOrigin: {
519
- vertical: 'bottom',
520
- horizontal: 'center'
521
- },
522
- transformOrigin: {
523
- vertical: 'top',
524
- horizontal: 'center'
525
- },
526
- ...MenuProps,
527
- slotProps: {
528
- ...MenuProps.slotProps,
529
- list: {
530
- 'aria-labelledby': labelId,
531
- role: 'listbox',
532
- 'aria-multiselectable': multiple ? 'true' : undefined,
533
- disableListWrap: true,
534
- id: listboxId,
535
- ...listProps
505
+ }), /*#__PURE__*/_jsx(SelectFocusSourceProvider, {
506
+ value: openInteractionType,
507
+ children: /*#__PURE__*/_jsx(Menu, {
508
+ id: `menu-${name || ''}`,
509
+ anchorEl: anchorElement,
510
+ open: open,
511
+ onClose: handleClose,
512
+ anchorOrigin: {
513
+ vertical: 'bottom',
514
+ horizontal: 'center'
515
+ },
516
+ transformOrigin: {
517
+ vertical: 'top',
518
+ horizontal: 'center'
536
519
  },
537
- paper: {
538
- ...paperProps,
539
- style: {
540
- minWidth: menuMinWidth,
541
- ...(paperProps != null ? paperProps.style : null)
520
+ ...MenuProps,
521
+ slotProps: {
522
+ ...MenuProps.slotProps,
523
+ list: {
524
+ 'aria-labelledby': labelId,
525
+ role: 'listbox',
526
+ 'aria-multiselectable': multiple ? 'true' : undefined,
527
+ disableListWrap: true,
528
+ id: listboxId,
529
+ ...menuListSlotProps
530
+ },
531
+ paper: {
532
+ ...menuPaperSlotProps,
533
+ style: {
534
+ minWidth: menuMinWidth,
535
+ ...menuPaperSlotProps?.style
536
+ }
542
537
  }
543
- }
544
- },
545
- children: items
538
+ },
539
+ children: items
540
+ })
546
541
  })]
547
542
  });
548
543
  });
@@ -1,4 +1,5 @@
1
1
  export { default } from "./Select.mjs";
2
2
  export * from "./Select.mjs";
3
+ export * from "./utils/index.mjs";
3
4
  export { default as selectClasses } from "./selectClasses.mjs";
4
5
  export * from "./selectClasses.mjs";
package/Select/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default } from "./Select.js";
2
2
  export * from "./Select.js";
3
+ export * from "./utils/index.js";
3
4
  export { default as selectClasses } from "./selectClasses.js";
4
5
  export * from "./selectClasses.js";
package/Select/index.js CHANGED
@@ -21,6 +21,18 @@ Object.defineProperty(exports, "selectClasses", {
21
21
  }
22
22
  });
23
23
  var _Select = _interopRequireDefault(require("./Select"));
24
+ var _utils = require("./utils");
25
+ Object.keys(_utils).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _utils[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _utils[key];
33
+ }
34
+ });
35
+ });
24
36
  var _selectClasses = _interopRequireWildcard(require("./selectClasses"));
25
37
  Object.keys(_selectClasses).forEach(function (key) {
26
38
  if (key === "default" || key === "__esModule") return;
package/Select/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
1
  export { default } from "./Select.mjs";
2
+ export * from "./utils/index.mjs";
2
3
  export { default as selectClasses } from "./selectClasses.mjs";
3
4
  export * from "./selectClasses.mjs";
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ declare function useSelectFocusSource(): "touch" | "mouse" | "keyboard" | null;
3
+ declare const SelectFocusSourceProvider: React.Provider<"touch" | "mouse" | "keyboard" | null>;
4
+ export { useSelectFocusSource, SelectFocusSourceProvider };
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ declare function useSelectFocusSource(): "touch" | "mouse" | "keyboard" | null;
3
+ declare const SelectFocusSourceProvider: React.Provider<"touch" | "mouse" | "keyboard" | null>;
4
+ export { useSelectFocusSource, SelectFocusSourceProvider };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SelectFocusSourceProvider = void 0;
9
+ exports.useSelectFocusSource = useSelectFocusSource;
10
+ var React = _interopRequireWildcard(require("react"));
11
+ const SelectFocusSourceContext = /*#__PURE__*/React.createContext(null);
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ SelectFocusSourceContext.displayName = 'SelectFocusSourceContext';
14
+ }
15
+ function useSelectFocusSource() {
16
+ const context = React.useContext(SelectFocusSourceContext);
17
+ return context;
18
+ }
19
+ const SelectFocusSourceProvider = exports.SelectFocusSourceProvider = SelectFocusSourceContext.Provider;
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ const SelectFocusSourceContext = /*#__PURE__*/React.createContext(null);
5
+ if (process.env.NODE_ENV !== 'production') {
6
+ SelectFocusSourceContext.displayName = 'SelectFocusSourceContext';
7
+ }
8
+ function useSelectFocusSource() {
9
+ const context = React.useContext(SelectFocusSourceContext);
10
+ return context;
11
+ }
12
+ const SelectFocusSourceProvider = SelectFocusSourceContext.Provider;
13
+ export { useSelectFocusSource, SelectFocusSourceProvider };
@@ -0,0 +1 @@
1
+ export default function areEqualValues(a: unknown, b: unknown): boolean;
@@ -0,0 +1 @@
1
+ export default function areEqualValues(a: unknown, b: unknown): boolean;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = areEqualValues;
7
+ function areEqualValues(a, b) {
8
+ if (typeof b === 'object' && b !== null) {
9
+ return a === b;
10
+ }
11
+
12
+ // The value could be a number, the DOM will stringify it anyway.
13
+ return String(a) === String(b);
14
+ }
@@ -0,0 +1,8 @@
1
+ export default function areEqualValues(a, b) {
2
+ if (typeof b === 'object' && b !== null) {
3
+ return a === b;
4
+ }
5
+
6
+ // The value could be a number, the DOM will stringify it anyway.
7
+ return String(a) === String(b);
8
+ }
@@ -0,0 +1 @@
1
+ export default function getOpenInteractionType(event: MouseEvent | KeyboardEvent | TouchEvent | PointerEvent | null): 'keyboard' | 'pointer' | null;
@@ -0,0 +1 @@
1
+ export default function getOpenInteractionType(event: MouseEvent | KeyboardEvent | TouchEvent | PointerEvent | null): 'keyboard' | 'pointer' | null;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getOpenInteractionType;
7
+ function getOpenInteractionType(event) {
8
+ if (!event) {
9
+ return null;
10
+ }
11
+ if (event.type === 'mousedown' || event.type === 'pointerdown' || event.type === 'touchstart') {
12
+ return 'pointer';
13
+ }
14
+ if (event.type === 'keydown' || event.type === 'click' && event.detail === 0) {
15
+ return 'keyboard';
16
+ }
17
+ return null;
18
+ }
@@ -0,0 +1,12 @@
1
+ export default function getOpenInteractionType(event) {
2
+ if (!event) {
3
+ return null;
4
+ }
5
+ if (event.type === 'mousedown' || event.type === 'pointerdown' || event.type === 'touchstart') {
6
+ return 'pointer';
7
+ }
8
+ if (event.type === 'keydown' || event.type === 'click' && event.detail === 0) {
9
+ return 'keyboard';
10
+ }
11
+ return null;
12
+ }
@@ -0,0 +1,4 @@
1
+ export { default as getOpenInteractionType } from "./getOpenInteractionType.mjs";
2
+ export { default as isEmpty } from "./isEmpty.mjs";
3
+ export { default as areEqualValues } from "./areEqualValues.mjs";
4
+ export { useSelectFocusSource, SelectFocusSourceProvider } from "./SelectFocusSourceContext.mjs";
@@ -0,0 +1,4 @@
1
+ export { default as getOpenInteractionType } from "./getOpenInteractionType.js";
2
+ export { default as isEmpty } from "./isEmpty.js";
3
+ export { default as areEqualValues } from "./areEqualValues.js";
4
+ export { useSelectFocusSource, SelectFocusSourceProvider } from "./SelectFocusSourceContext.js";