material-plus-ui 1.3.0 → 1.4.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 +4 -3
- package/dist/components/accordion/MPAccordion.d.ts +1 -1
- package/dist/components/accordion/MPAccordion.js +2 -1
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/alert/MPAlert.d.ts +27 -1
- package/dist/components/alert/MPAlert.js +2 -1
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +1 -1
- package/dist/components/animate-appear/MPAnimateAppear.d.ts +1 -1
- package/dist/components/animate-appear/MPAnimateAppear.js +2 -1
- package/dist/components/animate-appear/index.d.ts +2 -2
- package/dist/components/animate-appear/index.js +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.d.ts +1 -1
- package/dist/components/animate-blink/MPAnimateBlink.js +1 -1
- package/dist/components/animate-blink/index.d.ts +2 -2
- package/dist/components/animate-blink/index.js +1 -1
- package/dist/components/animate-fade/MPAnimateFade.d.ts +1 -1
- package/dist/components/animate-fade/MPAnimateFade.js +1 -1
- package/dist/components/animate-fade/index.d.ts +2 -2
- package/dist/components/animate-fade/index.js +1 -1
- package/dist/components/animate-grow/MPAnimateGrow.d.ts +1 -1
- package/dist/components/animate-grow/MPAnimateGrow.js +1 -1
- package/dist/components/animate-grow/index.d.ts +2 -2
- package/dist/components/animate-grow/index.js +1 -1
- package/dist/components/animate-headline/MPAnimateHeadline.d.ts +1 -1
- package/dist/components/animate-headline/MPAnimateHeadline.js +2 -1
- package/dist/components/animate-headline/index.d.ts +2 -2
- package/dist/components/animate-headline/index.js +1 -1
- package/dist/components/animate-lighting/MPAnimateLighting.d.ts +1 -1
- package/dist/components/animate-lighting/MPAnimateLighting.js +1 -1
- package/dist/components/animate-lighting/index.d.ts +2 -2
- package/dist/components/animate-lighting/index.js +1 -1
- package/dist/components/animate-marquee/MPAnimateMarquee.d.ts +1 -1
- package/dist/components/animate-marquee/MPAnimateMarquee.js +2 -1
- package/dist/components/animate-marquee/index.d.ts +2 -2
- package/dist/components/animate-marquee/index.js +1 -1
- package/dist/components/animate-rotate/MPAnimateRotate.d.ts +1 -1
- package/dist/components/animate-rotate/MPAnimateRotate.js +1 -1
- package/dist/components/animate-rotate/index.d.ts +2 -2
- package/dist/components/animate-rotate/index.js +1 -1
- package/dist/components/animate-slide/MPAnimateSlide.d.ts +1 -1
- package/dist/components/animate-slide/MPAnimateSlide.js +1 -1
- package/dist/components/animate-slide/index.d.ts +2 -2
- package/dist/components/animate-slide/index.js +1 -1
- package/dist/components/animate-typing/MPAnimateTyping.d.ts +1 -1
- package/dist/components/animate-typing/MPAnimateTyping.js +2 -1
- package/dist/components/animate-typing/index.d.ts +2 -2
- package/dist/components/animate-typing/index.js +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.d.ts +1 -1
- package/dist/components/animate-zoom/MPAnimateZoom.js +1 -1
- package/dist/components/animate-zoom/index.d.ts +2 -2
- package/dist/components/animate-zoom/index.js +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/MPAspectRatio.js +1 -1
- package/dist/components/aspect-ratio/index.d.ts +2 -2
- package/dist/components/aspect-ratio/index.js +1 -1
- package/dist/components/avatar/MPAvatar.d.ts +1 -1
- package/dist/components/avatar/MPAvatar.js +2 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar-group/MPAvatarGroup.d.ts +74 -0
- package/dist/components/avatar-group/MPAvatarGroup.js +2 -0
- package/dist/components/avatar-group/index.d.ts +2 -0
- package/dist/components/avatar-group/index.js +1 -0
- package/dist/components/badge/MPBadge.d.ts +1 -1
- package/dist/components/badge/MPBadge.js +2 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/blockquote/MPBlockquote.d.ts +1 -1
- package/dist/components/blockquote/MPBlockquote.js +2 -1
- package/dist/components/blockquote/index.d.ts +2 -2
- package/dist/components/blockquote/index.js +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.d.ts +1 -1
- package/dist/components/bottom-navigation/MPBottomNavigation.js +2 -1
- package/dist/components/bottom-navigation/index.d.ts +2 -2
- package/dist/components/bottom-navigation/index.js +1 -1
- package/dist/components/box/MPBox.d.ts +1 -1
- package/dist/components/box/MPBox.js +1 -1
- package/dist/components/box/index.d.ts +2 -2
- package/dist/components/box/index.js +1 -1
- package/dist/components/breadcrumb/MPBreadcrumb.d.ts +11 -5
- package/dist/components/breadcrumb/MPBreadcrumb.js +2 -1
- package/dist/components/breadcrumb/index.d.ts +2 -2
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/button/MPButton.d.ts +1 -1
- package/dist/components/button/MPButton.js +2 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/MPButtonGroup.d.ts +10 -1
- package/dist/components/button-group/MPButtonGroup.js +2 -1
- package/dist/components/button-group/index.d.ts +2 -2
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/card/MPCard.d.ts +1 -1
- package/dist/components/card/MPCard.js +2 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js +1 -1
- package/dist/components/carousel/MPCarousel.d.ts +13 -8
- package/dist/components/carousel/MPCarousel.js +2 -1
- package/dist/components/carousel/index.d.ts +2 -2
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/chat-bubble/MPChatBubble.d.ts +16 -3
- package/dist/components/chat-bubble/MPChatBubble.js +2 -1
- package/dist/components/chat-bubble/index.d.ts +2 -2
- package/dist/components/chat-bubble/index.js +1 -1
- package/dist/components/checkbox/MPCheckbox.d.ts +1 -1
- package/dist/components/checkbox/MPCheckbox.js +2 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/MPChip.d.ts +1 -1
- package/dist/components/chip/MPChip.js +2 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js +1 -1
- package/dist/components/collapsible/MPCollapsible.d.ts +1 -1
- package/dist/components/collapsible/MPCollapsible.js +2 -1
- package/dist/components/collapsible/index.d.ts +2 -2
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/color-picker/MPColorPicker.d.ts +22 -19
- package/dist/components/color-picker/MPColorPicker.js +2 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/combobox/MPCombobox.d.ts +23 -5
- package/dist/components/combobox/MPCombobox.js +2 -1
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/command-palette/MPCommandPalette.d.ts +132 -0
- package/dist/components/command-palette/MPCommandPalette.js +2 -0
- package/dist/components/command-palette/index.d.ts +2 -0
- package/dist/components/command-palette/index.js +1 -0
- package/dist/components/container/MPContainer.d.ts +1 -1
- package/dist/components/container/MPContainer.js +1 -1
- package/dist/components/container/index.d.ts +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/date-picker/MPDatePicker.d.ts +3 -3
- package/dist/components/date-picker/MPDatePicker.js +2 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/MPDateRangePicker.d.ts +3 -3
- package/dist/components/date-range-picker/MPDateRangePicker.js +2 -1
- package/dist/components/date-range-picker/index.d.ts +2 -2
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/MPDateTimePicker.d.ts +9 -4
- package/dist/components/date-time-picker/MPDateTimePicker.js +2 -1
- package/dist/components/date-time-picker/index.d.ts +2 -2
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/MPDialog.d.ts +1 -1
- package/dist/components/dialog/MPDialog.js +2 -1
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/MPDivider.d.ts +1 -1
- package/dist/components/divider/MPDivider.js +2 -1
- package/dist/components/divider/index.d.ts +2 -2
- package/dist/components/divider/index.js +1 -1
- package/dist/components/drawer/MPDrawer.d.ts +1 -1
- package/dist/components/drawer/MPDrawer.js +2 -1
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/empty/MPEmpty.d.ts +1 -1
- package/dist/components/empty/MPEmpty.js +2 -1
- package/dist/components/empty/index.d.ts +2 -2
- package/dist/components/empty/index.js +1 -1
- package/dist/components/fieldset/MPFieldset.d.ts +52 -0
- package/dist/components/fieldset/MPFieldset.js +2 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.js +1 -0
- package/dist/components/file-picker/MPFilePicker.d.ts +5 -4
- package/dist/components/file-picker/MPFilePicker.js +2 -1
- package/dist/components/file-picker/index.d.ts +2 -2
- package/dist/components/file-picker/index.js +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.d.ts +1 -1
- package/dist/components/floating-action-button/MPFloatingActionButton.js +2 -1
- package/dist/components/floating-action-button/index.d.ts +2 -2
- package/dist/components/floating-action-button/index.js +1 -1
- package/dist/components/footer/MPFooter.d.ts +94 -0
- package/dist/components/footer/MPFooter.js +2 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/footer/index.js +1 -0
- package/dist/components/form/MPForm.d.ts +73 -0
- package/dist/components/form/MPForm.js +2 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +1 -0
- package/dist/components/grid/MPGrid.d.ts +1 -1
- package/dist/components/grid/MPGrid.js +1 -0
- package/dist/components/grid/index.d.ts +2 -2
- package/dist/components/grid/index.js +1 -1
- package/dist/components/header/MPHeader.d.ts +122 -0
- package/dist/components/header/MPHeader.js +2 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/highlight/MPHighlight.d.ts +9 -2
- package/dist/components/highlight/MPHighlight.js +2 -1
- package/dist/components/highlight/index.d.ts +2 -2
- package/dist/components/highlight/index.js +1 -1
- package/dist/components/icon/MPIcon.d.ts +1 -1
- package/dist/components/icon/MPIcon.js +1 -0
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon-button/MPIconButton.d.ts +1 -1
- package/dist/components/icon-button/MPIconButton.js +2 -1
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/list/MPList.d.ts +1 -1
- package/dist/components/list/MPList.js +2 -1
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/index.js +1 -1
- package/dist/components/locale/MPLocaleProvider.d.ts +1 -1
- package/dist/components/locale/MPLocaleProvider.js +2 -1
- package/dist/components/locale/index.d.ts +2 -2
- package/dist/components/locale/index.js +1 -1
- package/dist/components/menu/MPMenu.d.ts +1 -1
- package/dist/components/menu/MPMenu.js +2 -1
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/menubar/MPMenubar.d.ts +82 -0
- package/dist/components/menubar/MPMenubar.js +2 -0
- package/dist/components/menubar/index.d.ts +2 -0
- package/dist/components/menubar/index.js +1 -0
- package/dist/components/navigation-menu/MPNavigationMenu.d.ts +151 -0
- package/dist/components/navigation-menu/MPNavigationMenu.js +2 -0
- package/dist/components/navigation-menu/index.d.ts +2 -0
- package/dist/components/navigation-menu/index.js +1 -0
- package/dist/components/number-field/MPNumberField.d.ts +13 -4
- package/dist/components/number-field/MPNumberField.js +2 -1
- package/dist/components/number-field/index.d.ts +2 -2
- package/dist/components/number-field/index.js +1 -1
- package/dist/components/otp-field/MPOtpField.d.ts +1 -1
- package/dist/components/otp-field/MPOtpField.js +2 -1
- package/dist/components/otp-field/index.d.ts +2 -2
- package/dist/components/otp-field/index.js +1 -1
- package/dist/components/overlay/MPOverlay.d.ts +9 -3
- package/dist/components/overlay/MPOverlay.js +2 -1
- package/dist/components/overlay/index.d.ts +2 -2
- package/dist/components/overlay/index.js +1 -1
- package/dist/components/page-layout/MPPageLayout.d.ts +145 -0
- package/dist/components/page-layout/MPPageLayout.js +2 -0
- package/dist/components/page-layout/index.d.ts +2 -0
- package/dist/components/page-layout/index.js +1 -0
- package/dist/components/pagination/MPPagination.d.ts +2 -2
- package/dist/components/pagination/MPPagination.js +2 -1
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/panes/MPPanes.d.ts +1 -1
- package/dist/components/panes/MPPanes.js +2 -1
- package/dist/components/panes/index.d.ts +2 -2
- package/dist/components/panes/index.js +1 -1
- package/dist/components/pill/MPPill.d.ts +1 -1
- package/dist/components/pill/MPPill.js +2 -1
- package/dist/components/pill/index.d.ts +2 -2
- package/dist/components/pill/index.js +1 -1
- package/dist/components/popover/MPPopover.d.ts +1 -1
- package/dist/components/popover/MPPopover.js +2 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/progress-box/MPProgressBox.d.ts +2 -2
- package/dist/components/progress-box/MPProgressBox.js +2 -1
- package/dist/components/progress-box/index.d.ts +2 -2
- package/dist/components/progress-box/index.js +1 -1
- package/dist/components/progress-circular/MPProgressCircular.d.ts +2 -2
- package/dist/components/progress-circular/MPProgressCircular.js +2 -1
- package/dist/components/progress-circular/index.d.ts +2 -2
- package/dist/components/progress-circular/index.js +1 -1
- package/dist/components/progress-linear/MPProgressLinear.d.ts +2 -2
- package/dist/components/progress-linear/MPProgressLinear.js +2 -1
- package/dist/components/progress-linear/index.d.ts +2 -2
- package/dist/components/progress-linear/index.js +1 -1
- package/dist/components/radio-group/MPRadioGroup.d.ts +1 -1
- package/dist/components/radio-group/MPRadioGroup.js +2 -1
- package/dist/components/radio-group/index.d.ts +2 -2
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/MPRating.d.ts +2 -2
- package/dist/components/rating/MPRating.js +2 -1
- package/dist/components/rating/index.d.ts +2 -2
- package/dist/components/rating/index.js +1 -1
- package/dist/components/segmented-button/MPSegmentedButton.d.ts +1 -1
- package/dist/components/segmented-button/MPSegmentedButton.js +2 -1
- package/dist/components/segmented-button/index.d.ts +2 -2
- package/dist/components/segmented-button/index.js +1 -1
- package/dist/components/select/MPSelect.d.ts +13 -2
- package/dist/components/select/MPSelect.js +2 -1
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/index.js +1 -1
- package/dist/components/shortcut/MPShortcut.d.ts +1 -1
- package/dist/components/shortcut/MPShortcut.js +2 -1
- package/dist/components/shortcut/index.d.ts +2 -2
- package/dist/components/shortcut/index.js +1 -1
- package/dist/components/sidebar/MPSidebar.d.ts +160 -0
- package/dist/components/sidebar/MPSidebar.js +2 -0
- package/dist/components/sidebar/MPSidebarTrigger.d.ts +45 -0
- package/dist/components/sidebar/MPSidebarTrigger.js +2 -0
- package/dist/components/sidebar/index.d.ts +4 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/skeleton/MPSkeleton.d.ts +1 -1
- package/dist/components/skeleton/MPSkeleton.js +2 -1
- package/dist/components/skeleton/index.d.ts +2 -2
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/slider/MPSlider.d.ts +1 -1
- package/dist/components/slider/MPSlider.js +2 -1
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +1 -1
- package/dist/components/snackbar/MPSnackbar.d.ts +1 -1
- package/dist/components/snackbar/MPSnackbar.js +2 -1
- package/dist/components/snackbar/index.d.ts +2 -2
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/spoiler/MPSpoiler.d.ts +1 -1
- package/dist/components/spoiler/MPSpoiler.js +2 -1
- package/dist/components/spoiler/index.d.ts +2 -2
- package/dist/components/spoiler/index.js +1 -1
- package/dist/components/switch/MPSwitch.d.ts +1 -1
- package/dist/components/switch/MPSwitch.js +2 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/table/MPTable.d.ts +28 -6
- package/dist/components/table/MPTable.js +2 -1
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +1 -1
- package/dist/components/tabs/MPTabs.d.ts +1 -1
- package/dist/components/tabs/MPTabs.js +2 -1
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/text-field/MPTextField.d.ts +15 -4
- package/dist/components/text-field/MPTextField.js +2 -1
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-link/MPTextLink.d.ts +8 -2
- package/dist/components/text-link/MPTextLink.js +2 -1
- package/dist/components/text-link/index.d.ts +2 -2
- package/dist/components/text-link/index.js +1 -1
- package/dist/components/time-picker/MPTimePicker.d.ts +7 -3
- package/dist/components/time-picker/MPTimePicker.js +2 -1
- package/dist/components/time-picker/index.d.ts +2 -2
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/timeline/MPTimeline.d.ts +1 -1
- package/dist/components/timeline/MPTimeline.js +2 -1
- package/dist/components/timeline/index.d.ts +2 -2
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/toggle/MPToggle.d.ts +72 -0
- package/dist/components/toggle/MPToggle.js +2 -0
- package/dist/components/toggle/index.d.ts +2 -0
- package/dist/components/toggle/index.js +1 -0
- package/dist/components/toggle-group/MPToggleGroup.d.ts +74 -0
- package/dist/components/toggle-group/MPToggleGroup.js +2 -0
- package/dist/components/toggle-group/index.d.ts +2 -0
- package/dist/components/toggle-group/index.js +1 -0
- package/dist/components/tooltip/MPTooltip.d.ts +1 -1
- package/dist/components/tooltip/MPTooltip.js +2 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/transfer/MPTransfer.d.ts +98 -0
- package/dist/components/transfer/MPTransfer.js +2 -0
- package/dist/components/transfer/index.d.ts +2 -0
- package/dist/components/transfer/index.js +1 -0
- package/dist/components/typography/MPTypography.d.ts +1 -1
- package/dist/components/typography/MPTypography.js +2 -1
- package/dist/components/typography/index.d.ts +2 -2
- package/dist/components/typography/index.js +1 -1
- package/dist/constants/glyphs.d.ts +72 -0
- package/dist/constants/glyphs.js +2 -0
- package/dist/constants/icons.d.ts +32 -60
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +91 -78
- package/dist/index.js +1 -1
- package/dist/internal/Calendar.d.ts +3 -3
- package/dist/internal/Calendar.js +2 -1
- package/dist/internal/FieldOutline.d.ts +1 -1
- package/dist/internal/FieldOutline.js +2 -1
- package/dist/internal/Picker.d.ts +2 -2
- package/dist/internal/Picker.js +2 -1
- package/dist/internal/StateLayer.js +1 -0
- package/dist/internal/SupportingText.d.ts +1 -1
- package/dist/internal/SupportingText.js +2 -1
- package/dist/internal/WidthSizer.js +1 -0
- package/dist/internal/accent.d.ts +1 -1
- package/dist/internal/animate.d.ts +1 -18
- package/dist/internal/animate.js +2 -1
- package/dist/internal/avatar-group.d.ts +22 -0
- package/dist/internal/avatar-group.js +2 -0
- package/dist/internal/button-group.d.ts +20 -1
- package/dist/internal/button-group.js +2 -1
- package/dist/internal/color.d.ts +0 -5
- package/dist/internal/color.js +1 -1
- package/dist/internal/date.d.ts +1 -1
- package/dist/internal/date.js +1 -1
- package/dist/internal/i18n.d.ts +245 -14
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/keys.d.ts +72 -0
- package/dist/internal/keys.js +2 -0
- package/dist/internal/length.d.ts +42 -0
- package/dist/internal/length.js +1 -0
- package/dist/internal/link.d.ts +44 -0
- package/dist/internal/link.js +1 -0
- package/dist/internal/locale.d.ts +27 -3
- package/dist/internal/locale.js +2 -1
- package/dist/internal/menu.d.ts +1 -1
- package/dist/internal/menu.js +1 -0
- package/dist/internal/messages/alert.d.ts +3 -0
- package/dist/internal/messages/alert.js +1 -0
- package/dist/internal/messages/breadcrumb.d.ts +3 -0
- package/dist/internal/messages/breadcrumb.js +1 -0
- package/dist/internal/messages/carousel.d.ts +3 -0
- package/dist/internal/messages/carousel.js +1 -0
- package/dist/internal/messages/chat.d.ts +3 -0
- package/dist/internal/messages/chat.js +1 -0
- package/dist/internal/messages/color-picker.d.ts +3 -0
- package/dist/internal/messages/color-picker.js +1 -0
- package/dist/internal/messages/combobox.d.ts +3 -0
- package/dist/internal/messages/combobox.js +1 -0
- package/dist/internal/messages/command.d.ts +3 -0
- package/dist/internal/messages/command.js +1 -0
- package/dist/internal/messages/common.d.ts +3 -0
- package/dist/internal/messages/common.js +1 -0
- package/dist/internal/messages/empty.d.ts +3 -0
- package/dist/internal/messages/empty.js +1 -0
- package/dist/internal/messages/file-picker.d.ts +3 -0
- package/dist/internal/messages/file-picker.js +1 -0
- package/dist/internal/messages/layout.d.ts +3 -0
- package/dist/internal/messages/layout.js +1 -0
- package/dist/internal/messages/number-field.d.ts +3 -0
- package/dist/internal/messages/number-field.js +1 -0
- package/dist/internal/messages/overlay.d.ts +3 -0
- package/dist/internal/messages/overlay.js +1 -0
- package/dist/internal/messages/pagination.d.ts +3 -0
- package/dist/internal/messages/pagination.js +1 -0
- package/dist/internal/messages/picker.d.ts +3 -0
- package/dist/internal/messages/picker.js +1 -0
- package/dist/internal/messages/rating.d.ts +3 -0
- package/dist/internal/messages/rating.js +1 -0
- package/dist/internal/messages/spoiler.d.ts +3 -0
- package/dist/internal/messages/spoiler.js +1 -0
- package/dist/internal/messages/table.d.ts +3 -0
- package/dist/internal/messages/table.js +1 -0
- package/dist/internal/messages/text-field.d.ts +3 -0
- package/dist/internal/messages/text-field.js +1 -0
- package/dist/internal/messages/text-link.d.ts +3 -0
- package/dist/internal/messages/text-link.js +1 -0
- package/dist/internal/messages/transfer.d.ts +3 -0
- package/dist/internal/messages/transfer.js +1 -0
- package/dist/internal/page-layout.d.ts +182 -0
- package/dist/internal/page-layout.js +2 -0
- package/dist/internal/progress.d.ts +1 -1
- package/dist/internal/scale.d.ts +18 -1
- package/dist/internal/scale.js +1 -1
- package/dist/internal/surface.d.ts +1 -1
- package/dist/internal/surface.js +1 -1
- package/dist/locales/ar.d.ts +1 -1
- package/dist/locales/ar.js +1 -1
- package/dist/locales/de.d.ts +1 -1
- package/dist/locales/de.js +1 -1
- package/dist/locales/es.d.ts +1 -1
- package/dist/locales/es.js +1 -1
- package/dist/locales/fr.d.ts +1 -1
- package/dist/locales/fr.js +1 -1
- package/dist/locales/hi.d.ts +1 -1
- package/dist/locales/hi.js +1 -1
- package/dist/locales/id.d.ts +1 -1
- package/dist/locales/id.js +1 -1
- package/dist/locales/index.d.ts +19 -19
- package/dist/locales/index.js +1 -1
- package/dist/locales/it.d.ts +1 -1
- package/dist/locales/it.js +1 -1
- package/dist/locales/ja.d.ts +1 -1
- package/dist/locales/ja.js +1 -1
- package/dist/locales/ko.d.ts +1 -1
- package/dist/locales/ko.js +1 -1
- package/dist/locales/nl.d.ts +1 -1
- package/dist/locales/nl.js +1 -1
- package/dist/locales/pl.d.ts +1 -1
- package/dist/locales/pl.js +1 -1
- package/dist/locales/pt.d.ts +1 -1
- package/dist/locales/pt.js +1 -1
- package/dist/locales/ru.d.ts +1 -1
- package/dist/locales/ru.js +1 -1
- package/dist/locales/th.d.ts +1 -1
- package/dist/locales/th.js +1 -1
- package/dist/locales/tr.d.ts +1 -1
- package/dist/locales/tr.js +1 -1
- package/dist/locales/vi.d.ts +1 -1
- package/dist/locales/vi.js +1 -1
- package/dist/locales/zh-hans.d.ts +1 -1
- package/dist/locales/zh-hans.js +1 -1
- package/dist/locales/zh-hant.d.ts +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/avatar-group.css +2 -0
- package/dist/styles/avatar.css +1 -1
- package/dist/styles/badge.css +1 -1
- 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-group.css +1 -1
- package/dist/styles/button.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/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 +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 +2 -0
- package/dist/styles/file-picker.css +1 -1
- package/dist/styles/floating-action-button.css +1 -1
- package/dist/styles/footer.css +2 -0
- package/dist/styles/form.css +2 -0
- package/dist/styles/header.css +2 -0
- package/dist/styles/highlight.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- 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 +2 -0
- package/dist/styles/navigation-menu.css +2 -0
- 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 +2 -0
- package/dist/styles/pagination.css +1 -1
- package/dist/styles/panes.css +1 -1
- package/dist/styles/pill.css +1 -1
- package/dist/styles/popover.css +1 -1
- 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/segmented-button.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/sidebar.css +2 -0
- package/dist/styles/skeleton.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/spoiler.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.css +1 -1
- package/dist/styles/toggle-group.css +2 -0
- package/dist/styles/toggle.css +2 -0
- package/dist/styles/transfer.css +2 -0
- package/dist/styles.css +1 -1
- package/package.json +12 -10
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Checkbox as t}from"@base-ui/react/checkbox";import{Field as n}from"@base-ui/react/field";import{MPIcon as o}from"../icon/MPIcon.js";import{CheckIcon as i,RemoveIcon as s}from"../../constants/icons.js";import{accentSlots as c}from"../../internal/accent.js";import{MPStateLayer as d}from"../../internal/StateLayer.js";import{MPSupportingText as l}from"../../internal/SupportingText.js";import{PROSE_TEXT as m,hasContent as p}from"../../internal/scale.js";const h={xs:{box:"size-3.5",halo:"size-8",glyph:12},sm:{box:"size-4",halo:"size-9",glyph:14},md:{box:"size-[18px]",halo:"size-10",glyph:16},lg:{box:"size-5",halo:"size-11",glyph:18},xl:{box:"size-[22px]",halo:"size-12",glyph:20}};export const MPCheckbox=/*@__PURE__*/r.forwardRef(function({checked:u,defaultChecked:f,onCheckedChange:b,indeterminate:x=!1,label:g,description:y,errorMessage:k,size:j="md",color:z="primary",required:_=!1,disabled:v=!1,readOnly:C=!1,name:N,value:M,id:I},R){const q=p(k),w=q?"error":z,L=h[j],O=r.useId(),P=I??O;return e(n.Root,{className:"mp-checkbox inline-block align-top",disabled:v,invalid:q,"data-mp-size":j,style:c(w),children:a("div",{className:["flex items-start gap-3",m[j]].join(" "),children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:a(t.Root,{ref:R,id:P,name:N,value:M,checked:u,defaultChecked:f,indeterminate:x,required:_,disabled:v,readOnly:C,onCheckedChange:e=>b?.(e),className:["mp-checkbox__tick group relative inline-flex shrink-0 items-center","box-border justify-center border-2 p-0","rounded-[calc(var(--mp-sys-shape-corner-extra-small)/2)]","appearance-none bg-transparent font-[inherit] outline-none","transition-[background-color,border-color]","duration-(--mp-sys-motion-duration-short4)",L.box,v?["border-mp-on-surface/38 cursor-default","data-checked:bg-mp-on-surface/38 data-checked:border-transparent","data-indeterminate:bg-mp-on-surface/38 data-indeterminate:border-transparent"].join(" "):[C?"cursor-default":"cursor-pointer",q?"border-mp-error":"border-mp-on-surface-variant","data-checked:border-transparent data-checked:bg-(--_mp-accent)","data-checked:text-(--_mp-on-accent)","data-indeterminate:border-transparent data-indeterminate:bg-(--_mp-accent)","data-indeterminate:text-(--_mp-on-accent)"].join(" ")].join(" "),children:[v?null:e(d,{layer:["top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",L.halo,"bg-mp-on-surface","group-data-checked:bg-(--_mp-accent)","group-data-indeterminate:bg-(--_mp-accent)"].join(" ")}),e(t.Indicator,{className:["flex items-center justify-center","transition-[opacity,scale] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:scale-60 data-starting-style:opacity-0","data-ending-style:scale-60 data-ending-style:opacity-0"].join(" "),children:e(o,{icon:x?s:i,size:L.glyph,strokeWidth:3})})]})}),p(g)||p(y)||q?a("span",{className:"flex min-w-0 flex-col gap-0.5",children:[p(g)?a(n.Label,{htmlFor:P,className:["leading-[1.4]",v?"text-mp-on-surface/38 cursor-default":C?"text-mp-on-surface":"text-mp-on-surface cursor-pointer"].join(" "),children:[g,_?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,e(l,{description:y,errorMessage:k})]}):null]})})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPCheckbox } from './MPCheckbox';
|
|
2
|
-
export type { MPCheckboxProps } from './MPCheckbox';
|
|
1
|
+
export { MPCheckbox } from './MPCheckbox.js';
|
|
2
|
+
export type { MPCheckboxProps } from './MPCheckbox.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPCheckbox}from"./MPCheckbox";
|
|
1
|
+
export{MPCheckbox}from"./MPCheckbox.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPColor, MPSize, MPVariant } from '../../types';
|
|
2
|
+
import type { MPColor, MPSize, MPVariant } from '../../types.js';
|
|
3
3
|
export interface MPChipProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
4
4
|
/**
|
|
5
5
|
* How much surface the chip paints.
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as o from"react";import{MPIcon as a}from"../icon/MPIcon.js";import{CloseIcon as r}from"../../constants/icons.js";import{accentSlots as i}from"../../internal/accent.js";import{useMPLocale as s,useMPMessages as l}from"../../internal/locale.js";import{COMMON as c}from"../../internal/messages/common.js";import{hasContent as m}from"../../internal/scale.js";import{MPStateLayer as p}from"../../internal/StateLayer.js";const d={xs:"h-6",sm:"h-7",md:"h-8",lg:"h-10",xl:"h-12"},u={xs:"text-mp-label-medium",sm:"text-mp-label-medium",md:"text-mp-label-large",lg:"text-mp-label-large",xl:"text-mp-title-medium"},f={xs:"px-2",sm:"px-3",md:"px-4",lg:"px-5",xl:"px-6"},x={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-2",xl:"gap-2.5"},b={xs:"rounded-mp-xs",sm:"rounded-mp-sm",md:"rounded-mp-sm",lg:"rounded-mp-sm",xl:"rounded-mp-md"},g={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-mp-surface-container-low text-mp-on-surface-variant",outlined:"border-mp-outline text-mp-on-surface-variant border bg-transparent",text:"text-mp-on-surface-variant bg-transparent"},h={filled:"bg-(--_mp-accent) text-(--_mp-on-accent)",tonal:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",elevated:"shadow-mp-1 bg-(--_mp-accent-container) text-(--_mp-on-accent-container)",outlined:"border-mp-outline bg-(--_mp-accent-container) text-(--_mp-on-accent-container) border",text:"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)"},v={filled:"bg-mp-on-surface/12 text-mp-on-surface/38",tonal:"bg-mp-on-surface/12 text-mp-on-surface/38",elevated:"bg-mp-on-surface/12 text-mp-on-surface/38 shadow-none",outlined:"border-mp-on-surface/12 text-mp-on-surface/38 border bg-transparent",text:"bg-transparent text-mp-on-surface/38"},y=/*@__PURE__*/["ms-0.5 -me-1 inline-flex shrink-0 cursor-pointer items-center justify-center","rounded-mp-full size-[1.35em] opacity-70","transition-opacity duration-(--mp-sys-motion-duration-short4)","hover:opacity-100 focus-visible:opacity-100","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:cursor-default disabled:opacity-38"].join(" "),_=/*@__PURE__*/["group relative flex min-w-0 flex-1 cursor-pointer items-center justify-center","self-stretch rounded-[inherit] font-[inherit] text-[inherit]","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(" ");export const MPChip=/*@__PURE__*/o.forwardRef(function({variant:o="outlined",size:j="md",color:w="primary",startIcon:k,endIcon:N,count:z,onDelete:C,deleteLabel:I,locale:$,selected:B,disabled:L=!1,className:M,style:P,children:D,onClick:F,...R},S){const q=s($),A=l(c,q),E=Boolean(F)&&!L,G=["mp-chip relative inline-flex max-w-full shrink-0 items-center","box-border overflow-hidden align-middle leading-none whitespace-nowrap select-none","transition-[background-color,border-color,box-shadow,color]","duration-(--mp-sys-motion-duration-short4)",d[j],u[j],x[j],b[j],L?v[o]:B?h[o]:g[o],E?"ps-0":f[j],C?"pe-2":E?"pe-0":"",M??""].filter(Boolean).join(" "),H=n(t,{children:[k,m(D)?e("span",{className:"min-w-0 truncate",children:D}):null,N,m(z)?e("span",{className:["rounded-mp-full ms-0.5 inline-flex shrink-0 items-center justify-center px-1.5 py-px","text-[0.85em] leading-none font-medium tabular-nums","filled"===o?"bg-(--_mp-on-accent)/20 text-(--_mp-on-accent)":"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)"].join(" "),children:z}):null]});return n("span",{ref:S,"data-mp-size":j,"data-mp-variant":o,"data-selected":B||void 0,className:G,style:{...i(w),...P},"aria-disabled":!(!L||E)||void 0,...R,children:[E?n("button",{type:"button","aria-pressed":B,className:`${_} ${x[j]} ${f[j]}`,onClick:F,children:[e(p,{}),H]}):H,C?e("button",{type:"button","aria-label":I??A.remove,disabled:L,className:y,onClick:C,children:e(a,{icon:r,size:"1em"})}):null]})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPChip } from './MPChip';
|
|
2
|
-
export type { MPChipProps } from './MPChip';
|
|
1
|
+
export { MPChip } from './MPChip.js';
|
|
2
|
+
export type { MPChipProps } from './MPChip.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPChip}from"./MPChip";
|
|
1
|
+
export{MPChip}from"./MPChip.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPSize, MPVariant } from '../../types';
|
|
2
|
+
import type { MPSize, MPVariant } from '../../types.js';
|
|
3
3
|
export interface MPCollapsibleProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'title' | 'onChange'> {
|
|
4
4
|
/** Whether the panel is showing. Use with `onOpenChange` for a controlled one. */
|
|
5
5
|
open?: boolean;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{Collapsible as a}from"@base-ui/react/collapsible";import{MPIcon as i}from"../icon/MPIcon.js";import{ChevronDownIcon as r}from"../../constants/icons.js";import{MPStateLayer as o}from"../../internal/StateLayer.js";import{CONTROL_GAP as s,CONTROL_ICON as l,hasContent as c,META_TEXT as d,PROSE_TEXT as m,SHEET_PAD_X as p,SHEET_PAD_Y as u,SHEET_TITLE as f}from"../../internal/scale.js";import{CONTAINER_SURFACE as h}from"../../internal/surface.js";const x=/*@__PURE__*/["h-(--collapsible-panel-height) overflow-hidden","transition-[height] duration-(--mp-sys-motion-duration-short4) ease-mp-standard","motion-reduce:transition-none","data-starting-style:h-0 data-ending-style:h-0"].join(" "),b={xs:"pb-2.5",sm:"pb-3",md:"pb-4",lg:"pb-5",xl:"pb-6"};export const MPCollapsible=/*@__PURE__*/t.forwardRef(function({open:t,defaultOpen:g=!1,onOpenChange:v,title:j,subtitle:N,startIcon:w,action:y,trigger:k,indicator:M=!0,disabled:O=!1,padded:z=!0,variant:C="outlined",size:P="md",hiddenUntilFound:$=!1,keepMounted:B=!1,className:F,children:I,...R},T){const U=p[P],L=u[P];return n(a.Root,{ref:T,open:t,defaultOpen:g,onOpenChange:e=>v?.(e),disabled:O,"data-mp-size":P,"data-mp-variant":C,className:["mp-collapsible rounded-mp-md flex w-full flex-col overflow-hidden",h[C],"text-mp-on-surface",F??""].filter(Boolean).join(" "),...R,children:[k?e(a.Trigger,{render:k}):n("div",{className:"flex w-full items-center",children:[n(a.Trigger,{className:["group relative flex min-w-0 flex-1 cursor-pointer items-center text-start","appearance-none border-0 bg-transparent font-[inherit] text-inherit",U,L,s[P],"outline-mp-secondary focus-visible:outline-2 focus-visible:-outline-offset-2","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),children:[e(o,{}),c(w)?e("span",{className:"text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center",children:w}):null,n("span",{className:"flex min-w-0 flex-1 flex-col",children:[c(j)?e("span",{className:`truncate ${f[P]}`,children:j}):null,c(N)?e("span",{className:`text-mp-on-surface-variant truncate ${d}`,children:N}):null]}),M?e("span",{className:["text-mp-on-surface-variant flex h-[1lh] shrink-0 items-center","transition-[rotate] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard motion-reduce:transition-none","group-data-panel-open:rotate-180"].join(" "),children:e(i,{icon:r,size:l[P]})}):null]}),c(y)?e("span",{className:`flex shrink-0 items-center ${U}`,children:y}):null]}),e(a.Panel,{hiddenUntilFound:$,keepMounted:B,className:x,children:e("div",{className:["min-w-0",m[P],"text-mp-on-surface-variant",z?U:"",z?k?L:b[P]:""].filter(Boolean).join(" "),children:I})})]})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPCollapsible } from './MPCollapsible';
|
|
2
|
-
export type { MPCollapsibleProps } from './MPCollapsible';
|
|
1
|
+
export { MPCollapsible } from './MPCollapsible.js';
|
|
2
|
+
export type { MPCollapsibleProps } from './MPCollapsible.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPCollapsible}from"./MPCollapsible";
|
|
1
|
+
export{MPCollapsible}from"./MPCollapsible.js";
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** The grid of ready-made colours. */
|
|
15
|
-
swatches: string;
|
|
16
|
-
/** The × that empties the control. */
|
|
17
|
-
clear: string;
|
|
18
|
-
/** What the trigger reads before anything has been chosen. */
|
|
19
|
-
empty: string;
|
|
20
|
-
}
|
|
2
|
+
import type { MPMessages } from '../../internal/i18n.js';
|
|
3
|
+
import type { MPColorFormat } from '../../internal/color.js';
|
|
4
|
+
import type { MPStyleProps } from '../../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The names for the parts of the picker that have no text on them.
|
|
7
|
+
*
|
|
8
|
+
* A namespace in the shared table rather than a set of defaults kept here, which
|
|
9
|
+
* is the rule every other component that invents a word follows: `locale` gets a
|
|
10
|
+
* translation, `MPLocaleProvider` gets one for the whole application at once,
|
|
11
|
+
* and `labels` gets whatever else. See `internal/i18n.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export type MPColorPickerLabels = MPMessages['colorPicker'];
|
|
21
14
|
export interface MPColorPickerProps extends MPStyleProps {
|
|
22
15
|
/** The colour, as a CSS string. Pass it to drive the picker yourself. */
|
|
23
16
|
value?: string;
|
|
@@ -93,6 +86,16 @@ export interface MPColorPickerProps extends MPStyleProps {
|
|
|
93
86
|
defaultOpen?: boolean;
|
|
94
87
|
onOpenChange?: (open: boolean) => void;
|
|
95
88
|
/** Overrides for the accessible names, one at a time. */
|
|
89
|
+
/**
|
|
90
|
+
* Which language the picker's own names are written in — the rails, the
|
|
91
|
+
* square, the × and the word the trigger shows before a colour has been
|
|
92
|
+
* chosen. Falls back to the nearest `MPLocaleProvider`, then to English.
|
|
93
|
+
*/
|
|
94
|
+
locale?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Overrides for the words themselves. They win over the translation, and
|
|
97
|
+
* anything not named stays translated.
|
|
98
|
+
*/
|
|
96
99
|
labels?: Partial<MPColorPickerLabels>;
|
|
97
100
|
/**
|
|
98
101
|
* The id put on the trigger and pointed at by the label. Generated when it is
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Field as n}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{MPIcon as l}from"../icon/MPIcon.js";import{CheckIcon as o,CloseIcon as i}from"../../constants/icons.js";import{MPFieldLabel as s,MPFieldOutline as u,useFloatingLabel as c}from"../../internal/FieldOutline.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{COLOR_PICKER as h}from"../../internal/messages/color-picker.js";import{MPStateLayer as m}from"../../internal/StateLayer.js";import{MPSupportingText as f}from"../../internal/SupportingText.js";import{CONTROL_ICON as g,META_TEXT as v,PROSE_TEXT as x,STACK_GAP as b,hasContent as y}from"../../internal/scale.js";import{FADE as w,PORTAL_LAYER as N}from"../../internal/surface.js";import{CHECKER_BACKGROUND as j,DEFAULT_SWATCHES as k,clamp as C,cssColor as _,formatColor as z,parseColor as P,readableInk as $}from"../../internal/color.js";const M={xs:"w-40",sm:"w-44",md:"w-52",lg:"w-60",xl:"w-72"},T={xs:"h-24",sm:"h-28",md:"h-32",lg:"h-40",xl:"h-48"},I={xs:"h-2.5",sm:"h-3",md:"h-3.5",lg:"h-4",xl:"h-5"},A={xs:"gap-2",sm:"gap-2.5",md:"gap-3",lg:"gap-3.5",xl:"gap-4"},R={xs:12,sm:14,md:16,lg:18,xl:20},O={xs:{padding:"px-2",height:"h-8"},sm:{padding:"px-3",height:"h-10"},md:{padding:"px-4",height:"h-14"},lg:{padding:"px-4",height:"h-16"},xl:{padding:"px-5",height:"h-18"}},B="border-mp-outline-variant relative overflow-hidden border",D=/*@__PURE__*/["pointer-events-none absolute rounded-full border-2 border-white","[box-shadow:0_0_0_1px_rgb(0_0_0/0.35),0_1px_3px_rgb(0_0_0/0.4)]"].join(" ");function L(e,a,r){return{x:0===e.width?0:C((a-e.left)/e.width,0,1),y:0===e.height?0:C((r-e.top)/e.height,0,1)}}function S(e){const a=e.shiftKey?10:1;switch(e.key){case"ArrowLeft":return{x:-a,y:0};case"ArrowRight":return{x:a,y:0};case"ArrowUp":return{x:0,y:a};case"ArrowDown":return{x:0,y:-a};default:return null}}function q({hsv:n,alphaValue:t,onChange:i,text:s,onTextChange:u,withAlpha:c,swatches:d,editable:p,size:h,inert:m,labels:f}){const g=R[h],x=-g/2,b=_({h:n.h,s:100,v:100}),y=_(n),w=r.useRef(null),N=r.useRef(null),k=r.useRef(0);r.useEffect(()=>()=>{k.current&&cancelAnimationFrame(k.current)},[]);const O=e=>({onPointerDown:a=>{if(m)return;const r=a.currentTarget.getBoundingClientRect();w.current=r,a.currentTarget.setPointerCapture(a.pointerId),e(L(r,a.clientX,a.clientY))},onPointerMove:a=>{const r=w.current;var n;!m&&r&&a.currentTarget.hasPointerCapture(a.pointerId)&&(n=L(r,a.clientX,a.clientY),N.current=n,k.current||(k.current=requestAnimationFrame(()=>{k.current=0;const a=N.current;N.current=null,a&&e(a)})))},onPointerUp:()=>{w.current=null},onPointerCancel:()=>{w.current=null}}),q=(e,a,r,n)=>({role:"slider",tabIndex:m?-1:0,"aria-label":e,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":Math.round(a),"aria-orientation":"horizontal","aria-disabled":m||void 0,onKeyDown:e=>{const a=S(e);!m&&a&&0!==a.x&&(e.preventDefault(),n(a.x))}}),F=/*@__PURE__*/["outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-2","focus-visible:outline-solid outline-none"].join(" "),V=r.useMemo(()=>d?d.map(e=>{const a=P(e);return{swatch:e,parsed:a,hex:null===a?null:z(a.hsv,a.alpha,"hex")}}):[],[d]),K=z(n,t,"hex");return a("div",{className:`mp-color-picker__panel flex flex-col ${M[h]} ${A[h]}`,children:[e("div",{...O(({x:e,y:a})=>i({hsv:{h:n.h,s:100*e,v:100*(1-a)},alpha:t})),role:"slider",tabIndex:m?-1:0,"aria-label":f.area,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n.s),"aria-valuetext":`${Math.round(n.s)}%, ${Math.round(n.v)}%`,"aria-disabled":m||void 0,onKeyDown:e=>{const a=S(e);!m&&a&&(e.preventDefault(),i({hsv:{h:n.h,s:C(n.s+a.x,0,100),v:C(n.v+a.y,0,100)},alpha:t}))},className:[B,"rounded-mp-sm",T[h],F,m?"cursor-default":"cursor-crosshair touch-none"].join(" "),style:{backgroundColor:b,backgroundImage:"linear-gradient(to top, #000000, rgb(0 0 0 / 0)), linear-gradient(to right, #ffffff, rgb(255 255 255 / 0))"},children:e("span",{className:D,style:{width:g,height:g,left:`${n.s}%`,top:100-n.v+"%",marginLeft:x,marginTop:x,backgroundColor:y}})}),e("div",{...O(({x:e})=>i({hsv:{...n,h:360*e},alpha:t})),...q(f.hue,n.h,360,e=>i({hsv:{...n,h:(n.h+2*e+360)%360},alpha:t})),className:[B,"rounded-mp-full",I[h],F,m?"cursor-default":"cursor-pointer touch-none"].join(" "),style:{backgroundImage:"linear-gradient(to right, #ff0000 0%, #ffff00 16.66%, #00ff00 33.33%, #00ffff 50%, #0000ff 66.66%, #ff00ff 83.33%, #ff0000 100%)"},children:e("span",{className:D,style:{width:g,height:g,left:n.h/360*100+"%",top:"50%",marginLeft:x,marginTop:x,backgroundColor:b}})}),c?a("div",{...O(({x:e})=>i({hsv:n,alpha:e})),...q(f.alpha,100*t,100,e=>i({hsv:n,alpha:C(t+e/100,0,1)})),className:[B,"rounded-mp-full",I[h],F,m?"cursor-default":"cursor-pointer touch-none"].join(" "),style:j,children:[e("span",{"aria-hidden":"true",className:"absolute inset-0",style:{backgroundImage:`linear-gradient(to right, ${_(n,0)}, ${y})`}}),e("span",{className:D,style:{width:g,height:g,left:100*t+"%",top:"50%",marginLeft:x,marginTop:x,backgroundColor:_(n,t)}})]}):null,p?a("div",{className:`flex items-center ${A[h]}`,children:[e("span",{"aria-hidden":"true",className:"border-mp-outline-variant shrink-0 rounded-full border",style:{width:g+8,height:g+8,...j},children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:_(n,t)}})}),e("input",{type:"text",value:s,readOnly:m,spellCheck:!1,autoComplete:"off","aria-label":f.value,onChange:e=>u(e.target.value),className:["rounded-mp-xs border-mp-outline text-mp-on-surface min-w-0 flex-1 border","bg-transparent px-2 py-1 font-mono lowercase",v,"focus-visible:border-mp-primary outline-none"].join(" ")})]}):null,V.length>0?e("div",{role:"group","aria-label":f.swatches,className:"grid grid-cols-8 gap-1",children:V.map(({swatch:a,parsed:r,hex:n},t)=>{const s=null!==r&&n===K;return e("button",{type:"button",disabled:m,"aria-label":a,"aria-pressed":s,onClick:()=>{r&&i({hsv:r.hsv,alpha:r.alpha})},className:["border-mp-outline-variant flex aspect-square items-center justify-center","rounded-full border","transition-[box-shadow] duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",F,m?"cursor-default":"hover:shadow-mp-1 cursor-pointer"].join(" "),style:{backgroundColor:a},children:e("span",{"aria-hidden":"true",className:["transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard",s?"opacity-100":"opacity-0"].join(" "),style:r?{color:$(r.hsv)}:void 0,children:e(l,{icon:o,size:12})})},`${t}:${a}`)})}):null]})}const F={h:202,s:100,v:61};export const MPColorPicker=/*@__PURE__*/r.forwardRef(function({value:o,defaultValue:C="#00639b",onValueChange:$,format:M="hex",alpha:T=!1,swatches:I=k,inline:A=!1,editable:R=!0,label:B,floatingLabel:D=!0,description:L,errorMessage:S,required:V=!1,disabled:K=!1,readOnly:E=!1,clearable:U=!1,name:X,open:Y,defaultOpen:W=!1,onOpenChange:G,locale:H,labels:J,size:Q="md",fullWidth:Z=!1,id:ee,className:ae,style:re},ne){const te=d(H),le=p(h,te,J),oe=y(S),ie=O[Q],se=r.useId(),ue=ee??se,[ce,de]=r.useState(C),pe=o??ce,[he,me]=r.useState(W),fe=Y??he,[ge,ve]=r.useState(()=>P(pe)??{hsv:F,alpha:1}),[xe,be]=r.useState(()=>pe),ye=z(ge.hsv,T?ge.alpha:1,M),we=""===pe;r.useEffect(()=>{const e=P(pe);e?z(e.hsv,T?e.alpha:1,M)!==ye&&(be(pe),ve(e)):be(pe)},[pe,ye,T,M]);const Ne=K||E,je=U&&!Ne&&!we,{shrunk:ke,focusProps:Ce}=c({floating:D&&y(B),filled:!we,pinned:fe}),_e=(e,a)=>{ve(e);const r=z(e.hsv,T?e.alpha:1,M);be(a??r),void 0===o&&de(r),$?.(r)},ze=e(q,{hsv:ge.hsv,alphaValue:ge.alpha,onChange:_e,text:xe,onTextChange:e=>{be(e);const a=P(e);a&&_e(a,e)},withAlpha:T,swatches:I,editable:R,size:Q,inert:Ne,labels:le}),Pe=e("span",{"aria-hidden":"true",className:"border-mp-outline-variant block size-5 shrink-0 rounded-full border",style:j,children:e("span",{className:"block size-full rounded-full",style:{backgroundColor:we?"transparent":_(ge.hsv,T?ge.alpha:1)}})}),$e=X?e("input",{type:"hidden",name:X,value:we?"":ye}):null;return A?a("div",{ref:ne,"data-mp-size":Q,className:["mp-color-picker flex flex-col",b[Q],ae??""].filter(Boolean).join(" "),style:re,children:[y(B)?a("span",{className:[v,K?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:[B,V?e("span",{"aria-hidden":"true",children:" *"}):null]}):null,ze,y(S)?e("span",{className:`${v} text-mp-error`,children:S}):y(L)?e("span",{className:`${v} text-mp-on-surface-variant`,children:L}):null,$e]}):a(n.Root,{ref:ne,disabled:K,invalid:oe,"data-mp-size":Q,className:["mp-color-picker group flex-col align-top",Z?"flex w-full":"inline-flex w-fit",ae??""].filter(Boolean).join(" "),style:re,...Ce,children:[a(t.Root,{open:fe,onOpenChange:e=>{void 0===Y&&me(e),G?.(e)},children:[a("div",{className:"relative w-full",children:[a(t.Trigger,{id:ue,disabled:K,nativeButton:!0,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",ie.padding,je?"pe-10":"",ie.height,x[Q],K?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(E?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[we&&!ke?null:Pe,e("span",{className:["min-w-0 flex-1 truncate text-start",we?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:we?ke?le.empty:null:ye})]}),je?a("button",{type:"button","aria-label":le.clear,onClick:()=>{void 0===o&&de(""),be(""),$?.("")},className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(m,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(l,{icon:i,size:g[Q]})]}):null,e(u,{label:B,required:V,notched:ke}),y(B)?e(s,{size:Q,label:B,required:V,htmlFor:ue,shrunk:ke}):null]}),e(t.Portal,{children:e(t.Positioner,{className:N,sideOffset:4,align:"start",children:e(t.Popup,{className:["mp-color-picker__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container","text-mp-on-surface p-3 outline-none",x[Q],w].join(" "),children:ze})})})]}),e(f,{description:L,errorMessage:S,className:ie.padding}),$e]})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPColorPicker } from './MPColorPicker';
|
|
2
|
-
export type { MPColorPickerLabels, MPColorPickerProps } from './MPColorPicker';
|
|
1
|
+
export { MPColorPicker } from './MPColorPicker.js';
|
|
2
|
+
export type { MPColorPickerLabels, MPColorPickerProps } from './MPColorPicker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPColorPicker}from"./MPColorPicker";
|
|
1
|
+
export{MPColorPicker}from"./MPColorPicker.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPStyleProps } from '../../types';
|
|
2
|
+
import type { MPStyleProps } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* What a combobox's value may be — the same two types `MPSelect` submits, and for
|
|
5
5
|
* the same reason: a form control's value is what a form sends, and every escape
|
|
@@ -28,7 +28,21 @@ type Selection<Multiple extends boolean | undefined> = Multiple extends true ? M
|
|
|
28
28
|
export interface MPComboboxProps<Multiple extends boolean | undefined = false> extends MPStyleProps {
|
|
29
29
|
/**
|
|
30
30
|
* The options, as data — the same shape `MPSelect` takes, and for the same
|
|
31
|
-
* reason: what a caller has is almost always an array already.
|
|
31
|
+
* reason: what a caller has is almost always an array already. *
|
|
32
|
+
* ## How long a list this holds
|
|
33
|
+
*
|
|
34
|
+
* Every row is rendered, and there is no windowing. That is the right default
|
|
35
|
+
* — windowing costs a measured container, a scroll listener and a row height
|
|
36
|
+
* the component would have to decide for the caller — and it has a ceiling: a
|
|
37
|
+
* few hundred rows is nothing, a few thousand is a visible pause when the list
|
|
38
|
+
* opens, and past that the answer is a narrower list rather than a faster one.
|
|
39
|
+
*
|
|
40
|
+
* A list somebody has to scroll ten thousand rows of is a list that wanted a
|
|
41
|
+
* filter. Where it genuinely is that long, window it yourself and pass the
|
|
42
|
+
* slice.
|
|
43
|
+
*
|
|
44
|
+
* `limit` is the lighter tool here: it caps what the *popup* draws while
|
|
45
|
+
* leaving the filter to search everything.
|
|
32
46
|
*/
|
|
33
47
|
items: readonly MPComboboxOption[];
|
|
34
48
|
/**
|
|
@@ -54,7 +68,11 @@ export interface MPComboboxProps<Multiple extends boolean | undefined = false> e
|
|
|
54
68
|
* @default true
|
|
55
69
|
*/
|
|
56
70
|
allowCustom?: boolean;
|
|
57
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* What that row says. Receives the trimmed query.
|
|
73
|
+
*
|
|
74
|
+
* Left out, it is the wording in `locale` with the query set into it.
|
|
75
|
+
*/
|
|
58
76
|
customLabel?: (query: string) => React.ReactNode;
|
|
59
77
|
/**
|
|
60
78
|
* Shows a × that empties the field. Off by default — a field that can be
|
|
@@ -63,8 +81,8 @@ export interface MPComboboxProps<Multiple extends boolean | undefined = false> e
|
|
|
63
81
|
*/
|
|
64
82
|
clearable?: boolean;
|
|
65
83
|
/**
|
|
66
|
-
* Shown in the popup when nothing matches and no value may be added.
|
|
67
|
-
*
|
|
84
|
+
* Shown in the popup when nothing matches and no value may be added. Defaults
|
|
85
|
+
* to the wording in `locale`.
|
|
68
86
|
*/
|
|
69
87
|
emptyMessage?: React.ReactNode;
|
|
70
88
|
/** The most rows the list will show at once. `-1` is all of them. @default -1 */
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Combobox as i}from"@base-ui/react/combobox";import{Field as n}from"@base-ui/react/field";import{MPChip as t}from"../chip/MPChip.js";import{MPIcon as o}from"../icon/MPIcon.js";import{AddIcon as r,CheckIcon as s,ChevronDownIcon as m,CloseIcon as c}from"../../constants/icons.js";import{MPFieldLabel as d,MPFieldOutline as p,useFloatingLabel as u}from"../../internal/FieldOutline.js";import{fillMessage as h}from"../../internal/i18n.js";import{useMPLocale as f,useMPMessages as g}from"../../internal/locale.js";import{COMBOBOX as b}from"../../internal/messages/combobox.js";import{COMMON as x}from"../../internal/messages/common.js";import{MPStateLayer as v}from"../../internal/StateLayer.js";import{MPSupportingText as y}from"../../internal/SupportingText.js";import{CONTROL_ICON as j,PROSE_TEXT as w,hasContent as N}from"../../internal/scale.js";import{FADE as C,PORTAL_LAYER as L}from"../../internal/surface.js";const S={xs:{padding:"ps-2 pe-1",height:"h-8"},sm:{padding:"ps-3 pe-1.5",height:"h-10"},md:{padding:"ps-4 pe-2",height:"h-14"},lg:{padding:"ps-4 pe-2",height:"h-16"},xl:{padding:"ps-5 pe-2.5",height:"h-18"}},I={xs:"min-h-8 py-1",sm:"min-h-10 py-1.5",md:"min-h-14 py-3",lg:"min-h-16 py-3",xl:"min-h-18 py-3"},z={xs:"xs",sm:"xs",md:"sm",lg:"md",xl:"md"};function M(e){return null==e?[]:Array.isArray(e)?e.slice():[e]}export function MPCombobox({items:O,multiple:V,value:k,defaultValue:P,onValueChange:$,onInputValueChange:q,allowCustom:T=!0,customLabel:A,clearable:R=!1,emptyMessage:_,limit:F,placeholder:E,label:B,floatingLabel:G=!0,description:H,errorMessage:W,startIcon:D,size:J="md",fullWidth:K=!1,required:Q=!1,disabled:U=!1,readOnly:X=!1,name:Y,open:Z,defaultOpen:ee,onOpenChange:ae,clearLabel:le,openLabel:ie,locale:ne,removeLabel:te,inputRef:oe,id:re,className:se,style:me}){const ce=f(ne),de=g(x,ce),pe=g(b,ce),ue=N(W),he=!0===V,fe=S[J],ge=l.useId(),be=re??ge,xe=l.useMemo(()=>O.map(e=>({value:e.value,label:e.label??String(e.value),disabled:e.disabled})),[O]),[ve,ye]=l.useState(()=>M(P)),je=void 0===k?ve:M(k),[we,Ne]=l.useState(""),{shrunk:Ce,focusProps:Le}=u({floating:G&&N(B),filled:je.length>0||""!==we,pinned:!!D}),Se=l.useMemo(()=>new Map(xe.map(e=>[e.value,e])),[xe]),Ie=l.useMemo(()=>{const e=new Set;for(const a of xe)e.add(a.label.toLocaleLowerCase()),e.add(String(a.value).toLocaleLowerCase());return e},[xe]),ze=l.useCallback(e=>Se.get(e)??{value:e,label:String(e),custom:!0},[Se]),Me=we.trim(),Oe=Me.toLocaleLowerCase(),Ve=""===Me||Ie.has(Oe)||je.some(e=>String(e).toLocaleLowerCase()===Oe),ke=!T||X||U||Ve?null:Me,Pe=l.useMemo(()=>null===ke?xe:[...xe,{value:ke,label:ke,custom:!0}],[xe,ke]),$e=he?je.map(ze):je.length>0?ze(je[0]):null;const qe=/*@__PURE__*/["min-w-0 flex-1 self-stretch bg-transparent font-[inherit] text-inherit outline-none","placeholder:text-mp-on-surface-variant",U?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface caret-mp-primary"].join(" "),Te=/*@__PURE__*/["group rounded-mp-full relative flex size-8 shrink-0 cursor-pointer items-center justify-center","text-mp-on-surface-variant","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none","disabled:text-mp-on-surface/38 disabled:cursor-default"].join(" "),Ae=a=>e(i.Input,{ref:oe,id:be,placeholder:Ce?E:void 0,className:he?`${qe} min-w-16 ${a?"ms-1.5":""}`:qe});return a(n.Root,{disabled:U,invalid:ue,"data-mp-size":J,className:["mp-combobox group flex-col align-top",K?"flex w-full":"inline-flex w-fit",se??""].filter(Boolean).join(" "),style:me,...Le,children:[a(i.Root,{name:Y,items:Pe,multiple:he,value:$e,onValueChange:e=>{!function(e){void 0===k&&ye(e),$?.(he?e:e[0]??null)}((null===e?[]:Array.isArray(e)?e:[e]).map(e=>e.value))},onInputValueChange:e=>{Ne(e),q?.(e)},open:Z,defaultOpen:ee,onOpenChange:e=>ae?.(e),autoHighlight:!0,itemToStringLabel:e=>e.label,itemToStringValue:e=>String(e.value),isItemEqualToValue:(e,a)=>e.value===a.value,limit:F,disabled:U,readOnly:X,required:Q,children:[a("div",{className:"relative w-full",children:[a(i.InputGroup,{className:["relative flex w-full items-center gap-2",fe.padding,he?I[J]:fe.height,w[J],U?"cursor-default":"cursor-text"].join(" "),children:[D?e("span",{className:["flex shrink-0 items-center",U?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:D}):null,he?e(i.Chips,{className:"flex min-w-0 flex-1 flex-wrap items-center gap-1",children:e(i.Value,{children:n=>a(l.Fragment,{children:[n.map((a,l)=>e(i.Chip,{render:e(t,{variant:ue?"outlined":"tonal",color:ue?"error":"primary",size:z[J],disabled:U,endIcon:X||U?null:e(i.ChipRemove,{"aria-label":te?te(a.label):h(de.removeNamed,{label:a.label}),className:"flex cursor-pointer items-center opacity-70 hover:opacity-100",children:e(o,{icon:c,size:16})})}),children:a.label},`${l}:${String(a.value)}`)),Ae(n.length>0)]})})}):Ae(!1),R&&!X?a(i.Clear,{"aria-label":le??de.clear,className:Te,children:[e(v,{}),e(o,{icon:c,size:j[J]})]}):null,a(i.Trigger,{"aria-label":ie??de.open,className:Te,children:[e(v,{}),e(i.Icon,{className:["relative flex items-center","transition-transform duration-(--mp-sys-motion-duration-short4)","data-popup-open:rotate-180"].join(" "),children:e(o,{icon:m,size:j[J]})})]})]}),e(p,{label:B,required:Q,notched:Ce}),N(B)?e(d,{size:J,label:B,required:Q,htmlFor:be,shrunk:Ce}):null]}),e(i.Portal,{children:e(i.Positioner,{className:L,sideOffset:4,children:a(i.Popup,{className:["mp-combobox__popup rounded-mp-xs shadow-mp-2 bg-mp-surface-container p-2","text-mp-on-surface w-[var(--anchor-width)] outline-none","max-h-[min(20rem,var(--available-height))] overflow-y-auto overscroll-contain",w[J],C].join(" "),children:[e(i.Empty,{className:"text-mp-on-surface-variant px-3 py-2 empty:hidden",children:_??pe.empty}),e(i.List,{children:(l,n)=>a(i.Item,{value:l,disabled:l.disabled,className:["mp-combobox__item group rounded-mp-xs relative flex cursor-pointer","items-center gap-3 py-2 ps-2 pe-3 select-none outline-none","transition-[background-color,color]","duration-(--mp-sys-motion-duration-short4)","data-selected:bg-mp-secondary-container","data-selected:text-mp-on-secondary-container","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default"].join(" "),children:[e(v,{className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),e("span",{className:"flex size-5 shrink-0 items-center justify-center",children:l.custom?e(o,{icon:r,size:18}):e(i.ItemIndicator,{children:e(o,{icon:s,size:18})})}),e("span",{className:"min-w-0 flex-1 truncate",children:l.custom?A?A(l.label):h(pe.add,{label:l.label}):l.label})]},`${n}:${l.custom?"custom:":""}${String(l.value)}`)})]})})})]}),e(y,{description:H,errorMessage:W,className:fe.padding})]})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPCombobox } from './MPCombobox';
|
|
2
|
-
export type { MPComboboxOption, MPComboboxProps, MPComboboxValue } from './MPCombobox';
|
|
1
|
+
export { MPCombobox } from './MPCombobox.js';
|
|
2
|
+
export type { MPComboboxOption, MPComboboxProps, MPComboboxValue } from './MPCombobox.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPCombobox}from"./MPCombobox";
|
|
1
|
+
export{MPCombobox}from"./MPCombobox.js";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { MPColor, MPSize } from '../../types.js';
|
|
3
|
+
/** One thing the palette can do. */
|
|
4
|
+
export interface MPCommand {
|
|
5
|
+
/** What identifies the command. */
|
|
6
|
+
value: string;
|
|
7
|
+
/** What the row says, and what the query is matched against. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** A second line under it — where the command goes, or what it changes. */
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
/** A glyph before the label. */
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The keystroke that does the same thing, set at the end of the row.
|
|
15
|
+
*
|
|
16
|
+
* Written the way [MPShortcut](../display/shortcut) writes them, so `Mod`
|
|
17
|
+
* resolves per platform. The palette **does not bind it** — the application
|
|
18
|
+
* does, and this is the label for the binding it already has.
|
|
19
|
+
*/
|
|
20
|
+
shortcut?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The heading this command sits under.
|
|
23
|
+
*
|
|
24
|
+
* Commands are drawn in the order they are given and a heading appears each
|
|
25
|
+
* time the group changes, so a group's commands have to be listed together.
|
|
26
|
+
*/
|
|
27
|
+
group?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Extra words the query is matched against but that are never drawn — the name
|
|
30
|
+
* somebody else's product gives the same command, an abbreviation, the word
|
|
31
|
+
* the reader would have searched for.
|
|
32
|
+
*/
|
|
33
|
+
keywords?: readonly string[];
|
|
34
|
+
/** In the list but not runnable. */
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
/** What running it does. */
|
|
37
|
+
onSelect?: () => void;
|
|
38
|
+
}
|
|
39
|
+
export interface MPCommandPaletteProps {
|
|
40
|
+
/** Everything the palette can do. */
|
|
41
|
+
items: readonly MPCommand[];
|
|
42
|
+
/** Whether the palette is open. Use with `onOpenChange` for a controlled one. */
|
|
43
|
+
open?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether it starts open, for an uncontrolled one.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
defaultOpen?: boolean;
|
|
49
|
+
onOpenChange?: (open: boolean) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Called when a command is run, after its own `onSelect`. The palette closes
|
|
52
|
+
* either way.
|
|
53
|
+
*/
|
|
54
|
+
onSelect?: (item: MPCommand) => void;
|
|
55
|
+
/**
|
|
56
|
+
* The keystroke that opens the palette, bound on the window.
|
|
57
|
+
*
|
|
58
|
+
* Written the way [MPShortcut](../display/shortcut) writes them, so `Mod` is
|
|
59
|
+
* Command on a Mac and Control everywhere else — the same vocabulary the rows
|
|
60
|
+
* *draw*, because a shortcut a component displays and one it binds have to be
|
|
61
|
+
* spelled the same way or the label is a claim nobody checked. `false` binds
|
|
62
|
+
* nothing.
|
|
63
|
+
* @default 'Mod+K'
|
|
64
|
+
*/
|
|
65
|
+
shortcut?: string | false;
|
|
66
|
+
/** How wide the sheet may get. A number in pixels, or any CSS length. */
|
|
67
|
+
width?: number | string;
|
|
68
|
+
/**
|
|
69
|
+
* How tall the list may get before it scrolls.
|
|
70
|
+
* @default 320
|
|
71
|
+
*/
|
|
72
|
+
maxHeight?: number | string;
|
|
73
|
+
/**
|
|
74
|
+
* The row height and type scale.
|
|
75
|
+
* @default 'md'
|
|
76
|
+
*/
|
|
77
|
+
size?: MPSize;
|
|
78
|
+
/**
|
|
79
|
+
* Which accent family the highlighted row and the caret read.
|
|
80
|
+
* @default 'primary'
|
|
81
|
+
*/
|
|
82
|
+
color?: MPColor;
|
|
83
|
+
/**
|
|
84
|
+
* Which language the placeholder, the empty line and the dialog's own name are
|
|
85
|
+
* written in. Falls back to the nearest `MPLocaleProvider`, then to English.
|
|
86
|
+
*/
|
|
87
|
+
locale?: string;
|
|
88
|
+
/** The placeholder in the field. Defaults to the wording in `locale`. */
|
|
89
|
+
placeholder?: string;
|
|
90
|
+
/** The line where the rows would be, when nothing matched. */
|
|
91
|
+
emptyMessage?: React.ReactNode;
|
|
92
|
+
/** The accessible name of the dialog, which has no visible title. */
|
|
93
|
+
label?: string;
|
|
94
|
+
className?: string;
|
|
95
|
+
style?: React.CSSProperties;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Everything an application can do, behind one field.
|
|
99
|
+
*
|
|
100
|
+
* The shape a keyboard-first product takes once it has more actions than a menu
|
|
101
|
+
* bar can hold: the reader types what they want instead of remembering where it
|
|
102
|
+
* was put.
|
|
103
|
+
*
|
|
104
|
+
* ## What it is not
|
|
105
|
+
*
|
|
106
|
+
* Not an [MPMenu](./menu). A menu is a short list in one place, and every row is
|
|
107
|
+
* visible before you go looking for it — that is the whole of what a menu is
|
|
108
|
+
* good at, and it is why a menu of sixty rows is not a menu.
|
|
109
|
+
*
|
|
110
|
+
* Not an [MPCombobox](./combobox) either, and this one is worth being precise
|
|
111
|
+
* about: what comes back from a combobox is a **value**, which the caller then
|
|
112
|
+
* does something with. What comes back from here is *something happening*. The
|
|
113
|
+
* row is the action, `onSelect` runs it, and the sheet closes because there is
|
|
114
|
+
* nothing left to decide.
|
|
115
|
+
*
|
|
116
|
+
* ## The surface is MD3's search view
|
|
117
|
+
*
|
|
118
|
+
* `surface-container-high` at `corner-extra-large` under elevation 3 — which is
|
|
119
|
+
* MD3's own docked search view, and happens to be the same three decisions
|
|
120
|
+
* [MPDialog](../feedback/dialog) makes. That is not a coincidence worth hiding:
|
|
121
|
+
* a sheet that has taken the page over a scrim is one object in this system,
|
|
122
|
+
* whether it is asking a question or taking a search.
|
|
123
|
+
*
|
|
124
|
+
* ## Where the behaviour comes from
|
|
125
|
+
*
|
|
126
|
+
* Base UI's `Autocomplete` owns the list — the highlight the pointer and the
|
|
127
|
+
* arrow keys **share**, `aria-activedescendant`, Enter running the highlighted
|
|
128
|
+
* row — and its `Dialog` owns the sheet, the scrim, the focus trap and putting
|
|
129
|
+
* the focus back wherever the reader was. What is left here is the surface, the
|
|
130
|
+
* matching, and the key that opens it.
|
|
131
|
+
*/
|
|
132
|
+
export declare function MPCommandPalette({ items, open, defaultOpen, onOpenChange, onSelect, shortcut, width, maxHeight, size, color, locale: localeProp, placeholder, emptyMessage, label, className, style }: MPCommandPaletteProps): React.JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{Autocomplete as n}from"@base-ui/react/autocomplete";import{Dialog as r}from"@base-ui/react/dialog";import{MPShortcut as l}from"../shortcut/MPShortcut.js";import{accentSlots as o}from"../../internal/accent.js";import{cssLength as s}from"../../internal/length.js";import{matchesShortcut as i,useDetectedOS as m}from"../../internal/keys.js";import{useMPLocale as c,useMPMessages as p}from"../../internal/locale.js";import{COMMAND as d}from"../../internal/messages/command.js";import{MPStateLayer as u}from"../../internal/StateLayer.js";import{hasContent as f,META_TEXT as h,PROSE_TEXT as x}from"../../internal/scale.js";import{FADE as g,PORTAL_LAYER as y,SCRIM as v,SHEET_MOTION as w}from"../../internal/surface.js";const b={xs:"max-w-sm",sm:"max-w-md",md:"max-w-xl",lg:"max-w-2xl",xl:"max-w-3xl"},j={xs:"h-10",sm:"h-12",md:"h-14",lg:"h-16",xl:"h-18"},N={xs:"px-2",sm:"px-2.5",md:"px-3",lg:"px-4",xl:"px-5"},$={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"};function k(e){return[e.label,e.group??"",...e.keywords??[]].join("\n").toLowerCase()}export function MPCommandPalette({items:C,open:S,defaultOpen:_=!1,onOpenChange:L,onSelect:M,shortcut:P="Mod+K",width:E,maxHeight:z=320,size:O="md",color:V="primary",locale:B,placeholder:F,emptyMessage:H,label:I,className:R,style:D}){const K=c(B),T=p(d,K),W=m(),[q,A]=a.useState(_),[G,J]=a.useState(""),Q=S??q,U=a.useCallback(e=>{e||J(""),void 0===S&&A(e),L?.(e)},[S,L]);a.useEffect(()=>{if(!1===P)return;const e=e=>{i(e,P,W)&&(e.preventDefault(),U(!0))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[P,W,U]);const X=a.useMemo(()=>C.map(k),[C]),Y=a.useMemo(()=>{if(""===G)return C;const e=G.toLowerCase();return C.filter((t,a)=>X[a].includes(e))},[C,X,G]),Z=s(E),ee=s(z);return e(r.Root,{open:Q,onOpenChange:U,children:t(r.Portal,{children:[e(r.Backdrop,{className:`${y} fixed inset-0 ${g} ${v}`}),e(r.Viewport,{className:`${y} fixed inset-0 flex justify-center p-4 pt-[12vh]`,children:e(r.Popup,{"aria-label":I??T.label,"data-mp-size":O,className:["mp-command-palette relative flex w-full flex-col self-start overflow-hidden","bg-mp-surface-container-high text-mp-on-surface shadow-mp-3 rounded-mp-xl","outline-none",x[O],void 0===Z?b[O]:"",`transition-[opacity,scale] ${w}`,"motion-safe:data-starting-style:scale-95 motion-safe:data-ending-style:scale-95",R??""].filter(Boolean).join(" "),style:{...o(V),...void 0===Z?null:{maxWidth:Z},...D},children:t(n.Root,{open:!0,mode:"list",items:Y,filter:null,value:G,onValueChange:e=>J(e),itemToStringValue:e=>e.label,children:[e("div",{className:`border-mp-outline-variant flex shrink-0 items-center border-b ${N[O]}`,children:e(n.Input,{autoFocus:!0,placeholder:F??T.search,className:["mp-command-palette__input min-w-0 flex-1 bg-transparent font-[inherit]","text-inherit outline-none","placeholder:text-mp-on-surface-variant caret-(--_mp-accent)",j[O]].join(" ")})}),e(n.List,{className:"mp-command-palette__list min-h-0 flex-1 overflow-y-auto overscroll-contain p-1",style:{maxHeight:ee},children:(r,o)=>t(a.Fragment,{children:[r.group&&r.group!==Y[o-1]?.group?e("div",{role:"presentation",className:`text-mp-on-surface-variant pt-2 pb-1 font-medium ${N[O]} ${h}`,children:r.group}):null,t(n.Item,{index:o,value:r,disabled:r.disabled,onClick:()=>(e=>{e.disabled||(e.onSelect?.(),M?.(e),U(!1))})(r),className:["mp-command-palette__row group rounded-mp-xs relative flex cursor-pointer","items-center gap-3 select-none outline-none","data-disabled:text-mp-on-surface/38 data-disabled:cursor-default",N[O],$[O]].join(" "),children:[e(u,{layer:"inset-0 rounded-[inherit] bg-current",className:"group-data-highlighted:opacity-8 group-data-disabled:opacity-0"}),f(r.icon)?e("span",{className:"relative flex h-[1lh] shrink-0 items-center",children:r.icon}):null,t("span",{className:"relative flex min-w-0 flex-1 flex-col",children:[e("span",{className:"truncate",children:r.label}),f(r.description)?e("span",{className:`text-mp-on-surface-variant truncate ${h}`,children:r.description}):null]}),r.shortcut?e(l,{size:"xs",keys:r.shortcut,className:"relative shrink-0"}):null]})]},`${o}:${r.value}`)}),e(n.Empty,{className:`text-mp-on-surface-variant py-6 text-center ${N[O]} ${h}`,children:H??T.empty})]})})})]})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{MPCommandPalette}from"./MPCommandPalette.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { MPSize } from '../../types';
|
|
3
|
+
import type { MPSize } from '../../types.js';
|
|
4
4
|
export interface MPContainerProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* How wide the content is allowed to get, on a ladder pinned to MD3's window
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{SHEET_PAD_X as
|
|
1
|
+
import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{MEASURE as n,SHEET_PAD_X as o}from"../../internal/scale.js";export const MPContainer=/*@__PURE__*/e.forwardRef(function({maxWidth:e="none",padded:a=!0,size:t="md",centered:i=!0,render:d,className:m,children:s,...c},l){return r({render:d,ref:l,props:{"data-mp-size":t,className:["mp-container block w-full","box-border","none"===e?"":n[e],i?"mx-auto":"",a?o[t]:"",m??""].filter(Boolean).join(" "),children:s,...c}})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPContainer } from './MPContainer';
|
|
2
|
-
export type { MPContainerProps } from './MPContainer';
|
|
1
|
+
export { MPContainer } from './MPContainer.js';
|
|
2
|
+
export type { MPContainerProps } from './MPContainer.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPContainer}from"./MPContainer";
|
|
1
|
+
export{MPContainer}from"./MPContainer.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type MPPickerLabels } from '../../internal/Calendar';
|
|
3
|
-
import { type MPPickerShellProps } from '../../internal/Picker';
|
|
4
|
-
import type { MPWeekday } from '../../types';
|
|
2
|
+
import { type MPPickerLabels } from '../../internal/Calendar.js';
|
|
3
|
+
import { type MPPickerShellProps } from '../../internal/Picker.js';
|
|
4
|
+
import type { MPWeekday } from '../../types.js';
|
|
5
5
|
export interface MPDatePickerProps extends MPPickerShellProps {
|
|
6
6
|
/** The chosen day. Use with `onValueChange` for a controlled picker. */
|
|
7
7
|
value?: Date | null;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{MPButton as o}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{CalendarIcon as n}from"../../constants/icons.js";import{MPCalendar as r}from"../../internal/Calendar.js";import{FOOTER_SIZE as s,MPPickerFooter as i,MPPickerShell as c,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as u}from"../../internal/locale.js";import{PICKER as p}from"../../internal/messages/picker.js";import{CONTROL_ICON as f}from"../../internal/scale.js";import{formatDate as h,isDayOutside as j,isValidDate as b,localeWeekStart as v,mergeDateAndTime as x,startOfDay as g,startOfMonth as D,toISODate as k,today as y,withPlaceholder as C}from"../../internal/date.js";export const MPDatePicker=/*@__PURE__*/l.forwardRef(function({value:O,defaultValue:S,onValueChange:z,open:M,defaultOpen:P,onOpenChange:w,defaultMonth:I,minDate:V,maxDate:B,shouldDisableDate:R,locale:E,weekStartsOn:F,format:N={dateStyle:"medium"},placeholder:T,clearable:q=!1,showTodayButton:A=!0,closeOnSelect:G=!0,labels:H,name:J,size:K="md",color:L="primary",readOnly:Q=!1,disabled:U=!1,startIcon:W,...X},Y){const Z=d(E),$=u(p,Z,H),_=F??v(Z),[ee,ae]=l.useState(S??null),le=void 0!==O?O:ee,[oe,te]=l.useState(P??!1),ne=M??oe,[re,se]=l.useState(()=>D(b(le)?le:I??y()));l.useEffect(()=>{ne&&se(D(b(le)?le:I??y()))},[ne]);const ie=e=>{e&&(Q||U)||(void 0===M&&te(e),w?.(e))},ce=e=>{void 0===O&&ae(e),z?.(e)},me=e=>{const a=b(le)?x(e,le):g(e);ce(a),se(D(a)),G&&ie(!1)},de=y(),ue=j(de,V,B)||(R?.(de)??!1),pe=A||q,fe=C(m(Z,N),T);return e(c,{...X,slug:"date-picker",size:K,color:L,readOnly:Q,disabled:U,triggerRef:Y,startIcon:void 0===W?e(t,{icon:n,size:f[K]}):W,display:b(le)?h(le,Z,N):T??"",samples:fe,empty:!b(le),clearable:q,onClear:()=>ce(null),open:ne,onOpenChange:ie,labels:$,hiddenValues:J?[{name:J,value:b(le)?k(le):""}]:void 0,children:a("div",{className:"flex flex-col "+(pe?"gap-1.5":""),children:[e(r,{size:K,color:L,locale:Z,weekStartsOn:_,month:re,onMonthChange:se,selected:[le],onSelect:me,minDate:V,maxDate:B,shouldDisableDate:R,labels:$,autoFocus:!0}),pe?a(i,{children:[q?e(o,{variant:"text",size:s[K],color:L,onClick:()=>{ce(null),ie(!1)},children:$.clear}):null,A?e(o,{variant:"text",size:s[K],color:L,disabled:ue,onClick:()=>me(de),children:$.today}):null]}):null]})})});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MPDatePicker } from './MPDatePicker';
|
|
2
|
-
export type { MPDatePickerProps } from './MPDatePicker';
|
|
1
|
+
export { MPDatePicker } from './MPDatePicker.js';
|
|
2
|
+
export type { MPDatePickerProps } from './MPDatePicker.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{MPDatePicker}from"./MPDatePicker";
|
|
1
|
+
export{MPDatePicker}from"./MPDatePicker.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type MPPickerLabels } from '../../internal/Calendar';
|
|
3
|
-
import { type MPPickerShellProps } from '../../internal/Picker';
|
|
4
|
-
import type { MPWeekday } from '../../types';
|
|
2
|
+
import { type MPPickerLabels } from '../../internal/Calendar.js';
|
|
3
|
+
import { type MPPickerShellProps } from '../../internal/Picker.js';
|
|
4
|
+
import type { MPWeekday } from '../../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Two ends, either of which may be missing.
|
|
7
7
|
*
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as n from"react";import{MPButton as a}from"../button/MPButton.js";import{MPIcon as t}from"../icon/MPIcon.js";import{ArrowRightIcon as r,CalendarIcon as s}from"../../constants/icons.js";import{MPCalendar as o}from"../../internal/Calendar.js";import{FOOTER_SIZE as i,MPPickerFooter as c,MPPickerShell as u,useDisplaySamples as m}from"../../internal/Picker.js";import{useMPLocale as d,useMPMessages as p}from"../../internal/locale.js";import{PICKER as h}from"../../internal/messages/picker.js";import{MPWidthSizer as f}from"../../internal/WidthSizer.js";import{CONTROL_ICON as v,META_TEXT as x}from"../../internal/scale.js";import{addMonths as g,compareDay as j,formatDate as b,isValidDate as w,localeWeekStart as N,startOfDay as S,startOfMonth as C,toISODate as y,today as D,withPlaceholder as k}from"../../internal/date.js";const O={start:null,end:null};export const MPDateRangePicker=/*@__PURE__*/n.forwardRef(function({value:P,defaultValue:z,onValueChange:M,open:B,defaultOpen:I,onOpenChange:R,defaultMonth:V,minDate:E,maxDate:F,shouldDisableDate:W,locale:$,weekStartsOn:_,format:q={dateStyle:"medium"},monthCount:A=2,startPlaceholder:G,endPlaceholder:H,presets:J,clearable:K=!1,closeOnSelect:L=!0,labels:Q,name:T,size:U="md",color:X="primary",readOnly:Y=!1,disabled:Z=!1,startIcon:ee,...le},ne){const ae=d($),te=p(h,ae,Q),re=_??N(ae),[se,oe]=n.useState(z??O),ie=void 0!==P?P??O:se,ce=w(ie.start)?ie.start:null,ue=w(ie.end)?ie.end:null,[me,de]=n.useState(I??!1),pe=B??me,[he,fe]=n.useState(null),[ve,xe]=n.useState(null),[ge,je]=n.useState(()=>C(ce??V??D()));n.useEffect(()=>{pe?je(C(ce??V??D())):(fe(null),xe(null))},[pe]);const be=e=>{e&&(Y||Z)||(void 0===B&&de(e),R?.(e))},we=e=>{void 0===P&&oe(e),M?.(e)},Ne=he??ce,Se=null!==he?ve:ue,Ce=(l,n)=>w(l)?b(l,ae,q):e("span",{className:"text-mp-on-surface-variant",children:n??""}),ye=g(ge,1),De=2===A,ke=m(ae,q),Oe=null!==he?te.end:null===ce?te.start:null,Pe={size:U,color:X,locale:ae,weekStartsOn:re,selected:[ce,ue,he],rangeStart:Ne,rangeEnd:Se,onSelect:e=>{const l=S(e);if(null===he)return fe(l),xe(l),void we({start:l,end:null});const[n,a]=j(l,he)<0?[l,he]:[he,l];fe(null),xe(null),we({start:n,end:a}),L&&be(!1)},onPreviewChange:e=>{null!==he&&xe(e??he)},minDate:E,maxDate:F,shouldDisableDate:W,showOutsideDays:!1,labels:te};return e(u,{...le,slug:"date-range-picker",size:U,color:X,readOnly:Y,disabled:Z,triggerRef:ne,startIcon:void 0===ee?e(t,{icon:s,size:v[U]}):ee,display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ce,G)}),e(f,{samples:k(ke,G)})]}),e("span",{"aria-hidden":"true",className:"text-mp-on-surface-variant flex shrink-0 items-center rtl:rotate-180",children:e(t,{icon:r,size:v[U]})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:Ce(ue,H)}),e(f,{samples:k(ke,H)})]})]}),empty:null===ce&&null===ue,clearable:K,onClear:()=>we(O),open:pe,onOpenChange:be,labels:te,hiddenValues:T?[{name:T,value:ce?y(ce):""},{name:T,value:ue?y(ue):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:"flex items-stretch gap-2",children:[J&&J.length>0?e("div",{className:"border-mp-outline-variant flex max-h-[calc(var(--_mp-cell,2.5rem)*8)] flex-col overflow-y-auto border-e pe-1.5",children:J.map((l,n)=>e(a,{variant:"text",size:i[U],color:X,className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;fe(null),xe(null),we(l),w(l.start)&&je(C(l.start)),L&&be(!1)})(l),children:l.label},n))}):null,e(o,{...Pe,month:ge,onMonthChange:je,showNextButton:!De,autoFocus:!0}),De?e(o,{...Pe,month:ye,onMonthChange:e=>je(g(e,-1)),showPreviousButton:!1}):null]}),K||null!==Oe?l(c,{children:[null!==Oe?e("span",{className:`text-mp-on-surface-variant me-auto ${x}`,children:Oe}):null,K?e(a,{variant:"text",size:i[U],color:X,onClick:()=>{fe(null),xe(null),we(O),be(!1)},children:te.clear}):null]}):null]})})});
|