material-plus-ui 1.2.0 → 1.3.1
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 +23 -2
- 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 +1 -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/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 +1 -1
- 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 +1 -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 +1 -1
- 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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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/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 +4 -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/file-picker/MPFilePicker.d.ts +1 -1
- 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/grid/MPGrid.d.ts +1 -1
- package/dist/components/grid/MPGrid.js +2 -1
- package/dist/components/grid/index.d.ts +2 -2
- package/dist/components/grid/index.js +1 -1
- package/dist/components/highlight/MPHighlight.d.ts +2 -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 +2 -1
- 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/number-field/MPNumberField.d.ts +1 -1
- 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 +1 -1
- 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/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 +1 -1
- 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/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 +1 -1
- 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 +2 -2
- 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 +1 -1
- 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 +3 -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/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/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 +62 -0
- package/dist/constants/glyphs.js +2 -0
- package/dist/constants/icons.d.ts +31 -60
- package/dist/constants/icons.js +1 -1
- package/dist/index.d.ts +78 -77
- 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.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 -1
- package/dist/internal/animate.js +1 -0
- package/dist/internal/button-group.d.ts +1 -1
- package/dist/internal/button-group.js +2 -1
- package/dist/internal/date.d.ts +1 -1
- package/dist/internal/i18n.d.ts +100 -5
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/locale.d.ts +8 -3
- package/dist/internal/locale.js +2 -1
- package/dist/internal/menu.d.ts +1 -1
- package/dist/internal/menu.js +2 -1
- package/dist/internal/messages/alert.d.ts +3 -0
- package/dist/internal/messages/alert.js +1 -0
- package/dist/internal/messages/chat.d.ts +3 -0
- package/dist/internal/messages/chat.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/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/text-field.d.ts +3 -0
- package/dist/internal/messages/text-field.js +1 -0
- package/dist/internal/progress.d.ts +1 -1
- package/dist/internal/scale.d.ts +1 -1
- package/dist/internal/surface.d.ts +1 -1
- package/dist/internal/surface.js +1 -1
- package/dist/locales/ar.d.ts +17 -0
- package/dist/locales/ar.js +1 -0
- package/dist/locales/de.d.ts +17 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/es.d.ts +17 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +17 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/hi.d.ts +17 -0
- package/dist/locales/hi.js +1 -0
- package/dist/locales/id.d.ts +17 -0
- package/dist/locales/id.js +1 -0
- package/dist/locales/index.d.ts +89 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/it.d.ts +17 -0
- package/dist/locales/it.js +1 -0
- package/dist/locales/ja.d.ts +17 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +17 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/nl.d.ts +17 -0
- package/dist/locales/nl.js +1 -0
- package/dist/locales/pl.d.ts +17 -0
- package/dist/locales/pl.js +1 -0
- package/dist/locales/pt.d.ts +17 -0
- package/dist/locales/pt.js +1 -0
- package/dist/locales/ru.d.ts +17 -0
- package/dist/locales/ru.js +1 -0
- package/dist/locales/th.d.ts +17 -0
- package/dist/locales/th.js +1 -0
- package/dist/locales/tr.d.ts +17 -0
- package/dist/locales/tr.js +1 -0
- package/dist/locales/vi.d.ts +17 -0
- package/dist/locales/vi.js +1 -0
- package/dist/locales/zh-hans.d.ts +21 -0
- package/dist/locales/zh-hans.js +1 -0
- package/dist/locales/zh-hant.d.ts +20 -0
- package/dist/locales/zh-hant.js +1 -0
- package/dist/styles/accordion.css +2 -0
- package/dist/styles/alert.css +2 -0
- package/dist/styles/animate-appear.css +2 -0
- package/dist/styles/animate-blink.css +2 -0
- package/dist/styles/animate-fade.css +2 -0
- package/dist/styles/animate-grow.css +2 -0
- package/dist/styles/animate-headline.css +2 -0
- package/dist/styles/animate-lighting.css +2 -0
- package/dist/styles/animate-marquee.css +2 -0
- package/dist/styles/animate-rotate.css +2 -0
- package/dist/styles/animate-slide.css +2 -0
- package/dist/styles/animate-typing.css +2 -0
- package/dist/styles/animate-zoom.css +2 -0
- package/dist/styles/aspect-ratio.css +2 -0
- package/dist/styles/avatar.css +2 -0
- package/dist/styles/badge.css +2 -0
- package/dist/styles/blockquote.css +2 -0
- package/dist/styles/bottom-navigation.css +2 -0
- package/dist/styles/box.css +2 -0
- package/dist/styles/breadcrumb.css +2 -0
- package/dist/styles/button-group.css +2 -0
- package/dist/styles/button.css +2 -0
- package/dist/styles/card.css +2 -0
- package/dist/styles/carousel.css +2 -0
- package/dist/styles/chat-bubble.css +2 -0
- package/dist/styles/checkbox.css +2 -0
- package/dist/styles/chip.css +2 -0
- package/dist/styles/collapsible.css +2 -0
- package/dist/styles/color-picker.css +2 -0
- package/dist/styles/combobox.css +2 -0
- package/dist/styles/container.css +2 -0
- package/dist/styles/date-picker.css +2 -0
- package/dist/styles/date-range-picker.css +2 -0
- package/dist/styles/date-time-picker.css +2 -0
- package/dist/styles/dialog.css +2 -0
- package/dist/styles/divider.css +2 -0
- package/dist/styles/drawer.css +2 -0
- package/dist/styles/empty.css +2 -0
- package/dist/styles/file-picker.css +2 -0
- package/dist/styles/floating-action-button.css +2 -0
- package/dist/styles/grid.css +2 -0
- package/dist/styles/highlight.css +2 -0
- package/dist/styles/icon-button.css +2 -0
- package/dist/styles/icon.css +2 -0
- package/dist/styles/list.css +2 -0
- package/dist/styles/locale.css +2 -0
- package/dist/styles/menu.css +2 -0
- package/dist/styles/number-field.css +2 -0
- package/dist/styles/otp-field.css +2 -0
- package/dist/styles/overlay.css +2 -0
- package/dist/styles/pagination.css +2 -0
- package/dist/styles/panes.css +2 -0
- package/dist/styles/pill.css +2 -0
- package/dist/styles/popover.css +2 -0
- package/dist/styles/progress-box.css +2 -0
- package/dist/styles/progress-circular.css +2 -0
- package/dist/styles/progress-linear.css +2 -0
- package/dist/styles/radio-group.css +2 -0
- package/dist/styles/rating.css +2 -0
- package/dist/styles/segmented-button.css +2 -0
- package/dist/styles/select.css +2 -0
- package/dist/styles/shortcut.css +2 -0
- package/dist/styles/skeleton.css +2 -0
- package/dist/styles/slider.css +2 -0
- package/dist/styles/snackbar.css +2 -0
- package/dist/styles/spoiler.css +2 -0
- package/dist/styles/switch.css +2 -0
- package/dist/styles/table.css +2 -0
- package/dist/styles/tabs.css +2 -0
- package/dist/styles/text-field.css +2 -0
- package/dist/styles/text-link.css +2 -0
- package/dist/styles/time-picker.css +2 -0
- package/dist/styles/timeline.css +2 -0
- package/dist/styles/tokens.css +2 -0
- package/dist/styles/tooltip.css +2 -0
- package/dist/styles/typography.css +2 -0
- package/package.json +31 -10
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import*as n from"react";import{MPButton as r}from"../components/button/MPButton";import{MPIcon as l}from"../components/icon/MPIcon";import{MPIconButton as a}from"../components/icon-button/MPIconButton";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons";import{MPStateLayer as u}from"./StateLayer";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale";import{VISUALLY_HIDDEN as p}from"./visually-hidden";import{addDays as f,addMonths as g,addYears as v,calendarWeeks as y,compareDay as w,dateFormatter as x,daysInMonth as b,isDayOutside as D,isMonthBeforeYear as S,isSameDay as N,isSameMonth as M,isValidDate as P,makeDate as _,meridiemLabels as C,monthLabels as k,startOfDay as z,startOfMonth as F,today as Y,weekdayLabels as A,withTime as E,YEAR_PAGE_SIZE as j,yearPageStart as B}from"./date";const R={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},T={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},$=["group relative flex cursor-pointer items-center justify-center overflow-hidden","box-border appearance-none bg-transparent font-[inherit] tabular-nums select-none","transition-[background-color,border-color,color]","duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:z-10 focus-visible:outline-2","focus-visible:outline-offset-[-2px] focus-visible:outline-solid outline-none"].join(" ");function H({children:t,label:n,selected:r,inRange:l=!1,rangeEdge:a=null,current:s=!1,muted:c=!1,disabled:i=!1,focused:m=!1,className:d,onClick:h,onPointerEnter:p,onKeyDown:f}){return o("button",{type:"button",role:"gridcell","aria-label":n,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":i||void 0,tabIndex:m?0:-1,"data-focus-target":m?"true":void 0,className:[$,"start"===a?"rounded-s-mp-full":"end"===a?"rounded-e-mp-full":"middle"===a?"rounded-none":"rounded-mp-full",i?"cursor-default text-mp-on-surface/38":r?"bg-(--_mp-accent) text-(--_mp-on-accent)":l?"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)":s?"border border-(--_mp-accent) text-(--_mp-accent)":c?"text-mp-on-surface-variant":"text-mp-on-surface",d??""].filter(Boolean).join(" "),onClick:()=>{i||h()},onPointerEnter:p,onKeyDown:f,children:[i?null:e(u,{}),t]})}function K({size:n,color:u,view:d,month:p,locale:f,labels:g,showPreviousButton:v,showNextButton:y,onStep:w,onViewChange:x}){const b=k(f,"long")[p.getMonth()],D=String(p.getFullYear()),N=S(f),M=T[n],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],_=(o,t)=>t?e(a,{size:M,color:u,label:P[-1===o?0:1],icon:e(l,{icon:-1===o?c:i,size:m[M],className:"rtl:rotate-180"}),onClick:()=>w(o)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),C=o=>e(l,{icon:s,size:m[M],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",o?"rotate-180":""].filter(Boolean).join(" ")}),z=e(r,{variant:"text",size:M,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:C("month"===d),onClick:()=>x("month"===d?"day":"month"),children:b},"month"),F=e(r,{variant:"text",size:M,color:u,className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,endIcon:C("year"===d),onClick:()=>x("year"===d?"day":"year"),children:D},"year"),Y=B(p.getFullYear());return o("div",{className:"flex items-center justify-between gap-1",children:[_(-1,v),e("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1",children:"year"===d?e("span",{className:`text-mp-on-surface flex h-(--_mp-cell) items-center tabular-nums ${h[n]}`,children:`${Y}–${Y+j-1}`}):"month"===d?F:o(t,N?{children:[z,F]}:{children:[F,z]})}),_(1,y)]})}export function MPCalendar({size:t,color:r,locale:l,weekStartsOn:a,month:s,onMonthChange:c,selected:i,rangeStart:u=null,rangeEnd:m=null,onSelect:d,onPreviewChange:h,minDate:p,maxDate:f,shouldDisableDate:y,showOutsideDays:w=!0,autoFocus:x=!1,showPreviousButton:b=!0,showNextButton:S=!0,labels:N}){const[C,k]=n.useState("day"),A=n.useMemo(()=>i.filter(P),[i]),[E,B]=n.useState(()=>{const e=A.find(e=>M(e,s));return e?z(e):M(Y(),s)?Y():F(s)}),T=n.useRef(x),$=n.useRef(null);n.useEffect(()=>{B(e=>M(e,s)?e:F(s))},[s]),n.useLayoutEffect(()=>{T.current&&(T.current=!1,$.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const H=n.useCallback(e=>D(e,p,f)||(y?.(e)??!1),[p,f,y]),q=e=>{T.current=!0,k(e)},I=e=>{T.current=!0,c(e)};return o("div",{ref:$,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":R[t]},onPointerLeave:()=>h?.(null),children:[e(K,{size:t,color:r,view:C,month:s,locale:l,labels:N,showPreviousButton:b,showNextButton:S,onStep:e=>{c("day"===C?g(s,e):v(s,"month"===C?e:e*j))},onViewChange:q}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===C?e(L,{size:t,locale:l,weekStartsOn:a,month:s,chosen:A,rangeStart:u,rangeEnd:m,focusedDate:E,showOutsideDays:w,isDisabled:H,onSelect:e=>{B(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{T.current=!0,B(e),M(e,s)||c(F(e))}}):"month"===C?e(O,{size:t,locale:l,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(s.getFullYear(),e,1)),q("day")}}):e(U,{size:t,month:s,chosen:A,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(e,s.getMonth(),1)),q("month")}})})]})}function L({size:t,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:p,onSelect:v,onPreviewChange:b,onMoveFocus:D}){const S=A(r,l,"narrow"),_=A(r,l,"long"),C=(z=i,P(k=c)&&P(z)?w(k,z)<=0?[k,z]:[z,k]:null);var k,z;const F=Y(),E=n.useMemo(()=>{const e=x(r,{dateStyle:"full"});return y(a,l).map(o=>o.map(o=>({date:o,label:e.format(o)})))},[a,l,r]),j=n.useRef(null),B=n.useRef(a);n.useLayoutEffect(()=>{const e=j.current,o=B.current;if(B.current=a,!e||M(o,a))return;const t=o.getTime()<a.getTime(),n="rtl"===getComputedStyle(e).direction;e.style.setProperty("--_mp-calendar-from",String(t===n?-1:1)),e.dataset.mpPaged="true",e.style.animationName="none",e.offsetWidth,e.style.animationName=""},[a]);return o("div",{role:"grid","aria-label":x(r,{year:"numeric",month:"long"}).format(a),className:"flex h-full flex-col",children:[e("div",{role:"rowgroup",children:e("div",{role:"row",className:"grid grid-cols-7",children:S.map((o,t)=>e("span",{role:"columnheader","aria-label":_[t],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:o},t))})}),e("div",{ref:j,role:"rowgroup",className:"mp-calendar__page flex flex-1 flex-col",children:E.map((o,n)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(({date:o,label:n})=>{const r=!M(o,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},o.getTime());const c=s.some(e=>N(e,o)),i=null!==C&&w(o,C[0])>=0&&w(o,C[1])<=0,d=null!==C&&i&&N(o,C[0]),y=null!==C&&i&&N(o,C[1]);return e(H,{label:n,selected:c,inRange:i&&!c,rangeEdge:i?d&&y?"both":d?"start":y?"end":"middle":null,current:N(o,F)&&!c,muted:r,disabled:p(o),focused:N(o,u),className:`size-(--_mp-cell) ${h[t]}`,onClick:()=>v(o),onPointerEnter:()=>b?.(o),onKeyDown:e=>((e,o)=>{const t=(o.getDay()-l+7)%7,n={ArrowLeft:()=>f(o,-1),ArrowRight:()=>f(o,1),ArrowUp:()=>f(o,-7),ArrowDown:()=>f(o,7),Home:()=>f(o,-t),End:()=>f(o,6-t),PageUp:()=>g(o,e.shiftKey?-12:-1),PageDown:()=>g(o,e.shiftKey?12:1)}[e.key];n&&(e.preventDefault(),D(n()))})(e,o),children:o.getDate()},o.getTime())})},n))})]})}function O({size:o,locale:t,month:n,chosen:r,minDate:l,maxDate:a,onMoveCursor:s,onPick:c}){const i=k(t,"short"),u=k(t,"long"),m=n.getFullYear(),d=new Date,p=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==o&&(e.preventDefault(),s(g(F(n),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(t=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(s=>{const f=3*t+s,g=_(m,f,1),v=_(m,f,b(m,f));return e(H,{label:`${u[f]} ${m}`,selected:r.some(e=>e.getFullYear()===m&&e.getMonth()===f),current:d.getFullYear()===m&&d.getMonth()===f,disabled:P(l)&&w(v,l)<0||P(a)&&w(g,a)>0,focused:f===n.getMonth(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>c(f),onKeyDown:p,children:i[f]},f)})},t))})}function U({size:o,month:t,chosen:n,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=B(t.getFullYear()),i=(new Date).getFullYear(),u=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==o&&(e.preventDefault(),a(v(F(t),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(a=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(m=>{const d=c+4*a+m;return e(H,{label:String(d),selected:n.some(e=>e.getFullYear()===d),current:d===i,disabled:P(r)&&d<r.getFullYear()||P(l)&&d>l.getFullYear(),focused:d===t.getFullYear(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function q(e){const o=e.parentElement;if(!o)return;const t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),r=t.top-n.top-o.clientTop+o.scrollTop,l=r+t.height;r<o.scrollTop?o.scrollTop=r:l>o.scrollTop+o.clientHeight&&(o.scrollTop=l-o.clientHeight)}export function MPTimeGrid({size:t,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:f,shouldDisableTime:g,autoFocus:v=!1,labels:y}){const w=l??a,b=n.useRef(null),[D,S]=n.useMemo(()=>C(r),[r]);n.useEffect(()=>{const e=b.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(q),v){const o=e?.querySelector('[role="listbox"]');(o?.querySelector('[data-chosen="true"]')??o?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[v]);const N=n.useMemo(()=>{const e=Math.ceil((c?12:24)/m),o=Array.from({length:e},(e,o)=>o*m);return c?o.map(e=>0===e?12:e):o},[c,m]),M=n.useMemo(()=>Array.from({length:Math.ceil(60/d)},(e,o)=>o*d),[d]),P=n.useMemo(()=>Array.from({length:Math.ceil(60/f)},(e,o)=>o*f),[f]),_=e=>String(e).padStart(2,"0"),k=c?w.getHours()%12||12:w.getHours(),z=(n,r,a,i,m)=>e("div",{role:"listbox","aria-label":r,className:["mp-time-grid__column flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"].join(" "),children:a.map(r=>{const a=((e,o)=>E(w,"hour"===e?{hours:c?o%12+(w.getHours()>=12?12:0):o}:"minute"===e?{minutes:o}:"second"===e?{seconds:o}:{hours:w.getHours()%12+12*o}))(n,r),d=null!==l&&i(r),p=g?.(a,n)??!1;return o("button",{type:"button",role:"option","aria-selected":d,"aria-disabled":p||void 0,"data-chosen":d?"true":void 0,className:[$,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[t],p?"cursor-default text-mp-on-surface/38":d?"bg-(--_mp-accent) text-(--_mp-on-accent)":"text-mp-on-surface"].join(" "),onClick:()=>{p||s(a)},children:[p?null:e(u,{}),m(r)]},r)})},n);return o("div",{ref:b,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":R[t]},children:[z("hour",y.hour,N,e=>e===k,e=>c?String(e):_(e)),z("minute",y.minute,M,e=>e===w.getMinutes(),_),i?z("second",y.second,P,e=>e===w.getSeconds(),_):null,c?z("meridiem",y.meridiem,[0,1],e=>(w.getHours()>=12?1:0)===e,e=>0===e?D:S):null,e("span",{className:p,"aria-live":"polite",children:null===l?"":x(r,{hour:"numeric",minute:"2-digit",...i?{second:"2-digit"}:{}}).format(l)})]})}
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import*as n from"react";import{MPButton as r}from"../components/button/MPButton.js";import{MPIcon as l}from"../components/icon/MPIcon.js";import{MPIconButton as a}from"../components/icon-button/MPIconButton.js";import{ChevronDownIcon as s,ChevronLeftIcon as c,ChevronRightIcon as i}from"../constants/icons.js";import{MPStateLayer as u}from"./StateLayer.js";import{CONTROL_ICON as m,META_TEXT as d,PROSE_TEXT as h}from"./scale.js";import{VISUALLY_HIDDEN as p}from"./visually-hidden.js";import{addDays as f,addMonths as g,addYears as v,calendarWeeks as y,compareDay as w,dateFormatter as x,daysInMonth as b,isDayOutside as D,isMonthBeforeYear as S,isSameDay as N,isSameMonth as M,isValidDate as P,makeDate as _,meridiemLabels as C,monthLabels as j,startOfDay as k,startOfMonth as z,today as F,weekdayLabels as Y,withTime as A,YEAR_PAGE_SIZE as E,yearPageStart as B}from"./date.js";const R={xs:"1.75rem",sm:"2rem",md:"2.5rem",lg:"2.75rem",xl:"3rem"},T={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},$=/*@__PURE__*/["group relative flex cursor-pointer items-center justify-center overflow-hidden","box-border appearance-none bg-transparent font-[inherit] tabular-nums select-none","transition-[background-color,border-color,color]","duration-(--mp-sys-motion-duration-short4)","outline-mp-secondary focus-visible:z-10 focus-visible:outline-2","focus-visible:outline-offset-[-2px] focus-visible:outline-solid outline-none"].join(" ");function H({children:t,label:n,selected:r,inRange:l=!1,rangeEdge:a=null,current:s=!1,muted:c=!1,disabled:i=!1,focused:m=!1,className:d,onClick:h,onPointerEnter:p,onKeyDown:f}){return o("button",{type:"button",role:"gridcell","aria-label":n,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":i||void 0,tabIndex:m?0:-1,"data-focus-target":m?"true":void 0,className:[$,"start"===a?"rounded-s-mp-full":"end"===a?"rounded-e-mp-full":"middle"===a?"rounded-none":"rounded-mp-full",i?"cursor-default text-mp-on-surface/38":r?"bg-(--_mp-accent) text-(--_mp-on-accent)":l?"bg-(--_mp-accent-container) text-(--_mp-on-accent-container)":s?"border border-(--_mp-accent) text-(--_mp-accent)":c?"text-mp-on-surface-variant":"text-mp-on-surface",d??""].filter(Boolean).join(" "),onClick:()=>{i||h()},onPointerEnter:p,onKeyDown:f,children:[i?null:e(u,{}),t]})}function K({size:n,color:u,view:d,month:p,locale:f,labels:g,showPreviousButton:v,showNextButton:y,onStep:w,onViewChange:x}){const b=j(f,"long")[p.getMonth()],D=String(p.getFullYear()),N=S(f),M=T[n],P="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],_=(o,t)=>t?e(a,{size:M,color:u,label:P[-1===o?0:1],icon:e(l,{icon:-1===o?c:i,size:m[M],className:"rtl:rotate-180"}),onClick:()=>w(o)}):e("span",{"aria-hidden":"true",className:"size-(--_mp-cell)"}),C=o=>e(l,{icon:s,size:m[M],className:["transition-transform duration-(--mp-sys-motion-duration-short4)",o?"rotate-180":""].filter(Boolean).join(" ")}),k=e(r,{variant:"text",size:M,color:u,"aria-label":g.chooseMonth,"aria-expanded":"month"===d,endIcon:C("month"===d),onClick:()=>x("month"===d?"day":"month"),children:b},"month"),z=e(r,{variant:"text",size:M,color:u,className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,endIcon:C("year"===d),onClick:()=>x("year"===d?"day":"year"),children:D},"year"),F=B(p.getFullYear());return o("div",{className:"flex items-center justify-between gap-1",children:[_(-1,v),e("div",{className:"flex min-w-0 flex-1 items-center justify-center gap-1",children:"year"===d?e("span",{className:`text-mp-on-surface flex h-(--_mp-cell) items-center tabular-nums ${h[n]}`,children:`${F}–${F+E-1}`}):"month"===d?z:o(t,N?{children:[k,z]}:{children:[z,k]})}),_(1,y)]})}export function MPCalendar({size:t,color:r,locale:l,weekStartsOn:a,month:s,onMonthChange:c,selected:i,rangeStart:u=null,rangeEnd:m=null,onSelect:d,onPreviewChange:h,minDate:p,maxDate:f,shouldDisableDate:y,showOutsideDays:w=!0,autoFocus:x=!1,showPreviousButton:b=!0,showNextButton:S=!0,labels:N}){const[C,j]=n.useState("day"),Y=n.useMemo(()=>i.filter(P),[i]),[A,B]=n.useState(()=>{const e=Y.find(e=>M(e,s));return e?k(e):M(F(),s)?F():z(s)}),T=n.useRef(x),$=n.useRef(null);n.useEffect(()=>{B(e=>M(e,s)?e:z(s))},[s]),n.useLayoutEffect(()=>{T.current&&(T.current=!1,$.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const H=n.useCallback(e=>D(e,p,f)||(y?.(e)??!1),[p,f,y]),q=e=>{T.current=!0,j(e)},I=e=>{T.current=!0,c(e)};return o("div",{ref:$,className:"mp-calendar flex flex-col gap-1",style:{"--_mp-cell":R[t]},onPointerLeave:()=>h?.(null),children:[e(K,{size:t,color:r,view:C,month:s,locale:l,labels:N,showPreviousButton:b,showNextButton:S,onStep:e=>{c("day"===C?g(s,e):v(s,"month"===C?e:e*E))},onViewChange:q}),e("div",{className:"h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*7)]",children:"day"===C?e(L,{size:t,locale:l,weekStartsOn:a,month:s,chosen:Y,rangeStart:u,rangeEnd:m,focusedDate:A,showOutsideDays:w,isDisabled:H,onSelect:e=>{B(e),d(e)},onPreviewChange:h,onMoveFocus:e=>{T.current=!0,B(e),M(e,s)||c(z(e))}}):"month"===C?e(O,{size:t,locale:l,month:s,chosen:Y,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(s.getFullYear(),e,1)),q("day")}}):e(U,{size:t,month:s,chosen:Y,minDate:p,maxDate:f,onMoveCursor:I,onPick:e=>{c(_(e,s.getMonth(),1)),q("month")}})})]})}function L({size:t,locale:r,weekStartsOn:l,month:a,chosen:s,rangeStart:c,rangeEnd:i,focusedDate:u,showOutsideDays:m,isDisabled:p,onSelect:v,onPreviewChange:b,onMoveFocus:D}){const S=Y(r,l,"narrow"),_=Y(r,l,"long"),C=(k=i,P(j=c)&&P(k)?w(j,k)<=0?[j,k]:[k,j]:null);var j,k;const z=F(),A=n.useMemo(()=>{const e=x(r,{dateStyle:"full"});return y(a,l).map(o=>o.map(o=>({date:o,label:e.format(o)})))},[a,l,r]),E=n.useRef(null),B=n.useRef(a);n.useLayoutEffect(()=>{const e=E.current,o=B.current;if(B.current=a,!e||M(o,a))return;const t=o.getTime()<a.getTime(),n="rtl"===getComputedStyle(e).direction;e.style.setProperty("--_mp-calendar-from",String(t===n?-1:1)),e.dataset.mpPaged="true",e.style.animationName="none",e.offsetWidth,e.style.animationName=""},[a]);return o("div",{role:"grid","aria-label":x(r,{year:"numeric",month:"long"}).format(a),className:"flex h-full flex-col",children:[e("div",{role:"rowgroup",children:e("div",{role:"row",className:"grid grid-cols-7",children:S.map((o,t)=>e("span",{role:"columnheader","aria-label":_[t],className:`text-mp-on-surface-variant flex h-(--_mp-cell) items-center justify-center select-none ${d}`,children:o},t))})}),e("div",{ref:E,role:"rowgroup",className:"mp-calendar__page flex flex-1 flex-col",children:A.map((o,n)=>e("div",{role:"row",className:"grid grid-cols-7",children:o.map(({date:o,label:n})=>{const r=!M(o,a);if(r&&!m)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--_mp-cell)"},o.getTime());const c=s.some(e=>N(e,o)),i=null!==C&&w(o,C[0])>=0&&w(o,C[1])<=0,d=null!==C&&i&&N(o,C[0]),y=null!==C&&i&&N(o,C[1]);return e(H,{label:n,selected:c,inRange:i&&!c,rangeEdge:i?d&&y?"both":d?"start":y?"end":"middle":null,current:N(o,z)&&!c,muted:r,disabled:p(o),focused:N(o,u),className:`size-(--_mp-cell) ${h[t]}`,onClick:()=>v(o),onPointerEnter:()=>b?.(o),onKeyDown:e=>((e,o)=>{const t=(o.getDay()-l+7)%7,n={ArrowLeft:()=>f(o,-1),ArrowRight:()=>f(o,1),ArrowUp:()=>f(o,-7),ArrowDown:()=>f(o,7),Home:()=>f(o,-t),End:()=>f(o,6-t),PageUp:()=>g(o,e.shiftKey?-12:-1),PageDown:()=>g(o,e.shiftKey?12:1)}[e.key];n&&(e.preventDefault(),D(n()))})(e,o),children:o.getDate()},o.getTime())})},n))})]})}function O({size:o,locale:t,month:n,chosen:r,minDate:l,maxDate:a,onMoveCursor:s,onPick:c}){const i=j(t,"short"),u=j(t,"long"),m=n.getFullYear(),d=new Date,p=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==o&&(e.preventDefault(),s(g(z(n),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(t=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(s=>{const f=3*t+s,g=_(m,f,1),v=_(m,f,b(m,f));return e(H,{label:`${u[f]} ${m}`,selected:r.some(e=>e.getFullYear()===m&&e.getMonth()===f),current:d.getFullYear()===m&&d.getMonth()===f,disabled:P(l)&&w(v,l)<0||P(a)&&w(g,a)>0,focused:f===n.getMonth(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>c(f),onKeyDown:p,children:i[f]},f)})},t))})}function U({size:o,month:t,chosen:n,minDate:r,maxDate:l,onMoveCursor:a,onPick:s}){const c=B(t.getFullYear()),i=(new Date).getFullYear(),u=e=>{const o={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-E,PageDown:E}[e.key];void 0!==o&&(e.preventDefault(),a(v(z(t),o)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(a=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(m=>{const d=c+4*a+m;return e(H,{label:String(d),selected:n.some(e=>e.getFullYear()===d),current:d===i,disabled:P(r)&&d<r.getFullYear()||P(l)&&d>l.getFullYear(),focused:d===t.getFullYear(),className:`h-(--_mp-cell) w-full ${h[o]}`,onClick:()=>s(d),onKeyDown:u,children:d},d)})},a))})}function q(e){const o=e.parentElement;if(!o)return;const t=e.getBoundingClientRect(),n=o.getBoundingClientRect(),r=t.top-n.top-o.clientTop+o.scrollTop,l=r+t.height;r<o.scrollTop?o.scrollTop=r:l>o.scrollTop+o.clientHeight&&(o.scrollTop=l-o.clientHeight)}export function MPTimeGrid({size:t,locale:r,value:l,referenceDate:a,onChange:s,hour12:c,showSeconds:i,hourStep:m,minuteStep:d,secondStep:f,shouldDisableTime:g,autoFocus:v=!1,labels:y}){const w=l??a,b=n.useRef(null),[D,S]=n.useMemo(()=>C(r),[r]);n.useEffect(()=>{const e=b.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(q),v){const o=e?.querySelector('[role="listbox"]');(o?.querySelector('[data-chosen="true"]')??o?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[v]);const N=n.useMemo(()=>{const e=Math.ceil((c?12:24)/m),o=Array.from({length:e},(e,o)=>o*m);return c?o.map(e=>0===e?12:e):o},[c,m]),M=n.useMemo(()=>Array.from({length:Math.ceil(60/d)},(e,o)=>o*d),[d]),P=n.useMemo(()=>Array.from({length:Math.ceil(60/f)},(e,o)=>o*f),[f]),_=e=>String(e).padStart(2,"0"),j=c?w.getHours()%12||12:w.getHours(),k=(n,r,a,i,m)=>e("div",{role:"listbox","aria-label":r,className:["mp-time-grid__column flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--_mp-cell)*7)] w-[calc(var(--_mp-cell)*1.75)]","scroll-py-0.5 [scrollbar-width:thin]"].join(" "),children:a.map(r=>{const a=((e,o)=>A(w,"hour"===e?{hours:c?o%12+(w.getHours()>=12?12:0):o}:"minute"===e?{minutes:o}:"second"===e?{seconds:o}:{hours:w.getHours()%12+12*o}))(n,r),d=null!==l&&i(r),p=g?.(a,n)??!1;return o("button",{type:"button",role:"option","aria-selected":d,"aria-disabled":p||void 0,"data-chosen":d?"true":void 0,className:[$,"rounded-mp-full h-(--_mp-cell) w-full shrink-0",h[t],p?"cursor-default text-mp-on-surface/38":d?"bg-(--_mp-accent) text-(--_mp-on-accent)":"text-mp-on-surface"].join(" "),onClick:()=>{p||s(a)},children:[p?null:e(u,{}),m(r)]},r)})},n);return o("div",{ref:b,className:"mp-time-grid flex gap-1",style:{"--_mp-cell":R[t]},children:[k("hour",y.hour,N,e=>e===j,e=>c?String(e):_(e)),k("minute",y.minute,M,e=>e===w.getMinutes(),_),i?k("second",y.second,P,e=>e===w.getSeconds(),_):null,c?k("meridiem",y.meridiem,[0,1],e=>(w.getHours()>=12?1:0)===e,e=>0===e?D:S):null,e("span",{className:p,"aria-live":"polite",children:null===l?"":x(r,{hour:"numeric",minute:"2-digit",...i?{second:"2-digit"}:{}}).format(l)})]})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPSize } from '../types';
|
|
2
|
+
import type { MPSize } from '../types.js';
|
|
3
3
|
export interface MPFieldOutlineProps {
|
|
4
4
|
/** The label, which is what cuts the notch. Without one the outline is closed. */
|
|
5
5
|
label?: React.ReactNode;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as r,Fragment as e,jsxs as t}from"react/jsx-runtime";import*as o from"react";import{Field as n}from"@base-ui/react/field";import{PROSE_TEXT as a}from"./scale.js";const i={xs:"left-1",sm:"left-2",md:"left-3",lg:"left-3",xl:"left-4"},s={xs:"top-[18px]",sm:"top-[18px]",md:"top-5",lg:"top-5",xl:"top-5"};function d(o,n){return t(e,{children:[o,n?r("span",{"aria-hidden":"true",children:" *"}):null]})}export function MPFieldOutline({label:e,required:t=!1,notched:o=!0}){return r("fieldset",{"aria-hidden":"true",className:["pointer-events-none absolute inset-0 -top-[5px] m-0 min-w-0 px-2 pt-0","rounded-mp-xs border border-mp-outline","transition-[border-color] duration-(--mp-sys-motion-duration-short4)","group-hover:border-mp-on-surface","group-focus-within:border-2 group-focus-within:border-mp-primary","group-data-focused:border-2 group-data-focused:border-mp-primary","group-data-invalid:border-mp-error","group-data-disabled:border-mp-on-surface/12"].join(" "),children:e?r("legend",{className:["text-mp-body-small invisible float-none block h-[11px] w-auto overflow-hidden p-0","leading-none","ease-mp-standard transition-[max-width,padding]","duration-(--mp-sys-motion-duration-short4)",o?"max-w-full px-1":"max-w-0 px-0"].join(" "),children:d(e,t)}):null})}export function MPFieldLabel({size:e,label:t,required:o=!1,htmlFor:p,shrunk:l=!0,multiline:u=!1}){return r(n.Label,{htmlFor:p,"data-mp-shrunk":l?"":void 0,className:["text-mp-on-surface-variant","ease-mp-standard transition-[color,top,font-size,max-width]","duration-(--mp-sys-motion-duration-short4)","absolute -translate-y-1/2 px-1 leading-none",i[e],l?"text-mp-body-small pointer-events-auto top-0 max-w-none":[a[e],"pointer-events-none max-w-[calc(100%-2rem)] truncate",u?s[e]:"top-1/2"].join(" "),"group-focus-within:text-mp-primary","group-data-focused:text-mp-primary","group-data-invalid:text-mp-error","group-data-disabled:text-mp-on-surface/38"].join(" "),children:d(t,o)})}export function useFloatingLabel({floating:r,filled:e,pinned:t=!1}){const[n,a]=o.useState(!1);return{shrunk:!r||e||n||t,focusProps:{onFocusCapture:()=>a(!0),onBlurCapture:r=>{r.currentTarget.contains(r.relatedTarget)||a(!1)}}}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { MPPickerLabels } from './Calendar';
|
|
3
|
-
import type { MPColor, MPSize, MPStyleProps } from '../types';
|
|
2
|
+
import type { MPPickerLabels } from './Calendar.js';
|
|
3
|
+
import type { MPColor, MPSize, MPStyleProps } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The strings a trigger is held open by, kept across renders that did not
|
|
6
6
|
* change what it could say.
|
package/dist/internal/Picker.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as i from"react";import{Field as n}from"@base-ui/react/field";import{Popover as t}from"@base-ui/react/popover";import{MPIcon as o}from"../components/icon/MPIcon.js";import{CloseIcon as a}from"../constants/icons.js";import{accentSlots as s}from"./accent.js";import{MPFieldLabel as l,MPFieldOutline as p,useFloatingLabel as c}from"./FieldOutline.js";import{MPStateLayer as m}from"./StateLayer.js";import{MPSupportingText as d}from"./SupportingText.js";import{MPWidthSizer as u}from"./WidthSizer.js";import{displaySamples as f}from"./date.js";import{CONTROL_ICON as h,hasContent as g,PROSE_TEXT as x}from"./scale.js";import{FADE as b,PORTAL_LAYER as j}from"./surface.js";export function useDisplaySamples(e,r){const n=`${e??""} ${JSON.stringify(r)}`;return i.useMemo(()=>f(e,r),[n])}const v={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"}},y={xs:"p-1.5",sm:"p-2",md:"p-2.5",lg:"p-3",xl:"p-3.5"};export function MPPickerShell({slug:f,size:N="md",color:P="primary",fullWidth:w=!1,label:O,floatingLabel:k=!0,description:M,errorMessage:S,startIcon:z,required:F=!1,disabled:B=!1,readOnly:C=!1,id:I,className:R,style:$,display:q,samples:T,empty:_,clearable:D=!1,onClear:E,open:L,onOpenChange:W,labels:J,hiddenValues:V,children:Z,triggerRef:A}){const G=g(S),H=v[N],K=i.useId(),Q=I??K,U=D&&!_&&!(B||C),{shrunk:X,focusProps:Y}=c({floating:k&&g(O),filled:!_,pinned:L||g(z)});return r(n.Root,{disabled:B,invalid:G,"data-mp-size":N,className:[`mp-${f} group flex-col align-top`,w?"flex w-full":"inline-flex w-fit",R??""].filter(Boolean).join(" "),style:{...s(P),...$},...Y,children:[r(t.Root,{open:L,onOpenChange:W,children:[r("div",{className:"relative w-full",children:[r(t.Trigger,{id:Q,ref:A,disabled:B,nativeButton:!0,className:["relative flex w-full items-center gap-2 select-none","appearance-none bg-transparent font-[inherit] outline-none",H.padding,U?"pe-10":"",H.height,x[N],B?"text-mp-on-surface/38 cursor-default":"text-mp-on-surface "+(C?"cursor-default":"cursor-pointer")].filter(Boolean).join(" "),children:[z?e("span",{className:["flex shrink-0 items-center",B?"text-mp-on-surface/38":"text-mp-on-surface-variant"].join(" "),children:z}):null,r("span",{className:"flex min-w-0 flex-1 flex-col",children:[e("span",{className:["w-full truncate text-start",_&&!B?"text-mp-on-surface-variant":""].filter(Boolean).join(" "),children:_&&!X?null:q}),e(u,{samples:T??[]})]})]}),U?r("button",{type:"button","aria-label":J.clear,onClick:E,className:["group/clear rounded-mp-full text-mp-on-surface-variant absolute inset-y-0","end-1 my-auto flex size-8 cursor-pointer items-center justify-center","appearance-none border-0 bg-transparent font-[inherit]","outline-mp-secondary focus-visible:outline-2 focus-visible:outline-offset-1","focus-visible:outline-solid outline-none"].join(" "),children:[e(m,{className:"group-hover/clear:opacity-8 group-focus-visible/clear:opacity-10"}),e(o,{icon:a,size:h[N]})]}):null,e(p,{label:O,required:F,notched:X}),g(O)?e(l,{size:N,label:O,required:F,htmlFor:Q,shrunk:X}):null]}),e(t.Portal,{children:e(t.Positioner,{className:j,sideOffset:4,align:"start",children:e(t.Popup,{initialFocus:!1,className:[`mp-${f}__popup rounded-mp-md shadow-mp-2 bg-mp-surface-container`,"text-mp-on-surface outline-none",y[N],x[N],b].join(" "),children:Z})})})]}),e(d,{description:M,errorMessage:S,className:H.padding}),V?.map((r,i)=>e("input",{type:"hidden",name:r.name,value:r.value},i))]})}export function MPPickerFooter({children:r}){return e("div",{className:"border-mp-outline-variant flex items-center justify-end gap-1 border-t pt-1.5",children:r})}export function MPPickerDivider(){return e("div",{"aria-hidden":"true",className:"bg-mp-outline-variant w-px self-stretch"})}export const FOOTER_SIZE={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import{jsx as o}from"react/jsx-runtime";export function MPStateLayer({layer:t="inset-0 rounded-[inherit] bg-current",className:a}){return o("span",{"aria-hidden":"true",className:["pointer-events-none absolute opacity-0",t,"transition-opacity duration-(--mp-sys-motion-duration-short4)","group-hover:opacity-8","group-active:opacity-10","group-focus-visible:opacity-10","group-disabled:opacity-0 group-data-disabled:opacity-0",a??""].filter(Boolean).join(" ")})}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{Field as e}from"@base-ui/react/field";import{META_TEXT as t,hasContent as o}from"./scale.js";export function MPSupportingText({description:a,errorMessage:s,className:i}){const n=["mp-supporting-text block",t,"data-disabled:text-mp-on-surface/38",i??""].filter(Boolean).join(" ");return o(s)?r(e.Error,{match:!0,className:`${n} text-mp-error`,children:s}):o(a)?r(e.Description,{className:`${n} text-mp-on-surface-variant`,children:a}):null}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import{jsx as e}from"react/jsx-runtime";export function MPWidthSizer({samples:a}){return 0===a.length?null:e("span",{"aria-hidden":"true",className:"invisible h-0 min-h-0 overflow-hidden",children:a.map((a,n)=>e("span",{"data-sample":a,className:"block whitespace-nowrap before:content-[attr(data-sample)]"},`${n}:${a}`))})}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* source colour scoped to a section, is what the component resolves against.
|
|
28
28
|
*/
|
|
29
29
|
import type * as React from 'react';
|
|
30
|
-
import type { MPColor } from '../types';
|
|
30
|
+
import type { MPColor } from '../types.js';
|
|
31
31
|
/**
|
|
32
32
|
* The four roles an accent family has, pointed at one of the four families.
|
|
33
33
|
*
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
* and their logic stays in their own files.
|
|
39
39
|
*/
|
|
40
40
|
import * as React from 'react';
|
|
41
|
-
import type { MPAnimateMode, MPAnimateRepeat, MPAnimateTrigger, MPAnimation, MPEasing, MPSide } from '../types';
|
|
41
|
+
import type { MPAnimateMode, MPAnimateRepeat, MPAnimateTrigger, MPAnimation, MPEasing, MPSide } from '../types.js';
|
|
42
42
|
/** The class that reads the slots. Always paired with one of the below. */
|
|
43
43
|
export declare const ANIM_BASE = "mp-anim";
|
|
44
44
|
/**
|
package/dist/internal/animate.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import*as e from"react";export const ANIM_BASE="mp-anim";export const ANIMATION_CLASS={fade:"mp-anim-fade",grow:"mp-anim-scale",slide:"mp-anim-slide",zoom:"mp-anim-scale",rotate:"mp-anim-rotate",blink:"mp-anim-blink"};const n={fade:{in:"medium2",out:"short4"},grow:{in:"medium4",out:"short4"},slide:{in:"medium4",out:"short4"},zoom:{in:"medium4",out:"short4"},rotate:{in:"long2",out:"medium2"},blink:{in:"extra-long4",out:"extra-long4"}},t={fade:"emphasized-decelerate",grow:"emphasized-decelerate",slide:"emphasized-decelerate",zoom:"emphasized-decelerate",rotate:"emphasized-decelerate",blink:"standard"};export function easingValue(e){return`var(--mp-sys-motion-easing-${e})`}export function durationValue(e,t,i="in"){return void 0!==e?`${e}ms`:`var(--mp-sys-motion-duration-${n[t][i]})`}export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}export function directionValue(e,n){return"out"===e?n?"alternate-reverse":"reverse":n?"alternate":"normal"}export function animationSlots(e){const n=e.mode??"in",i={"--_mp-anim-duration":durationValue(e.duration,e.effect,n),"--_mp-anim-delay":`${e.delay}ms`,"--_mp-anim-ease":easingValue(e.easing??t[e.effect]),"--_mp-anim-repeat":repeatValue(e.repeat),"--_mp-anim-direction":directionValue(n,e.alternate)};return void 0!==e.opacity&&(i["--_mp-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(i["--_mp-anim-scale"]=String(e.scale)),void 0!==e.x&&(i["--_mp-anim-x"]=e.x),void 0!==e.y&&(i["--_mp-anim-y"]=e.y),void 0!==e.angle&&(i["--_mp-anim-angle"]=e.angle),void 0!==e.angleTo&&(i["--_mp-anim-angle-to"]=e.angleTo),i}export function slideOffsets(e,n){const t=lengthValue(n),i="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:i};case"bottom":return{x:"0px",y:t};case"left":return{x:i,y:"0px"};default:return{x:t,y:"0px"}}}const i="(prefers-reduced-motion: reduce)";function a(e){if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia(i);return n.addEventListener("change",e),()=>n.removeEventListener("change",e)}function r(){return!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(i).matches}function o(){return!1}export function usePrefersReducedMotion(){return e.useSyncExternalStore(a,r,o)}export function useAnimationRun({trigger:n,play:t,once:i,threshold:a,paused:r,infinite:o}){const s=e.useRef(null),[u,m]=e.useState("mount"===n),[c,d]=e.useState(0),l=e.useCallback(()=>{m(!0),d(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=s.current;if(!e||0===c)return;const n=[e,...e.querySelectorAll(".mp-anim, .mp-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[c]),e.useEffect(()=>{if("visible"!==n)return;const e=s.current;if(!e||"undefined"==typeof IntersectionObserver)return void m(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(l(),i&&t.disconnect()):i||m(!1)},{threshold:a});return t.observe(e),()=>t.disconnect()},[n,i,a,l]),e.useEffect(()=>{"manual"===n&&(t?l():m(!1))},[n,t,l]);const p=e.useCallback(()=>{o&&m(!1)},[o]),f="hover"===n?{onPointerEnter:l,onFocus:l,onPointerLeave:p,onBlur:p}:{};return{ref:e.useCallback(e=>{s.current=e},[]),state:u&&!r?"running":"paused",started:u,handlers:f}}export function useAnimateElement(e){const{trigger:n,play:t,once:i,threshold:a,paused:r,infinite:o,...s}=e,u=useAnimationRun({trigger:n,play:t,once:i,threshold:a,paused:r,infinite:o});return{ref:u.ref,className:`mp-anim ${ANIMATION_CLASS[s.effect]}`,style:{...animationSlots(s),"--_mp-anim-state":u.state},props:{...u.handlers,"data-mp-animation":s.effect,"data-mp-state":u.state}}}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* meaning "use the button's own default" rather than turning into one.
|
|
12
12
|
*/
|
|
13
13
|
import * as React from 'react';
|
|
14
|
-
import type { MPColor, MPSize, MPVariant } from '../types';
|
|
14
|
+
import type { MPColor, MPSize, MPVariant } from '../types.js';
|
|
15
15
|
export interface MPButtonGroupContextValue {
|
|
16
16
|
variant?: MPVariant;
|
|
17
17
|
size?: MPSize;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import*as t from"react";export const MPButtonGroupContext=/*@__PURE__*/t.createContext(null);
|
package/dist/internal/date.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* Nothing here is exported from `src/index.ts`. It is the library talking to
|
|
23
23
|
* itself, in the sense `internal/` always means.
|
|
24
24
|
*/
|
|
25
|
-
import type { MPWeekday } from '../types';
|
|
25
|
+
import type { MPWeekday } from '../types.js';
|
|
26
26
|
/** Which unit the calendar is currently letting you pick. */
|
|
27
27
|
export type MPCalendarView = 'day' | 'month' | 'year';
|
|
28
28
|
/** How many years one page of the year grid holds. Four columns of three. */
|
package/dist/internal/i18n.d.ts
CHANGED
|
@@ -20,11 +20,36 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Every component that reads this takes a `locale` and an override prop for the
|
|
22
22
|
* strings themselves, so an unsupported language is never a dead end: `locale`
|
|
23
|
-
* gets you a translation
|
|
23
|
+
* gets you a translation, `MPLocaleProvider` gets you one for the whole
|
|
24
24
|
* application at once, and the prop gets you one for anything else.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* ## Where the words themselves are
|
|
27
|
+
*
|
|
28
|
+
* Not here. This file is the shape of the table, the registry a translation
|
|
29
|
+
* arrives through, and the merge — no strings.
|
|
30
|
+
*
|
|
31
|
+
* The eighteen translations live under `src/locales/`, and nothing in the
|
|
32
|
+
* library imports them. They used to be here, and being here is what made them
|
|
33
|
+
* cost something: a component that says one word — `MPButton` says *Loading* —
|
|
34
|
+
* held a static import chain down to a table of every string in every language,
|
|
35
|
+
* and a bundler cannot drop data that something imports. Twenty kilobytes, on
|
|
36
|
+
* every consumer, for a word. So the table arrives from the outside instead:
|
|
37
|
+
* `registerMPMessages` below is how, `material-plus-ui/locales` is where from,
|
|
38
|
+
* and the only thing that changed for a reader is that the application now names
|
|
39
|
+
* the languages it speaks. Once it has, `locale="ko"` resolves through exactly
|
|
40
|
+
* the path it always did.
|
|
41
|
+
*
|
|
42
|
+
* English left too, for the same reason one step smaller. It is nine modules
|
|
43
|
+
* under `internal/messages/`, one per namespace, because a bundler that can drop
|
|
44
|
+
* a module it can also drop an export — and cannot drop a property. Held as one
|
|
45
|
+
* object, English was 1.75 kB that every component carried whole: `MPButton`
|
|
46
|
+
* shipped the calendar's eighteen strings to say *Loading*. `resolveNamespace`
|
|
47
|
+
* is handed the namespace it should merge, so a component pays for the words it
|
|
48
|
+
* speaks and no others.
|
|
49
|
+
*
|
|
50
|
+
* The public surface is `registerMPMessages`, `MPLocaleProvider` and the
|
|
51
|
+
* per-component `labels` props; `resolveNamespace` and `fillMessage` stay
|
|
52
|
+
* internal.
|
|
28
53
|
*/
|
|
29
54
|
/**
|
|
30
55
|
* One namespace per component, rather than one flat list of keys.
|
|
@@ -210,8 +235,73 @@ export interface MPMessages {
|
|
|
210
235
|
notice: string;
|
|
211
236
|
};
|
|
212
237
|
}
|
|
238
|
+
/** A translation may fill in as much or as little of the table as it has. */
|
|
239
|
+
export type MPPartialMessages = {
|
|
240
|
+
[Namespace in keyof MPMessages]?: Partial<MPMessages[Namespace]>;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* One language, ready to be handed to `registerMPMessages`.
|
|
244
|
+
*
|
|
245
|
+
* The tag travels with the table rather than beside it, so registering is
|
|
246
|
+
* `registerMPMessages(ko)` and not `registerMPMessages('ko', ko)` — one
|
|
247
|
+
* argument that cannot disagree with itself, and a shape an application can
|
|
248
|
+
* write by hand for a language this library does not ship.
|
|
249
|
+
*/
|
|
250
|
+
export interface MPLocale {
|
|
251
|
+
/**
|
|
252
|
+
* The BCP 47 tag this table answers to, lowercased on the way in.
|
|
253
|
+
*
|
|
254
|
+
* Broad rather than narrow: `pt` serves a reader who asked for `pt-BR`, and a
|
|
255
|
+
* table registered as `pt-BR` would not serve one who asked for `pt`.
|
|
256
|
+
*/
|
|
257
|
+
locale: string;
|
|
258
|
+
/**
|
|
259
|
+
* Other tags that should resolve to this same table.
|
|
260
|
+
*
|
|
261
|
+
* What `zh-hant` uses to answer for `zh-TW`, `zh-HK` and `zh-MO`: the same
|
|
262
|
+
* characters under three names, held once. An alias is registered with the
|
|
263
|
+
* table and disappears with it.
|
|
264
|
+
*/
|
|
265
|
+
aliases?: string[];
|
|
266
|
+
/** The strings. Anything left out falls back to English, a namespace at a time. */
|
|
267
|
+
messages: MPPartialMessages;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* One namespace's English strings, carrying the name they answer to.
|
|
271
|
+
*
|
|
272
|
+
* The nine of them live in `internal/messages/`, one to a module, and a
|
|
273
|
+
* component imports the one it speaks. That is the whole reason this type
|
|
274
|
+
* exists: `resolveNamespace` below is handed the English table rather than
|
|
275
|
+
* looking it up, so the eight tables a component does not use are eight modules
|
|
276
|
+
* nothing imports.
|
|
277
|
+
*
|
|
278
|
+
* The name travels with the strings rather than beside them, so a call site is
|
|
279
|
+
* `useMPMessages(PICKER, locale)` and cannot name one namespace while passing
|
|
280
|
+
* another's words.
|
|
281
|
+
*/
|
|
282
|
+
export interface MPNamespace<Name extends keyof MPMessages> {
|
|
283
|
+
/** The key this namespace occupies in `MPMessages` and in a translation. */
|
|
284
|
+
readonly name: Name;
|
|
285
|
+
/** English, which every other language is merged over. */
|
|
286
|
+
readonly en: MPMessages[Name];
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Teaches the library a language.
|
|
290
|
+
*
|
|
291
|
+
* Variadic because registering one is the common case and registering four is
|
|
292
|
+
* the next one, and neither should need a loop at the call site. Call it once,
|
|
293
|
+
* at startup, before anything renders: it is module-level state, and a table
|
|
294
|
+
* that arrives after a component has already resolved its strings would be a
|
|
295
|
+
* table that only takes effect at the next re-render.
|
|
296
|
+
*
|
|
297
|
+
* Registering a tag that is already registered replaces it, which is what makes
|
|
298
|
+
* `registerMPMessages({ locale: 'ko', messages: { common: { close: '나가기' } } })`
|
|
299
|
+
* a workable way to correct one word without forking a file — although a
|
|
300
|
+
* component's own `labels` prop is the lighter tool for that.
|
|
301
|
+
*/
|
|
302
|
+
export declare function registerMPMessages(...locales: MPLocale[]): void;
|
|
213
303
|
/**
|
|
214
|
-
*
|
|
304
|
+
* One namespace's strings for a locale, merged over English.
|
|
215
305
|
*
|
|
216
306
|
* `undefined` is English rather than the runtime's own locale, and that is
|
|
217
307
|
* deliberate: `navigator.language` differs between the server that renders the
|
|
@@ -220,11 +310,16 @@ export interface MPMessages {
|
|
|
220
310
|
* at. A component that should follow the reader is *told* which language to
|
|
221
311
|
* follow — by its own `locale` prop, or by an `MPLocaleProvider` above it.
|
|
222
312
|
*
|
|
313
|
+
* A namespace at a time, so a language that has one and not another keeps
|
|
314
|
+
* English for the rest rather than losing both. That was already how the merge
|
|
315
|
+
* worked; what changed is that the namespaces are no longer merged all at once,
|
|
316
|
+
* because a component that reads one of them should not carry the other eight.
|
|
317
|
+
*
|
|
223
318
|
* Note that this is only about the words in the table. The dates themselves are
|
|
224
319
|
* formatted by `Intl` against the same tag, and `Intl` speaks every language the
|
|
225
320
|
* platform does whether or not there is an entry here.
|
|
226
321
|
*/
|
|
227
|
-
export declare function
|
|
322
|
+
export declare function resolveNamespace<Name extends keyof MPMessages>(namespace: MPNamespace<Name>, locale?: string): MPMessages[Name];
|
|
228
323
|
/**
|
|
229
324
|
* A message with its placeholders filled in.
|
|
230
325
|
*
|
package/dist/internal/i18n.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={common:{close:"Close",clear:"Clear",open:"Open",remove:"Remove",removeNamed:"Remove {label}",loading:"Loading"},textField:{showPassword:"Show the password",hidePassword:"Hide the password"},empty:{title:"Nothing here"},picker:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"},alert:{dismiss:"Dismiss"},chat:{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing"},spoiler:{reveal:"Reveal",hide:"Hide",notice:"Hidden so it is not read by accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"},rating:{label:"Rating",value:"{value} out of {max}",empty:"Not rated"}},a={ko:{common:{close:"닫기",clear:"지우기",open:"열기",remove:"제거",removeNamed:"{label} 제거",loading:"불러오는 중"},textField:{showPassword:"비밀번호 표시",hidePassword:"비밀번호 숨기기"},empty:{title:"아무것도 없습니다"},picker:{previousMonth:"이전 달",nextMonth:"다음 달",previousYear:"이전 해",nextYear:"다음 해",previousYears:"이전 연도 목록",nextYears:"다음 연도 목록",chooseMonth:"월 선택",chooseYear:"연도 선택",today:"오늘",now:"지금",clear:"지우기",done:"완료",hour:"시",minute:"분",second:"초",meridiem:"오전/오후",start:"시작",end:"종료"},alert:{dismiss:"닫기"},chat:{sending:"보내는 중",sent:"보냄",delivered:"전달됨",read:"읽음",failed:"전송 실패",typing:"입력 중"},spoiler:{reveal:"보기",hide:"가리기",notice:"실수로 읽지 않도록 가려 두었습니다"},pagination:{label:"페이지 매기기",page:"{page}페이지",status:"{total}페이지 중 {page}페이지",previous:"이전 페이지",next:"다음 페이지",first:"첫 페이지",last:"마지막 페이지"},rating:{label:"별점",value:"{max}점 만점에 {value}점",empty:"평가 없음"}},ja:{common:{close:"閉じる",clear:"クリア",open:"開く",remove:"削除",removeNamed:"{label} を削除",loading:"読み込み中"},textField:{showPassword:"パスワードを表示",hidePassword:"パスワードを非表示"},empty:{title:"何もありません"},picker:{previousMonth:"前の月",nextMonth:"次の月",previousYear:"前の年",nextYear:"次の年",previousYears:"前の年の一覧",nextYears:"次の年の一覧",chooseMonth:"月を選択",chooseYear:"年を選択",today:"今日",now:"現在",clear:"クリア",done:"完了",hour:"時",minute:"分",second:"秒",meridiem:"午前/午後",start:"開始",end:"終了"},alert:{dismiss:"閉じる"},chat:{sending:"送信中",sent:"送信済み",delivered:"配信済み",read:"既読",failed:"送信できませんでした",typing:"入力中"},spoiler:{reveal:"表示する",hide:"隠す",notice:"うっかり読まないように隠してあります"},pagination:{label:"ページ送り",page:"{page}ページ",status:"{total}ページ中{page}ページ",previous:"前のページ",next:"次のページ",first:"最初のページ",last:"最後のページ"},rating:{label:"評価",value:"{max}段階中{value}",empty:"未評価"}},"zh-hans":{common:{close:"关闭",clear:"清除",open:"打开",remove:"移除",removeNamed:"移除 {label}",loading:"加载中"},textField:{showPassword:"显示密码",hidePassword:"隐藏密码"},empty:{title:"暂无内容"},picker:{previousMonth:"上个月",nextMonth:"下个月",previousYear:"上一年",nextYear:"下一年",previousYears:"上一页年份",nextYears:"下一页年份",chooseMonth:"选择月份",chooseYear:"选择年份",today:"今天",now:"此刻",clear:"清除",done:"完成",hour:"小时",minute:"分钟",second:"秒",meridiem:"上午/下午",start:"开始",end:"结束"},alert:{dismiss:"关闭"},chat:{sending:"发送中",sent:"已发送",delivered:"已送达",read:"已读",failed:"未发送",typing:"正在输入"},spoiler:{reveal:"显示",hide:"隐藏",notice:"已隐藏,以免不小心读到"},pagination:{label:"分页",page:"第 {page} 页",status:"第 {page} 页,共 {total} 页",previous:"上一页",next:"下一页",first:"第一页",last:"最后一页"},rating:{label:"评分",value:"{max} 分中的 {value} 分",empty:"未评分"}},"zh-hant":{common:{close:"關閉",clear:"清除",open:"開啟",remove:"移除",removeNamed:"移除 {label}",loading:"載入中"},textField:{showPassword:"顯示密碼",hidePassword:"隱藏密碼"},empty:{title:"暫無內容"},picker:{previousMonth:"上個月",nextMonth:"下個月",previousYear:"上一年",nextYear:"下一年",previousYears:"上一頁年份",nextYears:"下一頁年份",chooseMonth:"選擇月份",chooseYear:"選擇年份",today:"今天",now:"此刻",clear:"清除",done:"完成",hour:"小時",minute:"分鐘",second:"秒",meridiem:"上午/下午",start:"開始",end:"結束"},alert:{dismiss:"關閉"},chat:{sending:"傳送中",sent:"已傳送",delivered:"已送達",read:"已讀",failed:"未傳送",typing:"正在輸入"},spoiler:{reveal:"顯示",hide:"隱藏",notice:"已隱藏,以免不小心讀到"},pagination:{label:"分頁",page:"第 {page} 頁",status:"第 {page} 頁,共 {total} 頁",previous:"上一頁",next:"下一頁",first:"第一頁",last:"最後一頁"},rating:{label:"評分",value:"{max} 分中的 {value} 分",empty:"未評分"}},es:{common:{close:"Cerrar",clear:"Borrar",open:"Abrir",remove:"Quitar",removeNamed:"Quitar {label}",loading:"Cargando"},textField:{showPassword:"Mostrar la contraseña",hidePassword:"Ocultar la contraseña"},empty:{title:"No hay nada aquí"},picker:{previousMonth:"Mes anterior",nextMonth:"Mes siguiente",previousYear:"Año anterior",nextYear:"Año siguiente",previousYears:"Años anteriores",nextYears:"Años siguientes",chooseMonth:"Elegir un mes",chooseYear:"Elegir un año",today:"Hoy",now:"Ahora",clear:"Borrar",done:"Listo",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"a. m./p. m.",start:"Inicio",end:"Fin"},alert:{dismiss:"Cerrar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregado",read:"Leído",failed:"No enviado",typing:"Escribiendo"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para que no se lea por accidente"},pagination:{label:"Paginación",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Página siguiente",first:"Primera página",last:"Última página"},rating:{label:"Valoración",value:"{value} de {max}",empty:"Sin valorar"}},pt:{common:{close:"Fechar",clear:"Limpar",open:"Abrir",remove:"Remover",removeNamed:"Remover {label}",loading:"Carregando"},textField:{showPassword:"Mostrar a senha",hidePassword:"Ocultar a senha"},empty:{title:"Não há nada aqui"},picker:{previousMonth:"Mês anterior",nextMonth:"Próximo mês",previousYear:"Ano anterior",nextYear:"Próximo ano",previousYears:"Anos anteriores",nextYears:"Próximos anos",chooseMonth:"Escolher um mês",chooseYear:"Escolher um ano",today:"Hoje",now:"Agora",clear:"Limpar",done:"Concluído",hour:"Hora",minute:"Minuto",second:"Segundo",meridiem:"AM/PM",start:"Início",end:"Fim"},alert:{dismiss:"Fechar"},chat:{sending:"Enviando",sent:"Enviado",delivered:"Entregue",read:"Lido",failed:"Não enviado",typing:"Digitando"},spoiler:{reveal:"Mostrar",hide:"Ocultar",notice:"Oculto para não ser lido por acidente"},pagination:{label:"Paginação",page:"Página {page}",status:"Página {page} de {total}",previous:"Página anterior",next:"Próxima página",first:"Primeira página",last:"Última página"},rating:{label:"Avaliação",value:"{value} de {max}",empty:"Sem avaliação"}},fr:{common:{close:"Fermer",clear:"Effacer",open:"Ouvrir",remove:"Supprimer",removeNamed:"Supprimer {label}",loading:"Chargement"},textField:{showPassword:"Afficher le mot de passe",hidePassword:"Masquer le mot de passe"},empty:{title:"Il n'y a rien ici"},picker:{previousMonth:"Mois précédent",nextMonth:"Mois suivant",previousYear:"Année précédente",nextYear:"Année suivante",previousYears:"Années précédentes",nextYears:"Années suivantes",chooseMonth:"Choisir un mois",chooseYear:"Choisir une année",today:"Aujourd'hui",now:"Maintenant",clear:"Effacer",done:"Terminé",hour:"Heure",minute:"Minute",second:"Seconde",meridiem:"AM/PM",start:"Début",end:"Fin"},alert:{dismiss:"Fermer"},chat:{sending:"Envoi en cours",sent:"Envoyé",delivered:"Distribué",read:"Lu",failed:"Non envoyé",typing:"En train d'écrire"},spoiler:{reveal:"Afficher",hide:"Masquer",notice:"Masqué pour ne pas être lu par accident"},pagination:{label:"Pagination",page:"Page {page}",status:"Page {page} sur {total}",previous:"Page précédente",next:"Page suivante",first:"Première page",last:"Dernière page"},rating:{label:"Note",value:"{value} sur {max}",empty:"Non noté"}},de:{common:{close:"Schließen",clear:"Löschen",open:"Öffnen",remove:"Entfernen",removeNamed:"{label} entfernen",loading:"Wird geladen"},textField:{showPassword:"Passwort anzeigen",hidePassword:"Passwort verbergen"},empty:{title:"Nichts vorhanden"},picker:{previousMonth:"Voriger Monat",nextMonth:"Nächster Monat",previousYear:"Voriges Jahr",nextYear:"Nächstes Jahr",previousYears:"Vorige Jahre",nextYears:"Nächste Jahre",chooseMonth:"Monat auswählen",chooseYear:"Jahr auswählen",today:"Heute",now:"Jetzt",clear:"Löschen",done:"Fertig",hour:"Stunde",minute:"Minute",second:"Sekunde",meridiem:"AM/PM",start:"Beginn",end:"Ende"},alert:{dismiss:"Schließen"},chat:{sending:"Wird gesendet",sent:"Gesendet",delivered:"Zugestellt",read:"Gelesen",failed:"Nicht gesendet",typing:"Schreibt"},spoiler:{reveal:"Anzeigen",hide:"Verbergen",notice:"Verborgen, damit es nicht versehentlich gelesen wird"},pagination:{label:"Seitennummerierung",page:"Seite {page}",status:"Seite {page} von {total}",previous:"Vorherige Seite",next:"Nächste Seite",first:"Erste Seite",last:"Letzte Seite"},rating:{label:"Bewertung",value:"{value} von {max}",empty:"Nicht bewertet"}},it:{common:{close:"Chiudi",clear:"Cancella",open:"Apri",remove:"Rimuovi",removeNamed:"Rimuovi {label}",loading:"Caricamento"},textField:{showPassword:"Mostra la password",hidePassword:"Nascondi la password"},empty:{title:"Non c'è nulla qui"},picker:{previousMonth:"Mese precedente",nextMonth:"Mese successivo",previousYear:"Anno precedente",nextYear:"Anno successivo",previousYears:"Anni precedenti",nextYears:"Anni successivi",chooseMonth:"Scegli un mese",chooseYear:"Scegli un anno",today:"Oggi",now:"Adesso",clear:"Cancella",done:"Fatto",hour:"Ora",minute:"Minuto",second:"Secondo",meridiem:"AM/PM",start:"Inizio",end:"Fine"},alert:{dismiss:"Chiudi"},chat:{sending:"Invio in corso",sent:"Inviato",delivered:"Consegnato",read:"Letto",failed:"Non inviato",typing:"Sta scrivendo"},spoiler:{reveal:"Mostra",hide:"Nascondi",notice:"Nascosto per non essere letto per sbaglio"},pagination:{label:"Impaginazione",page:"Pagina {page}",status:"Pagina {page} di {total}",previous:"Pagina precedente",next:"Pagina successiva",first:"Prima pagina",last:"Ultima pagina"},rating:{label:"Valutazione",value:"{value} su {max}",empty:"Non valutato"}},nl:{common:{close:"Sluiten",clear:"Wissen",open:"Openen",remove:"Verwijderen",removeNamed:"{label} verwijderen",loading:"Laden"},textField:{showPassword:"Wachtwoord tonen",hidePassword:"Wachtwoord verbergen"},empty:{title:"Hier is niets"},picker:{previousMonth:"Vorige maand",nextMonth:"Volgende maand",previousYear:"Vorig jaar",nextYear:"Volgend jaar",previousYears:"Vorige jaren",nextYears:"Volgende jaren",chooseMonth:"Kies een maand",chooseYear:"Kies een jaar",today:"Vandaag",now:"Nu",clear:"Wissen",done:"Klaar",hour:"Uur",minute:"Minuut",second:"Seconde",meridiem:"AM/PM",start:"Begin",end:"Einde"},alert:{dismiss:"Sluiten"},chat:{sending:"Verzenden",sent:"Verzonden",delivered:"Bezorgd",read:"Gelezen",failed:"Niet verzonden",typing:"Aan het typen"},spoiler:{reveal:"Tonen",hide:"Verbergen",notice:"Verborgen zodat het niet per ongeluk wordt gelezen"},pagination:{label:"Paginering",page:"Pagina {page}",status:"Pagina {page} van {total}",previous:"Vorige pagina",next:"Volgende pagina",first:"Eerste pagina",last:"Laatste pagina"},rating:{label:"Beoordeling",value:"{value} van {max}",empty:"Niet beoordeeld"}},pl:{common:{close:"Zamknij",clear:"Wyczyść",open:"Otwórz",remove:"Usuń",removeNamed:"Usuń {label}",loading:"Ładowanie"},textField:{showPassword:"Pokaż hasło",hidePassword:"Ukryj hasło"},empty:{title:"Nic tu nie ma"},picker:{previousMonth:"Poprzedni miesiąc",nextMonth:"Następny miesiąc",previousYear:"Poprzedni rok",nextYear:"Następny rok",previousYears:"Poprzednie lata",nextYears:"Następne lata",chooseMonth:"Wybierz miesiąc",chooseYear:"Wybierz rok",today:"Dzisiaj",now:"Teraz",clear:"Wyczyść",done:"Gotowe",hour:"Godzina",minute:"Minuta",second:"Sekunda",meridiem:"AM/PM",start:"Początek",end:"Koniec"},alert:{dismiss:"Zamknij"},chat:{sending:"Wysyłanie",sent:"Wysłano",delivered:"Dostarczono",read:"Przeczytano",failed:"Nie wysłano",typing:"Pisze"},spoiler:{reveal:"Pokaż",hide:"Ukryj",notice:"Ukryte, aby nie przeczytać przez przypadek"},pagination:{label:"Paginacja",page:"Strona {page}",status:"Strona {page} z {total}",previous:"Poprzednia strona",next:"Następna strona",first:"Pierwsza strona",last:"Ostatnia strona"},rating:{label:"Ocena",value:"{value} z {max}",empty:"Brak oceny"}},ru:{common:{close:"Закрыть",clear:"Очистить",open:"Открыть",remove:"Удалить",removeNamed:"Удалить {label}",loading:"Загрузка"},textField:{showPassword:"Показать пароль",hidePassword:"Скрыть пароль"},empty:{title:"Здесь ничего нет"},picker:{previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",previousYear:"Предыдущий год",nextYear:"Следующий год",previousYears:"Предыдущие годы",nextYears:"Следующие годы",chooseMonth:"Выбрать месяц",chooseYear:"Выбрать год",today:"Сегодня",now:"Сейчас",clear:"Очистить",done:"Готово",hour:"Часы",minute:"Минуты",second:"Секунды",meridiem:"ДП/ПП",start:"Начало",end:"Конец"},alert:{dismiss:"Закрыть"},chat:{sending:"Отправка",sent:"Отправлено",delivered:"Доставлено",read:"Прочитано",failed:"Не отправлено",typing:"Печатает"},spoiler:{reveal:"Показать",hide:"Скрыть",notice:"Скрыто, чтобы не прочитать случайно"},pagination:{label:"Постраничная навигация",page:"Страница {page}",status:"Страница {page} из {total}",previous:"Предыдущая страница",next:"Следующая страница",first:"Первая страница",last:"Последняя страница"},rating:{label:"Оценка",value:"{value} из {max}",empty:"Без оценки"}},tr:{common:{close:"Kapat",clear:"Temizle",open:"Aç",remove:"Kaldır",removeNamed:"{label} kaldır",loading:"Yükleniyor"},textField:{showPassword:"Parolayı göster",hidePassword:"Parolayı gizle"},empty:{title:"Burada bir şey yok"},picker:{previousMonth:"Önceki ay",nextMonth:"Sonraki ay",previousYear:"Önceki yıl",nextYear:"Sonraki yıl",previousYears:"Önceki yıllar",nextYears:"Sonraki yıllar",chooseMonth:"Ay seçin",chooseYear:"Yıl seçin",today:"Bugün",now:"Şimdi",clear:"Temizle",done:"Tamam",hour:"Saat",minute:"Dakika",second:"Saniye",meridiem:"ÖÖ/ÖS",start:"Başlangıç",end:"Bitiş"},alert:{dismiss:"Kapat"},chat:{sending:"Gönderiliyor",sent:"Gönderildi",delivered:"İletildi",read:"Okundu",failed:"Gönderilemedi",typing:"Yazıyor"},spoiler:{reveal:"Göster",hide:"Gizle",notice:"Yanlışlıkla okunmasın diye gizlendi"},pagination:{label:"Sayfalama",page:"Sayfa {page}",status:"{total} sayfadan {page}. sayfa",previous:"Önceki sayfa",next:"Sonraki sayfa",first:"İlk sayfa",last:"Son sayfa"},rating:{label:"Değerlendirme",value:"{max} üzerinden {value}",empty:"Değerlendirilmedi"}},ar:{common:{close:"إغلاق",clear:"مسح",open:"فتح",remove:"إزالة",removeNamed:"إزالة {label}",loading:"جارٍ التحميل"},textField:{showPassword:"إظهار كلمة المرور",hidePassword:"إخفاء كلمة المرور"},empty:{title:"لا يوجد شيء هنا"},picker:{previousMonth:"الشهر السابق",nextMonth:"الشهر التالي",previousYear:"السنة السابقة",nextYear:"السنة التالية",previousYears:"السنوات السابقة",nextYears:"السنوات التالية",chooseMonth:"اختيار شهر",chooseYear:"اختيار سنة",today:"اليوم",now:"الآن",clear:"مسح",done:"تم",hour:"الساعة",minute:"الدقيقة",second:"الثانية",meridiem:"ص/م",start:"البداية",end:"النهاية"},alert:{dismiss:"إغلاق"},chat:{sending:"جارٍ الإرسال",sent:"تم الإرسال",delivered:"تم التسليم",read:"تمت القراءة",failed:"لم يتم الإرسال",typing:"يكتب الآن"},spoiler:{reveal:"إظهار",hide:"إخفاء",notice:"مخفي حتى لا يُقرأ بالخطأ"},pagination:{label:"ترقيم الصفحات",page:"الصفحة {page}",status:"الصفحة {page} من {total}",previous:"الصفحة السابقة",next:"الصفحة التالية",first:"الصفحة الأولى",last:"الصفحة الأخيرة"},rating:{label:"التقييم",value:"{value} من {max}",empty:"بدون تقييم"}},hi:{common:{close:"बंद करें",clear:"हटाएँ",open:"खोलें",remove:"निकालें",removeNamed:"{label} निकालें",loading:"लोड हो रहा है"},textField:{showPassword:"पासवर्ड दिखाएँ",hidePassword:"पासवर्ड छिपाएँ"},empty:{title:"यहाँ कुछ नहीं है"},picker:{previousMonth:"पिछला महीना",nextMonth:"अगला महीना",previousYear:"पिछला वर्ष",nextYear:"अगला वर्ष",previousYears:"पिछले वर्ष",nextYears:"अगले वर्ष",chooseMonth:"महीना चुनें",chooseYear:"वर्ष चुनें",today:"आज",now:"अभी",clear:"हटाएँ",done:"हो गया",hour:"घंटा",minute:"मिनट",second:"सेकंड",meridiem:"AM/PM",start:"प्रारंभ",end:"समाप्ति"},alert:{dismiss:"बंद करें"},chat:{sending:"भेजा जा रहा है",sent:"भेजा गया",delivered:"पहुँच गया",read:"पढ़ लिया गया",failed:"नहीं भेजा गया",typing:"टाइप कर रहे हैं"},spoiler:{reveal:"दिखाएँ",hide:"छिपाएँ",notice:"गलती से न पढ़ लिया जाए इसलिए छिपाया गया है"},pagination:{label:"पृष्ठ क्रमांकन",page:"पृष्ठ {page}",status:"{total} में से पृष्ठ {page}",previous:"पिछला पृष्ठ",next:"अगला पृष्ठ",first:"पहला पृष्ठ",last:"अंतिम पृष्ठ"},rating:{label:"रेटिंग",value:"{max} में से {value}",empty:"रेटिंग नहीं दी गई"}},id:{common:{close:"Tutup",clear:"Bersihkan",open:"Buka",remove:"Hapus",removeNamed:"Hapus {label}",loading:"Memuat"},textField:{showPassword:"Tampilkan kata sandi",hidePassword:"Sembunyikan kata sandi"},empty:{title:"Tidak ada apa-apa di sini"},picker:{previousMonth:"Bulan sebelumnya",nextMonth:"Bulan berikutnya",previousYear:"Tahun sebelumnya",nextYear:"Tahun berikutnya",previousYears:"Tahun-tahun sebelumnya",nextYears:"Tahun-tahun berikutnya",chooseMonth:"Pilih bulan",chooseYear:"Pilih tahun",today:"Hari ini",now:"Sekarang",clear:"Hapus",done:"Selesai",hour:"Jam",minute:"Menit",second:"Detik",meridiem:"AM/PM",start:"Mulai",end:"Akhir"},alert:{dismiss:"Tutup"},chat:{sending:"Mengirim",sent:"Terkirim",delivered:"Diterima",read:"Dibaca",failed:"Gagal terkirim",typing:"Sedang mengetik"},spoiler:{reveal:"Tampilkan",hide:"Sembunyikan",notice:"Disembunyikan agar tidak terbaca tanpa sengaja"},pagination:{label:"Penomoran halaman",page:"Halaman {page}",status:"Halaman {page} dari {total}",previous:"Halaman sebelumnya",next:"Halaman berikutnya",first:"Halaman pertama",last:"Halaman terakhir"},rating:{label:"Peringkat",value:"{value} dari {max}",empty:"Belum dinilai"}},vi:{common:{close:"Đóng",clear:"Xóa",open:"Mở",remove:"Gỡ bỏ",removeNamed:"Gỡ bỏ {label}",loading:"Đang tải"},textField:{showPassword:"Hiện mật khẩu",hidePassword:"Ẩn mật khẩu"},empty:{title:"Không có gì ở đây"},picker:{previousMonth:"Tháng trước",nextMonth:"Tháng sau",previousYear:"Năm trước",nextYear:"Năm sau",previousYears:"Các năm trước",nextYears:"Các năm sau",chooseMonth:"Chọn tháng",chooseYear:"Chọn năm",today:"Hôm nay",now:"Bây giờ",clear:"Xóa",done:"Xong",hour:"Giờ",minute:"Phút",second:"Giây",meridiem:"SA/CH",start:"Bắt đầu",end:"Kết thúc"},alert:{dismiss:"Đóng"},chat:{sending:"Đang gửi",sent:"Đã gửi",delivered:"Đã nhận",read:"Đã đọc",failed:"Chưa gửi được",typing:"Đang nhập"},spoiler:{reveal:"Hiện",hide:"Ẩn",notice:"Đã ẩn để không vô tình đọc phải"},pagination:{label:"Phân trang",page:"Trang {page}",status:"Trang {page} trên {total}",previous:"Trang trước",next:"Trang sau",first:"Trang đầu",last:"Trang cuối"},rating:{label:"Đánh giá",value:"{value} trên {max}",empty:"Chưa đánh giá"}},th:{common:{close:"ปิด",clear:"ล้าง",open:"เปิด",remove:"ลบ",removeNamed:"ลบ {label}",loading:"กำลังโหลด"},textField:{showPassword:"แสดงรหัสผ่าน",hidePassword:"ซ่อนรหัสผ่าน"},empty:{title:"ไม่มีอะไรที่นี่"},picker:{previousMonth:"เดือนก่อนหน้า",nextMonth:"เดือนถัดไป",previousYear:"ปีก่อนหน้า",nextYear:"ปีถัดไป",previousYears:"ชุดปีก่อนหน้า",nextYears:"ชุดปีถัดไป",chooseMonth:"เลือกเดือน",chooseYear:"เลือกปี",today:"วันนี้",now:"ตอนนี้",clear:"ล้าง",done:"เสร็จสิ้น",hour:"ชั่วโมง",minute:"นาที",second:"วินาที",meridiem:"AM/PM",start:"เริ่ม",end:"สิ้นสุด"},alert:{dismiss:"ปิด"},chat:{sending:"กำลังส่ง",sent:"ส่งแล้ว",delivered:"ส่งถึงแล้ว",read:"อ่านแล้ว",failed:"ส่งไม่สำเร็จ",typing:"กำลังพิมพ์"},spoiler:{reveal:"แสดง",hide:"ซ่อน",notice:"ซ่อนไว้เพื่อไม่ให้อ่านโดยบังเอิญ"},pagination:{label:"การแบ่งหน้า",page:"หน้า {page}",status:"หน้า {page} จาก {total}",previous:"หน้าก่อนหน้า",next:"หน้าถัดไป",first:"หน้าแรก",last:"หน้าสุดท้าย"},rating:{label:"คะแนน",value:"{value} จาก {max}",empty:"ยังไม่ได้ให้คะแนน"}}},n={zh:"zh-hans","zh-cn":"zh-hans","zh-my":"zh-hans","zh-sg":"zh-hans","zh-hk":"zh-hant","zh-mo":"zh-hant","zh-tw":"zh-hant"};const i=new Map([["",e]]);export function resolveMessages(t){const o=t?.trim()??"",r=i.get(o);if(r)return r;const s=function(e){const a=e.toLowerCase().split(/[-_]/).filter(Boolean),n=a[0];if(!n)return[];const i=a.slice(1),t=i.find(e=>/^[a-z]{4}$/.test(e)),o=i.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[t?`${n}-${t}`:"",o?`${n}-${o}`:"",n].filter(Boolean)}(o).map(e=>a[e]??a[n[e]??""]).find(Boolean),l=s?{common:{...e.common,...s.common},textField:{...e.textField,...s.textField},empty:{...e.empty,...s.empty},picker:{...e.picker,...s.picker},alert:{...e.alert,...s.alert},chat:{...e.chat,...s.chat},pagination:{...e.pagination,...s.pagination},rating:{...e.rating,...s.rating},spoiler:{...e.spoiler,...s.spoiler}}:e;return i.set(o,l),l}export function fillMessage(e,a){return e.replace(/\{(\w+)\}/g,(e,n)=>a[n]??e)}
|
|
1
|
+
const e=new Map;export function registerMPMessages(...s){for(const t of s){e.set(t.locale.toLowerCase(),t.messages);for(const s of t.aliases??[])e.set(s.toLowerCase(),t.messages)}t.clear()}const t=new Map;export function resolveNamespace(s,n){const o=n?.trim()??"",r=`${s.name}\0${o}`,a=t.get(r);if(a)return a;const c=function(e){const t=e.toLowerCase().split(/[-_]/).filter(Boolean),s=t[0];if(!s)return[];const n=t.slice(1),o=n.find(e=>/^[a-z]{4}$/.test(e)),r=n.find(e=>/^([a-z]{2}|\d{3})$/.test(e));return[o?`${s}-${o}`:"",r?`${s}-${r}`:"",s].filter(Boolean)}(o).map(t=>e.get(t)).find(Boolean),i=c?.[s.name],f=i?{...s.en,...i}:s.en;return t.set(r,f),f}export function fillMessage(e,t){return e.replace(/\{(\w+)\}/g,(e,s)=>t[s]??e)}
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
*
|
|
13
13
|
* There is deliberately no third source. `navigator.language` is *not* consulted
|
|
14
14
|
* as a fallback, and that is not an oversight — see the note on
|
|
15
|
-
* `
|
|
15
|
+
* `resolveNamespace` in `internal/i18n.ts`. The runtime's own locale differs
|
|
16
16
|
* between the server that renders the markup and the browser that hydrates it,
|
|
17
17
|
* so reading it would put a hydration mismatch in the one part of the page a
|
|
18
18
|
* reader is looking at. `undefined` therefore means "the platform's default",
|
|
19
19
|
* which `Intl` resolves consistently in both places.
|
|
20
20
|
*/
|
|
21
21
|
import * as React from 'react';
|
|
22
|
-
import { type MPMessages } from './i18n';
|
|
22
|
+
import { type MPMessages, type MPNamespace } from './i18n.js';
|
|
23
23
|
/**
|
|
24
24
|
* `undefined` rather than `'en'`, and the distinction matters.
|
|
25
25
|
*
|
|
@@ -39,5 +39,10 @@ export declare function useMPLocale(locale?: string): string | undefined;
|
|
|
39
39
|
* what makes an unsupported language a partial answer rather than a dead end: a
|
|
40
40
|
* caller supplies the handful of words they care about and everything else is
|
|
41
41
|
* still translated, or still English, rather than blank.
|
|
42
|
+
*
|
|
43
|
+
* The namespace is passed as the object from `internal/messages/`, not as its
|
|
44
|
+
* name: it carries English with it, which is what lets a component that says one
|
|
45
|
+
* word leave the other eight namespaces out of the bundle entirely. The objects
|
|
46
|
+
* are module constants, so the identity `useMemo` compares is stable.
|
|
42
47
|
*/
|
|
43
|
-
export declare function useMPMessages<
|
|
48
|
+
export declare function useMPMessages<Name extends keyof MPMessages>(namespace: MPNamespace<Name>, locale: string | undefined, overrides?: Partial<MPMessages[Name]>): MPMessages[Name];
|
package/dist/internal/locale.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import*as e from"react";import{resolveNamespace as t}from"./i18n.js";export const MPLocaleContext=/*@__PURE__*/e.createContext(void 0);export function useMPLocale(t){const o=e.useContext(MPLocaleContext);return t??o}export function useMPMessages(o,n,r){return e.useMemo(()=>{const e=t(o,n);return r?{...e,...r}:e},[o,n,r])}
|
package/dist/internal/menu.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* every row from having to answer "what if there is no menu".
|
|
16
16
|
*/
|
|
17
17
|
import * as React from 'react';
|
|
18
|
-
import type { MPColor, MPSize } from '../types';
|
|
18
|
+
import type { MPColor, MPSize } from '../types.js';
|
|
19
19
|
export interface MPMenuContextValue {
|
|
20
20
|
size: MPSize;
|
|
21
21
|
color: MPColor;
|
package/dist/internal/menu.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import*as t from"react";export const MPMenuContext=/*@__PURE__*/t.createContext({size:"md",color:"primary"});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ALERT={name:"alert",en:{dismiss:"Dismiss"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHAT={name:"chat",en:{sending:"Sending",sent:"Sent",delivered:"Delivered",read:"Read",failed:"Not sent",typing:"Typing"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const COMMON={name:"common",en:{close:"Close",clear:"Clear",open:"Open",remove:"Remove",removeNamed:"Remove {label}",loading:"Loading"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const EMPTY={name:"empty",en:{title:"Nothing here"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PAGINATION={name:"pagination",en:{label:"Pagination",page:"Page {page}",status:"Page {page} of {total}",previous:"Previous page",next:"Next page",first:"First page",last:"Last page"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PICKER={name:"picker",en:{previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RATING={name:"rating",en:{label:"Rating",value:"{value} out of {max}",empty:"Not rated"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SPOILER={name:"spoiler",en:{reveal:"Reveal",hide:"Hide",notice:"Hidden so it is not read by accident"}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TEXT_FIELD={name:"textField",en:{showPassword:"Show the password",hidePassword:"Hide the password"}};
|
package/dist/internal/scale.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* sized by the thumb. A checkbox's tick is not either. Those tables stay in the
|
|
22
22
|
* component that owns them, next to the reasoning for their numbers.
|
|
23
23
|
*/
|
|
24
|
-
import type { MPSize } from '../types';
|
|
24
|
+
import type { MPSize } from '../types.js';
|
|
25
25
|
/**
|
|
26
26
|
* The control heights, and the ladder every other table here is derived from.
|
|
27
27
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* The second is what a *container* paints itself at, which is the last section
|
|
14
14
|
* of the file.
|
|
15
15
|
*/
|
|
16
|
-
import type { MPVariant } from '../types';
|
|
16
|
+
import type { MPVariant } from '../types.js';
|
|
17
17
|
/**
|
|
18
18
|
* The positioner every portalled popup wears.
|
|
19
19
|
*
|
package/dist/internal/surface.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PORTAL_LAYER="mp-portal z-50 outline-none";export const SCRIM="bg-mp-scrim/32 [backdrop-filter:blur(2px)]";export const FADE
|
|
1
|
+
export const PORTAL_LAYER="mp-portal z-50 outline-none";export const SCRIM="bg-mp-scrim/32 [backdrop-filter:blur(2px)]";export const FADE=/*@__PURE__*/["transition-opacity duration-(--mp-sys-motion-duration-short4)","ease-mp-standard","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" ");export const SHEET_MOTION=/*@__PURE__*/["duration-(--mp-sys-motion-duration-medium4)","ease-(--mp-sys-motion-easing-emphasized-decelerate)","data-ending-style:duration-(--mp-sys-motion-duration-short4)","data-ending-style:ease-(--mp-sys-motion-easing-emphasized-accelerate)","data-starting-style:opacity-0 data-ending-style:opacity-0"].join(" ");export const CONTAINER_SURFACE={filled:"bg-mp-surface-container-highest",tonal:"bg-mp-surface-container",elevated:"shadow-mp-1 bg-mp-surface-container-low",outlined:"border-mp-outline-variant border bg-transparent",text:"bg-transparent"};
|