material-plus-ui 1.3.1 → 1.4.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 (253) hide show
  1. package/README.md +2 -2
  2. package/dist/components/alert/MPAlert.d.ts +26 -0
  3. package/dist/components/alert/MPAlert.js +1 -1
  4. package/dist/components/alert/index.d.ts +1 -1
  5. package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
  6. package/dist/components/avatar/MPAvatar.js +1 -1
  7. package/dist/components/avatar-group/MPAvatarGroup.d.ts +74 -0
  8. package/dist/components/avatar-group/MPAvatarGroup.js +2 -0
  9. package/dist/components/avatar-group/index.d.ts +2 -0
  10. package/dist/components/avatar-group/index.js +1 -0
  11. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +10 -4
  12. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  13. package/dist/components/button/MPButton.js +1 -1
  14. package/dist/components/button-group/MPButtonGroup.d.ts +9 -0
  15. package/dist/components/button-group/MPButtonGroup.js +1 -1
  16. package/dist/components/carousel/MPCarousel.d.ts +12 -7
  17. package/dist/components/carousel/MPCarousel.js +1 -1
  18. package/dist/components/chat-bubble/MPChatBubble.d.ts +15 -2
  19. package/dist/components/chat-bubble/MPChatBubble.js +1 -1
  20. package/dist/components/color-picker/MPColorPicker.d.ts +20 -17
  21. package/dist/components/color-picker/MPColorPicker.js +1 -1
  22. package/dist/components/combobox/MPCombobox.d.ts +22 -4
  23. package/dist/components/combobox/MPCombobox.js +1 -1
  24. package/dist/components/command-palette/MPCommandPalette.d.ts +132 -0
  25. package/dist/components/command-palette/MPCommandPalette.js +2 -0
  26. package/dist/components/command-palette/index.d.ts +2 -0
  27. package/dist/components/command-palette/index.js +1 -0
  28. package/dist/components/container/MPContainer.js +1 -1
  29. package/dist/components/date-time-picker/MPDateTimePicker.d.ts +5 -0
  30. package/dist/components/dialog/MPDialog.js +1 -1
  31. package/dist/components/divider/MPDivider.js +1 -1
  32. package/dist/components/drawer/MPDrawer.js +1 -1
  33. package/dist/components/fieldset/MPFieldset.d.ts +52 -0
  34. package/dist/components/fieldset/MPFieldset.js +2 -0
  35. package/dist/components/fieldset/index.d.ts +2 -0
  36. package/dist/components/fieldset/index.js +1 -0
  37. package/dist/components/file-picker/MPFilePicker.d.ts +4 -3
  38. package/dist/components/file-picker/MPFilePicker.js +1 -1
  39. package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
  40. package/dist/components/footer/MPFooter.d.ts +94 -0
  41. package/dist/components/footer/MPFooter.js +2 -0
  42. package/dist/components/footer/index.d.ts +2 -0
  43. package/dist/components/footer/index.js +1 -0
  44. package/dist/components/form/MPForm.d.ts +73 -0
  45. package/dist/components/form/MPForm.js +2 -0
  46. package/dist/components/form/index.d.ts +2 -0
  47. package/dist/components/form/index.js +1 -0
  48. package/dist/components/header/MPHeader.d.ts +122 -0
  49. package/dist/components/header/MPHeader.js +2 -0
  50. package/dist/components/header/index.d.ts +2 -0
  51. package/dist/components/header/index.js +1 -0
  52. package/dist/components/highlight/MPHighlight.d.ts +7 -0
  53. package/dist/components/menu/MPMenu.js +1 -1
  54. package/dist/components/menubar/MPMenubar.d.ts +82 -0
  55. package/dist/components/menubar/MPMenubar.js +2 -0
  56. package/dist/components/menubar/index.d.ts +2 -0
  57. package/dist/components/menubar/index.js +1 -0
  58. package/dist/components/navigation-menu/MPNavigationMenu.d.ts +151 -0
  59. package/dist/components/navigation-menu/MPNavigationMenu.js +2 -0
  60. package/dist/components/navigation-menu/index.d.ts +2 -0
  61. package/dist/components/navigation-menu/index.js +1 -0
  62. package/dist/components/number-field/MPNumberField.d.ts +12 -3
  63. package/dist/components/number-field/MPNumberField.js +1 -1
  64. package/dist/components/overlay/MPOverlay.d.ts +8 -2
  65. package/dist/components/overlay/MPOverlay.js +1 -1
  66. package/dist/components/page-layout/MPPageLayout.d.ts +145 -0
  67. package/dist/components/page-layout/MPPageLayout.js +2 -0
  68. package/dist/components/page-layout/index.d.ts +2 -0
  69. package/dist/components/page-layout/index.js +1 -0
  70. package/dist/components/panes/MPPanes.js +1 -1
  71. package/dist/components/popover/MPPopover.js +1 -1
  72. package/dist/components/progress-box/MPProgressBox.js +1 -1
  73. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  74. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  75. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  76. package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
  77. package/dist/components/select/MPSelect.d.ts +12 -1
  78. package/dist/components/select/MPSelect.js +1 -1
  79. package/dist/components/shortcut/MPShortcut.js +1 -1
  80. package/dist/components/sidebar/MPSidebar.d.ts +160 -0
  81. package/dist/components/sidebar/MPSidebar.js +2 -0
  82. package/dist/components/sidebar/MPSidebarTrigger.d.ts +45 -0
  83. package/dist/components/sidebar/MPSidebarTrigger.js +2 -0
  84. package/dist/components/sidebar/index.d.ts +4 -0
  85. package/dist/components/sidebar/index.js +1 -0
  86. package/dist/components/skeleton/MPSkeleton.js +1 -1
  87. package/dist/components/slider/MPSlider.js +1 -1
  88. package/dist/components/snackbar/MPSnackbar.js +1 -1
  89. package/dist/components/switch/MPSwitch.js +1 -1
  90. package/dist/components/table/MPTable.d.ts +27 -5
  91. package/dist/components/table/MPTable.js +1 -1
  92. package/dist/components/text-field/MPTextField.d.ts +13 -2
  93. package/dist/components/text-field/MPTextField.js +1 -1
  94. package/dist/components/text-link/MPTextLink.d.ts +7 -1
  95. package/dist/components/text-link/MPTextLink.js +1 -1
  96. package/dist/components/time-picker/MPTimePicker.d.ts +4 -0
  97. package/dist/components/toggle/MPToggle.d.ts +72 -0
  98. package/dist/components/toggle/MPToggle.js +2 -0
  99. package/dist/components/toggle/index.d.ts +2 -0
  100. package/dist/components/toggle/index.js +1 -0
  101. package/dist/components/toggle-group/MPToggleGroup.d.ts +74 -0
  102. package/dist/components/toggle-group/MPToggleGroup.js +2 -0
  103. package/dist/components/toggle-group/index.d.ts +2 -0
  104. package/dist/components/toggle-group/index.js +1 -0
  105. package/dist/components/tooltip/MPTooltip.js +1 -1
  106. package/dist/components/transfer/MPTransfer.d.ts +98 -0
  107. package/dist/components/transfer/MPTransfer.js +2 -0
  108. package/dist/components/transfer/index.d.ts +2 -0
  109. package/dist/components/transfer/index.js +1 -0
  110. package/dist/constants/glyphs.d.ts +10 -0
  111. package/dist/constants/glyphs.js +1 -1
  112. package/dist/constants/icons.d.ts +1 -0
  113. package/dist/constants/icons.js +1 -1
  114. package/dist/index.d.ts +13 -0
  115. package/dist/index.js +1 -1
  116. package/dist/internal/Calendar.js +1 -1
  117. package/dist/internal/FieldOutline.js +1 -1
  118. package/dist/internal/SupportingText.d.ts +1 -1
  119. package/dist/internal/SupportingText.js +1 -1
  120. package/dist/internal/animate.d.ts +0 -17
  121. package/dist/internal/animate.js +1 -1
  122. package/dist/internal/avatar-group.d.ts +22 -0
  123. package/dist/internal/avatar-group.js +2 -0
  124. package/dist/internal/button-group.d.ts +20 -1
  125. package/dist/internal/button-group.js +1 -1
  126. package/dist/internal/color.d.ts +0 -5
  127. package/dist/internal/color.js +1 -1
  128. package/dist/internal/date.js +1 -1
  129. package/dist/internal/i18n.d.ts +201 -4
  130. package/dist/internal/keys.d.ts +72 -0
  131. package/dist/internal/keys.js +2 -0
  132. package/dist/internal/length.d.ts +42 -0
  133. package/dist/internal/length.js +1 -0
  134. package/dist/internal/link.d.ts +44 -0
  135. package/dist/internal/link.js +1 -0
  136. package/dist/internal/locale.d.ts +20 -1
  137. package/dist/internal/locale.js +1 -1
  138. package/dist/internal/messages/breadcrumb.d.ts +3 -0
  139. package/dist/internal/messages/breadcrumb.js +1 -0
  140. package/dist/internal/messages/carousel.d.ts +3 -0
  141. package/dist/internal/messages/carousel.js +1 -0
  142. package/dist/internal/messages/color-picker.d.ts +3 -0
  143. package/dist/internal/messages/color-picker.js +1 -0
  144. package/dist/internal/messages/combobox.d.ts +3 -0
  145. package/dist/internal/messages/combobox.js +1 -0
  146. package/dist/internal/messages/command.d.ts +3 -0
  147. package/dist/internal/messages/command.js +1 -0
  148. package/dist/internal/messages/file-picker.d.ts +3 -0
  149. package/dist/internal/messages/file-picker.js +1 -0
  150. package/dist/internal/messages/layout.d.ts +3 -0
  151. package/dist/internal/messages/layout.js +1 -0
  152. package/dist/internal/messages/number-field.d.ts +3 -0
  153. package/dist/internal/messages/number-field.js +1 -0
  154. package/dist/internal/messages/overlay.d.ts +3 -0
  155. package/dist/internal/messages/overlay.js +1 -0
  156. package/dist/internal/messages/table.d.ts +3 -0
  157. package/dist/internal/messages/table.js +1 -0
  158. package/dist/internal/messages/text-link.d.ts +3 -0
  159. package/dist/internal/messages/text-link.js +1 -0
  160. package/dist/internal/messages/transfer.d.ts +3 -0
  161. package/dist/internal/messages/transfer.js +1 -0
  162. package/dist/internal/page-layout.d.ts +182 -0
  163. package/dist/internal/page-layout.js +2 -0
  164. package/dist/internal/scale.d.ts +17 -0
  165. package/dist/internal/scale.js +1 -1
  166. package/dist/locales/ar.js +1 -1
  167. package/dist/locales/de.js +1 -1
  168. package/dist/locales/es.js +1 -1
  169. package/dist/locales/fr.js +1 -1
  170. package/dist/locales/hi.js +1 -1
  171. package/dist/locales/id.js +1 -1
  172. package/dist/locales/it.js +1 -1
  173. package/dist/locales/ja.js +1 -1
  174. package/dist/locales/ko.js +1 -1
  175. package/dist/locales/nl.js +1 -1
  176. package/dist/locales/pl.js +1 -1
  177. package/dist/locales/pt.js +1 -1
  178. package/dist/locales/ru.js +1 -1
  179. package/dist/locales/th.js +1 -1
  180. package/dist/locales/tr.js +1 -1
  181. package/dist/locales/vi.js +1 -1
  182. package/dist/locales/zh-hans.js +1 -1
  183. package/dist/locales/zh-hant.js +1 -1
  184. package/dist/styles/accordion.css +1 -1
  185. package/dist/styles/alert.css +1 -1
  186. package/dist/styles/avatar-group.css +2 -0
  187. package/dist/styles/avatar.css +1 -1
  188. package/dist/styles/badge.css +1 -1
  189. package/dist/styles/blockquote.css +1 -1
  190. package/dist/styles/bottom-navigation.css +1 -1
  191. package/dist/styles/box.css +1 -1
  192. package/dist/styles/breadcrumb.css +1 -1
  193. package/dist/styles/button-group.css +1 -1
  194. package/dist/styles/button.css +1 -1
  195. package/dist/styles/card.css +1 -1
  196. package/dist/styles/carousel.css +1 -1
  197. package/dist/styles/chat-bubble.css +1 -1
  198. package/dist/styles/checkbox.css +1 -1
  199. package/dist/styles/chip.css +1 -1
  200. package/dist/styles/collapsible.css +1 -1
  201. package/dist/styles/color-picker.css +1 -1
  202. package/dist/styles/combobox.css +1 -1
  203. package/dist/styles/command-palette.css +2 -0
  204. package/dist/styles/date-picker.css +1 -1
  205. package/dist/styles/date-range-picker.css +1 -1
  206. package/dist/styles/date-time-picker.css +1 -1
  207. package/dist/styles/dialog.css +1 -1
  208. package/dist/styles/divider.css +1 -1
  209. package/dist/styles/drawer.css +1 -1
  210. package/dist/styles/empty.css +1 -1
  211. package/dist/styles/fieldset.css +2 -0
  212. package/dist/styles/file-picker.css +1 -1
  213. package/dist/styles/floating-action-button.css +1 -1
  214. package/dist/styles/footer.css +2 -0
  215. package/dist/styles/form.css +2 -0
  216. package/dist/styles/header.css +2 -0
  217. package/dist/styles/highlight.css +1 -1
  218. package/dist/styles/icon-button.css +1 -1
  219. package/dist/styles/list.css +1 -1
  220. package/dist/styles/locale.css +1 -1
  221. package/dist/styles/menu.css +1 -1
  222. package/dist/styles/menubar.css +2 -0
  223. package/dist/styles/navigation-menu.css +2 -0
  224. package/dist/styles/number-field.css +1 -1
  225. package/dist/styles/otp-field.css +1 -1
  226. package/dist/styles/overlay.css +1 -1
  227. package/dist/styles/page-layout.css +2 -0
  228. package/dist/styles/pagination.css +1 -1
  229. package/dist/styles/panes.css +1 -1
  230. package/dist/styles/pill.css +1 -1
  231. package/dist/styles/popover.css +1 -1
  232. package/dist/styles/progress-box.css +1 -1
  233. package/dist/styles/progress-circular.css +1 -1
  234. package/dist/styles/progress-linear.css +1 -1
  235. package/dist/styles/radio-group.css +1 -1
  236. package/dist/styles/segmented-button.css +1 -1
  237. package/dist/styles/select.css +1 -1
  238. package/dist/styles/sidebar.css +2 -0
  239. package/dist/styles/skeleton.css +1 -1
  240. package/dist/styles/slider.css +1 -1
  241. package/dist/styles/spoiler.css +1 -1
  242. package/dist/styles/switch.css +1 -1
  243. package/dist/styles/table.css +1 -1
  244. package/dist/styles/tabs.css +1 -1
  245. package/dist/styles/text-field.css +1 -1
  246. package/dist/styles/text-link.css +1 -1
  247. package/dist/styles/time-picker.css +1 -1
  248. package/dist/styles/timeline.css +1 -1
  249. package/dist/styles/toggle-group.css +2 -0
  250. package/dist/styles/toggle.css +2 -0
  251. package/dist/styles/transfer.css +2 -0
  252. package/dist/styles.css +1 -1
  253. package/package.json +2 -2
