material-plus-ui 1.9.0 → 1.11.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 (280) hide show
  1. package/README.md +2 -2
  2. package/dist/a2ui/extended/api.d.ts +4 -4
  3. package/dist/components/accordion/MPAccordion.d.ts +13 -0
  4. package/dist/components/accordion/MPAccordion.js +1 -1
  5. package/dist/components/accordion/index.d.ts +1 -1
  6. package/dist/components/animate-counter/MPAnimateCounter.js +1 -1
  7. package/dist/components/animate-headline/MPAnimateHeadline.d.ts +8 -0
  8. package/dist/components/animate-headline/MPAnimateHeadline.js +1 -1
  9. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
  10. package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
  11. package/dist/components/animate-scramble/MPAnimateScramble.d.ts +8 -0
  12. package/dist/components/animate-scramble/MPAnimateScramble.js +1 -1
  13. package/dist/components/animate-split/MPAnimateSplit.d.ts +8 -0
  14. package/dist/components/animate-split/MPAnimateSplit.js +1 -1
  15. package/dist/components/animate-typing/MPAnimateTyping.d.ts +10 -2
  16. package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
  17. package/dist/components/app-logo/MPAppLogo.d.ts +6 -1
  18. package/dist/components/area-chart/MPAreaChart.js +1 -1
  19. package/dist/components/avatar/MPAvatar.d.ts +16 -0
  20. package/dist/components/avatar/MPAvatar.js +1 -1
  21. package/dist/components/badge/MPBadge.d.ts +7 -6
  22. package/dist/components/bar-chart/MPBarChart.js +1 -1
  23. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +8 -0
  24. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  25. package/dist/components/button/MPButton.d.ts +5 -3
  26. package/dist/components/carousel/MPCarousel.js +1 -1
  27. package/dist/components/checkbox/MPCheckbox.js +1 -1
  28. package/dist/components/chip/MPChip.d.ts +1 -1
  29. package/dist/components/chip/MPChip.js +1 -1
  30. package/dist/components/code-block/MPCodeBlock.js +1 -1
  31. package/dist/components/collapsible/MPCollapsible.js +1 -1
  32. package/dist/components/color-picker/MPColorPicker.js +1 -1
  33. package/dist/components/combobox/MPCombobox.d.ts +3 -2
  34. package/dist/components/combobox/MPCombobox.js +1 -1
  35. package/dist/components/command-palette/MPCommandPalette.d.ts +3 -1
  36. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  37. package/dist/components/config/MPConfigProvider.d.ts +17 -1
  38. package/dist/components/config/MPConfigProvider.js +1 -1
  39. package/dist/components/confirm/MPConfirmProvider.js +1 -1
  40. package/dist/components/data-table/MPDataTable.d.ts +3 -36
  41. package/dist/components/data-table/MPDataTable.js +1 -1
  42. package/dist/components/date-picker/MPDatePicker.js +1 -1
  43. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
  44. package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
  45. package/dist/components/dialog/MPDialog.d.ts +3 -2
  46. package/dist/components/drawer/MPDrawer.d.ts +13 -1
  47. package/dist/components/drawer/MPDrawer.js +1 -1
  48. package/dist/components/file-picker/MPFilePicker.js +1 -1
  49. package/dist/components/floating-action-button/MPFloatingActionButton.d.ts +3 -1
  50. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +10 -1
  51. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +1 -1
  52. package/dist/components/form/MPForm.d.ts +3 -0
  53. package/dist/components/form/MPForm.js +1 -1
  54. package/dist/components/gauge-chart/MPGaugeChart.js +1 -1
  55. package/dist/components/header/MPHeader.js +1 -1
  56. package/dist/components/heatmap-chart/MPHeatmapChart.js +1 -1
  57. package/dist/components/hover-card/MPHoverCard.d.ts +8 -7
  58. package/dist/components/icon-button/MPIconButton.js +1 -1
  59. package/dist/components/image/MPImage.d.ts +5 -0
  60. package/dist/components/image/MPImage.js +1 -1
  61. package/dist/components/line-chart/MPLineChart.js +1 -1
  62. package/dist/components/list/MPList.d.ts +3 -2
  63. package/dist/components/locale/MPLocaleProvider.d.ts +15 -30
  64. package/dist/components/locale/MPLocaleProvider.js +1 -1
  65. package/dist/components/menu/MPMenu.d.ts +9 -1
  66. package/dist/components/menu/MPMenu.js +1 -1
  67. package/dist/components/meter/MPMeter.d.ts +5 -0
  68. package/dist/components/meter/MPMeter.js +1 -1
  69. package/dist/components/mockup/MPMockup.js +1 -1
  70. package/dist/components/navigation-menu/MPNavigationMenu.d.ts +27 -1
  71. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  72. package/dist/components/number-field/MPNumberField.d.ts +2 -1
  73. package/dist/components/number-field/MPNumberField.js +1 -1
  74. package/dist/components/otp-field/MPOtpField.js +1 -1
  75. package/dist/components/page-layout/MPPageLayout.js +1 -1
  76. package/dist/components/pagination/MPPagination.d.ts +12 -4
  77. package/dist/components/pagination/MPPagination.js +1 -1
  78. package/dist/components/panes/MPPanes.js +1 -1
  79. package/dist/components/pie-chart/MPPieChart.js +1 -1
  80. package/dist/components/pill/MPPill.js +1 -1
  81. package/dist/components/progress-box/MPProgressBox.js +1 -1
  82. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  83. package/dist/components/progress-linear/MPProgressLinear.d.ts +4 -3
  84. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  85. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  86. package/dist/components/scatter-chart/MPScatterChart.js +1 -1
  87. package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
  88. package/dist/components/sidebar/MPSidebar.d.ts +15 -2
  89. package/dist/components/sidebar/MPSidebar.js +1 -1
  90. package/dist/components/slider/MPSlider.d.ts +5 -0
  91. package/dist/components/slider/MPSlider.js +1 -1
  92. package/dist/components/snackbar/MPSnackbar.d.ts +8 -6
  93. package/dist/components/snackbar/MPSnackbar.js +1 -1
  94. package/dist/components/stepper/MPStepper.d.ts +9 -7
  95. package/dist/components/stepper/MPStepper.js +1 -1
  96. package/dist/components/switch/MPSwitch.js +1 -1
  97. package/dist/components/table/MPTable.d.ts +7 -3
  98. package/dist/components/tabs/MPTabs.js +1 -1
  99. package/dist/components/text-field/MPTextField.d.ts +9 -0
  100. package/dist/components/text-field/MPTextField.js +1 -1
  101. package/dist/components/time-picker/MPTimePicker.js +1 -1
  102. package/dist/components/timeline-chart/MPTimelineChart.js +1 -1
  103. package/dist/components/toolbar/MPToolbar.d.ts +3 -3
  104. package/dist/components/tooltip/MPTooltip.d.ts +6 -0
  105. package/dist/components/tour/MPTour.js +1 -1
  106. package/dist/components/transfer/MPTransfer.js +1 -1
  107. package/dist/components/tree-select/MPTreeSelect.d.ts +12 -2
  108. package/dist/components/tree-select/MPTreeSelect.js +1 -1
  109. package/dist/components/tree-view/MPTreeView.d.ts +8 -0
  110. package/dist/components/tree-view/MPTreeView.js +1 -1
  111. package/dist/hooks/index.d.ts +4 -2
  112. package/dist/hooks/index.js +1 -1
  113. package/dist/hooks/mpColorSchemeScript.d.ts +46 -0
  114. package/dist/hooks/mpColorSchemeScript.js +1 -0
  115. package/dist/hooks/useMPColorScheme.d.ts +2 -47
  116. package/dist/hooks/useMPColorScheme.js +1 -1
  117. package/dist/hooks/useMPMediaQuery.js +1 -1
  118. package/dist/hooks/useMPOnScreen.js +1 -1
  119. package/dist/internal/Calendar.js +1 -1
  120. package/dist/internal/ChartChrome.d.ts +11 -2
  121. package/dist/internal/ChartChrome.js +1 -1
  122. package/dist/internal/ChartFrame.js +1 -1
  123. package/dist/internal/FieldOutline.d.ts +20 -2
  124. package/dist/internal/FieldOutline.js +1 -1
  125. package/dist/internal/FieldValue.d.ts +35 -0
  126. package/dist/internal/FieldValue.js +2 -0
  127. package/dist/internal/Picker.d.ts +24 -5
  128. package/dist/internal/Picker.js +1 -1
  129. package/dist/internal/RenderedLink.d.ts +20 -0
  130. package/dist/internal/RenderedLink.js +2 -0
  131. package/dist/internal/SupportingText.js +1 -1
  132. package/dist/internal/animate.d.ts +4 -0
  133. package/dist/internal/animate.js +1 -1
  134. package/dist/internal/box-size.d.ts +22 -0
  135. package/dist/internal/box-size.js +2 -0
  136. package/dist/internal/chart.d.ts +21 -11
  137. package/dist/internal/chart.js +1 -1
  138. package/dist/internal/color-scheme-keys.d.ts +13 -0
  139. package/dist/internal/color-scheme-keys.js +1 -0
  140. package/dist/internal/color-scheme.d.ts +11 -2
  141. package/dist/internal/color-scheme.js +1 -1
  142. package/dist/internal/config.d.ts +2 -0
  143. package/dist/internal/date.d.ts +2 -8
  144. package/dist/internal/date.js +1 -1
  145. package/dist/internal/fold.d.ts +45 -0
  146. package/dist/internal/fold.js +2 -0
  147. package/dist/internal/highlight.js +1 -1
  148. package/dist/internal/i18n.d.ts +6 -53
  149. package/dist/internal/i18n.js +1 -1
  150. package/dist/internal/intersection.d.ts +50 -0
  151. package/dist/internal/intersection.js +2 -0
  152. package/dist/internal/intl.d.ts +22 -21
  153. package/dist/internal/intl.js +1 -1
  154. package/dist/internal/keys.d.ts +0 -9
  155. package/dist/internal/keys.js +1 -1
  156. package/dist/internal/layout-effect.d.ts +7 -0
  157. package/dist/internal/layout-effect.js +2 -0
  158. package/dist/internal/locale.d.ts +10 -2
  159. package/dist/internal/media.d.ts +1 -0
  160. package/dist/internal/media.js +1 -0
  161. package/dist/internal/messages/common.js +1 -1
  162. package/dist/internal/occurrence.d.ts +18 -0
  163. package/dist/internal/occurrence.js +1 -0
  164. package/dist/internal/page-layout.js +1 -1
  165. package/dist/internal/progress.d.ts +5 -0
  166. package/dist/internal/ref.d.ts +9 -0
  167. package/dist/internal/ref.js +1 -0
  168. package/dist/internal/remember.d.ts +36 -0
  169. package/dist/internal/remember.js +1 -0
  170. package/dist/internal/surface.d.ts +7 -1
  171. package/dist/internal/surface.js +1 -1
  172. package/dist/internal/table.d.ts +4 -4
  173. package/dist/internal/text.d.ts +10 -4
  174. package/dist/internal/text.js +1 -1
  175. package/dist/internal/window-class.d.ts +8 -0
  176. package/dist/internal/window-class.js +1 -1
  177. package/dist/locales/ar.js +1 -1
  178. package/dist/locales/de.js +1 -1
  179. package/dist/locales/es.js +1 -1
  180. package/dist/locales/fr.js +1 -1
  181. package/dist/locales/hi.js +1 -1
  182. package/dist/locales/id.js +1 -1
  183. package/dist/locales/it.js +1 -1
  184. package/dist/locales/ja.js +1 -1
  185. package/dist/locales/ko.js +1 -1
  186. package/dist/locales/nl.js +1 -1
  187. package/dist/locales/pl.js +1 -1
  188. package/dist/locales/pt.js +1 -1
  189. package/dist/locales/ru.js +1 -1
  190. package/dist/locales/th.js +1 -1
  191. package/dist/locales/tr.js +1 -1
  192. package/dist/locales/vi.js +1 -1
  193. package/dist/locales/zh-hans.js +1 -1
  194. package/dist/locales/zh-hant.js +1 -1
  195. package/dist/styles/accordion.css +1 -1
  196. package/dist/styles/alert.css +1 -1
  197. package/dist/styles/animate-appear.css +1 -1
  198. package/dist/styles/animate-blink.css +1 -1
  199. package/dist/styles/animate-counter.css +1 -1
  200. package/dist/styles/animate-fade.css +1 -1
  201. package/dist/styles/animate-float.css +1 -1
  202. package/dist/styles/animate-grow.css +1 -1
  203. package/dist/styles/animate-headline.css +1 -1
  204. package/dist/styles/animate-lighting.css +1 -1
  205. package/dist/styles/animate-marquee.css +1 -1
  206. package/dist/styles/animate-reveal.css +1 -1
  207. package/dist/styles/animate-rotate.css +1 -1
  208. package/dist/styles/animate-scramble.css +1 -1
  209. package/dist/styles/animate-shake.css +1 -1
  210. package/dist/styles/animate-slide.css +1 -1
  211. package/dist/styles/animate-split.css +1 -1
  212. package/dist/styles/animate-typing.css +1 -1
  213. package/dist/styles/animate-zoom.css +1 -1
  214. package/dist/styles/avatar.css +1 -1
  215. package/dist/styles/blockquote.css +1 -1
  216. package/dist/styles/box.css +1 -1
  217. package/dist/styles/breadcrumb.css +1 -1
  218. package/dist/styles/calendar.css +1 -1
  219. package/dist/styles/card.css +1 -1
  220. package/dist/styles/carousel.css +1 -1
  221. package/dist/styles/checkbox.css +1 -1
  222. package/dist/styles/chip.css +1 -1
  223. package/dist/styles/collapsible.css +1 -1
  224. package/dist/styles/color-picker.css +1 -1
  225. package/dist/styles/combobox.css +1 -1
  226. package/dist/styles/command-palette.css +1 -1
  227. package/dist/styles/confirm.css +1 -1
  228. package/dist/styles/data-table.css +1 -1
  229. package/dist/styles/date-picker.css +1 -1
  230. package/dist/styles/date-range-picker.css +1 -1
  231. package/dist/styles/date-time-picker.css +1 -1
  232. package/dist/styles/dialog.css +1 -1
  233. package/dist/styles/drawer.css +1 -1
  234. package/dist/styles/empty.css +1 -1
  235. package/dist/styles/floating-bottom-navigation.css +1 -1
  236. package/dist/styles/footer.css +1 -1
  237. package/dist/styles/gauge-chart.css +1 -1
  238. package/dist/styles/header.css +1 -1
  239. package/dist/styles/highlight.css +1 -1
  240. package/dist/styles/hover-card.css +1 -1
  241. package/dist/styles/image.css +1 -1
  242. package/dist/styles/list.css +1 -1
  243. package/dist/styles/menu.css +1 -1
  244. package/dist/styles/menubar.css +1 -1
  245. package/dist/styles/meter.css +1 -1
  246. package/dist/styles/navigation-menu.css +1 -1
  247. package/dist/styles/number-field.css +1 -1
  248. package/dist/styles/otp-field.css +1 -1
  249. package/dist/styles/overlay.css +1 -1
  250. package/dist/styles/page-layout.css +1 -1
  251. package/dist/styles/pill.css +1 -1
  252. package/dist/styles/popconfirm.css +1 -1
  253. package/dist/styles/popover.css +1 -1
  254. package/dist/styles/progress-box.css +1 -1
  255. package/dist/styles/progress-circular.css +1 -1
  256. package/dist/styles/progress-linear.css +1 -1
  257. package/dist/styles/radio-group.css +1 -1
  258. package/dist/styles/segmented-button.css +1 -1
  259. package/dist/styles/select.css +1 -1
  260. package/dist/styles/sidebar.css +1 -1
  261. package/dist/styles/slider.css +1 -1
  262. package/dist/styles/snackbar.css +1 -1
  263. package/dist/styles/spoiler.css +1 -1
  264. package/dist/styles/stack.css +1 -1
  265. package/dist/styles/stepper.css +1 -1
  266. package/dist/styles/switch.css +1 -1
  267. package/dist/styles/table.css +1 -1
  268. package/dist/styles/tabs.css +1 -1
  269. package/dist/styles/text-field.css +1 -1
  270. package/dist/styles/time-picker.css +1 -1
  271. package/dist/styles/tokens.css +1 -1
  272. package/dist/styles/toolbar.css +1 -1
  273. package/dist/styles/tour.css +1 -1
  274. package/dist/styles/transfer.css +1 -1
  275. package/dist/styles/tree-select.css +1 -1
  276. package/dist/styles/tree-view.css +1 -1
  277. package/dist/styles/typography.css +1 -1
  278. package/dist/styles.css +1 -1
  279. package/dist/tailwind.css +178 -29
  280. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{Toggle as o}from"@base-ui/react/toggle";import{ToggleGroup as n}from"@base-ui/react/toggle-group";import{MPIcon as a}from"../icon/MPIcon.js";import{CheckIcon as s}from"../../constants/icons.js";import{MPStateLayer as i}from"../../internal/StateLayer.js";import{CONTROL_GAP as l,CONTROL_HEIGHT as d,CONTROL_ICON as c,CONTROL_PAD_X as m,CONTROL_TEXT as u}from"../../internal/scale.js";import{useMPSize as p}from"../../internal/config.js";export const MPSegmentedButton=/*@__PURE__*/r.forwardRef(function({items:r,value:f,defaultValue:b,onValueChange:h,multiple:g=!1,showCheck:y=!0,size:j,fullWidth:x=!1,disabled:v=!1,"aria-label":w,className:N,style:B},V){const k=p(j);return e(n,{ref:V,"aria-label":w,value:f,defaultValue:b,onValueChange:e=>h?.(e),multiple:g,disabled:v,"data-mp-size":k,className:["mp-segmented-button rounded-mp-full box-border items-center align-middle","overflow-hidden border",v?"border-mp-on-surface/12":"border-mp-outline",x?"flex w-full":"inline-flex w-fit",d[k],N??""].filter(Boolean).join(" "),style:B,children:r.map((r,n)=>{const d=v||r.disabled;return t(o,{value:r.value,disabled:r.disabled,className:["mp-segmented-button__segment group relative flex h-full items-center","box-border justify-center bg-transparent font-[inherit] whitespace-nowrap","select-none","appearance-none overflow-hidden outline-none","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)",u[k],l[k],m[k],0===n?"border-0":"border-y-0 border-e-0 border-s",d?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":["border-mp-outline cursor-pointer","text-mp-on-surface","data-pressed:bg-mp-secondary-container","data-pressed:text-mp-on-secondary-container"].join(" "),x?"flex-1":""].filter(Boolean).join(" "),children:[d?null:e(i,{}),y||r.icon?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:c[k],height:c[k]},children:[y?e("span",{className:["absolute inset-0 flex items-center justify-center opacity-0","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-pressed:opacity-100"].join(" "),children:e(a,{icon:s,size:c[k]})}):null,r.icon?e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",y?"group-data-pressed:opacity-0":""].filter(Boolean).join(" "),children:r.icon}):null]}):null,e("span",{className:"truncate",children:r.label})]},`${n}:${r.value}`)})})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{Toggle as a}from"@base-ui/react/toggle";import{ToggleGroup as o}from"@base-ui/react/toggle-group";import{MPIcon as n}from"../icon/MPIcon.js";import{CheckIcon as s}from"../../constants/icons.js";import{MPStateLayer as l}from"../../internal/StateLayer.js";import{useMPSize as i}from"../../internal/config.js";const m={xs:"h-8",sm:"h-9",md:"h-10",lg:"h-12",xl:"h-14"},d={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"},p={xs:"px-3",sm:"px-3.5",md:"px-4",lg:"px-5",xl:"px-6"},c={xs:"gap-1.5",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-2"},u={xs:16,sm:18,md:18,lg:20,xl:20};export const MPSegmentedButton=/*@__PURE__*/r.forwardRef(function({items:r,value:f,defaultValue:x,onValueChange:b,multiple:g=!1,showCheck:h=!0,size:y,fullWidth:j=!1,disabled:v=!1,"aria-label":w,className:N,style:B},V){const k=i(y);return e(o,{ref:V,"aria-label":w,value:f,defaultValue:x,onValueChange:e=>b?.(e),multiple:g,disabled:v,"data-mp-size":k,className:["mp-segmented-button rounded-mp-full box-border items-center align-middle","overflow-hidden border",v?"border-mp-on-surface/12":"border-mp-outline",j?"flex w-full":"inline-flex w-fit",m[k],N??""].filter(Boolean).join(" "),style:B,children:r.map((r,o)=>{const i=v||r.disabled;return t(a,{value:r.value,disabled:r.disabled,className:["mp-segmented-button__segment group relative flex h-full items-center","box-border justify-center bg-transparent font-[inherit] whitespace-nowrap","select-none","appearance-none overflow-hidden outline-none","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)",d[k],c[k],p[k],0===o?"border-0":"border-y-0 border-e-0 border-s",i?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":["border-mp-outline cursor-pointer","text-mp-on-surface","data-pressed:bg-mp-secondary-container","data-pressed:text-mp-on-secondary-container"].join(" "),j?"flex-1":""].filter(Boolean).join(" "),children:[i?null:e(l,{}),h||r.icon?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:u[k],height:u[k]},children:[h?e("span",{className:["absolute inset-0 flex items-center justify-center opacity-0","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-pressed:opacity-100"].join(" "),children:e(n,{icon:s,size:u[k]})}):null,r.icon?e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",h?"group-data-pressed:opacity-0":""].filter(Boolean).join(" "),children:r.icon}):null]}):null,e("span",{className:"truncate",children:r.label})]},`${o}:${r.value}`)})})});
