material-plus-ui 1.5.0 → 1.7.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 (549) hide show
  1. package/README.md +2 -2
  2. package/dist/components/accordion/MPAccordion.d.ts +21 -1
  3. package/dist/components/accordion/MPAccordion.js +1 -1
  4. package/dist/components/alert/MPAlert.d.ts +33 -2
  5. package/dist/components/alert/MPAlert.js +1 -1
  6. package/dist/components/anchor/MPAnchor.d.ts +107 -0
  7. package/dist/components/anchor/MPAnchor.js +2 -0
  8. package/dist/components/anchor/index.d.ts +2 -0
  9. package/dist/components/anchor/index.js +1 -0
  10. package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
  11. package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
  12. package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
  13. package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
  14. package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
  15. package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
  16. package/dist/components/animate-counter/index.d.ts +2 -0
  17. package/dist/components/animate-counter/index.js +1 -0
  18. package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
  19. package/dist/components/animate-fade/MPAnimateFade.js +2 -1
  20. package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
  21. package/dist/components/animate-float/MPAnimateFloat.js +2 -0
  22. package/dist/components/animate-float/index.d.ts +2 -0
  23. package/dist/components/animate-float/index.js +1 -0
  24. package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
  25. package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
  26. package/dist/components/animate-lighting/MPAnimateLighting.js +2 -1
  27. package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
  28. package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
  29. package/dist/components/animate-reveal/index.d.ts +2 -0
  30. package/dist/components/animate-reveal/index.js +1 -0
  31. package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
  32. package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
  33. package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
  34. package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
  35. package/dist/components/animate-scramble/index.d.ts +2 -0
  36. package/dist/components/animate-scramble/index.js +1 -0
  37. package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
  38. package/dist/components/animate-shake/MPAnimateShake.js +2 -0
  39. package/dist/components/animate-shake/index.d.ts +2 -0
  40. package/dist/components/animate-shake/index.js +1 -0
  41. package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
  42. package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
  43. package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
  44. package/dist/components/animate-split/MPAnimateSplit.js +2 -0
  45. package/dist/components/animate-split/index.d.ts +2 -0
  46. package/dist/components/animate-split/index.js +1 -0
  47. package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
  48. package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
  49. package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
  50. package/dist/components/app-logo/MPAppLogo.d.ts +156 -0
  51. package/dist/components/app-logo/MPAppLogo.js +2 -0
  52. package/dist/components/app-logo/index.d.ts +2 -0
  53. package/dist/components/app-logo/index.js +1 -0
  54. package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
  55. package/dist/components/area-chart/MPAreaChart.js +2 -0
  56. package/dist/components/area-chart/index.d.ts +2 -0
  57. package/dist/components/area-chart/index.js +1 -0
  58. package/dist/components/aspect-ratio/MPAspectRatio.js +2 -1
  59. package/dist/components/avatar/MPAvatar.d.ts +10 -1
  60. package/dist/components/avatar/MPAvatar.js +1 -1
  61. package/dist/components/badge/MPBadge.js +1 -1
  62. package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
  63. package/dist/components/bar-chart/MPBarChart.js +2 -0
  64. package/dist/components/bar-chart/index.d.ts +2 -0
  65. package/dist/components/bar-chart/index.js +1 -0
  66. package/dist/components/blockquote/MPBlockquote.d.ts +10 -1
  67. package/dist/components/blockquote/MPBlockquote.js +1 -1
  68. package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +19 -18
  69. package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
  70. package/dist/components/box/MPBox.d.ts +43 -8
  71. package/dist/components/box/MPBox.js +2 -1
  72. package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
  73. package/dist/components/button/MPButton.d.ts +49 -3
  74. package/dist/components/button/MPButton.js +1 -1
  75. package/dist/components/calendar/MPCalendar.d.ts +160 -0
  76. package/dist/components/calendar/MPCalendar.js +2 -0
  77. package/dist/components/calendar/index.d.ts +2 -0
  78. package/dist/components/calendar/index.js +1 -0
  79. package/dist/components/card/MPCard.js +1 -1
  80. package/dist/components/carousel/MPCarousel.js +1 -1
  81. package/dist/components/chat-bubble/MPChatBubble.js +1 -1
  82. package/dist/components/checkbox/MPCheckbox.js +1 -1
  83. package/dist/components/chip/MPChip.d.ts +31 -7
  84. package/dist/components/chip/MPChip.js +1 -1
  85. package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
  86. package/dist/components/code-block/MPCodeBlock.js +2 -0
  87. package/dist/components/code-block/index.d.ts +2 -0
  88. package/dist/components/code-block/index.js +1 -0
  89. package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
  90. package/dist/components/collapsible/MPCollapsible.js +1 -1
  91. package/dist/components/color-picker/MPColorPicker.js +1 -1
  92. package/dist/components/combobox/MPCombobox.d.ts +71 -5
  93. package/dist/components/combobox/MPCombobox.js +1 -1
  94. package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
  95. package/dist/components/command-palette/MPCommandPalette.js +1 -1
  96. package/dist/components/config/MPConfigProvider.d.ts +166 -0
  97. package/dist/components/config/MPConfigProvider.js +2 -0
  98. package/dist/components/config/index.d.ts +2 -0
  99. package/dist/components/config/index.js +1 -0
  100. package/dist/components/confirm/MPConfirmProvider.d.ts +143 -0
  101. package/dist/components/confirm/MPConfirmProvider.js +2 -0
  102. package/dist/components/confirm/index.d.ts +2 -0
  103. package/dist/components/confirm/index.js +1 -0
  104. package/dist/components/container/MPContainer.d.ts +9 -2
  105. package/dist/components/container/MPContainer.js +2 -1
  106. package/dist/components/data-list/MPDataList.d.ts +82 -0
  107. package/dist/components/data-list/MPDataList.js +2 -0
  108. package/dist/components/data-list/index.d.ts +2 -0
  109. package/dist/components/data-list/index.js +1 -0
  110. package/dist/components/data-table/MPDataTable.d.ts +295 -0
  111. package/dist/components/data-table/MPDataTable.js +2 -0
  112. package/dist/components/data-table/index.d.ts +2 -0
  113. package/dist/components/data-table/index.js +1 -0
  114. package/dist/components/date-picker/MPDatePicker.d.ts +53 -2
  115. package/dist/components/date-picker/MPDatePicker.js +1 -1
  116. package/dist/components/date-picker/index.d.ts +1 -1
  117. package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
  118. package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
  119. package/dist/components/dialog/MPDialog.d.ts +24 -3
  120. package/dist/components/dialog/MPDialog.js +1 -1
  121. package/dist/components/divider/MPDivider.js +1 -1
  122. package/dist/components/drawer/MPDrawer.d.ts +8 -2
  123. package/dist/components/drawer/MPDrawer.js +1 -1
  124. package/dist/components/empty/MPEmpty.d.ts +10 -1
  125. package/dist/components/empty/MPEmpty.js +1 -1
  126. package/dist/components/fieldset/MPFieldset.js +1 -1
  127. package/dist/components/file-picker/MPFilePicker.js +1 -1
  128. package/dist/components/flex/MPFlex.d.ts +95 -0
  129. package/dist/components/flex/MPFlex.js +2 -0
  130. package/dist/components/flex/index.d.ts +2 -0
  131. package/dist/components/flex/index.js +1 -0
  132. package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
  133. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
  134. package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
  135. package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
  136. package/dist/components/floating-bottom-navigation/index.js +1 -0
  137. package/dist/components/footer/MPFooter.d.ts +24 -4
  138. package/dist/components/footer/MPFooter.js +1 -1
  139. package/dist/components/form/MPForm.js +1 -1
  140. package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
  141. package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
  142. package/dist/components/gauge-chart/index.d.ts +2 -0
  143. package/dist/components/gauge-chart/index.js +1 -0
  144. package/dist/components/grid/MPGrid.d.ts +23 -1
  145. package/dist/components/grid/MPGrid.js +1 -1
  146. package/dist/components/header/MPHeader.d.ts +26 -4
  147. package/dist/components/header/MPHeader.js +1 -1
  148. package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
  149. package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
  150. package/dist/components/heatmap-chart/index.d.ts +2 -0
  151. package/dist/components/heatmap-chart/index.js +1 -0
  152. package/dist/components/hover-card/MPHoverCard.d.ts +100 -0
  153. package/dist/components/hover-card/MPHoverCard.js +2 -0
  154. package/dist/components/hover-card/index.d.ts +2 -0
  155. package/dist/components/hover-card/index.js +1 -0
  156. package/dist/components/image/MPImage.d.ts +121 -0
  157. package/dist/components/image/MPImage.js +2 -0
  158. package/dist/components/image/index.d.ts +2 -0
  159. package/dist/components/image/index.js +1 -0
  160. package/dist/components/line-chart/MPLineChart.d.ts +66 -0
  161. package/dist/components/line-chart/MPLineChart.js +2 -0
  162. package/dist/components/line-chart/index.d.ts +2 -0
  163. package/dist/components/line-chart/index.js +1 -0
  164. package/dist/components/list/MPList.d.ts +51 -1
  165. package/dist/components/list/MPList.js +1 -1
  166. package/dist/components/menu/MPMenu.d.ts +21 -2
  167. package/dist/components/menu/MPMenu.js +1 -1
  168. package/dist/components/menubar/MPMenubar.js +1 -1
  169. package/dist/components/meter/MPMeter.d.ts +87 -0
  170. package/dist/components/meter/MPMeter.js +2 -0
  171. package/dist/components/meter/index.d.ts +2 -0
  172. package/dist/components/meter/index.js +1 -0
  173. package/dist/components/mockup/MPMockup.d.ts +143 -0
  174. package/dist/components/mockup/MPMockup.js +2 -0
  175. package/dist/components/mockup/index.d.ts +2 -0
  176. package/dist/components/mockup/index.js +1 -0
  177. package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
  178. package/dist/components/number-field/MPNumberField.d.ts +3 -3
  179. package/dist/components/number-field/MPNumberField.js +1 -1
  180. package/dist/components/otp-field/MPOtpField.js +1 -1
  181. package/dist/components/overlay/MPOverlay.d.ts +1 -1
  182. package/dist/components/overlay/MPOverlay.js +1 -1
  183. package/dist/components/pagination/MPPagination.js +1 -1
  184. package/dist/components/panes/MPPanes.js +1 -1
  185. package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
  186. package/dist/components/pie-chart/MPPieChart.js +2 -0
  187. package/dist/components/pie-chart/index.d.ts +2 -0
  188. package/dist/components/pie-chart/index.js +1 -0
  189. package/dist/components/pill/MPPill.js +1 -1
  190. package/dist/components/popconfirm/MPPopconfirm.d.ts +92 -0
  191. package/dist/components/popconfirm/MPPopconfirm.js +2 -0
  192. package/dist/components/popconfirm/index.d.ts +2 -0
  193. package/dist/components/popconfirm/index.js +1 -0
  194. package/dist/components/popover/MPPopover.d.ts +1 -1
  195. package/dist/components/popover/MPPopover.js +1 -1
  196. package/dist/components/portal/MPPortal.d.ts +75 -0
  197. package/dist/components/portal/MPPortal.js +2 -0
  198. package/dist/components/portal/index.d.ts +2 -0
  199. package/dist/components/portal/index.js +1 -0
  200. package/dist/components/progress-box/MPProgressBox.js +1 -1
  201. package/dist/components/progress-circular/MPProgressCircular.js +1 -1
  202. package/dist/components/progress-linear/MPProgressLinear.js +1 -1
  203. package/dist/components/radio-group/MPRadioGroup.js +1 -1
  204. package/dist/components/rating/MPRating.js +1 -1
  205. package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
  206. package/dist/components/scatter-chart/MPScatterChart.js +2 -0
  207. package/dist/components/scatter-chart/index.d.ts +2 -0
  208. package/dist/components/scatter-chart/index.js +1 -0
  209. package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
  210. package/dist/components/scroll-area/MPScrollArea.js +2 -0
  211. package/dist/components/scroll-area/index.d.ts +2 -0
  212. package/dist/components/scroll-area/index.js +1 -0
  213. package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
  214. package/dist/components/scroll-zone/MPScrollZone.js +2 -0
  215. package/dist/components/scroll-zone/index.d.ts +2 -0
  216. package/dist/components/scroll-zone/index.js +1 -0
  217. package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
  218. package/dist/components/select/MPSelect.d.ts +28 -5
  219. package/dist/components/select/MPSelect.js +1 -1
  220. package/dist/components/shortcut/MPShortcut.js +1 -1
  221. package/dist/components/show/MPShow.d.ts +78 -0
  222. package/dist/components/show/MPShow.js +2 -0
  223. package/dist/components/show/index.d.ts +2 -0
  224. package/dist/components/show/index.js +1 -0
  225. package/dist/components/sidebar/MPSidebar.d.ts +20 -1
  226. package/dist/components/sidebar/MPSidebar.js +1 -1
  227. package/dist/components/skeleton/MPSkeleton.js +1 -1
  228. package/dist/components/slider/MPSlider.d.ts +27 -0
  229. package/dist/components/slider/MPSlider.js +1 -1
  230. package/dist/components/snackbar/MPSnackbar.d.ts +20 -1
  231. package/dist/components/snackbar/MPSnackbar.js +1 -1
  232. package/dist/components/sparkline/MPSparkline.d.ts +85 -0
  233. package/dist/components/sparkline/MPSparkline.js +2 -0
  234. package/dist/components/sparkline/index.d.ts +2 -0
  235. package/dist/components/sparkline/index.js +1 -0
  236. package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
  237. package/dist/components/spoiler/MPSpoiler.js +1 -1
  238. package/dist/components/stack/MPStack.d.ts +198 -0
  239. package/dist/components/stack/MPStack.js +2 -0
  240. package/dist/components/stack/index.d.ts +2 -0
  241. package/dist/components/stack/index.js +1 -0
  242. package/dist/components/statistic/MPStatistic.d.ts +104 -0
  243. package/dist/components/statistic/MPStatistic.js +2 -0
  244. package/dist/components/statistic/index.d.ts +2 -0
  245. package/dist/components/statistic/index.js +1 -0
  246. package/dist/components/stepper/MPStepper.d.ts +153 -0
  247. package/dist/components/stepper/MPStepper.js +2 -0
  248. package/dist/components/stepper/index.d.ts +2 -0
  249. package/dist/components/stepper/index.js +1 -0
  250. package/dist/components/switch/MPSwitch.js +1 -1
  251. package/dist/components/table/MPTable.d.ts +24 -2
  252. package/dist/components/table/MPTable.js +1 -1
  253. package/dist/components/tabs/MPTabs.d.ts +12 -0
  254. package/dist/components/tabs/MPTabs.js +1 -1
  255. package/dist/components/text-field/MPTextField.d.ts +38 -14
  256. package/dist/components/text-field/MPTextField.js +1 -1
  257. package/dist/components/time-picker/MPTimePicker.js +1 -1
  258. package/dist/components/timeline/MPTimeline.d.ts +10 -2
  259. package/dist/components/timeline/MPTimeline.js +1 -1
  260. package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
  261. package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
  262. package/dist/components/timeline-chart/index.d.ts +2 -0
  263. package/dist/components/timeline-chart/index.js +1 -0
  264. package/dist/components/toggle/MPToggle.js +1 -1
  265. package/dist/components/toolbar/MPToolbar.d.ts +106 -0
  266. package/dist/components/toolbar/MPToolbar.js +2 -0
  267. package/dist/components/toolbar/index.d.ts +2 -0
  268. package/dist/components/toolbar/index.js +1 -0
  269. package/dist/components/tour/MPTour.d.ts +120 -0
  270. package/dist/components/tour/MPTour.js +2 -0
  271. package/dist/components/tour/index.d.ts +2 -0
  272. package/dist/components/tour/index.js +1 -0
  273. package/dist/components/transfer/MPTransfer.js +1 -1
  274. package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
  275. package/dist/components/tree-select/MPTreeSelect.js +2 -0
  276. package/dist/components/tree-select/index.d.ts +2 -0
  277. package/dist/components/tree-select/index.js +1 -0
  278. package/dist/components/tree-view/MPTreeView.d.ts +153 -0
  279. package/dist/components/tree-view/MPTreeView.js +2 -0
  280. package/dist/components/tree-view/index.d.ts +2 -0
  281. package/dist/components/tree-view/index.js +1 -0
  282. package/dist/components/typography/MPTypography.d.ts +17 -1
  283. package/dist/components/typography/MPTypography.js +1 -1
  284. package/dist/components/visually-hidden/MPVisuallyHidden.d.ts +60 -0
  285. package/dist/components/visually-hidden/MPVisuallyHidden.js +2 -0
  286. package/dist/components/visually-hidden/index.d.ts +2 -0
  287. package/dist/components/visually-hidden/index.js +1 -0
  288. package/dist/constants/glyphs.d.ts +4 -0
  289. package/dist/constants/glyphs.js +1 -1
  290. package/dist/constants/icons.d.ts +2 -0
  291. package/dist/constants/icons.js +1 -1
  292. package/dist/hooks/index.d.ts +40 -0
  293. package/dist/hooks/index.js +1 -0
  294. package/dist/hooks/useMPColorScheme.d.ts +135 -0
  295. package/dist/hooks/useMPColorScheme.js +2 -0
  296. package/dist/hooks/useMPDisclosure.d.ts +58 -0
  297. package/dist/hooks/useMPDisclosure.js +2 -0
  298. package/dist/hooks/useMPElementSize.d.ts +55 -0
  299. package/dist/hooks/useMPElementSize.js +2 -0
  300. package/dist/hooks/useMPMediaQuery.d.ts +40 -0
  301. package/dist/hooks/useMPMediaQuery.js +2 -0
  302. package/dist/hooks/useMPOnScreen.d.ts +58 -0
  303. package/dist/hooks/useMPOnScreen.js +2 -0
  304. package/dist/hooks/useMPReducedMotion.d.ts +32 -0
  305. package/dist/hooks/useMPReducedMotion.js +2 -0
  306. package/dist/hooks/useMPShortcut.d.ts +105 -0
  307. package/dist/hooks/useMPShortcut.js +2 -0
  308. package/dist/hooks/useMPWindowClass.d.ts +55 -0
  309. package/dist/hooks/useMPWindowClass.js +2 -0
  310. package/dist/index.d.ts +43 -1
  311. package/dist/index.js +1 -1
  312. package/dist/internal/Calendar.d.ts +19 -4
  313. package/dist/internal/Calendar.js +1 -1
  314. package/dist/internal/ChartChrome.d.ts +205 -0
  315. package/dist/internal/ChartChrome.js +2 -0
  316. package/dist/internal/ChartFrame.d.ts +197 -0
  317. package/dist/internal/ChartFrame.js +2 -0
  318. package/dist/internal/FieldOutline.d.ts +14 -5
  319. package/dist/internal/FieldOutline.js +1 -1
  320. package/dist/internal/Picker.d.ts +15 -3
  321. package/dist/internal/Picker.js +1 -1
  322. package/dist/internal/SupportingText.d.ts +24 -0
  323. package/dist/internal/SupportingText.js +1 -1
  324. package/dist/internal/animate-core.d.ts +121 -0
  325. package/dist/internal/animate-core.js +1 -0
  326. package/dist/internal/animate.d.ts +75 -55
  327. package/dist/internal/animate.js +1 -1
  328. package/dist/internal/bottom-navigation.d.ts +58 -0
  329. package/dist/internal/bottom-navigation.js +2 -0
  330. package/dist/internal/chart.d.ts +471 -0
  331. package/dist/internal/chart.js +1 -0
  332. package/dist/internal/color-scheme.d.ts +28 -0
  333. package/dist/internal/color-scheme.js +2 -0
  334. package/dist/internal/config.d.ts +62 -0
  335. package/dist/internal/config.js +2 -0
  336. package/dist/internal/data-table.d.ts +162 -0
  337. package/dist/internal/data-table.js +1 -0
  338. package/dist/internal/date.d.ts +50 -3
  339. package/dist/internal/date.js +1 -1
  340. package/dist/internal/density.d.ts +9 -0
  341. package/dist/internal/density.js +1 -0
  342. package/dist/internal/elevation.d.ts +26 -0
  343. package/dist/internal/elevation.js +1 -0
  344. package/dist/internal/highlight.d.ts +96 -0
  345. package/dist/internal/highlight.js +1 -0
  346. package/dist/internal/i18n.d.ts +196 -1
  347. package/dist/internal/initials.d.ts +28 -0
  348. package/dist/internal/initials.js +1 -0
  349. package/dist/internal/mark.d.ts +52 -0
  350. package/dist/internal/mark.js +1 -0
  351. package/dist/internal/measure.d.ts +31 -0
  352. package/dist/internal/measure.js +1 -0
  353. package/dist/internal/messages/anchor.d.ts +3 -0
  354. package/dist/internal/messages/anchor.js +1 -0
  355. package/dist/internal/messages/chart.d.ts +3 -0
  356. package/dist/internal/messages/chart.js +1 -0
  357. package/dist/internal/messages/code.d.ts +3 -0
  358. package/dist/internal/messages/code.js +1 -0
  359. package/dist/internal/messages/confirm.d.ts +3 -0
  360. package/dist/internal/messages/confirm.js +1 -0
  361. package/dist/internal/messages/data-table.d.ts +3 -0
  362. package/dist/internal/messages/data-table.js +1 -0
  363. package/dist/internal/messages/picker.js +1 -1
  364. package/dist/internal/messages/scroll.d.ts +3 -0
  365. package/dist/internal/messages/scroll.js +1 -0
  366. package/dist/internal/messages/sparkline.d.ts +3 -0
  367. package/dist/internal/messages/sparkline.js +1 -0
  368. package/dist/internal/messages/tour.d.ts +3 -0
  369. package/dist/internal/messages/tour.js +1 -0
  370. package/dist/internal/mockup.d.ts +174 -0
  371. package/dist/internal/mockup.js +2 -0
  372. package/dist/internal/page-layout.d.ts +24 -5
  373. package/dist/internal/page-layout.js +1 -1
  374. package/dist/internal/progress.d.ts +14 -0
  375. package/dist/internal/responsive.d.ts +55 -0
  376. package/dist/internal/responsive.js +1 -0
  377. package/dist/internal/scale.d.ts +0 -17
  378. package/dist/internal/scale.js +1 -1
  379. package/dist/internal/step.d.ts +86 -0
  380. package/dist/internal/step.js +1 -0
  381. package/dist/internal/table.d.ts +53 -0
  382. package/dist/internal/table.js +1 -0
  383. package/dist/internal/text.d.ts +57 -0
  384. package/dist/internal/text.js +1 -0
  385. package/dist/internal/threshold.d.ts +19 -0
  386. package/dist/internal/threshold.js +1 -0
  387. package/dist/internal/time-scale.d.ts +44 -0
  388. package/dist/internal/time-scale.js +1 -0
  389. package/dist/internal/transition.d.ts +33 -0
  390. package/dist/internal/transition.js +1 -0
  391. package/dist/internal/visibility.d.ts +48 -0
  392. package/dist/internal/visibility.js +1 -0
  393. package/dist/internal/window-class.d.ts +48 -0
  394. package/dist/internal/window-class.js +2 -0
  395. package/dist/locales/ar.js +1 -1
  396. package/dist/locales/de.js +1 -1
  397. package/dist/locales/es.js +1 -1
  398. package/dist/locales/fr.js +1 -1
  399. package/dist/locales/hi.js +1 -1
  400. package/dist/locales/id.js +1 -1
  401. package/dist/locales/it.js +1 -1
  402. package/dist/locales/ja.js +1 -1
  403. package/dist/locales/ko.js +1 -1
  404. package/dist/locales/nl.js +1 -1
  405. package/dist/locales/pl.js +1 -1
  406. package/dist/locales/pt.js +1 -1
  407. package/dist/locales/ru.js +1 -1
  408. package/dist/locales/th.js +1 -1
  409. package/dist/locales/tr.js +1 -1
  410. package/dist/locales/vi.js +1 -1
  411. package/dist/locales/zh-hans.js +1 -1
  412. package/dist/locales/zh-hant.js +1 -1
  413. package/dist/styles/accordion.css +1 -1
  414. package/dist/styles/alert.css +1 -1
  415. package/dist/styles/anchor.css +2 -0
  416. package/dist/styles/animate-appear.css +1 -1
  417. package/dist/styles/animate-blink.css +1 -1
  418. package/dist/styles/animate-counter.css +2 -0
  419. package/dist/styles/animate-fade.css +1 -1
  420. package/dist/styles/animate-float.css +2 -0
  421. package/dist/styles/animate-grow.css +1 -1
  422. package/dist/styles/animate-headline.css +1 -1
  423. package/dist/styles/animate-lighting.css +1 -1
  424. package/dist/styles/animate-marquee.css +1 -1
  425. package/dist/styles/animate-reveal.css +2 -0
  426. package/dist/styles/animate-rotate.css +1 -1
  427. package/dist/styles/animate-scramble.css +2 -0
  428. package/dist/styles/animate-shake.css +2 -0
  429. package/dist/styles/animate-slide.css +1 -1
  430. package/dist/styles/animate-split.css +2 -0
  431. package/dist/styles/animate-typing.css +1 -1
  432. package/dist/styles/animate-zoom.css +1 -1
  433. package/dist/styles/app-logo.css +2 -0
  434. package/dist/styles/area-chart.css +2 -0
  435. package/dist/styles/aspect-ratio.css +1 -1
  436. package/dist/styles/avatar.css +1 -1
  437. package/dist/styles/badge.css +1 -1
  438. package/dist/styles/bar-chart.css +2 -0
  439. package/dist/styles/blockquote.css +1 -1
  440. package/dist/styles/bottom-navigation.css +1 -1
  441. package/dist/styles/box.css +1 -1
  442. package/dist/styles/breadcrumb.css +1 -1
  443. package/dist/styles/button.css +1 -1
  444. package/dist/styles/calendar.css +2 -0
  445. package/dist/styles/card.css +1 -1
  446. package/dist/styles/carousel.css +1 -1
  447. package/dist/styles/chat-bubble.css +1 -1
  448. package/dist/styles/checkbox.css +1 -1
  449. package/dist/styles/chip.css +1 -1
  450. package/dist/styles/code-block.css +2 -0
  451. package/dist/styles/collapsible.css +1 -1
  452. package/dist/styles/color-picker.css +1 -1
  453. package/dist/styles/combobox.css +1 -1
  454. package/dist/styles/command-palette.css +1 -1
  455. package/dist/styles/config.css +2 -0
  456. package/dist/styles/confirm.css +2 -0
  457. package/dist/styles/container.css +1 -1
  458. package/dist/styles/data-list.css +2 -0
  459. package/dist/styles/data-table.css +2 -0
  460. package/dist/styles/date-picker.css +1 -1
  461. package/dist/styles/date-range-picker.css +1 -1
  462. package/dist/styles/date-time-picker.css +1 -1
  463. package/dist/styles/dialog.css +1 -1
  464. package/dist/styles/divider.css +1 -1
  465. package/dist/styles/drawer.css +1 -1
  466. package/dist/styles/empty.css +1 -1
  467. package/dist/styles/fieldset.css +1 -1
  468. package/dist/styles/file-picker.css +1 -1
  469. package/dist/styles/flex.css +2 -0
  470. package/dist/styles/floating-action-button.css +1 -1
  471. package/dist/styles/floating-bottom-navigation.css +2 -0
  472. package/dist/styles/footer.css +1 -1
  473. package/dist/styles/form.css +1 -1
  474. package/dist/styles/gauge-chart.css +2 -0
  475. package/dist/styles/grid.css +1 -1
  476. package/dist/styles/header.css +1 -1
  477. package/dist/styles/heatmap-chart.css +2 -0
  478. package/dist/styles/highlight.css +1 -1
  479. package/dist/styles/hover-card.css +2 -0
  480. package/dist/styles/icon-button.css +1 -1
  481. package/dist/styles/image.css +2 -0
  482. package/dist/styles/line-chart.css +2 -0
  483. package/dist/styles/list.css +1 -1
  484. package/dist/styles/locale.css +1 -1
  485. package/dist/styles/menu.css +1 -1
  486. package/dist/styles/menubar.css +1 -1
  487. package/dist/styles/meter.css +2 -0
  488. package/dist/styles/mockup.css +2 -0
  489. package/dist/styles/navigation-menu.css +1 -1
  490. package/dist/styles/number-field.css +1 -1
  491. package/dist/styles/otp-field.css +1 -1
  492. package/dist/styles/overlay.css +1 -1
  493. package/dist/styles/page-layout.css +1 -1
  494. package/dist/styles/pagination.css +1 -1
  495. package/dist/styles/panes.css +1 -1
  496. package/dist/styles/pie-chart.css +2 -0
  497. package/dist/styles/pill.css +1 -1
  498. package/dist/styles/popconfirm.css +2 -0
  499. package/dist/styles/popover.css +1 -1
  500. package/dist/styles/portal.css +2 -0
  501. package/dist/styles/progress-box.css +1 -1
  502. package/dist/styles/progress-circular.css +1 -1
  503. package/dist/styles/progress-linear.css +1 -1
  504. package/dist/styles/radio-group.css +1 -1
  505. package/dist/styles/rating.css +1 -1
  506. package/dist/styles/scatter-chart.css +2 -0
  507. package/dist/styles/scroll-area.css +2 -0
  508. package/dist/styles/scroll-zone.css +2 -0
  509. package/dist/styles/segmented-button.css +1 -1
  510. package/dist/styles/select.css +1 -1
  511. package/dist/styles/shortcut.css +1 -1
  512. package/dist/styles/show.css +2 -0
  513. package/dist/styles/sidebar.css +1 -1
  514. package/dist/styles/skeleton.css +1 -1
  515. package/dist/styles/slider.css +1 -1
  516. package/dist/styles/snackbar.css +1 -1
  517. package/dist/styles/sparkline.css +2 -0
  518. package/dist/styles/spoiler.css +1 -1
  519. package/dist/styles/stack.css +2 -0
  520. package/dist/styles/statistic.css +2 -0
  521. package/dist/styles/stepper.css +2 -0
  522. package/dist/styles/switch.css +1 -1
  523. package/dist/styles/table.css +1 -1
  524. package/dist/styles/tabs.css +1 -1
  525. package/dist/styles/text-field.css +1 -1
  526. package/dist/styles/text-link.css +1 -1
  527. package/dist/styles/time-picker.css +1 -1
  528. package/dist/styles/timeline-chart.css +2 -0
  529. package/dist/styles/timeline.css +1 -1
  530. package/dist/styles/toggle.css +1 -1
  531. package/dist/styles/tokens.css +1 -1
  532. package/dist/styles/toolbar.css +2 -0
  533. package/dist/styles/tour.css +2 -0
  534. package/dist/styles/transfer.css +1 -1
  535. package/dist/styles/tree-select.css +2 -0
  536. package/dist/styles/tree-view.css +2 -0
  537. package/dist/styles/typography.css +1 -1
  538. package/dist/styles/visually-hidden.css +2 -0
  539. package/dist/styles.css +1 -1
  540. package/dist/tailwind.css +1423 -114
  541. package/dist/types.d.ts +628 -3
  542. package/package.json +8 -2
  543. package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
  544. package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
  545. package/dist/components/avatar-group/index.d.ts +0 -2
  546. package/dist/components/avatar-group/index.js +0 -1
  547. package/dist/internal/avatar-group.d.ts +0 -22
  548. package/dist/internal/avatar-group.js +0 -2
  549. package/dist/styles/avatar-group.css +0 -2
