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,77 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartBaseProps } from '../../internal/ChartChrome.js';
|
|
3
|
+
import type { MPChartCategory, MPChartDatum } from '../../types.js';
|
|
4
|
+
/** How the ring is drawn. */
|
|
5
|
+
export type MPPieChartShape = 'pie' | 'donut' | 'semi';
|
|
6
|
+
export interface MPPieChartProps extends ChartBaseProps {
|
|
7
|
+
/**
|
|
8
|
+
* The slices. Numbers, or points carrying their own name and colour.
|
|
9
|
+
*
|
|
10
|
+
* One series and not an array of them, because that is what a pie **is**: the
|
|
11
|
+
* slices are the entities here, so each takes a palette slot of its own and
|
|
12
|
+
* the legend lists them rather than listing series.
|
|
13
|
+
*/
|
|
14
|
+
data: readonly MPChartDatum[];
|
|
15
|
+
/** What each slice is called. Points may carry their own `x` instead. */
|
|
16
|
+
categories?: readonly MPChartCategory[];
|
|
17
|
+
/**
|
|
18
|
+
* - `pie` — a filled disc.
|
|
19
|
+
* - `donut` — a ring, with room in the middle for the total.
|
|
20
|
+
* - `semi` — half a ring, opened along the bottom, for a tile wider than it
|
|
21
|
+
* is tall.
|
|
22
|
+
* @default 'pie'
|
|
23
|
+
*/
|
|
24
|
+
shape?: MPPieChartShape;
|
|
25
|
+
/**
|
|
26
|
+
* Where the first slice starts, in degrees clockwise from twelve o'clock.
|
|
27
|
+
* Ignored by `semi`, which is defined by where it opens.
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
startAngle?: number;
|
|
31
|
+
/**
|
|
32
|
+
* What goes in the hole. A ring with nothing in the middle is a pie with a
|
|
33
|
+
* bite taken out of it — the total, or the one figure the chart is about, is
|
|
34
|
+
* what the ring was drawn around.
|
|
35
|
+
*/
|
|
36
|
+
center?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Writes each slice's **share** on it, where the slice is wide enough to hold
|
|
39
|
+
* the text with room either side. One that does not fit is dropped rather
|
|
40
|
+
* than clipped; the hover panel and the table still have it.
|
|
41
|
+
*
|
|
42
|
+
* The share and not the value, because a share is what a pie is a picture of
|
|
43
|
+
* and the value is one hover away.
|
|
44
|
+
* @default 'none'
|
|
45
|
+
*/
|
|
46
|
+
valueLabels?: 'none' | 'all';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parts of a whole, at a glance.
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* <MPPieChart
|
|
53
|
+
* categories={['Search', 'Direct', 'Social']}
|
|
54
|
+
* data={[52, 31, 17]}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* The narrowest chart here and the easiest one to misuse. An angle is a poor
|
|
59
|
+
* thing to compare: two slices within a few percent of each other are
|
|
60
|
+
* indistinguishable, and nobody can rank six of them by eye. So a pie answers
|
|
61
|
+
* exactly one question — **is one of these most of it?** Anything finer, and
|
|
62
|
+
* anything past about six slices, is [MPBarChart](bar-chart), where the reader
|
|
63
|
+
* is judging length instead.
|
|
64
|
+
*
|
|
65
|
+
* ## What it does with a negative
|
|
66
|
+
*
|
|
67
|
+
* Leaves it out, and says so in the table. A negative has no share of a whole,
|
|
68
|
+
* and every way of drawing one is a lie: as an absolute it claims the opposite
|
|
69
|
+
* of what it means, and as a signed sweep it overlaps the slice beside it.
|
|
70
|
+
*
|
|
71
|
+
* ## Colour follows the slice
|
|
72
|
+
*
|
|
73
|
+
* A slice takes its palette slot from its place in `data`, never from its size.
|
|
74
|
+
* A chart that is refiltered or resorted keeps every category the colour it had
|
|
75
|
+
* — which is the whole reason a legend is worth reading twice.
|
|
76
|
+
*/
|
|
77
|
+
export declare function MPPieChart({ data, categories, shape, startAngle, center, valueLabels, height, format, locale: localeProp, label, legend, tooltip, empty, size: sizeProp, className, style, ...rest }: MPPieChartProps): React.JSX.Element;
|
|
@@ -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 n}from"../../hooks/useMPElementSize.js";import{useMPLocale as o,useMPMessages as r}from"../../internal/locale.js";import{useMPSize as a}from"../../internal/config.js";import{numberFormatter as i}from"../../internal/intl.js";import{CHART as s}from"../../internal/messages/chart.js";import{TABLE as m}from"../../internal/messages/table.js";import{ChartLegend as c,ChartShell as h,ChartTable as u,ChartTooltipPanel as d,useVisibility as f}from"../../internal/ChartChrome.js";import{CHART_FONT_SIZE as p,MARK_GAP as v,PLOT_HEIGHT as g,arcPath as y,categoryAt as x,formatCategory as b,formatStatistic as M,polarPoint as j,seriesColor as P,toValues as k}from"../../internal/chart.js";const w={style:"percent",maximumFractionDigits:1};export function MPPieChart({data:I,categories:z,shape:A="pie",startAngle:B=0,center:N,valueLabels:C="none",height:D,format:L,locale:R,label:S,legend:$,tooltip:_,empty:E,size:F,className:K,style:O,...U}){const W=a(F),X=o(R),Y=r(s,X),q=r(m,X),G=l.useRef(null),H=n(G),J=l.useId(),Q=l.useMemo(()=>k([{data:I}])[0],[I]),T=f(l.useMemo(()=>Q.map(()=>({})),[Q])),[V,Z]=l.useState(null),ee=l.useCallback(e=>M(e,X,L,!0),[L,X]),te=l.useMemo(()=>Q.map((e,t)=>b(x(t,z,[Q]),X)),[Q,z,X]),le=l.useMemo(()=>Q.map((e,t)=>e.color??P(t,void 0)),[Q]),ne=Q.map((e,t)=>T.visible[t]&&null!==e.value&&e.value>0?e.value:0),oe=ne.reduce((e,t)=>e+t,0),re=H.width,ae="number"==typeof D?D:void 0===D?g[W]:H.height,ie=p[W],se="semi"===A,me=re/2,ce=se?ae-ie-4:ae/2,he=Math.max(0,se?Math.min(re/2,ae-ie-8)-2:Math.min(re,ae)/2-2),ue="pie"===A?0:.62*he,de=se?Math.PI:2*Math.PI;let fe=se?-Math.PI/2:B*Math.PI/180;const pe=ne.map(e=>{const t=fe;return fe+=oe>0?e/oe*de:0,{from:t,to:fe,share:e}}),ve=e=>{const t=pe.map((e,t)=>e.share>0?t:-1).filter(e=>e>=0);if(0===t.length)return;const l=null===V?e>0?-1:0:t.indexOf(V);Z(t[(l+e+t.length)%t.length])},ge=e=>oe>0?i(X,w).format(e/oe):"",ye=null===V?null:pe[V],xe=ye&&ye.share>0?[{seriesIndex:V,color:le[V],value:ye.share,formatted:`${ee(ye.share)} · ${ge(ye.share)}`,label:Q[V]?.label}]:[],be=ye&&ye.share>0?te[V]:void 0,Me=ye?j(me,ce,.75*he,(ye.from+ye.to)/2):null,je=!1===_?{mode:"none"}:!0===_||void 0===_?{}:_,Pe=!1===$?{interactive:!1}:!0===$||void 0===$?{}:$,ke=!1!==$&&Q.length>1,we=oe<=0,Ie=[Q];return t(h,{...U,size:W,className:["mp-pie-chart",K??""].filter(Boolean).join(" "),style:O,plotRef:G,name:S??Y.label,describedBy:we?void 0:J,interactive:!we,height:D,legendSide:Pe.side??"bottom",plotProps:{onPointerMove:we||"none"===je.mode?void 0:e=>Z(((e,t)=>{const l=G.current;if(!l||oe<=0)return null;const n=l.getBoundingClientRect(),o=e-n.left-me,r=t-n.top-ce,a=Math.hypot(o,r);if(a>he+8||a<ue)return null;const i=Math.atan2(o,-r),s=pe.findIndex(({from:e,to:t,share:l})=>!(l<=0)&&(i-e+4*Math.PI)%(2*Math.PI)<t-e);return-1===s?null:s})(e.clientX,e.clientY)),onPointerLeave:()=>Z(null),onKeyDown:we||"none"===je.mode?void 0:e=>{if("ArrowRight"===e.key||"ArrowDown"===e.key)ve(1);else if("ArrowLeft"===e.key||"ArrowUp"===e.key)ve(-1);else{if("Escape"!==e.key)return;Z(null)}e.preventDefault()},onBlur:()=>Z(null)},tooltip:Me&&xe.length>0&&"none"!==je.mode?e(d,{heading:be,items:xe,x:Me.x,y:Me.y,flip:Me.x>me,size:W}):null,legend:ke?e(c,{names:te,colors:le,options:Pe,visibility:T,size:W}):null,status:{heading:be,items:xe},table:we?null:e(u,{id:J,caption:S??Y.table,corner:Y.category,categories:te,names:[S??Y.table],values:Ie,format:ee,locale:X,empty:q.empty}),children:[we?e("div",{className:"text-mp-on-surface-variant text-mp-body-small flex h-full items-center justify-center",children:E??q.empty}):re>0&&ae>0?e("svg",{width:re,height:ae,viewBox:`0 0 ${re} ${ae}`,"aria-hidden":"true",className:"block overflow-visible",children:t("g",{className:"mp-pie-chart__slices",children:[pe.map((t,l)=>{if(t.share<=0)return null;return e("path",{d:y(me,ce,V===l?he+3:he,ue,t.from,t.to),fill:le[l],stroke:"var(--_mp-color-surface)",strokeWidth:v,strokeLinejoin:"round",opacity:null===T.hovered||T.hovered===l?1:.35},l)}),"all"===C?pe.map((t,l)=>{const n=ge(t.share),o=t.to-t.from,r=j(me,ce,ue>0?(he+ue)/2:.68*he,(t.from+t.to)/2),a=o*(ue>0?(he+ue)/2:.68*he);return t.share<=0||a<n.length*ie*.6+8?null:e("text",{x:r.x,y:r.y,textAnchor:"middle",dominantBaseline:"central",fill:"var(--_mp-color-on-surface)",fontSize:ie,children:n},l)}):null]})}):null,null==N||"pie"===A||we?null:e("div",{className:"pointer-events-none absolute flex flex-col items-center justify-center text-center",style:{left:me-ue,top:ce-ue,width:2*ue,height:se?ue:2*ue},children:N})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPPieChart}from"./MPPieChart.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{accentSlots as i}from"../../internal/accent.js";import{inertProps as r}from"../../internal/inert.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{CONTROL_GAP as a,CONTROL_ICON as l,CONTROL_TEXT as c,hasContent as m,META_TEXT as d,PROSE_TEXT as p,SHEET_PAD_X as u}from"../../internal/scale.js";import{useMPSize as f}from"../../internal/config.js";const
|
|
2
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{accentSlots as i}from"../../internal/accent.js";import{inertProps as r}from"../../internal/inert.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{CONTROL_GAP as a,CONTROL_ICON as l,CONTROL_TEXT as c,hasContent as m,META_TEXT as d,PROSE_TEXT as p,SHEET_PAD_X as u}from"../../internal/scale.js";import{useMPSize as f}from"../../internal/config.js";const x={xs:"min-h-8",sm:"min-h-10",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"},h={xs:"px-4",sm:"px-5",md:"px-6",lg:"px-8",xl:"px-10"},b={filled:"shadow-mp-2 bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"shadow-mp-2 bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-2 bg-mp-surface-container-low text-(--_mp-accent)",outlined:"border-mp-outline shadow-mp-1 border bg-mp-surface-container text-mp-on-surface",text:"shadow-mp-1 bg-mp-surface-container text-mp-on-surface"},w={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}};export const MPPill=/*@__PURE__*/o.forwardRef(function({startIcon:g,endIcon:v,title:y,description:j,details:_,expanded:k=!1,position:N="static",side:z="top",onClick:B,variant:C="filled",size:I,color:R="secondary",className:$,style:H,children:P,...S},E){const F=f(I),L=o.useRef(null),M=o.useId(),[O,q]=o.useState(0);o.useEffect(()=>{const e=L.current;if(!e)return;const t=new ResizeObserver(()=>q(e.scrollHeight));return t.observe(e),q(e.scrollHeight),()=>t.disconnect()},[_]);const A=Boolean(B),D=u[F],G=t(n,{children:[m(g)?e("span",{className:"flex shrink-0 items-center justify-center overflow-hidden rounded-mp-full [&_img]:size-full [&_img]:object-cover",style:{width:l[F],height:l[F]},children:g}):null,m(y)||m(j)||m(P)?t("span",{className:["flex min-w-0 flex-1 flex-col items-center justify-center text-center",h[F]].join(" "),children:[m(y)?e("span",{className:"max-w-full truncate",children:y}):null,m(j)?e("span",{className:`max-w-full truncate font-normal ${d} supports-[(not_(-webkit-appearance:-apple-pay-button))_or_(contain-intrinsic-size:1px)]:[color:color-mix(in_oklab,currentColor_72%,transparent)]`,children:j}):null,P]}):null]});return t("div",{ref:E,"data-mp-size":F,"data-mp-variant":C,"data-mp-expanded":k||void 0,className:["mp-pill inline-flex max-w-full flex-col overflow-hidden align-middle","box-border whitespace-nowrap select-none",k?"rounded-mp-xl":"rounded-mp-full","transition-[border-radius,background-color,box-shadow]","duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none",c[F],b[C],w[N][z],$??""].filter(Boolean).join(" "),style:{...i(R),...H},...S,children:[t("div",{className:["flex shrink-0 items-center py-1",x[F],a[F],A?"ps-0":D,m(v)?"pe-1":A?"pe-0":""].filter(Boolean).join(" "),children:[A?t("button",{type:"button",className:["group relative flex min-w-0 flex-1 cursor-pointer items-center justify-center","self-stretch appearance-none border-0 bg-transparent text-inherit [font:inherit]","rounded-[inherit]",a[F],D,"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),"aria-expanded":m(_)?k:void 0,"aria-controls":m(_)?M:void 0,onClick:B,children:[e(s,{}),G]}):G,m(v)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:v}):null]}),m(_)?e("div",{id:M,className:["overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none"].join(" "),style:{height:k?O:0},...r(!k),children:e("div",{ref:L,className:`${D} pb-2 whitespace-normal ${p[F]}`,children:_})}):null]})});
|
|
@@ -17,7 +17,7 @@ export interface MPPopconfirmProps {
|
|
|
17
17
|
* Called when the reader says yes.
|
|
18
18
|
*
|
|
19
19
|
* A callback rather than a promise, and that is the whole difference from
|
|
20
|
-
* [`useMPConfirm`](../
|
|
20
|
+
* [`useMPConfirm`](../hooks/confirm): this one is written where the button
|
|
21
21
|
* is, so there is already a handler there to put it in.
|
|
22
22
|
*/
|
|
23
23
|
onConfirm?: () => void;
|
|
@@ -63,7 +63,7 @@ export interface MPPopconfirmProps {
|
|
|
63
63
|
* They ask the same question and the difference is **where the reader's eye
|
|
64
64
|
* is**, which is a real difference and not a stylistic one:
|
|
65
65
|
*
|
|
66
|
-
* | | `MPPopconfirm` | [`useMPConfirm`](../
|
|
66
|
+
* | | `MPPopconfirm` | [`useMPConfirm`](../hooks/confirm) |
|
|
67
67
|
* | --- | --- | --- |
|
|
68
68
|
* | Appears | at the control | in the middle of the screen |
|
|
69
69
|
* | The page behind | stays put | goes under a scrim |
|
|
@@ -107,6 +107,7 @@ export interface MPPopoverProps {
|
|
|
107
107
|
style?: React.CSSProperties;
|
|
108
108
|
}
|
|
109
109
|
export type MPPopoverCloseProps = React.ComponentProps<typeof Popover.Close>;
|
|
110
|
+
/** The wedge, at roughly a third of the sheet's corner per step. */
|
|
110
111
|
/**
|
|
111
112
|
* Closes the popover it is inside.
|
|
112
113
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Popover as
|
|
2
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{POPUP_ARROW_SIZE as n,POPUP_ARROW_TURN as r,PopupArrow as s}from"../../internal/PopupArrow.js";import{Popover as l}from"@base-ui/react/popover";import{MPIcon as i}from"../icon/MPIcon.js";import{CloseIcon as a}from"../../constants/icons.js";import{useMPLocale as t,useMPMessages as m}from"../../internal/locale.js";import{cssLength as c}from"../../internal/length.js";import{COMMON as p}from"../../internal/messages/common.js";import{MPStateLayer as f}from"../../internal/StateLayer.js";import{hasContent as d,META_TEXT as u,PROSE_TEXT as x,SHEET_GAP as h,SHEET_PAD as g,SHEET_TITLE as v}from"../../internal/scale.js";import{FADE as j,PORTAL_LAYER as b}from"../../internal/surface.js";import{useMPSize as w}from"../../internal/config.js";const N={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"};export const MPPopoverClose=l.Close;export function MPPopover({trigger:P,title:O,description:y,side:C="bottom",align:z="center",sideOffset:k=8,alignOffset:M=0,arrow:A=!1,open:L,defaultOpen:T,onOpenChange:$,modal:B=!1,dismissible:D=!0,showClose:I=!1,closeLabel:R,locale:S,width:W,size:_,className:q,style:E,children:F}){const G=w(_),H=t(S),J=m(p,H),K=d(O)||d(y),Q=n[G];return o(l.Root,{open:L,defaultOpen:T,modal:B,onOpenChange:(e,o)=>{D||e||"escape-key"!==o.reason&&"outside-press"!==o.reason&&"focus-out"!==o.reason?$?.(e):o.cancel()},children:[P?e(l.Trigger,{render:P}):null,e(l.Portal,{children:e(l.Positioner,{className:b,side:C,align:z,sideOffset:k,alignOffset:M,children:o(l.Popup,{"data-mp-size":G,className:["mp-popover rounded-mp-md relative flex flex-col outline-none","bg-mp-surface-container text-mp-on-surface shadow-mp-2","box-border",g[G],h[G],x[G],void 0===W?N[G]:"",j,q??""].filter(Boolean).join(" "),style:{...void 0===W?null:{maxWidth:c(W)},...E},children:[A?e(l.Arrow,{className:r,children:e(s,{size:Q,fill:"var(--_mp-color-surface-container)"})}):null,K||I?o("div",{className:"flex shrink-0 items-start gap-3",children:[o("div",{className:"flex min-w-0 flex-1 flex-col",children:[d(O)?e(l.Title,{className:`m-0 ${v[G]}`,children:O}):null,d(y)?e(l.Description,{className:`text-mp-on-surface-variant m-0 ${u}`,children:y}):null]}),I?o(l.Close,{"aria-label":R??J.close,className:["group text-mp-on-surface-variant relative flex size-8 shrink-0","rounded-mp-full -m-1 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),children:[e(f,{}),e(i,{icon:a,size:18})]}):null]}):null,d(F)?e("div",{className:"min-w-0",children:F}):null]})})})]})}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface MPPortalProps {
|
|
3
|
+
/**
|
|
4
|
+
* Where to render. An element, a ref to one, or nothing for `document.body`.
|
|
5
|
+
*
|
|
6
|
+
* A ref is the useful form for a container this same page renders — it is
|
|
7
|
+
* `null` on the first render, and the portal waits rather than falling back to
|
|
8
|
+
* the body and moving afterwards.
|
|
9
|
+
*/
|
|
10
|
+
container?: Element | React.RefObject<Element | null> | null;
|
|
11
|
+
/**
|
|
12
|
+
* Renders in place instead, as though the portal were not there.
|
|
13
|
+
*
|
|
14
|
+
* For the component that is portalled in one context and not in another — a
|
|
15
|
+
* panel that escapes a clipping ancestor on a page and belongs inline in a
|
|
16
|
+
* printed view.
|
|
17
|
+
*
|
|
18
|
+
* It saves the branch and not the state: React sees a portal and an inline
|
|
19
|
+
* subtree as different elements, so changing this **remounts** the children
|
|
20
|
+
* exactly as `{escape ? <MPPortal>{x}</MPPortal> : x}` would. Anything below
|
|
21
|
+
* it loses its state, its scroll position and the focus in it. Decide once,
|
|
22
|
+
* per mount, rather than toggling.
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Children rendered somewhere else in the DOM, usually the end of `<body>`.
|
|
29
|
+
*
|
|
30
|
+
* For a subtree that has to escape a clipping or stacking context its own
|
|
31
|
+
* position would trap it in. Both of those are real and neither is obvious from
|
|
32
|
+
* looking at the markup: an `overflow: hidden` anywhere above an element clips
|
|
33
|
+
* it, and a `transform`, a `filter` or an `opacity` below 1 makes a new
|
|
34
|
+
* containing block that a `position: fixed` child is measured against rather
|
|
35
|
+
* than the viewport.
|
|
36
|
+
*
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <MPPortal>
|
|
39
|
+
* <div className="fixed inset-x-0 bottom-0">…</div>
|
|
40
|
+
* </MPPortal>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ## Most components here do not need it
|
|
44
|
+
*
|
|
45
|
+
* Every popup in this library already portals itself — a select's list, a
|
|
46
|
+
* dialog, a tooltip, a menu, a drawer's panel — because a component whose whole
|
|
47
|
+
* job is to sit over the page cannot leave that to a caller. This is for a
|
|
48
|
+
* caller's **own** overlay, in a page whose structure it does not control.
|
|
49
|
+
*
|
|
50
|
+
* ## Nothing on the first render, and never on a server
|
|
51
|
+
*
|
|
52
|
+
* A portal needs a real DOM node and there is none while the server renders, so
|
|
53
|
+
* this returns `null` there and again on the first client render. That is what
|
|
54
|
+
* keeps hydration honest: markup that appeared in one pass and not the other is
|
|
55
|
+
* exactly the mismatch React warns about, and the alternative — rendering to a
|
|
56
|
+
* placeholder and moving it — is a flash.
|
|
57
|
+
*
|
|
58
|
+
* The practical consequence is that a portal's content is never in the HTML a
|
|
59
|
+
* crawler reads. Anything that has to be indexed does not belong in one.
|
|
60
|
+
*
|
|
61
|
+
* ## It does not trap focus, and does not manage the stack
|
|
62
|
+
*
|
|
63
|
+
* A portal moves an element in the DOM and nothing else. Focus, Escape, an inert
|
|
64
|
+
* background, a scrim and a z-index are the *dialog's* concerns —
|
|
65
|
+
* [MPDialog](../feedback/dialog) and [MPDrawer](./drawer) are those, and a hand-built
|
|
66
|
+
* overlay in a portal has none of it. Reach for them before this.
|
|
67
|
+
*
|
|
68
|
+
* ## Events still bubble through React
|
|
69
|
+
*
|
|
70
|
+
* A click inside a portal reaches an `onClick` on the element that rendered it,
|
|
71
|
+
* even though the DOM says the two are unrelated. That is React's own behaviour
|
|
72
|
+
* rather than something added here, and it catches people both ways: a menu
|
|
73
|
+
* inside a portal inside a clickable card still opens the card.
|
|
74
|
+
*/
|
|
75
|
+
export declare function MPPortal({ container, disabled, children }: MPPortalProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import*as t from"react";import{createPortal as n}from"react-dom";export function MPPortal({container:e,disabled:o=!1,children:u}){const[c,i]=t.useState(null);return t.useEffect(()=>{i(r=>{const t=function(r){if(!r)return"undefined"==typeof document?null:document.body;return"current"in r?r.current:r}(e);return t===r?r:t})}),o?r(t.Fragment,{children:u}):c?n(u,c):null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPPortal}from"./MPPortal.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Radio as i}from"@base-ui/react/radio";import{RadioGroup as l}from"@base-ui/react/radio-group";import{Field as n}from"@base-ui/react/field";import{accentSlots as o}from"../../internal/accent.js";import{DOT_MOTION as t}from"../../internal/mark.js";import{MPStateLayer as s}from"../../internal/StateLayer.js";import{MPSupportingText as d}from"../../internal/SupportingText.js";import{META_TEXT as c,PROSE_TEXT as m,hasContent as p}from"../../internal/scale.js";import{useMPColor as u,useMPSize as f}from"../../internal/config.js";const x={xs:{ring:"size-4",fill:"size-2",halo:"size-8"},sm:{ring:"size-[18px]",fill:"size-[10px]",halo:"size-9"},md:{ring:"size-5",fill:"size-2.5",halo:"size-10"},lg:{ring:"size-[22px]",fill:"size-3",halo:"size-11"},xl:{ring:"size-6",fill:"size-3",halo:"size-12"}},h=/*@__PURE__*/a.createContext({size:"md",readOnly:!1,invalid:!1});export const MPRadio=/*@__PURE__*/a.forwardRef(function({value:l,label:o,description:d,disabled:u=!1,id:f,className:g,style:b},z){const j=a.useContext(h),v=x[j.size],y=a.useId(),N=f??y;return e(n.Root,{className:["mp-radio inline-block max-w-full align-top",g??""].filter(Boolean).join(" "),style:b,disabled:u,"data-mp-value":l,children:r("div",{className:["flex items-start gap-3",m[j.size]].join(" "),children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:r(i.Root,{ref:z,id:N,value:l,disabled:u,className:["mp-radio__dot group relative inline-flex shrink-0 items-center justify-center","box-border rounded-full border-2 p-0","appearance-none bg-transparent font-[inherit] outline-none","transition-[border-color] duration-(--mp-sys-motion-duration-short4)",v.ring,u?"border-mp-on-surface/38 cursor-default":[j.readOnly?"cursor-default":"cursor-pointer",j.invalid?"border-mp-error":"border-mp-on-surface-variant","data-checked:border-(--_mp-accent)"].join(" ")].join(" "),children:[u?null:e(s,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",v.halo,"bg-mp-on-surface","group-data-checked:bg-(--_mp-accent)"].join(" ")}),e(i.Indicator,{className:["mp-radio__fill rounded-full",v.fill,t,u?"bg-mp-on-surface/38":"bg-(--_mp-accent)"].join(" ")})]})}),p(o)||p(d)?r("span",{className:"flex min-w-0 flex-col gap-0.5",children:[p(o)?e(n.Label,{htmlFor:N,className:["leading-[1.4]",u?"text-mp-on-surface/38 cursor-default":j.readOnly?"text-mp-on-surface":"text-mp-on-surface cursor-pointer"].join(" "),children:o}):null,p(d)?e(n.Description,{className:`${c} text-mp-on-surface-variant data-disabled:text-mp-on-surface/38 m-0`,children:d}):null]}):null]})})});export const MPRadioGroup=/*@__PURE__*/a.forwardRef(function({value:i,defaultValue:t,onValueChange:s,label:m,description:x,errorMessage:g,orientation:b="vertical",size:z,color:j,required:v=!1,disabled:y=!1,readOnly:N=!1,name:R,children:_,className:k,style:w},O){const M=f(z),C=u(j),V=p(g),I=V?"error":C,P=a.useId(),S=a.useMemo(()=>({size:M,readOnly:N,invalid:V}),[M,N,V]);return e(h.Provider,{value:S,children:r(n.Root,{className:["mp-radio-group flex flex-col gap-2",k??""].filter(Boolean).join(" "),disabled:y,invalid:V,"data-mp-size":M,"data-mp-orientation":b,style:{...o(I),...w},children:[p(m)?r("span",{id:P,className:[c,y?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:[m,v?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(l,{ref:O,"aria-labelledby":p(m)?P:void 0,value:i,defaultValue:t,onValueChange:e=>s?.(String(e??"")),disabled:y,readOnly:N,required:v,name:R,className:["flex","horizontal"===b?"flex-row flex-wrap gap-x-6 gap-y-2":"flex-col gap-2"].join(" "),children:_}),e(d,{description:x,errorMessage:g})]})})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIcon as i}from"../icon/MPIcon.js";import{StarIcon as a}from"../../constants/icons.js";import{accentSlots as
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{MPIcon as i}from"../icon/MPIcon.js";import{StarIcon as a}from"../../constants/icons.js";import{accentSlots as o}from"../../internal/accent.js";import{fillMessage as r}from"../../internal/i18n.js";import{useMPLocale as s,useMPMessages as l}from"../../internal/locale.js";import{RATING as m}from"../../internal/messages/rating.js";import{VISUALLY_HIDDEN as c}from"../../internal/visually-hidden.js";import{useMPColor as u,useMPSize as d}from"../../internal/config.js";const p={xs:16,sm:20,md:24,lg:30,xl:36},h={xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"};export const MPRating=/*@__PURE__*/n.forwardRef(function({value:f,defaultValue:g=0,onValueChange:x,count:y=5,precision:v=1,icon:j,emptyIcon:b,clearable:w=!0,readOnly:M=!1,disabled:N=!1,name:P,required:S=!1,size:_,color:R,locale:z,labels:I,structuredData:k=!1,className:q,style:C,onPointerLeave:L,...V},A){const B=d(_),F=u(R),D=s(z),E=l(m,D,I),O=n.useId(),T=P??O,[G,H]=n.useState(g),J=void 0!==f,K=J?f:G,[Q,U]=n.useState(null),W=Math.max(1,Math.floor(y)),X=v>0&&v<=1?v:1,Y=Math.round(1/X),Z=Math.max(0,Math.min(W,Q??K)),$=e=>e<=0?E.empty:r(E.value,{value:String(e),max:String(W)}),ee=e=>{J||H(e),x?.(e)},te=t=>{const n=e(i,{icon:a,size:p[B],className:t?"[&>svg]:fill-current":""});return(t?j:b)??n},ne=Array.from({length:W},(n,i)=>{const a=Math.max(0,Math.min(1,Z-i));return t("span",{className:["mp-rating__star relative inline-flex shrink-0","rounded-mp-xs",M||N?"":["outline-mp-secondary has-[:focus-visible]:outline-2","has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-solid","supports-[not_selector(:has(*))]:focus-within:outline-2","supports-[not_selector(:has(*))]:focus-within:outline-offset-2","supports-[not_selector(:has(*))]:focus-within:outline-solid"].join(" ")].filter(Boolean).join(" "),style:{width:p[B],height:p[B]},children:[e("span",{className:["flex items-center justify-center",N?"text-mp-on-surface/38":"text-mp-outline"].join(" "),style:{width:p[B],height:p[B]},children:te(!1)}),e("span",{"aria-hidden":"true",className:["mp-rating__fill pointer-events-none absolute inset-y-0 start-0 overflow-hidden","transition-[width] duration-(--mp-sys-motion-duration-short2) ease-mp-standard","motion-reduce:transition-none"].join(" "),style:{width:100*a+"%"},children:e("span",{className:["flex items-center justify-center","transition-colors duration-(--mp-sys-motion-duration-short4)",N?"text-mp-on-surface/38":"text-(--_mp-accent)"].join(" "),style:{width:p[B],height:p[B]},children:te(!0)})}),M?null:Array.from({length:Y},(t,n)=>{const a=Number((i+(n+1)*X).toFixed(4));return e("label",{className:["absolute inset-y-0",N?"":"cursor-pointer"].join(" "),style:{insetInlineStart:100*n/Y+"%",width:100/Y+"%"},onPointerEnter:()=>{N||U(a)},children:e("input",{type:"radio",className:c,name:T,value:a,checked:K===a,disabled:N,required:S,"aria-label":$(a),onChange:()=>ee(a),onClick:()=>{w&&K===a&&ee(0)}})},a)})]},i)}),ie=["mp-rating inline-flex items-center align-middle",h[B],q??""].filter(Boolean).join(" "),ae={...o(F),...C};if(M){const i=Math.max(0,Math.min(W,K));return t("div",{ref:A,role:"img","data-mp-size":B,"aria-label":$(i),itemScope:k||void 0,itemType:k?"https://schema.org/Rating":void 0,className:ie,style:ae,onPointerLeave:L,...V,children:[k?t(n.Fragment,{children:[e("meta",{itemProp:"ratingValue",content:String(i)}),e("meta",{itemProp:"bestRating",content:String(W)}),e("meta",{itemProp:"worstRating",content:"0"})]}):null,ne]})}return e("div",{ref:A,role:"radiogroup","data-mp-size":B,"aria-label":E.label,"aria-disabled":N||void 0,"aria-required":S||void 0,className:ie,style:ae,onPointerLeave:e=>{U(null),L?.(e)},...V,children:ne})});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type CartesianChartProps } from '../../internal/ChartFrame.js';
|
|
3
|
+
export interface MPScatterChartProps extends CartesianChartProps {
|
|
4
|
+
/**
|
|
5
|
+
* Sizes each mark by its point's `z`, so a third number rides along.
|
|
6
|
+
*
|
|
7
|
+
* The **area** carries it and not the radius — a bubble drawn with its radius
|
|
8
|
+
* proportional to the value shows four times the ink for twice the number,
|
|
9
|
+
* and every reader judges the blob rather than the line across it.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
bubble?: boolean;
|
|
13
|
+
/** How big the largest bubble gets, in pixels. @default 22 */
|
|
14
|
+
maxRadius?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Gives each series a mark of its own shape as well as its own colour.
|
|
17
|
+
*
|
|
18
|
+
* On by default, and it is not decoration. Colour separates **three** series
|
|
19
|
+
* where any two marks can touch, and a scatter is exactly that case — see the
|
|
20
|
+
* note on the component. A shape is the second channel that carries the rest,
|
|
21
|
+
* and it survives greyscale, print and forced colours too.
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
shapes?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Two measures against each other, one mark per observation.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <MPScatterChart
|
|
31
|
+
* series={[{ name: 'Runs', data: [{ x: 12, y: 4.2 }, { x: 19, y: 5.1 }] }]}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* The only chart here with a value axis in **both** directions. Its question is
|
|
36
|
+
* whether two things move together, and its marks are observations rather than
|
|
37
|
+
* a sequence — so there is no order to walk along and nothing to join up.
|
|
38
|
+
*
|
|
39
|
+
* ## Neither axis starts at zero
|
|
40
|
+
*
|
|
41
|
+
* A position encodes a value and claims nothing about proportion, so cropping
|
|
42
|
+
* both scales moves every mark by the same amount and the relationship survives
|
|
43
|
+
* intact. Forcing zero onto two measures that live between 40 and 60 puts the
|
|
44
|
+
* whole picture in one corner, which is the one way to make a scatter say
|
|
45
|
+
* nothing at all.
|
|
46
|
+
*
|
|
47
|
+
* ## Three series is the cap on colour alone
|
|
48
|
+
*
|
|
49
|
+
* The palette's eight slots are separable pair by pair only to the third, and
|
|
50
|
+
* on a scatter **any two marks can sit side by side** — unlike a line or a bar,
|
|
51
|
+
* where only neighbours meet. That is a property of the colour space rather
|
|
52
|
+
* than of this palette, and no ordering of eight does better.
|
|
53
|
+
*
|
|
54
|
+
* So the marks take shapes as well: a circle, a square, a triangle, a diamond
|
|
55
|
+
* and a cross, each scaled to the same area so no series looks heavier than
|
|
56
|
+
* another. Past five series, facet the chart rather than reaching for a sixth
|
|
57
|
+
* shape.
|
|
58
|
+
*
|
|
59
|
+
* ## The grid runs both ways here and nowhere else
|
|
60
|
+
*
|
|
61
|
+
* A grid in both directions is graph paper, and on a chart of columns the
|
|
62
|
+
* vertical rules would be doing the job the crosshair already does. Here there
|
|
63
|
+
* is no column to be in and reading a mark's x off the picture is half of what
|
|
64
|
+
* the reader came for, so graph paper is exactly the point.
|
|
65
|
+
*/
|
|
66
|
+
export declare function MPScatterChart({ bubble, maxRadius, shapes, ...frame }: MPScatterChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{CartesianFrame as e}from"../../internal/ChartFrame.js";import{MARKER_RADIUS as s,MARK_SHAPES as a,bubbleRadius as t,markPath as c,pointX as i}from"../../internal/chart.js";export function MPScatterChart({bubble:o=!1,maxRadius:l=22,shapes:n=!0,...u}){const h=r=>n?a[r%a.length]:"circle";return r(e,{...u,xScale:"value",includeZero:!1,markRadius:20,markInset:o?l+2:s.xl+2,marks:({values:r,visible:e,valuePx:a,categoryValuePx:c,categories:n,size:u})=>{const h=s[u],m=o?r.reduce((r,s,a)=>e[a]?s.reduce((r,e)=>Math.max(r,e.z??0),r):r,0):0;return r.flatMap((r,s)=>e[s]?r.flatMap((r,e)=>{const u=i(r,e,n);if(null===r.value||null===u)return[];const d=o?t(r.z??0,m,l,h):h+1;return[{series:s,index:e,x:c(u),y:a(r.value),r:d}]}):[])},swatch:(e,s)=>r("svg",{width:10,height:10,viewBox:"0 0 10 10","aria-hidden":"true",className:"block",children:r("path",{d:c(h(e),5,5,4),fill:"cross"===h(e)?"none":s,stroke:s,strokeWidth:"cross"===h(e)?1.5:0})}),children:({marks:e,colors:s,activeMark:a,hovered:t})=>r("g",{className:"mp-scatter-chart__marks",children:e.map((e,i)=>{const o=h(e.series),l=a===e,n=null!==t&&t!==e.series;return r("path",{d:c(o,e.x,e.y,l?e.r+1.5:e.r),fill:"cross"===o?"none":s[e.series],stroke:"cross"===o?s[e.series]:"var(--_mp-color-surface)",strokeWidth:"cross"===o?2:1.5,strokeLinecap:"round",opacity:n?.15:l?1:.85},i)})})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPScatterChart}from"./MPScatterChart.js";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPOrientation, MPSize } from '../../types.js';
|
|
3
|
+
/** Which way the content is allowed to scroll. */
|
|
4
|
+
export type MPScrollAxis = MPOrientation | 'both';
|
|
5
|
+
export interface MPScrollAreaProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* The scrollbar's thickness.
|
|
8
|
+
* @default 'md'
|
|
9
|
+
*/
|
|
10
|
+
size?: MPSize;
|
|
11
|
+
/**
|
|
12
|
+
* Which way the content may scroll.
|
|
13
|
+
*
|
|
14
|
+
* `vertical` is the common case and the default. `both` is for content with a
|
|
15
|
+
* width of its own — a wide table, a diagram — where neither axis should be
|
|
16
|
+
* the one that wraps.
|
|
17
|
+
* @default 'vertical'
|
|
18
|
+
*/
|
|
19
|
+
axis?: MPScrollAxis;
|
|
20
|
+
/**
|
|
21
|
+
* How tall the box is allowed to get before it starts scrolling. A number is
|
|
22
|
+
* pixels, a string is any CSS length.
|
|
23
|
+
*
|
|
24
|
+
* Something has to bound the box or there is nothing to scroll: a scroll area
|
|
25
|
+
* whose height is its content's height never overflows. This is the usual way
|
|
26
|
+
* to say that, and a `className` with a `max-h-*` or a flex parent that
|
|
27
|
+
* constrains it are the others.
|
|
28
|
+
*/
|
|
29
|
+
maxHeight?: number | string;
|
|
30
|
+
/** A fixed height, for the box that should be its size whatever is in it. */
|
|
31
|
+
height?: number | string;
|
|
32
|
+
/**
|
|
33
|
+
* Keeps the scrollbar drawn instead of fading it out when the pointer leaves.
|
|
34
|
+
*
|
|
35
|
+
* Off, it behaves the way an overlay scrollbar does — visible while scrolling
|
|
36
|
+
* or hovered, gone otherwise. On is right for a panel whose scrollability is
|
|
37
|
+
* not obvious from its content, where a bar that appears only on hover is a
|
|
38
|
+
* bar a reader has to discover.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
persistent?: boolean;
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A box with a scrollbar of its own.
|
|
46
|
+
*
|
|
47
|
+
* The browser's is drawn by the operating system: a different width on every
|
|
48
|
+
* machine, a different colour from the sheet it is cut into, and on Windows a
|
|
49
|
+
* 17px band of grey that no design accounts for. This one is an element, so it
|
|
50
|
+
* is the same everywhere and made of the library's own tokens.
|
|
51
|
+
*
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <MPScrollArea maxHeight={320}>
|
|
54
|
+
* <MPList>…</MPList>
|
|
55
|
+
* </MPScrollArea>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* ## Something has to bound the box
|
|
59
|
+
*
|
|
60
|
+
* A scroll area whose height is its content's height never overflows and never
|
|
61
|
+
* shows a bar. `maxHeight` is the usual way to say what bounds it; a `className`
|
|
62
|
+
* carrying a `max-h-*`, or a flex parent that constrains it, are the others.
|
|
63
|
+
*
|
|
64
|
+
* ## The scrollbar overlays the content
|
|
65
|
+
*
|
|
66
|
+
* It takes no room in the layout, which is what makes it swappable for the
|
|
67
|
+
* browser's own on a page that has already been designed: adding one does not
|
|
68
|
+
* reflow anything. The trade is that content can pass underneath it, so a box
|
|
69
|
+
* whose content reaches the edge wants a little inline padding of its own.
|
|
70
|
+
*
|
|
71
|
+
* ## It is still a real scroll container
|
|
72
|
+
*
|
|
73
|
+
* The wheel, the trackpad, a touch drag, Page Up, Home and End, and a keyboard
|
|
74
|
+
* focus moving into something below the fold all work, because the viewport
|
|
75
|
+
* underneath is an ordinary `overflow: auto` element. This replaces how the bar
|
|
76
|
+
* is *drawn* and nothing about how scrolling behaves — including the browser's
|
|
77
|
+
* own scroll anchoring and its overscroll handling.
|
|
78
|
+
*
|
|
79
|
+
* The native bar is hidden rather than the scrolling being reimplemented, which
|
|
80
|
+
* is the difference between this and a library that listens for `wheel` events.
|
|
81
|
+
*/
|
|
82
|
+
export declare const MPScrollArea: React.ForwardRefExoticComponent<MPScrollAreaProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as r,jsxs as e}from"react/jsx-runtime";import*as o from"react";import{ScrollArea as t}from"@base-ui/react/scroll-area";import{cssLength as a}from"../../internal/length.js";import{useMPSize as i}from"../../internal/config.js";const n={xs:"w-1.5",sm:"w-2",md:"w-2.5",lg:"w-3",xl:"w-3.5"},s={xs:"h-1.5",sm:"h-2",md:"h-2.5",lg:"h-3",xl:"h-3.5"};export const MPScrollArea=/*@__PURE__*/o.forwardRef(function({size:o,axis:n="vertical",maxHeight:s,height:c,persistent:m=!1,className:p,style:h,children:u,...f},d){const g=i(o),x="horizontal"!==n,v="vertical"!==n;return e(t.Root,{ref:d,"data-mp-size":g,className:["mp-scroll-area relative overflow-hidden",p??""].filter(Boolean).join(" "),style:h,...f,children:[r(t.Viewport,{className:"mp-scroll-area__viewport size-full overscroll-contain",style:{maxHeight:a(s),height:a(c)},children:r(t.Content,{className:"mp-scroll-area__content",children:u})}),x?r(l,{orientation:"vertical",size:g,persistent:m}):null,v?r(l,{orientation:"horizontal",size:g,persistent:m}):null,x&&v?r(t.Corner,{className:"mp-scroll-area__corner bg-mp-surface-container"}):null]})});function l({orientation:e,size:o,persistent:a}){return r(t.Scrollbar,{orientation:e,className:["mp-scroll-area__bar flex touch-none select-none p-0.5","vertical"===e?n[o]:s[o],"transition-opacity duration-(--mp-sys-motion-duration-short4)",a?"opacity-100":"opacity-0 data-hovering:opacity-100 data-scrolling:opacity-100"].join(" "),children:r(t.Thumb,{className:["mp-scroll-area__thumb rounded-mp-full flex-1","bg-mp-on-surface/38 hover:bg-mp-on-surface/56 active:bg-mp-on-surface/56","transition-[background-color] duration-(--mp-sys-motion-duration-short4)"].join(" ")})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPScrollArea}from"./MPScrollArea.js";
|