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,207 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cx, hasContent, iconClasses, metaTextClasses, sheetBodyClasses, sheetTitleClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
const TimelineContext = /* @__PURE__ */ React.createContext(null);
|
|
6
|
+
const TimelineItemContext = /* @__PURE__ */ React.createContext({
|
|
7
|
+
index: 0,
|
|
8
|
+
last: false
|
|
9
|
+
});
|
|
10
|
+
/* ---------------------------------------------------------------------------
|
|
11
|
+
* Scales
|
|
12
|
+
* ------------------------------------------------------------------------- */
|
|
13
|
+
/**
|
|
14
|
+
* The bullet.
|
|
15
|
+
*
|
|
16
|
+
* Its own ladder rather than a step off `controlHeightClasses`, for the reason
|
|
17
|
+
* `tickSizeClasses` has one: a bullet is not a control you can put a label
|
|
18
|
+
* inside. It is a mark beside one, sized against the title next to it — which is
|
|
19
|
+
* why the steps are close to the tick ladder and not to the control ladder.
|
|
20
|
+
*
|
|
21
|
+
* It is written as a custom property rather than as a class because the
|
|
22
|
+
* connector has to know it: the line is centred on the bullet, and centring is
|
|
23
|
+
* arithmetic on this number.
|
|
24
|
+
*/
|
|
25
|
+
const bulletSizeValues = {
|
|
26
|
+
xs: '0.875rem',
|
|
27
|
+
sm: '1rem',
|
|
28
|
+
md: '1.25rem',
|
|
29
|
+
lg: '1.5rem',
|
|
30
|
+
xl: '1.875rem'
|
|
31
|
+
};
|
|
32
|
+
/** Between the bullet column and the content beside it. */
|
|
33
|
+
const bulletGapClasses = {
|
|
34
|
+
xs: 'gap-2',
|
|
35
|
+
sm: 'gap-2.5',
|
|
36
|
+
md: 'gap-3',
|
|
37
|
+
lg: 'gap-3.5',
|
|
38
|
+
xl: 'gap-4'
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* How far apart two items sit, and the one thing `density` is allowed to touch
|
|
42
|
+
* here — a compact timeline is the same type at the same bullet size with less
|
|
43
|
+
* air between the steps.
|
|
44
|
+
*
|
|
45
|
+
* The floor is set by the item with nothing in it. A step that is only a title
|
|
46
|
+
* and a time is one line tall, so the gap is the *whole* of what separates it
|
|
47
|
+
* from the next one — where a step with a paragraph under it has the paragraph's
|
|
48
|
+
* own leading working for it as well. Tuned against that case, which is why even
|
|
49
|
+
* `compact` keeps more air than a list of one-liners would otherwise suggest.
|
|
50
|
+
*/
|
|
51
|
+
const itemGapClasses = {
|
|
52
|
+
default: { xs: 'pb-5', sm: 'pb-6', md: 'pb-7', lg: 'pb-8', xl: 'pb-10' },
|
|
53
|
+
compact: { xs: 'pb-3', sm: 'pb-3.5', md: 'pb-4', lg: 'pb-5', xl: 'pb-6' }
|
|
54
|
+
};
|
|
55
|
+
/** The same ladder across, for the horizontal form. */
|
|
56
|
+
const itemGapXClasses = {
|
|
57
|
+
default: { xs: 'pe-5', sm: 'pe-6', md: 'pe-7', lg: 'pe-8', xl: 'pe-10' },
|
|
58
|
+
compact: { xs: 'pe-3', sm: 'pe-3.5', md: 'pe-4', lg: 'pe-5', xl: 'pe-6' }
|
|
59
|
+
};
|
|
60
|
+
const borderStyleClasses = {
|
|
61
|
+
solid: 'border-solid',
|
|
62
|
+
dashed: 'border-dashed',
|
|
63
|
+
dotted: 'border-dotted',
|
|
64
|
+
none: ''
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* The bullet at each of the three states.
|
|
68
|
+
*
|
|
69
|
+
* Every one of them is a different axis, never a different opacity: `complete`
|
|
70
|
+
* is the family's gradient, `current` is that gradient with a halo of the soft
|
|
71
|
+
* tint around it, and `upcoming` is a hairline ring on the page's own surface. A
|
|
72
|
+
* reader who cannot tell the colours apart still has a filled shape, a haloed
|
|
73
|
+
* shape and an empty one.
|
|
74
|
+
*
|
|
75
|
+
* There is no gloss line on the two filled ones, for the reason a filled
|
|
76
|
+
* `PlButton` has none — the gradient is the form. The `upcoming` ring is drawn
|
|
77
|
+
* in the neutral hairline rather than the sheet's white one, the same call a
|
|
78
|
+
* checkbox's edge makes: a bullet is small enough that its edge *is* the object,
|
|
79
|
+
* and white light on a translucent pane disappears on a light card.
|
|
80
|
+
*/
|
|
81
|
+
const bulletStatusClasses = {
|
|
82
|
+
complete: '[background-image:var(--p-fill)] text-(--p-on-solid)',
|
|
83
|
+
current: '[background-image:var(--p-fill)] text-(--p-on-solid) [box-shadow:0_0_0_0.25rem_var(--p-soft)]',
|
|
84
|
+
upcoming: 'border-2 bg-(--plass-surface) text-(--plass-muted-fg) [border-color:var(--plass-border)]'
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The line *after* an item, which is what makes it the item's own property: a
|
|
88
|
+
* connector is coloured by whether the step it leaves has been reached, not by
|
|
89
|
+
* where it arrives.
|
|
90
|
+
*/
|
|
91
|
+
const connectorColorClasses = {
|
|
92
|
+
complete: '[border-color:var(--p-line-hover)]',
|
|
93
|
+
current: '[border-color:var(--plass-border)]',
|
|
94
|
+
upcoming: '[border-color:var(--plass-border)]'
|
|
95
|
+
};
|
|
96
|
+
const titleStatusClasses = {
|
|
97
|
+
complete: 'text-(--plass-fg)',
|
|
98
|
+
current: 'text-(--p-accent)',
|
|
99
|
+
upcoming: 'text-(--plass-muted-fg)'
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* One step.
|
|
103
|
+
*
|
|
104
|
+
* Its index is not a prop and cannot be: an item that had to be told where it
|
|
105
|
+
* was in the list would be an item every caller could put in the wrong place,
|
|
106
|
+
* and `active={2}` would stop meaning anything. The `PlTimeline` numbers its
|
|
107
|
+
* children as it walks them, and hands each one its index through a context.
|
|
108
|
+
*/
|
|
109
|
+
export const PlTimelineItem = /* @__PURE__ */ React.forwardRef(function PlTimelineItem({ title, meta, bullet, status, color, connector = 'solid', className, children, ...props }, ref) {
|
|
110
|
+
const timeline = React.useContext(TimelineContext);
|
|
111
|
+
const { index, last } = React.useContext(TimelineItemContext);
|
|
112
|
+
// A bare item outside a timeline still renders — it is just one step with
|
|
113
|
+
// nothing before or after it. The defaults are the timeline's own.
|
|
114
|
+
const size = timeline?.size ?? 'md';
|
|
115
|
+
const density = timeline?.density ?? 'default';
|
|
116
|
+
const orientation = timeline?.orientation ?? 'vertical';
|
|
117
|
+
const family = color ?? timeline?.color ?? 'primary';
|
|
118
|
+
const active = timeline?.active ?? null;
|
|
119
|
+
const resolved = status ??
|
|
120
|
+
(active === null
|
|
121
|
+
? 'upcoming'
|
|
122
|
+
: index < active
|
|
123
|
+
? 'complete'
|
|
124
|
+
: index === active
|
|
125
|
+
? 'current'
|
|
126
|
+
: 'upcoming');
|
|
127
|
+
const horizontal = orientation === 'horizontal';
|
|
128
|
+
// The last item's line would run off the end of the sequence into nothing.
|
|
129
|
+
const drawsConnector = connector !== 'none' && !last;
|
|
130
|
+
const bulletBox = (_jsx("span", { "aria-hidden": "true", className: cx('relative z-10 flex shrink-0 items-center justify-center rounded-full',
|
|
131
|
+
// The label inside the bullet is sized off the bullet rather than off
|
|
132
|
+
// the page's own text, so a number in an `xs` bullet is not the same
|
|
133
|
+
// 8px it would be in an `xl` one.
|
|
134
|
+
'size-(--p-bullet) text-[calc(var(--p-bullet)*0.5)] leading-none font-semibold tabular-nums', bulletStatusClasses[resolved], transitionClasses, iconClasses), children: bullet }));
|
|
135
|
+
/*
|
|
136
|
+
* The line, drawn as one border edge on an absolutely positioned box rather
|
|
137
|
+
* than as a filled `<div>`, so `dashed` and `dotted` are the browser's own
|
|
138
|
+
* dashes and land on the device pixel grid the way every other edge in the
|
|
139
|
+
* library does.
|
|
140
|
+
*
|
|
141
|
+
* It starts at the far edge of the bullet and runs to the edge of the item,
|
|
142
|
+
* which is where the next bullet begins — so the arithmetic is the bullet
|
|
143
|
+
* size, and that is the whole reason it is a custom property.
|
|
144
|
+
*/
|
|
145
|
+
const connectorLine = drawsConnector ? (_jsx("span", { "aria-hidden": "true", className: cx('pointer-events-none absolute',
|
|
146
|
+
// Half the bullet, less half the line, so the 2px rule is centred on
|
|
147
|
+
// the bullet rather than starting at its centre.
|
|
148
|
+
horizontal
|
|
149
|
+
? 'top-[calc(var(--p-bullet)/2_-_1px)] end-0 start-(--p-bullet) border-t-2'
|
|
150
|
+
: 'top-(--p-bullet) bottom-0 start-[calc(var(--p-bullet)/2_-_1px)] border-s-2', borderStyleClasses[connector], connectorColorClasses[resolved], transitionClasses) })) : null;
|
|
151
|
+
const body = (_jsxs("div", { className: cx('flex min-w-0 flex-col gap-0.5', horizontal ? 'mt-2' : ''), children: [hasContent(title) || hasContent(meta) ? (_jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [hasContent(title) ? (_jsx("span", { className: cx('font-semibold', sheetTitleClasses[size], titleStatusClasses[resolved], transitionClasses), children: title })) : null, hasContent(meta) ? (_jsx("span", { className: cx('text-(--plass-muted-fg)', metaTextClasses[size]), children: meta })) : null] })) : null, hasContent(children) ? (_jsx("div", { className: cx('text-(--plass-muted-fg)', sheetBodyClasses[size]), children: children })) : null] }));
|
|
152
|
+
return (_jsxs("li", { ref: ref, "aria-current": resolved === 'current' ? 'step' : undefined, "data-status": resolved, className: cx('relative', horizontal
|
|
153
|
+
? cx('flex min-w-0 flex-1 flex-col', last ? '' : itemGapXClasses[density][size])
|
|
154
|
+
: cx('flex', bulletGapClasses[size], last ? '' : itemGapClasses[density][size]), className), style: {
|
|
155
|
+
'--p-bullet': bulletSizeValues[size],
|
|
156
|
+
...surfaceSlots(family, 0),
|
|
157
|
+
// A container's slots leave the sheet undyed, which is right for the
|
|
158
|
+
// ground a bullet sits on — but a bullet *is* the thing being
|
|
159
|
+
// coloured, so the two fills it needs are put back.
|
|
160
|
+
'--p-fill': `var(--plass-${family}-fill)`,
|
|
161
|
+
'--p-on-solid': `var(--plass-${family}-on-solid)`
|
|
162
|
+
}, ...props, children: [connectorLine, bulletBox, body] }));
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* A sequence of steps, in the order they happen in.
|
|
166
|
+
*
|
|
167
|
+
* There is no Base UI primitive under this and there should not be: a timeline
|
|
168
|
+
* has no selection, no roving focus and no keyboard contract — it is a list, and
|
|
169
|
+
* reaching for a composite primitive to draw one would hand every consumer's
|
|
170
|
+
* record of events the semantics of a widget.
|
|
171
|
+
*
|
|
172
|
+
* It is an `<ol>` for the reason it exists at all: the order *is* the content. A
|
|
173
|
+
* screen reader announcing "list of 5 items" over an unordered list would be
|
|
174
|
+
* describing something else.
|
|
175
|
+
*
|
|
176
|
+
* The children are numbered here rather than by a prop on each item, so `active`
|
|
177
|
+
* has something to count against and inserting a step in the middle does not
|
|
178
|
+
* mean renumbering the ones after it.
|
|
179
|
+
*/
|
|
180
|
+
export const PlTimeline = /* @__PURE__ */ React.forwardRef(function PlTimeline({ active, size = 'md', color = 'primary', density = 'default', orientation = 'vertical', render, className, style, children, ...props }, ref) {
|
|
181
|
+
// `toArray` is what drops the `null`s and `false`s a conditional step leaves
|
|
182
|
+
// behind, so `active={2}` counts the steps that are actually on the page.
|
|
183
|
+
const items = React.Children.toArray(children);
|
|
184
|
+
const count = items.length;
|
|
185
|
+
const context = React.useMemo(() => ({
|
|
186
|
+
size,
|
|
187
|
+
density,
|
|
188
|
+
orientation,
|
|
189
|
+
color,
|
|
190
|
+
active: active ?? null
|
|
191
|
+
}), [size, density, orientation, color, active]);
|
|
192
|
+
const element = useRender({
|
|
193
|
+
render: render ?? _jsx("ol", {}),
|
|
194
|
+
ref,
|
|
195
|
+
props: {
|
|
196
|
+
// Tailwind's reset takes the markers off every `<ol>`, and Safari takes
|
|
197
|
+
// the list semantics off with them. Saying `role="list"` out loud is the
|
|
198
|
+
// one-line fix, and it costs nothing when the reset is not there.
|
|
199
|
+
role: 'list',
|
|
200
|
+
className: cx('flex', orientation === 'horizontal' ? 'flex-row' : 'flex-col', className),
|
|
201
|
+
style: { ...surfaceSlots(color, 0), ...style },
|
|
202
|
+
children: items.map((item, index) => (_jsx(TimelineItemContext.Provider, { value: { index, last: index === count - 1 }, children: item }, index))),
|
|
203
|
+
...props
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return _jsx(TimelineContext.Provider, { value: context, children: element });
|
|
207
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlTimeline, PlTimelineItem } from './PlTimeline.js';
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassColor, PlassStyleProps, PlassVariant } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Where the stack sits.
|
|
5
|
+
*
|
|
6
|
+
* Written as two words rather than as a `side` plus an `align` pair, because
|
|
7
|
+
* they are not independent: a toast stack is always pinned to the top or the
|
|
8
|
+
* bottom, never to a side, and offering `left`/`right` as a "side" would invite
|
|
9
|
+
* a stack down the middle of the screen that nothing in the layout survives.
|
|
10
|
+
* The second half is `PlassAlign`, the same word every other component uses.
|
|
11
|
+
*/
|
|
12
|
+
export type PlToastPosition = `top-${PlassAlign}` | `bottom-${PlassAlign}`;
|
|
13
|
+
/**
|
|
14
|
+
* The Plass style props a single toast can override, carried in Base UI's
|
|
15
|
+
* per-toast `data`. Anything not set here falls back to the provider.
|
|
16
|
+
*/
|
|
17
|
+
export interface PlToastData {
|
|
18
|
+
color?: PlassColor;
|
|
19
|
+
variant?: PlassVariant;
|
|
20
|
+
icon?: React.ReactNode | false;
|
|
21
|
+
}
|
|
22
|
+
export interface PlToastOptions extends PlToastData {
|
|
23
|
+
/**
|
|
24
|
+
* Reusing an id updates that toast in place and restarts its timer, which is
|
|
25
|
+
* what "uploading… / uploaded" wants: one toast that changed its mind, not two
|
|
26
|
+
* stacked on each other.
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
/** The headline. */
|
|
30
|
+
title?: React.ReactNode;
|
|
31
|
+
/** The detail under it. A toast with only this is a one-line toast. */
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* How long before it dismisses itself, in milliseconds. `0` means it stays
|
|
35
|
+
* until it is closed — which is the right answer for anything the reader has
|
|
36
|
+
* to act on, because a toast that leaves before it is read said nothing.
|
|
37
|
+
*/
|
|
38
|
+
timeout?: number;
|
|
39
|
+
/**
|
|
40
|
+
* `high` interrupts a screen reader; `low` waits for a pause. An error is
|
|
41
|
+
* worth interrupting for and a save confirmation is not.
|
|
42
|
+
* @default 'low'
|
|
43
|
+
*/
|
|
44
|
+
priority?: 'low' | 'high';
|
|
45
|
+
/** The label of the action button. Passing it is what makes the button appear. */
|
|
46
|
+
actionLabel?: React.ReactNode;
|
|
47
|
+
onAction?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
48
|
+
/** Called when the toast closes, however it closed. */
|
|
49
|
+
onClose?: () => void;
|
|
50
|
+
/** Called once it has finished animating out and left the DOM. */
|
|
51
|
+
onRemove?: () => void;
|
|
52
|
+
}
|
|
53
|
+
export interface PlToastProviderProps extends Pick<PlassStyleProps, 'variant' | 'size' | 'density'> {
|
|
54
|
+
/** The default colour family. A single toast overrides it in `add`. */
|
|
55
|
+
color?: PlassColor;
|
|
56
|
+
/** @default 'bottom-end' */
|
|
57
|
+
position?: PlToastPosition;
|
|
58
|
+
/**
|
|
59
|
+
* How long a toast lasts by default, in milliseconds. `0` keeps every toast up
|
|
60
|
+
* until it is closed.
|
|
61
|
+
* @default 5000
|
|
62
|
+
*/
|
|
63
|
+
timeout?: number;
|
|
64
|
+
/**
|
|
65
|
+
* How many are shown at once. The rest are kept and revealed as the stack
|
|
66
|
+
* drains rather than being thrown away.
|
|
67
|
+
* @default 3
|
|
68
|
+
*/
|
|
69
|
+
limit?: number;
|
|
70
|
+
/**
|
|
71
|
+
* How wide a toast is allowed to get. Numbers are pixels.
|
|
72
|
+
* @default 380
|
|
73
|
+
*/
|
|
74
|
+
width?: number | string;
|
|
75
|
+
/**
|
|
76
|
+
* Accessible name of every toast's × button. Never drawn.
|
|
77
|
+
* @default 'Close'
|
|
78
|
+
*/
|
|
79
|
+
closeLabel?: string;
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Raises toasts from anywhere under a `PlToastProvider`.
|
|
84
|
+
*
|
|
85
|
+
* A hook rather than a component, because the thing a caller has at the moment a
|
|
86
|
+
* toast is warranted is a click handler, not a place in the tree — and a
|
|
87
|
+
* `<PlToast open={…} />` they would have to keep mounted, with a piece of state
|
|
88
|
+
* per message, is the shape this component exists to avoid.
|
|
89
|
+
*/
|
|
90
|
+
export declare function usePlToast(): {
|
|
91
|
+
/** Raises a toast and returns its id. */
|
|
92
|
+
add: (options: PlToastOptions) => string;
|
|
93
|
+
/** Closes one toast, or every toast when called with nothing. */
|
|
94
|
+
close: (id?: string) => void;
|
|
95
|
+
/** Changes a toast already on screen. */
|
|
96
|
+
update: (id: string, options: PlToastOptions) => void;
|
|
97
|
+
/**
|
|
98
|
+
* One toast that follows a promise: the loading message while it runs, then
|
|
99
|
+
* the success or the error. `timeout: 0` is applied to the loading state by
|
|
100
|
+
* Base UI, so a slow request cannot dismiss its own toast.
|
|
101
|
+
*/
|
|
102
|
+
promise: <Value>(promise: Promise<Value>, options: {
|
|
103
|
+
loading: PlToastOptions;
|
|
104
|
+
success: PlToastOptions | ((value: Value) => PlToastOptions);
|
|
105
|
+
error: PlToastOptions | ((error: unknown) => PlToastOptions);
|
|
106
|
+
}) => Promise<Value>;
|
|
107
|
+
/** Every toast currently in the stack, newest first. */
|
|
108
|
+
toasts: import("@base-ui/react").ToastObject<PlToastData>[];
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Puts the toast stack on the page and lets anything under it raise a message.
|
|
112
|
+
*
|
|
113
|
+
* Wrap the application once. Everything about how a toast *looks* is decided
|
|
114
|
+
* here — where the stack sits, how wide it is, which material it wears, how long
|
|
115
|
+
* it lasts — so the call site stays the one thing it should be: what happened.
|
|
116
|
+
*
|
|
117
|
+
* Base UI owns the parts of this that are genuinely hard and invisible when they
|
|
118
|
+
* work: the timers and their pausing on hover and on window blur, the limit, the
|
|
119
|
+
* swipe, the F6 focus hotkey, and the live region that makes a message which
|
|
120
|
+
* appeared out of nowhere reach a screen reader at all.
|
|
121
|
+
*/
|
|
122
|
+
export declare function PlToastProvider({ variant, size, color, density, position, timeout, limit, width, closeLabel, children }: PlToastProviderProps): React.JSX.Element;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Toast as BaseUIToast } from '@base-ui/react/toast';
|
|
4
|
+
import { CloseIcon, severityIcon } from '../../internal/icons.js';
|
|
5
|
+
import { controlSlots, focusRingClasses, glassClasses, hasContent, iconClasses, metaTextClasses, radiusClasses, sheetBodyClasses, sheetHeaderGapClasses, sheetPaddingXClasses, sheetPaddingYClasses, sheetSectionGapClasses, sheetTitleClasses } from '../../internal/styles.js';
|
|
6
|
+
/**
|
|
7
|
+
* How a stack is pinned, per position.
|
|
8
|
+
*
|
|
9
|
+
* The viewport is full width in every case and the alignment is done with
|
|
10
|
+
* `items-*`, rather than by pinning one edge and nudging the centre back with a
|
|
11
|
+
* translate. That keeps the one `transform` this component could have wanted out
|
|
12
|
+
* of it, and it means the same three classes serve all six positions.
|
|
13
|
+
*/
|
|
14
|
+
const viewportClasses = {
|
|
15
|
+
'top-start': 'top-0 items-start',
|
|
16
|
+
'top-center': 'top-0 items-center',
|
|
17
|
+
'top-end': 'top-0 items-end',
|
|
18
|
+
'bottom-start': 'bottom-0 flex-col-reverse items-start',
|
|
19
|
+
'bottom-center': 'bottom-0 flex-col-reverse items-center',
|
|
20
|
+
'bottom-end': 'bottom-0 flex-col-reverse items-end'
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A toast floats over the page, so — with the `PlSelect` popup, the `PlModal`
|
|
24
|
+
* sheet and the `PlTooltip` plate — it carries a shadow by default, at level 3.
|
|
25
|
+
*
|
|
26
|
+
* The two undyed materials are the glass at its most opaque, for the reason the
|
|
27
|
+
* modal's sheet is: what is behind a toast is arbitrary, and a 62%-translucent
|
|
28
|
+
* pane over a photograph is a pane you read the photograph through.
|
|
29
|
+
*/
|
|
30
|
+
const rootClasses = {
|
|
31
|
+
solid: /* @__PURE__ */ [
|
|
32
|
+
'text-(--p-on-solid) [background-image:var(--p-fill)]',
|
|
33
|
+
'[box-shadow:var(--plass-shadow-3),var(--p-lift)]'
|
|
34
|
+
].join(' '),
|
|
35
|
+
glass: /* @__PURE__ */ [
|
|
36
|
+
glassClasses,
|
|
37
|
+
'border text-(--plass-fg) bg-(--plass-glass-press)',
|
|
38
|
+
'[border-color:var(--p-line)]',
|
|
39
|
+
'[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]'
|
|
40
|
+
].join(' '),
|
|
41
|
+
ghost: /* @__PURE__ */ [
|
|
42
|
+
glassClasses,
|
|
43
|
+
'text-(--plass-fg) bg-(--plass-glass-press)',
|
|
44
|
+
'[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]'
|
|
45
|
+
].join(' ')
|
|
46
|
+
};
|
|
47
|
+
const accentClasses = {
|
|
48
|
+
solid: '',
|
|
49
|
+
glass: 'text-(--p-accent)',
|
|
50
|
+
ghost: 'text-(--p-accent)'
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Turns a Plass toast into the object Base UI's manager stores.
|
|
54
|
+
*
|
|
55
|
+
* The style props go into `data` rather than becoming top-level fields, because
|
|
56
|
+
* `data` is the slot Base UI reserves for exactly this and the alternative —
|
|
57
|
+
* shadowing the manager's own option names — is how a library ends up with two
|
|
58
|
+
* `type` props that mean different things.
|
|
59
|
+
*/
|
|
60
|
+
function toManagerOptions(options) {
|
|
61
|
+
const { color, variant, icon, actionLabel, onAction, ...rest } = options;
|
|
62
|
+
return {
|
|
63
|
+
...rest,
|
|
64
|
+
data: { color, variant, icon },
|
|
65
|
+
actionProps: actionLabel === undefined
|
|
66
|
+
? undefined
|
|
67
|
+
: { children: actionLabel, onClick: onAction }
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Raises toasts from anywhere under a `PlToastProvider`.
|
|
72
|
+
*
|
|
73
|
+
* A hook rather than a component, because the thing a caller has at the moment a
|
|
74
|
+
* toast is warranted is a click handler, not a place in the tree — and a
|
|
75
|
+
* `<PlToast open={…} />` they would have to keep mounted, with a piece of state
|
|
76
|
+
* per message, is the shape this component exists to avoid.
|
|
77
|
+
*/
|
|
78
|
+
export function usePlToast() {
|
|
79
|
+
const manager = BaseUIToast.useToastManager();
|
|
80
|
+
return React.useMemo(() => ({
|
|
81
|
+
/** Raises a toast and returns its id. */
|
|
82
|
+
add: (options) => manager.add(toManagerOptions(options)),
|
|
83
|
+
/** Closes one toast, or every toast when called with nothing. */
|
|
84
|
+
close: (id) => manager.close(id),
|
|
85
|
+
/** Changes a toast already on screen. */
|
|
86
|
+
update: (id, options) => manager.update(id, toManagerOptions(options)),
|
|
87
|
+
/**
|
|
88
|
+
* One toast that follows a promise: the loading message while it runs, then
|
|
89
|
+
* the success or the error. `timeout: 0` is applied to the loading state by
|
|
90
|
+
* Base UI, so a slow request cannot dismiss its own toast.
|
|
91
|
+
*/
|
|
92
|
+
promise: (promise, options) => manager.promise(promise, {
|
|
93
|
+
loading: toManagerOptions(options.loading),
|
|
94
|
+
success: (value) => toManagerOptions(typeof options.success === 'function' ? options.success(value) : options.success),
|
|
95
|
+
error: (error) => toManagerOptions(typeof options.error === 'function' ? options.error(error) : options.error)
|
|
96
|
+
}),
|
|
97
|
+
/** Every toast currently in the stack, newest first. */
|
|
98
|
+
toasts: manager.toasts
|
|
99
|
+
}), [manager]);
|
|
100
|
+
}
|
|
101
|
+
function ToastItem({ toast, variant: providerVariant, color: providerColor, size, density, closeLabel, swipeDirection }) {
|
|
102
|
+
const variant = toast.data?.variant ?? providerVariant ?? 'glass';
|
|
103
|
+
const color = toast.data?.color ?? providerColor;
|
|
104
|
+
const glyph = toast.data?.icon === undefined ? severityIcon(color) : toast.data.icon;
|
|
105
|
+
const accent = accentClasses[variant];
|
|
106
|
+
const titled = hasContent(toast.title);
|
|
107
|
+
return (_jsxs(BaseUIToast.Root, { toast: toast, swipeDirection: swipeDirection, className: [
|
|
108
|
+
'pointer-events-auto flex w-full items-start',
|
|
109
|
+
sheetPaddingXClasses[density ?? 'default'][size],
|
|
110
|
+
sheetPaddingYClasses[density ?? 'default'][size],
|
|
111
|
+
radiusClasses[size],
|
|
112
|
+
sheetSectionGapClasses[size],
|
|
113
|
+
sheetBodyClasses[size],
|
|
114
|
+
rootClasses[variant],
|
|
115
|
+
iconClasses,
|
|
116
|
+
// Opacity, and only opacity — the same restraint the modal shows, and
|
|
117
|
+
// for the same reason: this is a box full of text. Base UI still moves
|
|
118
|
+
// it while a finger is dragging it, which is the reader's hand rather
|
|
119
|
+
// than a state change, and it stops the moment the finger lifts.
|
|
120
|
+
'[transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
121
|
+
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0',
|
|
122
|
+
// A toast pushed out by the limit is kept in the DOM so it can come
|
|
123
|
+
// back; it just has nothing to say while it waits.
|
|
124
|
+
'data-[limited]:hidden',
|
|
125
|
+
focusRingClasses,
|
|
126
|
+
'[outline:none]'
|
|
127
|
+
]
|
|
128
|
+
.filter(Boolean)
|
|
129
|
+
.join(' '), style: controlSlots(color, 3, variant), children: [hasContent(glyph) ? (_jsx("span", { className: `flex h-[1lh] shrink-0 items-center ${accent}`, children: glyph })) : null, _jsxs("div", { className: `flex min-w-0 flex-1 flex-col ${sheetHeaderGapClasses[size]}`, children: [_jsx(BaseUIToast.Title, { className: `plass-title font-semibold ${sheetTitleClasses[size]} ${accent}` }), _jsx(BaseUIToast.Description, { className: titled && variant !== 'solid' ? 'text-(--plass-muted-fg)' : '' })] }), _jsx(BaseUIToast.Action, { className: [
|
|
130
|
+
'flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2',
|
|
131
|
+
'font-medium underline-offset-2',
|
|
132
|
+
accent || 'text-(--p-on-solid)',
|
|
133
|
+
'hover:underline',
|
|
134
|
+
focusRingClasses,
|
|
135
|
+
metaTextClasses[size]
|
|
136
|
+
].join(' ') }), _jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: _jsx(BaseUIToast.Close, { "aria-label": closeLabel, className: [
|
|
137
|
+
'inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full',
|
|
138
|
+
'opacity-70 [transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
139
|
+
'hover:opacity-100 focus-visible:opacity-100',
|
|
140
|
+
focusRingClasses
|
|
141
|
+
].join(' '), children: _jsx(CloseIcon, {}) }) })] }));
|
|
142
|
+
}
|
|
143
|
+
/** The stack itself. Rendered by the provider, never by a caller. */
|
|
144
|
+
function ToastViewport(props) {
|
|
145
|
+
const { toasts } = BaseUIToast.useToastManager();
|
|
146
|
+
const { position, width, ...rest } = props;
|
|
147
|
+
const swipeDirection = [
|
|
148
|
+
position.startsWith('top') ? 'up' : 'down',
|
|
149
|
+
'left',
|
|
150
|
+
'right'
|
|
151
|
+
];
|
|
152
|
+
return (_jsx(BaseUIToast.Portal, { children: _jsx(BaseUIToast.Viewport, { className: [
|
|
153
|
+
// Full width and `pointer-events-none`, so the strip across the top or
|
|
154
|
+
// the bottom of the page is not a wall the rest of the app is behind.
|
|
155
|
+
// The toasts themselves take their events back.
|
|
156
|
+
'plass-portal pointer-events-none fixed inset-x-0 z-50 flex flex-col gap-2 p-4',
|
|
157
|
+
viewportClasses[position]
|
|
158
|
+
].join(' '), children: toasts.map((toast) => (_jsx("div", { className: "w-full", style: { maxWidth: typeof width === 'number' ? `${width}px` : width }, children: _jsx(ToastItem, { toast: toast, swipeDirection: swipeDirection, ...rest }) }, toast.id))) }) }));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Puts the toast stack on the page and lets anything under it raise a message.
|
|
162
|
+
*
|
|
163
|
+
* Wrap the application once. Everything about how a toast *looks* is decided
|
|
164
|
+
* here — where the stack sits, how wide it is, which material it wears, how long
|
|
165
|
+
* it lasts — so the call site stays the one thing it should be: what happened.
|
|
166
|
+
*
|
|
167
|
+
* Base UI owns the parts of this that are genuinely hard and invisible when they
|
|
168
|
+
* work: the timers and their pausing on hover and on window blur, the limit, the
|
|
169
|
+
* swipe, the F6 focus hotkey, and the live region that makes a message which
|
|
170
|
+
* appeared out of nowhere reach a screen reader at all.
|
|
171
|
+
*/
|
|
172
|
+
export function PlToastProvider({ variant = 'glass', size = 'md', color = 'primary', density = 'default', position = 'bottom-end', timeout = 5000, limit = 3, width = 380, closeLabel = 'Close', children }) {
|
|
173
|
+
return (_jsxs(BaseUIToast.Provider, { timeout: timeout, limit: limit, children: [children, _jsx(ToastViewport, { position: position, variant: variant, size: size, color: color, density: density, width: width, closeLabel: closeLabel })] }));
|
|
174
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlToastProvider, usePlToast } from './PlToast.js';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassElevation, PlassPosition, PlassStyleProps } from '../../types.js';
|
|
4
|
+
export interface PlToolbarProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* Drop shadow depth. `0` — the default — is flat even when the bar is pinned:
|
|
7
|
+
* a shadow under a header is a way of saying "there is content beneath this",
|
|
8
|
+
* and that is only true once the page has been scrolled. Raise it yourself, or
|
|
9
|
+
* leave it flat and turn on `divider`.
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
elevation?: PlassElevation;
|
|
13
|
+
/**
|
|
14
|
+
* How the bar sits in the page's scroll.
|
|
15
|
+
*
|
|
16
|
+
* - `static` — in the flow, scrolling away with the content.
|
|
17
|
+
* - `sticky` — in the flow until it reaches the edge, then held there. What an
|
|
18
|
+
* application header usually wants: it takes up its own space, so nothing
|
|
19
|
+
* underneath has to be padded around it.
|
|
20
|
+
* - `fixed` — out of the flow entirely. The page needs padding of its own, or
|
|
21
|
+
* the first screenful sits behind the bar.
|
|
22
|
+
* @default 'static'
|
|
23
|
+
*/
|
|
24
|
+
position?: PlassPosition;
|
|
25
|
+
/** Which edge it is held against when `position` is not `static`. @default 'top' */
|
|
26
|
+
side?: 'top' | 'bottom';
|
|
27
|
+
/**
|
|
28
|
+
* Draws a hairline along the edge that faces the content — under a `top` bar,
|
|
29
|
+
* over a `bottom` one.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
divider?: boolean;
|
|
33
|
+
/** Pinned to the start of the bar: a logo, a title, a back button. */
|
|
34
|
+
start?: React.ReactNode;
|
|
35
|
+
/** Pinned to the end: the actions. */
|
|
36
|
+
end?: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Renders something other than a `<div>` — `render={<header />}`,
|
|
39
|
+
* `render={<nav />}`. Base UI's own escape hatch, and worth reaching for here:
|
|
40
|
+
* a page's header should be a `<header>`.
|
|
41
|
+
*/
|
|
42
|
+
render?: useRender.RenderProp;
|
|
43
|
+
/** The middle. Takes whatever width `start` and `end` leave. */
|
|
44
|
+
children?: React.ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A bar of controls: an application header, a page's action row, the strip along
|
|
48
|
+
* the bottom of an editor.
|
|
49
|
+
*
|
|
50
|
+
* Three slots and a row. `start` and `end` are pinned to their ends and
|
|
51
|
+
* `children` takes what is left, which is the arrangement every toolbar has ever
|
|
52
|
+
* had — so it is laid out here rather than left to a caller and a spacer `<div>`
|
|
53
|
+
* they have to remember.
|
|
54
|
+
*
|
|
55
|
+
* The one thing it does not do is take a height. A toolbar is as tall as the
|
|
56
|
+
* controls in it plus its padding, and that padding is the `size` / `density`
|
|
57
|
+
* pair every other surface uses — so `density="compact"` gives the dense bar
|
|
58
|
+
* without a second prop meaning the same thing, and without the type scale
|
|
59
|
+
* moving.
|
|
60
|
+
*
|
|
61
|
+
* It has **no `role="toolbar"`**, deliberately. That role is a promise about
|
|
62
|
+
* keyboard behaviour — one tab stop for the whole bar, arrow keys between the
|
|
63
|
+
* controls in it — and a bar that claims it without implementing it is worse for
|
|
64
|
+
* a keyboard reader than one that never claimed anything. What a page header
|
|
65
|
+
* wants is `render={<header />}`; what a genuine roving-focus set of choices
|
|
66
|
+
* wants is a `PlSegmentedButton`, which is one.
|
|
67
|
+
*/
|
|
68
|
+
export declare const PlToolbar: React.ForwardRefExoticComponent<PlToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cx, hasContent, radiusClasses, sheetPaddingXClasses, sheetPaddingYClasses, sheetRestClasses, sheetSectionGapClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* The three materials, said the way a *container* says them — the bar is never
|
|
7
|
+
* dyed, exactly as on a `PlBox` and a `PlCard`. A toolbar holds other people's
|
|
8
|
+
* controls, and those controls arrive with colours of their own.
|
|
9
|
+
*/
|
|
10
|
+
const variantClasses = sheetRestClasses;
|
|
11
|
+
const positionClasses = {
|
|
12
|
+
static: { top: '', bottom: '' },
|
|
13
|
+
sticky: { top: 'sticky top-0 z-20', bottom: 'sticky bottom-0 z-20' },
|
|
14
|
+
fixed: { top: 'fixed inset-x-0 top-0 z-30', bottom: 'fixed inset-x-0 bottom-0 z-30' }
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The rule faces the content, so it moves to the other edge on a bottom bar.
|
|
18
|
+
*
|
|
19
|
+
* `--plass-divider` and not the sheet's own white edge line: this is a mark the
|
|
20
|
+
* sheet makes on *itself*, and white light on a cut edge only reads when the
|
|
21
|
+
* page wash is behind it.
|
|
22
|
+
*/
|
|
23
|
+
const dividerClasses = {
|
|
24
|
+
top: 'border-b [border-color:var(--plass-divider)]',
|
|
25
|
+
bottom: 'border-t [border-color:var(--plass-divider)]'
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A bar of controls: an application header, a page's action row, the strip along
|
|
29
|
+
* the bottom of an editor.
|
|
30
|
+
*
|
|
31
|
+
* Three slots and a row. `start` and `end` are pinned to their ends and
|
|
32
|
+
* `children` takes what is left, which is the arrangement every toolbar has ever
|
|
33
|
+
* had — so it is laid out here rather than left to a caller and a spacer `<div>`
|
|
34
|
+
* they have to remember.
|
|
35
|
+
*
|
|
36
|
+
* The one thing it does not do is take a height. A toolbar is as tall as the
|
|
37
|
+
* controls in it plus its padding, and that padding is the `size` / `density`
|
|
38
|
+
* pair every other surface uses — so `density="compact"` gives the dense bar
|
|
39
|
+
* without a second prop meaning the same thing, and without the type scale
|
|
40
|
+
* moving.
|
|
41
|
+
*
|
|
42
|
+
* It has **no `role="toolbar"`**, deliberately. That role is a promise about
|
|
43
|
+
* keyboard behaviour — one tab stop for the whole bar, arrow keys between the
|
|
44
|
+
* controls in it — and a bar that claims it without implementing it is worse for
|
|
45
|
+
* a keyboard reader than one that never claimed anything. What a page header
|
|
46
|
+
* wants is `render={<header />}`; what a genuine roving-focus set of choices
|
|
47
|
+
* wants is a `PlSegmentedButton`, which is one.
|
|
48
|
+
*/
|
|
49
|
+
export const PlToolbar = /* @__PURE__ */ React.forwardRef(function PlToolbar({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, position = 'static', side = 'top', divider = false, start, end, render, className, style, children, ...props }, ref) {
|
|
50
|
+
const classNames = cx('flex w-full min-w-0 items-center', sheetPaddingXClasses[density][size], sheetPaddingYClasses[density][size], sheetSectionGapClasses[size],
|
|
51
|
+
// A pinned bar spans an edge of the window, and a rounded corner against
|
|
52
|
+
// the edge of the screen is a gap with nothing behind it. Only a bar
|
|
53
|
+
// sitting in the flow is a sheet with corners.
|
|
54
|
+
position === 'static' ? radiusClasses[size] : '', variantClasses[variant], divider ? dividerClasses[side] : '', positionClasses[position][side], transitionClasses, className);
|
|
55
|
+
return useRender({
|
|
56
|
+
render: render ?? _jsx("div", {}),
|
|
57
|
+
ref,
|
|
58
|
+
props: {
|
|
59
|
+
className: classNames,
|
|
60
|
+
style: { ...surfaceSlots(color, elevation), ...style },
|
|
61
|
+
children: (_jsxs(_Fragment, { children: [hasContent(start) ? (_jsx("div", { className: "flex min-w-0 shrink-0 items-center gap-2", children: start })) : null, _jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: children }), hasContent(end) ? (_jsx("div", { className: "flex min-w-0 shrink-0 items-center gap-2", children: end })) : null] })),
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlToolbar } from './PlToolbar.js';
|