material-plus-ui 1.5.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 +2 -1
- 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 +2 -1
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/badge/MPBadge.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 +19 -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.d.ts +49 -3
- package/dist/components/button/MPButton.js +1 -1
- package/dist/components/calendar/MPCalendar.d.ts +160 -0
- package/dist/components/calendar/MPCalendar.js +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/carousel/MPCarousel.js +1 -1
- package/dist/components/chat-bubble/MPChatBubble.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +31 -7
- 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 +71 -5
- 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 +166 -0
- package/dist/components/config/MPConfigProvider.js +2 -0
- package/dist/components/config/index.d.ts +2 -0
- package/dist/components/config/index.js +1 -0
- package/dist/components/confirm/MPConfirmProvider.d.ts +143 -0
- package/dist/components/confirm/MPConfirmProvider.js +2 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- 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/date-picker/MPDatePicker.d.ts +53 -2
- package/dist/components/date-picker/MPDatePicker.js +1 -1
- package/dist/components/date-picker/index.d.ts +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +24 -3
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/divider/MPDivider.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 +23 -1
- 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 +121 -0
- package/dist/components/image/MPImage.js +2 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- 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 +51 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +21 -2
- 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.d.ts +3 -3
- package/dist/components/number-field/MPNumberField.js +1 -1
- package/dist/components/otp-field/MPOtpField.js +1 -1
- package/dist/components/overlay/MPOverlay.d.ts +1 -1
- package/dist/components/overlay/MPOverlay.js +1 -1
- package/dist/components/pagination/MPPagination.js +1 -1
- package/dist/components/panes/MPPanes.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 +92 -0
- package/dist/components/popconfirm/MPPopconfirm.js +2 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/MPPopover.d.ts +1 -1
- 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/progress-box/MPProgressBox.js +1 -1
- package/dist/components/progress-circular/MPProgressCircular.js +1 -1
- package/dist/components/progress-linear/MPProgressLinear.js +1 -1
- 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 +28 -5
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/shortcut/MPShortcut.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/skeleton/MPSkeleton.js +1 -1
- package/dist/components/slider/MPSlider.d.ts +27 -0
- package/dist/components/slider/MPSlider.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +20 -1
- package/dist/components/snackbar/MPSnackbar.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.d.ts +153 -0
- package/dist/components/stepper/MPStepper.js +2 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/index.js +1 -0
- package/dist/components/switch/MPSwitch.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/text-field/MPTextField.d.ts +38 -14
- package/dist/components/text-field/MPTextField.js +1 -1
- package/dist/components/time-picker/MPTimePicker.js +1 -1
- package/dist/components/timeline/MPTimeline.d.ts +10 -2
- 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/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 +17 -1
- package/dist/components/typography/MPTypography.js +1 -1
- package/dist/components/visually-hidden/MPVisuallyHidden.d.ts +60 -0
- package/dist/components/visually-hidden/MPVisuallyHidden.js +2 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/constants/glyphs.d.ts +4 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +2 -0
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +40 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useMPColorScheme.d.ts +135 -0
- package/dist/hooks/useMPColorScheme.js +2 -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.d.ts +32 -0
- package/dist/hooks/useMPReducedMotion.js +2 -0
- package/dist/hooks/useMPShortcut.d.ts +105 -0
- package/dist/hooks/useMPShortcut.js +2 -0
- package/dist/hooks/useMPWindowClass.d.ts +55 -0
- package/dist/hooks/useMPWindowClass.js +2 -0
- package/dist/index.d.ts +43 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +19 -4
- 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/Picker.d.ts +15 -3
- package/dist/internal/Picker.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/color-scheme.d.ts +28 -0
- package/dist/internal/color-scheme.js +2 -0
- package/dist/internal/config.d.ts +62 -0
- package/dist/internal/config.js +2 -0
- package/dist/internal/data-table.d.ts +162 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +50 -3
- 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 +196 -1
- 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/confirm.d.ts +3 -0
- package/dist/internal/messages/confirm.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/picker.js +1 -1
- 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/progress.d.ts +14 -0
- 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 +86 -0
- package/dist/internal/step.js +1 -0
- 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 +48 -0
- package/dist/internal/window-class.js +2 -0
- 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 +2 -0
- 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 +2 -0
- package/dist/styles/confirm.css +2 -0
- 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 +2 -0
- 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/panes.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +2 -0
- 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/shortcut.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 +2 -0
- 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/visually-hidden.css +2 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1423 -114
- package/dist/types.d.ts +628 -3
- package/package.json +8 -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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* stops being a column, whether a drawer is open, and how tall the bars are.
|
|
16
16
|
*/
|
|
17
17
|
import * as React from 'react';
|
|
18
|
-
import type { MPSide, MPVariant, MPWindowClass } from '../types.js';
|
|
18
|
+
import type { MPElevation, MPSide, MPVariant, MPWindowClass } from '../types.js';
|
|
19
19
|
/**
|
|
20
20
|
* Which end of the band a sidebar takes.
|
|
21
21
|
*
|
|
@@ -109,18 +109,25 @@ export declare const MPPageLayoutContext: React.Context<MPPageLayoutContextValue
|
|
|
109
109
|
*/
|
|
110
110
|
export declare const MPSidebarSideContext: React.Context<MPSidebarSide | null>;
|
|
111
111
|
/**
|
|
112
|
-
* The same
|
|
112
|
+
* The same boundaries as classes, for the part of this that is decided in CSS
|
|
113
113
|
* rather than in JavaScript.
|
|
114
114
|
*
|
|
115
|
-
* `COLLAPSED_ONLY` hides something from the
|
|
115
|
+
* `COLLAPSED_ONLY` hides something from the class *up*, which is what a
|
|
116
116
|
* sidebar's own trigger wants: the button exists exactly while the column does
|
|
117
117
|
* not. `EXPANDED_ONLY` hides it below, which is what the column wants for the
|
|
118
118
|
* one paint between the server's markup arriving and JavaScript finding out how
|
|
119
119
|
* wide the window is — without it a phone draws a full-width sidebar and throws
|
|
120
120
|
* it away a moment later.
|
|
121
121
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* These were four arbitrary variants each — `min-[600px]:hidden` and its
|
|
123
|
+
* mirror — which is to say two more copies of the four widths, sitting a few
|
|
124
|
+
* lines under the copy that has just been removed. They are `internal/visibility.ts`
|
|
125
|
+
* now, and the same classes `MPShow` puts on: one vocabulary for "not at this
|
|
126
|
+
* width", so a sidebar and a bottom bar written against each other cannot part
|
|
127
|
+
* company at one of them.
|
|
128
|
+
*
|
|
129
|
+
* `none` is the only value that is not a window size class. A sidebar that never
|
|
130
|
+
* collapses has a trigger that is never shown and a column that always is.
|
|
124
131
|
*/
|
|
125
132
|
export declare const COLLAPSED_ONLY: Record<MPPageCollapse, string>;
|
|
126
133
|
export declare const EXPANDED_ONLY: Record<MPPageCollapse, string>;
|
|
@@ -180,3 +187,15 @@ export declare function drawerSide(side: MPSidebarSide): MPSide;
|
|
|
180
187
|
* `surface` — which is why it is what a bar defaults to.
|
|
181
188
|
*/
|
|
182
189
|
export declare const BAR_SURFACE: Record<MPVariant, string>;
|
|
190
|
+
/**
|
|
191
|
+
* What a bar paints, from whichever of `variant` and `elevation` answered.
|
|
192
|
+
*
|
|
193
|
+
* `containerSurface`'s rule, with the one difference a bar has: `outlined` does not
|
|
194
|
+
* draw a hairline round it — the rule under a top app bar belongs to the bar's
|
|
195
|
+
* own edge treatment — so a level replaces the surface outright whatever the
|
|
196
|
+
* variant was.
|
|
197
|
+
*
|
|
198
|
+
* A bar's `elevated` is level 2 rather than 1, because a bar sits over the
|
|
199
|
+
* page's content rather than in it. An explicit level says what it says.
|
|
200
|
+
*/
|
|
201
|
+
export declare function barSurface(variant: MPVariant, elevation: MPElevation | undefined): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import*as e from"react";export const MPPageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const MPSidebarSideContext=/*@__PURE__*/e.createContext(null);
|
|
2
|
+
import*as e from"react";import{HIDDEN_BELOW as t,HIDDEN_FROM as n}from"./visibility.js";import{below as r,useWindowMins as o}from"./window-class.js";import{ELEVATION_SURFACE as a}from"./elevation.js";export const MPPageLayoutContext=/*@__PURE__*/e.createContext({present:!1,register:()=>{},collapseBelow:"none",open:{start:!1,end:!1},setOpen:()=>{},scroll:"page"});export const MPSidebarSideContext=/*@__PURE__*/e.createContext(null);export const COLLAPSED_ONLY={none:"hidden",compact:n.compact,medium:n.medium,expanded:n.expanded,large:n.large,"extra-large":n["extra-large"]};export const EXPANDED_ONLY={none:"",compact:t.compact,medium:t.medium,expanded:t.expanded,large:t.large,"extra-large":t["extra-large"]};export function useMPCollapsed(t){const n=o(),a=r("none"===t?0:n[t]),d=e.useCallback(e=>{if(!a||"undefined"==typeof window||!window.matchMedia)return()=>{};const t=window.matchMedia(a);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},[a]),i=e.useCallback(()=>!(!a||"undefined"==typeof window||!window.matchMedia)&&window.matchMedia(a).matches,[a]);return e.useSyncExternalStore(d,i,()=>!1)}export function drawerSide(e){const t="undefined"!=typeof document&&"rtl"===document.documentElement.dir;return"start"===e?t?"right":"left":t?"left":"right"}export const BAR_SURFACE={filled:"bg-mp-surface-container-highest",tonal:"bg-mp-surface-container",elevated:"shadow-mp-2 bg-mp-surface-container-low",outlined:"bg-mp-surface",text:"bg-transparent"};export function barSurface(e,t){return void 0===t?BAR_SURFACE[e]:a[t]}
|
|
@@ -43,6 +43,20 @@ export interface MPProgressProps {
|
|
|
43
43
|
max?: number;
|
|
44
44
|
/** A name for what is loading. Read out with the value by a screen reader. */
|
|
45
45
|
label?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Keeps that name for a screen reader and takes it off the screen.
|
|
48
|
+
*
|
|
49
|
+
* For the indicator that is already labelled by what is around it — a spinner
|
|
50
|
+
* inside a card whose heading says what is loading, a bar under a filename.
|
|
51
|
+
* Drawing the name a second time is noise a sighted reader has to skip;
|
|
52
|
+
* *removing* it leaves a `progressbar` announced as "63%" and nothing else,
|
|
53
|
+
* which is a number with no subject.
|
|
54
|
+
*
|
|
55
|
+
* This is the third option, and it is the one the old `aria-label` was: the
|
|
56
|
+
* name stays in the accessibility tree and stops taking a line.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
hideLabel?: boolean;
|
|
46
60
|
/**
|
|
47
61
|
* Shows the value as text beside the shape. A percentage of the range unless
|
|
48
62
|
* `format` says otherwise.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one shape a value that changes with the window is written in.
|
|
3
|
+
*
|
|
4
|
+
* `MPResponsive<T>` in `src/types.ts` is the type — a value, or a map keyed by
|
|
5
|
+
* window size class, each entry applying from its own class upward. This is what
|
|
6
|
+
* turns one of those into something the stylesheet can read, and it is a module
|
|
7
|
+
* rather than three functions inside `MPGrid` because the grid stopped being the
|
|
8
|
+
* only component with a responsive prop.
|
|
9
|
+
*
|
|
10
|
+
* ## Why a custom property and not a class
|
|
11
|
+
*
|
|
12
|
+
* Because the values are arithmetic a caller picks at runtime. A column is
|
|
13
|
+
* `(100% + gutter) * span / columns - gutter` and a measure is whatever length
|
|
14
|
+
* was asked for; Tailwind finds classes by scanning source text, so an
|
|
15
|
+
* interpolated `w-[${n}]` generates no rule at all. The rules are therefore
|
|
16
|
+
* written once in `src/styles.css` and the per-instance numbers arrive as inline
|
|
17
|
+
* `--_mp-{name}-{class}` slots, exactly as a `color` reaches a background.
|
|
18
|
+
*
|
|
19
|
+
* The other half of that decision is what a media query can do that React
|
|
20
|
+
* cannot: an inherited custom property changes at a boundary without anything
|
|
21
|
+
* re-rendering, so the value a component lays itself out against is always the
|
|
22
|
+
* one that is actually on screen. A responsive prop resolved in JavaScript would
|
|
23
|
+
* be a subtree re-rendering at every window class to say the same thing, and a
|
|
24
|
+
* first paint on the server that has to be corrected afterwards.
|
|
25
|
+
*
|
|
26
|
+
* ## Why only the classes that were named
|
|
27
|
+
*
|
|
28
|
+
* `span={{ expanded: 6 }}` writes one custom property and not five. The gaps are
|
|
29
|
+
* filled in by the stylesheet, which falls each class back to the one below it —
|
|
30
|
+
* see the rungs in `src/styles.css`. That keeps the `style` attribute down to
|
|
31
|
+
* what was asked for, which is the difference between a list of two hundred rows
|
|
32
|
+
* carrying one declaration each and carrying five.
|
|
33
|
+
*/
|
|
34
|
+
import type * as React from 'react';
|
|
35
|
+
import type { MPResponsive, MPWindowClass } from '../types.js';
|
|
36
|
+
/** A bare value means "from `compact` up"; a map is already per class. */
|
|
37
|
+
export declare function classMap<T>(value: MPResponsive<T> | undefined): Partial<Record<MPWindowClass, T>>;
|
|
38
|
+
/**
|
|
39
|
+
* Turns a responsive value into the `--_mp-{name}-{class}` slots the stylesheet
|
|
40
|
+
* reads, writing only the classes the caller actually named.
|
|
41
|
+
*
|
|
42
|
+
* `toCss` is the component's own, because what a number means is the component's
|
|
43
|
+
* business: a span is a count, a gutter is a length on Tailwind's spacing scale,
|
|
44
|
+
* a measure is either a rung of the size ladder or a length said outright.
|
|
45
|
+
*/
|
|
46
|
+
export declare function responsiveSlots<T>(name: string, value: MPResponsive<T> | undefined, toCss: (value: T) => string): React.CSSProperties;
|
|
47
|
+
/**
|
|
48
|
+
* Fills the `compact` entry of a partial map in with the prop's own default.
|
|
49
|
+
*
|
|
50
|
+
* Without this, `spacing={{ expanded: 8 }}` would be a grid with no gutter at all
|
|
51
|
+
* below 840dp — the stylesheet's `0px` fallback rather than the documented 4 —
|
|
52
|
+
* and a caller who widened one class would silently lose every class under it. A
|
|
53
|
+
* map says "from here up, this instead"; it does not say "and nothing below".
|
|
54
|
+
*/
|
|
55
|
+
export declare function withBaseline<T>(value: MPResponsive<T> | undefined, baseline: T): MPResponsive<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WINDOW_CLASSES as o}from"./window-class.js";export function classMap(o){return null==o?{}:"object"==typeof o?o:{compact:o}}export function responsiveSlots(t,n,c){const e=classMap(n),s={};for(const n of o){const o=e[n];void 0!==o&&(s[`--_mp-${t}-${n}`]=c(o))}return s}export function withBaseline(o,t){return null==o?t:"object"==typeof o?{compact:t,...o}:o}
|
package/dist/internal/scale.d.ts
CHANGED
|
@@ -116,23 +116,6 @@ export declare const SHEET_TITLE: Record<MPSize, string>;
|
|
|
116
116
|
export declare const SHEET_GAP: Record<MPSize, string>;
|
|
117
117
|
/** The gap between a control and the text stacked above or below it. */
|
|
118
118
|
export declare const STACK_GAP: Record<MPSize, string>;
|
|
119
|
-
/**
|
|
120
|
-
* The measure — how wide a row of content is allowed to get — in `rem` and
|
|
121
|
-
* pinned to MD3's window size class boundaries: 600, 840, 1200 and 1600dp, with
|
|
122
|
-
* one rung below them.
|
|
123
|
-
*
|
|
124
|
-
* So `maxWidth="md"` is "never wider than a medium window", which is a sentence
|
|
125
|
-
* about the specification rather than a number somebody liked. Tailwind's own
|
|
126
|
-
* `max-w-*` scale is a different set — `max-w-lg` is 32rem — and two ladders
|
|
127
|
-
* called `lg` on one page is how a layout drifts by a few pixels for no reason
|
|
128
|
-
* anybody can find later.
|
|
129
|
-
*
|
|
130
|
-
* It is here rather than in `MPContainer`, which was its first reader, for the
|
|
131
|
-
* reason at the top of this file: a header, a footer and a container that hold
|
|
132
|
-
* their content to "a medium window" have to agree on where that edge is, or the
|
|
133
|
-
* bar and the article under it line up at every width but one.
|
|
134
|
-
*/
|
|
135
|
-
export declare const MEASURE: Record<MPSize, string>;
|
|
136
119
|
/**
|
|
137
120
|
* Whether a slot was given something worth drawing a wrapper around.
|
|
138
121
|
*
|
package/dist/internal/scale.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CONTROL_HEIGHT={xs:"h-8",sm:"h-10",md:"h-14",lg:"h-16",xl:"h-18"};export const CONTROL_SQUARE={xs:"size-8",sm:"size-10",md:"size-14",lg:"size-16",xl:"size-18"};export const CONTROL_TEXT={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-title-medium",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};export const CONTROL_PAD_X={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-8",xl:"px-10"};export const CONTROL_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const CONTROL_ICON={xs:16,sm:18,md:20,lg:22,xl:24};export const PROSE_TEXT={xs:"text-mp-body-medium",sm:"text-mp-body-medium",md:"text-mp-body-large",lg:"text-mp-body-large",xl:"text-mp-body-large"};export const META_TEXT="text-mp-body-small";export const SHEET_PAD={xs:"p-2.5",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"};export const SHEET_PAD_X={xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"};export const SHEET_PAD_Y={xs:"py-2.5",sm:"py-3",md:"py-4",lg:"py-5",xl:"py-6"};export const SHEET_TITLE={xs:"text-mp-title-small",sm:"text-mp-title-small",md:"text-mp-title-medium",lg:"text-mp-title-large",xl:"text-mp-headline-small"};export const SHEET_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const STACK_GAP={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export
|
|
1
|
+
export const CONTROL_HEIGHT={xs:"h-8",sm:"h-10",md:"h-14",lg:"h-16",xl:"h-18"};export const CONTROL_SQUARE={xs:"size-8",sm:"size-10",md:"size-14",lg:"size-16",xl:"size-18"};export const CONTROL_TEXT={xs:"text-mp-label-large",sm:"text-mp-label-large",md:"text-mp-title-medium",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};export const CONTROL_PAD_X={xs:"px-3",sm:"px-4",md:"px-6",lg:"px-8",xl:"px-10"};export const CONTROL_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-2",lg:"gap-2.5",xl:"gap-3"};export const CONTROL_ICON={xs:16,sm:18,md:20,lg:22,xl:24};export const PROSE_TEXT={xs:"text-mp-body-medium",sm:"text-mp-body-medium",md:"text-mp-body-large",lg:"text-mp-body-large",xl:"text-mp-body-large"};export const META_TEXT="text-mp-body-small";export const SHEET_PAD={xs:"p-2.5",sm:"p-3",md:"p-4",lg:"p-5",xl:"p-6"};export const SHEET_PAD_X={xs:"px-2.5",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"};export const SHEET_PAD_Y={xs:"py-2.5",sm:"py-3",md:"py-4",lg:"py-5",xl:"py-6"};export const SHEET_TITLE={xs:"text-mp-title-small",sm:"text-mp-title-small",md:"text-mp-title-medium",lg:"text-mp-title-large",xl:"text-mp-headline-small"};export const SHEET_GAP={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const STACK_GAP={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export function hasContent(t){return null!=t&&!1!==t&&""!==t}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bullet, the connector and the ladder they are drawn on — written once for
|
|
3
|
+
* the two components that draw a numbered sequence.
|
|
4
|
+
*
|
|
5
|
+
* `MPTimeline` shows a sequence that **happened**; `MPStepper` drives one that
|
|
6
|
+
* is being **worked through**. They are two components because those are two
|
|
7
|
+
* jobs — one is read and the other is pressed — but they are the same picture,
|
|
8
|
+
* and a picture kept by two tables is a picture that drifts the first time one
|
|
9
|
+
* of them is edited alone. That is the argument `scale.ts` makes about the size
|
|
10
|
+
* ladder, applied to a smaller thing.
|
|
11
|
+
*
|
|
12
|
+
* What is *not* here is anything either one decides on its own: the timeline's
|
|
13
|
+
* `meta` line, the stepper's reachability. Those are not shared and putting them
|
|
14
|
+
* here would make this a third component nobody renders.
|
|
15
|
+
*/
|
|
16
|
+
import type { MPSize } from '../types.js';
|
|
17
|
+
/**
|
|
18
|
+
* How far a step has got.
|
|
19
|
+
*
|
|
20
|
+
* Three rather than more, and `error` is deliberately not among them —
|
|
21
|
+
* `MPStepper` draws a failed step by swapping the accent family for `error`,
|
|
22
|
+
* which is one axis rather than a fourth state every table below would have to
|
|
23
|
+
* grow a row for. The three are about *position in the sequence*; the colour is
|
|
24
|
+
* about what happened.
|
|
25
|
+
*/
|
|
26
|
+
export type MPStepStatus = 'complete' | 'current' | 'upcoming';
|
|
27
|
+
/** How the line between two steps is drawn. `none` leaves the gap open. */
|
|
28
|
+
export type MPStepConnector = 'solid' | 'dashed' | 'dotted' | 'none';
|
|
29
|
+
/**
|
|
30
|
+
* The bullet.
|
|
31
|
+
*
|
|
32
|
+
* Its own ladder rather than a step off `CONTROL_HEIGHT`, for the reason a
|
|
33
|
+
* checkbox's tick has one: a bullet is not a control you can put a label inside.
|
|
34
|
+
* It is a mark beside one, sized against the title next to it.
|
|
35
|
+
*
|
|
36
|
+
* It is written as a custom property rather than as a class because the
|
|
37
|
+
* connector has to know it: the line is centred on the bullet, and centring is
|
|
38
|
+
* arithmetic on this number.
|
|
39
|
+
*/
|
|
40
|
+
export declare const BULLET_SIZE: Record<MPSize, string>;
|
|
41
|
+
/** Between the bullet column and the content beside it. */
|
|
42
|
+
export declare const BULLET_GAP: Record<MPSize, string>;
|
|
43
|
+
/**
|
|
44
|
+
* How far apart two steps sit.
|
|
45
|
+
*
|
|
46
|
+
* The floor is set by the step with nothing in it. A step that is only a title
|
|
47
|
+
* and a time is one line tall, so the gap is the *whole* of what separates it
|
|
48
|
+
* from the next one — where a step with a paragraph under it has the paragraph's
|
|
49
|
+
* own leading working for it as well.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ITEM_GAP: Record<MPSize, string>;
|
|
52
|
+
/** The same ladder across, for the horizontal form. */
|
|
53
|
+
export declare const ITEM_GAP_X: Record<MPSize, string>;
|
|
54
|
+
/**
|
|
55
|
+
* What everything that changes with a step's status eases on.
|
|
56
|
+
*
|
|
57
|
+
* The bullet always had this. The line leaving it and the title beside it did
|
|
58
|
+
* not, so advancing a stepper drew one event twice: a bullet filling with the
|
|
59
|
+
* accent over 200ms, and a connector and a heading arriving at their new colours
|
|
60
|
+
* in the frame the state changed. A sequence is read across, and the half of it
|
|
61
|
+
* that snapped was the half that carries the eye to the next step.
|
|
62
|
+
*
|
|
63
|
+
* `border-color` and `color` rather than a blanket `transition-colors`, which
|
|
64
|
+
* would also put the `background-color` and the `box-shadow` of the three-line
|
|
65
|
+
* `BULLET` table on every connector — a line has neither, and a transition
|
|
66
|
+
* listing a property nothing declares is a declaration the browser keeps.
|
|
67
|
+
*/
|
|
68
|
+
export declare const STEP_MOTION: string;
|
|
69
|
+
export declare const BORDER_STYLE: Record<MPStepConnector, string>;
|
|
70
|
+
/**
|
|
71
|
+
* The bullet at each of the three states.
|
|
72
|
+
*
|
|
73
|
+
* Every one of them is a different axis, never a different opacity: `complete`
|
|
74
|
+
* is filled with the accent under its own ink, `current` is the same fill with a
|
|
75
|
+
* halo of the container tone around it, and `upcoming` is a hairline ring on the
|
|
76
|
+
* page's own surface. A reader who cannot tell the colours apart still has a
|
|
77
|
+
* filled shape, a haloed shape and an empty one.
|
|
78
|
+
*/
|
|
79
|
+
export declare const BULLET: Record<MPStepStatus, string>;
|
|
80
|
+
/**
|
|
81
|
+
* The line *after* a step, which is what makes it the step's own property: a
|
|
82
|
+
* connector is coloured by whether the step it leaves has been reached, not by
|
|
83
|
+
* where it arrives.
|
|
84
|
+
*/
|
|
85
|
+
export declare const CONNECTOR_COLOR: Record<MPStepStatus, string>;
|
|
86
|
+
export declare const TITLE_COLOR: Record<MPStepStatus, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const BULLET_SIZE={xs:"0.875rem",sm:"1rem",md:"1.25rem",lg:"1.5rem",xl:"1.875rem"};export const BULLET_GAP={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const ITEM_GAP={xs:"pb-5",sm:"pb-6",md:"pb-7",lg:"pb-8",xl:"pb-10"};export const ITEM_GAP_X={xs:"pe-5",sm:"pe-6",md:"pe-7",lg:"pe-8",xl:"pe-10"};export const STEP_MOTION=/*@__PURE__*/["transition-[border-color,color]","duration-(--mp-sys-motion-duration-short4)","ease-mp-standard"].join(" ");export const BORDER_STYLE={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted",none:""};export const BULLET={complete:"bg-(--_mp-accent) text-(--_mp-on-accent)",current:"bg-(--_mp-accent) text-(--_mp-on-accent) shadow-[0_0_0_0.25rem_var(--_mp-accent-container)]",upcoming:"border-mp-outline text-mp-on-surface-variant border-2 bg-transparent"};export const CONNECTOR_COLOR={complete:"border-(--_mp-accent)",current:"border-mp-outline-variant",upcoming:"border-mp-outline-variant"};export const TITLE_COLOR={complete:"text-mp-on-surface",current:"text-(--_mp-accent)",upcoming:"text-mp-on-surface-variant"};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPDensity, MPSize } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The cell padding at a density step: two pixels off each face, which is MD3's
|
|
5
|
+
* four off the row.
|
|
6
|
+
*
|
|
7
|
+
* The two axes bottom out in different places because they are answering
|
|
8
|
+
* different questions. Sideways it is the room between one column and the next,
|
|
9
|
+
* and 6px is where two numbers start touching. Vertically it is the row height,
|
|
10
|
+
* and 4px is what keeps the shortest row — `body-small`'s 16px line box at `xs`
|
|
11
|
+
* — on the 24px floor `MPDensity` names.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cellPadX(size: MPSize, density: MPDensity): string;
|
|
14
|
+
export declare function cellPadY(size: MPSize, density: MPDensity): string;
|
|
15
|
+
/**
|
|
16
|
+
* What a cell is set in. MD3's data table puts its cells in `body-medium` and
|
|
17
|
+
* its column headings in `title-small` — 14px at weight 500, which is the same
|
|
18
|
+
* size one weight up, so a heading reads as a heading without changing the
|
|
19
|
+
* column's measure.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CELL_TEXT: Record<MPSize, string>;
|
|
22
|
+
export declare const HEAD_TEXT: Record<MPSize, string>;
|
|
23
|
+
/**
|
|
24
|
+
* A row's own background, read from a slot rather than written inline.
|
|
25
|
+
*
|
|
26
|
+
* Everything else about a cell is inline because a host stylesheet outranks a
|
|
27
|
+
* utility — but a row has a *hover* state, and an inline style has no `:hover`.
|
|
28
|
+
* A custom property is the way out: the host cannot see it, so a one-class
|
|
29
|
+
* variant sets it without a fight, and the inline `background-color` on the row
|
|
30
|
+
* just reads whatever it currently holds.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ROW: string;
|
|
33
|
+
/**
|
|
34
|
+
* A cell's raw value, if React can draw it, and nothing if it cannot.
|
|
35
|
+
*
|
|
36
|
+
* Without `render`, a cell is `row[column.key]` — and `Row` is the caller's own
|
|
37
|
+
* type, so that value is genuinely anything. A `Date`, a nested object, a `Map`:
|
|
38
|
+
* handed to React each of them throws *Objects are not valid as a React child*,
|
|
39
|
+
* from inside a `.map()` in a `<tbody>`, which takes down the table and every
|
|
40
|
+
* boundary above it. One unexpected column in an API response was a blank page.
|
|
41
|
+
*
|
|
42
|
+
* A blank cell is the honest answer to "this is not text". The column already
|
|
43
|
+
* has `render` for the case where it is something else, and the prop docs
|
|
44
|
+
* already say so — what was missing is that failing to reach for it cost the
|
|
45
|
+
* whole page rather than one cell.
|
|
46
|
+
*
|
|
47
|
+
* The list is what React itself will draw: strings, numbers, bigints, and the
|
|
48
|
+
* three nothings. `null`, `undefined` and `boolean` are already nothing to
|
|
49
|
+
* React, and are passed through rather than filtered so that the `false` a
|
|
50
|
+
* `condition && value` leaves behind stays as harmless here as it is anywhere
|
|
51
|
+
* else in this library.
|
|
52
|
+
*/
|
|
53
|
+
export declare function drawableCell(value: unknown): React.ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";const e={xs:10,sm:12,md:16,lg:20,xl:24},m={xs:6,sm:10,md:16,lg:20,xl:24};function l(t){return t/16+"rem"}export function cellPadX(t,m){return l(Math.max(6,e[t]+2*m))}export function cellPadY(t,e){return l(Math.max(4,m[t]+2*e))}export const CELL_TEXT={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-large"};export const HEAD_TEXT={xs:"text-mp-label-medium",sm:"text-mp-label-medium",md:"text-mp-title-small",lg:"text-mp-title-small",xl:"text-mp-title-medium"};export const ROW=/*@__PURE__*/["[--_mp-row:transparent]","transition-[background-color] duration-(--mp-sys-motion-duration-short4)"].join(" ");export function drawableCell(e){if(null==e)return null;const m=typeof e;return"string"===m||"number"===m||"bigint"===m||"boolean"===m||t.isValidElement(e)?e:null}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a character ends, and where a word does.
|
|
3
|
+
*
|
|
4
|
+
* One module, because the alternative is three. `MPAnimateTyping` counts
|
|
5
|
+
* characters, `MPAnimateScramble` replaces them and `MPAnimateSplit` hands each
|
|
6
|
+
* one its own delay, and every one of those has to agree about what a character
|
|
7
|
+
* *is*. Three copies would be three opinions, and they would only disagree on
|
|
8
|
+
* the text nobody tests with.
|
|
9
|
+
*
|
|
10
|
+
* ## Why not `[...text]`, and why not `split('')`
|
|
11
|
+
*
|
|
12
|
+
* A code point is not a character. `👩👩👧` is seven of them joined by zero-width
|
|
13
|
+
* joiners; `한` typed on a Korean keyboard can be three; a flag is two; an
|
|
14
|
+
* accented letter may be one or two depending on how the file was normalised.
|
|
15
|
+
* A typewriter that advances by code points spends four frames assembling an
|
|
16
|
+
* emoji out of parts that mean nothing on their own, and a splitter that does it
|
|
17
|
+
* hands a screen reader — or a `key` — a fragment that is not a character.
|
|
18
|
+
*
|
|
19
|
+
* `split('')` is worse again: it splits by UTF-16 code *unit*, so it halves
|
|
20
|
+
* every astral character into two lone surrogates, which render as `�`.
|
|
21
|
+
*
|
|
22
|
+
* ## Why not `split(' ')` for words
|
|
23
|
+
*
|
|
24
|
+
* Because a word boundary is not a space anywhere east of Myanmar. Japanese,
|
|
25
|
+
* Chinese, Thai, Khmer and Lao write without them, so splitting on whitespace
|
|
26
|
+
* hands back the entire sentence as a single fragment — an effect that silently
|
|
27
|
+
* does nothing, in the languages where nobody testing it would notice.
|
|
28
|
+
*
|
|
29
|
+
* `Intl.Segmenter` knows both boundaries and is in every current engine. The
|
|
30
|
+
* fallbacks below are for a runtime that does not have it, and they are the
|
|
31
|
+
* naive answers rather than an attempt at a second implementation: something
|
|
32
|
+
* imperfect that runs beats an effect that throws.
|
|
33
|
+
*/
|
|
34
|
+
import * as React from 'react';
|
|
35
|
+
/**
|
|
36
|
+
* The text a node carries, and nothing about its markup.
|
|
37
|
+
*
|
|
38
|
+
* Elements contribute nothing on purpose. There is no honest way to type out
|
|
39
|
+
* half of a link, or to scramble the third character of a `<strong>` and leave
|
|
40
|
+
* the emphasis intact — the effects that read this animate *text*, so what they
|
|
41
|
+
* take is text.
|
|
42
|
+
*/
|
|
43
|
+
export declare function textOf(node: React.ReactNode): string;
|
|
44
|
+
/** The text split the way a reader would split it: by grapheme cluster. */
|
|
45
|
+
export declare function graphemesOf(text: string, locale?: string): string[];
|
|
46
|
+
/**
|
|
47
|
+
* The text split into words, with the space after each one kept on it.
|
|
48
|
+
*
|
|
49
|
+
* Kept rather than dropped, because a set of fragments that has thrown its
|
|
50
|
+
* whitespace away cannot be laid out again: joining with `' '` puts a space
|
|
51
|
+
* where a line break was and another one before a full stop. Each fragment
|
|
52
|
+
* carries what followed it, so the pieces still concatenate to the original.
|
|
53
|
+
*
|
|
54
|
+
* `isWordLike` is what separates a word from the punctuation and spacing
|
|
55
|
+
* between two of them, and the run of non-words after a word is folded onto it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function wordsOf(text: string, locale?: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="undefined"!=typeof Intl&&"Segmenter"in Intl;export function textOf(e){return"string"==typeof e||"number"==typeof e?String(e):Array.isArray(e)?e.map(textOf).join(""):""}export function graphemesOf(t,n){if(!e)return[...t];return[...new Intl.Segmenter(n,{granularity:"grapheme"}).segment(t)].map(e=>e.segment)}export function wordsOf(t,n){if(!e)return t.match(/\S+\s*|\s+/g)??[];const r=new Intl.Segmenter(n,{granularity:"word"}),o=[];for(const e of r.segment(t))e.isWordLike||0===o.length?o.push(e.segment):o[o.length-1]+=e.segment;return o}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MPColor, MPThreshold } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where a reading changes colour, resolved once.
|
|
4
|
+
*
|
|
5
|
+
* A meter and a gauge are the same quantity in two shapes, and a page carrying
|
|
6
|
+
* both must not disagree about where the amber starts. That is the whole reason
|
|
7
|
+
* this is not a private function inside whichever component needed it first —
|
|
8
|
+
* two copies of a scan this short would agree until the day one of them was
|
|
9
|
+
* edited alone.
|
|
10
|
+
*
|
|
11
|
+
* It is a file of its own rather than a section of `internal/chart.ts` because
|
|
12
|
+
* `MPMeter` is not a chart: reaching into that module for six lines would hand
|
|
13
|
+
* a bar the scales, the path builders and the palette.
|
|
14
|
+
*
|
|
15
|
+
* Written as a scan rather than a sort, so the array is read in the order it
|
|
16
|
+
* was given. Thresholds are meant to be listed in ascending order, and quietly
|
|
17
|
+
* reordering them would hide the one call site that did not.
|
|
18
|
+
*/
|
|
19
|
+
export declare function thresholdColor(value: number, color: MPColor, thresholds: readonly MPThreshold[] | undefined): MPColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function thresholdColor(o,r,t){if(!t||0===t.length)return r;let e=r;for(const r of t)o>=r.from&&(e=r.color);return e}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ValueScale } from './chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* A scale for an axis of instants.
|
|
4
|
+
*
|
|
5
|
+
* `valueScale`'s 1-2-5-10 family is the right one for a count and exactly the
|
|
6
|
+
* wrong one for a moment: run on epoch milliseconds it produces a tick every
|
|
7
|
+
* 200,000,000 ms, which lands at 14:53:20 on an arbitrary Tuesday. Nobody reads
|
|
8
|
+
* that. Time is not decimal below the year — sixty, sixty, twenty-four, seven,
|
|
9
|
+
* twelve — so its steps are written down rather than derived.
|
|
10
|
+
*
|
|
11
|
+
* A file of its own because only the timeline needs it. The other seven charts
|
|
12
|
+
* would carry a calendar for nothing.
|
|
13
|
+
*/
|
|
14
|
+
/** The units a time axis is allowed to step in. */
|
|
15
|
+
export type TimeUnit = 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year';
|
|
16
|
+
/** A value scale whose ticks are instants, plus the unit they step in. */
|
|
17
|
+
export interface TimeScale extends ValueScale {
|
|
18
|
+
unit: TimeUnit;
|
|
19
|
+
count: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The scale an axis of instants runs on.
|
|
23
|
+
*
|
|
24
|
+
* The ends round outward to the step, exactly as `valueScale`'s do, so an axis
|
|
25
|
+
* of work starting on a Wednesday afternoon begins at midnight on the Wednesday
|
|
26
|
+
* rather than at the first task's start.
|
|
27
|
+
*/
|
|
28
|
+
export declare function timeScale(extent: {
|
|
29
|
+
min: number;
|
|
30
|
+
max: number;
|
|
31
|
+
} | null, options?: {
|
|
32
|
+
min?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
tickCount?: number;
|
|
35
|
+
}): TimeScale;
|
|
36
|
+
/**
|
|
37
|
+
* A tick written at the resolution its step implies.
|
|
38
|
+
*
|
|
39
|
+
* An axis stepping in hours writes clock times and one stepping in months
|
|
40
|
+
* writes month names. Writing the whole instant at every step would be an axis
|
|
41
|
+
* of identical strings differing in one field, which is the least readable form
|
|
42
|
+
* of a date there is.
|
|
43
|
+
*/
|
|
44
|
+
export declare function formatTimeTick(value: number, unit: TimeUnit, locale: string | undefined): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=1e3,t=6e4,n=36e5,o=24*n,s=[{unit:"second",count:1,size:e},{unit:"second",count:5,size:5e3},{unit:"second",count:15,size:15e3},{unit:"second",count:30,size:3e4},{unit:"minute",count:1,size:t},{unit:"minute",count:5,size:3e5},{unit:"minute",count:15,size:9e5},{unit:"minute",count:30,size:18e5},{unit:"hour",count:1,size:n},{unit:"hour",count:3,size:3*n},{unit:"hour",count:6,size:6*n},{unit:"hour",count:12,size:12*n},{unit:"day",count:1,size:o},{unit:"day",count:2,size:2*o},{unit:"week",count:1,size:7*o},{unit:"month",count:1,size:30*o},{unit:"month",count:3,size:91*o},{unit:"year",count:1,size:365*o}];function u(e,t,n){const o=new Date(e);switch(t){case"second":o.setSeconds(o.getSeconds()+n);break;case"minute":o.setMinutes(o.getMinutes()+n);break;case"hour":o.setHours(o.getHours()+n);break;case"day":o.setDate(o.getDate()+n);break;case"week":o.setDate(o.getDate()+7*n);break;case"month":o.setMonth(o.getMonth()+n);break;default:o.setFullYear(o.getFullYear()+n)}return o.getTime()}function i(e,t,n){const o=function(e,t){const n=new Date(e);switch(t){case"second":n.setMilliseconds(0);break;case"minute":n.setSeconds(0,0);break;case"hour":n.setMinutes(0,0,0);break;case"day":n.setHours(0,0,0,0);break;case"week":n.setHours(0,0,0,0),n.setDate(n.getDate()-(n.getDay()+6)%7);break;case"month":n.setHours(0,0,0,0),n.setDate(1);break;default:n.setHours(0,0,0,0),n.setMonth(0,1)}return n.getTime()}(e,t);if(n<=1)return o;const s=new Date(o);switch(t){case"second":s.setSeconds(Math.floor(s.getSeconds()/n)*n);break;case"minute":s.setMinutes(Math.floor(s.getMinutes()/n)*n);break;case"hour":s.setHours(Math.floor(s.getHours()/n)*n);break;case"month":s.setMonth(Math.floor(s.getMonth()/n)*n);break;case"year":s.setFullYear(Math.floor(s.getFullYear()/n)*n)}return s.getTime()}export function timeScale(e,t={}){const{tickCount:a=6}=t,c=t.min??e?.min??Date.now(),r=t.max??e?.max??c+o,h=r-c||2*n,m=h/Math.max(1,a),d=s.reduce((e,t)=>Math.abs(Math.log(t.size/m))<Math.abs(Math.log(e.size/m))?t:e),l="year"===d.unit?function(e){const t=10**Math.floor(Math.log10(Math.max(1,e))),n=Math.max(1,e)/t;return n<=1?t:n<=2?2*t:n<=5?5*t:10*t}(h/(365*o)/a):d.count,M=void 0!==t.min?c:i(c,d.unit,l),g=void 0!==t.max?r:(()=>{let e=M;do{e=u(e,d.unit,l)}while(e<r);return e})(),k=g-M||1,z=[];for(let e=M;e<=g&&(z.push(e),!(z.length>500));e=u(e,d.unit,l));return{min:M,max:g,ticks:z,unit:d.unit,count:l,fraction:e=>(e-M)/k}}export function formatTimeTick(e,t,n){const o="second"===t?{minute:"2-digit",second:"2-digit"}:"minute"===t||"hour"===t?{hour:"numeric",minute:"2-digit"}:"day"===t||"week"===t?{month:"short",day:"numeric"}:"month"===t?{year:"numeric",month:"short"}:{year:"numeric"};return new Intl.DateTimeFormat(n,o).format(e)}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { MPAnimation, MPEasing, MPTransition } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The class and the inline slots one transition comes to.
|
|
5
|
+
*
|
|
6
|
+
* Split from `transitionProps` because `MPStack` needs the *options* rather than
|
|
7
|
+
* the finished style: it has a per-child step to add to the delay before the
|
|
8
|
+
* slots are filled. One table read by both is what keeps `transition="fade"` the
|
|
9
|
+
* same fade on a card and on a stack item.
|
|
10
|
+
*/
|
|
11
|
+
export declare function transitionParts(transition: MPTransition | undefined): {
|
|
12
|
+
effect: MPAnimation;
|
|
13
|
+
duration?: number;
|
|
14
|
+
delay: number;
|
|
15
|
+
easing?: MPEasing;
|
|
16
|
+
opacity: number;
|
|
17
|
+
scale?: number;
|
|
18
|
+
x?: string;
|
|
19
|
+
y?: string;
|
|
20
|
+
angle?: string;
|
|
21
|
+
clip?: string;
|
|
22
|
+
} | null;
|
|
23
|
+
/**
|
|
24
|
+
* The same reading, as the two things a component spreads onto its root.
|
|
25
|
+
*
|
|
26
|
+
* Returns empty strings and an empty object rather than `null` for the common
|
|
27
|
+
* case, so a caller composes them unconditionally instead of branching around
|
|
28
|
+
* them at every call site.
|
|
29
|
+
*/
|
|
30
|
+
export declare function transitionProps(transition: MPTransition | undefined): {
|
|
31
|
+
className: string;
|
|
32
|
+
style: React.CSSProperties;
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ANIM_BASE as e,ANIMATION_CLASS as t,animationSlots as a,revealClip as o,slideOffsets as n}from"./animate-core.js";const r={grow:.8,zoom:.4};export function transitionParts(e){if(!e)return null;const t="string"==typeof e?{effect:e}:e,{effect:a}=t,s="slide"===a?n(t.from??"bottom",t.distance??"100%"):null;return{effect:a,duration:t.duration,delay:t.delay??0,easing:t.easing,opacity:!1===t.fade||"reveal"===a?1:0,scale:t.scale??r[a],x:s?.x,y:s?.y,angle:"rotate"===a?`${t.angle??-180}deg`:void 0,clip:"reveal"===a?o(t.from??"left"):void 0}}export function transitionProps(o){const n=transitionParts(o);return n?{className:`${e} ${t[n.effect]}`,style:a({...n,repeat:1})}:{className:"",style:{}}}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showing and hiding at a window size class, as class names.
|
|
3
|
+
*
|
|
4
|
+
* Two components need this and neither is really about it: `MPShow` is nothing
|
|
5
|
+
* but this, and `MPSidebar` uses it to keep a column off a narrow screen for the
|
|
6
|
+
* one paint before JavaScript has found out how wide the window is.
|
|
7
|
+
*
|
|
8
|
+
* ## Why it is CSS and not the hook
|
|
9
|
+
*
|
|
10
|
+
* `useMPWindowClass` could answer the same question, and a page that swapped a
|
|
11
|
+
* whole navigation pattern on it would be right — eventually. The correction is
|
|
12
|
+
* a second render, so the first paint is a guess, and on a phone that guess is a
|
|
13
|
+
* desktop sidebar drawn and thrown away. A media query has no first render to be
|
|
14
|
+
* wrong: the browser resolves it before it paints anything, on the server's own
|
|
15
|
+
* markup.
|
|
16
|
+
*
|
|
17
|
+
* The cost is that both branches are in the DOM. That is the trade, and it is
|
|
18
|
+
* the right way round for a nav bar or a column of filters and the wrong way
|
|
19
|
+
* round for a heavy subtree that only one width ever sees — which is where the
|
|
20
|
+
* hook earns its second render.
|
|
21
|
+
*
|
|
22
|
+
* ## Why the names are written out
|
|
23
|
+
*
|
|
24
|
+
* These are Tailwind's own `hidden`, under the variants `src/styles.css`
|
|
25
|
+
* registers. Tailwind finds classes by scanning source text, so
|
|
26
|
+
* `mp-${windowClass}:hidden` assembled at runtime generates no rule at all and
|
|
27
|
+
* the component comes out visible at every width. Ten literal strings is what
|
|
28
|
+
* that costs, and it is why these are tables rather than a function.
|
|
29
|
+
*
|
|
30
|
+
* A consumer can spell the same classes — they are in the shipped stylesheet
|
|
31
|
+
* either way.
|
|
32
|
+
*/
|
|
33
|
+
import type { MPWindowClass } from '../types.js';
|
|
34
|
+
/**
|
|
35
|
+
* Hidden while the window is *narrower* than this class — "show from here up".
|
|
36
|
+
*
|
|
37
|
+
* `compact` is the empty string rather than a class: no window is narrower than
|
|
38
|
+
* compact, so there is nothing to hide it at.
|
|
39
|
+
*/
|
|
40
|
+
export declare const HIDDEN_BELOW: Record<MPWindowClass, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Hidden from this class *up* — "show until here", the upper bound.
|
|
43
|
+
*
|
|
44
|
+
* `compact` is a plain `hidden`, and that is not a special case being smuggled
|
|
45
|
+
* in: shown only below compact is shown nowhere, and the honest answer to a
|
|
46
|
+
* bound of zero is an element that never appears.
|
|
47
|
+
*/
|
|
48
|
+
export declare const HIDDEN_FROM: Record<MPWindowClass, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const HIDDEN_BELOW={compact:"",medium:"mp-below-medium:hidden",expanded:"mp-below-expanded:hidden",large:"mp-below-large:hidden","extra-large":"mp-below-extra-large:hidden"};export const HIDDEN_FROM={compact:"hidden",medium:"mp-medium:hidden",expanded:"mp-expanded:hidden",large:"mp-large:hidden","extra-large":"mp-extra-large:hidden"};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MPWindowClass } from '../types.js';
|
|
2
|
+
/** Smallest first, which is also the order the media queries have to be in. */
|
|
3
|
+
export declare const WINDOW_CLASSES: readonly MPWindowClass[];
|
|
4
|
+
/**
|
|
5
|
+
* The width each class starts at, in CSS pixels.
|
|
6
|
+
*
|
|
7
|
+
* A class runs from its own entry up to the next one's, so the test is `>=` and
|
|
8
|
+
* the widest matching class wins. `compact` starts at zero because there is no
|
|
9
|
+
* window narrower than no window.
|
|
10
|
+
*/
|
|
11
|
+
export declare const WINDOW_MIN: Record<MPWindowClass, number>;
|
|
12
|
+
/**
|
|
13
|
+
* The media query a floor is, and the one below it.
|
|
14
|
+
*
|
|
15
|
+
* A width rather than a class name, because the floors are no longer constants:
|
|
16
|
+
* whose ladder is being asked about is the caller's business and this only
|
|
17
|
+
* knows how to say one. Nought has no query — every window is at least that
|
|
18
|
+
* wide — and both return `null` there, which a caller reads as "there is nothing
|
|
19
|
+
* to watch".
|
|
20
|
+
*/
|
|
21
|
+
export declare function atLeast(min: number): string | null;
|
|
22
|
+
export declare function below(min: number): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* The floors in force at this point in the tree.
|
|
25
|
+
*
|
|
26
|
+
* MD3's, with whatever an `MPConfigProvider` moved written over them. `compact`
|
|
27
|
+
* is forced back to nought whatever it was given: a class whose floor is above
|
|
28
|
+
* zero leaves a band of windows in no class at all.
|
|
29
|
+
*
|
|
30
|
+
* The object is rebuilt on every call rather than memoised, and deliberately —
|
|
31
|
+
* every caller turns it into a number or a string before doing anything with it,
|
|
32
|
+
* so its identity is never a dependency of anything. Memoising it would be a
|
|
33
|
+
* `useMemo` whose own dependency is the identity of a prop callers write inline.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useWindowMins(): Record<MPWindowClass, number>;
|
|
36
|
+
/**
|
|
37
|
+
* `useSyncExternalStore` rather than an effect and a `useState`, for the reason
|
|
38
|
+
* `useMPCollapsed` gives: the hook needs a **server snapshot**, and this is the
|
|
39
|
+
* one API that tells React the server's answer and the client's are meant to
|
|
40
|
+
* differ. An effect would render the wrong layout once and then correct it,
|
|
41
|
+
* which React would not know to expect.
|
|
42
|
+
*
|
|
43
|
+
* The ladder reaches the store as a string. Everything `useSyncExternalStore`
|
|
44
|
+
* is given has to be stable between renders or it resubscribes on each one, and
|
|
45
|
+
* a `breakpoints` prop written inline — which is how anybody would write it — is
|
|
46
|
+
* a new object every time its provider renders.
|
|
47
|
+
*/
|
|
48
|
+
export declare function useWindowClass(onServer: MPWindowClass): MPWindowClass;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as t from"react";import{MPConfigContext as e}from"./config.js";export const WINDOW_CLASSES=["compact","medium","expanded","large","extra-large"];export const WINDOW_MIN={compact:0,medium:600,expanded:840,large:1200,"extra-large":1600};export function atLeast(t){return t>0?`(width >= ${t}px)`:null}export function below(t){return t>0?`(width < ${t}px)`:null}export function useWindowMins(){const{breakpoints:n}=t.useContext(e);return n?{...WINDOW_MIN,...n,compact:0}:WINDOW_MIN}const n={classes:[],lists:[]},o=new Map;function s(t){if("undefined"==typeof window||!window.matchMedia)return n;let e=o.get(t);if(!e){const n=t.split(",").map(Number),s=WINDOW_CLASSES.map((t,e)=>[t,n[e]]).filter(([,t])=>t>0);e={classes:s.map(([t])=>t),lists:s.map(([,t])=>window.matchMedia(atLeast(t)))},o.set(t,e)}return e}export function useWindowClass(e){const n=(o=useWindowMins(),WINDOW_CLASSES.map(t=>o[t]).join(","));var o;const r=t.useCallback(t=>function(t,e){const{lists:n}=s(t);for(const t of n)t.addEventListener("change",e);return()=>{for(const t of n)t.removeEventListener("change",e)}}(n,t),[n]),a=t.useCallback(()=>function(t,e){const{classes:n,lists:o}=s(t);if(0===o.length)return e;let r=WINDOW_CLASSES[0];return n.forEach((t,e)=>{o[e]?.matches&&(r=t)}),r}(n,e),[n,e]);return t.useSyncExternalStore(r,a,a)}
|