material-plus-ui 1.4.0 → 1.6.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 (211) hide show
  1. package/.fix.py +92 -0
  2. package/README.md +1 -1
  3. package/dist/components/accordion/MPAccordion.js +1 -1
  4. package/dist/components/alert/MPAlert.js +1 -1
  5. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
  6. package/dist/components/aspect-ratio/MPAspectRatio.js +1 -1
  7. package/dist/components/avatar/MPAvatar.js +1 -1
  8. package/dist/components/avatar-group/MPAvatarGroup.js +1 -1
  9. package/dist/components/badge/MPBadge.js +1 -1
  10. package/dist/components/blockquote/MPBlockquote.js +1 -1
  11. package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +17 -0
  12. package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
  13. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  14. package/dist/components/button/MPButton.d.ts +49 -3
  15. package/dist/components/button/MPButton.js +1 -1
  16. package/dist/components/calendar/MPCalendar.d.ts +160 -0
  17. package/dist/components/calendar/MPCalendar.js +2 -0
  18. package/dist/components/calendar/index.d.ts +2 -0
  19. package/dist/components/calendar/index.js +1 -0
  20. package/dist/components/card/MPCard.js +1 -1
  21. package/dist/components/carousel/MPCarousel.js +1 -1
  22. package/dist/components/chat-bubble/MPChatBubble.js +1 -1
  23. package/dist/components/checkbox/MPCheckbox.d.ts +6 -0
  24. package/dist/components/checkbox/MPCheckbox.js +1 -1
  25. package/dist/components/chip/MPChip.d.ts +21 -6
  26. package/dist/components/chip/MPChip.js +1 -1
  27. package/dist/components/collapsible/MPCollapsible.js +1 -1
  28. package/dist/components/color-picker/MPColorPicker.js +1 -1
  29. package/dist/components/combobox/MPCombobox.d.ts +52 -3
  30. package/dist/components/combobox/MPCombobox.js +1 -1
  31. package/dist/components/command-palette/MPCommandPalette.d.ts +1 -1
  32. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  33. package/dist/components/config/MPConfigProvider.d.ts +124 -0
  34. package/dist/components/config/MPConfigProvider.js +2 -0
  35. package/dist/components/config/index.d.ts +2 -0
  36. package/dist/components/config/index.js +1 -0
  37. package/dist/components/confirm/MPConfirmProvider.d.ts +143 -0
  38. package/dist/components/confirm/MPConfirmProvider.js +2 -0
  39. package/dist/components/confirm/index.d.ts +2 -0
  40. package/dist/components/confirm/index.js +1 -0
  41. package/dist/components/container/MPContainer.js +1 -1
  42. package/dist/components/date-picker/MPDatePicker.d.ts +53 -2
  43. package/dist/components/date-picker/MPDatePicker.js +1 -1
  44. package/dist/components/date-picker/index.d.ts +1 -1
  45. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
  46. package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
  47. package/dist/components/dialog/MPDialog.d.ts +16 -3
  48. package/dist/components/dialog/MPDialog.js +1 -1
  49. package/dist/components/divider/MPDivider.js +1 -1
  50. package/dist/components/drawer/MPDrawer.d.ts +1 -1
  51. package/dist/components/drawer/MPDrawer.js +1 -1
  52. package/dist/components/empty/MPEmpty.js +1 -1
  53. package/dist/components/file-picker/MPFilePicker.d.ts +6 -0
  54. package/dist/components/file-picker/MPFilePicker.js +1 -1
  55. package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
  56. package/dist/components/footer/MPFooter.js +1 -1
  57. package/dist/components/grid/MPGrid.d.ts +23 -1
  58. package/dist/components/grid/MPGrid.js +1 -1
  59. package/dist/components/header/MPHeader.js +1 -1
  60. package/dist/components/image/MPImage.d.ts +112 -0
  61. package/dist/components/image/MPImage.js +2 -0
  62. package/dist/components/image/index.d.ts +2 -0
  63. package/dist/components/image/index.js +1 -0
  64. package/dist/components/list/MPList.d.ts +28 -0
  65. package/dist/components/list/MPList.js +1 -1
  66. package/dist/components/menu/MPMenu.d.ts +25 -4
  67. package/dist/components/menu/MPMenu.js +1 -1
  68. package/dist/components/menubar/MPMenubar.d.ts +8 -1
  69. package/dist/components/menubar/MPMenubar.js +1 -1
  70. package/dist/components/navigation-menu/MPNavigationMenu.d.ts +8 -1
  71. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  72. package/dist/components/number-field/MPNumberField.d.ts +9 -3
  73. package/dist/components/number-field/MPNumberField.js +1 -1
  74. package/dist/components/otp-field/MPOtpField.js +1 -1
  75. package/dist/components/overlay/MPOverlay.d.ts +1 -1
  76. package/dist/components/overlay/MPOverlay.js +1 -1
  77. package/dist/components/pagination/MPPagination.js +1 -1
  78. package/dist/components/panes/MPPanes.js +1 -1
  79. package/dist/components/pill/MPPill.js +1 -1
  80. package/dist/components/popconfirm/MPPopconfirm.d.ts +92 -0
  81. package/dist/components/popconfirm/MPPopconfirm.js +2 -0
  82. package/dist/components/popconfirm/index.d.ts +2 -0
  83. package/dist/components/popconfirm/index.js +1 -0
  84. package/dist/components/popover/MPPopover.d.ts +1 -1
  85. package/dist/components/popover/MPPopover.js +1 -1
  86. package/dist/components/progress-box/MPProgressBox.js +1 -1
  87. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  88. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  89. package/dist/components/radio-group/MPRadioGroup.d.ts +12 -0
  90. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  91. package/dist/components/rating/MPRating.js +1 -1
  92. package/dist/components/segmented-button/MPSegmentedButton.d.ts +7 -0
  93. package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
  94. package/dist/components/select/MPSelect.d.ts +9 -2
  95. package/dist/components/select/MPSelect.js +1 -1
  96. package/dist/components/shortcut/MPShortcut.js +1 -1
  97. package/dist/components/sidebar/MPSidebar.js +1 -1
  98. package/dist/components/skeleton/MPSkeleton.js +1 -1
  99. package/dist/components/slider/MPSlider.d.ts +33 -0
  100. package/dist/components/slider/MPSlider.js +1 -1
  101. package/dist/components/snackbar/MPSnackbar.d.ts +20 -1
  102. package/dist/components/snackbar/MPSnackbar.js +1 -1
  103. package/dist/components/spoiler/MPSpoiler.js +1 -1
  104. package/dist/components/stepper/MPStepper.d.ts +153 -0
  105. package/dist/components/stepper/MPStepper.js +2 -0
  106. package/dist/components/stepper/index.d.ts +2 -0
  107. package/dist/components/stepper/index.js +1 -0
  108. package/dist/components/switch/MPSwitch.d.ts +6 -0
  109. package/dist/components/switch/MPSwitch.js +1 -1
  110. package/dist/components/table/MPTable.d.ts +1 -1
  111. package/dist/components/table/MPTable.js +1 -1
  112. package/dist/components/tabs/MPTabs.js +1 -1
  113. package/dist/components/text-field/MPTextField.d.ts +46 -14
  114. package/dist/components/text-field/MPTextField.js +1 -1
  115. package/dist/components/time-picker/MPTimePicker.js +1 -1
  116. package/dist/components/timeline/MPTimeline.d.ts +10 -2
  117. package/dist/components/timeline/MPTimeline.js +1 -1
  118. package/dist/components/toggle/MPToggle.js +1 -1
  119. package/dist/components/transfer/MPTransfer.js +1 -1
  120. package/dist/components/typography/MPTypography.d.ts +7 -0
  121. package/dist/components/typography/MPTypography.js +1 -2
  122. package/dist/components/visually-hidden/MPVisuallyHidden.d.ts +60 -0
  123. package/dist/components/visually-hidden/MPVisuallyHidden.js +2 -0
  124. package/dist/components/visually-hidden/index.d.ts +2 -0
  125. package/dist/components/visually-hidden/index.js +1 -0
  126. package/dist/constants/glyphs.d.ts +2 -0
  127. package/dist/constants/glyphs.js +1 -1
  128. package/dist/constants/icons.d.ts +1 -0
  129. package/dist/constants/icons.js +1 -1
  130. package/dist/hooks/index.d.ts +23 -0
  131. package/dist/hooks/index.js +1 -0
  132. package/dist/hooks/useMPColorScheme.d.ts +135 -0
  133. package/dist/hooks/useMPColorScheme.js +1 -0
  134. package/dist/hooks/useMPReducedMotion.d.ts +32 -0
  135. package/dist/hooks/useMPReducedMotion.js +1 -0
  136. package/dist/hooks/useMPShortcut.d.ts +105 -0
  137. package/dist/hooks/useMPShortcut.js +2 -0
  138. package/dist/hooks/useMPWindowClass.d.ts +48 -0
  139. package/dist/hooks/useMPWindowClass.js +1 -0
  140. package/dist/index.d.ts +8 -0
  141. package/dist/index.js +1 -1
  142. package/dist/internal/Calendar.d.ts +19 -4
  143. package/dist/internal/Calendar.js +1 -1
  144. package/dist/internal/Picker.d.ts +15 -3
  145. package/dist/internal/Picker.js +1 -1
  146. package/dist/internal/color-scheme.d.ts +28 -0
  147. package/dist/internal/color-scheme.js +2 -0
  148. package/dist/internal/config.d.ts +43 -0
  149. package/dist/internal/config.js +2 -0
  150. package/dist/internal/date.d.ts +50 -3
  151. package/dist/internal/date.js +1 -1
  152. package/dist/internal/i18n.d.ts +26 -1
  153. package/dist/internal/messages/confirm.d.ts +3 -0
  154. package/dist/internal/messages/confirm.js +1 -0
  155. package/dist/internal/messages/picker.js +1 -1
  156. package/dist/internal/progress.d.ts +14 -0
  157. package/dist/internal/step.d.ts +71 -0
  158. package/dist/internal/step.js +1 -0
  159. package/dist/internal/window-class.d.ts +21 -0
  160. package/dist/internal/window-class.js +2 -0
  161. package/dist/locales/ar.js +1 -1
  162. package/dist/locales/de.js +1 -1
  163. package/dist/locales/es.js +1 -1
  164. package/dist/locales/fr.js +1 -1
  165. package/dist/locales/hi.js +1 -1
  166. package/dist/locales/id.js +1 -1
  167. package/dist/locales/it.js +1 -1
  168. package/dist/locales/ja.js +1 -1
  169. package/dist/locales/ko.js +1 -1
  170. package/dist/locales/nl.js +1 -1
  171. package/dist/locales/pl.js +1 -1
  172. package/dist/locales/pt.js +1 -1
  173. package/dist/locales/ru.js +1 -1
  174. package/dist/locales/th.js +1 -1
  175. package/dist/locales/tr.js +1 -1
  176. package/dist/locales/vi.js +1 -1
  177. package/dist/locales/zh-hans.js +1 -1
  178. package/dist/locales/zh-hant.js +1 -1
  179. package/dist/styles/accordion.css +1 -1
  180. package/dist/styles/animate-lighting.css +1 -1
  181. package/dist/styles/aspect-ratio.css +1 -1
  182. package/dist/styles/bottom-navigation.css +1 -1
  183. package/dist/styles/calendar.css +2 -0
  184. package/dist/styles/chip.css +1 -1
  185. package/dist/styles/combobox.css +1 -1
  186. package/dist/styles/config.css +2 -0
  187. package/dist/styles/confirm.css +2 -0
  188. package/dist/styles/grid.css +1 -1
  189. package/dist/styles/highlight.css +1 -1
  190. package/dist/styles/image.css +2 -0
  191. package/dist/styles/list.css +1 -1
  192. package/dist/styles/panes.css +1 -1
  193. package/dist/styles/popconfirm.css +2 -0
  194. package/dist/styles/progress-box.css +1 -1
  195. package/dist/styles/progress-circular.css +1 -1
  196. package/dist/styles/progress-linear.css +1 -1
  197. package/dist/styles/rating.css +1 -1
  198. package/dist/styles/shortcut.css +1 -1
  199. package/dist/styles/slider.css +1 -1
  200. package/dist/styles/snackbar.css +1 -1
  201. package/dist/styles/stepper.css +2 -0
  202. package/dist/styles/text-field.css +1 -1
  203. package/dist/styles/timeline.css +1 -1
  204. package/dist/styles/tokens.css +1 -1
  205. package/dist/styles/transfer.css +1 -1
  206. package/dist/styles/typography.css +1 -1
  207. package/dist/styles/visually-hidden.css +2 -0
  208. package/dist/styles.css +1 -1
  209. package/dist/tailwind.css +91 -5
  210. package/dist/types.d.ts +64 -0
  211. package/package.json +6 -1
