plass-ui 0.0.1 → 1.0.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/dist/components/accordion/PlAccordion.d.ts +98 -0
- package/dist/components/accordion/PlAccordion.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/PlAlert.d.ts +50 -0
- package/dist/components/alert/PlAlert.js +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/animate-appear/PlAnimateAppear.d.ts +55 -0
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -0
- package/dist/components/animate-appear/index.d.ts +2 -0
- package/dist/components/animate-appear/index.js +1 -0
- package/dist/components/animate-blink/PlAnimateBlink.d.ts +30 -0
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -0
- package/dist/components/animate-blink/index.d.ts +2 -0
- package/dist/components/animate-blink/index.js +1 -0
- package/dist/components/animate-fade/PlAnimateFade.d.ts +35 -0
- package/dist/components/animate-fade/PlAnimateFade.js +1 -0
- package/dist/components/animate-fade/index.d.ts +2 -0
- package/dist/components/animate-fade/index.js +1 -0
- package/dist/components/animate-grow/PlAnimateGrow.d.ts +45 -0
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -0
- package/dist/components/animate-grow/index.d.ts +2 -0
- package/dist/components/animate-grow/index.js +1 -0
- package/dist/components/animate-headline/PlAnimateHeadline.d.ts +55 -0
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -0
- package/dist/components/animate-headline/index.d.ts +2 -0
- package/dist/components/animate-headline/index.js +1 -0
- package/dist/components/animate-lighting/PlAnimateLighting.d.ts +67 -0
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -0
- package/dist/components/animate-lighting/index.d.ts +2 -0
- package/dist/components/animate-lighting/index.js +1 -0
- package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +65 -0
- package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -0
- package/dist/components/animate-marquee/index.d.ts +2 -0
- package/dist/components/animate-marquee/index.js +1 -0
- package/dist/components/animate-rotate/PlAnimateRotate.d.ts +52 -0
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -0
- package/dist/components/animate-rotate/index.d.ts +2 -0
- package/dist/components/animate-rotate/index.js +1 -0
- package/dist/components/animate-slide/PlAnimateSlide.d.ts +47 -0
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -0
- package/dist/components/animate-slide/index.d.ts +2 -0
- package/dist/components/animate-slide/index.js +1 -0
- package/dist/components/animate-typing/PlAnimateTyping.d.ts +56 -0
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -0
- package/dist/components/animate-typing/index.d.ts +2 -0
- package/dist/components/animate-typing/index.js +1 -0
- package/dist/components/animate-zoom/PlAnimateZoom.d.ts +37 -0
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -0
- package/dist/components/animate-zoom/index.d.ts +2 -0
- package/dist/components/animate-zoom/index.js +1 -0
- package/dist/components/aspect-ratio/PlAspectRatio.d.ts +64 -0
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +1 -0
- package/dist/components/avatar/PlAvatar.d.ts +102 -0
- package/dist/components/avatar/PlAvatar.js +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/PlBadge.d.ts +86 -0
- package/dist/components/badge/PlBadge.js +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/blockquote/PlBlockquote.d.ts +64 -0
- package/dist/components/blockquote/PlBlockquote.js +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.js +1 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +111 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -0
- package/dist/components/bottom-navigation/index.d.ts +2 -0
- package/dist/components/bottom-navigation/index.js +1 -0
- package/dist/components/box/PlBox.d.ts +50 -0
- package/dist/components/box/PlBox.js +1 -0
- package/dist/components/box/index.d.ts +2 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/breadcrumb/PlBreadcrumb.d.ts +138 -0
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/{Button.d.ts → PlButton.d.ts} +3 -3
- package/dist/components/button/PlButton.js +1 -0
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/PlButtonGroup.d.ts +32 -0
- package/dist/components/button-group/PlButtonGroup.js +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/PlCard.d.ts +81 -0
- package/dist/components/card/PlCard.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/PlCarousel.d.ts +78 -0
- package/dist/components/carousel/PlCarousel.js +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/chat-bubble/PlChatBubble.d.ts +127 -0
- package/dist/components/chat-bubble/PlChatBubble.js +1 -0
- package/dist/components/chat-bubble/index.d.ts +2 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/PlCheckbox.d.ts +39 -0
- package/dist/components/checkbox/PlCheckbox.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/PlChip.d.ts +55 -0
- package/dist/components/chip/PlChip.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/collapsible/PlCollapsible.d.ts +84 -0
- package/dist/components/collapsible/PlCollapsible.js +1 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/combobox/PlCombobox.d.ts +140 -0
- package/dist/components/combobox/PlCombobox.js +1 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/container/PlContainer.d.ts +66 -0
- package/dist/components/container/PlContainer.js +1 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/date-picker/PlDatePicker.d.ts +73 -0
- package/dist/components/date-picker/PlDatePicker.js +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/PlDateRangePicker.d.ts +91 -0
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-time-picker/PlDateTimePicker.d.ts +74 -0
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -0
- package/dist/components/date-time-picker/index.d.ts +2 -0
- package/dist/components/date-time-picker/index.js +1 -0
- package/dist/components/divider/PlDivider.d.ts +73 -0
- package/dist/components/divider/PlDivider.js +1 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/PlDrawer.d.ts +144 -0
- package/dist/components/drawer/PlDrawer.js +1 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/file-picker/PlFilePicker.d.ts +105 -0
- package/dist/components/file-picker/PlFilePicker.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -0
- package/dist/components/file-picker/index.js +1 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +118 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/grid/PlGrid.d.ts +67 -0
- package/dist/components/grid/PlGrid.js +1 -0
- package/dist/components/grid/PlGridItem.d.ts +50 -0
- package/dist/components/grid/PlGridItem.js +1 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/highlight/PlHighlight.d.ts +90 -0
- package/dist/components/highlight/PlHighlight.js +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.js +1 -0
- package/dist/components/hot-keys/PlHotKeys.d.ts +93 -0
- package/dist/components/hot-keys/PlHotKeys.js +1 -0
- package/dist/components/hot-keys/index.d.ts +2 -0
- package/dist/components/hot-keys/index.js +1 -0
- package/dist/components/icon/PlIcon.d.ts +62 -0
- package/dist/components/icon/PlIcon.js +1 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/icon/index.js +1 -0
- package/dist/components/icon-button/PlIconButton.d.ts +39 -0
- package/dist/components/icon-button/PlIconButton.js +1 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/list/PlList.d.ts +82 -0
- package/dist/components/list/PlList.js +1 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/menu/PlMenu.d.ts +210 -0
- package/dist/components/menu/PlMenu.js +1 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/modal/PlModal.d.ts +112 -0
- package/dist/components/modal/PlModal.js +1 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/number-field/PlNumberField.d.ts +133 -0
- package/dist/components/number-field/PlNumberField.js +1 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/otp-field/PlOtpField.d.ts +82 -0
- package/dist/components/otp-field/PlOtpField.js +1 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +1 -0
- package/dist/components/overlay/PlOverlay.d.ts +96 -0
- package/dist/components/overlay/PlOverlay.js +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.js +1 -0
- package/dist/components/pagination/PlPagination.d.ts +88 -0
- package/dist/components/pagination/PlPagination.js +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/panes/PlPanes.d.ts +79 -0
- package/dist/components/panes/PlPanes.js +1 -0
- package/dist/components/panes/index.d.ts +2 -0
- package/dist/components/panes/index.js +1 -0
- package/dist/components/pill/PlPill.d.ts +81 -0
- package/dist/components/pill/PlPill.js +1 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/popover/PlPopover.d.ts +107 -0
- package/dist/components/popover/PlPopover.js +1 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress-box/PlProgressBox.d.ts +32 -0
- package/dist/components/progress-box/PlProgressBox.js +1 -0
- package/dist/components/progress-box/index.d.ts +2 -0
- package/dist/components/progress-box/index.js +1 -0
- package/dist/components/progress-circular/PlProgressCircular.d.ts +22 -0
- package/dist/components/progress-circular/PlProgressCircular.js +1 -0
- package/dist/components/progress-circular/index.d.ts +2 -0
- package/dist/components/progress-circular/index.js +1 -0
- package/dist/components/progress-linear/PlProgressLinear.d.ts +31 -0
- package/dist/components/progress-linear/PlProgressLinear.js +1 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/radio-group/PlRadioGroup.d.ts +54 -0
- package/dist/components/radio-group/PlRadioGroup.js +1 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/rating/PlRating.d.ts +90 -0
- package/dist/components/rating/PlRating.js +1 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/rating/index.js +1 -0
- package/dist/components/scroll-zone/PlScrollZone.d.ts +132 -0
- package/dist/components/scroll-zone/PlScrollZone.js +1 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/segmented-button/PlSegmentedButton.d.ts +79 -0
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -0
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/select/PlSelect.d.ts +77 -0
- package/dist/components/select/PlSelect.js +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/skeleton/PlSkeleton.d.ts +73 -0
- package/dist/components/skeleton/PlSkeleton.js +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/PlSlider.d.ts +44 -0
- package/dist/components/slider/PlSlider.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/spoiler/PlSpoiler.d.ts +84 -0
- package/dist/components/spoiler/PlSpoiler.js +1 -0
- package/dist/components/spoiler/index.d.ts +2 -0
- package/dist/components/spoiler/index.js +1 -0
- package/dist/components/switch/PlSwitch.d.ts +42 -0
- package/dist/components/switch/PlSwitch.js +1 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/PlTable.d.ts +112 -0
- package/dist/components/table/PlTable.js +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/PlTabs.d.ts +94 -0
- package/dist/components/tabs/PlTabs.js +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/text-field/{TextField.d.ts → PlTextField.d.ts} +5 -5
- package/dist/components/text-field/PlTextField.js +1 -0
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-link/PlTextLink.d.ts +80 -0
- package/dist/components/text-link/PlTextLink.js +1 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/time-picker/PlTimePicker.d.ts +88 -0
- package/dist/components/time-picker/PlTimePicker.js +1 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/timeline/PlTimeline.d.ts +98 -0
- package/dist/components/timeline/PlTimeline.js +1 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/toast/PlToast.d.ts +122 -0
- package/dist/components/toast/PlToast.js +1 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toolbar/PlToolbar.d.ts +68 -0
- package/dist/components/toolbar/PlToolbar.js +1 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/PlTooltip.d.ts +92 -0
- package/dist/components/tooltip/PlTooltip.js +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/typography/PlTypography.d.ts +66 -0
- package/dist/components/typography/PlTypography.js +1 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/css/accordion.css +2 -0
- package/dist/css/alert.css +2 -0
- package/dist/css/animate-appear.css +2 -0
- package/dist/css/animate-blink.css +2 -0
- package/dist/css/animate-fade.css +2 -0
- package/dist/css/animate-grow.css +2 -0
- package/dist/css/animate-headline.css +2 -0
- package/dist/css/animate-lighting.css +2 -0
- package/dist/css/animate-marquee.css +2 -0
- package/dist/css/animate-rotate.css +2 -0
- package/dist/css/animate-slide.css +2 -0
- package/dist/css/animate-typing.css +2 -0
- package/dist/css/animate-zoom.css +2 -0
- package/dist/css/aspect-ratio.css +2 -0
- package/dist/css/avatar.css +2 -0
- package/dist/css/badge.css +2 -0
- package/dist/css/base.css +4 -0
- package/dist/css/blockquote.css +2 -0
- package/dist/css/bottom-navigation.css +2 -0
- package/dist/css/box.css +2 -0
- package/dist/css/breadcrumb.css +2 -0
- package/dist/css/button-group.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/card.css +2 -0
- package/dist/css/carousel.css +2 -0
- package/dist/css/chat-bubble.css +2 -0
- package/dist/css/checkbox.css +2 -0
- package/dist/css/chip.css +2 -0
- package/dist/css/collapsible.css +2 -0
- package/dist/css/combobox.css +2 -0
- package/dist/css/container.css +2 -0
- package/dist/css/date-picker.css +2 -0
- package/dist/css/date-range-picker.css +2 -0
- package/dist/css/date-time-picker.css +2 -0
- package/dist/css/divider.css +2 -0
- package/dist/css/drawer.css +2 -0
- package/dist/css/file-picker.css +2 -0
- package/dist/css/floating-bottom-navigation.css +2 -0
- package/dist/css/grid.css +2 -0
- package/dist/css/highlight.css +2 -0
- package/dist/css/hot-keys.css +2 -0
- package/dist/css/icon-button.css +2 -0
- package/dist/css/icon.css +2 -0
- package/dist/css/list.css +2 -0
- package/dist/css/menu.css +2 -0
- package/dist/css/modal.css +2 -0
- package/dist/css/number-field.css +2 -0
- package/dist/css/otp-field.css +2 -0
- package/dist/css/overlay.css +2 -0
- package/dist/css/pagination.css +2 -0
- package/dist/css/panes.css +2 -0
- package/dist/css/pill.css +2 -0
- package/dist/css/popover.css +2 -0
- package/dist/css/progress-box.css +2 -0
- package/dist/css/progress-circular.css +2 -0
- package/dist/css/progress-linear.css +2 -0
- package/dist/css/radio-group.css +2 -0
- package/dist/css/rating.css +2 -0
- package/dist/css/scroll-zone.css +2 -0
- package/dist/css/segmented-button.css +2 -0
- package/dist/css/select.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/slider.css +2 -0
- package/dist/css/spoiler.css +2 -0
- package/dist/css/switch.css +2 -0
- package/dist/css/table.css +2 -0
- package/dist/css/tabs.css +2 -0
- package/dist/css/text-field.css +2 -0
- package/dist/css/text-link.css +2 -0
- package/dist/css/time-picker.css +2 -0
- package/dist/css/timeline.css +2 -0
- package/dist/css/toast.css +2 -0
- package/dist/css/toolbar.css +2 -0
- package/dist/css/tooltip.css +2 -0
- package/dist/css/typography.css +2 -0
- package/dist/index.d.ts +75 -3
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +161 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/button-group.d.ts +27 -0
- package/dist/internal/button-group.js +2 -0
- package/dist/internal/calendar.d.ts +148 -0
- package/dist/internal/calendar.js +1 -0
- package/dist/internal/date.d.ts +173 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/format.d.ts +24 -0
- package/dist/internal/format.js +1 -0
- package/dist/internal/grid.d.ts +67 -0
- package/dist/internal/grid.js +1 -0
- package/dist/internal/icons.d.ts +86 -1
- package/dist/internal/icons.js +1 -1
- package/dist/internal/menu.d.ts +20 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/picker.d.ts +118 -0
- package/dist/internal/picker.js +1 -0
- package/dist/internal/progress.d.ts +145 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/sizer.d.ts +32 -0
- package/dist/internal/sizer.js +1 -0
- package/dist/internal/styles.d.ts +198 -8
- package/dist/internal/styles.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +899 -125
- package/dist/tokens.css +1275 -0
- package/dist/types.d.ts +150 -8
- package/dist/types.js +0 -8
- package/package.json +32 -27
- package/README.md +0 -111
- package/dist/components/button/Button.js +0 -1
- package/dist/components/text-field/TextField.js +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassPickerLabels } from '../../internal/calendar.js';
|
|
3
|
+
import { type PlassPickerShellProps } from '../../internal/picker.js';
|
|
4
|
+
import type { PlassWeekday } from '../../types.js';
|
|
5
|
+
/** The strings a picker says that `Intl` has no opinion about. */
|
|
6
|
+
export type PlPickerLabels = PlassPickerLabels;
|
|
7
|
+
export interface PlDatePickerProps extends PlassPickerShellProps {
|
|
8
|
+
/** The chosen day. Use with `onValueChange` for a controlled picker. */
|
|
9
|
+
value?: Date | null;
|
|
10
|
+
/** The day the picker starts on, for an uncontrolled one. */
|
|
11
|
+
defaultValue?: Date | null;
|
|
12
|
+
onValueChange?: (value: Date | null) => void;
|
|
13
|
+
/** Whether the calendar is open. Use with `onOpenChange` to control it. */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
defaultOpen?: boolean;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
/** Which month the calendar opens on when there is no value. @default this one */
|
|
18
|
+
defaultMonth?: Date;
|
|
19
|
+
/** The earliest day that may be chosen. Day-granular — the time is ignored. */
|
|
20
|
+
minDate?: Date | null;
|
|
21
|
+
/** The latest day that may be chosen. */
|
|
22
|
+
maxDate?: Date | null;
|
|
23
|
+
/**
|
|
24
|
+
* Blocks individual days that are inside the range but still not available —
|
|
25
|
+
* weekends, holidays, a room that is already booked.
|
|
26
|
+
*/
|
|
27
|
+
shouldDisableDate?: (date: Date) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* BCP 47 tag deciding the month and weekday names, the order of the header's
|
|
30
|
+
* two buttons, and how the trigger writes the date. Defaults to the browser's.
|
|
31
|
+
*/
|
|
32
|
+
locale?: string;
|
|
33
|
+
/** Which day the week starts on. Defaults to whatever the locale says. */
|
|
34
|
+
weekStartsOn?: PlassWeekday;
|
|
35
|
+
/**
|
|
36
|
+
* How the trigger writes the chosen date. Passed straight to `Intl`, so
|
|
37
|
+
* `{ dateStyle: 'full' }` and `{ year: '2-digit', month: 'narrow' }` both work.
|
|
38
|
+
* @default { dateStyle: 'medium' }
|
|
39
|
+
*/
|
|
40
|
+
format?: Intl.DateTimeFormatOptions;
|
|
41
|
+
/** Shown in the trigger while nothing is chosen. */
|
|
42
|
+
placeholder?: React.ReactNode;
|
|
43
|
+
/** Offers the × that empties the control. @default false */
|
|
44
|
+
clearable?: boolean;
|
|
45
|
+
/** Offers the shortcut to today in the footer. @default true */
|
|
46
|
+
showTodayButton?: boolean;
|
|
47
|
+
/** Closes the popup as soon as a day is chosen. @default true */
|
|
48
|
+
closeOnSelect?: boolean;
|
|
49
|
+
/** The strings the picker says. Every one has an English default. */
|
|
50
|
+
labels?: Partial<PlassPickerLabels>;
|
|
51
|
+
/** Identifies the field when a form is submitted, as `YYYY-MM-DD`. */
|
|
52
|
+
name?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* One day, chosen from a calendar.
|
|
56
|
+
*
|
|
57
|
+
* The trigger is a `PlTextField`'s shell wearing a calendar glyph, on purpose
|
|
58
|
+
* and for the reason a `PlSelect`'s is: a form where the date field is a
|
|
59
|
+
* different height, radius or material from the fields around it is a form that
|
|
60
|
+
* looks assembled.
|
|
61
|
+
*
|
|
62
|
+
* What the calendar is actually for is the header. A picker that only steps a
|
|
63
|
+
* month at a time puts a birthday thirty years back a hundred and eighty clicks
|
|
64
|
+
* away, so the month name and the year are each a button that opens a grid of
|
|
65
|
+
* its own — twelve months, then twelve years at a time. Any month of the year on
|
|
66
|
+
* screen is two clicks; any year at all is three.
|
|
67
|
+
*
|
|
68
|
+
* There is no typing into the trigger. Parsing a date out of free text is
|
|
69
|
+
* locale-dependent in a way that cannot be done honestly without a date library,
|
|
70
|
+
* and a field that understands `27/7/26` in one browser and not in the next is
|
|
71
|
+
* worse than one that never claimed to.
|
|
72
|
+
*/
|
|
73
|
+
export declare const PlDatePicker: React.ForwardRefExoticComponent<PlDatePickerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{PlButton as t}from"../button/PlButton.js";import{Calendar as o,usePickerLabels as n}from"../../internal/calendar.js";import{CalendarIcon as r}from"../../internal/icons.js";import{PickerFooter as s,PickerShell as i}from"../../internal/picker.js";import{displaySamples as c,formatDate as d,isDayOutside as m,isValidDate as u,localeWeekStart as p,mergeDateAndTime as f,startOfDay as h,startOfMonth as b,toISODate as y,today as D,withPlaceholder as g}from"../../internal/date.js";import{cx as j}from"../../internal/styles.js";export const PlDatePicker=/* @__PURE__ */l.forwardRef(function PlDatePicker({value:v,defaultValue:x,onValueChange:O,open:S,defaultOpen:k,onOpenChange:C,defaultMonth:z,minDate:P,maxDate:w,shouldDisableDate:M,locale:V,weekStartsOn:B,format:I={dateStyle:"medium"},placeholder:R,clearable:E=!1,showTodayButton:F=!0,closeOnSelect:N=!0,labels:T,name:q,size:A="md",color:G="primary",readOnly:H=!1,disabled:J=!1,startIcon:K,...L},Q){const U=n(T),W=B??p(V),[X,Y]=l.useState(x??null),Z=void 0!==v?v:X,[$,_]=l.useState(k??!1),ee=S??$,[ae,le]=l.useState(()=>b(u(Z)?Z:z??D()));l.useEffect(()=>{ee&&le(b(u(Z)?Z:z??D()))},[ee]);const setOpen=e=>{e&&(H||J)||(void 0===S&&_(e),C?.(e))},commit=e=>{void 0===v&&Y(e),O?.(e)},select=e=>{const a=u(Z)?f(e,Z):h(e);commit(a),le(b(a)),N&&setOpen(!1)},te=D(),oe=m(te,P,w)||(M?.(te)??!1),ne=F||E,re=l.useMemo(()=>g(c(V,I),R),[V,I,R]);return e(i,{...L,size:A,color:G,readOnly:H,disabled:J,triggerRef:Q,startIcon:K??e(r,{}),display:u(Z)?d(Z,V,I):R??"",samples:re,empty:!u(Z),clearable:E,onClear:()=>commit(null),open:ee,onOpenChange:setOpen,labels:U,hiddenValues:q?[{name:q,value:u(Z)?y(Z):""}]:void 0,children:a("div",{className:j("flex flex-col",ne&&"gap-1.5"),children:[e(o,{size:A,color:G,locale:V,weekStartsOn:W,month:ae,onMonthChange:le,selected:[Z],onSelect:select,minDate:P,maxDate:w,shouldDisableDate:M,labels:U,autoFocus:!0}),ne?a(s,{size:A,children:[E?e(t,{variant:"ghost",size:A,color:G,density:"compact",onClick:()=>{commit(null),setOpen(!1)},children:U.clear}):null,F?e(t,{variant:"ghost",size:A,color:G,density:"compact",disabled:oe,onClick:()=>select(te),children:U.today}):null]}):null]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlDatePicker}from"./PlDatePicker.js";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassPickerLabels } from '../../internal/calendar.js';
|
|
3
|
+
import { type PlassPickerShellProps } from '../../internal/picker.js';
|
|
4
|
+
import type { PlassWeekday } from '../../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Two ends, either of which may be missing.
|
|
7
|
+
*
|
|
8
|
+
* An object rather than a `[Date, Date]` tuple, and rather than two props. A
|
|
9
|
+
* range is one value — it is chosen in one gesture, cleared in one gesture and
|
|
10
|
+
* validated as a whole — and the two names are what stop a caller writing the
|
|
11
|
+
* end into the start. Half a range is a real state: it is what the picker holds
|
|
12
|
+
* between the first click and the second.
|
|
13
|
+
*/
|
|
14
|
+
export interface PlDateRange {
|
|
15
|
+
start: Date | null;
|
|
16
|
+
end: Date | null;
|
|
17
|
+
}
|
|
18
|
+
/** A named range offered as a shortcut beside the calendars. */
|
|
19
|
+
export interface PlDateRangePreset {
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* The range it stands for. A function when it depends on today, which is
|
|
23
|
+
* almost always — "the last 7 days" computed at module scope is a range that
|
|
24
|
+
* would be wrong for anyone who left the tab open overnight.
|
|
25
|
+
*/
|
|
26
|
+
value: PlDateRange | (() => PlDateRange);
|
|
27
|
+
}
|
|
28
|
+
export interface PlDateRangePickerProps extends PlassPickerShellProps {
|
|
29
|
+
/** The chosen range. Use with `onValueChange` for a controlled picker. */
|
|
30
|
+
value?: PlDateRange | null;
|
|
31
|
+
defaultValue?: PlDateRange | null;
|
|
32
|
+
/** Always called with an object. A cleared range is `{ start: null, end: null }`. */
|
|
33
|
+
onValueChange?: (value: PlDateRange) => void;
|
|
34
|
+
open?: boolean;
|
|
35
|
+
defaultOpen?: boolean;
|
|
36
|
+
onOpenChange?: (open: boolean) => void;
|
|
37
|
+
/** Which month the left calendar opens on when there is no value. */
|
|
38
|
+
defaultMonth?: Date;
|
|
39
|
+
/** The earliest day that may be chosen. Day-granular — the time is ignored. */
|
|
40
|
+
minDate?: Date | null;
|
|
41
|
+
/** The latest day that may be chosen. */
|
|
42
|
+
maxDate?: Date | null;
|
|
43
|
+
/** Blocks individual days that are inside the range but still not available. */
|
|
44
|
+
shouldDisableDate?: (date: Date) => boolean;
|
|
45
|
+
/**
|
|
46
|
+
* BCP 47 tag deciding the month and weekday names, the order of the header's
|
|
47
|
+
* two buttons, and how the trigger writes the dates. Defaults to the browser's.
|
|
48
|
+
*/
|
|
49
|
+
locale?: string;
|
|
50
|
+
/** Which day the week starts on. Defaults to whatever the locale says. */
|
|
51
|
+
weekStartsOn?: PlassWeekday;
|
|
52
|
+
/** @default { dateStyle: 'medium' } */
|
|
53
|
+
format?: Intl.DateTimeFormatOptions;
|
|
54
|
+
/**
|
|
55
|
+
* How many months are on screen at once. Two is the default because a range
|
|
56
|
+
* that crosses a month boundary is the ordinary case, not the exception.
|
|
57
|
+
* @default 2
|
|
58
|
+
*/
|
|
59
|
+
monthCount?: 1 | 2;
|
|
60
|
+
/** Shown in each half of the trigger while that end is unchosen. */
|
|
61
|
+
startPlaceholder?: React.ReactNode;
|
|
62
|
+
endPlaceholder?: React.ReactNode;
|
|
63
|
+
/** Shortcuts listed beside the calendars — "Last 7 days", "This month". */
|
|
64
|
+
presets?: readonly PlDateRangePreset[];
|
|
65
|
+
/** Offers the × that empties the control. @default false */
|
|
66
|
+
clearable?: boolean;
|
|
67
|
+
/** Closes the popup once both ends are chosen. @default true */
|
|
68
|
+
closeOnSelect?: boolean;
|
|
69
|
+
/** The strings the picker says. Every one has an English default. */
|
|
70
|
+
labels?: Partial<PlassPickerLabels>;
|
|
71
|
+
/**
|
|
72
|
+
* Identifies the field when a form is submitted. Two hidden inputs of the
|
|
73
|
+
* same name, so the two ends arrive as `FormData.getAll(name)`.
|
|
74
|
+
*/
|
|
75
|
+
name?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A span between two days.
|
|
79
|
+
*
|
|
80
|
+
* Two months side by side, because a range that crosses a month boundary is the
|
|
81
|
+
* ordinary case and a one-month picker makes it a two-step navigation problem.
|
|
82
|
+
* The two panels are one calendar in two halves: the left one has no forward
|
|
83
|
+
* stepper, the right one has no back stepper, and either header's month and year
|
|
84
|
+
* buttons move both.
|
|
85
|
+
*
|
|
86
|
+
* The band between the ends is drawn as the pointer moves, before the second
|
|
87
|
+
* click lands. That preview is the whole affordance — without it the first click
|
|
88
|
+
* has no visible consequence and the control looks broken for the second or so
|
|
89
|
+
* between the two.
|
|
90
|
+
*/
|
|
91
|
+
export declare const PlDateRangePicker: React.ForwardRefExoticComponent<PlDateRangePickerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{PlButton as n}from"../button/PlButton.js";import{Calendar as t,usePickerLabels as s}from"../../internal/calendar.js";import{ArrowRightIcon as r,CalendarIcon as o}from"../../internal/icons.js";import{PickerFooter as i,PickerShell as c}from"../../internal/picker.js";import{WidthSizer as u}from"../../internal/sizer.js";import{addMonths as d,compareDay as m,displaySamples as p,formatDate as h,isValidDate as f,localeWeekStart as v,startOfDay as x,startOfMonth as g,toISODate as b,today as w,withPlaceholder as y}from"../../internal/date.js";import{cx as N,gapClasses as j,metaTextClasses as D}from"../../internal/styles.js";const S={start:null,end:null};export const PlDateRangePicker=/* @__PURE__ */a.forwardRef(function PlDateRangePicker({value:C,defaultValue:O,onValueChange:P,open:k,defaultOpen:z,onOpenChange:M,defaultMonth:R,minDate:B,maxDate:V,shouldDisableDate:E,locale:I,weekStartsOn:F,format:q={dateStyle:"medium"},monthCount:A=2,startPlaceholder:G,endPlaceholder:H,presets:J,clearable:K=!1,closeOnSelect:L=!0,labels:Q,name:T,size:U="md",color:W="primary",readOnly:X=!1,disabled:Y=!1,startIcon:Z,...$},_){const ee=s(Q),le=F??v(I),[ae,ne]=a.useState(O??S),te=void 0!==C?C??S:ae,se=f(te.start)?te.start:null,re=f(te.end)?te.end:null,[oe,ie]=a.useState(z??!1),ce=k??oe,[ue,de]=a.useState(null),[me,pe]=a.useState(null),[he,fe]=a.useState(()=>g(se??R??w()));a.useEffect(()=>{ce?fe(g(se??R??w())):(de(null),pe(null))},[ce]);const setOpen=e=>{e&&(X||Y)||(void 0===k&&ie(e),M?.(e))},commit=e=>{void 0===C&&ne(e),P?.(e)},ve=ue??se,xe=null!==ue?me:re,write=(l,a)=>f(l)?h(l,I,q):e("span",{className:"text-(--plass-muted-fg)",children:a??""}),ge=d(he,1),be=2===A,we=a.useMemo(()=>p(I,q),[I,q]),ye=null!==ue?ee.end:null===se?ee.start:null,Ne={size:U,color:W,locale:I,weekStartsOn:le,selected:[se,re,ue],rangeStart:ve,rangeEnd:xe,onSelect:e=>{const l=x(e);if(null===ue)return de(l),pe(l),void commit({start:l,end:null});const[a,n]=m(l,ue)<0?[l,ue]:[ue,l];de(null),pe(null),commit({start:a,end:n}),L&&setOpen(!1)},onPreviewChange:e=>{null!==ue&&pe(e??ue)},minDate:B,maxDate:V,shouldDisableDate:E,showOutsideDays:!1,labels:ee};return e(c,{...$,size:U,color:W,readOnly:X,disabled:Y,triggerRef:_,startIcon:Z??e(o,{}),display:l("span",{className:"flex min-w-0 items-center gap-1.5",children:[l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:write(se,G)}),e(u,{samples:y(we,G)})]}),e("span",{"aria-hidden":"true",className:"flex shrink-0 items-center text-(--plass-muted-fg) rtl:rotate-180",children:e(r,{})}),l("span",{className:"flex min-w-0 flex-col",children:[e("span",{className:"truncate",children:write(re,H)}),e(u,{samples:y(we,H)})]})]}),empty:null===se&&null===re,clearable:K,onClear:()=>commit(S),open:ce,onOpenChange:setOpen,labels:ee,hiddenValues:T?[{name:T,value:se?b(se):""},{name:T,value:re?b(re):""}]:void 0,children:l("div",{className:"flex flex-col gap-1.5",children:[l("div",{className:N("flex items-stretch",j[U]),children:[J&&J.length>0?e("div",{className:N("flex max-h-[calc(var(--p-cell,2.5rem)*8)] flex-col overflow-y-auto border-e pe-1.5","[border-color:var(--plass-divider)]"),children:J.map((l,a)=>e(n,{variant:"ghost",size:U,color:W,density:"compact",className:"justify-start whitespace-nowrap",onClick:()=>(e=>{const l="function"==typeof e.value?e.value():e.value;de(null),pe(null),commit(l),f(l.start)&&fe(g(l.start)),L&&setOpen(!1)})(l),children:l.label},a))}):null,e(t,{...Ne,month:he,onMonthChange:fe,showNextButton:!be,autoFocus:!0}),be?e(t,{...Ne,month:ge,onMonthChange:e=>fe(d(e,-1)),showPreviousButton:!1}):null]}),K||null!==ye?l(i,{size:U,children:[null!==ye?e("span",{className:N("me-auto text-(--plass-muted-fg)",D[U]),children:ye}):null,K?e(n,{variant:"ghost",size:U,color:W,density:"compact",onClick:()=>{de(null),pe(null),commit(S),setOpen(!1)},children:ee.clear}):null]}):null]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlDateRangePicker}from"./PlDateRangePicker.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassPickerLabels } from '../../internal/calendar.js';
|
|
3
|
+
import { type PlassPickerShellProps } from '../../internal/picker.js';
|
|
4
|
+
import { type TimeUnit } from '../../internal/date.js';
|
|
5
|
+
import type { PlassWeekday } from '../../types.js';
|
|
6
|
+
export interface PlDateTimePickerProps extends PlassPickerShellProps {
|
|
7
|
+
/** The chosen moment. Use with `onValueChange` for a controlled picker. */
|
|
8
|
+
value?: Date | null;
|
|
9
|
+
defaultValue?: Date | null;
|
|
10
|
+
onValueChange?: (value: Date | null) => void;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
/** Which month the calendar opens on when there is no value. */
|
|
15
|
+
defaultMonth?: Date;
|
|
16
|
+
/**
|
|
17
|
+
* The earliest moment that may be chosen. Unlike a `PlDatePicker`'s, this one
|
|
18
|
+
* is read at full precision: the day it falls on stays available and the clock
|
|
19
|
+
* columns block the hours before it.
|
|
20
|
+
*/
|
|
21
|
+
minDate?: Date | null;
|
|
22
|
+
/** The latest moment that may be chosen, likewise at full precision. */
|
|
23
|
+
maxDate?: Date | null;
|
|
24
|
+
shouldDisableDate?: (date: Date) => boolean;
|
|
25
|
+
shouldDisableTime?: (value: Date, unit: TimeUnit) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* BCP 47 tag deciding the month and weekday names, whether the clock is on a
|
|
28
|
+
* 12-hour dial, and how the trigger writes the moment.
|
|
29
|
+
*/
|
|
30
|
+
locale?: string;
|
|
31
|
+
weekStartsOn?: PlassWeekday;
|
|
32
|
+
/**
|
|
33
|
+
* How the trigger writes the chosen moment. Passed straight to `Intl`.
|
|
34
|
+
* @default { dateStyle: 'medium', timeStyle: 'short' }
|
|
35
|
+
*/
|
|
36
|
+
format?: Intl.DateTimeFormatOptions;
|
|
37
|
+
/** A 12-hour dial with an AM/PM column. Defaults to whatever the locale does. */
|
|
38
|
+
hour12?: boolean;
|
|
39
|
+
showSeconds?: boolean;
|
|
40
|
+
hourStep?: number;
|
|
41
|
+
minuteStep?: number;
|
|
42
|
+
secondStep?: number;
|
|
43
|
+
placeholder?: React.ReactNode;
|
|
44
|
+
clearable?: boolean;
|
|
45
|
+
/** Offers the shortcut to this moment in the footer. @default true */
|
|
46
|
+
showNowButton?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Closes the popup as soon as a day is chosen. `false` here and `true` on a
|
|
49
|
+
* `PlDatePicker`, because a moment is a day *and* a time and closing on the
|
|
50
|
+
* first of the two would leave the second unanswered.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
closeOnSelect?: boolean;
|
|
54
|
+
/** The strings the picker says. Every one has an English default. */
|
|
55
|
+
labels?: Partial<PlassPickerLabels>;
|
|
56
|
+
/** Identifies the field when a form is submitted, as `YYYY-MM-DDTHH:MM`. */
|
|
57
|
+
name?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A day and a time, in one popup.
|
|
61
|
+
*
|
|
62
|
+
* Not a date picker that grew a clock and not a time picker that grew a
|
|
63
|
+
* calendar: the two panels sit side by side at exactly the same height — seven
|
|
64
|
+
* rows of cells each, which is why the calendar's grid and the clock's columns
|
|
65
|
+
* share the `--p-cell` ladder — so the popup is one rectangle rather than two of
|
|
66
|
+
* different sizes pushed together.
|
|
67
|
+
*
|
|
68
|
+
* The bounds do more work here than anywhere else. `minDate` is read at **full
|
|
69
|
+
* precision**, so a minimum of 09:30 on the 27th leaves the 27th selectable in
|
|
70
|
+
* the calendar and greys out the morning in the clock. That is the behaviour a
|
|
71
|
+
* "not before now" rule needs, and it is the one a day-granular check cannot
|
|
72
|
+
* give.
|
|
73
|
+
*/
|
|
74
|
+
export declare const PlDateTimePicker: React.ForwardRefExoticComponent<PlDateTimePickerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as l from"react";import{PlButton as o}from"../button/PlButton.js";import{Calendar as n,TimeGrid as a,usePickerLabels as s}from"../../internal/calendar.js";import{CalendarIcon as i}from"../../internal/icons.js";import{PickerDivider as r,PickerFooter as c,PickerShell as d}from"../../internal/picker.js";import{displaySamples as m,formatDate as u,isDayOutside as h,isHour12 as p,isValidDate as f,localeWeekStart as S,mergeDateAndTime as b,startOfDay as g,startOfMonth as y,timeUnitSpan as D,toISODateTime as v,today as C,withPlaceholder as j,withTime as k}from"../../internal/date.js";import{cx as w,gapClasses as x}from"../../internal/styles.js";export const PlDateTimePicker=/* @__PURE__ */l.forwardRef(function PlDateTimePicker({value:z,defaultValue:O,onValueChange:T,open:P,defaultOpen:M,onOpenChange:N,defaultMonth:V,minDate:B,maxDate:I,shouldDisableDate:R,shouldDisableTime:E,locale:F,weekStartsOn:q,format:A={dateStyle:"medium",timeStyle:"short"},hour12:G,showSeconds:H=!1,hourStep:J=1,minuteStep:K=1,secondStep:L=1,placeholder:Q,clearable:U=!1,showNowButton:W=!0,closeOnSelect:X=!1,labels:Y,name:Z,size:$="md",color:_="primary",density:ee="default",readOnly:te=!1,disabled:le=!1,startIcon:oe,...ne},ae){const se=s(Y),ie=q??S(F),re=G??p(F),[ce,de]=l.useState(O??null),me=void 0!==z?z:ce,[ue,he]=l.useState(M??!1),pe=P??ue,[fe,Se]=l.useState(()=>y(f(me)?me:V??C()));l.useEffect(()=>{pe&&Se(y(f(me)?me:V??C()))},[pe]);const setOpen=e=>{e&&(te||le)||(void 0===P&&he(e),N?.(e))},commit=e=>{void 0===z&&de(e),T?.(e)},be=l.useCallback((e,t)=>{const[l,o]=D(t,e),n=g(e).getTime();return!!(f(B)&&n+1e3*o<B.getTime())||!!(f(I)&&n+1e3*l>I.getTime())||(E?.(e,t)??!1)},[B,I,E]),ge=new Date,ye=k(ge,{seconds:H?ge.getSeconds():0}),De=h(ye,B,I)||(R?.(ye)??!1)||be(ye,"second"),ve=l.useMemo(()=>j(m(F,A),Q),[F,A,Q]);return e(d,{...ne,size:$,color:_,density:ee,readOnly:te,disabled:le,triggerRef:ae,startIcon:oe??e(i,{}),display:f(me)?u(me,F,A):Q??"",samples:ve,empty:!f(me),clearable:U,onClear:()=>commit(null),open:pe,onOpenChange:setOpen,labels:se,hiddenValues:Z?[{name:Z,value:f(me)?v(me,H):""}]:void 0,children:t("div",{className:"flex flex-col gap-1.5",children:[t("div",{className:w("flex items-stretch",x[$]),children:[e(n,{size:$,color:_,locale:F,weekStartsOn:ie,month:fe,onMonthChange:Se,selected:[me],onSelect:e=>{const t=f(me)?b(e,me):g(e);commit(t),Se(y(t)),X&&setOpen(!1)},minDate:B,maxDate:I,shouldDisableDate:R,labels:se,autoFocus:!0}),e(r,{}),e(a,{size:$,density:ee,locale:F,value:f(me)?me:null,referenceDate:f(me)?me:C(),onChange:commit,hour12:re,showSeconds:H,hourStep:J,minuteStep:K,secondStep:L,shouldDisableTime:be,labels:se})]}),t(c,{size:$,children:[U?e(o,{variant:"ghost",size:$,color:_,density:"compact",onClick:()=>{commit(null),setOpen(!1)},children:se.clear}):null,W?e(o,{variant:"ghost",size:$,color:_,density:"compact",disabled:De,onClick:()=>{commit(ye),Se(y(ye))},children:se.now}):null,e(o,{variant:"solid",size:$,color:_,density:"compact",onClick:()=>setOpen(!1),children:se.done})]})]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlDateTimePicker}from"./PlDateTimePicker.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassColor, PlassOrientation, PlassSize } from '../../types.js';
|
|
3
|
+
/** Where the label sits along a labelled divider. Ignored without a label. */
|
|
4
|
+
export type PlDividerTextAlign = PlassAlign;
|
|
5
|
+
export interface PlDividerProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* Which way the line runs. A vertical divider has no height of its own — it
|
|
8
|
+
* stretches to its flex parent, which is what a rule between two toolbar
|
|
9
|
+
* groups should do.
|
|
10
|
+
* @default 'horizontal'
|
|
11
|
+
*/
|
|
12
|
+
orientation?: PlassOrientation;
|
|
13
|
+
/**
|
|
14
|
+
* Semantic colour role, and — like `PlTextLink`'s — it has **no default**.
|
|
15
|
+
*
|
|
16
|
+
* Left out, the rule is the neutral hairline, which is the one that is
|
|
17
|
+
* visible on every ground the library has: a page wash, a glass sheet, a
|
|
18
|
+
* card. The sheet's own white hairline is white light on a translucent pane
|
|
19
|
+
* and disappears the moment a divider is set on something opaque, which is
|
|
20
|
+
* the same reason a checkbox's edge is drawn in the neutral one.
|
|
21
|
+
*
|
|
22
|
+
* Passing a family tints the rule instead, at the strength a hairline takes
|
|
23
|
+
* everywhere else in the library.
|
|
24
|
+
*/
|
|
25
|
+
color?: PlassColor;
|
|
26
|
+
/** Type scale of the label. Nothing else on a divider has a size. */
|
|
27
|
+
size?: PlassSize;
|
|
28
|
+
/**
|
|
29
|
+
* How far the rule runs — the width of a horizontal divider, the height of a
|
|
30
|
+
* vertical one. A number is pixels; a string is any CSS length, so `'50%'`
|
|
31
|
+
* and `'12rem'` both work.
|
|
32
|
+
*
|
|
33
|
+
* `length` rather than `width`, because a divider is the one component whose
|
|
34
|
+
* long axis turns with `orientation`: a `width` that meant height half the
|
|
35
|
+
* time would be a worse name than a longer one.
|
|
36
|
+
*
|
|
37
|
+
* Left out, a horizontal divider is the full width of its container and a
|
|
38
|
+
* vertical one stretches to the height of the flex row it is in.
|
|
39
|
+
*/
|
|
40
|
+
length?: number | string;
|
|
41
|
+
/**
|
|
42
|
+
* How thick the rule is. A number is pixels; a string is any CSS length.
|
|
43
|
+
* @default 1
|
|
44
|
+
*/
|
|
45
|
+
thickness?: number | string;
|
|
46
|
+
/** A label set into the line — "OR" between two sign-in options. */
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Where the label sits. `center` splits the line in half; `start` and `end`
|
|
50
|
+
* leave a short stub on the near side, so the label still reads as set *into*
|
|
51
|
+
* the rule rather than floating above it.
|
|
52
|
+
* @default 'center'
|
|
53
|
+
*/
|
|
54
|
+
textAlign?: PlDividerTextAlign;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A rule between two things.
|
|
58
|
+
*
|
|
59
|
+
* With no children it is Base UI's `Separator` and nothing else — a real
|
|
60
|
+
* `role="separator"` with the right `aria-orientation`. With children the line
|
|
61
|
+
* breaks around the label.
|
|
62
|
+
*
|
|
63
|
+
* `separator` is not a name-from-content role, so a visible label does *not*
|
|
64
|
+
* become the accessible name on its own: a screen reader would announce a bare
|
|
65
|
+
* "separator" and read the word "OR" as loose text somewhere nearby. A string
|
|
66
|
+
* label is therefore copied into `aria-label`. Anything richer is left alone —
|
|
67
|
+
* only the caller knows which part of it is the name.
|
|
68
|
+
*
|
|
69
|
+
* There is no `variant` and no `elevation`, because a divider is not a surface.
|
|
70
|
+
* It is not made of glass, catches no light and casts no shadow — it is the
|
|
71
|
+
* absence of a surface, drawn.
|
|
72
|
+
*/
|
|
73
|
+
export declare const PlDivider: React.ForwardRefExoticComponent<PlDividerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{Separator as l}from"@base-ui/react/separator";import{metaTextClasses as o}from"../../internal/styles.js";const a="[border-color:var(--p-rule-color)]";function toLength(e){return"number"==typeof e?`${e}px`:e}const i={horizontal:{start:["w-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","w-4 shrink-0"]},vertical:{start:["h-4 shrink-0","flex-1"],center:["flex-1","flex-1"],end:["flex-1","h-4 shrink-0"]}},n={xs:"gap-1.5",sm:"gap-2",md:"gap-3",lg:"gap-3.5",xl:"gap-4"};export const PlDivider=/* @__PURE__ */t.forwardRef(function PlDivider({orientation:t="horizontal",color:s,size:c="md",length:d,thickness:f,textAlign:p="center",className:h,style:u,children:m,...x},v){const w="vertical"===t,g=null!=m&&!1!==m&&""!==m,b={"--p-rule-color":s?`var(--plass-${s}-line)`:"var(--plass-border)","--p-rule":toLength(f)??"1px"},$=toLength(d),j={...b,...void 0===$?null:w?{height:$}:{width:$},...u};if(!g)return e(l,{ref:v,orientation:t,className:[w?"w-0 border-l [border-left-width:var(--p-rule)] "+(void 0===$?"self-stretch":""):"h-0 w-full border-t [border-top-width:var(--p-rule)]",a,h??""].filter(Boolean).join(" "),style:j,...x});const[k,y]=i[t][p],N=w?"w-0 border-l [border-left-width:var(--p-rule)]":"h-0 border-t [border-top-width:var(--p-rule)]";return r(l,{ref:v,orientation:t,"aria-label":"string"==typeof m?m:void 0,className:["flex items-center",w?"w-auto flex-col "+(void 0===$?"self-stretch":""):"w-full",n[c],h??""].filter(Boolean).join(" "),style:j,...x,children:[e("span",{"aria-hidden":"true",className:`${N} ${k} ${a}`}),e("span",{className:["shrink-0 whitespace-nowrap text-(--plass-muted-fg)",o[c],w?"[writing-mode:vertical-rl]":""].filter(Boolean).join(" "),children:m}),e("span",{"aria-hidden":"true",className:`${N} ${y} ${a}`})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlDivider}from"./PlDivider.js";
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Dialog as BaseUIDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import type { PlassSide, PlassStyleProps } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* How the panel relates to the page.
|
|
6
|
+
*
|
|
7
|
+
* - `overlay` — it is opened, it floats over the page on a scrim, it holds the
|
|
8
|
+
* focus, and it is dismissed. The navigation drawer behind a hamburger, the
|
|
9
|
+
* filter panel beside a table.
|
|
10
|
+
* - `inline` — it is part of the layout and the page is laid out around it. No
|
|
11
|
+
* scrim, no portal, no focus trap, nothing to dismiss. The sidebar that is
|
|
12
|
+
* simply there.
|
|
13
|
+
*
|
|
14
|
+
* A separate axis from `variant`, which already means the weight of a surface
|
|
15
|
+
* across the whole library and would be a second spelling of nothing.
|
|
16
|
+
*/
|
|
17
|
+
export type PlDrawerMode = 'overlay' | 'inline';
|
|
18
|
+
/**
|
|
19
|
+
* A drawer takes `size`, `color` and `density` and stops there.
|
|
20
|
+
*
|
|
21
|
+
* There is no `variant`, for `PlModal`'s reason: the three materials answer
|
|
22
|
+
* "how much does this surface assert itself against the page", and a panel that
|
|
23
|
+
* has taken an edge of the window has answered it. There is no `elevation`
|
|
24
|
+
* either — an `overlay` drawer floats and carries a shadow at the top of the
|
|
25
|
+
* ladder, an `inline` one is part of the layout and carries none, and neither
|
|
26
|
+
* is a decision worth offering.
|
|
27
|
+
*/
|
|
28
|
+
export interface PlDrawerProps extends Pick<PlassStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'children'> {
|
|
29
|
+
/**
|
|
30
|
+
* Which edge the panel is attached to. Physical rather than logical, the way
|
|
31
|
+
* `PlassSide` is everywhere: a drawer along the top of the window is along the
|
|
32
|
+
* top in every writing direction.
|
|
33
|
+
* @default 'left'
|
|
34
|
+
*/
|
|
35
|
+
side?: PlassSide;
|
|
36
|
+
/** @default 'overlay' */
|
|
37
|
+
mode?: PlDrawerMode;
|
|
38
|
+
/** The drawer is shown. Use with `onOpenChange` for a controlled drawer. */
|
|
39
|
+
open?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether the drawer starts open, for an uncontrolled one.
|
|
42
|
+
*
|
|
43
|
+
* Defaults to `false` in `overlay` mode and `true` in `inline` mode, because
|
|
44
|
+
* a fixed sidebar that had to be opened before it appeared would not be a
|
|
45
|
+
* fixed sidebar.
|
|
46
|
+
*/
|
|
47
|
+
defaultOpen?: boolean;
|
|
48
|
+
onOpenChange?: (open: boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* The element that opens the drawer, wired up by Base UI.
|
|
51
|
+
*
|
|
52
|
+
* `overlay` only. An `inline` drawer is not opened — it is in the layout — so
|
|
53
|
+
* a trigger there would have nothing to do and is not rendered.
|
|
54
|
+
*/
|
|
55
|
+
trigger?: React.ReactElement;
|
|
56
|
+
/** The heading. Rendered as the element that names the drawer. */
|
|
57
|
+
title?: React.ReactNode;
|
|
58
|
+
/** A line under the title, and the drawer's accessible description. */
|
|
59
|
+
description?: React.ReactNode;
|
|
60
|
+
/**
|
|
61
|
+
* The bottom row, held against the foot of the panel while the body scrolls.
|
|
62
|
+
* Laid out end-aligned, so a pair of buttons needs no wrapper of its own —
|
|
63
|
+
* and `PlDrawerClose` is what makes one of them dismiss.
|
|
64
|
+
*/
|
|
65
|
+
actions?: React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Scores the panel between the header, the body and the actions with a
|
|
68
|
+
* hairline instead of separating them with space. Worth turning on the moment
|
|
69
|
+
* the body scrolls: the lines are what say the header stayed put.
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
dividers?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Shows the × in the corner. On in `overlay` mode, where the panel has taken
|
|
75
|
+
* the page and the way out should not have to be remembered; off in `inline`
|
|
76
|
+
* mode, where a × that closes a fixed sidebar with nothing to reopen it is a
|
|
77
|
+
* one-way door.
|
|
78
|
+
*/
|
|
79
|
+
showClose?: boolean;
|
|
80
|
+
/** Accessible name of the × button. Never drawn. @default 'Close' */
|
|
81
|
+
closeLabel?: string;
|
|
82
|
+
/**
|
|
83
|
+
* How far the panel reaches in from its edge: a **width** for `left` and
|
|
84
|
+
* `right`, a **height** for `top` and `bottom`. Numbers are pixels.
|
|
85
|
+
*
|
|
86
|
+
* Left alone, a side panel takes the width its `size` implies and a top or
|
|
87
|
+
* bottom panel is as tall as what is in it, up to 85% of the window.
|
|
88
|
+
*/
|
|
89
|
+
extent?: number | string;
|
|
90
|
+
/**
|
|
91
|
+
* Rounds the two corners on the edge that faces the page — the top and bottom
|
|
92
|
+
* of a side panel, the inner pair of a top or bottom one. The corners against
|
|
93
|
+
* the window edge are always square, because a corner cut off something that
|
|
94
|
+
* has no visible end is a corner cut off nothing.
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
rounded?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Whether the page behind is taken away. `'trap-focus'` keeps the page
|
|
100
|
+
* scrollable and clickable while still holding focus inside. `overlay` only.
|
|
101
|
+
* @default true
|
|
102
|
+
*/
|
|
103
|
+
modal?: boolean | 'trap-focus';
|
|
104
|
+
/**
|
|
105
|
+
* Whether pressing Escape or clicking the scrim closes the drawer. Turn it off
|
|
106
|
+
* for the drawer that has to be answered — and then give it actions that
|
|
107
|
+
* answer it, because there will be no other way out. `overlay` only.
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
dismissible?: boolean;
|
|
111
|
+
/** The body. */
|
|
112
|
+
children?: React.ReactNode;
|
|
113
|
+
}
|
|
114
|
+
export type PlDrawerCloseProps = React.ComponentPropsWithoutRef<typeof BaseUIDialog.Close>;
|
|
115
|
+
/**
|
|
116
|
+
* Closes the drawer it is inside.
|
|
117
|
+
*
|
|
118
|
+
* Exported for `PlModalClose`'s reason: an uncontrolled drawer has no `setOpen`
|
|
119
|
+
* for its Cancel button to call. It is an `overlay` drawer's button — an
|
|
120
|
+
* `inline` drawer is not a Base UI dialog and has nothing for this to talk to.
|
|
121
|
+
*
|
|
122
|
+
* `render` is Base UI's own escape hatch, so a real Plass button dismisses:
|
|
123
|
+
* `<PlDrawerClose render={<PlButton variant="ghost">Cancel</PlButton>} />`.
|
|
124
|
+
*/
|
|
125
|
+
export declare const PlDrawerClose: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
126
|
+
/**
|
|
127
|
+
* A panel attached to one edge of the window.
|
|
128
|
+
*
|
|
129
|
+
* Two things in one component, because they are the same panel: `overlay` is the
|
|
130
|
+
* drawer you open — a scrim, a focus trap, Escape — and `inline` is the drawer
|
|
131
|
+
* that is simply part of the page. Everything else about them is identical,
|
|
132
|
+
* which is exactly why they should not be two components a caller has to switch
|
|
133
|
+
* between when a sidebar becomes a hamburger at a breakpoint.
|
|
134
|
+
*
|
|
135
|
+
* The sections are props rather than compound sub-components, as on `PlCard` and
|
|
136
|
+
* `PlModal`: the arrangement is fixed — heading, description, body, actions —
|
|
137
|
+
* and what a caller wants to decide is what goes in each slot. The body is the
|
|
138
|
+
* only part that scrolls, so the heading and the actions stay put.
|
|
139
|
+
*
|
|
140
|
+
* In `overlay` mode Base UI owns everything hard about it: the focus trap, the
|
|
141
|
+
* scroll lock, the `aria-labelledby` / `aria-describedby` wiring, restoring
|
|
142
|
+
* focus to the trigger, and the inert page behind.
|
|
143
|
+
*/
|
|
144
|
+
export declare function PlDrawer({ side, mode, size, color, density, open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers, showClose, closeLabel, extent, rounded, modal, dismissible, className, style, children, ...props }: PlDrawerProps): React.JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as s,jsxs as l,Fragment as e}from"react/jsx-runtime";import{Dialog as r}from"@base-ui/react/dialog";import{CloseIcon as a}from"../../internal/icons.js";import{cx as o,focusRingClasses as d,glassClasses as i,hasContent as t,metaTextClasses as n,sheetBodyClasses as u,sheetHeaderGapClasses as p,sheetLineClasses as m,sheetPaddingXClasses as c,sheetPaddingYClasses as x,sheetSectionGapClasses as f,sheetTitleClasses as g,surfaceSlots as h}from"../../internal/styles.js";const b={xs:"w-56",sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[28rem]"},v={left:{xs:"rounded-r-(--plass-radius-xs)",sm:"rounded-r-(--plass-radius-sm)",md:"rounded-r-(--plass-radius-md)",lg:"rounded-r-(--plass-radius-lg)",xl:"rounded-r-(--plass-radius-xl)"},right:{xs:"rounded-l-(--plass-radius-xs)",sm:"rounded-l-(--plass-radius-sm)",md:"rounded-l-(--plass-radius-md)",lg:"rounded-l-(--plass-radius-lg)",xl:"rounded-l-(--plass-radius-xl)"},top:{xs:"rounded-b-(--plass-radius-xs)",sm:"rounded-b-(--plass-radius-sm)",md:"rounded-b-(--plass-radius-md)",lg:"rounded-b-(--plass-radius-lg)",xl:"rounded-b-(--plass-radius-xl)"},bottom:{xs:"rounded-t-(--plass-radius-xs)",sm:"rounded-t-(--plass-radius-sm)",md:"rounded-t-(--plass-radius-md)",lg:"rounded-t-(--plass-radius-lg)",xl:"rounded-t-(--plass-radius-xl)"}},y={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},w={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},j=/* @__PURE__ */[i,"relative flex flex-col overflow-hidden","text-(--plass-fg) bg-(--plass-glass-press)","[border-color:var(--plass-glass-line)]","[outline:none]"].join(" "),N=/* @__PURE__ */["[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),k=/* @__PURE__ */["fixed inset-0 z-50 bg-(--plass-scrim)","[backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]",N].join(" "),C=/* @__PURE__ */["flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--plass-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease)]","hover:bg-(--p-soft) hover:text-(--plass-fg)",d].join(" ");export const PlDrawerClose=r.Close;export function PlDrawer({side:d="left",mode:i="overlay",size:_="md",color:$="primary",density:z="default",open:D,defaultOpen:P,onOpenChange:O,trigger:T,title:B,description:F,actions:L,dividers:R=!1,showClose:V,closeLabel:q="Close",extent:A,rounded:E=!0,modal:G=!0,dismissible:H=!0,className:I,style:J,children:K,...M}){const Q="overlay"===i,S="left"===d||"right"===d,U=V??Q,W=c[z][_],X=x[z][_],Y=R?`${W} ${X}`:W,Z=t(B)||t(F),ss=t(L),ls=void 0===A?null:{[S?"width":"height"]:"number"==typeof A?`${A}px`:A},es=o(j,u[_],y[d],E?v[d][_]:"",Q?"[box-shadow:var(--plass-shadow-4),var(--plass-gloss-glass)]":"[box-shadow:var(--plass-gloss-glass)]",Q?N:"",S?`h-full max-w-full ${void 0===A?b[_]:""}`:"w-full "+(void 0===A?"max-h-[85%]":""),R?"":`${X} ${f[_]}`,I),rs=Q?r.Title:"h2",as=Q?r.Description:"p",os=l(e,{children:[Z||U?l("div",{className:o("flex shrink-0 items-start gap-3",Y),children:[l("div",{className:o("flex min-w-0 flex-1 flex-col",p[_]),children:[t(B)?s(rs,{className:o("m-0 font-semibold",g[_]),children:B}):null,t(F)?s(as,{className:o("m-0 text-(--plass-muted-fg)",n[_]),children:F}):null]}),U?Q?s(r.Close,{"aria-label":q,className:C,children:s(a,{})}):s("button",{type:"button","aria-label":q,className:C,onClick:()=>O?.(!1),children:s(a,{})}):null]}):null,t(K)?s("div",{className:o("min-h-0 flex-1 overflow-y-auto overscroll-contain",Y,R&&(Z||U)?m:"",R?"":"-my-1 py-1"),children:K}):null,ss?s("div",{className:o("flex shrink-0 flex-wrap items-center justify-end gap-2",Y,R?m:""),children:L}):null]});return Q?l(r.Root,{open:D,defaultOpen:P,modal:G,disablePointerDismissal:!H,onOpenChange:(s,l)=>{H||s||"escape-key"!==l.reason?O?.(s):l.cancel()},children:[T?s(r.Trigger,{render:T}):null,l(r.Portal,{children:[s(r.Backdrop,{className:`plass-portal ${k}`}),s(r.Viewport,{className:o("plass-portal fixed inset-0 z-50 flex",w[d]),children:s(r.Popup,{className:es,style:{...h($,3),...ls,...J},...M,children:os})})]})]}):D??P??!0?s("div",{className:es,style:{...h($,0),...ls,...J},...M,children:os}):null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlDrawer,PlDrawerClose}from"./PlDrawer.js";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/** Why a file was turned away. One reason per file, in the order they are checked. */
|
|
4
|
+
export type PlFileRejectionReason = 'type' | 'size' | 'count';
|
|
5
|
+
export interface PlFileRejection {
|
|
6
|
+
file: File;
|
|
7
|
+
reason: PlFileRejectionReason;
|
|
8
|
+
}
|
|
9
|
+
export interface PlFilePickerProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'title' | 'children'> {
|
|
10
|
+
/**
|
|
11
|
+
* Drop shadow depth. `0` is the default — a dropzone is cut into the page
|
|
12
|
+
* rather than floating over it.
|
|
13
|
+
* @default 0
|
|
14
|
+
*/
|
|
15
|
+
elevation?: PlassElevation;
|
|
16
|
+
/**
|
|
17
|
+
* Which files the browser's own picker offers, in the `accept` grammar —
|
|
18
|
+
* `'image/*,.pdf'`. Dropped files are checked against it too, which the
|
|
19
|
+
* attribute alone does not do.
|
|
20
|
+
*/
|
|
21
|
+
accept?: string;
|
|
22
|
+
/** Whether more than one file may be chosen. @default false */
|
|
23
|
+
multiple?: boolean;
|
|
24
|
+
/** The largest a single file may be, in bytes. */
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
/**
|
|
27
|
+
* How many files may be held at once. Implies `multiple`, and is checked
|
|
28
|
+
* against what is already chosen rather than against one drop.
|
|
29
|
+
*/
|
|
30
|
+
maxFiles?: number;
|
|
31
|
+
/** The chosen files. Use with `onFilesChange` for a controlled picker. */
|
|
32
|
+
value?: readonly File[];
|
|
33
|
+
/** The initially chosen files, for an uncontrolled one. */
|
|
34
|
+
defaultValue?: readonly File[];
|
|
35
|
+
onFilesChange?: (files: File[]) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Called with everything that was turned away, and why. Without it a rejected
|
|
38
|
+
* file disappears silently, which is the single worst thing a dropzone does.
|
|
39
|
+
*/
|
|
40
|
+
onReject?: (rejections: PlFileRejection[]) => void;
|
|
41
|
+
/** Label above the box. */
|
|
42
|
+
label?: React.ReactNode;
|
|
43
|
+
/** Helper text below the box. */
|
|
44
|
+
description?: React.ReactNode;
|
|
45
|
+
/** Error message below. Its presence also turns the picker invalid. */
|
|
46
|
+
error?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Forces the invalid state without a message — for when an external form
|
|
49
|
+
* library owns the validity. Defaults to whether `error` has content.
|
|
50
|
+
*/
|
|
51
|
+
invalid?: boolean;
|
|
52
|
+
/** The line inside the box. Defaults to an English sentence. */
|
|
53
|
+
title?: React.ReactNode;
|
|
54
|
+
/** The line under it — what is accepted, how big, how many. */
|
|
55
|
+
hint?: React.ReactNode;
|
|
56
|
+
/** The glyph above the title. Pass `null` for a box with no picture in it. */
|
|
57
|
+
icon?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Lists the chosen files under the box, each with a way to remove it.
|
|
60
|
+
* @default true
|
|
61
|
+
*/
|
|
62
|
+
showList?: boolean;
|
|
63
|
+
/** Accessible name of a file's remove button. Receives the file's name. */
|
|
64
|
+
removeLabel?: (name: string) => string;
|
|
65
|
+
/** Stretches to the width of the container. @default true */
|
|
66
|
+
fullWidth?: boolean;
|
|
67
|
+
/** Unavailable. */
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
/** The files are shown but cannot be added to or removed. */
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
/** Whether a file must be chosen before the form is submitted. */
|
|
72
|
+
required?: boolean;
|
|
73
|
+
/** Identifies the field when a form is submitted. */
|
|
74
|
+
name?: string;
|
|
75
|
+
id?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* `1.4 MB`, in the units a person reading a file list expects.
|
|
79
|
+
*
|
|
80
|
+
* Base 1000 rather than 1024, and `MB` rather than `MiB`: it is the number
|
|
81
|
+
* every operating system's file browser shows, and a picker that disagrees with
|
|
82
|
+
* the Finder about how big the file is has picked a fight it cannot win.
|
|
83
|
+
*/
|
|
84
|
+
export declare function formatFileSize(bytes: number): string;
|
|
85
|
+
/**
|
|
86
|
+
* A box you drop files on, or click to open the file dialog.
|
|
87
|
+
*
|
|
88
|
+
* There is no Base UI primitive under this, and the fallback the library allows
|
|
89
|
+
* — plain React and DOM — is the right one: a dropzone is a `<div>` listening
|
|
90
|
+
* for four drag events and an `<input type="file">` it clicks for you. There is
|
|
91
|
+
* no popup to position, no focus to trap and no roving anything.
|
|
92
|
+
*
|
|
93
|
+
* What that leaves is the part every hand-rolled dropzone gets wrong. The drag
|
|
94
|
+
* counter is one: `dragenter` and `dragleave` both fire as the pointer crosses
|
|
95
|
+
* a *child* of the zone, so a zone that toggles a boolean flickers the whole
|
|
96
|
+
* time a file is dragged across its own contents. Counting them is the fix. The
|
|
97
|
+
* other is `accept`, which the browser enforces on its own dialog and never on
|
|
98
|
+
* a drop, so a dropzone that only sets the attribute accepts anything the
|
|
99
|
+
* moment a file arrives by drag.
|
|
100
|
+
*
|
|
101
|
+
* The shell is a `<div>` and the pressable area inside it is a real `<button>`,
|
|
102
|
+
* with the file list outside that button — the remove buttons cannot be nested
|
|
103
|
+
* inside the browse button.
|
|
104
|
+
*/
|
|
105
|
+
export declare const PlFilePicker: React.ForwardRefExoticComponent<PlFilePickerProps & React.RefAttributes<HTMLInputElement>>;
|