material-plus-ui 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +20 -14
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +34 -3
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/anchor/MPAnchor.d.ts +107 -0
- package/dist/components/anchor/MPAnchor.js +2 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
- package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
- package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/MPAnimateFade.js +2 -1
- package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
- package/dist/components/animate-float/MPAnimateFloat.js +2 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
- package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
- package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
- package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
- package/dist/components/animate-shake/MPAnimateShake.js +2 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
- package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
- package/dist/components/animate-split/MPAnimateSplit.js +2 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
- package/dist/components/app-logo/MPAppLogo.d.ts +171 -0
- package/dist/components/app-logo/MPAppLogo.js +2 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
- package/dist/components/area-chart/MPAreaChart.js +2 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +2 -1
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
- package/dist/components/bar-chart/MPBarChart.js +2 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +18 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +2 -18
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/box/MPBox.d.ts +43 -8
- package/dist/components/box/MPBox.js +2 -1
- package/dist/components/breadcrumb/MPBreadcrumb.js +1 -1
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.js +1 -1
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +11 -2
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
- package/dist/components/code-block/MPCodeBlock.js +2 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
- package/dist/components/collapsible/MPCollapsible.js +1 -1
- package/dist/components/color-picker/MPColorPicker.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +21 -4
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +49 -7
- package/dist/components/config/MPConfigProvider.js +1 -1
- package/dist/components/confirm/MPConfirmProvider.js +1 -1
- package/dist/components/container/MPContainer.d.ts +9 -2
- package/dist/components/container/MPContainer.js +2 -1
- package/dist/components/data-list/MPDataList.d.ts +82 -0
- package/dist/components/data-list/MPDataList.js +2 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/MPDataTable.d.ts +314 -0
- package/dist/components/data-table/MPDataTable.js +2 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +10 -2
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +8 -2
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +10 -1
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/fieldset/MPFieldset.js +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/flex/MPFlex.d.ts +95 -0
- package/dist/components/flex/MPFlex.js +2 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/MPFloatingActionButton.js +1 -1
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/footer/MPFooter.d.ts +24 -4
- package/dist/components/footer/MPFooter.js +1 -1
- package/dist/components/form/MPForm.js +1 -1
- package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
- package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +25 -8
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/header/MPHeader.d.ts +26 -4
- package/dist/components/header/MPHeader.js +1 -1
- package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
- package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/hover-card/MPHoverCard.d.ts +101 -0
- package/dist/components/hover-card/MPHoverCard.js +2 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/icon/MPIcon.js +1 -1
- package/dist/components/image/MPImage.d.ts +122 -5
- package/dist/components/image/MPImage.js +1 -1
- package/dist/components/image/index.d.ts +1 -1
- package/dist/components/line-chart/MPLineChart.d.ts +66 -0
- package/dist/components/line-chart/MPLineChart.js +2 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/list/MPList.d.ts +23 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +1 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/menubar/MPMenubar.js +1 -1
- package/dist/components/meter/MPMeter.d.ts +87 -0
- package/dist/components/meter/MPMeter.js +2 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/MPMockup.d.ts +143 -0
- package/dist/components/mockup/MPMockup.js +2 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/navigation-menu/MPNavigationMenu.js +1 -1
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
- package/dist/components/pie-chart/MPPieChart.js +2 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/pill/MPPill.js +1 -1
- package/dist/components/popconfirm/MPPopconfirm.d.ts +2 -2
- package/dist/components/popover/MPPopover.d.ts +1 -0
- package/dist/components/popover/MPPopover.js +1 -1
- package/dist/components/portal/MPPortal.d.ts +75 -0
- package/dist/components/portal/MPPortal.js +2 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
- package/dist/components/scatter-chart/MPScatterChart.js +2 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
- package/dist/components/scroll-area/MPScrollArea.js +2 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
- package/dist/components/scroll-zone/MPScrollZone.js +2 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/segmented-button/MPSegmentedButton.js +1 -1
- package/dist/components/select/MPSelect.d.ts +27 -4
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/show/MPShow.d.ts +78 -0
- package/dist/components/show/MPShow.js +2 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/MPSidebar.d.ts +20 -1
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +85 -0
- package/dist/components/sparkline/MPSparkline.js +2 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/stack/MPStack.d.ts +198 -0
- package/dist/components/stack/MPStack.js +2 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/MPStatistic.d.ts +104 -0
- package/dist/components/statistic/MPStatistic.js +2 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +1 -0
- package/dist/components/stepper/MPStepper.js +1 -1
- package/dist/components/table/MPTable.d.ts +25 -3
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +12 -0
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
- package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toggle/MPToggle.js +1 -1
- package/dist/components/toolbar/MPToolbar.d.ts +106 -0
- package/dist/components/toolbar/MPToolbar.js +2 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.js +1 -1
- package/dist/components/tour/MPTour.d.ts +120 -0
- package/dist/components/tour/MPTour.js +2 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
- package/dist/components/tree-select/MPTreeSelect.js +2 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/MPTreeView.d.ts +153 -0
- package/dist/components/tree-view/MPTreeView.js +2 -0
- package/dist/components/tree-view/index.d.ts +2 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +10 -1
- package/dist/components/typography/MPTypography.js +2 -1
- package/dist/constants/glyphs.d.ts +33 -31
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +32 -31
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +22 -5
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMPColorScheme.js +1 -0
- package/dist/hooks/useMPDisclosure.d.ts +58 -0
- package/dist/hooks/useMPDisclosure.js +2 -0
- package/dist/hooks/useMPElementSize.d.ts +55 -0
- package/dist/hooks/useMPElementSize.js +2 -0
- package/dist/hooks/useMPMediaQuery.d.ts +40 -0
- package/dist/hooks/useMPMediaQuery.js +2 -0
- package/dist/hooks/useMPOnScreen.d.ts +58 -0
- package/dist/hooks/useMPOnScreen.js +2 -0
- package/dist/hooks/useMPReducedMotion.js +1 -0
- package/dist/hooks/useMPWindowClass.d.ts +7 -0
- package/dist/hooks/useMPWindowClass.js +1 -0
- package/dist/index.d.ts +35 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +199 -0
- package/dist/internal/ChartChrome.js +2 -0
- package/dist/internal/ChartFrame.d.ts +197 -0
- package/dist/internal/ChartFrame.js +2 -0
- package/dist/internal/FieldOutline.d.ts +14 -5
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/Picker.js +1 -1
- package/dist/internal/PopupArrow.d.ts +60 -0
- package/dist/internal/PopupArrow.js +2 -0
- package/dist/internal/SupportingText.d.ts +24 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/animate-core.d.ts +121 -0
- package/dist/internal/animate-core.js +1 -0
- package/dist/internal/animate.d.ts +75 -55
- package/dist/internal/animate.js +1 -1
- package/dist/internal/bottom-navigation.d.ts +58 -0
- package/dist/internal/bottom-navigation.js +2 -0
- package/dist/internal/chart.d.ts +461 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/color-scheme.d.ts +0 -9
- package/dist/internal/color-scheme.js +1 -1
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +195 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +22 -18
- package/dist/internal/date.js +1 -1
- package/dist/internal/density.d.ts +9 -0
- package/dist/internal/density.js +1 -0
- package/dist/internal/elevation.d.ts +26 -0
- package/dist/internal/elevation.js +1 -0
- package/dist/internal/highlight.d.ts +96 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +180 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/intl.d.ts +64 -0
- package/dist/internal/intl.js +1 -0
- package/dist/internal/mark.d.ts +52 -0
- package/dist/internal/mark.js +1 -0
- package/dist/internal/measure.d.ts +31 -0
- package/dist/internal/measure.js +1 -0
- package/dist/internal/messages/anchor.d.ts +3 -0
- package/dist/internal/messages/anchor.js +1 -0
- package/dist/internal/messages/chart.d.ts +3 -0
- package/dist/internal/messages/chart.js +1 -0
- package/dist/internal/messages/code.d.ts +3 -0
- package/dist/internal/messages/code.js +1 -0
- package/dist/internal/messages/data-table.d.ts +3 -0
- package/dist/internal/messages/data-table.js +1 -0
- package/dist/internal/messages/scroll.d.ts +3 -0
- package/dist/internal/messages/scroll.js +1 -0
- package/dist/internal/messages/sparkline.d.ts +3 -0
- package/dist/internal/messages/sparkline.js +1 -0
- package/dist/internal/messages/tour.d.ts +3 -0
- package/dist/internal/messages/tour.js +1 -0
- package/dist/internal/messages/transfer.d.ts +1 -1
- package/dist/internal/messages/transfer.js +1 -1
- package/dist/internal/mockup.d.ts +174 -0
- package/dist/internal/mockup.js +2 -0
- package/dist/internal/page-layout.d.ts +24 -5
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/responsive.d.ts +55 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scale.d.ts +0 -17
- package/dist/internal/scale.js +1 -1
- package/dist/internal/step.d.ts +15 -0
- package/dist/internal/step.js +1 -1
- package/dist/internal/table.d.ts +53 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/text.d.ts +57 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/time-scale.d.ts +44 -0
- package/dist/internal/time-scale.js +1 -0
- package/dist/internal/transition.d.ts +33 -0
- package/dist/internal/transition.js +1 -0
- package/dist/internal/visibility.d.ts +48 -0
- package/dist/internal/visibility.js +1 -0
- package/dist/internal/window-class.d.ts +29 -2
- package/dist/internal/window-class.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/alert.css +1 -1
- package/dist/styles/anchor.css +2 -0
- package/dist/styles/animate-appear.css +1 -1
- package/dist/styles/animate-blink.css +1 -1
- package/dist/styles/animate-counter.css +2 -0
- package/dist/styles/animate-fade.css +1 -1
- package/dist/styles/animate-float.css +2 -0
- package/dist/styles/animate-grow.css +1 -1
- package/dist/styles/animate-headline.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/animate-marquee.css +1 -1
- package/dist/styles/animate-reveal.css +2 -0
- package/dist/styles/animate-rotate.css +1 -1
- package/dist/styles/animate-scramble.css +2 -0
- package/dist/styles/animate-shake.css +2 -0
- package/dist/styles/animate-slide.css +1 -1
- package/dist/styles/animate-split.css +2 -0
- package/dist/styles/animate-typing.css +1 -1
- package/dist/styles/animate-zoom.css +1 -1
- package/dist/styles/app-logo.css +2 -0
- package/dist/styles/area-chart.css +2 -0
- package/dist/styles/aspect-ratio.css +1 -1
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/bar-chart.css +2 -0
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/box.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/chat-bubble.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.css +1 -1
- package/dist/styles/code-block.css +2 -0
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/config.css +1 -1
- package/dist/styles/confirm.css +1 -1
- package/dist/styles/container.css +1 -1
- package/dist/styles/data-list.css +2 -0
- package/dist/styles/data-table.css +2 -0
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/date-time-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/empty.css +1 -1
- package/dist/styles/fieldset.css +1 -1
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/flex.css +2 -0
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/floating-bottom-navigation.css +2 -0
- package/dist/styles/footer.css +1 -1
- package/dist/styles/form.css +1 -1
- package/dist/styles/gauge-chart.css +2 -0
- package/dist/styles/grid.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/heatmap-chart.css +2 -0
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/hover-card.css +2 -0
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/icon.css +1 -1
- package/dist/styles/image.css +1 -1
- package/dist/styles/line-chart.css +2 -0
- package/dist/styles/list.css +1 -1
- package/dist/styles/locale.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/meter.css +2 -0
- package/dist/styles/mockup.css +2 -0
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-field.css +1 -1
- package/dist/styles/overlay.css +1 -1
- package/dist/styles/page-layout.css +1 -1
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/portal.css +2 -0
- package/dist/styles/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/scatter-chart.css +2 -0
- package/dist/styles/scroll-area.css +2 -0
- package/dist/styles/scroll-zone.css +2 -0
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/show.css +2 -0
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/sparkline.css +2 -0
- package/dist/styles/spoiler.css +1 -1
- package/dist/styles/stack.css +2 -0
- package/dist/styles/statistic.css +2 -0
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text-link.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +2 -0
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/toolbar.css +2 -0
- package/dist/styles/tour.css +2 -0
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/tree-select.css +2 -0
- package/dist/styles/tree-view.css +2 -0
- package/dist/styles/typography.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +2606 -185
- package/dist/types.d.ts +566 -5
- package/package.json +26 -25
- package/.fix.py +0 -92
- package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
- package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -2
- package/dist/styles/avatar-group.css +0 -2
|
@@ -0,0 +1,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 e}from"react/jsx-runtime";import*as o 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(o,a){return e(t,{children:[o,a?r("span",{"aria-hidden":"true",children:" *"}):null]})}export function MPFieldOutline({label:t,required:e=!1,notched:o=!0}){return r("fieldset",{"aria-hidden":"true",className:["pointer-events-none absolute inset-0
|
|
2
|
+
import{jsx as r,Fragment as t,jsxs as e}from"react/jsx-runtime";import*as o 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(o,a){return e(t,{children:[o,a?r("span",{"aria-hidden":"true",children:" *"}):null]})}export function MPFieldOutline({label:t,required:e=!1,notched:o=!0}){return r("fieldset",{"aria-hidden":"true",className:["pointer-events-none absolute inset-0 m-0 min-w-0 px-2 pt-0",t?"-top-[5px]":"","text-start","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"].filter(Boolean).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)",o?"max-w-full px-1":"max-w-0 px-0"].join(" "),children:d(t,e)}):null})}export function MPFieldLabel({size:t,label:e,required:o=!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(e,o)})}export function useFloatingLabel({floating:r,filled:t,pinned:e=!1}){const[a,n]=o.useState(!1);return{shrunk:!r||t||a||e,focusProps:{onFocusCapture:()=>n(!0),onBlurCapture:r=>{r.currentTarget.contains(r.relatedTarget)||n(!1)}}}}
|
package/dist/internal/Picker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{Field as r}from"@base-ui/react/field";import{Popover as i}from"@base-ui/react/popover";import{MPIcon as t}from"../components/icon/MPIcon.js";import{CloseIcon as l}from"../constants/icons.js";import{accentSlots as s}from"./accent.js";import{MPFieldLabel as a,MPFieldOutline as p,useFloatingLabel as c}from"./FieldOutline.js";import{MPStateLayer as u}from"./StateLayer.js";import{MPSupportingText as m}from"./SupportingText.js";import{MPWidthSizer as d}from"./WidthSizer.js";import{displaySamples as f}from"./date.js";import{CONTROL_ICON as h,hasContent as x,PROSE_TEXT as g}from"./scale.js";import{FADE as b,PORTAL_LAYER as y}from"./surface.js";export function useDisplaySamples(e,n){const r=`${e??""} ${JSON.stringify(n)}`;return o.useMemo(()=>f(e,n),[r])}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 POPUP_PAD={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function MPPickerShell({slug:f,size:v="md",color:P="primary",fullWidth:N=!1,label:k,floatingLabel:w=!0,description:C,errorMessage:O,startIcon:M,required:D=!1,disabled:F=!1,readOnly:S=!1,id:z,className:B,style:_,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,display:A,samples:E,empty:L,clearable:W=!1,onClear:J,open:V,onOpenChange:Z,labels:G,hiddenValues:H,children:Q,triggerRef:X}){const Y=x(O),ee=j[v],ne=o.useId(),oe=z??ne,re=W&&!L&&!(F||S),{shrunk:ie,focusProps:te}=c({floating:w&&x(k),filled:!L,pinned:V||x(M)});return n(r.Root,{disabled:F,invalid:Y,"data-mp-size":v,className:[`mp-${f} group flex-col align-top`,N?"flex w-full":"inline-flex w-fit",B??""].filter(Boolean).join(" "),style:{...s(P),..._},...te,children:[n(i.Root,{open:V,onOpenChange:Z,children:[n("div",{className:"relative w-full",children:[n(i.Trigger,{id:oe,ref:X,disabled:F,nativeButton:!0,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",ee.padding,re?"pe-10":"",ee.height,g[v],F?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(S?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[M?e("span",{className:["flex shrink-0 items-center",F?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:M}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:["w-full truncate text-start",L&&!F?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:L&&!ie?null:A}),e(d,{samples:E??[]})]})]}),re?n("button",{type:"button","aria-label":G.clear,onClick:J,className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(u,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(t,{icon:l,size:h[v]})]}):null,e(p,{label:k,required:D,notched:ie}),x(k)?e(a,{size:v,label:k,required:D,htmlFor:oe,shrunk:ie}):null]}),e(i.Portal,{children:e(i.Positioner,{className:y,sideOffset:4,align:"start",children:e(i.Popup,{initialFocus:!1,style:s(P),className:[`mp-${f}__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container`,"text-mp-on-surface outline-none",POPUP_PAD[v],g[v],b].join(" "),children:Q})})})]}),e(m,{description:C,errorMessage:O,className:ee.padding}),H?.map((n,o)=>e("input",{type:"hidden",name:n.name,value:n.value},o))]})}export function MPPickerFooter({children:n}){return e("div",{className:"border-mp-outline-variant flex items-center justify-end gap-1 border-t pt-1.5",children:n})}export function MPPickerDivider(){return e("div",{"aria-hidden":"true",className:"bg-mp-outline-variant w-px self-stretch"})}export const FOOTER_SIZE={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};
|
|
2
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{Field as r}from"@base-ui/react/field";import{Popover as i}from"@base-ui/react/popover";import{MPIcon as t}from"../components/icon/MPIcon.js";import{CloseIcon as l}from"../constants/icons.js";import{accentSlots as s}from"./accent.js";import{MPFieldLabel as a,MPFieldOutline as p,useFloatingLabel as c}from"./FieldOutline.js";import{MPStateLayer as u}from"./StateLayer.js";import{MPSupportingText as m}from"./SupportingText.js";import{MPWidthSizer as d}from"./WidthSizer.js";import{displaySamples as f}from"./date.js";import{CONTROL_ICON as h,hasContent as x,PROSE_TEXT as g}from"./scale.js";import{FADE as b,PORTAL_LAYER as y}from"./surface.js";export function useDisplaySamples(e,n){const r=`${e??""} ${JSON.stringify(n)}`;return o.useMemo(()=>f(e,n),[r])}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 POPUP_PAD={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function MPPickerShell({slug:f,size:v="md",color:P="primary",fullWidth:N=!1,label:k,floatingLabel:w=!0,description:C,errorMessage:O,startIcon:M,required:D=!1,disabled:F=!1,readOnly:S=!1,id:z,className:B,style:_,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,display:A,samples:E,empty:L,clearable:W=!1,onClear:J,open:V,onOpenChange:Z,labels:G,hiddenValues:H,children:Q,triggerRef:X}){const Y=x(O),ee=j[v],ne=o.useId(),oe=z??ne,re=W&&!L&&!(F||S),{shrunk:ie,focusProps:te}=c({floating:w&&x(k),filled:!L,pinned:V||x(M)});return n(r.Root,{disabled:F,invalid:Y,"data-mp-size":v,className:[`mp-${f} group flex-col align-top`,N?"flex w-full":"inline-flex w-fit",B??""].filter(Boolean).join(" "),style:{...s(P),..._},...te,children:[n(i.Root,{open:V,onOpenChange:Z,children:[n("div",{className:"relative w-full",children:[n(i.Trigger,{id:oe,ref:X,disabled:F,nativeButton:!0,onKeyDown:I,onKeyUp:K,onFocus:R,onBlur:U,onClick:$,onDoubleClick:q,onContextMenu:T,className:["relative flex w-full items-center gap-2 select-none","appearance-none border-0 bg-transparent font-[inherit] outline-none",ee.padding,re?"pe-10":"",ee.height,g[v],F?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(S?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[M?e("span",{className:["flex shrink-0 items-center",F?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:M}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:["w-full truncate text-start",L&&!F?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:L&&!ie?null:A}),e(d,{samples:E??[]})]})]}),re?n("button",{type:"button","aria-label":G.clear,onClick:J,className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent p-0 font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(u,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(t,{icon:l,size:h[v]})]}):null,e(p,{label:k,required:D,notched:ie}),x(k)?e(a,{size:v,label:k,required:D,htmlFor:oe,shrunk:ie}):null]}),e(i.Portal,{children:e(i.Positioner,{className:y,sideOffset:4,align:"start",children:e(i.Popup,{initialFocus:!1,style:s(P),className:[`mp-${f}__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container`,"text-mp-on-surface outline-none",POPUP_PAD[v],g[v],b].join(" "),children:Q})})})]}),e(m,{description:C,errorMessage:O,className:ee.padding}),H?.map((n,o)=>e("input",{type:"hidden",name:n.name,value:n.value},o))]})}export function MPPickerFooter({children:n}){return e("div",{className:"border-mp-outline-variant flex items-center justify-end gap-1 border-t pt-1.5",children:n})}export function MPPickerDivider(){return e("div",{"aria-hidden":"true",className:"bg-mp-outline-variant w-px self-stretch"})}export const FOOTER_SIZE={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wedge that points a floating sheet back at what opened it.
|
|
3
|
+
*
|
|
4
|
+
* Three components draw one — `MPTooltip`, `MPPopover` and `MPHoverCard` — and
|
|
5
|
+
* all three drew it themselves: the same four turn classes, the same viewBox,
|
|
6
|
+
* the same path, the same `aria-hidden`. Only the fill ever differed, and only
|
|
7
|
+
* because a tooltip is drawn on its own ink rather than on a container tone.
|
|
8
|
+
*
|
|
9
|
+
* Three copies of one shape is three chances for one of them to be edited alone,
|
|
10
|
+
* and the failure would be quiet — a wedge one pixel out of line with the sheet
|
|
11
|
+
* above it is not something anybody reports.
|
|
12
|
+
*
|
|
13
|
+
* The positioning stays with the caller. Each of the three has its own `Arrow`
|
|
14
|
+
* part from Base UI, which is what measures the collision and reports the side,
|
|
15
|
+
* and none of them can be swapped for another. So this takes the **className**
|
|
16
|
+
* that goes on that part and the drawing that goes inside it, and the caller
|
|
17
|
+
* spells the two lines that say which part it is.
|
|
18
|
+
*
|
|
19
|
+
* Nothing here is exported from `src/index.ts`. It is the library talking to
|
|
20
|
+
* itself, in the sense `internal/` always means.
|
|
21
|
+
*/
|
|
22
|
+
import * as React from 'react';
|
|
23
|
+
/**
|
|
24
|
+
* Which way the wedge is turned, by the side Base UI says it landed on.
|
|
25
|
+
*
|
|
26
|
+
* Drawn pointing down once and rotated to match, which is a rotation of a glyph
|
|
27
|
+
* — the one allowance the rule against moving a surface makes. The one-pixel
|
|
28
|
+
* overlap on each side is what closes the hairline a fractional position would
|
|
29
|
+
* otherwise leave between the wedge and the sheet it belongs to.
|
|
30
|
+
*/
|
|
31
|
+
export declare const POPUP_ARROW_TURN: string;
|
|
32
|
+
/**
|
|
33
|
+
* The drawing itself, twice as wide as it is tall.
|
|
34
|
+
*
|
|
35
|
+
* `aria-hidden`, because the wedge says nothing a reader has not already been
|
|
36
|
+
* told: the sheet it hangs off is announced by the thing that opened it, and an
|
|
37
|
+
* arrow announced separately would be a second object in the tree that is really
|
|
38
|
+
* a corner of the first.
|
|
39
|
+
*
|
|
40
|
+
* @param size the wedge's width in pixels. It is half that tall.
|
|
41
|
+
* @param fill the surface the sheet is drawn on, as a custom property.
|
|
42
|
+
*/
|
|
43
|
+
export declare function PopupArrow({ size, fill }: {
|
|
44
|
+
size: number;
|
|
45
|
+
fill: string;
|
|
46
|
+
}): React.JSX.Element;
|
|
47
|
+
/**
|
|
48
|
+
* How wide the wedge is at each rung.
|
|
49
|
+
*
|
|
50
|
+
* `MPPopover` and `MPHoverCard` share this one; `MPTooltip` keeps its own, two
|
|
51
|
+
* pixels narrower throughout, because a tooltip is a strip of text rather than a
|
|
52
|
+
* sheet and a wedge sized for a card reads as a spike coming off it.
|
|
53
|
+
*/
|
|
54
|
+
export declare const POPUP_ARROW_SIZE: {
|
|
55
|
+
readonly xs: 8;
|
|
56
|
+
readonly sm: 9;
|
|
57
|
+
readonly md: 10;
|
|
58
|
+
readonly lg: 11;
|
|
59
|
+
readonly xl: 12;
|
|
60
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";export const POPUP_ARROW_TURN=/*@__PURE__*/["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" ");export function PopupArrow({size:e,fill:a}){return t("svg",{width:e,height:e/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:t("path",{d:"M0 0h10L5 5z",fill:a})})}export const POPUP_ARROW_SIZE={xs:8,sm:9,md:10,lg:11,xl:12};
|
|
@@ -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 m=n(s)?"error":n(o)?"description":"none",c=r.useRef(null),p=r.useRef(m);r.useLayoutEffect(()=>{const e=c.current,r=p.current;p.current=m,e&&m!==r&&"none"!==m&&(e.dataset.mpReveal="none"===r?"open":"swap",e.style.animationName="none",e.offsetWidth,e.style.animationName="")},[m]);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:c,className:"mp-supporting-text__reveal",children:e(t.Error,{match:!0,className:`${l} text-mp-error`,children:s})}):n(o)?e("div",{ref:c,className:"mp-supporting-text__reveal",children:e(t.Description,{className:`${l} text-mp-on-surface-variant m-0`,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.
|
package/dist/internal/animate.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import{ANIM_BASE as e,ANIMATION_CLASS as t,animationSlots as n,easingValue as r,isInfinite as a,lengthValue as s,repeatValue as o,revealClip as i,slideOffsets as c}from"./animate-core.js";export{e as ANIM_BASE,t as ANIMATION_CLASS,n as animationSlots,r as easingValue,a as isInfinite,s as lengthValue,o as repeatValue,i as revealClip,c as slideOffsets};import*as u from"react";export function staggerChildren(e,t,r,{stagger:a,durationStep:s=0,reverse:o=!1}){const i=u.Children.toArray(e);return i.map((e,c)=>{const d=o?i.length-1-c:c,f=n({...r,delay:r.delay+d*a,durationOffset:(r.durationOffset??0)+d*s});if(!u.isValidElement(e))return u.createElement("span",{key:c,className:t,style:f},e);const l=e.props;return u.cloneElement(e,{className:[t,l.className].filter(Boolean).join(" "),style:{...f,...l.style}})})}const d="(prefers-reduced-motion: reduce)";function f(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(d);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function l(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(d).matches}function m(){return!1}export function usePrefersReducedMotion(){return u.useSyncExternalStore(f,l,m)}export function useAnimationRun({trigger:e,play:t,once:n,threshold:r,paused:a,infinite:s}){const o=u.useRef(null),[i,c]=u.useState("mount"===e),[d,f]=u.useState(0),l=u.useCallback(()=>{c(!0),f(e=>e+1)},[]);u.useLayoutEffect(()=>{const e=o.current;if(!e||0===d)return;const t=[e,...e.querySelectorAll(".mp-anim, .mp-marquee-track")];for(const e of t)e.style.animationName="none";e.offsetWidth;for(const e of t)e.style.animationName=""},[d]),u.useEffect(()=>{if("visible"!==e)return;const t=o.current;if(!t||"undefined"==typeof IntersectionObserver)return void c(!0);const a=new IntersectionObserver(([e])=>{e.isIntersecting?(l(),n&&a.disconnect()):n||c(!1)},{threshold:r});return a.observe(t),()=>a.disconnect()},[e,n,r,l]),u.useEffect(()=>{"manual"===e&&(t?l():c(!1))},[e,t,l]);const m=u.useCallback(()=>{s&&c(!1)},[s]),p="hover"===e?{onPointerEnter:l,onFocus:l,onPointerLeave:m,onBlur:m}:{};return{ref:u.useCallback(e=>{o.current=e},[]),state:i&&!a?"running":"paused",started:i,handlers:p}}export function useAnimateElement(r){const{trigger:a,play:s,once:o,threshold:i,paused:c,infinite:u,stagger:d=0,durationStep:f,reverse:l,effectClass:m,children:p,...h}=r,g=useAnimationRun({trigger:a,play:s,once:o,threshold:i,paused:c,infinite:u}),y=`${e} ${m??t[h.effect]}`,v=function(e,t,n){return"view"!==t?e:n?"paused":"running"}(g.state,h.timeline,c);return d>0?{ref:g.ref,className:"",style:{"--_mp-anim-state":v},props:{...g.handlers,"data-mp-animation":h.effect,"data-mp-state":v},children:staggerChildren(p,y,h,{stagger:d,durationStep:f,reverse:l})}:{ref:g.ref,className:y,style:{...n(h),"--_mp-anim-state":v},props:{...g.handlers,"data-mp-animation":h.effect,"data-mp-state":v},children:p}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the two navigation bars share, which is everything except the sheet.
|
|
3
|
+
*
|
|
4
|
+
* `MPBottomNavigation` is the bar held against the bottom edge of the window;
|
|
5
|
+
* `MPFloatingBottomNavigation` is the same row of destinations lifted clear of
|
|
6
|
+
* it. They differ in shape, in where they sit and in how wide they are — and in
|
|
7
|
+
* nothing a destination can see. So the context an `MPBottomNavigationItem`
|
|
8
|
+
* reads lives here rather than inside either of them, and an item works in
|
|
9
|
+
* both without knowing which it is in.
|
|
10
|
+
*
|
|
11
|
+
* A file of its own rather than one bar importing the other, because that
|
|
12
|
+
* import would run the wrong way: an item belongs to whichever bar it was put
|
|
13
|
+
* in, and a floating bar that had to pull in the full-width bar's height table
|
|
14
|
+
* and position map to reach a context would carry both sheets' CSS into every
|
|
15
|
+
* page that rendered either.
|
|
16
|
+
*
|
|
17
|
+
* There are no class strings in here, which is why it costs nothing to be
|
|
18
|
+
* shared — see the note at the top of `internal/density.ts` for what happens
|
|
19
|
+
* when there are.
|
|
20
|
+
*/
|
|
21
|
+
import * as React from 'react';
|
|
22
|
+
import type { MPSize } from '../types.js';
|
|
23
|
+
/** A destination's value. The same restraint `MPTabs` puts on a tab's. */
|
|
24
|
+
export type MPBottomNavigationValue = string | number;
|
|
25
|
+
/**
|
|
26
|
+
* Which names are drawn.
|
|
27
|
+
*
|
|
28
|
+
* MD3's three label behaviours, and the order they lose information in:
|
|
29
|
+
*
|
|
30
|
+
* - `all` — every destination is named. The only one that works for a reader
|
|
31
|
+
* who has not used the application before.
|
|
32
|
+
* - `selected` — only the destination the reader is on.
|
|
33
|
+
* - `none` — glyphs only.
|
|
34
|
+
*
|
|
35
|
+
* Undrawn is never unsaid: in both of the last two the names stay in the
|
|
36
|
+
* document for a screen reader, because a glyph on its own has no accessible
|
|
37
|
+
* name at all.
|
|
38
|
+
*/
|
|
39
|
+
export type MPBottomNavigationLabels = 'all' | 'selected' | 'none';
|
|
40
|
+
/** What an `MPBottomNavigationItem` inherits from whichever bar it is in. */
|
|
41
|
+
export interface MPBottomNavigationContextValue {
|
|
42
|
+
value: MPBottomNavigationValue | null;
|
|
43
|
+
change: (value: MPBottomNavigationValue) => void;
|
|
44
|
+
size: MPSize;
|
|
45
|
+
labels: MPBottomNavigationLabels;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the bar is the floating one.
|
|
49
|
+
*
|
|
50
|
+
* The one thing a destination does need to know, and it is about width rather
|
|
51
|
+
* than about looks: a full-width bar divides its own width between its
|
|
52
|
+
* destinations, so each is `flex-1`; a floating one is only as wide as what is
|
|
53
|
+
* in it, so each is as wide as its own contents. Stretched inside a lozenge
|
|
54
|
+
* they would each take a fifth of nothing.
|
|
55
|
+
*/
|
|
56
|
+
floating: boolean;
|
|
57
|
+
}
|
|
58
|
+
export declare const MPBottomNavigationContext: React.Context<MPBottomNavigationContextValue>;
|