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
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{MPIcon as i}from"../icon/MPIcon.js";import{CloseIcon as n}from"../../constants/icons.js";import{accentSlots as r}from"../../internal/accent.js";import{useMPLocale as a,useMPMessages as l}from"../../internal/locale.js";import{COMMON as m}from"../../internal/messages/common.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{cssLength as p}from"../../internal/length.js";import{PORTAL_LAYER as d}from"../../internal/surface.js";const u={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},f=/*@__PURE__*/["transition-[opacity,translate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),x={top:"motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",bottom:"motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full"},b={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"},y={xs:"min-h-9 gap-1.5 py-1.5 ps-3 pe-1.5",sm:"min-h-10 gap-2 py-2 ps-3.5 pe-2",md:"min-h-12 gap-2 py-2.5 ps-4 pe-2",lg:"min-h-14 gap-3 py-3 ps-5 pe-2.5",xl:"min-h-16 gap-3 py-3.5 pe-3 ps-6"},h={xs:16,sm:18,md:20,lg:22,xl:24};function g(e){const{color:t,icon:o,message:s,actionLabel:i,onAction:n,...r}=e;return{...r,title:s,data:{color:t,icon:o},actionProps:void 0===i?void 0:{children:i,onClick:n}}}export function useMPSnackbar(){const e=s.useToastManager();return o.useMemo(()=>({add:t=>e.add(g(t)),close:t=>e.close(t),update:(t,o)=>e.update(t,g(o)),promise:(t,o)=>e.promise(t,{loading:g(o.loading),success:e=>g("function"==typeof o.success?o.success(e):o.success),error:e=>g("function"==typeof o.error?o.error(e):o.error)}),snackbars:e.toasts}),[e])}function v({toast:o,color:a,size:l,showClose:m,closeLabel:p,swipeDirection:d,edge:u}){const g=o.data?.color??a,v=o.data?.icon,j={"--_mp-plate":g?`var(--_mp-color-${g}-container)`:"var(--_mp-color-inverse-surface)","--_mp-on-plate":g?`var(--_mp-color-on-${g}-container)`:"var(--_mp-color-inverse-on-surface)","--_mp-plate-action":g?`var(--_mp-color-${g})`:"var(--_mp-color-inverse-primary)",...g?r(g):null};return t(s.Root,{toast:o,swipeDirection:d,"data-mp-size":l,className:["mp-snackbar rounded-mp-xs shadow-mp-3 pointer-events-auto flex w-full items-center","bg-(--_mp-plate) text-(--_mp-on-plate) outline-none",y[l],b[l],f,x[u],"data-limited:hidden"].join(" "),style:j,children:[v?e("span",{className:"flex shrink-0 items-center",children:v}):null,e(s.Title,{render:e("span",{}),className:"min-w-0 flex-1 py-0.5 ps-1 [min-inline-size:min(280px,100%)]"}),e(s.Action,{className:["text-mp-label-large flex shrink-0 cursor-pointer items-center","rounded-mp-full h-8 px-3 text-(--_mp-plate-action)","transition-colors duration-(--mp-sys-motion-duration-short4)","hover:bg-(--_mp-plate-action)/8 focus-visible:bg-(--_mp-plate-action)/10","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ")}),m?t(s.Close,{"aria-label":p,className:["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer","items-center justify-center text-(--_mp-on-plate)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(c,{}),e(i,{icon:n,size:h[l]})]}):null]})}function j({position:t,width:o,...i}){const{toasts:n}=s.useToastManager(),r=t.startsWith("top")?"top":"bottom",a=["top"===r?"up":"down","left","right"];return e(s.Portal,{children:e(s.Viewport,{className:[d,"pointer-events-none fixed inset-x-0 flex flex-col gap-2 p-4",u[t]].join(" "),children:n.map(t=>e("div",{className:"w-full",style:{maxWidth:p(o)},children:e(v,{toast:t,swipeDirection:a,edge:r,...i})},t.id))})})}export function MPSnackbarProvider({color:o,position:i="bottom-start",timeout:n=5e3,limit:r=3,width:c=600,size:p="md",showClose:d=!0,closeLabel:u,locale:f,children:x}){const b=a(f),y=l(m,b);return t(s.Provider,{timeout:n,limit:r,children:[x,e(j,{position:i,width:c,color:o,size:p,showClose:d,closeLabel:u??y.close})]})}
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as o from"react";import{Toast as s}from"@base-ui/react/toast";import{MPIcon as i}from"../icon/MPIcon.js";import{CloseIcon as n}from"../../constants/icons.js";import{accentSlots as a}from"../../internal/accent.js";import{useMPLocale as r,useMPMessages as l}from"../../internal/locale.js";import{COMMON as m}from"../../internal/messages/common.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{cssLength as p}from"../../internal/length.js";import{PORTAL_LAYER as d}from"../../internal/surface.js";import{useMPSize as u}from"../../internal/config.js";const f={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},b=/*@__PURE__*/["transition-[opacity,translate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" "),x={top:"motion-safe:data-starting-style:-translate-y-full motion-safe:data-ending-style:-translate-y-full",bottom:"motion-safe:data-starting-style:translate-y-full motion-safe:data-ending-style:translate-y-full"},y={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"},h={xs:"min-h-9 gap-1.5 py-1.5 ps-3 pe-1.5",sm:"min-h-10 gap-2 py-2 ps-3.5 pe-2",md:"min-h-12 gap-2 py-2.5 ps-4 pe-2",lg:"min-h-14 gap-3 py-3 ps-5 pe-2.5",xl:"min-h-16 gap-3 py-3.5 pe-3 ps-6"},g={xs:16,sm:18,md:20,lg:22,xl:24};function v(t){const{color:e,icon:o,position:s,className:i,message:n,actionLabel:a,onAction:r,...l}=t;return{...l,title:n,data:{color:e,icon:o,position:s,className:i},actionProps:void 0===a?void 0:{children:a,onClick:r}}}export function useMPSnackbar(){const t=s.useToastManager();return o.useMemo(()=>({add:e=>t.add(v(e)),close:e=>t.close(e),update:(e,o)=>t.update(e,v(o)),promise:(e,o)=>t.promise(e,{loading:v(o.loading),success:t=>v("function"==typeof o.success?o.success(t):o.success),error:t=>v("function"==typeof o.error?o.error(t):o.error)}),snackbars:t.toasts}),[t])}function j({toast:o,color:r,size:l,showClose:m,closeLabel:p,swipeDirection:d,edge:u}){const f=o.data?.color??r,v=o.data?.icon,j={"--_mp-plate":f?`var(--_mp-color-${f}-container)`:"var(--_mp-color-inverse-surface)","--_mp-on-plate":f?`var(--_mp-color-on-${f}-container)`:"var(--_mp-color-inverse-on-surface)","--_mp-plate-action":f?`var(--_mp-color-${f})`:"var(--_mp-color-inverse-primary)",...f?a(f):null};return e(s.Root,{toast:o,swipeDirection:d,"data-mp-size":l,className:["mp-snackbar rounded-mp-xs shadow-mp-3 pointer-events-auto flex w-full items-center","bg-(--_mp-plate) text-(--_mp-on-plate) outline-none",h[l],y[l],b,x[u],"data-limited:hidden",o.data?.className??""].filter(Boolean).join(" "),style:j,children:[v?t("span",{className:"flex shrink-0 items-center",children:v}):null,t(s.Title,{render:t("span",{}),className:"min-w-0 flex-1 py-0.5 ps-1 [min-inline-size:min(280px,100%)]"}),t(s.Action,{className:["text-mp-label-large flex shrink-0 cursor-pointer items-center","rounded-mp-full h-8 px-3 text-(--_mp-plate-action)","transition-colors duration-(--mp-sys-motion-duration-short4)","hover:bg-(--_mp-plate-action)/8 focus-visible:bg-(--_mp-plate-action)/10","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" ")}),m?e(s.Close,{"aria-label":p,className:["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer","items-center justify-center text-(--_mp-on-plate)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[t(c,{}),t(i,{icon:n,size:g[l]})]}):null]})}const w=["top-start","top-center","top-end","bottom-start","bottom-center","bottom-end"];function _({position:e,fallback:o,width:i,...n}){const{toasts:a}=s.useToastManager(),r=a.filter(t=>(t.data?.position??o)===e),l=e.startsWith("top")?"top":"bottom",m=["top"===l?"up":"down","left","right"];return t(s.Portal,{children:t(s.Viewport,{className:[d,"pointer-events-none fixed inset-x-0 flex flex-col gap-2 p-4",f[e]].join(" "),children:r.map(e=>t("div",{className:"w-full",style:{maxWidth:p(i)},children:t(j,{toast:e,swipeDirection:m,edge:l,...n})},e.id))})})}export function MPSnackbarProvider({color:o,position:i="bottom-start",timeout:n=5e3,limit:a=3,width:c=600,size:p,showClose:d=!0,closeLabel:f,locale:b,children:x}){const y=u(p),h=r(b),g=l(m,h);return e(s.Provider,{timeout:n,limit:a,children:[x,w.map(e=>t(_,{position:e,fallback:i,width:c,color:o,size:y,showClose:d,closeLabel:f??g.close},e))]})}
@@ -0,0 +1,85 @@
1
+ import * as React from 'react';
2
+ import type { MPChartCurve, MPColor, MPSize } from '../../types.js';
3
+ /** What the series is drawn as. */
4
+ export type MPSparklineShape = 'line' | 'area' | 'bar';
5
+ export interface MPSparklineProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
6
+ /**
7
+ * The series, oldest first. A `null` is a gap — a point nothing was measured
8
+ * at — and it breaks the line rather than being joined across.
9
+ */
10
+ data: readonly (number | null)[];
11
+ /** @default 'line' */
12
+ shape?: MPSparklineShape;
13
+ /** How the line between two points is drawn. @default 'linear' */
14
+ curve?: MPChartCurve;
15
+ /**
16
+ * Marks the newest point.
17
+ *
18
+ * On by default, and it is most of what makes a sparkline readable: the whole
19
+ * shape is context for the last value, and without the dot a reader has to
20
+ * work out which end is now.
21
+ * @default true
22
+ */
23
+ endDot?: boolean;
24
+ /** The value the area or the bars are measured from. @default the series' floor */
25
+ baseline?: number;
26
+ /** Pins the bottom of the scale, so two sparklines can be compared. */
27
+ min?: number;
28
+ /** And the top. */
29
+ max?: number;
30
+ /** How wide. A number is pixels; a string is any CSS length. @default '100%' */
31
+ width?: number | string;
32
+ /** How tall. Defaults to the `size` ladder. */
33
+ height?: number;
34
+ /**
35
+ * Which accent family the mark reads, or any CSS colour. Left out, it takes
36
+ * the first slot of the chart palette.
37
+ */
38
+ color?: MPColor | (string & {});
39
+ /**
40
+ * What the shape says, for a reader who cannot see it.
41
+ *
42
+ * Left out, the component writes one from the numbers — how many points, the
43
+ * range they cover, and which way it ended. See the note on the component for
44
+ * why that is the whole of its accessibility rather than a hover layer.
45
+ */
46
+ label?: string;
47
+ /** Which language the generated label is written in. */
48
+ locale?: string;
49
+ /** @default 'md' */
50
+ size?: MPSize;
51
+ }
52
+ /**
53
+ * A series as a mark, with no axes and nothing to read a value against.
54
+ *
55
+ * ```tsx
56
+ * <MPSparkline data={[12, 15, 14, 19, 22, 21, 27]} />
57
+ * ```
58
+ *
59
+ * It answers one question — which way has this been going — and it answers it in
60
+ * the space of a word. That is the whole of its job: put it beside the number it
61
+ * is the history of, in a table cell, in a list row, in an
62
+ * [MPStatistic](statistic)'s `trend`.
63
+ *
64
+ * ## It has no hover layer, on purpose
65
+ *
66
+ * Every other chart in this library ships one, because a chart is something a
67
+ * reader interrogates. A sparkline is not. It is thirty pixels tall, it has no
68
+ * axis to read a value against, and a floating card over a mark that size covers
69
+ * the mark. A reader who needs the numbers needs [MPLineChart](line-chart), and
70
+ * a reader who needs one number has it in the figure this is sitting under.
71
+ *
72
+ * What it does have is a **sentence**. The accessible name says the shape in
73
+ * words — how many points, the range, and which way it ended — so the thing a
74
+ * sighted reader gets from the outline is a thing every reader gets. That is the
75
+ * relief channel, and it is a better one than a tooltip nobody can hover on a
76
+ * phone.
77
+ *
78
+ * ## The line is quiet and the end is not
79
+ *
80
+ * The stroke takes a faded step of its colour and the end dot takes the whole
81
+ * of it. The history is context; the last value is the point. Drawn at one
82
+ * weight throughout, a sparkline is a shape with no emphasis in it, and the eye
83
+ * has to find the end for itself.
84
+ */
85
+ export declare const MPSparkline: React.ForwardRefExoticComponent<MPSparklineProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{useMPLocale as i,useMPMessages as l}from"../../internal/locale.js";import{useMPSize as o}from"../../internal/config.js";import{fillMessage as a}from"../../internal/i18n.js";import{SPARKLINE as s}from"../../internal/messages/sparkline.js";import{TABLE as m}from"../../internal/messages/table.js";import{cssLength as c}from"../../internal/length.js";import{areaPath as p,barPath as f,extentOf as h,linePath as u,seriesColor as d}from"../../internal/chart.js";const g={xs:16,sm:24,md:32,lg:44,xl:56},b={xs:1.25,sm:1.5,md:2,lg:2.5,xl:3};export const MPSparkline=/*@__PURE__*/n.forwardRef(function({data:k,shape:x="line",curve:y="linear",endDot:j=!0,baseline:v,min:w,max:M,width:N="100%",height:F,color:L,label:$,locale:z,size:B,className:E,style:R,...W},A){const D=o(B),I=i(z),P=l(s,I),S=l(m,I),q=F??g[D],C=b[D],G=d(0,L),H=100,J=q,K="bar"===x?0:C/2,O=h(k,w,M),Q=O.max-O.min,T=e=>J-K-(e-O.min)/Q*(J-2*K),U=k.length>1?H/(k.length-1):0,V=k.map((e,t)=>null!==e&&Number.isFinite(e)?{x:k.length>1?t*U:50,y:T(e)}:null),X=v??O.min,Y=[...V].reverse().find(e=>null!==e)??null,Z=n.useMemo(()=>{if(void 0!==$)return $;const e=k.filter(e=>null!==e&&Number.isFinite(e));if(0===e.length)return S.empty;const t=new Intl.NumberFormat(I);return a(P.summary,{count:t.format(e.length),first:t.format(e[0]),last:t.format(e[e.length-1])})},[$,k,I,P.summary,S.empty]);return e("div",{ref:A,"data-mp-size":D,className:["mp-sparkline block",E??""].filter(Boolean).join(" "),style:{width:c(N),...R},...W,children:r("svg",{role:"img","aria-label":Z,viewBox:`0 0 100 ${J}`,preserveAspectRatio:"none",width:"100%",height:q,style:{display:"block",overflow:"visible"},children:["bar"===x?k.map((t,r)=>{if(null===t||!Number.isFinite(t))return null;const n=H/k.length,i=Math.max(.5,n-2),l=T(X),o=T(t);return e("path",{d:f(r*n+(n-i)/2,Math.min(o,l),i,Math.abs(l-o),i/3,t>=X?"top":"bottom"),fill:G,opacity:j&&r===k.length-1?1:.55},r)}):r(t,{children:["area"===x?e("path",{d:p(V,T(X),y),fill:G,opacity:.16}):null,e("path",{d:u(V,y),fill:"none",stroke:G,strokeWidth:C,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",opacity:.55})]}),j&&Y&&"bar"!==x?e("path",{d:`M${Y.x} ${Y.y}h0`,stroke:G,strokeWidth:2.5*C,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}):null]})})});
@@ -0,0 +1,2 @@
1
+ export { MPSparkline } from './MPSparkline.js';
2
+ export type { MPSparklineProps, MPSparklineShape } from './MPSparkline.js';
@@ -0,0 +1 @@
1
+ export{MPSparkline}from"./MPSparkline.js";
@@ -102,5 +102,17 @@ export interface MPSpoilerProps extends Omit<React.ComponentPropsWithoutRef<'div
102
102
  * three matter: a spoiler that can be defeated by Ctrl-A is not a spoiler, and
103
103
  * `aria-hidden` alone would leave a keyboard reader tabbing into a link their
104
104
  * screen reader has been told is not there.
105
+ *
106
+ * ## The box holds still
107
+ *
108
+ * Two separate things were moving it, and both of them are the same mistake in
109
+ * different clothes: something that is drawn in one state and not in the other,
110
+ * without the state that lacks it paying for the space.
111
+ *
112
+ * A `reversible` sheet's way back out is **reserved** rather than mounted on
113
+ * reveal, so pressing the button does not push the rest of the page down by the
114
+ * height of the row that replaces it. And the cover is a **grid item** rather
115
+ * than an `absolute` box, so a cover taller than what it covers makes the sheet
116
+ * taller instead of being cut off by it.
105
117
  */
106
118
  export declare const MPSpoiler: React.ForwardRefExoticComponent<MPSpoilerProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{MPButton as o}from"../button/MPButton.js";import{inertProps as i}from"../../internal/inert.js";import{useMPLocale as n,useMPMessages as t}from"../../internal/locale.js";import{SPOILER as l}from"../../internal/messages/spoiler.js";import{hasContent as s,META_TEXT as d,SHEET_PAD as c,SHEET_PAD_X as m,SHEET_PAD_Y as p}from"../../internal/scale.js";import{CONTAINER_SURFACE as f}from"../../internal/surface.js";const u="[background-color:color-mix(in_oklab,var(--_mp-color-surface)_55%,transparent)]";export const MPSpoiler=/*@__PURE__*/a.forwardRef(function({revealed:v,defaultRevealed:x=!1,onRevealedChange:h,locale:j,label:b,hideLabel:g,description:N,action:y,reversible:z=!1,maxHeight:k,blur:w=10,padded:B=!0,variant:C="outlined",size:R="md",color:_="primary",className:H,children:M,...P},S){const $=n(j),I=t(l,$),L=a.useId(),[q,A]=a.useState(x),D=v??q,E=e=>{void 0===v&&A(e),h?.(e)},F=!1===N?null:N??I.notice;return r("div",{ref:S,"data-mp-size":R,"data-mp-variant":C,"data-mp-revealed":D||void 0,className:["mp-spoiler rounded-mp-md relative isolate overflow-hidden","box-border",f[C],"text-mp-on-surface",H??""].filter(Boolean).join(" "),...P,children:[e("div",{id:L,className:["min-w-0",B?c[R]:"","transition-[filter] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",D?"":"select-none"].filter(Boolean).join(" "),style:{filter:D?void 0:`blur(${w}px)`,maxHeight:D?void 0:k,overflow:D?void 0:"hidden"},...i(!D),children:M}),D?null:r("div",{className:["absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 text-center",c[R],u].join(" "),children:[s(F)?e("p",{className:`text-mp-on-surface-variant m-0 ${d}`,children:F}):null,y??e(o,{variant:"tonal",size:R,color:_,onClick:()=>E(!0),"aria-expanded":!1,"aria-controls":L,children:b??I.reveal})]}),D&&z?e("div",{className:["flex justify-end",m[R],p[R],"pt-0"].join(" "),children:e(o,{variant:"text",size:R,color:_,onClick:()=>E(!1),"aria-expanded":!0,"aria-controls":L,children:g??I.hide})}):null]})});
2
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{MPButton as a}from"../button/MPButton.js";import{inertProps as i}from"../../internal/inert.js";import{useMPLocale as t,useMPMessages as n}from"../../internal/locale.js";import{SPOILER as l}from"../../internal/messages/spoiler.js";import{hasContent as s,META_TEXT as d,SHEET_PAD as c,SHEET_PAD_X as m,SHEET_PAD_Y as p}from"../../internal/scale.js";import{CONTAINER_SURFACE as f}from"../../internal/surface.js";import{useMPColor as u,useMPSize as v}from"../../internal/config.js";const x="[background-color:color-mix(in_oklab,var(--_mp-color-surface)_55%,transparent)]";export const MPSpoiler=/*@__PURE__*/o.forwardRef(function({revealed:h,defaultRevealed:j=!1,onRevealedChange:b,locale:g,label:w,hideLabel:N,description:z,action:k,reversible:y=!1,maxHeight:B,blur:_=10,padded:C=!0,variant:R="outlined",size:H,color:M,className:P,children:S,...$},I){const L=v(H),q=u(M),A=t(g),D=n(l,A),E=o.useId(),[F,G]=o.useState(j),J=h??F,K=e=>{void 0===h&&G(e),b?.(e)},O=!1===z?null:z??D.notice;return r("div",{ref:I,"data-mp-size":L,"data-mp-variant":R,"data-mp-revealed":J||void 0,className:["mp-spoiler rounded-mp-md relative isolate overflow-hidden","box-border","grid grid-cols-1",y?"grid-rows-[auto_auto]":"grid-rows-[auto]",f[R],"text-mp-on-surface",P??""].filter(Boolean).join(" "),...$,children:[e("div",{id:E,className:["col-start-1 row-start-1 min-w-0",C?c[L]:"","transition-[filter] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",J?"":"select-none"].filter(Boolean).join(" "),style:{filter:J?void 0:`blur(${_}px)`,maxHeight:J?void 0:B,overflow:J?void 0:"hidden"},...i(!J),children:S}),J?null:r("div",{className:["col-span-full row-span-full z-10","flex flex-col items-center justify-center gap-2 text-center",c[L],x].join(" "),children:[s(O)?e("p",{className:`text-mp-on-surface-variant m-0 ${d}`,children:O}):null,k??e(a,{variant:"tonal",size:L,color:q,onClick:()=>K(!0),"aria-expanded":!1,"aria-controls":E,children:w??D.reveal})]}),y?e("div",{className:["col-start-1 row-start-2 flex justify-end",m[L],p[L],"pt-0",J?"":"invisible"].filter(Boolean).join(" "),...i(!J),children:e(a,{variant:"text",size:L,color:q,onClick:()=>K(!1),"aria-expanded":!0,"aria-controls":E,children:N??D.hide})}):null]})});
@@ -0,0 +1,198 @@
1
+ import * as React from 'react';
2
+ import type { MPAnimateTimeline, MPAnimateTrigger, MPAnimation, MPEasing, MPSize } from '../../types.js';
3
+ /**
4
+ * Which way the pile grows.
5
+ *
6
+ * `diagonal` is a **horizontal** flow with a per-item vertical offset, not a
7
+ * flow of its own: see the note on `drop` for why the second axis cannot be
8
+ * left to the layout.
9
+ */
10
+ export type MPStackDirection = 'horizontal' | 'vertical' | 'diagonal';
11
+ /** Which end of the pile is nearest the reader. */
12
+ export type MPStackFront = 'first' | 'last';
13
+ export interface MPStackProps extends React.ComponentPropsWithoutRef<'div'> {
14
+ /**
15
+ * Which way the pile grows.
16
+ * @default 'horizontal'
17
+ */
18
+ direction?: MPStackDirection;
19
+ /**
20
+ * How far each item sits under the one before it, along the axis the pile
21
+ * flows on — a number in pixels, or any CSS length. Left out it is a fraction
22
+ * of `size`.
23
+ */
24
+ overlap?: number | string;
25
+ /**
26
+ * How far each item sits below the one before it on `diagonal`, which is the
27
+ * axis the flow is **not** on. Defaults to `overlap`, which is a shallow fan.
28
+ *
29
+ * It is a prop rather than an angle because a true 45° would need the items'
30
+ * own width, and a library does not have it: the horizontal advance is
31
+ * `width − overlap`, and `width` is whatever the caller put in. Nothing here
32
+ * pretends otherwise.
33
+ */
34
+ drop?: number | string;
35
+ /**
36
+ * Sets the default `overlap`, and nothing else. It is not passed to the
37
+ * items — a `Stack` does not know what they are.
38
+ * @default 'md'
39
+ */
40
+ size?: MPSize;
41
+ /** How many items are drawn before the rest become an `overflow`. */
42
+ max?: number;
43
+ /**
44
+ * How many there are altogether, when the stack was handed only the first few.
45
+ * Without it the count is worked out from the children, which is right only
46
+ * when all of them were passed.
47
+ */
48
+ total?: number;
49
+ /**
50
+ * The last item in the pile, built from the number that did not fit.
51
+ *
52
+ * A **function** rather than a node, because the count is the whole of what
53
+ * that item has to say: `(hidden) => <MPAvatar initials={`+${hidden}`} />`.
54
+ * Left out, nothing is drawn for the remainder.
55
+ */
56
+ overflow?: (hidden: number) => React.ReactNode;
57
+ /**
58
+ * Which end of the pile is nearest the reader.
59
+ * @default 'first'
60
+ */
61
+ front?: MPStackFront;
62
+ /**
63
+ * What each item is scaled by relative to the one in front of it. `1` is no
64
+ * change; `0.94` puts the fifth card at about three quarters.
65
+ *
66
+ * It changes what is drawn and not what is measured, so the spacing of the
67
+ * pile is the same either way — a scaled card does not pull the ones behind
68
+ * it closer.
69
+ * @default 1
70
+ */
71
+ scaleStep?: number;
72
+ /**
73
+ * The same, for opacity. `0.85` fades a deck into the page behind it.
74
+ * @default 1
75
+ */
76
+ opacityStep?: number;
77
+ /**
78
+ * Draws a hairline of the page's own `surface` around each item, so two
79
+ * shapes of similar tone have an edge between them.
80
+ *
81
+ * On the **item** rather than on the wrapper around it, because a ring has to
82
+ * follow the shape it is tracing and a square ring around a circular avatar
83
+ * is worse than none. That is a fixed-depth selector, so it reaches a child
84
+ * this stack put there and not one wrapped in something else — see the
85
+ * component's documentation.
86
+ * @default false
87
+ */
88
+ ring?: boolean;
89
+ /**
90
+ * An entrance for each item, from the same six the `MPAnimate*` components
91
+ * run. Left out, nothing is animated.
92
+ */
93
+ transition?: MPAnimation;
94
+ /** How long one item's entrance takes, in milliseconds. */
95
+ duration?: number;
96
+ /** How long before the first one starts, in milliseconds. */
97
+ delay?: number;
98
+ /** Which Material easing curve the entrance runs on. */
99
+ easing?: MPEasing;
100
+ /**
101
+ * How long after one item the next one starts, in milliseconds.
102
+ * @default 60
103
+ */
104
+ stagger?: number;
105
+ /** How much longer each item takes than the one before it, in milliseconds. */
106
+ durationStep?: number;
107
+ /** Deals the pile from the back. */
108
+ reverse?: boolean;
109
+ /**
110
+ * What starts the entrance.
111
+ * @default 'mount'
112
+ */
113
+ trigger?: MPAnimateTrigger;
114
+ /** Runs it, when `trigger` is `manual`. */
115
+ play?: boolean;
116
+ /**
117
+ * With `trigger="visible"`, whether it runs only the first time.
118
+ * @default true
119
+ */
120
+ once?: boolean;
121
+ /**
122
+ * With `trigger="visible"`, how much has to be on screen to count.
123
+ * @default 0.2
124
+ */
125
+ threshold?: number;
126
+ /** Holds the entrance where it is. */
127
+ paused?: boolean;
128
+ /** Hands the entrance to the reader's scrolling. */
129
+ timeline?: MPAnimateTimeline;
130
+ /** Which part of the travel through the scrollport the entrance covers. */
131
+ range?: string;
132
+ /** The things in the pile. */
133
+ children?: React.ReactNode;
134
+ }
135
+ /**
136
+ * Things laid over each other in a pile.
137
+ *
138
+ * A stack of avatars, a deck of cards, a heap of documents, a run of overlapped
139
+ * thumbnails: one component, because "several of these, overlapping" is one
140
+ * idea and the things being overlapped are not this component's business.
141
+ *
142
+ * ## Why the overlap is a margin and not a `translate`
143
+ *
144
+ * This is the detail nearly every implementation of this gets wrong. Move the
145
+ * items with `translate` and each one still **occupies its full width**: the
146
+ * box stays the size of one item plus the full width of all the others, the
147
+ * pile is drawn outside it, and everything after the stack on the page is laid
148
+ * out against a measurement that is wrong. It cannot go in a sentence.
149
+ *
150
+ * A negative margin takes the space back, so the box is exactly the size of
151
+ * what is drawn. At 32px items with a 10px overlap, five of them come to
152
+ * 120×32 horizontally, 32×120 vertically and 120×72 on the diagonal — the box
153
+ * fits the content in all three.
154
+ *
155
+ * The margin is **logical**, so a horizontal pile overlaps the other way under
156
+ * RTL without being asked to.
157
+ *
158
+ * ## Why `diagonal` is a horizontal flow
159
+ *
160
+ * Because a flow only overlaps items on the axis it flows along. The other axis
161
+ * has to be written per item, as a margin multiplied by the item's index — a
162
+ * fixed `margin-block-start` in a row does not accumulate, it puts every item
163
+ * at the same offset and the fan does not happen.
164
+ *
165
+ * ## What it does not do
166
+ *
167
+ * It does not know what the items **are**, which is the price of being general.
168
+ * There is no `variant`, no `color` and no `shape` to set once for the pile:
169
+ * `size` here picks the default overlap and is not passed on. Set the ones your
170
+ * items share on [MPConfigProvider](../../guide/config), and the rest per item.
171
+ *
172
+ * ## Two layers per item, and why
173
+ *
174
+ * Each item is wrapped twice. The outer span carries the offset, the `z-index`
175
+ * and the entrance; the inner one carries the static `scale` and `opacity` that
176
+ * make depth. They are separate because the `grow` and `zoom` keyframes
177
+ * animate the individual `scale` property — an animation and a resting depth on
178
+ * the same element means the keyframe wins and the depth is gone the moment
179
+ * something is animated.
180
+ *
181
+ * The wrappers are also what keeps this off the children. Cloning them to add a
182
+ * `className` would require every child to accept one, and a face wrapped in a
183
+ * router's link or a tooltip trigger has no obligation to.
184
+ *
185
+ * `ring` is the one exception, and it is honest about the cost: it is a
186
+ * fixed-depth descendant selector, so it lands on the element this stack
187
+ * wrapped. A child that is itself a wrapper gets the ring on the wrapper.
188
+ *
189
+ * ## What `transition` costs
190
+ *
191
+ * 2.1 kB gzipped against the 0.9 kB the layout alone would come to, because it
192
+ * reads the same effect tables `MPAnimateFade` does. It is here rather than
193
+ * composed from outside because the items are inside wrappers this component
194
+ * builds and nothing outside can reach them — but a stack of four faces with no
195
+ * `transition` is paying for six effects it will never run, and that is written
196
+ * into the documentation rather than left to be found.
197
+ */
198
+ export declare const MPStack: React.ForwardRefExoticComponent<MPStackProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{ANIMATION_CLASS as a,ANIM_BASE as r,animationSlots as i,useAnimationRun as n}from"../../internal/animate.js";import{lengthValue as l}from"../../internal/animate.js";import{useMPSize as o}from"../../internal/config.js";const s={xs:"0.625rem",sm:"0.75rem",md:"1.125rem",lg:"1.25rem",xl:"1.5rem"};export const MPStack=/*@__PURE__*/t.forwardRef(function({direction:c="horizontal",overlap:m,drop:d,size:p,max:f,total:g,overflow:h,front:u="first",scaleStep:v=1,opacityStep:y=1,ring:x=!1,transition:S,duration:k,delay:j=0,easing:$,stagger:w=60,durationStep:z=0,reverse:N=!1,trigger:B="mount",play:M,once:_=!0,threshold:I=.2,paused:b,timeline:A,range:C,className:E,style:O,children:P,...R},V){const q=o(p),D=n({trigger:B,play:M,once:_,threshold:I,paused:b,infinite:!1}),F="view"===A?b?"paused":"running":D.state,G=t.Children.toArray(P),H=void 0===f?G:G.slice(0,Math.max(0,f)),J=g??G.length,K=Math.max(0,J-H.length),L=h&&K>0?h(K):null,Q=null===L?H:[...H,L],T=void 0===m?s[q]:l(m),U=void 0===d?T:l(d),W="vertical"===c?"flex-col":"flex-row",X=S?`${r} ${a[S]}`:"";return e("div",{ref:e=>{D.ref(e),"function"==typeof V?V(e):V&&(V.current=e)},"data-mp-size":q,"data-mp-direction":c,className:["mp-stack isolate inline-flex align-middle",W,"diagonal"===c?"items-start":"items-center",x?"ring-mp-surface [&>*>*>*]:ring-2":"",E??""].filter(Boolean).join(" "),style:{"--_mp-anim-state":F,...O},...D.handlers,...R,children:Q.map((a,r)=>{const n=N?Q.length-1-r:r,l="first"===u?r:Q.length-1-r;return e("span",{className:X,style:{zIndex:"first"===u?Q.length-r:r+1,...r>0&&"vertical"===c?{marginBlockStart:`calc(${T} * -1)`}:{},...r>0&&"vertical"!==c?{marginInlineStart:`calc(${T} * -1)`}:{},..."diagonal"===c?{marginBlockStart:`calc(${U} * ${r})`}:{},...S?i({effect:S,duration:k,delay:j+n*w,easing:$,repeat:1,durationOffset:n*z,timeline:A,range:C}):{}},children:e("span",{className:"mp-stack__item block",style:{scale:1===v?void 0:String(v**l),opacity:1===y?void 0:y**l},children:a})},t.isValidElement(a)?a.key??r:r)})})});
@@ -0,0 +1,2 @@
1
+ export { MPStack } from './MPStack.js';
2
+ export type { MPStackDirection, MPStackFront, MPStackProps } from './MPStack.js';
@@ -0,0 +1 @@
1
+ export{MPStack}from"./MPStack.js";
@@ -0,0 +1,104 @@
1
+ import * as React from 'react';
2
+ import type { MPAlign, MPSize, MPSlots } from '../../types.js';
3
+ /** How the move from `previousValue` is written. */
4
+ export type MPStatisticDeltaFormat = 'percent' | 'absolute' | 'both' | 'none';
5
+ /** The parts an `MPStatistic` draws that a `className` cannot reach. */
6
+ export type MPStatisticSlot = 'label' | 'value' | 'delta' | 'caption' | 'trend';
7
+ export interface MPStatisticProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'prefix' | 'color'> {
8
+ /** What the figure is. Sentence case, and no trailing colon. */
9
+ label?: React.ReactNode;
10
+ /**
11
+ * The figure.
12
+ *
13
+ * A number is written by `locale` and `format`; anything else is drawn as it
14
+ * is, for a value that is already a string — `"2h 14m"`, `"A+"` — or a piece
15
+ * of markup.
16
+ */
17
+ value: React.ReactNode;
18
+ /**
19
+ * How a numeric `value` is written. An `Intl.NumberFormat` options object, and
20
+ * giving one turns `compact` off: a caller who has asked for a currency has
21
+ * said what they want.
22
+ */
23
+ format?: Intl.NumberFormatOptions;
24
+ /**
25
+ * Shortens a number of five digits or more — `12.9K`, `4.2M`.
26
+ *
27
+ * Four digits stay: `1,284` is a figure anybody takes in at a glance, and
28
+ * `1.3K` has thrown away two of them to save two characters.
29
+ * @default true
30
+ */
31
+ compact?: boolean;
32
+ /** Which language the figure and the move are written in. */
33
+ locale?: string;
34
+ /** Placed before the figure, on the same line — a currency mark, an icon. */
35
+ prefix?: React.ReactNode;
36
+ /** Placed after it, one step smaller — a unit, a denominator. */
37
+ unit?: React.ReactNode;
38
+ /** What the figure was, so the move from it can be drawn. */
39
+ previousValue?: number;
40
+ /**
41
+ * How that move is written.
42
+ * @default 'percent'
43
+ */
44
+ delta?: MPStatisticDeltaFormat;
45
+ /**
46
+ * Which direction is the good one.
47
+ *
48
+ * It is a prop and not an assumption because half the figures on a dashboard
49
+ * are the other way round: churn, latency, cost and error rate are all better
50
+ * when they fall, and a component that painted every fall red would be lying
51
+ * about four tiles in eight.
52
+ * @default 'up'
53
+ */
54
+ betterWhen?: 'up' | 'down';
55
+ /** What the move is measured against — "vs last week". Read out with it. */
56
+ period?: React.ReactNode;
57
+ /** A line under the figure, for the thing that does not fit anywhere else. */
58
+ caption?: React.ReactNode;
59
+ /**
60
+ * Room under the figure for a picture of it — a sparkline, usually.
61
+ *
62
+ * A slot rather than a chart of its own: a statistic that owned a sparkline
63
+ * would be a statistic that had opinions about a second component's data
64
+ * shape, and the two are separable.
65
+ */
66
+ trend?: React.ReactNode;
67
+ /** @default 'start' */
68
+ align?: MPAlign;
69
+ /** @default 'md' */
70
+ size?: MPSize;
71
+ classNames?: MPSlots<MPStatisticSlot>;
72
+ }
73
+ /**
74
+ * One figure, said once and read from across a desk.
75
+ *
76
+ * ```tsx
77
+ * <MPStatistic label="Active installs" value={128400} previousValue={119200} />
78
+ * ```
79
+ *
80
+ * It is the chart you draw when there is nothing to plot. A single number has no
81
+ * shape, no order and no second dimension, and putting it on a pair of axes to
82
+ * make it look like data is the most common way a dashboard wastes a panel. What
83
+ * a reader wants from one figure is the figure, what it is, and whether it is
84
+ * going the right way.
85
+ *
86
+ * ## The direction is the caller's to say
87
+ *
88
+ * `betterWhen` exists because half the figures on any dashboard are the other
89
+ * way round — churn, latency, cost and error rate are all better when they fall.
90
+ * A component that painted every fall red would be wrong about four tiles in
91
+ * eight, and it would be wrong *confidently*, in the one colour a reader trusts
92
+ * without checking.
93
+ *
94
+ * Flat is a third state rather than a quiet "up". It takes the muted ink and a
95
+ * dash, because a figure that has not moved has not done anything good either.
96
+ *
97
+ * ## The figure does not wear the direction's colour
98
+ *
99
+ * Only the move does. The number itself is `on-surface` at every size, in every
100
+ * state: it is the thing being reported, and a reported value that changes
101
+ * colour with its own trend is a value the reader has to decode before they can
102
+ * read it.
103
+ */
104
+ export declare function MPStatistic({ label, value, format, compact, locale: localeProp, prefix, unit, previousValue, delta, betterWhen, period, caption, trend, align, size: sizeProp, className, classNames, ...props }: MPStatisticProps): React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import{MPIcon as a}from"../icon/MPIcon.js";import{ArrowDownIcon as l,ArrowUpIcon as n,RemoveIcon as i}from"../../constants/icons.js";import{useMPLocale as s}from"../../internal/locale.js";import{useMPSize as r}from"../../internal/config.js";import{COMPACT_FROM as m,deltaOf as c,formatStatistic as o}from"../../internal/chart.js";import{META_TEXT as p,hasContent as u}from"../../internal/scale.js";const d={xs:"text-mp-title-medium",sm:"text-mp-title-large",md:"text-mp-headline-small",lg:"text-mp-headline-medium",xl:"text-mp-display-small"},x={xs:"text-mp-label-small",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-title-small",xl:"text-mp-title-medium"},f={start:"items-start text-start",center:"items-center text-center",end:"items-end text-end"};export function MPStatistic({label:h,value:b,format:g,compact:N=!0,locale:j,prefix:v,unit:_,previousValue:y,delta:w="percent",betterWhen:D="up",period:F,caption:z,trend:I,align:M="start",size:k,className:B,classNames:P,...Z}){const S=r(k),V=s(j),W="number"==typeof b?o(b,V,g,N):b,$="number"==typeof b&&"number"==typeof y&&"none"!==w?c(b,y,D):null,q=null===$?.percent||null===$?null:new Intl.NumberFormat(V,{style:"percent",maximumFractionDigits:1,signDisplay:"exceptZero"}).format($.percent/100),A=null===$?null:new Intl.NumberFormat(V,{...g??{},signDisplay:"exceptZero",...g?{}:N&&Math.abs($.absolute)>=m?{notation:"compact",maximumFractionDigits:1}:{}}).format($.absolute),C="absolute"===w?A:"both"===w?[A,q].filter(Boolean).join(" · "):q??A,E=(...t)=>t.filter(Boolean).join(" ");return e("div",{"data-mp-size":S,className:E("mp-statistic flex min-w-0 flex-col gap-1",f[M],B),...Z,children:[u(h)?t("span",{className:E("mp-statistic__label text-mp-on-surface-variant",x[S],P?.label),children:h}):null,e("span",{className:E("mp-statistic__value text-mp-on-surface flex items-baseline gap-1 font-medium",d[S],P?.value),children:[u(v)?t("span",{className:"shrink-0",children:v}):null,t("span",{className:"min-w-0 truncate",children:W}),u(_)?t("span",{className:`text-mp-on-surface-variant shrink-0 ${x[S]}`,children:_}):null]}),$&&C?e("span",{className:E("mp-statistic__delta flex items-center gap-0.5",p,0===$.direction?"text-mp-on-surface-variant":$.good?"text-mp-tertiary":"text-mp-error",P?.delta),"data-mp-direction":0===$.direction?"flat":1===$.direction?"up":"down",children:[t(a,{icon:0===$.direction?i:1===$.direction?n:l,size:14}),t("span",{children:C}),u(F)?t("span",{className:"text-mp-on-surface-variant",children:F}):null]}):null,u(z)?t("span",{className:E("mp-statistic__caption text-mp-on-surface-variant",p,P?.caption),children:z}):null,u(I)?t("div",{className:E("mp-statistic__trend w-full",P?.trend),children:I}):null]})}
@@ -0,0 +1,2 @@
1
+ export { MPStatistic } from './MPStatistic.js';
2
+ export type { MPStatisticDeltaFormat, MPStatisticProps, MPStatisticSlot } from './MPStatistic.js';
@@ -0,0 +1 @@
1
+ export{MPStatistic}from"./MPStatistic.js";