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,143 @@
1
+ import * as React from 'react';
2
+ import type { MPColor, MPSize } from '../../types.js';
3
+ /** What a confirmation asks, and how it is drawn. */
4
+ export interface MPConfirmOptions {
5
+ /** The question, as a heading. */
6
+ title?: React.ReactNode;
7
+ /** The sentence under it — what happens, and to what. */
8
+ description?: React.ReactNode;
9
+ /** A glyph above the title, the way `MPDialog` draws one. */
10
+ icon?: React.ReactNode;
11
+ /**
12
+ * Anything else the dialog should hold — a field, a list of what is about to
13
+ * be deleted, a checkbox that says "do not ask again".
14
+ */
15
+ children?: React.ReactNode;
16
+ /** What the yes button says. @default the translation of `Confirm` */
17
+ confirmLabel?: React.ReactNode;
18
+ /** What the no button says. @default the translation of `Cancel` */
19
+ cancelLabel?: React.ReactNode;
20
+ /**
21
+ * The accent the yes button is drawn in.
22
+ *
23
+ * `'error'` is what a destructive confirmation wants, and it is not the
24
+ * default: most confirmations are not destructive, and a red button on every
25
+ * one of them stops being a warning.
26
+ * @default 'primary'
27
+ */
28
+ color?: MPColor;
29
+ /** @default 'md' */
30
+ size?: MPSize;
31
+ /**
32
+ * Whether Escape and a press outside answer **no**.
33
+ *
34
+ * On by default, because a dialog a reader cannot leave is a trap and because
35
+ * the safe answer to "are you sure" is no. Switch it off for a question that
36
+ * genuinely has to be answered — and be sure it does, because the reader then
37
+ * has exactly two ways out and both of them are your buttons.
38
+ * @default true
39
+ */
40
+ dismissible?: boolean;
41
+ }
42
+ export interface MPConfirmResult {
43
+ /**
44
+ * Asks, and resolves with the answer.
45
+ *
46
+ * `true` for the confirm button, `false` for cancel — and `false` for Escape,
47
+ * a press outside, and anything else that closes the dialog. There is no third
48
+ * answer, so a caller writes one `if`.
49
+ */
50
+ confirm: (options: MPConfirmOptions) => Promise<boolean>;
51
+ /**
52
+ * Tells, and resolves once it has been acknowledged.
53
+ *
54
+ * One button, because there is nothing to refuse. `Promise<void>` rather than
55
+ * `Promise<boolean>` for the same reason: an acknowledgement has no answer,
56
+ * and a boolean nobody can vary is a value a caller would have to learn to
57
+ * ignore.
58
+ */
59
+ alert: (options: MPConfirmOptions) => Promise<void>;
60
+ }
61
+ export interface MPConfirmProviderProps {
62
+ /**
63
+ * Defaults for every confirmation raised under this — a `size` to match the
64
+ * application, an accent, a `cancelLabel` in your own words. Each call still
65
+ * says whatever it needs to and wins.
66
+ */
67
+ defaults?: Omit<MPConfirmOptions, 'title' | 'description' | 'children'>;
68
+ children?: React.ReactNode;
69
+ }
70
+ /**
71
+ * Holds the one dialog every `confirm()` in the application is drawn in.
72
+ *
73
+ * Wrap the application, the way `MPSnackbarProvider` is wrapped, and for the
74
+ * same reason: what a caller has at the moment a question is warranted is a
75
+ * click handler, not a place in the tree.
76
+ *
77
+ * ```tsx
78
+ * <MPConfirmProvider>
79
+ * <App />
80
+ * </MPConfirmProvider>
81
+ * ```
82
+ *
83
+ * ## One at a time
84
+ *
85
+ * A second `confirm()` raised while one is open **replaces** it, and the first
86
+ * promise resolves `false`. Not a queue, deliberately: a queue would ask a
87
+ * question about something the reader has already moved on from, and the answer
88
+ * to a stale question is not information. Two confirmations racing is a bug in
89
+ * the calling code, and resolving the first as *no* is the safe reading of it.
90
+ */
91
+ export declare function MPConfirmProvider({ defaults, children }: MPConfirmProviderProps): React.JSX.Element;
92
+ /**
93
+ * Asks a question and waits for the answer.
94
+ *
95
+ * ```tsx
96
+ * const { confirm } = useMPConfirm();
97
+ *
98
+ * async function remove() {
99
+ * const sure = await confirm({
100
+ * title: 'Delete this project?',
101
+ * description: 'Everything in it goes too, and it cannot be undone.',
102
+ * confirmLabel: 'Delete',
103
+ * color: 'error'
104
+ * });
105
+ *
106
+ * if (sure) {
107
+ * await api.delete(id);
108
+ * }
109
+ * }
110
+ * ```
111
+ *
112
+ * ## Why this rather than a dialog of your own
113
+ *
114
+ * Because the dialog is not the hard part. "Are you sure" needs a piece of open
115
+ * state, a piece of state for *what* is being confirmed, two handlers, and a
116
+ * dialog kept mounted somewhere it does not belong — per call site. What the
117
+ * caller actually has at that moment is a click handler, and what they want back
118
+ * is a boolean.
119
+ *
120
+ * It is the same trade `useMPSnackbar` makes, run the other way: a snackbar is
121
+ * something to say, this is something to ask.
122
+ *
123
+ * ## `false` is every other answer
124
+ *
125
+ * The confirm button resolves `true`; the cancel button, Escape, a press outside
126
+ * and any other close resolve `false`. There is no third outcome and the promise
127
+ * never rejects, so a caller writes an `if` and not a `try`.
128
+ *
129
+ * `alert()` is the one-button form and resolves `void` once it has been
130
+ * acknowledged — an acknowledgement has nothing to refuse, and a boolean nobody
131
+ * can vary is a value a caller would have to learn to ignore.
132
+ *
133
+ * ## Sharp edges
134
+ *
135
+ * - **It needs an `MPConfirmProvider` above it.** Without one the hook throws,
136
+ * rather than returning a function that silently never resolves — a promise
137
+ * that never settles is the hardest possible way to be told about a missing
138
+ * provider.
139
+ * - **One at a time.** A second `confirm()` raised while one is open replaces it
140
+ * and resolves the first `false`. See the provider for why that is not a queue.
141
+ * - **Do not `await` it inside a render.** It is a click handler's tool.
142
+ */
143
+ export declare function useMPConfirm(): MPConfirmResult;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,Fragment as r,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{MPButton as i}from"../button/MPButton.js";import{MPDialog as t}from"../dialog/MPDialog.js";import{useMPLocale as l,useMPMessages as c}from"../../internal/locale.js";import{CONFIRM as a}from"../../internal/messages/confirm.js";const s=/*@__PURE__*/o.createContext(null);export function MPConfirmProvider({defaults:m,children:u}){const[d,f]=o.useState(null),p=c(a,l()),h=o.useRef(null),C=o.useCallback((e,r)=>new Promise(n=>{h.current?.(!1),h.current=n,f({...m,...e,acknowledge:r})}),[m]),P=o.useMemo(()=>({confirm:e=>C(e,!1),alert:e=>C(e,!0).then(()=>{})}),[C]),x=e=>{h.current?.(e),h.current=null,f(null)},g=d?.acknowledge??!1;return n(s.Provider,{value:P,children:[u,e(t,{open:null!==d,onOpenChange:e=>{e||x(g)},icon:d?.icon,title:d?.title,description:d?.description,size:d?.size??"md",color:d?.color??"primary",dismissible:d?.dismissible??!0,actions:n(r,{children:[g?null:e(i,{variant:"text",onClick:()=>x(!1),children:d?.cancelLabel??p.cancel}),e(i,{variant:"text",color:d?.color??"primary",onClick:()=>x(!0),children:d?.confirmLabel??(g?p.ok:p.confirm)})]}),children:d?.children})]})}export function useMPConfirm(){const e=o.useContext(s);if(!e)throw new Error("useMPConfirm was called outside an <MPConfirmProvider>. Wrap the application in one — the provider is what holds the dialog every confirm() is drawn in.");return e}
@@ -0,0 +1,2 @@
1
+ export { MPConfirmProvider, useMPConfirm } from './MPConfirmProvider.js';
2
+ export type { MPConfirmProviderProps, MPConfirmOptions, MPConfirmResult } from './MPConfirmProvider.js';
@@ -0,0 +1 @@
1
+ export{MPConfirmProvider,useMPConfirm}from"./MPConfirmProvider.js";
@@ -1,16 +1,23 @@
1
1
  import * as React from 'react';