@@ -0,0 +1,165 @@
1
+ import * as React from 'react';
2
+ import type { MPColor, MPOrientation, MPSize, MPVariant } from '../../types.js';
3
+ /**
4
+ * When the two scroll buttons are drawn.
5
+ *
6
+ * - `auto` — neither while everything fits, and at an end whichever costs less.
7
+ * An `overlay` button with nowhere to go is removed, an `inline` one is drawn
8
+ * `disabled`. The default.
9
+ * - `always` — both, from the first paint, `disabled` rather than gone at an
10
+ * end. What a strip whose content arrives from a fetch wants, so the buttons
11
+ * are not appearing under the pointer half a second in.
12
+ * - `none` — none at all. The wheel, a finger, a drag and the arrow keys are
13
+ * all still there; this is the strip that scrolls the way a phone scrolls.
14
+ */
15
+ export type MPScrollZoneButtons = 'auto' | 'always' | 'none';
16
+ /**
17
+ * Where those buttons sit, which is also where the strip ends.
18
+ *
19
+ * - `inline` — beside the strip, in the layout. The default. The scroller stops
20
+ * where the button starts, so an item is cut off at the button's edge rather
21
+ * than sliding under it: nothing is ever half-hidden behind a control.
22
+ * - `overlay` — over the ends of the strip, which keeps every pixel of the box
23
+ * for content. What a shelf of pictures wants, where the thing under the
24
+ * button is a picture that carries on.
25
+ *
26
+ * The lane an `inline` button sits in is held open even while that button has
27
+ * nowhere to go, or the strip would resize under the pointer each time it
28
+ * reached an end. That is also what decides what `buttons="auto"` does there:
29
+ * the lane is paid for either way, so an inline button stays and goes
30
+ * `disabled`, while an overlay one — whose absence is free — is removed.
31
+ */
32
+ export type MPScrollZoneButtonPlacement = 'inline' | 'overlay';
33
+ /**
34
+ * What pressing one does.
35
+ *
36
+ * - `item` — moves to the next child along, `step` of them at a time. The
37
+ * default, and the only one that lands on something rather than between two
38
+ * things.
39
+ * - `page` — moves by everything currently in view, the way Page Down does.
40
+ * - `hold` — travels for as long as the button is held, at `speed` pixels a
41
+ * second. A press too short to be a hold moves one item instead, so the
42
+ * button is never dead to a quick tap.
43
+ */
44
+ export type MPScrollZoneMode = 'item' | 'page' | 'hold';
45
+ export interface MPScrollZoneProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
46
+ /**
47
+ * Which way the children run, and so which way the zone scrolls.
48
+ * @default 'horizontal'
49
+ */
50
+ orientation?: MPOrientation;
51
+ /**
52
+ * How many rows a horizontal zone lays its children out in before it starts a
53
+ * new column, and how many columns a vertical one uses. `2` is the shelf that
54
+ * holds twice as much in the same width.
55
+ * @default 1
56
+ */
57
+ lines?: number;
58
+ /**
59
+ * The space between children. A number is pixels, a string is any CSS length.
60
+ * @default 8
61
+ */
62
+ gap?: number | string;
63
+ /** When the scroll buttons are drawn. @default 'auto' */
64
+ buttons?: MPScrollZoneButtons;
65
+ /**
66
+ * Whether they sit beside the strip or over it.
67
+ * @default 'inline'
68
+ */
69
+ buttonPlacement?: MPScrollZoneButtonPlacement;
70
+ /** What pressing one does. @default 'item' */
71
+ mode?: MPScrollZoneMode;
72
+ /** How many children one press moves, in `item` mode. @default 1 */
73
+ step?: number;
74
+ /** How fast a held button travels, in pixels a second. @default 900 */
75
+ speed?: number;
76
+ /**
77
+ * Snaps the nearest child to the leading edge when the scrolling stops. The
78
+ * wheel and a drag included, not only the buttons.
79
+ * @default false
80
+ */
81
+ snap?: boolean;
82
+ /**
83
+ * Lets a mouse or a pen drag the strip along, the way a finger already can.
84
+ *
85
+ * Touch is left to the browser, whose own scrolling beats anything a handler
86
+ * can imitate: momentum, rubber-banding and the scrollbar all come with it.
87
+ * @default true
88
+ */
89
+ drag?: boolean;
90
+ /**
91
+ * Turns a wheel rolled over the strip into travel along it — the one axis a
92
+ * mouse has, on a strip that does not run along it.
93
+ *
94
+ * Off by default, because a wheel taken from the page is the page's: a reader
95
+ * who meant to scroll past the shelf is held by it instead. What it does take
96
+ * it gives back at the ends, so a strip with nothing left ahead of it is
97
+ * something to scroll past rather than something to be caught in. A trackpad
98
+ * swiping sideways is left alone, and a vertical zone ignores the prop —
99
+ * there the wheel already points the way the strip runs.
100
+ * @default false
101
+ */
102
+ wheel?: boolean;
103
+ /** Shows the browser's own scrollbar under the strip. @default false */
104
+ scrollbar?: boolean;
105
+ /**
106
+ * How the scroll buttons are drawn.
107
+ * @default 'filled'
108
+ */
109
+ variant?: MPVariant;
110
+ /**
111
+ * The size of those buttons, and how far they sit from the strip. Not the
112
+ * size of a child, which is whatever the caller made it.
113
+ * @default 'md'
114
+ */
115
+ size?: MPSize;
116
+ /** Which accent family they read. @default 'primary' */
117
+ color?: MPColor;
118
+ /** What the strip is called: "Categories", "Recent files". */
119
+ label?: string;
120
+ /** Defaults to the wording in `locale`. */
121
+ previousLabel?: string;
122
+ /** The same. */
123
+ nextLabel?: string;
124
+ /**
125
+ * Which language the buttons name themselves in. Falls back to the nearest
126
+ * `MPLocaleProvider`, then to English.
127
+ */
128
+ locale?: string;
129
+ /** The strip. Every top-level child is one item of it. */
130
+ children?: React.ReactNode;
131
+ }
132
+ /**
133
+ * A strip of anything, laid out in one direction and scrolled in it.
134
+ *
135
+ * The mechanism is an ordinary scroll container, and everything the component
136
+ * offers is a way of driving one. Swiping on a phone, two-finger dragging on a
137
+ * trackpad, the arrow keys and the scrollbar are the browser's own and are never
138
+ * intercepted. What is added on top is a pair of buttons for the pointer that
139
+ * has neither a wheel nor a finger, a mouse drag for the strip that reads as
140
+ * something to pull, and — only where it is asked for — the wheel turned onto
141
+ * the axis the strip runs along.
142
+ *
143
+ * ```tsx
144
+ * <MPScrollZone label="Categories">
145
+ * <MPChip>Coffee</MPChip>
146
+ * <MPChip>Tea</MPChip>
147
+ * </MPScrollZone>
148
+ * ```
149
+ *
150
+ * ## Nothing is transformed
151
+ *
152
+ * A translated track would have to argue for an exception to the rule the rest
153
+ * of the library keeps; a scroll offset does not. It is also what makes the
154
+ * strip run the other way under RTL without being told, keeps the scrollbar
155
+ * honest, and lets the browser scroll a focused child into view on its own.
156
+ *
157
+ * ## What separates it from `MPCarousel`
158
+ *
159
+ * `lines`, and what it implies. A carousel is one thing at a time and knows
160
+ * which one — it has a `value`, an index, and a row of marks saying where the
161
+ * reader is. A scroll zone has none of those, because it is a shelf that
162
+ * happens to be longer than the room it is in: there is no current item to
163
+ * report, and two rows of thumbnails is a shape a carousel cannot hold.
164
+ */
165
+ export declare const MPScrollZone: React.ForwardRefExoticComponent<MPScrollZoneProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIconButton as r}from"../icon-button/MPIconButton.js";import{MPIcon as o}from"../icon/MPIcon.js";import{ChevronLeftIcon as i,ChevronRightIcon as l,ChevronDownIcon as s}from"../../constants/icons.js";import{accentSlots as a}from"../../internal/accent.js";import{cssLength as c}from"../../internal/length.js";import{useMPLocale as u,useMPMessages as d}from"../../internal/locale.js";import{SCROLL as m}from"../../internal/messages/scroll.js";import{CONTROL_ICON as f}from"../../internal/scale.js";import{useMPColor as p,useMPSize as b}from"../../internal/config.js";const v={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},w={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const MPScrollZone=/*@__PURE__*/n.forwardRef(function({orientation:h="horizontal",lines:g=1,gap:y=8,buttons:x="auto",buttonPlacement:k="inline",mode:L="item",step:E=1,speed:j=900,snap:M=!1,drag:C=!0,wheel:P=!1,scrollbar:z=!1,variant:R="filled",size:N,color:T,label:A,previousLabel:B,nextLabel:D,locale:W,className:S,style:F,children:I,...Y},_){const H=b(N),X=p(T),q=d(m,u(W)),K="horizontal"===h,O=Math.max(1,Math.round(g)),$=Math.max(1,Math.round(E)),V="inline"===k,Z=n.useRef(null),G=n.useRef(null),[J,Q]=n.useState({back:!1,forward:!1}),U=n.useCallback(()=>{const e=Z.current;if(!e)return;const t=K?e.clientWidth:e.clientHeight,n=K?e.scrollWidth:e.scrollHeight,r=Math.abs(K?e.scrollLeft:e.scrollTop);Q(e=>{const o=r>1,i=n-t-r>1;return e.back===o&&e.forward===i?e:{back:o,forward:i}})},[K]);n.useEffect(()=>{const e=Z.current,t=G.current;if(U(),!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(U);return n.observe(e),t&&n.observe(t),()=>n.disconnect()},[U]);const ee=n.useCallback(()=>{const e=Z.current;return e&&K&&"rtl"===getComputedStyle(e).direction?-1:1},[K]),te=n.useCallback((e,t)=>{const n=Z.current;if(!n)return;const r=t?"undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth":"auto";n.scrollBy(K?{left:e,behavior:r}:{top:e,behavior:r})},[K]),ne=n.useCallback(()=>{const e=Z.current,t=G.current;if(!e||!t)return[];const n=K&&"rtl"===getComputedStyle(e).direction,r=K?n?"right":"left":"top",o=n?-1:1,i=e.getBoundingClientRect()[r],l=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-i)*o);l.includes(t)||l.push(t)}return l.sort((e,t)=>e-t)},[K]),re=n.useCallback((e,t=L)=>{const n=Z.current;if(!n)return;const r=ee(),o=K?n.clientWidth:n.clientHeight;if("page"===t)return void te(o*(e?1:-1)*r,!0);const i=ne(),l=i.filter(e=>e>1),s=i.filter(e=>e<-1),a=e?l[$-1]:s[s.length-$];te(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[ee,K,ne,$,L,te]),oe=n.useRef(null);n.useEffect(()=>()=>oe.current?.(),[]);const ie=n.useCallback((e,t)=>{if(oe.current)return;const n=ee(),r=performance.now();let o=r,i=0;const l=t=>{const r=t-o;o=t,te(j*r/1e3*(e?1:-1)*n,!1),i=requestAnimationFrame(l)};i=requestAnimationFrame(l);const s=()=>{cancelAnimationFrame(i),oe.current=null,window.removeEventListener(t,s),window.removeEventListener("pointercancel",s),window.removeEventListener("blur",s),performance.now()-r<140&&re(e,"item")};oe.current=s,window.addEventListener(t,s),window.addEventListener("pointercancel",s),window.addEventListener("blur",s)},[re,ee,te,j]),le=n.useRef(null);function se(e){return"hold"!==L?{onClick:()=>re(e)}:{onPointerDown:t=>{0===t.button&&ie(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),ie(e,"keyup"))}}}n.useEffect(()=>()=>le.current?.(),[]),n.useEffect(()=>{const e=Z.current;if(!e||!P||!K)return;const t=t=>{if(t.ctrlKey||Math.abs(t.deltaX)>Math.abs(t.deltaY))return;const n=1===t.deltaMode?16:2===t.deltaMode?e.clientWidth:1,r=t.deltaY*n;if(!r)return;const o=Math.abs(e.scrollLeft);(r>0?e.scrollWidth-e.clientWidth-o>1:o>1)&&(t.preventDefault(),te(r*ee(),!1))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[ee,K,te,P]);const ae="none"!==x&&("always"===x||J.back||J.forward);function ce(t){const n=t?J.forward:J.back;if("auto"===x&&!n&&!V)return e("span",{});const a=e(r,{variant:R,size:H,color:X,label:t?D??q.next:B??q.previous,disabled:!n,className:"pointer-events-auto",icon:e(o,{icon:K?t?l:i:s,size:f[H],className:K?"rtl:rotate-180":t?"":"rotate-180"}),...se(t)});return V?e("span",{className:"flex shrink-0 items-center justify-center",children:a}):a}return t("div",{ref:_,"data-mp-size":H,"data-mp-variant":R,className:["mp-scroll-zone relative flex min-w-0",V&&K?"flex-row items-stretch":"flex-col",V?w[H]:"",S??""].filter(Boolean).join(" "),style:{...a(X),...F},...Y,children:[ae&&V?ce(!1):null,e("div",{ref:Z,tabIndex:0,role:"group","aria-label":A??q.label,className:["mp-scroll-zone__scroller","min-h-0 min-w-0 grow",K?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden",M?K?"snap-x snap-mandatory":"snap-y snap-mandatory":"",z?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",C&&(J.back||J.forward)?"cursor-grab data-dragging:cursor-grabbing":"","outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].filter(Boolean).join(" "),onScroll:U,onPointerDown:function(e){if(!C||"touch"===e.pointerType||0!==e.button)return;le.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,o=t.scrollLeft,i=t.scrollTop;let l=!1;const s=document.body.style.getPropertyValue("-webkit-user-select"),a=e=>{const s=e.clientX-n,a=e.clientY-r;if(!l){if(Math.abs(K?s:a)<4)return;l=!0;try{t.setPointerCapture(e.pointerId)}catch{}t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none")}K?t.scrollLeft=o-s:t.scrollTop=i-a},c=()=>{le.current=null,t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",u),t.removeEventListener("pointercancel",c),delete t.dataset.dragging,s?document.body.style.setProperty("-webkit-user-select",s):document.body.style.removeProperty("-webkit-user-select")},u=()=>{const e=l;if(c(),!e)return;const n=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",n,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",n,!0),0)};le.current=c,t.addEventListener("pointermove",a),t.addEventListener("pointerup",u),t.addEventListener("pointercancel",c)},children:e("div",{ref:G,className:["mp-scroll-zone__track",M?"[&>*]:snap-start":""].filter(Boolean).join(" "),style:{display:"grid",gap:c(y),gridAutoFlow:K?"column":"row",...K?{width:"max-content",gridTemplateRows:`repeat(${O}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${O}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:I})}),ae&&V?ce(!0):null,ae&&!V?t("div",{className:["pointer-events-none absolute inset-0 flex justify-between",K?"items-center":"flex-col items-center",v[H]].join(" "),children:[ce(!1),ce(!0)]}):null]})});
@@ -0,0 +1,2 @@
1
+ export { MPScrollZone } from './MPScrollZone.js';
2
+ export type { MPScrollZoneButtonPlacement, MPScrollZoneButtons, MPScrollZoneMode, MPScrollZoneProps } from './MPScrollZone.js';
@@ -0,0 +1 @@
1
+ export{MPScrollZone}from"./MPScrollZone.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{Toggle as n}from"@base-ui/react/toggle";import{ToggleGroup as o}from"@base-ui/react/toggle-group";import{MPIcon as a}from"../icon/MPIcon.js";import{CheckIcon as s}from"../../constants/icons.js";import{MPStateLayer as i}from"../../internal/StateLayer.js";import{CONTROL_GAP as l,CONTROL_HEIGHT as d,CONTROL_ICON as c,CONTROL_PAD_X as m,CONTROL_TEXT as u}from"../../internal/scale.js";export const MPSegmentedButton=/*@__PURE__*/r.forwardRef(function({items:r,value:p,defaultValue:f,onValueChange:b,multiple:h=!1,showCheck:g=!0,size:y="md",fullWidth:j=!1,disabled:x=!1,"aria-label":v,className:w,style:N},B){return e(o,{ref:B,"aria-label":v,value:p,defaultValue:f,onValueChange:e=>b?.(e),multiple:h,disabled:x,"data-mp-size":y,className:["mp-segmented-button rounded-mp-full box-border items-center align-middle","overflow-hidden border",x?"border-mp-on-surface/12":"border-mp-outline",j?"flex w-full":"inline-flex w-fit",d[y],w??""].filter(Boolean).join(" "),style:N,children:r.map((r,o)=>{const d=x||r.disabled;return t(n,{value:r.value,disabled:r.disabled,className:["mp-segmented-button__segment group relative flex h-full items-center","box-border justify-center bg-transparent font-[inherit] whitespace-nowrap","select-none","appearance-none overflow-hidden outline-none","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)",u[y],l[y],m[y],0===o?"":"border-s",d?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":["border-mp-outline cursor-pointer","text-mp-on-surface","data-pressed:bg-mp-secondary-container","data-pressed:text-mp-on-secondary-container"].join(" "),j?"flex-1":""].filter(Boolean).join(" "),children:[d?null:e(i,{}),g||r.icon?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:c[y],height:c[y]},children:[g?e("span",{className:["absolute inset-0 flex items-center justify-center opacity-0","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-pressed:opacity-100"].join(" "),children:e(a,{icon:s,size:c[y]})}):null,r.icon?e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",g?"group-data-pressed:opacity-0":""].filter(Boolean).join(" "),children:r.icon}):null]}):null,e("span",{className:"truncate",children:r.label})]},`${o}:${r.value}`)})})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{Toggle as o}from"@base-ui/react/toggle";import{ToggleGroup as r}from"@base-ui/react/toggle-group";import{MPIcon as a}from"../icon/MPIcon.js";import{CheckIcon as s}from"../../constants/icons.js";import{MPStateLayer as i}from"../../internal/StateLayer.js";import{CONTROL_GAP as l,CONTROL_HEIGHT as c,CONTROL_ICON as d,CONTROL_PAD_X as m,CONTROL_TEXT as u}from"../../internal/scale.js";import{useMPSize as p}from"../../internal/config.js";export const MPSegmentedButton=/*@__PURE__*/n.forwardRef(function({items:n,value:f,defaultValue:b,onValueChange:h,multiple:g=!1,showCheck:y=!0,size:j,fullWidth:x=!1,disabled:v=!1,"aria-label":w,className:N,style:B},V){const k=p(j);return e(r,{ref:V,"aria-label":w,value:f,defaultValue:b,onValueChange:e=>h?.(e),multiple:g,disabled:v,"data-mp-size":k,className:["mp-segmented-button rounded-mp-full box-border items-center align-middle","overflow-hidden border",v?"border-mp-on-surface/12":"border-mp-outline",x?"flex w-full":"inline-flex w-fit",c[k],N??""].filter(Boolean).join(" "),style:B,children:n.map((n,r)=>{const c=v||n.disabled;return t(o,{value:n.value,disabled:n.disabled,className:["mp-segmented-button__segment group relative flex h-full items-center","box-border justify-center bg-transparent font-[inherit] whitespace-nowrap","select-none","appearance-none overflow-hidden outline-none","transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)",u[k],l[k],m[k],0===r?"":"border-s",c?"border-mp-on-surface/12 text-mp-on-surface/38 cursor-default":["border-mp-outline cursor-pointer","text-mp-on-surface","data-pressed:bg-mp-secondary-container","data-pressed:text-mp-on-secondary-container"].join(" "),x?"flex-1":""].filter(Boolean).join(" "),children:[c?null:e(i,{}),y||n.icon?t("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:d[k],height:d[k]},children:[y?e("span",{className:["absolute inset-0 flex items-center justify-center opacity-0","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard group-data-pressed:opacity-100"].join(" "),children:e(a,{icon:s,size:d[k]})}):null,n.icon?e("span",{className:["absolute inset-0 flex items-center justify-center","transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",y?"group-data-pressed:opacity-0":""].filter(Boolean).join(" "),children:n.icon}):null]}):null,e("span",{className:"truncate",children:n.label})]},`${r}:${n.value}`)})})});
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { MPStyleProps } from '../../types.js';
2
+ import type { MPControlEventProps, MPSlots, MPStyleProps } from '../../types.js';
3
3
  /**
4
4
  * What a select's value may be.
5
5
  *
@@ -18,12 +18,13 @@ export interface MPSelectOption {
18
18
  /** Unavailable, but still listed — the option exists, it just cannot be taken. */
