material-plus-ui 1.8.0 → 1.10.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 (332) hide show
  1. package/README.md +10 -6
  2. package/dist/a2ui/catalog.d.ts +104 -0
  3. package/dist/a2ui/catalog.js +1 -0
  4. package/dist/a2ui/components/MPA2uiAudioPlayer.d.ts +1 -0
  5. package/dist/a2ui/components/MPA2uiAudioPlayer.js +2 -0
  6. package/dist/a2ui/components/MPA2uiButton.d.ts +1 -0
  7. package/dist/a2ui/components/MPA2uiButton.js +2 -0
  8. package/dist/a2ui/components/MPA2uiCard.d.ts +1 -0
  9. package/dist/a2ui/components/MPA2uiCard.js +2 -0
  10. package/dist/a2ui/components/MPA2uiCheckBox.d.ts +1 -0
  11. package/dist/a2ui/components/MPA2uiCheckBox.js +2 -0
  12. package/dist/a2ui/components/MPA2uiChoicePicker.d.ts +1 -0
  13. package/dist/a2ui/components/MPA2uiChoicePicker.js +2 -0
  14. package/dist/a2ui/components/MPA2uiColumn.d.ts +1 -0
  15. package/dist/a2ui/components/MPA2uiColumn.js +2 -0
  16. package/dist/a2ui/components/MPA2uiDateTimeInput.d.ts +1 -0
  17. package/dist/a2ui/components/MPA2uiDateTimeInput.js +2 -0
  18. package/dist/a2ui/components/MPA2uiDivider.d.ts +1 -0
  19. package/dist/a2ui/components/MPA2uiDivider.js +2 -0
  20. package/dist/a2ui/components/MPA2uiIcon.d.ts +1 -0
  21. package/dist/a2ui/components/MPA2uiIcon.js +2 -0
  22. package/dist/a2ui/components/MPA2uiImage.d.ts +1 -0
  23. package/dist/a2ui/components/MPA2uiImage.js +2 -0
  24. package/dist/a2ui/components/MPA2uiList.d.ts +1 -0
  25. package/dist/a2ui/components/MPA2uiList.js +2 -0
  26. package/dist/a2ui/components/MPA2uiModal.d.ts +1 -0
  27. package/dist/a2ui/components/MPA2uiModal.js +2 -0
  28. package/dist/a2ui/components/MPA2uiRow.d.ts +1 -0
  29. package/dist/a2ui/components/MPA2uiRow.js +2 -0
  30. package/dist/a2ui/components/MPA2uiSlider.d.ts +1 -0
  31. package/dist/a2ui/components/MPA2uiSlider.js +2 -0
  32. package/dist/a2ui/components/MPA2uiTabs.d.ts +1 -0
  33. package/dist/a2ui/components/MPA2uiTabs.js +2 -0
  34. package/dist/a2ui/components/MPA2uiText.d.ts +1 -0
  35. package/dist/a2ui/components/MPA2uiText.js +2 -0
  36. package/dist/a2ui/components/MPA2uiTextField.d.ts +1 -0
  37. package/dist/a2ui/components/MPA2uiTextField.js +2 -0
  38. package/dist/a2ui/components/MPA2uiVideo.d.ts +1 -0
  39. package/dist/a2ui/components/MPA2uiVideo.js +2 -0
  40. package/dist/a2ui/extended/MPA2uiBarChart.d.ts +1 -0
  41. package/dist/a2ui/extended/MPA2uiBarChart.js +2 -0
  42. package/dist/a2ui/extended/MPA2uiDataTable.d.ts +1 -0
  43. package/dist/a2ui/extended/MPA2uiDataTable.js +2 -0
  44. package/dist/a2ui/extended/MPA2uiLineChart.d.ts +1 -0
  45. package/dist/a2ui/extended/MPA2uiLineChart.js +2 -0
  46. package/dist/a2ui/extended/MPA2uiPieChart.d.ts +1 -0
  47. package/dist/a2ui/extended/MPA2uiPieChart.js +2 -0
  48. package/dist/a2ui/extended/MPA2uiStatistic.d.ts +1 -0
  49. package/dist/a2ui/extended/MPA2uiStatistic.js +2 -0
  50. package/dist/a2ui/extended/api.d.ts +1436 -0
  51. package/dist/a2ui/extended/api.js +1 -0
  52. package/dist/a2ui/extended/chart.d.ts +26 -0
  53. package/dist/a2ui/extended/chart.js +1 -0
  54. package/dist/a2ui/index.d.ts +103 -0
  55. package/dist/a2ui/index.js +1 -0
  56. package/dist/a2ui/internal/children.d.ts +28 -0
  57. package/dist/a2ui/internal/children.js +1 -0
  58. package/dist/a2ui/internal/common.d.ts +113 -0
  59. package/dist/a2ui/internal/common.js +1 -0
  60. package/dist/a2ui/internal/icons.d.ts +3 -0
  61. package/dist/a2ui/internal/icons.js +1 -0
  62. package/dist/components/accordion/MPAccordion.d.ts +13 -0
  63. package/dist/components/accordion/MPAccordion.js +1 -1
  64. package/dist/components/accordion/index.d.ts +1 -1
  65. package/dist/components/alert/MPAlert.d.ts +1 -1
  66. package/dist/components/animate-counter/MPAnimateCounter.js +1 -1
  67. package/dist/components/animate-grow/MPAnimateGrow.d.ts +1 -1
  68. package/dist/components/animate-headline/MPAnimateHeadline.d.ts +8 -0
  69. package/dist/components/animate-headline/MPAnimateHeadline.js +1 -1
  70. package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
  71. package/dist/components/animate-marquee/MPAnimateMarquee.js +1 -1
  72. package/dist/components/animate-scramble/MPAnimateScramble.d.ts +8 -0
  73. package/dist/components/animate-scramble/MPAnimateScramble.js +1 -1
  74. package/dist/components/animate-slide/MPAnimateSlide.d.ts +1 -1
  75. package/dist/components/animate-split/MPAnimateSplit.d.ts +8 -0
  76. package/dist/components/animate-split/MPAnimateSplit.js +1 -1
  77. package/dist/components/animate-typing/MPAnimateTyping.d.ts +10 -2
  78. package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
  79. package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
  80. package/dist/components/app-logo/MPAppLogo.d.ts +6 -1
  81. package/dist/components/area-chart/MPAreaChart.d.ts +18 -3
  82. package/dist/components/area-chart/MPAreaChart.js +1 -1
  83. package/dist/components/avatar/MPAvatar.d.ts +17 -1
  84. package/dist/components/avatar/MPAvatar.js +1 -1
  85. package/dist/components/bar-chart/MPBarChart.d.ts +15 -5
  86. package/dist/components/bar-chart/MPBarChart.js +1 -1
  87. package/dist/components/blockquote/MPBlockquote.d.ts +1 -1
  88. package/dist/components/box/MPBox.d.ts +1 -1
  89. package/dist/components/breadcrumb/MPBreadcrumb.d.ts +8 -0
  90. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  91. package/dist/components/carousel/MPCarousel.js +1 -1
  92. package/dist/components/checkbox/MPCheckbox.js +1 -1
  93. package/dist/components/chip/MPChip.d.ts +1 -1
  94. package/dist/components/code-block/MPCodeBlock.js +1 -1
  95. package/dist/components/combobox/MPCombobox.js +1 -1
  96. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  97. package/dist/components/config/MPConfigProvider.d.ts +17 -1
  98. package/dist/components/config/MPConfigProvider.js +1 -1
  99. package/dist/components/confirm/MPConfirmProvider.js +1 -1
  100. package/dist/components/data-table/MPDataTable.d.ts +0 -34
  101. package/dist/components/data-table/MPDataTable.js +1 -1
  102. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
  103. package/dist/components/drawer/MPDrawer.d.ts +13 -1
  104. package/dist/components/drawer/MPDrawer.js +1 -1
  105. package/dist/components/empty/MPEmpty.d.ts +1 -1
  106. package/dist/components/file-picker/MPFilePicker.js +1 -1
  107. package/dist/components/form/MPForm.d.ts +3 -0
  108. package/dist/components/form/MPForm.js +1 -1
  109. package/dist/components/gauge-chart/MPGaugeChart.js +1 -1
  110. package/dist/components/header/MPHeader.js +1 -1
  111. package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +12 -3
  112. package/dist/components/heatmap-chart/MPHeatmapChart.js +1 -1
  113. package/dist/components/image/MPImage.d.ts +5 -0
  114. package/dist/components/image/MPImage.js +1 -1
  115. package/dist/components/line-chart/MPLineChart.d.ts +20 -2
  116. package/dist/components/line-chart/MPLineChart.js +1 -1
  117. package/dist/components/locale/MPLocaleProvider.d.ts +15 -30
  118. package/dist/components/locale/MPLocaleProvider.js +1 -1
  119. package/dist/components/menu/MPMenu.d.ts +9 -1
  120. package/dist/components/menu/MPMenu.js +1 -1
  121. package/dist/components/meter/MPMeter.d.ts +5 -0
  122. package/dist/components/meter/MPMeter.js +1 -1
  123. package/dist/components/mockup/MPMockup.js +1 -1
  124. package/dist/components/navigation-menu/MPNavigationMenu.d.ts +27 -1
  125. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  126. package/dist/components/number-field/MPNumberField.d.ts +2 -1
  127. package/dist/components/number-field/MPNumberField.js +1 -1
  128. package/dist/components/otp-field/MPOtpField.js +1 -1
  129. package/dist/components/page-layout/MPPageLayout.js +1 -1
  130. package/dist/components/pagination/MPPagination.d.ts +8 -0
  131. package/dist/components/pagination/MPPagination.js +1 -1
  132. package/dist/components/panes/MPPanes.js +1 -1
  133. package/dist/components/pie-chart/MPPieChart.d.ts +23 -1
  134. package/dist/components/pie-chart/MPPieChart.js +1 -1
  135. package/dist/components/pill/MPPill.js +1 -1
  136. package/dist/components/progress-box/MPProgressBox.js +1 -1
  137. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  138. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  139. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  140. package/dist/components/scatter-chart/MPScatterChart.d.ts +5 -1
  141. package/dist/components/scatter-chart/MPScatterChart.js +1 -1
  142. package/dist/components/sidebar/MPSidebar.d.ts +11 -0
  143. package/dist/components/sidebar/MPSidebar.js +1 -1
  144. package/dist/components/slider/MPSlider.d.ts +5 -0
  145. package/dist/components/slider/MPSlider.js +1 -1
  146. package/dist/components/snackbar/MPSnackbar.js +1 -1
  147. package/dist/components/sparkline/MPSparkline.d.ts +14 -1
  148. package/dist/components/sparkline/MPSparkline.js +1 -1
  149. package/dist/components/switch/MPSwitch.js +1 -1
  150. package/dist/components/tabs/MPTabs.js +1 -1
  151. package/dist/components/text-field/MPTextField.js +1 -1
  152. package/dist/components/timeline-chart/MPTimelineChart.d.ts +6 -2
  153. package/dist/components/timeline-chart/MPTimelineChart.js +1 -1
  154. package/dist/components/tour/MPTour.js +1 -1
  155. package/dist/components/transfer/MPTransfer.js +1 -1
  156. package/dist/components/tree-select/MPTreeSelect.js +1 -1
  157. package/dist/components/tree-view/MPTreeView.d.ts +8 -0
  158. package/dist/components/tree-view/MPTreeView.js +1 -1
  159. package/dist/components/typography/MPTypography.d.ts +1 -1
  160. package/dist/hooks/index.d.ts +4 -2
  161. package/dist/hooks/index.js +1 -1
  162. package/dist/hooks/mpColorSchemeScript.d.ts +46 -0
  163. package/dist/hooks/mpColorSchemeScript.js +1 -0
  164. package/dist/hooks/useMPColorScheme.d.ts +2 -47
  165. package/dist/hooks/useMPColorScheme.js +1 -1
  166. package/dist/hooks/useMPMediaQuery.js +1 -1
  167. package/dist/hooks/useMPOnScreen.js +1 -1
  168. package/dist/internal/Calendar.js +1 -1
  169. package/dist/internal/ChartChrome.d.ts +73 -14
  170. package/dist/internal/ChartChrome.js +1 -1
  171. package/dist/internal/ChartFrame.d.ts +24 -4
  172. package/dist/internal/ChartFrame.js +1 -1
  173. package/dist/internal/FieldOutline.d.ts +9 -1
  174. package/dist/internal/FieldOutline.js +1 -1
  175. package/dist/internal/RenderedLink.d.ts +20 -0
  176. package/dist/internal/RenderedLink.js +2 -0
  177. package/dist/internal/SupportingText.js +1 -1
  178. package/dist/internal/animate.d.ts +4 -0
  179. package/dist/internal/animate.js +1 -1
  180. package/dist/internal/box-size.d.ts +22 -0
  181. package/dist/internal/box-size.js +2 -0
  182. package/dist/internal/chart.d.ts +111 -13
  183. package/dist/internal/chart.js +1 -1
  184. package/dist/internal/color-scheme-keys.d.ts +13 -0
  185. package/dist/internal/color-scheme-keys.js +1 -0
  186. package/dist/internal/color-scheme.d.ts +11 -2
  187. package/dist/internal/color-scheme.js +1 -1
  188. package/dist/internal/config.d.ts +2 -0
  189. package/dist/internal/date.d.ts +2 -8
  190. package/dist/internal/date.js +1 -1
  191. package/dist/internal/highlight.js +1 -1
  192. package/dist/internal/i18n.d.ts +4 -53
  193. package/dist/internal/i18n.js +1 -1
  194. package/dist/internal/intersection.d.ts +50 -0
  195. package/dist/internal/intersection.js +2 -0
  196. package/dist/internal/intl.d.ts +22 -21
  197. package/dist/internal/intl.js +1 -1
  198. package/dist/internal/keys.d.ts +0 -9
  199. package/dist/internal/keys.js +1 -1
  200. package/dist/internal/layout-effect.d.ts +7 -0
  201. package/dist/internal/layout-effect.js +2 -0
  202. package/dist/internal/locale.d.ts +10 -2
  203. package/dist/internal/media.d.ts +1 -0
  204. package/dist/internal/media.js +1 -0
  205. package/dist/internal/messages/chart.d.ts +1 -1
  206. package/dist/internal/messages/chart.js +1 -1
  207. package/dist/internal/occurrence.d.ts +18 -0
  208. package/dist/internal/occurrence.js +1 -0
  209. package/dist/internal/page-layout.js +1 -1
  210. package/dist/internal/progress.d.ts +5 -0
  211. package/dist/internal/ref.d.ts +9 -0
  212. package/dist/internal/ref.js +1 -0
  213. package/dist/internal/remember.d.ts +36 -0
  214. package/dist/internal/remember.js +1 -0
  215. package/dist/internal/surface.d.ts +7 -1
  216. package/dist/internal/surface.js +1 -1
  217. package/dist/internal/text.d.ts +10 -4
  218. package/dist/internal/text.js +1 -1
  219. package/dist/internal/window-class.d.ts +8 -0
  220. package/dist/internal/window-class.js +1 -1
  221. package/dist/locales/ar.js +1 -1
  222. package/dist/locales/de.js +1 -1
  223. package/dist/locales/es.js +1 -1
  224. package/dist/locales/fr.js +1 -1
  225. package/dist/locales/hi.js +1 -1
  226. package/dist/locales/id.js +1 -1
  227. package/dist/locales/it.js +1 -1
  228. package/dist/locales/ja.js +1 -1
  229. package/dist/locales/ko.js +1 -1
  230. package/dist/locales/nl.js +1 -1
  231. package/dist/locales/pl.js +1 -1
  232. package/dist/locales/pt.js +1 -1
  233. package/dist/locales/ru.js +1 -1
  234. package/dist/locales/th.js +1 -1
  235. package/dist/locales/tr.js +1 -1
  236. package/dist/locales/vi.js +1 -1
  237. package/dist/locales/zh-hans.js +1 -1
  238. package/dist/locales/zh-hant.js +1 -1
  239. package/dist/styles/accordion.css +1 -1
  240. package/dist/styles/alert.css +1 -1
  241. package/dist/styles/animate-appear.css +1 -1
  242. package/dist/styles/animate-blink.css +1 -1
  243. package/dist/styles/animate-counter.css +1 -1
  244. package/dist/styles/animate-fade.css +1 -1
  245. package/dist/styles/animate-float.css +1 -1
  246. package/dist/styles/animate-grow.css +1 -1
  247. package/dist/styles/animate-headline.css +1 -1
  248. package/dist/styles/animate-lighting.css +1 -1
  249. package/dist/styles/animate-marquee.css +1 -1
  250. package/dist/styles/animate-reveal.css +1 -1
  251. package/dist/styles/animate-rotate.css +1 -1
  252. package/dist/styles/animate-scramble.css +1 -1
  253. package/dist/styles/animate-shake.css +1 -1
  254. package/dist/styles/animate-slide.css +1 -1
  255. package/dist/styles/animate-split.css +1 -1
  256. package/dist/styles/animate-typing.css +1 -1
  257. package/dist/styles/animate-zoom.css +1 -1
  258. package/dist/styles/area-chart.css +1 -1
  259. package/dist/styles/avatar.css +1 -1
  260. package/dist/styles/bar-chart.css +1 -1
  261. package/dist/styles/blockquote.css +1 -1
  262. package/dist/styles/box.css +1 -1
  263. package/dist/styles/breadcrumb.css +1 -1
  264. package/dist/styles/calendar.css +1 -1
  265. package/dist/styles/card.css +1 -1
  266. package/dist/styles/carousel.css +1 -1
  267. package/dist/styles/checkbox.css +1 -1
  268. package/dist/styles/chip.css +1 -1
  269. package/dist/styles/collapsible.css +1 -1
  270. package/dist/styles/color-picker.css +1 -1
  271. package/dist/styles/combobox.css +1 -1
  272. package/dist/styles/command-palette.css +1 -1
  273. package/dist/styles/confirm.css +1 -1
  274. package/dist/styles/data-table.css +1 -1
  275. package/dist/styles/date-picker.css +1 -1
  276. package/dist/styles/date-range-picker.css +1 -1
  277. package/dist/styles/date-time-picker.css +1 -1
  278. package/dist/styles/dialog.css +1 -1
  279. package/dist/styles/drawer.css +1 -1
  280. package/dist/styles/empty.css +1 -1
  281. package/dist/styles/floating-bottom-navigation.css +1 -1
  282. package/dist/styles/footer.css +1 -1
  283. package/dist/styles/gauge-chart.css +1 -1
  284. package/dist/styles/header.css +1 -1
  285. package/dist/styles/heatmap-chart.css +1 -1
  286. package/dist/styles/highlight.css +1 -1
  287. package/dist/styles/hover-card.css +1 -1
  288. package/dist/styles/image.css +1 -1
  289. package/dist/styles/line-chart.css +1 -1
  290. package/dist/styles/list.css +1 -1
  291. package/dist/styles/menu.css +1 -1
  292. package/dist/styles/menubar.css +1 -1
  293. package/dist/styles/meter.css +1 -1
  294. package/dist/styles/navigation-menu.css +1 -1
  295. package/dist/styles/number-field.css +1 -1
  296. package/dist/styles/otp-field.css +1 -1
  297. package/dist/styles/overlay.css +1 -1
  298. package/dist/styles/page-layout.css +1 -1
  299. package/dist/styles/pie-chart.css +1 -1
  300. package/dist/styles/pill.css +1 -1
  301. package/dist/styles/popconfirm.css +1 -1
  302. package/dist/styles/popover.css +1 -1
  303. package/dist/styles/progress-box.css +1 -1
  304. package/dist/styles/progress-circular.css +1 -1
  305. package/dist/styles/progress-linear.css +1 -1
  306. package/dist/styles/radio-group.css +1 -1
  307. package/dist/styles/scatter-chart.css +1 -1
  308. package/dist/styles/select.css +1 -1
  309. package/dist/styles/sidebar.css +1 -1
  310. package/dist/styles/slider.css +1 -1
  311. package/dist/styles/snackbar.css +1 -1
  312. package/dist/styles/sparkline.css +1 -1
  313. package/dist/styles/spoiler.css +1 -1
  314. package/dist/styles/stack.css +1 -1
  315. package/dist/styles/statistic.css +1 -1
  316. package/dist/styles/switch.css +1 -1
  317. package/dist/styles/table.css +1 -1
  318. package/dist/styles/tabs.css +1 -1
  319. package/dist/styles/text-field.css +1 -1
  320. package/dist/styles/time-picker.css +1 -1
  321. package/dist/styles/timeline-chart.css +1 -1
  322. package/dist/styles/tokens.css +1 -1
  323. package/dist/styles/toolbar.css +1 -1
  324. package/dist/styles/tour.css +1 -1
  325. package/dist/styles/transfer.css +1 -1
  326. package/dist/styles/tree-select.css +1 -1
  327. package/dist/styles/tree-view.css +1 -1
  328. package/dist/styles/typography.css +1 -1
  329. package/dist/styles.css +1 -1
  330. package/dist/tailwind.css +116 -4
  331. package/dist/types.d.ts +208 -1
  332. package/package.json +25 -4
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { Menu } from '@base-ui/react/menu';
2
3
  import type { MPAlign, MPColor, MPSide, MPSize } from '../../types.js';
