material-plus-ui 0.0.1 → 1.0.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 (265) 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/aspect-ratio/MPAspectRatio.d.ts +69 -0
  11. package/dist/components/aspect-ratio/MPAspectRatio.js +1 -0
  12. package/dist/components/aspect-ratio/index.d.ts +2 -0
  13. package/dist/components/aspect-ratio/index.js +1 -0
  14. package/dist/components/avatar/MPAvatar.d.ts +97 -0
  15. package/dist/components/avatar/MPAvatar.js +1 -0
  16. package/dist/components/avatar/index.d.ts +2 -0
  17. package/dist/components/avatar/index.js +1 -0
  18. package/dist/components/badge/MPBadge.d.ts +104 -0
  19. package/dist/components/badge/MPBadge.js +1 -0
  20. package/dist/components/badge/index.d.ts +2 -0
  21. package/dist/components/badge/index.js +1 -0
  22. package/dist/components/blockquote/MPBlockquote.d.ts +73 -0
  23. package/dist/components/blockquote/MPBlockquote.js +1 -0
  24. package/dist/components/blockquote/index.d.ts +2 -0
  25. package/dist/components/blockquote/index.js +1 -0
  26. package/dist/components/box/MPBox.d.ts +78 -0
  27. package/dist/components/box/MPBox.js +1 -0
  28. package/dist/components/box/index.d.ts +2 -0
  29. package/dist/components/box/index.js +1 -0
  30. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +105 -0
  31. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -0
  32. package/dist/components/breadcrumb/index.d.ts +2 -0
  33. package/dist/components/breadcrumb/index.js +1 -0
  34. package/dist/components/button/MPButton.d.ts +70 -0
  35. package/dist/components/button/MPButton.js +1 -0
  36. package/dist/components/button/index.d.ts +2 -0
  37. package/dist/components/button/index.js +1 -0
  38. package/dist/components/button-group/MPButtonGroup.d.ts +31 -0
  39. package/dist/components/button-group/MPButtonGroup.js +1 -0
  40. package/dist/components/button-group/index.d.ts +2 -0
  41. package/dist/components/button-group/index.js +1 -0
  42. package/dist/components/card/MPCard.d.ts +73 -0
  43. package/dist/components/card/MPCard.js +1 -0
  44. package/dist/components/card/index.d.ts +2 -0
  45. package/dist/components/card/index.js +1 -0
  46. package/dist/components/carousel/MPCarousel.d.ts +116 -0
  47. package/dist/components/carousel/MPCarousel.js +1 -0
  48. package/dist/components/carousel/index.d.ts +2 -0
  49. package/dist/components/carousel/index.js +1 -0
  50. package/dist/components/chat-bubble/MPChatBubble.d.ts +132 -0
  51. package/dist/components/chat-bubble/MPChatBubble.js +1 -0
  52. package/dist/components/chat-bubble/index.d.ts +2 -0
  53. package/dist/components/chat-bubble/index.js +1 -0
  54. package/dist/components/checkbox/MPCheckbox.d.ts +76 -0
  55. package/dist/components/checkbox/MPCheckbox.js +1 -0
  56. package/dist/components/checkbox/index.d.ts +2 -0
  57. package/dist/components/checkbox/index.js +1 -0
  58. package/dist/components/chip/MPChip.d.ts +64 -0
  59. package/dist/components/chip/MPChip.js +1 -0
  60. package/dist/components/chip/index.d.ts +2 -0
  61. package/dist/components/chip/index.js +1 -0
  62. package/dist/components/collapsible/MPCollapsible.d.ts +97 -0
  63. package/dist/components/collapsible/MPCollapsible.js +1 -0
  64. package/dist/components/collapsible/index.d.ts +2 -0
  65. package/dist/components/collapsible/index.js +1 -0
  66. package/dist/components/color-picker/MPColorPicker.d.ts +113 -0
  67. package/dist/components/color-picker/MPColorPicker.js +1 -0
  68. package/dist/components/color-picker/index.d.ts +2 -0
  69. package/dist/components/color-picker/index.js +1 -0
  70. package/dist/components/combobox/MPCombobox.d.ts +147 -0
  71. package/dist/components/combobox/MPCombobox.js +1 -0
  72. package/dist/components/combobox/index.d.ts +2 -0
  73. package/dist/components/combobox/index.js +1 -0
  74. package/dist/components/date-picker/MPDatePicker.d.ts +95 -0
  75. package/dist/components/date-picker/MPDatePicker.js +1 -0
  76. package/dist/components/date-picker/index.d.ts +2 -0
  77. package/dist/components/date-picker/index.js +1 -0
  78. package/dist/components/date-range-picker/MPDateRangePicker.d.ts +98 -0
  79. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -0
  80. package/dist/components/date-range-picker/index.d.ts +2 -0
  81. package/dist/components/date-range-picker/index.js +1 -0
  82. package/dist/components/date-time-picker/MPDateTimePicker.d.ts +78 -0
  83. package/dist/components/date-time-picker/MPDateTimePicker.js +1 -0
  84. package/dist/components/date-time-picker/index.d.ts +2 -0
  85. package/dist/components/date-time-picker/index.js +1 -0
  86. package/dist/components/dialog/MPDialog.d.ts +145 -0
  87. package/dist/components/dialog/MPDialog.js +1 -0
  88. package/dist/components/dialog/index.d.ts +2 -0
  89. package/dist/components/dialog/index.js +1 -0
  90. package/dist/components/divider/MPDivider.d.ts +80 -0
  91. package/dist/components/divider/MPDivider.js +1 -0
  92. package/dist/components/divider/index.d.ts +2 -0
  93. package/dist/components/divider/index.js +1 -0
  94. package/dist/components/drawer/MPDrawer.d.ts +163 -0
  95. package/dist/components/drawer/MPDrawer.js +1 -0
  96. package/dist/components/drawer/index.d.ts +2 -0
  97. package/dist/components/drawer/index.js +1 -0
  98. package/dist/components/empty/MPEmpty.d.ts +64 -0
  99. package/dist/components/empty/MPEmpty.js +1 -0
  100. package/dist/components/empty/index.d.ts +2 -0
  101. package/dist/components/empty/index.js +1 -0
  102. package/dist/components/file-picker/MPFilePicker.d.ts +103 -0
  103. package/dist/components/file-picker/MPFilePicker.js +1 -0
  104. package/dist/components/file-picker/index.d.ts +2 -0
  105. package/dist/components/file-picker/index.js +1 -0
  106. package/dist/components/highlight/MPHighlight.d.ts +95 -0
  107. package/dist/components/highlight/MPHighlight.js +1 -0
  108. package/dist/components/highlight/index.d.ts +2 -0
  109. package/dist/components/highlight/index.js +1 -0
  110. package/dist/components/icon-button/MPIconButton.d.ts +59 -0
  111. package/dist/components/icon-button/MPIconButton.js +1 -0
  112. package/dist/components/icon-button/index.d.ts +2 -0
  113. package/dist/components/icon-button/index.js +1 -0
  114. package/dist/components/list/MPList.d.ts +96 -0
  115. package/dist/components/list/MPList.js +1 -0
  116. package/dist/components/list/index.d.ts +2 -0
  117. package/dist/components/list/index.js +1 -0
  118. package/dist/components/locale/MPLocaleProvider.d.ts +63 -0
  119. package/dist/components/locale/MPLocaleProvider.js +1 -0
  120. package/dist/components/locale/index.d.ts +2 -0
  121. package/dist/components/locale/index.js +1 -0
  122. package/dist/components/menu/MPMenu.d.ts +223 -0
  123. package/dist/components/menu/MPMenu.js +1 -0
  124. package/dist/components/menu/index.d.ts +2 -0
  125. package/dist/components/menu/index.js +1 -0
  126. package/dist/components/number-field/MPNumberField.d.ts +99 -0
  127. package/dist/components/number-field/MPNumberField.js +1 -0
  128. package/dist/components/number-field/index.d.ts +2 -0
  129. package/dist/components/number-field/index.js +1 -0
  130. package/dist/components/otp-field/MPOtpField.d.ts +89 -0
  131. package/dist/components/otp-field/MPOtpField.js +1 -0
  132. package/dist/components/otp-field/index.d.ts +2 -0
  133. package/dist/components/otp-field/index.js +1 -0
  134. package/dist/components/overlay/MPOverlay.d.ts +96 -0
  135. package/dist/components/overlay/MPOverlay.js +1 -0
  136. package/dist/components/overlay/index.d.ts +2 -0
  137. package/dist/components/overlay/index.js +1 -0
  138. package/dist/components/panes/MPPanes.d.ts +100 -0
  139. package/dist/components/panes/MPPanes.js +1 -0
  140. package/dist/components/panes/index.d.ts +2 -0
  141. package/dist/components/panes/index.js +1 -0
  142. package/dist/components/pill/MPPill.d.ts +117 -0
  143. package/dist/components/pill/MPPill.js +1 -0
  144. package/dist/components/pill/index.d.ts +2 -0
  145. package/dist/components/pill/index.js +1 -0
  146. package/dist/components/popover/MPPopover.d.ts +138 -0
  147. package/dist/components/popover/MPPopover.js +1 -0
  148. package/dist/components/popover/index.d.ts +2 -0
  149. package/dist/components/popover/index.js +1 -0
  150. package/dist/components/progress-box/MPProgressBox.d.ts +40 -0
  151. package/dist/components/progress-box/MPProgressBox.js +1 -0
  152. package/dist/components/progress-box/index.d.ts +2 -0
  153. package/dist/components/progress-box/index.js +1 -0
  154. package/dist/components/progress-circular/MPProgressCircular.d.ts +32 -0
  155. package/dist/components/progress-circular/MPProgressCircular.js +1 -0
  156. package/dist/components/progress-circular/index.d.ts +2 -0
  157. package/dist/components/progress-circular/index.js +1 -0
  158. package/dist/components/progress-linear/MPProgressLinear.d.ts +32 -0
  159. package/dist/components/progress-linear/MPProgressLinear.js +1 -0
  160. package/dist/components/progress-linear/index.d.ts +2 -0
  161. package/dist/components/progress-linear/index.js +1 -0
  162. package/dist/components/radio-group/MPRadioGroup.d.ts +81 -0
  163. package/dist/components/radio-group/MPRadioGroup.js +1 -0
  164. package/dist/components/radio-group/index.d.ts +2 -0
  165. package/dist/components/radio-group/index.js +1 -0
  166. package/dist/components/segmented-button/MPSegmentedButton.d.ts +75 -0
  167. package/dist/components/segmented-button/MPSegmentedButton.js +1 -0
  168. package/dist/components/segmented-button/index.d.ts +2 -0
  169. package/dist/components/segmented-button/index.js +1 -0
  170. package/dist/components/select/MPSelect.d.ts +86 -0
  171. package/dist/components/select/MPSelect.js +1 -0
  172. package/dist/components/select/index.d.ts +2 -0
  173. package/dist/components/select/index.js +1 -0
  174. package/dist/components/shortcut/MPShortcut.d.ts +67 -0
  175. package/dist/components/shortcut/MPShortcut.js +1 -0
  176. package/dist/components/shortcut/index.d.ts +2 -0
  177. package/dist/components/shortcut/index.js +1 -0
  178. package/dist/components/skeleton/MPSkeleton.d.ts +76 -0
  179. package/dist/components/skeleton/MPSkeleton.js +1 -0
  180. package/dist/components/skeleton/index.d.ts +2 -0
  181. package/dist/components/skeleton/index.js +1 -0
  182. package/dist/components/slider/MPSlider.d.ts +77 -0
  183. package/dist/components/slider/MPSlider.js +1 -0
  184. package/dist/components/slider/index.d.ts +2 -0
  185. package/dist/components/slider/index.js +1 -0
  186. package/dist/components/snackbar/MPSnackbar.d.ts +170 -0
  187. package/dist/components/snackbar/MPSnackbar.js +1 -0
  188. package/dist/components/snackbar/index.d.ts +2 -0
  189. package/dist/components/snackbar/index.js +1 -0
  190. package/dist/components/spoiler/MPSpoiler.d.ts +106 -0
  191. package/dist/components/spoiler/MPSpoiler.js +1 -0
  192. package/dist/components/spoiler/index.d.ts +2 -0
  193. package/dist/components/spoiler/index.js +1 -0
  194. package/dist/components/switch/MPSwitch.d.ts +75 -0
  195. package/dist/components/switch/MPSwitch.js +1 -0
  196. package/dist/components/switch/index.d.ts +2 -0
  197. package/dist/components/switch/index.js +1 -0
  198. package/dist/components/table/MPTable.d.ts +107 -0
  199. package/dist/components/table/MPTable.js +1 -0
  200. package/dist/components/table/index.d.ts +2 -0
  201. package/dist/components/table/index.js +1 -0
  202. package/dist/components/text-field/MPTextField.d.ts +17 -18
  203. package/dist/components/text-field/MPTextField.js +1 -1
  204. package/dist/components/text-link/MPTextLink.d.ts +88 -0
  205. package/dist/components/text-link/MPTextLink.js +1 -0
  206. package/dist/components/text-link/index.d.ts +2 -0
  207. package/dist/components/text-link/index.js +1 -0
  208. package/dist/components/time-picker/MPTimePicker.d.ts +108 -0
  209. package/dist/components/time-picker/MPTimePicker.js +1 -0
  210. package/dist/components/time-picker/index.d.ts +2 -0
  211. package/dist/components/time-picker/index.js +1 -0
  212. package/dist/components/timeline/MPTimeline.d.ts +96 -0
  213. package/dist/components/timeline/MPTimeline.js +1 -0
  214. package/dist/components/timeline/index.d.ts +2 -0
  215. package/dist/components/timeline/index.js +1 -0
  216. package/dist/components/tooltip/MPTooltip.d.ts +117 -0
  217. package/dist/components/tooltip/MPTooltip.js +1 -0
  218. package/dist/components/tooltip/index.d.ts +2 -0
  219. package/dist/components/tooltip/index.js +1 -0
  220. package/dist/components/typography/MPTypography.d.ts +94 -0
  221. package/dist/components/typography/MPTypography.js +1 -0
  222. package/dist/components/typography/index.d.ts +2 -0
  223. package/dist/components/typography/index.js +1 -0
  224. package/dist/constants/icons.d.ts +36 -0
  225. package/dist/constants/icons.js +1 -1
  226. package/dist/index.d.ts +55 -0
  227. package/dist/index.js +1 -1
  228. package/dist/internal/Calendar.d.ts +118 -0
  229. package/dist/internal/Calendar.js +1 -0
  230. package/dist/internal/FieldOutline.d.ts +38 -0
  231. package/dist/internal/FieldOutline.js +1 -0
  232. package/dist/internal/Picker.d.ts +110 -0
  233. package/dist/internal/Picker.js +1 -0
  234. package/dist/internal/StateLayer.d.ts +45 -0
  235. package/dist/internal/StateLayer.js +1 -0
  236. package/dist/internal/SupportingText.d.ts +23 -0
  237. package/dist/internal/SupportingText.js +1 -0
  238. package/dist/internal/WidthSizer.d.ts +31 -0
  239. package/dist/internal/WidthSizer.js +1 -0
  240. package/dist/internal/accent.d.ts +39 -0
  241. package/dist/internal/accent.js +1 -0
  242. package/dist/internal/button-group.d.ts +21 -0
  243. package/dist/internal/button-group.js +1 -0
  244. package/dist/internal/color.d.ts +125 -0
  245. package/dist/internal/color.js +1 -0
  246. package/dist/internal/date.d.ts +179 -0
  247. package/dist/internal/date.js +1 -0
  248. package/dist/internal/i18n.d.ts +131 -0
  249. package/dist/internal/i18n.js +1 -0
  250. package/dist/internal/locale.d.ts +43 -0
  251. package/dist/internal/locale.js +1 -0
  252. package/dist/internal/menu.d.ts +23 -0
  253. package/dist/internal/menu.js +1 -0
  254. package/dist/internal/progress.d.ts +126 -0
  255. package/dist/internal/progress.js +1 -0
  256. package/dist/internal/scale.d.ts +127 -0
  257. package/dist/internal/scale.js +1 -0
  258. package/dist/internal/surface.d.ts +76 -0
  259. package/dist/internal/surface.js +1 -0
  260. package/dist/internal/visually-hidden.d.ts +23 -0
  261. package/dist/internal/visually-hidden.js +1 -0
  262. package/dist/styles.css +1 -1
  263. package/dist/tailwind.css +1285 -20
  264. package/dist/types.d.ts +107 -16
  265. package/package.json +16 -21
