material-plus-ui 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/components/accordion/MPAccordion.d.ts +21 -1
- package/dist/components/accordion/MPAccordion.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +33 -2
- package/dist/components/alert/MPAlert.js +1 -1
- package/dist/components/anchor/MPAnchor.d.ts +107 -0
- package/dist/components/anchor/MPAnchor.js +2 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/MPAnimateAppear.d.ts +2 -2
- package/dist/components/animate-appear/MPAnimateAppear.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/MPAnimateBlink.js +2 -1
- package/dist/components/animate-counter/MPAnimateCounter.d.ts +67 -0
- package/dist/components/animate-counter/MPAnimateCounter.js +2 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/MPAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/MPAnimateFade.js +2 -1
- package/dist/components/animate-float/MPAnimateFloat.d.ts +53 -0
- package/dist/components/animate-float/MPAnimateFloat.js +2 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/MPAnimateGrow.js +2 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -0
- package/dist/components/animate-reveal/MPAnimateReveal.d.ts +64 -0
- package/dist/components/animate-reveal/MPAnimateReveal.js +2 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/MPAnimateRotate.js +2 -1
- package/dist/components/animate-scramble/MPAnimateScramble.d.ts +65 -0
- package/dist/components/animate-scramble/MPAnimateScramble.js +2 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/MPAnimateShake.d.ts +65 -0
- package/dist/components/animate-shake/MPAnimateShake.js +2 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/MPAnimateSlide.js +2 -1
- package/dist/components/animate-split/MPAnimateSplit.d.ts +56 -0
- package/dist/components/animate-split/MPAnimateSplit.js +2 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/MPAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/MPAnimateZoom.js +2 -1
- package/dist/components/app-logo/MPAppLogo.d.ts +156 -0
- package/dist/components/app-logo/MPAppLogo.js +2 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/MPAreaChart.d.ts +79 -0
- package/dist/components/area-chart/MPAreaChart.js +2 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -0
- package/dist/components/avatar/MPAvatar.d.ts +10 -1
- package/dist/components/avatar/MPAvatar.js +1 -1
- package/dist/components/bar-chart/MPBarChart.d.ts +74 -0
- package/dist/components/bar-chart/MPBarChart.js +2 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/blockquote/MPBlockquote.d.ts +10 -1
- package/dist/components/blockquote/MPBlockquote.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +2 -18
- package/dist/components/bottom-navigation/MPBottomNavigation.js +1 -1
- package/dist/components/box/MPBox.d.ts +43 -8
- package/dist/components/box/MPBox.js +2 -1
- package/dist/components/card/MPCard.js +1 -1
- package/dist/components/checkbox/MPCheckbox.js +1 -1
- package/dist/components/chip/MPChip.d.ts +10 -1
- package/dist/components/chip/MPChip.js +1 -1
- package/dist/components/code-block/MPCodeBlock.d.ts +177 -0
- package/dist/components/code-block/MPCodeBlock.js +2 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/MPCollapsible.d.ts +12 -1
- package/dist/components/collapsible/MPCollapsible.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +21 -4
- package/dist/components/combobox/MPCombobox.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +12 -2
- package/dist/components/command-palette/MPCommandPalette.js +1 -1
- package/dist/components/config/MPConfigProvider.d.ts +49 -7
- package/dist/components/config/MPConfigProvider.js +1 -1
- package/dist/components/container/MPContainer.d.ts +9 -2
- package/dist/components/container/MPContainer.js +2 -1
- package/dist/components/data-list/MPDataList.d.ts +82 -0
- package/dist/components/data-list/MPDataList.js +2 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/MPDataTable.d.ts +295 -0
- package/dist/components/data-table/MPDataTable.js +2 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/dialog/MPDialog.d.ts +10 -2
- package/dist/components/dialog/MPDialog.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +8 -2
- package/dist/components/drawer/MPDrawer.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +10 -1
- package/dist/components/empty/MPEmpty.js +1 -1
- package/dist/components/fieldset/MPFieldset.js +1 -1
- package/dist/components/file-picker/MPFilePicker.js +1 -1
- package/dist/components/flex/MPFlex.d.ts +95 -0
- package/dist/components/flex/MPFlex.js +2 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.d.ts +127 -0
- package/dist/components/floating-bottom-navigation/MPFloatingBottomNavigation.js +2 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/footer/MPFooter.d.ts +24 -4
- package/dist/components/footer/MPFooter.js +1 -1
- package/dist/components/form/MPForm.js +1 -1
- package/dist/components/gauge-chart/MPGaugeChart.d.ts +78 -0
- package/dist/components/gauge-chart/MPGaugeChart.js +2 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/MPGrid.js +1 -1
- package/dist/components/header/MPHeader.d.ts +26 -4
- package/dist/components/header/MPHeader.js +1 -1
- package/dist/components/heatmap-chart/MPHeatmapChart.d.ts +75 -0
- package/dist/components/heatmap-chart/MPHeatmapChart.js +2 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/hover-card/MPHoverCard.d.ts +100 -0
- package/dist/components/hover-card/MPHoverCard.js +2 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/image/MPImage.d.ts +10 -1
- package/dist/components/line-chart/MPLineChart.d.ts +66 -0
- package/dist/components/line-chart/MPLineChart.js +2 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/list/MPList.d.ts +23 -1
- package/dist/components/list/MPList.js +1 -1
- package/dist/components/menu/MPMenu.js +1 -1
- package/dist/components/meter/MPMeter.d.ts +87 -0
- package/dist/components/meter/MPMeter.js +2 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/MPMockup.d.ts +143 -0
- package/dist/components/mockup/MPMockup.js +2 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/pie-chart/MPPieChart.d.ts +77 -0
- package/dist/components/pie-chart/MPPieChart.js +2 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/portal/MPPortal.d.ts +75 -0
- package/dist/components/portal/MPPortal.js +2 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/radio-group/MPRadioGroup.js +1 -1
- package/dist/components/rating/MPRating.js +1 -1
- package/dist/components/scatter-chart/MPScatterChart.d.ts +66 -0
- package/dist/components/scatter-chart/MPScatterChart.js +2 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/MPScrollArea.d.ts +82 -0
- package/dist/components/scroll-area/MPScrollArea.js +2 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/MPScrollZone.d.ts +165 -0
- package/dist/components/scroll-zone/MPScrollZone.js +2 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/select/MPSelect.d.ts +27 -4
- package/dist/components/select/MPSelect.js +1 -1
- package/dist/components/show/MPShow.d.ts +78 -0
- package/dist/components/show/MPShow.js +2 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/MPSidebar.d.ts +20 -1
- package/dist/components/sidebar/MPSidebar.js +1 -1
- package/dist/components/sparkline/MPSparkline.d.ts +85 -0
- package/dist/components/sparkline/MPSparkline.js +2 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/MPSpoiler.d.ts +12 -0
- package/dist/components/spoiler/MPSpoiler.js +1 -1
- package/dist/components/stack/MPStack.d.ts +198 -0
- package/dist/components/stack/MPStack.js +2 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/statistic/MPStatistic.d.ts +104 -0
- package/dist/components/statistic/MPStatistic.js +2 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +1 -0
- package/dist/components/stepper/MPStepper.js +1 -1
- package/dist/components/table/MPTable.d.ts +24 -2
- package/dist/components/table/MPTable.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +12 -0
- package/dist/components/tabs/MPTabs.js +1 -1
- package/dist/components/timeline/MPTimeline.js +1 -1
- package/dist/components/timeline-chart/MPTimelineChart.d.ts +63 -0
- package/dist/components/timeline-chart/MPTimelineChart.js +2 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toolbar/MPToolbar.d.ts +106 -0
- package/dist/components/toolbar/MPToolbar.js +2 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tour/MPTour.d.ts +120 -0
- package/dist/components/tour/MPTour.js +2 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/MPTransfer.js +1 -1
- package/dist/components/tree-select/MPTreeSelect.d.ts +113 -0
- package/dist/components/tree-select/MPTreeSelect.js +2 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/tree-view/MPTreeView.d.ts +153 -0
- package/dist/components/tree-view/MPTreeView.js +2 -0
- package/dist/components/tree-view/index.d.ts +2 -0
- package/dist/components/tree-view/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +10 -1
- package/dist/components/typography/MPTypography.js +2 -1
- package/dist/constants/glyphs.d.ts +2 -0
- package/dist/constants/glyphs.js +1 -1
- package/dist/constants/icons.d.ts +1 -0
- package/dist/constants/icons.js +1 -1
- package/dist/hooks/index.d.ts +22 -5
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useMPColorScheme.js +1 -0
- package/dist/hooks/useMPDisclosure.d.ts +58 -0
- package/dist/hooks/useMPDisclosure.js +2 -0
- package/dist/hooks/useMPElementSize.d.ts +55 -0
- package/dist/hooks/useMPElementSize.js +2 -0
- package/dist/hooks/useMPMediaQuery.d.ts +40 -0
- package/dist/hooks/useMPMediaQuery.js +2 -0
- package/dist/hooks/useMPOnScreen.d.ts +58 -0
- package/dist/hooks/useMPOnScreen.js +2 -0
- package/dist/hooks/useMPReducedMotion.js +1 -0
- package/dist/hooks/useMPWindowClass.d.ts +7 -0
- package/dist/hooks/useMPWindowClass.js +1 -0
- package/dist/index.d.ts +35 -1
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.js +1 -1
- package/dist/internal/ChartChrome.d.ts +205 -0
- package/dist/internal/ChartChrome.js +2 -0
- package/dist/internal/ChartFrame.d.ts +197 -0
- package/dist/internal/ChartFrame.js +2 -0
- package/dist/internal/FieldOutline.d.ts +14 -5
- package/dist/internal/FieldOutline.js +1 -1
- package/dist/internal/SupportingText.d.ts +24 -0
- package/dist/internal/SupportingText.js +1 -1
- package/dist/internal/animate-core.d.ts +121 -0
- package/dist/internal/animate-core.js +1 -0
- package/dist/internal/animate.d.ts +75 -55
- package/dist/internal/animate.js +1 -1
- package/dist/internal/bottom-navigation.d.ts +58 -0
- package/dist/internal/bottom-navigation.js +2 -0
- package/dist/internal/chart.d.ts +471 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/config.d.ts +24 -5
- package/dist/internal/config.js +1 -1
- package/dist/internal/data-table.d.ts +162 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/density.d.ts +9 -0
- package/dist/internal/density.js +1 -0
- package/dist/internal/elevation.d.ts +26 -0
- package/dist/internal/elevation.js +1 -0
- package/dist/internal/highlight.d.ts +96 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +170 -0
- package/dist/internal/initials.d.ts +28 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/mark.d.ts +52 -0
- package/dist/internal/mark.js +1 -0
- package/dist/internal/measure.d.ts +31 -0
- package/dist/internal/measure.js +1 -0
- package/dist/internal/messages/anchor.d.ts +3 -0
- package/dist/internal/messages/anchor.js +1 -0
- package/dist/internal/messages/chart.d.ts +3 -0
- package/dist/internal/messages/chart.js +1 -0
- package/dist/internal/messages/code.d.ts +3 -0
- package/dist/internal/messages/code.js +1 -0
- package/dist/internal/messages/data-table.d.ts +3 -0
- package/dist/internal/messages/data-table.js +1 -0
- package/dist/internal/messages/scroll.d.ts +3 -0
- package/dist/internal/messages/scroll.js +1 -0
- package/dist/internal/messages/sparkline.d.ts +3 -0
- package/dist/internal/messages/sparkline.js +1 -0
- package/dist/internal/messages/tour.d.ts +3 -0
- package/dist/internal/messages/tour.js +1 -0
- package/dist/internal/mockup.d.ts +174 -0
- package/dist/internal/mockup.js +2 -0
- package/dist/internal/page-layout.d.ts +24 -5
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/responsive.d.ts +55 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scale.d.ts +0 -17
- package/dist/internal/scale.js +1 -1
- package/dist/internal/step.d.ts +15 -0
- package/dist/internal/step.js +1 -1
- package/dist/internal/table.d.ts +53 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/text.d.ts +57 -0
- package/dist/internal/text.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/time-scale.d.ts +44 -0
- package/dist/internal/time-scale.js +1 -0
- package/dist/internal/transition.d.ts +33 -0
- package/dist/internal/transition.js +1 -0
- package/dist/internal/visibility.d.ts +48 -0
- package/dist/internal/visibility.js +1 -0
- package/dist/internal/window-class.d.ts +29 -2
- package/dist/internal/window-class.js +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.js +1 -1
- package/dist/styles/accordion.css +1 -1
- package/dist/styles/alert.css +1 -1
- package/dist/styles/anchor.css +2 -0
- package/dist/styles/animate-appear.css +1 -1
- package/dist/styles/animate-blink.css +1 -1
- package/dist/styles/animate-counter.css +2 -0
- package/dist/styles/animate-fade.css +1 -1
- package/dist/styles/animate-float.css +2 -0
- package/dist/styles/animate-grow.css +1 -1
- package/dist/styles/animate-headline.css +1 -1
- package/dist/styles/animate-lighting.css +1 -1
- package/dist/styles/animate-marquee.css +1 -1
- package/dist/styles/animate-reveal.css +2 -0
- package/dist/styles/animate-rotate.css +1 -1
- package/dist/styles/animate-scramble.css +2 -0
- package/dist/styles/animate-shake.css +2 -0
- package/dist/styles/animate-slide.css +1 -1
- package/dist/styles/animate-split.css +2 -0
- package/dist/styles/animate-typing.css +1 -1
- package/dist/styles/animate-zoom.css +1 -1
- package/dist/styles/app-logo.css +2 -0
- package/dist/styles/area-chart.css +2 -0
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- package/dist/styles/bar-chart.css +2 -0
- package/dist/styles/blockquote.css +1 -1
- package/dist/styles/bottom-navigation.css +1 -1
- package/dist/styles/box.css +1 -1
- package/dist/styles/breadcrumb.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/calendar.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/chat-bubble.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chip.css +1 -1
- package/dist/styles/code-block.css +2 -0
- package/dist/styles/collapsible.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/command-palette.css +1 -1
- package/dist/styles/config.css +1 -1
- package/dist/styles/confirm.css +1 -1
- package/dist/styles/container.css +1 -1
- package/dist/styles/data-list.css +2 -0
- package/dist/styles/data-table.css +2 -0
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/date-time-picker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/empty.css +1 -1
- package/dist/styles/fieldset.css +1 -1
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/flex.css +2 -0
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/floating-bottom-navigation.css +2 -0
- package/dist/styles/footer.css +1 -1
- package/dist/styles/form.css +1 -1
- package/dist/styles/gauge-chart.css +2 -0
- package/dist/styles/grid.css +1 -1
- package/dist/styles/header.css +1 -1
- package/dist/styles/heatmap-chart.css +2 -0
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/hover-card.css +2 -0
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/image.css +1 -1
- package/dist/styles/line-chart.css +2 -0
- package/dist/styles/list.css +1 -1
- package/dist/styles/locale.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/menubar.css +1 -1
- package/dist/styles/meter.css +2 -0
- package/dist/styles/mockup.css +2 -0
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-field.css +1 -1
- package/dist/styles/overlay.css +1 -1
- package/dist/styles/page-layout.css +1 -1
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/pie-chart.css +2 -0
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popconfirm.css +1 -1
- package/dist/styles/popover.css +1 -1
- package/dist/styles/portal.css +2 -0
- package/dist/styles/progress-box.css +1 -1
- package/dist/styles/progress-circular.css +1 -1
- package/dist/styles/progress-linear.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/scatter-chart.css +2 -0
- package/dist/styles/scroll-area.css +2 -0
- package/dist/styles/scroll-zone.css +2 -0
- package/dist/styles/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/show.css +2 -0
- package/dist/styles/sidebar.css +1 -1
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/sparkline.css +2 -0
- package/dist/styles/spoiler.css +1 -1
- package/dist/styles/stack.css +2 -0
- package/dist/styles/statistic.css +2 -0
- package/dist/styles/stepper.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/text-link.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/timeline-chart.css +2 -0
- package/dist/styles/timeline.css +1 -1
- package/dist/styles/toggle.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/styles/toolbar.css +2 -0
- package/dist/styles/tour.css +2 -0
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/tree-select.css +2 -0
- package/dist/styles/tree-view.css +2 -0
- package/dist/styles/typography.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1356 -133
- package/dist/types.d.ts +564 -3
- package/package.json +3 -2
- package/dist/components/avatar-group/MPAvatarGroup.d.ts +0 -74
- package/dist/components/avatar-group/MPAvatarGroup.js +0 -2
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/internal/avatar-group.d.ts +0 -22
- package/dist/internal/avatar-group.js +0 -2
- package/dist/styles/avatar-group.css +0 -2
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPAlign, MPDensity, MPSide, MPSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The same axes an `MPPopover` takes, and for the same reasons.
|
|
5
|
+
*
|
|
6
|
+
* No `variant`, because the five weights answer "how much does this surface
|
|
7
|
+
* assert itself against the page" and a card that arrives uninvited has already
|
|
8
|
+
* been answered for. No `color`, because MD3's answer for a small sheet
|
|
9
|
+
* anchored to something is `surface-container`, neutral — and a card that could
|
|
10
|
+
* be dyed would dye whatever preview somebody put in it. No `elevation`,
|
|
11
|
+
* because a card floating over the page is the whole idea and a prop that could
|
|
12
|
+
* sit it flat would undo it.
|
|
13
|
+
*/
|
|
14
|
+
export interface MPHoverCardProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'children'> {
|
|
15
|
+
/**
|
|
16
|
+
* What the card hangs off. Exactly one element, which must accept a ref and
|
|
17
|
+
* spread props — every Material Plus component does.
|
|
18
|
+
*
|
|
19
|
+
* Usually an `MPTextLink` or an `MPAvatar`: the two things a reader wants to
|
|
20
|
+
* know more about without leaving the sentence they are in.
|
|
21
|
+
*/
|
|
22
|
+
trigger: React.ReactElement;
|
|
23
|
+
/** The heading, rendered as the element that names the card. */
|
|
24
|
+
title?: React.ReactNode;
|
|
25
|
+
/** A line under it, and the card's accessible description. */
|
|
26
|
+
description?: React.ReactNode;
|
|
27
|
+
/** The body. */
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Which edge of the trigger it appears on. Flips when there is no room.
|
|
31
|
+
* @default 'bottom'
|
|
32
|
+
*/
|
|
33
|
+
side?: MPSide;
|
|
34
|
+
/** Where it sits along that edge. @default 'center' */
|
|
35
|
+
align?: MPAlign;
|
|
36
|
+
/** Distance from the trigger, in pixels. @default 8 */
|
|
37
|
+
sideOffset?: number;
|
|
38
|
+
/** Shift along that edge, in pixels. @default 0 */
|
|
39
|
+
alignOffset?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Draws the wedge pointing at the trigger.
|
|
42
|
+
*
|
|
43
|
+
* Off by default, as on `MPPopover`: a sheet eight pixels from what opened it
|
|
44
|
+
* does not need to say what it belongs to.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
arrow?: boolean;
|
|
48
|
+
/** Whether the card is open. Use with `onOpenChange` for a controlled one. */
|
|
49
|
+
open?: boolean;
|
|
50
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
51
|
+
defaultOpen?: boolean;
|
|
52
|
+
onOpenChange?: (open: boolean) => void;
|
|
53
|
+
/**
|
|
54
|
+
* How long the pointer has to rest on the trigger before the card opens, in
|
|
55
|
+
* milliseconds. Base UI's own default is long enough that crossing a
|
|
56
|
+
* paragraph of links does not open four of them.
|
|
57
|
+
*/
|
|
58
|
+
delay?: number;
|
|
59
|
+
/**
|
|
60
|
+
* How long the card stays after the pointer has left, in milliseconds. This
|
|
61
|
+
* is what makes the gap between the trigger and the card crossable.
|
|
62
|
+
*/
|
|
63
|
+
closeDelay?: number;
|
|
64
|
+
/** A hard cap on the card's width, overriding the one `size` implies. */
|
|
65
|
+
width?: number | string;
|
|
66
|
+
/** The type scale and the room inside. @default 'md' */
|
|
67
|
+
size?: MPSize;
|
|
68
|
+
/** Takes room out of that padding, two pixels a face per step. @default 0 */
|
|
69
|
+
density?: MPDensity;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A card that opens when the pointer rests on something, holding a preview of
|
|
73
|
+
* what is on the other side of it.
|
|
74
|
+
*
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <MPHoverCard trigger={<MPTextLink href="/people/priya">Priya Raman</MPTextLink>} title="Priya Raman">
|
|
77
|
+
* Platform team. Joined 2023.
|
|
78
|
+
* </MPHoverCard>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* ## Where it sits between the other two popups
|
|
82
|
+
*
|
|
83
|
+
* A tooltip is a **label**: one line, no interaction, and the pointer never
|
|
84
|
+
* reaches it. A popover is a panel that was **asked for** by a press, so it can
|
|
85
|
+
* hold a form. This one is uninvited like a tooltip and reachable like a
|
|
86
|
+
* popover — the pointer can cross into it, and a link inside it can be
|
|
87
|
+
* followed.
|
|
88
|
+
*
|
|
89
|
+
* ## Because it is uninvited, it is never the only way to anything
|
|
90
|
+
*
|
|
91
|
+
* A keyboard with no hover, a touchscreen with no pointer, and a screen reader
|
|
92
|
+
* all arrive by the trigger's own route instead. So whatever is in here has to
|
|
93
|
+
* exist on the page the trigger leads to as well. Treat it as a shortcut for
|
|
94
|
+
* the reader who has a pointer, never as the place a fact lives.
|
|
95
|
+
*
|
|
96
|
+
* That is also why there is no keyboard equivalent bolted on. A card that
|
|
97
|
+
* opened on focus would interrupt every keyboard reader tabbing through a
|
|
98
|
+
* paragraph of links, which is a worse answer than not opening at all.
|
|
99
|
+
*/
|
|
100
|
+
export declare function MPHoverCard({ trigger, title, description, children, side, align, sideOffset, alignOffset, arrow, open, defaultOpen, onOpenChange, delay, closeDelay, width, size: sizeProp, density: densityProp, className, style, ...props }: MPHoverCardProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as i from"react";import{PreviewCard as t}from"@base-ui/react/preview-card";import{cssLength as r}from"../../internal/length.js";import{sheetPad as l}from"../../internal/density.js";import{hasContent as o,META_TEXT as n,PROSE_TEXT as s,SHEET_GAP as d,SHEET_TITLE as m}from"../../internal/scale.js";import{FADE as c,PORTAL_LAYER as p}from"../../internal/surface.js";import{useMPDensity as f,useMPSize as h}from"../../internal/config.js";const x={xs:"max-w-64",sm:"max-w-72",md:"max-w-96",lg:"max-w-md",xl:"max-w-xl"},u={xs:8,sm:9,md:10,lg:11,xl:12};export function MPHoverCard({trigger:g,title:v,description:w,children:b,side:j="bottom",align:y="center",sideOffset:N=8,alignOffset:O=0,arrow:_=!1,open:P,defaultOpen:$,onOpenChange:z,delay:C,closeDelay:B,width:D,size:M,density:k,className:A,style:H,...I}){const L=h(M),R=f(k),T=o(v)||o(w),W=u[L],q=i.useId(),E=`${q}-title`,F=`${q}-description`;return a(t.Root,{open:P,defaultOpen:$,onOpenChange:e=>z?.(e),children:[e(t.Trigger,{render:g,delay:C,closeDelay:B}),e(t.Portal,{children:e(t.Positioner,{className:p,side:j,align:y,sideOffset:N,alignOffset:O,children:a(t.Popup,{"data-mp-size":L,"aria-labelledby":o(v)?E:void 0,"aria-describedby":o(w)?F:void 0,className:["mp-hover-card rounded-mp-md relative flex flex-col outline-none","bg-mp-surface-container text-mp-on-surface shadow-mp-2","box-border",l(L,R),d[L],s[L],void 0===D?x[L]:"",c,A??""].filter(Boolean).join(" "),style:{...void 0===D?null:{maxWidth:r(D)},...H},...I,children:[_?e(t.Arrow,{className:["data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"].join(" "),children:e("svg",{width:W,height:W/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:e("path",{d:"M0 0h10L5 5z",fill:"var(--_mp-color-surface-container)"})})}):null,T?a("div",{className:"flex min-w-0 flex-col",children:[o(v)?e("div",{id:E,className:`mp-hover-card__title m-0 ${m[L]}`,children:v}):null,o(w)?e("div",{id:F,className:`mp-hover-card__description text-mp-on-surface-variant m-0 ${n}`,children:w}):null]}):null,o(b)?e("div",{className:"min-w-0",children:b}):null]})})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPHoverCard}from"./MPHoverCard.js";
|
|
@@ -64,7 +64,16 @@ export interface MPImageProps extends Omit<React.ComponentPropsWithoutRef<'img'>
|
|
|
64
64
|
previewSrc?: string;
|
|
65
65
|
/** The label on the button `preview` turns the box into. */
|
|
66
66
|
previewLabel?: string;
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Called when the state changes, for a caller that wants to know.
|
|
69
|
+
*
|
|
70
|
+
* **This is the signal to use, not `onLoad`.** `onLoad` is the `<img>`'s own
|
|
71
|
+
* event and is passed straight through, so it does not fire for a picture the
|
|
72
|
+
* browser already has: the load has been and gone before React attached
|
|
73
|
+
* anything, which is the whole reason this component exists. `onStateChange`
|
|
74
|
+
* is reported from the `complete` check as well as from the event, so it
|
|
75
|
+
* arrives either way.
|
|
76
|
+
*/
|
|
68
77
|
onStateChange?: (state: MPImageState) => void;
|
|
69
78
|
/** The corner and type scale of the placeholder and the fallback. @default 'md' */
|
|
70
79
|
size?: MPSize;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type CartesianChartProps } from '../../internal/ChartFrame.js';
|
|
3
|
+
import type { MPChartCurve, MPChartValueLabels } from '../../types.js';
|
|
4
|
+
export interface MPLineChartProps extends CartesianChartProps {
|
|
5
|
+
/**
|
|
6
|
+
* How the line gets from one point to the next.
|
|
7
|
+
* @default 'linear'
|
|
8
|
+
*/
|
|
9
|
+
curve?: MPChartCurve;
|
|
10
|
+
/**
|
|
11
|
+
* The dots on the joins.
|
|
12
|
+
*
|
|
13
|
+
* `auto` draws them while they still have room to be separate marks and drops
|
|
14
|
+
* them once the line is denser than that — a dot every three pixels is not a
|
|
15
|
+
* row of dots, it is a thicker line.
|
|
16
|
+
* @default 'auto'
|
|
17
|
+
*/
|
|
18
|
+
markers?: boolean | 'auto';
|
|
19
|
+
/**
|
|
20
|
+
* Which values are written onto the line itself.
|
|
21
|
+
* @default 'none'
|
|
22
|
+
*/
|
|
23
|
+
valueLabels?: MPChartValueLabels;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A quantity over an ordered axis — how it has moved, and where it is going.
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <MPLineChart
|
|
30
|
+
* categories={['Mon', 'Tue', 'Wed', 'Thu', 'Fri']}
|
|
31
|
+
* series={[{ name: 'Signups', data: [120, 138, 131, 164, 190] }]}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* It is the shape for a value read along a sequence — days, releases, versions,
|
|
36
|
+
* steps of a process. What it encodes is **position**, and that is the whole
|
|
37
|
+
* argument for every decision below: a line says where a number was, and the
|
|
38
|
+
* distance between two of them says how far it moved.
|
|
39
|
+
*
|
|
40
|
+
* ## The axis does not start at zero
|
|
41
|
+
*
|
|
42
|
+
* A bar's length means its value, so a bar chart cut off above zero is a lie
|
|
43
|
+
* about proportion. A line's *position* means its value and nothing about the
|
|
44
|
+
* mark claims proportionality, so cropping the scale moves every point by the
|
|
45
|
+
* same amount and the picture survives. Forcing zero onto a series that runs
|
|
46
|
+
* between 3,200 and 3,400 draws a flat line and reports a real change as
|
|
47
|
+
* nothing happening.
|
|
48
|
+
*
|
|
49
|
+
* Pass `yAxis={{ min: 0 }}` where zero genuinely is the baseline.
|
|
50
|
+
*
|
|
51
|
+
* ## A gap is a gap
|
|
52
|
+
*
|
|
53
|
+
* A `null` is a point nothing was measured at, and the line breaks there rather
|
|
54
|
+
* than being joined across. A bridged gap draws a straight run through values
|
|
55
|
+
* nobody has, and it is the one kind of invented data a reader never questions
|
|
56
|
+
* — it looks exactly like the rest of the line.
|
|
57
|
+
*
|
|
58
|
+
* ## The hover layer is not optional
|
|
59
|
+
*
|
|
60
|
+
* A chart in a browser is a thing a reader interrogates, so the crosshair and
|
|
61
|
+
* the panel are on by default: the question a line chart gets asked is "what
|
|
62
|
+
* happened in March", and answering it by making somebody measure against a
|
|
63
|
+
* gridline is answering it badly. The arrow keys walk the same columns, and a
|
|
64
|
+
* clipped live region says each one out loud.
|
|
65
|
+
*/
|
|
66
|
+
export declare function MPLineChart({ curve, markers, valueLabels, ...frame }: MPLineChartProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{CartesianFrame as l}from"../../internal/ChartFrame.js";import{LINE_WIDTH as t,MARKER_RADIUS as n,linePath as a}from"../../internal/chart.js";export function MPLineChart({curve:o="linear",markers:i="auto",valueLabels:u="none",...s}){return e(l,{...s,inset:!0,includeZero:!1,headroom:"none"===u?0:14,children:({plot:l,values:s,visible:c,colors:m,point:h,size:d,hovered:f,activeIndex:p,format:x})=>{const v=t[d],k=n[d],j=s.reduce((e,r)=>Math.max(e,r.length),0),y=j>1?l.width/(j-1):l.width,g="auto"===i?y>=6*k:i;return e("g",{className:"mp-line-chart__marks",children:s.map((t,n)=>{if(!c[n])return null;const i=t.map((e,r)=>null===e.value?null:h(r,e.value)),s=m[n];return r("g",{opacity:null!==f&&f!==n?.25:1,children:[e("path",{d:a(i,o),fill:"none",stroke:s,strokeWidth:v,strokeLinecap:"round",strokeLinejoin:"round"}),i.map((r,l)=>{if(!r)return null;const t=p===l;return g||t?e("circle",{cx:r.x,cy:r.y,r:t?k+1:k,fill:s,stroke:"var(--_mp-color-surface)",strokeWidth:2},l):null}),"none"===u?null:t.map((r,n)=>{const a=i[n];if(!a||null===r.value)return null;const o=t.filter(e=>null!==e.value),s=o.map(e=>e.value);if(!("all"===u||"last"===u&&r===o[o.length-1]||"extremes"===u&&(r.value===Math.min(...s)||r.value===Math.max(...s))))return null;const c=a.x>l.left+l.width-24?"end":a.x<l.left+24?"start":"middle";return e("text",{x:a.x,y:a.y-k-5,textAnchor:c,fill:"var(--_mp-color-on-surface)",fontSize:"xs"===d||"sm"===d?10:11,children:r.label??x(r.value)},n)})]},n)})})}})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPLineChart}from"./MPLineChart.js";
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { MPColor, MPSize, MPVariant } from '../../types.js';
|
|
3
|
+
import type { MPColor, MPDensity, MPSize, MPElevation, MPVariant } from '../../types.js';
|
|
4
4
|
export interface MPListProps extends Omit<React.ComponentPropsWithoutRef<'ul'>, 'color'> {
|
|
5
5
|
/**
|
|
6
6
|
* How much surface the sheet paints behind the rows.
|
|
7
7
|
* @default 'outlined'
|
|
8
8
|
*/
|
|
9
9
|
variant?: MPVariant;
|
|
10
|
+
/**
|
|
11
|
+
* How far off the page the sheet is lifted, on MD3's own scale.
|
|
12
|
+
*
|
|
13
|
+
* It moves the **tone** as well as the shadow, because Material pairs the two:
|
|
14
|
+
* a level-2 surface is `surface-container` under a level-2 shadow, and a prop
|
|
15
|
+
* that only cast a shadow would raise this into a surface the specification
|
|
16
|
+
* has no name for. Given a level, `variant` is left holding only its hairline.
|
|
17
|
+
*
|
|
18
|
+
* Left unset, `variant` decides — and `variant="elevated"` is this at `1`.
|
|
19
|
+
*/
|
|
20
|
+
elevation?: MPElevation;
|
|
10
21
|
/**
|
|
11
22
|
* The row height and type scale. Each rung lands a one-line row on exactly the
|
|
12
23
|
* control height of the same name — see `PAD_Y`.
|
|
@@ -19,6 +30,17 @@ export interface MPListProps extends Omit<React.ComponentPropsWithoutRef<'ul'>,
|
|
|
19
30
|
* @default 'primary'
|
|
20
31
|
*/
|
|
21
32
|
color?: MPColor;
|
|
33
|
+
/**
|
|
34
|
+
* Takes room out of every row without changing what it is set in.
|
|
35
|
+
*
|
|
36
|
+
* A list is the component density was invented for: it is one row repeated,
|
|
37
|
+
* and how many of them a reader can see at once is most of what makes it
|
|
38
|
+
* usable. Each step keeps the row exactly one rung down the control ladder —
|
|
39
|
+
* `md` at `-1` is 52px, which is `lg` at `-2` and a `sm` button at `0` — so a
|
|
40
|
+
* dense list and the controls beside it still line up.
|
|
41
|
+
* @default 0
|
|
42
|
+
*/
|
|
43
|
+
density?: MPDensity;
|
|
22
44
|
/**
|
|
23
45
|
* Separates the rows with a hairline instead of with space.
|
|
24
46
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as r,Fragment as n}from"react/jsx-runtime";import*as t from"react";import{useRender as i}from"@base-ui/react/use-render";import{accentSlots as o}from"../../internal/accent.js";import{linkRel as l}from"../../internal/link.js";import{CONTROL_GAP as s,hasContent as a,PROSE_TEXT as d
|
|
2
|
+
import{jsx as e,jsxs as r,Fragment as n}from"react/jsx-runtime";import*as t from"react";import{useRender as i}from"@base-ui/react/use-render";import{accentSlots as o}from"../../internal/accent.js";import{linkRel as l}from"../../internal/link.js";import{CONTROL_GAP as s,hasContent as a,PROSE_TEXT as d}from"../../internal/scale.js";import{sheetPadX as m}from"../../internal/density.js";import{MPStateLayer as c}from"../../internal/StateLayer.js";import{containerSurface as p}from"../../internal/elevation.js";import{useMPColor as u,useMPDensity as f,useMPSize as x}from"../../internal/config.js";const y=/*@__PURE__*/t.createContext({size:"md",color:"primary",density:0,dividers:!1}),h={xs:"py-1.5",sm:"py-2.5",md:"py-4",lg:"py-5",xl:"py-6"},v={xs:["py-1","py-0.5","py-0.5"],sm:["py-2","py-1.5","py-1"],md:["py-3.5","py-3","py-2.5"],lg:["py-4.5","py-4","py-3.5"],xl:["py-5.5","py-5","py-4.5"]};function b(e,r){return 0===r?h[e]:v[e][-r-1]}const j={xs:"text-mp-body-small",sm:"text-mp-body-small",md:"text-mp-body-medium",lg:"text-mp-body-medium",xl:"text-mp-body-medium"},g={xs:"rounded-mp-xs",sm:"rounded-mp-xs",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"};export const MPList=/*@__PURE__*/t.forwardRef(function({variant:r="outlined",elevation:n,size:l,color:s,density:a,dividers:d=!1,render:m,className:c,style:h,children:v,...b},j){const g=x(l),N=u(s),k=f(a),_=t.useMemo(()=>({size:g,color:N,density:k,dividers:d}),[g,N,k,d]),w=["mp-list rounded-mp-md flex flex-col",p(r,n),"text-mp-on-surface",d?"overflow-hidden [&>li+li]:border-mp-outline-variant [&>li+li]:border-t":"p-1",c??""].filter(Boolean).join(" "),z=i({render:m??e("ul",{}),ref:j,props:{role:"list","data-mp-size":g,"data-mp-variant":r,className:w,style:{...o(N),...h},children:v,...b}});return e(y.Provider,{value:_,children:z})});function N({render:r,props:n}){return i({render:r??(n.href?e("a",{}):e("button",{})),props:n})}export const MPListItem=/*@__PURE__*/t.forwardRef(function({startIcon:i,endIcon:o,description:p,action:u,href:f,target:x,rel:h,render:v,selected:k=!1,disabled:_=!1,className:w,children:z,onClick:B,...C},I){const{size:L,density:M,dividers:P}=t.useContext(y),R=Boolean(B||f)&&!_,F=m(L,M),S=["group relative flex min-w-0 flex-1 items-center overflow-hidden text-start","font-[inherit] no-underline",F,b(L,M),s[L],d[L],"transition-[background-color,color] duration-(--mp-sys-motion-duration-short4)",P?"":g[L],_?"text-mp-on-surface/38 cursor-default":k?"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)":"",R?["cursor-pointer appearance-none border-0",k?"":"bg-transparent","outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none"].filter(Boolean).join(" "):""].filter(Boolean).join(" "),$=r(n,{children:[R?e(c,{}):null,a(i)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:i}):null,r("span",{className:"mp-list-item__text flex min-w-0 flex-1 flex-col",children:[a(z)?e("span",{className:"mp-list-item__label truncate",children:z}):null,a(p)?e("span",{className:["mp-list-item__description truncate",j[L],k?"opacity-80":"text-mp-on-surface-variant"].join(" "),children:p}):null]}),a(o)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:o}):null]});return r("li",{ref:I,"data-selected":k||void 0,className:["flex w-full items-center",w??""].filter(Boolean).join(" "),...C,children:[R&&f?e(N,{render:v,props:{href:f,target:x,rel:l(x,h),className:S,"aria-current":k?"page":void 0,onClick:B,children:$}}):R?e(N,{render:v,props:{type:v?void 0:"button",className:S,"aria-current":!!k||void 0,onClick:B,children:$}}):e("div",{className:S,"aria-disabled":_||void 0,children:$}),a(u)?e("div",{className:`flex shrink-0 items-center ${F}`,children:u}):null]})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as l}from"@base-ui/react/context-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{CheckIcon as s,ChevronRightIcon as o}from"../../constants/icons.js";import{linkRel as i}from"../../internal/link.js";import{MPMenuContext as c}from"../../internal/menu.js";import{accentSlots as
|
|
2
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Menu as a}from"@base-ui/react/menu";import{ContextMenu as l}from"@base-ui/react/context-menu";import{MPIcon as r}from"../icon/MPIcon.js";import{CheckIcon as s,ChevronRightIcon as o}from"../../constants/icons.js";import{linkRel as i}from"../../internal/link.js";import{MPMenuContext as c}from"../../internal/menu.js";import{accentSlots as m}from"../../internal/accent.js";import{MPStateLayer as d}from"../../internal/StateLayer.js";import{CONTROL_ICON as u,META_TEXT as p,hasContent as h}from"../../internal/scale.js";import{DOT_MOTION as f,MARK_MOTION as x}from"../../internal/mark.js";import{FADE as b,PORTAL_LAYER as g}from"../../internal/surface.js";import{useMPColor as v,useMPSize as N}from"../../internal/config.js";const y=/*@__PURE__*/["mp-menu__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container text-mp-on-surface","max-h-[min(24rem,var(--available-height))] min-w-[112px] max-w-[280px]","overflow-y-auto overscroll-contain py-2 outline-none",b].join(" "),C={xs:"min-h-8",sm:"min-h-10",md:"min-h-12",lg:"min-h-14",xl:"min-h-16"},k={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},j={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3",xl:"gap-4"},M={xs:"text-mp-label-medium",sm:"text-mp-label-large",md:"text-mp-label-large",lg:"text-mp-title-medium",xl:"text-mp-title-medium"};function O(e,n,t){return["group relative flex w-full cursor-pointer items-center select-none",n?"text-(--_mp-accent)":"text-mp-on-surface",C[e],k[e],j[e],M[e],"data-disabled:text-mp-on-surface/38 data-disabled:cursor-default","outline-none",t??""].filter(Boolean).join(" ")}function P(){return e(d,{layer:"inset-0 bg-current",className:"group-data-highlighted:opacity-8 group-data-popup-open:opacity-8 group-data-disabled:opacity-0"})}const I="relative flex shrink-0 items-center justify-center";function $({children:t,description:a}){return h(a)?n("span",{className:"relative flex min-w-0 flex-1 flex-col py-1.5 text-start",children:[e("span",{className:"truncate",children:t}),e("span",{className:`text-mp-on-surface-variant truncate ${p}`,children:a})]}):e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:t})}function _({shortcut:n}){return h(n)?e("span",{className:`text-mp-on-surface-variant relative ms-2 shrink-0 ${p}`,children:n}):null}export function MPMenuItem({onClick:l,href:r,target:s,rel:o,startIcon:m,endIcon:d,shortcut:u,description:p,color:f,closeOnClick:x=!0,disabled:b=!1,label:g,children:v,className:N,style:y}){const{size:C}=t.useContext(c),k=n(t.Fragment,{children:[e(P,{}),h(m)?e("span",{className:`${I} text-mp-on-surface-variant`,children:m}):null,e($,{description:p,children:v}),h(d)?e("span",{className:`${I} text-mp-on-surface-variant`,children:d}):null,e(_,{shortcut:u})]}),j=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0,M=j||y?{...j,...y}:void 0;return void 0===r||b?e(a.Item,{disabled:b,label:g,closeOnClick:x,onClick:l,className:O(C,Boolean(f),N),style:M,children:k}):e(a.LinkItem,{href:r,target:s,rel:i(s,o),label:g,closeOnClick:x,onClick:l,className:O(C,Boolean(f),N),style:M,children:k})}export function MPMenuCheckboxItem({checked:l,defaultChecked:o,onCheckedChange:i,endIcon:m,shortcut:d,description:p,color:f,closeOnClick:b=!1,disabled:g=!1,label:v,children:N,className:y,style:C}){const{size:k}=t.useContext(c),j=f?{"--_mp-accent":`var(--_mp-color-${f})`}:void 0;return n(a.CheckboxItem,{checked:l,defaultChecked:o,onCheckedChange:e=>i?.(e),disabled:g,label:v,closeOnClick:b,className:O(k,Boolean(f),y),style:j||C?{...j,...C}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[k]},children:e(a.CheckboxItemIndicator,{className:`mp-menu__mark flex items-center justify-center ${x}`,children:e(r,{icon:s,size:u[k]})})}),e($,{description:p,children:N}),h(m)?e("span",{className:`${I} text-mp-on-surface-variant`,children:m}):null,e(_,{shortcut:d})]})}export function MPMenuRadioGroup({value:n,defaultValue:t,onValueChange:l,disabled:r=!1,children:s,className:o,style:i}){return e(a.RadioGroup,{value:n,defaultValue:t,onValueChange:e=>l?.(e),disabled:r,className:o,style:i,children:s})}export function MPMenuRadioItem({value:l,endIcon:r,shortcut:s,description:o,color:i,closeOnClick:m=!1,disabled:d=!1,label:p,children:x,className:b,style:g}){const{size:v}=t.useContext(c),N=i?{"--_mp-accent":`var(--_mp-color-${i})`}:void 0;return n(a.RadioItem,{value:l,disabled:d,label:p,closeOnClick:m,className:O(v,Boolean(i),b),style:N||g?{...N,...g}:void 0,children:[e(P,{}),e("span",{className:`${I} text-(--_mp-accent)`,style:{width:u[v]},children:e(a.RadioItemIndicator,{className:`mp-menu__dot flex items-center justify-center ${f}`,children:e("span",{className:"block size-2.5 rounded-full bg-current"})})}),e($,{description:o,children:x}),h(r)?e("span",{className:`${I} text-mp-on-surface-variant`,children:r}):null,e(_,{shortcut:s})]})}export function MPMenuGroup({label:l,children:r,className:s,style:o}){const{size:i}=t.useContext(c);return n(a.Group,{className:s,style:o,children:[h(l)?e(a.GroupLabel,{className:`text-mp-on-surface-variant pt-2 pb-1 ${k[i]} ${p}`,children:l}):null,r]})}export function MPMenuSeparator({className:n,...t}){return e(a.Separator,{className:["bg-mp-outline-variant my-2 h-px",n??""].filter(Boolean).join(" "),...t})}export function MPMenuSubmenu({label:l,startIcon:s,disabled:i=!1,side:d="right",sideOffset:p=0,children:f,className:x,style:b}){const{size:v,color:N}=t.useContext(c);return n(a.SubmenuRoot,{children:[n(a.SubmenuTrigger,{disabled:i,className:O(v,!1),children:[e(P,{}),h(s)?e("span",{className:`${I} text-mp-on-surface-variant`,children:s}):null,e("span",{className:"relative min-w-0 flex-1 truncate text-start",children:l}),e("span",{className:`${I} text-mp-on-surface-variant rtl:rotate-180`,children:e(r,{icon:o,size:u[v]})})]}),e(a.Portal,{children:e(a.Positioner,{className:g,side:d,sideOffset:p,align:"start",children:e(a.Popup,{className:[y,x??""].filter(Boolean).join(" "),style:{...m(N),...b},children:f})})})]})}export function MPMenu({size:l,color:r,trigger:s,open:o,defaultOpen:i,onOpenChange:d,side:u="bottom",align:p="start",sideOffset:h=4,modal:f,openOnHover:x=!1,loopFocus:b=!0,nativeButton:C=!0,disabled:k=!1,className:j,style:M,children:O}){const P=N(l),I=v(r),$=t.useMemo(()=>({size:P,color:I}),[P,I]);return e(c.Provider,{value:$,children:n(a.Root,{open:o,defaultOpen:i,onOpenChange:e=>d?.(e),modal:f,loopFocus:b,disabled:k,children:[s?e(a.Trigger,{render:s,openOnHover:x,nativeButton:C,disabled:k}):null,e(a.Portal,{children:e(a.Positioner,{className:g,side:u,align:p,sideOffset:h,children:e(a.Popup,{"data-mp-size":P,className:[y,j??""].filter(Boolean).join(" "),style:{...m(I),...M},children:O})})})]})})}export function MPContextMenu({size:a,color:r,content:s,children:o,open:i,defaultOpen:d,onOpenChange:u,loopFocus:p=!0,disabled:h=!1,className:f,style:x}){const b=N(a),C=v(r),k=t.useMemo(()=>({size:b,color:C}),[b,C]);return e(c.Provider,{value:k,children:n(l.Root,{open:i,defaultOpen:d,onOpenChange:e=>u?.(e),loopFocus:p,disabled:h,children:[e(l.Trigger,{children:o}),e(l.Portal,{children:e(l.Positioner,{className:g,children:e(l.Popup,{"data-mp-size":b,className:[y,f??""].filter(Boolean).join(" "),style:{...m(C),...x},children:s})})})]})})}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPColor, MPSize, MPThreshold } from '../../types.js';
|
|
3
|
+
export interface MPMeterProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* How much there is.
|
|
6
|
+
*
|
|
7
|
+
* Required, and that is the whole difference from `MPProgressLinear`: a meter
|
|
8
|
+
* reports a quantity that is already known, so there is no indeterminate case
|
|
9
|
+
* for a default to stand in for.
|
|
10
|
+
*/
|
|
11
|
+
value: number;
|
|
12
|
+
/** @default 0 */
|
|
13
|
+
min?: number;
|
|
14
|
+
/** @default 100 */
|
|
15
|
+
max?: number;
|
|
16
|
+
/** A name for what is being measured. Read out with the value. */
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Shows the value as text beside the bar. A share of the range unless
|
|
20
|
+
* `format` says otherwise.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showValue?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* How to write that value — `Intl.NumberFormat` options, so bytes,
|
|
26
|
+
* currencies and plain counts all work.
|
|
27
|
+
*
|
|
28
|
+
* It matters more here than on a progress bar. A meter usually has real
|
|
29
|
+
* units: 41 of 60 seats, 2.1 GB of 5, £340 of a £500 budget. A percentage is
|
|
30
|
+
* what a range nobody described reads as, not what the reader came for.
|
|
31
|
+
*/
|
|
32
|
+
format?: Intl.NumberFormatOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Where the bar changes colour, smallest `from` first. The family of the last
|
|
35
|
+
* threshold the value has reached wins; below all of them `color` stands.
|
|
36
|
+
*/
|
|
37
|
+
thresholds?: readonly MPThreshold[];
|
|
38
|
+
/**
|
|
39
|
+
* Thickness of the groove. Nothing else on a bar has a size.
|
|
40
|
+
* @default 'md'
|
|
41
|
+
*/
|
|
42
|
+
size?: MPSize;
|
|
43
|
+
/**
|
|
44
|
+
* The family the bar carries before any threshold is reached.
|
|
45
|
+
* @default 'primary'
|
|
46
|
+
*/
|
|
47
|
+
color?: MPColor;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* How much of something there is, on a scale known in advance — disk used, seats
|
|
51
|
+
* taken, quota spent, a password's strength.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <MPMeter
|
|
55
|
+
* value={41}
|
|
56
|
+
* max={60}
|
|
57
|
+
* label="Seats taken"
|
|
58
|
+
* showValue
|
|
59
|
+
* thresholds={[{ from: 48, color: 'tertiary' }, { from: 57, color: 'error' }]}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* ## It looks like a progress bar and is not one
|
|
64
|
+
*
|
|
65
|
+
* A progress bar is about **time**: something is happening, this is how far it
|
|
66
|
+
* has got, it may have no value at all, and it is expected to move on its own.
|
|
67
|
+
* A meter is about **quantity**: the number is already known, it does not move
|
|
68
|
+
* unless the thing it measures does, and it is meaningful to say the reading is
|
|
69
|
+
* bad — which is what `thresholds` is for and what a progress bar has no use
|
|
70
|
+
* for. A disk that is 94% full is not 94% finished.
|
|
71
|
+
*
|
|
72
|
+
* The two carry different roles for that reason, so a screen reader announces a
|
|
73
|
+
* meter as a measurement rather than as something in progress. Reaching for the
|
|
74
|
+
* wrong one is not a styling mistake; it is a claim about what the number means.
|
|
75
|
+
*
|
|
76
|
+
* ## `thresholds` names roles, not colours
|
|
77
|
+
*
|
|
78
|
+
* MD3 has four accent families and none of them is called `warning`, so an amber
|
|
79
|
+
* band is `tertiary` under whatever source colour the page is themed from. That
|
|
80
|
+
* is the honest answer rather than a limitation: a threshold that named a colour
|
|
81
|
+
* would be a colour that ignores the theme, on the one component whose whole
|
|
82
|
+
* point is to be read at a glance.
|
|
83
|
+
*
|
|
84
|
+
* The last threshold the value has reached wins, so they are listed smallest
|
|
85
|
+
* first and the list is read in the order it was given.
|
|
86
|
+
*/
|
|
87
|
+
export declare const MPMeter: React.ForwardRefExoticComponent<MPMeterProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as a from"react";import{Meter as t}from"@base-ui/react/meter";import{accentSlots as n}from"../../internal/accent.js";import{META_TEXT as o,STACK_GAP as s}from"../../internal/scale.js";import{BAR_THICKNESS as l,progressFraction as i}from"../../internal/progress.js";import{useMPColor as m,useMPSize as c}from"../../internal/config.js";import{thresholdColor as u}from"../../internal/threshold.js";export const MPMeter=/*@__PURE__*/a.forwardRef(function({value:a,min:f=0,max:d=100,label:p,showValue:h=!1,format:j,thresholds:b,size:x,color:w,className:v,style:N,..._},g){const y=c(x),k=m(w),M=i(a,f,d),z=u(a,k,b),R=void 0!==j;return r(t.Root,{ref:g,value:a,min:f,max:d,format:j,"data-mp-size":y,className:["mp-meter flex w-full flex-col",s[y],v??""].filter(Boolean).join(" "),style:{...n(z),...N},..._,children:[p||h?r("div",{className:["mp-meter__header flex items-baseline gap-2",p?"justify-between":"justify-end",o].join(" "),children:[p?e(t.Label,{className:"text-mp-on-surface min-w-0 truncate",children:p}):null,h?e(t.Value,{className:"text-mp-on-surface-variant shrink-0 tabular-nums",children:e=>R?e:`${Math.round(100*(M??0))}%`}):null]}):null,e(t.Track,{className:["mp-meter__track rounded-mp-full bg-mp-on-surface/12 relative w-full overflow-hidden",l[y]].join(" "),children:e(t.Indicator,{className:["mp-meter__bar rounded-mp-full absolute inset-y-0 start-0 bg-(--_mp-accent)","transition-[width,background-color] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none"].join(" ")})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPMeter}from"./MPMeter.js";
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPMockupBezel, MPMockupDevice, MPMockupFinish, MPMockupHardware, MPMockupNotch, MPMockupOrientation, MPMockupOs, MPMockupResolution } from '../../internal/mockup.js';
|
|
3
|
+
import type { MPSize } from '../../types.js';
|
|
4
|
+
export type { MPMockupBezel, MPMockupDevice, MPMockupFinish, MPMockupHardware, MPMockupNotch, MPMockupOrientation, MPMockupOs, MPMockupResolution };
|
|
5
|
+
export interface MPMockupProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
6
|
+
/**
|
|
7
|
+
* Which machine this is a picture of. The one prop with no default: a mockup
|
|
8
|
+
* that has not said what it is a mockup of has not said anything.
|
|
9
|
+
*/
|
|
10
|
+
device: MPMockupDevice;
|
|
11
|
+
/**
|
|
12
|
+
* The system whose chrome is drawn on the screen. A desktop runs `macos`,
|
|
13
|
+
* `windows` or `linux`; a tablet runs `ipados` or `android`; a phone runs
|
|
14
|
+
* `ios` or `android`.
|
|
15
|
+
*
|
|
16
|
+
* A value the device cannot run falls back to that device's own default
|
|
17
|
+
* rather than being refused — `os="macos"` on a phone is a caller who changed
|
|
18
|
+
* `device` and forgot this one.
|
|
19
|
+
*/
|
|
20
|
+
os?: MPMockupOs;
|
|
21
|
+
/**
|
|
22
|
+
* What holds a desktop screen up: a stand under it, or a keyboard in front of
|
|
23
|
+
* it. Ignored on a tablet and a phone, which hold themselves up.
|
|
24
|
+
* @default 'monitor'
|
|
25
|
+
*/
|
|
26
|
+
hardware?: MPMockupHardware;
|
|
27
|
+
/**
|
|
28
|
+
* How big the device is, on a five-step ladder of real resolutions per device
|
|
29
|
+
* — a 320-wide phone up to a 430-wide one, a 1024-wide desktop up to a
|
|
30
|
+
* 1920-wide one.
|
|
31
|
+
*
|
|
32
|
+
* As on `MPBox`, `size` here sets no height and no type scale. What it sets is
|
|
33
|
+
* the **resolution of the screen**, which is the only thing about a device
|
|
34
|
+
* there is to scale. `resolution` overrides it outright.
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
37
|
+
size?: MPSize;
|
|
38
|
+
/**
|
|
39
|
+
* The screen's logical resolution in CSS pixels, when none of the five steps
|
|
40
|
+
* is the machine you mean.
|
|
41
|
+
*
|
|
42
|
+
* This is the viewport the content is laid out against, not the panel's
|
|
43
|
+
* physical pixel count.
|
|
44
|
+
*/
|
|
45
|
+
resolution?: MPMockupResolution;
|
|
46
|
+
/**
|
|
47
|
+
* Which way a handheld is held. Landscape turns the screen, the bezel and the
|
|
48
|
+
* cut-out together. Ignored on a desktop, whose stand does not turn with it.
|
|
49
|
+
* @default 'portrait'
|
|
50
|
+
*/
|
|
51
|
+
orientation?: MPMockupOrientation;
|
|
52
|
+
/**
|
|
53
|
+
* How much hardware there is around the screen.
|
|
54
|
+
*
|
|
55
|
+
* `none` is not a thinner bezel — it is no hardware at all, leaving the screen
|
|
56
|
+
* on its own with its corners cut, which is what a mockup that only wants the
|
|
57
|
+
* viewport is asking for. `thick` is an older device: narrow sides, a
|
|
58
|
+
* forehead and a chin.
|
|
59
|
+
* @default 'standard'
|
|
60
|
+
*/
|
|
61
|
+
bezel?: MPMockupBezel;
|
|
62
|
+
/**
|
|
63
|
+
* What the hardware is made of. Fixed colours rather than theme tokens — a
|
|
64
|
+
* graphite phone stays graphite on a page switched to dark.
|
|
65
|
+
* @default 'graphite'
|
|
66
|
+
*/
|
|
67
|
+
finish?: MPMockupFinish;
|
|
68
|
+
/**
|
|
69
|
+
* The camera cut-out. Hardware rather than chrome, so it is drawn whether or
|
|
70
|
+
* not `systemUi` is on. Defaults to what the device would have: a dynamic
|
|
71
|
+
* island on an iOS phone, a punch hole on an Android one, nothing anywhere
|
|
72
|
+
* else.
|
|
73
|
+
*/
|
|
74
|
+
notch?: MPMockupNotch;
|
|
75
|
+
/**
|
|
76
|
+
* Draws the system's own bars — a status bar and a home indicator, a menu bar
|
|
77
|
+
* and a dock, a taskbar.
|
|
78
|
+
*
|
|
79
|
+
* Each takes its own room rather than covering the content, so turning it off
|
|
80
|
+
* gives the screen back to `children` rather than uncovering anything.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
systemUi?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The rendered width of the whole picture on the page. A number is pixels, a
|
|
86
|
+
* string is any CSS length.
|
|
87
|
+
*
|
|
88
|
+
* Left out the mockup fills the width it is given. The device is always laid
|
|
89
|
+
* out at its own resolution and then scaled once, so this changes how big the
|
|
90
|
+
* picture is and never what the content inside it thinks the viewport is.
|
|
91
|
+
*/
|
|
92
|
+
width?: number | string;
|
|
93
|
+
/** The rendered height. Given on its own it decides the size and the width follows. */
|
|
94
|
+
height?: number | string;
|
|
95
|
+
/** What is on the screen. */
|
|
96
|
+
children?: React.ReactNode;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* A picture of a device, with a real page inside it.
|
|
100
|
+
*
|
|
101
|
+
* ```tsx
|
|
102
|
+
* <MPMockup device="mobile" width={280}>
|
|
103
|
+
* <YourScreen />
|
|
104
|
+
* </MPMockup>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* ## The screen is a real viewport
|
|
108
|
+
*
|
|
109
|
+
* `children` are laid out against the device's own resolution — 390 by 844 CSS
|
|
110
|
+
* pixels for a phone at `md` — and the whole device is then scaled once to
|
|
111
|
+
* whatever room it was given. So a layout inside it wraps where it would wrap
|
|
112
|
+
* on the machine, not where it would wrap in the box the picture happens to fit
|
|
113
|
+
* in.
|
|
114
|
+
*
|
|
115
|
+
* The one thing to know is that a media query still measures the **window**.
|
|
116
|
+
* `@media (max-width: 600px)` inside a phone mockup on a laptop is false, and
|
|
117
|
+
* always will be — nothing on the page can change what the window is. Content
|
|
118
|
+
* that has to respond inside the frame should measure the frame, with a
|
|
119
|
+
* container query.
|
|
120
|
+
*
|
|
121
|
+
* ## That scale is a transform, and it is the exception
|
|
122
|
+
*
|
|
123
|
+
* The rule everywhere else in this library is that a surface is not moved or
|
|
124
|
+
* scaled. It is a rule about **controls**: a scaled button is a button whose
|
|
125
|
+
* text was resampled at the moment it was pressed.
|
|
126
|
+
*
|
|
127
|
+
* Nothing here is pressed, and the scale never changes on an interaction — it
|
|
128
|
+
* is set once from the room available and again only when that room changes. A
|
|
129
|
+
* device drawn at a third of its size is a picture of a device, which is the
|
|
130
|
+
* whole point, and no other mechanism lays a 390-pixel page out inside a
|
|
131
|
+
* 130-pixel box.
|
|
132
|
+
*
|
|
133
|
+
* ## Hardware is a photograph, software is a page
|
|
134
|
+
*
|
|
135
|
+
* The finishes are fixed colours and do not follow the theme: a graphite phone
|
|
136
|
+
* stays graphite on a page switched to dark, because a mockup whose aluminium
|
|
137
|
+
* turned white would be a mockup of nothing.
|
|
138
|
+
*
|
|
139
|
+
* The chrome on the screen does follow it. A menu bar and a status bar are
|
|
140
|
+
* drawn out of `surface` and `on-surface`, so the frame stays a frame around
|
|
141
|
+
* *your* page rather than becoming a picture of somebody else's screenshot.
|
|
142
|
+
*/
|
|
143
|
+
export declare const MPMockup: React.ForwardRefExoticComponent<MPMockupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as i from"react";import{cssLength as o}from"../../internal/length.js";import{FINISHES as s,HARDWARE as h,MockupCutout as r,RESOLUTIONS as n,defaultNotch as a,mockupChrome as d,mockupMetrics as l,resolveOs as c}from"../../internal/mockup.js";import{useMPSize as m}from"../../internal/config.js";export const MPMockup=/*@__PURE__*/i.forwardRef(function({device:p,os:u,hardware:f="monitor",size:g,resolution:w,orientation:v="portrait",bezel:b="standard",finish:k="graphite",notch:y,systemUi:x=!0,width:_,height:$,className:R,style:N,children:j,...z},B){const H=m(g),M=c(p,u),O=y??a(p,M),W=l({device:p,bezel:b,hardware:f,orientation:v,resolution:w??n[p][H]}),{screen:C,body:P,frame:E,shell:F,screenRadius:S,stand:T,laptop:U}=W,q=x?d({os:M,width:C.width,notch:O}):null,A=i.useRef(null),[D,G]=i.useState(null);i.useEffect(()=>{const e=A.current;if(!e||"undefined"==typeof ResizeObserver)return;const t=()=>{const t=e.getBoundingClientRect();t.width<=0||t.height<=0||G(Math.min(t.width/E.width,t.height/E.height))};t();const i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[E.width,E.height]);const I=i.useCallback(e=>{A.current=e,"function"==typeof B?B(e):B&&(B.current=e)},[B]);return e("div",{ref:I,"data-mp-size":H,"data-mp-device":p,"data-mp-os":M,className:["mp-mockup relative",R??""].filter(Boolean).join(" "),style:{...s[k],width:o(_)??(void 0===$?"100%":"auto"),height:o($),aspectRatio:`${E.width} / ${E.height}`,...N},...z,children:t("div",{className:"mp-mockup__frame absolute top-1/2 left-1/2 flex flex-col items-center",style:{width:E.width,height:E.height,transform:`translate(-50%, -50%) scale(${D??1})`,transformOrigin:"center",visibility:null===D?"hidden":void 0},children:[e("div",{className:`mp-mockup__body relative shrink-0 ${h}`,style:{width:P.width,height:P.height,borderRadius:F.radius,padding:`${F.top}px ${F.side}px ${F.bottom}px`},children:t("div",{className:"mp-mockup__screen bg-mp-surface text-mp-on-surface relative flex size-full flex-col overflow-hidden",style:{borderRadius:S},children:[q?.top,e("div",{className:"mp-mockup__content relative min-h-0 overflow-hidden",style:{width:C.width,height:C.height-(q?.insetTop??0)-(q?.insetBottom??0)},children:j}),q?.bottom,e(r,{notch:O,width:C.width})]})}),T?t(i.Fragment,{children:[e("div",{className:`mp-mockup__neck shrink-0 ${h}`,style:{width:T.neckWidth,height:T.neckHeight}}),e("div",{className:`mp-mockup__foot shrink-0 ${h}`,style:{width:T.footWidth,height:T.footHeight,borderRadius:T.footHeight}})]}):null,U?e("div",{className:`mp-mockup__base relative shrink-0 ${h}`,style:{width:U.width,height:U.height,clipPath:"polygon(2% 0, 98% 0, 100% 100%, 0 100%)",borderRadius:`0 0 ${.5*U.height}px ${.5*U.height}px`},children:e("span",{className:"bg-(--_mp-device-edge) absolute top-0 left-1/2 -translate-x-1/2 rounded-b-full",style:{width:U.lipWidth,height:.28*U.height}})}):null]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPMockup}from"./MPMockup.js";
|