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,175 @@
1
+ import * as React from 'react';
2
+ import type { MPStyleProps } from '../../types';
3
+ /**
4
+ * What a combobox's value may be — the same two types `MPSelect` submits, and for
5
+ * the same reason: a form control's value is what a form sends, and every escape
6
+ * from that buys flexibility by making the common case harder to write.
7
+ *
8
+ * A value the list does not contain arrives as a `string`. It is what the reader
9
+ * typed.
10
+ */
11
+ export type MPComboboxValue = string | number;
12
+ export interface MPComboboxOption {
13
+ /** Submitted, and what `value` and `onValueChange` speak in. */
14
+ value: MPComboboxValue;
15
+ /**
16
+ * Shown in the list, in the input and on the chip. Defaults to the value.
17
+ *
18
+ * A `string` rather than a `ReactNode`, which is the one place this differs
19
+ * from `MPSelect`: the label is what the filter matches against and what is
20
+ * written into a text input, and neither of those can be done to an element.
21
+ */
22
+ label?: string;
23
+ /** Unavailable, but still listed — the option exists, it just cannot be picked. */
24
+ disabled?: boolean;
25
+ }
26
+ /** One value, or an array of them, depending on `multiple`. */
27
+ type Selection<Multiple extends boolean | undefined> = Multiple extends true ? MPComboboxValue[] : MPComboboxValue | null;
28
+ export interface MPComboboxProps<Multiple extends boolean | undefined = false> extends MPStyleProps {
29
+ /**
30
+ * The options, as data — the same shape `MPSelect` takes, and for the same
31
+ * reason: what a caller has is almost always an array already.
32
+ */
33
+ items: readonly MPComboboxOption[];
34
+ /**
35
+ * Whether more than one value may be held. The chosen ones become `MPChip`s
36
+ * inside the field, and the input goes on filtering after each.
37
+ * @default false
38
+ */
39
+ multiple?: Multiple;
40
+ /** The chosen value. Use with `onValueChange` for a controlled combobox. */
41
+ value?: Selection<Multiple> | null;
42
+ /** The initially chosen value, for an uncontrolled combobox. */
43
+ defaultValue?: Selection<Multiple> | null;
44
+ onValueChange?: (value: Selection<Multiple>) => void;
45
+ /** Called as the text in the input changes — the filter query, not the value. */
46
+ onInputValueChange?: (inputValue: string) => void;
47
+ /**
48
+ * Whether a value the list does not contain may be committed.
49
+ *
50
+ * On by default, and it is what separates this from a searchable select: the
51
+ * typed text is offered as its own row at the end of the list, so committing it
52
+ * is a choice the reader makes rather than something that happens to them on
53
+ * blur. Turn it off for a field whose values are a closed set.
54
+ * @default true
55
+ */
56
+ allowCustom?: boolean;
57
+ /** What that row says. Receives the trimmed query. */
58
+ customLabel?: (query: string) => React.ReactNode;
59
+ /**
60
+ * Shows a × that empties the field. Off by default — a field that can be
61
+ * cleared in one click is a field that can be emptied by accident.
62
+ * @default false
63
+ */
64
+ clearable?: boolean;
65
+ /**
66
+ * Shown in the popup when nothing matches and no value may be added.
67
+ * @default 'No matches'
68
+ */
69
+ emptyMessage?: React.ReactNode;
70
+ /** The most rows the list will show at once. `-1` is all of them. @default -1 */
71
+ limit?: number;
72
+ /**
73
+ * Shown in the input while nothing is typed. With a floating label it is held
74
+ * back until the label has risen out of its way.
75
+ */
76
+ placeholder?: string;
77
+ /**
78
+ * Label for the combobox, drawn in the outline's notch and — while nothing is
79
+ * chosen or typed, the control is unfocused and there is no `startIcon` —
80
+ * resting on the input's own line. See `floatingLabel`.
81
+ */
82
+ label?: React.ReactNode;
83
+ /**
84
+ * Whether the label rests on the input's line while there is nothing to make
85
+ * room for, and rises into the notch on focus, on the first character or on
86
+ * the first chip.
87
+ *
88
+ * `false` pins it in the notch, which is the one thing a floating label costs:
89
+ * a combobox with a label and one without no longer sit at the same height in
90
+ * a form until both are answered. A `startIcon` holds the label up regardless.
91
+ * @default true
92
+ */
93
+ floatingLabel?: boolean;
94
+ /** The line under the control. Replaced by `errorMessage` when there is one. */
95
+ description?: React.ReactNode;
96
+ /**
97
+ * The message under the control. Its presence is also what puts the combobox
98
+ * into its error state.
99
+ */
100
+ errorMessage?: React.ReactNode;
101
+ /** Content placed before the input — an `MPIcon`, usually. */
102
+ startIcon?: React.ReactNode;
103
+ /** Marks the combobox required, both to assistive technology and to the label. */
104
+ required?: boolean;
105
+ /** Greys the control out and stops it taking input. */
106
+ disabled?: boolean;
107
+ /** Shows the value without allowing it to be changed, and stays focusable. */
108
+ readOnly?: boolean;
109
+ /** Name of the form control. */
110
+ name?: string;
111
+ /** The popup is open. Use with `onOpenChange` for a controlled popup. */
112
+ open?: boolean;
113
+ /** Whether the popup starts open. */
114
+ defaultOpen?: boolean;
115
+ onOpenChange?: (open: boolean) => void;
116
+ /**
117
+ * Accessible name of the clear button. Defaults to the word for "clear" in
118
+ * `locale`.
119
+ */
120
+ clearLabel?: string;
121
+ /**
122
+ * Which language the two adornments' default names are written in. Falls back
123
+ * to the nearest `MPLocaleProvider`, then to English.
124
+ */
125
+ locale?: string;
126
+ /**
127
+ * Accessible name of the chevron that opens the list, **for a combobox with no
128
+ * `label`**.
129
+ *
130
+ * With a label, Base UI names the chevron after the field itself and that name
131
+ * wins — `aria-labelledby` outranks `aria-label` — which is the right answer:
132
+ * a button called "Fruit" beside a field called "Fruit" is the button that
133
+ * opens that field. This is the fallback for the unlabelled case, where the
134
+ * chevron would otherwise be a button with a glyph in it and no name at all.
135
+ *
136
+ * Defaults to the word for "open" in `locale`.
137
+ */
138
+ openLabel?: string;
139
+ /**
140
+ * Accessible name of a chip's remove button. Receives the chip's label.
141
+ *
142
+ * Left out, the chip is still named — "Remove Seoul" in `locale`'s own word
143
+ * order — rather than being one of five buttons all called "Remove".
144
+ */
145
+ removeLabel?: (label: string) => string;
146
+ /** A ref to the text input the reader types into. */
147
+ inputRef?: React.Ref<HTMLInputElement>;
148
+ /**
149
+ * The id put on the input and pointed at by the label. Generated when it is
150
+ * left out.
151
+ */
152
+ id?: string;
153
+ className?: string;
154
+ style?: React.CSSProperties;
155
+ }
156
+ /**
157
+ * A field you can type into and also choose from.
158
+ *
159
+ * The shell is `MPTextField`'s wearing a chevron, exactly as `MPSelect`'s trigger
160
+ * is — the three have to be indistinguishable in a form, or the form looks
161
+ * assembled rather than designed. What is different is what the text does: it
162
+ * filters the list, and — unless `allowCustom` is off — it can become the value
163
+ * itself, offered as the last row rather than committed silently on blur.
164
+ *
165
+ * With `multiple` the chosen values become chips inside the field and the input
166
+ * goes on filtering after each one, so a set of tags is built without the field
167
+ * ever closing.
168
+ *
169
+ * Base UI owns everything hard about this: the filtering and its collator, the
170
+ * popup's positioning and flipping, the `combobox`/`listbox` wiring, arrow-key
171
+ * navigation across both the list and the chips, and the hidden input that makes
172
+ * the whole thing submit with a form.
173
+ */
174
+ export declare function MPCombobox<Multiple extends boolean | undefined = false>({ items, multiple, value, defaultValue, onValueChange, onInputValueChange, allowCustom, customLabel, clearable, emptyMessage, limit, placeholder, label, floatingLabel, description, errorMessage, startIcon, size, fullWidth, required, disabled, readOnly, name, open, defaultOpen, onOpenChange, clearLabel, openLabel, locale: localeProp, removeLabel, inputRef, id, className, style }: MPComboboxProps<Multiple>): React.JSX.Element;
175
+ export {};
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Combobox as i}from"@base-ui/react/combobox";import{Field as n}from"@base-ui/react/field";import{MPChip as t}from"../chip/MPChip";import{MPIcon as r}from"../icon/MPIcon";import{AddIcon as o,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons";import{MPFieldLabel as u,MPFieldOutline as d,useFloatingLabel as p}from"../../internal/FieldOutline";import{fillMessage as h}from"../../internal/i18n";import{useMPLocale as f,useMPMessages as b}from"../../internal/locale";import{MPStateLayer as g}from"../../internal/StateLayer";import{MPSupportingText as x}from"../../internal/SupportingText";import{CONTROL_ICON as v,PROSE_TEXT as y,hasContent as N}from"../../internal/scale";import{FADE as w,PORTAL_LAYER as C}from"../../internal/surface";const L={xs:{padding:"ps-2 pe-1",height:"h-8"},sm:{padding:"ps-3 pe-1.5",height:"h-10"},md:{padding:"ps-4 pe-2",height:"h-14"},lg:{padding:"ps-4 pe-2",height:"h-16"},xl:{padding:"ps-5 pe-2.5",height:"h-18"}},j={xs:"min-h-8 py-1",sm:"min-h-10 py-1.5",md:"min-h-14 py-3",lg:"min-h-16 py-3",xl:"min-h-18 py-3"},I={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function S(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:z,multiple:M,value:O,defaultValue:V,onValueChange:P,onInputValueChange:k,allowCustom:q=!0,customLabel:A,clearable:T=!1,emptyMessage:$="No matches",limit:R,placeholder:_,label:F,floatingLabel:E=!0,description:B,errorMessage:G,startIcon:H,size:W="md",fullWidth:D=!1,required:J=!1,disabled:K=!1,readOnly:Q=!1,name:U,open:X,defaultOpen:Y,onOpenChange:Z,clearLabel:ee,openLabel:ae,locale:le,removeLabel:ie,inputRef:ne,id:te,className:re,style:oe}){const se=f(le),me=b("common",se),ce=N(G),ue=!0===M,de=L[W],pe=l.useId(),he=te??pe,fe=l.useMemo(()=>z.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[z]),[be,ge]=l.useState(()=>S(V)),xe=void 0===O?be:S(O),[ve,ye]=l.useState(""),{shrunk:Ne,focusProps:we}=p({floating:E&&N(F),filled:xe.length>0||""!==ve,pinned:!!H}),Ce=l.useCallback(e=>fe.find(a=>a.value===e)??{value:e,label:String(e),custom:!0},[fe]),Le=ve.trim(),je=Le.toLocaleLowerCase(),Ie=""===Le||fe.some(e=>e.label.toLocaleLowerCase()===je||String(e.value).toLocaleLowerCase()===je)||xe.some(e=>String(e).toLocaleLowerCase()===je),Se=!q||Q||K||Ie?null:Le,ze=l.useMemo(()=>null===Se?fe:[...fe,{value:Se,label:Se,custom:!0}],[fe,Se]),Me=ue?xe.map(Ce):xe.length>0?Ce(xe[0]):null;const Oe=["min-w-0 flex-1 self-stretch bg-transparent font-[inherit] text-inherit outline-none","placeholder:text-mp-on-surface-variant",K?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Ve=["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer items-center justify-center","text-mp-on-surface-variant","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),Pe=a=>e(i.Input,{ref:ne,id:he,placeholder:Ne?_:void 0,className:ue?`${Oe} min-w-16 ${a?"ms-1.5":""}`:Oe});return a(n.Root,{disabled:K,invalid:ce,"data-mp-size":W,className:["mp-combobox group flex-col align-top",D?"flex w-full":"inline-flex w-fit",re??""].filter(Boolean).join(" "),style:oe,...we,children:[a(i.Root,{name:U,items:ze,multiple:ue,value:Me,onValueChange:e=>{!function(e){void 0===O&&ge(e),P?.(ue?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{ye(e),k?.(e)},open:X,defaultOpen:Y,onOpenChange:e=>Z?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:R,disabled:K,readOnly:Q,required:J,children:[a("div",{className:"relative w-full",children:[a(i.InputGroup,{className:["relative flex w-full items-center gap-2",de.padding,ue?j[W]:de.height,y[W],K?"cursor-default":"cursor-text"].join(" "),children:[H?e("span",{className:["flex shrink-0 items-center",K?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:H}):null,ue?e(i.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(i.Value,{children:n=>a(l.Fragment,{children:[n.map(a=>e(i.Chip,{render:e(t,{variant:ce?"outlined":"tonal",color:ce?"error":"primary",size:I[W],disabled:K,endIcon:Q||K?null:e(i.ChipRemove,{"aria-label":ie?ie(a.label):h(me.removeNamed,{label:a.label}),className:"flex cursor-pointer items-center opacity-70 hover:opacity-100",children:e(r,{icon:c,size:16})})}),children:a.label},String(a.value))),Pe(n.length>0)]})})}):Pe(!1),T&&!Q?a(i.Clear,{"aria-label":ee??me.clear,className:Ve,children:[e(g,{}),e(r,{icon:c,size:v[W]})]}):null,a(i.Trigger,{"aria-label":ae??me.open,className:Ve,children:[e(g,{}),e(i.Icon,{className:["relative flex items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180"].join(" "),children:e(r,{icon:m,size:v[W]})})]})]}),e(d,{label:F,required:J,notched:Ne}),N(F)?e(u,{size:W,label:F,required:J,htmlFor:he,shrunk:Ne}):null]}),e(i.Portal,{children:e(i.Positioner,{className:C,sideOffset:4,children:a(i.Popup,{className:["mp-combobox__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface w-[var(--anchor-width)] outline-none","max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",y[W],w].join(" "),children:[e(i.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:$}),e(i.List,{children:l=>a(i.Item,{value:l,disabled:l.disabled,className:["mp-combobox__item rounded-mp-xs relative flex cursor-pointer items-center","gap-3 py-2 ps-2 pe-3 select-none outline-none","data-highlighted:bg-mp-on-surface/8","data-selected:bg-mp-secondary-container","data-selected:text-mp-on-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:l.custom?e(r,{icon:o,size:18}):e(i.ItemIndicator,{children:e(r,{icon:s,size:18})})}),e("span",{className:"min-w-0 flex-1 truncate",children:l.custom?A?A(l.label):`Add “${l.label}”`:l.label})]},`${l.custom?"custom:":""}${String(l.value)}`)})]})})})]}),e(x,{description:B,errorMessage:G,className:de.padding})]})}
@@ -0,0 +1,2 @@
1
+ export { MPCombobox } from './MPCombobox';
2
+ export type { MPComboboxOption, MPComboboxProps, MPComboboxValue } from './MPCombobox';
@@ -0,0 +1 @@
1
+ export{MPCombobox}from"./MPCombobox";
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { MPSize } from '../../types';
4
+ export interface MPContainerProps extends React.ComponentPropsWithoutRef<'div'> {
5
+ /**
6
+ * How wide the content is allowed to get, on a ladder pinned to MD3's window
7
+ * size classes — `sm` 600dp, `md` 840dp, `lg` 1200dp, `xl` 1600dp, `xs` 480dp.
8
+ *
9
+ * `none`, the default, is no limit: a container's job is the margin, and a
10
+ * measure is a second decision that a page should have to ask for.
11
+ * @default 'none'
12
+ */
13
+ maxWidth?: MPSize | 'none';
14
+ /**
15
+ * The page margin. Turn it off to keep the centring and the measure without
16
+ * the gutter — a full-bleed hero, a section that pads itself.
17
+ * @default true
18
+ */
19
+ padded?: boolean;
20
+ /**
21
+ * The margin's rung. `md` is 16dp, which is MD3's own compact margin; the
22
+ * specification widens it to 24dp from a medium window up, which here is
23
+ * `size="lg"`.
24
+ *
25
+ * As on [MPBox](./box) this is the size of the *sheet* — it never touches a
26
+ * height or the type scale — and it is independent of `maxWidth`, which is how
27
+ * wide the content gets rather than how far it sits from the edge.
28
+ * @default 'md'
29
+ */
30
+ size?: MPSize;
31
+ /**
32
+ * Centres the content once `maxWidth` is narrower than the page. No effect
33
+ * while `maxWidth` is `none`, because there is nothing left over to centre in.
34
+ * @default true
35
+ */
36
+ centered?: boolean;
37
+ /**
38
+ * Renders something other than a `<div>`: `render={<main />}`,
39
+ * `render={<section />}`. Base UI's own escape hatch.
40
+ */
41
+ render?: useRender.RenderProp;
42
+ children?: React.ReactNode;
43
+ }
44
+ /**
45
+ * The page margin, and optionally a measure.
46
+ *
47
+ * Material describes a layout as content held off the edge of the window by a
48
+ * margin — 16dp in a compact window, 24dp from medium up — and this is that
49
+ * margin, said once, at the top of a page rather than on each of the things
50
+ * inside it.
51
+ *
52
+ * Nothing to do with the grid. A container holds an [MPGrid](./grid) as happily
53
+ * as it holds a single paragraph, and a grid needs no container around it: the
54
+ * two are separate because the questions are separate — how far the content sits
55
+ * from the edge of the window, and how the content divides itself up.
56
+ *
57
+ * ## Why it draws no surface
58
+ *
59
+ * No `variant`, no `color`, no shadow, for the same reason a grid draws none:
60
+ * the outermost element on a page is the one thing that must not decide what the
61
+ * page looks like. A container that painted `surface-container` would put a
62
+ * second background behind an application that already has one, and every sheet
63
+ * inside it would then be a sheet on a sheet.
64
+ *
65
+ * When the page genuinely is a card on a background, that is an
66
+ * [MPBox](./box) or an [MPCard](./card) *inside* the container.
67
+ *
68
+ * ## Why the measure is off by default
69
+ *
70
+ * Because the two decisions arrive at different times. Nearly every page wants
71
+ * the margin, and a good number of them — a dashboard, a table, an editor —
72
+ * deliberately want the full width. A container that capped the width on its own
73
+ * would be a component whose most common use is undoing something it did.
74
+ */
75
+ export declare const MPContainer: React.ForwardRefExoticComponent<MPContainerProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{SHEET_PAD_X as m}from"../../internal/scale";const a={xs:"max-w-[30rem]",sm:"max-w-[37.5rem]",md:"max-w-[52.5rem]",lg:"max-w-[75rem]",xl:"max-w-[100rem]"};export const MPContainer=e.forwardRef(function({maxWidth:e="none",padded:n=!0,size:o="md",centered:t=!0,render:d,className:i,children:s,...c},l){return r({render:d,ref:l,props:{"data-mp-size":o,className:["mp-container block w-full","box-border","none"===e?"":a[e],t?"mx-auto":"",n?m[o]:"",i??""].filter(Boolean).join(" "),children:s,...c}})});
@@ -0,0 +1,2 @@
1
+ export { MPContainer } from './MPContainer';
2
+ export type { MPContainerProps } from './MPContainer';
@@ -0,0 +1 @@
1
+ export{MPContainer}from"./MPContainer";
@@ -0,0 +1,98 @@
1
+ import * as React from 'react';
2
+ import { type MPPickerLabels } from '../../internal/Calendar';
3
+ import { type MPPickerShellProps } from '../../internal/Picker';
4
+ import type { MPWeekday } from '../../types';
5
+ export interface MPDatePickerProps extends MPPickerShellProps {
6
+ /** The chosen day. Use with `onValueChange` for a controlled picker. */
7
+ value?: Date | null;
8
+ /** The day the picker starts on, for an uncontrolled one. */
9
+ defaultValue?: Date | null;
10
+ /** Called with the newly chosen day — a `Date`, not an event. `null` when cleared. */
11
+ onValueChange?: (value: Date | null) => void;
12
+ /** Whether the calendar is open. Use with `onOpenChange` to control it. */
13
+ open?: boolean;
14
+ defaultOpen?: boolean;
15
+ onOpenChange?: (open: boolean) => void;
16
+ /**
17
+ * Which month the calendar opens on when there is no value.
18
+ * @default this month
19
+ */
20
+ defaultMonth?: Date;
21
+ /** The earliest day that may be chosen. Day-granular — the time is ignored. */
22
+ minDate?: Date | null;
23
+ /** The latest day that may be chosen. */
24
+ maxDate?: Date | null;
25
+ /**
26
+ * Blocks individual days that are inside the range but still not available —
27
+ * weekends, holidays, a room that is already booked.
28
+ */
29
+ shouldDisableDate?: (date: Date) => boolean;
30
+ /**
31
+ * A BCP 47 tag deciding the month and weekday names, the order of the header's
32
+ * two buttons, which day the week starts on, and how the trigger writes the
33
+ * date. Falls back to the nearest `MPLocaleProvider`, then to the platform's
34
+ * own.
35
+ */
36
+ locale?: string;
37
+ /** Which day the week starts on. Defaults to whatever the locale says. */
38
+ weekStartsOn?: MPWeekday;
39
+ /**
40
+ * How the trigger writes the chosen date. Passed straight to `Intl`, so
41
+ * `{ dateStyle: 'full' }` and `{ year: '2-digit', month: 'narrow' }` both work.
42
+ *
43
+ * An object written inline is fine: what the picker keeps between renders is
44
+ * keyed on what the format *says*, not on the object that says it.
45
+ * @default { dateStyle: 'medium' }
46
+ */
47
+ format?: Intl.DateTimeFormatOptions;
48
+ /** Shown in the trigger while nothing is chosen. */
49
+ placeholder?: React.ReactNode;
50
+ /**
51
+ * Offers the × that empties the control.
52
+ * @default false
53
+ */
54
+ clearable?: boolean;
55
+ /**
56
+ * Offers the shortcut to today in the footer.
57
+ * @default true
58
+ */
59
+ showTodayButton?: boolean;
60
+ /**
61
+ * Closes the popup as soon as a day is chosen.
62
+ * @default true
63
+ */
64
+ closeOnSelect?: boolean;
65
+ /**
66
+ * Overrides for the words the picker says on its own behalf. Whatever is not
67
+ * given falls back to the translation for `locale`, and then to English.
68
+ */
69
+ labels?: Partial<MPPickerLabels>;
70
+ /** Identifies the field when a form is submitted, as `YYYY-MM-DD`. */
71
+ name?: string;
72
+ }
73
+ /**
74
+ * One day, chosen from a calendar.
75
+ *
76
+ * The trigger is a text field's shell wearing a calendar glyph, on purpose and
77
+ * for the reason `MPSelect`'s is: a form where the date field is a different
78
+ * height, radius or outline weight from the fields around it is a form that
79
+ * looks assembled rather than designed.
80
+ *
81
+ * What the calendar is actually for is its header. A picker that only steps a
82
+ * month at a time puts a birthday thirty years back a hundred and eighty clicks
83
+ * away, so the month name and the year are each a button that opens a grid of
84
+ * its own — twelve months, then twelve years at a time. Any month of the year on
85
+ * screen is two clicks; any year at all is three. That is MD3's own docked date
86
+ * picker, and this is drawn on MD3's own numbers: a 40dp cell, a filled circle
87
+ * for the chosen day, an outlined one for today.
88
+ *
89
+ * ## Every string comes from the platform
90
+ *
91
+ * The month names, the weekday initials, the order of the header's two buttons
92
+ * and the way the trigger writes the date are all `Intl`'s answers for `locale`
93
+ * — not a bundled table. Which day the week starts on is `Intl`'s too. The only
94
+ * words this library supplies are the ones `Intl` has no opinion about
95
+ * ("Previous month", "Today"), and those are translated for eighteen languages
96
+ * and overridable with `labels`.
97
+ */
98
+ export declare const MPDatePicker: React.ForwardRefExoticComponent<MPDatePickerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{MPButton as o}from"../button/MPButton";import{MPIcon as t}from"../icon/MPIcon";import{CalendarIcon as n}from"../../constants/icons";import{MPCalendar as r}from"../../internal/Calendar";import{FOOTER_SIZE as i,MPPickerFooter as s,MPPickerShell as c,useDisplaySamples as d}from"../../internal/Picker";import{useMPLocale as m,useMPMessages as u}from"../../internal/locale";import{CONTROL_ICON as p}from"../../internal/scale";import{formatDate as f,isDayOutside as h,isValidDate as b,localeWeekStart as v,mergeDateAndTime as x,startOfDay as D,startOfMonth as g,toISODate as k,today as y,withPlaceholder as C}from"../../internal/date";export const MPDatePicker=l.forwardRef(function({value:O,defaultValue:S,onValueChange:z,open:M,defaultOpen:P,onOpenChange:w,defaultMonth:j,minDate:I,maxDate:V,shouldDisableDate:B,locale:R,weekStartsOn:E,format:F={dateStyle:"medium"},placeholder:N,clearable:T=!1,showTodayButton:q=!0,closeOnSelect:A=!0,labels:G,name:H,size:J="md",color:K="primary",readOnly:L=!1,disabled:Q=!1,startIcon:U,...W},X){const Y=m(R),Z=u("picker",Y,G),$=E??v(Y),[_,ee]=l.useState(S??null),ae=void 0!==O?O:_,[le,oe]=l.useState(P??!1),te=M??le,[ne,re]=l.useState(()=>g(b(ae)?ae:j??y()));l.useEffect(()=>{te&&re(g(b(ae)?ae:j??y()))},[te]);const ie=e=>{e&&(L||Q)||(void 0===M&&oe(e),w?.(e))},se=e=>{void 0===O&&ee(e),z?.(e)},ce=e=>{const a=b(ae)?x(e,ae):D(e);se(a),re(g(a)),A&&ie(!1)},de=y(),me=h(de,I,V)||(B?.(de)??!1),ue=q||T,pe=C(d(Y,F),N);return e(c,{...W,slug:"date-picker",size:J,color:K,readOnly:L,disabled:Q,triggerRef:X,startIcon:void 0===U?e(t,{icon:n,size:p[J]}):U,display:b(ae)?f(ae,Y,F):N??"",samples:pe,empty:!b(ae),clearable:T,onClear:()=>se(null),open:te,onOpenChange:ie,labels:Z,hiddenValues:H?[{name:H,value:b(ae)?k(ae):""}]:void 0,children:a("div",{className:"flex flex-col "+(ue?"gap-1.5":""),children:[e(r,{size:J,color:K,locale:Y,weekStartsOn:$,month:ne,onMonthChange:re,selected:[ae],onSelect:ce,minDate:I,maxDate:V,shouldDisableDate:B,labels:Z,autoFocus:!0}),ue?a(s,{children:[T?e(o,{variant:"text",size:i[J],color:K,onClick:()=>{se(null),ie(!1)},children:Z.clear}):null,q?e(o,{variant:"text",size:i[J],color:K,disabled:me,onClick:()=>ce(de),children:Z.today}):null]}):null]})})});
@@ -0,0 +1,2 @@
1
+ export { MPDatePicker } from './MPDatePicker';
2
+ export type { MPDatePickerProps } from './MPDatePicker';
@@ -0,0 +1 @@
1
+ export{MPDatePicker}from"./MPDatePicker";
@@ -0,0 +1,98 @@
1
+ import * as React from 'react';
2
+ import { type MPPickerLabels } from '../../internal/Calendar';
3
+ import { type MPPickerShellProps } from '../../internal/Picker';
4
+ import type { MPWeekday } from '../../types';
5
+ /**
6
+ * Two ends, either of which may be missing.
7
+ *
8
+ * An object rather than a `[Date, Date]` tuple, and rather than two props. A
9
+ * range is one value — it is chosen in one gesture, cleared in one gesture and
10
+ * validated as a whole — and the two names are what stop a caller writing the
11
+ * end into the start. Half a range is a real state: it is what the picker holds
12
+ * between the first click and the second.
13
+ */
14
+ export interface MPDateRange {
15
+ start: Date | null;
16
+ end: Date | null;
17
+ }
18
+ /** A named range offered as a shortcut beside the calendars. */
19
+ export interface MPDateRangePreset {
20
+ label: React.ReactNode;
21
+ /**
22
+ * The range it stands for. A function when it depends on today, which is
23
+ * almost always — "the last 7 days" computed once at module scope is a range
24
+ * that would be wrong for anyone who left the tab open overnight.
25
+ */
26
+ value: MPDateRange | (() => MPDateRange);
27
+ }
28
+ export interface MPDateRangePickerProps extends MPPickerShellProps {
29
+ /** The chosen range. Use with `onValueChange` for a controlled picker. */
30
+ value?: MPDateRange | null;
31
+ defaultValue?: MPDateRange | null;
32
+ /**
33
+ * Always called with an object. A cleared range is `{ start: null, end: null }`
34
+ * rather than `null`, so a caller never has to test two shapes for "empty".
35
+ */
36
+ onValueChange?: (value: MPDateRange) => void;
37
+ open?: boolean;
38
+ defaultOpen?: boolean;
39
+ onOpenChange?: (open: boolean) => void;
40
+ /** Which month the left calendar opens on when there is no value. */
41
+ defaultMonth?: Date;
42
+ minDate?: Date | null;
43
+ maxDate?: Date | null;
44
+ shouldDisableDate?: (date: Date) => boolean;
45
+ /**
46
+ * A BCP 47 tag deciding every name the calendars draw and how the trigger
47
+ * writes the two ends. Falls back to the nearest `MPLocaleProvider`, then to
48
+ * the platform's own.
49
+ */
50
+ locale?: string;
51
+ weekStartsOn?: MPWeekday;
52
+ /** @default { dateStyle: 'medium' } */
53
+ format?: Intl.DateTimeFormatOptions;
54
+ /**
55
+ * How many months are on screen at once. Two is the default because a range
56
+ * that crosses a month boundary is the ordinary case, not the exception.
57
+ * @default 2
58
+ */
59
+ monthCount?: 1 | 2;
60
+ /** Shown in each half of the trigger while that end is unchosen. */
61
+ startPlaceholder?: React.ReactNode;
62
+ endPlaceholder?: React.ReactNode;
63
+ /** Shortcuts listed beside the calendars — "Last 7 days", "This month". */
64
+ presets?: readonly MPDateRangePreset[];
65
+ clearable?: boolean;
66
+ /**
67
+ * Closes the popup once both ends are chosen.
68
+ * @default true
69
+ */
70
+ closeOnSelect?: boolean;
71
+ labels?: Partial<MPPickerLabels>;
72
+ /**
73
+ * Identifies the field when a form is submitted. Two hidden inputs of the same
74
+ * name, so the two ends arrive as `FormData.getAll(name)`.
75
+ */
76
+ name?: string;
77
+ }
78
+ /**
79
+ * A span between two days.
80
+ *
81
+ * Two months side by side, because a range that crosses a month boundary is the
82
+ * ordinary case and a one-month picker makes it a two-step navigation problem.
83
+ * The two panels are one calendar in two halves: the left one has no forward
84
+ * stepper, the right one has no back stepper, and either header's month and year
85
+ * buttons move both.
86
+ *
87
+ * The band between the ends is drawn as the pointer moves, before the second
88
+ * click lands. That preview is the whole affordance — without it the first click
89
+ * has no visible consequence and the control looks broken for the second or so
90
+ * between the two.
91
+ *
92
+ * The band itself is the accent's *container* tone under its own ink, and the
93
+ * two ends are the accent proper. That is the same pair MD3 uses for a selected
94
+ * range, and it is what keeps the ends distinguishable from the days between
95
+ * them: a band drawn in the accent would make a nine-day range look like nine
96
+ * separately chosen days.
97
+ */
98
+ export declare const MPDateRangePicker: React.ForwardRefExoticComponent<MPDateRangePickerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton";import{MPIcon as t}from"../icon/MPIcon";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons";import{MPCalendar as o}from"../../internal/Calendar";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale";import{MPWidthSizer as h}from"../../internal/WidthSizer";import{CONTROL_ICON as f,META_TEXT as v}from"../../internal/scale";import{addMonths as x,compareDay as g,formatDate as b,isValidDate as w,localeWeekStart as N,startOfDay as S,startOfMonth as C,toISODate as y,today as D,withPlaceholder as k}from"../../internal/date";const O={start:null,end:null};export const MPDateRangePicker=n.forwardRef(function({value:P,defaultValue:z,onValueChange:M,open:j,defaultOpen:B,onOpenChange:I,defaultMonth:R,minDate:V,maxDate:E,shouldDisableDate:F,locale:W,weekStartsOn:$,format:_={dateStyle:"medium"},monthCount:q=2,startPlaceholder:A,endPlaceholder:G,presets:H,clearable:J=!1,closeOnSelect:K=!0,labels:L,name:Q,size:T="md",color:U="primary",readOnly:X=!1,disabled:Y=!1,startIcon:Z,...ee},le){const ne=d(W),ae=p("picker",ne,L),te=$??N(ne),[re,se]=n.useState(z??O),oe=void 0!==P?P??O:re,ie=w(oe.start)?oe.start:null,ce=w(oe.end)?oe.end:null,[ue,me]=n.useState(B??!1),de=j??ue,[pe,he]=n.useState(null),[fe,ve]=n.useState(null),[xe,ge]=n.useState(()=>C(ie??R??D()));n.useEffect(()=>{de?ge(C(ie??R??D())):(he(null),ve(null))},[de]);const be=e=>{e&&(X||Y)||(void 0===j&&me(e),I?.(e))},we=e=>{void 0===P&&se(e),M?.(e)},Ne=pe??ie,Se=null!==pe?fe:ce,Ce=(l,n)=>w(l)?b(l,ne,_):e("span",{className:"text-mp-on-surface-variant",children:n??""}),ye=x(xe,1),De=2===q,ke=m(ne,_),Oe=null!==pe?ae.end:null===ie?ae.start:null,Pe={size:T,color:U,locale:ne,weekStartsOn:te,selected:[ie,ce,pe],rangeStart:Ne,rangeEnd:Se,onSelect:e=>{const l=S(e);if(null===pe)return he(l),ve(l),void we({start:l,end:null});const[n,a]=g(l,pe)<0?[l,pe]:[pe,l];he(null),ve(null),we({start:n,end:a}),K&&be(!1)},onPreviewChange:e=>{null!==pe&&ve(e??pe)},minDate:V,maxDate:E,shouldDisableDate:F,showOutsideDays:!1,labels:ae};return e(u,{...ee,slug:"date-range-picker",size:T,color:U,readOnly:X,disabled:Y,triggerRef:le,startIcon:void 0===Z?e(t,{icon:s,size:f[T]}):Z,display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ie,A)}),e(h,{samples:k(ke,A)})]}),e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant flex shrink-0 items-center rtl:rotate-180",children:e(t,{icon:r,size:f[T]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ce,G)}),e(h,{samples:k(ke,G)})]})]}),empty:null===ie&&null===ce,clearable:J,onClear:()=>we(O),open:de,onOpenChange:be,labels:ae,hiddenValues:Q?[{name:Q,value:ie?y(ie):""},{name:Q,value:ce?y(ce):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[H&&H.length>0?e("div",{className:"border-mp-outline-variant flex max-h-[calc(var(--_mp-cell,2.5rem)*8)] flex-col overflow-y-auto border-e pe-1.5",children:H.map((l,n)=>e(a,{variant:"text",size:i[T],color:U,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;he(null),ve(null),we(l),w(l.start)&&ge(C(l.start)),K&&be(!1)})(l),children:l.label},n))}):null,e(o,{...Pe,month:xe,onMonthChange:ge,showNextButton:!De,autoFocus:!0}),De?e(o,{...Pe,month:ye,onMonthChange:e=>ge(x(e,-1)),showPreviousButton:!1}):null]}),J||null!==Oe?l(c,{children:[null!==Oe?e("span",{className:`text-mp-on-surface-variant me-auto ${v}`,children:Oe}):null,J?e(a,{variant:"text",size:i[T],color:U,onClick:()=>{he(null),ve(null),we(O),be(!1)},children:ae.clear}):null]}):null]})})});
@@ -0,0 +1,2 @@
1
+ export { MPDateRangePicker } from './MPDateRangePicker';
2
+ export type { MPDateRange, MPDateRangePickerProps, MPDateRangePreset } from './MPDateRangePicker';
@@ -0,0 +1 @@
1
+ export{MPDateRangePicker}from"./MPDateRangePicker";
@@ -0,0 +1,78 @@
1
+ import * as React from 'react';
2
+ import { type MPPickerLabels } from '../../internal/Calendar';
3
+ import { type MPPickerShellProps } from '../../internal/Picker';
4
+ import { type MPTimeUnit } from '../../internal/date';
5
+ import type { MPWeekday } from '../../types';
6
+ export interface MPDateTimePickerProps extends MPPickerShellProps {
7
+ /** The chosen moment. Use with `onValueChange` for a controlled picker. */
8
+ value?: Date | null;
9
+ defaultValue?: Date | null;
10
+ onValueChange?: (value: Date | null) => void;
11
+ open?: boolean;
12
+ defaultOpen?: boolean;
13
+ onOpenChange?: (open: boolean) => void;
14
+ /** Which month the calendar opens on when there is no value. */
15
+ defaultMonth?: Date;
16
+ /**
17
+ * The earliest moment that may be chosen.
18
+ *
19
+ * Unlike `MPDatePicker`'s, this one is read at **full precision**: the day it
20
+ * falls on stays available in the calendar and the clock's columns block the
21
+ * hours before it. That is what a "not before now" rule needs, and it is what
22
+ * a day-granular check cannot give.
23
+ */
24
+ minDate?: Date | null;
25
+ /** The latest moment that may be chosen, likewise at full precision. */
26
+ maxDate?: Date | null;
27
+ shouldDisableDate?: (date: Date) => boolean;
28
+ shouldDisableTime?: (value: Date, unit: MPTimeUnit) => boolean;
29
+ /**
30
+ * A BCP 47 tag deciding every name and number the picker draws. Falls back to
31
+ * the nearest `MPLocaleProvider`, then to the platform's own.
32
+ */
33
+ locale?: string;
34
+ weekStartsOn?: MPWeekday;
35
+ /**
36
+ * How the trigger writes the chosen moment. Passed straight to `Intl`.
37
+ * @default { dateStyle: 'medium', timeStyle: 'short' }
38
+ */
39
+ format?: Intl.DateTimeFormatOptions;
40
+ /** A 12-hour dial with an AM/PM column. Defaults to whatever the locale does. */
41
+ hour12?: boolean;
42
+ showSeconds?: boolean;
43
+ hourStep?: number;
44
+ minuteStep?: number;
45
+ secondStep?: number;
46
+ placeholder?: React.ReactNode;
47
+ clearable?: boolean;
48
+ /**
49
+ * Offers the shortcut to this moment in the footer.
50
+ * @default true
51
+ */
52
+ showNowButton?: boolean;
53
+ /**
54
+ * Closes the popup as soon as a day is chosen.
55
+ *
56
+ * `false` here and `true` on `MPDatePicker`, because a moment is a day *and* a
57
+ * time and closing on the first of the two would leave the second unanswered.
58
+ * @default false
59
+ */
60
+ closeOnSelect?: boolean;
61
+ labels?: Partial<MPPickerLabels>;
62
+ /** Identifies the field when a form is submitted, as `YYYY-MM-DDTHH:MM`. */
63
+ name?: string;
64
+ }
65
+ /**
66
+ * A day and a time, in one popup.
67
+ *
68
+ * Not a date picker that grew a clock and not a time picker that grew a
69
+ * calendar: the two panels sit side by side at exactly the same height — seven
70
+ * rows of cells each, which is why the calendar's grid and the clock's columns
71
+ * share the `--_mp-cell` ladder — so the popup is one rectangle rather than two
72
+ * of different sizes pushed together.
73
+ *
74
+ * The bounds do more work here than anywhere else. `minDate` is read at full
75
+ * precision, so a minimum of 09:30 on the 27th leaves the 27th selectable in the
76
+ * calendar and greys out the morning in the clock.
77
+ */
78
+ export declare const MPDateTimePicker: React.ForwardRefExoticComponent<MPDateTimePickerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as t from"react";import{MPButton as l}from"../button/MPButton";import{MPIcon as a}from"../icon/MPIcon";import{CalendarIcon as n}from"../../constants/icons";import{MPCalendar as r,MPTimeGrid as i}from"../../internal/Calendar";import{FOOTER_SIZE as s,MPPickerDivider as c,MPPickerFooter as d,MPPickerShell as m,useDisplaySamples as u}from"../../internal/Picker";import{useMPLocale as h,useMPMessages as p}from"../../internal/locale";import{CONTROL_ICON as f}from"../../internal/scale";import{formatDate as S,isDayOutside as b,isHour12 as g,isValidDate as v,localeWeekStart as D,mergeDateAndTime as x,startOfDay as C,startOfMonth as k,timeUnitSpan as w,toISODateTime as z,today as O,withPlaceholder as y,withTime as T}from"../../internal/date";export const MPDateTimePicker=t.forwardRef(function({value:M,defaultValue:P,onValueChange:j,open:I,defaultOpen:N,onOpenChange:V,defaultMonth:B,minDate:R,maxDate:E,shouldDisableDate:F,shouldDisableTime:q,locale:A,weekStartsOn:G,format:H,hour12:J,showSeconds:K=!1,hourStep:L=1,minuteStep:Q=1,secondStep:U=1,placeholder:W,clearable:X=!1,showNowButton:Y=!0,closeOnSelect:Z=!1,labels:$,name:_,size:ee="md",color:oe="primary",readOnly:te=!1,disabled:le=!1,startIcon:ae,...ne},re){const ie=h(A),se=p("picker",ie,$),ce=G??D(ie),de=J??g(ie),[me,ue]=t.useState(P??null),he=void 0!==M?M:me,[pe,fe]=t.useState(N??!1),Se=I??pe,[be,ge]=t.useState(()=>k(v(he)?he:B??O()));t.useEffect(()=>{Se&&ge(k(v(he)?he:B??O()))},[Se]);const ve=e=>{e&&(te||le)||(void 0===I&&fe(e),V?.(e))},De=e=>{void 0===M&&ue(e),j?.(e)},xe=t.useCallback((e,o)=>{const[t,l]=w(o,e),a=C(e).getTime();return!!(v(R)&&a+1e3*l<R.getTime())||(!!(v(E)&&a+1e3*t>E.getTime())||(q?.(e,o)??!1))},[R,E,q]),Ce=H??{dateStyle:"medium",timeStyle:"short",hour12:de},ke=new Date,we=T(ke,{seconds:K?ke.getSeconds():0}),ze=b(we,R,E)||(F?.(we)??!1)||xe(we,"second"),Oe=y(u(ie,Ce),W);return e(m,{...ne,slug:"date-time-picker",size:ee,color:oe,readOnly:te,disabled:le,triggerRef:re,startIcon:void 0===ae?e(a,{icon:n,size:f[ee]}):ae,display:v(he)?S(he,ie,Ce):W??"",samples:Oe,empty:!v(he),clearable:X,onClear:()=>De(null),open:Se,onOpenChange:ve,labels:se,hiddenValues:_?[{name:_,value:v(he)?z(he,K):""}]:void 0,children:o("div",{className:"flex flex-col gap-1.5",children:[o("div",{className:"flex items-stretch gap-2",children:[e(r,{size:ee,color:oe,locale:ie,weekStartsOn:ce,month:be,onMonthChange:ge,selected:[he],onSelect:e=>{const o=v(he)?x(e,he):C(e);De(o),ge(k(o)),Z&&ve(!1)},minDate:R,maxDate:E,shouldDisableDate:F,labels:se,autoFocus:!0}),e(c,{}),e(i,{size:ee,locale:ie,value:v(he)?he:null,referenceDate:v(he)?he:O(),onChange:De,hour12:de,showSeconds:K,hourStep:L,minuteStep:Q,secondStep:U,shouldDisableTime:xe,labels:se})]}),o(d,{children:[X?e(l,{variant:"text",size:s[ee],color:oe,onClick:()=>{De(null),ve(!1)},children:se.clear}):null,Y?e(l,{variant:"text",size:s[ee],color:oe,disabled:ze,onClick:()=>{De(we),ge(k(we))},children:se.now}):null,e(l,{variant:"filled",size:s[ee],color:oe,onClick:()=>ve(!1),children:se.done})]})]})})});
@@ -0,0 +1,2 @@
1
+ export { MPDateTimePicker } from './MPDateTimePicker';
2
+ export type { MPDateTimePickerProps } from './MPDateTimePicker';
@@ -0,0 +1 @@
1
+ export{MPDateTimePicker}from"./MPDateTimePicker";