@@ -0,0 +1,113 @@
1
+ import * as React from 'react';
2
+ import type { MPColorFormat } from '../../internal/color';
3
+ import type { MPStyleProps } from '../../types';
4
+ /** The names for the parts of the picker that have no text on them. */
5
+ export interface MPColorPickerLabels {
6
+ /** The saturation/brightness square. */
7
+ area: string;
8
+ /** The hue rail beside it. */
9
+ hue: string;
10
+ /** The opacity rail, when `alpha` is on. */
11
+ alpha: string;
12
+ /** The field the value can be typed into. */
13
+ value: string;
14
+ /** The grid of ready-made colours. */
15
+ swatches: string;
16
+ /** The × that empties the control. */
17
+ clear: string;
18
+ /** What the trigger reads before anything has been chosen. */
19
+ empty: string;
20
+ }
21
+ export interface MPColorPickerProps extends MPStyleProps {
22
+ /** The colour, as a CSS string. Pass it to drive the picker yourself. */
23
+ value?: string;
24
+ /** Where an uncontrolled picker starts. @default '#00639b' */
25
+ defaultValue?: string;
26
+ /** Called with the new colour, written in `format`. */
27
+ onValueChange?: (value: string) => void;
28
+ /**
29
+ * Which notation the value is written in on the way out.
30
+ * @default 'hex'
31
+ */
32
+ format?: MPColorFormat;
33
+ /**
34
+ * Offers an opacity rail, and lets the value carry a fourth channel.
35
+ * @default false
36
+ */
37
+ alpha?: boolean;
38
+ /**
39
+ * The ready-made colours under the panel. `false` draws none; an array of CSS
40
+ * colour strings replaces the built-in set.
41
+ */
42
+ swatches?: readonly string[] | false;
43
+ /**
44
+ * Draws the panel in the page instead of in a popup, with no trigger.
45
+ * @default false
46
+ */
47
+ inline?: boolean;
48
+ /**
49
+ * The field under the panel the value can be typed into.
50
+ * @default true
51
+ */
52
+ editable?: boolean;
53
+ /** Label in the outline's notch, or above the panel when `inline`. */
54
+ label?: React.ReactNode;
55
+ /** The line under the control. Replaced by `errorMessage` when there is one. */
56
+ description?: React.ReactNode;
57
+ /**
58
+ * The message under the control. Its presence is also what puts the picker into
59
+ * its error state.
60
+ */
61
+ errorMessage?: React.ReactNode;
62
+ /** Marks the control required, both to assistive technology and to the label. */
63
+ required?: boolean;
64
+ /** Greys the control out and stops it opening. */
65
+ disabled?: boolean;
66
+ /** Shows the colour without allowing it to change, and stays focusable. */
67
+ readOnly?: boolean;
68
+ /** Offers the × that empties the control. @default false */
69
+ clearable?: boolean;
70
+ /** Name of the form control. Submits the value as written in `format`. */
71
+ name?: string;
72
+ /** Whether the popup is open. Use with `onOpenChange` for a controlled popup. */
73
+ open?: boolean;
74
+ /** Whether it starts open. @default false */
75
+ defaultOpen?: boolean;
76
+ onOpenChange?: (open: boolean) => void;
77
+ /** Overrides for the accessible names, one at a time. */
78
+ labels?: Partial<MPColorPickerLabels>;
79
+ /**
80
+ * The id put on the trigger and pointed at by the label. Derived from `name`
81
+ * when omitted, and generated when there is no name either.
82
+ */
83
+ id?: string;
84
+ className?: string;
85
+ style?: React.CSSProperties;
86
+ }
87
+ /**
88
+ * A colour, chosen by eye.
89
+ *
90
+ * A saturation square with a hue rail beside it — the arrangement every design
91
+ * tool has settled on, because it is the one that puts every colour of a hue
92
+ * within a single movement of the pointer. `alpha` adds a third rail, `format`
93
+ * decides which notation comes back out, and `swatches` puts the handful of
94
+ * colours a product actually uses one click away.
95
+ *
96
+ * The trigger is `MPTextField`'s shell wearing a swatch, so a picker in a form is
97
+ * the same object as the fields around it — the same notched outline, the same
98
+ * label in the notch, the same supporting text underneath.
99
+ *
100
+ * ## Why the panel's state is HSV
101
+ *
102
+ * It never leaves that model, which is what keeps the hue rail still while the
103
+ * pointer is in the black corner: through RGB, every shade of black is the same
104
+ * colour and the rail would snap to red the moment the square bottomed out.
105
+ *
106
+ * ## This is not the theme
107
+ *
108
+ * A colour chosen here is *data* — a tag's colour, a calendar's, a project's. It
109
+ * is not `--mp-source-color`, and the picker deliberately does not offer the
110
+ * scheme's four families as swatches: those are roles that mean something, and
111
+ * they move when somebody re-themes the application.
112
+ */
113
+ export declare const MPColorPicker: React.ForwardRefExoticComponent<MPColorPickerProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Field as n}from"@base-ui/react/field";import{Popover as l}from"@base-ui/react/popover";import{MPIcon as t}from"../icon/MPIcon";import{CheckIcon as o,CloseIcon as i}from"../../constants/icons";import{MPFieldLabel as s,MPFieldOutline as u}from"../../internal/FieldOutline";import{MPStateLayer as c}from"../../internal/StateLayer";import{MPSupportingText as d}from"../../internal/SupportingText";import{CONTROL_ICON as p,META_TEXT as h,PROSE_TEXT as f,STACK_GAP as m,hasContent as g}from"../../internal/scale";import{FADE as v,PORTAL_LAYER as b}from"../../internal/surface";import{CHECKER_BACKGROUND as x,DEFAULT_SWATCHES as y,clamp as w,cssColor as N,formatColor as k,parseColor as C,readableInk as j}from"../../internal/color";const _={area:"Saturation and brightness",hue:"Hue",alpha:"Opacity",value:"Colour value",swatches:"Swatches",clear:"Clear",empty:"No colour"},z={xs:"w-40",sm:"w-44",md:"w-52",lg:"w-60",xl:"w-72"},$={xs:"h-24",sm:"h-28",md:"h-32",lg:"h-40",xl:"h-48"},M={xs:"h-2.5",sm:"h-3",md:"h-3.5",lg:"h-4",xl:"h-5"},P={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"},T={xs:12,sm:14,md:16,lg:18,xl:20},I={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}},O="border-mp-outline-variant relative overflow-hidden border",S=["pointer-events-none absolute rounded-full border-2 border-white","[box-shadow:0_0_0_1px_rgb(0_0_0/0.35),0_1px_3px_rgb(0_0_0/0.4)]"].join(" ");function A(e){const a=e.currentTarget.getBoundingClientRect();return{x:0===a.width?0:w((e.clientX-a.left)/a.width,0,1),y:0===a.height?0:w((e.clientY-a.top)/a.height,0,1)}}function B(e){const a=e.shiftKey?10:1;switch(e.key){case"ArrowLeft":return{x:-a,y:0};case"ArrowRight":return{x:a,y:0};case"ArrowUp":return{x:0,y:a};case"ArrowDown":return{x:0,y:-a};default:return null}}function D({hsv:r,alphaValue:n,onChange:l,text:i,onTextChange:s,withAlpha:u,swatches:c,editable:d,size:p,inert:f,labels:m}){const g=T[p],v=-g/2,b=N({h:r.h,s:100,v:100}),y=N(r),_=e=>({onPointerDown:a=>{f||(a.currentTarget.setPointerCapture(a.pointerId),e(a))},onPointerMove:a=>{!f&&a.currentTarget.hasPointerCapture(a.pointerId)&&e(a)}}),I=(e,a,r,n)=>({role:"slider",tabIndex:f?-1:0,"aria-label":e,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":Math.round(a),"aria-orientation":"horizontal","aria-disabled":f||void 0,onKeyDown:e=>{const a=B(e);!f&&a&&0!==a.x&&(e.preventDefault(),n(a.x))}}),D=["outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ");return a("div",{className:`mp-color-picker__panel flex flex-col ${z[p]} ${P[p]}`,children:[e("div",{..._(e=>{const{x:a,y:t}=A(e);l({hsv:{h:r.h,s:100*a,v:100*(1-t)},alpha:n})}),role:"slider",tabIndex:f?-1:0,"aria-label":m.area,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(r.s),"aria-valuetext":`${Math.round(r.s)}%, ${Math.round(r.v)}%`,"aria-disabled":f||void 0,onKeyDown:e=>{const a=B(e);!f&&a&&(e.preventDefault(),l({hsv:{h:r.h,s:w(r.s+a.x,0,100),v:w(r.v+a.y,0,100)},alpha:n}))},className:[O,"rounded-mp-sm",$[p],D,f?"cursor-default":"cursor-crosshair touch-none"].join(" "),style:{backgroundColor:b,backgroundImage:"linear-gradient(to top, #000000, rgb(0 0 0 / 0)), linear-gradient(to right, #ffffff, rgb(255 255 255 / 0))"},children:e("span",{className:S,style:{width:g,height:g,left:`${r.s}%`,top:100-r.v+"%",marginLeft:v,marginTop:v,backgroundColor:y}})}),e("div",{..._(e=>l({hsv:{...r,h:360*A(e).x},alpha:n})),...I(m.hue,r.h,360,e=>l({hsv:{...r,h:(r.h+2*e+360)%360},alpha:n})),className:[O,"rounded-mp-full",M[p],D,f?"cursor-default":"cursor-pointer touch-none"].join(" "),style:{backgroundImage:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)"},children:e("span",{className:S,style:{width:g,height:g,left:r.h/360*100+"%",top:"50%",marginLeft:v,marginTop:v,backgroundColor:b}})}),u?a("div",{..._(e=>l({hsv:r,alpha:A(e).x})),...I(m.alpha,100*n,100,e=>l({hsv:r,alpha:w(n+e/100,0,1)})),className:[O,"rounded-mp-full",M[p],D,f?"cursor-default":"cursor-pointer touch-none"].join(" "),style:x,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundImage:`linear-gradient(to right, ${N(r,0)}, ${y})`}}),e("span",{className:S,style:{width:g,height:g,left:100*n+"%",top:"50%",marginLeft:v,marginTop:v,backgroundColor:N(r,n)}})]}):null,d?a("div",{className:`flex items-center ${P[p]}`,children:[e("span",{"aria-hidden":"true",className:"border-mp-outline-variant shrink-0 rounded-full border",style:{width:g+8,height:g+8,...x},children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:N(r,n)}})}),e("input",{type:"text",value:i,readOnly:f,spellCheck:!1,autoComplete:"off","aria-label":m.value,onChange:e=>s(e.target.value),className:["rounded-mp-xs border-mp-outline text-mp-on-surface min-w-0 flex-1 border","bg-transparent px-2 py-1 font-mono lowercase",h,"focus-visible:border-mp-primary outline-none"].join(" ")})]}):null,c&&c.length>0?e("div",{role:"group","aria-label":m.swatches,className:"grid grid-cols-8 gap-1",children:c.map(a=>{const i=C(a),s=null!==i&&k(i.hsv,i.alpha,"hex")===k(r,n,"hex");return e("button",{type:"button",disabled:f,"aria-label":a,"aria-pressed":s,onClick:()=>{i&&l(i)},className:["border-mp-outline-variant flex aspect-square items-center justify-center","rounded-full border",D,f?"cursor-default":"hover:shadow-mp-1 cursor-pointer"].join(" "),style:{backgroundColor:a},children:s&&i?e("span",{style:{color:j(i.hsv)},children:e(t,{icon:o,size:12})}):null},a)})}):null]})}const L={h:202,s:100,v:61};export const MPColorPicker=r.forwardRef(function({value:o,defaultValue:w="#00639b",onValueChange:j,format:z="hex",alpha:$=!1,swatches:M=y,inline:P=!1,editable:T=!0,label:O,description:S,errorMessage:A,required:B=!1,disabled:R=!1,readOnly:q=!1,clearable:V=!1,name:K,open:F,defaultOpen:E=!1,onOpenChange:H,labels:U,size:W="md",fullWidth:X=!1,id:Y,className:G,style:J},Q){const Z=r.useMemo(()=>({..._,...U}),[U]),ee=g(A),ae=I[W],re=r.useId(),ne=Y??`mp-color-picker-${K??re}`,[le,te]=r.useState(w),oe=o??le,[ie,se]=r.useState(E),ue=F??ie,[ce,de]=r.useState(()=>C(oe)??{hsv:L,alpha:1}),[pe,he]=r.useState(()=>oe),fe=k(ce.hsv,$?ce.alpha:1,z),me=""===oe;r.useEffect(()=>{const e=C(oe);e?k(e.hsv,$?e.alpha:1,z)!==fe&&(he(oe),de(e)):he(oe)},[oe,fe,$,z]);const ge=R||q,ve=V&&!ge&&!me,be=(e,a)=>{de(e);const r=k(e.hsv,$?e.alpha:1,z);he(a??r),void 0===o&&te(r),j?.(r)},xe=e(D,{hsv:ce.hsv,alphaValue:ce.alpha,onChange:be,text:pe,onTextChange:e=>{he(e);const a=C(e);a&&be(a,e)},withAlpha:$,swatches:M,editable:T,size:W,inert:ge,labels:Z}),ye=e("span",{"aria-hidden":"true",className:"border-mp-outline-variant block size-5 shrink-0 rounded-full border",style:x,children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:me?"transparent":N(ce.hsv,$?ce.alpha:1)}})}),we=K?e("input",{type:"hidden",name:K,value:me?"":fe}):null;return P?a("div",{ref:Q,"data-mp-size":W,className:["mp-color-picker flex flex-col",m[W],G??""].filter(Boolean).join(" "),style:J,children:[g(O)?a("span",{className:[h,R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:[O,B?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,xe,g(A)?e("span",{className:`${h} text-mp-error`,children:A}):g(S)?e("span",{className:`${h} text-mp-on-surface-variant`,children:S}):null,we]}):a(n.Root,{ref:Q,disabled:R,invalid:ee,"data-mp-size":W,className:["mp-color-picker group flex-col align-top",X?"flex w-full":"inline-flex w-fit",G??""].filter(Boolean).join(" "),style:J,children:[a(l.Root,{open:ue,onOpenChange:e=>{void 0===F&&se(e),H?.(e)},children:[a("div",{className:"relative w-full",children:[a(l.Trigger,{id:ne,disabled:R,nativeButton:!0,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",ae.padding,ve?"pe-10":"",ae.height,f[W],R?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(q?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[ye,e("span",{className:["min-w-0 flex-1 truncate text-start",me?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:me?Z.empty:fe})]}),ve?a("button",{type:"button","aria-label":Z.clear,onClick:()=>{void 0===o&&te(""),he(""),j?.("")},className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(c,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(t,{icon:i,size:p[W]})]}):null,e(u,{label:O,required:B}),g(O)?e(s,{size:W,label:O,required:B,htmlFor:ne}):null]}),e(l.Portal,{children:e(l.Positioner,{className:b,sideOffset:4,align:"start",children:e(l.Popup,{className:["mp-color-picker__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container","text-mp-on-surface p-3 outline-none",f[W],v].join(" "),children:xe})})})]}),e(d,{description:S,errorMessage:A,className:ae.padding}),we]})});
@@ -0,0 +1,2 @@
1
+ export { MPColorPicker } from './MPColorPicker';
2
+ export type { MPColorPickerLabels, MPColorPickerProps } from './MPColorPicker';
@@ -0,0 +1 @@
1
+ export{MPColorPicker}from"./MPColorPicker";
@@ -0,0 +1,147 @@
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
+ /** Shown in the input while nothing is typed. */
73
+ placeholder?: string;
74
+ /**
75
+ * Label in the outline's notch. Always drawn there rather than floating over
76
+ * the placeholder, so a combobox and a text field sit at the same height in a
77
+ * form.
78
+ */
79
+ label?: React.ReactNode;
80
+ /** The line under the control. Replaced by `errorMessage` when there is one. */
81
+ description?: React.ReactNode;
82
+ /**
83
+ * The message under the control. Its presence is also what puts the combobox
84
+ * into its error state.
85
+ */
86
+ errorMessage?: React.ReactNode;
87
+ /** Content placed before the input — an `MPIcon`, usually. */
88
+ startIcon?: React.ReactNode;
89
+ /** Marks the combobox required, both to assistive technology and to the label. */
90
+ required?: boolean;
91
+ /** Greys the control out and stops it taking input. */
92
+ disabled?: boolean;
93
+ /** Shows the value without allowing it to be changed, and stays focusable. */
94
+ readOnly?: boolean;
95
+ /** Name of the form control. */
96
+ name?: string;
97
+ /** The popup is open. Use with `onOpenChange` for a controlled popup. */
98
+ open?: boolean;
99
+ /** Whether the popup starts open. */
100
+ defaultOpen?: boolean;
101
+ onOpenChange?: (open: boolean) => void;
102
+ /** Accessible name of the clear button. @default 'Clear' */
103
+ clearLabel?: string;
104
+ /**
105
+ * Accessible name of the chevron that opens the list, **for a combobox with no
106
+ * `label`**.
107
+ *
108
+ * With a label, Base UI names the chevron after the field itself and that name
109
+ * wins — `aria-labelledby` outranks `aria-label` — which is the right answer:
110
+ * a button called "Fruit" beside a field called "Fruit" is the button that
111
+ * opens that field. This is the fallback for the unlabelled case, where the
112
+ * chevron would otherwise be a button with a glyph in it and no name at all.
113
+ * @default 'Open'
114
+ */
115
+ openLabel?: string;
116
+ /** Accessible name of a chip's remove button. Receives the chip's label. */
117
+ removeLabel?: (label: string) => string;
118
+ /** A ref to the text input the reader types into. */
119
+ inputRef?: React.Ref<HTMLInputElement>;
120
+ /**
121
+ * The id put on the input and pointed at by the label. Derived from `name` when
122
+ * omitted, and generated when there is no name either.
123
+ */
124
+ id?: string;
125
+ className?: string;
126
+ style?: React.CSSProperties;
127
+ }
128
+ /**
129
+ * A field you can type into and also choose from.
130
+ *
131
+ * The shell is `MPTextField`'s wearing a chevron, exactly as `MPSelect`'s trigger
132
+ * is — the three have to be indistinguishable in a form, or the form looks
133
+ * assembled rather than designed. What is different is what the text does: it
134
+ * filters the list, and — unless `allowCustom` is off — it can become the value
135
+ * itself, offered as the last row rather than committed silently on blur.
136
+ *
137
+ * With `multiple` the chosen values become chips inside the field and the input
138
+ * goes on filtering after each one, so a set of tags is built without the field
139
+ * ever closing.
140
+ *
141
+ * Base UI owns everything hard about this: the filtering and its collator, the
142
+ * popup's positioning and flipping, the `combobox`/`listbox` wiring, arrow-key
143
+ * navigation across both the list and the chips, and the hidden input that makes
144
+ * the whole thing submit with a form.
145
+ */
146
+ export declare function MPCombobox<Multiple extends boolean | undefined = false>({ items, multiple, value, defaultValue, onValueChange, onInputValueChange, allowCustom, customLabel, clearable, emptyMessage, limit, placeholder, label, description, errorMessage, startIcon, size, fullWidth, required, disabled, readOnly, name, open, defaultOpen, onOpenChange, clearLabel, openLabel, removeLabel, inputRef, id, className, style }: MPComboboxProps<Multiple>): React.JSX.Element;
147
+ 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 p}from"../../internal/FieldOutline";import{MPStateLayer as d}from"../../internal/StateLayer";import{MPSupportingText as h}from"../../internal/SupportingText";import{CONTROL_ICON as f,PROSE_TEXT as b,hasContent as g}from"../../internal/scale";import{FADE as x,PORTAL_LAYER as v}from"../../internal/surface";const y={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"}},C={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"},N={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function w(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:L,multiple:j,value:I,defaultValue:S,onValueChange:z,onInputValueChange:O,allowCustom:M=!0,customLabel:V,clearable:$=!1,emptyMessage:P="No matches",limit:q,placeholder:A,label:R,description:T,errorMessage:k,startIcon:_,size:F="md",fullWidth:E=!1,required:B=!1,disabled:G=!1,readOnly:H=!1,name:W,open:D,defaultOpen:J,onOpenChange:K,clearLabel:Q="Clear",openLabel:U="Open",removeLabel:X=e=>`Remove ${e}`,inputRef:Y,id:Z,className:ee,style:ae}){const le=g(k),ie=!0===j,ne=y[F],te=l.useId(),re=Z??`mp-combobox-${W??te}`,oe=l.useMemo(()=>L.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[L]),[se,me]=l.useState(()=>w(S)),ce=void 0===I?se:w(I),[ue,pe]=l.useState(""),de=l.useCallback(e=>oe.find(a=>a.value===e)??{value:e,label:String(e),custom:!0},[oe]),he=ue.trim(),fe=he.toLocaleLowerCase(),be=""===he||oe.some(e=>e.label.toLocaleLowerCase()===fe||String(e.value).toLocaleLowerCase()===fe)||ce.some(e=>String(e).toLocaleLowerCase()===fe),ge=!M||H||G||be?null:he,xe=l.useMemo(()=>null===ge?oe:[...oe,{value:ge,label:ge,custom:!0}],[oe,ge]),ve=ie?ce.map(de):ce.length>0?de(ce[0]):null;const ye=["min-w-0 flex-1 self-stretch bg-transparent font-[inherit] text-inherit outline-none","placeholder:text-mp-on-surface-variant",G?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Ce=["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(" "),Ne=a=>e(i.Input,{ref:Y,id:re,placeholder:A,className:ie?`${ye} min-w-16 ${a?"ms-1.5":""}`:ye});return a(n.Root,{disabled:G,invalid:le,"data-mp-size":F,className:["mp-combobox group flex-col align-top",E?"flex w-full":"inline-flex w-fit",ee??""].filter(Boolean).join(" "),style:ae,children:[a(i.Root,{name:W,items:xe,multiple:ie,value:ve,onValueChange:e=>{!function(e){void 0===I&&me(e),z?.(ie?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{pe(e),O?.(e)},open:D,defaultOpen:J,onOpenChange:e=>K?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:q,disabled:G,readOnly:H,required:B,children:[a("div",{className:"relative w-full",children:[a(i.InputGroup,{className:["relative flex w-full items-center gap-2",ne.padding,ie?C[F]:ne.height,b[F],G?"cursor-default":"cursor-text"].join(" "),children:[_?e("span",{className:["flex shrink-0 items-center",G?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:_}):null,ie?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:le?"outlined":"tonal",color:le?"error":"primary",size:N[F],disabled:G,endIcon:H||G?null:e(i.ChipRemove,{"aria-label":X(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))),Ne(n.length>0)]})})}):Ne(!1),$&&!H?a(i.Clear,{"aria-label":Q,className:Ce,children:[e(d,{}),e(r,{icon:c,size:f[F]})]}):null,a(i.Trigger,{"aria-label":U,className:Ce,children:[e(d,{}),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:f[F]})})]})]}),e(p,{label:R,required:B}),g(R)?e(u,{size:F,label:R,required:B,htmlFor:re}):null]}),e(i.Portal,{children:e(i.Positioner,{className:v,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",b[F],x].join(" "),children:[e(i.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:P}),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?V?V(l.label):`Add “${l.label}”`:l.label})]},`${l.custom?"custom:":""}${String(l.value)}`)})]})})})]}),e(h,{description:T,errorMessage:k,className:ne.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,95 @@
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
+ * @default { dateStyle: 'medium' }
43
+ */
44
+ format?: Intl.DateTimeFormatOptions;
45
+ /** Shown in the trigger while nothing is chosen. */
46
+ placeholder?: React.ReactNode;
47
+ /**
48
+ * Offers the × that empties the control.
49
+ * @default false
50
+ */
51
+ clearable?: boolean;
52
+ /**
53
+ * Offers the shortcut to today in the footer.
54
+ * @default true
55
+ */
56
+ showTodayButton?: boolean;
57
+ /**
58
+ * Closes the popup as soon as a day is chosen.
59
+ * @default true
60
+ */
61
+ closeOnSelect?: boolean;
62
+ /**
63
+ * Overrides for the words the picker says on its own behalf. Whatever is not
64
+ * given falls back to the translation for `locale`, and then to English.
65
+ */
66
+ labels?: Partial<MPPickerLabels>;
67
+ /** Identifies the field when a form is submitted, as `YYYY-MM-DD`. */
68
+ name?: string;
69
+ }
70
+ /**
71
+ * One day, chosen from a calendar.
72
+ *
73
+ * The trigger is a text field's shell wearing a calendar glyph, on purpose and
74
+ * for the reason `MPSelect`'s is: a form where the date field is a different
75
+ * height, radius or outline weight from the fields around it is a form that
76
+ * looks assembled rather than designed.
77
+ *
78
+ * What the calendar is actually for is its header. A picker that only steps a
79
+ * month at a time puts a birthday thirty years back a hundred and eighty clicks
80
+ * away, so the month name and the year are each a button that opens a grid of
81
+ * its own — twelve months, then twelve years at a time. Any month of the year on
82
+ * screen is two clicks; any year at all is three. That is MD3's own docked date
83
+ * picker, and this is drawn on MD3's own numbers: a 40dp cell, a filled circle
84
+ * for the chosen day, an outlined one for today.
85
+ *
86
+ * ## Every string comes from the platform
87
+ *
88
+ * The month names, the weekday initials, the order of the header's two buttons
89
+ * and the way the trigger writes the date are all `Intl`'s answers for `locale`
90
+ * — not a bundled table. Which day the week starts on is `Intl`'s too. The only
91
+ * words this library supplies are the ones `Intl` has no opinion about
92
+ * ("Previous month", "Today"), and those are translated for eighteen languages
93
+ * and overridable with `labels`.
94
+ */
95
+ 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}from"../../internal/Picker";import{useMPLocale as m,useMPMessages as d}from"../../internal/locale";import{CONTROL_ICON as u}from"../../internal/scale";import{displaySamples as p,formatDate as f,isDayOutside as h,isValidDate as b,localeWeekStart as x,mergeDateAndTime as v,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=d("picker",Y,G),$=E??x(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)?v(e,ae):D(e);se(a),re(g(a)),A&&ie(!1)},me=y(),de=h(me,I,V)||(B?.(me)??!1),ue=q||T,pe=l.useMemo(()=>C(p(Y,F),N),[Y,F,N]);return e(c,{...W,slug:"date-picker",size:J,color:K,readOnly:L,disabled:Q,name:H,triggerRef:X,startIcon:U??e(t,{icon:n,size:u[J]}),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:de,onClick:()=>ce(me),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}from"../../internal/Picker";import{useMPLocale as m,useMPMessages as d}from"../../internal/locale";import{MPWidthSizer as p}from"../../internal/WidthSizer";import{CONTROL_ICON as h,META_TEXT as f}from"../../internal/scale";import{addMonths as v,compareDay as x,displaySamples 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=m(W),ae=d("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=v(xe,1),De=2===q,ke=n.useMemo(()=>g(ne,_),[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]=x(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,name:Q,triggerRef:le,startIcon:Z??e(t,{icon:s,size:h[T]}),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(p,{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:h[T]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ce,G)}),e(p,{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(v(e,-1)),showPreviousButton:!1}):null]}),J||null!==Oe?l(c,{children:[null!==Oe?e("span",{className:`text-mp-on-surface-variant me-auto ${f}`,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 m,MPPickerShell as d}from"../../internal/Picker";import{useMPLocale as u,useMPMessages as h}from"../../internal/locale";import{CONTROL_ICON as p}from"../../internal/scale";import{displaySamples as f,formatDate as S,isDayOutside as b,isHour12 as g,isValidDate as D,localeWeekStart as v,mergeDateAndTime as x,startOfDay as C,startOfMonth as k,timeUnitSpan as w,toISODateTime as z,today as O,withPlaceholder as y,withTime as M}from"../../internal/date";export const MPDateTimePicker=t.forwardRef(function({value:T,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=u(A),se=h("picker",ie,$),ce=G??v(ie),me=J??g(ie),[de,ue]=t.useState(P??null),he=void 0!==T?T:de,[pe,fe]=t.useState(N??!1),Se=I??pe,[be,ge]=t.useState(()=>k(D(he)?he:B??O()));t.useEffect(()=>{Se&&ge(k(D(he)?he:B??O()))},[Se]);const De=e=>{e&&(te||le)||(void 0===I&&fe(e),V?.(e))},ve=e=>{void 0===T&&ue(e),j?.(e)},xe=t.useCallback((e,o)=>{const[t,l]=w(o,e),a=C(e).getTime();return!!(D(R)&&a+1e3*l<R.getTime())||(!!(D(E)&&a+1e3*t>E.getTime())||(q?.(e,o)??!1))},[R,E,q]),Ce=H??{dateStyle:"medium",timeStyle:"short",hour12:me},ke=new Date,we=M(ke,{seconds:K?ke.getSeconds():0}),ze=b(we,R,E)||(F?.(we)??!1)||xe(we,"second"),Oe=t.useMemo(()=>y(f(ie,Ce),W),[ie,Ce,W]);return e(d,{...ne,slug:"date-time-picker",size:ee,color:oe,readOnly:te,disabled:le,name:_,triggerRef:re,startIcon:ae??e(a,{icon:n,size:p[ee]}),display:D(he)?S(he,ie,Ce):W??"",samples:Oe,empty:!D(he),clearable:X,onClear:()=>ve(null),open:Se,onOpenChange:De,labels:se,hiddenValues:_?[{name:_,value:D(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=D(he)?x(e,he):C(e);ve(o),ge(k(o)),Z&&De(!1)},minDate:R,maxDate:E,shouldDisableDate:F,labels:se,autoFocus:!0}),e(c,{}),e(i,{size:ee,locale:ie,value:D(he)?he:null,referenceDate:D(he)?he:O(),onChange:ve,hour12:me,showSeconds:K,hourStep:L,minuteStep:Q,secondStep:U,shouldDisableTime:xe,labels:se})]}),o(m,{children:[X?e(l,{variant:"text",size:s[ee],color:oe,onClick:()=>{ve(null),De(!1)},children:se.clear}):null,Y?e(l,{variant:"text",size:s[ee],color:oe,disabled:ze,onClick:()=>{ve(we),ge(k(we))},children:se.now}):null,e(l,{variant:"filled",size:s[ee],color:oe,onClick:()=>De(!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";