@@ -0,0 +1,124 @@
1
+ import * as React from 'react';
2
+ import { useMPConfig, type MPConfigValue } from '../../internal/config.js';
3
+ import type { MPColor, MPSize } from '../../types.js';
4
+ export interface MPConfigProviderProps {
5
+ /**
6
+ * The size every control under this starts at.
7
+ *
8
+ * `md` is Material's own and is what a component takes when nobody says
9
+ * anything — see `MPSize`. A design that runs at `sm` sets it here once
10
+ * instead of at the several hundred call sites that would otherwise each have
11
+ * to repeat it, and each be a place it can be forgotten.
12
+ */
13
+ size?: MPSize;
14
+ /**
15
+ * The accent family every control under this reads.
16
+ *
17
+ * `primary` unless set. A product themed on `secondary` or `tertiary` is one
18
+ * line here rather than a prop on every button, chip, tab and slider.
19
+ */
20
+ color?: MPColor;
21
+ /**
22
+ * The language the components speak — the same value `MPLocaleProvider` takes,
23
+ * carried here so an application needs one provider rather than two.
24
+ */
25
+ locale?: string;
26
+ /**
27
+ * Which way the text runs, for everything under it.
28
+ *
29
+ * This is the one prop here that reaches **two** systems, because the
30
+ * direction is answered in two places and they have to agree:
31
+ *
32
+ * - **The stylesheet** reads the DOM's own `dir`. Every padding, margin and
33
+ * corner in this library is already a logical property, so the CSS half of
34
+ * RTL has always worked from a `dir` attribute anywhere above a component.
35
+ * - **Base UI** reads a React context, and there was nothing putting one
36
+ * there. Seven of its parts consult it — the slider, menu, select, combobox,
37
+ * navigation menu, OTP field and scroll area — and without it they were all
38
+ * being told the page ran left to right. The visible one was the slider,
39
+ * whose handle sat exactly one handle-width off the value it was reporting,
40
+ * at every value, and hung off the end of the track at the extremes.
41
+ *
42
+ * Given here, both are set: the attribute goes on a `display: contents`
43
+ * element, which takes part in no layout at all, and the same value goes into
44
+ * Base UI's own `DirectionProvider`. Left out, nothing is rendered and nothing
45
+ * is claimed — a page that sets `dir` on `<html>` and never mounts this still
46
+ * gets the CSS half and not the other one.
47
+ */
48
+ dir?: 'ltr' | 'rtl';
49
+ children?: React.ReactNode;
50
+ }
51
+ /**
52
+ * The prop defaults for everything under it.
53
+ *
54
+ * Wrap the application. Every component in this library still takes `size` and
55
+ * `color` of its own, and this is where those props get their default — so a
56
+ * design that runs at `size="sm"` is one decision rather than one per call site.
57
+ *
58
+ * ```tsx
59
+ * <MPConfigProvider size="sm" color="tertiary" locale="ko">
60
+ * <App />
61
+ * </MPConfigProvider>
62
+ * ```
63
+ *
64
+ * ## Why it carries these two and not a theme
65
+ *
66
+ * Everything a theme normally holds is already a CSS custom property here — the
67
+ * colour roles, the type scale, the corners, the motion durations. Those reach a
68
+ * component through the cascade, which means a *section* of a page can differ
69
+ * from the rest of it without a provider at all and without a re-render. A JS
70
+ * theme object would be a second place the same values live.
71
+ *
72
+ * `size` is the one thing that cannot travel that way. It resolves to literal
73
+ * Tailwind class strings — `h-14`, `text-mp-body-large` — because Tailwind finds
74
+ * classes by scanning source text and an interpolated `h-${n}` generates no rule
75
+ * at all. A value that cannot be a custom property and has to reach every call
76
+ * site is exactly what context is for. `color` joins it because the two are the
77
+ * axes a whole product is usually set on together.
78
+ *
79
+ * ## Why `variant` is not here
80
+ *
81
+ * Because there is no such thing as *the* default variant. `MPAccordion` starts
82
+ * `outlined`, `MPAlert` `tonal`, `MPBadge` `filled`, `MPButton` `filled`,
83
+ * `MPChip` `outlined` — five answers to five different questions about emphasis.
84
+ * One global value would overwrite all five with an arbitrary one, and the
85
+ * component that looked wrong afterwards would give no clue why.
86
+ *
87
+ * ## What it does not override
88
+ *
89
+ * A component that had chosen its own default keeps it. `MPBadge` is `error`
90
+ * because a badge is usually a count of something that wants attention;
91
+ * `MPTooltip` is `sm` because a tooltip at a control's height is a slab;
92
+ * `MPDialog`, `MPPill` and `MPShortcut` are `secondary`. Those are answers
93
+ * rather than unfilled defaults, so the configuration passes them by — set the
94
+ * prop to move them.
95
+ *
96
+ * ## Nesting
97
+ *
98
+ * Providers nest and **merge**, nearest wins per field. A section that only
99
+ * changes the accent keeps the size the provider above it set:
100
+ *
101
+ * ```tsx
102
+ * <MPConfigProvider size="sm">
103
+ * <App />
104
+ * <MPConfigProvider color="error">
105
+ * <DangerZone /> // size="sm" still, color="error" now
106
+ * </MPConfigProvider>
107
+ * </MPConfigProvider>
108
+ * ```
109
+ */
110
+ export declare function MPConfigProvider({ size, color, locale, dir, children }: MPConfigProviderProps): React.JSX.Element;
111
+ /**
112
+ * The configuration in force at this point in the tree.
113
+ *
114
+ * Exported for the reason `useMPLocale` is: an application that has told this
115
+ * library its size and its accent should not have to tell itself the same thing
116
+ * twice. A wrapper component of your own around one of these can resolve a prop
117
+ * the way the component underneath will.
118
+ *
119
+ * The fields are optional, and `undefined` means "nobody set one" rather than
120
+ * `md` or `primary` — the library's own defaults are applied by the components,
121
+ * not stored here, so that a future change of default is one place.
122
+ */
123
+ export { useMPConfig };
124
+ export type { MPConfigValue };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{DirectionProvider as e}from"@base-ui/react/direction-provider";import{MPConfigContext as i,useMPConfig as t}from"../../internal/config.js";import{MPLocaleContext as c,useMPLocale as n}from"../../internal/locale.js";export function MPConfigProvider({size:l,color:s,locale:d,dir:a,children:m}){const p=t(),f=n(),u=o.useMemo(()=>({size:l??p.size,color:s??p.color}),[l,s,p.size,p.color]),v=d??f,h=r(i.Provider,{value:u,children:r(c.Provider,{value:v,children:m})});return a?r(e,{direction:a,children:r("div",{dir:a,style:{display:"contents"},children:h})}):h}export{t as useMPConfig};
@@ -0,0 +1,2 @@
1
+ export { MPConfigProvider, useMPConfig } from './MPConfigProvider.js';
2
+ export type { MPConfigProviderProps, MPConfigValue } from './MPConfigProvider.js';
@@ -0,0 +1 @@
1
+ export{MPConfigProvider,useMPConfig}from"./MPConfigProvider.js";
@@ -0,0 +1,143 @@
1
+ import * as React from 'react';
2
+ import type { MPColor, MPSize } from '../../types.js';
3
+ /** What a confirmation asks, and how it is drawn. */
4
+ export interface MPConfirmOptions {
5
+ /** The question, as a heading. */
6
+ title?: React.ReactNode;
7
+ /** The sentence under it — what happens, and to what. */
8
+ description?: React.ReactNode;
9
+ /** A glyph above the title, the way `MPDialog` draws one. */
10
+ icon?: React.ReactNode;
11
+ /**
12
+ * Anything else the dialog should hold — a field, a list of what is about to
13
+ * be deleted, a checkbox that says "do not ask again".
14
+ */
15
+ children?: React.ReactNode;
16
+ /** What the yes button says. @default the translation of `Confirm` */
17
+ confirmLabel?: React.ReactNode;
18
+ /** What the no button says. @default the translation of `Cancel` */
19
+ cancelLabel?: React.ReactNode;
20
+ /**
21
+ * The accent the yes button is drawn in.
22
+ *
23
+ * `'error'` is what a destructive confirmation wants, and it is not the
24
+ * default: most confirmations are not destructive, and a red button on every
25
+ * one of them stops being a warning.
26
+ * @default 'primary'
27
+ */
28
+ color?: MPColor;
29
+ /** @default 'md' */
30
+ size?: MPSize;
31
+ /**
32
+ * Whether Escape and a press outside answer **no**.
33
+ *
34
+ * On by default, because a dialog a reader cannot leave is a trap and because
35
+ * the safe answer to "are you sure" is no. Switch it off for a question that
36
+ * genuinely has to be answered — and be sure it does, because the reader then
37
+ * has exactly two ways out and both of them are your buttons.
38
+ * @default true
39
+ */
40
+ dismissible?: boolean;
41
+ }
42
+ export interface MPConfirmResult {
43
+ /**
44
+ * Asks, and resolves with the answer.
45
+ *
46
+ * `true` for the confirm button, `false` for cancel — and `false` for Escape,
47
+ * a press outside, and anything else that closes the dialog. There is no third
48
+ * answer, so a caller writes one `if`.
49
+ */
50
+ confirm: (options: MPConfirmOptions) => Promise<boolean>;
51
+ /**
52
+ * Tells, and resolves once it has been acknowledged.
53
+ *
54
+ * One button, because there is nothing to refuse. `Promise<void>` rather than
55
+ * `Promise<boolean>` for the same reason: an acknowledgement has no answer,
56
+ * and a boolean nobody can vary is a value a caller would have to learn to
57
+ * ignore.
58
+ */
59
+ alert: (options: MPConfirmOptions) => Promise<void>;
60
+ }
61
+ export interface MPConfirmProviderProps {
62
+ /**
63
+ * Defaults for every confirmation raised under this — a `size` to match the
64
+ * application, an accent, a `cancelLabel` in your own words. Each call still
65
+ * says whatever it needs to and wins.
66
+ */
67
+ defaults?: Omit<MPConfirmOptions, 'title' | 'description' | 'children'>;
68
+ children?: React.ReactNode;
69
+ }
70
+ /**
71
+ * Holds the one dialog every `confirm()` in the application is drawn in.
72
+ *
73
+ * Wrap the application, the way `MPSnackbarProvider` is wrapped, and for the
74
+ * same reason: what a caller has at the moment a question is warranted is a
75
+ * click handler, not a place in the tree.
76
+ *
77
+ * ```tsx
78
+ * <MPConfirmProvider>
79
+ * <App />
80
+ * </MPConfirmProvider>
81
+ * ```
82
+ *
83
+ * ## One at a time
84
+ *
85
+ * A second `confirm()` raised while one is open **replaces** it, and the first
86
+ * promise resolves `false`. Not a queue, deliberately: a queue would ask a
87
+ * question about something the reader has already moved on from, and the answer
88
+ * to a stale question is not information. Two confirmations racing is a bug in
89
+ * the calling code, and resolving the first as *no* is the safe reading of it.
90
+ */
91
+ export declare function MPConfirmProvider({ defaults, children }: MPConfirmProviderProps): React.JSX.Element;
92
+ /**
93
+ * Asks a question and waits for the answer.
94
+ *
95
+ * ```tsx
96
+ * const { confirm } = useMPConfirm();
97
+ *
98
+ * async function remove() {
99
+ * const sure = await confirm({
100
+ * title: 'Delete this project?',
101
+ * description: 'Everything in it goes too, and it cannot be undone.',
102
+ * confirmLabel: 'Delete',
103
+ * color: 'error'
104
+ * });
105
+ *
106
+ * if (sure) {
107
+ * await api.delete(id);
108
+ * }
109
+ * }
110
+ * ```
111
+ *
112
+ * ## Why this rather than a dialog of your own
113
+ *
114
+ * Because the dialog is not the hard part. "Are you sure" needs a piece of open
115
+ * state, a piece of state for *what* is being confirmed, two handlers, and a
116
+ * dialog kept mounted somewhere it does not belong — per call site. What the
117
+ * caller actually has at that moment is a click handler, and what they want back
118
+ * is a boolean.
119
+ *
120
+ * It is the same trade `useMPSnackbar` makes, run the other way: a snackbar is
121
+ * something to say, this is something to ask.
122
+ *
123
+ * ## `false` is every other answer
124
+ *
125
+ * The confirm button resolves `true`; the cancel button, Escape, a press outside
126
+ * and any other close resolve `false`. There is no third outcome and the promise
127
+ * never rejects, so a caller writes an `if` and not a `try`.
128
+ *
129
+ * `alert()` is the one-button form and resolves `void` once it has been
130
+ * acknowledged — an acknowledgement has nothing to refuse, and a boolean nobody
131
+ * can vary is a value a caller would have to learn to ignore.
132
+ *
133
+ * ## Sharp edges
134
+ *
135
+ * - **It needs an `MPConfirmProvider` above it.** Without one the hook throws,
136
+ * rather than returning a function that silently never resolves — a promise
137
+ * that never settles is the hardest possible way to be told about a missing
138
+ * provider.
139
+ * - **One at a time.** A second `confirm()` raised while one is open replaces it
140
+ * and resolves the first `false`. See the provider for why that is not a queue.
141
+ * - **Do not `await` it inside a render.** It is a click handler's tool.
142
+ */
143
+ export declare function useMPConfirm(): MPConfirmResult;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as i}from"../button/MPButton.js";import{MPDialog as t}from"../dialog/MPDialog.js";import{useMPLocale as l,useMPMessages as c}from"../../internal/locale.js";import{CONFIRM as a}from"../../internal/messages/confirm.js";const s=/*@__PURE__*/o.createContext(null);export function MPConfirmProvider({defaults:m,children:u}){const[d,f]=o.useState(null),p=c(a,l()),h=o.useRef(null),C=o.useCallback((e,r)=>new Promise(n=>{h.current?.(!1),h.current=n,f({...m,...e,acknowledge:r})}),[m]),P=o.useMemo(()=>({confirm:e=>C(e,!1),alert:e=>C(e,!0).then(()=>{})}),[C]),x=e=>{h.current?.(e),h.current=null,f(null)},g=d?.acknowledge??!1;return n(s.Provider,{value:P,children:[u,e(t,{open:null!==d,onOpenChange:e=>{e||x(g)},icon:d?.icon,title:d?.title,description:d?.description,size:d?.size??"md",color:d?.color??"primary",dismissible:d?.dismissible??!0,actions:n(r,{children:[g?null:e(i,{variant:"text",onClick:()=>x(!1),children:d?.cancelLabel??p.cancel}),e(i,{variant:"text",color:d?.color??"primary",onClick:()=>x(!0),children:d?.confirmLabel??(g?p.ok:p.confirm)})]}),children:d?.children})]})}export function useMPConfirm(){const e=o.useContext(s);if(!e)throw new Error("useMPConfirm was called outside an <MPConfirmProvider>. Wrap the application in one — the provider is what holds the dialog every confirm() is drawn in.");return e}
@@ -0,0 +1,2 @@
1
+ export { MPConfirmProvider, useMPConfirm } from './MPConfirmProvider.js';
2
+ export type { MPConfirmProviderProps, MPConfirmOptions, MPConfirmResult } from './MPConfirmProvider.js';
@@ -0,0 +1 @@
1
+ export{MPConfirmProvider,useMPConfirm}from"./MPConfirmProvider.js";
@@ -1 +1 @@
1
- import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{MEASURE as n,SHEET_PAD_X as o}from"../../internal/scale.js";export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:a=!0,size:t="md",centered:i=!0,render:d,className:m,children:s,...c},l){return r({render:d,ref:l,props:{"data-mp-size":t,className:["mp-container block w-full","box-border","none"===e?"":n[e],i?"mx-auto":"",a?o[t]:"",m??""].filter(Boolean).join(" "),children:s,...c}})});
1
+ import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{MEASURE as n,SHEET_PAD_X as o}from"../../internal/scale.js";import{useMPSize as a}from"../../internal/config.js";export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:t=!0,size:i,centered:s=!0,render:c,className:m,children:d,...l},f){const p=a(i);return r({render:c,ref:f,props:{"data-mp-size":p,className:["mp-container block w-full","box-border","none"===e?"":n[e],s?"mx-auto":"",t?o[p]:"",m??""].filter(Boolean).join(" "),children:d,...l}})});
@@ -1,7 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { type MPPickerLabels } from '../../internal/Calendar.js';
3
3
  import { type MPPickerShellProps } from '../../internal/Picker.js';