@@ -55,6 +55,17 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
55
55
  * to bring it back would be a sidebar the reader has lost.
56
56
  */
57
57
  collapseBelow?: MPPageCollapse;
58
+ /**
59
+ * Keeps the sidebar's contents in the document while it is a closed drawer,
60
+ * hidden, rather than taking them out.
61
+ *
62
+ * Collapsed, a sidebar is a modal drawer, and a closed one is not on the page
63
+ * at all — so below `collapseBelow` its links vanished from the page a
64
+ * crawler renders at a phone's width. Turn it on for a sidebar that is the
65
+ * site's navigation. See `MPDrawer`'s own `keepMounted`.
66
+ * @default false
67
+ */
68
+ keepMounted?: boolean;
58
69
  /**
59
70
  * Whether the drawer is open. Only meaningful once the sidebar has collapsed;
60
71
  * a column is not opened, it is there.
@@ -90,8 +101,10 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
90
101
  */
91
102
  title?: React.ReactNode;
92
103
  /**
93
- * How much surface the column paints, on the **container** ladder — a sidebar
94
- * is never dyed, because what sits on it arrives with colours of its own.
104
+ * How much surface the column paints, on the ladder `MPHeader` and `MPFooter`
105
+ * use: the container one, except that `elevated` lifts to a level-2 shadow and
106
+ * `outlined` keeps the page's surface. A sidebar is never dyed, because what
107
+ * sits on it arrives with colours of its own.
95
108
  *
96
109
  * `outlined` is the default: the page's own surface, with a hairline down the
97
110
  * edge that faces the content. That is the column *in the layout*. Once it has
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{barSurface as l,drawerSide as d,EXPANDED_ONLY as u,MPPageLayoutContext as c,MPSidebarSideContext as m,useMPCollapsed as p}from"../../internal/page-layout.js";import{sheetPadX as f,sheetPadY as v}from"../../internal/density.js";import{useMPDensity as b,useMPSize as y}from"../../internal/config.js";const h={xs:"15rem",sm:"18rem",md:"22.5rem",lg:"26rem",xl:"30rem"};function g(e,t){return null==e?t:"number"==typeof e?e:o(e,"undefined"==typeof window?void 0:window.innerWidth)??t}export const MPSidebar=/*@__PURE__*/r.forwardRef(function({side:o,width:w,minWidth:x=160,maxWidth:j=480,resizable:_=!1,onResize:R,onResizeEnd:k,collapseBelow:C,open:z,defaultOpen:P=!1,onOpenChange:E,sticky:M=!0,title:L,variant:B="outlined",elevation:S,size:N,density:A,padded:D=!0,label:O,locale:$,className:I,style:W,children:T,...X},K){const V=y(N),q=b(A),F=r.useContext(c),G=r.useContext(m),H=o??G??"start",J=i($??F.locale),Q=a(s,J),U=C??(F.present?F.collapseBelow:"none"),Y=p(U),[Z,ee]=r.useState(P),te=void 0!==z,re=te?z:F.present?F.open[H]:Z,ne=e=>{te||(F.present?F.setOpen(H,e):ee(e)),E?.(e)},oe=void 0===w?h[V]:"number"==typeof w?`${w}px`:w,ie=r.useRef(null),ae=r.useRef(oe),se=r.useRef(null),le=r.useId();ae.current!==oe&&(ae.current=oe,ie.current=null);const de=ie.current??oe,ue=r.useRef(null),ce=r.useCallback(e=>{ue.current=e,"function"==typeof K?K(e):K&&(K.current=e)},[K]),me=r.useRef(null);r.useEffect(()=>()=>me.current?.(),[]);const pe=e=>{const t=ue.current;if(!t)return e;const r=Math.min(g(j,480),Math.max(g(x,160),Math.round(e)));return ie.current=`${r}px`,t.style.setProperty("--_mp-sidebar-width",ie.current),se.current?.setAttribute("aria-valuenow",String(r)),r};return Y?e(n,{side:d(H),mode:"modal",open:re,onOpenChange:ne,title:L??O??Q.sidebar,size:V,locale:J,extent:void 0===w?void 0:de,className:I,style:W,children:T}):t("aside",{ref:ce,"aria-label":O??Q.sidebar,"data-mp-size":V,"data-mp-variant":B,"data-mp-side":H,className:["mp-sidebar text-mp-on-surface relative box-border flex min-w-0 shrink-0 flex-col","w-(--_mp-sidebar-width)",l(B,S),"outlined"===B?"border-mp-outline-variant "+("start"===H?"border-e":"border-s"):"","content"===F.scroll?"h-full":M?["self-start sticky [top:var(--_mp-layout-header,0px)]","[height:calc(100dvh_-_var(--_mp-layout-header,0px)_-_var(--_mp-layout-footer,0px))]"].join(" "):"",u[U],I??""].filter(Boolean).join(" "),style:{"--_mp-sidebar-width":de,...W},...X,children:[e("div",{id:le,className:["mp-sidebar__body min-h-0 flex-1 overflow-y-auto overscroll-contain",D?`${f(V,q)} ${v(V,q)}`:""].filter(Boolean).join(" "),children:T}),_?e("div",{ref:se,role:"separator","aria-orientation":"vertical","aria-label":Q.resizeSidebar,"aria-valuemin":Math.round(g(x,160)),"aria-valuemax":Math.round(g(j,480)),"aria-valuenow":Math.round(g(de,g(h[V],360))),"aria-controls":le,tabIndex:0,className:["mp-sidebar__handle absolute inset-y-0 z-1 w-2 cursor-col-resize bg-transparent","start"===H?"-me-1 end-0":"-ms-1 start-0","hover:bg-mp-outline-variant data-dragging:bg-mp-outline-variant","transition-colors duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-0","focus-visible:outline-solid outline-none"].join(" "),onPointerDown:e=>{const t=ue.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,i=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,s="start"===H===a?-1:1;let l=i;const d=e=>{l=pe(i+(e.clientX-o)*s),R?.(l)},u=()=>{me.current=null,r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},c=()=>{u(),k?.(l)};me.current=u,r.addEventListener("pointermove",d),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===H===t?-1:1;(e=>{const t=ue.current;if(!t)return;const r=pe(t.getBoundingClientRect().width+e);R?.(r),k?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{barSurface as l,drawerSide as d,EXPANDED_ONLY as u,MPPageLayoutContext as c,MPSidebarSideContext as m,useMPCollapsed as p}from"../../internal/page-layout.js";import{sheetPadX as f,sheetPadY as v}from"../../internal/density.js";import{useMPDensity as b,useMPSize as y}from"../../internal/config.js";const h={xs:"15rem",sm:"18rem",md:"22.5rem",lg:"26rem",xl:"30rem"};function g(e,t){return null==e?t:"number"==typeof e?e:o(e,"undefined"==typeof window?void 0:window.innerWidth)??t}export const MPSidebar=/*@__PURE__*/r.forwardRef(function({side:o,width:w,minWidth:x=160,maxWidth:j=480,resizable:_=!1,onResize:k,onResizeEnd:R,collapseBelow:C,keepMounted:M=!1,open:z,defaultOpen:P=!1,onOpenChange:E,sticky:L=!0,title:B,variant:S="outlined",elevation:N,size:A,density:D,padded:O=!0,label:$,locale:I,className:W,style:T,children:X,...K},V){const q=y(A),F=b(D),G=r.useContext(c),H=r.useContext(m),J=o??H??"start",Q=i(I??G.locale),U=a(s,Q),Y=C??(G.present?G.collapseBelow:"none"),Z=p(Y),[ee,te]=r.useState(P),re=void 0!==z,ne=re?z:G.present?G.open[J]:ee,oe=e=>{re||(G.present?G.setOpen(J,e):te(e)),E?.(e)},ie=void 0===w?h[q]:"number"==typeof w?`${w}px`:w,ae=r.useRef(null),se=r.useRef(ie),le=r.useRef(null),de=r.useId();se.current!==ie&&(se.current=ie,ae.current=null);const ue=ae.current??ie,ce=r.useRef(null),me=r.useCallback(e=>{ce.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),pe=r.useRef(null);r.useEffect(()=>()=>pe.current?.(),[]);const fe=e=>{const t=ce.current;if(!t)return e;const r=Math.min(g(j,480),Math.max(g(x,160),Math.round(e)));return ae.current=`${r}px`,t.style.setProperty("--_mp-sidebar-width",ae.current),le.current?.setAttribute("aria-valuenow",String(r)),r};return Z?e(n,{side:d(J),mode:"modal",open:ne,onOpenChange:oe,title:B??$??U.sidebar,keepMounted:M,size:q,locale:Q,extent:void 0===w?void 0:ue,className:W,style:T,children:X}):t("aside",{ref:me,"aria-label":$??U.sidebar,"data-mp-size":q,"data-mp-variant":S,"data-mp-side":J,className:["mp-sidebar text-mp-on-surface relative box-border flex min-w-0 shrink-0 flex-col","w-(--_mp-sidebar-width)",l(S,N),"outlined"===S?"border-mp-outline-variant "+("start"===J?"border-e":"border-s"):"","content"===G.scroll?"h-full":L?["self-start sticky [top:var(--_mp-layout-header,0px)]","[height:calc(100dvh_-_var(--_mp-layout-header,0px)_-_var(--_mp-layout-footer,0px))]"].join(" "):"",u[Y],W??""].filter(Boolean).join(" "),style:{"--_mp-sidebar-width":ue,...T},...K,children:[e("div",{id:de,className:["mp-sidebar__body min-h-0 flex-1 overflow-y-auto overscroll-contain",O?`${f(q,F)} ${v(q,F)}`:""].filter(Boolean).join(" "),children:X}),_?e("div",{ref:le,role:"separator","aria-orientation":"vertical","aria-label":U.resizeSidebar,"aria-valuemin":Math.round(g(x,160)),"aria-valuemax":Math.round(g(j,480)),"aria-valuenow":Math.round(g(ue,g(h[q],360))),"aria-controls":de,tabIndex:0,className:["mp-sidebar__handle absolute inset-y-0 z-1 w-2 cursor-col-resize bg-transparent","start"===J?"-me-1 end-0":"-ms-1 start-0","hover:bg-mp-outline-variant data-dragging:bg-mp-outline-variant","transition-colors duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-0","focus-visible:outline-solid outline-none"].join(" "),onPointerDown:e=>{const t=ce.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,i=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,s="start"===J===a?-1:1;let l=i;const d=e=>{l=fe(i+(e.clientX-o)*s),k?.(l)},u=()=>{pe.current=null,r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},c=()=>{u(),R?.(l)};pe.current=u,r.addEventListener("pointermove",d),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===J===t?-1:1;(e=>{const t=ce.current;if(!t)return;const r=fe(t.getBoundingClientRect().width+e);k?.(r),R?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
@@ -59,6 +59,11 @@ export interface MPSliderProps {
59
59
  showValue?: boolean;
60
60
  /** How the readout is written. Passed to `Intl.NumberFormat`. */
61
61
  format?: Intl.NumberFormatOptions;
62
+ /**
63
+ * The locale the readout and the announced value are written in. Defaults to
64
+ * the nearest `MPLocaleProvider`, then to the runtime's own.
65
+ */
66
+ locale?: string;
62
67
  /**
63
68
  * Which way the slider runs. A vertical slider has no length of its own, so
64
69
  * give it a height — the default is a starting point, not a rule.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Slider as r}from"@base-ui/react/slider";import{accentSlots as s}from"../../internal/accent.js";import{MPStateLayer as n}from"../../internal/StateLayer.js";import{META_TEXT as l,hasContent as i}from"../../internal/scale.js";import{useMPColor as o,useMPSize as m}from"../../internal/config.js";const u={xs:{thickness:"h-0.5",cross:"w-0.5",handle:"size-3.5",strip:"h-8",stripCross:"w-8"},sm:{thickness:"h-[3px]",cross:"w-[3px]",handle:"size-4",strip:"h-9",stripCross:"w-9"},md:{thickness:"h-1",cross:"w-1",handle:"size-5",strip:"h-10",stripCross:"w-10"},lg:{thickness:"h-1.5",cross:"w-1.5",handle:"size-6",strip:"h-11",stripCross:"w-11"},xl:{thickness:"h-2",cross:"w-2",handle:"size-7",strip:"h-12",stripCross:"w-12"}},c=/*@__PURE__*/["duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),d={xs:"size-[2px]",sm:"size-[2px]",md:"size-[3px]",lg:"size-1",xl:"size-1.5"},p={xs:"size-8",sm:"size-9",md:"size-10",lg:"size-11",xl:"size-12"};export const MPSlider=/*@__PURE__*/t.forwardRef(function({value:f,defaultValue:h,onValueChange:g,onValueCommitted:b,min:x=0,max:v=100,step:w=1,marks:j,label:y,description:z,showValue:N=!1,format:_,orientation:k="horizontal",size:C,color:V,disabled:A=!1,name:M,"aria-label":S,className:$,style:I},B){const L=m(C),R=o(V),T="vertical"===k,F=u[L],P=t.useId(),X=f??h,Y=Array.isArray(X)?X.length:1,q=t.useMemo(()=>{if(!j||v<=x)return[];if(!0!==j)return j.filter(e=>e.value>=x&&e.value<=v);const e=Math.floor((v-x)/w);return!Number.isFinite(e)||e<1||e>50?[]:Array.from({length:e+1},(e,a)=>({value:x+a*w}))},[j,x,v,w]),[D,E]=t.useState(h),G=f??D,H=t.useMemo(()=>{const e=Array.isArray(G)?G:void 0===G?[]:[G];return 0===e.length?null:1===e.length?{from:x,to:e[0]}:{from:Math.min(...e),to:Math.max(...e)}},[G,x]),J=e=>(e-x)/(v-x)*100+"%";return a(r.Root,{ref:B,value:f,defaultValue:h,onValueChange:e=>{void 0===f&&E(e),g?.(e)},onValueCommitted:e=>b?.(e),min:x,max:v,step:w,disabled:A,orientation:k,format:_,name:M,"data-mp-size":L,className:["mp-slider flex",T?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1",A?"cursor-default":"",$??""].filter(Boolean).join(" "),style:{...s(R),...I},children:[i(y)||N?a("div",{className:["flex w-full items-baseline gap-2",l].join(" "),children:[i(y)?e(r.Label,{className:A?"text-mp-on-surface/38":"text-mp-on-surface-variant",children:y}):null,N?e(r.Value,{className:["ms-auto tabular-nums",A?"text-mp-on-surface/38":"text-mp-on-surface"].join(" ")}):null]}):null,e(r.Control,{className:["mp-slider__control group/rail flex touch-none items-center justify-center select-none",T?`${F.stripCross} h-40 flex-col`:`w-full ${F.strip}`,A?"":"cursor-pointer"].filter(Boolean).join(" "),children:a(r.Track,{className:["mp-slider__track rounded-mp-full relative",T?`${F.cross} h-full`:`${F.thickness} w-full`,A?"bg-mp-on-surface/12":"bg-mp-surface-container-highest"].join(" "),children:[e(r.Indicator,{className:["rounded-mp-full","[transition-property:inset-inline-start,width,bottom,height]",c,"group-data-dragging/rail:transition-none",A?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")}),q.map(a=>{const t=null!==H&&a.value>=H.from&&a.value<=H.to;return e("span",{"aria-hidden":"true",className:["mp-slider__tick pointer-events-none absolute rounded-full",d[L],A?"bg-mp-on-surface/38":t?"bg-(--_mp-on-accent)":"bg-mp-on-surface-variant"].join(" "),style:T?{bottom:J(a.value),insetInlineStart:"50%",transform:"translate(-50%, 50%)"}:{insetInlineStart:J(a.value),top:"50%",transform:"translate(-50%, -50%)"}},`tick:${a.value}`)}),Array.from({length:Y},(a,t)=>e(r.Thumb,{index:t,"aria-label":i(y)?void 0:S,"aria-describedby":i(z)?P:void 0,className:["mp-slider__handle group rounded-mp-full relative outline-none","[transition-property:inset-inline-start,bottom]",c,"data-dragging:transition-none",F.handle,A?"bg-mp-on-surface/38 cursor-default":"bg-(--_mp-accent) cursor-grab active:cursor-grabbing"].join(" "),children:A?null:e(n,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",p[L],"bg-(--_mp-accent)"].join(" "),className:"group-data-dragging:opacity-16"})},t))]})}),q.some(e=>i(e.label))?e("div",{"aria-hidden":"true",className:["mp-slider__marks relative",l,T?"h-full":"w-full",A?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),style:T?void 0:{height:"1lh"},children:q.map(a=>i(a.label)?e("span",{className:"absolute whitespace-nowrap",style:T?{bottom:J(a.value),transform:"translateY(50%)"}:{insetInlineStart:J(a.value),transform:"translateX(-50%)"},children:a.label},`label:${a.value}`):null)}):null,i(z)?e("div",{id:P,className:[l,A?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:z}):null]})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Slider as r}from"@base-ui/react/slider";import{accentSlots as s}from"../../internal/accent.js";import{MPStateLayer as n}from"../../internal/StateLayer.js";import{META_TEXT as l,hasContent as i}from"../../internal/scale.js";import{useMPColor as o,useMPSize as m}from"../../internal/config.js";import{useMPLocale as c}from"../../internal/locale.js";import{checkServerLocale as u,intlLocale as p}from"../../internal/intl.js";const d={xs:{thickness:"h-0.5",cross:"w-0.5",handle:"size-3.5",strip:"h-8",stripCross:"w-8"},sm:{thickness:"h-[3px]",cross:"w-[3px]",handle:"size-4",strip:"h-9",stripCross:"w-9"},md:{thickness:"h-1",cross:"w-1",handle:"size-5",strip:"h-10",stripCross:"w-10"},lg:{thickness:"h-1.5",cross:"w-1.5",handle:"size-6",strip:"h-11",stripCross:"w-11"},xl:{thickness:"h-2",cross:"w-2",handle:"size-7",strip:"h-12",stripCross:"w-12"}},f=/*@__PURE__*/["duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),h={xs:"size-[2px]",sm:"size-[2px]",md:"size-[3px]",lg:"size-1",xl:"size-1.5"},g={xs:"size-8",sm:"size-9",md:"size-10",lg:"size-11",xl:"size-12"};export const MPSlider=/*@__PURE__*/t.forwardRef(function({value:b,defaultValue:x,onValueChange:v,onValueCommitted:j,min:w=0,max:y=100,step:z=1,marks:N,label:_,description:k,showValue:C=!1,format:V,locale:A,orientation:M="horizontal",size:S,color:$,disabled:I=!1,name:B,"aria-label":L,className:R,style:T},F){const P=m(S),X=o($),Y=c(A),q="vertical"===M;u(Y);const D=d[P],E=t.useId(),G=b??x,H=Array.isArray(G)?G.length:1,J=t.useMemo(()=>{if(!N||y<=w)return[];if(!0!==N)return N.filter(e=>e.value>=w&&e.value<=y);const e=Math.floor((y-w)/z);return!Number.isFinite(e)||e<1||e>50?[]:Array.from({length:e+1},(e,a)=>({value:w+a*z}))},[N,w,y,z]),[K,O]=t.useState(x),Q=b??K,U=t.useMemo(()=>{const e=Array.isArray(Q)?Q:void 0===Q?[]:[Q];return 0===e.length?null:1===e.length?{from:w,to:e[0]}:{from:Math.min(...e),to:Math.max(...e)}},[Q,w]),W=e=>(e-w)/(y-w)*100+"%";return a(r.Root,{ref:F,value:b,defaultValue:x,onValueChange:e=>{void 0===b&&O(e),v?.(e)},onValueCommitted:e=>j?.(e),min:w,max:y,step:z,disabled:I,orientation:M,format:V,locale:p(Y),name:B,"data-mp-size":P,className:["mp-slider flex",q?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1",I?"cursor-default":"",R??""].filter(Boolean).join(" "),style:{...s(X),...T},children:[i(_)||C?a("div",{className:["flex w-full items-baseline gap-2",l].join(" "),children:[i(_)?e(r.Label,{className:I?"text-mp-on-surface/38":"text-mp-on-surface-variant",children:_}):null,C?e(r.Value,{className:["ms-auto tabular-nums",I?"text-mp-on-surface/38":"text-mp-on-surface"].join(" ")}):null]}):null,e(r.Control,{className:["mp-slider__control group/rail flex touch-none items-center justify-center select-none",q?`${D.stripCross} h-40 flex-col`:`w-full ${D.strip}`,I?"":"cursor-pointer"].filter(Boolean).join(" "),children:a(r.Track,{className:["mp-slider__track rounded-mp-full relative",q?`${D.cross} h-full`:`${D.thickness} w-full`,I?"bg-mp-on-surface/12":"bg-mp-surface-container-highest"].join(" "),children:[e(r.Indicator,{className:["rounded-mp-full","[transition-property:inset-inline-start,width,bottom,height]",f,"group-data-dragging/rail:transition-none",I?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")}),J.map(a=>{const t=null!==U&&a.value>=U.from&&a.value<=U.to;return e("span",{"aria-hidden":"true",className:["mp-slider__tick pointer-events-none absolute rounded-full",h[P],I?"bg-mp-on-surface/38":t?"bg-(--_mp-on-accent)":"bg-mp-on-surface-variant"].join(" "),style:q?{bottom:W(a.value),insetInlineStart:"50%",transform:"translate(-50%, 50%)"}:{insetInlineStart:W(a.value),top:"50%",transform:"translate(-50%, -50%)"}},`tick:${a.value}`)}),Array.from({length:H},(a,t)=>e(r.Thumb,{index:t,"aria-label":i(_)?void 0:L,"aria-describedby":i(k)?E:void 0,className:["mp-slider__handle group rounded-mp-full relative outline-none","[transition-property:inset-inline-start,bottom]",f,"data-dragging:transition-none",D.handle,I?"bg-mp-on-surface/38 cursor-default":"bg-(--_mp-accent) cursor-grab active:cursor-grabbing"].join(" "),children:I?null:e(n,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",g[P],"bg-(--_mp-accent)"].join(" "),className:"group-data-dragging:opacity-16"})},t))]})}),J.some(e=>i(e.label))?e("div",{"aria-hidden":"true",className:["mp-slider__marks relative",l,q?"h-full":"w-full",I?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),style:q?void 0:{height:"1lh"},children:J.map(a=>i(a.label)?e("span",{className:"absolute whitespace-nowrap",style:q?{bottom:W(a.value),transform:"translateY(50%)"}:{insetInlineStart:W(a.value),transform:"translateX(-50%)"},children:a.label},`label:${a.value}`):null)}):null,i(k)?e("div",{id:E,className:[l,I?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:k}):null]})});
@@ -28,10 +28,11 @@ export interface MPSnackbarData {
28
28
  * page whose bottom corner is a toolbar. Not for a preference: an application
29
29
  * whose snackbars all appear in the same wrong place should move the provider.
30
30
  *
31
- * All six stacks are on the page from the start whether or not anything is in
32
- * them, which is not a detail: a stack is its own `aria-live` region, and a
33
- * region added to the document at the same instant as the message inside it is
34
- * a region a screen reader has nothing to compare against and does not read.
31
+ * The six stacks share one `aria-live` region, which is on the page from the
32
+ * first render whether or not anything is in it, and that is not a detail: a
33
+ * region added to the document at the same instant as the message inside it
34
+ * is one a screen reader has nothing to compare against and does not read. A
35
+ * corner's stack is drawn inside it once that corner has a message.
35
36
  */
36
37
  position?: MPSnackbarPosition;
37
38
  /**
@@ -113,8 +114,9 @@ export interface MPSnackbarProviderProps {
113
114
  */
114
115
  limit?: number;
115
116
  /**
116
- * How wide a snackbar may get. Numbers are pixels. MD3's own maximum is 600dp
117
- * and its minimum is 344dp, which is what the two ends of the plate are set to.
117
+ * How wide a snackbar may get. Numbers are pixels. The default is MD3's own
118
+ * maximum, 600dp. There is no minimum on the plate; the message keeps at least
119
+ * 280px of the line, or the whole line on a window narrower than that.
118
120
  * @default 600
119
121
  */
120
122
  width?: number | string;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{MPIcon as i}from"../icon/MPIcon.js";import{CloseIcon as n}from"../../constants/icons.js";import{accentSlots as a}from"../../internal/accent.js";import{useMPLocale as r,useMPMessages as l}from"../../internal/locale.js";import{COMMON as m}from"../../internal/messages/common.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{cssLength as p}from"../../internal/length.js";import{PORTAL_LAYER as d}from"../../internal/surface.js";import{useMPSize as u}from"../../internal/config.js";const f={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},b=/*@__PURE__*/["transition-[opacity,translate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),x={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"},y={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"},h={xs:"min-h-9 gap-1.5 py-1.5 ps-3 pe-1.5",sm:"min-h-10 gap-2 py-2 ps-3.5 pe-2",md:"min-h-12 gap-2 py-2.5 ps-4 pe-2",lg:"min-h-14 gap-3 py-3 ps-5 pe-2.5",xl:"min-h-16 gap-3 py-3.5 pe-3 ps-6"},g={xs:16,sm:18,md:20,lg:22,xl:24};function v(t){const{color:e,icon:o,position:s,className:i,message:n,actionLabel:a,onAction:r,...l}=t;return{...l,title:n,data:{color:e,icon:o,position:s,className:i},actionProps:void 0===a?void 0:{children:a,onClick:r}}}export function useMPSnackbar(){const t=s.useToastManager();return o.useMemo(()=>({add:e=>t.add(v(e)),close:e=>t.close(e),update:(e,o)=>t.update(e,v(o)),promise:(e,o)=>t.promise(e,{loading:v(o.loading),success:t=>v("function"==typeof o.success?o.success(t):o.success),error:t=>v("function"==typeof o.error?o.error(t):o.error)}),snackbars:t.toasts}),[t])}function j({toast:o,color:r,size:l,showClose:m,closeLabel:p,swipeDirection:d,edge:u}){const f=o.data?.color??r,v=o.data?.icon,j={"--_mp-plate":f?`var(--_mp-color-${f}-container)`:"var(--_mp-color-inverse-surface)","--_mp-on-plate":f?`var(--_mp-color-on-${f}-container)`:"var(--_mp-color-inverse-on-surface)","--_mp-plate-action":f?`var(--_mp-color-${f})`:"var(--_mp-color-inverse-primary)",...f?a(f):null};return e(s.Root,{toast:o,swipeDirection:d,"data-mp-size":l,className:["mp-snackbar rounded-mp-xs shadow-mp-3 pointer-events-auto flex w-full items-center","bg-(--_mp-plate) text-(--_mp-on-plate) outline-none",h[l],y[l],b,x[u],"data-limited:hidden",o.data?.className??""].filter(Boolean).join(" "),style:j,children:[v?t("span",{className:"flex shrink-0 items-center",children:v}):null,t(s.Title,{render:t("span",{}),className:"min-w-0 flex-1 py-0.5 ps-1 [min-inline-size:min(280px,100%)]"}),t(s.Action,{className:["text-mp-label-large flex shrink-0 cursor-pointer items-center","rounded-mp-full h-8 px-3 text-(--_mp-plate-action)","transition-colors duration-(--mp-sys-motion-duration-short4)","hover:bg-(--_mp-plate-action)/8 focus-visible:bg-(--_mp-plate-action)/10","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ")}),m?e(s.Close,{"aria-label":p,className:["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer","items-center justify-center text-(--_mp-on-plate)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[t(c,{}),t(i,{icon:n,size:g[l]})]}):null]})}const w=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"];function _({position:e,fallback:o,width:i,...n}){const{toasts:a}=s.useToastManager(),r=a.filter(t=>(t.data?.position??o)===e),l=e.startsWith("top")?"top":"bottom",m=["top"===l?"up":"down","left","right"];return t(s.Portal,{children:t(s.Viewport,{className:[d,"pointer-events-none fixed inset-x-0 flex flex-col gap-2 p-4",f[e]].join(" "),children:r.map(e=>t("div",{className:"w-full",style:{maxWidth:p(i)},children:t(j,{toast:e,swipeDirection:m,edge:l,...n})},e.id))})})}export function MPSnackbarProvider({color:o,position:i="bottom-start",timeout:n=5e3,limit:a=3,width:c=600,size:p,showClose:d=!0,closeLabel:f,locale:b,children:x}){const y=u(p),h=r(b),g=l(m,h);return e(s.Provider,{timeout:n,limit:a,children:[x,w.map(e=>t(_,{position:e,fallback:i,width:c,color:o,size:y,showClose:d,closeLabel:f??g.close},e))]})}
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{MPIcon as n}from"../icon/MPIcon.js";import{CloseIcon as i}from"../../constants/icons.js";import{accentSlots as a}from"../../internal/accent.js";import{useMPLocale as r,useMPMessages as l}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{cssLength as p}from"../../internal/length.js";import{PORTAL_LAYER as d}from"../../internal/surface.js";import{useMPSize as u}from"../../internal/config.js";const f={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},b=/*@__PURE__*/["transition-[opacity,translate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),x={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"},h={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"},y={xs:"min-h-9 gap-1.5 py-1.5 ps-3 pe-1.5",sm:"min-h-10 gap-2 py-2 ps-3.5 pe-2",md:"min-h-12 gap-2 py-2.5 ps-4 pe-2",lg:"min-h-14 gap-3 py-3 ps-5 pe-2.5",xl:"min-h-16 gap-3 py-3.5 pe-3 ps-6"},g={xs:16,sm:18,md:20,lg:22,xl:24};function v(t){const{color:e,icon:o,position:s,className:n,message:i,actionLabel:a,onAction:r,...l}=t;return{...l,title:i,data:{color:e,icon:o,position:s,className:n},actionProps:void 0===a?void 0:{children:a,onClick:r}}}export function useMPSnackbar(){const t=s.useToastManager();return o.useMemo(()=>({add:e=>t.add(v(e)),close:e=>t.close(e),update:(e,o)=>t.update(e,v(o)),promise:(e,o)=>t.promise(e,{loading:v(o.loading),success:t=>v("function"==typeof o.success?o.success(t):o.success),error:t=>v("function"==typeof o.error?o.error(t):o.error)}),snackbars:t.toasts}),[t])}function j({toast:o,color:r,size:l,showClose:c,closeLabel:p,swipeDirection:d,edge:u}){const f=o.data?.color??r,v=o.data?.icon,j={"--_mp-plate":f?`var(--_mp-color-${f}-container)`:"var(--_mp-color-inverse-surface)","--_mp-on-plate":f?`var(--_mp-color-on-${f}-container)`:"var(--_mp-color-inverse-on-surface)","--_mp-plate-action":f?`var(--_mp-color-${f})`:"var(--_mp-color-inverse-primary)",...f?a(f):null};return e(s.Root,{toast:o,swipeDirection:d,"data-mp-size":l,className:["mp-snackbar rounded-mp-xs shadow-mp-3 pointer-events-auto flex w-full items-center","bg-(--_mp-plate) text-(--_mp-on-plate) outline-none",y[l],h[l],b,x[u],"data-limited:hidden",o.data?.className??""].filter(Boolean).join(" "),style:j,children:[v?t("span",{className:"flex shrink-0 items-center",children:v}):null,t(s.Title,{render:t("span",{}),className:"min-w-0 flex-1 py-0.5 ps-1 [min-inline-size:min(280px,100%)]"}),t(s.Action,{className:["text-mp-label-large flex shrink-0 cursor-pointer items-center","rounded-mp-full h-8 px-3 text-(--_mp-plate-action)","transition-colors duration-(--mp-sys-motion-duration-short4)","hover:bg-(--_mp-plate-action)/8 focus-visible:bg-(--_mp-plate-action)/10","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ")}),c?e(s.Close,{"aria-label":p,className:["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer","items-center justify-center text-(--_mp-on-plate)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[t(m,{}),t(n,{icon:i,size:g[l]})]}):null]})}const _=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"];function w({fallback:e,width:o,...n}){const{toasts:i}=s.useToastManager();return t(s.Portal,{children:t(s.Viewport,{className:`${d} pointer-events-none fixed inset-0`,children:_.map(s=>{const a=i.filter(t=>(t.data?.position??e)===s);if(0===a.length)return null;const r=s.startsWith("top")?"top":"bottom",l=["top"===r?"up":"down","left","right"];return t("div",{"data-mp-position":s,className:["mp-snackbar__stack pointer-events-none absolute inset-x-0 flex flex-col gap-2 p-4",f[s]].join(" "),children:a.map(e=>t("div",{className:"w-full",style:{maxWidth:p(o)},children:t(j,{toast:e,swipeDirection:l,edge:r,...n})},e.id))},s)})})})}export function MPSnackbarProvider({color:o,position:n="bottom-start",timeout:i=5e3,limit:a=3,width:m=600,size:p,showClose:d=!0,closeLabel:f,locale:b,children:x}){const h=u(p),y=r(b),g=l(c,y);return e(s.Provider,{timeout:i,limit:a,children:[x,t(w,{fallback:n,width:m,color:o,size:h,showClose:d,closeLabel:f??g.close})]})}
@@ -18,10 +18,12 @@ export interface MPStepperProps extends Omit<React.ComponentPropsWithoutRef<'div
18
18
  /**
19
19
  * Called with the step that was pressed.
20
20
  *
21
- * **Leaving it out is what makes the steps unpressable.** A stepper with no
22
- * handler is a progress indicator — it says where the reader is and offers no
23
- * way to move, which is the right shape for a sequence the application drives
24
- * with its own Next and Back buttons.
21
+ * **Leaving it out of a controlled stepper is what makes the steps
22
+ * unpressable.** A stepper given `active` and no handler is a progress
23
+ * indicator — it says where the reader is and offers no way to move, which is
24
+ * the right shape for a sequence the application drives with its own Next and
25
+ * Back buttons. An uncontrolled stepper moves itself when a step is pressed,
26
+ * handler or not.
25
27
  */
26
28
  onActiveChange?: (active: number) => void;
27
29
  /**
@@ -123,9 +125,9 @@ export interface MPStepProps extends Omit<React.ComponentPropsWithoutRef<'li'>,
123
125
  * | The content | is all on screen | is one panel |
124
126
  * | Default orientation | `vertical` | `horizontal` |
125
127
  *
126
- * A stepper with no `onActiveChange` is the overlap: unpressable, one panel, and
127
- * a progress indicator for a sequence the application's own Next and Back
128
- * buttons drive.
128
+ * A controlled stepper with no `onActiveChange` is the overlap: unpressable, one
129
+ * panel, and a progress indicator for a sequence the application's own Next and
130
+ * Back buttons drive.
129
131
  *
130
132
  * ## It ships no Next and Back
131
133
  *
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as l}from"../icon/MPIcon.js";import{CheckIcon as o,ErrorIcon as a}from"../../constants/icons.js";import{accentSlots as i}from"../../internal/accent.js";import{hasContent as s,META_TEXT as c,SHEET_TITLE as p}from"../../internal/scale.js";import{BORDER_STYLE as m,BULLET as d,BULLET_GAP as u,BULLET_SIZE as f,CONNECTOR_COLOR as h,ITEM_GAP as v,ITEM_GAP_X as x,STEP_MOTION as b,TITLE_COLOR as _}from"../../internal/step.js";import{useMPColor as j,useMPSize as N}from"../../internal/config.js";function g(e,t){return`${e}-label-${t}`}function w(e){return`${e}-panel`}const y=/*@__PURE__*/n.createContext(null),z=/*@__PURE__*/n.createContext(0);export const MPStepper=/*@__PURE__*/n.forwardRef(function({active:r,defaultActive:l=0,onActiveChange:o,linear:a=!0,orientation:c="horizontal",size:p,color:m,className:d,style:u,children:h,...v},x){const b=N(p),_=j(m),[g,w]=n.useState(l),C=r??g,[P,S]=n.useState(C);C>P&&S(C);const $=n.Children.toArray(h).filter(n.isValidElement),k=$.length,M=n.useId(),A=s($[C]?.props.children),I=n.useCallback(e=>{void 0===r&&w(e),o?.(e)},[r,o]),R=n.useMemo(()=>({size:b,color:_,orientation:c,active:C,onSelect:o||void 0===r?I:null,linear:a,count:k,furthest:P,idBase:M,hasPanel:A}),[b,_,c,C,o,r,I,a,k,P,M,A]),E="horizontal"===c;return e(y.Provider,{value:R,children:t("div",{...v,ref:x,"data-mp-size":b,className:["mp-stepper flex flex-col",d??""].filter(Boolean).join(" "),style:{...i(_),...u},children:[e("ol",{className:["mp-stepper__rail m-0 flex list-none p-0",E?"flex-row items-start":"flex-col"].join(" "),style:{"--_mp-bullet":f[b]},children:$.map((t,r)=>e(z.Provider,{value:r,children:t},r))}),e(B,{steps:$,active:C,idBase:M})]})})});function B({steps:t,active:r,idBase:n}){const l=t[r],o=l?.props.children;if(!s(o))return null;const a=s(l?.props.label);return e("div",{id:w(n),role:"group","aria-labelledby":a?g(n,r):void 0,className:"mp-stepper__panel mt-4",children:o})}export const MPStep=/*@__PURE__*/n.forwardRef(function({label:f,description:j,bullet:N,error:B=!1,optional:C,disabled:P=!1,connector:S="solid",color:$,className:k,style:M,children:A,...I},R){const E=n.useContext(y),F=n.useContext(z),V=E?.size??"md",q=E?.orientation??"horizontal",D=E?.active??0,G=E?.count??1,H=E?.furthest??0,J=E?.linear??!0,K=F<D?"complete":F===D?"current":"upcoming",L=$??(B?"error":E?.color??"primary"),O="horizontal"===q,Q=F===G-1,T="none"!==S&&!Q,U=!P&&(!J||F<=H),W=null!=E?.onSelect&&U,X=N??("complete"!==K||B?B?e(l,{icon:a}):F+1:e(l,{icon:o})),Y=e("span",{"aria-hidden":"true",className:["mp-stepper__bullet rounded-mp-full relative z-10 flex shrink-0","items-center justify-center","size-(--_mp-bullet) text-[calc(var(--_mp-bullet)*0.5)] leading-none font-medium","tabular-nums [&>svg]:size-[0.6em]",d[K],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" "),children:X}),Z=T?e("span",{"aria-hidden":"true",className:["mp-stepper__connector pointer-events-none absolute",O?"start-(--_mp-bullet) top-[calc(var(--_mp-bullet)/2_-_1px)] end-0 border-t-2":"top-(--_mp-bullet) start-[calc(var(--_mp-bullet)/2_-_1px)] bottom-0 border-s-2",m[S],h[K],b].filter(Boolean).join(" ")}):null,ee=t("span",{className:"flex min-w-0 flex-col gap-0.5 text-start "+(O?"mt-2":""),children:[s(f)?e("span",{id:E?g(E.idBase,F):void 0,className:["mp-stepper__label",p[V],B?"text-mp-error":_[K],b].join(" "),children:f}):null,s(C)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:C}):null,s(j)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:j}):null]}),te=t(r,{children:[Z,t("span",{className:`flex min-w-0 ${O?"flex-col items-start":"flex-row"} ${O?"":u[V]}`,children:[Y,ee]})]});return e("li",{...I,ref:R,"aria-current":"current"===K?"step":void 0,className:["mp-stepper__step relative min-w-0",O?`flex-1 ${Q?"":x[V]}`:Q?"":v[V],k??""].filter(Boolean).join(" "),style:{...$||B?i(L):null,...M},children:W?e("button",{type:"button","aria-controls":E?.hasPanel?w(E.idBase):void 0,"aria-expanded":E?.hasPanel?"current"===K:void 0,className:["group relative flex w-full min-w-0 cursor-pointer appearance-none border-0 bg-transparent p-0 text-start","outline-mp-secondary rounded-mp-xs focus-visible:outline-2 focus-visible:outline-offset-2","outline-none"].join(" "),onClick:()=>E?.onSelect?.(F),children:te}):e("span",{className:"relative flex w-full min-w-0","aria-disabled":!(!E?.onSelect||U)||void 0,children:te})})});
2
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as l}from"../icon/MPIcon.js";import{CheckIcon as o,ErrorIcon as a}from"../../constants/icons.js";import{accentSlots as i}from"../../internal/accent.js";import{hasContent as s,META_TEXT as c,SHEET_TITLE as p}from"../../internal/scale.js";import{BORDER_STYLE as m,BULLET as d,BULLET_GAP as u,BULLET_SIZE as f,CONNECTOR_COLOR as h,ITEM_GAP as v,ITEM_GAP_X as x,STEP_MOTION as b,TITLE_COLOR as _}from"../../internal/step.js";import{useMPColor as j,useMPSize as N}from"../../internal/config.js";function g(e,t){return`${e}-label-${t}`}function w(e){return`${e}-panel`}const y=/*@__PURE__*/n.createContext(null),z=/*@__PURE__*/n.createContext(0);export const MPStepper=/*@__PURE__*/n.forwardRef(function({active:r,defaultActive:l=0,onActiveChange:o,linear:a=!0,orientation:c="horizontal",size:p,color:m,className:d,style:u,children:h,...v},x){const b=N(p),_=j(m),[g,w]=n.useState(l),C=r??g,[P,$]=n.useState(C);C>P&&$(C);const S=n.Children.toArray(h).filter(n.isValidElement),k=S.length,M=n.useId(),A=s(S[C]?.props.children),I=n.useCallback(e=>{void 0===r&&w(e),o?.(e)},[r,o]),R=n.useMemo(()=>({size:b,color:_,orientation:c,active:C,onSelect:o||void 0===r?I:null,linear:a,count:k,furthest:P,idBase:M,hasPanel:A}),[b,_,c,C,o,r,I,a,k,P,M,A]),E="horizontal"===c;return e(y.Provider,{value:R,children:t("div",{...v,ref:x,"data-mp-size":b,className:["mp-stepper flex flex-col",d??""].filter(Boolean).join(" "),style:{...i(_),...u},children:[e("ol",{className:["mp-stepper__rail m-0 flex list-none p-0",E?"flex-row items-start":"flex-col"].join(" "),style:{"--_mp-bullet":f[b]},children:S.map((t,r)=>e(z.Provider,{value:r,children:t},r))}),e(B,{steps:S,active:C,idBase:M})]})})});function B({steps:t,active:r,idBase:n}){const l=t[r],o=l?.props.children;if(!s(o))return null;const a=s(l?.props.label);return e("div",{id:w(n),role:"group","aria-labelledby":a?g(n,r):void 0,className:"mp-stepper__panel mt-4",children:o})}export const MPStep=/*@__PURE__*/n.forwardRef(function({label:f,description:j,bullet:N,error:B=!1,optional:C,disabled:P=!1,connector:$="solid",color:S,className:k,style:M,children:A,...I},R){const E=n.useContext(y),F=n.useContext(z),V=E?.size??"md",q=E?.orientation??"horizontal",D=E?.active??0,G=E?.count??1,H=E?.furthest??0,J=E?.linear??!0,K=F<D?"complete":F===D?"current":"upcoming",L=S??(B?"error":E?.color??"primary"),O="horizontal"===q,Q=F===G-1,T="none"!==$&&!Q,U=!P&&(!J||F<=H),W=null!=E?.onSelect,X=W&&U,Y=N??("complete"!==K||B?B?e(l,{icon:a}):F+1:e(l,{icon:o})),Z=e("span",{"aria-hidden":"true",className:["mp-stepper__bullet rounded-mp-full relative z-10 flex shrink-0","items-center justify-center","size-(--_mp-bullet) text-[calc(var(--_mp-bullet)*0.5)] leading-none font-medium","tabular-nums [&>svg]:size-[0.6em]",d[K],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" "),children:Y}),ee=T?e("span",{"aria-hidden":"true",className:["mp-stepper__connector pointer-events-none absolute",O?"start-(--_mp-bullet) top-[calc(var(--_mp-bullet)/2_-_1px)] end-0 border-t-2":"top-(--_mp-bullet) start-[calc(var(--_mp-bullet)/2_-_1px)] bottom-0 border-s-2",m[$],h[K],b].filter(Boolean).join(" ")}):null,te=t("span",{className:"flex min-w-0 flex-col gap-0.5 text-start "+(O?"mt-2":""),children:[s(f)?e("span",{id:E?g(E.idBase,F):void 0,className:["mp-stepper__label",p[V],B?"text-mp-error":_[K],b].join(" "),children:f}):null,s(C)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:C}):null,s(j)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:j}):null]}),re=t(r,{children:[ee,t("span",{className:`flex min-w-0 ${O?"flex-col items-start":"flex-row"} ${O?"":u[V]}`,children:[Z,te]})]});return e("li",{...I,ref:R,"aria-current":"current"===K?"step":void 0,className:["mp-stepper__step relative min-w-0",O?`flex-1 ${Q?"":x[V]}`:Q?"":v[V],k??""].filter(Boolean).join(" "),style:{...S||B?i(L):null,...M},children:W?e("button",{type:"button","aria-controls":E?.hasPanel?w(E.idBase):void 0,"aria-expanded":E?.hasPanel?"current"===K:void 0,"aria-disabled":!U||void 0,className:["group relative flex w-full min-w-0 appearance-none border-0 bg-transparent p-0 text-start",X?"cursor-pointer":"cursor-default","outline-mp-secondary rounded-mp-xs focus-visible:outline-2 focus-visible:outline-offset-2","outline-none"].join(" "),onClick:X?()=>E?.onSelect?.(F):void 0,children:re}):e("span",{className:"relative flex w-full min-w-0",children:re})})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Switch as n}from"@base-ui/react/switch";import{Field as i}from"@base-ui/react/field";import{MPIcon as s}from"../icon/MPIcon.js";import{CheckIcon as o,CloseIcon as c}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{MPStateLayer as d}from"../../internal/StateLayer.js";import{MPSupportingText as h}from"../../internal/SupportingText.js";import{PROSE_TEXT as m,hasContent as p}from"../../internal/scale.js";import{useMPColor as u,useMPSize as f}from"../../internal/config.js";const g={xs:{track:"h-5 w-8",thumb:"start-[5px] size-2.5 data-checked:start-[15px] data-checked:size-3.5",halo:"size-8",glyph:8},sm:{track:"h-6 w-10",thumb:"start-1.5 size-3 data-checked:start-[19px] data-checked:size-[18px]",halo:"size-9",glyph:10},md:{track:"h-8 w-13",thumb:"start-2 size-4 data-checked:start-6 data-checked:size-6",halo:"size-10",glyph:14},lg:{track:"h-9 w-15",thumb:"start-[9px] size-[18px] data-checked:start-7 data-checked:size-7",halo:"size-11",glyph:16},xl:{track:"h-10 w-17",thumb:"start-2.5 size-5 data-checked:start-[33px] data-checked:size-[30px]",halo:"size-12",glyph:18}};export const MPSwitch=/*@__PURE__*/r.forwardRef(function({checked:k,defaultChecked:b,onCheckedChange:x,label:y,description:j,errorMessage:z,icons:w=!1,labelPlacement:N="end",size:_,color:C,required:M=!1,disabled:v=!1,readOnly:P=!1,name:R,id:S,fullWidth:W=!1,className:q,style:B},F){const I=f(_),L=u(C),O=p(z),T=O?"error":L,A=g[I],D=r.useId(),E=S??D,G=e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(n.Root,{ref:F,id:E,name:R,checked:k,defaultChecked:b,required:M,disabled:v,readOnly:P,onCheckedChange:e=>x?.(e),className:["mp-switch__track group relative box-border inline-flex shrink-0 p-0","rounded-mp-full appearance-none font-[inherit] outline-none","transition-[background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",A.track,v?["bg-mp-surface-container-highest inset-ring-2 inset-ring-mp-on-surface/12","cursor-default","data-checked:bg-mp-on-surface/12 data-checked:inset-ring-0"].join(" "):[P?"cursor-default":"cursor-pointer","bg-mp-surface-container-highest inset-ring-2",O?"inset-ring-mp-error":"inset-ring-mp-outline","data-checked:inset-ring-0 data-checked:bg-(--_mp-accent)"].join(" ")].join(" "),children:a(n.Thumb,{className:["mp-switch__thumb absolute top-1/2 flex -translate-y-1/2 items-center justify-center","rounded-full","transition-[inset-inline-start,width,height,background-color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",A.thumb,v?"bg-mp-on-surface/38 data-checked:bg-mp-surface-container-highest":[O?"bg-mp-error":"bg-mp-outline","data-checked:bg-(--_mp-on-accent)"].join(" ")].join(" "),children:[v?null:e(d,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",A.halo,"bg-mp-on-surface group-data-checked:bg-(--_mp-accent)"].join(" ")}),w?a(t,{children:[e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard opacity-0 group-data-checked:opacity-100",v?"text-mp-surface-container-highest":"text-(--_mp-accent)"].join(" "),children:e(s,{icon:o,size:A.glyph,strokeWidth:3})}),e("span",{className:["absolute inset-0 flex items-center justify-center","text-mp-surface-container-highest","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-checked:opacity-0"].join(" "),children:e(s,{icon:c,size:A.glyph,strokeWidth:3})})]}):null]})})}),H=p(y)||p(j)||O?a("span",{className:["flex min-w-0 flex-col gap-0.5","start"===N?"flex-1":""].filter(Boolean).join(" "),children:[p(y)?a(i.Label,{htmlFor:E,className:["leading-[1.4]",v?"text-mp-on-surface/38 cursor-default":P?"text-mp-on-surface":"text-mp-on-surface cursor-pointer"].join(" "),children:[y,M?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(h,{description:j,errorMessage:z})]}):null;return e(i.Root,{className:["mp-switch align-top",W?"flex w-full":"inline-flex",q??""].filter(Boolean).join(" "),disabled:v,invalid:O,"data-mp-size":I,style:{...l(T),...B},children:e("div",{className:["flex w-full items-start gap-3",m[I]].join(" "),children:a(t,"start"===N?{children:[H,G]}:{children:[G,H]})})})});
2
+ import{jsx as e,Fragment as t,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Switch as n}from"@base-ui/react/switch";import{Field as i}from"@base-ui/react/field";import{MPIcon as s}from"../icon/MPIcon.js";import{CheckIcon as o,CloseIcon as c}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{MPStateLayer as d}from"../../internal/StateLayer.js";import{MPSupportingText as h}from"../../internal/SupportingText.js";import{PROSE_TEXT as m,hasContent as p}from"../../internal/scale.js";import{useMPColor as u,useMPSize as f}from"../../internal/config.js";const g={xs:{track:"h-5 w-8",thumb:"start-[5px] size-2.5 data-checked:start-[15px] data-checked:size-3.5",halo:"size-8",glyph:8},sm:{track:"h-6 w-10",thumb:"start-1.5 size-3 data-checked:start-[19px] data-checked:size-[18px]",halo:"size-9",glyph:10},md:{track:"h-8 w-13",thumb:"start-2 size-4 data-checked:start-6 data-checked:size-6",halo:"size-10",glyph:14},lg:{track:"h-9 w-15",thumb:"start-[9px] size-[18px] data-checked:start-7 data-checked:size-7",halo:"size-11",glyph:16},xl:{track:"h-10 w-17",thumb:"start-2.5 size-5 data-checked:start-[33px] data-checked:size-[30px]",halo:"size-12",glyph:18}};export const MPSwitch=/*@__PURE__*/r.forwardRef(function({checked:k,defaultChecked:b,onCheckedChange:x,label:y,description:j,errorMessage:z,icons:w=!1,labelPlacement:N="end",size:_,color:C,required:M=!1,disabled:v=!1,readOnly:P=!1,name:R,id:S,fullWidth:W=!1,className:q,style:B},I){const L=f(_),O=u(C),T=p(z),F=T?"error":O,A=g[L],D=r.useId(),E=S??D,G=e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(n.Root,{ref:I,id:E,name:R,checked:k,defaultChecked:b,required:M,disabled:v,readOnly:P,onCheckedChange:e=>x?.(e),className:["mp-switch__track group relative box-border inline-flex shrink-0 p-0","rounded-mp-full appearance-none font-[inherit] outline-none","transition-[background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",A.track,v?["bg-mp-surface-container-highest inset-ring-2 inset-ring-mp-on-surface/12","cursor-default","data-checked:bg-mp-on-surface/12 data-checked:inset-ring-0"].join(" "):[P?"cursor-default":"cursor-pointer","bg-mp-surface-container-highest inset-ring-2",T?"inset-ring-mp-error":"inset-ring-mp-outline","data-checked:inset-ring-0 data-checked:bg-(--_mp-accent)"].join(" ")].join(" "),children:a(n.Thumb,{className:["mp-switch__thumb absolute top-1/2 flex -translate-y-1/2 items-center justify-center","rounded-full","transition-[inset-inline-start,width,height,background-color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",A.thumb,v?"bg-mp-on-surface/38 data-checked:bg-mp-surface-container-highest":[T?"bg-mp-error":"bg-mp-outline","data-checked:bg-(--_mp-on-accent)"].join(" ")].join(" "),children:[v?null:e(d,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",A.halo,"bg-mp-on-surface group-data-checked:bg-(--_mp-accent)"].join(" ")}),w?a(t,{children:[e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard opacity-0 group-data-checked:opacity-100",v?"text-mp-surface-container-highest":"text-(--_mp-accent)"].join(" "),children:e(s,{icon:o,size:A.glyph,strokeWidth:3})}),e("span",{className:["absolute inset-0 flex items-center justify-center","text-mp-surface-container-highest","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-checked:opacity-0"].join(" "),children:e(s,{icon:c,size:A.glyph,strokeWidth:3})})]}):null]})})}),H=p(y)||p(j)||T?a("span",{className:["flex min-w-0 flex-col gap-0.5","start"===N?"flex-1":""].filter(Boolean).join(" "),children:[p(y)?a(i.Label,{className:["leading-[1.4]",v?"text-mp-on-surface/38 cursor-default":P?"text-mp-on-surface":"text-mp-on-surface cursor-pointer"].join(" "),children:[y,M?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(h,{description:j,errorMessage:z})]}):null;return e(i.Root,{className:["mp-switch align-top",W?"flex w-full":"inline-flex",q??""].filter(Boolean).join(" "),disabled:v,invalid:T,"data-mp-size":L,style:{...l(F),...B},children:e("div",{className:["flex w-full items-start gap-3",m[L]].join(" "),children:a(t,"start"===N?{children:[H,G]}:{children:[G,H]})})})});
@@ -128,9 +128,13 @@ export interface MPTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'
128
128
  */
129
129
  size?: MPSize;
130
130
  /**
131
- * Which accent family a hovered or pressed row reads. The cells themselves
132
- * stay neutral.
133
- * @default 'primary'
131
+ * Has no visible effect, and is kept only so code that passes it still
132
+ * compiles.
133
+ *
134
+ * It promised the accent family a hovered row would read, and the rows were
135
+ * never tinted: a stripe and a hover are neutral surfaces one step apart, on
136
+ * purpose, because a table that tints its rows colours its data.
137
+ * @deprecated No effect. It is due to be removed in the next major version.
134
138
  */
135
139
  color?: MPColor;
136
140
  /**
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{accentSlots as n}from"../../internal/accent.js";import{MPStateLayer as o}from"../../internal/StateLayer.js";import{CONTROL_GAP as r,hasContent as l,SHEET_GAP as s}from"../../internal/scale.js";import{useMPColor as c,useMPSize as u}from"../../internal/config.js";const d=/*@__PURE__*/a.createContext({variant:"primary",size:"md",iconPosition:"top",fullWidth:!1}),m={xs:"h-8",sm:"h-10",md:"h-12",lg:"h-14",xl:"h-16"},p={xs:"h-11",sm:"h-13",md:"h-16",lg:"h-18",xl:"h-20"},f={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"},h={xs:"px-3",sm:"px-3.5",md:"px-4",lg:"px-5",xl:"px-6"},b={xs:12,sm:14,md:16,lg:20,xl:24},v={xs:18,sm:20,md:24,lg:24,xl:28};function x(e,t,i,n=""){a.Children.toArray(e).forEach(e=>{if(!a.isValidElement(e))return void(l(e)&&t.push(e));if(e.type===a.Fragment)return void x(e.props.children,t,i,`${n}${String(e.key)}/`);const o=n?a.cloneElement(e,{key:`${n}${String(e.key)}`}):e;e.type===MPTabPanel?i.push(o):t.push(o)})}export const MPTabs=/*@__PURE__*/a.forwardRef(function({variant:o="primary",color:r,size:l,value:m,defaultValue:p,onValueChange:f,iconPosition:h,activateOnFocus:v=!1,loopFocus:y=!0,divider:w=!0,fullWidth:g=!1,className:_,style:j,children:P,"aria-label":k,...N},M){const z=c(r),C=u(l),R=h??("primary"===o?"top":"start"),$=a.useMemo(()=>({variant:o,size:C,iconPosition:R,fullWidth:g}),[o,C,R,g]),S=a.useRef(null),[W,E]=a.useState(null),F=a.useCallback(()=>{const e=S.current;if(!e)return;const t=e.scrollWidth-e.clientWidth,a=Math.abs(e.scrollLeft),i=t-a,n="rtl"===getComputedStyle(e).direction,o=(n?i:a)>1,r=(n?a:i)>1;E(o&&r?"both":o?"left":r?"right":null)},[]);a.useEffect(F),a.useEffect(()=>{const e=S.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(F);return t.observe(e),()=>t.disconnect()},[F]);const T=[],V=[];return x(P,T,V),e(d.Provider,{value:$,children:t(i.Root,{ref:M,value:m,defaultValue:p,onValueChange:e=>f?.(e),"data-mp-size":C,"data-mp-variant":o,className:["mp-tabs flex min-w-0 flex-col",s[C],_??""].filter(Boolean).join(" "),style:{...n(z),"--_mp-tab-inset":`${b[C]}px`,...j},...N,children:[t(i.List,{ref:S,"aria-label":k,activateOnFocus:v,loopFocus:y,"data-mp-overflow":W??void 0,onScroll:F,className:["mp-tabs__list relative flex shrink-0",w?"border-mp-outline-variant border-b":"",g?"w-full":"","overflow-x-auto overflow-y-hidden","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"].filter(Boolean).join(" "),children:[T,e(i.Indicator,{className:["mp-tabs__indicator pointer-events-none absolute bottom-0","bg-(--_mp-accent)","primary"===o?["h-0.75 rounded-t-full","left-[calc(var(--active-tab-left)_+_var(--_mp-tab-inset))]","w-[calc(var(--active-tab-width)_-_2_*_var(--_mp-tab-inset))]"].join(" "):"left-(--active-tab-left) h-0.5 w-(--active-tab-width)","[transition-property:left,width]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" ")})]}),V]})})});export const MPTab=/*@__PURE__*/a.forwardRef(function({value:n,icon:s,disabled:c=!1,className:u,children:b,...x},y){const{variant:w,size:g,iconPosition:_,fullWidth:j}=a.useContext(d),P="top"===_&&l(s);return t(i.Tab,{ref:y,value:n,disabled:c,className:["mp-tabs__tab group relative flex shrink-0 items-center justify-center","box-border appearance-none border-0 bg-transparent font-[inherit] whitespace-nowrap select-none","overflow-hidden outline-none","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",P?`flex-col gap-1 ${p[g]}`:`flex-row ${m[g]}`,P?"":r[g],f[g],h[g],c?"text-mp-on-surface/38 cursor-default":["text-mp-on-surface-variant cursor-pointer","primary"===w?"data-active:text-(--_mp-accent)":"data-active:text-mp-on-surface"].join(" "),"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid",j?"flex-1":"",u??""].filter(Boolean).join(" "),...x,children:[c?null:e(o,{}),l(s)?e("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:v[g],height:v[g]},children:s}):null,l(b)?e("span",{className:"relative truncate",children:b}):null]})});export const MPTabPanel=/*@__PURE__*/a.forwardRef(function({value:t,keepMounted:a=!1,className:n,children:o,...r},l){return e(i.Panel,{ref:l,value:t,keepMounted:a,className:["mp-tabs__panel text-mp-on-surface min-w-0 flex-1","rounded-mp-xs outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-opacity duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-starting-style:opacity-0",n??""].filter(Boolean).join(" "),...r,children:o})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Tabs as a}from"@base-ui/react/tabs";import{accentSlots as r}from"../../internal/accent.js";import{MPStateLayer as i}from"../../internal/StateLayer.js";import{CONTROL_GAP as o,hasContent as l,SHEET_GAP as s}from"../../internal/scale.js";import{useMPColor as c,useMPSize as u}from"../../internal/config.js";const d=/*@__PURE__*/n.createContext({variant:"primary",size:"md",iconPosition:"top",fullWidth:!1}),m={xs:"h-8",sm:"h-10",md:"h-12",lg:"h-14",xl:"h-16"},f={xs:"h-11",sm:"h-13",md:"h-16",lg:"h-18",xl:"h-20"},p={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"},h={xs:"px-3",sm:"px-3.5",md:"px-4",lg:"px-5",xl:"px-6"},b={xs:12,sm:14,md:16,lg:20,xl:24},v={xs:18,sm:20,md:24,lg:24,xl:28};function x(e,t,a,r=""){n.Children.toArray(e).forEach(e=>{if(!n.isValidElement(e))return void(l(e)&&t.push(e));if(e.type===n.Fragment)return void x(e.props.children,t,a,`${r}${String(e.key)}/`);const i=r?n.cloneElement(e,{key:`${r}${String(e.key)}`}):e;e.type===MPTabPanel?a.push(i):t.push(i)})}export const MPTabs=/*@__PURE__*/n.forwardRef(function({variant:i="primary",color:o,size:l,value:m,defaultValue:f,onValueChange:p,iconPosition:h,activateOnFocus:v=!1,loopFocus:y=!0,divider:w=!0,fullWidth:g=!1,className:_,style:j,children:P,"aria-label":k,...M},N){const R=c(o),z=u(l),C=h??("primary"===i?"top":"start"),F=n.useMemo(()=>({variant:i,size:z,iconPosition:C,fullWidth:g}),[i,z,C,g]),$=n.useRef(null),[O,S]=n.useState(null),W=n.useCallback(()=>{const e=$.current;if(!e)return;const t=e.scrollWidth-e.clientWidth,n=Math.abs(e.scrollLeft),a=t-n,r="rtl"===getComputedStyle(e).direction,i=(r?a:n)>1,o=(r?n:a)>1;S(i&&o?"both":i?"left":o?"right":null)},[]);n.useEffect(()=>{const e=$.current;if(W(),!e)return;const t="undefined"==typeof ResizeObserver?null:new ResizeObserver(W),n=()=>{if(t){t.disconnect(),t.observe(e);for(const n of e.children)t.observe(n)}};n();const a="undefined"==typeof MutationObserver?null:new MutationObserver(()=>{n(),W()});return a?.observe(e,{childList:!0}),()=>{t?.disconnect(),a?.disconnect()}},[W]);const E=n.useRef(0);n.useEffect(()=>()=>cancelAnimationFrame(E.current),[]);const T=[],V=[];return x(P,T,V),e(d.Provider,{value:F,children:t(a.Root,{ref:N,value:m,defaultValue:f,onValueChange:e=>p?.(e),"data-mp-size":z,"data-mp-variant":i,className:["mp-tabs flex min-w-0 flex-col",s[z],_??""].filter(Boolean).join(" "),style:{...r(R),"--_mp-tab-inset":`${b[z]}px`,...j},...M,children:[t(a.List,{ref:$,"aria-label":k,activateOnFocus:v,loopFocus:y,"data-mp-overflow":O??void 0,onScroll:()=>{0===E.current&&(E.current=requestAnimationFrame(()=>{E.current=0,W()}))},className:["mp-tabs__list relative flex shrink-0",w?"border-mp-outline-variant border-b":"",g?"w-full":"","overflow-x-auto overflow-y-hidden","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"].filter(Boolean).join(" "),children:[T,e(a.Indicator,{className:["mp-tabs__indicator pointer-events-none absolute bottom-0","bg-(--_mp-accent)","primary"===i?["h-0.75 rounded-t-full","left-[calc(var(--active-tab-left)_+_var(--_mp-tab-inset))]","w-[calc(var(--active-tab-width)_-_2_*_var(--_mp-tab-inset))]"].join(" "):"left-(--active-tab-left) h-0.5 w-(--active-tab-width)","[transition-property:left,width]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" ")})]}),V]})})});export const MPTab=/*@__PURE__*/n.forwardRef(function({value:r,icon:s,disabled:c=!1,className:u,children:b,...x},y){const{variant:w,size:g,iconPosition:_,fullWidth:j}=n.useContext(d),P="top"===_&&l(s);return t(a.Tab,{ref:y,value:r,disabled:c,className:["mp-tabs__tab group relative flex shrink-0 items-center justify-center","box-border appearance-none border-0 bg-transparent font-[inherit] whitespace-nowrap select-none","overflow-hidden outline-none","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",P?`flex-col gap-1 ${f[g]}`:`flex-row ${m[g]}`,P?"":o[g],p[g],h[g],c?"text-mp-on-surface/38 cursor-default":["text-mp-on-surface-variant cursor-pointer","primary"===w?"data-active:text-(--_mp-accent)":"data-active:text-mp-on-surface"].join(" "),"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid",j?"flex-1":"",u??""].filter(Boolean).join(" "),...x,children:[c?null:e(i,{}),l(s)?e("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:v[g],height:v[g]},children:s}):null,l(b)?e("span",{className:"relative truncate",children:b}):null]})});export const MPTabPanel=/*@__PURE__*/n.forwardRef(function({value:t,keepMounted:n=!1,className:r,children:i,...o},l){return e(a.Panel,{ref:l,value:t,keepMounted:n,className:["mp-tabs__panel text-mp-on-surface min-w-0 flex-1","rounded-mp-xs outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-opacity duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-starting-style:opacity-0",r??""].filter(Boolean).join(" "),...o,children:i})});
@@ -43,6 +43,15 @@ export interface MPTextFieldProps extends MPStyleProps, MPControlEventProps<HTML
43
43
  * where a placeholder would be. See `floatingLabel`.
44
44
  */
45
45
  label?: string;
46
+ /**
47
+ * The accessible name, for a field with no visible `label` — a filter box
48
+ * whose purpose the panel around it already shows.
49
+ *
50
+ * A prop of its own because the field passes nothing on that it does not
51
+ * name, and a hyphenated attribute is one TypeScript never checks: written on
52
+ * the component, it used to be accepted without a word and dropped.
53
+ */
54
+ 'aria-label'?: string;
46
55
  /**
47
56
  * Whether the label rests on the field's line while there is nothing to make
48
57
  * room for, and rises into the notch on focus or on the first character.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Field as n}from"@base-ui/react/field";import{MPIcon as r}from"../icon/MPIcon.js";import{MPFieldLabel as a,MPFieldOutline as i,useFloatingLabel as l}from"../../internal/FieldOutline.js";import{MPSupportingText as s}from"../../internal/SupportingText.js";import{VisibilityIcon as d,VisibilityOffIcon as p}from"../../constants/icons.js";import{useMPLocale as u,useMPMessages as c}from"../../internal/locale.js";import{TEXT_FIELD as m}from"../../internal/messages/text-field.js";import{useMPSize as f}from"../../internal/config.js";const x={xs:{padding:"px-2",control:"py-1.5",text:"text-mp-body-medium",icon:16},sm:{padding:"px-3",control:"py-2.5",text:"text-mp-body-medium",icon:18},md:{padding:"px-4",control:"py-4",text:"text-mp-body-large",icon:20},lg:{padding:"px-4",control:"py-5",text:"text-mp-body-large",icon:22},xl:{padding:"px-5",control:"py-6",text:"text-mp-body-large",icon:24}};export const MPTextField=/*@__PURE__*/o.forwardRef(function({value:b,name:g,type:y="text",placeholder:h,autoComplete:v,label:w,floatingLabel:C=!0,onChange:j,onFormReset:k,onSubmit:M,onKeyDown:z,onKeyUp:D,onFocus:F,onBlur:N,onClick:E,onDoubleClick:P,onContextMenu:S,errorMessage:B="",required:K=!1,fullWidth:q=!1,readOnly:L=!1,autoFocus:R=!1,size:U,disabled:I=!1,disableEnterKey:O=!1,rows:T,maxLength:$,startIcon:_,resizable:W=!1,id:A,locale:G,passwordLabels:H,className:J,style:Q},V){const X=f(U),Y=u(G),Z=c(m,Y,H),ee=o.useRef(null),[te,oe]=o.useState(!1),[ne,re]=o.useState(!1),[ae,ie]=o.useState(b),le=o.useId(),se=A??le,de=!!T,pe=B.length>0,ue=x[X],ce=ne?ae:b,{shrunk:me,focusProps:fe}=l({floating:C&&!!w,filled:ce.length>0,pinned:!!_}),xe=o.useCallback(e=>{ee.current=e,"function"==typeof V?V(e):V&&(V.current=e)},[V]),be=e=>{e.preventDefault()};return o.useEffect(()=>{ne||ie(b)},[b,ne]),o.useEffect(()=>{R&&!window.matchMedia("(max-width: 599.95px)").matches&&ee.current?.focus()},[]),t(n.Root,{className:["mp-text-field group relative",q?"w-full":"inline-block","align-top",J??""].filter(Boolean).join(" "),style:Q,disabled:I,invalid:pe,"data-mp-size":X,...fe,children:[t("div",{className:["relative flex w-full items-center gap-2",ue.padding,de?"py-2":""].filter(Boolean).join(" "),children:[e(i,{label:w,required:K,notched:me}),_?e("span",{className:"text-mp-on-surface-variant group-data-disabled:text-mp-on-surface/38 flex shrink-0 items-center",children:_}):null,e(n.Control,{render:de?e("textarea",{rows:T}):e("input",{}),id:se,name:g,type:de?void 0:te?"text":y,required:K,readOnly:L,disabled:I,autoComplete:v,placeholder:me?h:void 0,maxLength:$,value:ce,ref:xe,className:[`${ue.text} text-mp-on-surface w-full min-w-0 flex-1`,"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary",ue.control,de?"py-0":"",de&&W?"resize-y":"resize-none","search"===y?"[&::-webkit-search-cancel-button]:hidden":"","group-data-disabled:text-mp-on-surface/38","placeholder:text-mp-on-surface-variant group-data-disabled:placeholder:text-mp-on-surface/38"].filter(Boolean).join(" "),onChange:e=>{k?.();const t=e.target.value;ne&&ie(t),j?.(t)},onCompositionStart:()=>{re(!0),ie(b)},onCompositionUpdate:e=>{ie(e.target.value)},onCompositionEnd:e=>{re(!1);const t=e.target.value;k?.(),j?.(t),ie(t)},onKeyUp:D,onFocus:F,onBlur:N,onClick:E,onDoubleClick:P,onContextMenu:S,onKeyDown:e=>{if(z?.(e),!e.defaultPrevented&&"Enter"===e.key){if(function(e){const t=e.nativeEvent;return t.isComposing||229===t.keyCode}(e))return;M?.(),(O||M&&!de)&&e.preventDefault()}}}),"password"!==y||de?null:e("button",{type:"button","aria-label":te?Z.hidePassword:Z.showPassword,onClick:()=>oe(e=>!e),onMouseDown:be,onMouseUp:be,disabled:I,className:["text-mp-on-surface-variant -me-1 flex shrink-0 items-center justify-center","cursor-pointer appearance-none border-0 bg-transparent p-1 font-[inherit]","rounded-full","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","hover:text-mp-on-surface focus-visible:text-mp-primary","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),children:e(r,{icon:te?d:p,size:ue.icon})}),w?e(a,{size:X,label:w,required:K,htmlFor:se,shrunk:me,multiline:de}):null]}),e(s,{errorMessage:B,className:`mp-text-field__support mt-1 ${ue.padding}`})]})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Field as n}from"@base-ui/react/field";import{MPIcon as a}from"../icon/MPIcon.js";import{MPFieldLabel as r,MPFieldOutline as i,useFloatingLabel as l}from"../../internal/FieldOutline.js";import{MPSupportingText as s}from"../../internal/SupportingText.js";import{VisibilityIcon as d,VisibilityOffIcon as p}from"../../constants/icons.js";import{useMPLocale as u,useMPMessages as c}from"../../internal/locale.js";import{TEXT_FIELD as m}from"../../internal/messages/text-field.js";import{useMPSize as f}from"../../internal/config.js";const x={xs:{padding:"px-2",control:"py-1.5",text:"text-mp-body-medium",icon:16},sm:{padding:"px-3",control:"py-2.5",text:"text-mp-body-medium",icon:18},md:{padding:"px-4",control:"py-4",text:"text-mp-body-large",icon:20},lg:{padding:"px-4",control:"py-5",text:"text-mp-body-large",icon:22},xl:{padding:"px-5",control:"py-6",text:"text-mp-body-large",icon:24}};export const MPTextField=/*@__PURE__*/o.forwardRef(function({value:b,name:g,type:y="text",placeholder:h,autoComplete:v,label:w,"aria-label":C,floatingLabel:j=!0,onChange:k,onFormReset:M,onSubmit:z,onKeyDown:D,onKeyUp:N,onFocus:E,onBlur:F,onClick:P,onDoubleClick:S,onContextMenu:B,errorMessage:K="",required:q=!1,fullWidth:L=!1,readOnly:R=!1,autoFocus:U=!1,size:I,disabled:O=!1,disableEnterKey:T=!1,rows:$,maxLength:_,startIcon:W,resizable:A=!1,id:G,locale:H,passwordLabels:J,className:Q,style:V},X){const Y=f(I),Z=u(H),ee=c(m,Z,J),te=o.useRef(null),[oe,ne]=o.useState(!1),[ae,re]=o.useState(!1),[ie,le]=o.useState(b),se=o.useId(),de=G??se,pe=!!$,ue=K.length>0,ce=x[Y],me=ae?ie:b,{shrunk:fe,focusProps:xe}=l({floating:j&&!!w,filled:me.length>0,pinned:!!W}),be=o.useCallback(e=>{te.current=e,"function"==typeof X?X(e):X&&(X.current=e)},[X]),ge=e=>{e.preventDefault()};return o.useEffect(()=>{ae||le(b)},[b,ae]),o.useEffect(()=>{U&&!window.matchMedia("(max-width: 599.95px)").matches&&te.current?.focus()},[]),t(n.Root,{className:["mp-text-field group relative",L?"w-full":"inline-block","align-top",Q??""].filter(Boolean).join(" "),style:V,disabled:O,invalid:ue,"data-mp-size":Y,...xe,children:[t("div",{className:["relative flex w-full items-center gap-2",ce.padding,pe?"py-2":""].filter(Boolean).join(" "),children:[e(i,{label:w,required:q,notched:fe}),W?e("span",{className:"text-mp-on-surface-variant group-data-disabled:text-mp-on-surface/38 flex shrink-0 items-center",children:W}):null,e(n.Control,{render:pe?e("textarea",{rows:$}):e("input",{}),id:de,name:g,"aria-label":C,type:pe?void 0:oe?"text":y,required:q,readOnly:R,disabled:O,autoComplete:v,placeholder:fe?h:void 0,maxLength:_,value:me,ref:be,className:[`${ce.text} text-mp-on-surface w-full min-w-0 flex-1`,"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary",ce.control,pe?"py-0":"",pe&&A?"resize-y":"resize-none","search"===y?"[&::-webkit-search-cancel-button]:hidden":"","group-data-disabled:text-mp-on-surface/38","placeholder:text-mp-on-surface-variant group-data-disabled:placeholder:text-mp-on-surface/38"].filter(Boolean).join(" "),onChange:e=>{M?.();const t=e.target.value;ae&&le(t),k?.(t)},onCompositionStart:()=>{re(!0),le(b)},onCompositionUpdate:e=>{le(e.target.value)},onCompositionEnd:e=>{re(!1);const t=e.target.value;M?.(),k?.(t),le(t)},onKeyUp:N,onFocus:E,onBlur:F,onClick:P,onDoubleClick:S,onContextMenu:B,onKeyDown:e=>{if(D?.(e),!e.defaultPrevented&&"Enter"===e.key){if(function(e){const t=e.nativeEvent;return t.isComposing||229===t.keyCode}(e))return;z?.(),(T||z&&!pe)&&e.preventDefault()}}}),"password"!==y||pe?null:e("button",{type:"button","aria-label":oe?ee.hidePassword:ee.showPassword,onClick:()=>ne(e=>!e),onMouseDown:ge,onMouseUp:ge,disabled:O,className:["text-mp-on-surface-variant -me-1 flex shrink-0 items-center justify-center","cursor-pointer appearance-none border-0 bg-transparent p-1 font-[inherit]","rounded-full","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","hover:text-mp-on-surface focus-visible:text-mp-primary","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),children:e(a,{icon:oe?d:p,size:ce.icon})}),w?e(r,{size:Y,label:w,required:q,shrunk:fe,multiline:pe}):null]}),e(s,{errorMessage:K,className:`mp-text-field__support mt-1 ${ce.padding}`})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{MPButton as l}from"../button/MPButton.js";import{MPIcon as r}from"../icon/MPIcon.js";import{ClockIcon as t}from"../../constants/icons.js";import{MPTimeGrid as i}from"../../internal/Calendar.js";import{FOOTER_SIZE as a,MPPickerFooter as s,MPPickerShell as c,useDisplaySamples as u}from"../../internal/Picker.js";import{useMPLocale as m,useMPMessages as d}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,isHour12 as g,isValidDate as j,secondsOfDay as S,timeUnitSpan as b,toISOTime as v,withPlaceholder as C,withTime as x}from"../../internal/date.js";import{useMPColor as k,useMPSize as w}from"../../internal/config.js";export const MPTimePicker=/*@__PURE__*/n.forwardRef(function({value:z,defaultValue:D,onValueChange:O,open:P,defaultOpen:T,onOpenChange:y,referenceDate:M,minTime:I,maxTime:V,shouldDisableTime:B,hour12:N,showSeconds:R=!1,hourStep:F=1,minuteStep:H=1,secondStep:q=1,locale:A,format:E,placeholder:G,clearable:J=!1,showNowButton:K=!0,closeOnSelect:L=!1,labels:Q,name:U,size:W,color:X,readOnly:Y=!1,disabled:Z=!1,startIcon:$,..._},ee){const oe=w(W),ne=k(X),le=m(A),re=d(p,le,Q),te=N??g(le),[ie,ae]=n.useState(D??null),se=void 0!==z?z:ie,[ce,ue]=n.useState(T??!1),me=P??ce,[de]=n.useState(()=>M??new Date),pe=e=>{e&&(Y||Z)||(void 0===P&&ue(e),y?.(e))},fe=e=>{void 0===z&&ae(e),O?.(e)},he=n.useCallback((e,o)=>{const[n,l]=b(o,e);return!!(j(I)&&l<S(I))||(!!(j(V)&&n>S(V))||(B?.(e,o)??!1))},[I,V,B]),ge=E??{hour:"numeric",minute:"2-digit",hour12:te,...R?{second:"2-digit"}:{}},je=new Date,Se=x(M??de,{hours:je.getHours(),minutes:je.getMinutes(),seconds:R?je.getSeconds():0}),be=K||J||!L,ve=C(u(le,ge),G);return e(c,{..._,slug:"time-picker",size:oe,color:ne,readOnly:Y,disabled:Z,triggerRef:ee,startIcon:void 0===$?e(r,{icon:t,size:f[oe]}):$,display:j(se)?h(se,le,ge):G??"",samples:ve,empty:!j(se),clearable:J,onClear:()=>fe(null),open:me,onOpenChange:pe,labels:re,hiddenValues:U?[{name:U,value:j(se)?v(se,R):""}]:void 0,children:o("div",{className:"flex flex-col "+(be?"gap-1.5":""),children:[e(i,{size:oe,locale:le,value:j(se)?se:null,referenceDate:M??de,onChange:e=>{fe(e),L&&pe(!1)},hour12:te,showSeconds:R,hourStep:F,minuteStep:H,secondStep:q,shouldDisableTime:he,labels:re,autoFocus:!0}),be?o(s,{children:[J?e(l,{variant:"text",size:a[oe],color:ne,onClick:()=>{fe(null),pe(!1)},children:re.clear}):null,K?e(l,{variant:"text",size:a[oe],color:ne,disabled:he(Se,"second"),onClick:()=>{fe(Se),pe(!1)},children:re.now}):null,L?null:e(l,{variant:"filled",size:a[oe],color:ne,onClick:()=>pe(!1),children:re.done})]}):null]})})});
2
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import*as n from"react";import{MPButton as l}from"../button/MPButton.js";import{MPIcon as r}from"../icon/MPIcon.js";import{ClockIcon as t}from"../../constants/icons.js";import{MPTimeGrid as a}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 u,useMPMessages as d}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,isHour12 as g,isValidDate as j,secondsOfDay as S,timeUnitSpan as b,toISOTime as v,withPlaceholder as C,withTime as x}from"../../internal/date.js";import{useMPColor as k,useMPSize as w}from"../../internal/config.js";export const MPTimePicker=/*@__PURE__*/n.forwardRef(function({value:z,defaultValue:D,onValueChange:O,open:P,defaultOpen:T,onOpenChange:y,referenceDate:M,minTime:V,maxTime:I,shouldDisableTime:B,hour12:N,showSeconds:R=!1,hourStep:F=1,minuteStep:H=1,secondStep:q=1,locale:A,format:E,placeholder:G,clearable:J=!1,showNowButton:K=!0,closeOnSelect:L=!1,labels:Q,name:U,size:W,color:X,readOnly:Y=!1,disabled:Z=!1,startIcon:$,..._},ee){const oe=w(W),ne=k(X),le=u(A),re=d(p,le,Q),te=N??g(le),[ae,ie]=n.useState(D??null),se=void 0!==z?z:ae,[ce,me]=n.useState(T??!1),ue=P??ce,[de]=n.useState(()=>M??new Date),pe=e=>{e&&(Y||Z)||(void 0===P&&me(e),y?.(e))},fe=e=>{void 0===z&&ie(e),O?.(e)},he=n.useCallback((e,o)=>{const[n,l]=b(o,e);return!!(j(V)&&l<S(V))||(!!(j(I)&&n>S(I))||(B?.(e,o)??!1))},[V,I,B]),ge=E??{hour:"numeric",minute:"2-digit",hour12:te,...R?{second:"2-digit"}:{}},je=new Date,Se=x(M??de,{hours:je.getHours(),minutes:je.getMinutes(),seconds:R?je.getSeconds():0}),be=K||J||!L,ve=C(m(le,ge),G),Ce=j(se)?v(se,R):"";return e(c,{..._,slug:"time-picker",size:oe,color:ne,name:U,locale:le,readOnly:Y,disabled:Z,triggerRef:ee,startIcon:void 0===$?e(r,{icon:t,size:f[oe]}):$,display:j(se)?h(se,le,ge):G??"",samples:ve,empty:!j(se),clearable:J,onClear:()=>fe(null),open:ue,onOpenChange:pe,labels:re,formValue:Ce,hiddenValues:U?[{name:U,value:Ce}]:void 0,children:o("div",{className:"flex flex-col "+(be?"gap-1.5":""),children:[e(a,{size:oe,locale:le,value:j(se)?se:null,referenceDate:M??de,onChange:e=>{fe(e),L&&pe(!1)},hour12:te,showSeconds:R,hourStep:F,minuteStep:H,secondStep:q,shouldDisableTime:he,labels:re,autoFocus:!0}),be?o(s,{children:[J?e(l,{variant:"text",size:i[oe],color:ne,onClick:()=>{fe(null),pe(!1)},children:re.clear}):null,K?e(l,{variant:"text",size:i[oe],color:ne,disabled:he(Se,"second"),onClick:()=>{fe(Se),pe(!1)},children:re.now}):null,L?null:e(l,{variant:"filled",size:i[oe],color:ne,onClick:()=>pe(!1),children:re.done})]}):null]})})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as a,jsxs as e}from"react/jsx-runtime";import*as t from"react";import{CartesianFrame as r}from"../../internal/ChartFrame.js";import{ChartTable as n}from"../../internal/ChartChrome.js";import{useMPLocale as o,useMPMessages as l}from"../../internal/locale.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as i}from"../../internal/messages/table.js";import{formatTimeTick as m,timeScale as p}from"../../internal/time-scale.js";import{BAR_RADIUS as c,CHART_FONT_SIZE as u,MARK_GAP as f,barPath as x,seriesColor as d,textWidth as h,toNumber as b}from"../../internal/chart.js";function g(a,e,t){return null!=a&&!1!==a&&""!==a&&("string"!=typeof a&&"number"!=typeof a||e>=h(String(a),t)+16)}export function MPTimelineChart({series:h,yAxis:y,xAxis:M,spanLabels:j=!0,...k}){const v=o(k.locale),$=l(s,v),C=l(i,v),P=t.useMemo(()=>h.map(a=>a.data.map(a=>{const e=b(a.start),t=b(a.end);return null===e||null===t?null:{from:Math.min(e,t),to:Math.max(e,t),span:a}}).filter(a=>null!==a)),[h]),S=P.flat(),A=S.length>0?{min:Math.min(...S.map(a=>a.from)),max:Math.max(...S.map(a=>a.to))}:null,_=p(A,{min:M?.min,max:M?.max,tickCount:M?.tickCount}),z=t.useCallback(a=>m(a,_.unit,v),[_.unit,v]),F=t.useMemo(()=>[{data:h.map(()=>0)}],[h]),N=h.map((a,e)=>a.name??String(e+1)),T=h.map((a,e)=>d(e,a.color));return a(r,{...k,series:F,categories:N,horizontal:!0,inset:!1,bandRatio:.62,scale:_,includeZero:!1,legend:!1,xAxis:y,yAxis:{...M,tickFormat:M?.tickFormat??(a=>z(Number(a)))},marks:({plot:a,band:e,valuePx:t,categoryPx:r})=>P.flatMap((n,o)=>n.map((n,l)=>{const s=t(n.from),i=t(n.to),m=a.top+r(o);return{series:o,index:l,x:(s+i)/2,y:m,r:e.band/2,rx:Math.max(1,Math.abs(i-s)/2),ry:e.band/2}})),markTooltip:a=>{const e=P[a.series]?.[a.index];return e?{heading:void 0===e.span.label||null===e.span.label?N[a.series]:`${N[a.series]} · ${String(e.span.label)}`,items:[{seriesIndex:a.series,color:e.span.color?d(0,e.span.color):T[a.series],value:e.to-e.from,formatted:`${z(e.from)} – ${z(e.to)}`}]}:null},table:e=>a(n,{id:e,caption:k.label??$.table,corner:y?.label??$.category,categories:N,names:[$.table],values:[P.map(a=>({value:a.length,label:a.map(a=>`${z(a.from)} – ${z(a.to)}`).join("; ")}))],format:a=>String(a),locale:v,empty:C.empty}),children:({plot:t,band:r,valuePx:n,categoryPx:o,activeMark:l,size:s})=>{const i=u[s]-1;return a("g",{className:"mp-timeline-chart__spans",children:P.map((s,m)=>s.map((s,p)=>{const u=n(s.from),h=n(s.to),b=Math.max(2,r.band-f),y=t.top+o(m)-b/2,M=Math.max(1,h-u),k=l?.series===m&&l?.index===p,v=s.span.color?d(0,s.span.color):T[m];return e("g",{children:[a("path",{d:x(u,y,M,b,c,"both"),fill:v,opacity:k?1:.85,stroke:k?"var(--_mp-color-on-surface)":"none",strokeWidth:k?1.5:0}),j&&g(s.span.label,M,i)?a("text",{x:u+8,y:t.top+o(m),dominantBaseline:"central",fill:"var(--_mp-color-surface)",fontSize:i,children:s.span.label}):null]},`${m}-${p}`)}))})}})}
2
+ import{jsx as a,jsxs as e}from"react/jsx-runtime";import*as t from"react";import{CartesianFrame as r}from"../../internal/ChartFrame.js";import{ChartTable as n}from"../../internal/ChartChrome.js";import{useMPLocale as o,useMPMessages as l}from"../../internal/locale.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as i}from"../../internal/messages/table.js";import{formatTimeTick as m,timeScale as p}from"../../internal/time-scale.js";import{BAR_RADIUS as c,CHART_FONT_SIZE as u,MARK_GAP as f,barPath as x,bounds as d,seriesColor as b,textWidth as h,toNumber as g}from"../../internal/chart.js";function y(a,e,t){return null!=a&&!1!==a&&""!==a&&("string"!=typeof a&&"number"!=typeof a||e>=h(String(a),t)+16)}export function MPTimelineChart({series:h,yAxis:j,xAxis:M,spanLabels:k=!0,...v}){const $=o(v.locale),C=l(s,$),P=l(i,$),S=t.useMemo(()=>h.map(a=>a.data.map(a=>{const e=g(a.start),t=g(a.end);return null===e||null===t?null:{from:Math.min(e,t),to:Math.max(e,t),span:a}}).filter(a=>null!==a)),[h]),A=S.flat(),_=d(A.map(a=>a.from)),z=d(A.map(a=>a.to)),F=_&&z?{min:_.min,max:z.max}:null,N=p(F,{min:M?.min,max:M?.max,tickCount:M?.tickCount}),T=t.useCallback(a=>m(a,N.unit,$),[N.unit,$]),B=t.useMemo(()=>[{data:h.map(()=>0)}],[h]),I=h.map((a,e)=>a.name??String(e+1)),L=h.map((a,e)=>b(e,a.color));return a(r,{...v,series:B,categories:I,horizontal:!0,inset:!1,bandRatio:.62,scale:N,includeZero:!1,legend:!1,xAxis:j,yAxis:{...M,tickFormat:M?.tickFormat??(a=>T(Number(a)))},marks:({plot:a,band:e,valuePx:t,categoryPx:r})=>S.flatMap((n,o)=>n.map((n,l)=>{const s=t(n.from),i=t(n.to),m=a.top+r(o);return{series:o,index:l,x:(s+i)/2,y:m,r:e.band/2,rx:Math.max(1,Math.abs(i-s)/2),ry:e.band/2}})),markTooltip:a=>{const e=S[a.series]?.[a.index];return e?{heading:void 0===e.span.label||null===e.span.label?I[a.series]:`${I[a.series]} · ${String(e.span.label)}`,items:[{seriesIndex:a.series,color:e.span.color?b(0,e.span.color):L[a.series],value:e.to-e.from,formatted:`${T(e.from)} – ${T(e.to)}`}]}:null},table:e=>a(n,{id:e,caption:v.label??C.table,corner:j?.label??C.category,categories:I,names:[C.table],values:[S.map(a=>({value:a.length,label:a.map(a=>`${T(a.from)} – ${T(a.to)}`).join("; ")}))],format:a=>String(a),locale:$,empty:P.empty}),children:({plot:t,band:r,valuePx:n,categoryPx:o,activeMark:l,size:s})=>{const i=u[s]-1;return a("g",{className:"mp-timeline-chart__spans",children:S.map((s,m)=>s.map((s,p)=>{const u=n(s.from),d=n(s.to),h=Math.max(2,r.band-f),g=t.top+o(m)-h/2,j=Math.max(1,d-u),M=l?.series===m&&l?.index===p,v=s.span.color?b(0,s.span.color):L[m];return e("g",{children:[a("path",{d:x(u,g,j,h,c,"both"),fill:v,opacity:M?1:.85,stroke:M?"var(--_mp-color-on-surface)":"none",strokeWidth:M?1.5:0}),k&&y(s.span.label,j,i)?a("text",{x:u+8,y:t.top+o(m),dominantBaseline:"central",fill:"var(--_mp-color-surface)",fontSize:i,children:s.span.label}):null]},`${m}-${p}`)}))})}})}
@@ -99,8 +99,8 @@ export interface MPToolbarProps extends React.ComponentPropsWithoutRef<'div'> {
99
99
  *
100
100
  * ## What it is not
101
101
  *
102
- * Not `MPHeader`, which is `MPPageLayout`'s own slot and knows about the
103
- * sidebar, the skip link and the drawer. This is a bar you can put anywhere,
104
- * including inside a card.
102
+ * Not `MPHeader`, which is `MPPageLayout`'s header slot: the layout measures it
103
+ * and keeps the page clear of it. This is a bar you can put anywhere, including
104
+ * inside a card.
105
105
  */
106
106
  export declare const MPToolbar: React.ForwardRefExoticComponent<MPToolbarProps & React.RefAttributes<HTMLDivElement>>;
@@ -55,6 +55,12 @@ export interface MPTooltipProps {
55
55
  */
56
56
  disabled?: boolean;
57
57
  /**
58
+ * The plate's padding and type. `sm` and `md` both draw MD3's plain tooltip,
59
+ * 24dp tall with a `body-small` label, and differ only in the arrow.
60
+ *
61
+ * `sm` is this component's own answer, so it does not take the size
62
+ * `MPConfigProvider` sets for the rest of the application: a tooltip at a
63
+ * control's height is a slab. Set it here when a tooltip has to be larger.
58
64
  * @default 'sm'
59
65
  */
60
66
  size?: MPSize;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as o}from"@base-ui/react/popover";import{MPButton as i}from"../button/MPButton.js";import{MPIcon as r}from"../icon/MPIcon.js";import{CloseIcon as s}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{useMPColor as a,useMPSize as c}from"../../internal/config.js";import{fillMessage as m}from"../../internal/i18n.js";import{useMPLocale as u,useMPMessages as p}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{TOUR as f}from"../../internal/messages/tour.js";import{CONTROL_ICON as h,META_TEXT as g,PROSE_TEXT as x,SHEET_GAP as v,SHEET_PAD as j,SHEET_TITLE as b,hasContent as w}from"../../internal/scale.js";import{MPStateLayer as N}from"../../internal/StateLayer.js";import{FADE as y,PORTAL_LAYER as S}from"../../internal/surface.js";import{VISUALLY_HIDDEN as k}from"../../internal/visually-hidden.js";const _={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-md"},B={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function z({spot:t,className:n}){return e("div",null===t?{"aria-hidden":"true",className:["mp-tour__scrim bg-mp-scrim/32 pointer-events-none fixed inset-0 z-40",n??""].filter(Boolean).join(" ")}:{"aria-hidden":"true",className:["mp-tour__scrim rounded-mp-xs pointer-events-none fixed z-40","shadow-[0_0_0_9999px_color-mix(in_oklab,var(--_mp-color-scrim)_32%,transparent)]","transition-[top,left,width,height] duration-(--mp-sys-motion-duration-medium1)","ease-mp-standard motion-reduce:transition-none",n??""].filter(Boolean).join(" "),style:{top:t.top,left:t.left,width:t.width,height:t.height}})}export function MPTour({steps:C,open:M,defaultOpen:P=!1,onOpenChange:$,step:O,defaultStep:R=0,onStepChange:q,onFinish:E,scrim:F=!0,skippable:I=!0,dismissible:T=!0,scrollIntoView:A=!0,locale:D,labels:H,size:L,color:V,className:W,style:G,classNames:J}){const K=c(L),Q=a(V),U=u(D),X=p(f,U,H),Y=p(d,U),[Z,ee]=n.useState(P),[te,ne]=n.useState(R),oe=M??Z,ie=Math.min(O??te,Math.max(0,C.length-1)),re=C[ie],[se,le]=n.useState(null),[ae,ce]=n.useState(""),me=n.useRef(ie);n.useEffect(()=>{if(!oe)return me.current=ie,void ce("");if(me.current===ie)return;me.current=ie;const e=m(X.position,{index:String(ie+1),total:String(C.length)}),t=C[ie]?.title;ce("string"==typeof t&&""!==t?`${e}. ${t}`:e)},[oe,ie,C,X.position]);const ue=e=>{void 0===M&&ee(e),$?.(e)},pe=e=>{void 0===O&&ne(e),q?.(e)},de=re?.target,fe=re?.padding??6;if(n.useEffect(()=>{if(!oe||!de)return;const e=document.querySelector(de);if(!(e instanceof HTMLElement))return;A&&e.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});let t=0,n="";const o=()=>{const i=e.getBoundingClientRect(),r=`${i.top} ${i.left} ${i.width} ${i.height}`;r!==n&&(n=r,le({selector:de,spot:{top:i.top-fe,left:i.left-fe,width:i.width+2*fe,height:i.height+2*fe}})),t=requestAnimationFrame(o)};return o(),()=>cancelAnimationFrame(t)},[oe,de,fe,A]),0===C.length)return null;const he=oe&&de&&se?.selector===de?se.spot:null,ge=0===ie,xe=ie===C.length-1,ve=B[K],je=w(re?.title)||w(re?.content);return t(o.Root,{open:oe,onOpenChange:(e,t)=>{e?ue(!0):"outside-press"===t.reason||"focus-out"===t.reason||"escape-key"===t.reason&&!T?t.cancel():ue(!1)},children:[oe&&F?e(z,{spot:he,className:J?.scrim}):null,e(o.Portal,{children:e(o.Positioner,{className:S,side:re?.side??"bottom",align:re?.align??"center",sideOffset:de?10:0,collisionPadding:12,anchor:()=>de?document.querySelector(de):{getBoundingClientRect:()=>new DOMRect(window.innerWidth/2,window.innerHeight/2,0,0)},children:t(o.Popup,{"data-mp-size":K,className:["mp-tour rounded-mp-md relative box-border flex flex-col outline-none","bg-mp-surface-container text-mp-on-surface shadow-mp-3",j[K],v[K],x[K],_[K],y,W??""].filter(Boolean).join(" "),style:{...l(Q),...G},children:[je?t("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[w(re?.title)?e(o.Title,{className:["text-mp-on-surface m-0 font-medium",b[K],J?.title??""].filter(Boolean).join(" "),children:re?.title}):null,w(re?.content)?e(o.Description,{className:["text-mp-on-surface-variant m-0 min-w-0",J?.content??""].filter(Boolean).join(" "),children:re?.content}):null]}),T?t("button",{type:"button","aria-label":Y.close,onClick:()=>ue(!1),className:["group/close rounded-mp-full text-mp-on-surface-variant relative -me-1 -mt-1","flex size-8 shrink-0 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none",J?.close??""].filter(Boolean).join(" "),children:[e(N,{className:"group-hover/close:opacity-8 group-focus-visible/close:opacity-10"}),e(r,{icon:s,size:h[K]})]}):null]}):null,e("span",{className:k,"aria-live":"polite",children:ae}),t("div",{className:["flex items-center gap-2",J?.footer??""].filter(Boolean).join(" "),children:[e("span",{className:`text-mp-on-surface-variant shrink-0 tabular-nums ${g}`,children:m(X.position,{index:String(ie+1),total:String(C.length)})}),t("div",{className:"ms-auto flex items-center gap-1",children:[I&&!xe?e(i,{size:ve,variant:"text",color:"secondary",onClick:()=>ue(!1),children:X.skip}):null,ge?null:e(i,{size:ve,variant:"outlined",color:Q,onClick:()=>pe(ie-1),children:X.previous}),e(i,{size:ve,color:Q,onClick:()=>xe?(E?.(),void ue(!1)):pe(ie+1),children:xe?X.done:X.next})]})]})]})})})]})}
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Popover as o}from"@base-ui/react/popover";import{MPButton as i}from"../button/MPButton.js";import{MPIcon as r}from"../icon/MPIcon.js";import{CloseIcon as s}from"../../constants/icons.js";import{accentSlots as l}from"../../internal/accent.js";import{useMPColor as a,useMPSize as c}from"../../internal/config.js";import{fillMessage as m}from"../../internal/i18n.js";import{useMPLocale as p,useMPMessages as u}from"../../internal/locale.js";import{COMMON as d}from"../../internal/messages/common.js";import{TOUR as f}from"../../internal/messages/tour.js";import{CONTROL_ICON as h,META_TEXT as g,PROSE_TEXT as x,SHEET_GAP as v,SHEET_PAD as j,SHEET_TITLE as w,hasContent as b}from"../../internal/scale.js";import{MPStateLayer as y}from"../../internal/StateLayer.js";import{FADE as N,PORTAL_LAYER as S}from"../../internal/surface.js";import{VISUALLY_HIDDEN as k}from"../../internal/visually-hidden.js";const $={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-md"},_={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};function B({spot:t,className:n,holeRef:o}){return e("div",null===t?{"aria-hidden":"true",className:["mp-tour__scrim bg-mp-scrim/32 pointer-events-none fixed inset-0 z-40",n??""].filter(Boolean).join(" ")}:{ref:o,"aria-hidden":"true",className:["mp-tour__scrim rounded-mp-xs pointer-events-none fixed z-40","shadow-[0_0_0_9999px_color-mix(in_oklab,var(--_mp-color-scrim)_32%,transparent)]","transition-[top,left,width,height] duration-(--mp-sys-motion-duration-medium1)","ease-mp-standard motion-reduce:transition-none",n??""].filter(Boolean).join(" "),style:{top:t.top,left:t.left,width:t.width,height:t.height}})}export function MPTour({steps:z,open:C,defaultOpen:R=!1,onOpenChange:M,step:P,defaultStep:O=0,onStepChange:q,onFinish:E,scrim:F=!0,skippable:I=!0,dismissible:T=!0,scrollIntoView:A=!0,locale:D,labels:H,size:L,color:V,className:W,style:G,classNames:J}){const K=c(L),Q=a(V),U=p(D),X=u(f,U,H),Y=u(d,U),[Z,ee]=n.useState(R),[te,ne]=n.useState(O),oe=C??Z,ie=Math.min(P??te,Math.max(0,z.length-1)),re=z[ie],[se,le]=n.useState(null),ae=n.useRef(null),[ce,me]=n.useState(""),pe=n.useRef(ie);n.useEffect(()=>{if(!oe)return pe.current=ie,void me("");if(pe.current===ie)return;pe.current=ie;const e=m(X.position,{index:String(ie+1),total:String(z.length)}),t=z[ie]?.title;me("string"==typeof t&&""!==t?`${e}. ${t}`:e)},[oe,ie,z,X.position]);const ue=e=>{void 0===C&&ee(e),M?.(e)},de=e=>{void 0===P&&ne(e),q?.(e)},fe=re?.target,he=re?.padding??6;if(n.useEffect(()=>{if(!oe||!fe)return;const e=document.querySelector(fe);if(!(e instanceof HTMLElement))return;A&&e.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});let t=0,n="",o=!1;const i=()=>{const r=e.getBoundingClientRect(),s=`${r.top} ${r.left} ${r.width} ${r.height}`;if(s!==n){n=s;const e={top:r.top-he,left:r.left-he,width:r.width+2*he,height:r.height+2*he},t=ae.current;o&&t?(t.style.top=`${e.top}px`,t.style.left=`${e.left}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`):(o=!0,le({selector:fe,spot:e}))}t=requestAnimationFrame(i)};return i(),()=>cancelAnimationFrame(t)},[oe,fe,he,A]),0===z.length)return null;const ge=oe&&fe&&se?.selector===fe?se.spot:null,xe=0===ie,ve=ie===z.length-1,je=_[K],we=b(re?.title)||b(re?.content);return t(o.Root,{open:oe,onOpenChange:(e,t)=>{e?ue(!0):"outside-press"===t.reason||"focus-out"===t.reason||"escape-key"===t.reason&&!T?t.cancel():ue(!1)},children:[oe&&F?e(B,{spot:ge,className:J?.scrim,holeRef:ae}):null,e(o.Portal,{children:e(o.Positioner,{className:S,side:re?.side??"bottom",align:re?.align??"center",sideOffset:fe?10:0,collisionPadding:12,anchor:()=>fe?document.querySelector(fe):{getBoundingClientRect:()=>new DOMRect(window.innerWidth/2,window.innerHeight/2,0,0)},children:t(o.Popup,{"data-mp-size":K,className:["mp-tour rounded-mp-md relative box-border flex flex-col outline-none","bg-mp-surface-container text-mp-on-surface shadow-mp-3",j[K],v[K],x[K],$[K],N,W??""].filter(Boolean).join(" "),style:{...l(Q),...G},children:[we?t("div",{className:"flex items-start gap-3",children:[t("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[b(re?.title)?e(o.Title,{className:["text-mp-on-surface m-0 font-medium",w[K],J?.title??""].filter(Boolean).join(" "),children:re?.title}):null,b(re?.content)?e(o.Description,{className:["text-mp-on-surface-variant m-0 min-w-0",J?.content??""].filter(Boolean).join(" "),children:re?.content}):null]}),T?t("button",{type:"button","aria-label":Y.close,onClick:()=>ue(!1),className:["group/close rounded-mp-full text-mp-on-surface-variant relative -me-1 -mt-1","flex size-8 shrink-0 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none",J?.close??""].filter(Boolean).join(" "),children:[e(y,{className:"group-hover/close:opacity-8 group-focus-visible/close:opacity-10"}),e(r,{icon:s,size:h[K]})]}):null]}):null,e("span",{className:k,"aria-live":"polite",children:ce}),t("div",{className:["flex items-center gap-2",J?.footer??""].filter(Boolean).join(" "),children:[e("span",{className:`text-mp-on-surface-variant shrink-0 tabular-nums ${g}`,children:m(X.position,{index:String(ie+1),total:String(z.length)})}),t("div",{className:"ms-auto flex items-center gap-1",children:[I&&!ve?e(i,{size:je,variant:"text",color:"secondary",onClick:()=>ue(!1),children:X.skip}):null,xe?null:e(i,{size:je,variant:"outlined",color:Q,onClick:()=>de(ie-1),children:X.previous}),e(i,{size:je,color:Q,onClick:()=>ve?(E?.(),void ue(!1)):de(ie+1),children:ve?X.done:X.next})]})]})]})})})]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{MPBox as l}from"../box/MPBox.js";import{MPCheckbox as r}from"../checkbox/MPCheckbox.js";import{MPIcon as s}from"../icon/MPIcon.js";import{MPIconButton as i}from"../icon-button/MPIconButton.js";import{MPTextField as n}from"../text-field/MPTextField.js";import{ArrowRightIcon as o}from"../../constants/icons.js";import{useMPLocale as c,useMPMessages as m}from"../../internal/locale.js";import{cssLength as d}from"../../internal/length.js";import{TRANSFER as u}from"../../internal/messages/transfer.js";import{fillMessage as h}from"../../internal/i18n.js";import{VISUALLY_HIDDEN as f}from"../../internal/visually-hidden.js";import{useMPColor as p,useMPSize as v}from"../../internal/config.js";import{hasContent as g,META_TEXT as b,SHEET_PAD_X as x}from"../../internal/scale.js";const w={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},k={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"},S=new Set;function j({title:s,rows:i,total:o,ticked:c,arrived:m,onTick:d,onTickAll:u,search:h,onSearch:f,searchable:p,disabled:v,height:g,messages:S,variant:j,size:y,color:N}){const T=i.filter(e=>!e.disabled),z=T.filter(e=>c.has(e.value)),C=T.length>0&&z.length===T.length,$=z.length>0&&!C,_=x[y],M=t.useId();return a(l,{variant:j,size:y,padded:!1,className:"mp-transfer__panel flex min-w-0 flex-col overflow-hidden",children:[a("div",{className:["mp-transfer__heading border-mp-outline-variant flex items-center gap-2 border-b",_,w[y]].join(" "),children:[e("div",{className:"min-w-0 flex-1",children:e(r,{size:y,color:N,checked:C,indeterminate:$,disabled:v||0===T.length,label:e("span",{id:M,className:"block truncate font-medium",children:s}),onCheckedChange:e=>u(e)})}),a("span",{className:`text-mp-on-surface-variant shrink-0 tabular-nums ${b}`,children:[z.length,"/",o]})]}),p?e("div",{className:`${_} ${w[y]}`,children:e(n,{size:y,fullWidth:!0,disabled:v,placeholder:S.search,"aria-label":S.search,value:h,onChange:f})}):null,e("div",{role:"group","aria-labelledby":M,className:`mp-transfer__list flex flex-col overflow-y-auto overscroll-contain ${_} ${w[y]}`,style:{height:g},children:0===i.length?e("span",{className:`text-mp-on-surface-variant ${b} ${k[y]}`,children:S.empty}):i.map((a,t)=>e("div",{className:[k[y],m.has(a.value)?"mp-row-arrive":""].filter(Boolean).join(" "),children:e(r,{size:y,color:N,label:a.label,checked:c.has(a.value),disabled:v||a.disabled,onCheckedChange:e=>d(a.value,e)})},`${t}:${a.value}`))})]})}function y(e,a){if(""===a)return e;const t=a.toLowerCase();return e.filter(e=>"string"!=typeof e.label||e.label.toLowerCase().includes(t))}export const MPTransfer=/*@__PURE__*/t.forwardRef(function({items:l,value:r,defaultValue:n,onValueChange:b,sourceLabel:x,targetLabel:w,searchable:k=!1,height:N=220,disabled:T=!1,variant:z="outlined",size:C,color:$,locale:_,labels:M,className:P,...B},L){const A=v(C),I=p($),V=c(_),E=m(u,V,M),[F,R]=t.useState(n??[]),W=r??F,[q,D]=t.useState(()=>new Set),[G,H]=t.useState(()=>({values:new Set,toTarget:!0})),[J,K]=t.useState(""),[O,Q]=t.useState(""),[U,X]=t.useState(null),Y=t.useMemo(()=>new Set(W),[W]),Z=l.filter(e=>!Y.has(e.value)),ee=l.filter(e=>Y.has(e.value));t.useEffect(()=>{const e=new Set(l.map(e=>e.value));D(a=>{const t=[...a].filter(a=>e.has(a));return t.length===a.size?a:new Set(t)})},[l]);const ae=(e,a)=>{D(t=>{const l=new Set(t);return a?l.add(e):l.delete(e),l})},te=(e,a)=>{D(t=>{const l=new Set(t);for(const t of e)t.disabled||(a?l.add(t.value):l.delete(t.value));return l})},le=(e,a)=>{const t=e.filter(e=>!e.disabled&&q.has(e.value));if(0===t.length)return;const s=new Set(t.map(e=>e.value)),i=a?l.filter(e=>Y.has(e.value)||s.has(e.value)).map(e=>e.value):W.filter(e=>!s.has(e));D(e=>new Set([...e].filter(e=>!s.has(e)))),H({values:s,toTarget:a}),X(e=>{return{tick:(e?.tick??0)+1,text:h(E.moved,{count:String(t.length),list:(l=a?w:x,r=a?E.target:E.source,"string"==typeof l&&""!==l?l:r)})};var l,r}),(e=>{void 0===r&&R(e),b?.(e)})(i)},re=y(Z,J),se=y(ee,O),ie=re.some(e=>!e.disabled&&q.has(e.value)),ne=se.some(e=>!e.disabled&&q.has(e.value)),oe=d(N),ce={ticked:q,disabled:T,height:oe,messages:E,variant:z,size:A,color:I,searchable:k};return a("div",{ref:L,"data-mp-size":A,className:["mp-transfer grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)]","mp-medium:[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",P??""].filter(Boolean).join(" "),...B,children:[e(j,{...ce,title:g(x)?x:E.source,rows:re,total:Z.length,arrived:G.toTarget?S:G.values,onTick:ae,onTickAll:e=>te(re,e),search:J,onSearch:K}),a("div",{className:"flex flex-row justify-center gap-2 mp-medium:flex-col",children:[e(i,{size:A,color:I,variant:"text"===z?"text":"outlined",label:E.toTarget,disabled:T||!ie,onClick:()=>le(re,!0),icon:e(s,{icon:o,className:"rotate-90 mp-medium:rotate-0"})}),e(i,{size:A,color:I,variant:"text"===z?"text":"outlined",label:E.toSource,disabled:T||!ne,onClick:()=>le(se,!1),icon:e(s,{icon:o,className:"-rotate-90 mp-medium:rotate-180"})})]}),e("span",{className:f,"aria-live":"polite","aria-atomic":"true",children:U?e("span",{children:U.text},U.tick):null}),e(j,{...ce,title:g(w)?w:E.target,rows:se,total:ee.length,arrived:G.toTarget?G.values:S,onTick:ae,onTickAll:e=>te(se,e),search:O,onSearch:Q})]})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{MPBox as l}from"../box/MPBox.js";import{MPCheckbox as r}from"../checkbox/MPCheckbox.js";import{MPIcon as s}from"../icon/MPIcon.js";import{MPIconButton as i}from"../icon-button/MPIconButton.js";import{MPTextField as n}from"../text-field/MPTextField.js";import{ArrowRightIcon as o}from"../../constants/icons.js";import{useMPLocale as c,useMPMessages as m}from"../../internal/locale.js";import{cssLength as d}from"../../internal/length.js";import{TRANSFER as u}from"../../internal/messages/transfer.js";import{fillMessage as h}from"../../internal/i18n.js";import{VISUALLY_HIDDEN as f}from"../../internal/visually-hidden.js";import{useMPColor as p,useMPSize as v}from"../../internal/config.js";import{hasContent as g,META_TEXT as b,SHEET_PAD_X as x}from"../../internal/scale.js";import{occurrenceKeys as w}from"../../internal/occurrence.js";const j={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},k={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"},S=new Set;function y({title:s,rows:i,total:o,ticked:c,arrived:m,onTick:d,onTickAll:u,search:h,onSearch:f,searchable:p,disabled:v,height:g,messages:S,variant:y,size:N,color:T}){const z=i.filter(e=>!e.disabled),C=t.useMemo(()=>w(i,e=>e.value),[i]),M=z.filter(e=>c.has(e.value)),_=z.length>0&&M.length===z.length,$=M.length>0&&!_,P=x[N],B=t.useId();return a(l,{variant:y,size:N,padded:!1,className:"mp-transfer__panel flex min-w-0 flex-col overflow-hidden",children:[a("div",{className:["mp-transfer__heading border-mp-outline-variant flex items-center gap-2 border-b",P,j[N]].join(" "),children:[e("div",{className:"min-w-0 flex-1",children:e(r,{size:N,color:T,checked:_,indeterminate:$,disabled:v||0===z.length,label:e("span",{id:B,className:"block truncate font-medium",children:s}),onCheckedChange:e=>u(e)})}),a("span",{className:`text-mp-on-surface-variant shrink-0 tabular-nums ${b}`,children:[M.length,"/",o]})]}),p?e("div",{className:`${P} ${j[N]}`,children:e(n,{size:N,fullWidth:!0,disabled:v,placeholder:S.search,"aria-label":S.search,value:h,onChange:f})}):null,e("div",{role:"group","aria-labelledby":B,className:`mp-transfer__list flex flex-col overflow-y-auto overscroll-contain ${P} ${j[N]}`,style:{height:g},children:0===i.length?e("span",{className:`text-mp-on-surface-variant ${b} ${k[N]}`,children:S.empty}):i.map(a=>e("div",{className:[k[N],m.has(a.value)?"mp-row-arrive":""].filter(Boolean).join(" "),children:e(r,{size:N,color:T,label:a.label,checked:c.has(a.value),disabled:v||a.disabled,onCheckedChange:e=>d(a.value,e)})},C.get(a)))})]})}function N(e,a){if(""===a)return e;const t=a.toLowerCase();return e.filter(e=>"string"!=typeof e.label||e.label.toLowerCase().includes(t))}export const MPTransfer=/*@__PURE__*/t.forwardRef(function({items:l,value:r,defaultValue:n,onValueChange:b,sourceLabel:x,targetLabel:w,searchable:j=!1,height:k=220,disabled:T=!1,variant:z="outlined",size:C,color:M,locale:_,labels:$,className:P,...B},L){const A=v(C),I=p(M),V=c(_),E=m(u,V,$),[F,R]=t.useState(n??[]),W=r??F,[q,D]=t.useState(()=>new Set),[G,H]=t.useState(()=>({values:new Set,toTarget:!0})),[J,K]=t.useState(""),[O,Q]=t.useState(""),[U,X]=t.useState(null),Y=t.useMemo(()=>new Set(W),[W]),Z=l.filter(e=>!Y.has(e.value)),ee=l.filter(e=>Y.has(e.value));t.useEffect(()=>{const e=new Set(l.map(e=>e.value));D(a=>{const t=[...a].filter(a=>e.has(a));return t.length===a.size?a:new Set(t)})},[l]);const ae=(e,a)=>{D(t=>{const l=new Set(t);return a?l.add(e):l.delete(e),l})},te=(e,a)=>{D(t=>{const l=new Set(t);for(const t of e)t.disabled||(a?l.add(t.value):l.delete(t.value));return l})},le=(e,a)=>{const t=e.filter(e=>!e.disabled&&q.has(e.value));if(0===t.length)return;const s=new Set(t.map(e=>e.value)),i=a?l.filter(e=>Y.has(e.value)||s.has(e.value)).map(e=>e.value):W.filter(e=>!s.has(e));D(e=>new Set([...e].filter(e=>!s.has(e)))),H({values:s,toTarget:a}),X(e=>{return{tick:(e?.tick??0)+1,text:h(E.moved,{count:String(t.length),list:(l=a?w:x,r=a?E.target:E.source,"string"==typeof l&&""!==l?l:r)})};var l,r}),(e=>{void 0===r&&R(e),b?.(e)})(i)},re=N(Z,J),se=N(ee,O),ie=re.some(e=>!e.disabled&&q.has(e.value)),ne=se.some(e=>!e.disabled&&q.has(e.value)),oe=d(k),ce={ticked:q,disabled:T,height:oe,messages:E,variant:z,size:A,color:I,searchable:j};return a("div",{ref:L,"data-mp-size":A,className:["mp-transfer grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)]","mp-medium:[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",P??""].filter(Boolean).join(" "),...B,children:[e(y,{...ce,title:g(x)?x:E.source,rows:re,total:Z.length,arrived:G.toTarget?S:G.values,onTick:ae,onTickAll:e=>te(re,e),search:J,onSearch:K}),a("div",{className:"flex flex-row justify-center gap-2 mp-medium:flex-col",children:[e(i,{size:A,color:I,variant:"text"===z?"text":"outlined",label:E.toTarget,disabled:T||!ie,onClick:()=>le(re,!0),icon:e(s,{icon:o,className:"rotate-90 mp-medium:rotate-0"})}),e(i,{size:A,color:I,variant:"text"===z?"text":"outlined",label:E.toSource,disabled:T||!ne,onClick:()=>le(se,!1),icon:e(s,{icon:o,className:"-rotate-90 mp-medium:rotate-180"})})]}),e("span",{className:f,"aria-live":"polite","aria-atomic":"true",children:U?e("span",{children:U.text},U.tick):null}),e(y,{...ce,title:g(w)?w:E.target,rows:se,total:ee.length,arrived:G.toTarget?G.values:S,onTick:ae,onTickAll:e=>te(se,e),search:O,onSearch:Q})]})});
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { type MPTreeViewValue } from '../tree-view/MPTreeView.js';
3
3
  import { type MPPickerShellProps } from '../../internal/Picker.js';
