material-plus-ui 1.6.0 → 1.8.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.
- package/LICENSE +1 -1
- package/README.md +20 -14
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +34 -3
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/anchor/MPAnchor.d.ts +107 -0
- package/dist/components/anchor/MPAnchor.js +2 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
- package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
- package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/MPAnimateFade.js +2 -1
- package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
- package/dist/components/animate-float/MPAnimateFloat.js +2 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
- package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
- package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
- package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
- package/dist/components/animate-shake/MPAnimateShake.js +2 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
- package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
- package/dist/components/animate-split/MPAnimateSplit.js +2 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
- package/dist/components/app-logo/MPAppLogo.d.ts +171 -0
- package/dist/components/app-logo/MPAppLogo.js +2 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
- package/dist/components/area-chart/MPAreaChart.js +2 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +2 -1
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
- package/dist/components/bar-chart/MPBarChart.js +2 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +18 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +2 -18
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/box/MPBox.d.ts +43 -8
- package/dist/components/box/MPBox.js +2 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.js +1 -1
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +11 -2
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
- package/dist/components/code-block/MPCodeBlock.js +2 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
- package/dist/components/collapsible/MPCollapsible.js +1 -1
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +21 -4
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +49 -7
- package/dist/components/config/MPConfigProvider.js +1 -1
- package/dist/components/confirm/MPConfirmProvider.js +1 -1
- package/dist/components/container/MPContainer.d.ts +9 -2
- package/dist/components/container/MPContainer.js +2 -1
- package/dist/components/data-list/MPDataList.d.ts +82 -0
- package/dist/components/data-list/MPDataList.js +2 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/MPDataTable.d.ts +314 -0
- package/dist/components/data-table/MPDataTable.js +2 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +10 -2
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +8 -2
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +10 -1
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/fieldset/MPFieldset.js +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/flex/MPFlex.d.ts +95 -0
- package/dist/components/flex/MPFlex.js +2 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/footer/MPFooter.d.ts +24 -4
- package/dist/components/footer/MPFooter.js +1 -1
- package/dist/components/form/MPForm.js +1 -1
- package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
- package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +25 -8
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/header/MPHeader.d.ts +26 -4
- package/dist/components/header/MPHeader.js +1 -1
- package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
- package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/hover-card/MPHoverCard.d.ts +101 -0
- package/dist/components/hover-card/MPHoverCard.js +2 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/icon/MPIcon.js +1 -1
- package/dist/components/image/MPImage.d.ts +122 -5
- package/dist/components/image/MPImage.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/line-chart/MPLineChart.d.ts +66 -0
- package/dist/components/line-chart/MPLineChart.js +2 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/list/MPList.d.ts +23 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +1 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/menubar/MPMenubar.js +1 -1
- package/dist/components/meter/MPMeter.d.ts +87 -0
- package/dist/components/meter/MPMeter.js +2 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/MPMockup.d.ts +143 -0
- package/dist/components/mockup/MPMockup.js +2 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
- package/dist/components/pie-chart/MPPieChart.js +2 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popconfirm/MPPopconfirm.d.ts +2 -2
- package/dist/components/popover/MPPopover.d.ts +1 -0
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/portal/MPPortal.d.ts +75 -0
- package/dist/components/portal/MPPortal.js +2 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
- package/dist/components/scatter-chart/MPScatterChart.js +2 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
- package/dist/components/scroll-area/MPScrollArea.js +2 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
- package/dist/components/scroll-zone/MPScrollZone.js +2 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.d.ts +27 -4
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/show/MPShow.d.ts +78 -0
- package/dist/components/show/MPShow.js +2 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/MPSidebar.d.ts +20 -1
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +85 -0
- package/dist/components/sparkline/MPSparkline.js +2 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/stack/MPStack.d.ts +198 -0
- package/dist/components/stack/MPStack.js +2 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/MPStatistic.d.ts +104 -0
- package/dist/components/statistic/MPStatistic.js +2 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +1 -0
- package/dist/components/stepper/MPStepper.js +1 -1
- package/dist/components/table/MPTable.d.ts +25 -3
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +12 -0
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
- package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toggle/MPToggle.js +1 -1
- package/dist/components/toolbar/MPToolbar.d.ts +106 -0
- package/dist/components/toolbar/MPToolbar.js +2 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.js +1 -1
- package/dist/components/tour/MPTour.d.ts +120 -0
- package/dist/components/tour/MPTour.js +2 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
- package/dist/components/tree-select/MPTreeSelect.js +2 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/MPTreeView.d.ts +153 -0
- package/dist/components/tree-view/MPTreeView.js +2 -0
- package/dist/components/tree-view/index.d.ts +2 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +10 -1
- package/dist/components/typography/MPTypography.js +2 -1
- package/dist/constants/glyphs.d.ts +33 -31
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +32 -31
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +22 -5
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMPColorScheme.js +1 -0
- package/dist/hooks/useMPDisclosure.d.ts +58 -0
- package/dist/hooks/useMPDisclosure.js +2 -0
- package/dist/hooks/useMPElementSize.d.ts +55 -0
- package/dist/hooks/useMPElementSize.js +2 -0
- package/dist/hooks/useMPMediaQuery.d.ts +40 -0
- package/dist/hooks/useMPMediaQuery.js +2 -0
- package/dist/hooks/useMPOnScreen.d.ts +58 -0
- package/dist/hooks/useMPOnScreen.js +2 -0
- package/dist/hooks/useMPReducedMotion.js +1 -0
- package/dist/hooks/useMPWindowClass.d.ts +7 -0
- package/dist/hooks/useMPWindowClass.js +1 -0
- package/dist/index.d.ts +35 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +199 -0
- package/dist/internal/ChartChrome.js +2 -0
- package/dist/internal/ChartFrame.d.ts +197 -0
- package/dist/internal/ChartFrame.js +2 -0
- package/dist/internal/FieldOutline.d.ts +14 -5
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/PopupArrow.d.ts +60 -0
- package/dist/internal/PopupArrow.js +2 -0
- package/dist/internal/SupportingText.d.ts +24 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/animate-core.d.ts +121 -0
- package/dist/internal/animate-core.js +1 -0
- package/dist/internal/animate.d.ts +75 -55
- package/dist/internal/animate.js +1 -1
- package/dist/internal/bottom-navigation.d.ts +58 -0
- package/dist/internal/bottom-navigation.js +2 -0
- package/dist/internal/chart.d.ts +461 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/color-scheme.d.ts +0 -9
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +195 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +22 -18
- package/dist/internal/date.js +1 -1
- package/dist/internal/density.d.ts +9 -0
- package/dist/internal/density.js +1 -0
- package/dist/internal/elevation.d.ts +26 -0
- package/dist/internal/elevation.js +1 -0
- package/dist/internal/highlight.d.ts +96 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +180 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/intl.d.ts +64 -0
- package/dist/internal/intl.js +1 -0
- package/dist/internal/mark.d.ts +52 -0
- package/dist/internal/mark.js +1 -0
- package/dist/internal/measure.d.ts +31 -0
- package/dist/internal/measure.js +1 -0
- package/dist/internal/messages/anchor.d.ts +3 -0
- package/dist/internal/messages/anchor.js +1 -0
- package/dist/internal/messages/chart.d.ts +3 -0
- package/dist/internal/messages/chart.js +1 -0
- package/dist/internal/messages/code.d.ts +3 -0
- package/dist/internal/messages/code.js +1 -0
- package/dist/internal/messages/data-table.d.ts +3 -0
- package/dist/internal/messages/data-table.js +1 -0
- package/dist/internal/messages/scroll.d.ts +3 -0
- package/dist/internal/messages/scroll.js +1 -0
- package/dist/internal/messages/sparkline.d.ts +3 -0
- package/dist/internal/messages/sparkline.js +1 -0
- package/dist/internal/messages/tour.d.ts +3 -0
- package/dist/internal/messages/tour.js +1 -0
- package/dist/internal/messages/transfer.d.ts +1 -1
- package/dist/internal/messages/transfer.js +1 -1
- package/dist/internal/mockup.d.ts +174 -0
- package/dist/internal/mockup.js +2 -0
- package/dist/internal/page-layout.d.ts +24 -5
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/responsive.d.ts +55 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scale.d.ts +0 -17
- package/dist/internal/scale.js +1 -1
- package/dist/internal/step.d.ts +15 -0
- package/dist/internal/step.js +1 -1
- package/dist/internal/table.d.ts +53 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/text.d.ts +57 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/time-scale.d.ts +44 -0
- package/dist/internal/time-scale.js +1 -0
- package/dist/internal/transition.d.ts +33 -0
- package/dist/internal/transition.js +1 -0
- package/dist/internal/visibility.d.ts +48 -0
- package/dist/internal/visibility.js +1 -0
- package/dist/internal/window-class.d.ts +29 -2
- package/dist/internal/window-class.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/alert.css +1 -1
- package/dist/styles/anchor.css +2 -0
- package/dist/styles/animate-appear.css +1 -1
- package/dist/styles/animate-blink.css +1 -1
- package/dist/styles/animate-counter.css +2 -0
- package/dist/styles/animate-fade.css +1 -1
- package/dist/styles/animate-float.css +2 -0
- package/dist/styles/animate-grow.css +1 -1
- package/dist/styles/animate-headline.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/animate-marquee.css +1 -1
- package/dist/styles/animate-reveal.css +2 -0
- package/dist/styles/animate-rotate.css +1 -1
- package/dist/styles/animate-scramble.css +2 -0
- package/dist/styles/animate-shake.css +2 -0
- package/dist/styles/animate-slide.css +1 -1
- package/dist/styles/animate-split.css +2 -0
- package/dist/styles/animate-typing.css +1 -1
- package/dist/styles/animate-zoom.css +1 -1
- package/dist/styles/app-logo.css +2 -0
- package/dist/styles/area-chart.css +2 -0
- package/dist/styles/aspect-ratio.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/bar-chart.css +2 -0
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/box.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/chat-bubble.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.css +1 -1
- package/dist/styles/code-block.css +2 -0
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/config.css +1 -1
- package/dist/styles/confirm.css +1 -1
- package/dist/styles/container.css +1 -1
- package/dist/styles/data-list.css +2 -0
- package/dist/styles/data-table.css +2 -0
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/date-time-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/empty.css +1 -1
- package/dist/styles/fieldset.css +1 -1
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/flex.css +2 -0
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/floating-bottom-navigation.css +2 -0
- package/dist/styles/footer.css +1 -1
- package/dist/styles/form.css +1 -1
- package/dist/styles/gauge-chart.css +2 -0
- package/dist/styles/grid.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/heatmap-chart.css +2 -0
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/hover-card.css +2 -0
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/icon.css +1 -1
- package/dist/styles/image.css +1 -1
- package/dist/styles/line-chart.css +2 -0
- package/dist/styles/list.css +1 -1
- package/dist/styles/locale.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/meter.css +2 -0
- package/dist/styles/mockup.css +2 -0
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-field.css +1 -1
- package/dist/styles/overlay.css +1 -1
- package/dist/styles/page-layout.css +1 -1
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/portal.css +2 -0
- package/dist/styles/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/scatter-chart.css +2 -0
- package/dist/styles/scroll-area.css +2 -0
- package/dist/styles/scroll-zone.css +2 -0
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/show.css +2 -0
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/sparkline.css +2 -0
- package/dist/styles/spoiler.css +1 -1
- package/dist/styles/stack.css +2 -0
- package/dist/styles/statistic.css +2 -0
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text-link.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +2 -0
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/toolbar.css +2 -0
- package/dist/styles/tour.css +2 -0
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/tree-select.css +2 -0
- package/dist/styles/tree-view.css +2 -0
- package/dist/styles/typography.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +2606 -185
- package/dist/types.d.ts +566 -5
- package/package.json +26 -25
- package/.fix.py +0 -92
- package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
- package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -2
- package/dist/styles/avatar-group.css +0 -2
|
@@ -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 @@
|
|
|
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{numberFormatter as p}from"../../internal/intl.js";import{META_TEXT as u,hasContent as d}from"../../internal/scale.js";const x={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"},f={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"},h={style:"percent",maximumFractionDigits:1,signDisplay:"exceptZero"},b={start:"items-start text-start",center:"items-center text-center",end:"items-end text-end"};export function MPStatistic({label:g,value:j,format:N,compact:v=!0,locale:_,prefix:y,unit:w,previousValue:D,delta:z="percent",betterWhen:M="up",period:k,caption:B,trend:F,align:P="start",size:Z,className:I,classNames:S,...V}){const W=r(Z),$=s(_),q="number"==typeof j?o(j,$,N,v):j,A="number"==typeof j&&"number"==typeof D&&"none"!==z?c(j,D,M):null,C=null===A?.percent||null===A?null:p($,h).format(A.percent/100),E=null===A?null:p($,{...N??{},signDisplay:"exceptZero",...N?{}:v&&Math.abs(A.absolute)>=m?{notation:"compact",maximumFractionDigits:1}:{}}).format(A.absolute),G="absolute"===z?E:"both"===z?[E,C].filter(Boolean).join(" · "):C??E,H=(...t)=>t.filter(Boolean).join(" ");return e("div",{"data-mp-size":W,className:H("mp-statistic flex min-w-0 flex-col gap-1",b[P],I),...V,children:[d(g)?t("span",{className:H("mp-statistic__label text-mp-on-surface-variant",f[W],S?.label),children:g}):null,e("span",{className:H("mp-statistic__value text-mp-on-surface flex items-baseline gap-1 font-medium",x[W],S?.value),children:[d(y)?t("span",{className:"shrink-0",children:y}):null,t("span",{className:"min-w-0 truncate",children:q}),d(w)?t("span",{className:`text-mp-on-surface-variant shrink-0 ${f[W]}`,children:w}):null]}),A&&G?e("span",{className:H("mp-statistic__delta flex items-center gap-0.5",u,0===A.direction?"text-mp-on-surface-variant":A.good?"text-mp-tertiary":"text-mp-error",S?.delta),"data-mp-direction":0===A.direction?"flat":1===A.direction?"up":"down",children:[t(a,{icon:0===A.direction?i:1===A.direction?n:l,size:14}),t("span",{children:G}),d(k)?t("span",{className:"text-mp-on-surface-variant",children:k}):null]}):null,d(B)?t("span",{className:H("mp-statistic__caption text-mp-on-surface-variant",u,S?.caption),children:B}):null,d(F)?t("div",{className:H("mp-statistic__trend w-full",S?.trend),children:F}):null]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPStatistic}from"./MPStatistic.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import*as n from"react";import{MPIcon as l}from"../icon/MPIcon.js";import{CheckIcon as o,ErrorIcon as a}from"../../constants/icons.js";import{accentSlots as i}from"../../internal/accent.js";import{hasContent as s,META_TEXT as c,SHEET_TITLE as p}from"../../internal/scale.js";import{BORDER_STYLE as m,BULLET as d,BULLET_GAP as u,BULLET_SIZE as f,CONNECTOR_COLOR as h,ITEM_GAP as v,ITEM_GAP_X as x,STEP_MOTION as b,TITLE_COLOR as _}from"../../internal/step.js";import{useMPColor as j,useMPSize as N}from"../../internal/config.js";function g(e,t){return`${e}-label-${t}`}function w(e){return`${e}-panel`}const y=/*@__PURE__*/n.createContext(null),z=/*@__PURE__*/n.createContext(0);export const MPStepper=/*@__PURE__*/n.forwardRef(function({active:r,defaultActive:l=0,onActiveChange:o,linear:a=!0,orientation:c="horizontal",size:p,color:m,className:d,style:u,children:h,...v},x){const b=N(p),_=j(m),[g,w]=n.useState(l),C=r??g,[P,S]=n.useState(C);C>P&&S(C);const $=n.Children.toArray(h).filter(n.isValidElement),k=$.length,M=n.useId(),A=s($[C]?.props.children),I=n.useCallback(e=>{void 0===r&&w(e),o?.(e)},[r,o]),R=n.useMemo(()=>({size:b,color:_,orientation:c,active:C,onSelect:o||void 0===r?I:null,linear:a,count:k,furthest:P,idBase:M,hasPanel:A}),[b,_,c,C,o,r,I,a,k,P,M,A]),E="horizontal"===c;return e(y.Provider,{value:R,children:t("div",{...v,ref:x,"data-mp-size":b,className:["mp-stepper flex flex-col",d??""].filter(Boolean).join(" "),style:{...i(_),...u},children:[e("ol",{className:["mp-stepper__rail m-0 flex list-none p-0",E?"flex-row items-start":"flex-col"].join(" "),style:{"--_mp-bullet":f[b]},children:$.map((t,r)=>e(z.Provider,{value:r,children:t},r))}),e(B,{steps:$,active:C,idBase:M})]})})});function B({steps:t,active:r,idBase:n}){const l=t[r],o=l?.props.children;if(!s(o))return null;const a=s(l?.props.label);return e("div",{id:w(n),role:"group","aria-labelledby":a?g(n,r):void 0,className:"mp-stepper__panel mt-4",children:o})}export const MPStep=/*@__PURE__*/n.forwardRef(function({label:f,description:j,bullet:N,error:B=!1,optional:C,disabled:P=!1,connector:S="solid",color:$,className:k,style:M,children:A,...I},R){const E=n.useContext(y),F=n.useContext(z),V=E?.size??"md",q=E?.orientation??"horizontal",D=E?.active??0,G=E?.count??1,H=E?.furthest??0,J=E?.linear??!0,K=F<D?"complete":F===D?"current":"upcoming",L=$??(B?"error":E?.color??"primary"),O="horizontal"===q,Q=F===G-1,T="none"!==S&&!Q,U=!P&&(!J||F<=H),W=null!=E?.onSelect&&U,X=N??("complete"!==K||B?B?e(l,{icon:a}):F+1:e(l,{icon:o})),Y=e("span",{"aria-hidden":"true",className:["mp-stepper__bullet rounded-mp-full relative z-10 flex shrink-0","items-center justify-center","size-(--_mp-bullet) text-[calc(var(--_mp-bullet)*0.5)] leading-none font-medium","tabular-nums [&>svg]:size-[0.6em]",d[K],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" "),children:X}),Z=T?e("span",{"aria-hidden":"true",className:["mp-stepper__connector pointer-events-none absolute",O?"start-(--_mp-bullet) top-[calc(var(--_mp-bullet)/2_-_1px)] end-0 border-t-2":"top-(--_mp-bullet) start-[calc(var(--_mp-bullet)/2_-_1px)] bottom-0 border-s-2",m[S],h[K],b].filter(Boolean).join(" ")}):null,ee=t("span",{className:"flex min-w-0 flex-col gap-0.5 text-start "+(O?"mt-2":""),children:[s(f)?e("span",{id:E?g(E.idBase,F):void 0,className:["mp-stepper__label",p[V],B?"text-mp-error":_[K],b].join(" "),children:f}):null,s(C)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:C}):null,s(j)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:j}):null]}),te=t(r,{children:[Z,t("span",{className:`flex min-w-0 ${O?"flex-col items-start":"flex-row"} ${O?"":u[V]}`,children:[Y,ee]})]});return e("li",{...I,ref:R,"aria-current":"current"===K?"step":void 0,className:["mp-stepper__step relative min-w-0",O?`flex-1 ${Q?"":x[V]}`:Q?"":v[V],k??""].filter(Boolean).join(" "),style:{...$||B?i(L):null,...M},children:W?e("button",{type:"button","aria-controls":E?.hasPanel?w(E.idBase):void 0,"aria-expanded":E?.hasPanel?"current"===K:void 0,className:["group relative flex w-full min-w-0 cursor-pointer appearance-none border-0 bg-transparent p-0 text-start","outline-mp-secondary rounded-mp-xs focus-visible:outline-2 focus-visible:outline-offset-2","outline-none"].join(" "),onClick:()=>E?.onSelect?.(F),children:te}):e("span",{className:"relative flex w-full min-w-0","aria-disabled":!(!E?.onSelect||U)||void 0,children:te})})});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPAlign, MPColor, MPSize, MPVariant } from '../../types.js';
|
|
2
|
+
import type { MPAlign, MPColor, MPDensity, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
3
3
|
/** Which edge the text in a column lines up against. */
|
|
4
4
|
export type MPTableAlign = MPAlign;
|
|
5
5
|
/**
|
|
@@ -98,7 +98,7 @@ export interface MPTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'
|
|
|
98
98
|
* A row that answers a press has to answer a keyboard too, so each one joins
|
|
99
99
|
* the tab order and takes Enter and Space. That is the honest minimum for a
|
|
100
100
|
* `<tr>` — a row cannot be wrapped in a `<button>` the way an
|
|
101
|
-
* [MPListItem](
|
|
101
|
+
* [MPListItem](./list) is, because a `<button>` is not something a
|
|
102
102
|
* `<tbody>` may contain.
|
|
103
103
|
*
|
|
104
104
|
* It is also worth knowing what it costs: a table of two hundred rows becomes
|
|
@@ -112,6 +112,17 @@ export interface MPTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'
|
|
|
112
112
|
* @default 'outlined'
|
|
113
113
|
*/
|
|
114
114
|
variant?: MPVariant;
|
|
115
|
+
/**
|
|
116
|
+
* How far off the page the sheet is lifted, on MD3's own scale.
|
|
117
|
+
*
|
|
118
|
+
* It moves the **tone** as well as the shadow, because Material pairs the two:
|
|
119
|
+
* a level-2 surface is `surface-container` under a level-2 shadow, and a prop
|
|
120
|
+
* that only cast a shadow would raise this into a surface the specification
|
|
121
|
+
* has no name for. Given a level, `variant` is left holding only its hairline.
|
|
122
|
+
*
|
|
123
|
+
* Left unset, `variant` decides — and `variant="elevated"` is this at `1`.
|
|
124
|
+
*/
|
|
125
|
+
elevation?: MPElevation;
|
|
115
126
|
/**
|
|
116
127
|
* @default 'md'
|
|
117
128
|
*/
|
|
@@ -122,6 +133,17 @@ export interface MPTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'
|
|
|
122
133
|
* @default 'primary'
|
|
123
134
|
*/
|
|
124
135
|
color?: MPColor;
|
|
136
|
+
/**
|
|
137
|
+
* Takes room out of every cell without changing what it is set in.
|
|
138
|
+
*
|
|
139
|
+
* The axis a table is most often asked for: the reason to make one denser is
|
|
140
|
+
* to see more rows at once, and shrinking the type to get there makes the
|
|
141
|
+
* figures harder to read at exactly the moment there are more of them. Each
|
|
142
|
+
* step is MD3's four pixels off the row — `md` goes 52, 48, 44, 40 — and the
|
|
143
|
+
* text stays where it was.
|
|
144
|
+
* @default 0
|
|
145
|
+
*/
|
|
146
|
+
density?: MPDensity;
|
|
125
147
|
}
|
|
126
148
|
/**
|
|
127
149
|
* A grid of data.
|
|
@@ -139,4 +161,4 @@ export interface MPTableProps<Row> extends Omit<React.ComponentPropsWithoutRef<'
|
|
|
139
161
|
* than a ref on the scroll container is worth — and a caller who needs one can
|
|
140
162
|
* put it on a `<div>` of their own around this.
|
|
141
163
|
*/
|
|
142
|
-
export declare function MPTable<Row>({ headers, items, getRowKey, caption, empty, locale: localeProp, striped, hoverable, stickyHeader, onRowClick, variant, size: sizeProp, color: colorProp, className, style, ...props }: MPTableProps<Row>): React.JSX.Element;
|
|
164
|
+
export declare function MPTable<Row>({ headers, items, getRowKey, caption, empty, locale: localeProp, striped, hoverable, stickyHeader, onRowClick, variant, elevation, size: sizeProp, color: colorProp, density: densityProp, className, style, ...props }: MPTableProps<Row>): React.JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{accentSlots as o}from"../../internal/accent.js";import{useMPLocale as r,useMPMessages as a}from"../../internal/locale.js";import{TABLE as l}from"../../internal/messages/table.js";import{cssLength as n}from"../../internal/length.js";import{META_TEXT as i}from"../../internal/scale.js";import{containerSurface as s}from"../../internal/elevation.js";import{CELL_TEXT as c,HEAD_TEXT as m,ROW as d,cellPadX as p,cellPadY as u,drawableCell as f}from"../../internal/table.js";import{useMPColor as v,useMPDensity as y,useMPSize as h}from"../../internal/config.js";export function MPTable({headers:g,items:b,getRowKey:x,caption:j,empty:w,locale:k,striped:N=!1,hoverable:_=!1,stickyHeader:C=!1,onRowClick:$,variant:A="outlined",elevation:B,size:z,color:T,density:D,className:K,style:R,...E}){const H=h(z),I=v(T),M=y(D),P=a(l,r(k)),S=p(H,M),q=u(H,M),F=Boolean($),G=_||F,J={padding:`${q} ${S}`},L={...J,backgroundColor:"var(--_mp-color-surface-container)"},O={borderTop:"1px solid var(--_mp-color-outline-variant)",backgroundColor:"var(--_mp-row)"};return e("div",{"data-mp-size":H,"data-mp-variant":A,className:["mp-table rounded-mp-md overflow-x-auto",s(A,B),K??""].filter(Boolean).join(" "),style:{...o(I),...R},...E,children:t("table",{className:`text-mp-on-surface w-full text-start ${c[H]}`,style:{borderCollapse:"collapse"},children:[j?e("caption",{className:`text-mp-on-surface-variant ${i}`,style:{...J,textAlign:"start"},children:j}):null,e("colgroup",{children:g.map(t=>e("col",{style:void 0===t.width?void 0:{width:n(t.width)}},t.key))}),e("thead",{children:e("tr",{children:g.map(t=>e("th",{scope:"col",className:["text-mp-on-surface-variant whitespace-nowrap",m[H],C?"sticky top-0 z-10":""].filter(Boolean).join(" "),style:{...L,textAlign:t.align??"start"},children:t.label??t.key},t.key))})}),e("tbody",{children:0===b.length?e("tr",{className:d,style:O,children:e("td",{colSpan:g.length,className:"text-mp-on-surface-variant",style:{padding:`2rem ${S}`,textAlign:"center"},children:w??P.empty})}):b.map((t,o)=>e("tr",{className:[d,N&&o%2==1?"[--_mp-row:var(--_mp-color-surface-container-low)]":"",G?"hover:[--_mp-row:var(--_mp-color-surface-container)]":"",F?["cursor-pointer","outline-mp-secondary focus-visible:outline-2","focus-visible:-outline-offset-2 focus-visible:outline-solid outline-none"].join(" "):""].filter(Boolean).join(" "),style:O,tabIndex:F?0:void 0,onClick:$?()=>$(t,o):void 0,onKeyDown:$?e=>{"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),$(t,o))}:void 0,children:g.map(r=>e("td",{style:{...J,textAlign:r.align??"start"},children:r.render?r.render(t,o):f(t[r.key])},r.key))},x?x(t,o):o))})]})})}
|
|
@@ -125,6 +125,18 @@ export interface MPTabPanelProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
125
125
|
* A bar with more tabs than room scrolls rather than wrapping, which is MD3's
|
|
126
126
|
* scrollable tabs: a tab bar on two lines has stopped being a bar, and the
|
|
127
127
|
* indicator has nowhere sensible to sit.
|
|
128
|
+
*
|
|
129
|
+
* ## Saying that it scrolls
|
|
130
|
+
*
|
|
131
|
+
* It always did. What it had no way of saying was so — macOS draws an overlay
|
|
132
|
+
* scrollbar that does not exist until it is used, so a bar with four tabs off
|
|
133
|
+
* the edge and a bar with none were the same picture, and Windows drew a real
|
|
134
|
+
* one that is a signal and also fifteen pixels of furniture under the tabs.
|
|
135
|
+
*
|
|
136
|
+
* The scrollbar is hidden on both and the ends are faded instead, on the side
|
|
137
|
+
* that has more bar past it. The overflow is **measured** — it depends on the
|
|
138
|
+
* room the bar was given, which nothing here knows — and written out as
|
|
139
|
+
* `data-mp-overflow` for the stylesheet to read.
|
|
128
140
|
*/
|
|
129
141
|
export declare const MPTabs: React.ForwardRefExoticComponent<MPTabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
130
142
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{accentSlots as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Tabs as i}from"@base-ui/react/tabs";import{accentSlots as n}from"../../internal/accent.js";import{MPStateLayer as o}from"../../internal/StateLayer.js";import{CONTROL_GAP as r,hasContent as l,SHEET_GAP as s}from"../../internal/scale.js";import{useMPColor as c,useMPSize as u}from"../../internal/config.js";const d=/*@__PURE__*/a.createContext({variant:"primary",size:"md",iconPosition:"top",fullWidth:!1}),m={xs:"h-8",sm:"h-10",md:"h-12",lg:"h-14",xl:"h-16"},p={xs:"h-11",sm:"h-13",md:"h-16",lg:"h-18",xl:"h-20"},f={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"},h={xs:"px-3",sm:"px-3.5",md:"px-4",lg:"px-5",xl:"px-6"},b={xs:12,sm:14,md:16,lg:20,xl:24},v={xs:18,sm:20,md:24,lg:24,xl:28};function x(e,t,i,n=""){a.Children.toArray(e).forEach(e=>{if(!a.isValidElement(e))return void(l(e)&&t.push(e));if(e.type===a.Fragment)return void x(e.props.children,t,i,`${n}${String(e.key)}/`);const o=n?a.cloneElement(e,{key:`${n}${String(e.key)}`}):e;e.type===MPTabPanel?i.push(o):t.push(o)})}export const MPTabs=/*@__PURE__*/a.forwardRef(function({variant:o="primary",color:r,size:l,value:m,defaultValue:p,onValueChange:f,iconPosition:h,activateOnFocus:v=!1,loopFocus:y=!0,divider:w=!0,fullWidth:g=!1,className:_,style:j,children:P,"aria-label":k,...N},M){const z=c(r),C=u(l),R=h??("primary"===o?"top":"start"),$=a.useMemo(()=>({variant:o,size:C,iconPosition:R,fullWidth:g}),[o,C,R,g]),S=a.useRef(null),[W,E]=a.useState(null),F=a.useCallback(()=>{const e=S.current;if(!e)return;const t=e.scrollWidth-e.clientWidth,a=Math.abs(e.scrollLeft),i=t-a,n="rtl"===getComputedStyle(e).direction,o=(n?i:a)>1,r=(n?a:i)>1;E(o&&r?"both":o?"left":r?"right":null)},[]);a.useEffect(F),a.useEffect(()=>{const e=S.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=new ResizeObserver(F);return t.observe(e),()=>t.disconnect()},[F]);const T=[],V=[];return x(P,T,V),e(d.Provider,{value:$,children:t(i.Root,{ref:M,value:m,defaultValue:p,onValueChange:e=>f?.(e),"data-mp-size":C,"data-mp-variant":o,className:["mp-tabs flex min-w-0 flex-col",s[C],_??""].filter(Boolean).join(" "),style:{...n(z),"--_mp-tab-inset":`${b[C]}px`,...j},...N,children:[t(i.List,{ref:S,"aria-label":k,activateOnFocus:v,loopFocus:y,"data-mp-overflow":W??void 0,onScroll:F,className:["mp-tabs__list relative flex shrink-0",w?"border-mp-outline-variant border-b":"",g?"w-full":"","overflow-x-auto overflow-y-hidden","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden"].filter(Boolean).join(" "),children:[T,e(i.Indicator,{className:["mp-tabs__indicator pointer-events-none absolute bottom-0","bg-(--_mp-accent)","primary"===o?["h-0.75 rounded-t-full","left-[calc(var(--active-tab-left)_+_var(--_mp-tab-inset))]","w-[calc(var(--active-tab-width)_-_2_*_var(--_mp-tab-inset))]"].join(" "):"left-(--active-tab-left) h-0.5 w-(--active-tab-width)","[transition-property:left,width]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" ")})]}),V]})})});export const MPTab=/*@__PURE__*/a.forwardRef(function({value:n,icon:s,disabled:c=!1,className:u,children:b,...x},y){const{variant:w,size:g,iconPosition:_,fullWidth:j}=a.useContext(d),P="top"===_&&l(s);return t(i.Tab,{ref:y,value:n,disabled:c,className:["mp-tabs__tab group relative flex shrink-0 items-center justify-center","box-border appearance-none border-0 bg-transparent font-[inherit] whitespace-nowrap select-none","overflow-hidden outline-none","transition-[color] duration-(--mp-sys-motion-duration-short4) ease-mp-standard",P?`flex-col gap-1 ${p[g]}`:`flex-row ${m[g]}`,P?"":r[g],f[g],h[g],c?"text-mp-on-surface/38 cursor-default":["text-mp-on-surface-variant cursor-pointer","primary"===w?"data-active:text-(--_mp-accent)":"data-active:text-mp-on-surface"].join(" "),"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid",j?"flex-1":"",u??""].filter(Boolean).join(" "),...x,children:[c?null:e(o,{}),l(s)?e("span",{className:"relative flex shrink-0 items-center justify-center",style:{width:v[g],height:v[g]},children:s}):null,l(b)?e("span",{className:"relative truncate",children:b}):null]})});export const MPTabPanel=/*@__PURE__*/a.forwardRef(function({value:t,keepMounted:a=!1,className:n,children:o,...r},l){return e(i.Panel,{ref:l,value:t,keepMounted:a,className:["mp-tabs__panel text-mp-on-surface min-w-0 flex-1","rounded-mp-xs outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none","transition-opacity duration-(--mp-sys-motion-duration-short4) ease-mp-standard","data-starting-style:opacity-0",n??""].filter(Boolean).join(" "),...r,children:o})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as n}from"../../internal/accent.js";import{hasContent as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useRender as r}from"@base-ui/react/use-render";import{accentSlots as n}from"../../internal/accent.js";import{hasContent as i,META_TEXT as o,PROSE_TEXT as a,SHEET_TITLE as s}from"../../internal/scale.js";import{useMPColor as c,useMPSize as m}from"../../internal/config.js";import{BORDER_STYLE as u,BULLET as d,BULLET_GAP as p,BULLET_SIZE as f,CONNECTOR_COLOR as x,ITEM_GAP as h,ITEM_GAP_X as v,STEP_MOTION as b,TITLE_COLOR as _}from"../../internal/step.js";const j=/*@__PURE__*/l.createContext(null),N=/*@__PURE__*/l.createContext({index:0,last:!1});export const MPTimelineItem=/*@__PURE__*/l.forwardRef(function({title:r,meta:c,bullet:m,status:g,color:y,connector:z="solid",className:w,style:C,children:$,...M},P){const B=l.useContext(j),{index:k,last:A}=l.useContext(N),R=B?.size??"md",T=B?.orientation??"vertical",I=y??B?.color??"primary",q=B?.active??null,D=g??(null===q?"upcoming":k<q?"complete":k===q?"current":"upcoming"),E="horizontal"===T,F="none"!==z&&!A,G=e("span",{"aria-hidden":"true",className:["mp-timeline__bullet rounded-mp-full relative z-10 flex shrink-0","items-center justify-center","size-(--_mp-bullet) text-[calc(var(--_mp-bullet)*0.5)] leading-none font-medium","tabular-nums [&>svg]:size-[0.6em]",d[D],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" "),children:m}),H=F?e("span",{"aria-hidden":"true",className:["mp-timeline__connector pointer-events-none absolute",E?"start-(--_mp-bullet) top-[calc(var(--_mp-bullet)/2_-_1px)] end-0 border-t-2":"top-(--_mp-bullet) start-[calc(var(--_mp-bullet)/2_-_1px)] bottom-0 border-s-2",u[z],x[D],b].filter(Boolean).join(" ")}):null,J=t("div",{className:"flex min-w-0 flex-col gap-0.5 "+(E?"mt-2":""),children:[i(r)||i(c)?t("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[i(r)?e("span",{className:["mp-timeline__title",s[R],_[D],b].join(" "),children:r}):null,i(c)?e("span",{className:`text-mp-on-surface-variant ${o}`,children:c}):null]}):null,i($)?e("div",{className:`text-mp-on-surface-variant ${a[R]}`,children:$}):null]});return t("li",{ref:P,"aria-current":"current"===D?"step":void 0,"data-status":D,className:["mp-timeline__item relative",E?`flex min-w-0 flex-1 flex-col ${A?"":v[R]}`:`flex ${p[R]} ${A?"":h[R]}`,w??""].filter(Boolean).join(" "),style:{"--_mp-bullet":f[R],...n(I),...C},...M,children:[H,G,J]})});export const MPTimeline=/*@__PURE__*/l.forwardRef(function({active:t,size:n,color:i,orientation:o="vertical",render:a,className:s,style:u,children:d,...p},f){const x=m(n),h=c(i),v=l.Children.toArray(d),b=v.length,_=l.useMemo(()=>({size:x,orientation:o,color:h,active:t??null}),[x,o,h,t]),g=l.useMemo(()=>Array.from({length:b},(e,t)=>({index:t,last:t===b-1})),[b]),y=r({render:a??e("ol",{}),ref:f,props:{role:"list","data-mp-size":x,className:["mp-timeline m-0 flex list-none p-0","horizontal"===o?"flex-row":"flex-col",s??""].filter(Boolean).join(" "),style:u,children:v.map((t,l)=>e(N.Provider,{value:g[l],children:t},l)),...p}});return e(j.Provider,{value:_,children:y})});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartBaseProps } from '../../internal/ChartChrome.js';
|
|
3
|
+
import type { MPChartAxis, MPTimelineSeries } from '../../types.js';
|
|
4
|
+
/** No `legend`: the rows are the axis, so there is nothing for one to identify. */
|
|
5
|
+
export interface MPTimelineChartProps extends Omit<ChartBaseProps, 'legend'> {
|
|
6
|
+
/** The rows, top to bottom. Each carries its own spans. */
|
|
7
|
+
series: readonly MPTimelineSeries[];
|
|
8
|
+
/** The row axis. */
|
|
9
|
+
yAxis?: MPChartAxis;
|
|
10
|
+
/** The time axis. */
|
|
11
|
+
xAxis?: MPChartAxis;
|
|
12
|
+
/**
|
|
13
|
+
* Writes each span's label inside it, where the span is wide enough to hold
|
|
14
|
+
* the text. One that does not fit is dropped rather than clipped.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
spanLabels?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What ran when, one row per thing.
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <MPTimelineChart
|
|
24
|
+
* series={[
|
|
25
|
+
* { name: 'Build', data: [{ start: new Date('2026-03-02'), end: new Date('2026-03-05') }] },
|
|
26
|
+
* { name: 'Test', data: [{ start: new Date('2026-03-05'), end: new Date('2026-03-09') }] }
|
|
27
|
+
* ]}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* A Gantt: rows down the side, time along the bottom, and a bar for every
|
|
32
|
+
* stretch. What it encodes is a **duration and its place**, which is the one
|
|
33
|
+
* question the other charts cannot be asked — every one of them has a mark at a
|
|
34
|
+
* single point on the value axis, and a span has two ends.
|
|
35
|
+
*
|
|
36
|
+
* ## The axis is a calendar, not a number line
|
|
37
|
+
*
|
|
38
|
+
* The 1-2-5-10 steps every other chart's value axis uses are exactly wrong for
|
|
39
|
+
* an instant. Run on epoch milliseconds they put a tick every 200,000,000 ms,
|
|
40
|
+
* which lands at 14:53:20 on an arbitrary Tuesday. Time is not decimal below
|
|
41
|
+
* the year — sixty, sixty, twenty-four, seven, twelve — so this axis steps in
|
|
42
|
+
* seconds, minutes, hours, days, weeks, months and years, and the ticks are
|
|
43
|
+
* walked with real calendar arithmetic: a month step lands on the first of the
|
|
44
|
+
* month whatever its length, and a day step survives the clocks going back.
|
|
45
|
+
*
|
|
46
|
+
* Ticks are also **aligned**, so a three-hour axis reads 00:00, 03:00, 06:00
|
|
47
|
+
* rather than 01:00, 04:00, 07:00. Evenly spaced ticks that land on nothing a
|
|
48
|
+
* reader recognises give up most of the value of using a calendar at all.
|
|
49
|
+
*
|
|
50
|
+
* ## There is no legend
|
|
51
|
+
*
|
|
52
|
+
* The rows **are** the category axis and they are already named down the side.
|
|
53
|
+
* A legend restating twenty row names is not a filter anybody wants, and it
|
|
54
|
+
* would be the only legend here that identified nothing new.
|
|
55
|
+
*
|
|
56
|
+
* ## The pointer is tested against the whole bar
|
|
57
|
+
*
|
|
58
|
+
* A span can be two hundred pixels of bar whose centre a pointer never goes
|
|
59
|
+
* near, so hit-testing to the centre would hand a short bar on the next row a
|
|
60
|
+
* hover the reader is plainly not making. The frame measures to the mark's
|
|
61
|
+
* **body** instead.
|
|
62
|
+
*/
|
|
63
|
+
export declare function MPTimelineChart({ series, yAxis, xAxis, spanLabels, ...frame }: MPTimelineChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as a,jsxs as e}from"react/jsx-runtime";import*as t from"react";import{CartesianFrame as r}from"../../internal/ChartFrame.js";import{ChartTable as n}from"../../internal/ChartChrome.js";import{useMPLocale as o,useMPMessages as l}from"../../internal/locale.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as i}from"../../internal/messages/table.js";import{formatTimeTick as m,timeScale as p}from"../../internal/time-scale.js";import{BAR_RADIUS as c,CHART_FONT_SIZE as u,MARK_GAP as f,barPath as x,seriesColor as d,textWidth as h,toNumber as b}from"../../internal/chart.js";function g(a,e,t){return null!=a&&!1!==a&&""!==a&&("string"!=typeof a&&"number"!=typeof a||e>=h(String(a),t)+16)}export function MPTimelineChart({series:h,yAxis:y,xAxis:M,spanLabels:j=!0,...k}){const v=o(k.locale),$=l(s,v),C=l(i,v),P=t.useMemo(()=>h.map(a=>a.data.map(a=>{const e=b(a.start),t=b(a.end);return null===e||null===t?null:{from:Math.min(e,t),to:Math.max(e,t),span:a}}).filter(a=>null!==a)),[h]),S=P.flat(),A=S.length>0?{min:Math.min(...S.map(a=>a.from)),max:Math.max(...S.map(a=>a.to))}:null,_=p(A,{min:M?.min,max:M?.max,tickCount:M?.tickCount}),z=t.useCallback(a=>m(a,_.unit,v),[_.unit,v]),F=t.useMemo(()=>[{data:h.map(()=>0)}],[h]),N=h.map((a,e)=>a.name??String(e+1)),T=h.map((a,e)=>d(e,a.color));return a(r,{...k,series:F,categories:N,horizontal:!0,inset:!1,bandRatio:.62,scale:_,includeZero:!1,legend:!1,xAxis:y,yAxis:{...M,tickFormat:M?.tickFormat??(a=>z(Number(a)))},marks:({plot:a,band:e,valuePx:t,categoryPx:r})=>P.flatMap((n,o)=>n.map((n,l)=>{const s=t(n.from),i=t(n.to),m=a.top+r(o);return{series:o,index:l,x:(s+i)/2,y:m,r:e.band/2,rx:Math.max(1,Math.abs(i-s)/2),ry:e.band/2}})),markTooltip:a=>{const e=P[a.series]?.[a.index];return e?{heading:void 0===e.span.label||null===e.span.label?N[a.series]:`${N[a.series]} · ${String(e.span.label)}`,items:[{seriesIndex:a.series,color:e.span.color?d(0,e.span.color):T[a.series],value:e.to-e.from,formatted:`${z(e.from)} – ${z(e.to)}`}]}:null},table:e=>a(n,{id:e,caption:k.label??$.table,corner:y?.label??$.category,categories:N,names:[$.table],values:[P.map(a=>({value:a.length,label:a.map(a=>`${z(a.from)} – ${z(a.to)}`).join("; ")}))],format:a=>String(a),locale:v,empty:C.empty}),children:({plot:t,band:r,valuePx:n,categoryPx:o,activeMark:l,size:s})=>{const i=u[s]-1;return a("g",{className:"mp-timeline-chart__spans",children:P.map((s,m)=>s.map((s,p)=>{const u=n(s.from),h=n(s.to),b=Math.max(2,r.band-f),y=t.top+o(m)-b/2,M=Math.max(1,h-u),k=l?.series===m&&l?.index===p,v=s.span.color?d(0,s.span.color):T[m];return e("g",{children:[a("path",{d:x(u,y,M,b,c,"both"),fill:v,opacity:k?1:.85,stroke:k?"var(--_mp-color-on-surface)":"none",strokeWidth:k?1.5:0}),j&&g(s.span.label,M,i)?a("text",{x:u+8,y:t.top+o(m),dominantBaseline:"central",fill:"var(--_mp-color-surface)",fontSize:i,children:s.span.label}):null]},`${m}-${p}`)}))})}})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPTimelineChart}from"./MPTimelineChart.js";
|