2
2
  import { useRender } from '@base-ui/react/use-render';
3
- import type { MPSize } from '../../types.js';
3
+ import type { MPMeasure, MPResponsive, MPSize } from '../../types.js';
4
4
  export interface MPContainerProps extends React.ComponentPropsWithoutRef<'div'> {
5
5
  /**
6
6
  * How wide the content is allowed to get, on a ladder pinned to MD3's window
7
7
  * size classes — `sm` 600dp, `md` 840dp, `lg` 1200dp, `xl` 1600dp, `xs` 480dp.
8
8
  *
9
+ * Or a CSS length of your own: `maxWidth="60ch"` is the measure a paragraph
10
+ * actually wants, and no ladder of window widths can spell it.
11
+ *
12
+ * Responsive, like the grid's props: `maxWidth={{ compact: 'none', expanded: 'lg' }}`
13
+ * is edge to edge on a phone and held to 1200dp from 840 up. Each entry applies
14
+ * from its own window class upward.
15
+ *
9
16
  * `none`, the default, is no limit: a container's job is the margin, and a
10
17
  * measure is a second decision that a page should have to ask for.
11
18
  * @default 'none'
12
19
  */
13
- maxWidth?: MPSize | 'none';
20
+ maxWidth?: MPResponsive<MPMeasure>;
14
21
  /**
15
22
  * The page margin. Turn it off to keep the centring and the measure without
16
23
  * the gutter — a full-bleed hero, a section that pads itself.
@@ -1 +1,2 @@
1
- import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{MEASURE as n,SHEET_PAD_X as o}from"../../internal/scale.js";export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:a=!0,size:t="md",centered:i=!0,render:d,className:m,children:s,...c},l){return r({render:d,ref:l,props:{"data-mp-size":t,className:["mp-container block w-full","box-border","none"===e?"":n[e],i?"mx-auto":"",a?o[t]:"",m??""].filter(Boolean).join(" "),children:s,...c}})});
1
+ "use client";
2
+ import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{SHEET_PAD_X as n}from"../../internal/scale.js";import{measureValue as o}from"../../internal/measure.js";import{useWindowMins as t}from"../../internal/window-class.js";import{responsiveSlots as a,withBaseline as s}from"../../internal/responsive.js";import{useMPSize as i}from"../../internal/config.js";export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:m=!0,size:l,centered:c=!0,render:p,className:d,style:f,children:u,...j},b){const w=i(l),x=t(),h="none"!==e;return r({render:p,ref:b,props:{"data-mp-size":w,className:["mp-container block w-full","box-border",h?"mp-measure":"",c?"mx-auto":"",m?n[w]:"",d??""].filter(Boolean).join(" "),style:h?{...a("measure",s(e,"none"),e=>o(e,x)),...f}:f,children:u,...j}})});
@@ -0,0 +1,82 @@
1
+ import * as React from 'react';
2
+ import type { MPDensity, MPOrientation, MPSize } from '../../types.js';
3
+ export interface MPDataListProps extends Omit<React.ComponentPropsWithoutRef<'dl'>, 'color'> {
4
+ /**
5
+ * Where the label sits.
6
+ *
7
+ * - `horizontal` — beside the value, in a column of its own. The default, and
8
+ * the shape a details panel takes.
9
+ * - `vertical` — above it. For a narrow column, and for values long enough
10
+ * that a label beside them would leave most of the row empty.
11
+ * @default 'horizontal'
12
+ */
13
+ orientation?: MPOrientation;
14
+ /**
15
+ * How wide the label column is when `horizontal`. A number is pixels, a
16
+ * string is any CSS length.
17
+ *
18
+ * Left out it is as wide as the widest label, which is what keeps every value
19
+ * in the list starting at the same place without anybody measuring anything.
20
+ */
21
+ labelWidth?: number | string;
22
+ /** Draws a hairline between the rows. @default false */
23
+ dividers?: boolean;
24
+ /** @default 'md' */
25
+ size?: MPSize;
26
+ /**
27
+ * Tightens the gaps between rows and columns, and nothing else. The type
28
+ * scale does not move.
29
+ * @default 0
30
+ */
31
+ density?: MPDensity;
32
+ /** The pairs. */
33
+ children?: React.ReactNode;
34
+ }
35
+ export interface MPDataListItemProps {
36
+ /** What the value is called. */
37
+ label: React.ReactNode;
38
+ /** The value. A node, so a chip, a link or a piece of code all fit. */
39
+ children?: React.ReactNode;
40
+ }
41
+ /**
42
+ * One pair: what it is called, and what it is.
43
+ *
44
+ * A fragment rather than an element, so the `<dt>` and the `<dd>` land as direct
45
+ * children of the `<dl>` and the grid can line every label up against every
46
+ * other. It has no `size` or `density` of its own — those belong to the list,
47
+ * because a details panel with one row set tighter than its neighbours is not a
48
+ * thing anybody wants.
49
+ */
50
+ export declare function MPDataListItem({ label, children }: MPDataListItemProps): React.JSX.Element;
51
+ /**
52
+ * A list of things and what they are called — a details panel, the summary of a
53
+ * record, the metadata under a heading.
54
+ *
55
+ * ```tsx
56
+ * <MPDataList>
57
+ * <MPDataListItem label="Status">Active</MPDataListItem>
58
+ * <MPDataListItem label="Owner">Priya Raman</MPDataListItem>
59
+ * </MPDataList>
60
+ * ```
61
+ *
62
+ * ## Why not a two-column `MPTable`
63
+ *
64
+ * Because they are read differently, and the difference is the whole reason
65
+ * this is a component. A table is a grid of **rows**, all of the same shape,
66
+ * and a screen reader walks it as a grid — announcing column headers, offering
67
+ * cell-by-cell navigation, counting rows. This is a set of **pairs**, and each
68
+ * one is announced as "label, value", which is what a details panel actually
69
+ * is.
70
+ *
71
+ * So it is a real `<dl>` of real `<dt>`/`<dd>` pairs, and `MPDataListItem`
72
+ * renders a fragment rather than a wrapper: the two elements have to be direct
73
+ * children of the `<dl>` for the grid to line every label up against every
74
+ * other, and a `<div>` between them would take the grid with it.
75
+ *
76
+ * ## It draws no surface
77
+ *
78
+ * No sheet, no padding, no corner. Put it in an `MPCard` when one is wanted,
79
+ * which is what makes the same list work inside a card, inside a popover, and
80
+ * loose under a heading.
81
+ */
82
+ export declare const MPDataList: React.ForwardRefExoticComponent<MPDataListProps & React.RefAttributes<HTMLDListElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as a from"react";import{cssLength as i}from"../../internal/length.js";import{META_TEXT as n,PROSE_TEXT as r,hasContent as l}from"../../internal/scale.js";import{useMPDensity as o,useMPSize as s}from"../../internal/config.js";const m=/*@__PURE__*/a.createContext({size:"md",orientation:"horizontal"}),d={xs:12,sm:16,md:20,lg:24,xl:32},p={xs:8,sm:10,md:12,lg:14,xl:16};function c(t,e,a){return Math.max(a,t+4*e)}export function MPDataListItem({label:i,children:o}){const{size:s,orientation:d}=a.useContext(m),p="vertical"===d;return e(a.Fragment,{children:[t("dt",{className:["mp-data-list__label text-mp-on-surface-variant min-w-0",n,p?"mt-(--_mp-data-list-row) first:mt-0":""].filter(Boolean).join(" "),children:i}),t("dd",{className:`mp-data-list__value text-mp-on-surface m-0 min-w-0 ${r[s]}`,children:l(o)?o:null})]})}export const MPDataList=/*@__PURE__*/a.forwardRef(function({orientation:e="horizontal",labelWidth:n,dividers:r=!1,size:l,density:f,className:x,style:h,children:u,..._},j){const b=s(l),g=o(f),v="vertical"===e,w=a.useMemo(()=>({size:b,orientation:e}),[b,e]);return t(m.Provider,{value:w,children:t("dl",{ref:j,"data-mp-size":b,className:["mp-data-list m-0 min-w-0",v?"flex flex-col":["grid items-baseline","[grid-template-columns:var(--_mp-data-list-label)_minmax(0,1fr)]","gap-x-(--_mp-data-list-col) gap-y-(--_mp-data-list-row)"].join(" "),r?["border-mp-outline-variant","[&>dt:nth-of-type(n+2)]:border-t [&>dt:nth-of-type(n+2)]:pt-(--_mp-data-list-row)",v?"":"[&>dd:nth-of-type(n+2)]:border-t [&>dd:nth-of-type(n+2)]:pt-(--_mp-data-list-row)"].filter(Boolean).join(" "):"",x??""].filter(Boolean).join(" "),style:{"--_mp-data-list-label":i(n)??"max-content","--_mp-data-list-col":`${c(d[b],g,8)}px`,"--_mp-data-list-row":`${c(p[b],g,4)}px`,...h},..._,children:u})})});
@@ -0,0 +1,2 @@
1
+ export { MPDataList, MPDataListItem } from './MPDataList.js';
2
+ export type { MPDataListItemProps, MPDataListProps } from './MPDataList.js';
@@ -0,0 +1 @@
1
+ export{MPDataList,MPDataListItem}from"./MPDataList.js";
@@ -0,0 +1,295 @@
1
+ import * as React from 'react';
2
+ import { type MPDataTableSort } from '../../internal/data-table.js';
3
+ import type { MPAlign, MPColor, MPDensity, MPElevation, MPSize, MPSlots, MPVariant } from '../../types.js';
4
+ export type { MPDataTableSort, MPSortDirection } from '../../internal/data-table.js';
5
+ /** How many rows may be chosen at once. */
6
+ export type MPDataTableSelectionMode = 'none' | 'single' | 'multiple';
7
+ /** The parts an `MPDataTable` draws that a `className` cannot reach. */
8
+ export type MPDataTableSlot = 'toolbar' | 'table' | 'head' | 'row' | 'cell' | 'footer';
9
+ /**
10
+ * A column: its heading, how wide it is, how to get a value out of a row and how
11
+ * to draw one.
12
+ *
13
+ * The split between `value` and `render` is the whole shape of this type. A
14
+ * `render` decides what a reader sees; a `value` decides what the sort and the
15
+ * search see. Most columns need neither — the cell is `row[key]`, and that is
16
+ * what is compared and matched. A column that draws an `MPChip` needs `render`,
17
+ * and it needs `value` as well the moment it is sortable, because a React
18
+ * element has no order.
19
+ */
20
+ export interface MPDataTableColumn<Row> {
21
+ /**
22
+ * Identifies the column — to `sort`, to `columnWidths`, and unless `value` or
23
+ * `render` says otherwise, it names the property to read off each row.
24
+ */
25
+ key: string;
26
+ /** The heading. Defaults to the `key`, which is usually not what you want. */
27
+ label?: React.ReactNode;
28
+ /**
29
+ * How wide, in pixels.
30
+ *
31
+ * Pixels rather than any CSS length, because a resize drag does arithmetic on
32
+ * this number. Columns that do not say are `160`, and see `resizable` for what
33
+ * turning it on does to the layout.
34
+ */
35
+ width?: number;
36
+ /** How narrow a drag may make it. @default 48 */
37
+ minWidth?: number;
38
+ /**
39
+ * Which edge the cells line up against. Numbers usually want `end` so their
40
+ * digits line up in a column.
41
+ * @default 'start'
42
+ */
43
+ align?: MPAlign;
44
+ /** Whether this column can be sorted. Defaults to the table's `sortable`. */
45
+ sortable?: boolean;
46
+ /** Whether this column can be dragged wider. Defaults to the table's `resizable`. */
47
+ resizable?: boolean;
48
+ /** Whether the search looks in this column. @default true */
49
+ searchable?: boolean;
50
+ /**
51
+ * The value behind the cell: what is sorted, and what the search is matched
52
+ * against. Defaults to `row[key]`.
53
+ */
54
+ value?: (row: Row) => unknown;
55
+ /**
56
+ * Orders two rows by this column, for a value the default comparison cannot
57
+ * rank — a status that goes `draft`, `review`, `live` rather than
58
+ * alphabetically. Always written ascending; the table reverses it.
59
+ */
60
+ compare?: (a: Row, b: Row) => number;
61
+ /**
62
+ * Draws the cell. `index` is the row's place in the sorted, searched order and
63
+ * is counted across every page, so `(row, index) => index + 1` is a running
64
+ * row number.
65
+ */
66
+ render?: (row: Row, index: number) => React.ReactNode;
67
+ /**
68
+ * What a download writes for this cell.
69
+ *
70
+ * Defaults to `value`, and then to `row[key]`. It is separate from `render` on
71
+ * purpose: a cell that draws a chip, an avatar or a progress bar has no text
72
+ * to put in a file, and `render`'s return is a React element rather than
73
+ * something a spreadsheet can hold.
74
+ */
75
+ exportValue?: (row: Row) => unknown;
76
+ /** Leaves this column out of a download. @default true */
77
+ exportable?: boolean;
78
+ }
79
+ export interface MPDataTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children' | 'onSelect'> {
80
+ /** The columns, in the order they appear. */
81
+ headers: readonly MPDataTableColumn<Row>[];
82
+ /** The rows. */
83
+ items: readonly Row[];
84
+ /**
85
+ * A stable identity per row, and the value `selected` is a list of.
86
+ *
87
+ * Defaults to the row's index in `items`, which is enough for a table that
88
+ * only ever displays. The moment rows can be chosen, sorted or searched it is
89
+ * required in practice: an index identifies a position, and every one of those
90
+ * three changes which row is in it.
91
+ */
92
+ getRowKey?: (row: Row, index: number) => React.Key;
93
+ /** Shown above the table, and read out as its accessible name. */
94
+ caption?: React.ReactNode;
95
+ /** What to show instead of rows when nothing is left. */
96
+ empty?: React.ReactNode;
97
+ /**
98
+ * Which language the table's own words are in — the ticks' names, the count
99
+ * under the rows, the download button.
100
+ *
101
+ * It is also what the default sort compares strings with. Pass it whenever the
102
+ * markup is rendered on a server: without it the comparison follows the
103
+ * runtime's own locale, and a server that disagrees with the browser about
104
+ * that produces two different row orders for the same table.
105
+ */
106
+ locale?: string;
107
+ /**
108
+ * Makes every column sortable. A column overrides it either way with its own
109
+ * `sortable`.
110
+ * @default false
111
+ */
112
+ sortable?: boolean;
113
+ /**
114
+ * Whether more than one column can be sorted at a time. With `multiple`, a
115
+ * Shift-press adds a column to the sort instead of replacing it, and each
116
+ * sorted heading carries its place in the order.
117
+ * @default 'single'
118
+ */
119
+ sortMode?: 'single' | 'multiple';
120
+ /** The sort. Use with `onSortChange` for a controlled one. */
121
+ sort?: readonly MPDataTableSort[];
122
+ /** What it starts as, for an uncontrolled table. */
123
+ defaultSort?: readonly MPDataTableSort[];
124
+ onSortChange?: (sort: MPDataTableSort[]) => void;
125
+ /** Draws a field above the table that filters the rows. @default false */
126
+ searchable?: boolean;
127
+ /** The query. Use with `onSearchChange` for a controlled field. */
128
+ search?: string;
129
+ /** What it starts as, for an uncontrolled one. */
130
+ defaultSearch?: string;
131
+ onSearchChange?: (search: string) => void;
132
+ /**
133
+ * Overrides the word on the field, which is also its accessible name.
134
+ *
135
+ * It is a label rather than a placeholder because a placeholder is not a name:
136
+ * a field whose only word disappears the moment somebody types in it is a
137
+ * field a screen reader announces as nothing.
138
+ */
139
+ searchLabel?: string;
140
+ /**
141
+ * A filter of your own, applied after the search. Return `false` to drop a
142
+ * row. `index` is the row's place in `items`.
143
+ */
144
+ filter?: (row: Row, index: number) => boolean;
145
+ /** Content at the end of the bar the search field sits in. */
146
+ toolbar?: React.ReactNode;
147
+ /**
148
+ * Hands the rows out a page at a time, and puts the pages in the footer.
149
+ *
150
+ * Every row is rendered otherwise, and there is no windowing — the same
151
+ * ceiling `MPTable` states, and this is the answer to it. A few hundred rows
152
+ * is nothing, a few thousand is a visible pause, and past that a table wants
153
+ * either this or a narrower list.
154
+ * @default false
155
+ */
156
+ paged?: boolean;
157
+ /** The current page, 1-based. Use with `onPageChange`. */
158
+ page?: number;
159
+ /** @default 1 */
160
+ defaultPage?: number;
161
+ onPageChange?: (page: number) => void;
162
+ /** How many rows a page holds. Use with `onPageSizeChange`. */
163
+ pageSize?: number;
164
+ /** @default 25 */
165
+ defaultPageSize?: number;
166
+ onPageSizeChange?: (pageSize: number) => void;
167
+ /**
168
+ * What the footer's page-size control offers. An empty list drops the control.
169
+ * @default [10, 25, 50, 100]
170
+ */
171
+ pageSizeOptions?: readonly number[];
172
+ /**
173
+ * Lets a heading be dragged wider or narrower, and gives the handle between
174
+ * two columns to the keyboard as well.
175
+ *
176
+ * **It also changes how the columns are laid out, and it has to.** Without it
177
+ * the browser balances the columns against their contents, which is what makes
178
+ * a plain table read well; but a balanced column springs back from a drag,
179
+ * because a width in that layout is a hint rather than a measurement. Turning
180
+ * this on fixes the layout, so `width` becomes exact and a column that has not
181
+ * said how wide it is takes 160.
182
+ * @default false
183
+ */
184
+ resizable?: boolean;
185
+ /** The widths, keyed by column. Use with `onColumnWidthsChange`. */
186
+ columnWidths?: Readonly<Record<string, number>>;
187
+ /** What they start as, for an uncontrolled table. */
188
+ defaultColumnWidths?: Readonly<Record<string, number>>;
189
+ onColumnWidthsChange?: (widths: Record<string, number>) => void;
190
+ /**
191
+ * How many rows may be chosen.
192
+ * @default 'none'
193
+ */
194
+ selectionMode?: MPDataTableSelectionMode;
195
+ /** The chosen rows, as their keys. Use with `onSelectedChange`. */
196
+ selected?: readonly React.Key[];
197
+ /** Which start chosen, for an uncontrolled table. */
198
+ defaultSelected?: readonly React.Key[];
199
+ /**
200
+ * The keys, and the rows behind them — including rows the search has hidden
201
+ * and rows on other pages, which are still chosen and still have to be handed
202
+ * back.
203
+ */
204
+ onSelectedChange?: (selected: React.Key[], rows: Row[]) => void;
205
+ /**
206
+ * Adds a column of ticks, and one in the heading that takes the whole page at
207
+ * once.
208
+ *
209
+ * It also decides which of the row and the tick is the keyboard's route into
210
+ * the row — see the note on the component.
211
+ * @default false
212
+ */
213
+ checkboxes?: boolean;
214
+ /** Fires on every press of a row, before the selection changes. */
215
+ onRowClick?: (row: Row, index: number) => void;
216
+ /**
217
+ * Adds a button that writes the rows out as a CSV file.
218
+ *
219
+ * **Every row the reader is currently looking at, not the page they are on.**
220
+ * The search and the sort are applied and the paging is not, because a file of
221
+ * page three is not a file anybody asked for.
222
+ * @default false
223
+ */
224
+ exportable?: boolean;
225
+ /** What the downloaded file is called. @default 'table.csv' */
226
+ exportFileName?: string;
227
+ /**
228
+ * Takes the CSV instead of downloading it — to post it somewhere, to open it
229
+ * in a viewer of your own, or to put a sheet around it.
230
+ */
231
+ onExport?: (csv: string) => void;
232
+ /** Tints every other row. @default false */
233
+ striped?: boolean;
234
+ /** Lights the row under the pointer. @default false */
235
+ hoverable?: boolean;
236
+ /**
237
+ * Pins the heading while the body scrolls. Only does anything if something
238
+ * around the table actually constrains its height.
239
+ * @default false
240
+ */
241
+ stickyHeader?: boolean;
242
+ /**
243
+ * How much surface the sheet around the table paints.
244
+ * @default 'outlined'
245
+ */
246
+ variant?: MPVariant;
247
+ /** How far off the page the sheet is lifted, on MD3's own scale. */
248
+ elevation?: MPElevation;
249
+ /** @default 'md' */
250
+ size?: MPSize;
251
+ /**
252
+ * Which accent family the sort arrow, the ticks and a chosen row read. The
253
+ * cells themselves stay neutral.
254
+ * @default 'primary'
255
+ */
256
+ color?: MPColor;
257
+ /** Takes room out of every cell without changing what it is set in. @default 0 */
258
+ density?: MPDensity;
259
+ classNames?: MPSlots<MPDataTableSlot>;
260
+ }
261
+ /**
262
+ * A grid of data with the four things a reader does to one: put it in order,
263
+ * cut it down, step through it and take some of it away.
264
+ *
265
+ * ```tsx
266
+ * <MPDataTable headers={columns} items={rows} sortable searchable paged />
267
+ * ```
268
+ *
269
+ * It is a separate component from [MPTable](table) rather than a mode of it.
270
+ * `MPTable` is the presentational half: it
271
+ * draws what it is given, in the order it is given, and a page that only shows a
272
+ * grid should not carry a comparator, a CSV writer and a page clamp to do it.
273
+ * What the two do share is the geometry — `internal/table.ts` holds the cells'
274
+ * room and the type they are set in — so a data table never sits a pixel off the
275
+ * plain table beside it.
276
+ *
277
+ * ## What it does to the rows, and in what order
278
+ *
279
+ * Search, then `filter`, then sort, then the page. The order is the only one
280
+ * that makes each step mean what it says: sorting before searching would order
281
+ * rows nobody is going to see, and paging before either would cut a page out of
282
+ * a list the reader has not asked for yet. `render`'s `index` counts along the
283
+ * sorted, searched order across every page, so it is a running row number rather
284
+ * than a position on the screen.
285
+ *
286
+ * ## Who holds the keyboard
287
+ *
288
+ * A row that answers a press has to answer a keyboard, and a table of two
289
+ * hundred rows that each did would be two hundred tab stops. So there is exactly
290
+ * one route into a row and `checkboxes` is what picks it: with ticks, the tick
291
+ * is the control and the row is not in the tab order; without them, the row is.
292
+ * `onRowClick` on its own always puts the row in the tab order, because then
293
+ * there is nothing else to press.
294
+ */
295
+ export declare function MPDataTable<Row>({ headers, items, getRowKey, caption, empty, locale: localeProp, sortable, sortMode, sort: sortProp, defaultSort, onSortChange, searchable, search: searchProp, defaultSearch, onSearchChange, searchLabel, filter, toolbar, paged, page: pageProp, defaultPage, onPageChange, pageSize: pageSizeProp, defaultPageSize, onPageSizeChange, pageSizeOptions, resizable, columnWidths: columnWidthsProp, defaultColumnWidths, onColumnWidthsChange, selectionMode, selected: selectedProp, defaultSelected, onSelectedChange, checkboxes, onRowClick, exportable, exportFileName, onExport, striped, hoverable, stickyHeader, variant, elevation, size: sizeProp, color: colorProp, density: densityProp, className, style, classNames, ...props }: MPDataTableProps<Row>): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{MPButton as n}from"../button/MPButton.js";import{MPCheckbox as r}from"../checkbox/MPCheckbox.js";import{MPIcon as o}from"../icon/MPIcon.js";import{MPPagination as l}from"../pagination/MPPagination.js";import{MPSelect as s}from"../select/MPSelect.js";import{MPTextField as i}from"../text-field/MPTextField.js";import{ArrowDownIcon as c,ArrowUpIcon as d,SearchIcon as m}from"../../constants/icons.js";import{accentSlots as u}from"../../internal/accent.js";import{containerSurface as p}from"../../internal/elevation.js";import{useMPColor as f,useMPDensity as h,useMPSize as y}from"../../internal/config.js";import{useMPLocale as g,useMPMessages as b}from"../../internal/locale.js";import{fillMessage as v}from"../../internal/i18n.js";import{DATA_TABLE as x}from"../../internal/messages/data-table.js";import{TABLE as k}from"../../internal/messages/table.js";import{TRANSFER as w}from"../../internal/messages/transfer.js";import{CONTROL_ICON as S,META_TEXT as N}from"../../internal/scale.js";import{VISUALLY_HIDDEN as j}from"../../internal/visually-hidden.js";import{CELL_TEXT as C,HEAD_TEXT as z,ROW as _,cellPadX as M,cellPadY as P,drawableCell as L}from"../../internal/table.js";import{DEFAULT_COLUMN_WIDTH as D,MIN_COLUMN_WIDTH as E,compareValues as $,downloadText as A,keysBetween as I,nextSort as K,pageBounds as W,searchHaystack as R,searchText as T,sortRows as B,toCsv as V}from"../../internal/data-table.js";function F(e,t){return e.value?e.value(t):t[e.key]}const H={xs:36,sm:40,md:48,lg:52,xl:60},X=/*@__PURE__*/["group/sort -m-1 flex w-full cursor-pointer items-center gap-1 rounded-mp-xs p-1","appearance-none border-0 bg-transparent font-[inherit] text-inherit text-start","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","hover:text-mp-on-surface","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),O=/*@__PURE__*/["mp-data-table__resize absolute inset-y-0 end-0 z-10 w-2 translate-x-1/2 rtl:-translate-x-1/2","cursor-col-resize touch-none select-none appearance-none border-0 bg-transparent p-0","after:absolute after:inset-y-1 after:start-1/2 after:w-px after:bg-transparent","after:transition-[background-color] after:duration-(--mp-sys-motion-duration-short4)","hover:after:bg-mp-primary data-dragging:after:bg-mp-primary","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-solid outline-none"].join(" ");export function MPDataTable({headers:q,items:G,getRowKey:J,caption:Q,empty:U,locale:Y,sortable:Z=!1,sortMode:ee="single",sort:te,defaultSort:ae,onSortChange:ne,searchable:re=!1,search:oe,defaultSearch:le,onSearchChange:se,searchLabel:ie,filter:ce,toolbar:de,paged:me=!1,page:ue,defaultPage:pe,onPageChange:fe,pageSize:he,defaultPageSize:ye,onPageSizeChange:ge,pageSizeOptions:be=[10,25,50,100],resizable:ve=!1,columnWidths:xe,defaultColumnWidths:ke,onColumnWidthsChange:we,selectionMode:Se="none",selected:Ne,defaultSelected:je,onSelectedChange:Ce,checkboxes:ze=!1,onRowClick:_e,exportable:Me=!1,exportFileName:Pe="table.csv",onExport:Le,striped:De=!1,hoverable:Ee=!1,stickyHeader:$e=!1,variant:Ae="outlined",elevation:Ie,size:Ke,color:We,density:Re,className:Te,style:Be,classNames:Ve,...Fe}){const He=y(Ke),Xe=f(We),Oe=h(Re),qe=g(Y),Ge=b(x,qe),Je=b(k,qe),Qe=b(w,qe),Ue=M(He,Oe),Ye=P(He,Oe),[Ze,et]=a.useState(()=>[...ae??[]]),tt=te??Ze,[at,nt]=a.useState(le??""),rt=oe??at,[ot,lt]=a.useState(pe??1),st=ue??ot,[it,ct]=a.useState(ye??25),dt=he??it,[mt,ut]=a.useState(()=>({...ke})),pt=xe??mt,[ft,ht]=a.useState(()=>[...je??[]]),yt=Ne??ft,gt=a.useMemo(()=>new Set(yt.map(e=>String(e))),[yt]),bt=a.useRef(null),vt=a.useMemo(()=>G.map((e,t)=>{const a=J?J(e,t):t;return{row:e,identity:a,key:String(a),origin:t}}),[G,J]),xt=a.useMemo(()=>{const e=q.filter(e=>!1!==e.searchable);return vt.map(t=>R(e.map(e=>F(e,t.row))))},[vt,q]),kt=T(rt.trim()),wt=a.useMemo(()=>{const e=""===kt?vt:vt.filter((e,t)=>xt[t].includes(kt));return ce?e.filter(e=>ce(e.row,e.origin)):e},[vt,xt,kt,ce]),St=a.useMemo(()=>new Intl.Collator(qe,{numeric:!0,sensitivity:"base"}),[qe]),Nt=a.useMemo(()=>B(wt,tt,(e,t)=>{const a=q.find(t=>t.key===e);if(!a)return null;const n="desc"===t,r=a.compare;return r?(e,t)=>n?-r(e.row,t.row):r(e.row,t.row):(e,t)=>$(F(a,e.row),F(a,t.row),St,n)}),[wt,tt,q,St]),jt=W(Nt.length,st,dt),Ct=me?Nt.slice(jt.start,jt.end):Nt,zt=e=>{void 0===ue&&lt(e),fe?.(e)},_t=e=>{void 0===xe&&ut(e),we?.(e)},Mt=e=>{const t=new Set(e),a=[],n=[];for(const e of vt)t.has(e.key)&&(n.push(e.identity),a.push(e.row));void 0===Ne&&ht(n),Ce?.(n,a)},Pt="none"!==Se,Lt="multiple"===Se,Dt=ze&&Pt,Et=(e,t,a)=>{if(_e?.(e.row,jt.start+t),Pt){if(!Lt)return Mt(gt.has(e.key)?[]:[e.key]),void(bt.current=e.key);if(a&&null!==bt.current){const t=I(Ct.map(e=>e.key),bt.current,e.key);return void Mt([...new Set([...gt,...t])])}bt.current=e.key,Mt(gt.has(e.key)?[...gt].filter(t=>t!==e.key):[...gt,e.key])}},$t=Ct.map(e=>e.key),At=$t.filter(e=>gt.has(e)).length,It=$t.length>0&&At===$t.length,Kt=e=>pt[e.key]??e.width??D,Wt=a.useRef(null);a.useEffect(()=>()=>{null!==Wt.current&&(document.body.style.userSelect=Wt.current,Wt.current=null)},[]);const Rt=(e,t)=>{const a=Math.max(E,e.minWidth??E);_t({...pt,[e.key]:Math.max(a,Kt(e)+t)})},Tt=e=>{const t={...pt};delete t[e.key],_t(t)},Bt={padding:`${Ye} ${Ue}`},Vt={...Bt,backgroundColor:"var(--_mp-color-surface-container)"},Ft={borderTop:"1px solid var(--_mp-color-outline-variant)",backgroundColor:"var(--_mp-row)"},Ht=q.length+(Dt?1:0),Xt=Boolean(_e)||Pt&&!Dt,Ot=Ee||Pt||Boolean(_e),qt=re||Me||void 0!==de,Gt=me||Pt,Jt=(...e)=>e.filter(Boolean).join(" ");return t("div",{"data-mp-size":He,"data-mp-variant":Ae,className:Jt("mp-data-table rounded-mp-md flex flex-col",p(Ae,Ie),Te),style:{...u(Xe),...Be},...Fe,children:[qt?t("div",{className:Jt("mp-data-table__toolbar flex flex-wrap items-center gap-2",Ve?.toolbar),style:{padding:`${Ye} ${Ue}`},children:[re?e(i,{size:He,value:rt,onChange:e=>{void 0===oe&&nt(e),zt(1),se?.(e)},label:ie??Qe.search,startIcon:e(o,{icon:m,size:S[He]}),className:"mp-data-table__search min-w-0 flex-1"}):e("div",{className:"min-w-0 flex-1"}),de,Me?e(n,{size:He,variant:"text",color:Xe,onClick:()=>{const e=q.filter(e=>!1!==e.exportable),t=e.map(e=>"string"==typeof e.label?e.label:e.key),a=Nt.map(t=>e.map(e=>e.exportValue?e.exportValue(t.row):F(e,t.row))),n=V([t,...a]);Le?Le(n):A(n,Pe,"text/csv;charset=utf-8")},startIcon:e(o,{icon:c,size:S[He]}),children:Ge.download}):null]}):null,e("div",{className:"mp-data-table__scroll min-h-0 flex-1 overflow-auto",children:t("table",{className:Jt("text-mp-on-surface w-full text-start",C[He],Ve?.table),style:{borderCollapse:"collapse",...ve?{tableLayout:"fixed",minWidth:q.reduce((e,t)=>e+Kt(t),Dt?H[He]:0)}:void 0},children:[Q?e("caption",{className:`text-mp-on-surface-variant ${N}`,style:{...Bt,textAlign:"start"},children:Q}):null,t("colgroup",{children:[Dt?e("col",{style:{width:H[He]}}):null,q.map(t=>e("col",{style:ve||void 0!==pt[t.key]||void 0!==t.width?{width:Kt(t)}:void 0},t.key))]}),e("thead",{className:Ve?.head,children:t("tr",{children:[Dt?e("th",{scope:"col",className:Jt("whitespace-nowrap",$e&&"sticky top-0 z-20"),style:Vt,children:e(r,{size:He,color:Xe,checked:It,indeterminate:At>0&&!It,onCheckedChange:()=>{Mt(It?[...gt].filter(e=>!$t.includes(e)):[...new Set([...gt,...$t])])},label:e("span",{className:j,children:Ge.selectAll}),disabled:!Lt||0===$t.length})}):null,q.map(a=>{const n=a.sortable??Z,r=(l=a.key,tt.findIndex(e=>e.key===l));var l;const s=-1===r?void 0:tt[r],i=a.resizable??ve,c=a.align??"start";return t("th",{scope:"col","aria-sort":n?void 0===s?"none":"asc"===s.direction?"ascending":"descending":void 0,className:Jt("text-mp-on-surface-variant relative whitespace-nowrap",z[He],$e&&"sticky top-0 z-10"),style:{...Vt,textAlign:c},children:[n?t("button",{type:"button",className:Jt(X,"end"===c&&"justify-end","center"===c&&"justify-center"),onClick:e=>((e,t)=>{const a=K(tt,e,t&&"multiple"===ee);void 0===te&&et(a),ne?.(a)})(a.key,e.shiftKey),children:[e("span",{className:"min-w-0 truncate",children:a.label??a.key}),e(o,{icon:d,size:S[He]-6,className:Jt("shrink-0 transition-[rotate,opacity]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard",void 0===s?"opacity-0 group-hover/sort:opacity-38":"text-mp-primary opacity-100","desc"===s?.direction&&"rotate-180")}),tt.length>1&&-1!==r?e("span",{className:"text-mp-primary shrink-0 tabular-nums",children:r+1}):null]}):a.label??a.key,i?e("button",{type:"button","aria-label":Ge.resize,className:O,onPointerDown:e=>((e,t)=>{const a=t.currentTarget;try{a.setPointerCapture(t.pointerId)}catch{}a.dataset.dragging="true";const n=document.body.style.userSelect;Wt.current=n,document.body.style.userSelect="none";const r=t.clientX,o=Kt(e),l="rtl"===getComputedStyle(a).direction?-1:1,s=Math.max(E,e.minWidth??E),i=t=>{_t({...pt,[e.key]:Math.max(s,Math.round(o+(t.clientX-r)*l))})},c=()=>{a.removeEventListener("pointermove",i),a.removeEventListener("pointerup",c),a.removeEventListener("pointercancel",c),delete a.dataset.dragging,null!==Wt.current&&(document.body.style.userSelect=Wt.current,Wt.current=null)};a.addEventListener("pointermove",i),a.addEventListener("pointerup",c),a.addEventListener("pointercancel",c)})(a,e),onDoubleClick:()=>Tt(a),onKeyDown:e=>{const t=e.shiftKey?32:8;"ArrowRight"===e.key?(e.preventDefault(),Rt(a,t)):"ArrowLeft"===e.key?(e.preventDefault(),Rt(a,-t)):"Home"===e.key&&(e.preventDefault(),Tt(a))}}):null]},a.key)})]})}),e("tbody",{children:0===Ct.length?e("tr",{className:_,style:Ft,children:e("td",{colSpan:Ht,className:"text-mp-on-surface-variant",style:{padding:`2rem ${Ue}`,textAlign:"center"},children:U??Je.empty})}):Ct.map((a,n)=>{const o=gt.has(a.key);return t("tr",{"aria-selected":Pt?o:void 0,className:Jt(_,Ve?.row,De&&(jt.start+n)%2==1?"[--_mp-row:var(--_mp-color-surface-container-low)]":"",o?"[--_mp-row:var(--_mp-color-secondary-container)]":"",Ot&&!o?"hover:[--_mp-row:var(--_mp-color-surface-container)]":"",(Pt||_e)&&"cursor-pointer",Xt&&["outline-mp-secondary focus-visible:outline-2","focus-visible:-outline-offset-2 focus-visible:outline-solid outline-none"].join(" ")),style:Ft,tabIndex:Xt?0:void 0,onClick:e=>Et(a,n,e.shiftKey),onKeyDown:Xt?e=>{"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),Et(a,n,e.shiftKey))}:void 0,children:[Dt?e("td",{style:Bt,children:e(r,{size:He,color:Xe,checked:o,onCheckedChange:()=>Et(a,n,!1),label:e("span",{className:j,children:Ge.selectRow})})}):null,q.map(t=>e("td",{className:Ve?.cell,style:{...Bt,textAlign:t.align??"start"},children:t.render?t.render(a.row,jt.start+n):L(F(t,a.row))},t.key))]},a.key)})})]})}),Gt?t("div",{className:Jt("mp-data-table__footer border-mp-outline-variant flex flex-wrap items-center gap-3","text-mp-on-surface-variant border-t",N,Ve?.footer),style:{padding:`${Ye} ${Ue}`},children:[e("span",{className:"mp-data-table__count",children:v(Ge.total,{total:String(Nt.length)})}),gt.size>0?e("span",{className:"mp-data-table__selected text-mp-primary",children:v(Ge.selected,{count:String(gt.size)})}):null,e("span",{className:"flex-1"}),me&&be.length>0?e(s,{size:"xs",label:Ge.perPage,floatingLabel:!1,value:dt,onValueChange:e=>(e=>{void 0===he&&ct(e),zt(1),ge?.(e)})(Number(e)),items:be.map(e=>({value:e})),className:"mp-data-table__page-size",style:{minWidth:"9.5rem"}}):null,me?e(l,{size:"xs",color:Xe,count:jt.pages,page:jt.page,onPageChange:zt,locale:qe}):null]}):null]})}
@@ -0,0 +1,2 @@
1
+ export { MPDataTable } from './MPDataTable.js';
2
+ export type { MPDataTableColumn, MPDataTableProps, MPDataTableSelectionMode, MPDataTableSlot, MPDataTableSort, MPSortDirection } from './MPDataTable.js';
@@ -0,0 +1 @@
1
+ export{MPDataTable}from"./MPDataTable.js";