4
+ import { type MPDatePrecision } from '../../internal/date.js';
4
5
  import type { MPWeekday } from '../../types.js';
6
+ /**
7
+ * Which unit a picker asks for.
8
+ *
9
+ * Re-exported so a caller storing the answer can name what they are holding —
10
+ * a `'month'` picker's value is a month, and the day inside it is an artefact.
11
+ */
12
+ export type { MPDatePrecision };
5
13
  export interface MPDatePickerProps extends MPPickerShellProps {
6
14
  /** The chosen day. Use with `onValueChange` for a controlled picker. */
7
15
  value?: Date | null;
@@ -13,18 +21,45 @@ export interface MPDatePickerProps extends MPPickerShellProps {
13
21
  open?: boolean;
14
22
  defaultOpen?: boolean;
15
23
  onOpenChange?: (open: boolean) => void;
24
+ /**
25
+ * Which unit the picker asks for.
26
+ *
27
+ * `'month'` stops the calendar at its grid of twelve months and answers with
28
+ * the 1st of the one that is pressed; `'year'` stops at the grid of years and
29
+ * answers with the 1st of January. A card's expiry, a fiscal year, the month a
30
+ * report covers — the questions where a day is not something the reader has to
31
+ * give and the value should not pretend they did.
32
+ *
33
+ * The finer views are not hidden so much as absent: a month picker never draws
34
+ * a day grid, so there is no way through it to a day. What follows the
35
+ * precision with it is the trigger's default `format`, what the hidden input
36
+ * submits, and the word on the footer's shortcut.
37
+ * @default 'day'
38
+ */
39
+ precision?: MPDatePrecision;
16
40
  /**
17
41
  * Which month the calendar opens on when there is no value.
18
42
  * @default this month
19
43
  */
20
44
  defaultMonth?: Date;
21
- /** The earliest day that may be chosen. Day-granular — the time is ignored. */
45
+ /**
46
+ * The earliest day that may be chosen. Day-granular — the time is ignored.
47
+ *
48
+ * Read at whatever `precision` asks for: a minimum of 10 July still leaves
49
+ * July pickable on a month picker, because there the bound is about which
50
+ * months exist.
51
+ */
22
52
  minDate?: Date | null;
23
53
  /** The latest day that may be chosen. */
24
54
  maxDate?: Date | null;
25
55
  /**
26
56
  * Blocks individual days that are inside the range but still not available —
27
57
  * weekends, holidays, a room that is already booked.
58
+ *
59
+ * Asked about days and only about days, so a picker whose `precision` is a
60
+ * month or a year never consults it: a rule written about weekends has no
61
+ * answer for "is July available", and inventing one out of the 1st would block
62
+ * whichever months happened to start on a Sunday.
28
63
  */
29
64
  shouldDisableDate?: (date: Date) => boolean;
30
65
  /**
@@ -42,6 +77,8 @@ export interface MPDatePickerProps extends MPPickerShellProps {
42
77
  *
43
78
  * An object written inline is fine: what the picker keeps between renders is
44
79
  * keyed on what the format *says*, not on the object that says it.
80
+ *
81
+ * Left out, it follows `precision`: a medium date, `July 2026`, or `2026`.
45
82
  * @default { dateStyle: 'medium' }
46
83
  */
47
84
  format?: Intl.DateTimeFormatOptions;
@@ -54,6 +91,9 @@ export interface MPDatePickerProps extends MPPickerShellProps {
54
91
  clearable?: boolean;
55
92
  /**
56
93
  * Offers the shortcut to today in the footer.
94
+ *
95
+ * It lands on whatever unit is being asked for, and says so: *Today*, *This
96
+ * month* or *This year*.
57
97
  * @default true
58
98
  */
59
99
  showTodayButton?: boolean;
@@ -67,7 +107,10 @@ export interface MPDatePickerProps extends MPPickerShellProps {
67
107
  * given falls back to the translation for `locale`, and then to English.
68
108
  */
69
109
  labels?: Partial<MPPickerLabels>;
70
- /** Identifies the field when a form is submitted, as `YYYY-MM-DD`. */
110
+ /**
111
+ * Identifies the field when a form is submitted, as `YYYY-MM-DD` — or as
112
+ * `YYYY-MM` or `YYYY` when `precision` asks for less.
113
+ */
71
114
  name?: string;
72
115
  }
73
116
  /**
@@ -86,6 +129,14 @@ export interface MPDatePickerProps extends MPPickerShellProps {
86
129
  * picker, and this is drawn on MD3's own numbers: a 40dp cell, a filled circle
87
130
  * for the chosen day, an outlined one for today.
88
131
  *
132
+ * ## A day, a month, or a year
133
+ *
134
+ * `precision` decides which of the three the calendar stops at, and it stops by
135
+ * leaving the finer views out rather than by refusing them: a month picker opens
136
+ * on the twelve months and has no day grid to reach, a year picker opens on the
137
+ * years. Everything downstream follows — how the trigger writes the value, what
138
+ * a form submits, and whether the footer's shortcut says *Today* or *This year*.
139
+ *
89
140
  * ## Every string comes from the platform
90
141
  *
91
142
  * The month names, the weekday initials, the order of the header's two buttons
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{MPButton as o}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{CalendarIcon as n}from"../../constants/icons.js";import{MPCalendar as r}from"../../internal/Calendar.js";import{FOOTER_SIZE as s,MPPickerFooter as i,MPPickerShell as c,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as u}from"../../internal/locale.js";import{PICKER as p}from"../../internal/messages/picker.js";import{CONTROL_ICON as f}from"../../internal/scale.js";import{formatDate as h,isDayOutside as j,isValidDate as b,localeWeekStart as v,mergeDateAndTime as x,startOfDay as g,startOfMonth as D,toISODate as k,today as y,withPlaceholder as C}from"../../internal/date.js";export const MPDatePicker=/*@__PURE__*/l.forwardRef(function({value:O,defaultValue:S,onValueChange:z,open:M,defaultOpen:P,onOpenChange:w,defaultMonth:I,minDate:V,maxDate:B,shouldDisableDate:R,locale:E,weekStartsOn:F,format:N={dateStyle:"medium"},placeholder:T,clearable:q=!1,showTodayButton:A=!0,closeOnSelect:G=!0,labels:H,name:J,size:K="md",color:L="primary",readOnly:Q=!1,disabled:U=!1,startIcon:W,...X},Y){const Z=d(E),$=u(p,Z,H),_=F??v(Z),[ee,ae]=l.useState(S??null),le=void 0!==O?O:ee,[oe,te]=l.useState(P??!1),ne=M??oe,[re,se]=l.useState(()=>D(b(le)?le:I??y()));l.useEffect(()=>{ne&&se(D(b(le)?le:I??y()))},[ne]);const ie=e=>{e&&(Q||U)||(void 0===M&&te(e),w?.(e))},ce=e=>{void 0===O&&ae(e),z?.(e)},me=e=>{const a=b(le)?x(e,le):g(e);ce(a),se(D(a)),G&&ie(!1)},de=y(),ue=j(de,V,B)||(R?.(de)??!1),pe=A||q,fe=C(m(Z,N),T);return e(c,{...X,slug:"date-picker",size:K,color:L,readOnly:Q,disabled:U,triggerRef:Y,startIcon:void 0===W?e(t,{icon:n,size:f[K]}):W,display:b(le)?h(le,Z,N):T??"",samples:fe,empty:!b(le),clearable:q,onClear:()=>ce(null),open:ne,onOpenChange:ie,labels:$,hiddenValues:J?[{name:J,value:b(le)?k(le):""}]:void 0,children:a("div",{className:"flex flex-col "+(pe?"gap-1.5":""),children:[e(r,{size:K,color:L,locale:Z,weekStartsOn:_,month:re,onMonthChange:se,selected:[le],onSelect:me,minDate:V,maxDate:B,shouldDisableDate:R,labels:$,autoFocus:!0}),pe?a(i,{children:[q?e(o,{variant:"text",size:s[K],color:L,onClick:()=>{ce(null),ie(!1)},children:$.clear}):null,A?e(o,{variant:"text",size:s[K],color:L,disabled:ue,onClick:()=>me(de),children:$.today}):null]}):null]})})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as o from"react";import{MPButton as t}from"../button/MPButton.js";import{MPIcon as n}from"../icon/MPIcon.js";import{CalendarIcon as l}from"../../constants/icons.js";import{Calendar as r}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as s,MPPickerShell as c,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as u}from"../../internal/locale.js";import{PICKER as p}from"../../internal/messages/picker.js";import{CONTROL_ICON as f}from"../../internal/scale.js";import{formatDate as h,isUnitOutside as y,isValidDate as j,localeWeekStart as b,mergeDateAndTime as g,startOfMonth as v,startOfUnit as x,toISODate as D,toISOMonth as k,toISOYear as C,today as O,withPlaceholder as S}from"../../internal/date.js";import{useMPColor as z,useMPSize as M}from"../../internal/config.js";const P={day:{dateStyle:"medium"},month:{year:"numeric",month:"long"},year:{year:"numeric"}},w={day:D,month:k,year:C};export const MPDatePicker=/*@__PURE__*/o.forwardRef(function({value:D,defaultValue:k,onValueChange:C,open:I,defaultOpen:V,onOpenChange:B,precision:R="day",defaultMonth:E,minDate:F,maxDate:N,shouldDisableDate:T,locale:Y,weekStartsOn:q,format:A,placeholder:G,clearable:H=!1,showTodayButton:J=!0,closeOnSelect:K=!0,labels:L,name:Q,size:U,color:W,readOnly:X=!1,disabled:Z=!1,startIcon:$,..._},ee){const ae=M(U),oe=z(W),te=d(Y),ne=u(p,te,L),le=q??b(te),re=A??P[R],[ie,se]=o.useState(k??null),ce=void 0!==D?D:ie,[me,de]=o.useState(V??!1),ue=I??me,[pe,fe]=o.useState(()=>v(j(ce)?ce:E??O()));o.useEffect(()=>{ue&&fe(v(j(ce)?ce:E??O()))},[ue]);const he=e=>{e&&(X||Z)||(void 0===I&&de(e),B?.(e))},ye=e=>{void 0===D&&se(e),C?.(e)},je=e=>{const a=x(e,R),o=j(ce)?g(a,ce):a;ye(o),fe(v(o)),K&&he(!1)},be=O(),ge=y(be,R,F,N)||"day"===R&&(T?.(be)??!1),ve="year"===R?ne.thisYear:"month"===R?ne.thisMonth:ne.today,xe=J||H,De=S(m(te,re),G);return e(c,{..._,slug:"date-picker",size:ae,color:oe,readOnly:X,disabled:Z,triggerRef:ee,startIcon:void 0===$?e(n,{icon:l,size:f[ae]}):$,display:j(ce)?h(ce,te,re):G??"",samples:De,empty:!j(ce),clearable:H,onClear:()=>ye(null),open:ue,onOpenChange:he,labels:ne,hiddenValues:Q?[{name:Q,value:j(ce)?w[R](ce):""}]:void 0,children:a("div",{className:"flex flex-col "+(xe?"gap-1.5":""),children:[e(r,{size:ae,color:oe,locale:te,weekStartsOn:le,month:pe,onMonthChange:fe,selected:[ce],onSelect:je,minDate:F,maxDate:N,shouldDisableDate:T,precision:R,labels:ne,autoFocus:!0}),xe?a(s,{children:[H?e(t,{variant:"text",size:i[ae],color:oe,onClick:()=>{ye(null),he(!1)},children:ne.clear}):null,J?e(t,{variant:"text",size:i[ae],color:oe,disabled:ge,onClick:()=>je(be),children:ve}):null]}):null]})})});
@@ -1,2 +1,2 @@
1
1
  export { MPDatePicker } from './MPDatePicker.js';
2
- export type { MPDatePickerProps } from './MPDatePicker.js';
2
+ export type { MPDatePickerProps, MPDatePrecision } from './MPDatePicker.js';
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons.js";import{MPCalendar as o}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{PICKER as h}from"../../internal/messages/picker.js";import{MPWidthSizer as f}from"../../internal/WidthSizer.js";import{CONTROL_ICON as v,META_TEXT as x}from"../../internal/scale.js";import{addMonths as g,compareDay as j,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.js";const O={start:null,end:null};export const MPDateRangePicker=/*@__PURE__*/n.forwardRef(function({value:P,defaultValue:z,onValueChange:M,open:B,defaultOpen:I,onOpenChange:R,defaultMonth:V,minDate:E,maxDate:F,shouldDisableDate:W,locale:$,weekStartsOn:_,format:q={dateStyle:"medium"},monthCount:A=2,startPlaceholder:G,endPlaceholder:H,presets:J,clearable:K=!1,closeOnSelect:L=!0,labels:Q,name:T,size:U="md",color:X="primary",readOnly:Y=!1,disabled:Z=!1,startIcon:ee,...le},ne){const ae=d($),te=p(h,ae,Q),re=_??N(ae),[se,oe]=n.useState(z??O),ie=void 0!==P?P??O:se,ce=w(ie.start)?ie.start:null,ue=w(ie.end)?ie.end:null,[me,de]=n.useState(I??!1),pe=B??me,[he,fe]=n.useState(null),[ve,xe]=n.useState(null),[ge,je]=n.useState(()=>C(ce??V??D()));n.useEffect(()=>{pe?je(C(ce??V??D())):(fe(null),xe(null))},[pe]);const be=e=>{e&&(Y||Z)||(void 0===B&&de(e),R?.(e))},we=e=>{void 0===P&&oe(e),M?.(e)},Ne=he??ce,Se=null!==he?ve:ue,Ce=(l,n)=>w(l)?b(l,ae,q):e("span",{className:"text-mp-on-surface-variant",children:n??""}),ye=g(ge,1),De=2===A,ke=m(ae,q),Oe=null!==he?te.end:null===ce?te.start:null,Pe={size:U,color:X,locale:ae,weekStartsOn:re,selected:[ce,ue,he],rangeStart:Ne,rangeEnd:Se,onSelect:e=>{const l=S(e);if(null===he)return fe(l),xe(l),void we({start:l,end:null});const[n,a]=j(l,he)<0?[l,he]:[he,l];fe(null),xe(null),we({start:n,end:a}),L&&be(!1)},onPreviewChange:e=>{null!==he&&xe(e??he)},minDate:E,maxDate:F,shouldDisableDate:W,showOutsideDays:!1,labels:te};return e(u,{...le,slug:"date-range-picker",size:U,color:X,readOnly:Y,disabled:Z,triggerRef:ne,startIcon:void 0===ee?e(t,{icon:s,size:v[U]}):ee,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(ce,G)}),e(f,{samples:k(ke,G)})]}),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:v[U]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ue,H)}),e(f,{samples:k(ke,H)})]})]}),empty:null===ce&&null===ue,clearable:K,onClear:()=>we(O),open:pe,onOpenChange:be,labels:te,hiddenValues:T?[{name:T,value:ce?y(ce):""},{name:T,value:ue?y(ue):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[J&&J.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:J.map((l,n)=>e(a,{variant:"text",size:i[U],color:X,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;fe(null),xe(null),we(l),w(l.start)&&je(C(l.start)),L&&be(!1)})(l),children:l.label},n))}):null,e(o,{...Pe,month:ge,onMonthChange:je,showNextButton:!De,autoFocus:!0}),De?e(o,{...Pe,month:ye,onMonthChange:e=>je(g(e,-1)),showPreviousButton:!1}):null]}),K||null!==Oe?l(c,{children:[null!==Oe?e("span",{className:`text-mp-on-surface-variant me-auto ${x}`,children:Oe}):null,K?e(a,{variant:"text",size:i[U],color:X,onClick:()=>{fe(null),xe(null),we(O),be(!1)},children:te.clear}):null]}):null]})})});
2
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons.js";import{Calendar as o}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{PICKER as f}from"../../internal/messages/picker.js";import{MPWidthSizer as h}from"../../internal/WidthSizer.js";import{CONTROL_ICON as v,META_TEXT as x}from"../../internal/scale.js";import{addMonths as g,compareDay as j,formatDate as b,isValidDate as w,localeWeekStart as N,startOfDay as S,startOfMonth as C,toISODate as D,today as k,withPlaceholder as y}from"../../internal/date.js";import{useMPColor as O,useMPSize as P}from"../../internal/config.js";const z={start:null,end:null};export const MPDateRangePicker=/*@__PURE__*/n.forwardRef(function({value:M,defaultValue:B,onValueChange:I,open:R,defaultOpen:V,onOpenChange:E,defaultMonth:F,minDate:W,maxDate:$,shouldDisableDate:_,locale:q,weekStartsOn:A,format:G={dateStyle:"medium"},monthCount:H=2,startPlaceholder:J,endPlaceholder:K,presets:L,clearable:Q=!1,closeOnSelect:T=!0,labels:U,name:X,size:Y,color:Z,readOnly:ee=!1,disabled:le=!1,startIcon:ne,...ae},te){const re=P(Y),se=O(Z),oe=d(q),ie=p(f,oe,U),ce=A??N(oe),[ue,me]=n.useState(B??z),de=void 0!==M?M??z:ue,pe=w(de.start)?de.start:null,fe=w(de.end)?de.end:null,[he,ve]=n.useState(V??!1),xe=R??he,[ge,je]=n.useState(null),[be,we]=n.useState(null),[Ne,Se]=n.useState(()=>C(pe??F??k()));n.useEffect(()=>{xe?Se(C(pe??F??k())):(je(null),we(null))},[xe]);const Ce=e=>{e&&(ee||le)||(void 0===R&&ve(e),E?.(e))},De=e=>{void 0===M&&me(e),I?.(e)},ke=ge??pe,ye=null!==ge?be:fe,Oe=(l,n)=>w(l)?b(l,oe,G):e("span",{className:"text-mp-on-surface-variant",children:n??""}),Pe=g(Ne,1),ze=2===H,Me=m(oe,G),Be=null!==ge?ie.end:null===pe?ie.start:null,Ie={size:re,color:se,locale:oe,weekStartsOn:ce,selected:[pe,fe,ge],rangeStart:ke,rangeEnd:ye,onSelect:e=>{const l=S(e);if(null===ge)return je(l),we(l),void De({start:l,end:null});const[n,a]=j(l,ge)<0?[l,ge]:[ge,l];je(null),we(null),De({start:n,end:a}),T&&Ce(!1)},onPreviewChange:e=>{null!==ge&&we(e??ge)},minDate:W,maxDate:$,shouldDisableDate:_,showOutsideDays:!1,labels:ie};return e(u,{...ae,slug:"date-range-picker",size:re,color:se,readOnly:ee,disabled:le,triggerRef:te,startIcon:void 0===ne?e(t,{icon:s,size:v[re]}):ne,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:Oe(pe,J)}),e(h,{samples:y(Me,J)})]}),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:v[re]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Oe(fe,K)}),e(h,{samples:y(Me,K)})]})]}),empty:null===pe&&null===fe,clearable:Q,onClear:()=>De(z),open:xe,onOpenChange:Ce,labels:ie,hiddenValues:X?[{name:X,value:pe?D(pe):""},{name:X,value:fe?D(fe):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[L&&L.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:L.map((l,n)=>e(a,{variant:"text",size:i[re],color:se,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;je(null),we(null),De(l),w(l.start)&&Se(C(l.start)),T&&Ce(!1)})(l),children:l.label},n))}):null,e(o,{...Ie,month:Ne,onMonthChange:Se,showNextButton:!ze,autoFocus:!0}),ze?e(o,{...Ie,month:Pe,onMonthChange:e=>Se(g(e,-1)),showPreviousButton:!1}):null]}),Q||null!==Be?l(c,{children:[null!==Be?e("span",{className:`text-mp-on-surface-variant me-auto ${x}`,children:Be}):null,Q?e(a,{variant:"text",size:i[re],color:se,onClick:()=>{je(null),we(null),De(z),Ce(!1)},children:ie.clear}):null]}):null]})})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as t from"react";import{MPButton as l}from"../button/MPButton.js";import{MPIcon as a}from"../icon/MPIcon.js";import{CalendarIcon as n}from"../../constants/icons.js";import{MPCalendar as s,MPTimeGrid as r}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerDivider as c,MPPickerFooter as m,MPPickerShell as d,useDisplaySamples as u}from"../../internal/Picker.js";import{useMPLocale as p,useMPMessages as h}from"../../internal/locale.js";import{PICKER as f}from"../../internal/messages/picker.js";import{CONTROL_ICON as S}from"../../internal/scale.js";import{formatDate as b,isDayOutside as g,isHour12 as v,isValidDate as D,localeWeekStart as j,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.js";export const MPDateTimePicker=/*@__PURE__*/t.forwardRef(function({value:M,defaultValue:P,onValueChange:I,open:N,defaultOpen:V,onOpenChange:B,defaultMonth:R,minDate:E,maxDate:F,shouldDisableDate:q,shouldDisableTime:A,locale:G,weekStartsOn:H,format:J,hour12:K,showSeconds:L=!1,hourStep:Q=1,minuteStep:U=1,secondStep:W=1,placeholder:X,clearable:Y=!1,showNowButton:Z=!0,closeOnSelect:$=!1,labels:_,name:ee,size:oe="md",color:te="primary",readOnly:le=!1,disabled:ae=!1,startIcon:ne,...se},re){const ie=p(G),ce=h(f,ie,_),me=H??j(ie),de=K??v(ie),[ue,pe]=t.useState(P??null),he=void 0!==M?M:ue,[fe,Se]=t.useState(V??!1),be=N??fe,[ge,ve]=t.useState(()=>k(D(he)?he:R??O()));t.useEffect(()=>{be&&ve(k(D(he)?he:R??O()))},[be]);const De=e=>{e&&(le||ae)||(void 0===N&&Se(e),B?.(e))},je=e=>{void 0===M&&pe(e),I?.(e)},xe=t.useCallback((e,o)=>{const[t,l]=w(o,e),a=C(e).getTime();return!!(D(E)&&a+1e3*l<E.getTime())||(!!(D(F)&&a+1e3*t>F.getTime())||(A?.(e,o)??!1))},[E,F,A]),Ce=J??{dateStyle:"medium",timeStyle:"short",hour12:de},ke=new Date,we=T(ke,{seconds:L?ke.getSeconds():0}),ze=g(we,E,F)||(q?.(we)??!1)||xe(we,"second"),Oe=y(u(ie,Ce),X);return e(d,{...se,slug:"date-time-picker",size:oe,color:te,readOnly:le,disabled:ae,triggerRef:re,startIcon:void 0===ne?e(a,{icon:n,size:S[oe]}):ne,display:D(he)?b(he,ie,Ce):X??"",samples:Oe,empty:!D(he),clearable:Y,onClear:()=>je(null),open:be,onOpenChange:De,labels:ce,hiddenValues:ee?[{name:ee,value:D(he)?z(he,L):""}]:void 0,children:o("div",{className:"flex flex-col gap-1.5",children:[o("div",{className:"flex items-stretch gap-2",children:[e(s,{size:oe,color:te,locale:ie,weekStartsOn:me,month:ge,onMonthChange:ve,selected:[he],onSelect:e=>{const o=D(he)?x(e,he):C(e);je(o),ve(k(o)),$&&De(!1)},minDate:E,maxDate:F,shouldDisableDate:q,labels:ce,autoFocus:!0}),e(c,{}),e(r,{size:oe,locale:ie,value:D(he)?he:null,referenceDate:D(he)?he:O(),onChange:je,hour12:de,showSeconds:L,hourStep:Q,minuteStep:U,secondStep:W,shouldDisableTime:xe,labels:ce})]}),o(m,{children:[Y?e(l,{variant:"text",size:i[oe],color:te,onClick:()=>{je(null),De(!1)},children:ce.clear}):null,Z?e(l,{variant:"text",size:i[oe],color:te,disabled:ze,onClick:()=>{je(we),ve(k(we))},children:ce.now}):null,e(l,{variant:"filled",size:i[oe],color:te,onClick:()=>De(!1),children:ce.done})]})]})})});
2
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as t from"react";import{MPButton as l}from"../button/MPButton.js";import{MPIcon as n}from"../icon/MPIcon.js";import{CalendarIcon as a}from"../../constants/icons.js";import{Calendar as s,MPTimeGrid as r}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerDivider as c,MPPickerFooter as m,MPPickerShell as d,useDisplaySamples as u}from"../../internal/Picker.js";import{useMPLocale as p,useMPMessages as h}from"../../internal/locale.js";import{PICKER as f}from"../../internal/messages/picker.js";import{CONTROL_ICON as S}from"../../internal/scale.js";import{formatDate as g,isDayOutside as b,isHour12 as j,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.js";import{useMPColor as M,useMPSize as P}from"../../internal/config.js";export const MPDateTimePicker=/*@__PURE__*/t.forwardRef(function({value:I,defaultValue:N,onValueChange:V,open:B,defaultOpen:R,onOpenChange:E,defaultMonth:F,minDate:q,maxDate:A,shouldDisableDate:G,shouldDisableTime:H,locale:J,weekStartsOn:K,format:L,hour12:Q,showSeconds:U=!1,hourStep:W=1,minuteStep:X=1,secondStep:Y=1,placeholder:Z,clearable:$=!1,showNowButton:_=!0,closeOnSelect:ee=!1,labels:oe,name:te,size:le,color:ne,readOnly:ae=!1,disabled:se=!1,startIcon:re,...ie},ce){const me=P(le),de=M(ne),ue=p(J),pe=h(f,ue,oe),he=K??D(ue),fe=Q??j(ue),[Se,ge]=t.useState(N??null),be=void 0!==I?I:Se,[je,ve]=t.useState(R??!1),De=B??je,[xe,Ce]=t.useState(()=>k(v(be)?be:F??O()));t.useEffect(()=>{De&&Ce(k(v(be)?be:F??O()))},[De]);const ke=e=>{e&&(ae||se)||(void 0===B&&ve(e),E?.(e))},we=e=>{void 0===I&&ge(e),V?.(e)},ze=t.useCallback((e,o)=>{const[t,l]=w(o,e),n=C(e).getTime();return!!(v(q)&&n+1e3*l<q.getTime())||(!!(v(A)&&n+1e3*t>A.getTime())||(H?.(e,o)??!1))},[q,A,H]),Oe=L??{dateStyle:"medium",timeStyle:"short",hour12:fe},ye=new Date,Te=T(ye,{seconds:U?ye.getSeconds():0}),Me=b(Te,q,A)||(G?.(Te)??!1)||ze(Te,"second"),Pe=y(u(ue,Oe),Z);return e(d,{...ie,slug:"date-time-picker",size:me,color:de,readOnly:ae,disabled:se,triggerRef:ce,startIcon:void 0===re?e(n,{icon:a,size:S[me]}):re,display:v(be)?g(be,ue,Oe):Z??"",samples:Pe,empty:!v(be),clearable:$,onClear:()=>we(null),open:De,onOpenChange:ke,labels:pe,hiddenValues:te?[{name:te,value:v(be)?z(be,U):""}]:void 0,children:o("div",{className:"flex flex-col gap-1.5",children:[o("div",{className:"flex items-stretch gap-2",children:[e(s,{size:me,color:de,locale:ue,weekStartsOn:he,month:xe,onMonthChange:Ce,selected:[be],onSelect:e=>{const o=v(be)?x(e,be):C(e);we(o),Ce(k(o)),ee&&ke(!1)},minDate:q,maxDate:A,shouldDisableDate:G,labels:pe,autoFocus:!0}),e(c,{}),e(r,{size:me,locale:ue,value:v(be)?be:null,referenceDate:v(be)?be:O(),onChange:we,hour12:fe,showSeconds:U,hourStep:W,minuteStep:X,secondStep:Y,shouldDisableTime:ze,labels:pe})]}),o(m,{children:[$?e(l,{variant:"text",size:i[me],color:de,onClick:()=>{we(null),ke(!1)},children:pe.clear}):null,_?e(l,{variant:"text",size:i[me],color:de,disabled:Me,onClick:()=>{we(Te),Ce(k(Te))},children:pe.now}):null,e(l,{variant:"filled",size:i[me],color:de,onClick:()=>ke(!1),children:pe.done})]})]})})});
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Dialog } from '@base-ui/react/dialog';
3
- import type { MPColor, MPSize } from '../../types.js';
3
+ import type { MPColor, MPControlEventProps, MPSize } from '../../types.js';
4
4
  /**
5
5
  * A dialog takes `size` and `color` and stops there.
6
6
  *
@@ -8,7 +8,20 @@ import type { MPColor, MPSize } from '../../types.js';
8
8
  * paint against the page around it", and a modal has already taken the page.
9
9
  * There is no `elevation` prop either — see the note on the sheet below.
10
10
  */