4
4
  import type { MPPickerLabels } from '../../internal/Calendar.js';
5
- import type { MPSlots } from '../../types.js';
5
+ import type { MPColor, MPSlots } from '../../types.js';
6
6
  /** One node of the tree the reader is choosing from. */
7
7
  export interface MPTreeSelectItem {
8
8
  /** What is stored when this node is chosen. Unique across the whole tree. */
@@ -24,7 +24,17 @@ export interface MPTreeSelectItem {
24
24
  }
25
25
  /** The parts an `MPTreeSelect` draws that a `className` cannot reach. */
26
26
  export type MPTreeSelectSlot = 'popup' | 'tree' | 'item' | 'empty';
27
- export interface MPTreeSelectProps extends MPPickerShellProps {
27
+ export interface MPTreeSelectProps extends Omit<MPPickerShellProps, 'color'> {
28
+ /**
29
+ * Has no visible effect, and is kept only so code that passes it still
30
+ * compiles.
31
+ *
32
+ * The pickers share this prop for a calendar's chosen day and a range's band,
33
+ * and a tree has neither. A chosen row is `secondary-container`, as an
34
+ * `MPSelect`'s chosen option is.
35
+ * @deprecated No effect. It is due to be removed in the next major version.
36
+ */
37
+ color?: MPColor;
28
38
  /** The tree, as nested items. */
29
39
  items?: MPTreeSelectItem[];
30
40
  /** The chosen value, or values when `multiple`. */