material-plus-ui 0.0.1 → 1.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 (341) hide show
  1. package/README.md +39 -28
  2. package/dist/components/accordion/MPAccordion.d.ts +115 -0
  3. package/dist/components/accordion/MPAccordion.js +1 -0
  4. package/dist/components/accordion/index.d.ts +2 -0
  5. package/dist/components/accordion/index.js +1 -0
  6. package/dist/components/alert/MPAlert.d.ts +91 -0
  7. package/dist/components/alert/MPAlert.js +1 -0
  8. package/dist/components/alert/index.d.ts +2 -0
  9. package/dist/components/alert/index.js +1 -0
  10. package/dist/components/animate-appear/MPAnimateAppear.d.ts +56 -0
  11. package/dist/components/animate-appear/MPAnimateAppear.js +1 -0
  12. package/dist/components/animate-appear/index.d.ts +2 -0
  13. package/dist/components/animate-appear/index.js +1 -0
  14. package/dist/components/animate-blink/MPAnimateBlink.d.ts +41 -0
  15. package/dist/components/animate-blink/MPAnimateBlink.js +1 -0
  16. package/dist/components/animate-blink/index.d.ts +2 -0
  17. package/dist/components/animate-blink/index.js +1 -0
  18. package/dist/components/animate-fade/MPAnimateFade.d.ts +38 -0
  19. package/dist/components/animate-fade/MPAnimateFade.js +1 -0
  20. package/dist/components/animate-fade/index.d.ts +2 -0
  21. package/dist/components/animate-fade/index.js +1 -0
  22. package/dist/components/animate-grow/MPAnimateGrow.d.ts +52 -0
  23. package/dist/components/animate-grow/MPAnimateGrow.js +1 -0
  24. package/dist/components/animate-grow/index.d.ts +2 -0
  25. package/dist/components/animate-grow/index.js +1 -0
  26. package/dist/components/animate-headline/MPAnimateHeadline.d.ts +63 -0
  27. package/dist/components/animate-headline/MPAnimateHeadline.js +1 -0
  28. package/dist/components/animate-headline/index.d.ts +2 -0
  29. package/dist/components/animate-headline/index.js +1 -0
  30. package/dist/components/animate-lighting/MPAnimateLighting.d.ts +68 -0
  31. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
  32. package/dist/components/animate-lighting/index.d.ts +2 -0
  33. package/dist/components/animate-lighting/index.js +1 -0
  34. package/dist/components/animate-marquee/MPAnimateMarquee.d.ts +66 -0
  35. package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -0
  36. package/dist/components/animate-marquee/index.d.ts +2 -0
  37. package/dist/components/animate-marquee/index.js +1 -0
  38. package/dist/components/animate-rotate/MPAnimateRotate.d.ts +56 -0
  39. package/dist/components/animate-rotate/MPAnimateRotate.js +1 -0
  40. package/dist/components/animate-rotate/index.d.ts +2 -0
  41. package/dist/components/animate-rotate/index.js +1 -0
  42. package/dist/components/animate-slide/MPAnimateSlide.d.ts +53 -0
  43. package/dist/components/animate-slide/MPAnimateSlide.js +1 -0
  44. package/dist/components/animate-slide/index.d.ts +2 -0
  45. package/dist/components/animate-slide/index.js +1 -0
  46. package/dist/components/animate-typing/MPAnimateTyping.d.ts +59 -0
  47. package/dist/components/animate-typing/MPAnimateTyping.js +1 -0
  48. package/dist/components/animate-typing/index.d.ts +2 -0
  49. package/dist/components/animate-typing/index.js +1 -0
  50. package/dist/components/animate-zoom/MPAnimateZoom.d.ts +44 -0
  51. package/dist/components/animate-zoom/MPAnimateZoom.js +1 -0
  52. package/dist/components/animate-zoom/index.d.ts +2 -0
  53. package/dist/components/animate-zoom/index.js +1 -0
  54. package/dist/components/aspect-ratio/MPAspectRatio.d.ts +69 -0
  55. package/dist/components/aspect-ratio/MPAspectRatio.js +1 -0
  56. package/dist/components/aspect-ratio/index.d.ts +2 -0
  57. package/dist/components/aspect-ratio/index.js +1 -0
  58. package/dist/components/avatar/MPAvatar.d.ts +104 -0
  59. package/dist/components/avatar/MPAvatar.js +1 -0
  60. package/dist/components/avatar/index.d.ts +2 -0
  61. package/dist/components/avatar/index.js +1 -0
  62. package/dist/components/badge/MPBadge.d.ts +104 -0
  63. package/dist/components/badge/MPBadge.js +1 -0
  64. package/dist/components/badge/index.d.ts +2 -0
  65. package/dist/components/badge/index.js +1 -0
  66. package/dist/components/blockquote/MPBlockquote.d.ts +73 -0
  67. package/dist/components/blockquote/MPBlockquote.js +1 -0
  68. package/dist/components/blockquote/index.d.ts +2 -0
  69. package/dist/components/blockquote/index.js +1 -0
  70. package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +144 -0
  71. package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -0
  72. package/dist/components/bottom-navigation/index.d.ts +2 -0
  73. package/dist/components/bottom-navigation/index.js +1 -0
  74. package/dist/components/box/MPBox.d.ts +78 -0
  75. package/dist/components/box/MPBox.js +1 -0
  76. package/dist/components/box/index.d.ts +2 -0
  77. package/dist/components/box/index.js +1 -0
  78. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +127 -0
  79. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -0
  80. package/dist/components/breadcrumb/index.d.ts +2 -0
  81. package/dist/components/breadcrumb/index.js +1 -0
  82. package/dist/components/button/MPButton.d.ts +75 -0
  83. package/dist/components/button/MPButton.js +1 -0
  84. package/dist/components/button/index.d.ts +2 -0
  85. package/dist/components/button/index.js +1 -0
  86. package/dist/components/button-group/MPButtonGroup.d.ts +31 -0
  87. package/dist/components/button-group/MPButtonGroup.js +1 -0
  88. package/dist/components/button-group/index.d.ts +2 -0
  89. package/dist/components/button-group/index.js +1 -0
  90. package/dist/components/card/MPCard.d.ts +73 -0
  91. package/dist/components/card/MPCard.js +1 -0
  92. package/dist/components/card/index.d.ts +2 -0
  93. package/dist/components/card/index.js +1 -0
  94. package/dist/components/carousel/MPCarousel.d.ts +116 -0
  95. package/dist/components/carousel/MPCarousel.js +1 -0
  96. package/dist/components/carousel/index.d.ts +2 -0
  97. package/dist/components/carousel/index.js +1 -0
  98. package/dist/components/chat-bubble/MPChatBubble.d.ts +132 -0
  99. package/dist/components/chat-bubble/MPChatBubble.js +1 -0
  100. package/dist/components/chat-bubble/index.d.ts +2 -0
  101. package/dist/components/chat-bubble/index.js +1 -0
  102. package/dist/components/checkbox/MPCheckbox.d.ts +76 -0
  103. package/dist/components/checkbox/MPCheckbox.js +1 -0
  104. package/dist/components/checkbox/index.d.ts +2 -0
  105. package/dist/components/checkbox/index.js +1 -0
  106. package/dist/components/chip/MPChip.d.ts +74 -0
  107. package/dist/components/chip/MPChip.js +1 -0
  108. package/dist/components/chip/index.d.ts +2 -0
  109. package/dist/components/chip/index.js +1 -0
  110. package/dist/components/collapsible/MPCollapsible.d.ts +97 -0
  111. package/dist/components/collapsible/MPCollapsible.js +1 -0
  112. package/dist/components/collapsible/index.d.ts +2 -0
  113. package/dist/components/collapsible/index.js +1 -0
  114. package/dist/components/color-picker/MPColorPicker.d.ts +131 -0
  115. package/dist/components/color-picker/MPColorPicker.js +1 -0
  116. package/dist/components/color-picker/index.d.ts +2 -0
  117. package/dist/components/color-picker/index.js +1 -0
  118. package/dist/components/combobox/MPCombobox.d.ts +175 -0
  119. package/dist/components/combobox/MPCombobox.js +1 -0
  120. package/dist/components/combobox/index.d.ts +2 -0
  121. package/dist/components/combobox/index.js +1 -0
  122. package/dist/components/container/MPContainer.d.ts +75 -0
  123. package/dist/components/container/MPContainer.js +1 -0
  124. package/dist/components/container/index.d.ts +2 -0
  125. package/dist/components/container/index.js +1 -0
  126. package/dist/components/date-picker/MPDatePicker.d.ts +98 -0
  127. package/dist/components/date-picker/MPDatePicker.js +1 -0
  128. package/dist/components/date-picker/index.d.ts +2 -0
  129. package/dist/components/date-picker/index.js +1 -0
  130. package/dist/components/date-range-picker/MPDateRangePicker.d.ts +98 -0
  131. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -0
  132. package/dist/components/date-range-picker/index.d.ts +2 -0
  133. package/dist/components/date-range-picker/index.js +1 -0
  134. package/dist/components/date-time-picker/MPDateTimePicker.d.ts +78 -0
  135. package/dist/components/date-time-picker/MPDateTimePicker.js +1 -0
  136. package/dist/components/date-time-picker/index.d.ts +2 -0
  137. package/dist/components/date-time-picker/index.js +1 -0
  138. package/dist/components/dialog/MPDialog.d.ts +150 -0
  139. package/dist/components/dialog/MPDialog.js +1 -0
  140. package/dist/components/dialog/index.d.ts +2 -0
  141. package/dist/components/dialog/index.js +1 -0
  142. package/dist/components/divider/MPDivider.d.ts +80 -0
  143. package/dist/components/divider/MPDivider.js +1 -0
  144. package/dist/components/divider/index.d.ts +2 -0
  145. package/dist/components/divider/index.js +1 -0
  146. package/dist/components/drawer/MPDrawer.d.ts +168 -0
  147. package/dist/components/drawer/MPDrawer.js +1 -0
  148. package/dist/components/drawer/index.d.ts +2 -0
  149. package/dist/components/drawer/index.js +1 -0
  150. package/dist/components/empty/MPEmpty.d.ts +74 -0
  151. package/dist/components/empty/MPEmpty.js +1 -0
  152. package/dist/components/empty/index.d.ts +2 -0
  153. package/dist/components/empty/index.js +1 -0
  154. package/dist/components/file-picker/MPFilePicker.d.ts +113 -0
  155. package/dist/components/file-picker/MPFilePicker.js +1 -0
  156. package/dist/components/file-picker/index.d.ts +2 -0
  157. package/dist/components/file-picker/index.js +1 -0
  158. package/dist/components/floating-action-button/MPFloatingActionButton.d.ts +126 -0
  159. package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -0
  160. package/dist/components/floating-action-button/index.d.ts +2 -0
  161. package/dist/components/floating-action-button/index.js +1 -0
  162. package/dist/components/grid/MPGrid.d.ts +155 -0
  163. package/dist/components/grid/MPGrid.js +1 -0
  164. package/dist/components/grid/index.d.ts +2 -0
  165. package/dist/components/grid/index.js +1 -0
  166. package/dist/components/highlight/MPHighlight.d.ts +95 -0
  167. package/dist/components/highlight/MPHighlight.js +1 -0
  168. package/dist/components/highlight/index.d.ts +2 -0
  169. package/dist/components/highlight/index.js +1 -0
  170. package/dist/components/icon-button/MPIconButton.d.ts +59 -0
  171. package/dist/components/icon-button/MPIconButton.js +1 -0
  172. package/dist/components/icon-button/index.d.ts +2 -0
  173. package/dist/components/icon-button/index.js +1 -0
  174. package/dist/components/list/MPList.d.ts +96 -0
  175. package/dist/components/list/MPList.js +1 -0
  176. package/dist/components/list/index.d.ts +2 -0
  177. package/dist/components/list/index.js +1 -0
  178. package/dist/components/locale/MPLocaleProvider.d.ts +63 -0
  179. package/dist/components/locale/MPLocaleProvider.js +1 -0
  180. package/dist/components/locale/index.d.ts +2 -0
  181. package/dist/components/locale/index.js +1 -0
  182. package/dist/components/menu/MPMenu.d.ts +232 -0
  183. package/dist/components/menu/MPMenu.js +1 -0
  184. package/dist/components/menu/index.d.ts +2 -0
  185. package/dist/components/menu/index.js +1 -0
  186. package/dist/components/number-field/MPNumberField.d.ts +117 -0
  187. package/dist/components/number-field/MPNumberField.js +1 -0
  188. package/dist/components/number-field/index.d.ts +2 -0
  189. package/dist/components/number-field/index.js +1 -0
  190. package/dist/components/otp-field/MPOtpField.d.ts +89 -0
  191. package/dist/components/otp-field/MPOtpField.js +1 -0
  192. package/dist/components/otp-field/index.d.ts +2 -0
  193. package/dist/components/otp-field/index.js +1 -0
  194. package/dist/components/overlay/MPOverlay.d.ts +96 -0
  195. package/dist/components/overlay/MPOverlay.js +1 -0
  196. package/dist/components/overlay/index.d.ts +2 -0
  197. package/dist/components/overlay/index.js +1 -0
  198. package/dist/components/pagination/MPPagination.d.ts +106 -0
  199. package/dist/components/pagination/MPPagination.js +1 -0
  200. package/dist/components/pagination/index.d.ts +2 -0
  201. package/dist/components/pagination/index.js +1 -0
  202. package/dist/components/panes/MPPanes.d.ts +100 -0
  203. package/dist/components/panes/MPPanes.js +1 -0
  204. package/dist/components/panes/index.d.ts +2 -0
  205. package/dist/components/panes/index.js +1 -0
  206. package/dist/components/pill/MPPill.d.ts +117 -0
  207. package/dist/components/pill/MPPill.js +1 -0
  208. package/dist/components/pill/index.d.ts +2 -0
  209. package/dist/components/pill/index.js +1 -0
  210. package/dist/components/popover/MPPopover.d.ts +143 -0
  211. package/dist/components/popover/MPPopover.js +1 -0
  212. package/dist/components/popover/index.d.ts +2 -0
  213. package/dist/components/popover/index.js +1 -0
  214. package/dist/components/progress-box/MPProgressBox.d.ts +40 -0
  215. package/dist/components/progress-box/MPProgressBox.js +1 -0
  216. package/dist/components/progress-box/index.d.ts +2 -0
  217. package/dist/components/progress-box/index.js +1 -0
  218. package/dist/components/progress-circular/MPProgressCircular.d.ts +32 -0
  219. package/dist/components/progress-circular/MPProgressCircular.js +1 -0
  220. package/dist/components/progress-circular/index.d.ts +2 -0
  221. package/dist/components/progress-circular/index.js +1 -0
  222. package/dist/components/progress-linear/MPProgressLinear.d.ts +32 -0
  223. package/dist/components/progress-linear/MPProgressLinear.js +1 -0
  224. package/dist/components/progress-linear/index.d.ts +2 -0
  225. package/dist/components/progress-linear/index.js +1 -0
  226. package/dist/components/radio-group/MPRadioGroup.d.ts +81 -0
  227. package/dist/components/radio-group/MPRadioGroup.js +1 -0
  228. package/dist/components/radio-group/index.d.ts +2 -0
  229. package/dist/components/radio-group/index.js +1 -0
  230. package/dist/components/rating/MPRating.d.ts +135 -0
  231. package/dist/components/rating/MPRating.js +1 -0
  232. package/dist/components/rating/index.d.ts +2 -0
  233. package/dist/components/rating/index.js +1 -0
  234. package/dist/components/segmented-button/MPSegmentedButton.d.ts +75 -0
  235. package/dist/components/segmented-button/MPSegmentedButton.js +1 -0
  236. package/dist/components/segmented-button/index.d.ts +2 -0
  237. package/dist/components/segmented-button/index.js +1 -0
  238. package/dist/components/select/MPSelect.d.ts +103 -0
  239. package/dist/components/select/MPSelect.js +1 -0
  240. package/dist/components/select/index.d.ts +2 -0
  241. package/dist/components/select/index.js +1 -0
  242. package/dist/components/shortcut/MPShortcut.d.ts +67 -0
  243. package/dist/components/shortcut/MPShortcut.js +1 -0
  244. package/dist/components/shortcut/index.d.ts +2 -0
  245. package/dist/components/shortcut/index.js +1 -0
  246. package/dist/components/skeleton/MPSkeleton.d.ts +76 -0
  247. package/dist/components/skeleton/MPSkeleton.js +1 -0
  248. package/dist/components/skeleton/index.d.ts +2 -0
  249. package/dist/components/skeleton/index.js +1 -0
  250. package/dist/components/slider/MPSlider.d.ts +77 -0
  251. package/dist/components/slider/MPSlider.js +1 -0
  252. package/dist/components/slider/index.d.ts +2 -0
  253. package/dist/components/slider/index.js +1 -0
  254. package/dist/components/snackbar/MPSnackbar.d.ts +175 -0
  255. package/dist/components/snackbar/MPSnackbar.js +1 -0
  256. package/dist/components/snackbar/index.d.ts +2 -0
  257. package/dist/components/snackbar/index.js +1 -0
  258. package/dist/components/spoiler/MPSpoiler.d.ts +106 -0
  259. package/dist/components/spoiler/MPSpoiler.js +1 -0
  260. package/dist/components/spoiler/index.d.ts +2 -0
  261. package/dist/components/spoiler/index.js +1 -0
  262. package/dist/components/switch/MPSwitch.d.ts +75 -0
  263. package/dist/components/switch/MPSwitch.js +1 -0
  264. package/dist/components/switch/index.d.ts +2 -0
  265. package/dist/components/switch/index.js +1 -0
  266. package/dist/components/table/MPTable.d.ts +120 -0
  267. package/dist/components/table/MPTable.js +1 -0
  268. package/dist/components/table/index.d.ts +2 -0
  269. package/dist/components/table/index.js +1 -0
  270. package/dist/components/tabs/MPTabs.d.ts +145 -0
  271. package/dist/components/tabs/MPTabs.js +1 -0
  272. package/dist/components/tabs/index.d.ts +2 -0
  273. package/dist/components/tabs/index.js +1 -0
  274. package/dist/components/text-field/MPTextField.d.ts +51 -22
  275. package/dist/components/text-field/MPTextField.js +1 -1
  276. package/dist/components/text-link/MPTextLink.d.ts +88 -0
  277. package/dist/components/text-link/MPTextLink.js +1 -0
  278. package/dist/components/text-link/index.d.ts +2 -0
  279. package/dist/components/text-link/index.js +1 -0
  280. package/dist/components/time-picker/MPTimePicker.d.ts +108 -0
  281. package/dist/components/time-picker/MPTimePicker.js +1 -0
  282. package/dist/components/time-picker/index.d.ts +2 -0
  283. package/dist/components/time-picker/index.js +1 -0
  284. package/dist/components/timeline/MPTimeline.d.ts +96 -0
  285. package/dist/components/timeline/MPTimeline.js +1 -0
  286. package/dist/components/timeline/index.d.ts +2 -0
  287. package/dist/components/timeline/index.js +1 -0
  288. package/dist/components/tooltip/MPTooltip.d.ts +117 -0
  289. package/dist/components/tooltip/MPTooltip.js +1 -0
  290. package/dist/components/tooltip/index.d.ts +2 -0
  291. package/dist/components/tooltip/index.js +1 -0
  292. package/dist/components/typography/MPTypography.d.ts +94 -0
  293. package/dist/components/typography/MPTypography.js +1 -0
  294. package/dist/components/typography/index.d.ts +2 -0
  295. package/dist/components/typography/index.js +1 -0
  296. package/dist/constants/icons.d.ts +49 -0
  297. package/dist/constants/icons.js +1 -1
  298. package/dist/index.d.ts +73 -0
  299. package/dist/index.js +1 -1
  300. package/dist/internal/Calendar.d.ts +118 -0
  301. package/dist/internal/Calendar.js +1 -0
  302. package/dist/internal/FieldOutline.d.ts +109 -0
  303. package/dist/internal/FieldOutline.js +1 -0
  304. package/dist/internal/Picker.d.ts +153 -0
  305. package/dist/internal/Picker.js +1 -0
  306. package/dist/internal/StateLayer.d.ts +45 -0
  307. package/dist/internal/StateLayer.js +1 -0
  308. package/dist/internal/SupportingText.d.ts +23 -0
  309. package/dist/internal/SupportingText.js +1 -0
  310. package/dist/internal/WidthSizer.d.ts +31 -0
  311. package/dist/internal/WidthSizer.js +1 -0
  312. package/dist/internal/accent.d.ts +39 -0
  313. package/dist/internal/accent.js +1 -0
  314. package/dist/internal/animate.d.ts +179 -0
  315. package/dist/internal/animate.js +1 -0
  316. package/dist/internal/button-group.d.ts +21 -0
  317. package/dist/internal/button-group.js +1 -0
  318. package/dist/internal/color.d.ts +125 -0
  319. package/dist/internal/color.js +1 -0
  320. package/dist/internal/date.d.ts +179 -0
  321. package/dist/internal/date.js +1 -0
  322. package/dist/internal/i18n.d.ts +241 -0
  323. package/dist/internal/i18n.js +1 -0
  324. package/dist/internal/inert.d.ts +11 -0
  325. package/dist/internal/inert.js +1 -0
  326. package/dist/internal/locale.d.ts +43 -0
  327. package/dist/internal/locale.js +1 -0
  328. package/dist/internal/menu.d.ts +23 -0
  329. package/dist/internal/menu.js +1 -0
  330. package/dist/internal/progress.d.ts +126 -0
  331. package/dist/internal/progress.js +1 -0
  332. package/dist/internal/scale.d.ts +127 -0
  333. package/dist/internal/scale.js +1 -0
  334. package/dist/internal/surface.d.ts +76 -0
  335. package/dist/internal/surface.js +1 -0
  336. package/dist/internal/visually-hidden.d.ts +23 -0
  337. package/dist/internal/visually-hidden.js +1 -0
  338. package/dist/styles.css +1 -1
  339. package/dist/tailwind.css +1871 -20
  340. package/dist/types.d.ts +262 -16
  341. package/package.json +16 -21
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import { useMPLocale } from '../../internal/locale';
3
+ export interface MPLocaleProviderProps {
4
+ /**
5
+ * A BCP 47 tag — `ko`, `ja`, `pt-BR`, `zh-Hant`.
6
+ *
7
+ * It reaches two different systems and they degrade differently, which is
8
+ * worth knowing before choosing one:
9
+ *
10
+ * - **`Intl` formats the dates and the numbers**, and speaks every language
11
+ * the platform does. A tag with no entry in this library's own table still
12
+ * gets month names, weekday names, AM/PM and the right date order.
13
+ * - **This library's table supplies the words `Intl` has no opinion about** —
14
+ * "Previous month", "Today", "Hour". Those fall back to English for a tag it
15
+ * does not carry, and a `labels` prop on the component fills the gap.
16
+ *
17
+ * Left `undefined` the platform's own default is used for the first and
18
+ * English for the second, which is exactly what a component with no provider
19
+ * over it does.
20
+ */
21
+ locale?: string;
22
+ children?: React.ReactNode;
23
+ }
24
+ /**
25
+ * The language the components speak, set once for everything under it.
26
+ *
27
+ * Wrap the application. Every component in this library that writes a word or
28
+ * formats a date takes a `locale` prop of its own, and this is where that prop
29
+ * gets its default — so a form of four pickers is one decision rather than four.
30
+ *
31
+ * ```tsx
32
+ * <MPLocaleProvider locale="ko">
33
+ * <App />
34
+ * </MPLocaleProvider>
35
+ * ```
36
+ *
37
+ * ## Why it is not a whole theme object
38
+ *
39
+ * Everything else a provider might carry here is already a CSS custom property:
40
+ * the colour roles, the type scale, the corners, the motion durations. Those
41
+ * reach a component through the cascade, which means a section of a page can
42
+ * differ from the rest of it without a second provider and without a re-render.
43
+ * A locale cannot travel that way — it decides which *string* is rendered, not
44
+ * how one is painted — so it is the one thing left that needs context, and this
45
+ * provider carries that and nothing else.
46
+ *
47
+ * ## Nesting
48
+ *
49
+ * Providers nest, and the nearest one wins. A page in Korean with one section
50
+ * showing a Japanese listing's dates is two providers, and the inner one does
51
+ * not have to restate anything: there is only the one value.
52
+ */
53
+ export declare function MPLocaleProvider({ locale, children }: MPLocaleProviderProps): React.JSX.Element;
54
+ /**
55
+ * The locale in force at this point in the tree.
56
+ *
57
+ * Exported because an application that has told this library its language should
58
+ * not have to tell itself the same thing twice — the same tag is what its own
59
+ * `Intl.NumberFormat` calls want. Passing an argument makes it the
60
+ * prop-beats-provider resolution the components themselves use, which is what a
61
+ * wrapper component around one of them wants.
62
+ */
63
+ export { useMPLocale };
@@ -0,0 +1 @@
1
+ import{jsx as r}from"react/jsx-runtime";import{MPLocaleContext as e,useMPLocale as o}from"../../internal/locale";export function MPLocaleProvider({locale:o,children:i}){return r(e.Provider,{value:o,children:i})}export{o as useMPLocale};
@@ -0,0 +1,2 @@
1
+ export { MPLocaleProvider, useMPLocale } from './MPLocaleProvider';
2
+ export type { MPLocaleProviderProps } from './MPLocaleProvider';
@@ -0,0 +1 @@
1
+ export{MPLocaleProvider,useMPLocale}from"./MPLocaleProvider";
@@ -0,0 +1,232 @@
1
+ import * as React from 'react';
2
+ import type { MPAlign, MPColor, MPSide, MPSize } from '../../types';
3
+ /**
4
+ * A menu takes `size` and `color` and stops there.
5
+ *
6
+ * There is no `variant`, for the reason `MPDialog` has none: the five weights
7
+ * answer "how much of a surface does this paint", and a popup that has taken the
8
+ * pointer has already answered it. There is no `elevation` either — MD3 puts a
9
+ * menu at level 2 and nowhere else, and a menu that could be told to sit flat
10
+ * would be a list.
11
+ */
12
+ interface MPMenuSurfaceProps {
13
+ /**
14
+ * The row height and type scale.
15
+ * @default 'md'
16
+ */
17
+ size?: MPSize;
18
+ /**
19
+ * Which accent family a ticked or chosen row reads. The popup itself stays
20
+ * neutral, as MD3's does.
21
+ * @default 'primary'
22
+ */
23
+ color?: MPColor;
24
+ className?: string;
25
+ style?: React.CSSProperties;
26
+ }
27
+ export interface MPMenuProps extends MPMenuSurfaceProps {
28
+ /**
29
+ * The element that opens the menu, wired up by Base UI. Optional — a controlled
30
+ * menu opened from elsewhere needs no trigger of its own.
31
+ */
32
+ trigger?: React.ReactElement;
33
+ /** Whether the menu is open. Use with `onOpenChange` for a controlled menu. */
34
+ open?: boolean;
35
+ /** Whether it starts open, for an uncontrolled one. */
36
+ defaultOpen?: boolean;
37
+ onOpenChange?: (open: boolean) => void;
38
+ /** Which edge of the trigger it hangs off. @default 'bottom' */
39
+ side?: MPSide;
40
+ /** Where it sits along that edge. @default 'start' */
41
+ align?: MPAlign;
42
+ /** Distance from the trigger, in pixels. @default 4 */
43
+ sideOffset?: number;
44
+ /** Whether the page behind is taken away while the menu is open. @default true */
45
+ modal?: boolean;
46
+ /**
47
+ * Opens on hover as well as on click. For a menu bar, where crossing the row
48
+ * with one menu open should walk through the others rather than close them.
49
+ * @default false
50
+ */
51
+ openOnHover?: boolean;
52
+ /** Whether the arrow keys wrap from the last row back to the first. @default true */
53
+ loopFocus?: boolean;
54
+ /** Unavailable. The trigger stops opening anything. */
55
+ disabled?: boolean;
56
+ /** The rows. */
57
+ children?: React.ReactNode;
58
+ }
59
+ export interface MPContextMenuProps extends MPMenuSurfaceProps {
60
+ /** The rows, exactly as they are written inside an `MPMenu`. */
61
+ content: React.ReactNode;
62
+ /**
63
+ * The area that answers a right-click or a long press. Rendered inside a
64
+ * `<div>` of Base UI's, which is what listens for the gesture.
65
+ */
66
+ children: React.ReactNode;
67
+ open?: boolean;
68
+ defaultOpen?: boolean;
69
+ onOpenChange?: (open: boolean) => void;
70
+ /** @default true */
71
+ loopFocus?: boolean;
72
+ disabled?: boolean;
73
+ }
74
+ export interface MPMenuItemProps {
75
+ /** What the row does. Not given, and not a link, the row is a label. */
76
+ onClick?: (event: React.MouseEvent<HTMLElement>) => void;
77
+ /** Renders the row as a real `<a>`. A menu of links has to be links. */
78
+ href?: string;
79
+ /** Where the link opens — `_blank` and the rest. Ignored without `href`. */
80
+ target?: string;
81
+ /**
82
+ * The link's relationship to the page. Ignored without `href`.
83
+ *
84
+ * Left unset, a `target="_blank"` row gets `noopener noreferrer` — the pair
85
+ * that stops the opened page reaching back through `window.opener`. Setting
86
+ * it replaces that rather than adding to it, so a row that needs `nofollow`
87
+ * should say `rel="noopener noreferrer nofollow"`.
88
+ */
89
+ rel?: string;
90
+ /** Content before the label — an icon, a swatch, an avatar. */
91
+ startIcon?: React.ReactNode;
92
+ /** Content after the label, before any `shortcut`. */
93
+ endIcon?: React.ReactNode;
94
+ /**
95
+ * The keystroke that does the same thing, set at the end of the row and muted.
96
+ * Text only — the row does not bind it, the application does.
97
+ */
98
+ shortcut?: React.ReactNode;
99
+ /** A second line under the label, one step down the type scale and muted. */
100
+ description?: React.ReactNode;
101
+ /**
102
+ * Re-points the row's family — `error` for the one that deletes. Defaults to
103
+ * the menu's own.
104
+ */
105
+ color?: MPColor;
106
+ /** Whether picking the row closes the menu. @default true */
107
+ closeOnClick?: boolean;
108
+ /** Unavailable. Still listed, and still found by typeahead. */
109
+ disabled?: boolean;
110
+ /** What typeahead matches against, when the label is not a plain string. */
111
+ label?: string;
112
+ /** The label. */
113
+ children?: React.ReactNode;
114
+ className?: string;
115
+ style?: React.CSSProperties;
116
+ }
117
+ export interface MPMenuSubmenuProps {
118
+ /** The label on the row that opens it. */
119
+ label?: React.ReactNode;
120
+ startIcon?: React.ReactNode;
121
+ disabled?: boolean;
122
+ /** Which edge of the parent row it opens against. @default 'right' */
123
+ side?: MPSide;
124
+ /** Distance from the parent menu, in pixels. @default 0 */
125
+ sideOffset?: number;
126
+ /** The nested rows. */
127
+ children?: React.ReactNode;
128
+ className?: string;
129
+ style?: React.CSSProperties;
130
+ }
131
+ export interface MPMenuGroupProps {
132
+ /** The heading over the group. Wired to it by Base UI. */
133
+ label?: React.ReactNode;
134
+ children?: React.ReactNode;
135
+ className?: string;
136
+ }
137
+ export interface MPMenuCheckboxItemProps extends Omit<MPMenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
138
+ checked?: boolean;
139
+ defaultChecked?: boolean;
140
+ onCheckedChange?: (checked: boolean) => void;
141
+ /**
142
+ * Whether ticking the row closes the menu. `false` here rather than the `true`
143
+ * a plain row takes: a list of things to tick is a list you tick more than one
144
+ * of.
145
+ * @default false
146
+ */
147
+ closeOnClick?: boolean;
148
+ }
149
+ export interface MPMenuRadioGroupProps {
150
+ value?: string | number;
151
+ defaultValue?: string | number;
152
+ onValueChange?: (value: string | number) => void;
153
+ disabled?: boolean;
154
+ children?: React.ReactNode;
155
+ className?: string;
156
+ }
157
+ export interface MPMenuRadioItemProps extends Omit<MPMenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
158
+ /** What this row sets the group to. */
159
+ value: string | number;
160
+ /** @default false */
161
+ closeOnClick?: boolean;
162
+ }
163
+ export type MPMenuSeparatorProps = React.ComponentPropsWithoutRef<'div'>;
164
+ /**
165
+ * One row of a menu.
166
+ *
167
+ * Renders a real `<a>` when it is given an `href` and Base UI's own item
168
+ * otherwise. A menu of links that are not links cannot be opened in a new tab,
169
+ * cannot be copied, and tells a screen reader the wrong thing about every one of
170
+ * them.
171
+ */
172
+ export declare function MPMenuItem({ onClick, href, target, rel, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuItemProps): React.JSX.Element;
173
+ /** A row that ticks. The tick lands in the column a `startIcon` would. */
174
+ export declare function MPMenuCheckboxItem({ checked, defaultChecked, onCheckedChange, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuCheckboxItemProps): React.JSX.Element;
175
+ /** One choice out of a set. Wraps the rows that make up the set. */
176
+ export declare function MPMenuRadioGroup({ value, defaultValue, onValueChange, disabled, children, className }: MPMenuRadioGroupProps): React.JSX.Element;
177
+ /**
178
+ * A row inside an `MPMenuRadioGroup`.
179
+ *
180
+ * Marked with a filled dot rather than a tick, which is the same distinction
181
+ * `MPCheckbox` and `MPRadio` make everywhere else: a tick says "and", a dot says
182
+ * "instead of".
183
+ */
184
+ export declare function MPMenuRadioItem({ value, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuRadioItemProps): React.JSX.Element;
185
+ /** A named run of rows. The label is a heading, not a row — it cannot be picked. */
186
+ export declare function MPMenuGroup({ label, children, className }: MPMenuGroupProps): React.JSX.Element;
187
+ /** The hairline between two runs of rows. `outline-variant`, as MD3 draws it. */
188
+ export declare function MPMenuSeparator({ className, ...props }: MPMenuSeparatorProps): React.JSX.Element;
189
+ /**
190
+ * A menu inside a menu.
191
+ *
192
+ * The row that opens it is the same row every other item is, wearing a chevron —
193
+ * and it opens on hover, on Enter and on the arrow key that points at it, all of
194
+ * which is Base UI's. What is here is the surface and the glyph.
195
+ *
196
+ * Nesting is unlimited: a submenu renders its children inside a popup that is
197
+ * itself a menu, so a submenu of a submenu needs no different component.
198
+ */
199
+ export declare function MPMenuSubmenu({ label, startIcon, disabled, side, sideOffset, children, className, style }: MPMenuSubmenuProps): React.JSX.Element;
200
+ /**
201
+ * A list of actions that appears when something is pressed.
202
+ *
203
+ * Everything that makes a menu a menu rather than a floating list of divs is Base
204
+ * UI's: roving focus with the arrow keys, Home and End, typeahead, Escape,
205
+ * closing on an outside click, restoring focus to the trigger, submenus opening
206
+ * on hover with the safe triangle so a diagonal reach does not close them, and
207
+ * the `menu` / `menuitem` roles that make any of it mean something to a screen
208
+ * reader. What is here is the surface, the ladders and the row layout.
209
+ *
210
+ * ## Why the rows are composed and a select's options are data
211
+ *
212
+ * The opposite of `MPSelect`, and deliberately. A select's options are values out
213
+ * of a list a caller already has, and its trigger has to be able to name the
214
+ * chosen one before the popup has ever been mounted. A menu's rows are *code* —
215
+ * each one a different handler, a different icon, sometimes a submenu — and
216
+ * nothing has to know about them until the menu opens. Data would mean an `items`
217
+ * type with a variant for every shape a row can take, which is a component tree
218
+ * spelled as a discriminated union.
219
+ */
220
+ export declare function MPMenu({ size, color, trigger, open, defaultOpen, onOpenChange, side, align, sideOffset, modal, openOnHover, loopFocus, disabled, className, style, children }: MPMenuProps): React.JSX.Element;
221
+ /**
222
+ * The same menu, opened by a right-click or a long press instead of by a button.
223
+ *
224
+ * It takes the rows as `content` and the area as `children`, which is
225
+ * `MPTooltip`'s shape rather than `MPMenu`'s — because here the trigger is not
226
+ * one element handed over, it is a region of the page, and the region is the
227
+ * thing being wrapped. Base UI positions the popup at the pointer rather than
228
+ * against an anchor, and the long press is what makes it reachable on a touch
229
+ * screen at all.
230
+ */
231
+ export declare function MPContextMenu({ size, color, content, children, open, defaultOpen, onOpenChange, loopFocus, disabled, className, style }: MPContextMenuProps): React.JSX.Element;
232
+ export {};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as l}from"@base-ui/react/context-menu";import{MPIcon as r}from"../icon/MPIcon";import{CheckIcon as o,ChevronRightIcon as s}from"../../constants/icons";import{MPMenuContext as i}from"../../internal/menu";import{accentSlots as c}from"../../internal/accent";import{MPStateLayer as d}from"../../internal/StateLayer";import{CONTROL_ICON as m,META_TEXT as u,hasContent as p}from"../../internal/scale";import{FADE as h,PORTAL_LAYER as f}from"../../internal/surface";const x=["mp-menu__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container text-mp-on-surface","max-h-[min(24rem,var(--available-height))] min-w-[112px] max-w-[280px]","overflow-y-auto overscroll-contain py-2 outline-none",h].join(" "),b={xs:"min-h-8",sm:"min-h-10",md:"min-h-12",lg:"min-h-14",xl:"min-h-16"},g={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},N={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3",xl:"gap-4"},v={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};function C(e,n,t){return["group relative flex w-full cursor-pointer items-center select-none",n?"text-(--_mp-accent)":"text-mp-on-surface",b[e],g[e],N[e],v[e],"data-disabled:text-mp-on-surface/38 data-disabled:cursor-default","outline-none",t??""].filter(Boolean).join(" ")}function y(){return e(d,{layer:"inset-0 bg-current",className:"group-data-highlighted:opacity-8 group-data-popup-open:opacity-8 group-data-disabled:opacity-0"})}const k="relative flex shrink-0 items-center justify-center";function M({children:t,description:a}){return p(a)?n("span",{className:"relative flex min-w-0 flex-1 flex-col py-1.5 text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`text-mp-on-surface-variant truncate ${u}`,children:a})]}):e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:t})}function O({shortcut:n}){return p(n)?e("span",{className:`text-mp-on-surface-variant relative ms-2 shrink-0 ${u}`,children:n}):null}export function MPMenuItem({onClick:l,href:r,target:o,rel:s,startIcon:c,endIcon:d,shortcut:m,description:u,color:h,closeOnClick:f=!0,disabled:x=!1,label:b,children:g,className:N,style:v}){const{size:P}=t.useContext(i),I=n(t.Fragment,{children:[e(y,{}),p(c)?e("span",{className:`${k} text-mp-on-surface-variant`,children:c}):null,e(M,{description:u,children:g}),p(d)?e("span",{className:`${k} text-mp-on-surface-variant`,children:d}):null,e(O,{shortcut:m})]}),$=h?{"--_mp-accent":`var(--_mp-color-${h})`}:void 0,z=$||v?{...$,...v}:void 0;return void 0===r||x?e(a.Item,{disabled:x,label:b,closeOnClick:f,onClick:l,className:C(P,Boolean(h),N),style:z,children:I}):e(a.LinkItem,{href:r,target:o,rel:s??("_blank"===o?"noopener noreferrer":void 0),label:b,closeOnClick:f,onClick:l,className:C(P,Boolean(h),N),style:z,children:I})}export function MPMenuCheckboxItem({checked:l,defaultChecked:s,onCheckedChange:c,endIcon:d,shortcut:u,description:h,color:f,closeOnClick:x=!1,disabled:b=!1,label:g,children:N,className:v,style:P}){const{size:I}=t.useContext(i),$=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:s,onCheckedChange:e=>c?.(e),disabled:b,label:g,closeOnClick:x,className:C(I,Boolean(f),v),style:$||P?{...$,...P}:void 0,children:[e(y,{}),e("span",{className:`${k} text-(--_mp-accent)`,style:{width:m[I]},children:e(a.CheckboxItemIndicator,{className:"flex items-center justify-center",children:e(r,{icon:o,size:m[I]})})}),e(M,{description:h,children:N}),p(d)?e("span",{className:`${k} text-mp-on-surface-variant`,children:d}):null,e(O,{shortcut:u})]})}export function MPMenuRadioGroup({value:n,defaultValue:t,onValueChange:l,disabled:r=!1,children:o,className:s}){return e(a.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>l?.(e),disabled:r,className:s,children:o})}export function MPMenuRadioItem({value:l,endIcon:r,shortcut:o,description:s,color:c,closeOnClick:d=!1,disabled:u=!1,label:h,children:f,className:x,style:b}){const{size:g}=t.useContext(i),N=c?{"--_mp-accent":`var(--_mp-color-${c})`}:void 0;return n(a.RadioItem,{value:l,disabled:u,label:h,closeOnClick:d,className:C(g,Boolean(c),x),style:N||b?{...N,...b}:void 0,children:[e(y,{}),e("span",{className:`${k} text-(--_mp-accent)`,style:{width:m[g]},children:e(a.RadioItemIndicator,{className:"flex items-center justify-center",children:e("span",{className:"block size-2.5 rounded-full bg-current"})})}),e(M,{description:s,children:f}),p(r)?e("span",{className:`${k} text-mp-on-surface-variant`,children:r}):null,e(O,{shortcut:o})]})}export function MPMenuGroup({label:l,children:r,className:o}){const{size:s}=t.useContext(i);return n(a.Group,{className:o,children:[p(l)?e(a.GroupLabel,{className:`text-mp-on-surface-variant pt-2 pb-1 ${g[s]} ${u}`,children:l}):null,r]})}export function MPMenuSeparator({className:n,...t}){return e(a.Separator,{className:["bg-mp-outline-variant my-2 h-px",n??""].filter(Boolean).join(" "),...t})}export function MPMenuSubmenu({label:l,startIcon:o,disabled:d=!1,side:u="right",sideOffset:h=0,children:b,className:g,style:N}){const{size:v,color:M}=t.useContext(i);return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:d,className:C(v,!1),children:[e(y,{}),p(o)?e("span",{className:`${k} text-mp-on-surface-variant`,children:o}):null,e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${k} text-mp-on-surface-variant rtl:rotate-180`,children:e(r,{icon:s,size:m[v]})})]}),e(a.Portal,{children:e(a.Positioner,{className:f,side:u,sideOffset:h,align:"start",children:e(a.Popup,{className:[x,g??""].filter(Boolean).join(" "),style:{...c(M),...N},children:b})})})]})}export function MPMenu({size:l="md",color:r="primary",trigger:o,open:s,defaultOpen:d,onOpenChange:m,side:u="bottom",align:p="start",sideOffset:h=4,modal:b=!0,openOnHover:g=!1,loopFocus:N=!0,disabled:v=!1,className:C,style:y,children:k}){const M=t.useMemo(()=>({size:l,color:r}),[l,r]);return e(i.Provider,{value:M,children:n(a.Root,{open:s,defaultOpen:d,onOpenChange:e=>m?.(e),modal:b,loopFocus:N,disabled:v,children:[o?e(a.Trigger,{render:o,openOnHover:g,disabled:v}):null,e(a.Portal,{children:e(a.Positioner,{className:f,side:u,align:p,sideOffset:h,children:e(a.Popup,{"data-mp-size":l,className:[x,C??""].filter(Boolean).join(" "),style:{...c(r),...y},children:k})})})]})})}export function MPContextMenu({size:a="md",color:r="primary",content:o,children:s,open:d,defaultOpen:m,onOpenChange:u,loopFocus:p=!0,disabled:h=!1,className:b,style:g}){const N=t.useMemo(()=>({size:a,color:r}),[a,r]);return e(i.Provider,{value:N,children:n(l.Root,{open:d,defaultOpen:m,onOpenChange:e=>u?.(e),loopFocus:p,disabled:h,children:[e(l.Trigger,{children:s}),e(l.Portal,{children:e(l.Positioner,{className:f,children:e(l.Popup,{"data-mp-size":a,className:[x,b??""].filter(Boolean).join(" "),style:{...c(r),...g},children:o})})})]})})}
@@ -0,0 +1,2 @@
1
+ export { MPContextMenu, MPMenu, MPMenuCheckboxItem, MPMenuGroup, MPMenuItem, MPMenuRadioGroup, MPMenuRadioItem, MPMenuSeparator, MPMenuSubmenu } from './MPMenu';
2
+ export type { MPContextMenuProps, MPMenuCheckboxItemProps, MPMenuGroupProps, MPMenuItemProps, MPMenuProps, MPMenuRadioGroupProps, MPMenuRadioItemProps, MPMenuSeparatorProps, MPMenuSubmenuProps } from './MPMenu';
@@ -0,0 +1 @@
1
+ export{MPContextMenu,MPMenu,MPMenuCheckboxItem,MPMenuGroup,MPMenuItem,MPMenuRadioGroup,MPMenuRadioItem,MPMenuSeparator,MPMenuSubmenu}from"./MPMenu";
@@ -0,0 +1,117 @@
1
+ import * as React from 'react';
2
+ import type { MPStyleProps } from '../../types';
3
+ /**
4
+ * Where the two steppers sit.
5
+ *
6
+ * - `end` — both at the trailing edge, the way a spinner has always looked.
7
+ * - `split` — minus at the start, plus at the end, with the number between them.
8
+ * For a quantity that is nudged rather than typed.
9
+ * - `none` — no buttons. It is still a number field: the arrow keys, the
10
+ * clamping and the formatting all stay.
11
+ *
12
+ * There is deliberately no stacked pair of half-height chevrons. At `xs` each
13
+ * arrow would be under three pixels tall, and a target that small is a target
14
+ * nobody hits.
15
+ */
16
+ export type MPNumberFieldSteppers = 'end' | 'split' | 'none';
17
+ export interface MPNumberFieldProps extends MPStyleProps {
18
+ /** The number. Use with `onValueChange` for a controlled field. */
19
+ value?: number | null;
20
+ /** The starting number, for an uncontrolled field. */
21
+ defaultValue?: number;
22
+ /** Called on every change — typing, stepping, the wheel. */
23
+ onValueChange?: (value: number | null) => void;
24
+ /**
25
+ * Called when the value settles: on blur after typing, on pointer release
26
+ * after a press, and together with `onValueChange` for the keyboard.
27
+ */
28
+ onValueCommitted?: (value: number | null) => void;
29
+ /** The bottom of the range. Stepping stops here. */
30
+ min?: number;
31
+ /** The top of the range. */
32
+ max?: number;
33
+ /** How far one step goes. @default 1 */
34
+ step?: number;
35
+ /** The step taken while Shift is held. @default 10 */
36
+ largeStep?: number;
37
+ /** The step taken while Alt is held. @default 0.1 */
38
+ smallStep?: number;
39
+ /**
40
+ * Whether the wheel changes the value while the field is focused and hovered.
41
+ * Off by default: a page that scrolls under the pointer and a field that
42
+ * changes under it are the same gesture, and only one of them was meant.
43
+ * @default false
44
+ */
45
+ allowWheelScrub?: boolean;
46
+ /**
47
+ * How the number is written — currency, percent, decimal places. Passed
48
+ * straight to `Intl.NumberFormat`, so the field can show `$1,240.00` and still
49
+ * report `1240`.
50
+ */
51
+ format?: Intl.NumberFormatOptions;
52
+ /** Which locale the number is written and parsed in. Defaults to the runtime's. */
53
+ locale?: Intl.LocalesArgument;
54
+ /**
55
+ * Where the steppers sit, or `none` for a field without them.
56
+ * @default 'end'
57
+ */
58
+ steppers?: MPNumberFieldSteppers;
59
+ /** The accessible name of the increment button. @default 'Increase' */
60
+ incrementLabel?: string;
61
+ /** The accessible name of the decrement button. @default 'Decrease' */
62
+ decrementLabel?: string;
63
+ /**
64
+ * Label for the field, drawn in the outline's notch and — while the field is
65
+ * empty, unfocused and has nothing standing at its start — resting on the
66
+ * field's own line where a placeholder would be. See `floatingLabel`.
67
+ */
68
+ label?: React.ReactNode;
69
+ /**
70
+ * Whether the label rests on the field's line while there is nothing to make
71
+ * room for, and rises into the notch on focus or on the first digit.
72
+ *
73
+ * `false` pins it in the notch, which is the one thing a floating label costs:
74
+ * a field with a label and one without no longer sit at the same height in a
75
+ * form until both are filled. A `startIcon` — or `steppers="split"`, whose
76
+ * minus sits in the same place — holds the label up regardless.
77
+ * @default true
78
+ */
79
+ floatingLabel?: boolean;
80
+ /** The line under the control. Replaced by `errorMessage` when there is one. */
81
+ description?: React.ReactNode;
82
+ /** The message under the control, which also turns the field over. */
83
+ errorMessage?: React.ReactNode;
84
+ /**
85
+ * Placeholder shown while the field is empty. With a floating label it is held
86
+ * back until the label has risen out of its way.
87
+ */
88
+ placeholder?: string;
89
+ /** Content placed before the number — a currency mark, a unit, an icon. */
90
+ startIcon?: React.ReactNode;
91
+ /** Marks the field required. */
92
+ required?: boolean;
93
+ /** Greys the field out and stops it taking input. */
94
+ disabled?: boolean;
95
+ /** Shows the number without allowing edits, and drops the steppers. */
96
+ readOnly?: boolean;
97
+ /** Name of the form control. */
98
+ name?: string;
99
+ /** The id put on the control and pointed at by the label. */
100
+ id?: string;
101
+ }
102
+ /**
103
+ * A Material Design field that only holds a number.
104
+ *
105
+ * The shell is `MPTextField`'s, to the pixel — the same notched outline, the same
106
+ * label in the notch, the same supporting text — because a form where the
107
+ * quantity box is a different height or radius from the boxes around it is a form
108
+ * that looks assembled rather than designed.
109
+ *
110
+ * What is added on top is a real numeric control rather than
111
+ * `<input type="number">`, which is worth being explicit about: the native one
112
+ * silently accepts text in some browsers, has a spinner nobody can style, scrubs
113
+ * on scroll by default, and reports `''` for anything it cannot parse. Base UI's
114
+ * owns the parsing against the locale, the clamping, the press-and-hold repeat on
115
+ * the steppers, and the hidden input that submits with a form.
116
+ */
117
+ export declare function MPNumberField({ value, defaultValue, onValueChange, onValueCommitted, min, max, step, largeStep, smallStep, allowWheelScrub, format, locale, steppers, incrementLabel, decrementLabel, label, floatingLabel, description, errorMessage, placeholder, startIcon, size, fullWidth, required, disabled, readOnly, name, id }: MPNumberFieldProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{NumberField as n}from"@base-ui/react/number-field";import{Field as r}from"@base-ui/react/field";import{MPIcon as t}from"../icon/MPIcon";import{AddIcon as i,RemoveIcon as s}from"../../constants/icons";import{MPFieldLabel as o,MPFieldOutline as p,useFloatingLabel as d}from"../../internal/FieldOutline";import{MPStateLayer as m}from"../../internal/StateLayer";import{MPSupportingText as c}from"../../internal/SupportingText";import{CONTROL_ICON as u,PROSE_TEXT as f,hasContent as h}from"../../internal/scale";const x={xs:{padding:"px-2",height:"h-8",stepper:"size-6"},sm:{padding:"px-3",height:"h-10",stepper:"size-8"},md:{padding:"px-4",height:"h-14",stepper:"size-10"},lg:{padding:"px-4",height:"h-16",stepper:"size-11"},xl:{padding:"px-5",height:"h-18",stepper:"size-12"}};export function MPNumberField({value:g,defaultValue:b,onValueChange:v,onValueCommitted:N,min:z,max:j,step:y,largeStep:S,smallStep:w,allowWheelScrub:I=!1,format:V,locale:k,steppers:q="end",incrementLabel:C="Increase",decrementLabel:L="Decrease",label:M,floatingLabel:F=!0,description:O,errorMessage:P,placeholder:W,startIcon:D,size:R="md",fullWidth:_=!1,required:B=!1,disabled:G=!1,readOnly:T=!1,name:$,id:A}){const E=h(P),H=x[R],J=l.useId(),K=A??J,Q="none"!==q&&!T&&!G,[U,X]=l.useState(b??null),Y=void 0===g?U:g,{shrunk:Z,focusProps:ee}=d({floating:F&&h(M),filled:null!==Y,pinned:!!D||Q&&"split"===q}),ae=["mp-number-field__stepper group relative flex shrink-0 items-center justify-center","rounded-mp-full cursor-pointer appearance-none bg-transparent p-0 font-[inherit]","text-mp-on-surface-variant outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default",H.stepper].join(" "),le=a(n.Decrement,{"aria-label":L,className:ae,children:[e(m,{}),e(t,{icon:s,size:u[R]})]}),ne=a(n.Increment,{"aria-label":C,className:ae,children:[e(m,{}),e(t,{icon:i,size:u[R]})]});return a(r.Root,{className:["mp-number-field group flex-col align-top",_?"flex w-full":"inline-flex w-fit"].join(" "),disabled:G,invalid:E,"data-mp-size":R,...ee,children:[e(n.Root,{id:K,name:$,className:"contents",value:g,defaultValue:b,onValueChange:e=>{X(e),v?.(e)},onValueCommitted:e=>N?.(e),min:z,max:j,step:y,largeStep:S,smallStep:w,allowWheelScrub:I,format:V,locale:k,disabled:G,readOnly:T,required:B,children:a("div",{className:"relative w-full",children:[a(n.Group,{className:["flex w-full items-center gap-2",H.height,Q&&"end"===q?`${H.padding} pe-1`:Q&&"split"===q?"px-1":H.padding].join(" "),children:[Q&&"split"===q?le:null,D?e("span",{className:["flex shrink-0 items-center",G?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:D}):null,e(n.Input,{placeholder:Z?W:void 0,className:["w-full min-w-0 flex-1 tabular-nums",f[R],"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary text-mp-on-surface","placeholder:text-mp-on-surface-variant","disabled:text-mp-on-surface/38 disabled:placeholder:text-mp-on-surface/38",Q&&"split"===q?"text-center":""].filter(Boolean).join(" ")}),Q&&"end"===q?a("span",{className:"flex shrink-0 items-center",children:[le,ne]}):null,Q&&"split"===q?ne:null]}),e(p,{label:M,required:B,notched:Z}),h(M)?e(o,{size:R,label:M,required:B,htmlFor:K,shrunk:Z}):null]})}),e(c,{description:O,errorMessage:P,className:H.padding})]})}
@@ -0,0 +1,2 @@
1
+ export { MPNumberField } from './MPNumberField';
2
+ export type { MPNumberFieldProps, MPNumberFieldSteppers } from './MPNumberField';
@@ -0,0 +1 @@
1
+ export{MPNumberField}from"./MPNumberField";
@@ -0,0 +1,89 @@
1
+ import * as React from 'react';
2
+ import type { MPStyleProps } from '../../types';
3
+ /**
4
+ * What may be typed into a slot.
5
+ *
6
+ * `numeric` is the default because that is what a texted code is, and it is also
7
+ * what puts a number pad in front of a phone. `any` accepts whatever the keyboard
8
+ * produces — for a licence key with punctuation in it.
9
+ */
10
+ export type MPOtpFieldCharset = 'numeric' | 'alpha' | 'alphanumeric' | 'any';
11
+ export interface MPOtpFieldProps extends MPStyleProps {
12
+ /**
13
+ * How many characters the code has. Clamped to 2–12: a single box is an
14
+ * `MPTextField`, and past twelve the row stops fitting a phone.
15
+ * @default 6
16
+ */
17
+ length?: number;
18
+ /**
19
+ * What may be typed. Anything rejected is dropped rather than shown, and
20
+ * `onValueInvalid` reports it.
21
+ * @default 'numeric'
22
+ */
23
+ charset?: MPOtpFieldCharset;
24
+ /** Hides the characters, the way a password field does. @default false */
25
+ mask?: boolean;
26
+ /**
27
+ * Splits the row every `groupSize` slots with a separator. `3` on a six-digit
28
+ * code gives the familiar two blocks of three.
29
+ */
30
+ groupSize?: number;
31
+ /** What is drawn between two groups. @default '–' */
32
+ separator?: React.ReactNode;
33
+ /** The code. Use with `onValueChange` for a controlled field. */
34
+ value?: string;
35
+ /** What it starts as, for an uncontrolled one. */
36
+ defaultValue?: string;
37
+ onValueChange?: (value: string) => void;
38
+ /** Fires once every slot is filled — the moment to verify the code. */
39
+ onComplete?: (value: string) => void;
40
+ /** Fires when typed or pasted text held characters the charset rejects. */
41
+ onValueInvalid?: (value: string) => void;
42
+ /** Submits the owning form as soon as the code is complete. @default false */
43
+ autoSubmit?: boolean;
44
+ /**
45
+ * The label above the row.
46
+ *
47
+ * Above it rather than in a notch, which is the one place this control departs
48
+ * from `MPTextField`'s shell. A notched label belongs to *one* outlined box; a
49
+ * code is six of them, and cutting the notch into the first would name the
50
+ * first digit rather than the field.
51
+ */
52
+ label?: React.ReactNode;
53
+ /** The line under the row. Replaced by `errorMessage` when there is one. */
54
+ description?: React.ReactNode;
55
+ /**
56
+ * The message under the row. Its presence is also what puts the field into its
57
+ * error state — there is no separate boolean, so there is no way to render a
58
+ * control that is visibly wrong with no explanation of why.
59
+ */
60
+ errorMessage?: React.ReactNode;
61
+ /** Name of the form control. */
62
+ name?: string;
63
+ /** The form must have a complete code before it submits. @default false */
64
+ required?: boolean;
65
+ /** Greys every slot out and stops them taking input. */
66
+ disabled?: boolean;
67
+ /** Readable and copyable, but not typeable. @default false */
68
+ readOnly?: boolean;
69
+ /** Puts the caret in the first slot on mount. @default false */
70
+ autoFocus?: boolean;
71
+ className?: string;
72
+ style?: React.CSSProperties;
73
+ }
74
+ /**
75
+ * A row of one-character slots: a PIN, a texted verification code, an invite key.
76
+ *
77
+ * Base UI owns everything that makes this harder than it looks — one hidden value
78
+ * behind however many inputs, paste spread across the slots from wherever the
79
+ * caret was, backspace stepping back a box, a click landing on the first empty
80
+ * slot rather than the one under the pointer, and the autofill hook that lets a
81
+ * phone offer the code straight from the message.
82
+ *
83
+ * What is here is the box a slot is drawn in, and it is Material's outlined text
84
+ * field cut down to one character: the same `corner-extra-small`, the same
85
+ * hairline in `outline`, the same two-pixel `primary` ring on focus. A form
86
+ * holding a text field and a code should not look like two form kits stacked on
87
+ * each other.
88
+ */
89
+ export declare const MPOtpField: React.ForwardRefExoticComponent<MPOtpFieldProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Field as t}from"@base-ui/react/field";import{OTPField as o}from"@base-ui/react/otp-field";import{MPSupportingText as n}from"../../internal/SupportingText";import{META_TEXT as l,STACK_GAP as i,hasContent as m}from"../../internal/scale";const s={xs:"h-8 w-7",sm:"h-10 w-9",md:"h-14 w-12",lg:"h-16 w-14",xl:"h-18 w-16"},d={xs:"text-mp-body-large",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},u={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2.5",xl:"gap-3"},p={numeric:"numeric",alpha:"alpha",alphanumeric:"alphanumeric",any:"none"};export const MPOtpField=a.forwardRef(function({size:c="md",fullWidth:f=!1,length:h=6,charset:x="numeric",mask:b=!1,groupSize:g,separator:v="–",value:y,defaultValue:w,onValueChange:M,onComplete:V,onValueInvalid:N,autoSubmit:j=!1,label:C,description:F,errorMessage:S,name:z,required:I=!1,disabled:O=!1,readOnly:R=!1,autoFocus:$=!1,className:k,style:q},T){const A=Math.min(12,Math.max(2,Math.round(h))),B=m(S),L=g&&g>0?Math.round(g):0,P=["rounded-mp-xs border bg-transparent text-center font-[inherit]",s[c],d[c],"transition-[border-color,color] duration-(--mp-sys-motion-duration-short4)","focus:border-2 focus:border-mp-primary focus:outline-none",O?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":B?"border-mp-error text-mp-on-surface caret-mp-error hover:border-mp-error":R?"border-mp-outline-variant text-mp-on-surface cursor-default":"border-mp-outline text-mp-on-surface caret-mp-primary hover:border-mp-on-surface"].join(" ");return r(t.Root,{disabled:O,invalid:B,"data-mp-size":c,className:["mp-otp-field flex-col align-top",i[c],f?"flex w-full":"inline-flex w-fit",k??""].filter(Boolean).join(" "),style:q,children:[m(C)?r(t.Label,{className:`${l} text-mp-on-surface-variant data-disabled:text-mp-on-surface/38 data-invalid:text-mp-error`,children:[C,I?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(o.Root,{ref:T,length:A,validationType:p[x],mask:b,name:z,required:I,disabled:O,readOnly:R,autoSubmit:j,value:y,defaultValue:w,onValueChange:e=>M?.(e),onValueComplete:e=>V?.(e),onValueInvalid:e=>N?.(e),className:`flex items-center ${u[c]}`,children:Array.from({length:A},(t,n)=>r(a.Fragment,{children:[L>0&&n>0&&n%L===0?e("span",{"aria-hidden":"true",className:`text-mp-on-surface-variant px-0.5 select-none ${d[c]}`,children:v}):null,e(o.Input,{className:P,autoFocus:$&&0===n})]},n))}),e(n,{description:F,errorMessage:S})]})});
@@ -0,0 +1,2 @@
1
+ export { MPOtpField } from './MPOtpField';
2
+ export type { MPOtpFieldCharset, MPOtpFieldProps } from './MPOtpField';
@@ -0,0 +1 @@
1
+ export{MPOtpField}from"./MPOtpField";