19
19
  disabled?: boolean;
20
20
  }
21
- export interface MPSelectProps extends MPStyleProps {
21
+ export interface MPSelectProps extends MPStyleProps, MPControlEventProps<HTMLButtonElement> {
22
22
  /**
23
23
  * The options, as data. There is no `<MPSelect.Option>` to compose: what a
24
24
  * caller has is almost always an array already, and the list has to be
25
25
  * available to the trigger before the popup has ever been opened — otherwise
26
- * a closed select can only show its raw value. *
26
+ * a closed select can only show its raw value.
27
+ *
27
28
  * ## How long a list this holds
28
29
  *
29
30
  * Every row is rendered, and there is no windowing. That is the right default
@@ -37,9 +38,19 @@ export interface MPSelectProps extends MPStyleProps {
37
38
  * slice.
38
39
  */
39
40
  items: readonly MPSelectOption[];
40
- /** The chosen value. Use with `onValueChange` for a controlled select. */
41
+ /**
42
+ * The chosen value. Use with `onValueChange` for a controlled select.
43
+ *
44
+ * **Nothing chosen is `null`**, and it is worth saying out loud because the
45
+ * near miss is quiet. A value with no matching entry in `items` has no label
46
+ * to show, so the trigger draws the value itself: a form holding `0` for "not
47
+ * picked yet" sits there reading `0`. That is the right answer for a value
48
+ * that is real and whose row has not arrived yet — the alternative is a field
49
+ * that says nothing about a value it is holding and will submit — but it is
50
+ * not the answer anybody wants for a sentinel.
51
+ */
41
52
  value?: MPSelectValue | null;
42
- /** The value chosen at the start, for an uncontrolled select. */
53
+ /** The value chosen at the start, for an uncontrolled select. `null` is none. */
43
54
  defaultValue?: MPSelectValue | null;
44
55
  /** Called with the newly chosen value — a value, not an event. */
45
56
  onValueChange?: (value: MPSelectValue | null) => void;
@@ -97,6 +108,18 @@ export interface MPSelectProps extends MPStyleProps {
97
108
  */
98
109
  className?: string;
99
110
  style?: React.CSSProperties;
111
+ /**
112
+ * A class name for a part `className` cannot reach.
113
+ *
114
+ * The list renders at the end of `<body>`, outside the element `className`
115
+ * lands on — no selector written against the root will ever find it — and the
116
+ * options are drawn from `options` rather than written by the caller, so there
117
+ * is no element of theirs to put a class on.
118
+ *
119
+ * - `popup` — the sheet the options are drawn on.
120
+ * - `item` — every option in it.
121
+ */
122
+ classNames?: MPSlots<'popup' | 'item'>;
100
123
  }
101
124
  /**
102
125
  * A Material Design select.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Select as n}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as i}from"../icon/MPIcon.js";import{CheckIcon as l,ChevronDownIcon as o}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as d,useFloatingLabel as c}from"../../internal/FieldOutline.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{MPSupportingText as p}from"../../internal/SupportingText.js";import{CONTROL_ICON as u,PROSE_TEXT as f,hasContent as h}from"../../internal/scale.js";import{FADE as g,PORTAL_LAYER as x}from"../../internal/surface.js";const v={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}};export const MPSelect=/*@__PURE__*/t.forwardRef(function({items:b,value:j,defaultValue:N,onValueChange:y,placeholder:w,label:I,floatingLabel:S=!0,description:k,errorMessage:z,startIcon:P,size:M="md",fullWidth:O=!1,required:V=!1,disabled:q=!1,readOnly:T=!1,name:_,id:C,className:L,style:R},B){const F=h(z),W=v[M],$=t.useId(),A=C??$,[D,E]=t.useState(N??null),[G,H]=t.useState(!1),J=void 0===j?D:j,{shrunk:K,focusProps:Q}=c({floating:S&&h(I),filled:null!==J&&""!==J,pinned:G||!!P}),U=t.useMemo(()=>b.map(e=>({label:e.label??String(e.value),value:e.value})),[b]);return a(r.Root,{className:["mp-select group flex-col align-top",O?"flex w-full":"inline-flex w-fit",L??""].filter(Boolean).join(" "),style:R,disabled:q,invalid:F,"data-mp-size":M,...Q,children:[a(n.Root,{id:A,name:_,items:U,value:j,defaultValue:N,onValueChange:e=>{E(e??null),y?.(e??null)},onOpenChange:H,disabled:q,readOnly:T,required:V,children:[a("div",{className:"relative w-full",children:[a(n.Trigger,{ref:B,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",W.padding,W.height,f[M],q?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(T?"cursor-default":"cursor-pointer")].join(" "),children:[P?e("span",{className:["flex shrink-0 items-center",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:P}):null,e(n.Value,{className:["min-w-0 flex-1 truncate text-start","data-placeholder:text-mp-on-surface-variant",q?"data-placeholder:text-mp-on-surface/38":""].filter(Boolean).join(" "),placeholder:K?w:void 0}),e(n.Icon,{className:["flex shrink-0 items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180",q?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:e(i,{icon:o,size:u[M]})})]}),e(d,{label:I,required:V,notched:K}),h(I)?e(s,{size:M,label:I,required:V,htmlFor:A,shrunk:K}):null]}),e(n.Portal,{children:e(n.Positioner,{className:x,sideOffset:4,alignItemWithTrigger:!1,children:e(n.Popup,{className:["mp-select__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface min-w-[var(--anchor-width)] outline-none",f[M],g].join(" "),children:e(n.List,{className:"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",children:b.map((t,r)=>a(n.Item,{value:t.value,disabled:t.disabled,className:["mp-select__item group rounded-mp-xs relative flex cursor-pointer items-center","gap-3 py-2 pe-3 ps-2 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:text-mp-on-secondary-container","data-selected:bg-mp-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(m,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:e(n.ItemIndicator,{children:e(i,{icon:l,size:18})})}),e(n.ItemText,{className:"min-w-0 flex-1 truncate",children:t.label??String(t.value)})]},`${r}:${String(t.value)}`))})})})})]}),e(p,{description:k,errorMessage:z,className:W.padding})]})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Select as t}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as o}from"../icon/MPIcon.js";import{CheckIcon as i,ChevronDownIcon as l}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as c,useFloatingLabel as d}from"../../internal/FieldOutline.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{MPSupportingText as p}from"../../internal/SupportingText.js";import{CONTROL_ICON as u,PROSE_TEXT as f,hasContent as h}from"../../internal/scale.js";import{MARK_MOTION_KEPT as g}from"../../internal/mark.js";import{FADE as x,PORTAL_LAYER as b}from"../../internal/surface.js";import{useMPSize as v}from"../../internal/config.js";const j={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}};export const MPSelect=/*@__PURE__*/n.forwardRef(function({items:y,value:N,defaultValue:k,onValueChange:w,onKeyDown:C,onKeyUp:I,onFocus:M,onBlur:S,onClick:z,onDoubleClick:P,onContextMenu:_,placeholder:B,label:O,floatingLabel:V=!0,description:q,errorMessage:D,startIcon:F,size:K,fullWidth:T=!1,required:L=!1,disabled:R=!1,readOnly:$=!1,name:U,id:W,classNames:A,className:E,style:G},H){const J=v(K),Q=h(D),X=j[J],Y=n.useId(),Z=W??Y,[ee,ae]=n.useState(k??null),[ne,te]=n.useState(!1),re=void 0===N?ee:N,{shrunk:oe,focusProps:ie}=d({floating:V&&h(O),filled:null!==re&&""!==re,pinned:ne||!!F}),le=n.useMemo(()=>y.map(e=>({label:e.label??String(e.value),value:e.value})),[y]);return a(r.Root,{className:["mp-select group flex-col align-top",T?"flex w-full":"inline-flex w-fit",E??""].filter(Boolean).join(" "),style:G,disabled:R,invalid:Q,"data-mp-size":J,...ie,children:[a(t.Root,{id:Z,name:U,items:le,value:N,defaultValue:k,onValueChange:e=>{ae(e??null),w?.(e??null)},onOpenChange:te,disabled:R,readOnly:$,required:L,children:[a("div",{className:"relative w-full",children:[a(t.Trigger,{ref:H,onKeyDown:C,onKeyUp:I,onFocus:M,onBlur:S,onClick:z,onDoubleClick:P,onContextMenu:_,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",X.padding,X.height,f[J],R?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+($?"cursor-default":"cursor-pointer")].join(" "),children:[F?e("span",{className:["flex shrink-0 items-center",R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:F}):null,e(t.Value,{className:["min-w-0 flex-1 truncate text-start","data-placeholder:text-mp-on-surface-variant",R?"data-placeholder:text-mp-on-surface/38":""].filter(Boolean).join(" "),placeholder:oe?B:void 0}),e(t.Icon,{className:["flex shrink-0 items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180",R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:e(o,{icon:l,size:u[J]})})]}),e(c,{label:O,required:L,notched:oe}),h(O)?e(s,{size:J,label:O,required:L,htmlFor:Z,shrunk:oe}):null]}),e(t.Portal,{children:e(t.Positioner,{className:b,sideOffset:4,alignItemWithTrigger:!1,children:e(t.Popup,{className:["mp-select__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface min-w-[var(--anchor-width)] outline-none",f[J],x,A?.popup??""].filter(Boolean).join(" "),children:e(t.List,{className:"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",children:y.map((n,r)=>a(t.Item,{value:n.value,disabled:n.disabled,className:["mp-select__item group rounded-mp-xs relative flex cursor-pointer items-center",A?.item??"","gap-3 py-2 pe-3 ps-2 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:text-mp-on-secondary-container","data-selected:bg-mp-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(m,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:e(t.ItemIndicator,{keepMounted:!0,className:`mp-select__mark ${g}`,children:e(o,{icon:i,size:18})})}),e(t.ItemText,{className:"min-w-0 flex-1 truncate",children:n.label??String(n.value)})]},`${r}:${String(n.value)}`))})})})})]}),e(p,{description:q,errorMessage:D,className:X.padding})]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,Fragment as n,jsxs as a}from"react/jsx-runtime";import*as m from"react";import{accentSlots as t}from"../../internal/accent.js";import{tokenizeShortcut as o,useDetectedOS as r}from"../../internal/keys.js";import{VISUALLY_HIDDEN as l}from"../../internal/visually-hidden.js";const s=e=>({symbol:e,name:e}),i={mod:{mac:{symbol:"⌘",name:"Command"},windows:s("Ctrl"),linux:s("Ctrl")},meta:{mac:{symbol:"⌘",name:"Command"},windows:s("Win"),linux:s("Super")},ctrl:{mac:{symbol:"⌃",name:"Control"},windows:s("Ctrl"),linux:s("Ctrl")},alt:{mac:{symbol:"⌥",name:"Option"},windows:s("Alt"),linux:s("Alt")},shift:{mac:{symbol:"⇧",name:"Shift"},windows:s("Shift"),linux:s("Shift")},enter:{mac:{symbol:"↩",name:"Enter"},windows:s("Enter"),linux:s("Enter")},tab:{mac:{symbol:"⇥",name:"Tab"},windows:s("Tab"),linux:s("Tab")},escape:{mac:{symbol:"⎋",name:"Escape"},windows:s("Esc"),linux:s("Esc")},backspace:{mac:{symbol:"⌫",name:"Backspace"},windows:s("Backspace"),linux:s("Backspace")},delete:{mac:{symbol:"⌦",name:"Delete"},windows:s("Del"),linux:s("Del")},capslock:{mac:{symbol:"⇪",name:"Caps Lock"},windows:s("Caps Lock"),linux:s("Caps Lock")}},c={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock"},d={up:{symbol:"↑",name:"Arrow up"},down:{symbol:"↓",name:"Arrow down"},left:{symbol:"←",name:"Arrow left"},right:{symbol:"→",name:"Arrow right"},arrowup:{symbol:"↑",name:"Arrow up"},arrowdown:{symbol:"↓",name:"Arrow down"},arrowleft:{symbol:"←",name:"Arrow left"},arrowright:{symbol:"→",name:"Arrow right"}};const p={xs:"h-5",sm:"h-6",md:"h-8",lg:"h-10",xl:"h-12"},u={xs:"min-w-5",sm:"min-w-6",md:"min-w-8",lg:"min-w-10",xl:"min-w-12"},w={xs:"text-mp-label-small",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-label-large",xl:"text-mp-title-medium"},x={xs:"px-1",sm:"px-1.5",md:"px-2",lg:"px-2.5",xl:"px-3"},b={xs:"rounded-mp-xs",sm:"rounded-mp-xs",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"},f={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface-variant",outlined:"border-mp-outline-variant text-mp-on-surface-variant border bg-transparent",text:"text-mp-on-surface-variant bg-mp-surface-container"};export const MPShortcut=/*@__PURE__*/m.forwardRef(function({variant:y="outlined",size:h="md",color:g="secondary",keys:k,os:C="auto",separator:v,className:A,style:j,...E},N){const S=r(),_="auto"===C?S:C,B=o(k).map(e=>function(e,n){const a=e.toLowerCase().replace(/[\s_-]/g,""),m=c[a]??a,t=d[m];if(t)return t;const o=i[m];return o?o[n]:s(1===e.length?e.toUpperCase():e)}(e,_)),L=void 0===v?"mac"===_?null:"+":v,D=/*@__PURE__*/["inline-flex shrink-0 items-center justify-center","font-mono leading-none whitespace-nowrap tabular-nums",p[h],u[h],w[h],x[h],b[h],f[y]].join(" ");return e("span",{ref:N,"data-mp-size":h,"data-mp-variant":y,className:["mp-shortcut inline-flex max-w-full items-center gap-1 align-middle",A??""].filter(Boolean).join(" "),style:{...t(g),...j},...E,children:B.map((t,o)=>a(m.Fragment,{children:[o>0&&null!==L?e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant",children:L}):null,e("kbd",{className:D,children:t.symbol===t.name?t.symbol:a(n,{children:[e("span",{"aria-hidden":"true",children:t.symbol}),e("span",{className:l,children:t.name})]})})]},o))})});
2
+ import{jsx as e,Fragment as n,jsxs as a}from"react/jsx-runtime";import*as m from"react";import{accentSlots as t}from"../../internal/accent.js";import{tokenizeShortcut as o,useDetectedOS as r}from"../../internal/keys.js";import{VISUALLY_HIDDEN as l}from"../../internal/visually-hidden.js";import{useMPSize as s}from"../../internal/config.js";const i=e=>({symbol:e,name:e}),c={mod:{mac:{symbol:"⌘",name:"Command"},windows:i("Ctrl"),linux:i("Ctrl")},meta:{mac:{symbol:"⌘",name:"Command"},windows:i("Win"),linux:i("Super")},ctrl:{mac:{symbol:"⌃",name:"Control"},windows:i("Ctrl"),linux:i("Ctrl")},alt:{mac:{symbol:"⌥",name:"Option"},windows:i("Alt"),linux:i("Alt")},shift:{mac:{symbol:"⇧",name:"Shift"},windows:i("Shift"),linux:i("Shift")},enter:{mac:{symbol:"↩",name:"Enter"},windows:i("Enter"),linux:i("Enter")},tab:{mac:{symbol:"⇥",name:"Tab"},windows:i("Tab"),linux:i("Tab")},escape:{mac:{symbol:"⎋",name:"Escape"},windows:i("Esc"),linux:i("Esc")},backspace:{mac:{symbol:"⌫",name:"Backspace"},windows:i("Backspace"),linux:i("Backspace")},delete:{mac:{symbol:"⌦",name:"Delete"},windows:i("Del"),linux:i("Del")},capslock:{mac:{symbol:"⇪",name:"Caps Lock"},windows:i("Caps Lock"),linux:i("Caps Lock")}},d={cmdorctrl:"mod",commandorcontrol:"mod",cmd:"meta",command:"meta",super:"meta",win:"meta",windows:"meta",control:"ctrl",option:"alt",opt:"alt",return:"enter",esc:"escape",del:"delete",caps:"capslock"},p={up:{symbol:"↑",name:"Arrow up"},down:{symbol:"↓",name:"Arrow down"},left:{symbol:"←",name:"Arrow left"},right:{symbol:"→",name:"Arrow right"},arrowup:{symbol:"↑",name:"Arrow up"},arrowdown:{symbol:"↓",name:"Arrow down"},arrowleft:{symbol:"←",name:"Arrow left"},arrowright:{symbol:"→",name:"Arrow right"}};const u={xs:"h-5",sm:"h-6",md:"h-8",lg:"h-10",xl:"h-12"},w={xs:"min-w-5",sm:"min-w-6",md:"min-w-8",lg:"min-w-10",xl:"min-w-12"},x={xs:"text-mp-label-small",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-label-large",xl:"text-mp-title-medium"},b={xs:"px-1",sm:"px-1.5",md:"px-2",lg:"px-2.5",xl:"px-3"},f={xs:"rounded-mp-xs",sm:"rounded-mp-xs",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"},y={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface-variant",outlined:"border-mp-outline-variant text-mp-on-surface-variant border bg-transparent",text:"text-mp-on-surface-variant bg-mp-surface-container"};export const MPShortcut=/*@__PURE__*/m.forwardRef(function({variant:h="outlined",size:g,color:k="secondary",keys:C,os:j="auto",separator:v,className:A,style:E,...N},S){const _=s(g),B=r(),L="auto"===j?B:j,D=o(C).map(e=>function(e,n){const a=e.toLowerCase().replace(/[\s_-]/g,""),m=d[a]??a,t=p[m];if(t)return t;const o=c[m];return o?o[n]:i(1===e.length?e.toUpperCase():e)}(e,L)),T=void 0===v?"mac"===L?null:"+":v,z=/*@__PURE__*/["inline-flex shrink-0 items-center justify-center","font-mono leading-none whitespace-nowrap tabular-nums",u[_],w[_],x[_],b[_],f[_],y[h]].join(" ");return e("span",{ref:S,"data-mp-size":_,"data-mp-variant":h,className:["mp-shortcut inline-flex max-w-full items-center gap-1 align-middle",A??""].filter(Boolean).join(" "),style:{...t(k),...E},...N,children:D.map((t,o)=>a(m.Fragment,{children:[o>0&&null!==T?e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant",children:T}):null,e("kbd",{className:z,children:t.symbol===t.name?t.symbol:a(n,{children:[e("span",{"aria-hidden":"true",children:t.symbol}),e("span",{className:l,children:t.name})]})})]},o))})});
@@ -0,0 +1,78 @@
1
+ import * as React from 'react';
2
+ import { useRender } from '@base-ui/react/use-render';
3
+ import type { MPWindowClass } from '../../types.js';
4
+ export interface MPShowProps extends React.ComponentPropsWithoutRef<'div'> {
5
+ /**
6
+ * The narrowest window this is shown in. `from="medium"` is 600dp up, so it is
7
+ * absent on a phone and present everywhere else.
8
+ */
9
+ from?: MPWindowClass;
10
+ /**
11
+ * The class this stops being shown at, exclusive. `until="expanded"` is every
12
+ * window under 840dp — the mirror of `from="expanded"`, and the two of them
13
+ * over the same class cover every width exactly once.
14
+ */
15
+ until?: MPWindowClass;
16
+ /**
17
+ * One class and no other, which is `from` and `until` said together:
18
+ * `only="medium"` is 600dp to 839dp.
19
+ *
20
+ * `from` and `until` still override their own half, so
21
+ * `only="medium" until="large"` is 600dp to 1199dp. That is the same range
22
+ * `from="medium" until="large"` is, and which of the two to write is a
23
+ * question of which one reads like the intention.
24
+ */
25
+ only?: MPWindowClass;
26
+ /**
27
+ * Renders something other than a `<div>`: `render={<li />}`,
28
+ * `render={<td />}` — for the places where a bare `<div>` would not be allowed
29
+ * to sit. Base UI's own escape hatch.
30
+ */
31
+ render?: useRender.RenderProp;
32
+ children?: React.ReactNode;
33
+ }
34
+ /**
35
+ * Content at some window sizes and not others.
36
+ *
37
+ * ```tsx
38
+ * <MPShow from="expanded">
39
+ * <MPSidebar>{nav}</MPSidebar>
40
+ * </MPShow>
41
+ * <MPShow until="expanded">
42
+ * <MPBottomNavigation items={nav} />
43
+ * </MPShow>
44
+ * ```
45
+ *
46
+ * The two halves of that pair are exclusive and exhaustive over the same class,
47
+ * which is the shape worth writing: one of them is on screen at every width, and
48
+ * never both.
49
+ *
50
+ * ## It is `display: none`, not a condition
51
+ *
52
+ * Both branches are rendered and one of them is hidden by CSS, which is a
53
+ * deliberate trade rather than a shortcut. A media query is resolved by the
54
+ * browser before it paints anything, including on the server's markup — so the
55
+ * first frame is already right. [useMPWindowClass](../../guide/hooks) answers
56
+ * the same question in JavaScript, and cannot answer it until the page has
57
+ * hydrated: the first paint is a guess and the correction is a second render,
58
+ * which on a phone is a desktop navigation drawn and thrown away.
59
+ *
60
+ * So this is the one to reach for when what changes is *which* of two
61
+ * arrangements is on screen. The hook is the one to reach for when the subtree
62
+ * that is not on screen is expensive — a chart, a map, a table of a thousand
63
+ * rows — because hidden is not unmounted: it is built, laid out and skipped at
64
+ * paint, and its effects run.
65
+ *
66
+ * `display: none` also takes the content off the accessibility tree, which is
67
+ * the point. A screen reader on a narrow window reads the compact arrangement
68
+ * and not both of them.
69
+ *
70
+ * ## It is not a box
71
+ *
72
+ * The wrapper is `display: contents` while it is shown, so it takes no part in
73
+ * the layout: an `MPShow` inside a flex row makes its children the flex items,
74
+ * exactly as if it were not there. That declaration is written at zero
75
+ * specificity, so a `className` of your own that sets a display wins over it
76
+ * without a fight — and the hiding, which is a real class, still wins over both.
77
+ */
78
+ export declare const MPShow: React.ForwardRefExoticComponent<MPShowProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import*as r from"react";import{useRender as e}from"@base-ui/react/use-render";import{HIDDEN_BELOW as o,HIDDEN_FROM as i}from"../../internal/visibility.js";import{WINDOW_CLASSES as n}from"../../internal/window-class.js";export const MPShow=/*@__PURE__*/r.forwardRef(function({from:r,until:s,only:t,render:a,className:l,children:m,...f},c){const d=r??t,p=s??(t?(u=t,n[n.indexOf(u)+1]):void 0);var u;return e({render:a,ref:c,props:{className:["mp-show",d?o[d]:"",p?i[p]:"",l??""].filter(Boolean).join(" "),children:m,...f}})});
@@ -0,0 +1,2 @@
1
+ export { MPShow } from './MPShow.js';
2
+ export type { MPShowProps } from './MPShow.js';
@@ -0,0 +1 @@
1
+ export{MPShow}from"./MPShow.js";
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type MPPageCollapse, type MPSidebarSide } from '../../internal/page-layout.js';
3
- import type { MPSize, MPVariant } from '../../types.js';
3
+ import type { MPDensity, MPSize, MPElevation, MPVariant } from '../../types.js';
4
4
  export type { MPPageCollapse, MPSidebarSide } from '../../internal/page-layout.js';
