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,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{VISUALLY_HIDDEN as a}from"./visually-hidden.js";import{cssLength as r}from"./length.js";import{PLOT_HEIGHT as i,formatCategory as s}from"./chart.js";export function useVisibility(e){const[t,l]=n.useState(()=>{const t=new Set;return e.forEach((e,l)=>{e.hidden&&t.add(l)}),t}),[a,r]=n.useState(null),i=n.useCallback(e=>{l(t=>{const l=new Set(t);return l.has(e)?l.delete(e):l.add(e),l})},[]);return{visible:e.map((e,l)=>!t.has(l)),hovered:a,toggle:i,setHovered:r}}export const LEGEND_SIDE={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"};const o={start:"justify-start",center:"justify-center",end:"justify-end"};export function ChartLegend({names:n,colors:a,options:r,visibility:i,size:s,values:c,swatch:m}){const d=!1!==r.interactive,u="xs"===s||"sm"===s?"text-mp-label-small":"text-mp-label-medium";return e("ul",{className:["mp-chart__legend flex flex-wrap items-center gap-x-4 gap-y-1",o[r.align??"center"],u].join(" "),children:n.map((n,r)=>{const s=i.visible[r],o=!s||null!==i.hovered&&i.hovered!==r,u=n??`${r+1}`,p=l(t,{children:[e("span",{className:"shrink-0","aria-hidden":"true",children:m?m(r,a[r]):e("span",{className:"block size-2.5 rounded-mp-full",style:{background:a[r]}})}),e("span",{className:"text-mp-on-surface-variant truncate",children:u}),c?.[r]?e("span",{className:"text-mp-on-surface tabular-nums",children:c[r]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>i.toggle(r),onPointerEnter:()=>i.setHovered(r),onPointerLeave:()=>i.setHovered(null),onFocus:()=>i.setHovered(r),onBlur:()=>i.setHovered(null),className:["flex min-w-0 cursor-pointer items-center gap-1.5 rounded-mp-xs","focus-visible:outline-mp-primary focus-visible:outline-2 focus-visible:outline-offset-2",o?"opacity-40":"",s?"":"line-through"].filter(Boolean).join(" "),children:p}):e("span",{className:"flex min-w-0 items-center gap-1.5 "+(o?"opacity-40":""),children:p})},r)})})}export function ChartTooltipPanel({heading:t,items:n,x:a,y:r,flip:i,size:s}){return l("div",{"aria-hidden":"true",className:["mp-chart__tooltip pointer-events-none absolute z-10 min-w-24 max-w-64","bg-mp-surface-container-high shadow-mp-2 rounded-mp-xs px-2.5 py-2","xs"===s||"sm"===s?"text-mp-label-small":"text-mp-label-medium"].join(" "),style:{left:a,top:r,transform:`translate(${i?"calc(-100% - 12px)":"12px"}, -50%)`},children:[null==t||""===t?null:e("div",{className:"text-mp-on-surface-variant mb-1 truncate",children:t}),e("ul",{className:"flex flex-col gap-0.5",children:n.map(t=>l("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"block size-2 shrink-0 rounded-mp-full",style:{background:t.color}}),t.name?e("span",{className:"text-mp-on-surface-variant min-w-0 truncate",children:t.name}):null,e("span",{className:"text-mp-on-surface ms-auto ps-2 tabular-nums",children:t.label??t.formatted})]},t.seriesIndex))})]})}export function ChartStatus({heading:r,items:i}){return e("span",{role:"status","aria-live":"polite",className:a,children:0===i.length?null:l(t,{children:[null==r||""===r?null:l(t,{children:[r,", "]}),i.map((e,t)=>l(n.Fragment,{children:[t>0?", ":null,e.name?`${e.name}: `:null,e.label??e.formatted]},e.seriesIndex))]})})}export function ChartTable({id:t,caption:n,corner:r,categories:i,names:o,values:c,format:m,locale:d,empty:u}){return e("div",{id:t,className:a,children:l("table",{children:[e("caption",{children:n}),e("thead",{children:l("tr",{children:[e("th",{scope:"col",children:r}),o.map((t,l)=>e("th",{scope:"col",children:t??l+1},l))]})}),e("tbody",{children:0===i.length?e("tr",{children:e("td",{colSpan:o.length+1,children:u})}):i.map((t,n)=>l("tr",{children:[e("th",{scope:"row",children:s(t,d)}),o.map((t,l)=>{const a=c[l]?.[n];return e("td",{children:a?.label??(null===a?.value||void 0===a?u:m(a.value))},l)})]},n))})]})})}export function ChartShell({size:t,plotRef:n,name:a,describedBy:s,interactive:o,height:c,plotProps:m,children:d,tooltip:u,legend:p,legendSide:h="bottom",status:f,table:x,className:v,...b}){return l("div",{"data-mp-size":t,className:["mp-chart flex min-w-0 flex-col gap-3",v??""].filter(Boolean).join(" "),...b,children:[l("div",{className:`flex min-w-0 gap-3 ${LEGEND_SIDE[h]}`,children:[l("div",{ref:n,role:"img",tabIndex:o?0:void 0,"aria-label":a,"aria-describedby":s,...m,className:["mp-chart__plot rounded-mp-xs relative min-w-0 flex-1","focus-visible:outline-mp-primary focus-visible:outline-2 focus-visible:outline-offset-2"].join(" "),style:{height:r(c)??i[t]},children:[d,u]}),p]}),e(ChartStatus,{heading:f.heading,items:f.items}),x]})}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartBaseProps } from './ChartChrome.js';
|
|
3
|
+
import { BandScale, ChartValue, PlotBox, ValueScale } from './chart.js';
|
|
4
|
+
import type { MPChartAxis, MPChartCategory, MPChartSeries, MPChartTooltipItem, MPSize } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The frame a chart with two axes is drawn in.
|
|
7
|
+
*
|
|
8
|
+
* The plot box once the axes have taken their bands, the value scale, the band
|
|
9
|
+
* scale, the grid and the crosshair — everything that is identical on a line
|
|
10
|
+
* chart and a bar chart. What is left for a chart to do is its marks, and it is
|
|
11
|
+
* handed **pixels** to draw them at: a component that had to know which way
|
|
12
|
+
* round the axes run is a component that gets it wrong when somebody turns it
|
|
13
|
+
* sideways.
|
|
14
|
+
*
|
|
15
|
+
* The parts a chart with no axes also needs — the legend, the hover panel, the
|
|
16
|
+
* spoken readout, the table and the arrangement holding them — are in
|
|
17
|
+
* `ChartChrome.tsx`, so a pie chart can have them without carrying any of this.
|
|
18
|
+
*/
|
|
19
|
+
/** What a chart with two axes adds. */
|
|
20
|
+
export interface CartesianChartProps extends ChartBaseProps {
|
|
21
|
+
/** The series, in the order their colours are handed out. */
|
|
22
|
+
series: readonly MPChartSeries[];
|
|
23
|
+
/** The category axis' labels. Points may carry their own `x` instead. */
|
|
24
|
+
categories?: readonly MPChartCategory[];
|
|
25
|
+
/** The category axis. */
|
|
26
|
+
xAxis?: MPChartAxis;
|
|
27
|
+
/** The value axis. */
|
|
28
|
+
yAxis?: MPChartAxis;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* One mark on a plot whose marks are not arranged in columns.
|
|
32
|
+
*
|
|
33
|
+
* A scatter has no shared categories, so there is no column for a pointer to be
|
|
34
|
+
* inside and nothing for a crosshair to be dropped through — the only question
|
|
35
|
+
* a reader can be asking is "which of these dots". A chart that says so hands
|
|
36
|
+
* the frame its marks and gets the nearest-mark search, the arrow keys and the
|
|
37
|
+
* panel's anchoring for free.
|
|
38
|
+
*/
|
|
39
|
+
export interface ChartMark {
|
|
40
|
+
/** Its series' place in the array as it was passed — where its colour is from. */
|
|
41
|
+
series: number;
|
|
42
|
+
/** Its own place within that series. */
|
|
43
|
+
index: number;
|
|
44
|
+
/** Its centre, in pixels from the chart's top-left. */
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
/** How big it is. Widens the hit target, so a bubble is easier to hit than a dot. */
|
|
48
|
+
r: number;
|
|
49
|
+
/**
|
|
50
|
+
* Its half-width and half-height, where the mark is a box rather than a disc.
|
|
51
|
+
*
|
|
52
|
+
* A span on a timeline is two hundred pixels of bar whose centre a pointer may
|
|
53
|
+
* never go near, so measuring to that centre would hand the row's short bar a
|
|
54
|
+
* hover the reader is plainly not making. Given these, the pointer is tested
|
|
55
|
+
* against the mark's **body**.
|
|
56
|
+
*/
|
|
57
|
+
rx?: number;
|
|
58
|
+
ry?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Where everything goes — the half of the context settled before the pointer is
|
|
62
|
+
* consulted.
|
|
63
|
+
*
|
|
64
|
+
* Split out because the marks are built from it: a chart hands the frame a
|
|
65
|
+
* builder, the frame runs it on the layout, and only then is there a list for
|
|
66
|
+
* the pointer to be nearest to. A builder that could read what is active would
|
|
67
|
+
* be reading a value that does not exist yet.
|
|
68
|
+
*/
|
|
69
|
+
export interface CartesianLayout {
|
|
70
|
+
plot: PlotBox;
|
|
71
|
+
/** Every series unpacked, in the order it was passed. */
|
|
72
|
+
values: readonly (readonly ChartValue[])[];
|
|
73
|
+
/** Which of them are drawn. */
|
|
74
|
+
visible: readonly boolean[];
|
|
75
|
+
/** And what colour each one is, by its original index. */
|
|
76
|
+
colors: readonly string[];
|
|
77
|
+
scale: ValueScale;
|
|
78
|
+
band: BandScale;
|
|
79
|
+
/** Bars run along the category axis rather than across it. */
|
|
80
|
+
horizontal: boolean;
|
|
81
|
+
/** Where a value sits along the value axis, in pixels from the chart's edge. */
|
|
82
|
+
valuePx: (value: number) => number;
|
|
83
|
+
/** Where a category's centre sits along the category axis, as an offset along it. */
|
|
84
|
+
categoryPx: (index: number) => number;
|
|
85
|
+
/** The two combined, whichever way round the chart runs. */
|
|
86
|
+
point: (index: number, value: number) => {
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The scale the **category** axis runs on, where `xScale` made it a second
|
|
92
|
+
* value axis. `null` on every chart whose categories are columns.
|
|
93
|
+
*/
|
|
94
|
+
categoryScale: ValueScale | null;
|
|
95
|
+
/**
|
|
96
|
+
* Where a value sits along the category axis, in pixels from the chart's
|
|
97
|
+
* edge — the same absolute reckoning `valuePx` uses, and deliberately not
|
|
98
|
+
* `categoryPx`'s offset-along-the-axis. Only meaningful with `xScale="value"`.
|
|
99
|
+
*/
|
|
100
|
+
categoryValuePx: (value: number) => number;
|
|
101
|
+
/** Where the baseline sits along the value axis. */
|
|
102
|
+
zeroPx: number;
|
|
103
|
+
categories: readonly MPChartCategory[];
|
|
104
|
+
format: (value: number) => string;
|
|
105
|
+
size: MPSize;
|
|
106
|
+
}
|
|
107
|
+
/** The layout, plus everything the pointer decides. */
|
|
108
|
+
export interface CartesianContext extends CartesianLayout {
|
|
109
|
+
/** The series the legend is being hovered over, if any. */
|
|
110
|
+
hovered: number | null;
|
|
111
|
+
/** The category under the pointer, if any. */
|
|
112
|
+
activeIndex: number | null;
|
|
113
|
+
/** Every mark, where the chart supplied a builder. Empty otherwise. */
|
|
114
|
+
marks: readonly ChartMark[];
|
|
115
|
+
/** The one the pointer is on, or the one the arrow keys walked to. */
|
|
116
|
+
activeMark: ChartMark | null;
|
|
117
|
+
}
|
|
118
|
+
interface CartesianFrameProps extends CartesianChartProps {
|
|
119
|
+
/**
|
|
120
|
+
* Makes the category axis a second **value** axis instead of a row of
|
|
121
|
+
* columns. What a scatter needs and what nothing else does.
|
|
122
|
+
* @default 'band'
|
|
123
|
+
*/
|
|
124
|
+
xScale?: 'band' | 'value';
|
|
125
|
+
/**
|
|
126
|
+
* Builds every mark on the plot, which swaps the frame's column hit-testing
|
|
127
|
+
* for a nearest-mark search and makes the arrow keys walk this list. The
|
|
128
|
+
* result comes back on the context, so the marks are laid out once and drawn
|
|
129
|
+
* from the same array they are tested against.
|
|
130
|
+
*/
|
|
131
|
+
marks?: (layout: CartesianLayout) => readonly ChartMark[];
|
|
132
|
+
/**
|
|
133
|
+
* How far off a mark the pointer still counts as on it, in pixels, added to
|
|
134
|
+
* the mark's own radius. An 8px dot is not a hit target.
|
|
135
|
+
* @default 24
|
|
136
|
+
*/
|
|
137
|
+
markRadius?: number;
|
|
138
|
+
/** The legend's swatch, where a chart's marks are not all the same shape. */
|
|
139
|
+
swatch?: (index: number, color: string) => React.ReactNode;
|
|
140
|
+
/**
|
|
141
|
+
* The value axis' scale, already worked out.
|
|
142
|
+
*
|
|
143
|
+
* For an axis that is not a count. `valueScale` rounds to 1-2-5-10, which is
|
|
144
|
+
* the family a reader does arithmetic in and exactly the wrong one for an
|
|
145
|
+
* instant — sixty, twenty-four, seven, twelve. A chart whose axis has its own
|
|
146
|
+
* arithmetic builds the scale itself and hands it over.
|
|
147
|
+
*/
|
|
148
|
+
scale?: ValueScale;
|
|
149
|
+
/**
|
|
150
|
+
* The table behind the picture, for a chart whose data are not a grid of
|
|
151
|
+
* series against categories.
|
|
152
|
+
*
|
|
153
|
+
* The default one is right wherever the marks *are* that grid, and useless
|
|
154
|
+
* where they are not: a timeline's rows are the category axis and its marks
|
|
155
|
+
* are spans within them, so the frame has no cell to look an answer up in.
|
|
156
|
+
*/
|
|
157
|
+
table?: (id: string) => React.ReactNode;
|
|
158
|
+
/** What the panel says about a mark whose value is not a cell of the grid. */
|
|
159
|
+
markTooltip?: (mark: ChartMark) => {
|
|
160
|
+
heading: React.ReactNode;
|
|
161
|
+
items: readonly MPChartTooltipItem[];
|
|
162
|
+
} | null;
|
|
163
|
+
/** Bars, and only bars, run the other way. */
|
|
164
|
+
horizontal?: boolean;
|
|
165
|
+
/** The value axis measures totals rather than parts. */
|
|
166
|
+
stacked?: boolean;
|
|
167
|
+
/** A line chart may leave zero out; a bar chart may not. */
|
|
168
|
+
includeZero?: boolean;
|
|
169
|
+
/** How much of a band the marks take. Bars need room reserved; lines do not. */
|
|
170
|
+
bandRatio?: number;
|
|
171
|
+
/**
|
|
172
|
+
* Lines and areas sit **on** the category ticks; bars sit **between** them.
|
|
173
|
+
* The difference is one half-step, and getting it wrong is what leaves a line
|
|
174
|
+
* chart's first point floating a centimetre off the axis.
|
|
175
|
+
*/
|
|
176
|
+
inset?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Extra room at the **far end of the value axis**, for labels that ride the
|
|
179
|
+
* marks. The top of the plot on an upright chart and its right-hand edge on a
|
|
180
|
+
* horizontal one — a value label sits past the end of the mark, and which
|
|
181
|
+
* edge that is turns with the chart.
|
|
182
|
+
*/
|
|
183
|
+
headroom?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Room on **every** side, for marks drawn from their centre. `headroom` is
|
|
186
|
+
* not enough for those: a dot at the largest x hangs over the right edge and
|
|
187
|
+
* one at the smallest hangs over the value axis' own labels.
|
|
188
|
+
*/
|
|
189
|
+
markInset?: number;
|
|
190
|
+
/** Draws the marks. */
|
|
191
|
+
children: (context: CartesianContext) => React.ReactNode;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The frame: two axes, a grid, a crosshair, a legend, a panel and the table.
|
|
195
|
+
*/
|
|
196
|
+
export declare function CartesianFrame({ series, categories, xAxis, yAxis, horizontal, stacked, includeZero, bandRatio, inset, headroom, markInset, xScale, marks, markRadius, swatch, scale: givenScale, table: givenTable, markTooltip, height, format, locale: localeProp, label, legend, tooltip, empty, size: sizeProp, className, style, children, ...rest }: CartesianFrameProps): React.JSX.Element;
|
|
197
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{useMPElementSize as i}from"../hooks/useMPElementSize.js";import{useMPLocale as a,useMPMessages as n}from"./locale.js";import{useMPSize as o}from"./config.js";import{CHART as r}from"./messages/chart.js";import{TABLE as s}from"./messages/table.js";import{ChartLegend as h,ChartShell as c,ChartTable as d,ChartTooltipPanel as u,useVisibility as m}from"./ChartChrome.js";import{CHART_FONT_SIZE as x,MARKER_RADIUS as f,PLOT_HEIGHT as p,bandScale as g,categoryAt as y,categoryCount as v,categoryExtent as k,fitsLast as b,formatCategory as M,formatStatistic as w,seriesColor as z,seriesExtent as S,showsTick as P,textWidth as A,tickStride as C,toValues as j,truncate as B,valueScale as $}from"./chart.js";const R=[],W="var(--_mp-color-outline-variant)",F="var(--_mp-color-outline)",N="var(--_mp-color-on-surface-variant)";function T({plot:l,scale:i,horizontal:a,categoryPx:n,categoryScale:o,categoryValuePx:r,valuePx:s,tickTexts:h,categoryTexts:c,valueAxis:d,categoryAxis:u,fontSize:m,zeroPx:x}){const f=!1!==d?.grid&&!d?.hidden,p=!u?.hidden&&(u?.grid??null!==o),g=e=>o?r(o.ticks[e]):(a?l.top:l.left)+n(e),y=C(c.length,a?l.height:l.width,a?1.8*m:Math.max(...c.map(e=>A(e,m)),1)+12),v=C(i.ticks.length,a?l.width:l.height,a?Math.max(...h.map(e=>A(e,m)),1)+16:2*m),k=c.length>1?Math.abs(g(1)-g(0)):l.width,M=i.ticks.length>1?Math.abs(s(i.ticks[1])-s(i.ticks[0])):l.height,w=b(c.length,y,k,a?1.8*m:A(c[c.length-1]??"",m)),z=b(i.ticks.length,v,M,a?A(h[h.length-1]??"",m):1.6*m);return t("g",{className:"mp-chart__axes",children:[i.ticks.map((n,o)=>{const r=s(n),c=Math.abs(n)<1e-9&&i.min<0,u=!d?.hidden&&P(o,i.ticks.length,v,z);return t("g",{children:[f?e("line",a?{x1:r,x2:r,y1:l.top,y2:l.top+l.height,stroke:c?F:W,strokeWidth:1}:{x1:l.left,x2:l.left+l.width,y1:r,y2:r,stroke:c?F:W,strokeWidth:1}):null,u?e("text",{x:a?r:l.left-8,y:a?l.top+l.height+m+6:r,textAnchor:a?"middle":"end",dominantBaseline:a?"auto":"central",fill:N,fontSize:m,children:h[o]}):null]},`v${o}`)}),c.map((i,n)=>{const o=g(n),r=!u?.hidden&&P(n,c.length,y,w);return t("g",{children:[p?e("line",a?{x1:l.left,x2:l.left+l.width,y1:o,y2:o,stroke:W,strokeWidth:1}:{x1:o,x2:o,y1:l.top,y2:l.top+l.height,stroke:W,strokeWidth:1}):null,r?e("text",{x:a?l.left-8:o,y:a?o:l.top+l.height+m+6,textAnchor:a?"end":"middle",dominantBaseline:a?"central":"auto",fill:N,fontSize:m,children:i}):null]},`c${n}`)}),e("line",a?{x1:x,x2:x,y1:l.top,y2:l.top+l.height,stroke:F,strokeWidth:1}:{x1:l.left,x2:l.left+l.width,y1:x,y2:x,stroke:F,strokeWidth:1}),d?.label&&!d.hidden?e("text",{x:a?l.left+l.width/2:m,y:a?l.top+l.height+2*m+12:l.top+l.height/2,textAnchor:"middle",dominantBaseline:a?"auto":"central",fill:N,fontSize:m,transform:a?void 0:`rotate(-90 ${m} ${l.top+l.height/2})`,children:d.label}):null,u?.label&&!u.hidden?e("text",{x:a?m:l.left+l.width/2,y:a?l.top+l.height/2:l.top+l.height+2*m+12,textAnchor:"middle",dominantBaseline:a?"central":"auto",fill:N,fontSize:m,transform:a?`rotate(-90 ${m} ${l.top+l.height/2})`:void 0,children:u.label}):null]})}export function CartesianFrame({series:b,categories:P,xAxis:C,yAxis:W,horizontal:N=!1,stacked:_=!1,includeZero:E=!0,bandRatio:I=1,inset:V=!1,headroom:D=0,markInset:X=0,xScale:Y="band",marks:Z,markRadius:L=24,swatch:H,scale:K,table:U,markTooltip:q,height:G,format:J,locale:O,label:Q,legend:ee,tooltip:te,empty:le,size:ie,className:ae,style:ne,children:oe,...re}){const se=o(ie),he=a(O),ce=n(r,he),de=n(s,he),ue=l.useRef(null),me=i(ue),xe=me.width,fe=l.useId(),pe=m(b),[ge,ye]=l.useState(null),[ve,ke]=l.useState(null),[be,Me]=l.useState(null),we=l.useCallback(e=>w(e,he,J,!0),[J,he]),ze=l.useMemo(()=>j(b),[b]),Se=l.useMemo(()=>b.map((e,t)=>z(t,e.color)),[b]),Pe=l.useMemo(()=>b.map(e=>e.name),[b]),Ae=v(b),Ce=l.useMemo(()=>Array.from({length:Ae},(e,t)=>y(t,P,ze)),[Ae,P,ze]),je=ze.filter((e,t)=>pe.visible[t]),Be=S(je,_),$e=x[se],Re=W,We=C,Fe=K??$(Be,{min:Re?.min,max:Re?.max,tickCount:Re?.tickCount,includeZero:E}),Ne="value"===Y?k(je,P):null,Te="value"===Y?$(Ne,{min:We?.min,max:We?.max,tickCount:We?.tickCount,includeZero:!1}):null,_e=Fe.ticks.map((e,t)=>Re?.tickFormat?String(Re.tickFormat(e,t)):we(e)),Ee=Te?Te.ticks.map((e,t)=>We?.tickFormat?String(We.tickFormat(e,t)):w(e,he,void 0,!0)):Ce.map((e,t)=>We?.tickFormat?String(We.tickFormat(e,t)):M(e,he)),Ie=_e.reduce((e,t)=>Math.max(e,A(t,$e)),0),Ve=$e+6,De=Re?.hidden?0:Ie+10+(Re?.label?Ve:0),Xe=(xe-(N?0:De)-16)/Math.max(1,Ae),Ye=Te?Ee:N||Xe-6>=2.4*$e?Ee.map(e=>B(e,N?150:Xe-6,$e)):Ee,Ze=Ye.reduce((e,t)=>Math.max(e,A(t,$e)),0),Le=N?We?.hidden?0:Ze+10+(We?.label?Ve:0):De,He=N?Re?.hidden?0:$e+12+(Re?.label?Ve:0):We?.hidden?0:$e+12+(We?.label?Ve:0),Ke=(N?We:Re)?.thickness??Le,Ue=(N?Re:We)?.thickness??He,qe=(N?12+D:Math.max(8,Ze/2))+X,Ge=f[se]+4+(N?0:D)+X,Je="number"==typeof G?G:void 0===G?p[se]:me.height,Oe={left:Ke+X,top:Ge,width:Math.max(0,xe-Ke-X-qe),height:Math.max(0,Je-Ge-Ue-X)},Qe=N?Oe.height:Oe.width,et=g(V?Math.max(1,Ae-1):Ae,Qe,I),tt=l.useCallback(e=>V?Ae<=1?Qe/2:Qe*e/(Ae-1):et.centre(e),[V,Ae,Qe,et]),lt=l.useCallback(e=>N?Oe.left+Fe.fraction(e)*Oe.width:Oe.top+(1-Fe.fraction(e))*Oe.height,[N,Oe.left,Oe.top,Oe.width,Oe.height,Fe]),it=l.useCallback(e=>N?Oe.top+(1-(Te?.fraction(e)??0))*Oe.height:Oe.left+(Te?.fraction(e)??0)*Oe.width,[N,Oe.left,Oe.top,Oe.width,Oe.height,Te]),at=l.useCallback((e,t)=>N?{x:lt(t),y:Oe.top+tt(e)}:{x:Oe.left+tt(e),y:lt(t)},[N,lt,tt,Oe.left,Oe.top]),nt=lt(Math.min(Math.max(0,Fe.min),Fe.max)),ot={plot:Oe,values:ze,visible:pe.visible,colors:Se,scale:Fe,band:et,horizontal:N,valuePx:lt,categoryPx:tt,point:at,categoryScale:Te,categoryValuePx:it,zeroPx:nt,categories:Ce,format:we,size:se},rt=Z?Z(ot):R,st=!1===te?{mode:"none"}:!0===te||void 0===te?{}:te,ht=st.mode??(Z?"item":"index"),ct=null===ve?null:rt[ve]??null,dt=Z?ct?ct.index:null:ge,ut=Z?rt.length:Ae,mt=()=>{ye(null),ke(null),Me(null)},xt=e=>{const t=null===e?null:Math.min(ut-1,Math.max(0,e));Z?ke(t):ye(t)},ft=e=>{Me(null);xt(((Z?ve:ge)??(e>0?-1:ut))+e)},pt=null===dt?[]:b.flatMap((e,t)=>{if(!pe.visible[t]||ct&&ct.series!==t)return[];const l=ze[t]?.[dt];return l&&null!==l.value?[{seriesIndex:t,name:e.name,color:l.color??Se[t],value:l.value,formatted:we(l.value),label:l.label}]:[]}),gt=ct&&q?q(ct):null,yt=gt?gt.items:"item"===ht&&pt.length>1&&null!==be?[pt.reduce((e,t)=>Math.abs(lt(t.value??0)-be)<Math.abs(lt(e.value??0)-be)?t:e)]:pt,vt=gt?gt.heading:ct?M(ze[ct.series]?.[ct.index]?.x??P?.[ct.index]??ct.index,he):null===dt?void 0:M(Ce[dt]??dt,he),kt=ct?ct.x:N?lt(yt[0]?.value??0):Oe.left+tt(dt??0),bt=ct?ct.y:N?Oe.top+tt(dt??0):Oe.top+Oe.height/2,Mt=ct?(ct.x-Oe.left)/Math.max(1,Oe.width)>.6:(N?Fe.fraction(yt[0]?.value??0):tt(dt??0)/Math.max(1,Qe))>.6,wt=!1===ee?{interactive:!1}:!0===ee||void 0===ee?{}:ee,zt=!0===ee||!1!==ee&&b.length>1,St=wt.side??"bottom",Pt={...ot,hovered:pe.hovered,activeIndex:dt,marks:rt,activeMark:ct},At=0===Ae||null===Be||"value"===Y&&null===Ne;return e(c,{...re,size:se,className:ae,style:ne,plotRef:ue,name:Q??ce.label,describedBy:At?void 0:fe,interactive:!At,height:G,legendSide:St,plotProps:{onPointerMove:At||"none"===ht?void 0:e=>{Z?ke(((e,t)=>{const l=ue.current;if(!l||0===rt.length)return null;const i=l.getBoundingClientRect(),a=e-i.left,n=t-i.top;let o=null,r=1/0,s=1/0;return rt.forEach((e,t)=>{const l=Math.hypot(e.x-a,e.y-n),i=void 0===e.rx?Math.max(0,l-e.r):Math.hypot(Math.max(0,Math.abs(e.x-a)-e.rx),Math.max(0,Math.abs(e.y-n)-(e.ry??e.rx)));i<=L&&(i<r||i===r&&l<s)&&(r=i,s=l,o=t)}),o})(e.clientX,e.clientY)):ye(((e,t)=>{const l=ue.current;if(!l||0===Ae)return null;const i=l.getBoundingClientRect(),a=N?t-i.top-Oe.top:e-i.left-Oe.left;if(a<-et.step||a>Qe+et.step)return null;const n=V?Ae<=1?0:Math.round(a/Qe*(Ae-1)):Math.floor(a/et.step);return Math.min(Ae-1,Math.max(0,n))})(e.clientX,e.clientY)),"item"===ht&&Me(((e,t)=>{const l=ue.current;if(!l)return null;const i=l.getBoundingClientRect();return N?e-i.left:t-i.top})(e.clientX,e.clientY))},onPointerLeave:mt,onKeyDown:At||"none"===ht?void 0:e=>{const t=N?"ArrowDown":"ArrowRight",l=N?"ArrowUp":"ArrowLeft";if(e.key===t)ft(1);else if(e.key===l)ft(-1);else if("Home"===e.key)xt(0);else if("End"===e.key)xt(ut-1);else{if("Escape"!==e.key)return;mt()}e.preventDefault()},onBlur:mt},tooltip:null!==dt&&yt.length>0&&"none"!==ht?st.render?e("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-10",style:{left:kt,top:bt,transform:`translate(${Mt?"calc(-100% - 12px)":"12px"}, -50%)`},children:st.render({index:dt,category:Ce[dt]??dt,items:yt})}):e(u,{heading:vt,items:yt,x:kt,y:bt,flip:Mt,size:se}):null,legend:zt?e(h,{names:Pe,colors:Se,options:wt,visibility:pe,size:se,swatch:H,values:wt.showValue&&null!==dt?b.map((e,t)=>{const l=ze[t]?.[dt]?.value;return null==l?void 0:we(l)}):void 0}):null,status:{heading:vt,items:yt},table:At?null:U?.(fe)??e(d,{id:fe,caption:Q??ce.table,corner:We?.label??ce.category,categories:Ce,names:Pe,values:ze,format:we,locale:he,empty:de.empty}),children:At?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:le??de.empty}):xe>0&&Je>0?t("svg",{width:xe,height:Je,viewBox:`0 0 ${xe} ${Je}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(T,{plot:Oe,scale:Fe,horizontal:N,categoryPx:tt,categoryScale:Te,categoryValuePx:it,valuePx:lt,tickTexts:_e,categoryTexts:Ye,valueAxis:Re,categoryAxis:We,fontSize:$e,zeroPx:nt}),null===dt||Z||"index"!==ht||!1===st.crosshair?null:(()=>{const t=tt(dt);return e("line",N?{x1:Oe.left,x2:Oe.left+Oe.width,y1:Oe.top+t,y2:Oe.top+t,stroke:F,strokeWidth:1}:{x1:Oe.left+t,x2:Oe.left+t,y1:Oe.top,y2:Oe.top+Oe.height,stroke:F,strokeWidth:1})})(),oe(Pt)]}):null})}
|
|
@@ -55,11 +55,20 @@ export interface MPFieldLabelProps extends MPFieldOutlineProps {
|
|
|
55
55
|
* outline is `pointer-events-none` so that clicks land on the control
|
|
56
56
|
* underneath, and a label inside it would stop being clickable.
|
|
57
57
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* pointer.
|
|
58
|
+
* It is `pointer-events-none` in both states, and for a different reason in
|
|
59
|
+
* each. Resting, it is lying over the text the caret goes into, and a click on
|
|
60
|
+
* it has to reach the control so the caret lands where the pointer did. A
|
|
61
|
+
* `<label for>` would only have focused the control, which puts the caret at the
|
|
62
|
+
* end of the text rather than under the pointer.
|
|
63
|
+
*
|
|
64
|
+
* Shrunk, it is out of the way and could safely take a click. What it cannot do
|
|
65
|
+
* is take one *halfway*. The press focuses the control, the focus is what starts
|
|
66
|
+
* the label rising, and the label arrives under the pointer before the button
|
|
67
|
+
* comes back up: the press goes down on the control and up on the label, and a
|
|
68
|
+
* press whose two ends disagree is delivered to their nearest common ancestor
|
|
69
|
+
* rather than to either. The control never sees the click. That is what made a
|
|
70
|
+
* picker asked for without its glyph — `startIcon={null}`, which is the whole
|
|
71
|
+
* point of `floatingLabel` on a picker — impossible to open with a mouse.
|
|
63
72
|
*/
|
|
64
73
|
export declare function MPFieldLabel({ size, label, required, htmlFor, shrunk, multiline }: MPFieldLabelProps): React.JSX.Element;
|
|
65
74
|
export interface MPFloatingLabel {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as r,Fragment as t,jsxs as
|
|
2
|
+
import{jsx as r,Fragment as t,jsxs as o}from"react/jsx-runtime";import*as e from"react";import{Field as a}from"@base-ui/react/field";import{PROSE_TEXT as n}from"./scale.js";const i={xs:"start-1",sm:"start-2",md:"start-3",lg:"start-3",xl:"start-4"},s={xs:"top-[18px]",sm:"top-[18px]",md:"top-5",lg:"top-5",xl:"top-5"};function d(e,a){return o(t,{children:[e,a?r("span",{"aria-hidden":"true",children:" *"}):null]})}export function MPFieldOutline({label:t,required:o=!1,notched:e=!0}){return r("fieldset",{"aria-hidden":"true",className:["pointer-events-none absolute inset-0 -top-[5px] m-0 min-w-0 px-2 pt-0","rounded-mp-xs border border-mp-outline","transition-[border-color] duration-(--mp-sys-motion-duration-short4)","group-hover:border-mp-on-surface","group-focus-within:border-2 group-focus-within:border-mp-primary","group-data-focused:border-2 group-data-focused:border-mp-primary","group-data-invalid:border-mp-error","group-data-disabled:border-mp-on-surface/12"].join(" "),children:t?r("legend",{className:["text-mp-body-small invisible float-none block h-[11px] w-auto overflow-hidden p-0","leading-none","ease-mp-standard transition-[max-width,padding]","duration-(--mp-sys-motion-duration-short4)",e?"max-w-full px-1":"max-w-0 px-0"].join(" "),children:d(t,o)}):null})}export function MPFieldLabel({size:t,label:o,required:e=!1,htmlFor:p,shrunk:l=!0,multiline:u=!1}){return r(a.Label,{htmlFor:p,"data-mp-shrunk":l?"":void 0,className:["text-mp-on-surface-variant","ease-mp-standard transition-[color,top,font-size,max-width]","duration-(--mp-sys-motion-duration-short4)","pointer-events-none absolute -translate-y-1/2 px-1 leading-none",i[t],l?"text-mp-body-small top-0 max-w-none":[n[t],"max-w-[calc(100%-2rem)] truncate",u?s[t]:"top-1/2"].join(" "),"group-focus-within:text-mp-primary","group-data-focused:text-mp-primary","group-data-invalid:text-mp-error","group-data-disabled:text-mp-on-surface/38"].join(" "),children:d(o,e)})}export function useFloatingLabel({floating:r,filled:t,pinned:o=!1}){const[a,n]=e.useState(!1);return{shrunk:!r||t||a||o,focusProps:{onFocusCapture:()=>n(!0),onBlurCapture:r=>{r.currentTarget.contains(r.relatedTarget)||n(!1)}}}}
|
|
@@ -14,6 +14,30 @@ import * as React from 'react';
|
|
|
14
14
|
* validity state; here the message's presence *is* the state, which is the same
|
|
15
15
|
* bargain `MPTextField.errorMessage` makes — there is no way to render a control
|
|
16
16
|
* that is visibly wrong with no explanation of why.
|
|
17
|
+
*
|
|
18
|
+
* ## The line arrives rather than appearing
|
|
19
|
+
*
|
|
20
|
+
* A field that turned invalid grew by a line of text between one frame and the
|
|
21
|
+
* next, and everything under it on the page moved down by that much. On a form
|
|
22
|
+
* validated on blur that is the whole page stepping as the reader tabs through
|
|
23
|
+
* it.
|
|
24
|
+
*
|
|
25
|
+
* So the space opens. `mp-supporting-text__reveal` in `styles.css` has the
|
|
26
|
+
* argument for the row it opens as and for why swapping a description for an
|
|
27
|
+
* error is a different animation from having something to say at all.
|
|
28
|
+
*
|
|
29
|
+
* What is worth knowing on this side is that the animation is **switched on by
|
|
30
|
+
* an attribute this component sets**, rather than by a class that is simply
|
|
31
|
+
* always there. A page load is not a change: a server-rendered form would
|
|
32
|
+
* otherwise grow six description lines out of nothing the moment it hydrated,
|
|
33
|
+
* which is a page assembling itself in front of a reader who asked for a form.
|
|
34
|
+
* The effect below only ever runs when it has watched the message change.
|
|
35
|
+
*
|
|
36
|
+
* The wrapper is drawn only when there is a message, and that is not a detail
|
|
37
|
+
* to lose either: every control that shows one puts it in a flex column with a
|
|
38
|
+
* `gap`, so an element that was always there would be a gap that was always
|
|
39
|
+
* there — two pixels under every checkbox in the library that has nothing to
|
|
40
|
+
* say.
|
|
17
41
|
*/
|
|
18
42
|
export declare function MPSupportingText({ description, errorMessage, className }: {
|
|
19
43
|
description?: React.ReactNode;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import*as r from"react";import{Field as t}from"@base-ui/react/field";import{META_TEXT as a,hasContent as n}from"./scale.js";export function MPSupportingText({description:o,errorMessage:s,className:i}){const c=n(s)?"error":n(o)?"description":"none",m=r.useRef(null),p=r.useRef(c);r.useLayoutEffect(()=>{const e=m.current,r=p.current;p.current=c,e&&c!==r&&"none"!==c&&(e.dataset.mpReveal="none"===r?"open":"swap",e.style.animationName="none",e.offsetWidth,e.style.animationName="")},[c]);const l=["mp-supporting-text block min-h-0",a,"data-disabled:text-mp-on-surface/38",i??""].filter(Boolean).join(" ");return n(s)?e("div",{ref:m,className:"mp-supporting-text__reveal",children:e(t.Error,{match:!0,className:`${l} text-mp-error`,children:s})}):n(o)?e("div",{ref:m,className:"mp-supporting-text__reveal",children:e(t.Description,{className:`${l} text-mp-on-surface-variant`,children:o})}):e(t.Error,{className:`${l} text-mp-error`})}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The values an animation comes to, and nothing that runs one.
|
|
3
|
+
*
|
|
4
|
+
* Split from `animate.ts` for the reason `density.ts` is split from `scale.ts`,
|
|
5
|
+
* with a sharper edge: the split stylesheet is cut along the import graph a file
|
|
6
|
+
* at a time, and `animate.ts` names the marquee's own class in a query selector.
|
|
7
|
+
* A component reaching in here for a single entrance was coming out with the
|
|
8
|
+
* marquee's rules and its two keyframes attached.
|
|
9
|
+
*
|
|
10
|
+
* Which is also a rule about writing in this file. A hand-written rule is
|
|
11
|
+
* attributed by looking for its class names in a component's files, and a
|
|
12
|
+
* comment is one of those files — so naming another component's class here, even
|
|
13
|
+
* in prose, would put that component's CSS into every sheet this module reaches.
|
|
14
|
+
*
|
|
15
|
+
* So this half is the tables and the arithmetic — what a duration, a curve, a
|
|
16
|
+
* repeat and an offset resolve to — and the other half is the machinery that
|
|
17
|
+
* watches a trigger and drives them. `transition.ts` reads this one; the
|
|
18
|
+
* `MPAnimate*` components read both, through the re-export next door.
|
|
19
|
+
*/
|
|
20
|
+
import * as React from 'react';
|
|
21
|
+
import type { MPAnimateMode, MPAnimateRepeat, MPAnimateTimeline, MPAnimation, MPEasing, MPSide } from '../types.js';
|
|
22
|
+
/** The class that reads the slots. Always paired with one of the below. */
|
|
23
|
+
export declare const ANIM_BASE = "mp-anim";
|
|
24
|
+
/**
|
|
25
|
+
* Which keyframe an effect runs.
|
|
26
|
+
*
|
|
27
|
+
* `grow` and `zoom` share one: they are the same arithmetic at two strengths,
|
|
28
|
+
* and a second identical `@keyframes` would only be a second place to fix a
|
|
29
|
+
* bug. What separates them is their defaults and their origin, which is a
|
|
30
|
+
* property rather than a keyframe.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ANIMATION_CLASS: Record<MPAnimation, string>;
|
|
33
|
+
/**
|
|
34
|
+
* The name an effect goes by, which is wider than the shared union.
|
|
35
|
+
*
|
|
36
|
+
* `float` and `shake` are not entrances and are not in `MPAnimation` — see
|
|
37
|
+
* `effectClass` below for why a shared lookup table is a thing to keep small.
|
|
38
|
+
* They still need a *name*, because `data-mp-animation` is how a test and a
|
|
39
|
+
* page's own CSS find one, and because the tables above are read by name.
|
|
40
|
+
*
|
|
41
|
+
* Neither of them reads those tables: an effect that brings its own keyframe
|
|
42
|
+
* brings its own duration and curve with it, since a six-second drift and a
|
|
43
|
+
* four-hundred-millisecond refusal are not on any Material ladder. The
|
|
44
|
+
* fallbacks in the two lookups below exist so the types do not have to lie
|
|
45
|
+
* about that, not because anything relies on them.
|
|
46
|
+
*/
|
|
47
|
+
export type AnimationEffect = MPAnimation | 'float' | 'shake' | 'count';
|
|
48
|
+
/** A curve, as the stylesheet spells it. */
|
|
49
|
+
export declare function easingValue(easing: MPEasing): string;
|
|
50
|
+
/** A number is pixels; a string is already a CSS length. */
|
|
51
|
+
export declare function lengthValue(value: number | string): string;
|
|
52
|
+
/** `'infinite'` reaches CSS as the word; a count reaches it as the number. */
|
|
53
|
+
export declare function repeatValue(repeat: MPAnimateRepeat): string;
|
|
54
|
+
export declare function isInfinite(repeat: MPAnimateRepeat | undefined): boolean;
|
|
55
|
+
export interface AnimationSlotOptions {
|
|
56
|
+
/** Which effect's tokens to fall back to, and which keyframe to run. */
|
|
57
|
+
effect: AnimationEffect;
|
|
58
|
+
/** Milliseconds. Unset takes the effect's Material duration token. */
|
|
59
|
+
duration?: number;
|
|
60
|
+
/** Milliseconds. */
|
|
61
|
+
delay: number;
|
|
62
|
+
/** Unset takes the effect's Material easing token. */
|
|
63
|
+
easing?: MPEasing;
|
|
64
|
+
repeat: MPAnimateRepeat;
|
|
65
|
+
alternate?: boolean;
|
|
66
|
+
mode?: MPAnimateMode;
|
|
67
|
+
/** Milliseconds added to the duration, clamped at zero. See `durationValue`. */
|
|
68
|
+
durationOffset?: number;
|
|
69
|
+
/** `view` hands the animation to the reader's scrolling instead of a clock. */
|
|
70
|
+
timeline?: MPAnimateTimeline;
|
|
71
|
+
/** Any CSS `animation-range`. Only read on `timeline: 'view'`. */
|
|
72
|
+
range?: string;
|
|
73
|
+
/** Where the animated properties start. Only the ones an effect reads. */
|
|
74
|
+
opacity?: number;
|
|
75
|
+
scale?: number;
|
|
76
|
+
x?: string;
|
|
77
|
+
y?: string;
|
|
78
|
+
angle?: string;
|
|
79
|
+
angleTo?: string;
|
|
80
|
+
clip?: string;
|
|
81
|
+
/** The two ends of a counted value. Only `MPAnimateCounter` fills these. */
|
|
82
|
+
from?: number;
|
|
83
|
+
to?: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The `--_mp-anim-*` slots, as an inline style object.
|
|
87
|
+
*
|
|
88
|
+
* Inline rather than utilities for the reason the accent slots are: these are
|
|
89
|
+
* per-instance numbers, and Tailwind cannot generate a class for a duration it
|
|
90
|
+
* has never seen written down.
|
|
91
|
+
*/
|
|
92
|
+
export declare function animationSlots(options: AnimationSlotOptions): React.CSSProperties;
|
|
93
|
+
/**
|
|
94
|
+
* Which way a slide starts, given the edge it comes from.
|
|
95
|
+
*
|
|
96
|
+
* `MPSide` is physical everywhere in this library, and it stays physical here:
|
|
97
|
+
* something sliding in from the top of the window comes from the top in every
|
|
98
|
+
* writing direction.
|
|
99
|
+
*/
|
|
100
|
+
export declare function slideOffsets(from: MPSide, distance: number | string): {
|
|
101
|
+
x: string;
|
|
102
|
+
y: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* The `inset()` a wipe starts from, given the edge it opens at.
|
|
106
|
+
*
|
|
107
|
+
* A reveal is one rectangle shrinking to nothing: `inset(0 100% 0 0)` is the
|
|
108
|
+
* whole element clipped away from the right, so the content is disclosed
|
|
109
|
+
* left-to-right as the inset returns to `inset(0)`. Naming the *edge it opens
|
|
110
|
+
* at* rather than the direction it travels is the same choice `MPAnimateSlide`
|
|
111
|
+
* makes, and for the same reason — a caller is pointing at a place.
|
|
112
|
+
*
|
|
113
|
+
* `inset(0)` is the to-state and needs no slot, which is the argument for a
|
|
114
|
+
* clip-path over a mask: "nothing is clipped" already has a spelling, where a
|
|
115
|
+
* gradient mask would need a second gradient per direction to say it.
|
|
116
|
+
*
|
|
117
|
+
* Physical, like `MPSide` everywhere else here. A title disclosed from the left
|
|
118
|
+
* of its box is disclosed from the left in every writing direction; what changes
|
|
119
|
+
* under RTL is which edge a caller names, and that is theirs to decide.
|
|
120
|
+
*/
|
|
121
|
+
export declare function revealClip(from: MPSide): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ANIM_BASE="mp-anim";export const ANIMATION_CLASS={fade:"mp-anim-fade",grow:"mp-anim-scale",slide:"mp-anim-slide",zoom:"mp-anim-scale",rotate:"mp-anim-rotate",blink:"mp-anim-blink",reveal:"mp-anim-reveal"};const e={fade:{in:"medium2",out:"short4"},grow:{in:"medium4",out:"short4"},slide:{in:"medium4",out:"short4"},zoom:{in:"medium4",out:"short4"},rotate:{in:"long2",out:"medium2"},blink:{in:"extra-long4",out:"extra-long4"},reveal:{in:"medium4",out:"short4"}},t={fade:"emphasized-decelerate",grow:"emphasized-decelerate",slide:"emphasized-decelerate",zoom:"emphasized-decelerate",rotate:"emphasized-decelerate",blink:"standard",reveal:"emphasized-decelerate"};export function easingValue(e){return`var(--mp-sys-motion-easing-${e})`}function n(t,n,i="in",a=0){const r=void 0!==t?`${t}ms`:`var(--mp-sys-motion-duration-${(e[n]??e.fade)[i]})`;return 0===a?r:void 0!==t?`${Math.max(0,t+a)}ms`:`max(0ms, calc(${r} + ${a}ms))`}export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}function i(e,t){return"out"===e?t?"alternate-reverse":"reverse":t?"alternate":"normal"}export function animationSlots(e){const a=e.mode??"in",r={"--_mp-anim-duration":n(e.duration,e.effect,a,e.durationOffset),"--_mp-anim-delay":`${e.delay}ms`,"--_mp-anim-ease":easingValue(e.easing??t[e.effect]??t.fade),"--_mp-anim-repeat":repeatValue(e.repeat),"--_mp-anim-direction":i(a,e.alternate)};return"view"===e.timeline&&(r["--_mp-anim-timeline"]="view()",r["--_mp-anim-range"]=e.range??"entry 0% cover 45%"),void 0!==e.opacity&&(r["--_mp-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(r["--_mp-anim-scale"]=String(e.scale)),void 0!==e.x&&(r["--_mp-anim-x"]=e.x),void 0!==e.y&&(r["--_mp-anim-y"]=e.y),void 0!==e.angle&&(r["--_mp-anim-angle"]=e.angle),void 0!==e.angleTo&&(r["--_mp-anim-angle-to"]=e.angleTo),void 0!==e.clip&&(r["--_mp-anim-clip"]=e.clip),void 0!==e.from&&(r["--_mp-anim-from"]=String(e.from)),void 0!==e.to&&(r["--_mp-anim-to"]=String(e.to)),r}export function slideOffsets(e,t){const n=lengthValue(t),i="number"==typeof t?-t+"px":`calc(-1 * ${n})`;switch(e){case"top":return{x:"0px",y:i};case"bottom":return{x:"0px",y:n};case"left":return{x:i,y:"0px"};default:return{x:n,y:"0px"}}}export function revealClip(e){switch(e){case"top":return"inset(0 0 100% 0)";case"bottom":return"inset(100% 0 0 0)";case"right":return"inset(0 0 0 100%)";default:return"inset(0 100% 0 0)"}}
|
|
@@ -30,72 +30,66 @@
|
|
|
30
30
|
* this library: the value a caller does not name is the *token*, so a theme can
|
|
31
31
|
* still reach it.
|
|
32
32
|
*
|
|
33
|
+
* ## One effect, or one effect per child
|
|
34
|
+
*
|
|
35
|
+
* `stagger` is the same six effects written onto the children instead of onto
|
|
36
|
+
* the box, and it is three props rather than an `MPAnimateStagger` component:
|
|
37
|
+
* a list settling in is not a different effect from a fade, it is the same fade
|
|
38
|
+
* told when to start. The per-child half is `staggerChildren`, which
|
|
39
|
+
* `MPAnimateAppear` was built out of first and now shares — two copies would be
|
|
40
|
+
* two answers to which child is the third one.
|
|
41
|
+
*
|
|
33
42
|
* ## What is deliberately not here
|
|
34
43
|
*
|
|
35
44
|
* An animation that has to know what its children *are* — a marquee that
|
|
36
45
|
* duplicates them, a headline that swaps between them, a typewriter that counts
|
|
37
46
|
* characters — cannot be a class name and a few numbers. Those are components,
|
|
38
|
-
* and their logic stays in their own files.
|
|
47
|
+
* and their logic stays in their own files. They are also the ones that cannot
|
|
48
|
+
* take a `stagger`, and for the same reason.
|
|
39
49
|
*/
|
|
50
|
+
import { ANIM_BASE, ANIMATION_CLASS, animationSlots, easingValue, isInfinite, lengthValue, repeatValue, revealClip, slideOffsets, type AnimationEffect, type AnimationSlotOptions } from './animate-core.js';
|
|
51
|
+
export { ANIM_BASE, ANIMATION_CLASS, animationSlots, easingValue, isInfinite, lengthValue, repeatValue, revealClip, slideOffsets };
|
|
52
|
+
export type { AnimationEffect, AnimationSlotOptions };
|
|
40
53
|
import * as React from 'react';
|
|
41
|
-
import type {
|
|
42
|
-
/**
|
|
43
|
-
export
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/** A curve, as the stylesheet spells it. */
|
|
54
|
-
export declare function easingValue(easing: MPEasing): string;
|
|
55
|
-
/** A number is pixels; a string is already a CSS length. */
|
|
56
|
-
export declare function lengthValue(value: number | string): string;
|
|
57
|
-
/** `'infinite'` reaches CSS as the word; a count reaches it as the number. */
|
|
58
|
-
export declare function repeatValue(repeat: MPAnimateRepeat): string;
|
|
59
|
-
export declare function isInfinite(repeat: MPAnimateRepeat | undefined): boolean;
|
|
60
|
-
export interface AnimationSlotOptions {
|
|
61
|
-
/** Which effect's tokens to fall back to, and which keyframe to run. */
|
|
62
|
-
effect: MPAnimation;
|
|
63
|
-
/** Milliseconds. Unset takes the effect's Material duration token. */
|
|
64
|
-
duration?: number;
|
|
65
|
-
/** Milliseconds. */
|
|
66
|
-
delay: number;
|
|
67
|
-
/** Unset takes the effect's Material easing token. */
|
|
68
|
-
easing?: MPEasing;
|
|
69
|
-
repeat: MPAnimateRepeat;
|
|
70
|
-
alternate?: boolean;
|
|
71
|
-
mode?: MPAnimateMode;
|
|
72
|
-
/** Where the animated properties start. Only the ones an effect reads. */
|
|
73
|
-
opacity?: number;
|
|
74
|
-
scale?: number;
|
|
75
|
-
x?: string;
|
|
76
|
-
y?: string;
|
|
77
|
-
angle?: string;
|
|
78
|
-
angleTo?: string;
|
|
54
|
+
import type { MPAnimateTrigger } from '../types.js';
|
|
55
|
+
/** What differs between one child and the next. */
|
|
56
|
+
export interface StaggerOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Milliseconds added to each child's delay. The whole of the effect: at 0
|
|
59
|
+
* there is nothing per-child to do and the box animates instead.
|
|
60
|
+
*/
|
|
61
|
+
stagger: number;
|
|
62
|
+
/** Milliseconds added to each child's duration. Negative is allowed. */
|
|
63
|
+
durationStep?: number;
|
|
64
|
+
/** Runs the set from the last child to the first. */
|
|
65
|
+
reverse?: boolean;
|
|
79
66
|
}
|
|
80
67
|
/**
|
|
81
|
-
* The
|
|
68
|
+
* The same animation on every child, held back by its position.
|
|
82
69
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
70
|
+
* One implementation for all of it. `MPAnimateAppear` had this and the six
|
|
71
|
+
* single-keyframe effects did not, and writing it a second time would have left
|
|
72
|
+
* the library with two answers to "which child is the third one" — which is the
|
|
73
|
+
* kind of disagreement nobody finds until a list is reversed inside a fragment.
|
|
74
|
+
*
|
|
75
|
+
* ## The animation goes on the children, not on wrappers
|
|
76
|
+
*
|
|
77
|
+
* A row of `<li>`s stays a row of `<li>`s and a grid's cells stay its direct
|
|
78
|
+
* children, so nothing about the layout changes because the set is being
|
|
79
|
+
* animated. The cost is real and worth naming: a child has to accept
|
|
80
|
+
* `className` and `style`, which every host element and every component in this
|
|
81
|
+
* library does, and a caller's own component need not. Only a bare string has
|
|
82
|
+
* no element to write onto, and that one is wrapped in a `<span>`.
|
|
83
|
+
*
|
|
84
|
+
* ## The step is per child, which makes the grouping the caller's dial
|
|
85
|
+
*
|
|
86
|
+
* Eight children are eight steps and one child holding eight things is one
|
|
87
|
+
* step. That is also how to opt part of a set out of the sequence — group it.
|
|
90
88
|
*
|
|
91
|
-
* `
|
|
92
|
-
*
|
|
93
|
-
* writing direction.
|
|
89
|
+
* The caller's own `style` wins over the slots, deliberately: the slots are
|
|
90
|
+
* this library's answer and the attribute is the caller's.
|
|
94
91
|
*/
|
|
95
|
-
export declare function
|
|
96
|
-
x: string;
|
|
97
|
-
y: string;
|
|
98
|
-
};
|
|
92
|
+
export declare function staggerChildren(children: React.ReactNode, className: string, slots: AnimationSlotOptions, { stagger, durationStep, reverse }: StaggerOptions): React.ReactNode[];
|
|
99
93
|
export declare function usePrefersReducedMotion(): boolean;
|
|
100
94
|
export interface AnimationRunOptions {
|
|
101
95
|
trigger: MPAnimateTrigger;
|
|
@@ -136,7 +130,31 @@ export interface AnimationRun {
|
|
|
136
130
|
* and leaves everything inside it alone.
|
|
137
131
|
*/
|
|
138
132
|
export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite }: AnimationRunOptions): AnimationRun;
|
|
139
|
-
export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions {
|
|
133
|
+
export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions, Partial<StaggerOptions> {
|
|
134
|
+
/**
|
|
135
|
+
* A keyframe class the effect brings itself, instead of the one its `effect`
|
|
136
|
+
* names.
|
|
137
|
+
*
|
|
138
|
+
* `MPAnimation` and the three tables behind it are what everything with an
|
|
139
|
+
* entrance shares, and a shared lookup table is a tax on everything that
|
|
140
|
+
* imports it: a `Record<Effect, string>` is not tree-shaken key by key, so
|
|
141
|
+
* every component reading one pays for the rows it will never use. The
|
|
142
|
+
* question to ask before adding a value is whether a component that will
|
|
143
|
+
* never use it has any business paying for it.
|
|
144
|
+
*
|
|
145
|
+
* `float` and `shake` do not: neither is an arrival. A drift with no
|
|
146
|
+
* destination and a four-hundred-millisecond answer to a rejection have
|
|
147
|
+
* nothing in common with a fade beyond the machinery below, so they keep
|
|
148
|
+
* their keyframes in their own files and borrow everything else — the
|
|
149
|
+
* trigger, the rewind, the slots, the stagger.
|
|
150
|
+
*
|
|
151
|
+
* `effect` is still named, because the durations and the curves are per
|
|
152
|
+
* effect and the data attribute is how a test finds one. What this replaces
|
|
153
|
+
* is only which `@keyframes` runs.
|
|
154
|
+
*/
|
|
155
|
+
effectClass?: string;
|
|
156
|
+
/** Only read when the effect is being spread across them. */
|
|
157
|
+
children?: React.ReactNode;
|
|
140
158
|
}
|
|
141
159
|
export interface AnimateElement {
|
|
142
160
|
ref: React.RefCallback<HTMLElement>;
|
|
@@ -144,6 +162,8 @@ export interface AnimateElement {
|
|
|
144
162
|
style: React.CSSProperties;
|
|
145
163
|
/** The hover handlers and the two data attributes, ready to be spread. */
|
|
146
164
|
props: React.HTMLAttributes<HTMLElement> & Record<string, unknown>;
|
|
165
|
+
/** The children, wrapped when there is a `stagger` and untouched otherwise. */
|
|
166
|
+
children: React.ReactNode;
|
|
147
167
|
}
|
|
148
168
|
/**
|
|
149
169
|
* Everything an `MPAnimate*` root needs, in one call.
|