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,95 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPGridAlign, MPGridJustify } from '../grid/MPGrid.js';
|
|
4
|
+
import type { MPResponsive } from '../../types.js';
|
|
5
|
+
/** Which way the items run. */
|
|
6
|
+
export type MPFlexDirection = 'row' | 'column';
|
|
7
|
+
export interface MPFlexProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
8
|
+
/**
|
|
9
|
+
* Which way the items run, and the width at which that changes.
|
|
10
|
+
*
|
|
11
|
+
* `direction={{ compact: 'column', medium: 'row' }}` is the whole reason this
|
|
12
|
+
* component exists as something other than a `className`: a stack on a phone
|
|
13
|
+
* and a row from 600dp up is the most common layout decision there is, and
|
|
14
|
+
* writing it as a Tailwind variant means writing the library's boundary out
|
|
15
|
+
* again in a number that has to match.
|
|
16
|
+
* @default 'row'
|
|
17
|
+
*/
|
|
18
|
+
direction?: MPResponsive<MPFlexDirection>;
|
|
19
|
+
/**
|
|
20
|
+
* Whether items that do not fit move onto another line.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
wrap?: MPResponsive<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* How the space the items did not take is divided along the direction.
|
|
26
|
+
* @default 'start'
|
|
27
|
+
*/
|
|
28
|
+
justify?: MPResponsive<MPGridJustify>;
|
|
29
|
+
/**
|
|
30
|
+
* How the items sit across it.
|
|
31
|
+
*
|
|
32
|
+
* `stretch` is CSS's own default and is what makes two cards in a row the same
|
|
33
|
+
* height without either being told a height. `center` is what a row of a label
|
|
34
|
+
* and a control wants.
|
|
35
|
+
* @default 'stretch'
|
|
36
|
+
*/
|
|
37
|
+
align?: MPResponsive<MPGridAlign>;
|
|
38
|
+
/**
|
|
39
|
+
* The space between items. A number is pixels, a string is any CSS length.
|
|
40
|
+
* @default 0
|
|
41
|
+
*/
|
|
42
|
+
gap?: MPResponsive<number | string>;
|
|
43
|
+
/**
|
|
44
|
+
* Lays out as `inline-flex`, so the box is as wide as its contents and sits in
|
|
45
|
+
* a line of text.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
inline?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Renders something other than a `<div>`. Base UI's own escape hatch, so it
|
|
51
|
+
* behaves here exactly as it does on every Base UI primitive.
|
|
52
|
+
*/
|
|
53
|
+
render?: useRender.RenderProp;
|
|
54
|
+
children?: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A row, or a column, and the width at which it changes from one to the other.
|
|
58
|
+
*
|
|
59
|
+
* It draws nothing. No surface, no padding, no corner — only the five properties
|
|
60
|
+
* a flex container has, each of which can be said per window size class.
|
|
61
|
+
*
|
|
62
|
+
* ## Why this and not a `className`
|
|
63
|
+
*
|
|
64
|
+
* For a row that is always a row, a `className` is the better answer and this
|
|
65
|
+
* component is overhead. What it is for is the row that is a column on a phone:
|
|
66
|
+
*
|
|
67
|
+
* ```tsx
|
|
68
|
+
* <MPFlex direction={{ compact: 'column', medium: 'row' }} gap={16}>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* Written as Tailwind variants that is `flex-col md:flex-row`, which is the
|
|
72
|
+
* library's boundary said again in Tailwind's numbers — 768px rather than 600 —
|
|
73
|
+
* and a layout that reflows at one width while the `MPGrid` beside it reflows at
|
|
74
|
+
* another. The variants this package ships (`mp-medium:flex-row`) fix the number
|
|
75
|
+
* and are the right answer where a page is already writing Tailwind; this is the
|
|
76
|
+
* answer for a page that would rather say it in props, and it resolves in CSS
|
|
77
|
+
* either way. See [Breakpoints](../../design/breakpoints).
|
|
78
|
+
*
|
|
79
|
+
* ## Its relationship to the other three
|
|
80
|
+
*
|
|
81
|
+
* - [MPGrid](./grid) divides a row into columns and is what a *page* is laid out
|
|
82
|
+
* on. Reach for it when things have to line up with things in another row.
|
|
83
|
+
* - [MPStack](./stack) lays things **over** each other in a pile, which is a
|
|
84
|
+
* different idea that shares an unfortunate name across the ecosystem.
|
|
85
|
+
* - [MPBox](./box) is a sheet with padding and a surface. This is neither.
|
|
86
|
+
*
|
|
87
|
+
* ## Every axis is responsive, and resolved in CSS
|
|
88
|
+
*
|
|
89
|
+
* The values reach the stylesheet as `--_mp-flex-*` slots, one per class the
|
|
90
|
+
* caller actually named, and the rules in `styles.css` fall each class back to
|
|
91
|
+
* the one below it. So a window crossing 600dp changes the layout with nothing
|
|
92
|
+
* re-rendering, and a server-rendered first paint is already right — which is
|
|
93
|
+
* the half of this that a hook and a branch cannot do.
|
|
94
|
+
*/
|
|
95
|
+
export declare const MPFlex: React.ForwardRefExoticComponent<MPFlexProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{responsiveSlots as n}from"../../internal/responsive.js";import{cssLength as t}from"../../internal/length.js";export const MPFlex=/*@__PURE__*/e.forwardRef(function({direction:e,wrap:f,justify:a,align:o,gap:s,inline:p=!1,render:x,className:c,style:m,children:d,...u},g){return r({render:x,ref:g,props:{className:["mp-flex",p?"inline-flex":"flex",c??""].filter(Boolean).join(" "),style:{...n("flex-dir",e,e=>e),...n("flex-wrap",f,e=>e?"wrap":"nowrap"),...n("flex-justify",a,i),...n("flex-align",o,l),...n("flex-gap",s,e=>t(e)),...m},children:d,...u}})});function i(e){return"start"===e||"end"===e?`flex-${e}`:e}function l(e){return"start"===e||"end"===e?`flex-${e}`:e}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPFlex}from"./MPFlex.js";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { type MPBottomNavigationLabels, type MPBottomNavigationValue } from '../../internal/bottom-navigation.js';
|
|
4
|
+
import type { MPElevation, MPPosition, MPSize, MPVariant } from '../../types.js';
|
|
5
|
+
export interface MPFloatingBottomNavigationProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'defaultValue' | 'onChange'> {
|
|
6
|
+
/** The destination the reader is on. Use with `onValueChange` for a controlled bar. */
|
|
7
|
+
value?: MPBottomNavigationValue | null;
|
|
8
|
+
/** Which starts current, for an uncontrolled bar. */
|
|
9
|
+
defaultValue?: MPBottomNavigationValue | null;
|
|
10
|
+
/** Called with the value of the destination that was pressed. */
|
|
11
|
+
onValueChange?: (value: MPBottomNavigationValue) => void;
|
|
12
|
+
/**
|
|
13
|
+
* How the bar sits in the page's scroll.
|
|
14
|
+
*
|
|
15
|
+
* `fixed` — the default — holds it against the bottom of the window.
|
|
16
|
+
* `sticky` holds it against the bottom of whatever is scrolling, `absolute`
|
|
17
|
+
* against the bottom of the nearest positioned ancestor — which is what a bar
|
|
18
|
+
* inside a phone screen of its own wants — and `static` puts it back in the
|
|
19
|
+
* flow, centred.
|
|
20
|
+
* @default 'fixed'
|
|
21
|
+
*/
|
|
22
|
+
position?: MPPosition;
|
|
23
|
+
/**
|
|
24
|
+
* How far the bar floats above the bottom edge. A number is pixels, a string
|
|
25
|
+
* is any CSS length.
|
|
26
|
+
*
|
|
27
|
+
* This is the whole difference between this component and
|
|
28
|
+
* `MPBottomNavigation`: the gap under it is what makes the page keep going
|
|
29
|
+
* underneath rather than stop at a bar.
|
|
30
|
+
* @default 16
|
|
31
|
+
*/
|
|
32
|
+
offset?: number | string;
|
|
33
|
+
/**
|
|
34
|
+
* Which names are drawn. `selected` here, against the `all` a full-width bar
|
|
35
|
+
* defaults to: this one is only as wide as what is in it, so five drawn names
|
|
36
|
+
* would stretch it across the screen and it would stop being a lozenge.
|
|
37
|
+
* @default 'selected'
|
|
38
|
+
*/
|
|
39
|
+
labels?: MPBottomNavigationLabels;
|
|
40
|
+
/**
|
|
41
|
+
* How much surface the lozenge paints.
|
|
42
|
+
*
|
|
43
|
+
* A container's ladder, so the sheet is never dyed — what carries the accent
|
|
44
|
+
* is the one destination that is current.
|
|
45
|
+
* @default 'filled'
|
|
46
|
+
*/
|
|
47
|
+
variant?: MPVariant;
|
|
48
|
+
/**
|
|
49
|
+
* How far off the page it is lifted.
|
|
50
|
+
*
|
|
51
|
+
* `3` here, against the nothing every other surface defaults to, because this
|
|
52
|
+
* bar is *defined* by not being part of the page: a lozenge lying flat over
|
|
53
|
+
* the content it is floating above reads as a mistake rather than as a
|
|
54
|
+
* decision.
|
|
55
|
+
* @default 3
|
|
56
|
+
*/
|
|
57
|
+
elevation?: MPElevation;
|
|
58
|
+
/**
|
|
59
|
+
* The height of the row and its type scale.
|
|
60
|
+
* @default 'md'
|
|
61
|
+
*/
|
|
62
|
+
size?: MPSize;
|
|
63
|
+
/**
|
|
64
|
+
* Adds `env(safe-area-inset-bottom)` to `offset`, so the bar clears a phone's
|
|
65
|
+
* home indicator rather than sitting on it.
|
|
66
|
+
*
|
|
67
|
+
* Unlike on `MPBottomNavigation` this moves the whole sheet rather than the
|
|
68
|
+
* row inside it: there is nothing under a floating bar that has to stay
|
|
69
|
+
* covered.
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
safeArea?: boolean;
|
|
73
|
+
/** Every destination stops answering. */
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The name the bar is announced by — "Main", "Sections". A landmark with no
|
|
77
|
+
* name is one a screen reader lists as "navigation".
|
|
78
|
+
*/
|
|
79
|
+
label?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Renders something other than a `<nav>`. Rarely what you want here: a row of
|
|
82
|
+
* destinations is navigation.
|
|
83
|
+
*/
|
|
84
|
+
render?: useRender.RenderProp;
|
|
85
|
+
/** The `MPBottomNavigationItem`s — the same item the full-width bar takes. */
|
|
86
|
+
children?: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A row of destinations floating clear of the bottom edge of the window.
|
|
90
|
+
*
|
|
91
|
+
* ```tsx
|
|
92
|
+
* <MPFloatingBottomNavigation defaultValue="home" label="Main">
|
|
93
|
+
* <MPBottomNavigationItem value="home" icon={<HomeIcon />}>Home</MPBottomNavigationItem>
|
|
94
|
+
* <MPBottomNavigationItem value="search" icon={<SearchIcon />}>Search</MPBottomNavigationItem>
|
|
95
|
+
* </MPFloatingBottomNavigation>
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* It is `MPBottomNavigation` lifted off the page. The same `<nav>`, the same
|
|
99
|
+
* `MPBottomNavigationItem` children, the same `aria-current="page"` — and
|
|
100
|
+
* deliberately not a `role="tablist"`, for the same reason: a bottom navigation
|
|
101
|
+
* changes what the page *is*, not which panel of one is showing.
|
|
102
|
+
*
|
|
103
|
+
* ## Everything about the shape follows from `offset`
|
|
104
|
+
*
|
|
105
|
+
* Because the page keeps going underneath, the sheet is a stadium rather than a
|
|
106
|
+
* bar with two corners; it is only as wide as its destinations; it carries a
|
|
107
|
+
* shadow, because a lozenge lying flat over what it is floating above reads as
|
|
108
|
+
* a mistake; and it names only the destination the reader is on, since five
|
|
109
|
+
* drawn names would stretch it back into a bar.
|
|
110
|
+
*
|
|
111
|
+
* ## There is no second highlight
|
|
112
|
+
*
|
|
113
|
+
* The destination the reader is on wears the same active indicator it wears in
|
|
114
|
+
* the full-width bar — MD3's pill, widening out of a circle behind the glyph.
|
|
115
|
+
* A floating bar could instead have one tile that slides between destinations,
|
|
116
|
+
* and this deliberately does not: the specification draws one selected
|
|
117
|
+
* treatment, and a lozenge with both would be saying where the reader is twice,
|
|
118
|
+
* on two different curves.
|
|
119
|
+
*
|
|
120
|
+
* ## Which bar to reach for
|
|
121
|
+
*
|
|
122
|
+
* `MPBottomNavigation` when the bar is the bottom of the screen — the page
|
|
123
|
+
* stops at it, and the tonal step between `surface-container` and `surface` is
|
|
124
|
+
* what separates them. This one when the content is meant to run underneath: a
|
|
125
|
+
* map, a photograph, a feed that should not end in a bar.
|
|
126
|
+
*/
|
|
127
|
+
export declare const MPFloatingBottomNavigation: React.ForwardRefExoticComponent<MPFloatingBottomNavigationProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{useRender as a}from"@base-ui/react/use-render";import{MPBottomNavigationContext as o}from"../../internal/bottom-navigation.js";import{containerSurface as i}from"../../internal/elevation.js";import{cssLength as l}from"../../internal/length.js";import{useMPSize as s}from"../../internal/config.js";const n={xs:"h-12",sm:"h-14",md:"h-16",lg:"h-18",xl:"h-20"},r={xs:"px-1",sm:"px-1.5",md:"px-2",lg:"px-2.5",xl:"px-3"},m={xs:"gap-0.5",sm:"gap-1",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"},f={static:"mx-auto w-fit",absolute:"absolute inset-x-0 bottom-(--_mp-nav-offset) z-30 mx-auto w-fit",sticky:"sticky bottom-(--_mp-nav-offset) z-30 mx-auto w-fit",fixed:"fixed inset-x-0 bottom-(--_mp-nav-offset) z-40 mx-auto w-fit"};export const MPFloatingBottomNavigation=/*@__PURE__*/t.forwardRef(function({value:p,defaultValue:d=null,onValueChange:x,position:u="fixed",offset:c=16,labels:b="selected",variant:g="filled",elevation:v=3,size:h,safeArea:j=!0,disabled:w=!1,label:z,render:y,className:_,style:k,children:N,...B},C){const M=s(h),[P,V]=t.useState(d),A=void 0!==p,F=A?p:P,R=t.useCallback(e=>{A||V(e),x?.(e)},[A,x]),S=t.useMemo(()=>({value:F??null,change:R,size:M,labels:b,disabled:w,floating:!0}),[F,R,M,b,w]),$=l(c);return a({render:y??e("nav",{}),ref:C,props:{"aria-label":z,"data-mp-size":M,"data-mp-variant":g,className:["mp-floating-bottom-navigation rounded-mp-full box-border flex max-w-full min-w-0","items-stretch",n[M],r[M],m[M],i(g,v),"text-mp-on-surface",f[u],_??""].filter(Boolean).join(" "),style:{"--_mp-nav-offset":j?`calc(${$} + env(safe-area-inset-bottom))`:$,...k},children:e(o.Provider,{value:S,children:N}),...B}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPFloatingBottomNavigation}from"./MPFloatingBottomNavigation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { MPPosition, MPSize, MPVariant } from '../../types.js';
|
|
3
|
+
import type { MPDensity, MPMeasure, MPPosition, MPResponsive, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
4
4
|
export interface MPFooterProps extends Omit<React.ComponentPropsWithoutRef<'footer'>, 'title'> {
|
|
5
5
|
/**
|
|
6
6
|
* How the sheet sits in the page's scroll.
|
|
@@ -25,6 +25,16 @@ export interface MPFooterProps extends Omit<React.ComponentPropsWithoutRef<'foot
|
|
|
25
25
|
* @default 'outlined'
|
|
26
26
|
*/
|
|
27
27
|
variant?: MPVariant;
|
|
28
|
+
/**
|
|
29
|
+
* How far off the page the bar is lifted, on MD3's own scale.
|
|
30
|
+
*
|
|
31
|
+
* It moves the tone as well as the shadow — see `MPElevation`. A bar's
|
|
32
|
+
* `elevated` is level 2 rather than 1, because a bar sits over the page's
|
|
33
|
+
* content rather than in it; an explicit level says exactly what it says.
|
|
34
|
+
*
|
|
35
|
+
* Left unset, `variant` decides.
|
|
36
|
+
*/
|
|
37
|
+
elevation?: MPElevation;
|
|
28
38
|
/**
|
|
29
39
|
* The sheet's scale — its gutter and the air above and below its content. As
|
|
30
40
|
* on [MPBox](./box), `size` here is the size of the *sheet*: it sets no height
|
|
@@ -32,13 +42,23 @@ export interface MPFooterProps extends Omit<React.ComponentPropsWithoutRef<'foot
|
|
|
32
42
|
* @default 'md'
|
|
33
43
|
*/
|
|
34
44
|
size?: MPSize;
|
|
45
|
+
/**
|
|
46
|
+
* Takes room out of the gutter and the air above and below the content.
|
|
47
|
+
*
|
|
48
|
+
* A footer is the sheet a page ends on, and the amount of screen it takes is
|
|
49
|
+
* mostly padding. On a dense page it is the first thing that should give some
|
|
50
|
+
* back.
|
|
51
|
+
* @default 0
|
|
52
|
+
*/
|
|
53
|
+
density?: MPDensity;
|
|
35
54
|
/**
|
|
36
55
|
* Holds the content to a measure and centres it while the sheet itself still
|
|
37
|
-
* spans the window. The same
|
|
38
|
-
*
|
|
56
|
+
* spans the window. The same prop [MPContainer](./container)'s `maxWidth` is —
|
|
57
|
+
* a rung of the size ladder, a CSS length of your own, or a map keyed by
|
|
58
|
+
* window size class.
|
|
39
59
|
* @default 'none'
|
|
40
60
|
*/
|
|
41
|
-
maxWidth?:
|
|
61
|
+
maxWidth?: MPResponsive<MPMeasure>;
|
|
42
62
|
/**
|
|
43
63
|
* The gutter, and the air above and below.
|
|
44
64
|
* @default true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import*as
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as o from"react";import{useRender as t}from"@base-ui/react/use-render";import{barSurface as r,MPPageLayoutContext as n}from"../../internal/page-layout.js";import{sheetPadX as i,sheetPadY as a}from"../../internal/density.js";import{measureValue as s}from"../../internal/measure.js";import{useWindowMins as m}from"../../internal/window-class.js";import{responsiveSlots as l,withBaseline as f}from"../../internal/responsive.js";import{useMPDensity as d,useMPSize as p}from"../../internal/config.js";const c={static:"",absolute:"absolute inset-x-0 bottom-0 z-30",sticky:"sticky bottom-0 z-30",fixed:"fixed inset-x-0 bottom-0 z-40"};export const MPFooter=/*@__PURE__*/o.forwardRef(function({position:u="static",variant:b="outlined",elevation:x,size:j,density:v,maxWidth:y="none",padded:w=!0,label:z,render:h,className:g,children:k,...N},B){const C=p(j),$=d(v),_=m(),{register:F}=o.useContext(n),M=o.useCallback(e=>{F("footer",e),"function"==typeof B?B(e):B&&(B.current=e)},[F,B]);return t({render:h??e("footer",{}),ref:M,props:{"aria-label":z,"data-mp-size":C,"data-mp-variant":b,className:["mp-footer text-mp-on-surface box-border w-full min-w-0",r(b,x),"outlined"===b?"border-mp-outline-variant border-t":"",c[u],g??""].filter(Boolean).join(" "),children:e("div",{className:["mp-footer__inner w-full",w?`${i(C,$)} ${a(C,$)}`:"","none"===y?"":"mp-measure mx-auto"].filter(Boolean).join(" "),style:"none"===y?void 0:l("measure",f(y,"none"),e=>s(e,_)),children:k}),...N}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import*as o from"react";import{Form as e}from"@base-ui/react/form";import{useMPSize as i}from"../../internal/config.js";import{SHEET_GAP as t}from"../../internal/scale.js";export const MPForm=/*@__PURE__*/o.forwardRef(function({validationMode:o="onSubmit",errors:m,onSubmit:a,size:n,className:s,children:f,...l},c){const d=i(n);return r(e,{ref:c,validationMode:o,errors:m,onFormSubmit:r=>a?.(r),"data-mp-size":d,className:["mp-form flex flex-col",t[d],s??""].filter(Boolean).join(" "),...l,children:f})});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPColor, MPSize, MPThreshold } from '../../types.js';
|
|
3
|
+
export interface MPGaugeChartProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
4
|
+
/** The reading. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** @default 0 */
|
|
7
|
+
min?: number;
|
|
8
|
+
/** @default 100 */
|
|
9
|
+
max?: number;
|
|
10
|
+
/**
|
|
11
|
+
* How far round the dial goes, in degrees, centred on twelve o'clock.
|
|
12
|
+
*
|
|
13
|
+
* `180` is a half dial sitting on its base; `240` is the classic gauge, open
|
|
14
|
+
* at the bottom. Past about 300 the two ends meet and the reader can no
|
|
15
|
+
* longer tell the start from the finish.
|
|
16
|
+
* @default 240
|
|
17
|
+
*/
|
|
18
|
+
sweep?: number;
|
|
19
|
+
/** What the reading is called, under the figure. */
|
|
20
|
+
label?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Where the reading changes colour. The last threshold it has reached wins,
|
|
23
|
+
* so they are listed smallest first.
|
|
24
|
+
*/
|
|
25
|
+
thresholds?: readonly MPThreshold[];
|
|
26
|
+
/**
|
|
27
|
+
* Paints the **track** in threshold bands as well as the fill, so a reader
|
|
28
|
+
* sees where the trouble starts before the needle gets there.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
bands?: boolean;
|
|
32
|
+
/** The family the dial carries before any threshold is reached. @default 'primary' */
|
|
33
|
+
color?: MPColor;
|
|
34
|
+
/** How the figure in the middle is written. */
|
|
35
|
+
format?: Intl.NumberFormatOptions;
|
|
36
|
+
/** Which language that figure is written in. */
|
|
37
|
+
locale?: string;
|
|
38
|
+
/** How tall the drawing is. Defaults to the `size` ladder. */
|
|
39
|
+
height?: number | string;
|
|
40
|
+
/** @default 'md' */
|
|
41
|
+
size?: MPSize;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One reading on a dial.
|
|
45
|
+
*
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <MPGaugeChart value={72} label="CPU" thresholds={[{ from: 80, color: 'error' }]} />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* ## Consider not using one
|
|
51
|
+
*
|
|
52
|
+
* A gauge spends a whole panel on a single number, and the arc adds nothing a
|
|
53
|
+
* reader could not get from the figure and a bar: an angle is judged less
|
|
54
|
+
* accurately than a length, and a dial's ends are the two places the eye is
|
|
55
|
+
* worst at. [MPStatistic](statistic) with an [MPMeter](../feedback/meter) under
|
|
56
|
+
* it says the same thing in a third of the room and reads better.
|
|
57
|
+
*
|
|
58
|
+
* What a gauge is genuinely good for is a **thresholded** reading somebody
|
|
59
|
+
* watches — a dial where the amber band is drawn on the face, so the question
|
|
60
|
+
* "how close is this to trouble" is answered by where the needle sits rather
|
|
61
|
+
* than by arithmetic. That is what `bands` is for, and it is the case worth
|
|
62
|
+
* reaching for this shape over the other two.
|
|
63
|
+
*
|
|
64
|
+
* ## It is a meter, in the markup
|
|
65
|
+
*
|
|
66
|
+
* `role="meter"` with the value, the minimum and the maximum on it — the same
|
|
67
|
+
* semantics [MPMeter](../feedback/meter) carries, because they are the same
|
|
68
|
+
* quantity in two shapes. There is no table behind it and no hover layer: a
|
|
69
|
+
* chart of one number has nothing a reader could uncover that the figure in the
|
|
70
|
+
* middle is not already saying.
|
|
71
|
+
*
|
|
72
|
+
* ## Thresholds name roles
|
|
73
|
+
*
|
|
74
|
+
* `{ from: 80, color: 'error' }` and never a hex, so a dial and a bar on the
|
|
75
|
+
* same page cannot disagree about where the amber starts. Both read the same
|
|
76
|
+
* resolver.
|
|
77
|
+
*/
|
|
78
|
+
export declare function MPGaugeChart({ value, min, max, sweep, label, thresholds, bands, color: colorProp, format, locale: localeProp, height, size: sizeProp, className, style, ...props }: MPGaugeChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Meter as l}from"@base-ui/react/meter";import{useMPElementSize as r}from"../../hooks/useMPElementSize.js";import{useMPColor as o,useMPSize as m}from"../../internal/config.js";import{useMPLocale as i}from"../../internal/locale.js";import{accentSlots as s}from"../../internal/accent.js";import{thresholdColor as n}from"../../internal/threshold.js";import{progressFraction as c}from"../../internal/progress.js";import{CHART_FONT_SIZE as h,PLOT_HEIGHT as p,arcPath as f,formatStatistic as u}from"../../internal/chart.js";import{cssLength as d}from"../../internal/length.js";import{META_TEXT as x}from"../../internal/scale.js";const g={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"};export function MPGaugeChart({value:v,min:j=0,max:M=100,sweep:_=240,label:b,thresholds:y,bands:w=!1,color:N,format:P,locale:$,height:z,size:I,className:k,style:B,...R}){const C=m(I),E=o(N),G=i($),L=a.useRef(null),S=r(L),V=c(v,j,M)??0,W=n(v,E,y),q=h[C],A=S.width,D="number"==typeof z?z:void 0===z?p[C]:S.height,F=Math.min(300,Math.max(30,_))*Math.PI/180,H=F/2,J=H>Math.PI/2?Math.cos(Math.PI-H):0,K=Math.min(A/2,D/(1+J)),O=Math.max(0,K-2),Q=.78*O,T=A/2,U=O+2,X=-H,Y=H,Z=X+V*F,ee=a.useMemo(()=>{if(!w||!y||0===y.length)return[{from:0,to:1,color:E}];const e=[...y.map(e=>({at:c(e.from,j,M)??0,color:e.color})).filter(e=>e.at>0&&e.at<1).sort((e,t)=>e.at-t.at)],t=[];let a=0,l=E;for(const r of e)t.push({from:a,to:r.at,color:l}),a=r.at,l=r.color;return t.push({from:a,to:1,color:l}),t},[w,y,E,j,M]),te=u(v,G,P,!1);return t(l.Root,{value:v,min:j,max:M,format:P,"data-mp-size":C,className:["mp-gauge-chart flex min-w-0 flex-col items-center",k??""].filter(Boolean).join(" "),style:{...s(W),...B},...R,children:[t("div",{ref:L,className:"mp-gauge-chart__dial relative w-full",style:{height:d(z)??p[C]},children:[A>0&&O>0?t("svg",{width:A,height:D,viewBox:`0 0 ${A} ${D}`,"aria-hidden":"true",className:"block overflow-visible",children:[ee.map((t,a)=>e("path",{d:f(T,U,O,Q,X+t.from*F,X+t.to*F),fill:w?`var(--_mp-color-${t.color})`:"var(--_mp-color-on-surface)",opacity:w?.22:.12},a)),e("path",{d:f(T,U,O,Q,X,Z),fill:"var(--_mp-accent)"}),e("path",{d:f(T,U,O,Q,X,X+.004*F),fill:"var(--_mp-color-outline)"}),e("path",{d:f(T,U,O,Q,Y-.004*F,Y),fill:"var(--_mp-color-outline)"})]}):null,t("div",{className:"pointer-events-none absolute inset-x-0 flex flex-col items-center",style:{top:U-.45*Q},children:[e(l.Value,{className:`mp-gauge-chart__value text-mp-on-surface font-medium tabular-nums ${g[C]}`,children:e=>P?e:te}),b?e(l.Label,{className:`mp-gauge-chart__label text-mp-on-surface-variant ${x}`,style:{maxWidth:1.8*Q},children:b}):null]})]}),J>0?e("span",{"aria-hidden":"true",style:{height:q/2}}):null]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPGaugeChart}from"./MPGaugeChart.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{
|
|
2
|
+
import*as e from"react";import{useRender as t}from"@base-ui/react/use-render";import{classMap as n,responsiveSlots as r,withBaseline as s}from"../../internal/responsive.js";import{WINDOW_CLASSES as a}from"../../internal/window-class.js";function o(e){return String(Math.max(1,Math.round(e)))}function c(e){return String(Math.max(1,Math.round(e)))}function i(e){const t=n(e),r=Object.values(t).some(e=>"grow"===e),s={};for(const e of a){const n=t[e];void 0!==n&&("grow"!==n&&(s[`--_mp-span-${e}`]=c(n)),r&&(s[`--_mp-grow-${e}`]="grow"===n?"1":"0"))}return s}function l(e){return String(Math.max(0,Math.round(e)))}function f(e){const t=.25*Math.max(0,e);return`${Number(t.toFixed(5))}rem`}const p={start:"justify-start",center:"justify-center",end:"justify-end","space-between":"justify-between","space-around":"justify-around","space-evenly":"justify-evenly"},u={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"},m={start:"content-start",center:"content-center",end:"content-end","space-between":"content-between","space-around":"content-around","space-evenly":"content-evenly",stretch:"content-stretch"},d={auto:"self-auto",start:"self-start",center:"self-center",end:"self-end",stretch:"self-stretch",baseline:"self-baseline"};export const MPGrid=/*@__PURE__*/e.forwardRef(function({columns:e,spacing:n,rowSpacing:a,columnSpacing:c,justifyContent:i,alignItems:l,alignContent:d,wrap:g=!0,render:y,className:h,style:w,children:x,...j},b){return t({render:y,ref:b,props:{className:["mp-grid flex",g?"flex-wrap":"flex-nowrap","gap-x-(--_mp-gap-x) gap-y-(--_mp-gap-y)",i?p[i]:"",l?u[l]:"",d?m[d]:"",h??""].filter(Boolean).join(" "),style:{...r("cols",s(e,12),o),...r("gap-x",s(c??n,4),f),...r("gap-y",s(a??n,4),f),...w},children:x,...j}})});export const MPGridItem=/*@__PURE__*/e.forwardRef(function({span:e,offset:n,alignSelf:s,render:a,className:o,style:c,children:f,...p},u){return t({render:a,ref:u,props:{className:["mp-grid-item",s?d[s]:"",o??""].filter(Boolean).join(" "),"data-mp-offset":null==n?void 0:"",style:{...i(e),...r("offset",n,l),...c},children:f,...p}})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { MPAlign, MPPosition, MPSize, MPVariant } from '../../types.js';
|
|
3
|
+
import type { MPAlign, MPDensity, MPMeasure, MPPosition, MPResponsive, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
4
4
|
export interface MPHeaderProps extends Omit<React.ComponentPropsWithoutRef<'header'>, 'title'> {
|
|
5
5
|
/**
|
|
6
6
|
* The leading slot: the mark, the product's name, the thing that is the same
|
|
@@ -50,6 +50,16 @@ export interface MPHeaderProps extends Omit<React.ComponentPropsWithoutRef<'head
|
|
|
50
50
|
* @default 'tonal'
|
|
51
51
|
*/
|
|
52
52
|
variant?: MPVariant;
|
|
53
|
+
/**
|
|
54
|
+
* How far off the page the bar is lifted, on MD3's own scale.
|
|
55
|
+
*
|
|
56
|
+
* It moves the tone as well as the shadow — see `MPElevation`. A bar's
|
|
57
|
+
* `elevated` is level 2 rather than 1, because a bar sits over the page's
|
|
58
|
+
* content rather than in it; an explicit level says exactly what it says.
|
|
59
|
+
*
|
|
60
|
+
* Left unset, `variant` decides.
|
|
61
|
+
*/
|
|
62
|
+
elevation?: MPElevation;
|
|
53
63
|
/**
|
|
54
64
|
* The bar's height floor, its gutter and the air between its slots.
|
|
55
65
|
*
|
|
@@ -59,13 +69,25 @@ export interface MPHeaderProps extends Omit<React.ComponentPropsWithoutRef<'head
|
|
|
59
69
|
* @default 'md'
|
|
60
70
|
*/
|
|
61
71
|
size?: MPSize;
|
|
72
|
+
/**
|
|
73
|
+
* Takes room out of the bar's gutter.
|
|
74
|
+
*
|
|
75
|
+
* The height floor is `size`'s and stays where it is: a top app bar that a
|
|
76
|
+
* dense page shrank would move every fixed thing under it, and the bar is the
|
|
77
|
+
* one part of a screen a reader locates by position. What tightens is the
|
|
78
|
+
* room at its edges.
|
|
79
|
+
* @default 0
|
|
80
|
+
*/
|
|
81
|
+
density?: MPDensity;
|
|
62
82
|
/**
|
|
63
83
|
* Holds the row of slots to a measure and centres it while the sheet itself
|
|
64
|
-
* still spans the window. The same
|
|
65
|
-
* `maxWidth`
|
|
84
|
+
* still spans the window. The same prop [MPContainer](./container)'s
|
|
85
|
+
* `maxWidth` is — a rung of the size ladder, a CSS length of your own, or a
|
|
86
|
+
* map keyed by window size class — so a header and the container under it line
|
|
87
|
+
* up on one edge by being given the same value.
|
|
66
88
|
* @default 'none'
|
|
67
89
|
*/
|
|
68
|
-
maxWidth?:
|
|
90
|
+
maxWidth?: MPResponsive<MPMeasure>;
|
|
69
91
|
/**
|
|
70
92
|
* The gutter down each side of the row.
|
|
71
93
|
* @default true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{useRender as n}from"@base-ui/react/use-render";import{barSurface as r,MPPageLayoutContext as a}from"../../internal/page-layout.js";import{hasContent as s}from"../../internal/scale.js";import{sheetPadX as l}from"../../internal/density.js";import{measureValue as m}from"../../internal/measure.js";import{useWindowMins as o}from"../../internal/window-class.js";import{responsiveSlots as d,withBaseline as c}from"../../internal/responsive.js";import{useMPDensity as p,useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-12",sm:"min-h-14",md:"min-h-16",lg:"min-h-20",xl:"min-h-24"},u={xs:"text-mp-title-small",sm:"text-mp-title-medium",md:"text-mp-title-large",lg:"text-mp-headline-small",xl:"text-mp-headline-medium"},h={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-4",xl:"gap-5"},g={xs:"gap-3",sm:"gap-4",md:"gap-6",lg:"gap-8",xl:"gap-10"},j={static:"",absolute:"absolute inset-x-0 top-0 z-30",sticky:"sticky top-0 z-30",fixed:"fixed inset-x-0 top-0 z-40"},b={start:"shrink-0",center:"flex-1 basis-0",end:"shrink-0"},v={start:"flex min-w-0 flex-1 items-center justify-start",center:"flex min-w-0 shrink items-center justify-center",end:"flex min-w-0 flex-1 items-center justify-end"};export const MPHeader=/*@__PURE__*/i.forwardRef(function({brand:y,actions:w,align:N="start",position:k="sticky",variant:_="tonal",elevation:z,size:B,density:C,maxWidth:$="none",padded:H=!0,label:M,render:P,className:R,children:W,...q},A){const D=f(B),E=p(C),F=o(),{register:G}=i.useContext(a),I=i.useCallback(e=>{G("header",e),"function"==typeof A?A(e):A&&(A.current=e)},[G,A]);return n({render:P??e("header",{}),ref:I,props:{"aria-label":M,"data-mp-size":D,"data-mp-variant":_,className:["mp-header text-mp-on-surface box-border w-full min-w-0",r(_,z),"outlined"===_?"border-mp-outline-variant border-b":"",j[k],R??""].filter(Boolean).join(" "),children:t("div",{className:["flex w-full items-center",x[D],g[D],H?l(D,E):"","none"===$?"":"mp-measure mx-auto"].filter(Boolean).join(" "),style:"none"===$?void 0:d("measure",c($,"none"),e=>m(e,F)),children:[s(y)?e("div",{className:["mp-header__brand flex min-w-0 items-center",b[N],h[D],u[D]].join(" "),children:y}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null,s(W)?e("div",{className:`mp-header__middle ${v[N]} ${h[D]}`,children:W}):null,s(w)?e("div",{className:["mp-header__actions flex min-w-0 items-center justify-end",b[N],h[D]].join(" "),children:w}):"center"===N?e("div",{"aria-hidden":"true",className:b[N]}):null]}),...q}})});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartBaseProps } from '../../internal/ChartChrome.js';
|
|
3
|
+
import type { MPChartAxis, MPChartCategory, MPChartSeries } from '../../types.js';
|
|
4
|
+
export interface MPHeatmapChartProps extends ChartBaseProps {
|
|
5
|
+
/**
|
|
6
|
+
* The rows. Each series is one row and its `data` are that row's cells, in
|
|
7
|
+
* the order `categories` names the columns.
|
|
8
|
+
*/
|
|
9
|
+
series: readonly MPChartSeries[];
|
|
10
|
+
/** The column headings. */
|
|
11
|
+
categories?: readonly MPChartCategory[];
|
|
12
|
+
/** The column axis. Only `label`, `hidden` and `tickFormat` mean anything here. */
|
|
13
|
+
xAxis?: MPChartAxis;
|
|
14
|
+
/** The row axis, same three. */
|
|
15
|
+
yAxis?: MPChartAxis;
|
|
16
|
+
/**
|
|
17
|
+
* Where the colour scale starts and ends. Taken from the data otherwise.
|
|
18
|
+
*
|
|
19
|
+
* Worth pinning when two heatmaps are meant to be compared: without it each
|
|
20
|
+
* one scales to its own range, and the darkest cell of a quiet week looks
|
|
21
|
+
* exactly like the darkest cell of a bad one.
|
|
22
|
+
*/
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Writes each cell's value in it, where the cell is big enough to hold the
|
|
27
|
+
* text. One that does not fit is dropped rather than clipped.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
valueLabels?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A grid of cells, coloured by how much.
|
|
34
|
+
*
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <MPHeatmapChart
|
|
37
|
+
* categories={['Mon', 'Tue', 'Wed']}
|
|
38
|
+
* series={[
|
|
39
|
+
* { name: '09:00', data: [4, 9, 2] },
|
|
40
|
+
* { name: '10:00', data: [7, 12, 5] }
|
|
41
|
+
* ]}
|
|
42
|
+
* />
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Two categorical axes and a magnitude in the cells. It is the shape for a
|
|
46
|
+
* pattern across two dimensions — a week by hour, a cohort by month — where
|
|
47
|
+
* what a reader is looking for is *where* the dense part is rather than what
|
|
48
|
+
* any one cell holds.
|
|
49
|
+
*
|
|
50
|
+
* ## Its colour is a ramp, not the palette
|
|
51
|
+
*
|
|
52
|
+
* The eight chart slots are an **identity** channel: they say which series, and
|
|
53
|
+
* nobody can tell whether slot 6 is more than slot 3. A cell's colour here has
|
|
54
|
+
* to say how much, so it comes from a sequential ramp instead — one hue, five
|
|
55
|
+
* steps, running pale to deep on a light page and deep to bright on a dark one,
|
|
56
|
+
* because "more" has to be further from the page in both.
|
|
57
|
+
*
|
|
58
|
+
* That also sidesteps the cap the palette runs into: every cell touches its
|
|
59
|
+
* neighbours, and colour separates only three touching series. A ramp is not
|
|
60
|
+
* being asked to separate anything — it is being asked to be ordered.
|
|
61
|
+
*
|
|
62
|
+
* ## Steps rather than a gradient
|
|
63
|
+
*
|
|
64
|
+
* A smooth fill looks better and reads worse. Given a gradient a reader can say
|
|
65
|
+
* "darker" and nothing else; given five steps they can match a cell to a band
|
|
66
|
+
* in the legend and come away with a number.
|
|
67
|
+
*
|
|
68
|
+
* ## Pin the scale to compare two of them
|
|
69
|
+
*
|
|
70
|
+
* By default each heatmap scales to its own range, so two side by side say
|
|
71
|
+
* nothing to each other — the darkest cell of a quiet week looks exactly like
|
|
72
|
+
* the darkest cell of a bad one. Give both the same `min` and `max` when the
|
|
73
|
+
* comparison is the point.
|
|
74
|
+
*/
|
|
75
|
+
export declare function MPHeatmapChart({ series, categories, xAxis, yAxis, min, max, valueLabels, height, format, locale: localeProp, label, legend, tooltip, empty, size: sizeProp, className, style, ...rest }: MPHeatmapChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{useMPElementSize as n}from"../../hooks/useMPElementSize.js";import{useMPLocale as a,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as o}from"../../internal/config.js";import{CHART as i}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartShell as s,ChartTable as c,ChartTooltipPanel as h}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as u,MARK_GAP as d,PLOT_HEIGHT as f,RAMP_STEPS as p,formatCategory as x,formatStatistic as g,rampFill as v,rampInk as y,rampStep as w,textWidth as b,toValues as k,truncate as M}from"../../internal/chart.js";export function MPHeatmapChart({series:j,categories:A,xAxis:N,yAxis:S,min:$,max:_,valueLabels:z=!1,height:B,format:C,locale:P,label:D,legend:R,tooltip:L,empty:E,size:F,className:I,style:W,...H}){const K=o(F),U=a(P),X=r(i,U),Y=r(m,U),q=t.useRef(null),G=n(q),J=t.useId(),[O,Q]=t.useState(null),T=t.useMemo(()=>k(j),[j]),V=T.reduce((e,l)=>Math.max(e,l.length),0),Z=t.useCallback(e=>g(e,U,C,!0),[C,U]),ee=j.map((e,l)=>e.name??String(l+1)),le=Array.from({length:V},(e,l)=>N?.tickFormat?String(N.tickFormat(A?.[l]??l,l)):x(A?.[l]??l,U)),te=T.flat().filter(e=>null!==e.value),ne=$??(te.length>0?Math.min(...te.map(e=>e.value)):0),ae=_??(te.length>0?Math.max(...te.map(e=>e.value)):0),re=ae-ne||1,oe=u[K],ie=G.width,me="number"==typeof B?B:void 0===B?f[K]:G.height,se=ee.reduce((e,l)=>Math.max(e,b(l,oe)),0),ce=S?.hidden?0:S?.thickness??Math.min(140,se+10),he=N?.hidden?0:N?.thickness??oe+12,ue=ce,de=0,fe=Math.max(0,ie-ce),pe=Math.max(0,me-he),xe=V>0?fe/V:0,ge=T.length>0?pe/T.length:0,ve=(e,l)=>{Q(t=>{const n=t??{row:0,column:0};return{row:Math.min(T.length-1,Math.max(0,n.row+(t?e:0))),column:Math.min(V-1,Math.max(0,n.column+(t?l:0)))}})},ye=O?T[O.row]?.[O.column]??null:null,we=O&&ye&&null!==ye.value?[{seriesIndex:O.row,name:ee[O.row],color:v(w((ye.value-ne)/re)),value:ye.value,formatted:Z(ye.value),label:ye.label}]:[],be=!1===L?{mode:"none"}:!0===L||void 0===L?{}:L,ke=!1!==R&&te.length>0,Me=0===V||0===T.length||0===te.length,je=Array.from({length:V},(e,l)=>T.map(e=>e[l]??{value:null}));return e(s,{...H,size:K,className:["mp-heatmap-chart",I??""].filter(Boolean).join(" "),style:W,plotRef:q,name:D??X.label,describedBy:Me?void 0:J,interactive:!Me,height:B,legendSide:"bottom",plotProps:{onPointerMove:Me||"none"===be.mode?void 0:e=>Q(((e,l)=>{const t=q.current;if(!t||xe<=0||ge<=0)return null;const n=t.getBoundingClientRect(),a=Math.floor((e-n.left-ue)/xe),r=Math.floor((l-n.top-de)/ge);return a<0||a>=V||r<0||r>=T.length?null:{row:r,column:a}})(e.clientX,e.clientY)),onPointerLeave:()=>Q(null),onKeyDown:Me||"none"===be.mode?void 0:e=>{if("ArrowRight"===e.key)ve(0,1);else if("ArrowLeft"===e.key)ve(0,-1);else if("ArrowDown"===e.key)ve(1,0);else if("ArrowUp"===e.key)ve(-1,0);else{if("Escape"!==e.key)return;Q(null)}e.preventDefault()},onBlur:()=>Q(null)},tooltip:O&&we.length>0&&"none"!==be.mode?e(h,{heading:`${ee[O.row]} · ${le[O.column]}`,items:we,x:ue+(O.column+.5)*xe,y:de+(O.row+.5)*ge,flip:O.column>V/2,size:K}):null,legend:ke?l("div",{className:"mp-chart__legend flex items-center justify-center gap-2",children:[e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:Z(ne)}),e("span",{className:"flex","aria-hidden":"true",children:Array.from({length:p},(l,t)=>e("span",{className:"block h-3 w-6 first:rounded-s-mp-xs last:rounded-e-mp-xs",style:{background:v(t)}},t))}),e("span",{className:"text-mp-on-surface-variant text-mp-label-small tabular-nums",children:Z(ae)})]}):null,status:{heading:O?`${ee[O.row]} · ${le[O.column]}`:void 0,items:we},table:Me?null:e(c,{id:J,caption:D??X.table,corner:S?.label??X.category,categories:ee,names:le,values:je,format:Z,locale:U,empty:Y.empty}),children:Me?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:E??Y.empty}):ie>0&&me>0?l("svg",{width:ie,height:me,viewBox:`0 0 ${ie} ${me}`,"aria-hidden":"true",className:"block overflow-visible",children:[e("g",{className:"mp-heatmap-chart__cells",children:T.map((t,n)=>Array.from({length:V},(a,r)=>{const o=t[r],i=O?.row===n&&O?.column===r,m=ue+r*xe,s=de+n*ge,c=Math.max(0,xe-d),h=Math.max(0,ge-d);if(!o||null===o.value)return e("rect",{x:m+d/2,y:s+d/2,width:c,height:h,fill:"none",stroke:"var(--_mp-color-outline-variant)",strokeWidth:1,strokeDasharray:"2 2",rx:2},r);const u=w((o.value-ne)/re);return l("g",{children:[e("rect",{x:m+d/2,y:s+d/2,width:c,height:h,fill:o.color??v(u),rx:2,stroke:i?"var(--_mp-color-on-surface)":"none",strokeWidth:i?2:0}),z&&c>b(Z(o.value),oe)+8&&h>oe+4?e("text",{x:m+xe/2,y:s+ge/2,textAnchor:"middle",dominantBaseline:"central",fill:y(u),fontSize:oe,children:Z(o.value)}):null]},r)}))}),S?.hidden?null:ee.map((l,t)=>e("text",{x:ue-8,y:de+(t+.5)*ge,textAnchor:"end",dominantBaseline:"central",fill:"var(--_mp-color-on-surface-variant)",fontSize:oe,children:M(l,ce-10,oe)},`r${t}`)),N?.hidden?null:le.map((l,t)=>e("text",{x:ue+(t+.5)*xe,y:de+pe+oe+4,textAnchor:"middle",fill:"var(--_mp-color-on-surface-variant)",fontSize:oe,children:M(l,xe-2,oe)},`c${t}`))]}):null})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPHeatmapChart}from"./MPHeatmapChart.js";
|