5
5
  export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'title'> {
6
6
  /**
@@ -100,6 +100,16 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
100
100
  * @default 'outlined'
101
101
  */
102
102
  variant?: MPVariant;
103
+ /**
104
+ * How far off the page the bar is lifted, on MD3's own scale.
105
+ *
106
+ * It moves the tone as well as the shadow — see `MPElevation`. A bar's
107
+ * `elevated` is level 2 rather than 1, because a bar sits over the page's
108
+ * content rather than in it; an explicit level says exactly what it says.
109
+ *
110
+ * Left unset, `variant` decides.
111
+ */
112
+ elevation?: MPElevation;
103
113
  /**
104
114
  * The column's default width and the air around its content. `md` is 360px,
105
115
  * which is MD3's own navigation drawer and the same rung
@@ -107,6 +117,15 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
107
117
  * @default 'md'
108
118
  */
109
119
  size?: MPSize;
120
+ /**
121
+ * Takes room out of the air around the column's content.
122
+ *
123
+ * The width is `size`'s and does not move — a navigation column narrower than
124
+ * its labels is a column of truncated labels — so what this tightens is the
125
+ * gutter, which is what a sidebar full of destinations is competing for.
126
+ * @default 0
127
+ */
128
+ density?: MPDensity;
110
129
  /**
111
130
  * The gutter, and the air above and below the content.
112
131
  * @default true
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{BAR_SURFACE as l,drawerSide as u,EXPANDED_ONLY as d,MPPageLayoutContext as c,MPSidebarSideContext as m,useMPCollapsed as p}from"../../internal/page-layout.js";import{SHEET_PAD_X as f,SHEET_PAD_Y as b}from"../../internal/scale.js";const v={xs:"15rem",sm:"18rem",md:"22.5rem",lg:"26rem",xl:"30rem"};function y(e,t){return null==e?t:"number"==typeof e?e:o(e,"undefined"==typeof window?void 0:window.innerWidth)??t}export const MPSidebar=/*@__PURE__*/r.forwardRef(function({side:o,width:h,minWidth:g=160,maxWidth:w=480,resizable:x=!1,onResize:_,onResizeEnd:j,collapseBelow:R,open:k,defaultOpen:C=!1,onOpenChange:z,sticky:P=!0,title:E,variant:M="outlined",size:L="md",padded:B=!0,label:S,locale:N,className:A,style:D,children:O,...$},I){const W=r.useContext(c),T=r.useContext(m),X=o??T??"start",K=i(N??W.locale),V=a(s,K),q=R??(W.present?W.collapseBelow:"none"),F=p(q),[G,H]=r.useState(C),J=void 0!==k,Q=J?k:W.present?W.open[X]:G,U=e=>{J||(W.present?W.setOpen(X,e):H(e)),z?.(e)},Y=void 0===h?v[L]:"number"==typeof h?`${h}px`:h,Z=r.useRef(null),ee=r.useRef(Y),te=r.useRef(null),re=r.useId();ee.current!==Y&&(ee.current=Y,Z.current=null);const ne=Z.current??Y,oe=r.useRef(null),ie=r.useCallback(e=>{oe.current=e,"function"==typeof I?I(e):I&&(I.current=e)},[I]),ae=r.useRef(null);r.useEffect(()=>()=>ae.current?.(),[]);const se=e=>{const t=oe.current;if(!t)return e;const r=Math.min(y(w,480),Math.max(y(g,160),Math.round(e)));return Z.current=`${r}px`,t.style.setProperty("--_mp-sidebar-width",Z.current),te.current?.setAttribute("aria-valuenow",String(r)),r};return F?e(n,{side:u(X),mode:"modal",open:Q,onOpenChange:U,title:E??S??V.sidebar,size:L,locale:K,extent:void 0===h?void 0:ne,className:A,style:D,children:O}):t("aside",{ref:ie,"aria-label":S??V.sidebar,"data-mp-size":L,"data-mp-variant":M,"data-mp-side":X,className:["mp-sidebar text-mp-on-surface relative box-border flex min-w-0 shrink-0 flex-col","w-(--_mp-sidebar-width)",l[M],"outlined"===M?"border-mp-outline-variant "+("start"===X?"border-e":"border-s"):"","content"===W.scroll?"h-full":P?["self-start sticky [top:var(--_mp-layout-header,0px)]","[height:calc(100dvh_-_var(--_mp-layout-header,0px)_-_var(--_mp-layout-footer,0px))]"].join(" "):"",d[q],A??""].filter(Boolean).join(" "),style:{"--_mp-sidebar-width":ne,...D},...$,children:[e("div",{id:re,className:["mp-sidebar__body min-h-0 flex-1 overflow-y-auto overscroll-contain",B?`${f[L]} ${b[L]}`:""].filter(Boolean).join(" "),children:O}),x?e("div",{ref:te,role:"separator","aria-orientation":"vertical","aria-label":V.resizeSidebar,"aria-valuemin":Math.round(y(g,160)),"aria-valuemax":Math.round(y(w,480)),"aria-valuenow":Math.round(y(ne,y(v[L],360))),"aria-controls":re,tabIndex:0,className:["mp-sidebar__handle absolute inset-y-0 z-1 w-2 cursor-col-resize bg-transparent","start"===X?"-me-1 end-0":"-ms-1 start-0","hover:bg-mp-outline-variant data-dragging:bg-mp-outline-variant","transition-colors duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-0","focus-visible:outline-solid outline-none"].join(" "),onPointerDown:e=>{const t=oe.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,i=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,s="start"===X===a?-1:1;let l=i;const u=e=>{l=se(i+(e.clientX-o)*s),_?.(l)},d=()=>{ae.current=null,r.removeEventListener("pointermove",u),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},c=()=>{d(),j?.(l)};ae.current=d,r.addEventListener("pointermove",u),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===X===t?-1:1;(e=>{const t=oe.current;if(!t)return;const r=se(t.getBoundingClientRect().width+e);_?.(r),j?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{barSurface as l,drawerSide as d,EXPANDED_ONLY as u,MPPageLayoutContext as c,MPSidebarSideContext as m,useMPCollapsed as p}from"../../internal/page-layout.js";import{sheetPadX as f,sheetPadY as v}from"../../internal/density.js";import{useMPDensity as b,useMPSize as y}from"../../internal/config.js";const h={xs:"15rem",sm:"18rem",md:"22.5rem",lg:"26rem",xl:"30rem"};function g(e,t){return null==e?t:"number"==typeof e?e:o(e,"undefined"==typeof window?void 0:window.innerWidth)??t}export const MPSidebar=/*@__PURE__*/r.forwardRef(function({side:o,width:w,minWidth:x=160,maxWidth:j=480,resizable:_=!1,onResize:R,onResizeEnd:k,collapseBelow:C,open:z,defaultOpen:P=!1,onOpenChange:E,sticky:M=!0,title:L,variant:B="outlined",elevation:S,size:N,density:A,padded:D=!0,label:O,locale:$,className:I,style:W,children:T,...X},K){const V=y(N),q=b(A),F=r.useContext(c),G=r.useContext(m),H=o??G??"start",J=i($??F.locale),Q=a(s,J),U=C??(F.present?F.collapseBelow:"none"),Y=p(U),[Z,ee]=r.useState(P),te=void 0!==z,re=te?z:F.present?F.open[H]:Z,ne=e=>{te||(F.present?F.setOpen(H,e):ee(e)),E?.(e)},oe=void 0===w?h[V]:"number"==typeof w?`${w}px`:w,ie=r.useRef(null),ae=r.useRef(oe),se=r.useRef(null),le=r.useId();ae.current!==oe&&(ae.current=oe,ie.current=null);const de=ie.current??oe,ue=r.useRef(null),ce=r.useCallback(e=>{ue.current=e,"function"==typeof K?K(e):K&&(K.current=e)},[K]),me=r.useRef(null);r.useEffect(()=>()=>me.current?.(),[]);const pe=e=>{const t=ue.current;if(!t)return e;const r=Math.min(g(j,480),Math.max(g(x,160),Math.round(e)));return ie.current=`${r}px`,t.style.setProperty("--_mp-sidebar-width",ie.current),se.current?.setAttribute("aria-valuenow",String(r)),r};return Y?e(n,{side:d(H),mode:"modal",open:re,onOpenChange:ne,title:L??O??Q.sidebar,size:V,locale:J,extent:void 0===w?void 0:de,className:I,style:W,children:T}):t("aside",{ref:ce,"aria-label":O??Q.sidebar,"data-mp-size":V,"data-mp-variant":B,"data-mp-side":H,className:["mp-sidebar text-mp-on-surface relative box-border flex min-w-0 shrink-0 flex-col","w-(--_mp-sidebar-width)",l(B,S),"outlined"===B?"border-mp-outline-variant "+("start"===H?"border-e":"border-s"):"","content"===F.scroll?"h-full":M?["self-start sticky [top:var(--_mp-layout-header,0px)]","[height:calc(100dvh_-_var(--_mp-layout-header,0px)_-_var(--_mp-layout-footer,0px))]"].join(" "):"",u[U],I??""].filter(Boolean).join(" "),style:{"--_mp-sidebar-width":de,...W},...X,children:[e("div",{id:le,className:["mp-sidebar__body min-h-0 flex-1 overflow-y-auto overscroll-contain",D?`${f(V,q)} ${v(V,q)}`:""].filter(Boolean).join(" "),children:T}),_?e("div",{ref:se,role:"separator","aria-orientation":"vertical","aria-label":Q.resizeSidebar,"aria-valuemin":Math.round(g(x,160)),"aria-valuemax":Math.round(g(j,480)),"aria-valuenow":Math.round(g(de,g(h[V],360))),"aria-controls":le,tabIndex:0,className:["mp-sidebar__handle absolute inset-y-0 z-1 w-2 cursor-col-resize bg-transparent","start"===H?"-me-1 end-0":"-ms-1 start-0","hover:bg-mp-outline-variant data-dragging:bg-mp-outline-variant","transition-colors duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-0","focus-visible:outline-solid outline-none"].join(" "),onPointerDown:e=>{const t=ue.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,i=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,s="start"===H===a?-1:1;let l=i;const d=e=>{l=pe(i+(e.clientX-o)*s),R?.(l)},u=()=>{me.current=null,r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},c=()=>{u(),k?.(l)};me.current=u,r.addEventListener("pointermove",d),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===H===t?-1:1;(e=>{const t=ue.current;if(!t)return;const r=pe(t.getBoundingClientRect().width+e);R?.(r),k?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{CONTROL_SQUARE as o}from"../../internal/scale.js";import{cssLength as a}from"../../internal/length.js";const n={xs:"h-3",sm:"h-3.5",md:"h-4",lg:"h-4",xl:"h-5.5"},s={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-1.5"},i={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},t="overflow-hidden bg-(--_mp-placeholder)";export const MPSkeleton=/*@__PURE__*/r.forwardRef(function({shape:r="line",lines:m=1,size:d="md",color:p,width:h,height:c,animated:f=!0,label:u,render:g,className:x,style:w,...j},v){const b=f?"animate-pulse motion-reduce:animate-none":"",k="circle"===r?`rounded-mp-full shrink-0 ${o[d]}`:"rect"===r?`rounded-mp-md w-full ${void 0===c?i[d]:""}`:`rounded-mp-xs w-full ${n[d]}`,y=u?{role:"status","aria-busy":!0,"aria-label":u}:{"aria-hidden":!0},$="line"===r&&m>1;return l({render:g,ref:v,props:{"data-mp-size":d,className:($?["mp-skeleton flex w-full flex-col",s[d],x??""]:["mp-skeleton",t,b,k,x??""]).filter(Boolean).join(" "),style:{"--_mp-placeholder":p?`var(--_mp-color-${p}-container)`:"var(--_mp-color-surface-container-highest)",width:a(h),height:$?void 0:a(c),...w},...y,...$?{children:Array.from({length:m},(r,l)=>e("div",{className:[t,b,"rounded-mp-xs",n[d],l===m-1?"w-3/5":"w-full"].filter(Boolean).join(" ")},l))}:null,...j}})});
2
+ import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{useRender as l}from"@base-ui/react/use-render";import{CONTROL_SQUARE as o}from"../../internal/scale.js";import{cssLength as a}from"../../internal/length.js";import{useMPSize as n}from"../../internal/config.js";const i={xs:"h-3",sm:"h-3.5",md:"h-4",lg:"h-4",xl:"h-5.5"},s={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-1.5"},t={xs:"h-12",sm:"h-16",md:"h-20",lg:"h-28",xl:"h-36"},m="overflow-hidden bg-(--_mp-placeholder)";export const MPSkeleton=/*@__PURE__*/r.forwardRef(function({shape:r="line",lines:d=1,size:p,color:h,width:c,height:f,animated:u=!0,label:g,render:x,className:w,style:j,...v},b){const k=n(p),y=u?"animate-pulse motion-reduce:animate-none":"",$="circle"===r?`rounded-mp-full shrink-0 ${o[k]}`:"rect"===r?`rounded-mp-md w-full ${void 0===f?t[k]:""}`:`rounded-mp-xs w-full ${i[k]}`,_=g?{role:"status","aria-busy":!0,"aria-label":g}:{"aria-hidden":!0},N="line"===r&&d>1;return l({render:x,ref:b,props:{"data-mp-size":k,className:(N?["mp-skeleton flex w-full flex-col",s[k],w??""]:["mp-skeleton",m,y,$,w??""]).filter(Boolean).join(" "),style:{"--_mp-placeholder":h?`var(--_mp-color-${h}-container)`:"var(--_mp-color-surface-container-highest)",width:a(c),height:N?void 0:a(f),...j},..._,...N?{children:Array.from({length:d},(r,l)=>e("div",{className:[m,y,"rounded-mp-xs",i[k],l===d-1?"w-3/5":"w-full"].filter(Boolean).join(" ")},l))}:null,...v}})});
@@ -1,5 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import type { MPColor, MPOrientation, MPSize } from '../../types.js';
3
+ export interface MPSliderMark {
4
+ /** Where on the range it sits. Outside `min`…`max` it is not drawn. */
5
+ value: number;
6
+ /**
7
+ * What is written under it — or beside it on a vertical slider. Left out, the
8
+ * mark is a tick on the track and nothing else.
9
+ */
10
+ label?: React.ReactNode;
11
+ }
3
12
  export interface MPSliderProps {
4
13
  /**
5
14
  * The value, or the values. An array is what makes it a range slider — there is
@@ -19,6 +28,24 @@ export interface MPSliderProps {
19
28
  max?: number;
20
29
  /** How far one arrow key, or one notch of the drag, moves. @default 1 */
21
30
  step?: number;
31
+ /**
32
+ * The ticks on the track, and optionally what is written under them.
33
+ *
34
+ * `true` puts one at every `step`, which is MD3's discrete slider — up to fifty
35
+ * of them, past which they stop being ticks and become a dotted line (see
36
+ * `MAX_TICKS`). An array names them instead, and is the form that can carry
37
+ * labels: `[{ value: 1990, label: '1990' }, …]` for the decade markings under
38
+ * a year range.
39
+ *
40
+ * A tick over the filled part of the track is drawn in the accent's own ink and
41
+ * one over the groove in `on-surface-variant`, which is the specification's
42
+ * pairing and the reason a tick stays visible as the handle passes it.
43
+ *
44
+ * Labels are laid out from the tick's centre and are not measured, so two that
45
+ * would collide will overlap — an array with fewer entries is the answer, not a
46
+ * smaller type scale.
47
+ */
48
+ marks?: boolean | readonly MPSliderMark[];
22
49
  /** The label above the track. */
23
50
  label?: React.ReactNode;
24
51
  /** The line under the track. */
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as r from"react";import{Slider as a}from"@base-ui/react/slider";import{accentSlots as t}from"../../internal/accent.js";import{MPStateLayer as n}from"../../internal/StateLayer.js";import{META_TEXT as i,hasContent as o}from"../../internal/scale.js";const l={xs:{thickness:"h-0.5",cross:"w-0.5",handle:"size-3.5",strip:"h-8",stripCross:"w-8"},sm:{thickness:"h-[3px]",cross:"w-[3px]",handle:"size-4",strip:"h-9",stripCross:"w-9"},md:{thickness:"h-1",cross:"w-1",handle:"size-5",strip:"h-10",stripCross:"w-10"},lg:{thickness:"h-1.5",cross:"w-1.5",handle:"size-6",strip:"h-11",stripCross:"w-11"},xl:{thickness:"h-2",cross:"w-2",handle:"size-7",strip:"h-12",stripCross:"w-12"}},c=/*@__PURE__*/["duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),m={xs:"size-8",sm:"size-9",md:"size-10",lg:"size-11",xl:"size-12"};export const MPSlider=/*@__PURE__*/r.forwardRef(function({value:d,defaultValue:u,onValueChange:p,onValueCommitted:f,min:h=0,max:g=100,step:x=1,label:b,description:w,showValue:j=!1,format:y,orientation:z="horizontal",size:v="md",color:C="primary",disabled:N=!1,name:_,"aria-label":k,className:V,style:$},A){const B="vertical"===z,I=l[v],L=r.useId(),R=d??u,S=Array.isArray(R)?R.length:1;return s(a.Root,{ref:A,value:d,defaultValue:u,onValueChange:e=>p?.(e),onValueCommitted:e=>f?.(e),min:h,max:g,step:x,disabled:N,orientation:z,format:y,name:_,"data-mp-size":v,className:["mp-slider flex",B?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1",N?"cursor-default":"",V??""].filter(Boolean).join(" "),style:{...t(C),...$},children:[o(b)||j?s("div",{className:["flex w-full items-baseline gap-2",i].join(" "),children:[o(b)?e(a.Label,{className:N?"text-mp-on-surface/38":"text-mp-on-surface-variant",children:b}):null,j?e(a.Value,{className:["ms-auto tabular-nums",N?"text-mp-on-surface/38":"text-mp-on-surface"].join(" ")}):null]}):null,e(a.Control,{className:["mp-slider__control group/rail flex touch-none items-center justify-center select-none",B?`${I.stripCross} h-40 flex-col`:`w-full ${I.strip}`,N?"":"cursor-pointer"].filter(Boolean).join(" "),children:s(a.Track,{className:["mp-slider__track rounded-mp-full relative",B?`${I.cross} h-full`:`${I.thickness} w-full`,N?"bg-mp-on-surface/12":"bg-mp-surface-container-highest"].join(" "),children:[e(a.Indicator,{className:["rounded-mp-full","[transition-property:inset-inline-start,width,bottom,height]",c,"group-data-dragging/rail:transition-none",N?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")}),Array.from({length:S},(s,r)=>e(a.Thumb,{index:r,"aria-label":o(b)?void 0:k,"aria-describedby":o(w)?L:void 0,className:["mp-slider__handle group rounded-mp-full relative outline-none","[transition-property:inset-inline-start,bottom]",c,"data-dragging:transition-none",I.handle,N?"bg-mp-on-surface/38 cursor-default":"bg-(--_mp-accent) cursor-grab active:cursor-grabbing"].join(" "),children:N?null:e(n,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",m[v],"bg-(--_mp-accent)"].join(" "),className:"group-data-dragging:opacity-16"})},r))]})}),o(w)?e("div",{id:L,className:[i,N?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:w}):null]})});
2
+ import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Slider as r}from"@base-ui/react/slider";import{accentSlots as s}from"../../internal/accent.js";import{MPStateLayer as n}from"../../internal/StateLayer.js";import{META_TEXT as l,hasContent as i}from"../../internal/scale.js";import{useMPColor as o,useMPSize as m}from"../../internal/config.js";const u={xs:{thickness:"h-0.5",cross:"w-0.5",handle:"size-3.5",strip:"h-8",stripCross:"w-8"},sm:{thickness:"h-[3px]",cross:"w-[3px]",handle:"size-4",strip:"h-9",stripCross:"w-9"},md:{thickness:"h-1",cross:"w-1",handle:"size-5",strip:"h-10",stripCross:"w-10"},lg:{thickness:"h-1.5",cross:"w-1.5",handle:"size-6",strip:"h-11",stripCross:"w-11"},xl:{thickness:"h-2",cross:"w-2",handle:"size-7",strip:"h-12",stripCross:"w-12"}},c=/*@__PURE__*/["duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),d={xs:"size-[2px]",sm:"size-[2px]",md:"size-[3px]",lg:"size-1",xl:"size-1.5"},p={xs:"size-8",sm:"size-9",md:"size-10",lg:"size-11",xl:"size-12"};export const MPSlider=/*@__PURE__*/t.forwardRef(function({value:f,defaultValue:h,onValueChange:g,onValueCommitted:b,min:x=0,max:v=100,step:w=1,marks:j,label:y,description:z,showValue:N=!1,format:_,orientation:k="horizontal",size:C,color:V,disabled:A=!1,name:M,"aria-label":S,className:$,style:I},B){const L=m(C),R=o(V),T="vertical"===k,F=u[L],P=t.useId(),X=f??h,Y=Array.isArray(X)?X.length:1,q=t.useMemo(()=>{if(!j||v<=x)return[];if(!0!==j)return j.filter(e=>e.value>=x&&e.value<=v);const e=Math.floor((v-x)/w);return!Number.isFinite(e)||e<1||e>50?[]:Array.from({length:e+1},(e,a)=>({value:x+a*w}))},[j,x,v,w]),[D,E]=t.useState(h),G=f??D,H=t.useMemo(()=>{const e=Array.isArray(G)?G:void 0===G?[]:[G];return 0===e.length?null:1===e.length?{from:x,to:e[0]}:{from:Math.min(...e),to:Math.max(...e)}},[G,x]),J=e=>(e-x)/(v-x)*100+"%";return a(r.Root,{ref:B,value:f,defaultValue:h,onValueChange:e=>{void 0===f&&E(e),g?.(e)},onValueCommitted:e=>b?.(e),min:x,max:v,step:w,disabled:A,orientation:k,format:_,name:M,"data-mp-size":L,className:["mp-slider flex",T?"w-fit flex-col items-center gap-2":"w-full flex-col gap-1",A?"cursor-default":"",$??""].filter(Boolean).join(" "),style:{...s(R),...I},children:[i(y)||N?a("div",{className:["flex w-full items-baseline gap-2",l].join(" "),children:[i(y)?e(r.Label,{className:A?"text-mp-on-surface/38":"text-mp-on-surface-variant",children:y}):null,N?e(r.Value,{className:["ms-auto tabular-nums",A?"text-mp-on-surface/38":"text-mp-on-surface"].join(" ")}):null]}):null,e(r.Control,{className:["mp-slider__control group/rail flex touch-none items-center justify-center select-none",T?`${F.stripCross} h-40 flex-col`:`w-full ${F.strip}`,A?"":"cursor-pointer"].filter(Boolean).join(" "),children:a(r.Track,{className:["mp-slider__track rounded-mp-full relative",T?`${F.cross} h-full`:`${F.thickness} w-full`,A?"bg-mp-on-surface/12":"bg-mp-surface-container-highest"].join(" "),children:[e(r.Indicator,{className:["rounded-mp-full","[transition-property:inset-inline-start,width,bottom,height]",c,"group-data-dragging/rail:transition-none",A?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")}),q.map(a=>{const t=null!==H&&a.value>=H.from&&a.value<=H.to;return e("span",{"aria-hidden":"true",className:["mp-slider__tick pointer-events-none absolute rounded-full",d[L],A?"bg-mp-on-surface/38":t?"bg-(--_mp-on-accent)":"bg-mp-on-surface-variant"].join(" "),style:T?{bottom:J(a.value),insetInlineStart:"50%",transform:"translate(-50%, 50%)"}:{insetInlineStart:J(a.value),top:"50%",transform:"translate(-50%, -50%)"}},`tick:${a.value}`)}),Array.from({length:Y},(a,t)=>e(r.Thumb,{index:t,"aria-label":i(y)?void 0:S,"aria-describedby":i(z)?P:void 0,className:["mp-slider__handle group rounded-mp-full relative outline-none","[transition-property:inset-inline-start,bottom]",c,"data-dragging:transition-none",F.handle,A?"bg-mp-on-surface/38 cursor-default":"bg-(--_mp-accent) cursor-grab active:cursor-grabbing"].join(" "),children:A?null:e(n,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",p[L],"bg-(--_mp-accent)"].join(" "),className:"group-data-dragging:opacity-16"})},t))]})}),q.some(e=>i(e.label))?e("div",{"aria-hidden":"true",className:["mp-slider__marks relative",l,T?"h-full":"w-full",A?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),style:T?void 0:{height:"1lh"},children:q.map(a=>i(a.label)?e("span",{className:"absolute whitespace-nowrap",style:T?{bottom:J(a.value),transform:"translateY(50%)"}:{insetInlineStart:J(a.value),transform:"translateX(-50%)"},children:a.label},`label:${a.value}`):null)}):null,i(z)?e("div",{id:P,className:[l,A?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:z}):null]})});
@@ -20,6 +20,25 @@ export type MPSnackbarPosition = `top-${MPAlign}` | `bottom-${MPAlign}`;
20
20
  export interface MPSnackbarData {
21
21
  color?: MPColor;
22
22
  icon?: React.ReactNode | false;
23
+ /**
24
+ * Which stack this one joins, overriding the provider's `position`.
25
+ *
26
+ * For the message that has to be somewhere else *because of what it is* — a
27
+ * confirmation pinned under the thing it confirms, an error at the top of a
28
+ * page whose bottom corner is a toolbar. Not for a preference: an application
29
+ * whose snackbars all appear in the same wrong place should move the provider.
30
+ *
31
+ * All six stacks are on the page from the start whether or not anything is in
32
+ * them, which is not a detail: a stack is its own `aria-live` region, and a
33
+ * region added to the document at the same instant as the message inside it is
34
+ * a region a screen reader has nothing to compare against and does not read.
35
+ */
36
+ position?: MPSnackbarPosition;
37
+ /**
38
+ * Added to this snackbar's plate — the element that draws the surface, not the
39
+ * stack around it.
40
+ */
41
+ className?: string;
23
42
  }
24
43
  export interface MPSnackbarOptions extends MPSnackbarData {
25
44
  /**
@@ -172,4 +191,4 @@ export declare function useMPSnackbar(): {
172
191
  * is not part of Material Design 3 — so a `Toast` here would be a different
173
192
  * component wearing the name of one the specification still ships.
174
193
  */
175
- export declare function MPSnackbarProvider({ color, position, timeout, limit, width, size, showClose, closeLabel, locale: localeProp, children }: MPSnackbarProviderProps): React.JSX.Element;
194
+ export declare function MPSnackbarProvider({ color, position, timeout, limit, width, size: sizeProp, showClose, closeLabel, locale: localeProp, children }: MPSnackbarProviderProps): React.JSX.Element;