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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPControlEventProps, MPStyleProps } from '../../types.js';
|
|
2
|
+
import type { MPControlEventProps, MPSlots, MPStyleProps } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* What a select's value may be.
|
|
5
5
|
*
|
|
@@ -23,7 +23,8 @@ export interface MPSelectProps extends MPStyleProps, MPControlEventProps<HTMLBut
|
|
|
23
23
|
* The options, as data. There is no `<MPSelect.Option>` to compose: what a
|
|
24
24
|
* caller has is almost always an array already, and the list has to be
|
|
25
25
|
* available to the trigger before the popup has ever been opened — otherwise
|
|
26
|
-
* a closed select can only show its raw value.
|
|
26
|
+
* a closed select can only show its raw value.
|
|
27
|
+
*
|
|
27
28
|
* ## How long a list this holds
|
|
28
29
|
*
|
|
29
30
|
* Every row is rendered, and there is no windowing. That is the right default
|
|
@@ -37,9 +38,19 @@ export interface MPSelectProps extends MPStyleProps, MPControlEventProps<HTMLBut
|
|
|
37
38
|
* slice.
|
|
38
39
|
*/
|
|
39
40
|
items: readonly MPSelectOption[];
|
|
40
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* The chosen value. Use with `onValueChange` for a controlled select.
|
|
43
|
+
*
|
|
44
|
+
* **Nothing chosen is `null`**, and it is worth saying out loud because the
|
|
45
|
+
* near miss is quiet. A value with no matching entry in `items` has no label
|
|
46
|
+
* to show, so the trigger draws the value itself: a form holding `0` for "not
|
|
47
|
+
* picked yet" sits there reading `0`. That is the right answer for a value
|
|
48
|
+
* that is real and whose row has not arrived yet — the alternative is a field
|
|
49
|
+
* that says nothing about a value it is holding and will submit — but it is
|
|
50
|
+
* not the answer anybody wants for a sentinel.
|
|
51
|
+
*/
|
|
41
52
|
value?: MPSelectValue | null;
|
|
42
|
-
/** The value chosen at the start, for an uncontrolled select. */
|
|
53
|
+
/** The value chosen at the start, for an uncontrolled select. `null` is none. */
|
|
43
54
|
defaultValue?: MPSelectValue | null;
|
|
44
55
|
/** Called with the newly chosen value — a value, not an event. */
|
|
45
56
|
onValueChange?: (value: MPSelectValue | null) => void;
|
|
@@ -97,6 +108,18 @@ export interface MPSelectProps extends MPStyleProps, MPControlEventProps<HTMLBut
|
|
|
97
108
|
*/
|
|
98
109
|
className?: string;
|
|
99
110
|
style?: React.CSSProperties;
|
|
111
|
+
/**
|
|
112
|
+
* A class name for a part `className` cannot reach.
|
|
113
|
+
*
|
|
114
|
+
* The list renders at the end of `<body>`, outside the element `className`
|
|
115
|
+
* lands on — no selector written against the root will ever find it — and the
|
|
116
|
+
* options are drawn from `options` rather than written by the caller, so there
|
|
117
|
+
* is no element of theirs to put a class on.
|
|
118
|
+
*
|
|
119
|
+
* - `popup` — the sheet the options are drawn on.
|
|
120
|
+
* - `item` — every option in it.
|
|
121
|
+
*/
|
|
122
|
+
classNames?: MPSlots<'popup' | 'item'>;
|
|
100
123
|
}
|
|
101
124
|
/**
|
|
102
125
|
* A Material Design select.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Select as t}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as o}from"../icon/MPIcon.js";import{CheckIcon as i,ChevronDownIcon as l}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as c,useFloatingLabel as d}from"../../internal/FieldOutline.js";import{MPStateLayer as
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as n from"react";import{Select as t}from"@base-ui/react/select";import{Field as r}from"@base-ui/react/field";import{MPIcon as o}from"../icon/MPIcon.js";import{CheckIcon as i,ChevronDownIcon as l}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as c,useFloatingLabel as d}from"../../internal/FieldOutline.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{MPSupportingText as p}from"../../internal/SupportingText.js";import{CONTROL_ICON as u,PROSE_TEXT as f,hasContent as h}from"../../internal/scale.js";import{MARK_MOTION_KEPT as g}from"../../internal/mark.js";import{FADE as x,PORTAL_LAYER as b}from"../../internal/surface.js";import{useMPSize as v}from"../../internal/config.js";const j={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}};export const MPSelect=/*@__PURE__*/n.forwardRef(function({items:y,value:N,defaultValue:k,onValueChange:w,onKeyDown:C,onKeyUp:I,onFocus:M,onBlur:S,onClick:z,onDoubleClick:P,onContextMenu:_,placeholder:B,label:O,floatingLabel:V=!0,description:q,errorMessage:D,startIcon:F,size:K,fullWidth:T=!1,required:L=!1,disabled:R=!1,readOnly:$=!1,name:U,id:W,classNames:A,className:E,style:G},H){const J=v(K),Q=h(D),X=j[J],Y=n.useId(),Z=W??Y,[ee,ae]=n.useState(k??null),[ne,te]=n.useState(!1),re=void 0===N?ee:N,{shrunk:oe,focusProps:ie}=d({floating:V&&h(O),filled:null!==re&&""!==re,pinned:ne||!!F}),le=n.useMemo(()=>y.map(e=>({label:e.label??String(e.value),value:e.value})),[y]);return a(r.Root,{className:["mp-select group flex-col align-top",T?"flex w-full":"inline-flex w-fit",E??""].filter(Boolean).join(" "),style:G,disabled:R,invalid:Q,"data-mp-size":J,...ie,children:[a(t.Root,{id:Z,name:U,items:le,value:N,defaultValue:k,onValueChange:e=>{ae(e??null),w?.(e??null)},onOpenChange:te,disabled:R,readOnly:$,required:L,children:[a("div",{className:"relative w-full",children:[a(t.Trigger,{ref:H,onKeyDown:C,onKeyUp:I,onFocus:M,onBlur:S,onClick:z,onDoubleClick:P,onContextMenu:_,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",X.padding,X.height,f[J],R?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+($?"cursor-default":"cursor-pointer")].join(" "),children:[F?e("span",{className:["flex shrink-0 items-center",R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:F}):null,e(t.Value,{className:["min-w-0 flex-1 truncate text-start","data-placeholder:text-mp-on-surface-variant",R?"data-placeholder:text-mp-on-surface/38":""].filter(Boolean).join(" "),placeholder:oe?B:void 0}),e(t.Icon,{className:["flex shrink-0 items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180",R?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:e(o,{icon:l,size:u[J]})})]}),e(c,{label:O,required:L,notched:oe}),h(O)?e(s,{size:J,label:O,required:L,htmlFor:Z,shrunk:oe}):null]}),e(t.Portal,{children:e(t.Positioner,{className:b,sideOffset:4,alignItemWithTrigger:!1,children:e(t.Popup,{className:["mp-select__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface min-w-[var(--anchor-width)] outline-none",f[J],x,A?.popup??""].filter(Boolean).join(" "),children:e(t.List,{className:"max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",children:y.map((n,r)=>a(t.Item,{value:n.value,disabled:n.disabled,className:["mp-select__item group rounded-mp-xs relative flex cursor-pointer items-center",A?.item??"","gap-3 py-2 pe-3 ps-2 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:text-mp-on-secondary-container","data-selected:bg-mp-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(m,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:e(t.ItemIndicator,{keepMounted:!0,className:`mp-select__mark ${g}`,children:e(o,{icon:i,size:18})})}),e(t.ItemText,{className:"min-w-0 flex-1 truncate",children:n.label??String(n.value)})]},`${r}:${String(n.value)}`))})})})})]}),e(p,{description:q,errorMessage:D,className:X.padding})]})});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { MPWindowClass } from '../../types.js';
|
|
4
|
+
export interface MPShowProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* The narrowest window this is shown in. `from="medium"` is 600dp up, so it is
|
|
7
|
+
* absent on a phone and present everywhere else.
|
|
8
|
+
*/
|
|
9
|
+
from?: MPWindowClass;
|
|
10
|
+
/**
|
|
11
|
+
* The class this stops being shown at, exclusive. `until="expanded"` is every
|
|
12
|
+
* window under 840dp — the mirror of `from="expanded"`, and the two of them
|
|
13
|
+
* over the same class cover every width exactly once.
|
|
14
|
+
*/
|
|
15
|
+
until?: MPWindowClass;
|
|
16
|
+
/**
|
|
17
|
+
* One class and no other, which is `from` and `until` said together:
|
|
18
|
+
* `only="medium"` is 600dp to 839dp.
|
|
19
|
+
*
|
|
20
|
+
* `from` and `until` still override their own half, so
|
|
21
|
+
* `only="medium" until="large"` is 600dp to 1199dp. That is the same range
|
|
22
|
+
* `from="medium" until="large"` is, and which of the two to write is a
|
|
23
|
+
* question of which one reads like the intention.
|
|
24
|
+
*/
|
|
25
|
+
only?: MPWindowClass;
|
|
26
|
+
/**
|
|
27
|
+
* Renders something other than a `<div>`: `render={<li />}`,
|
|
28
|
+
* `render={<td />}` — for the places where a bare `<div>` would not be allowed
|
|
29
|
+
* to sit. Base UI's own escape hatch.
|
|
30
|
+
*/
|
|
31
|
+
render?: useRender.RenderProp;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Content at some window sizes and not others.
|
|
36
|
+
*
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <MPShow from="expanded">
|
|
39
|
+
* <MPSidebar>{nav}</MPSidebar>
|
|
40
|
+
* </MPShow>
|
|
41
|
+
* <MPShow until="expanded">
|
|
42
|
+
* <MPBottomNavigation items={nav} />
|
|
43
|
+
* </MPShow>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* The two halves of that pair are exclusive and exhaustive over the same class,
|
|
47
|
+
* which is the shape worth writing: one of them is on screen at every width, and
|
|
48
|
+
* never both.
|
|
49
|
+
*
|
|
50
|
+
* ## It is `display: none`, not a condition
|
|
51
|
+
*
|
|
52
|
+
* Both branches are rendered and one of them is hidden by CSS, which is a
|
|
53
|
+
* deliberate trade rather than a shortcut. A media query is resolved by the
|
|
54
|
+
* browser before it paints anything, including on the server's markup — so the
|
|
55
|
+
* first frame is already right. [useMPWindowClass](../../guide/hooks) answers
|
|
56
|
+
* the same question in JavaScript, and cannot answer it until the page has
|
|
57
|
+
* hydrated: the first paint is a guess and the correction is a second render,
|
|
58
|
+
* which on a phone is a desktop navigation drawn and thrown away.
|
|
59
|
+
*
|
|
60
|
+
* So this is the one to reach for when what changes is *which* of two
|
|
61
|
+
* arrangements is on screen. The hook is the one to reach for when the subtree
|
|
62
|
+
* that is not on screen is expensive — a chart, a map, a table of a thousand
|
|
63
|
+
* rows — because hidden is not unmounted: it is built, laid out and skipped at
|
|
64
|
+
* paint, and its effects run.
|
|
65
|
+
*
|
|
66
|
+
* `display: none` also takes the content off the accessibility tree, which is
|
|
67
|
+
* the point. A screen reader on a narrow window reads the compact arrangement
|
|
68
|
+
* and not both of them.
|
|
69
|
+
*
|
|
70
|
+
* ## It is not a box
|
|
71
|
+
*
|
|
72
|
+
* The wrapper is `display: contents` while it is shown, so it takes no part in
|
|
73
|
+
* the layout: an `MPShow` inside a flex row makes its children the flex items,
|
|
74
|
+
* exactly as if it were not there. That declaration is written at zero
|
|
75
|
+
* specificity, so a `className` of your own that sets a display wins over it
|
|
76
|
+
* without a fight — and the hiding, which is a real class, still wins over both.
|
|
77
|
+
*/
|
|
78
|
+
export declare const MPShow: React.ForwardRefExoticComponent<MPShowProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as r from"react";import{useRender as e}from"@base-ui/react/use-render";import{HIDDEN_BELOW as o,HIDDEN_FROM as i}from"../../internal/visibility.js";import{WINDOW_CLASSES as n}from"../../internal/window-class.js";export const MPShow=/*@__PURE__*/r.forwardRef(function({from:r,until:s,only:t,render:a,className:l,children:m,...f},c){const d=r??t,p=s??(t?(u=t,n[n.indexOf(u)+1]):void 0);var u;return e({render:a,ref:c,props:{className:["mp-show",d?o[d]:"",p?i[p]:"",l??""].filter(Boolean).join(" "),children:m,...f}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPShow}from"./MPShow.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type MPPageCollapse, type MPSidebarSide } from '../../internal/page-layout.js';
|
|
3
|
-
import type { MPSize, MPVariant } from '../../types.js';
|
|
3
|
+
import type { MPDensity, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
4
4
|
export type { MPPageCollapse, MPSidebarSide } from '../../internal/page-layout.js';
|
|
5
5
|
export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'aside'>, 'title'> {
|
|
6
6
|
/**
|
|
@@ -100,6 +100,16 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
|
|
|
100
100
|
* @default 'outlined'
|
|
101
101
|
*/
|
|
102
102
|
variant?: MPVariant;
|
|
103
|
+
/**
|
|
104
|
+
* How far off the page the bar is lifted, on MD3's own scale.
|
|
105
|
+
*
|
|
106
|
+
* It moves the tone as well as the shadow — see `MPElevation`. A bar's
|
|
107
|
+
* `elevated` is level 2 rather than 1, because a bar sits over the page's
|
|
108
|
+
* content rather than in it; an explicit level says exactly what it says.
|
|
109
|
+
*
|
|
110
|
+
* Left unset, `variant` decides.
|
|
111
|
+
*/
|
|
112
|
+
elevation?: MPElevation;
|
|
103
113
|
/**
|
|
104
114
|
* The column's default width and the air around its content. `md` is 360px,
|
|
105
115
|
* which is MD3's own navigation drawer and the same rung
|
|
@@ -107,6 +117,15 @@ export interface MPSidebarProps extends Omit<React.ComponentPropsWithoutRef<'asi
|
|
|
107
117
|
* @default 'md'
|
|
108
118
|
*/
|
|
109
119
|
size?: MPSize;
|
|
120
|
+
/**
|
|
121
|
+
* Takes room out of the air around the column's content.
|
|
122
|
+
*
|
|
123
|
+
* The width is `size`'s and does not move — a navigation column narrower than
|
|
124
|
+
* its labels is a column of truncated labels — so what this tightens is the
|
|
125
|
+
* gutter, which is what a sidebar full of destinations is competing for.
|
|
126
|
+
* @default 0
|
|
127
|
+
*/
|
|
128
|
+
density?: MPDensity;
|
|
110
129
|
/**
|
|
111
130
|
* The gutter, and the air above and below the content.
|
|
112
131
|
* @default true
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{MPDrawer as n}from"../drawer/MPDrawer.js";import{pixelsIn as o}from"../../internal/length.js";import{useMPLocale as i,useMPMessages as a}from"../../internal/locale.js";import{LAYOUT as s}from"../../internal/messages/layout.js";import{barSurface as l,drawerSide as d,EXPANDED_ONLY as u,MPPageLayoutContext as c,MPSidebarSideContext as m,useMPCollapsed as p}from"../../internal/page-layout.js";import{sheetPadX as f,sheetPadY as v}from"../../internal/density.js";import{useMPDensity as b,useMPSize as y}from"../../internal/config.js";const h={xs:"15rem",sm:"18rem",md:"22.5rem",lg:"26rem",xl:"30rem"};function g(e,t){return null==e?t:"number"==typeof e?e:o(e,"undefined"==typeof window?void 0:window.innerWidth)??t}export const MPSidebar=/*@__PURE__*/r.forwardRef(function({side:o,width:w,minWidth:x=160,maxWidth:j=480,resizable:_=!1,onResize:R,onResizeEnd:k,collapseBelow:C,open:z,defaultOpen:P=!1,onOpenChange:E,sticky:M=!0,title:L,variant:B="outlined",elevation:S,size:N,density:A,padded:D=!0,label:O,locale:$,className:I,style:W,children:T,...X},K){const V=y(N),q=b(A),F=r.useContext(c),G=r.useContext(m),H=o??G??"start",J=i($??F.locale),Q=a(s,J),U=C??(F.present?F.collapseBelow:"none"),Y=p(U),[Z,ee]=r.useState(P),te=void 0!==z,re=te?z:F.present?F.open[H]:Z,ne=e=>{te||(F.present?F.setOpen(H,e):ee(e)),E?.(e)},oe=void 0===w?h[V]:"number"==typeof w?`${w}px`:w,ie=r.useRef(null),ae=r.useRef(oe),se=r.useRef(null),le=r.useId();ae.current!==oe&&(ae.current=oe,ie.current=null);const de=ie.current??oe,ue=r.useRef(null),ce=r.useCallback(e=>{ue.current=e,"function"==typeof K?K(e):K&&(K.current=e)},[K]),me=r.useRef(null);r.useEffect(()=>()=>me.current?.(),[]);const pe=e=>{const t=ue.current;if(!t)return e;const r=Math.min(g(j,480),Math.max(g(x,160),Math.round(e)));return ie.current=`${r}px`,t.style.setProperty("--_mp-sidebar-width",ie.current),se.current?.setAttribute("aria-valuenow",String(r)),r};return Y?e(n,{side:d(H),mode:"modal",open:re,onOpenChange:ne,title:L??O??Q.sidebar,size:V,locale:J,extent:void 0===w?void 0:de,className:I,style:W,children:T}):t("aside",{ref:ce,"aria-label":O??Q.sidebar,"data-mp-size":V,"data-mp-variant":B,"data-mp-side":H,className:["mp-sidebar text-mp-on-surface relative box-border flex min-w-0 shrink-0 flex-col","w-(--_mp-sidebar-width)",l(B,S),"outlined"===B?"border-mp-outline-variant "+("start"===H?"border-e":"border-s"):"","content"===F.scroll?"h-full":M?["self-start sticky [top:var(--_mp-layout-header,0px)]","[height:calc(100dvh_-_var(--_mp-layout-header,0px)_-_var(--_mp-layout-footer,0px))]"].join(" "):"",u[U],I??""].filter(Boolean).join(" "),style:{"--_mp-sidebar-width":de,...W},...X,children:[e("div",{id:le,className:["mp-sidebar__body min-h-0 flex-1 overflow-y-auto overscroll-contain",D?`${f(V,q)} ${v(V,q)}`:""].filter(Boolean).join(" "),children:T}),_?e("div",{ref:se,role:"separator","aria-orientation":"vertical","aria-label":Q.resizeSidebar,"aria-valuemin":Math.round(g(x,160)),"aria-valuemax":Math.round(g(j,480)),"aria-valuenow":Math.round(g(de,g(h[V],360))),"aria-controls":le,tabIndex:0,className:["mp-sidebar__handle absolute inset-y-0 z-1 w-2 cursor-col-resize bg-transparent","start"===H?"-me-1 end-0":"-ms-1 start-0","hover:bg-mp-outline-variant data-dragging:bg-mp-outline-variant","transition-colors duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-0","focus-visible:outline-solid outline-none"].join(" "),onPointerDown:e=>{const t=ue.current;if(!t||0!==e.button)return;const r=e.currentTarget;r.setPointerCapture(e.pointerId),r.dataset.dragging="true";const n=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const o=e.clientX,i=t.getBoundingClientRect().width,a="rtl"===getComputedStyle(t).direction,s="start"===H===a?-1:1;let l=i;const d=e=>{l=pe(i+(e.clientX-o)*s),R?.(l)},u=()=>{me.current=null,r.removeEventListener("pointermove",d),r.removeEventListener("pointerup",c),r.removeEventListener("pointercancel",c),delete r.dataset.dragging,n?document.body.style.setProperty("-webkit-user-select",n):document.body.style.removeProperty("-webkit-user-select")},c=()=>{u(),k?.(l)};me.current=u,r.addEventListener("pointermove",d),r.addEventListener("pointerup",c),r.addEventListener("pointercancel",c)},onKeyDown:e=>{if("ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.preventDefault();const t="rtl"===getComputedStyle(e.currentTarget).direction,r="start"===H===t?-1:1;(e=>{const t=ue.current;if(!t)return;const r=pe(t.getBoundingClientRect().width+e);R?.(r),k?.(r)})(("ArrowRight"===e.key?16:-16)*r)}}):null]})});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPChartCurve, MPColor, MPSize } from '../../types.js';
|
|
3
|
+
/** What the series is drawn as. */
|
|
4
|
+
export type MPSparklineShape = 'line' | 'area' | 'bar';
|
|
5
|
+
export interface MPSparklineProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* The series, oldest first. A `null` is a gap — a point nothing was measured
|
|
8
|
+
* at — and it breaks the line rather than being joined across.
|
|
9
|
+
*/
|
|
10
|
+
data: readonly (number | null)[];
|
|
11
|
+
/** @default 'line' */
|
|
12
|
+
shape?: MPSparklineShape;
|
|
13
|
+
/** How the line between two points is drawn. @default 'linear' */
|
|
14
|
+
curve?: MPChartCurve;
|
|
15
|
+
/**
|
|
16
|
+
* Marks the newest point.
|
|
17
|
+
*
|
|
18
|
+
* On by default, and it is most of what makes a sparkline readable: the whole
|
|
19
|
+
* shape is context for the last value, and without the dot a reader has to
|
|
20
|
+
* work out which end is now.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
endDot?: boolean;
|
|
24
|
+
/** The value the area or the bars are measured from. @default the series' floor */
|
|
25
|
+
baseline?: number;
|
|
26
|
+
/** Pins the bottom of the scale, so two sparklines can be compared. */
|
|
27
|
+
min?: number;
|
|
28
|
+
/** And the top. */
|
|
29
|
+
max?: number;
|
|
30
|
+
/** How wide. A number is pixels; a string is any CSS length. @default '100%' */
|
|
31
|
+
width?: number | string;
|
|
32
|
+
/** How tall. Defaults to the `size` ladder. */
|
|
33
|
+
height?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Which accent family the mark reads, or any CSS colour. Left out, it takes
|
|
36
|
+
* the first slot of the chart palette.
|
|
37
|
+
*/
|
|
38
|
+
color?: MPColor | (string & {});
|
|
39
|
+
/**
|
|
40
|
+
* What the shape says, for a reader who cannot see it.
|
|
41
|
+
*
|
|
42
|
+
* Left out, the component writes one from the numbers — how many points, the
|
|
43
|
+
* range they cover, and which way it ended. See the note on the component for
|
|
44
|
+
* why that is the whole of its accessibility rather than a hover layer.
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
/** Which language the generated label is written in. */
|
|
48
|
+
locale?: string;
|
|
49
|
+
/** @default 'md' */
|
|
50
|
+
size?: MPSize;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A series as a mark, with no axes and nothing to read a value against.
|
|
54
|
+
*
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <MPSparkline data={[12, 15, 14, 19, 22, 21, 27]} />
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* It answers one question — which way has this been going — and it answers it in
|
|
60
|
+
* the space of a word. That is the whole of its job: put it beside the number it
|
|
61
|
+
* is the history of, in a table cell, in a list row, in an
|
|
62
|
+
* [MPStatistic](statistic)'s `trend`.
|
|
63
|
+
*
|
|
64
|
+
* ## It has no hover layer, on purpose
|
|
65
|
+
*
|
|
66
|
+
* Every other chart in this library ships one, because a chart is something a
|
|
67
|
+
* reader interrogates. A sparkline is not. It is thirty pixels tall, it has no
|
|
68
|
+
* axis to read a value against, and a floating card over a mark that size covers
|
|
69
|
+
* the mark. A reader who needs the numbers needs [MPLineChart](line-chart), and
|
|
70
|
+
* a reader who needs one number has it in the figure this is sitting under.
|
|
71
|
+
*
|
|
72
|
+
* What it does have is a **sentence**. The accessible name says the shape in
|
|
73
|
+
* words — how many points, the range, and which way it ended — so the thing a
|
|
74
|
+
* sighted reader gets from the outline is a thing every reader gets. That is the
|
|
75
|
+
* relief channel, and it is a better one than a tooltip nobody can hover on a
|
|
76
|
+
* phone.
|
|
77
|
+
*
|
|
78
|
+
* ## The line is quiet and the end is not
|
|
79
|
+
*
|
|
80
|
+
* The stroke takes a faded step of its colour and the end dot takes the whole
|
|
81
|
+
* of it. The history is context; the last value is the point. Drawn at one
|
|
82
|
+
* weight throughout, a sparkline is a shape with no emphasis in it, and the eye
|
|
83
|
+
* has to find the end for itself.
|
|
84
|
+
*/
|
|
85
|
+
export declare const MPSparkline: React.ForwardRefExoticComponent<MPSparklineProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as n from"react";import{useMPLocale as i,useMPMessages as l}from"../../internal/locale.js";import{useMPSize as o}from"../../internal/config.js";import{fillMessage as a}from"../../internal/i18n.js";import{SPARKLINE as s}from"../../internal/messages/sparkline.js";import{TABLE as m}from"../../internal/messages/table.js";import{cssLength as c}from"../../internal/length.js";import{areaPath as p,barPath as f,extentOf as h,linePath as u,seriesColor as d}from"../../internal/chart.js";const g={xs:16,sm:24,md:32,lg:44,xl:56},b={xs:1.25,sm:1.5,md:2,lg:2.5,xl:3};export const MPSparkline=/*@__PURE__*/n.forwardRef(function({data:k,shape:x="line",curve:y="linear",endDot:j=!0,baseline:v,min:w,max:M,width:N="100%",height:F,color:L,label:$,locale:z,size:B,className:E,style:R,...W},A){const D=o(B),I=i(z),P=l(s,I),S=l(m,I),q=F??g[D],C=b[D],G=d(0,L),H=100,J=q,K="bar"===x?0:C/2,O=h(k,w,M),Q=O.max-O.min,T=e=>J-K-(e-O.min)/Q*(J-2*K),U=k.length>1?H/(k.length-1):0,V=k.map((e,t)=>null!==e&&Number.isFinite(e)?{x:k.length>1?t*U:50,y:T(e)}:null),X=v??O.min,Y=[...V].reverse().find(e=>null!==e)??null,Z=n.useMemo(()=>{if(void 0!==$)return $;const e=k.filter(e=>null!==e&&Number.isFinite(e));if(0===e.length)return S.empty;const t=new Intl.NumberFormat(I);return a(P.summary,{count:t.format(e.length),first:t.format(e[0]),last:t.format(e[e.length-1])})},[$,k,I,P.summary,S.empty]);return e("div",{ref:A,"data-mp-size":D,className:["mp-sparkline block",E??""].filter(Boolean).join(" "),style:{width:c(N),...R},...W,children:r("svg",{role:"img","aria-label":Z,viewBox:`0 0 100 ${J}`,preserveAspectRatio:"none",width:"100%",height:q,style:{display:"block",overflow:"visible"},children:["bar"===x?k.map((t,r)=>{if(null===t||!Number.isFinite(t))return null;const n=H/k.length,i=Math.max(.5,n-2),l=T(X),o=T(t);return e("path",{d:f(r*n+(n-i)/2,Math.min(o,l),i,Math.abs(l-o),i/3,t>=X?"top":"bottom"),fill:G,opacity:j&&r===k.length-1?1:.55},r)}):r(t,{children:["area"===x?e("path",{d:p(V,T(X),y),fill:G,opacity:.16}):null,e("path",{d:u(V,y),fill:"none",stroke:G,strokeWidth:C,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",opacity:.55})]}),j&&Y&&"bar"!==x?e("path",{d:`M${Y.x} ${Y.y}h0`,stroke:G,strokeWidth:2.5*C,strokeLinecap:"round",vectorEffect:"non-scaling-stroke"}):null]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPSparkline}from"./MPSparkline.js";
|
|
@@ -102,5 +102,17 @@ export interface MPSpoilerProps extends Omit<React.ComponentPropsWithoutRef<'div
|
|
|
102
102
|
* three matter: a spoiler that can be defeated by Ctrl-A is not a spoiler, and
|
|
103
103
|
* `aria-hidden` alone would leave a keyboard reader tabbing into a link their
|
|
104
104
|
* screen reader has been told is not there.
|
|
105
|
+
*
|
|
106
|
+
* ## The box holds still
|
|
107
|
+
*
|
|
108
|
+
* Two separate things were moving it, and both of them are the same mistake in
|
|
109
|
+
* different clothes: something that is drawn in one state and not in the other,
|
|
110
|
+
* without the state that lacks it paying for the space.
|
|
111
|
+
*
|
|
112
|
+
* A `reversible` sheet's way back out is **reserved** rather than mounted on
|
|
113
|
+
* reveal, so pressing the button does not push the rest of the page down by the
|
|
114
|
+
* height of the row that replaces it. And the cover is a **grid item** rather
|
|
115
|
+
* than an `absolute` box, so a cover taller than what it covers makes the sheet
|
|
116
|
+
* taller instead of being cut off by it.
|
|
105
117
|
*/
|
|
106
118
|
export declare const MPSpoiler: React.ForwardRefExoticComponent<MPSpoilerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{MPButton as
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as o from"react";import{MPButton as a}from"../button/MPButton.js";import{inertProps as i}from"../../internal/inert.js";import{useMPLocale as t,useMPMessages as n}from"../../internal/locale.js";import{SPOILER as l}from"../../internal/messages/spoiler.js";import{hasContent as s,META_TEXT as d,SHEET_PAD as c,SHEET_PAD_X as m,SHEET_PAD_Y as p}from"../../internal/scale.js";import{CONTAINER_SURFACE as f}from"../../internal/surface.js";import{useMPColor as u,useMPSize as v}from"../../internal/config.js";const x="[background-color:color-mix(in_oklab,var(--_mp-color-surface)_55%,transparent)]";export const MPSpoiler=/*@__PURE__*/o.forwardRef(function({revealed:h,defaultRevealed:j=!1,onRevealedChange:b,locale:g,label:w,hideLabel:N,description:z,action:k,reversible:y=!1,maxHeight:B,blur:_=10,padded:C=!0,variant:R="outlined",size:H,color:M,className:P,children:S,...$},I){const L=v(H),q=u(M),A=t(g),D=n(l,A),E=o.useId(),[F,G]=o.useState(j),J=h??F,K=e=>{void 0===h&&G(e),b?.(e)},O=!1===z?null:z??D.notice;return r("div",{ref:I,"data-mp-size":L,"data-mp-variant":R,"data-mp-revealed":J||void 0,className:["mp-spoiler rounded-mp-md relative isolate overflow-hidden","box-border","grid grid-cols-1",y?"grid-rows-[auto_auto]":"grid-rows-[auto]",f[R],"text-mp-on-surface",P??""].filter(Boolean).join(" "),...$,children:[e("div",{id:E,className:["col-start-1 row-start-1 min-w-0",C?c[L]:"","transition-[filter] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",J?"":"select-none"].filter(Boolean).join(" "),style:{filter:J?void 0:`blur(${_}px)`,maxHeight:J?void 0:B,overflow:J?void 0:"hidden"},...i(!J),children:S}),J?null:r("div",{className:["col-span-full row-span-full z-10","flex flex-col items-center justify-center gap-2 text-center",c[L],x].join(" "),children:[s(O)?e("p",{className:`text-mp-on-surface-variant m-0 ${d}`,children:O}):null,k??e(a,{variant:"tonal",size:L,color:q,onClick:()=>K(!0),"aria-expanded":!1,"aria-controls":E,children:w??D.reveal})]}),y?e("div",{className:["col-start-1 row-start-2 flex justify-end",m[L],p[L],"pt-0",J?"":"invisible"].filter(Boolean).join(" "),...i(!J),children:e(a,{variant:"text",size:L,color:q,onClick:()=>K(!1),"aria-expanded":!0,"aria-controls":E,children:N??D.hide})}):null]})});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAnimateTimeline, MPAnimateTrigger, MPAnimation, MPEasing, MPSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Which way the pile grows.
|
|
5
|
+
*
|
|
6
|
+
* `diagonal` is a **horizontal** flow with a per-item vertical offset, not a
|
|
7
|
+
* flow of its own: see the note on `drop` for why the second axis cannot be
|
|
8
|
+
* left to the layout.
|
|
9
|
+
*/
|
|
10
|
+
export type MPStackDirection = 'horizontal' | 'vertical' | 'diagonal';
|
|
11
|
+
/** Which end of the pile is nearest the reader. */
|
|
12
|
+
export type MPStackFront = 'first' | 'last';
|
|
13
|
+
export interface MPStackProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
14
|
+
/**
|
|
15
|
+
* Which way the pile grows.
|
|
16
|
+
* @default 'horizontal'
|
|
17
|
+
*/
|
|
18
|
+
direction?: MPStackDirection;
|
|
19
|
+
/**
|
|
20
|
+
* How far each item sits under the one before it, along the axis the pile
|
|
21
|
+
* flows on — a number in pixels, or any CSS length. Left out it is a fraction
|
|
22
|
+
* of `size`.
|
|
23
|
+
*/
|
|
24
|
+
overlap?: number | string;
|
|
25
|
+
/**
|
|
26
|
+
* How far each item sits below the one before it on `diagonal`, which is the
|
|
27
|
+
* axis the flow is **not** on. Defaults to `overlap`, which is a shallow fan.
|
|
28
|
+
*
|
|
29
|
+
* It is a prop rather than an angle because a true 45° would need the items'
|
|
30
|
+
* own width, and a library does not have it: the horizontal advance is
|
|
31
|
+
* `width − overlap`, and `width` is whatever the caller put in. Nothing here
|
|
32
|
+
* pretends otherwise.
|
|
33
|
+
*/
|
|
34
|
+
drop?: number | string;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the default `overlap`, and nothing else. It is not passed to the
|
|
37
|
+
* items — a `Stack` does not know what they are.
|
|
38
|
+
* @default 'md'
|
|
39
|
+
*/
|
|
40
|
+
size?: MPSize;
|
|
41
|
+
/** How many items are drawn before the rest become an `overflow`. */
|
|
42
|
+
max?: number;
|
|
43
|
+
/**
|
|
44
|
+
* How many there are altogether, when the stack was handed only the first few.
|
|
45
|
+
* Without it the count is worked out from the children, which is right only
|
|
46
|
+
* when all of them were passed.
|
|
47
|
+
*/
|
|
48
|
+
total?: number;
|
|
49
|
+
/**
|
|
50
|
+
* The last item in the pile, built from the number that did not fit.
|
|
51
|
+
*
|
|
52
|
+
* A **function** rather than a node, because the count is the whole of what
|
|
53
|
+
* that item has to say: `(hidden) => <MPAvatar initials={`+${hidden}`} />`.
|
|
54
|
+
* Left out, nothing is drawn for the remainder.
|
|
55
|
+
*/
|
|
56
|
+
overflow?: (hidden: number) => React.ReactNode;
|
|
57
|
+
/**
|
|
58
|
+
* Which end of the pile is nearest the reader.
|
|
59
|
+
* @default 'first'
|
|
60
|
+
*/
|
|
61
|
+
front?: MPStackFront;
|
|
62
|
+
/**
|
|
63
|
+
* What each item is scaled by relative to the one in front of it. `1` is no
|
|
64
|
+
* change; `0.94` puts the fifth card at about three quarters.
|
|
65
|
+
*
|
|
66
|
+
* It changes what is drawn and not what is measured, so the spacing of the
|
|
67
|
+
* pile is the same either way — a scaled card does not pull the ones behind
|
|
68
|
+
* it closer.
|
|
69
|
+
* @default 1
|
|
70
|
+
*/
|
|
71
|
+
scaleStep?: number;
|
|
72
|
+
/**
|
|
73
|
+
* The same, for opacity. `0.85` fades a deck into the page behind it.
|
|
74
|
+
* @default 1
|
|
75
|
+
*/
|
|
76
|
+
opacityStep?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Draws a hairline of the page's own `surface` around each item, so two
|
|
79
|
+
* shapes of similar tone have an edge between them.
|
|
80
|
+
*
|
|
81
|
+
* On the **item** rather than on the wrapper around it, because a ring has to
|
|
82
|
+
* follow the shape it is tracing and a square ring around a circular avatar
|
|
83
|
+
* is worse than none. That is a fixed-depth selector, so it reaches a child
|
|
84
|
+
* this stack put there and not one wrapped in something else — see the
|
|
85
|
+
* component's documentation.
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
ring?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* An entrance for each item, from the same six the `MPAnimate*` components
|
|
91
|
+
* run. Left out, nothing is animated.
|
|
92
|
+
*/
|
|
93
|
+
transition?: MPAnimation;
|
|
94
|
+
/** How long one item's entrance takes, in milliseconds. */
|
|
95
|
+
duration?: number;
|
|
96
|
+
/** How long before the first one starts, in milliseconds. */
|
|
97
|
+
delay?: number;
|
|
98
|
+
/** Which Material easing curve the entrance runs on. */
|
|
99
|
+
easing?: MPEasing;
|
|
100
|
+
/**
|
|
101
|
+
* How long after one item the next one starts, in milliseconds.
|
|
102
|
+
* @default 60
|
|
103
|
+
*/
|
|
104
|
+
stagger?: number;
|
|
105
|
+
/** How much longer each item takes than the one before it, in milliseconds. */
|
|
106
|
+
durationStep?: number;
|
|
107
|
+
/** Deals the pile from the back. */
|
|
108
|
+
reverse?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* What starts the entrance.
|
|
111
|
+
* @default 'mount'
|
|
112
|
+
*/
|
|
113
|
+
trigger?: MPAnimateTrigger;
|
|
114
|
+
/** Runs it, when `trigger` is `manual`. */
|
|
115
|
+
play?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* With `trigger="visible"`, whether it runs only the first time.
|
|
118
|
+
* @default true
|
|
119
|
+
*/
|
|
120
|
+
once?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* With `trigger="visible"`, how much has to be on screen to count.
|
|
123
|
+
* @default 0.2
|
|
124
|
+
*/
|
|
125
|
+
threshold?: number;
|
|
126
|
+
/** Holds the entrance where it is. */
|
|
127
|
+
paused?: boolean;
|
|
128
|
+
/** Hands the entrance to the reader's scrolling. */
|
|
129
|
+
timeline?: MPAnimateTimeline;
|
|
130
|
+
/** Which part of the travel through the scrollport the entrance covers. */
|
|
131
|
+
range?: string;
|
|
132
|
+
/** The things in the pile. */
|
|
133
|
+
children?: React.ReactNode;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Things laid over each other in a pile.
|
|
137
|
+
*
|
|
138
|
+
* A stack of avatars, a deck of cards, a heap of documents, a run of overlapped
|
|
139
|
+
* thumbnails: one component, because "several of these, overlapping" is one
|
|
140
|
+
* idea and the things being overlapped are not this component's business.
|
|
141
|
+
*
|
|
142
|
+
* ## Why the overlap is a margin and not a `translate`
|
|
143
|
+
*
|
|
144
|
+
* This is the detail nearly every implementation of this gets wrong. Move the
|
|
145
|
+
* items with `translate` and each one still **occupies its full width**: the
|
|
146
|
+
* box stays the size of one item plus the full width of all the others, the
|
|
147
|
+
* pile is drawn outside it, and everything after the stack on the page is laid
|
|
148
|
+
* out against a measurement that is wrong. It cannot go in a sentence.
|
|
149
|
+
*
|
|
150
|
+
* A negative margin takes the space back, so the box is exactly the size of
|
|
151
|
+
* what is drawn. At 32px items with a 10px overlap, five of them come to
|
|
152
|
+
* 120×32 horizontally, 32×120 vertically and 120×72 on the diagonal — the box
|
|
153
|
+
* fits the content in all three.
|
|
154
|
+
*
|
|
155
|
+
* The margin is **logical**, so a horizontal pile overlaps the other way under
|
|
156
|
+
* RTL without being asked to.
|
|
157
|
+
*
|
|
158
|
+
* ## Why `diagonal` is a horizontal flow
|
|
159
|
+
*
|
|
160
|
+
* Because a flow only overlaps items on the axis it flows along. The other axis
|
|
161
|
+
* has to be written per item, as a margin multiplied by the item's index — a
|
|
162
|
+
* fixed `margin-block-start` in a row does not accumulate, it puts every item
|
|
163
|
+
* at the same offset and the fan does not happen.
|
|
164
|
+
*
|
|
165
|
+
* ## What it does not do
|
|
166
|
+
*
|
|
167
|
+
* It does not know what the items **are**, which is the price of being general.
|
|
168
|
+
* There is no `variant`, no `color` and no `shape` to set once for the pile:
|
|
169
|
+
* `size` here picks the default overlap and is not passed on. Set the ones your
|
|
170
|
+
* items share on [MPConfigProvider](../../guide/config), and the rest per item.
|
|
171
|
+
*
|
|
172
|
+
* ## Two layers per item, and why
|
|
173
|
+
*
|
|
174
|
+
* Each item is wrapped twice. The outer span carries the offset, the `z-index`
|
|
175
|
+
* and the entrance; the inner one carries the static `scale` and `opacity` that
|
|
176
|
+
* make depth. They are separate because the `grow` and `zoom` keyframes
|
|
177
|
+
* animate the individual `scale` property — an animation and a resting depth on
|
|
178
|
+
* the same element means the keyframe wins and the depth is gone the moment
|
|
179
|
+
* something is animated.
|
|
180
|
+
*
|
|
181
|
+
* The wrappers are also what keeps this off the children. Cloning them to add a
|
|
182
|
+
* `className` would require every child to accept one, and a face wrapped in a
|
|
183
|
+
* router's link or a tooltip trigger has no obligation to.
|
|
184
|
+
*
|
|
185
|
+
* `ring` is the one exception, and it is honest about the cost: it is a
|
|
186
|
+
* fixed-depth descendant selector, so it lands on the element this stack
|
|
187
|
+
* wrapped. A child that is itself a wrapper gets the ring on the wrapper.
|
|
188
|
+
*
|
|
189
|
+
* ## What `transition` costs
|
|
190
|
+
*
|
|
191
|
+
* 2.1 kB gzipped against the 0.9 kB the layout alone would come to, because it
|
|
192
|
+
* reads the same effect tables `MPAnimateFade` does. It is here rather than
|
|
193
|
+
* composed from outside because the items are inside wrappers this component
|
|
194
|
+
* builds and nothing outside can reach them — but a stack of four faces with no
|
|
195
|
+
* `transition` is paying for six effects it will never run, and that is written
|
|
196
|
+
* into the documentation rather than left to be found.
|
|
197
|
+
*/
|
|
198
|
+
export declare const MPStack: React.ForwardRefExoticComponent<MPStackProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as t from"react";import{ANIMATION_CLASS as a,ANIM_BASE as r,animationSlots as i,useAnimationRun as n}from"../../internal/animate.js";import{lengthValue as l}from"../../internal/animate.js";import{useMPSize as o}from"../../internal/config.js";const s={xs:"0.625rem",sm:"0.75rem",md:"1.125rem",lg:"1.25rem",xl:"1.5rem"};export const MPStack=/*@__PURE__*/t.forwardRef(function({direction:c="horizontal",overlap:m,drop:d,size:p,max:f,total:g,overflow:h,front:u="first",scaleStep:v=1,opacityStep:y=1,ring:x=!1,transition:S,duration:k,delay:j=0,easing:$,stagger:w=60,durationStep:z=0,reverse:N=!1,trigger:B="mount",play:M,once:_=!0,threshold:I=.2,paused:b,timeline:A,range:C,className:E,style:O,children:P,...R},V){const q=o(p),D=n({trigger:B,play:M,once:_,threshold:I,paused:b,infinite:!1}),F="view"===A?b?"paused":"running":D.state,G=t.Children.toArray(P),H=void 0===f?G:G.slice(0,Math.max(0,f)),J=g??G.length,K=Math.max(0,J-H.length),L=h&&K>0?h(K):null,Q=null===L?H:[...H,L],T=void 0===m?s[q]:l(m),U=void 0===d?T:l(d),W="vertical"===c?"flex-col":"flex-row",X=S?`${r} ${a[S]}`:"";return e("div",{ref:e=>{D.ref(e),"function"==typeof V?V(e):V&&(V.current=e)},"data-mp-size":q,"data-mp-direction":c,className:["mp-stack isolate inline-flex align-middle",W,"diagonal"===c?"items-start":"items-center",x?"ring-mp-surface [&>*>*>*]:ring-2":"",E??""].filter(Boolean).join(" "),style:{"--_mp-anim-state":F,...O},...D.handlers,...R,children:Q.map((a,r)=>{const n=N?Q.length-1-r:r,l="first"===u?r:Q.length-1-r;return e("span",{className:X,style:{zIndex:"first"===u?Q.length-r:r+1,...r>0&&"vertical"===c?{marginBlockStart:`calc(${T} * -1)`}:{},...r>0&&"vertical"!==c?{marginInlineStart:`calc(${T} * -1)`}:{},..."diagonal"===c?{marginBlockStart:`calc(${U} * ${r})`}:{},...S?i({effect:S,duration:k,delay:j+n*w,easing:$,repeat:1,durationOffset:n*z,timeline:A,range:C}):{}},children:e("span",{className:"mp-stack__item block",style:{scale:1===v?void 0:String(v**l),opacity:1===y?void 0:y**l},children:a})},t.isValidElement(a)?a.key??r:r)})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPStack}from"./MPStack.js";
|