@@ -28,7 +28,21 @@ type Selection<Multiple extends boolean | undefined> = Multiple extends true ? M
28
28
  export interface MPComboboxProps<Multiple extends boolean | undefined = false> extends MPStyleProps {
29
29
  /**
30
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.
31
+ * reason: what a caller has is almost always an array already. *
32
+ * ## How long a list this holds
33
+ *
34
+ * Every row is rendered, and there is no windowing. That is the right default
35
+ * — windowing costs a measured container, a scroll listener and a row height
36
+ * the component would have to decide for the caller — and it has a ceiling: a
37
+ * few hundred rows is nothing, a few thousand is a visible pause when the list
38
+ * opens, and past that the answer is a narrower list rather than a faster one.
39
+ *
40
+ * A list somebody has to scroll ten thousand rows of is a list that wanted a
41
+ * filter. Where it genuinely is that long, window it yourself and pass the
42
+ * slice.
43
+ *
44
+ * `limit` is the lighter tool here: it caps what the *popup* draws while
45
+ * leaving the filter to search everything.
32
46
  */
33
47
  items: readonly MPComboboxOption[];
34
48
  /**
@@ -54,7 +68,11 @@ export interface MPComboboxProps<Multiple extends boolean | undefined = false> e
54
68
  * @default true
55
69
  */
56
70
  allowCustom?: boolean;
57
- /** What that row says. Receives the trimmed query. */
71
+ /**
72
+ * What that row says. Receives the trimmed query.
73
+ *
74
+ * Left out, it is the wording in `locale` with the query set into it.
75
+ */
58
76
  customLabel?: (query: string) => React.ReactNode;
59
77
  /**
60
78
  * Shows a × that empties the field. Off by default — a field that can be
@@ -63,8 +81,8 @@ export interface MPComboboxProps<Multiple extends boolean | undefined = false> e
63
81
  */
64
82
  clearable?: boolean;
65
83
  /**
66
- * Shown in the popup when nothing matches and no value may be added.
67
- * @default 'No matches'
84
+ * Shown in the popup when nothing matches and no value may be added. Defaults
85
+ * to the wording in `locale`.
68
86
  */
69
87
  emptyMessage?: React.ReactNode;
70
88
  /** The most rows the list will show at once. `-1` is all of them. @default -1 */
@@ -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{Combobox as i}from"@base-ui/react/combobox";import{Field as n}from"@base-ui/react/field";import{MPChip as t}from"../chip/MPChip.js";import{MPIcon as r}from"../icon/MPIcon.js";import{AddIcon as o,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons.js";import{MPFieldLabel as d,MPFieldOutline as u,useFloatingLabel as p}from"../../internal/FieldOutline.js";import{fillMessage as h}from"../../internal/i18n.js";import{useMPLocale as f,useMPMessages as g}from"../../internal/locale.js";import{COMMON as b}from"../../internal/messages/common.js";import{MPStateLayer as x}from"../../internal/StateLayer.js";import{MPSupportingText as v}from"../../internal/SupportingText.js";import{CONTROL_ICON as y,PROSE_TEXT as j,hasContent as N}from"../../internal/scale.js";import{FADE as w,PORTAL_LAYER as C}from"../../internal/surface.js";const L={xs:{padding:"ps-2 pe-1",height:"h-8"},sm:{padding:"ps-3 pe-1.5",height:"h-10"},md:{padding:"ps-4 pe-2",height:"h-14"},lg:{padding:"ps-4 pe-2",height:"h-16"},xl:{padding:"ps-5 pe-2.5",height:"h-18"}},I={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"},S={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function z(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:M,multiple:O,value:V,defaultValue:k,onValueChange:P,onInputValueChange:q,allowCustom:A=!0,customLabel:T,clearable:$=!1,emptyMessage:R="No matches",limit:_,placeholder:F,label:E,floatingLabel:B=!0,description:G,errorMessage:H,startIcon:W,size:D="md",fullWidth:J=!1,required:K=!1,disabled:Q=!1,readOnly:U=!1,name:X,open:Y,defaultOpen:Z,onOpenChange:ee,clearLabel:ae,openLabel:le,locale:ie,removeLabel:ne,inputRef:te,id:re,className:oe,style:se}){const me=f(ie),ce=g(b,me),de=N(H),ue=!0===O,pe=L[D],he=l.useId(),fe=re??he,ge=l.useMemo(()=>M.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[M]),[be,xe]=l.useState(()=>z(k)),ve=void 0===V?be:z(V),[ye,je]=l.useState(""),{shrunk:Ne,focusProps:we}=p({floating:B&&N(E),filled:ve.length>0||""!==ye,pinned:!!W}),Ce=l.useCallback(e=>ge.find(a=>a.value===e)??{value:e,label:String(e),custom:!0},[ge]),Le=ye.trim(),Ie=Le.toLocaleLowerCase(),Se=""===Le||ge.some(e=>e.label.toLocaleLowerCase()===Ie||String(e.value).toLocaleLowerCase()===Ie)||ve.some(e=>String(e).toLocaleLowerCase()===Ie),ze=!A||U||Q||Se?null:Le,Me=l.useMemo(()=>null===ze?ge:[...ge,{value:ze,label:ze,custom:!0}],[ge,ze]),Oe=ue?ve.map(Ce):ve.length>0?Ce(ve[0]):null;const Ve=/*@__PURE__*/["min-w-0 flex-1 self-stretch bg-transparent font-[inherit] text-inherit outline-none","placeholder:text-mp-on-surface-variant",Q?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),ke=/*@__PURE__*/["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer items-center justify-center","text-mp-on-surface-variant","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),Pe=a=>e(i.Input,{ref:te,id:fe,placeholder:Ne?F:void 0,className:ue?`${Ve} min-w-16 ${a?"ms-1.5":""}`:Ve});return a(n.Root,{disabled:Q,invalid:de,"data-mp-size":D,className:["mp-combobox group flex-col align-top",J?"flex w-full":"inline-flex w-fit",oe??""].filter(Boolean).join(" "),style:se,...we,children:[a(i.Root,{name:X,items:Me,multiple:ue,value:Oe,onValueChange:e=>{!function(e){void 0===V&&xe(e),P?.(ue?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{je(e),q?.(e)},open:Y,defaultOpen:Z,onOpenChange:e=>ee?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:_,disabled:Q,readOnly:U,required:K,children:[a("div",{className:"relative w-full",children:[a(i.InputGroup,{className:["relative flex w-full items-center gap-2",pe.padding,ue?I[D]:pe.height,j[D],Q?"cursor-default":"cursor-text"].join(" "),children:[W?e("span",{className:["flex shrink-0 items-center",Q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:W}):null,ue?e(i.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(i.Value,{children:n=>a(l.Fragment,{children:[n.map(a=>e(i.Chip,{render:e(t,{variant:de?"outlined":"tonal",color:de?"error":"primary",size:S[D],disabled:Q,endIcon:U||Q?null:e(i.ChipRemove,{"aria-label":ne?ne(a.label):h(ce.removeNamed,{label:a.label}),className:"flex cursor-pointer items-center opacity-70 hover:opacity-100",children:e(r,{icon:c,size:16})})}),children:a.label},String(a.value))),Pe(n.length>0)]})})}):Pe(!1),$&&!U?a(i.Clear,{"aria-label":ae??ce.clear,className:ke,children:[e(x,{}),e(r,{icon:c,size:y[D]})]}):null,a(i.Trigger,{"aria-label":le??ce.open,className:ke,children:[e(x,{}),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:y[D]})})]})]}),e(u,{label:E,required:K,notched:Ne}),N(E)?e(d,{size:D,label:E,required:K,htmlFor:fe,shrunk:Ne}):null]}),e(i.Portal,{children:e(i.Positioner,{className:C,sideOffset:4,children:a(i.Popup,{className:["mp-combobox__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface w-[var(--anchor-width)] outline-none","max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",j[D],w].join(" "),children:[e(i.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:R}),e(i.List,{children:l=>a(i.Item,{value:l,disabled:l.disabled,className:["mp-combobox__item group rounded-mp-xs relative flex cursor-pointer","items-center gap-3 py-2 ps-2 pe-3 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","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(x,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),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?T?T(l.label):`Add “${l.label}”`:l.label})]},`${l.custom?"custom:":""}${String(l.value)}`)})]})})})]}),e(v,{description:G,errorMessage:H,className:pe.padding})]})}
2
+ 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.js";import{MPIcon as o}from"../icon/MPIcon.js";import{AddIcon as r,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons.js";import{MPFieldLabel as d,MPFieldOutline as p,useFloatingLabel as u}from"../../internal/FieldOutline.js";import{fillMessage as h}from"../../internal/i18n.js";import{useMPLocale as f,useMPMessages as g}from"../../internal/locale.js";import{COMBOBOX as b}from"../../internal/messages/combobox.js";import{COMMON as x}from"../../internal/messages/common.js";import{MPStateLayer as v}from"../../internal/StateLayer.js";import{MPSupportingText as y}from"../../internal/SupportingText.js";import{CONTROL_ICON as j,PROSE_TEXT as w,hasContent as N}from"../../internal/scale.js";import{FADE as C,PORTAL_LAYER as L}from"../../internal/surface.js";const S={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"}},I={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"},z={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function M(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:O,multiple:V,value:k,defaultValue:P,onValueChange:$,onInputValueChange:q,allowCustom:T=!0,customLabel:A,clearable:R=!1,emptyMessage:_,limit:F,placeholder:E,label:B,floatingLabel:G=!0,description:H,errorMessage:W,startIcon:D,size:J="md",fullWidth:K=!1,required:Q=!1,disabled:U=!1,readOnly:X=!1,name:Y,open:Z,defaultOpen:ee,onOpenChange:ae,clearLabel:le,openLabel:ie,locale:ne,removeLabel:te,inputRef:oe,id:re,className:se,style:me}){const ce=f(ne),de=g(x,ce),pe=g(b,ce),ue=N(W),he=!0===V,fe=S[J],ge=l.useId(),be=re??ge,xe=l.useMemo(()=>O.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[O]),[ve,ye]=l.useState(()=>M(P)),je=void 0===k?ve:M(k),[we,Ne]=l.useState(""),{shrunk:Ce,focusProps:Le}=u({floating:G&&N(B),filled:je.length>0||""!==we,pinned:!!D}),Se=l.useMemo(()=>new Map(xe.map(e=>[e.value,e])),[xe]),Ie=l.useMemo(()=>{const e=new Set;for(const a of xe)e.add(a.label.toLocaleLowerCase()),e.add(String(a.value).toLocaleLowerCase());return e},[xe]),ze=l.useCallback(e=>Se.get(e)??{value:e,label:String(e),custom:!0},[Se]),Me=we.trim(),Oe=Me.toLocaleLowerCase(),Ve=""===Me||Ie.has(Oe)||je.some(e=>String(e).toLocaleLowerCase()===Oe),ke=!T||X||U||Ve?null:Me,Pe=l.useMemo(()=>null===ke?xe:[...xe,{value:ke,label:ke,custom:!0}],[xe,ke]),$e=he?je.map(ze):je.length>0?ze(je[0]):null;const qe=/*@__PURE__*/["min-w-0 flex-1 self-stretch bg-transparent font-[inherit] text-inherit outline-none","placeholder:text-mp-on-surface-variant",U?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Te=/*@__PURE__*/["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(" "),Ae=a=>e(i.Input,{ref:oe,id:be,placeholder:Ce?E:void 0,className:he?`${qe} min-w-16 ${a?"ms-1.5":""}`:qe});return a(n.Root,{disabled:U,invalid:ue,"data-mp-size":J,className:["mp-combobox group flex-col align-top",K?"flex w-full":"inline-flex w-fit",se??""].filter(Boolean).join(" "),style:me,...Le,children:[a(i.Root,{name:Y,items:Pe,multiple:he,value:$e,onValueChange:e=>{!function(e){void 0===k&&ye(e),$?.(he?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{Ne(e),q?.(e)},open:Z,defaultOpen:ee,onOpenChange:e=>ae?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:F,disabled:U,readOnly:X,required:Q,children:[a("div",{className:"relative w-full",children:[a(i.InputGroup,{className:["relative flex w-full items-center gap-2",fe.padding,he?I[J]:fe.height,w[J],U?"cursor-default":"cursor-text"].join(" "),children:[D?e("span",{className:["flex shrink-0 items-center",U?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:D}):null,he?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,l)=>e(i.Chip,{render:e(t,{variant:ue?"outlined":"tonal",color:ue?"error":"primary",size:z[J],disabled:U,endIcon:X||U?null:e(i.ChipRemove,{"aria-label":te?te(a.label):h(de.removeNamed,{label:a.label}),className:"flex cursor-pointer items-center opacity-70 hover:opacity-100",children:e(o,{icon:c,size:16})})}),children:a.label},`${l}:${String(a.value)}`)),Ae(n.length>0)]})})}):Ae(!1),R&&!X?a(i.Clear,{"aria-label":le??de.clear,className:Te,children:[e(v,{}),e(o,{icon:c,size:j[J]})]}):null,a(i.Trigger,{"aria-label":ie??de.open,className:Te,children:[e(v,{}),e(i.Icon,{className:["relative flex items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180"].join(" "),children:e(o,{icon:m,size:j[J]})})]})]}),e(p,{label:B,required:Q,notched:Ce}),N(B)?e(d,{size:J,label:B,required:Q,htmlFor:be,shrunk:Ce}):null]}),e(i.Portal,{children:e(i.Positioner,{className:L,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",w[J],C].join(" "),children:[e(i.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:_??pe.empty}),e(i.List,{children:(l,n)=>a(i.Item,{value:l,disabled:l.disabled,className:["mp-combobox__item group rounded-mp-xs relative flex cursor-pointer","items-center gap-3 py-2 ps-2 pe-3 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","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(v,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:l.custom?e(o,{icon:r,size:18}):e(i.ItemIndicator,{children:e(o,{icon:s,size:18})})}),e("span",{className:"min-w-0 flex-1 truncate",children:l.custom?A?A(l.label):h(pe.add,{label:l.label}):l.label})]},`${n}:${l.custom?"custom:":""}${String(l.value)}`)})]})})})]}),e(y,{description:H,errorMessage:W,className:fe.padding})]})}
@@ -0,0 +1,132 @@
1
+ import * as React from 'react';
2
+ import type { MPColor, MPSize } from '../../types.js';
3
+ /** One thing the palette can do. */
4
+ export interface MPCommand {
5
+ /** What identifies the command. */
6
+ value: string;
7
+ /** What the row says, and what the query is matched against. */
8
+ label: string;
9
+ /** A second line under it — where the command goes, or what it changes. */
10
+ description?: React.ReactNode;
11
+ /** A glyph before the label. */
12
+ icon?: React.ReactNode;
13
+ /**
14
+ * The keystroke that does the same thing, set at the end of the row.
15
+ *
16
+ * Written the way [MPShortcut](../display/shortcut) writes them, so `Mod`
17
+ * resolves per platform. The palette **does not bind it** — the application
18
+ * does, and this is the label for the binding it already has.
19
+ */
20
+ shortcut?: string;
21
+ /**
22
+ * The heading this command sits under.
23
+ *
24
+ * Commands are drawn in the order they are given and a heading appears each
25
+ * time the group changes, so a group's commands have to be listed together.
26
+ */
27
+ group?: string;
28
+ /**
29
+ * Extra words the query is matched against but that are never drawn — the name
30
+ * somebody else's product gives the same command, an abbreviation, the word
31
+ * the reader would have searched for.
32
+ */
33
+ keywords?: readonly string[];
34
+ /** In the list but not runnable. */
35
+ disabled?: boolean;
36
+ /** What running it does. */
37
+ onSelect?: () => void;
38
+ }
39
+ export interface MPCommandPaletteProps {
40
+ /** Everything the palette can do. */
41
+ items: readonly MPCommand[];
42
+ /** Whether the palette is open. Use with `onOpenChange` for a controlled one. */
43
+ open?: boolean;
44
+ /**
45
+ * Whether it starts open, for an uncontrolled one.
46
+ * @default false
47
+ */
48
+ defaultOpen?: boolean;
49
+ onOpenChange?: (open: boolean) => void;
50
+ /**
51
+ * Called when a command is run, after its own `onSelect`. The palette closes
52
+ * either way.
53
+ */
54
+ onSelect?: (item: MPCommand) => void;
55
+ /**
56
+ * The keystroke that opens the palette, bound on the window.
57
+ *
58
+ * Written the way [MPShortcut](../display/shortcut) writes them, so `Mod` is
59
+ * Command on a Mac and Control everywhere else — the same vocabulary the rows
60
+ * *draw*, because a shortcut a component displays and one it binds have to be
61
+ * spelled the same way or the label is a claim nobody checked. `false` binds
62
+ * nothing.
63
+ * @default 'Mod+K'
64
+ */
65
+ shortcut?: string | false;
66
+ /** How wide the sheet may get. A number in pixels, or any CSS length. */
67
+ width?: number | string;
68
+ /**
69
+ * How tall the list may get before it scrolls.
70
+ * @default 320
71
+ */
72
+ maxHeight?: number | string;
73
+ /**
74
+ * The row height and type scale.
75
+ * @default 'md'
76
+ */
77
+ size?: MPSize;
78
+ /**
79
+ * Which accent family the highlighted row and the caret read.
80
+ * @default 'primary'
81
+ */
82
+ color?: MPColor;
83
+ /**
84
+ * Which language the placeholder, the empty line and the dialog's own name are
85
+ * written in. Falls back to the nearest `MPLocaleProvider`, then to English.
86
+ */
87
+ locale?: string;
88
+ /** The placeholder in the field. Defaults to the wording in `locale`. */
89
+ placeholder?: string;
90
+ /** The line where the rows would be, when nothing matched. */
91
+ emptyMessage?: React.ReactNode;
92
+ /** The accessible name of the dialog, which has no visible title. */
93
+ label?: string;
94
+ className?: string;
95
+ style?: React.CSSProperties;
96
+ }
97
+ /**
98
+ * Everything an application can do, behind one field.
99
+ *
100
+ * The shape a keyboard-first product takes once it has more actions than a menu
101
+ * bar can hold: the reader types what they want instead of remembering where it
102
+ * was put.
103
+ *
104
+ * ## What it is not
105
+ *
106
+ * Not an [MPMenu](./menu). A menu is a short list in one place, and every row is
107
+ * visible before you go looking for it — that is the whole of what a menu is
108
+ * good at, and it is why a menu of sixty rows is not a menu.
109
+ *
110
+ * Not an [MPCombobox](./combobox) either, and this one is worth being precise
111
+ * about: what comes back from a combobox is a **value**, which the caller then
112
+ * does something with. What comes back from here is *something happening*. The
113
+ * row is the action, `onSelect` runs it, and the sheet closes because there is
114
+ * nothing left to decide.
115
+ *
116
+ * ## The surface is MD3's search view
117
+ *
118
+ * `surface-container-high` at `corner-extra-large` under elevation 3 — which is
119
+ * MD3's own docked search view, and happens to be the same three decisions
120
+ * [MPDialog](../feedback/dialog) makes. That is not a coincidence worth hiding:
121
+ * a sheet that has taken the page over a scrim is one object in this system,
122
+ * whether it is asking a question or taking a search.
123
+ *
124
+ * ## Where the behaviour comes from
125
+ *
126
+ * Base UI's `Autocomplete` owns the list — the highlight the pointer and the
127
+ * arrow keys **share**, `aria-activedescendant`, Enter running the highlighted
128
+ * row — and its `Dialog` owns the sheet, the scrim, the focus trap and putting
129
+ * the focus back wherever the reader was. What is left here is the surface, the
130
+ * matching, and the key that opens it.
131
+ */
132
+ export declare function MPCommandPalette({ items, open, defaultOpen, onOpenChange, onSelect, shortcut, width, maxHeight, size, color, locale: localeProp, placeholder, emptyMessage, label, className, style }: MPCommandPaletteProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as n}from"@base-ui/react/autocomplete";import{Dialog as r}from"@base-ui/react/dialog";import{MPShortcut as l}from"../shortcut/MPShortcut.js";import{accentSlots as o}from"../../internal/accent.js";import{cssLength as s}from"../../internal/length.js";import{matchesShortcut as i,useDetectedOS as m}from"../../internal/keys.js";import{useMPLocale as c,useMPMessages as p}from"../../internal/locale.js";import{COMMAND as d}from"../../internal/messages/command.js";import{MPStateLayer as u}from"../../internal/StateLayer.js";import{hasContent as f,META_TEXT as h,PROSE_TEXT as x}from"../../internal/scale.js";import{FADE as g,PORTAL_LAYER as y,SCRIM as v,SHEET_MOTION as w}from"../../internal/surface.js";const b={xs:"max-w-sm",sm:"max-w-md",md:"max-w-xl",lg:"max-w-2xl",xl:"max-w-3xl"},j={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-16",xl:"h-18"},N={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},$={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"};function k(e){return[e.label,e.group??"",...e.keywords??[]].join("\n").toLowerCase()}export function MPCommandPalette({items:C,open:S,defaultOpen:_=!1,onOpenChange:L,onSelect:M,shortcut:P="Mod+K",width:E,maxHeight:z=320,size:O="md",color:V="primary",locale:B,placeholder:F,emptyMessage:H,label:I,className:R,style:D}){const K=c(B),T=p(d,K),W=m(),[q,A]=a.useState(_),[G,J]=a.useState(""),Q=S??q,U=a.useCallback(e=>{e||J(""),void 0===S&&A(e),L?.(e)},[S,L]);a.useEffect(()=>{if(!1===P)return;const e=e=>{i(e,P,W)&&(e.preventDefault(),U(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[P,W,U]);const X=a.useMemo(()=>C.map(k),[C]),Y=a.useMemo(()=>{if(""===G)return C;const e=G.toLowerCase();return C.filter((t,a)=>X[a].includes(e))},[C,X,G]),Z=s(E),ee=s(z);return e(r.Root,{open:Q,onOpenChange:U,children:t(r.Portal,{children:[e(r.Backdrop,{className:`${y} fixed inset-0 ${g} ${v}`}),e(r.Viewport,{className:`${y} fixed inset-0 flex justify-center p-4 pt-[12vh]`,children:e(r.Popup,{"aria-label":I??T.label,"data-mp-size":O,className:["mp-command-palette relative flex w-full flex-col self-start overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 rounded-mp-xl","outline-none",x[O],void 0===Z?b[O]:"",`transition-[opacity,scale] ${w}`,"motion-safe:data-starting-style:scale-95 motion-safe:data-ending-style:scale-95",R??""].filter(Boolean).join(" "),style:{...o(V),...void 0===Z?null:{maxWidth:Z},...D},children:t(n.Root,{open:!0,mode:"list",items:Y,filter:null,value:G,onValueChange:e=>J(e),itemToStringValue:e=>e.label,children:[e("div",{className:`border-mp-outline-variant flex shrink-0 items-center border-b ${N[O]}`,children:e(n.Input,{autoFocus:!0,placeholder:F??T.search,className:["mp-command-palette__input min-w-0 flex-1 bg-transparent font-[inherit]","text-inherit outline-none","placeholder:text-mp-on-surface-variant caret-(--_mp-accent)",j[O]].join(" ")})}),e(n.List,{className:"mp-command-palette__list min-h-0 flex-1 overflow-y-auto overscroll-contain p-1",style:{maxHeight:ee},children:(r,o)=>t(a.Fragment,{children:[r.group&&r.group!==Y[o-1]?.group?e("div",{role:"presentation",className:`text-mp-on-surface-variant pt-2 pb-1 font-medium ${N[O]} ${h}`,children:r.group}):null,t(n.Item,{index:o,value:r,disabled:r.disabled,onClick:()=>(e=>{e.disabled||(e.onSelect?.(),M?.(e),U(!1))})(r),className:["mp-command-palette__row group rounded-mp-xs relative flex cursor-pointer","items-center gap-3 select-none outline-none","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",N[O],$[O]].join(" "),children:[e(u,{layer:"inset-0 rounded-[inherit] bg-current",className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),f(r.icon)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:r.icon}):null,t("span",{className:"relative flex min-w-0 flex-1 flex-col",children:[e("span",{className:"truncate",children:r.label}),f(r.description)?e("span",{className:`text-mp-on-surface-variant truncate ${h}`,children:r.description}):null]}),r.shortcut?e(l,{size:"xs",keys:r.shortcut,className:"relative shrink-0"}):null]})]},`${o}:${r.value}`)}),e(n.Empty,{className:`text-mp-on-surface-variant py-6 text-center ${N[O]} ${h}`,children:H??T.empty})]})})})]})})}
@@ -0,0 +1,2 @@
1
+ export { MPCommandPalette } from './MPCommandPalette.js';
2
+ export type { MPCommand, MPCommandPaletteProps } from './MPCommandPalette.js';
@@ -0,0 +1 @@
1
+ export{MPCommandPalette}from"./MPCommandPalette.js";
@@ -1 +1 @@
1
- import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{SHEET_PAD_X as m}from"../../internal/scale.js";const a={xs:"max-w-[30rem]",sm:"max-w-[37.5rem]",md:"max-w-[52.5rem]",lg:"max-w-[75rem]",xl:"max-w-[100rem]"};export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:n=!0,size:o="md",centered:t=!0,render:s,className:d,children:i,...c},l){return r({render:s,ref:l,props:{"data-mp-size":o,className:["mp-container block w-full","box-border","none"===e?"":a[e],t?"mx-auto":"",n?m[o]:"",d??""].filter(Boolean).join(" "),children:i,...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";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}})});
@@ -40,6 +40,11 @@ export interface MPDateTimePickerProps extends MPPickerShellProps {
40
40
  /** A 12-hour dial with an AM/PM column. Defaults to whatever the locale does. */
41
41
  hour12?: boolean;
42
42
  showSeconds?: boolean;
43
+ /**
44
+ * How far apart the rows of each clock column are. Rounded, and held between 1
45
+ * and the column's own span — see [MPTimePicker](./time-picker).
46
+ * @default 1
47
+ */
43
48
  hourStep?: number;
44
49
  minuteStep?: number;
45
50
  secondStep?: number;
@@ -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{useMPLocale as o,useMPMessages as a}from"../../internal/locale.js";import{COMMON as r}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{SHEET_GAP as c,hasContent as p}from"../../internal/scale.js";import{FADE as d,PORTAL_LAYER as x,SCRIM as f,SHEET_MOTION as u}from"../../internal/surface.js";const h={xs:"max-w-[320px]",sm:"max-w-[400px]",md:"max-w-[560px]",lg:"max-w-[720px]",xl:"max-w-[960px]"},g=`transition-[opacity,scale] ${u}`,y=/*@__PURE__*/["motion-safe:data-starting-style:scale-95","motion-safe:data-ending-style:scale-95"].join(" "),j={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-7",xl:"p-8"},v={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-7",xl:"px-8"},b={xs:"py-3",sm:"py-4",md:"py-6",lg:"py-7",xl:"py-8"},w={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"},N={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=t.Close;export function MPDialog({open:u,defaultOpen:k,onOpenChange:C,trigger:P,icon:B,title:z,description:D,actions:O,dividers:M=!1,showClose:L,closeLabel:S,locale:T,width:W,fullWidth:I=!0,fullScreen:R=!1,modal:V=!0,dismissible:_=!0,size:q="md",color:A="secondary",className:E,style:F,children:G}){const H=o(T),J=a(r,H),K=L??R,Q=p(B),U=p(z)||p(D)||Q,X=p(O),Y=M?j[q]:v[q],Z="border-mp-outline-variant border-t";return l(t.Root,{open:u,defaultOpen:k,modal:V,disablePointerDismissal:!_,onOpenChange:(e,l)=>{_||e||"escape-key"!==l.reason?C?.(e):l.cancel()},children:[P?e(t.Trigger,{render:P}):null,l(t.Portal,{children:[e(t.Backdrop,{className:`${x} fixed inset-0 ${d} ${f}`}),e(t.Viewport,{className:[x,"fixed inset-0 flex justify-center",R?"items-stretch":"items-center p-4"].join(" "),children:l(t.Popup,{"data-mp-size":q,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",R?"h-full max-w-none rounded-none":`rounded-mp-xl max-h-full ${void 0===W?h[q]:""}`,R||I?"":"w-auto",M?"":`${b[q]} ${c[q]}`,g,R?"":y,E??""].filter(Boolean).join(" "),style:{...s(A),...void 0===W||R?null:{maxWidth:"number"==typeof W?`${W}px`:W},...F},children:[U||K?l("div",{className:["flex shrink-0 items-start gap-3",Y,Q&&!K?"flex-col items-center text-center":""].filter(Boolean).join(" "),children:[Q?e("span",{className:"flex shrink-0 items-center justify-center text-(--_mp-accent)",children:B}):null,l("div",{className:`flex min-w-0 flex-1 flex-col ${c[q]}`,children:[p(z)?e(t.Title,{className:`m-0 ${w[q]}`,children:z}):null,p(D)?e(t.Description,{className:`text-mp-on-surface-variant m-0 ${N[q]}`,children:D}):null]}),K?l(t.Close,{"aria-label":S??J.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(m,{}),e(i,{icon:n,size:$[q]})]}):null]}):null,p(G)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",N[q],Y,M&&(U||K)?Z:""].filter(Boolean).join(" "),children:G}):null,X?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",Y,M?Z:""].filter(Boolean).join(" "),children:O}):null]})})]})]})}
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]})})]})]})}
@@ -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";const i="[border-color:var(--_mp-line)]";function o(e){return"number"==typeof e?`${e}px`:e}const 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:p,size:d="md",length:c,thickness:f,textAlign:h="center",className:x,style:u,children:v,...b},w){const g="vertical"===t,_=a(v),$={"--_mp-line":p?`var(--_mp-color-${p})`:"var(--_mp-color-outline-variant)","--_mp-rule":o(f)??"1px"},j=o(c),k={...$,...void 0===j?null:g?{height:j}:{width:j},...u};if(!_)return e(l,{ref:w,orientation:t,"data-mp-size":d,className:["mp-divider",g?"w-0 border-l [border-left-width:var(--_mp-rule)] "+(void 0===j?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--_mp-rule)]",i,x??""].filter(Boolean).join(" "),style:k,...b});const[N,y]=n[t][h],z=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":d,className:["mp-divider flex items-center",g?"w-auto flex-col "+(void 0===j?"self-stretch":""):"w-full",m[d],x??""].filter(Boolean).join(" "),style:k,...b,children:[e("span",{"aria-hidden":"true",className:`${z} ${N} ${i}`}),e("span",{className:["text-mp-on-surface-variant shrink-0 whitespace-nowrap",s[d],g?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:v}),e("span",{"aria-hidden":"true",className:`${z} ${y} ${i}`})]})});
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}`})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import*as a from"react";import{Dialog as o}from"@base-ui/react/dialog";import{MPIcon as n}from"../icon/MPIcon.js";import{CloseIcon as r}from"../../constants/icons.js";import{useMPLocale as i,useMPMessages as s}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{hasContent as f,META_TEXT as c,PROSE_TEXT as p,SHEET_GAP as u,SHEET_PAD_X as x,SHEET_PAD_Y as h,SHEET_TITLE as g}from"../../internal/scale.js";import{FADE as b,PORTAL_LAYER as y,SCRIM as v,SHEET_MOTION as w}from"../../internal/surface.js";const j={xs:"w-60",sm:"w-72",md:"w-90",lg:"w-104",xl:"w-120"},$={left:"rounded-r-mp-lg",right:"rounded-l-mp-lg",top:"rounded-b-mp-xl",bottom:"rounded-t-mp-xl"},N={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},C={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},k={left:"motion-safe:data-starting-style:-translate-x-full motion-safe:data-ending-style:-translate-x-full",right:"motion-safe:data-starting-style:translate-x-full motion-safe:data-ending-style:translate-x-full",top:"motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",bottom:"motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full"},z=`transition-[opacity,translate] ${w}`,P="border-mp-outline-variant border-t";export const MPDrawerClose=o.Close;export function MPDrawer({side:w="left",mode:B="modal",open:D,defaultOpen:O,onOpenChange:M,trigger:L,title:S,description:T,actions:F,dividers:I=!1,showClose:R,closeLabel:V,locale:q,extent:A,rounded:E=!0,dismissible:G=!0,size:H="md",className:J,style:K,children:Q}){const U=i(q),W=s(d,U),X="modal"===B,Y="left"===w||"right"===w,Z=R??X,_=V??W.close,[ee,te]=a.useState(O??!0),le=D??ee,ae=x[H],oe=h[H],ne=I?`${ae} ${oe}`:ae,re=f(S)||f(T),ie=f(F),se=void 0===A?null:{[Y?"width":"height"]:"number"==typeof A?`${A}px`:A},de=["mp-drawer relative flex flex-col overflow-hidden box-border","border-mp-outline-variant outline-none",X?"bg-mp-surface-container-low shadow-mp-1":"bg-mp-surface","text-mp-on-surface",p[H],N[w],E?$[w]:"",X?`${z} ${k[w]}`:"",Y?`h-full max-w-full ${void 0===A?j[H]:""}`:"w-full "+(void 0===A?"max-h-[85%]":""),I?"":`${oe} ${u[H]}`,J??""].filter(Boolean).join(" "),me=X?o.Title:"h2",fe=X?o.Description:"p",ce=/*@__PURE__*/["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),pe=t(l,{children:[re||Z?t("div",{className:`flex shrink-0 items-start gap-3 ${ne}`,children:[t("div",{className:"flex min-w-0 flex-1 flex-col",children:[f(S)?e(me,{className:`m-0 ${g[H]}`,children:S}):null,f(T)?e(fe,{className:`text-mp-on-surface-variant m-0 ${c}`,children:T}):null]}),Z?X?t(o.Close,{"aria-label":_,className:ce,children:[e(m,{}),e(n,{icon:r,size:20})]}):t("button",{type:"button","aria-label":_,className:ce,onClick:()=>{void 0===D&&te(!1),M?.(!1)},children:[e(m,{}),e(n,{icon:r,size:20})]}):null]}):null,f(Q)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",ne,I&&(re||Z)?P:"",I?"":"-my-1 py-1"].filter(Boolean).join(" "),children:Q}):null,ie?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",ne,I?P:""].filter(Boolean).join(" "),children:F}):null]});return X?t(o.Root,{open:D,defaultOpen:O,disablePointerDismissal:!G,onOpenChange:(e,t)=>{G||e||"escape-key"!==t.reason?M?.(e):t.cancel()},children:[L?e(o.Trigger,{render:L}):null,t(o.Portal,{children:[e(o.Backdrop,{className:`${y} fixed inset-0 ${b} ${v}`}),e(o.Viewport,{className:`${y} fixed inset-0 flex ${C[w]}`,children:e(o.Popup,{"data-mp-size":H,"data-mp-side":w,"data-mp-mode":B,className:de,style:{...se,...K},children:pe})})]})]}):le?e("div",{"data-mp-size":H,"data-mp-side":w,"data-mp-mode":B,className:de,style:{...se,...K},children:pe}):null}
2
+ import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import*as a from"react";import{Dialog as o}from"@base-ui/react/dialog";import{MPIcon as n}from"../icon/MPIcon.js";import{CloseIcon as r}from"../../constants/icons.js";import{useMPLocale as i,useMPMessages as s}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{cssLength as f}from"../../internal/length.js";import{hasContent as c,META_TEXT as p,PROSE_TEXT as u,SHEET_GAP as x,SHEET_PAD_X as h,SHEET_PAD_Y as g,SHEET_TITLE as b}from"../../internal/scale.js";import{FADE as y,PORTAL_LAYER as v,SCRIM as j,SHEET_MOTION as w}from"../../internal/surface.js";const $={xs:"w-60",sm:"w-72",md:"w-90",lg:"w-104",xl:"w-120"},N={left:"rounded-r-mp-lg",right:"rounded-l-mp-lg",top:"rounded-b-mp-xl",bottom:"rounded-t-mp-xl"},C={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},k={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},z={left:"motion-safe:data-starting-style:-translate-x-full motion-safe:data-ending-style:-translate-x-full",right:"motion-safe:data-starting-style:translate-x-full motion-safe:data-ending-style:translate-x-full",top:"motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",bottom:"motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full"},P=`transition-[opacity,translate] ${w}`,B="border-mp-outline-variant border-t";export const MPDrawerClose=o.Close;export function MPDrawer({side:w="left",mode:D="modal",open:O,defaultOpen:M,onOpenChange:L,trigger:S,title:T,description:F,actions:I,dividers:R=!1,showClose:V,closeLabel:q,locale:A,extent:E,rounded:G=!0,dismissible:H=!0,size:J="md",className:K,style:Q,children:U}){const W=i(A),X=s(d,W),Y="modal"===D,Z="left"===w||"right"===w,_=V??Y,ee=q??X.close,[te,le]=a.useState(M??!0),ae=O??te,oe=h[J],ne=g[J],re=R?`${oe} ${ne}`:oe,ie=c(T)||c(F),se=c(I),de=void 0===E?null:{[Z?"width":"height"]:f(E)},me=["mp-drawer relative flex flex-col overflow-hidden box-border","border-mp-outline-variant outline-none",Y?"bg-mp-surface-container-low shadow-mp-1":"bg-mp-surface","text-mp-on-surface",u[J],C[w],G?N[w]:"",Y?`${P} ${z[w]}`:"",Z?`h-full max-w-full ${void 0===E?$[J]:""}`:"w-full "+(void 0===E?"max-h-[85%]":""),R?"":`${ne} ${x[J]}`,K??""].filter(Boolean).join(" "),fe=Y?o.Title:"h2",ce=Y?o.Description:"p",pe=/*@__PURE__*/["group text-mp-on-surface-variant relative flex size-10 shrink-0","rounded-mp-full cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),ue=t(l,{children:[ie||_?t("div",{className:`flex shrink-0 items-start gap-3 ${re}`,children:[t("div",{className:"flex min-w-0 flex-1 flex-col",children:[c(T)?e(fe,{className:`m-0 ${b[J]}`,children:T}):null,c(F)?e(ce,{className:`text-mp-on-surface-variant m-0 ${p}`,children:F}):null]}),_?Y?t(o.Close,{"aria-label":ee,className:pe,children:[e(m,{}),e(n,{icon:r,size:20})]}):t("button",{type:"button","aria-label":ee,className:pe,onClick:()=>{void 0===O&&le(!1),L?.(!1)},children:[e(m,{}),e(n,{icon:r,size:20})]}):null]}):null,c(U)?e("div",{className:["min-h-0 flex-1 overflow-y-auto overscroll-contain",re,R&&(ie||_)?B:"",R?"":"-my-1 py-1"].filter(Boolean).join(" "),children:U}):null,se?e("div",{className:["flex shrink-0 flex-wrap items-center justify-end gap-2",re,R?B:""].filter(Boolean).join(" "),children:I}):null]});return Y?t(o.Root,{open:O,defaultOpen:M,disablePointerDismissal:!H,onOpenChange:(e,t)=>{H||e||"escape-key"!==t.reason?L?.(e):t.cancel()},children:[S?e(o.Trigger,{render:S}):null,t(o.Portal,{children:[e(o.Backdrop,{className:`${v} fixed inset-0 ${y} ${j}`}),e(o.Viewport,{className:`${v} fixed inset-0 flex ${k[w]}`,children:e(o.Popup,{"data-mp-size":J,"data-mp-side":w,"data-mp-mode":D,className:me,style:{...de,...Q},children:ue})})]})]}):ae?e("div",{"data-mp-size":J,"data-mp-side":w,"data-mp-mode":D,className:me,style:{...de,...Q},children:ue}):null}
@@ -0,0 +1,52 @@
1
+ import * as React from 'react';
2
+ import type { MPSize } from '../../types.js';
3
+ export interface MPFieldsetProps extends Omit<React.ComponentPropsWithoutRef<'fieldset'>, 'color'> {
4
+ /**
5
+ * What the group is called.
6
+ *
7
+ * It becomes part of the accessible name of every control inside, so it has to
8
+ * be a phrase that still reads correctly in front of each of them — "Billing
9
+ * address", not "Where should we send it?".
10
+ */
11
+ legend?: React.ReactNode;
12
+ /** A line under the legend. */
13
+ description?: React.ReactNode;
14
+ /**
15
+ * Disables every control inside at once, the way a `<fieldset>` always has.
16
+ * @default false
17
+ */
18
+ disabled?: boolean;
19
+ /**
20
+ * The legend's type scale and the gap the controls stand at.
21
+ * @default 'md'
22
+ */
23
+ size?: MPSize;
24
+ children?: React.ReactNode;
25
+ }
26
+ /**
27
+ * A group of controls that answer one question together, with a name on it.
28
+ *
29
+ * ## Why it draws no surface
30
+ *
31
+ * Because a group of fields is a **grouping** and not a sheet, and the sheet
32
+ * already exists: put this inside an [MPCard](../layout/card) or an
33
+ * [MPBox](../layout/box) when one is wanted. A fieldset that painted its own
34
+ * would be a second sheet inside the first the moment anybody did.
35
+ *
36
+ * What it owns instead is the legend, the gap the controls stand at, and the one
37
+ * thing only a real `<fieldset>` can do: **`disabled` reaches every control
38
+ * inside it**, including ones a component three levels down rendered and never
39
+ * heard of it. That is not something a context could promise.
40
+ *
41
+ * ## Why the legend is not a `<legend>`
42
+ *
43
+ * It is a `<div>` pointed at by `aria-labelledby` — Base UI's decision, and the
44
+ * one that makes the group a normal flex container. A real rendered `<legend>`
45
+ * is lifted out of its fieldset's content box by every browser, so a `gap` would
46
+ * put no space at all under it and the first control would sit against the name
47
+ * of the group.
48
+ *
49
+ * The accessible name is the same either way, which is the only part that had to
50
+ * survive.
51
+ */
52
+ export declare const MPFieldset: React.ForwardRefExoticComponent<MPFieldsetProps & React.RefAttributes<HTMLFieldSetElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as l from"react";import{Fieldset as a}from"@base-ui/react/fieldset";import{hasContent as r,META_TEXT as n,SHEET_GAP as i,SHEET_TITLE as t,STACK_GAP as o}from"../../internal/scale.js";export const MPFieldset=/*@__PURE__*/l.forwardRef(function({legend:l,description:m,disabled:c=!1,size:d="md",className:f,children:p,...x},u){const h=r(l)||r(m);return s(a.Root,{ref:u,disabled:c,"data-mp-size":d,className:["mp-fieldset flex min-w-0 flex-col","m-0 border-0 p-0",i[d],f??""].filter(Boolean).join(" "),...x,children:[h?s(a.Legend,{className:`mp-fieldset__legend flex min-w-0 flex-col p-0 ${o[d]}`,children:[r(l)?e("span",{className:`text-mp-on-surface ${t[d]}`,children:l}):null,r(m)?e("span",{className:`text-mp-on-surface-variant ${n}`,children:m}):null]}):null,p]})});
@@ -0,0 +1,2 @@
1
+ export { MPFieldset } from './MPFieldset.js';
2
+ export type { MPFieldsetProps } from './MPFieldset.js';
@@ -0,0 +1 @@
1
+ export{MPFieldset}from"./MPFieldset.js";
@@ -52,7 +52,7 @@ export interface MPFilePickerProps extends MPStyleProps {
52
52
  description?: React.ReactNode;
53
53
  /** The message under the box, which also turns the picker over. */
54
54
  errorMessage?: React.ReactNode;
55
- /** The line inside the box. @default 'Drop files here, or click to browse' */
55
+ /** The line inside the box. Defaults to the wording in `locale`. */
56
56
  title?: React.ReactNode;
57
57
  /** The line under it — what is accepted, how big, how many. */
58
58
  hint?: React.ReactNode;
@@ -68,8 +68,9 @@ export interface MPFilePickerProps extends MPStyleProps {
68
68
  */
69
69
  removeLabel?: (name: string) => string;
70
70
  /**
71
- * Which language the remove buttons' default names are written in. Falls back
72
- * to the nearest `MPLocaleProvider`, then to English.
71
+ * Which language the box's own words are written in — the prompt inside it and
72
+ * the remove buttons' names. Falls back to the nearest `MPLocaleProvider`,
73
+ * then to English.
73
74
  */
74
75
  locale?: string;
75
76
  /** Marks the field required. */
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as t}from"../icon/MPIcon.js";import{CloseIcon as a,UploadIcon as i}from"../../constants/icons.js";import{fillMessage as o}from"../../internal/i18n.js";import{useMPLocale as l,useMPMessages as s}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{MPStateLayer as p}from"../../internal/StateLayer.js";import{CONTROL_ICON as m,META_TEXT as u,PROSE_TEXT as d,STACK_GAP as f,hasContent as h}from"../../internal/scale.js";const x={xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"};export function formatFileSize(e){if(e<1e3)return`${e} B`;const r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function b(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(e.slice(0,-1)):t===e)}export const MPFilePicker=/*@__PURE__*/n.forwardRef(function({accept:v,multiple:g=!1,maxSize:j,maxFiles:y,value:N,defaultValue:k,onFilesChange:w,onReject:z,label:C,description:I,errorMessage:B,title:D,hint:F,icon:L,showList:M=!0,removeLabel:S,locale:$,size:T="md",fullWidth:W=!0,required:_=!1,disabled:P=!1,readOnly:R=!1,name:E,id:O},q){const A=l($),V=s(c,A),G=n.useRef(null);n.useImperativeHandle(q,()=>G.current,[]);const[H,Y]=n.useState(()=>[...k??[]]),J=N?[...N]:H,K=n.useRef(0),[Q,U]=n.useState(!1),X=h(B),Z=P||R,ee=n.useId(),re=n.useId(),ne=n.useCallback(e=>{N||Y(e),w?.(e)},[w,N]),te=n.useCallback(e=>{const r=[],n=[],t=g?y??Number.POSITIVE_INFINITY:1,a=g?J.length:0;for(const i of e)v&&!b(i,v)?n.push({file:i,reason:"type"}):void 0!==j&&i.size>j?n.push({file:i,reason:"size"}):a+r.length>=t?n.push({file:i,reason:"count"}):r.push(i);return{kept:r,rejections:n}},[v,J.length,y,j,g]),ae=n.useCallback(e=>{const{kept:r,rejections:n}=te(e);n.length>0&&z?.(n),r.length>0&&ne(g?[...J,...r]:r)},[te,ne,J,g,z]);return r("div",{className:["mp-file-picker flex-col align-top",f[T],W?"flex w-full":"inline-flex"].join(" "),"data-mp-size":T,"data-disabled":P||void 0,"data-invalid":X||void 0,children:[h(C)?r("span",{id:re,className:[u,P?"text-mp-on-surface/38":X?"text-mp-error":"text-mp-on-surface-variant"].join(" "),children:[C,_?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,r("div",{className:"flex w-full flex-col",onDragEnter:e=>{Z||(e.preventDefault(),K.current+=1,U(!0))},onDragOver:e=>{Z||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{Z||(K.current=Math.max(0,K.current-1),0===K.current&&U(!1))},onDrop:e=>{Z||(e.preventDefault(),K.current=0,U(!1),ae(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:O,disabled:P,"aria-describedby":h(I)||X?ee:void 0,"aria-invalid":X||void 0,className:["mp-file-picker__zone group relative flex w-full flex-col items-center","justify-center gap-2 text-center","rounded-mp-md box-border border-2 border-dashed","appearance-none bg-transparent font-[inherit] outline-none","transition-[border-color,background-color] duration-(--mp-sys-motion-duration-short4)",x[T],d[T],P?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":[R?"cursor-default":"cursor-pointer",X?"border-mp-error":"border-mp-outline-variant","text-mp-on-surface",Q?"border-mp-primary bg-mp-primary/8":""].filter(Boolean).join(" ")].filter(Boolean).join(" "),onClick:()=>{!Z&&G.current&&(G.current.value="",G.current.click())},children:[Z?null:e(p,{layer:"inset-0 rounded-[inherit] bg-mp-primary"}),void 0===L?e(t,{icon:i,size:1.6*m[T],className:P?"":"text-mp-primary"}):h(L)?e("span",{className:P?"":"text-mp-primary",children:L}):null,e("span",{className:"font-medium",children:D??"Drop files here, or click to browse"}),h(F)?e("span",{className:[u,P?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:F}):null]}),e("input",{ref:G,type:"file",name:E,accept:v,multiple:g,required:_&&0===J.length,disabled:Z,tabIndex:-1,"aria-labelledby":h(C)?re:void 0,"aria-describedby":h(I)||X?ee:void 0,className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>ae(Array.from(e.target.files??[]))})]}),M&&J.length>0?e("ul",{className:["mp-file-picker__list m-0 flex w-full list-none flex-col p-0",f[T]].join(" "),children:J.map((n,i)=>r("li",{className:["rounded-mp-xs bg-mp-surface-container-low flex w-full items-center gap-3","px-3 py-2",d[T],P?"text-mp-on-surface/38":"text-mp-on-surface"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:[u,"shrink-0 tabular-nums",P?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:formatFileSize(n.size)}),Z?null:r("button",{type:"button","aria-label":S?S(n.name):o(V.removeNamed,{label:n.name}),className:["group text-mp-on-surface-variant relative flex size-8 shrink-0","cursor-pointer appearance-none items-center justify-center rounded-full","bg-transparent p-0 font-[inherit] outline-none"].join(" "),onClick:()=>ne(J.filter((e,r)=>r!==i)),children:[e(p,{}),e(t,{icon:a,size:18})]})]},`${n.name}-${n.size}-${n.lastModified}-${i}`))}):null,X?e("span",{id:ee,className:[u,"text-mp-error"].join(" "),children:B}):h(I)?e("span",{id:ee,className:[u,P?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:I}):null]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as t}from"../icon/MPIcon.js";import{CloseIcon as a,UploadIcon as i}from"../../constants/icons.js";import{fillMessage as o}from"../../internal/i18n.js";import{useMPLocale as l,useMPMessages as s}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{FILE_PICKER as m}from"../../internal/messages/file-picker.js";import{MPStateLayer as p}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,META_TEXT as d,PROSE_TEXT as f,STACK_GAP as h,hasContent as x}from"../../internal/scale.js";const b={xs:"p-4",sm:"p-5",md:"p-6",lg:"p-8",xl:"p-10"};export function formatFileSize(e){if(e<1e3)return`${e} B`;const r=["kB","MB","GB","TB"];let n=e/1e3,t=0;for(;n>=1e3&&t<r.length-1;)n/=1e3,t+=1;return`${n<10?n.toFixed(1):Math.round(n)} ${r[t]}`}function v(e,r){const n=e.name.toLowerCase(),t=e.type.toLowerCase();return r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean).some(e=>e.startsWith(".")?n.endsWith(e):e.endsWith("/*")?t.startsWith(e.slice(0,-1)):t===e)}export const MPFilePicker=/*@__PURE__*/n.forwardRef(function({accept:g,multiple:j=!1,maxSize:y,maxFiles:N,value:k,defaultValue:z,onFilesChange:w,onReject:C,label:I,description:B,errorMessage:D,title:F,hint:L,icon:M,showList:S=!0,removeLabel:$,locale:T,size:W="md",fullWidth:_=!0,required:P=!1,disabled:R=!1,readOnly:E=!1,name:O,id:q},A){const V=l(T),G=s(c,V),H=s(m,V),Y=n.useRef(null);n.useImperativeHandle(A,()=>Y.current,[]);const[J,K]=n.useState(()=>[...z??[]]),Q=k?[...k]:J,U=n.useRef(0),[X,Z]=n.useState(!1),ee=x(D),re=R||E,ne=n.useId(),te=n.useId(),ae=n.useCallback(e=>{k||K(e),w?.(e)},[w,k]),ie=n.useCallback(e=>{const r=[],n=[],t=j?N??Number.POSITIVE_INFINITY:1,a=j?Q.length:0;for(const i of e)g&&!v(i,g)?n.push({file:i,reason:"type"}):void 0!==y&&i.size>y?n.push({file:i,reason:"size"}):a+r.length>=t?n.push({file:i,reason:"count"}):r.push(i);return{kept:r,rejections:n}},[g,Q.length,N,y,j]),oe=n.useCallback(e=>{const{kept:r,rejections:n}=ie(e);n.length>0&&C?.(n),r.length>0&&ae(j?[...Q,...r]:r)},[ie,ae,Q,j,C]);return r("div",{className:["mp-file-picker flex-col align-top",h[W],_?"flex w-full":"inline-flex"].join(" "),"data-mp-size":W,"data-disabled":R||void 0,"data-invalid":ee||void 0,children:[x(I)?r("span",{id:te,className:[d,R?"text-mp-on-surface/38":ee?"text-mp-error":"text-mp-on-surface-variant"].join(" "),children:[I,P?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,r("div",{className:"relative flex w-full flex-col",onDragEnter:e=>{re||(e.preventDefault(),U.current+=1,Z(!0))},onDragOver:e=>{re||(e.preventDefault(),e.dataTransfer.dropEffect="copy")},onDragLeave:()=>{re||(U.current=Math.max(0,U.current-1),0===U.current&&Z(!1))},onDrop:e=>{re||(e.preventDefault(),U.current=0,Z(!1),oe(Array.from(e.dataTransfer.files)))},children:[r("button",{type:"button",id:q,disabled:R,"aria-describedby":x(B)||ee?ne:void 0,"aria-invalid":ee||void 0,className:["mp-file-picker__zone group relative flex w-full flex-col items-center","justify-center gap-2 text-center","rounded-mp-md box-border border-2 border-dashed","appearance-none bg-transparent font-[inherit] outline-none","transition-[border-color,background-color] duration-(--mp-sys-motion-duration-short4)",b[W],f[W],R?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":[E?"cursor-default":"cursor-pointer",ee?"border-mp-error":"border-mp-outline-variant","text-mp-on-surface",X?"border-mp-primary bg-mp-primary/8":""].filter(Boolean).join(" ")].filter(Boolean).join(" "),onClick:()=>{!re&&Y.current&&(Y.current.value="",Y.current.click())},children:[re?null:e(p,{layer:"inset-0 rounded-[inherit] bg-mp-primary"}),void 0===M?e(t,{icon:i,size:1.6*u[W],className:R?"":"text-mp-primary"}):x(M)?e("span",{className:R?"":"text-mp-primary",children:M}):null,e("span",{className:"font-medium",children:F??H.prompt}),x(L)?e("span",{className:[d,R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:L}):null]}),e("input",{ref:Y,type:"file",name:O,accept:g,multiple:j,required:P&&0===Q.length,disabled:re,tabIndex:-1,"aria-labelledby":x(I)?te:void 0,"aria-describedby":x(B)||ee?ne:void 0,className:"absolute size-px overflow-hidden opacity-0 [clip-path:inset(50%)]",onChange:e=>oe(Array.from(e.target.files??[]))})]}),S&&Q.length>0?e("ul",{className:["mp-file-picker__list m-0 flex w-full list-none flex-col p-0",h[W]].join(" "),children:Q.map((n,i)=>r("li",{className:["rounded-mp-xs bg-mp-surface-container-low flex w-full items-center gap-3","px-3 py-2",f[W],R?"text-mp-on-surface/38":"text-mp-on-surface"].join(" "),children:[e("span",{className:"min-w-0 flex-1 truncate",children:n.name}),e("span",{className:[d,"shrink-0 tabular-nums",R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:formatFileSize(n.size)}),re?null:r("button",{type:"button","aria-label":$?$(n.name):o(G.removeNamed,{label:n.name}),className:["group text-mp-on-surface-variant relative flex size-8 shrink-0","cursor-pointer appearance-none items-center justify-center rounded-full","bg-transparent p-0 font-[inherit] outline-none"].join(" "),onClick:()=>ae(Q.filter((e,r)=>r!==i)),children:[e(p,{}),e(t,{icon:a,size:18})]})]},`${n.name}-${n.size}-${n.lastModified}-${i}`))}):null,ee?e("span",{id:ne,className:[d,"text-mp-error"].join(" "),children:D}):x(B)?e("span",{id:ne,className:[d,R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:B}):null]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{Button as o}from"@base-ui/react/button";import{accentSlots as n}from"../../internal/accent.js";import{MPStateLayer as i}from"../../internal/StateLayer.js";import{hasContent as s}from"../../internal/scale.js";const r={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"bg-mp-surface-container-high text-(--_mp-accent)"},m={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-18",xl:"h-24"},l={xs:"min-w-10 gap-0 px-0",sm:"min-w-12 gap-0 px-0",md:"min-w-14 gap-0 px-0",lg:"min-w-18 gap-0 px-0",xl:"min-w-24 gap-0 px-0"},p={xs:"rounded-mp-md",sm:"rounded-mp-lg",md:"rounded-mp-lg",lg:"rounded-mp-xl",xl:"rounded-mp-xl"},d={xs:24,sm:24,md:24,lg:30,xl:36},f={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"},c={xs:"min-w-16 gap-1.5 px-3",sm:"min-w-18 gap-2 px-4",md:"min-w-20 gap-2 px-4",lg:"min-w-24 gap-2.5 px-5",xl:"min-w-28 gap-3 px-6"},x={absolute:"absolute z-30",sticky:"sticky z-30",fixed:"fixed z-40"},u={"top-start":"top-(--_mp-fab-offset) start-(--_mp-fab-offset)","top-end":"top-(--_mp-fab-offset) end-(--_mp-fab-offset)","bottom-start":"bottom-(--_mp-fab-offset) start-(--_mp-fab-offset)","bottom-end":"bottom-(--_mp-fab-offset) end-(--_mp-fab-offset)"};export const MPFloatingActionButton=/*@__PURE__*/a.forwardRef(function({icon:a,label:b,extended:g=!1,variant:h="tonal",color:w="primary",size:y="md",position:_="fixed",corner:j="bottom-end",offset:v=16,disabled:k=!1,type:z="button",className:N,style:$,...B},A){return e(o,{ref:A,type:z,disabled:k,"aria-label":b,"data-mp-size":y,"data-mp-variant":h,className:["mp-fab group inline-flex shrink-0 items-center justify-center","box-border overflow-hidden align-middle whitespace-nowrap select-none","cursor-pointer appearance-none font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-[background-color,box-shadow,color,min-width,padding,gap]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",p[y],m[y],f[y],g?c[y]:l[y],k?"bg-mp-on-surface/12 text-mp-on-surface/38 cursor-default shadow-none":`${r[h]} shadow-mp-3`,"static"===_?"relative":`${x[_]} ${u[j]}`,N??""].filter(Boolean).join(" "),style:{...n(w),"--_mp-fab-offset":"number"==typeof v?`${v}px`:v,...$},...B,children:[k?null:t(i,{}),s(a)?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:d[y],height:d[y]},children:a}):null,t("span",{className:["relative grid transition-[grid-template-columns]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",g?"grid-cols-[1fr]":"grid-cols-[0fr]"].join(" "),children:t("span",{className:"min-w-0 truncate",children:b})})]})});
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{Button as n}from"@base-ui/react/button";import{accentSlots as o}from"../../internal/accent.js";import{cssLength as i}from"../../internal/length.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{hasContent as r}from"../../internal/scale.js";const m={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"bg-mp-surface-container-high text-(--_mp-accent)"},l={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-18",xl:"h-24"},p={xs:"min-w-10 gap-0 px-0",sm:"min-w-12 gap-0 px-0",md:"min-w-14 gap-0 px-0",lg:"min-w-18 gap-0 px-0",xl:"min-w-24 gap-0 px-0"},d={xs:"rounded-mp-md",sm:"rounded-mp-lg",md:"rounded-mp-lg",lg:"rounded-mp-xl",xl:"rounded-mp-xl"},f={xs:24,sm:24,md:24,lg:30,xl:36},c={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"},x={xs:"min-w-16 gap-1.5 px-3",sm:"min-w-18 gap-2 px-4",md:"min-w-20 gap-2 px-4",lg:"min-w-24 gap-2.5 px-5",xl:"min-w-28 gap-3 px-6"},u={absolute:"absolute z-30",sticky:"sticky z-30",fixed:"fixed z-40"},b={"top-start":"top-(--_mp-fab-offset) start-(--_mp-fab-offset)","top-end":"top-(--_mp-fab-offset) end-(--_mp-fab-offset)","bottom-start":"bottom-(--_mp-fab-offset) start-(--_mp-fab-offset)","bottom-end":"bottom-(--_mp-fab-offset) end-(--_mp-fab-offset)"};export const MPFloatingActionButton=/*@__PURE__*/a.forwardRef(function({icon:a,label:g,extended:h=!1,variant:w="tonal",color:y="primary",size:_="md",position:j="fixed",corner:v="bottom-end",offset:k=16,disabled:z=!1,type:N="button",className:B,style:$,...A},F){return e(n,{ref:F,type:N,disabled:z,"aria-label":g,"data-mp-size":_,"data-mp-variant":w,className:["mp-fab group inline-flex shrink-0 items-center justify-center","box-border overflow-hidden align-middle whitespace-nowrap select-none","cursor-pointer appearance-none font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-[background-color,box-shadow,color,min-width,padding,gap]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",d[_],l[_],c[_],h?x[_]:p[_],z?"bg-mp-on-surface/12 text-mp-on-surface/38 cursor-default shadow-none":`${m[w]} shadow-mp-3`,"static"===j?"relative":`${u[j]} ${b[v]}`,B??""].filter(Boolean).join(" "),style:{...o(y),"--_mp-fab-offset":i(k),...$},...A,children:[z?null:t(s,{}),r(a)?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:f[_],height:f[_]},children:a}):null,t("span",{className:["relative grid transition-[grid-template-columns]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",h?"grid-cols-[1fr]":"grid-cols-[0fr]"].join(" "),children:t("span",{className:"min-w-0 truncate",children:g})})]})});
@@ -0,0 +1,94 @@
1
+ import * as React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { MPPosition, MPSize, MPVariant } from '../../types.js';
4
+ export interface MPFooterProps extends Omit<React.ComponentPropsWithoutRef<'footer'>, 'title'> {
5
+ /**
6
+ * How the sheet sits in the page's scroll.
7
+ *
8
+ * `static` — the default, and the opposite of [MPHeader](./header)'s — is what
9
+ * a footer *is*: the thing at the end of the document, reached by scrolling to
10
+ * it. `sticky` and `fixed` are for the bar that has to stay in reach — a
11
+ * form's save row, a cookie notice — and an [MPPageLayout](./page-layout)
12
+ * reserves the height a `fixed` one takes out of the flow.
13
+ * @default 'static'
14
+ */
15
+ position?: MPPosition;
16
+ /**
17
+ * How much surface the sheet paints, on the **container** ladder — a footer is
18
+ * never dyed, because what sits on it arrives with colours of its own.
19
+ *
20
+ * `outlined` is the default here and `tonal` is [MPHeader](./header)'s,
21
+ * because the two sit against different things. A header is over content that
22
+ * is passing underneath it and needs a tone of its own to stay legible; a
23
+ * footer has the end of the document above it and nothing below, so the
24
+ * hairline is the whole of what says the document ended.
25
+ * @default 'outlined'
26
+ */
27
+ variant?: MPVariant;
28
+ /**
29
+ * The sheet's scale — its gutter and the air above and below its content. As
30
+ * on [MPBox](./box), `size` here is the size of the *sheet*: it sets no height
31
+ * and no type scale.
32
+ * @default 'md'
33
+ */
34
+ size?: MPSize;
35
+ /**
36
+ * Holds the content to a measure and centres it while the sheet itself still
37
+ * spans the window. The same ladder [MPContainer](./container)'s `maxWidth`
38
+ * uses.
39
+ * @default 'none'
40
+ */
41
+ maxWidth?: MPSize | 'none';
42
+ /**
43
+ * The gutter, and the air above and below.
44
+ * @default true
45
+ */
46
+ padded?: boolean;
47
+ /**
48
+ * The name the region is announced by. Worth writing when a page has more than
49
+ * one `<footer>` in it — an article's own and the site's.
50
+ */
51
+ label?: string;
52
+ /**
53
+ * Renders something other than a `<footer>`. Base UI's own escape hatch, and
54
+ * rarely what you want: at the top level of a document that tag is the
55
+ * `contentinfo` landmark, and it is what says "this is the site's own
56
+ * information" rather than "this is more of the article".
57
+ */
58
+ render?: useRender.RenderProp;
59
+ /**
60
+ * Everything in it.
61
+ *
62
+ * A footer's content is four columns of links on one site and a single line on
63
+ * the next, all of it the caller's — which is why this component has slots for
64
+ * nothing and room for anything.
65
+ */
66
+ children?: React.ReactNode;
67
+ }
68
+ /**
69
+ * The sheet at the end of a page.
70
+ *
71
+ * A real `<footer>`, which is the whole reason it is a component rather than a
72
+ * div: at the top level of a document that tag is the `contentinfo` landmark —
73
+ * the region a screen reader offers as "the site's own information", and the one
74
+ * a search engine reads the copyright, the address and the site map out of.
75
+ *
76
+ * ## Why it has no slots, and [MPHeader](./header) does
77
+ *
78
+ * Because a header's three regions are a fixed arrangement worth writing once,
79
+ * and a footer's content is not an arrangement at all. Four columns of links on
80
+ * one site, a copyright line on the next, a language picker and a row of logos
81
+ * on the third. A component that guessed would be a component every second site
82
+ * had to fight.
83
+ *
84
+ * What it decides instead is the **sheet**: the surface, the gutter, the measure,
85
+ * and whether it stays in reach. Everything above that is an
86
+ * [MPGrid](./grid) or an [MPContainer](./container) the caller puts inside it.
87
+ *
88
+ * ## Inside a layout, and outside one
89
+ *
90
+ * Inside an [MPPageLayout](./page-layout) it registers itself, so a `fixed`
91
+ * footer's height is reserved rather than sitting on top of the last paragraph.
92
+ * Outside one it is simply a sheet.
93
+ */
94
+ export declare const MPFooter: React.ForwardRefExoticComponent<MPFooterProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{useRender as o}from"@base-ui/react/use-render";import{BAR_SURFACE as r,MPPageLayoutContext as a}from"../../internal/page-layout.js";import{MEASURE as i,SHEET_PAD_X as n,SHEET_PAD_Y as s}from"../../internal/scale.js";const l={static:"",absolute:"absolute inset-x-0 bottom-0 z-30",sticky:"sticky bottom-0 z-30",fixed:"fixed inset-x-0 bottom-0 z-40"};export const MPFooter=/*@__PURE__*/t.forwardRef(function({position:m="static",variant:c="outlined",size:d="md",maxWidth:f="none",padded:u=!0,label:p,render:b,className:x,children:j,...z},h){const{register:v}=t.useContext(a),w=t.useCallback(e=>{v("footer",e),"function"==typeof h?h(e):h&&(h.current=e)},[v,h]);return o({render:b??e("footer",{}),ref:w,props:{"aria-label":p,"data-mp-size":d,"data-mp-variant":c,className:["mp-footer text-mp-on-surface box-border w-full min-w-0",r[c],"outlined"===c?"border-mp-outline-variant border-t":"",l[m],x??""].filter(Boolean).join(" "),children:e("div",{className:["mp-footer__inner w-full",u?`${n[d]} ${s[d]}`:"","none"===f?"":`${i[f]} mx-auto`].filter(Boolean).join(" "),children:j}),...z}})});
@@ -0,0 +1,2 @@
1
+ export { MPFooter } from './MPFooter.js';
2
+ export type { MPFooterProps } from './MPFooter.js';
@@ -0,0 +1 @@
1
+ export{MPFooter}from"./MPFooter.js";