11
- export interface MPDialogProps {
11
+ /**
12
+ * A dialog's sheet, which is where an event handler lands.
13
+ *
14
+ * The same rule the eight controls follow, applied to the one component that had
15
+ * no element a caller could reach at all: a class describes the whole dialog and
16
+ * lands on its outermost element, an event came from somewhere inside the sheet
17
+ * and lands on the sheet. So `onKeyDown` is a keystroke inside the dialog and
18
+ * never one on the trigger that opened it, and never one on the page behind.
19
+ *
20
+ * It is the popup rather than the backdrop deliberately. A key pressed while the
21
+ * dialog holds focus reaches the popup by bubbling; a click on the scrim does
22
+ * not, which is `dismissible`'s job and not this one's.
23
+ */
24
+ export interface MPDialogProps extends MPControlEventProps<HTMLElement> {
12
25
  /** The dialog is shown. Use with `onOpenChange` for a controlled dialog. */
13
26
  open?: boolean;
14
27
  /** Whether the dialog starts open, for an uncontrolled one. */
@@ -147,4 +160,4 @@ export declare const MPDialogClose: React.ForwardRefExoticComponent<Omit<import(
147
160
  * is no `variant`: a dialog that could be told to sit flat on the page would be a
148
161
  * dialog that could be told to stop being a dialog.
149
162
  */
150
- export declare function MPDialog({ open, defaultOpen, onOpenChange, trigger, icon, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, width, fullWidth, fullScreen, modal, dismissible, size, color, className, style, children }: MPDialogProps): React.JSX.Element;
163
+ export declare function MPDialog({ open, defaultOpen, onOpenChange, trigger, icon, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, width, fullWidth, fullScreen, modal, dismissible, size: sizeProp, color, onKeyDown, onKeyUp, onFocus, onBlur, onClick, onDoubleClick, onContextMenu, className, style, children }: MPDialogProps): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Dialog as t}from"@base-ui/react/dialog";import{MPIcon as i}from"../icon/MPIcon.js";import{CloseIcon as n}from"../../constants/icons.js";import{accentSlots as s}from"../../internal/accent.js";import{cssLength as o}from"../../internal/length.js";import{useMPLocale as a,useMPMessages as r}from"../../internal/locale.js";import{COMMON as m}from"../../internal/messages/common.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{SHEET_GAP as p,hasContent as d}from"../../internal/scale.js";import{FADE as x,PORTAL_LAYER as f,SCRIM as u,SHEET_MOTION as h}from"../../internal/surface.js";const g={xs:"max-w-[320px]",sm:"max-w-[400px]",md:"max-w-[560px]",lg:"max-w-[720px]",xl:"max-w-[960px]"},y=`transition-[opacity,scale] ${h}`,j=/*@__PURE__*/["motion-safe:data-starting-style:scale-95","motion-safe:data-ending-style:scale-95"].join(" "),v={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-7",xl:"p-8"},b={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-7",xl:"px-8"},w={xs:"py-3",sm:"py-4",md:"py-6",lg:"py-7",xl:"py-8"},N={xs:"text-mp-title-medium",sm:"text-mp-title-large",md:"text-mp-headline-small",lg:"text-mp-headline-medium",xl:"text-mp-headline-large"},$={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-large",xl:"text-mp-body-large"},k={xs:20,sm:22,md:24,lg:28,xl:32};export const MPDialogClose=t.Close;export function MPDialog({open:h,defaultOpen:C,onOpenChange:P,trigger:B,icon:z,title:D,description:O,actions:M,dividers:L=!1,showClose:S,closeLabel:T,locale:W,width:I,fullWidth:R=!0,fullScreen:V=!1,modal:_=!0,dismissible:q=!0,size:A="md",color:E="secondary",className:F,style:G,children:H}){const J=a(W),K=r(m,J),Q=S??V,U=d(z),X=d(D)||d(O)||U,Y=d(M),Z=L?v[A]:b[A],ee="border-mp-outline-variant border-t";return l(t.Root,{open:h,defaultOpen:C,modal:_,disablePointerDismissal:!q,onOpenChange:(e,l)=>{q||e||"escape-key"!==l.reason?P?.(e):l.cancel()},children:[B?e(t.Trigger,{render:B}):null,l(t.Portal,{children:[e(t.Backdrop,{className:`${f} fixed inset-0 ${x} ${u}`}),e(t.Viewport,{className:[f,"fixed inset-0 flex justify-center",V?"items-stretch":"items-center p-4"].join(" "),children:l(t.Popup,{"data-mp-size":A,className:["mp-dialog relative flex w-full flex-col overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 outline-none",V?"h-full max-w-none rounded-none":`rounded-mp-xl max-h-full ${void 0===I?g[A]:""}`,V||R?"":"w-auto",L?"":`${w[A]} ${p[A]}`,y,V?"":j,F??""].filter(Boolean).join(" "),style:{...s(E),...void 0===I||V?null:{maxWidth:o(I)},...G},children:[X||Q?l("div",{className:["flex shrink-0 items-start gap-3",Z,U&&!Q?"flex-col items-center text-center":""].filter(Boolean).join(" "),children:[U?e("span",{className:"flex shrink-0 items-center justify-center text-(--_mp-accent)",children:z}):null,l("div",{className:`flex min-w-0 flex-1 flex-col ${p[A]}`,children:[d(D)?e(t.Title,{className:`m-0 ${N[A]}`,children:D}):null,d(O)?e(t.Description,{className:`text-mp-on-surface-variant m-0 ${$[A]}`,children:O}):null]}),Q?l(t.Close,{"aria-label":T??K.close,className:["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(c,{}),e(i,{icon:n,size:k[A]})]}):null]}):null,d(H)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",$[A],Z,L&&(X||Q)?ee:""].filter(Boolean).join(" "),children:H}):null,Y?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",Z,L?ee:""].filter(Boolean).join(" "),children:M}):null]})})]})]})}
2
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Dialog as n}from"@base-ui/react/dialog";import{MPIcon as o}from"../icon/MPIcon.js";import{CloseIcon as t}from"../../constants/icons.js";import{accentSlots as i}from"../../internal/accent.js";import{cssLength as s}from"../../internal/length.js";import{useMPLocale as a,useMPMessages as r}from"../../internal/locale.js";import{COMMON as m}from"../../internal/messages/common.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{SHEET_GAP as p,hasContent as d}from"../../internal/scale.js";import{FADE as x,PORTAL_LAYER as f,SCRIM as u,SHEET_MOTION as h}from"../../internal/surface.js";import{useMPSize as g}from"../../internal/config.js";const y={xs:"max-w-[320px]",sm:"max-w-[400px]",md:"max-w-[560px]",lg:"max-w-[720px]",xl:"max-w-[960px]"},j=`transition-[opacity,scale] ${h}`,b=/*@__PURE__*/["motion-safe:data-starting-style:scale-95","motion-safe:data-ending-style:scale-95"].join(" "),v={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-7",xl:"p-8"},w={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-7",xl:"px-8"},C={xs:"py-3",sm:"py-4",md:"py-6",lg:"py-7",xl:"py-8"},N={xs:"text-mp-title-medium",sm:"text-mp-title-large",md:"text-mp-headline-small",lg:"text-mp-headline-medium",xl:"text-mp-headline-large"},k={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-large",xl:"text-mp-body-large"},$={xs:20,sm:22,md:24,lg:28,xl:32};export const MPDialogClose=n.Close;export function MPDialog({open:h,defaultOpen:D,onOpenChange:B,trigger:P,icon:M,title:z,description:K,actions:O,dividers:F=!1,showClose:L,closeLabel:S,locale:T,width:U,fullWidth:W=!0,fullScreen:I=!1,modal:R=!0,dismissible:V=!0,size:_,color:q="secondary",onKeyDown:A,onKeyUp:E,onFocus:G,onBlur:H,onClick:J,onDoubleClick:Q,onContextMenu:X,className:Y,style:Z,children:ee}){const le=g(_),ne=a(T),oe=r(m,ne),te=L??I,ie=d(M),se=d(z)||d(K)||ie,ae=d(O),re=F?v[le]:w[le],me="border-mp-outline-variant border-t";return l(n.Root,{open:h,defaultOpen:D,modal:R,disablePointerDismissal:!V,onOpenChange:(e,l)=>{V||e||"escape-key"!==l.reason?B?.(e):l.cancel()},children:[P?e(n.Trigger,{render:P}):null,l(n.Portal,{children:[e(n.Backdrop,{className:`${f} fixed inset-0 ${x} ${u}`}),e(n.Viewport,{className:[f,"fixed inset-0 flex justify-center",I?"items-stretch":"items-center p-4"].join(" "),children:l(n.Popup,{"data-mp-size":le,onKeyDown:A,onKeyUp:E,onFocus:G,onBlur:H,onClick:J,onDoubleClick:Q,onContextMenu:X,className:["mp-dialog relative flex w-full flex-col overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 outline-none",I?"h-full max-w-none rounded-none":`rounded-mp-xl max-h-full ${void 0===U?y[le]:""}`,I||W?"":"w-auto",F?"":`${C[le]} ${p[le]}`,j,I?"":b,Y??""].filter(Boolean).join(" "),style:{...i(q),...void 0===U||I?null:{maxWidth:s(U)},...Z},children:[se||te?l("div",{className:["flex shrink-0 items-start gap-3",re,ie&&!te?"flex-col items-center text-center":""].filter(Boolean).join(" "),children:[ie?e("span",{className:"flex shrink-0 items-center justify-center text-(--_mp-accent)",children:M}):null,l("div",{className:`flex min-w-0 flex-1 flex-col ${p[le]}`,children:[d(z)?e(n.Title,{className:`m-0 ${N[le]}`,children:z}):null,d(K)?e(n.Description,{className:`text-mp-on-surface-variant m-0 ${k[le]}`,children:K}):null]}),te?l(n.Close,{"aria-label":S??oe.close,className:["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(c,{}),e(o,{icon:t,size:$[le]})]}):null]}):null,d(ee)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",k[le],re,F&&(se||te)?me:""].filter(Boolean).join(" "),children:ee}):null,ae?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",re,F?me:""].filter(Boolean).join(" "),children:O}):null]})})]})]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{Separator as l}from"@base-ui/react/separator";import{hasContent as a}from"../../internal/scale.js";import{cssLength as i}from"../../internal/length.js";const o="[border-color:var(--_mp-line)]",n={horizontal:{start:["w-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","w-4 shrink-0"]},vertical:{start:["h-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","h-4 shrink-0"]}},s={xs:"text-mp-label-small",sm:"text-mp-label-small",md:"text-mp-label-medium",lg:"text-mp-label-large",xl:"text-mp-label-large"},m={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const MPDivider=/*@__PURE__*/t.forwardRef(function({orientation:t="horizontal",color:d,size:p="md",length:c,thickness:f,textAlign:h="center",className:x,style:u,children:v,...b},w){const g="vertical"===t,_=a(v),j={"--_mp-line":d?`var(--_mp-color-${d})`:"var(--_mp-color-outline-variant)","--_mp-rule":i(f)??"1px"},$=i(c),k={...j,...void 0===$?null:g?{height:$}:{width:$},...u};if(!_)return e(l,{ref:w,orientation:t,"data-mp-size":p,className:["mp-divider",g?"w-0 border-l [border-left-width:var(--_mp-rule)] "+(void 0===$?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--_mp-rule)]",o,x??""].filter(Boolean).join(" "),style:k,...b});const[N,z]=n[t][h],y=g?"w-0 border-l [border-left-width:var(--_mp-rule)]":"h-0 border-t [border-top-width:var(--_mp-rule)]";return r(l,{ref:w,orientation:t,"aria-label":"string"==typeof v?v:void 0,"data-mp-size":p,className:["mp-divider flex items-center",g?"w-auto flex-col "+(void 0===$?"self-stretch":""):"w-full",m[p],x??""].filter(Boolean).join(" "),style:k,...b,children:[e("span",{"aria-hidden":"true",className:`${y} ${N} ${o}`}),e("span",{className:["text-mp-on-surface-variant shrink-0 whitespace-nowrap",s[p],g?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:v}),e("span",{"aria-hidden":"true",className:`${y} ${z} ${o}`})]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{Separator as l}from"@base-ui/react/separator";import{hasContent as a}from"../../internal/scale.js";import{cssLength as i}from"../../internal/length.js";import{useMPSize as o}from"../../internal/config.js";const n="[border-color:var(--_mp-line)]",s={horizontal:{start:["w-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","w-4 shrink-0"]},vertical:{start:["h-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","h-4 shrink-0"]}},m={xs:"text-mp-label-small",sm:"text-mp-label-small",md:"text-mp-label-medium",lg:"text-mp-label-large",xl:"text-mp-label-large"},p={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const MPDivider=/*@__PURE__*/t.forwardRef(function({orientation:t="horizontal",color:d,size:c,length:f,thickness:h,textAlign:x="center",className:u,style:v,children:b,...g},w){const j=o(c),_="vertical"===t,$=a(b),k={"--_mp-line":d?`var(--_mp-color-${d})`:"var(--_mp-color-outline-variant)","--_mp-rule":i(h)??"1px"},N=i(f),z={...k,...void 0===N?null:_?{height:N}:{width:N},...v};if(!$)return e(l,{ref:w,orientation:t,"data-mp-size":j,className:["mp-divider",_?"w-0 border-l [border-left-width:var(--_mp-rule)] "+(void 0===N?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--_mp-rule)]",n,u??""].filter(Boolean).join(" "),style:z,...g});const[y,B]=s[t][x],A=_?"w-0 border-l [border-left-width:var(--_mp-rule)]":"h-0 border-t [border-top-width:var(--_mp-rule)]";return r(l,{ref:w,orientation:t,"aria-label":"string"==typeof b?b:void 0,"data-mp-size":j,className:["mp-divider flex items-center",_?"w-auto flex-col "+(void 0===N?"self-stretch":""):"w-full",p[j],u??""].filter(Boolean).join(" "),style:z,...g,children:[e("span",{"aria-hidden":"true",className:`${A} ${y} ${n}`}),e("span",{className:["text-mp-on-surface-variant shrink-0 whitespace-nowrap",m[j],_?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:b}),e("span",{"aria-hidden":"true",className:`${A} ${B} ${n}`})]})});
@@ -184,4 +184,4 @@ export declare const MPDrawerClose: React.ForwardRefExoticComponent<Omit<import(
184
184
  * `SLIDE` gives a reader who asked for less motion the old behaviour exactly:
185
185
  * the fade, with nowhere to travel from.
186
186
  */
187
- export declare function MPDrawer({ side, mode, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, extent, rounded, dismissible, size, className, style, children }: MPDrawerProps): React.JSX.Element | null;
187
+ export declare function MPDrawer({ side, mode, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, locale: localeProp, extent, rounded, dismissible, size: sizeProp, className, style, children }: MPDrawerProps): React.JSX.Element | null;