plass-ui 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/PlAccordion.d.ts +98 -0
- package/dist/components/accordion/PlAccordion.js +131 -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 +109 -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 +71 -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 +47 -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 +48 -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 +49 -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 +120 -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 +65 -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 +94 -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 +50 -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 +49 -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 +177 -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 +45 -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 +58 -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 +121 -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 +168 -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 +112 -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 +141 -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 +46 -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 +201 -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 +196 -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 +64 -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 +102 -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 +177 -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 +206 -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 +100 -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 +144 -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 +65 -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 +199 -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 +47 -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 +87 -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 +152 -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 +106 -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 +107 -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 +190 -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 +274 -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 +291 -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 +51 -0
- package/dist/components/grid/PlGridItem.d.ts +50 -0
- package/dist/components/grid/PlGridItem.js +34 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/grid/index.js +2 -0
- package/dist/components/highlight/PlHighlight.d.ts +90 -0
- package/dist/components/highlight/PlHighlight.js +185 -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 +294 -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 +58 -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 +37 -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 +160 -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 +209 -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 +150 -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 +111 -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 +109 -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 +77 -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 +159 -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 +324 -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 +154 -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 +113 -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 +34 -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 +47 -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 +40 -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 +99 -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 +101 -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 +411 -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 +206 -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 +115 -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 +142 -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 +132 -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 +74 -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 +131 -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 +210 -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 +182 -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 +126 -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 +136 -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 +97 -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 +207 -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 +174 -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 +65 -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 +117 -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 +143 -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 +75 -1
- package/dist/internal/animate.d.ts +161 -0
- package/dist/internal/animate.js +318 -0
- package/dist/internal/button-group.d.ts +27 -0
- package/dist/internal/button-group.js +19 -0
- package/dist/internal/calendar.d.ts +148 -0
- package/dist/internal/calendar.js +501 -0
- package/dist/internal/date.d.ts +173 -0
- package/dist/internal/date.js +353 -0
- package/dist/internal/format.d.ts +24 -0
- package/dist/internal/format.js +41 -0
- package/dist/internal/grid.d.ts +67 -0
- package/dist/internal/grid.js +143 -0
- package/dist/internal/icons.d.ts +86 -1
- package/dist/internal/icons.js +138 -1
- package/dist/internal/menu.d.ts +20 -0
- package/dist/internal/menu.js +18 -0
- package/dist/internal/picker.d.ts +118 -0
- package/dist/internal/picker.js +139 -0
- package/dist/internal/progress.d.ts +145 -0
- package/dist/internal/progress.js +167 -0
- package/dist/internal/sizer.d.ts +32 -0
- package/dist/internal/sizer.js +35 -0
- package/dist/internal/styles.d.ts +198 -8
- package/dist/internal/styles.js +636 -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 +1 -1
- package/package.json +31 -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,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Separator } from '@base-ui/react/separator';
|
|
4
|
+
import { metaTextClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* The hairline itself. A border rather than a filled 1px box, so it lands on
|
|
7
|
+
* the device pixel grid the same way every other edge in the library does.
|
|
8
|
+
*
|
|
9
|
+
* Its thickness is read from a slot rather than from a `border-2`-style utility
|
|
10
|
+
* because a labelled divider draws the rule twice — the two stubs either side
|
|
11
|
+
* of the label — and one custom property set on the root keeps both the same
|
|
12
|
+
* without threading a value through each.
|
|
13
|
+
*/
|
|
14
|
+
const lineClasses = '[border-color:var(--p-rule-color)]';
|
|
15
|
+
/** Turns `2` into `2px` and leaves `'0.5rem'` alone. */
|
|
16
|
+
function toLength(value) {
|
|
17
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* How the line is split around an off-centre label: `[before, after]`. The short
|
|
21
|
+
* side is a fixed stub rather than a small flex ratio, so the label sits the
|
|
22
|
+
* same distance from the edge whatever the divider's length turns out to be.
|
|
23
|
+
*/
|
|
24
|
+
const stubClasses = {
|
|
25
|
+
horizontal: {
|
|
26
|
+
start: ['w-4 shrink-0', 'flex-1'],
|
|
27
|
+
center: ['flex-1', 'flex-1'],
|
|
28
|
+
end: ['flex-1', 'w-4 shrink-0']
|
|
29
|
+
},
|
|
30
|
+
vertical: {
|
|
31
|
+
start: ['h-4 shrink-0', 'flex-1'],
|
|
32
|
+
center: ['flex-1', 'flex-1'],
|
|
33
|
+
end: ['flex-1', 'h-4 shrink-0']
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/** Space between the label and the line on either side of it. */
|
|
37
|
+
const labelGapClasses = {
|
|
38
|
+
xs: 'gap-1.5',
|
|
39
|
+
sm: 'gap-2',
|
|
40
|
+
md: 'gap-3',
|
|
41
|
+
lg: 'gap-3.5',
|
|
42
|
+
xl: 'gap-4'
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A rule between two things.
|
|
46
|
+
*
|
|
47
|
+
* With no children it is Base UI's `Separator` and nothing else — a real
|
|
48
|
+
* `role="separator"` with the right `aria-orientation`. With children the line
|
|
49
|
+
* breaks around the label.
|
|
50
|
+
*
|
|
51
|
+
* `separator` is not a name-from-content role, so a visible label does *not*
|
|
52
|
+
* become the accessible name on its own: a screen reader would announce a bare
|
|
53
|
+
* "separator" and read the word "OR" as loose text somewhere nearby. A string
|
|
54
|
+
* label is therefore copied into `aria-label`. Anything richer is left alone —
|
|
55
|
+
* only the caller knows which part of it is the name.
|
|
56
|
+
*
|
|
57
|
+
* There is no `variant` and no `elevation`, because a divider is not a surface.
|
|
58
|
+
* It is not made of glass, catches no light and casts no shadow — it is the
|
|
59
|
+
* absence of a surface, drawn.
|
|
60
|
+
*/
|
|
61
|
+
export const PlDivider = /* @__PURE__ */ React.forwardRef(function PlDivider({ orientation = 'horizontal', color, size = 'md', length, thickness, textAlign = 'center', className, style, children, ...props }, ref) {
|
|
62
|
+
const vertical = orientation === 'vertical';
|
|
63
|
+
const hasLabel = children !== undefined && children !== null && children !== false && children !== '';
|
|
64
|
+
const slots = {
|
|
65
|
+
'--p-rule-color': color ? `var(--plass-${color}-line)` : 'var(--plass-border)',
|
|
66
|
+
'--p-rule': toLength(thickness) ?? '1px'
|
|
67
|
+
};
|
|
68
|
+
// The long axis, and only when it was asked for: left alone, a horizontal
|
|
69
|
+
// divider is `w-full` and a vertical one stretches to its flex row, which are
|
|
70
|
+
// the two things a rule between two things should already do.
|
|
71
|
+
const span = toLength(length);
|
|
72
|
+
const sizing = span === undefined ? null : vertical ? { height: span } : { width: span };
|
|
73
|
+
const rootStyle = { ...slots, ...sizing, ...style };
|
|
74
|
+
if (!hasLabel) {
|
|
75
|
+
return (_jsx(Separator, { ref: ref, orientation: orientation, className: [
|
|
76
|
+
// The line is a single border edge; the box itself has no thickness,
|
|
77
|
+
// so a divider never adds a pixel of layout beyond the rule.
|
|
78
|
+
vertical
|
|
79
|
+
? `w-0 border-l [border-left-width:var(--p-rule)] ${span === undefined ? 'self-stretch' : ''}`
|
|
80
|
+
: 'h-0 w-full border-t [border-top-width:var(--p-rule)]',
|
|
81
|
+
lineClasses,
|
|
82
|
+
className ?? ''
|
|
83
|
+
]
|
|
84
|
+
.filter(Boolean)
|
|
85
|
+
.join(' '), style: rootStyle, ...props }));
|
|
86
|
+
}
|
|
87
|
+
const [before, after] = stubClasses[orientation][textAlign];
|
|
88
|
+
const edgeClasses = vertical
|
|
89
|
+
? 'w-0 border-l [border-left-width:var(--p-rule)]'
|
|
90
|
+
: 'h-0 border-t [border-top-width:var(--p-rule)]';
|
|
91
|
+
return (_jsxs(Separator, { ref: ref, orientation: orientation, "aria-label": typeof children === 'string' ? children : undefined, className: [
|
|
92
|
+
'flex items-center',
|
|
93
|
+
vertical ? `w-auto flex-col ${span === undefined ? 'self-stretch' : ''}` : 'w-full',
|
|
94
|
+
labelGapClasses[size],
|
|
95
|
+
className ?? ''
|
|
96
|
+
]
|
|
97
|
+
.filter(Boolean)
|
|
98
|
+
.join(' '), style: rootStyle, ...props, children: [_jsx("span", { "aria-hidden": "true", className: `${edgeClasses} ${before} ${lineClasses}` }), _jsx("span", { className: [
|
|
99
|
+
'shrink-0 whitespace-nowrap text-(--plass-muted-fg)',
|
|
100
|
+
metaTextClasses[size],
|
|
101
|
+
// A vertical rule's label has to turn with it, or the line grows to
|
|
102
|
+
// the width of the word and stops being a hairline.
|
|
103
|
+
vertical ? '[writing-mode:vertical-rl]' : ''
|
|
104
|
+
]
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join(' '), children: children }), _jsx("span", { "aria-hidden": "true", className: `${edgeClasses} ${after} ${lineClasses}` })] }));
|
|
107
|
+
});
|
|
@@ -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,190 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseUIDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { CloseIcon } from '../../internal/icons.js';
|
|
4
|
+
import { cx, focusRingClasses, glassClasses, hasContent, metaTextClasses, sheetBodyClasses, sheetHeaderGapClasses, sheetLineClasses, sheetPaddingXClasses, sheetPaddingYClasses, sheetSectionGapClasses, sheetTitleClasses, surfaceSlots } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* How wide a `left` or `right` panel is when nothing says otherwise.
|
|
7
|
+
*
|
|
8
|
+
* Its own ladder rather than `PlModal`'s `maxWidth`, and deliberately narrower
|
|
9
|
+
* at every step: a modal is measured by how long a line of text is comfortable
|
|
10
|
+
* inside it, and a drawer is measured by how much of the window it is willing
|
|
11
|
+
* to take away from what it is a drawer *for*.
|
|
12
|
+
*
|
|
13
|
+
* A `top` or `bottom` panel has no entry here on purpose — its extent is its
|
|
14
|
+
* content, capped at 85% of the window, because a bottom sheet holding three
|
|
15
|
+
* rows should be three rows tall.
|
|
16
|
+
*/
|
|
17
|
+
const extentClasses = {
|
|
18
|
+
xs: 'w-56',
|
|
19
|
+
sm: 'w-64',
|
|
20
|
+
md: 'w-80',
|
|
21
|
+
lg: 'w-96',
|
|
22
|
+
xl: 'w-[28rem]'
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The corners on the free edge, written out per side and per step because
|
|
26
|
+
* Tailwind only ever sees class names that appear literally in the source.
|
|
27
|
+
*/
|
|
28
|
+
const roundedClasses = {
|
|
29
|
+
left: {
|
|
30
|
+
xs: 'rounded-r-(--plass-radius-xs)',
|
|
31
|
+
sm: 'rounded-r-(--plass-radius-sm)',
|
|
32
|
+
md: 'rounded-r-(--plass-radius-md)',
|
|
33
|
+
lg: 'rounded-r-(--plass-radius-lg)',
|
|
34
|
+
xl: 'rounded-r-(--plass-radius-xl)'
|
|
35
|
+
},
|
|
36
|
+
right: {
|
|
37
|
+
xs: 'rounded-l-(--plass-radius-xs)',
|
|
38
|
+
sm: 'rounded-l-(--plass-radius-sm)',
|
|
39
|
+
md: 'rounded-l-(--plass-radius-md)',
|
|
40
|
+
lg: 'rounded-l-(--plass-radius-lg)',
|
|
41
|
+
xl: 'rounded-l-(--plass-radius-xl)'
|
|
42
|
+
},
|
|
43
|
+
top: {
|
|
44
|
+
xs: 'rounded-b-(--plass-radius-xs)',
|
|
45
|
+
sm: 'rounded-b-(--plass-radius-sm)',
|
|
46
|
+
md: 'rounded-b-(--plass-radius-md)',
|
|
47
|
+
lg: 'rounded-b-(--plass-radius-lg)',
|
|
48
|
+
xl: 'rounded-b-(--plass-radius-xl)'
|
|
49
|
+
},
|
|
50
|
+
bottom: {
|
|
51
|
+
xs: 'rounded-t-(--plass-radius-xs)',
|
|
52
|
+
sm: 'rounded-t-(--plass-radius-sm)',
|
|
53
|
+
md: 'rounded-t-(--plass-radius-md)',
|
|
54
|
+
lg: 'rounded-t-(--plass-radius-lg)',
|
|
55
|
+
xl: 'rounded-t-(--plass-radius-xl)'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The hairline on the free edge only. A border all round would draw a line
|
|
60
|
+
* along the window's own edge, where there is nothing on the other side of it
|
|
61
|
+
* to be separated from.
|
|
62
|
+
*/
|
|
63
|
+
const edgeClasses = {
|
|
64
|
+
left: 'border-r',
|
|
65
|
+
right: 'border-l',
|
|
66
|
+
top: 'border-b',
|
|
67
|
+
bottom: 'border-t'
|
|
68
|
+
};
|
|
69
|
+
/** Which end of the viewport the panel is pushed to, and along which axis. */
|
|
70
|
+
const viewportClasses = {
|
|
71
|
+
left: 'flex-row justify-start',
|
|
72
|
+
right: 'flex-row justify-end',
|
|
73
|
+
top: 'flex-col justify-start',
|
|
74
|
+
bottom: 'flex-col justify-end'
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* The sheet.
|
|
78
|
+
*
|
|
79
|
+
* Opacity only, exactly as on `PlModal`. A drawer that slid in would be
|
|
80
|
+
* dragging its own text across the screen for the length of the transition, and
|
|
81
|
+
* a panel is nothing but text and controls — this is the case the no-transform
|
|
82
|
+
* rule was written for, not the exception to it. What says the panel came from
|
|
83
|
+
* an edge is that it is *attached* to one: square against the window, cut on the
|
|
84
|
+
* free side.
|
|
85
|
+
*/
|
|
86
|
+
const panelClasses = /* @__PURE__ */ [
|
|
87
|
+
glassClasses,
|
|
88
|
+
'relative flex flex-col overflow-hidden',
|
|
89
|
+
'text-(--plass-fg) bg-(--plass-glass-press)',
|
|
90
|
+
'[border-color:var(--plass-glass-line)]',
|
|
91
|
+
'[outline:none]'
|
|
92
|
+
].join(' ');
|
|
93
|
+
const overlayShadowClasses = '[box-shadow:var(--plass-shadow-4),var(--plass-gloss-glass)]';
|
|
94
|
+
const inlineShadowClasses = '[box-shadow:var(--plass-gloss-glass)]';
|
|
95
|
+
const fadeClasses = /* @__PURE__ */ [
|
|
96
|
+
'[transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
97
|
+
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0'
|
|
98
|
+
].join(' ');
|
|
99
|
+
const backdropClasses = /* @__PURE__ */ [
|
|
100
|
+
'fixed inset-0 z-50 bg-(--plass-scrim)',
|
|
101
|
+
'[backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]',
|
|
102
|
+
fadeClasses
|
|
103
|
+
].join(' ');
|
|
104
|
+
/** The × in the corner, shared by both modes. */
|
|
105
|
+
const closeButtonClasses = /* @__PURE__ */ [
|
|
106
|
+
'flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center',
|
|
107
|
+
'rounded-full text-(--plass-muted-fg)',
|
|
108
|
+
'[&_svg]:size-[1.1em] [&_svg]:shrink-0',
|
|
109
|
+
'[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease)]',
|
|
110
|
+
'hover:bg-(--p-soft) hover:text-(--plass-fg)',
|
|
111
|
+
focusRingClasses
|
|
112
|
+
].join(' ');
|
|
113
|
+
/**
|
|
114
|
+
* Closes the drawer it is inside.
|
|
115
|
+
*
|
|
116
|
+
* Exported for `PlModalClose`'s reason: an uncontrolled drawer has no `setOpen`
|
|
117
|
+
* for its Cancel button to call. It is an `overlay` drawer's button — an
|
|
118
|
+
* `inline` drawer is not a Base UI dialog and has nothing for this to talk to.
|
|
119
|
+
*
|
|
120
|
+
* `render` is Base UI's own escape hatch, so a real Plass button dismisses:
|
|
121
|
+
* `<PlDrawerClose render={<PlButton variant="ghost">Cancel</PlButton>} />`.
|
|
122
|
+
*/
|
|
123
|
+
export const PlDrawerClose = BaseUIDialog.Close;
|
|
124
|
+
/**
|
|
125
|
+
* A panel attached to one edge of the window.
|
|
126
|
+
*
|
|
127
|
+
* Two things in one component, because they are the same panel: `overlay` is the
|
|
128
|
+
* drawer you open — a scrim, a focus trap, Escape — and `inline` is the drawer
|
|
129
|
+
* that is simply part of the page. Everything else about them is identical,
|
|
130
|
+
* which is exactly why they should not be two components a caller has to switch
|
|
131
|
+
* between when a sidebar becomes a hamburger at a breakpoint.
|
|
132
|
+
*
|
|
133
|
+
* The sections are props rather than compound sub-components, as on `PlCard` and
|
|
134
|
+
* `PlModal`: the arrangement is fixed — heading, description, body, actions —
|
|
135
|
+
* and what a caller wants to decide is what goes in each slot. The body is the
|
|
136
|
+
* only part that scrolls, so the heading and the actions stay put.
|
|
137
|
+
*
|
|
138
|
+
* In `overlay` mode Base UI owns everything hard about it: the focus trap, the
|
|
139
|
+
* scroll lock, the `aria-labelledby` / `aria-describedby` wiring, restoring
|
|
140
|
+
* focus to the trigger, and the inert page behind.
|
|
141
|
+
*/
|
|
142
|
+
export function PlDrawer({ side = 'left', mode = 'overlay', size = 'md', color = 'primary', density = 'default', open, defaultOpen, onOpenChange, trigger, title, description, actions, dividers = false, showClose, closeLabel = 'Close', extent, rounded = true, modal = true, dismissible = true, className, style, children, ...props }) {
|
|
143
|
+
const overlay = mode === 'overlay';
|
|
144
|
+
const along = side === 'left' || side === 'right';
|
|
145
|
+
const showCloseButton = showClose ?? overlay;
|
|
146
|
+
const insetX = sheetPaddingXClasses[density][size];
|
|
147
|
+
const insetY = sheetPaddingYClasses[density][size];
|
|
148
|
+
// With dividers the lines have to reach both edges, so the sheet gives up its
|
|
149
|
+
// padding and every section takes it on instead — the same trade PlCard makes.
|
|
150
|
+
const sectionClasses = dividers ? `${insetX} ${insetY}` : insetX;
|
|
151
|
+
const hasHeader = hasContent(title) || hasContent(description);
|
|
152
|
+
const hasActions = hasContent(actions);
|
|
153
|
+
const sizeStyle = extent === undefined
|
|
154
|
+
? null
|
|
155
|
+
: { [along ? 'width' : 'height']: typeof extent === 'number' ? `${extent}px` : extent };
|
|
156
|
+
const panel = cx(panelClasses, sheetBodyClasses[size], edgeClasses[side], rounded ? roundedClasses[side][size] : '', overlay ? overlayShadowClasses : inlineShadowClasses, overlay ? fadeClasses : '', along
|
|
157
|
+
? `h-full max-w-full ${extent === undefined ? extentClasses[size] : ''}`
|
|
158
|
+
: `w-full ${extent === undefined ? 'max-h-[85%]' : ''}`, dividers ? '' : `${insetY} ${sheetSectionGapClasses[size]}`, className);
|
|
159
|
+
// Base UI's parts carry the `aria-labelledby` / `aria-describedby` wiring an
|
|
160
|
+
// overlay drawer needs. An inline one is not a dialog and needs none, so it
|
|
161
|
+
// gets the plain tags rather than a dialog's parts outside a dialog.
|
|
162
|
+
const TitleTag = overlay ? BaseUIDialog.Title : 'h2';
|
|
163
|
+
const DescriptionTag = overlay ? BaseUIDialog.Description : 'p';
|
|
164
|
+
const contents = (_jsxs(_Fragment, { children: [hasHeader || showCloseButton ? (_jsxs("div", { className: cx('flex shrink-0 items-start gap-3', sectionClasses), children: [_jsxs("div", { className: cx('flex min-w-0 flex-1 flex-col', sheetHeaderGapClasses[size]), children: [hasContent(title) ? (_jsx(TitleTag, { className: cx('m-0 font-semibold', sheetTitleClasses[size]), children: title })) : null, hasContent(description) ? (_jsx(DescriptionTag, { className: cx('m-0 text-(--plass-muted-fg)', metaTextClasses[size]), children: description })) : null] }), showCloseButton ? (overlay ? (_jsx(BaseUIDialog.Close, { "aria-label": closeLabel, className: closeButtonClasses, children: _jsx(CloseIcon, {}) })) : (_jsx("button", { type: "button", "aria-label": closeLabel, className: closeButtonClasses, onClick: () => onOpenChange?.(false), children: _jsx(CloseIcon, {}) }))) : null] })) : null, hasContent(children) ? (_jsx("div", { className: cx('min-h-0 flex-1 overflow-y-auto overscroll-contain', sectionClasses, dividers && (hasHeader || showCloseButton) ? sheetLineClasses : '',
|
|
165
|
+
// A scroll container clips at its padding box and a focus ring is
|
|
166
|
+
// drawn outside the control that owns it, so a field at the top or
|
|
167
|
+
// bottom of an unruled body would have its ring sliced off. The
|
|
168
|
+
// padding is room for the ring and the negative margin hands the
|
|
169
|
+
// space straight back, so nothing on the sheet moves.
|
|
170
|
+
dividers ? '' : '-my-1 py-1'), children: children })) : null, hasActions ? (_jsx("div", { className: cx('flex shrink-0 flex-wrap items-center justify-end gap-2', sectionClasses, dividers ? sheetLineClasses : ''), children: actions })) : null] }));
|
|
171
|
+
if (!overlay) {
|
|
172
|
+
// An inline drawer is in the flow, so "closed" is "not in the layout".
|
|
173
|
+
// There is nothing to animate on the way out: the page around it is what
|
|
174
|
+
// moves, and moving the page is not this component's to do.
|
|
175
|
+
if (!(open ?? defaultOpen ?? true)) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return (_jsx("div", { className: panel, style: { ...surfaceSlots(color, 0), ...sizeStyle, ...style }, ...props, children: contents }));
|
|
179
|
+
}
|
|
180
|
+
return (_jsxs(BaseUIDialog.Root, { open: open, defaultOpen: defaultOpen, modal: modal, disablePointerDismissal: !dismissible, onOpenChange: (next, details) => {
|
|
181
|
+
// `disablePointerDismissal` covers the click on the scrim; Escape has no
|
|
182
|
+
// prop of its own, so it is cancelled here by the reason it arrives
|
|
183
|
+
// with.
|
|
184
|
+
if (!dismissible && !next && details.reason === 'escape-key') {
|
|
185
|
+
details.cancel();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
onOpenChange?.(next);
|
|
189
|
+
}, children: [trigger ? _jsx(BaseUIDialog.Trigger, { render: trigger }) : null, _jsxs(BaseUIDialog.Portal, { children: [_jsx(BaseUIDialog.Backdrop, { className: `plass-portal ${backdropClasses}` }), _jsx(BaseUIDialog.Viewport, { className: cx('plass-portal fixed inset-0 z-50 flex', viewportClasses[side]), children: _jsx(BaseUIDialog.Popup, { className: panel, style: { ...surfaceSlots(color, 3), ...sizeStyle, ...style }, ...props, children: contents }) })] })] }));
|
|
190
|
+
}
|
|
@@ -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>>;
|