3
4
  /**
4
5
  * A menu takes `size` and `color` and stops there.
@@ -95,6 +96,13 @@ export interface MPMenuItemProps {
95
96
  onClick?: (event: React.MouseEvent<HTMLElement>) => void;
96
97
  /** Renders the row as a real `<a>`. A menu of links has to be links. */
97
98
  href?: string;
99
+ /**
100
+ * Renders the row's `<a>` as something else — a router's `Link`, so a press is a
101
+ * client-side navigation and the page is prefetched. `href` and the classes
102
+ * still go through, so `render={<NextLink />}` needs the URL written once.
103
+ * Ignored where there is no link to replace.
104
+ */
105
+ render?: Menu.LinkItem.Props['render'];
98
106
  /** Where the link opens — `_blank` and the rest. Ignored without `href`. */
99
107
  target?: string;
100
108
  /**
@@ -190,7 +198,7 @@ export type MPMenuSeparatorProps = React.ComponentPropsWithoutRef<'div'>;
190
198
  * cannot be copied, and tells a screen reader the wrong thing about every one of
191
199
  * them.
192
200
  */
193
- export declare function MPMenuItem({ onClick, href, target, rel, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuItemProps): React.JSX.Element;
201
+ export declare function MPMenuItem({ onClick, href, render, target, rel, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuItemProps): React.JSX.Element;
194
202
  /** A row that ticks. The tick lands in the column a `startIcon` would. */
195
203
  export declare function MPMenuCheckboxItem({ checked, defaultChecked, onCheckedChange, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: MPMenuCheckboxItemProps): React.JSX.Element;
196
204
  /** One choice out of a set. Wraps the rows that make up the set. */
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as l}from"@base-ui/react/context-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{CheckIcon as s,ChevronRightIcon as o}from"../../constants/icons.js";import{linkRel as i}from"../../internal/link.js";import{MPMenuContext as c}from"../../internal/menu.js";import{accentSlots as m}from"../../internal/accent.js";import{MPStateLayer as d}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,META_TEXT as p,hasContent as h}from"../../internal/scale.js";import{DOT_MOTION as f,MARK_MOTION as x}from"../../internal/mark.js";import{FADE as b,PORTAL_LAYER as g}from"../../internal/surface.js";import{useMPColor as v,useMPSize as N}from"../../internal/config.js";const y=/*@__PURE__*/["mp-menu__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container text-mp-on-surface","max-h-[min(24rem,var(--available-height))] min-w-[112px] max-w-[280px]","overflow-y-auto overscroll-contain py-2 outline-none",b].join(" "),C={xs:"min-h-8",sm:"min-h-10",md:"min-h-12",lg:"min-h-14",xl:"min-h-16"},k={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},j={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3",xl:"gap-4"},M={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};function O(e,n,t){return["group relative flex w-full cursor-pointer items-center select-none",n?"text-(--_mp-accent)":"text-mp-on-surface",C[e],k[e],j[e],M[e],"data-disabled:text-mp-on-surface/38 data-disabled:cursor-default","outline-none",t??""].filter(Boolean).join(" ")}function P(){return e(d,{layer:"inset-0 bg-current",className:"group-data-highlighted:opacity-8 group-data-popup-open:opacity-8 group-data-disabled:opacity-0"})}const I="relative flex shrink-0 items-center justify-center";function $({children:t,description:a}){return h(a)?n("span",{className:"relative flex min-w-0 flex-1 flex-col py-1.5 text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`text-mp-on-surface-variant truncate ${p}`,children:a})]}):e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:t})}function _({shortcut:n}){return h(n)?e("span",{className:`text-mp-on-surface-variant relative ms-2 shrink-0 ${p}`,children:n}):null}export function MPMenuItem({onClick:l,href:r,target:s,rel:o,startIcon:m,endIcon:d,shortcut:u,description:p,color:f,closeOnClick:x=!0,disabled:b=!1,label:g,children:v,className:N,style:y}){const{size:C}=t.useContext(c),k=n(t.Fragment,{children:[e(P,{}),h(m)?e("span",{className:`${I} text-mp-on-surface-variant`,children:m}):null,e($,{description:p,children:v}),h(d)?e("span",{className:`${I} text-mp-on-surface-variant`,children:d}):null,e(_,{shortcut:u})]}),j=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0,M=j||y?{...j,...y}:void 0;return void 0===r||b?e(a.Item,{disabled:b,label:g,closeOnClick:x,onClick:l,className:O(C,Boolean(f),N),style:M,children:k}):e(a.LinkItem,{href:r,target:s,rel:i(s,o),label:g,closeOnClick:x,onClick:l,className:O(C,Boolean(f),N),style:M,children:k})}export function MPMenuCheckboxItem({checked:l,defaultChecked:o,onCheckedChange:i,endIcon:m,shortcut:d,description:p,color:f,closeOnClick:b=!1,disabled:g=!1,label:v,children:N,className:y,style:C}){const{size:k}=t.useContext(c),j=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:o,onCheckedChange:e=>i?.(e),disabled:g,label:v,closeOnClick:b,className:O(k,Boolean(f),y),style:j||C?{...j,...C}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[k]},children:e(a.CheckboxItemIndicator,{className:`mp-menu__mark flex items-center justify-center ${x}`,children:e(r,{icon:s,size:u[k]})})}),e($,{description:p,children:N}),h(m)?e("span",{className:`${I} text-mp-on-surface-variant`,children:m}):null,e(_,{shortcut:d})]})}export function MPMenuRadioGroup({value:n,defaultValue:t,onValueChange:l,disabled:r=!1,children:s,className:o,style:i}){return e(a.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>l?.(e),disabled:r,className:o,style:i,children:s})}export function MPMenuRadioItem({value:l,endIcon:r,shortcut:s,description:o,color:i,closeOnClick:m=!1,disabled:d=!1,label:p,children:x,className:b,style:g}){const{size:v}=t.useContext(c),N=i?{"--_mp-accent":`var(--_mp-color-${i})`}:void 0;return n(a.RadioItem,{value:l,disabled:d,label:p,closeOnClick:m,className:O(v,Boolean(i),b),style:N||g?{...N,...g}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[v]},children:e(a.RadioItemIndicator,{className:`mp-menu__dot flex items-center justify-center ${f}`,children:e("span",{className:"block size-2.5 rounded-full bg-current"})})}),e($,{description:o,children:x}),h(r)?e("span",{className:`${I} text-mp-on-surface-variant`,children:r}):null,e(_,{shortcut:s})]})}export function MPMenuGroup({label:l,children:r,className:s,style:o}){const{size:i}=t.useContext(c);return n(a.Group,{className:s,style:o,children:[h(l)?e(a.GroupLabel,{className:`text-mp-on-surface-variant pt-2 pb-1 ${k[i]} ${p}`,children:l}):null,r]})}export function MPMenuSeparator({className:n,...t}){return e(a.Separator,{className:["bg-mp-outline-variant my-2 h-px",n??""].filter(Boolean).join(" "),...t})}export function MPMenuSubmenu({label:l,startIcon:s,disabled:i=!1,side:d="right",sideOffset:p=0,children:f,className:x,style:b}){const{size:v,color:N}=t.useContext(c);return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:i,className:O(v,!1),children:[e(P,{}),h(s)?e("span",{className:`${I} text-mp-on-surface-variant`,children:s}):null,e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${I} text-mp-on-surface-variant rtl:rotate-180`,children:e(r,{icon:o,size:u[v]})})]}),e(a.Portal,{children:e(a.Positioner,{className:g,side:d,sideOffset:p,align:"start",children:e(a.Popup,{className:[y,x??""].filter(Boolean).join(" "),style:{...m(N),...b},children:f})})})]})}export function MPMenu({size:l,color:r,trigger:s,open:o,defaultOpen:i,onOpenChange:d,side:u="bottom",align:p="start",sideOffset:h=4,modal:f,openOnHover:x=!1,loopFocus:b=!0,nativeButton:C=!0,disabled:k=!1,className:j,style:M,children:O}){const P=N(l),I=v(r),$=t.useMemo(()=>({size:P,color:I}),[P,I]);return e(c.Provider,{value:$,children:n(a.Root,{open:o,defaultOpen:i,onOpenChange:e=>d?.(e),modal:f,loopFocus:b,disabled:k,children:[s?e(a.Trigger,{render:s,openOnHover:x,nativeButton:C,disabled:k}):null,e(a.Portal,{children:e(a.Positioner,{className:g,side:u,align:p,sideOffset:h,children:e(a.Popup,{"data-mp-size":P,className:[y,j??""].filter(Boolean).join(" "),style:{...m(I),...M},children:O})})})]})})}export function MPContextMenu({size:a,color:r,content:s,children:o,open:i,defaultOpen:d,onOpenChange:u,loopFocus:p=!0,disabled:h=!1,className:f,style:x}){const b=N(a),C=v(r),k=t.useMemo(()=>({size:b,color:C}),[b,C]);return e(c.Provider,{value:k,children:n(l.Root,{open:i,defaultOpen:d,onOpenChange:e=>u?.(e),loopFocus:p,disabled:h,children:[e(l.Trigger,{children:o}),e(l.Portal,{children:e(l.Positioner,{className:g,children:e(l.Popup,{"data-mp-size":b,className:[y,f??""].filter(Boolean).join(" "),style:{...m(C),...x},children:s})})})]})})}
2
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as l}from"@base-ui/react/context-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{CheckIcon as s,ChevronRightIcon as o}from"../../constants/icons.js";import{linkRel as i}from"../../internal/link.js";import{MPMenuContext as c}from"../../internal/menu.js";import{accentSlots as d}from"../../internal/accent.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,META_TEXT as p,hasContent as h}from"../../internal/scale.js";import{DOT_MOTION as f,MARK_MOTION as x}from"../../internal/mark.js";import{FADE as b,PORTAL_LAYER as g}from"../../internal/surface.js";import{useMPColor as v,useMPSize as N}from"../../internal/config.js";const y=/*@__PURE__*/["mp-menu__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container text-mp-on-surface","max-h-[min(24rem,var(--available-height))] min-w-[112px] max-w-[280px]","overflow-y-auto overscroll-contain py-2 outline-none",b].join(" "),C={xs:"min-h-8",sm:"min-h-10",md:"min-h-12",lg:"min-h-14",xl:"min-h-16"},k={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},j={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3",xl:"gap-4"},M={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};function O(e,n,t){return["group relative flex w-full cursor-pointer items-center select-none",n?"text-(--_mp-accent)":"text-mp-on-surface",C[e],k[e],j[e],M[e],"data-disabled:text-mp-on-surface/38 data-disabled:cursor-default","outline-none",t??""].filter(Boolean).join(" ")}function P(){return e(m,{layer:"inset-0 bg-current",className:"group-data-highlighted:opacity-8 group-data-popup-open:opacity-8 group-data-disabled:opacity-0"})}const I="relative flex shrink-0 items-center justify-center";function $({children:t,description:a}){return h(a)?n("span",{className:"relative flex min-w-0 flex-1 flex-col py-1.5 text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`text-mp-on-surface-variant truncate ${p}`,children:a})]}):e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:t})}function _({shortcut:n}){return h(n)?e("span",{className:`text-mp-on-surface-variant relative ms-2 shrink-0 ${p}`,children:n}):null}export function MPMenuItem({onClick:l,href:r,render:s,target:o,rel:d,startIcon:m,endIcon:u,shortcut:p,description:f,color:x,closeOnClick:b=!0,disabled:g=!1,label:v,children:N,className:y,style:C}){const{size:k}=t.useContext(c),j=n(t.Fragment,{children:[e(P,{}),h(m)?e("span",{className:`${I} text-mp-on-surface-variant`,children:m}):null,e($,{description:f,children:N}),h(u)?e("span",{className:`${I} text-mp-on-surface-variant`,children:u}):null,e(_,{shortcut:p})]}),M=x?{"--_mp-accent":`var(--_mp-color-${x})`}:void 0,z=M||C?{...M,...C}:void 0;return void 0===r||g?e(a.Item,{disabled:g,label:v,closeOnClick:b,onClick:l,className:O(k,Boolean(x),y),style:z,children:j}):e(a.LinkItem,{href:r,target:o,rel:i(o,d),render:s,label:v,closeOnClick:b,onClick:l,className:O(k,Boolean(x),y),style:z,children:j})}export function MPMenuCheckboxItem({checked:l,defaultChecked:o,onCheckedChange:i,endIcon:d,shortcut:m,description:p,color:f,closeOnClick:b=!1,disabled:g=!1,label:v,children:N,className:y,style:C}){const{size:k}=t.useContext(c),j=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:o,onCheckedChange:e=>i?.(e),disabled:g,label:v,closeOnClick:b,className:O(k,Boolean(f),y),style:j||C?{...j,...C}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[k]},children:e(a.CheckboxItemIndicator,{className:`mp-menu__mark flex items-center justify-center ${x}`,children:e(r,{icon:s,size:u[k]})})}),e($,{description:p,children:N}),h(d)?e("span",{className:`${I} text-mp-on-surface-variant`,children:d}):null,e(_,{shortcut:m})]})}export function MPMenuRadioGroup({value:n,defaultValue:t,onValueChange:l,disabled:r=!1,children:s,className:o,style:i}){return e(a.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>l?.(e),disabled:r,className:o,style:i,children:s})}export function MPMenuRadioItem({value:l,endIcon:r,shortcut:s,description:o,color:i,closeOnClick:d=!1,disabled:m=!1,label:p,children:x,className:b,style:g}){const{size:v}=t.useContext(c),N=i?{"--_mp-accent":`var(--_mp-color-${i})`}:void 0;return n(a.RadioItem,{value:l,disabled:m,label:p,closeOnClick:d,className:O(v,Boolean(i),b),style:N||g?{...N,...g}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[v]},children:e(a.RadioItemIndicator,{className:`mp-menu__dot flex items-center justify-center ${f}`,children:e("span",{className:"block size-2.5 rounded-full bg-current"})})}),e($,{description:o,children:x}),h(r)?e("span",{className:`${I} text-mp-on-surface-variant`,children:r}):null,e(_,{shortcut:s})]})}export function MPMenuGroup({label:l,children:r,className:s,style:o}){const{size:i}=t.useContext(c);return n(a.Group,{className:s,style:o,children:[h(l)?e(a.GroupLabel,{className:`text-mp-on-surface-variant pt-2 pb-1 ${k[i]} ${p}`,children:l}):null,r]})}export function MPMenuSeparator({className:n,...t}){return e(a.Separator,{className:["bg-mp-outline-variant my-2 h-px",n??""].filter(Boolean).join(" "),...t})}export function MPMenuSubmenu({label:l,startIcon:s,disabled:i=!1,side:m="right",sideOffset:p=0,children:f,className:x,style:b}){const{size:v,color:N}=t.useContext(c);return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:i,className:O(v,!1),children:[e(P,{}),h(s)?e("span",{className:`${I} text-mp-on-surface-variant`,children:s}):null,e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${I} text-mp-on-surface-variant rtl:rotate-180`,children:e(r,{icon:o,size:u[v]})})]}),e(a.Portal,{children:e(a.Positioner,{className:g,side:m,sideOffset:p,align:"start",children:e(a.Popup,{className:[y,x??""].filter(Boolean).join(" "),style:{...d(N),...b},children:f})})})]})}export function MPMenu({size:l,color:r,trigger:s,open:o,defaultOpen:i,onOpenChange:m,side:u="bottom",align:p="start",sideOffset:h=4,modal:f,openOnHover:x=!1,loopFocus:b=!0,nativeButton:C=!0,disabled:k=!1,className:j,style:M,children:O}){const P=N(l),I=v(r),$=t.useMemo(()=>({size:P,color:I}),[P,I]);return e(c.Provider,{value:$,children:n(a.Root,{open:o,defaultOpen:i,onOpenChange:e=>m?.(e),modal:f,loopFocus:b,disabled:k,children:[s?e(a.Trigger,{render:s,openOnHover:x,nativeButton:C,disabled:k}):null,e(a.Portal,{children:e(a.Positioner,{className:g,side:u,align:p,sideOffset:h,children:e(a.Popup,{"data-mp-size":P,className:[y,j??""].filter(Boolean).join(" "),style:{...d(I),...M},children:O})})})]})})}export function MPContextMenu({size:a,color:r,content:s,children:o,open:i,defaultOpen:m,onOpenChange:u,loopFocus:p=!0,disabled:h=!1,className:f,style:x}){const b=N(a),C=v(r),k=t.useMemo(()=>({size:b,color:C}),[b,C]);return e(c.Provider,{value:k,children:n(l.Root,{open:i,defaultOpen:m,onOpenChange:e=>u?.(e),loopFocus:p,disabled:h,children:[e(l.Trigger,{children:o}),e(l.Portal,{children:e(l.Positioner,{className:g,children:e(l.Popup,{"data-mp-size":b,className:[y,f??""].filter(Boolean).join(" "),style:{...d(C),...x},children:s})})})]})})}
@@ -30,6 +30,11 @@ export interface MPMeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>
30
30
  * what a range nobody described reads as, not what the reader came for.
31
31
  */
32
32
  format?: Intl.NumberFormatOptions;
33
+ /**
34
+ * The locale `format` writes the value in. Defaults to the nearest
35
+ * `MPLocaleProvider`, then to the runtime's own.
36
+ */
37
+ locale?: string;
33
38
  /**
34
39
  * Where the bar changes colour, smallest `from` first. The family of the last
35
40
  * threshold the value has reached wins; below all of them `color` stands.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Meter as t}from"@base-ui/react/meter";import{accentSlots as n}from"../../internal/accent.js";import{META_TEXT as o,STACK_GAP as s}from"../../internal/scale.js";import{BAR_THICKNESS as l,progressFraction as i}from"../../internal/progress.js";import{useMPColor as m,useMPSize as c}from"../../internal/config.js";import{thresholdColor as u}from"../../internal/threshold.js";export const MPMeter=/*@__PURE__*/a.forwardRef(function({value:a,min:f=0,max:d=100,label:p,showValue:h=!1,format:j,thresholds:b,size:x,color:w,className:v,style:N,..._},g){const y=c(x),k=m(w),M=i(a,f,d),z=u(a,k,b),R=void 0!==j;return r(t.Root,{ref:g,value:a,min:f,max:d,format:j,"data-mp-size":y,className:["mp-meter flex w-full flex-col",s[y],v??""].filter(Boolean).join(" "),style:{...n(z),...N},..._,children:[p||h?r("div",{className:["mp-meter__header flex items-baseline gap-2",p?"justify-between":"justify-end",o].join(" "),children:[p?e(t.Label,{className:"text-mp-on-surface min-w-0 truncate",children:p}):null,h?e(t.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>R?e:`${Math.round(100*(M??0))}%`}):null]}):null,e(t.Track,{className:["mp-meter__track rounded-mp-full bg-mp-on-surface/12 relative w-full overflow-hidden",l[y]].join(" "),children:e(t.Indicator,{className:["mp-meter__bar rounded-mp-full absolute inset-y-0 start-0 bg-(--_mp-accent)","transition-[width,background-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none"].join(" ")})})]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Meter as t}from"@base-ui/react/meter";import{accentSlots as o}from"../../internal/accent.js";import{META_TEXT as n,STACK_GAP as l}from"../../internal/scale.js";import{BAR_THICKNESS as s,progressFraction as i}from"../../internal/progress.js";import{useMPColor as m,useMPSize as c}from"../../internal/config.js";import{useMPLocale as f}from"../../internal/locale.js";import{checkServerLocale as u,intlLocale as d}from"../../internal/intl.js";import{thresholdColor as p}from"../../internal/threshold.js";export const MPMeter=/*@__PURE__*/a.forwardRef(function({value:a,min:h=0,max:j=100,label:b,showValue:x=!1,format:w,locale:v,thresholds:N,size:_,color:g,className:y,style:k,...M},z){const R=c(_),V=m(g),B=i(a,h,j),I=p(a,V,N),L=void 0!==w,P=f(v);return L&&u(P),r(t.Root,{ref:z,value:a,min:h,max:j,format:w,locale:d(P),"data-mp-size":R,className:["mp-meter flex w-full flex-col",l[R],y??""].filter(Boolean).join(" "),style:{...o(I),...k},...M,children:[b||x?r("div",{className:["mp-meter__header flex items-baseline gap-2",b?"justify-between":"justify-end",n].join(" "),children:[b?e(t.Label,{className:"text-mp-on-surface min-w-0 truncate",children:b}):null,x?e(t.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>L?e:`${Math.round(100*(B??0))}%`}):null]}):null,e(t.Track,{className:["mp-meter__track rounded-mp-full bg-mp-on-surface/12 relative w-full overflow-hidden",s[R]].join(" "),children:e(t.Indicator,{className:["mp-meter__bar rounded-mp-full absolute inset-y-0 start-0 bg-(--_mp-accent)","transition-[width,background-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none"].join(" ")})})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{cssLength as o}from"../../internal/length.js";import{FINISHES as s,HARDWARE as h,MockupCutout as r,RESOLUTIONS as n,defaultNotch as a,mockupChrome as d,mockupMetrics as l,resolveOs as c}from"../../internal/mockup.js";import{useMPSize as m}from"../../internal/config.js";export const MPMockup=/*@__PURE__*/i.forwardRef(function({device:p,os:u,hardware:f="monitor",size:g,resolution:w,orientation:v="portrait",bezel:b="standard",finish:k="graphite",notch:y,systemUi:x=!0,width:_,height:$,className:R,style:N,children:j,...z},B){const H=m(g),M=c(p,u),O=y??a(p,M),W=l({device:p,bezel:b,hardware:f,orientation:v,resolution:w??n[p][H]}),{screen:C,body:P,frame:E,shell:F,screenRadius:S,stand:T,laptop:U}=W,q=x?d({os:M,width:C.width,notch:O}):null,A=i.useRef(null),[D,G]=i.useState(null);i.useEffect(()=>{const e=A.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=()=>{const t=e.getBoundingClientRect();t.width<=0||t.height<=0||G(Math.min(t.width/E.width,t.height/E.height))};t();const i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[E.width,E.height]);const I=i.useCallback(e=>{A.current=e,"function"==typeof B?B(e):B&&(B.current=e)},[B]);return e("div",{ref:I,"data-mp-size":H,"data-mp-device":p,"data-mp-os":M,className:["mp-mockup relative",R??""].filter(Boolean).join(" "),style:{...s[k],width:o(_)??(void 0===$?"100%":"auto"),height:o($),aspectRatio:`${E.width} / ${E.height}`,...N},...z,children:t("div",{className:"mp-mockup__frame absolute top-1/2 left-1/2 flex flex-col items-center",style:{width:E.width,height:E.height,transform:`translate(-50%, -50%) scale(${D??1})`,transformOrigin:"center",visibility:null===D?"hidden":void 0},children:[e("div",{className:`mp-mockup__body relative shrink-0 ${h}`,style:{width:P.width,height:P.height,borderRadius:F.radius,padding:`${F.top}px ${F.side}px ${F.bottom}px`},children:t("div",{className:"mp-mockup__screen bg-mp-surface text-mp-on-surface relative flex size-full flex-col overflow-hidden",style:{borderRadius:S},children:[q?.top,e("div",{className:"mp-mockup__content relative min-h-0 overflow-hidden",style:{width:C.width,height:C.height-(q?.insetTop??0)-(q?.insetBottom??0)},children:j}),q?.bottom,e(r,{notch:O,width:C.width})]})}),T?t(i.Fragment,{children:[e("div",{className:`mp-mockup__neck shrink-0 ${h}`,style:{width:T.neckWidth,height:T.neckHeight}}),e("div",{className:`mp-mockup__foot shrink-0 ${h}`,style:{width:T.footWidth,height:T.footHeight,borderRadius:T.footHeight}})]}):null,U?e("div",{className:`mp-mockup__base relative shrink-0 ${h}`,style:{width:U.width,height:U.height,clipPath:"polygon(2% 0, 98% 0, 100% 100%, 0 100%)",borderRadius:`0 0 ${.5*U.height}px ${.5*U.height}px`},children:e("span",{className:"bg-(--_mp-device-edge) absolute top-0 left-1/2 -translate-x-1/2 rounded-b-full",style:{width:U.lipWidth,height:.28*U.height}})}):null]})})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{cssLength as o}from"../../internal/length.js";import{FINISHES as h,HARDWARE as n,MockupCutout as r,RESOLUTIONS as s,defaultNotch as d,mockupChrome as a,mockupMetrics as l,resolveOs as c}from"../../internal/mockup.js";import{useMPSize as m}from"../../internal/config.js";export const MPMockup=/*@__PURE__*/i.forwardRef(function({device:p,os:u,hardware:f="monitor",size:g,resolution:w,orientation:v="portrait",bezel:b="standard",finish:y="graphite",notch:k,systemUi:x=!0,width:_,height:$,className:R,style:N,children:j,...z},M){const B=m(g),H=c(p,u),O=k??d(p,H),W=l({device:p,bezel:b,hardware:f,orientation:v,resolution:w??s[p][B]}),{screen:C,body:P,frame:E,shell:F,screenRadius:L,stand:S,laptop:T}=W,U=x?a({os:H,width:C.width,notch:O}):null,q=i.useRef(null),[A,D]=i.useState(null),G="number"==typeof _&&"number"==typeof $?Math.min(_/E.width,$/E.height):"number"==typeof _&&void 0===$?_/E.width:"number"==typeof $&&void 0===_?$/E.height:null,I=A??G;i.useLayoutEffect(()=>{const e=q.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=()=>{const t=e.getBoundingClientRect();t.width<=0||t.height<=0||D(Math.min(t.width/E.width,t.height/E.height))};t();const i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[E.width,E.height]);const J=i.useCallback(e=>{q.current=e,"function"==typeof M?M(e):M&&(M.current=e)},[M]);return e("div",{ref:J,"data-mp-size":B,"data-mp-device":p,"data-mp-os":H,className:["mp-mockup relative",R??""].filter(Boolean).join(" "),style:{...h[y],width:o(_)??(void 0===$?"100%":"auto"),height:o($),aspectRatio:`${E.width} / ${E.height}`,...N},...z,children:t("div",{className:"mp-mockup__frame absolute top-1/2 left-1/2 flex flex-col items-center",style:{width:E.width,height:E.height,transform:`translate(-50%, -50%) scale(${I??1})`,transformOrigin:"center",visibility:null===I?"hidden":void 0},children:[e("div",{className:`mp-mockup__body relative shrink-0 ${n}`,style:{width:P.width,height:P.height,borderRadius:F.radius,padding:`${F.top}px ${F.side}px ${F.bottom}px`},children:t("div",{className:"mp-mockup__screen bg-mp-surface text-mp-on-surface relative flex size-full flex-col overflow-hidden",style:{borderRadius:L},children:[U?.top,e("div",{className:"mp-mockup__content relative min-h-0 overflow-hidden",style:{width:C.width,height:C.height-(U?.insetTop??0)-(U?.insetBottom??0)},children:j}),U?.bottom,e(r,{notch:O,width:C.width})]})}),S?t(i.Fragment,{children:[e("div",{className:`mp-mockup__neck shrink-0 ${n}`,style:{width:S.neckWidth,height:S.neckHeight}}),e("div",{className:`mp-mockup__foot shrink-0 ${n}`,style:{width:S.footWidth,height:S.footHeight,borderRadius:S.footHeight}})]}):null,T?e("div",{className:`mp-mockup__base relative shrink-0 ${n}`,style:{width:T.width,height:T.height,clipPath:"polygon(2% 0, 98% 0, 100% 100%, 0 100%)",borderRadius:`0 0 ${.5*T.height}px ${.5*T.height}px`},children:e("span",{className:"bg-(--_mp-device-edge) absolute top-0 left-1/2 -translate-x-1/2 rounded-b-full",style:{width:T.lipWidth,height:.28*T.height}})}):null]})})});
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { NavigationMenu } from '@base-ui/react/navigation-menu';
2
3
  import type { MPColor, MPOrientation, MPSize } from '../../types.js';
3
4
  export interface MPNavigationMenuProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'color' | 'defaultValue' | 'onChange'> {
4
5
  /**
@@ -35,6 +36,17 @@ export interface MPNavigationMenuProps extends Omit<React.ComponentPropsWithoutR
35
36
  * @default 'primary'
36
37
  */
37
38
  color?: MPColor;
39
+ /**
40
+ * Keeps every panel's links in the page while the panels are closed: in the
41
+ * server's markup, hidden, and in the document from then on.
42
+ *
43
+ * Off by default, which leaves a closed panel out of the page entirely — so
44
+ * the links inside it are not in the HTML a crawler reads and not on the
45
+ * page a crawler renders. Turn it on when the panels hold destinations the
46
+ * site wants found.
47
+ * @default false
48
+ */
49
+ keepMounted?: boolean;
38
50
  /**
39
51
  * The name the `<nav>` is announced by, through `aria-label` in the rest
40
52
  * props.
@@ -73,6 +85,13 @@ export interface MPNavigationMenuItemProps {
73
85
  * also needs `nofollow` should say `rel="noopener noreferrer nofollow"`.
74
86
  */
75
87
  rel?: string;
88
+ /**
89
+ * Renders the destination's `<a>` as something else — a router's `Link`, so a press is a
90
+ * client-side navigation and the page is prefetched. `href` and the classes
91
+ * still go through, so `render={<NextLink />}` needs the URL written once.
92
+ * Ignored where there is no link to replace.
93
+ */
94
+ render?: NavigationMenu.Link.Props['render'];
76
95
  /** A glyph before the label. */
77
96
  startIcon?: React.ReactNode;
78
97
  /**
@@ -106,6 +125,13 @@ export interface MPNavigationMenuLinkProps extends Omit<React.ComponentPropsWith
106
125
  description?: React.ReactNode;
107
126
  /** A glyph before the title. */
108
127
  startIcon?: React.ReactNode;
128
+ /**
129
+ * Renders the row's `<a>` as something else — a router's `Link`, so a press is a
130
+ * client-side navigation and the page is prefetched. `href` and the classes
131
+ * still go through, so `render={<NextLink />}` needs the URL written once.
132
+ * Ignored where there is no link to replace.
133
+ */
134
+ render?: NavigationMenu.Link.Props['render'];
109
135
  }
110
136
  /**
111
137
  * One row inside a panel: where it goes, what it is called, and a line saying
@@ -124,7 +150,7 @@ export declare const MPNavigationMenuLink: React.ForwardRefExoticComponent<MPNav
124
150
  * is a link — and the difference is not cosmetic. The second is announced as a
125
151
  * destination and the first as something that expands.
126
152
  */
127
- export declare function MPNavigationMenuItem({ label, href, target, rel, startIcon, value, disabled, columns, children, className, style }: MPNavigationMenuItemProps): React.JSX.Element;
153
+ export declare function MPNavigationMenuItem({ label, href, target, rel, render, startIcon, value, disabled, columns, children, className, style }: MPNavigationMenuItemProps): React.JSX.Element;
128
154
  /**
129
155
  * A site's navigation: a row of destinations, some of which open a panel of more
130
156
  * of them.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import*as a from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{ChevronDownIcon as o}from"../../constants/icons.js";import{accentSlots as s}from"../../internal/accent.js";import{linkRel as l}from"../../internal/link.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{CONTROL_GAP as m,CONTROL_HEIGHT as p,CONTROL_ICON as d,CONTROL_PAD_X as u,CONTROL_TEXT as f,hasContent as h,META_TEXT as g}from"../../internal/scale.js";import{PORTAL_LAYER as x}from"../../internal/surface.js";import{useMPColor as v,useMPSize as N}from"../../internal/config.js";const y=/*@__PURE__*/a.createContext({size:"md"}),j=/*@__PURE__*/["mp-navigation-menu__popup rounded-mp-xs shadow-mp-2","bg-mp-surface-container text-mp-on-surface box-border overflow-hidden outline-none","transition-[opacity,width,height] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),b={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-2.5",xl:"p-3"};export const MPNavigationMenuLink=/*@__PURE__*/a.forwardRef(function({href:t,title:r,description:o,startIcon:s,target:p,rel:d,className:x,children:v,...N},j){const{size:b}=a.useContext(y);return n(i.Link,{ref:j,href:t,target:p,rel:l(p,d),className:["mp-navigation-menu__link group text-mp-on-surface rounded-mp-xs relative flex","min-w-0 cursor-pointer items-start bg-transparent py-2 no-underline outline-none",m[b],u[b],x??""].filter(Boolean).join(" "),...N,children:[e(c,{}),h(s)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:s}):null,n("span",{className:"relative flex min-w-0 flex-col gap-0.5",children:[e("span",{className:`font-medium ${f[b]}`,children:r}),h(o)?e("span",{className:`text-mp-on-surface-variant ${g}`,children:o}):null,v]})]})});export function MPNavigationMenuItem({label:s,href:g,target:x,rel:v,startIcon:N,value:j,disabled:w=!1,columns:M=1,children:P,className:_,style:z}){const{size:k}=a.useContext(y),C=void 0!==g&&!h(P),I=Number.isFinite(M)?Math.max(1,Math.round(M)):1,L=["mp-navigation-menu__item group text-mp-on-surface relative inline-flex shrink-0","rounded-mp-full cursor-pointer items-center justify-center bg-transparent","appearance-none border-0 font-[inherit] whitespace-nowrap no-underline select-none","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-colors duration-(--mp-sys-motion-duration-short4)","data-popup-open:text-(--_mp-accent)","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",p[k],f[k],m[k],u[k],_??""].filter(Boolean).join(" ");return e(i.Item,{value:j,children:C?n(i.Link,{href:g,target:x,rel:l(x,v),className:L,style:z,children:[e(c,{}),h(N)?e("span",{className:"relative flex",children:N}):null,e("span",{className:"relative",children:s})]}):n(t,{children:[n(i.Trigger,{disabled:w,className:L,style:z,children:[w?null:e(c,{className:"group-data-popup-open:opacity-8"}),h(N)?e("span",{className:"relative flex",children:N}):null,e("span",{className:"relative",children:s}),e(i.Icon,{className:["relative flex items-center transition-transform","duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-popup-open:rotate-180"].join(" "),children:e(r,{icon:o,size:d[k]})})]}),e(i.Content,{className:`mp-navigation-menu__panel grid gap-1 ${b[k]}`,style:I>1?{gridTemplateColumns:`repeat(${I}, minmax(0, 1fr))`}:void 0,children:P})]})})}export const MPNavigationMenu=/*@__PURE__*/a.forwardRef(function({orientation:t="horizontal",value:r,defaultValue:o,onValueChange:l,delay:c,closeDelay:p,sideOffset:d=8,size:u,color:f,className:h,style:g,children:b,...w},M){const P=N(u),_=v(f),z=a.useMemo(()=>({size:P}),[P]);return e(y.Provider,{value:z,children:n(i.Root,{ref:M,orientation:t,value:r,defaultValue:o,onValueChange:e=>l?.(e),delay:c,closeDelay:p,"data-mp-size":P,className:["mp-navigation-menu",h??""].filter(Boolean).join(" "),style:{...s(_),...g},...w,children:[e(i.List,{className:["m-0 flex list-none items-center p-0","vertical"===t?"flex-col items-stretch":"flex-row",m[P]].join(" "),children:b}),e(i.Portal,{children:e(i.Positioner,{className:x,sideOffset:d,collisionPadding:12,style:s(_),children:e(i.Popup,{className:j,children:e(i.Viewport,{})})})})]})})});
2
+ import{jsx as e,jsxs as n,Fragment as t}from"react/jsx-runtime";import*as a from"react";import{NavigationMenu as i}from"@base-ui/react/navigation-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{ChevronDownIcon as o}from"../../constants/icons.js";import{accentSlots as s}from"../../internal/accent.js";import{linkRel as l}from"../../internal/link.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{CONTROL_GAP as m,CONTROL_HEIGHT as d,CONTROL_ICON as p,CONTROL_PAD_X as u,CONTROL_TEXT as f,hasContent as h,META_TEXT as g}from"../../internal/scale.js";import{PORTAL_LAYER as x}from"../../internal/surface.js";import{useMPColor as v,useMPSize as N}from"../../internal/config.js";const y=/*@__PURE__*/a.createContext({size:"md",keepMounted:!1}),j=/*@__PURE__*/["mp-navigation-menu__popup rounded-mp-xs shadow-mp-2","bg-mp-surface-container text-mp-on-surface box-border overflow-hidden outline-none","transition-[opacity,width,height] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),b={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-2.5",xl:"p-3"};export const MPNavigationMenuLink=/*@__PURE__*/a.forwardRef(function({href:t,title:r,description:o,startIcon:s,target:d,rel:p,className:x,children:v,...N},j){const{size:b}=a.useContext(y);return n(i.Link,{ref:j,href:t,target:d,rel:l(d,p),className:["mp-navigation-menu__link group text-mp-on-surface rounded-mp-xs relative flex","min-w-0 cursor-pointer items-start bg-transparent py-2 no-underline outline-none",m[b],u[b],x??""].filter(Boolean).join(" "),...N,children:[e(c,{}),h(s)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:s}):null,n("span",{className:"relative flex min-w-0 flex-col gap-0.5",children:[e("span",{className:`font-medium ${f[b]}`,children:r}),h(o)?e("span",{className:`text-mp-on-surface-variant ${g}`,children:o}):null,v]})]})});export function MPNavigationMenuItem({label:s,href:g,target:x,rel:v,render:N,startIcon:j,value:M,disabled:k=!1,columns:w=1,children:P,className:_,style:z}){const{size:C,keepMounted:I}=a.useContext(y),L=void 0!==g&&!h(P),V=Number.isFinite(w)?Math.max(1,Math.round(w)):1,$=["mp-navigation-menu__item group text-mp-on-surface relative inline-flex shrink-0","rounded-mp-full cursor-pointer items-center justify-center bg-transparent","appearance-none border-0 font-[inherit] whitespace-nowrap no-underline select-none","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-colors duration-(--mp-sys-motion-duration-short4)","data-popup-open:text-(--_mp-accent)","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",d[C],f[C],m[C],u[C],_??""].filter(Boolean).join(" ");return e(i.Item,{value:M,children:L?n(i.Link,{href:g,target:x,rel:l(x,v),render:N,className:$,style:z,children:[e(c,{}),h(j)?e("span",{className:"relative flex",children:j}):null,e("span",{className:"relative",children:s})]}):n(t,{children:[n(i.Trigger,{disabled:k,className:$,style:z,children:[k?null:e(c,{className:"group-data-popup-open:opacity-8"}),h(j)?e("span",{className:"relative flex",children:j}):null,e("span",{className:"relative",children:s}),e(i.Icon,{className:["relative flex items-center transition-transform","duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-popup-open:rotate-180"].join(" "),children:e(r,{icon:o,size:p[C]})})]}),e(i.Content,{keepMounted:I,className:`mp-navigation-menu__panel grid gap-1 [&[hidden]]:hidden ${b[C]}`,style:V>1?{gridTemplateColumns:`repeat(${V}, minmax(0, 1fr))`}:void 0,children:P})]})})}export const MPNavigationMenu=/*@__PURE__*/a.forwardRef(function({orientation:t="horizontal",value:r,defaultValue:o,onValueChange:l,delay:c,closeDelay:d,sideOffset:p=8,size:u,color:f,keepMounted:h=!1,className:g,style:b,children:M,...k},w){const P=N(u),_=v(f),z=a.useMemo(()=>({size:P,keepMounted:h}),[P,h]);return e(y.Provider,{value:z,children:n(i.Root,{ref:w,orientation:t,value:r,defaultValue:o,onValueChange:e=>l?.(e),delay:c,closeDelay:d,"data-mp-size":P,className:["mp-navigation-menu",g??""].filter(Boolean).join(" "),style:{...s(_),...b},...k,children:[e(i.List,{className:["m-0 flex list-none items-center p-0","vertical"===t?"flex-col items-stretch":"flex-row",m[P]].join(" "),children:M}),e(i.Portal,{keepMounted:h,children:e(i.Positioner,{className:x,sideOffset:p,collisionPadding:12,style:s(_),children:e(i.Popup,{className:j,children:e(i.Viewport,{})})})})]})})});
@@ -50,7 +50,8 @@ export interface MPNumberFieldProps extends MPStyleProps, MPControlEventProps<HT
50
50
  */
51
51
  format?: Intl.NumberFormatOptions;
52
52
  /**
53
- * Which locale the number is written and parsed in. Defaults to the runtime's.
53
+ * Which locale the number is written and parsed in. Defaults to the nearest
54
+ * `MPLocaleProvider`, then to the runtime's own.
54
55
  *
55
56
  * A plain BCP 47 string also names the language the two steppers are announced
56
57
  * in; anything wider falls back to the nearest `MPLocaleProvider`, then to
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{NumberField as r}from"@base-ui/react/number-field";import{Field as a}from"@base-ui/react/field";import{MPIcon as t}from"../icon/MPIcon.js";import{AddIcon as i,RemoveIcon as o}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as p,useFloatingLabel as m}from"../../internal/FieldOutline.js";import{useMPLocale as d,useMPMessages as c}from"../../internal/locale.js";import{NUMBER_FIELD as u}from"../../internal/messages/number-field.js";import{MPStateLayer as f}from"../../internal/StateLayer.js";import{MPSupportingText as h}from"../../internal/SupportingText.js";import{CONTROL_ICON as x,PROSE_TEXT as g,hasContent as b}from"../../internal/scale.js";import{useMPSize as j}from"../../internal/config.js";const y={xs:{padding:"px-2",height:"h-8",stepper:"size-6"},sm:{padding:"px-3",height:"h-10",stepper:"size-8"},md:{padding:"px-4",height:"h-14",stepper:"size-10"},lg:{padding:"px-4",height:"h-16",stepper:"size-11"},xl:{padding:"px-5",height:"h-18",stepper:"size-12"}};export function MPNumberField({value:v,defaultValue:N,onValueChange:w,onValueCommitted:z,onKeyDown:C,onKeyUp:k,onFocus:S,onBlur:M,onClick:V,onDoubleClick:D,onContextMenu:F,min:I,max:q,step:B,largeStep:K,smallStep:L,allowWheelScrub:O=!1,format:P,locale:W,steppers:R="end",incrementLabel:U,decrementLabel:_,label:G,floatingLabel:T=!0,description:$,errorMessage:A,placeholder:E,startIcon:H,size:J,fullWidth:Q=!1,required:X=!1,disabled:Y=!1,readOnly:Z=!1,name:ee,id:ne,className:le,style:re}){const ae=j(J),te=c(u,d("string"==typeof W?W:void 0)),ie=b(A),oe=y[ae],se=l.useId(),pe=ne??se,me="none"!==R&&!Z&&!Y,[de,ce]=l.useState(N??null),ue=void 0===v?de:v,{shrunk:fe,focusProps:he}=m({floating:T&&b(G),filled:null!==ue,pinned:!!H||me&&"split"===R}),xe=/*@__PURE__*/["mp-number-field__stepper group relative flex shrink-0 items-center justify-center","rounded-mp-full cursor-pointer appearance-none border-0 bg-transparent p-0 font-[inherit]","text-mp-on-surface-variant outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default",oe.stepper].join(" "),ge=n(r.Decrement,{"aria-label":_??te.decrease,className:xe,children:[e(f,{}),e(t,{icon:o,size:x[ae]})]}),be=n(r.Increment,{"aria-label":U??te.increase,className:xe,children:[e(f,{}),e(t,{icon:i,size:x[ae]})]});return n(a.Root,{className:["mp-number-field group flex-col align-top",Q?"flex w-full":"inline-flex w-fit",le??""].filter(Boolean).join(" "),style:re,disabled:Y,invalid:ie,"data-mp-size":ae,...he,children:[e(r.Root,{id:pe,name:ee,className:"contents",value:v,defaultValue:N,onValueChange:e=>{ce(e),w?.(e)},onValueCommitted:e=>z?.(e),min:I,max:q,step:B,largeStep:K,smallStep:L,allowWheelScrub:O,format:P,locale:W,disabled:Y,readOnly:Z,required:X,children:n("div",{className:"relative w-full",children:[n(r.Group,{className:["flex w-full items-center gap-2",oe.height,me&&"end"===R?`${oe.padding} pe-1`:me&&"split"===R?"px-1":oe.padding].join(" "),children:[me&&"split"===R?ge:null,H?e("span",{className:["flex shrink-0 items-center",Y?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:H}):null,e(r.Input,{placeholder:fe?E:void 0,onKeyDown:C,onKeyUp:k,onFocus:S,onBlur:M,onClick:V,onDoubleClick:D,onContextMenu:F,className:["w-full min-w-0 flex-1 tabular-nums",g[ae],"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary text-mp-on-surface","placeholder:text-mp-on-surface-variant","disabled:text-mp-on-surface/38 disabled:placeholder:text-mp-on-surface/38",me&&"split"===R?"text-center":""].filter(Boolean).join(" ")}),me&&"end"===R?n("span",{className:"flex shrink-0 items-center",children:[ge,be]}):null,me&&"split"===R?be:null]}),e(p,{label:G,required:X,notched:fe}),b(G)?e(s,{size:ae,label:G,required:X,htmlFor:pe,shrunk:fe}):null]})}),e(h,{description:$,errorMessage:A,className:oe.padding})]})}
2
+ import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{NumberField as r}from"@base-ui/react/number-field";import{Field as a}from"@base-ui/react/field";import{MPIcon as t}from"../icon/MPIcon.js";import{AddIcon as i,RemoveIcon as o}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as p,useFloatingLabel as m}from"../../internal/FieldOutline.js";import{useMPLocale as d,useMPMessages as c}from"../../internal/locale.js";import{checkServerLocale as u,intlLocale as f}from"../../internal/intl.js";import{NUMBER_FIELD as h}from"../../internal/messages/number-field.js";import{MPStateLayer as g}from"../../internal/StateLayer.js";import{MPSupportingText as x}from"../../internal/SupportingText.js";import{CONTROL_ICON as b,PROSE_TEXT as j,hasContent as y}from"../../internal/scale.js";import{useMPSize as v}from"../../internal/config.js";const N={xs:{padding:"px-2",height:"h-8",stepper:"size-6"},sm:{padding:"px-3",height:"h-10",stepper:"size-8"},md:{padding:"px-4",height:"h-14",stepper:"size-10"},lg:{padding:"px-4",height:"h-16",stepper:"size-11"},xl:{padding:"px-5",height:"h-18",stepper:"size-12"}};export function MPNumberField({value:w,defaultValue:z,onValueChange:C,onValueCommitted:k,onKeyDown:S,onKeyUp:M,onFocus:V,onBlur:D,onClick:I,onDoubleClick:q,onContextMenu:B,min:F,max:K,step:L,largeStep:O,smallStep:P,allowWheelScrub:W=!1,format:R,locale:U,steppers:_="end",incrementLabel:G,decrementLabel:T,label:$,floatingLabel:A=!0,description:E,errorMessage:H,placeholder:J,startIcon:Q,size:X,fullWidth:Y=!1,required:Z=!1,disabled:ee=!1,readOnly:ne=!1,name:le,id:re,className:ae,style:te}){const ie=v(X),oe=d("string"==typeof U?U:void 0),se=c(h,oe);void 0===U&&u(oe);const pe=y(H),me=N[ie],de=l.useId(),ce=re??de,ue="none"!==_&&!ne&&!ee,[fe,he]=l.useState(z??null),ge=void 0===w?fe:w,{shrunk:xe,focusProps:be}=m({floating:A&&y($),filled:null!==ge,pinned:!!Q||ue&&"split"===_}),je=/*@__PURE__*/["mp-number-field__stepper group relative flex shrink-0 items-center justify-center","rounded-mp-full cursor-pointer appearance-none border-0 bg-transparent p-0 font-[inherit]","text-mp-on-surface-variant outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default",me.stepper].join(" "),ye=n(r.Decrement,{"aria-label":T??se.decrease,className:je,children:[e(g,{}),e(t,{icon:o,size:b[ie]})]}),ve=n(r.Increment,{"aria-label":G??se.increase,className:je,children:[e(g,{}),e(t,{icon:i,size:b[ie]})]});return n(a.Root,{className:["mp-number-field group flex-col align-top",Y?"flex w-full":"inline-flex w-fit",ae??""].filter(Boolean).join(" "),style:te,disabled:ee,invalid:pe,"data-mp-size":ie,...be,children:[e(r.Root,{id:ce,name:le,className:"contents",value:w,defaultValue:z,onValueChange:e=>{he(e),C?.(e)},onValueCommitted:e=>k?.(e),min:F,max:K,step:L,largeStep:O,smallStep:P,allowWheelScrub:W,format:R,locale:"string"==typeof U?f(U):U??f(oe),disabled:ee,readOnly:ne,required:Z,children:n("div",{className:"relative w-full",children:[n(r.Group,{className:["flex w-full items-center gap-2",me.height,ue&&"end"===_?`${me.padding} pe-1`:ue&&"split"===_?"px-1":me.padding].join(" "),children:[ue&&"split"===_?ye:null,Q?e("span",{className:["flex shrink-0 items-center",ee?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:Q}):null,e(r.Input,{placeholder:xe?J:void 0,onKeyDown:S,onKeyUp:M,onFocus:V,onBlur:D,onClick:I,onDoubleClick:q,onContextMenu:B,className:["w-full min-w-0 flex-1 tabular-nums",j[ie],"font-[family-name:var(--mp-sys-typescale-body-large-font)]","appearance-none border-0 bg-transparent px-0 outline-none","caret-mp-primary text-mp-on-surface","placeholder:text-mp-on-surface-variant","disabled:text-mp-on-surface/38 disabled:placeholder:text-mp-on-surface/38",ue&&"split"===_?"text-center":""].filter(Boolean).join(" ")}),ue&&"end"===_?n("span",{className:"flex shrink-0 items-center",children:[ye,ve]}):null,ue&&"split"===_?ve:null]}),e(p,{label:$,required:Z,notched:xe}),y($)?e(s,{size:ie,label:$,required:Z,shrunk:xe}):null]})}),e(x,{description:E,errorMessage:H,className:me.padding})]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Field as t}from"@base-ui/react/field";import{OTPField as o}from"@base-ui/react/otp-field";import{MPSupportingText as n}from"../../internal/SupportingText.js";import{META_TEXT as l,STACK_GAP as i,hasContent as m}from"../../internal/scale.js";import{useMPSize as s}from"../../internal/config.js";const u={xs:"h-8 w-7",sm:"h-10 w-9",md:"h-14 w-12",lg:"h-16 w-14",xl:"h-18 w-16"},d={xs:"text-mp-body-large",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},p={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2.5",xl:"gap-3"},c={numeric:"numeric",alpha:"alpha",alphanumeric:"alphanumeric",any:"none"};export const MPOtpField=/*@__PURE__*/a.forwardRef(function({size:f,fullWidth:h=!1,length:x=6,charset:g="numeric",mask:b=!1,groupSize:v,separator:y="–",value:j,defaultValue:w,onValueChange:M,onComplete:V,onValueInvalid:N,autoSubmit:C=!1,label:F,description:S,errorMessage:z,name:I,required:O=!1,disabled:R=!1,readOnly:$=!1,autoFocus:k=!1,className:q,style:T},A){const B=s(f),L=Math.min(12,Math.max(2,Math.round(x))),P=m(z),W=v&&v>0?Math.round(v):0,D=/*@__PURE__*/["rounded-mp-xs border bg-transparent text-center font-[inherit]",u[B],d[B],"transition-[border-color,color] duration-(--mp-sys-motion-duration-short4)","focus:border-2 focus:border-mp-primary focus:outline-none",R?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":P?"border-mp-error text-mp-on-surface caret-mp-error hover:border-mp-error":$?"border-mp-outline-variant text-mp-on-surface cursor-default":"border-mp-outline text-mp-on-surface caret-mp-primary hover:border-mp-on-surface"].join(" ");return r(t.Root,{disabled:R,invalid:P,"data-mp-size":B,className:["mp-otp-field flex-col align-top",i[B],h?"flex w-full":"inline-flex w-fit",q??""].filter(Boolean).join(" "),style:T,children:[m(F)?r(t.Label,{className:`${l} text-mp-on-surface-variant data-disabled:text-mp-on-surface/38 data-invalid:text-mp-error`,children:[F,O?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(o.Root,{ref:A,length:L,validationType:c[g],mask:b,name:I,required:O,disabled:R,readOnly:$,autoSubmit:C,value:j,defaultValue:w,onValueChange:e=>M?.(e),onValueComplete:e=>V?.(e),onValueInvalid:e=>N?.(e),className:`flex items-center ${p[B]}`,children:Array.from({length:L},(t,n)=>r(a.Fragment,{children:[W>0&&n>0&&n%W===0?e("span",{"aria-hidden":"true",className:`text-mp-on-surface-variant px-0.5 select-none ${d[B]}`,children:y}):null,e(o.Input,{className:D,autoFocus:k&&0===n})]},n))}),e(n,{description:S,errorMessage:z})]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Field as t}from"@base-ui/react/field";import{OTPField as o}from"@base-ui/react/otp-field";import{MPSupportingText as n}from"../../internal/SupportingText.js";import{META_TEXT as l,STACK_GAP as i,hasContent as s}from"../../internal/scale.js";import{useMPSize as m}from"../../internal/config.js";const u={xs:"h-8 w-7",sm:"h-10 w-9",md:"h-14 w-12",lg:"h-16 w-14",xl:"h-18 w-16"},d={xs:"text-mp-body-large",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},p={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2.5",xl:"gap-3"},c={numeric:"numeric",alpha:"alpha",alphanumeric:"alphanumeric",any:"none"};export const MPOtpField=/*@__PURE__*/a.forwardRef(function({size:f,fullWidth:h=!1,length:x=6,charset:g="numeric",mask:b=!1,groupSize:v,separator:y="–",value:j,defaultValue:w,onValueChange:M,onComplete:V,onValueInvalid:N,autoSubmit:C=!1,label:F,description:S,errorMessage:z,name:I,required:O=!1,disabled:R=!1,readOnly:$=!1,autoFocus:k=!1,className:q,style:T},A){const B=m(f),L=Math.min(12,Math.max(2,Math.round(x))),P=s(z),W=v&&v>0?Math.round(v):0,D=/*@__PURE__*/["rounded-mp-xs border bg-transparent text-center font-[inherit]",u[B],d[B],"transition-[border-color,color] duration-(--mp-sys-motion-duration-short4)","focus:border-mp-primary focus:inset-ring focus:inset-ring-mp-primary focus:outline-none",R?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":P?"border-mp-error text-mp-on-surface caret-mp-error hover:border-mp-error":$?"border-mp-outline-variant text-mp-on-surface cursor-default":"border-mp-outline text-mp-on-surface caret-mp-primary hover:border-mp-on-surface"].join(" ");return r(t.Root,{disabled:R,invalid:P,"data-mp-size":B,className:["mp-otp-field flex-col align-top",i[B],h?"flex w-full":"inline-flex w-fit",q??""].filter(Boolean).join(" "),style:T,children:[s(F)?r(t.Label,{className:`${l} text-mp-on-surface-variant data-disabled:text-mp-on-surface/38 data-invalid:text-mp-error`,children:[F,O?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(o.Root,{ref:A,length:L,validationType:c[g],mask:b,name:I,required:O,disabled:R,readOnly:$,autoSubmit:C,value:j,defaultValue:w,onValueChange:e=>M?.(e),onValueComplete:e=>V?.(e),onValueInvalid:e=>N?.(e),className:`flex items-center ${p[B]}`,children:Array.from({length:L},(t,n)=>r(a.Fragment,{children:[W>0&&n>0&&n%W===0?e("span",{"aria-hidden":"true",className:`text-mp-on-surface-variant px-0.5 select-none ${d[B]}`,children:y}):null,e(o.Input,{className:D,autoFocus:k&&0===n})]},n))}),e(n,{description:S,errorMessage:z})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as o from"react";import{useMPLocale as t,useMPMessages as n}from"../../internal/locale.js";import{LAYOUT as r}from"../../internal/messages/layout.js";import{MPPageLayoutContext as a,MPSidebarSideContext as i}from"../../internal/page-layout.js";import{hasContent as s}from"../../internal/scale.js";import{cssLength as u}from"../../internal/length.js";const p=["header","footer"];export const MPPageLayout=/*@__PURE__*/o.forwardRef(function({header:c,footer:f,sidebar:d,endSidebar:m,headerSpan:h="full",footerSpan:v="full",scroll:y="page",height:x="viewport",collapseBelow:b="expanded",sidebarOpen:g,defaultSidebarOpen:w=!1,onSidebarOpenChange:j,endSidebarOpen:_,defaultEndSidebarOpen:k=!1,onEndSidebarOpenChange:S,skipLink:P=!0,skipLabel:C,mainId:O="main",mainProps:N,locale:B,className:$,style:R,children:z,...E},I){const L=t(B),M=n(r,L),[H,T]=o.useState(w),[q,A]=o.useState(k),D=o.useMemo(()=>({start:g??H,end:_??q}),[g,H,_,q]),F=o.useCallback((e,l)=>{if("start"===e)return void 0===g&&T(l),void j?.(l);void 0===_&&A(l),S?.(l)},[g,_,j,S]),G=o.useRef(null),J=o.useCallback(e=>{G.current=e,"function"==typeof I?I(e):I&&(I.current=e)},[I]),K=o.useRef({header:null,footer:null}),Q=o.useRef(null),U=o.useCallback(()=>{const e=G.current;if(e)for(const l of p){const o=K.current[l],t="header"===l?h:v;if(!o){e.style.setProperty(`--_mp-layout-${l}`,"0px"),e.style.setProperty(`--_mp-layout-${l}-inset`,"0px");continue}const n=getComputedStyle(o).position,r=`${o.offsetHeight}px`,a="sticky"===n||"fixed"===n;e.style.setProperty(`--_mp-layout-${l}`,a&&"full"===t?r:"0px"),e.style.setProperty(`--_mp-layout-${l}-inset`,"fixed"===n?r:"0px")}},[h,v]),V=o.useCallback(()=>{const e=Q.current;if(e){e.disconnect();for(const l of p){const o=K.current[l];o&&e.observe(o)}}U()},[U]);o.useEffect(()=>(Q.current=new ResizeObserver(()=>U()),V(),()=>{Q.current?.disconnect(),Q.current=null}),[U,V]);const W=o.useCallback((e,l)=>{K.current[e]=l,V()},[V]),X=o.useMemo(()=>({present:!0,register:W,collapseBelow:b,open:D,setOpen:F,scroll:y,locale:L}),[W,b,D,F,y,L]),Y="content"===y,Z=u("viewport"===x||"auto"===x?void 0:x),ee=void 0!==Z?"":"auto"===x?Y?"h-full":"min-h-full":Y?"h-dvh":"min-h-dvh",le=s(c)?c:null,oe=s(f)?f:null;return e(a.Provider,{value:X,children:l("div",{ref:J,"data-mp-scroll":y,className:["mp-page-layout relative flex w-full flex-col",Y?"overflow-hidden":"",ee,"full"===h?"[padding-top:var(--_mp-layout-header-inset,0px)]":"","full"===v?"[padding-bottom:var(--_mp-layout-footer-inset,0px)]":"",$??""].filter(Boolean).join(" "),style:void 0===Z?R:{...Y?{height:Z}:{minHeight:Z},...R},...E,children:[P?e("a",{href:`#${O}`,className:["mp-page-layout__skip absolute start-3 top-3 z-50 size-px overflow-hidden","whitespace-nowrap [clip-path:inset(50%)]","focus:size-auto focus:overflow-visible focus:[clip-path:none]","focus:bg-mp-primary focus:text-mp-on-primary focus:rounded-mp-full","focus:shadow-mp-2 focus:text-mp-label-large focus:px-4 focus:py-2.5","focus:no-underline focus:outline-none"].join(" "),children:C??M.skipToContent}):null,"full"===h?le:null,l("div",{className:["flex w-full flex-1",Y?"min-h-0":""].filter(Boolean).join(" "),children:[s(d)?e(i.Provider,{value:"start",children:d}):null,l("div",{className:["flex min-w-0 flex-1 flex-col",Y?"min-h-0":"","content"===h?"[padding-top:var(--_mp-layout-header-inset,0px)]":"","content"===v?"[padding-bottom:var(--_mp-layout-footer-inset,0px)]":""].filter(Boolean).join(" "),children:["content"===h?le:null,e("main",{...N,id:O,tabIndex:N?.tabIndex??-1,className:["mp-page-layout__main min-w-0 flex-1",Y?"min-h-0 overflow-y-auto":"",N?.className??""].filter(Boolean).join(" "),children:z}),"content"===v?oe:null]}),s(m)?e(i.Provider,{value:"end",children:m}):null]}),"full"===v?oe:null]})})});
2
+ import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as o from"react";import{useMPLocale as t,useMPMessages as n}from"../../internal/locale.js";import{LAYOUT as r}from"../../internal/messages/layout.js";import{MPPageLayoutContext as a,MPSidebarSideContext as s}from"../../internal/page-layout.js";import{hasContent as i}from"../../internal/scale.js";import{cssLength as u}from"../../internal/length.js";const p=["header","footer"];export const MPPageLayout=/*@__PURE__*/o.forwardRef(function({header:c,footer:d,sidebar:f,endSidebar:m,headerSpan:h="full",footerSpan:v="full",scroll:y="page",height:x="viewport",collapseBelow:b="expanded",sidebarOpen:g,defaultSidebarOpen:w=!1,onSidebarOpenChange:_,endSidebarOpen:j,defaultEndSidebarOpen:k=!1,onEndSidebarOpenChange:S,skipLink:P=!0,skipLabel:C,mainId:O="main",mainProps:N,locale:B,className:$,style:R,children:z,...E},I){const L=t(B),M=n(r,L),[H,T]=o.useState(w),[q,A]=o.useState(k),D=o.useMemo(()=>({start:g??H,end:j??q}),[g,H,j,q]),F=o.useCallback((e,l)=>{if("start"===e)return void 0===g&&T(l),void _?.(l);void 0===j&&A(l),S?.(l)},[g,j,_,S]),G=o.useRef(null),J=o.useCallback(e=>{G.current=e,"function"==typeof I?I(e):I&&(I.current=e)},[I]),K=o.useRef({header:null,footer:null}),Q=o.useRef(null),U=o.useCallback(()=>{const e=G.current;if(e)for(const l of p){const o=K.current[l],t="header"===l?h:v;if(!o){e.style.setProperty(`--_mp-layout-${l}`,"0px"),e.style.setProperty(`--_mp-layout-${l}-inset`,"0px");continue}const n=getComputedStyle(o).position,r=`${o.offsetHeight}px`,a="sticky"===n||"fixed"===n;e.style.setProperty(`--_mp-layout-${l}`,a&&"full"===t?r:"0px"),e.style.setProperty(`--_mp-layout-${l}-inset`,"fixed"===n?r:"0px")}},[h,v]),V=o.useCallback(()=>{const e=Q.current;if(e){e.disconnect();for(const l of p){const o=K.current[l];o&&e.observe(o)}}U()},[U]);o.useEffect(()=>(Q.current=new ResizeObserver(()=>U()),V(),()=>{Q.current?.disconnect(),Q.current=null}),[U,V]);const W=o.useCallback((e,l)=>{K.current[e]=l,V()},[V]),X=o.useMemo(()=>({present:!0,register:W,collapseBelow:b,open:D,setOpen:F,scroll:y,locale:L}),[W,b,D,F,y,L]),Y="content"===y,Z=u("viewport"===x||"auto"===x?void 0:x),ee=void 0!==Z?"":"auto"===x?Y?"h-full":"min-h-full":Y?"h-dvh":"min-h-dvh",le=i(c)?c:null,oe=i(d)?d:null;return e(a.Provider,{value:X,children:l("div",{ref:J,"data-mp-scroll":y,className:["mp-page-layout relative flex w-full flex-col",Y?"overflow-hidden":"",ee,"full"===h?"[padding-top:var(--_mp-layout-header-inset,var(--_mp-layout-header-seed,0px))]":"","full"===v?"[padding-bottom:var(--_mp-layout-footer-inset,0px)]":"",$??""].filter(Boolean).join(" "),style:void 0===Z?R:{...Y?{height:Z}:{minHeight:Z},...R},...E,children:[P?e("a",{href:`#${O}`,className:["mp-page-layout__skip absolute start-3 top-3 z-50 size-px overflow-hidden","whitespace-nowrap [clip-path:inset(50%)]","focus:size-auto focus:overflow-visible focus:[clip-path:none]","focus:bg-mp-primary focus:text-mp-on-primary focus:rounded-mp-full","focus:shadow-mp-2 focus:text-mp-label-large focus:px-4 focus:py-2.5","focus:no-underline focus:outline-none"].join(" "),children:C??M.skipToContent}):null,"full"===h?le:null,l("div",{className:["flex w-full flex-1",Y?"min-h-0":""].filter(Boolean).join(" "),children:[i(f)?e(s.Provider,{value:"start",children:f}):null,l("div",{className:["flex min-w-0 flex-1 flex-col",Y?"min-h-0":"","content"===h?"[padding-top:var(--_mp-layout-header-inset,var(--_mp-layout-header-seed,0px))]":"","content"===v?"[padding-bottom:var(--_mp-layout-footer-inset,0px)]":""].filter(Boolean).join(" "),children:["content"===h?le:null,e("main",{...N,id:O,tabIndex:N?.tabIndex??-1,className:["mp-page-layout__main min-w-0 flex-1",Y?"min-h-0 overflow-y-auto":"",N?.className??""].filter(Boolean).join(" "),children:z}),"content"===v?oe:null]}),i(m)?e(s.Provider,{value:"end",children:m}):null]}),"full"===v?oe:null]})})});
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import type { useRender } from '@base-ui/react/use-render';
2
3
  import { type MPMessages } from '../../internal/i18n.js';
3
4
  import type { MPColor, MPStyleProps } from '../../types.js';
4
5
  /** The words the row says on its own behalf. */
@@ -61,6 +62,13 @@ export interface MPPaginationProps extends MPStyleProps, Omit<React.ComponentPro
61
62
  * client-side router keeps the page it already has.
62
63
  */
63
64
  getPageHref?: (page: number) => string;
65
+ /**
66
+ * Renders each page's link as something else — a router's `Link`, so moving
67
+ * between pages is a client-side navigation and the next one is prefetched.
68
+ * The `href` from `getPageHref` still goes through, along with `rel` and the
69
+ * classes. Only read alongside `getPageHref`; without it there are no links.
70
+ */
71
+ renderLink?: useRender.RenderProp;
64
72
  /**
65
73
  * Which language the row names itself in — a BCP 47 tag such as `ko`, `pt-BR`
66
74
  * or `zh-Hant`. Unsupported tags fall back to English.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{MPIcon as a}from"../icon/MPIcon.js";import{ChevronLeftIcon as i,ChevronRightIcon as r,ChevronsLeftIcon as l,ChevronsRightIcon as o}from"../../constants/icons.js";import{accentSlots as s}from"../../internal/accent.js";import{fillMessage as m}from"../../internal/i18n.js";import{useMPLocale as c,useMPMessages as p}from"../../internal/locale.js";import{PAGINATION as u}from"../../internal/messages/pagination.js";import{MPStateLayer as f}from"../../internal/StateLayer.js";import{CONTROL_ICON as d,CONTROL_TEXT as h}from"../../internal/scale.js";import{VISUALLY_HIDDEN as g}from"../../internal/visually-hidden.js";import{useMPColor as x,useMPSize as b}from"../../internal/config.js";const j={xs:"h-8 min-w-8 px-1.5",sm:"h-10 min-w-10 px-2",md:"h-14 min-w-14 px-2.5",lg:"h-16 min-w-16 px-3",xl:"h-18 min-w-18 px-3.5"},v={xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"};function y(e,n){return Array.from({length:Math.max(0,n-e+1)},(n,t)=>e+t)}export const MPPagination=/*@__PURE__*/t.forwardRef(function({count:M,page:w,defaultPage:N=1,onPageChange:P,siblingCount:C=1,boundaryCount:S=1,showEdges:K=!1,showArrows:_=!0,size:k,color:z,fullWidth:$=!1,disabled:A=!1,getPageHref:B,locale:D,labels:E,className:H,style:I,...L},R){const W=b(k),q=x(z),F=c(D),G=p(u,F,E),[J,O]=t.useState(N),Q=void 0!==w,T=Math.min(Math.max(w??J,1),Math.max(M,1));if(M<2)return null;const U=function(e,n,t,a){const i=y(1,Math.min(a,e)),r=y(Math.max(e-a+1,a+1),e),l=Math.max(Math.min(n-t,e-a-2*t-1),a+2),o=Math.min(Math.max(n+t,a+2*t+2),r.length>0?r[0]-2:e-1);return[...i,...l>a+2?["start-ellipsis"]:a+1<e-a?[a+1]:[],...y(l,o),...o<e-a-1?["end-ellipsis"]:e-a>a?[e-a]:[],...r]}(M,T,C,S),V=T<=1,X=T>=M,Y=(e,n)=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||B&&!P||(e.preventDefault(),(e=>{const n=Math.min(Math.max(e,1),M);n!==T&&(Q||O(n),P?.(n))})(n))},Z=(e,n)=>["mp-pagination__cell group relative inline-flex items-center justify-center","rounded-mp-full box-border appearance-none overflow-hidden align-middle select-none","border-0 font-[inherit] tabular-nums whitespace-nowrap no-underline","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none",j[W],h[W],n?"text-mp-on-surface/38 cursor-default bg-transparent":e?"bg-(--_mp-accent) text-(--_mp-on-accent) cursor-pointer":"text-mp-on-surface cursor-pointer bg-transparent"].join(" "),ee=(t,a,i,r,l,o,s)=>e("li",{className:"flex",children:!B||i||r?n("button",{type:"button",disabled:i,"aria-label":l,"aria-current":r?"page":void 0,className:Z(r,i),onClick:e=>Y(e,a),children:[i?null:e(f,{}),e("span",{className:"relative",children:o})]}):n("a",{href:B(a),rel:s,"aria-label":l,className:Z(!1,!1),onClick:e=>Y(e,a),children:[e(f,{}),e("span",{className:"relative",children:o})]})},t),ne=n=>e(a,{icon:n,size:d[W],className:"rtl:rotate-180"});return n("nav",{ref:R,"aria-label":G.label,"data-mp-size":W,className:["mp-pagination flex",$?"w-full justify-center":"",H??""].filter(Boolean).join(" "),style:{...s(q),...I},...L,children:[n("ul",{role:"list",className:`m-0 flex list-none items-center p-0 ${v[W]}`,children:[K?ee("first",1,A||V,!1,G.first,ne(l)):null,_?ee("previous",T-1,A||V,!1,G.previous,ne(i),"prev"):null,U.map((n,t)=>"number"==typeof n?ee(`slot-${t}`,n,A,n===T,m(G.page,{page:String(n)}),n):e("li",{"aria-hidden":"true",className:["text-mp-on-surface-variant flex items-center justify-center select-none",j[W],h[W]].join(" "),children:"…"},`slot-${t}`)),_?ee("next",T+1,A||X,!1,G.next,ne(r),"next"):null,K?ee("last",M,A||X,!1,G.last,ne(o)):null]}),e("span",{className:g,"aria-live":"polite",children:m(G.status,{page:String(T),total:String(M)})})]})});
2
+ import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{RenderedLink as r}from"../../internal/RenderedLink.js";import{MPIcon as i}from"../icon/MPIcon.js";import{ChevronLeftIcon as l,ChevronRightIcon as o,ChevronsLeftIcon as s,ChevronsRightIcon as m}from"../../constants/icons.js";import{accentSlots as c}from"../../internal/accent.js";import{fillMessage as p}from"../../internal/i18n.js";import{useMPLocale as u,useMPMessages as f}from"../../internal/locale.js";import{PAGINATION as d}from"../../internal/messages/pagination.js";import{MPStateLayer as h}from"../../internal/StateLayer.js";import{CONTROL_ICON as g,CONTROL_TEXT as x}from"../../internal/scale.js";import{VISUALLY_HIDDEN as b}from"../../internal/visually-hidden.js";import{useMPColor as j,useMPSize as v}from"../../internal/config.js";const y={xs:"h-8 min-w-8 px-1.5",sm:"h-10 min-w-10 px-2",md:"h-14 min-w-14 px-2.5",lg:"h-16 min-w-16 px-3",xl:"h-18 min-w-18 px-3.5"},M={xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"};function w(e,n){return Array.from({length:Math.max(0,n-e+1)},(n,t)=>e+t)}export const MPPagination=/*@__PURE__*/a.forwardRef(function({count:N,page:P,defaultPage:k=1,onPageChange:C,siblingCount:S=1,boundaryCount:K=1,showEdges:_=!1,showArrows:z=!0,size:L,color:$,fullWidth:A=!1,disabled:R=!1,getPageHref:B,renderLink:D,locale:E,labels:F,className:H,style:I,...W},q){const G=v(L),J=j($),O=u(E),Q=f(d,O,F),[T,U]=a.useState(k),V=void 0!==P,X=Math.min(Math.max(P??T,1),Math.max(N,1));if(N<2)return null;const Y=function(e,n,t,a){const r=w(1,Math.min(a,e)),i=w(Math.max(e-a+1,a+1),e),l=Math.max(Math.min(n-t,e-a-2*t-1),a+2),o=Math.min(Math.max(n+t,a+2*t+2),i.length>0?i[0]-2:e-1);return[...r,...l>a+2?["start-ellipsis"]:a+1<e-a?[a+1]:[],...w(l,o),...o<e-a-1?["end-ellipsis"]:e-a>a?[e-a]:[],...i]}(N,X,S,K),Z=X<=1,ee=X>=N,ne=(e,n)=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||B&&!C||(e.preventDefault(),(e=>{const n=Math.min(Math.max(e,1),N);n!==X&&(V||U(n),C?.(n))})(n))},te=(e,n)=>["mp-pagination__cell group relative inline-flex items-center justify-center","rounded-mp-full box-border appearance-none overflow-hidden align-middle select-none","border-0 font-[inherit] tabular-nums whitespace-nowrap no-underline","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none",y[G],x[G],n?"text-mp-on-surface/38 cursor-default bg-transparent":e?"bg-(--_mp-accent) text-(--_mp-on-accent) cursor-pointer":"text-mp-on-surface cursor-pointer bg-transparent"].join(" "),ae=(a,i,l,o,s,m,c)=>e("li",{className:"flex",children:!B||l||o?t("button",{type:"button",disabled:l,"aria-label":s,"aria-current":o?"page":void 0,className:te(o,l),onClick:e=>ne(e,i),children:[l?null:e(h,{}),e("span",{className:"relative",children:m})]}):e(r,{render:D,props:{href:B(i),rel:c,"aria-label":s,className:te(!1,!1),onClick:e=>ne(e,i),children:t(n,{children:[e(h,{}),e("span",{className:"relative",children:m})]})}})},a),re=n=>e(i,{icon:n,size:g[G],className:"rtl:rotate-180"});return t("nav",{ref:q,"aria-label":Q.label,"data-mp-size":G,className:["mp-pagination flex",A?"w-full justify-center":"",H??""].filter(Boolean).join(" "),style:{...c(J),...I},...W,children:[t("ul",{role:"list",className:`m-0 flex list-none items-center p-0 ${M[G]}`,children:[_?ae("first",1,R||Z,!1,Q.first,re(s)):null,z?ae("previous",X-1,R||Z,!1,Q.previous,re(l),"prev"):null,Y.map((n,t)=>"number"==typeof n?ae(`slot-${t}`,n,R,n===X,p(Q.page,{page:String(n)}),n):e("li",{"aria-hidden":"true",className:["text-mp-on-surface-variant flex items-center justify-center select-none",y[G],x[G]].join(" "),children:"…"},`slot-${t}`)),z?ae("next",X+1,R||ee,!1,Q.next,re(o),"next"):null,_?ae("last",N,R||ee,!1,Q.last,re(m)):null]}),e("span",{className:b,"aria-live":"polite",children:p(Q.status,{page:String(X),total:String(N)})})]})});
@@ -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{accentSlots as r}from"../../internal/accent.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPColor as i,useMPSize as a}from"../../internal/config.js";const s=/*@__PURE__*/n.createContext({basis:null,id:null}),l={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},c={xs:4,sm:6,md:8,lg:10,xl:12};function u(e,t,n){if(null!=e)return"number"==typeof e?t*e/100:o(e,t,n)}export const MPPanes=/*@__PURE__*/n.forwardRef(function({orientation:o="horizontal",resizable:d=!0,color:m,size:f,onResize:p,onResizeEnd:h,className:g,style:v,children:x,...y},b){const w=i(m),z=a(f),S=n.Children.toArray(x).filter(n.isValidElement),j=S.length,E=n.useId(),R=n.useRef(null),M=n.useCallback(e=>{R.current=e,"function"==typeof b?b(e):b&&(b.current=e)},[b]),k=n.useRef([]),C=S.map(e=>e.props),[L,P]=n.useState(null),$=L&&L.length===j?L:null,_=n.useRef(null);n.useLayoutEffect(()=>{k.current=C,_.current=$});const B=n.useRef(null);n.useEffect(()=>()=>{null!==B.current&&(document.body.style.userSelect=B.current,B.current=null)},[]);const N="horizontal"===o,A=c[z]*Math.max(0,j-1);function D(e){const t=R.current,n=_.current;if(!d||!t||!n||void 0===n[e+1])return null;const r=t.getBoundingClientRect(),o=(N?r.width:r.height)-A;if(o<=0)return null;const i=k.current[e],a=k.current[e+1],s=n[e]*o,l=s+n[e+1]*o,c=Math.max(u(i?.minSize,o,t)??0,l-(u(a?.maxSize,o,t)??l)),m=Math.min(u(i?.maxSize,o,t)??l,l-(u(a?.minSize,o,t)??0));return m<c?null:{root:t,current:n,lower:c,upper:m,start:s,resize(t){const r=Math.min(m,Math.max(c,s+t)),i=[...n];return i[e]=r/o,i[e+1]=(l-r)/o,P(i),p?.(i.map(e=>100*e)),i}}}n.useEffect(()=>{const e=R.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect(),n=(N?t.width:t.height)-A;n<=0||P(t=>t&&t.length===j?t:function(e,t,n){const r=e.map(e=>u(e.defaultSize,t,n)),o=r.reduce((e,t)=>e+(t??0),0),i=r.filter(e=>void 0===e).length,a=i>0?Math.max(0,t-o)/i:0,s=r.map(e=>Math.max(0,e??a)),l=s.reduce((e,t)=>e+t,0);return l<=0?s.map(()=>1/Math.max(1,s.length)):s.map(e=>e/l)}(k.current,n,e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[j,N,A]);const I=["mp-panes__handle group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",l[z],"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",d?[N?"cursor-col-resize":"cursor-row-resize","hover:bg-(--_mp-accent)/8 data-[dragging]:bg-(--_mp-accent)/10"].join(" "):""].filter(Boolean).join(" ");return e("div",{ref:M,"data-mp-size":z,className:["mp-panes flex h-full w-full",N?"flex-row":"flex-col","min-h-0 min-w-0",g??""].filter(Boolean).join(" "),style:{...r(w),...v},...y,children:S.map((r,o)=>t(n.Fragment,{children:[o>0?e("div",{role:"separator","aria-orientation":N?"vertical":"horizontal","aria-valuenow":$?Math.round(100*$[o-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!d||void 0,"aria-controls":`${E}-${o-1}`,tabIndex:d?0:-1,className:I,onPointerDown:e=>{0===e.button&&function(e,t){const n=D(e);if(!n)return;const r=t.currentTarget;try{r.setPointerCapture(t.pointerId)}catch{}r.dataset.dragging="true";const o=document.body.style.userSelect;B.current=o,document.body.style.userSelect="none";const i=N?t.clientX:t.clientY,a=N&&"rtl"===getComputedStyle(n.root).direction?-1:1;let s=n.current;const l=e=>{const t=N?e.clientX:e.clientY;s=n.resize((t-i)*a)},c=()=>{r.removeEventListener("pointermove",l),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,document.body.style.userSelect=o,B.current=null,h?.(s.map(e=>100*e))};r.addEventListener("pointermove",l),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)}(o-1,e)},onKeyDown:e=>{const t=N?"ArrowLeft":"ArrowUp",n=N?"ArrowRight":"ArrowDown";if(e.key===t||e.key===n){e.preventDefault();const t=N&&"rtl"===getComputedStyle(e.currentTarget).direction?-1:1;return void function(e,t){const n=D(e);if(!n)return;const r=n.resize(t);h?.(r.map(e=>100*e))}(o-1,(e.key===n?16:-16)*t)}"Home"!==e.key&&"End"!==e.key||(e.preventDefault(),function(e,t){const n=D(e);if(!n)return;const r=n.resize(n[t]-n.start);h?.(r.map(e=>100*e))}(o-1,"Home"===e.key?"lower":"upper"))},children:e("span",{"aria-hidden":"true",className:["bg-mp-outline-variant pointer-events-none","transition-colors duration-(--mp-sys-motion-duration-short4)",N?"h-full w-px":"h-px w-full",d?["group-hover/handle:bg-(--_mp-accent)","group-focus-visible/handle:bg-(--_mp-accent)","group-data-[dragging]/handle:bg-(--_mp-accent)"].join(" "):""].filter(Boolean).join(" ")})}):null,e(s.Provider,{value:{basis:$?`calc((100% - ${A}px) * ${$[o].toFixed(6)})`:null,id:`${E}-${o}`},children:r})]},r.key??o))})});export const MPPane=/*@__PURE__*/n.forwardRef(function({defaultSize:t,minSize:r,maxSize:o,className:i,style:a,children:l,...c},u){const{basis:d,id:m}=n.useContext(s);return e("div",{ref:u,id:m??void 0,className:["mp-pane relative min-h-0 min-w-0 overflow-auto",i??""].filter(Boolean).join(" "),style:{flex:d?`0 0 ${d}`:"1 1 0%",...a},...c,children:l})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{accentSlots as r}from"../../internal/accent.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPColor as i,useMPSize as l}from"../../internal/config.js";const s=/*@__PURE__*/n.createContext({basis:null,seed:null,id:null}),a={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},u={xs:4,sm:6,md:8,lg:10,xl:12};function c(e,t,n){if(null!=e)return"number"==typeof e?t*e/100:o(e,t,n)}const d=/^\s*(-?[\d.]+)\s*%\s*$/,m=/^\s*-?[\d.]+\s*(px|rem|em)\s*$/;export const MPPanes=/*@__PURE__*/n.forwardRef(function({orientation:o="horizontal",resizable:f=!0,color:p,size:h,onResize:g,onResizeEnd:v,className:x,style:y,children:b,...z},w){const S=i(p),$=l(h),j=n.Children.toArray(b).filter(n.isValidElement),E=j.length,M=n.useId(),R=n.useRef(null),k=n.useCallback(e=>{R.current=e,"function"==typeof w?w(e):w&&(w.current=e)},[w]),C=n.useRef([]),L=j.map(e=>e.props),[N,P]=n.useState(null),_=N&&N.length===E?N:null,B=n.useRef(null);n.useLayoutEffect(()=>{C.current=L,B.current=_});const A=n.useRef(null);n.useEffect(()=>()=>{null!==A.current&&(document.body.style.userSelect=A.current,A.current=null)},[]);const D="horizontal"===o,F=u[$]*Math.max(0,E-1),I=_?[]:function(e,t){const n=e.map(({defaultSize:e})=>{if("number"==typeof e)return e;const t="string"==typeof e?d.exec(e):null;return t?Number(t[1]):null}),r=`(100% - ${t}px)`;if(n.every(e=>null!==e&&e>0)){const e=n.reduce((e,t)=>e+(t??0),0);return n.map(t=>`0 0 calc(${r} * ${((t??0)/e).toFixed(6)})`)}return e.map(({defaultSize:e},t)=>{const o=n[t];return null!==o?`0 1 calc(${r} * ${(Math.max(0,o)/100).toFixed(6)})`:"string"==typeof e&&m.test(e)?`0 1 ${e.trim()}`:null})}(L,F);function H(e){const t=R.current,n=B.current;if(!f||!t||!n||void 0===n[e+1])return null;const r=t.getBoundingClientRect(),o=(D?r.width:r.height)-F;if(o<=0)return null;const i=C.current[e],l=C.current[e+1],s=n[e]*o,a=s+n[e+1]*o,u=Math.max(c(i?.minSize,o,t)??0,a-(c(l?.maxSize,o,t)??a)),d=Math.min(c(i?.maxSize,o,t)??a,a-(c(l?.minSize,o,t)??0));return d<u?null:{root:t,current:n,lower:u,upper:d,start:s,resize(t){const r=Math.min(d,Math.max(u,s+t)),i=[...n];return i[e]=r/o,i[e+1]=(a-r)/o,P(i),g?.(i.map(e=>100*e)),i}}}n.useEffect(()=>{const e=R.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect(),n=(D?t.width:t.height)-F;n<=0||P(t=>t&&t.length===E?t:function(e,t,n){const r=e.map(e=>c(e.defaultSize,t,n)),o=r.reduce((e,t)=>e+(t??0),0),i=r.filter(e=>void 0===e).length,l=i>0?Math.max(0,t-o)/i:0,s=r.map(e=>Math.max(0,e??l)),a=s.reduce((e,t)=>e+t,0);return a<=0?s.map(()=>1/Math.max(1,s.length)):s.map(e=>e/a)}(C.current,n,e))};t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[E,D,F]);const T=["mp-panes__handle group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",a[$],"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",f?[D?"cursor-col-resize":"cursor-row-resize","hover:bg-(--_mp-accent)/8 data-[dragging]:bg-(--_mp-accent)/10"].join(" "):""].filter(Boolean).join(" ");return e("div",{ref:k,"data-mp-size":$,className:["mp-panes flex h-full w-full",D?"flex-row":"flex-col","min-h-0 min-w-0",x??""].filter(Boolean).join(" "),style:{...r(S),...y},...z,children:j.map((r,o)=>t(n.Fragment,{children:[o>0?e("div",{role:"separator","aria-orientation":D?"vertical":"horizontal","aria-valuenow":_?Math.round(100*_[o-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!f||void 0,"aria-controls":`${M}-${o-1}`,tabIndex:f?0:-1,className:T,onPointerDown:e=>{0===e.button&&function(e,t){const n=H(e);if(!n)return;const r=t.currentTarget;try{r.setPointerCapture(t.pointerId)}catch{}r.dataset.dragging="true";const o=document.body.style.userSelect;A.current=o,document.body.style.userSelect="none";const i=D?t.clientX:t.clientY,l=D&&"rtl"===getComputedStyle(n.root).direction?-1:1;let s=n.current;const a=e=>{const t=D?e.clientX:e.clientY;s=n.resize((t-i)*l)},u=()=>{r.removeEventListener("pointermove",a),r.removeEventListener("pointerup",u),r.removeEventListener("pointercancel",u),delete r.dataset.dragging,document.body.style.userSelect=o,A.current=null,v?.(s.map(e=>100*e))};r.addEventListener("pointermove",a),r.addEventListener("pointerup",u),r.addEventListener("pointercancel",u)}(o-1,e)},onKeyDown:e=>{const t=D?"ArrowLeft":"ArrowUp",n=D?"ArrowRight":"ArrowDown";if(e.key===t||e.key===n){e.preventDefault();const t=D&&"rtl"===getComputedStyle(e.currentTarget).direction?-1:1;return void function(e,t){const n=H(e);if(!n)return;const r=n.resize(t);v?.(r.map(e=>100*e))}(o-1,(e.key===n?16:-16)*t)}"Home"!==e.key&&"End"!==e.key||(e.preventDefault(),function(e,t){const n=H(e);if(!n)return;const r=n.resize(n[t]-n.start);v?.(r.map(e=>100*e))}(o-1,"Home"===e.key?"lower":"upper"))},children:e("span",{"aria-hidden":"true",className:["bg-mp-outline-variant pointer-events-none","transition-colors duration-(--mp-sys-motion-duration-short4)",D?"h-full w-px":"h-px w-full",f?["group-hover/handle:bg-(--_mp-accent)","group-focus-visible/handle:bg-(--_mp-accent)","group-data-[dragging]/handle:bg-(--_mp-accent)"].join(" "):""].filter(Boolean).join(" ")})}):null,e(s.Provider,{value:{basis:_?`calc((100% - ${F}px) * ${_[o].toFixed(6)})`:null,seed:I[o]??null,id:`${M}-${o}`},children:r})]},r.key??o))})});export const MPPane=/*@__PURE__*/n.forwardRef(function({defaultSize:t,minSize:r,maxSize:o,className:i,style:l,children:a,...u},c){const{basis:d,seed:m,id:f}=n.useContext(s);return e("div",{ref:c,id:f??void 0,className:["mp-pane relative min-h-0 min-w-0 overflow-auto",i??""].filter(Boolean).join(" "),style:{flex:d?`0 0 ${d}`:m??"1 1 0%",...l},...u,children:a})});
@@ -28,6 +28,28 @@ export interface MPPieChartProps extends ChartBaseProps {
28
28
  * @default 0
29
29
  */
30
30
  startAngle?: number;
31
+ /**
32
+ * How much of the radius the hole takes, from `0` to `0.9`.
33
+ *
34
+ * Read by `donut` and `semi` only: `pie` is the word for a shape with no hole
35
+ * in it, and a filled disc with a `hole` would be a donut under another name.
36
+ *
37
+ * Thinner than about `0.4` and the ring stops reading as a ring; past `0.8`
38
+ * the slices are a hairline and their angles stop being comparable at all.
39
+ * The default leaves a hole wide enough for a figure and a word.
40
+ * @default 0.62
41
+ */
42
+ hole?: number;
43
+ /**
44
+ * How much page shows between two slices, in pixels. `0` lets them touch.
45
+ *
46
+ * It is drawn as a stroke in the surface's colour rather than by narrowing
47
+ * each sweep, so every slice keeps the angle its share earned however wide
48
+ * the gap is set. Past about a tenth of the radius the strokes start eating
49
+ * the small slices, which is the point at which a pie is the wrong chart.
50
+ * @default 2
51
+ */
52
+ gap?: number;
31
53
  /**
32
54
  * What goes in the hole. A ring with nothing in the middle is a pie with a
33
55
  * bite taken out of it — the total, or the one figure the chart is about, is
@@ -74,4 +96,4 @@ export interface MPPieChartProps extends ChartBaseProps {
74
96
  * A chart that is refiltered or resorted keeps every category the colour it had
75
97
  * — which is the whole reason a legend is worth reading twice.
76
98
  */
77
- export declare function MPPieChart({ data, categories, shape, startAngle, center, valueLabels, height, format, locale: localeProp, label, legend, tooltip, empty, size: sizeProp, className, style, ...rest }: MPPieChartProps): React.JSX.Element;
99
+ export declare function MPPieChart({ data, categories, shape, startAngle, hole, gap, center, valueLabels, height, format, locale: localeProp, label, legend, tooltip, empty, labelColor, size: sizeProp, className, style, ...rest }: MPPieChartProps): React.JSX.Element;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useMPElementSize as n}from"../../hooks/useMPElementSize.js";import{useMPLocale as o,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as a}from"../../internal/config.js";import{numberFormatter as i}from"../../internal/intl.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartLegend as c,ChartShell as h,ChartTable as u,ChartTooltipPanel as d,useVisibility as f}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as p,MARK_GAP as v,PLOT_HEIGHT as g,arcPath as y,categoryAt as x,formatCategory as b,formatStatistic as M,polarPoint as j,seriesColor as P,toValues as k}from"../../internal/chart.js";const w={style:"percent",maximumFractionDigits:1};export function MPPieChart({data:I,categories:z,shape:A="pie",startAngle:B=0,center:N,valueLabels:C="none",height:D,format:L,locale:R,label:S,legend:$,tooltip:_,empty:E,size:F,className:K,style:O,...U}){const W=a(F),X=o(R),Y=r(s,X),q=r(m,X),G=l.useRef(null),H=n(G),J=l.useId(),Q=l.useMemo(()=>k([{data:I}])[0],[I]),T=f(l.useMemo(()=>Q.map(()=>({})),[Q])),[V,Z]=l.useState(null),ee=l.useCallback(e=>M(e,X,L,!0),[L,X]),te=l.useMemo(()=>Q.map((e,t)=>b(x(t,z,[Q]),X)),[Q,z,X]),le=l.useMemo(()=>Q.map((e,t)=>e.color??P(t,void 0)),[Q]),ne=Q.map((e,t)=>T.visible[t]&&null!==e.value&&e.value>0?e.value:0),oe=ne.reduce((e,t)=>e+t,0),re=H.width,ae="number"==typeof D?D:void 0===D?g[W]:H.height,ie=p[W],se="semi"===A,me=re/2,ce=se?ae-ie-4:ae/2,he=Math.max(0,se?Math.min(re/2,ae-ie-8)-2:Math.min(re,ae)/2-2),ue="pie"===A?0:.62*he,de=se?Math.PI:2*Math.PI;let fe=se?-Math.PI/2:B*Math.PI/180;const pe=ne.map(e=>{const t=fe;return fe+=oe>0?e/oe*de:0,{from:t,to:fe,share:e}}),ve=e=>{const t=pe.map((e,t)=>e.share>0?t:-1).filter(e=>e>=0);if(0===t.length)return;const l=null===V?e>0?-1:0:t.indexOf(V);Z(t[(l+e+t.length)%t.length])},ge=e=>oe>0?i(X,w).format(e/oe):"",ye=null===V?null:pe[V],xe=ye&&ye.share>0?[{seriesIndex:V,color:le[V],value:ye.share,formatted:`${ee(ye.share)} · ${ge(ye.share)}`,label:Q[V]?.label}]:[],be=ye&&ye.share>0?te[V]:void 0,Me=ye?j(me,ce,.75*he,(ye.from+ye.to)/2):null,je=!1===_?{mode:"none"}:!0===_||void 0===_?{}:_,Pe=!1===$?{interactive:!1}:!0===$||void 0===$?{}:$,ke=!1!==$&&Q.length>1,we=oe<=0,Ie=[Q];return t(h,{...U,size:W,className:["mp-pie-chart",K??""].filter(Boolean).join(" "),style:O,plotRef:G,name:S??Y.label,describedBy:we?void 0:J,interactive:!we,height:D,legendSide:Pe.side??"bottom",plotProps:{onPointerMove:we||"none"===je.mode?void 0:e=>Z(((e,t)=>{const l=G.current;if(!l||oe<=0)return null;const n=l.getBoundingClientRect(),o=e-n.left-me,r=t-n.top-ce,a=Math.hypot(o,r);if(a>he+8||a<ue)return null;const i=Math.atan2(o,-r),s=pe.findIndex(({from:e,to:t,share:l})=>!(l<=0)&&(i-e+4*Math.PI)%(2*Math.PI)<t-e);return-1===s?null:s})(e.clientX,e.clientY)),onPointerLeave:()=>Z(null),onKeyDown:we||"none"===je.mode?void 0:e=>{if("ArrowRight"===e.key||"ArrowDown"===e.key)ve(1);else if("ArrowLeft"===e.key||"ArrowUp"===e.key)ve(-1);else{if("Escape"!==e.key)return;Z(null)}e.preventDefault()},onBlur:()=>Z(null)},tooltip:Me&&xe.length>0&&"none"!==je.mode?e(d,{heading:be,items:xe,x:Me.x,y:Me.y,flip:Me.x>me,size:W}):null,legend:ke?e(c,{names:te,colors:le,options:Pe,visibility:T,size:W}):null,status:{heading:be,items:xe},table:we?null:e(u,{id:J,caption:S??Y.table,corner:Y.category,categories:te,names:[S??Y.table],values:Ie,format:ee,locale:X,empty:q.empty}),children:[we?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:E??q.empty}):re>0&&ae>0?e("svg",{width:re,height:ae,viewBox:`0 0 ${re} ${ae}`,"aria-hidden":"true",className:"block overflow-visible",children:t("g",{className:"mp-pie-chart__slices",children:[pe.map((t,l)=>{if(t.share<=0)return null;return e("path",{d:y(me,ce,V===l?he+3:he,ue,t.from,t.to),fill:le[l],stroke:"var(--_mp-color-surface)",strokeWidth:v,strokeLinejoin:"round",opacity:null===T.hovered||T.hovered===l?1:.35},l)}),"all"===C?pe.map((t,l)=>{const n=ge(t.share),o=t.to-t.from,r=j(me,ce,ue>0?(he+ue)/2:.68*he,(t.from+t.to)/2),a=o*(ue>0?(he+ue)/2:.68*he);return t.share<=0||a<n.length*ie*.6+8?null:e("text",{x:r.x,y:r.y,textAnchor:"middle",dominantBaseline:"central",fill:"var(--_mp-color-on-surface)",fontSize:ie,children:n},l)}):null]})}):null,null==N||"pie"===A||we?null:e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:me-ue,top:ce-ue,width:2*ue,height:se?ue:2*ue},children:N})]})}
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useBoxSize as n}from"../../internal/box-size.js";import{useMPLocale as o,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as a}from"../../internal/config.js";import{numberFormatter as i}from"../../internal/intl.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartLegend as h,ChartShell as c,LEGEND_OFF as u,LEGEND_ON as p,ChartTable as d,ChartTooltipPanel as f,useVisibility as v}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as g,MARK_GAP as x,PLOT_HEIGHT as y,arcPath as M,categoryAt as b,formatCategory as j,formatStatistic as k,polarPoint as w,seriesColor as P,toValues as I}from"../../internal/chart.js";const N={style:"percent",maximumFractionDigits:1};export function MPPieChart({data:z,categories:A,shape:B="pie",startAngle:C=0,hole:$=.62,gap:D=x,center:L,valueLabels:R="none",height:_,format:S,locale:E,label:F,legend:K,tooltip:O,empty:U,labelColor:W="ink",size:X,className:Y,style:q,...G}){const H=a(X),J=o(E),Q=r(s,J),T=r(m,J),V=l.useRef(null),Z=n(V),ee=l.useId(),te=l.useMemo(()=>I([{data:z}])[0],[z]),le=v(l.useMemo(()=>te.map(()=>({})),[te])),[ne,oe]=l.useState(null),re=l.useCallback(e=>k(e,J,S,!0),[S,J]),ae=l.useMemo(()=>te.map((e,t)=>j(b(t,A,[te]),J)),[te,A,J]),ie=l.useMemo(()=>te.map((e,t)=>e.color??P(t,void 0)),[te]),se=te.map((e,t)=>le.visible[t]&&null!==e.value&&e.value>0?e.value:0),me=se.reduce((e,t)=>e+t,0),he=Z.width,ce="number"==typeof _?_:void 0===_?y[H]:Z.height,ue=g[H],pe="semi"===B,de=he/2,fe=pe?ce-ue-4:ce/2,ve=Math.max(0,pe?Math.min(he/2,ce-ue-8)-2:Math.min(he,ce)/2-2),ge="pie"===B?0:ve*Math.min(.9,Math.max(0,$)),xe=he>0?ge:Math.max(0,pe?ce-ue-10:ce/2-2)*Math.min(.9,Math.max(0,$)),ye=pe?Math.PI:2*Math.PI;let Me=pe?-Math.PI/2:C*Math.PI/180;const be=se.map(e=>{const t=Me;return Me+=me>0?e/me*ye:0,{from:t,to:Me,share:e}}),je=e=>{const t=be.map((e,t)=>e.share>0?t:-1).filter(e=>e>=0);if(0===t.length)return;const l=null===ne?e>0?-1:0:t.indexOf(ne);oe(t[(l+e+t.length)%t.length])},ke=e=>me>0?i(J,N).format(e/me):"",we=null===ne?null:be[ne],Pe=we&&we.share>0?[{seriesIndex:ne,color:ie[ne],value:we.share,formatted:`${re(we.share)} · ${ke(we.share)}`,label:te[ne]?.label}]:[],Ie=we&&we.share>0?ae[ne]:void 0,Ne=we?w(de,fe,.75*ve,(we.from+we.to)/2):null,ze=!1===O?{mode:"none"}:!0===O||void 0===O?{}:O,Ae=!1===K?u:!0===K||void 0===K?p:K,Be=!1!==K&&te.length>1,Ce=me<=0,$e=[te];return t(c,{...G,size:H,className:["mp-pie-chart",Y??""].filter(Boolean).join(" "),style:q,plotRef:V,name:F??Q.label,describedBy:Ce?void 0:ee,interactive:!Ce,height:_,legendSide:Ae.side??"bottom",plotProps:{onPointerMove:Ce||"none"===ze.mode?void 0:e=>oe(((e,t)=>{const l=V.current;if(!l||me<=0)return null;const n=l.getBoundingClientRect(),o=e-n.left-de,r=t-n.top-fe,a=Math.hypot(o,r);if(a>ve+8||a<ge)return null;const i=Math.atan2(o,-r),s=be.findIndex(({from:e,to:t,share:l})=>!(l<=0)&&(i-e+4*Math.PI)%(2*Math.PI)<t-e);return-1===s?null:s})(e.clientX,e.clientY)),onPointerLeave:()=>oe(null),onKeyDown:Ce||"none"===ze.mode?void 0:e=>{if("ArrowRight"===e.key||"ArrowDown"===e.key)je(1);else if("ArrowLeft"===e.key||"ArrowUp"===e.key)je(-1);else{if("Escape"!==e.key)return;oe(null)}e.preventDefault()},onBlur:()=>oe(null)},tooltip:Ne&&Pe.length>0&&"none"!==ze.mode?e(f,{heading:Ie,items:Pe,x:Ne.x,y:Ne.y,flip:Ne.x>de,size:H}):null,legend:Be?e(h,{names:ae,colors:ie,options:Ae,visibility:le,size:H,colorNames:"series"===W}):null,status:{heading:Ie,items:Pe},table:Ce?null:e(d,{id:ee,caption:F??Q.table,corner:Q.category,categories:ae,names:[F??Q.table],values:$e,format:re,locale:J,empty:T.empty}),children:[Ce?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:U??T.empty}):he>0&&ce>0?e("svg",{width:he,height:ce,viewBox:`0 0 ${he} ${ce}`,"aria-hidden":"true",className:"block overflow-visible",children:t("g",{className:"mp-pie-chart__slices",children:[be.map((t,l)=>{if(t.share<=0)return null;return e("path",{d:M(de,fe,ne===l?ve+3:ve,ge,t.from,t.to),fill:ie[l],stroke:"var(--_mp-color-surface)",strokeWidth:Math.max(0,D),strokeLinejoin:"round",opacity:null===le.hovered||le.hovered===l?1:.35},l)}),"all"===R?be.map((t,l)=>{const n=ke(t.share),o=t.to-t.from,r=w(de,fe,ge>0?(ve+ge)/2:.68*ve,(t.from+t.to)/2),a=o*(ge>0?(ve+ge)/2:.68*ve);return t.share<=0||a<n.length*ue*.6+8?null:e("text",{x:r.x,y:r.y,textAnchor:"middle",dominantBaseline:"central",fill:"var(--_mp-color-on-surface)",fontSize:ue,children:n},l)}):null]})}):null,null==L||"pie"===B||Ce?null:e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:he>0?de-xe:`calc(50% - ${xe}px)`,top:fe-xe,width:2*xe,height:pe?xe:2*xe},children:L})]})}
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{accentSlots as i}from"../../internal/accent.js";import{inertProps as r}from"../../internal/inert.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{CONTROL_GAP as a,CONTROL_ICON as l,CONTROL_TEXT as c,hasContent as m,META_TEXT as d,PROSE_TEXT as p,SHEET_PAD_X as u}from"../../internal/scale.js";import{useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-8",sm:"min-h-10",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"},h={xs:"px-4",sm:"px-5",md:"px-6",lg:"px-8",xl:"px-10"},b={filled:"shadow-mp-2 bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"shadow-mp-2 bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-2 bg-mp-surface-container-low text-(--_mp-accent)",outlined:"border-mp-outline shadow-mp-1 border bg-mp-surface-container text-mp-on-surface",text:"shadow-mp-1 bg-mp-surface-container text-mp-on-surface"},w={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}};export const MPPill=/*@__PURE__*/o.forwardRef(function({startIcon:g,endIcon:v,title:y,description:j,details:_,expanded:k=!1,position:N="static",side:z="top",onClick:B,variant:C="filled",size:I,color:R="secondary",className:$,style:H,children:P,...S},E){const F=f(I),L=o.useRef(null),M=o.useId(),[O,q]=o.useState(0);o.useEffect(()=>{const e=L.current;if(!e)return;const t=new ResizeObserver(()=>q(e.scrollHeight));return t.observe(e),q(e.scrollHeight),()=>t.disconnect()},[_]);const A=Boolean(B),D=u[F],G=t(n,{children:[m(g)?e("span",{className:"flex shrink-0 items-center justify-center overflow-hidden rounded-mp-full [&_img]:size-full [&_img]:object-cover",style:{width:l[F],height:l[F]},children:g}):null,m(y)||m(j)||m(P)?t("span",{className:["flex min-w-0 flex-1 flex-col items-center justify-center text-center",h[F]].join(" "),children:[m(y)?e("span",{className:"max-w-full truncate",children:y}):null,m(j)?e("span",{className:`max-w-full truncate font-normal ${d} supports-[(not_(-webkit-appearance:-apple-pay-button))_or_(contain-intrinsic-size:1px)]:[color:color-mix(in_oklab,currentColor_72%,transparent)]`,children:j}):null,P]}):null]});return t("div",{ref:E,"data-mp-size":F,"data-mp-variant":C,"data-mp-expanded":k||void 0,className:["mp-pill inline-flex max-w-full flex-col overflow-hidden align-middle","box-border whitespace-nowrap select-none",k?"rounded-mp-xl":"rounded-mp-full","transition-[border-radius,background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",c[F],b[C],w[N][z],$??""].filter(Boolean).join(" "),style:{...i(R),...H},...S,children:[t("div",{className:["flex shrink-0 items-center py-1",x[F],a[F],A?"ps-0":D,m(v)?"pe-1":A?"pe-0":""].filter(Boolean).join(" "),children:[A?t("button",{type:"button",className:["group relative flex min-w-0 flex-1 cursor-pointer items-center justify-center","self-stretch appearance-none border-0 bg-transparent text-inherit [font:inherit]","rounded-[inherit]",a[F],D,"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),"aria-expanded":m(_)?k:void 0,"aria-controls":m(_)?M:void 0,onClick:B,children:[e(s,{}),G]}):G,m(v)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:v}):null]}),m(_)?e("div",{id:M,className:["overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none"].join(" "),style:{height:k?O:0},...r(!k),children:e("div",{ref:L,className:`${D} pb-2 whitespace-normal ${p[F]}`,children:_})}):null]})});
2
+ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{accentSlots as i}from"../../internal/accent.js";import{inertProps as r}from"../../internal/inert.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{CONTROL_GAP as a,CONTROL_ICON as l,CONTROL_TEXT as c,hasContent as m,META_TEXT as d,PROSE_TEXT as p,SHEET_PAD_X as u}from"../../internal/scale.js";import{useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-8",sm:"min-h-10",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"},h={xs:"px-4",sm:"px-5",md:"px-6",lg:"px-8",xl:"px-10"},b={filled:"shadow-mp-2 bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"shadow-mp-2 bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-2 bg-mp-surface-container-low text-(--_mp-accent)",outlined:"border-mp-outline shadow-mp-1 border bg-mp-surface-container text-mp-on-surface",text:"shadow-mp-1 bg-mp-surface-container text-mp-on-surface"},w={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}};export const MPPill=/*@__PURE__*/o.forwardRef(function({startIcon:g,endIcon:v,title:y,description:j,details:_,expanded:k=!1,position:N="static",side:z="top",onClick:B,variant:C="filled",size:I,color:R="secondary",className:$,style:H,children:P,...S},E){const F=f(I),L=o.useRef(null),M=o.useId(),[O,q]=o.useState(null);o.useEffect(()=>{const e=L.current;if(!e)return;const t=new ResizeObserver(()=>q(e.scrollHeight));return t.observe(e),q(e.scrollHeight),()=>t.disconnect()},[_]);const A=Boolean(B),D=u[F],G=t(n,{children:[m(g)?e("span",{className:"flex shrink-0 items-center justify-center overflow-hidden rounded-mp-full [&_img]:size-full [&_img]:object-cover",style:{width:l[F],height:l[F]},children:g}):null,m(y)||m(j)||m(P)?t("span",{className:["flex min-w-0 flex-1 flex-col items-center justify-center text-center",h[F]].join(" "),children:[m(y)?e("span",{className:"max-w-full truncate",children:y}):null,m(j)?e("span",{className:`max-w-full truncate font-normal ${d} supports-[(not_(-webkit-appearance:-apple-pay-button))_or_(contain-intrinsic-size:1px)]:[color:color-mix(in_oklab,currentColor_72%,transparent)]`,children:j}):null,P]}):null]});return t("div",{ref:E,"data-mp-size":F,"data-mp-variant":C,"data-mp-expanded":k||void 0,className:["mp-pill inline-flex max-w-full flex-col overflow-hidden align-middle","box-border whitespace-nowrap select-none",k?"rounded-mp-xl":"rounded-mp-full","transition-[border-radius,background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",c[F],b[C],w[N][z],$??""].filter(Boolean).join(" "),style:{...i(R),...H},...S,children:[t("div",{className:["flex shrink-0 items-center py-1",x[F],a[F],A?"ps-0":D,m(v)?"pe-1":A?"pe-0":""].filter(Boolean).join(" "),children:[A?t("button",{type:"button",className:["group relative flex min-w-0 flex-1 cursor-pointer items-center justify-center","self-stretch appearance-none border-0 bg-transparent text-inherit [font:inherit]","rounded-[inherit]",a[F],D,"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),"aria-expanded":m(_)?k:void 0,"aria-controls":m(_)?M:void 0,onClick:B,children:[e(s,{}),G]}):G,m(v)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:v}):null]}),m(_)?e("div",{id:M,className:["overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none"].join(" "),style:{height:k?O??"auto":0},...r(!k),children:e("div",{ref:L,className:`${D} pb-2 whitespace-normal ${p[F]}`,children:_})}):null]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as n}from"@base-ui/react/progress";import{accentSlots as r}from"../../internal/accent.js";import{VISUALLY_HIDDEN as s}from"../../internal/visually-hidden.js";import{META_TEXT as t,STACK_GAP as o}from"../../internal/scale.js";import{SEGMENT_GAP as i,SEGMENT_RADIUS as m,SEGMENT_SIZE as c,progressAriaText as u,progressFraction as f,progressText as p}from"../../internal/progress.js";import{useMPColor as d,useMPSize as h}from"../../internal/config.js";export const MPProgressBox=/*@__PURE__*/l.forwardRef(function({size:l,color:x,count:b=4,value:g=null,min:j=0,max:v=100,label:y,hideLabel:N=!1,showValue:w=!1,format:M,className:B,style:L},V){const _=h(l),k=d(x),z=f(g,j,v),A=null===z,P=void 0!==M,R=N?null:y,T=Math.max(1,Math.floor(b));return a(n.Root,{ref:V,value:null===z?null:g??null,min:j,max:v,format:M,getAriaValueText:u(z,P),"data-mp-size":_,className:["mp-progress-box inline-flex flex-col",o[_],B??""].filter(Boolean).join(" "),style:{...r(k),...L},children:[N&&y?e(n.Label,{className:s,children:y}):null,R||w?a("div",{className:["flex items-baseline gap-2",R?"justify-between":"justify-end",t].join(" "),children:[R?e(n.Label,{className:"text-mp-on-surface min-w-0 truncate",children:R}):null,w?e(n.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>p(z,e,P)}):null]}):null,e(n.Track,{className:`flex ${i[_]}`,children:Array.from({length:T},(a,l)=>e("span",{className:["bg-mp-on-surface/12 relative overflow-hidden",c[_],m[_],A?"mp-progress-segment-wave bg-(--_mp-accent)":""].filter(Boolean).join(" "),style:A?{"--_mp-index":l}:void 0,children:A?null:e("span",{className:"absolute inset-y-0 start-0 bg-(--_mp-accent) transition-[width] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",style:{width:`${Math.min(100,Math.max(0,100*(z*T-l)))}%`}})},l))})]})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as n}from"@base-ui/react/progress";import{accentSlots as r}from"../../internal/accent.js";import{VISUALLY_HIDDEN as s}from"../../internal/visually-hidden.js";import{META_TEXT as t,STACK_GAP as o}from"../../internal/scale.js";import{SEGMENT_GAP as i,SEGMENT_RADIUS as m,SEGMENT_SIZE as c,progressAriaText as u,progressFraction as f,progressText as p}from"../../internal/progress.js";import{useMPColor as d,useMPSize as h}from"../../internal/config.js";import{useMPLocale as x}from"../../internal/locale.js";import{checkServerLocale as j,intlLocale as b}from"../../internal/intl.js";export const MPProgressBox=/*@__PURE__*/l.forwardRef(function({size:l,color:g,count:v=4,value:y=null,min:N=0,max:w=100,label:M,hideLabel:B=!1,showValue:L=!1,format:V,locale:_,className:k,style:z},A){const P=h(l),R=d(g),T=f(y,N,w),$=null===T,q=void 0!==V,C=x(_);q&&j(C);const D=B?null:M,E=Math.max(1,Math.floor(v));return a(n.Root,{ref:A,value:null===T?null:y??null,min:N,max:w,format:V,locale:b(C),getAriaValueText:u(T,q),"data-mp-size":P,className:["mp-progress-box inline-flex flex-col",o[P],k??""].filter(Boolean).join(" "),style:{...r(R),...z},children:[B&&M?e(n.Label,{className:s,children:M}):null,D||L?a("div",{className:["flex items-baseline gap-2",D?"justify-between":"justify-end",t].join(" "),children:[D?e(n.Label,{className:"text-mp-on-surface min-w-0 truncate",children:D}):null,L?e(n.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>p(T,e,q)}):null]}):null,e(n.Track,{className:`flex ${i[P]}`,children:Array.from({length:E},(a,l)=>e("span",{className:["bg-mp-on-surface/12 relative overflow-hidden",c[P],m[P],$?"mp-progress-segment-wave bg-(--_mp-accent)":""].filter(Boolean).join(" "),style:$?{"--_mp-index":l}:void 0,children:$?null:e("span",{className:"absolute inset-y-0 start-0 bg-(--_mp-accent) transition-[width] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",style:{width:`${Math.min(100,Math.max(0,100*(T*E-l)))}%`}})},l))})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as r,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{Progress as s}from"@base-ui/react/progress";import{accentSlots as t}from"../../internal/accent.js";import{VISUALLY_HIDDEN as o}from"../../internal/visually-hidden.js";import{CONTROL_GAP as l,META_TEXT as n}from"../../internal/scale.js";import{RING_DIAMETER as i,RING_STROKE as c,progressAriaText as m,progressFraction as u,progressText as p}from"../../internal/progress.js";import{useMPColor as f,useMPSize as h}from"../../internal/config.js";export const MPProgressCircular=/*@__PURE__*/a.forwardRef(function({size:a,color:d,value:x=null,min:k=0,max:g=100,label:j,hideLabel:v=!1,showValue:y=!1,format:N,className:b,style:w},L){const $=h(a),V=f(d),z=u(x,k,g),B=null===z,D=void 0!==N,P=i[$],R=c[$],W=P/2,_=W-R/2;return e(s.Root,{ref:L,value:null===z?null:x??null,min:k,max:g,format:N,getAriaValueText:m(z,D),"data-mp-size":$,className:["mp-progress-circular inline-flex items-center",l[$],n,b??""].filter(Boolean).join(" "),style:{...t(V),...w},children:[e("svg",{className:B?"mp-progress-circular-turn shrink-0":"shrink-0",width:P,height:P,viewBox:`0 0 ${P} ${P}`,fill:"none","aria-hidden":"true",children:[r("circle",{cx:W,cy:W,r:_,stroke:"var(--_mp-color-on-surface)",strokeOpacity:.12,strokeWidth:R}),r("circle",{cx:W,cy:W,r:_,pathLength:100,stroke:"var(--_mp-accent)",strokeWidth:R,strokeLinecap:"round",className:B?"mp-progress-circular-arc":"transition-[stroke-dashoffset] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",transform:`rotate(-90 ${W} ${W})`,...B?null:{strokeDasharray:100,strokeDashoffset:100*(1-z)}})]}),v?j?r(s.Label,{className:o,children:j}):null:j?r(s.Label,{className:"text-mp-on-surface min-w-0 truncate",children:j}):null,y?r(s.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:r=>p(z,r,D)}):null]})});
2
+ import{jsx as r,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{Progress as t}from"@base-ui/react/progress";import{accentSlots as s}from"../../internal/accent.js";import{VISUALLY_HIDDEN as o}from"../../internal/visually-hidden.js";import{CONTROL_GAP as n,META_TEXT as l}from"../../internal/scale.js";import{RING_DIAMETER as i,RING_STROKE as c,progressAriaText as m,progressFraction as u,progressText as f}from"../../internal/progress.js";import{useMPColor as p,useMPSize as h}from"../../internal/config.js";import{useMPLocale as d}from"../../internal/locale.js";import{useOffscreenPause as j}from"../../internal/intersection.js";import{useJoinedRef as x}from"../../internal/ref.js";import{checkServerLocale as k,intlLocale as g}from"../../internal/intl.js";export const MPProgressCircular=/*@__PURE__*/a.forwardRef(function({size:a,color:v,value:y=null,min:N=0,max:b=100,label:w,hideLabel:L=!1,showValue:$=!1,format:V,locale:z,className:B,style:D},P){const R=h(a),W=p(v),_=u(y,N,b),A=null===_,C=void 0!==V,M=d(z),O=j(A),T=x(P,O);C&&k(M);const q=i[R],E=c[R],F=q/2,G=F-E/2;return e(t.Root,{ref:T,value:null===_?null:y??null,min:N,max:b,format:V,locale:g(M),getAriaValueText:m(_,C),"data-mp-size":R,className:["mp-progress-circular inline-flex items-center",n[R],l,B??""].filter(Boolean).join(" "),style:{...s(W),...D},children:[e("svg",{className:A?"mp-progress-circular-turn shrink-0":"shrink-0",width:q,height:q,viewBox:`0 0 ${q} ${q}`,fill:"none","aria-hidden":"true",children:[r("circle",{cx:F,cy:F,r:G,stroke:"var(--_mp-color-on-surface)",strokeOpacity:.12,strokeWidth:E}),r("circle",{cx:F,cy:F,r:G,pathLength:100,stroke:"var(--_mp-accent)",strokeWidth:E,strokeLinecap:"round",className:A?"mp-progress-circular-arc":"transition-[stroke-dashoffset] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",transform:`rotate(-90 ${F} ${F})`,...A?null:{strokeDasharray:100,strokeDashoffset:100*(1-_)}})]}),L?w?r(t.Label,{className:o,children:w}):null:w?r(t.Label,{className:"text-mp-on-surface min-w-0 truncate",children:w}):null,$?r(t.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:r=>f(_,r,C)}):null]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as r}from"@base-ui/react/progress";import{accentSlots as s}from"../../internal/accent.js";import{VISUALLY_HIDDEN as n}from"../../internal/visually-hidden.js";import{META_TEXT as t,STACK_GAP as i}from"../../internal/scale.js";import{BAR_THICKNESS as o,progressAriaText as m,progressFraction as c,progressText as u}from"../../internal/progress.js";import{useMPColor as f,useMPSize as p}from"../../internal/config.js";export const MPProgressLinear=/*@__PURE__*/l.forwardRef(function({size:d,color:h,value:j=null,min:g=0,max:x=100,label:b,hideLabel:N=!1,showValue:v=!1,format:w,className:y,style:L},V){const $=p(d),k=f(h),z=c(j,g,x),P=null===z,R=N?null:b,T=void 0!==w,A="absolute inset-y-0 rounded-mp-full bg-(--_mp-accent)";return a(r.Root,{ref:V,value:null===z?null:j??null,min:g,max:x,format:w,getAriaValueText:m(z,T),"data-mp-size":$,className:["mp-progress-linear flex w-full flex-col",i[$],y??""].filter(Boolean).join(" "),style:{...s(k),...L},children:[N&&b?e(r.Label,{className:n,children:b}):null,R||v?a("div",{className:["flex items-baseline gap-2",R?"justify-between":"justify-end",t].join(" "),children:[R?e(r.Label,{className:"text-mp-on-surface min-w-0 truncate",children:R}):null,v?e(r.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>u(z,e,T)}):null]}):null,e(r.Track,{className:["rounded-mp-full bg-mp-on-surface/12 relative w-full overflow-hidden",o[$]].join(" "),children:P?a(l.Fragment,{children:[e("span",{className:`${A} mp-progress-linear-lead`}),e("span",{className:`${A} mp-progress-linear-trail`})]}):e(r.Indicator,{className:`${A} start-0 transition-[width] duration-(--mp-sys-motion-duration-short4) ease-mp-standard`})})]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as l from"react";import{Progress as a}from"@base-ui/react/progress";import{accentSlots as n}from"../../internal/accent.js";import{VISUALLY_HIDDEN as s}from"../../internal/visually-hidden.js";import{META_TEXT as t,STACK_GAP as i}from"../../internal/scale.js";import{BAR_THICKNESS as o,progressAriaText as m,progressFraction as c,progressText as u}from"../../internal/progress.js";import{useMPColor as f,useMPSize as p}from"../../internal/config.js";import{useMPLocale as d}from"../../internal/locale.js";import{useOffscreenPause as j}from"../../internal/intersection.js";import{useJoinedRef as h}from"../../internal/ref.js";import{checkServerLocale as g,intlLocale as x}from"../../internal/intl.js";export const MPProgressLinear=/*@__PURE__*/l.forwardRef(function({size:b,color:N,value:v=null,min:w=0,max:y=100,label:L,hideLabel:V=!1,showValue:$=!1,format:k,locale:z,className:P,style:R},T){const A=p(b),B=f(N),F=c(v,w,y),I=null===F,M=V?null:L,_=void 0!==k,q=d(z),C=j(I),D=h(T,C);_&&g(q);const E="absolute inset-y-0 rounded-mp-full bg-(--_mp-accent)";return r(a.Root,{ref:D,value:null===F?null:v??null,min:w,max:y,format:k,locale:x(q),getAriaValueText:m(F,_),"data-mp-size":A,className:["mp-progress-linear flex w-full flex-col",i[A],P??""].filter(Boolean).join(" "),style:{...n(B),...R},children:[V&&L?e(a.Label,{className:s,children:L}):null,M||$?r("div",{className:["flex items-baseline gap-2",M?"justify-between":"justify-end",t].join(" "),children:[M?e(a.Label,{className:"text-mp-on-surface min-w-0 truncate",children:M}):null,$?e(a.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>u(F,e,_)}):null]}):null,e(a.Track,{className:["rounded-mp-full bg-mp-on-surface/12 relative w-full overflow-hidden",o[A]].join(" "),children:I?r(l.Fragment,{children:[e("span",{className:`${E} mp-progress-linear-lead`}),e("span",{className:`${E} mp-progress-linear-trail`})]}):e(a.Indicator,{className:`${E} start-0 transition-[width] duration-(--mp-sys-motion-duration-short4) ease-mp-standard`})})]})});