material-plus-ui 1.6.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.
- package/README.md +2 -2
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +33 -2
- 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 +156 -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.js +1 -0
- 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 +10 -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/card/MPCard.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +10 -1
- 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/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/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 +295 -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/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-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.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 +100 -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/image/MPImage.d.ts +10 -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.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/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/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/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 +24 -2
- 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/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/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 +2 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +1 -0
- 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 +205 -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/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 +471 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +162 -0
- package/dist/internal/data-table.js +1 -0
- 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 +170 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.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/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/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/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 +1356 -133
- package/dist/types.d.ts +564 -3
- package/package.json +3 -2
- 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,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 @@
|
|
|
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 l from"react";import{MPIcon as n}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 u,BULLET_GAP as d,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";import{useMPColor as j,useMPSize as N}from"../../internal/config.js";const g=/*@__PURE__*/l.createContext(null),w=/*@__PURE__*/l.createContext(0);export const MPStepper=/*@__PURE__*/l.forwardRef(function({active:r,defaultActive:n=0,onActiveChange:o,linear:a=!0,orientation:s="horizontal",size:c,color:p,className:m,style:u,children:d,...x},h){const v=N(c),b=j(p),[_,z]=l.useState(n),C=r??_,[S,P]=l.useState(C);C>S&&P(C);const $=l.Children.toArray(d).filter(l.isValidElement),k=$.length,M=l.useCallback(e=>{void 0===r&&z(e),o?.(e)},[r,o]),A=l.useMemo(()=>({size:v,color:b,orientation:s,active:C,onSelect:o||void 0===r?M:null,linear:a,count:k,furthest:S}),[v,b,s,C,o,r,M,a,k,S]),B="horizontal"===s;return e(g.Provider,{value:A,children:t("div",{...x,ref:h,"data-mp-size":v,className:["mp-stepper flex flex-col",m??""].filter(Boolean).join(" "),style:{...i(b),...u},children:[e("ol",{className:["mp-stepper__rail flex list-none p-0",B?"flex-row items-start":"flex-col"].join(" "),style:{"--_mp-bullet":f[v]},children:$.map((t,r)=>e(w.Provider,{value:r,children:t},r))}),e(y,{steps:$,active:C})]})})});function y({steps:t,active:r}){const l=t[r],n=l?.props.children;return s(n)?e("div",{className:"mp-stepper__panel mt-4",role:"group","aria-label":void 0,children:n}):null}export const MPStep=/*@__PURE__*/l.forwardRef(function({label:f,description:j,bullet:N,error:y=!1,optional:z,disabled:C=!1,connector:S="solid",color:P,className:$,style:k,children:M,...A},B){const R=l.useContext(g),E=l.useContext(w),F=R?.size??"md",I=R?.orientation??"horizontal",V=R?.active??0,q=R?.count??1,D=R?.furthest??0,G=R?.linear??!0,H=E<V?"complete":E===V?"current":"upcoming",J=P??(y?"error":R?.color??"primary"),K="horizontal"===I,L=E===q-1,O="none"!==S&&!L,Q=!C&&(!G||E<=D),T=null!=R?.onSelect&&Q,U=N??("complete"!==H||y?y?e(n,{icon:a}):E+1:e(n,{icon:o})),W=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]",u[H],"transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard"].join(" "),children:U}),X=O?e("span",{"aria-hidden":"true",className:["mp-stepper__connector pointer-events-none absolute",K?"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],x[H],b].filter(Boolean).join(" ")}):null,Y=t("span",{className:"flex min-w-0 flex-col gap-0.5 text-start "+(K?"mt-2":""),children:[s(f)?e("span",{className:["mp-stepper__label",p[F],y?"text-mp-error":_[H],b].join(" "),children:f}):null,s(z)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:z}):null,s(j)?e("span",{className:`text-mp-on-surface-variant ${c}`,children:j}):null]}),Z=t(r,{children:[X,t("span",{className:`flex min-w-0 ${K?"flex-col items-start":"flex-row"} ${K?"":d[F]}`,children:[W,Y]})]});return e("li",{...A,ref:B,"aria-current":"current"===H?"step":void 0,className:["mp-stepper__step relative min-w-0",K?`flex-1 ${L?"":v[F]}`:L?"":h[F],$??""].filter(Boolean).join(" "),style:{...P||y?i(J):null,...k},children:T?e("button",{type:"button",className:["group relative flex w-full min-w-0 cursor-pointer appearance-none 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:()=>R?.onSelect?.(E),children:Z}):e("span",{className:"relative flex w-full min-w-0","aria-disabled":!(!R?.onSelect||Q)||void 0,children:Z})})});
|
|
@@ -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
|
/**
|
|
@@ -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 m=/*@__PURE__*/a.createContext({variant:"primary",size:"md",iconPosition:"top",fullWidth:!1}),d={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:d,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(m.Provider,{value:$,children:t(i.Root,{ref:M,value:d,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(m),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 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 ${d[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 flex","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";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPDensity, MPElevation, MPPosition, MPSize, MPVariant } from '../../types.js';
|
|
4
|
+
/** Which edge a pinned bar is held against. */
|
|
5
|
+
export type MPToolbarSide = 'top' | 'bottom';
|
|
6
|
+
export interface MPToolbarProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
7
|
+
/**
|
|
8
|
+
* How much surface the bar paints.
|
|
9
|
+
*
|
|
10
|
+
* A container's ladder, so the bar is never dyed — exactly as on `MPBox`. A
|
|
11
|
+
* toolbar holds other people's controls, and those controls arrive with
|
|
12
|
+
* colours of their own.
|
|
13
|
+
* @default 'outlined'
|
|
14
|
+
*/
|
|
15
|
+
variant?: MPVariant;
|
|
16
|
+
/**
|
|
17
|
+
* How far off the page it is lifted, on MD3's five levels.
|
|
18
|
+
*
|
|
19
|
+
* Left unset the bar is flat even when it is pinned, and that is deliberate: a
|
|
20
|
+
* shadow under a header is a way of saying "there is content beneath this",
|
|
21
|
+
* which is only true once the page has been scrolled. Raise it yourself, or
|
|
22
|
+
* leave it flat and turn on `divider`.
|
|
23
|
+
*/
|
|
24
|
+
elevation?: MPElevation;
|
|
25
|
+
/**
|
|
26
|
+
* The room inside. As on `MPBox`, `size` sets padding here and neither a
|
|
27
|
+
* height nor a type scale: a toolbar is as tall as the controls in it.
|
|
28
|
+
* @default 'md'
|
|
29
|
+
*/
|
|
30
|
+
size?: MPSize;
|
|
31
|
+
/** Takes room out of that padding, two pixels a face per step. @default 0 */
|
|
32
|
+
density?: MPDensity;
|
|
33
|
+
/**
|
|
34
|
+
* How the bar sits in the page's scroll.
|
|
35
|
+
*
|
|
36
|
+
* - `static` — in the flow, scrolling away with the content.
|
|
37
|
+
* - `sticky` — in the flow until it reaches the edge, then held there. What an
|
|
38
|
+
* application header usually wants: it takes up its own room, so nothing
|
|
39
|
+
* underneath has to be padded around it.
|
|
40
|
+
* - `fixed` — out of the flow entirely. The page needs padding of its own, or
|
|
41
|
+
* the first screenful sits behind the bar.
|
|
42
|
+
* - `absolute` — pinned to the nearest positioned ancestor rather than to the
|
|
43
|
+
* window. For a bar along the edge of a panel.
|
|
44
|
+
* @default 'static'
|
|
45
|
+
*/
|
|
46
|
+
position?: MPPosition;
|
|
47
|
+
/** Which edge it is held against when `position` is not `static`. @default 'top' */
|
|
48
|
+
side?: MPToolbarSide;
|
|
49
|
+
/**
|
|
50
|
+
* Draws a hairline along the edge that faces the content — under a `top` bar,
|
|
51
|
+
* over a `bottom` one.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
divider?: boolean;
|
|
55
|
+
/** Pinned to the start of the bar: a logo, a title, a back button. */
|
|
56
|
+
start?: React.ReactNode;
|
|
57
|
+
/** Pinned to the end: the actions. */
|
|
58
|
+
end?: React.ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Renders something other than a `<div>`. Worth reaching for here more than
|
|
61
|
+
* anywhere else: a page's header should be a `<header>`.
|
|
62
|
+
*/
|
|
63
|
+
render?: useRender.RenderProp;
|
|
64
|
+
/** The middle. Takes whatever width `start` and `end` leave. */
|
|
65
|
+
children?: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A bar of controls: an application header, a page's action row, the strip along
|
|
69
|
+
* the bottom of an editor.
|
|
70
|
+
*
|
|
71
|
+
* ```tsx
|
|
72
|
+
* <MPToolbar render={<header />} position="sticky" divider start={<MPAppLogo name="Acme" />}>
|
|
73
|
+
* <MPTextField placeholder="Search" />
|
|
74
|
+
* </MPToolbar>
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* Three slots and a row. `start` and `end` are pinned to their ends and
|
|
78
|
+
* `children` takes what is left, which is the arrangement every toolbar has ever
|
|
79
|
+
* had — so it is laid out here rather than left to a caller and the spacer
|
|
80
|
+
* `<div>` they have to remember.
|
|
81
|
+
*
|
|
82
|
+
* ## It takes no height
|
|
83
|
+
*
|
|
84
|
+
* A toolbar is as tall as the controls in it plus its padding, and that padding
|
|
85
|
+
* is the `size`/`density` pair every other surface uses. So `density={-2}` gives
|
|
86
|
+
* the dense bar without a second prop that means the same thing, and without the
|
|
87
|
+
* type scale moving.
|
|
88
|
+
*
|
|
89
|
+
* ## It has no `role="toolbar"`, deliberately
|
|
90
|
+
*
|
|
91
|
+
* That role is a promise about keyboard behaviour — one tab stop for the whole
|
|
92
|
+
* bar, arrow keys between the controls inside it — and a bar that claims it
|
|
93
|
+
* without implementing it is worse for a keyboard reader than one that claimed
|
|
94
|
+
* nothing at all.
|
|
95
|
+
*
|
|
96
|
+
* What a page header wants is `render={<header />}`, which is a landmark and is
|
|
97
|
+
* true. What a genuine roving-focus toolbar wants is `MPButtonGroup`, which is
|
|
98
|
+
* one.
|
|
99
|
+
*
|
|
100
|
+
* ## What it is not
|
|
101
|
+
*
|
|
102
|
+
* Not `MPHeader`, which is `MPPageLayout`'s own slot and knows about the
|
|
103
|
+
* sidebar, the skip link and the drawer. This is a bar you can put anywhere,
|
|
104
|
+
* including inside a card.
|
|
105
|
+
*/
|
|
106
|
+
export declare const MPToolbar: React.ForwardRefExoticComponent<MPToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import*as o from"react";import{useRender as r}from"@base-ui/react/use-render";import{sheetPadX as i,sheetPadY as n}from"../../internal/density.js";import{containerSurface as s}from"../../internal/elevation.js";import{SHEET_GAP as a,hasContent as m}from"../../internal/scale.js";import{useMPDensity as l,useMPSize as d}from"../../internal/config.js";const p={static:{top:"",bottom:""},absolute:{top:"absolute inset-x-0 top-0 z-20",bottom:"absolute inset-x-0 bottom-0 z-20"},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},c={top:"border-mp-outline-variant border-b",bottom:"border-mp-outline-variant border-t"};export const MPToolbar=/*@__PURE__*/o.forwardRef(function({variant:b="outlined",elevation:f,size:x,density:u,position:v="static",side:h="top",divider:j=!1,start:z,end:y,render:w,className:_,style:g,children:k,...N},B){const F=d(x),M=l(u);return r({render:w,ref:B,props:{"data-mp-size":F,"data-mp-variant":b,className:["mp-toolbar box-border flex w-full min-w-0 items-center",i(F,M),n(F,M),a[F],"static"===v?"rounded-mp-md":"",s(b,f),"text-mp-on-surface",j?c[h]:"",p[v][h],_??""].filter(Boolean).join(" "),style:g,children:e(o.Fragment,{children:[m(z)?t("div",{className:"mp-toolbar__start flex min-w-0 shrink-0 items-center gap-2",children:z}):null,t("div",{className:"mp-toolbar__main flex min-w-0 flex-1 items-center gap-2",children:k}),m(y)?t("div",{className:"mp-toolbar__end flex min-w-0 shrink-0 items-center gap-2",children:y}):null]}),...N}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPToolbar}from"./MPToolbar.js";
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAlign, MPColor, MPSide, MPSize, MPSlots } from '../../types.js';
|
|
3
|
+
/** One stop on the tour. */
|
|
4
|
+
export interface MPTourStep {
|
|
5
|
+
/**
|
|
6
|
+
* A CSS selector for what this step is about.
|
|
7
|
+
*
|
|
8
|
+
* Left out, the card is centred over the page with nothing cut out of the
|
|
9
|
+
* dimming — which is what a welcome step and a closing step are.
|
|
10
|
+
*/
|
|
11
|
+
target?: string;
|
|
12
|
+
/** The step's heading. */
|
|
13
|
+
title?: React.ReactNode;
|
|
14
|
+
/** What it says. */
|
|
15
|
+
content?: React.ReactNode;
|
|
16
|
+
/** Which edge of the target the card sits on. @default 'bottom' */
|
|
17
|
+
side?: MPSide;
|
|
18
|
+
/** Where along that edge. @default 'center' */
|
|
19
|
+
align?: MPAlign;
|
|
20
|
+
/**
|
|
21
|
+
* How far the hole is inflated past the target, in pixels. A control with a
|
|
22
|
+
* focus ring wants a couple; a whole panel wants none.
|
|
23
|
+
* @default 6
|
|
24
|
+
*/
|
|
25
|
+
padding?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The parts an `MPTour` draws around its card.
|
|
29
|
+
*
|
|
30
|
+
* `className` is the card — the sheet the steps are written on — and `scrim` is
|
|
31
|
+
* the dimming behind it, which is a sibling of the card rather than a descendant
|
|
32
|
+
* and so has no other way in.
|
|
33
|
+
*/
|
|
34
|
+
export type MPTourSlot = 'scrim' | 'title' | 'content' | 'close' | 'footer';
|
|
35
|
+
export interface MPTourProps {
|
|
36
|
+
/** The stops, in order. */
|
|
37
|
+
steps: readonly MPTourStep[];
|
|
38
|
+
/** Whether the tour is running. Use with `onOpenChange` for a controlled one. */
|
|
39
|
+
open?: boolean;
|
|
40
|
+
/** Whether it starts running, for an uncontrolled one. @default false */
|
|
41
|
+
defaultOpen?: boolean;
|
|
42
|
+
onOpenChange?: (open: boolean) => void;
|
|
43
|
+
/** Which stop, from `0`. Use with `onStepChange` for a controlled one. */
|
|
44
|
+
step?: number;
|
|
45
|
+
/** Which one it starts on. @default 0 */
|
|
46
|
+
defaultStep?: number;
|
|
47
|
+
onStepChange?: (step: number) => void;
|
|
48
|
+
/** Called when the last step's button is pressed, before the tour closes. */
|
|
49
|
+
onFinish?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Dims the page and cuts the target out of the dimming. Off, the card is the
|
|
52
|
+
* only thing the tour draws.
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
scrim?: boolean;
|
|
56
|
+
/** Offers the Skip button beside the counter. @default true */
|
|
57
|
+
skippable?: boolean;
|
|
58
|
+
/** Whether Escape and the × end the tour. @default true */
|
|
59
|
+
dismissible?: boolean;
|
|
60
|
+
/** Scrolls each target into view as the tour reaches it. @default true */
|
|
61
|
+
scrollIntoView?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Which language the buttons and the counter are written in. Falls back to the
|
|
64
|
+
* nearest `MPLocaleProvider`, then to English.
|
|
65
|
+
*/
|
|
66
|
+
locale?: string;
|
|
67
|
+
/** Individual overrides for the five words the tour says on its own behalf. */
|
|
68
|
+
labels?: Partial<{
|
|
69
|
+
previous: string;
|
|
70
|
+
next: string;
|
|
71
|
+
done: string;
|
|
72
|
+
skip: string;
|
|
73
|
+
position: string;
|
|
74
|
+
}>;
|
|
75
|
+
/** @default 'md' */
|
|
76
|
+
size?: MPSize;
|
|
77
|
+
/** Which accent family the buttons read. @default 'primary' */
|
|
78
|
+
color?: MPColor;
|
|
79
|
+
/** Class names for the card. */
|
|
80
|
+
className?: string;
|
|
81
|
+
style?: React.CSSProperties;
|
|
82
|
+
/**
|
|
83
|
+
* Class names for the parts around it. `className` is the card, so the dimming
|
|
84
|
+
* behind it is `classNames.scrim`.
|
|
85
|
+
*/
|
|
86
|
+
classNames?: MPSlots<MPTourSlot>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A guided walk over a page that already exists.
|
|
90
|
+
*
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <MPTour
|
|
93
|
+
* defaultOpen
|
|
94
|
+
* steps={[{ target: '#search', title: 'Find anything', content: 'Press ⌘K.' }]}
|
|
95
|
+
* />
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* It is [MPStepper](../display/stepper) turned inside out. That component puts
|
|
99
|
+
* the instructions *in* the page and the reader follows them; this one leaves
|
|
100
|
+
* the page exactly as it is and stands over it. The steps are therefore given by
|
|
101
|
+
* selector rather than as content: what a tour is about is already on screen,
|
|
102
|
+
* and describing it a second time inside the card would be two copies to keep in
|
|
103
|
+
* step.
|
|
104
|
+
*
|
|
105
|
+
* ## The dimming never takes the pointer
|
|
106
|
+
*
|
|
107
|
+
* A reader can use the control being pointed at while the card is up, and that
|
|
108
|
+
* is the difference between a tour and a sequence of dialogs. Nothing outside
|
|
109
|
+
* the card is blocked, no focus is trapped, and neither a press outside nor the
|
|
110
|
+
* focus leaving ends the tour — only Escape, the ×, and the card's own buttons
|
|
111
|
+
* do.
|
|
112
|
+
*
|
|
113
|
+
* ## What it is not
|
|
114
|
+
*
|
|
115
|
+
* It is not documentation, and it is not a place to put anything a reader will
|
|
116
|
+
* need twice. A tour is shown once, to somebody who has not asked for it, over
|
|
117
|
+
* a page they are trying to get on with — so three or four steps is the shape,
|
|
118
|
+
* and anything that has to be found again belongs on the page.
|
|
119
|
+
*/
|
|
120
|
+
export declare function MPTour({ steps, open: openProp, defaultOpen, onOpenChange, step: stepProp, defaultStep, onStepChange, onFinish, scrim, skippable, dismissible, scrollIntoView, locale: localeProp, labels, size: sizeProp, color: colorProp, className, style, classNames }: MPTourProps): React.JSX.Element | null;
|