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,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Slider as BaseUISlider } from '@base-ui/react/slider';
|
|
3
|
+
import type { PlassColor, PlassElevation, PlassOrientation, PlassSize } from '../../types.js';
|
|
4
|
+
type BaseSliderProps = Omit<React.ComponentPropsWithoutRef<typeof BaseUISlider.Root>, 'className' | 'style' | 'render' | 'children' | 'orientation'>;
|
|
5
|
+
export interface PlSliderProps extends BaseSliderProps {
|
|
6
|
+
/** @default 'md' */
|
|
7
|
+
size?: PlassSize;
|
|
8
|
+
/** @default 'primary' */
|
|
9
|
+
color?: PlassColor;
|
|
10
|
+
/**
|
|
11
|
+
* Drop shadow depth of the **thumb**. `1`, like a PlButton: the thumb is the
|
|
12
|
+
* one part of a slider you press, and it rests on the sheet.
|
|
13
|
+
* @default 1
|
|
14
|
+
*/
|
|
15
|
+
elevation?: PlassElevation;
|
|
16
|
+
/**
|
|
17
|
+
* Which way the slider runs. A vertical slider has no length of its own, so
|
|
18
|
+
* give it a height — the default `h-40` is a starting point, not a rule.
|
|
19
|
+
* @default 'horizontal'
|
|
20
|
+
*/
|
|
21
|
+
orientation?: PlassOrientation;
|
|
22
|
+
/** The label above the track. */
|
|
23
|
+
label?: React.ReactNode;
|
|
24
|
+
/** Helper text below the track. */
|
|
25
|
+
description?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Shows the current value beside the label. Pass a function to format it —
|
|
28
|
+
* the raw numbers and Base UI's already-localised strings are both handed in.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
showValue?: boolean | ((formatted: readonly string[], values: readonly number[]) => React.ReactNode);
|
|
32
|
+
/** Class names for the wrapper, not for the track. */
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A value chosen along a range.
|
|
38
|
+
*
|
|
39
|
+
* Pass an array to `value` or `defaultValue` and it becomes a range slider with
|
|
40
|
+
* one thumb per entry — there is no separate `range` prop, because the shape of
|
|
41
|
+
* the value already says which one this is.
|
|
42
|
+
*/
|
|
43
|
+
export declare const PlSlider: React.ForwardRefExoticComponent<PlSliderProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Slider as BaseUISlider } from '@base-ui/react/slider';
|
|
4
|
+
import { controlSlots, focusRingClasses, metaTextClasses, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* Groove thickness and thumb diameter.
|
|
7
|
+
*
|
|
8
|
+
* The thumb is deliberately far bigger than the groove — it is the only part of
|
|
9
|
+
* the control you can actually hit, and a thumb sized to match a 6px rail is a
|
|
10
|
+
* thumb nobody catches on a touchscreen.
|
|
11
|
+
*/
|
|
12
|
+
const trackThicknessClasses = {
|
|
13
|
+
xs: 'h-1',
|
|
14
|
+
sm: 'h-1.5',
|
|
15
|
+
md: 'h-1.5',
|
|
16
|
+
lg: 'h-2',
|
|
17
|
+
xl: 'h-2.5'
|
|
18
|
+
};
|
|
19
|
+
const verticalThicknessClasses = {
|
|
20
|
+
xs: 'w-1',
|
|
21
|
+
sm: 'w-1.5',
|
|
22
|
+
md: 'w-1.5',
|
|
23
|
+
lg: 'w-2',
|
|
24
|
+
xl: 'w-2.5'
|
|
25
|
+
};
|
|
26
|
+
const thumbSizeClasses = {
|
|
27
|
+
xs: 'size-3',
|
|
28
|
+
sm: 'size-3.5',
|
|
29
|
+
md: 'size-4.5',
|
|
30
|
+
lg: 'size-5',
|
|
31
|
+
xl: 'size-6'
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The control is taller than the groove it holds so that the whole strip is a
|
|
35
|
+
* pointer target, not just the rail. Base UI presses the track wherever you
|
|
36
|
+
* click, and a 6px hit area would make that unusable.
|
|
37
|
+
*/
|
|
38
|
+
const trackBoxHeightClasses = {
|
|
39
|
+
xs: 'h-4',
|
|
40
|
+
sm: 'h-4.5',
|
|
41
|
+
md: 'h-5',
|
|
42
|
+
lg: 'h-6',
|
|
43
|
+
xl: 'h-7'
|
|
44
|
+
};
|
|
45
|
+
const trackBoxWidthClasses = {
|
|
46
|
+
xs: 'w-4',
|
|
47
|
+
sm: 'w-4.5',
|
|
48
|
+
md: 'w-5',
|
|
49
|
+
lg: 'w-6',
|
|
50
|
+
xl: 'w-7'
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The rail is `--plass-track`, the same groove a PlSwitch's off state is — one
|
|
54
|
+
* neutral ink, so the two controls in a settings panel are visibly made of the
|
|
55
|
+
* same thing.
|
|
56
|
+
*
|
|
57
|
+
* It used to be the glass at its most opaque with `--plass-well` cut into it,
|
|
58
|
+
* on the reading that a rail and a filled field are the same recessed object.
|
|
59
|
+
* They are not: a field is a box you look *into* and a rail is a line you look
|
|
60
|
+
* *along*, and the part of it that matters is the part with nothing on it. A
|
|
61
|
+
* 4px white-on-white line with a shadow in it is the run a reader is supposed
|
|
62
|
+
* to be judging the value against, and on a light page there was nothing there
|
|
63
|
+
* to judge it against at all.
|
|
64
|
+
*
|
|
65
|
+
* The indicator over it is the gradient, so the filled part of the run is made
|
|
66
|
+
* of exactly the same material as the button that submits the form it is in.
|
|
67
|
+
*
|
|
68
|
+
* Both are pills rather than taking the radius ladder: this is a channel
|
|
69
|
+
* something travels along, not a sheet.
|
|
70
|
+
*/
|
|
71
|
+
const railClasses = 'rounded-full bg-(--plass-track)';
|
|
72
|
+
const indicatorClasses = `rounded-full [background-image:var(--p-fill)] ${transitionClasses}`;
|
|
73
|
+
/**
|
|
74
|
+
* The thumb is a key of tinted glass on the same gradient as the run behind it,
|
|
75
|
+
* separated from it by a ring in the page's own surface colour — white on a
|
|
76
|
+
* light page, near-black on a dark one — so it never dissolves into the
|
|
77
|
+
* indicator it is sitting on.
|
|
78
|
+
*
|
|
79
|
+
* It grows a halo on hover and while dragging rather than growing itself. The
|
|
80
|
+
* no-transform rule is not relaxed just because this particular part carries no
|
|
81
|
+
* label.
|
|
82
|
+
*/
|
|
83
|
+
const thumbClasses = /* @__PURE__ */ [
|
|
84
|
+
'rounded-full border-2 [background-image:var(--p-fill)]',
|
|
85
|
+
'[border-color:var(--plass-surface)]',
|
|
86
|
+
'[box-shadow:var(--p-elev),var(--p-lift)]',
|
|
87
|
+
'cursor-grab select-none active:cursor-grabbing',
|
|
88
|
+
transitionClasses,
|
|
89
|
+
'hover:[box-shadow:var(--p-elev-hover),var(--p-lift-hover),0_0_0_4px_var(--p-soft)]',
|
|
90
|
+
focusRingClasses,
|
|
91
|
+
'data-[dragging]:[box-shadow:var(--p-elev-press),var(--p-lift-press),0_0_0_6px_var(--p-soft-hover)]'
|
|
92
|
+
].join(' ');
|
|
93
|
+
/**
|
|
94
|
+
* Disabled is the light going out, exactly as it is on every other control: the
|
|
95
|
+
* shape and the place stay, the saturation and half the opacity go.
|
|
96
|
+
*/
|
|
97
|
+
const disabledSliderClasses = 'opacity-50 saturate-[0.35] [&_*]:cursor-not-allowed';
|
|
98
|
+
/**
|
|
99
|
+
* A value chosen along a range.
|
|
100
|
+
*
|
|
101
|
+
* Pass an array to `value` or `defaultValue` and it becomes a range slider with
|
|
102
|
+
* one thumb per entry — there is no separate `range` prop, because the shape of
|
|
103
|
+
* the value already says which one this is.
|
|
104
|
+
*/
|
|
105
|
+
export const PlSlider = /* @__PURE__ */ React.forwardRef(function PlSlider({ size = 'md', color = 'primary', elevation = 1, orientation = 'horizontal', label, description, showValue = false, disabled = false, className, style, ...props }, ref) {
|
|
106
|
+
const vertical = orientation === 'vertical';
|
|
107
|
+
// One thumb per value. The count comes off whichever of the two was given, so
|
|
108
|
+
// an uncontrolled range slider works without being told it is one.
|
|
109
|
+
const values = props.value ?? props.defaultValue;
|
|
110
|
+
const thumbCount = Array.isArray(values) ? values.length : 1;
|
|
111
|
+
return (_jsxs(BaseUISlider.Root, { ref: ref, orientation: orientation, disabled: disabled, className: [
|
|
112
|
+
'flex',
|
|
113
|
+
vertical ? 'w-fit flex-col items-center gap-2' : 'w-full flex-col gap-1.5',
|
|
114
|
+
disabled ? disabledSliderClasses : '',
|
|
115
|
+
className ?? ''
|
|
116
|
+
]
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
.join(' '),
|
|
119
|
+
// `solid`, always: the run and the thumb are the coloured thing, so the
|
|
120
|
+
// interaction light on them is white rather than the family's own tint.
|
|
121
|
+
style: { ...controlSlots(color, elevation, 'solid'), ...style }, ...props, children: [label || showValue ? (_jsxs("div", { className: `flex w-full items-baseline gap-2 ${metaTextClasses[size]}`, children: [label ? (_jsx(BaseUISlider.Label, { className: "font-semibold text-(--plass-fg)", children: label })) : null, showValue ? (_jsx(BaseUISlider.Value, { className: "ms-auto tabular-nums text-(--plass-muted-fg)", children: typeof showValue === 'function' ? showValue : null })) : null] })) : null, _jsx(BaseUISlider.Control, { className: [
|
|
122
|
+
'flex touch-none items-center justify-center select-none',
|
|
123
|
+
vertical
|
|
124
|
+
? `${trackBoxWidthClasses[size]} h-40 flex-col`
|
|
125
|
+
: `w-full ${trackBoxHeightClasses[size]}`
|
|
126
|
+
].join(' '), children: _jsxs(BaseUISlider.Track, { className: [
|
|
127
|
+
railClasses,
|
|
128
|
+
vertical
|
|
129
|
+
? `${verticalThicknessClasses[size]} h-full`
|
|
130
|
+
: `${trackThicknessClasses[size]} w-full`
|
|
131
|
+
].join(' '), children: [_jsx(BaseUISlider.Indicator, { className: indicatorClasses }), Array.from({ length: thumbCount }, (_, index) => (_jsx(BaseUISlider.Thumb, { index: index, className: `${thumbClasses} ${thumbSizeClasses[size]}` }, index)))] }) }), description ? (_jsx("div", { className: `${metaTextClasses[size]} text-(--plass-muted-fg)`, children: description })) : null] }));
|
|
132
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlSlider } from './PlSlider.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassDensity, PlassElevation, PlassSize, PlassVariant } from '../../types.js';
|
|
3
|
+
export interface PlSpoilerProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onChange'> {
|
|
4
|
+
/** Whether the content is uncovered. Use with `onRevealedChange` for a controlled one. */
|
|
5
|
+
revealed?: boolean;
|
|
6
|
+
/** Where an uncontrolled spoiler starts. @default false */
|
|
7
|
+
defaultRevealed?: boolean;
|
|
8
|
+
onRevealedChange?: (revealed: boolean) => void;
|
|
9
|
+
/** The reveal button's label. @default 'Reveal' */
|
|
10
|
+
label?: React.ReactNode;
|
|
11
|
+
/** The hide button's label, when `reversible` is on. @default 'Hide' */
|
|
12
|
+
hideLabel?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The line above the button, saying why the content is covered. Pass `false`
|
|
15
|
+
* for a cover with nothing written on it.
|
|
16
|
+
* @default 'This may contain spoilers'
|
|
17
|
+
*/
|
|
18
|
+
description?: React.ReactNode | false;
|
|
19
|
+
/**
|
|
20
|
+
* Replaces the default reveal button entirely.
|
|
21
|
+
*
|
|
22
|
+
* The replacement is yours to wire up: pass `revealed` and `onRevealedChange`
|
|
23
|
+
* and drive it from your own control. `label` is the prop for the far
|
|
24
|
+
* commoner case of wanting different words on the button that is already
|
|
25
|
+
* there.
|
|
26
|
+
*/
|
|
27
|
+
action?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Keeps the content coverable: once revealed, a hide button appears under it.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
reversible?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Clamps the covered box to this height — a CSS length, or a number in pixels.
|
|
35
|
+
* Revealing releases it and the content takes whatever height it needs.
|
|
36
|
+
*
|
|
37
|
+
* Left out, the box is exactly as tall as what it holds, which is the right
|
|
38
|
+
* default for a paragraph or a picture. Set it for something long enough that
|
|
39
|
+
* a page of blurred content would be a page of nothing.
|
|
40
|
+
*/
|
|
41
|
+
maxHeight?: number | string;
|
|
42
|
+
/** How hard the content is blurred, in pixels. @default 10 */
|
|
43
|
+
blur?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Inner padding around the content, on the sheet's `size` / `density` scale.
|
|
46
|
+
* Turn it off for something that should reach the edges — a picture, a video.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
padded?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* What the sheet is made of. `ghost` draws no box at all, which is what a
|
|
52
|
+
* spoiler sitting inside running prose usually wants.
|
|
53
|
+
* @default 'glass'
|
|
54
|
+
*/
|
|
55
|
+
variant?: PlassVariant;
|
|
56
|
+
/** The sheet's radius, and the size of the button on it. @default 'md' */
|
|
57
|
+
size?: PlassSize;
|
|
58
|
+
/** @default 'primary' */
|
|
59
|
+
color?: PlassColor;
|
|
60
|
+
/** Padding around the cover's own text and button. @default 'default' */
|
|
61
|
+
density?: PlassDensity;
|
|
62
|
+
/** Drop shadow depth. `0` is the default and it is flat. @default 0 */
|
|
63
|
+
elevation?: PlassElevation;
|
|
64
|
+
/** What is being covered. */
|
|
65
|
+
children?: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Content that is covered until somebody asks for it.
|
|
69
|
+
*
|
|
70
|
+
* The cover is a **blur** rather than a `display: none`, which is the whole
|
|
71
|
+
* point: a reader can see that there is something there, roughly how much of it
|
|
72
|
+
* there is, and — with `maxHeight` — that it has been clamped. What they cannot
|
|
73
|
+
* do is read it by accident, which is the one thing a spoiler is for.
|
|
74
|
+
*
|
|
75
|
+
* While it is covered the content is `inert`, so it is not tabbable, not
|
|
76
|
+
* readable by a screen reader and not selectable by a drag across the page. A
|
|
77
|
+
* spoiler that could be defeated by <kbd>Ctrl</kbd>+<kbd>A</kbd> is not a
|
|
78
|
+
* spoiler.
|
|
79
|
+
*
|
|
80
|
+
* The sheet is never dyed, exactly as on a `PlCard`: what a spoiler holds is a
|
|
81
|
+
* photograph, a paragraph, a plot twist, and it arrives with its own colours.
|
|
82
|
+
* The family shows up on the button and in the hairline and stops there.
|
|
83
|
+
*/
|
|
84
|
+
export declare const PlSpoiler: React.ForwardRefExoticComponent<PlSpoilerProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PlButton } from '../button/PlButton.js';
|
|
4
|
+
import { cx, hasContent, metaTextClasses, radiusClasses, sheetPaddingXClasses, sheetPaddingYClasses, sheetRestClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* The wash between the blurred content and the words on top of it.
|
|
7
|
+
*
|
|
8
|
+
* Blur alone is not cover. It takes a paragraph apart but leaves its colour and
|
|
9
|
+
* its rhythm — a photograph blurred at 10px is still recognisably a photograph
|
|
10
|
+
* of a face — and it leaves the button standing on whatever happened to be
|
|
11
|
+
* underneath it. Mixing the page's own surface over the top settles both: the
|
|
12
|
+
* content goes to a wash of its own colours, and the button gets something to
|
|
13
|
+
* stand on.
|
|
14
|
+
*/
|
|
15
|
+
const scrimClasses = '[background-color:color-mix(in_oklab,var(--plass-surface)_55%,transparent)]';
|
|
16
|
+
/**
|
|
17
|
+
* Content that is covered until somebody asks for it.
|
|
18
|
+
*
|
|
19
|
+
* The cover is a **blur** rather than a `display: none`, which is the whole
|
|
20
|
+
* point: a reader can see that there is something there, roughly how much of it
|
|
21
|
+
* there is, and — with `maxHeight` — that it has been clamped. What they cannot
|
|
22
|
+
* do is read it by accident, which is the one thing a spoiler is for.
|
|
23
|
+
*
|
|
24
|
+
* While it is covered the content is `inert`, so it is not tabbable, not
|
|
25
|
+
* readable by a screen reader and not selectable by a drag across the page. A
|
|
26
|
+
* spoiler that could be defeated by <kbd>Ctrl</kbd>+<kbd>A</kbd> is not a
|
|
27
|
+
* spoiler.
|
|
28
|
+
*
|
|
29
|
+
* The sheet is never dyed, exactly as on a `PlCard`: what a spoiler holds is a
|
|
30
|
+
* photograph, a paragraph, a plot twist, and it arrives with its own colours.
|
|
31
|
+
* The family shows up on the button and in the hairline and stops there.
|
|
32
|
+
*/
|
|
33
|
+
export const PlSpoiler = /* @__PURE__ */ React.forwardRef(function PlSpoiler({ revealed, defaultRevealed = false, onRevealedChange, label = 'Reveal', hideLabel = 'Hide', description = 'This may contain spoilers', action, reversible = false, maxHeight, blur = 10, padded = true, variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, className, style, children, ...props }, ref) {
|
|
34
|
+
const contentId = React.useId();
|
|
35
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultRevealed);
|
|
36
|
+
const open = revealed ?? uncontrolled;
|
|
37
|
+
const change = (next) => {
|
|
38
|
+
if (revealed === undefined) {
|
|
39
|
+
setUncontrolled(next);
|
|
40
|
+
}
|
|
41
|
+
onRevealedChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
const insetX = sheetPaddingXClasses[density][size];
|
|
44
|
+
const insetY = sheetPaddingYClasses[density][size];
|
|
45
|
+
const notice = description === false ? null : description;
|
|
46
|
+
return (_jsxs("div", { ref: ref, className: cx(
|
|
47
|
+
// A grid rather than a box with an absolutely positioned cover on it,
|
|
48
|
+
// and the difference is what happens to a *short* spoiler: an
|
|
49
|
+
// absolute cover is laid out against a box the content alone decided
|
|
50
|
+
// the height of, so a one-line spoiler clips its own Reveal button.
|
|
51
|
+
// Both children are put in the same cell instead, so the row is as
|
|
52
|
+
// tall as whichever of them needs more and they stretch to match.
|
|
53
|
+
'isolate grid overflow-hidden', radiusClasses[size], sheetRestClasses[variant], transitionClasses, className), style: { ...surfaceSlots(color, elevation), ...style }, ...props, children: [_jsx("div", { id: contentId, className: cx('min-w-0 [grid-area:1/1]', padded ? `${insetX} ${insetY}` : '', '[transition:filter_var(--plass-duration-slow)_var(--plass-ease)]', 'motion-reduce:[transition-duration:0ms]', open ? '' : 'select-none'), style: {
|
|
54
|
+
filter: open ? undefined : `blur(${blur}px)`,
|
|
55
|
+
// The clamp is only ever on the covered state: revealing something
|
|
56
|
+
// and leaving it in a box with a scrollbar is answering the wrong
|
|
57
|
+
// question.
|
|
58
|
+
maxHeight: open ? undefined : maxHeight,
|
|
59
|
+
overflow: open ? undefined : 'hidden'
|
|
60
|
+
},
|
|
61
|
+
// `inert` rather than `aria-hidden`: it takes the content out of the
|
|
62
|
+
// tab order, off the accessibility tree and out of the selection in
|
|
63
|
+
// one attribute — and `aria-hidden` alone would leave a keyboard
|
|
64
|
+
// reader tabbing into a link their screen reader has been told is not
|
|
65
|
+
// there.
|
|
66
|
+
inert: !open, children: children }), open ? null : (_jsxs("div", { className: cx('z-10 flex flex-col items-center justify-center gap-2 text-center [grid-area:1/1]', insetX, insetY, scrimClasses), children: [hasContent(notice) ? (_jsx("p", { className: cx('m-0 text-(--plass-muted-fg)', metaTextClasses[size]), children: notice })) : null, action ?? (_jsx(PlButton, { size: size, color: color, density: density, onClick: () => change(true), "aria-expanded": false, "aria-controls": contentId, children: label }))] })), open && reversible ? (_jsx("div", { className: cx('flex justify-end', insetX,
|
|
67
|
+
// The row takes the sheet's padding on both axes and then gives
|
|
68
|
+
// the top back: `padded` content already ends with a full gap, and
|
|
69
|
+
// two of them stacked is a hole between the text and the way back
|
|
70
|
+
// out. `pt-0` beating `py-*` is Tailwind's own
|
|
71
|
+
// longhand-after-shorthand ordering rather than an accident of how
|
|
72
|
+
// these are concatenated.
|
|
73
|
+
insetY, 'pt-0'), children: _jsx(PlButton, { variant: "ghost", size: size, color: color, density: density, onClick: () => change(false), "aria-expanded": true, "aria-controls": contentId, children: hideLabel }) })) : null] }));
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlSpoiler } from './PlSpoiler.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Switch as BaseUISwitch } from '@base-ui/react/switch';
|
|
3
|
+
import type { PlassAlign, PlassColor, PlassSize } from '../../types.js';
|
|
4
|
+
/** Which side of the track the label sits on. */
|
|
5
|
+
export type PlSwitchLabelPlacement = Extract<PlassAlign, 'start' | 'end'>;
|
|
6
|
+
type BaseSwitchProps = Omit<React.ComponentPropsWithoutRef<typeof BaseUISwitch.Root>, 'className' | 'style' | 'render' | 'children'>;
|
|
7
|
+
export interface PlSwitchProps extends BaseSwitchProps {
|
|
8
|
+
/** @default 'md' */
|
|
9
|
+
size?: PlassSize;
|
|
10
|
+
/** @default 'primary' */
|
|
11
|
+
color?: PlassColor;
|
|
12
|
+
/** The text beside the track. Wired to it by Base UI's Field. */
|
|
13
|
+
label?: React.ReactNode;
|
|
14
|
+
/** Helper text under the label. */
|
|
15
|
+
description?: React.ReactNode;
|
|
16
|
+
/** Error message below. Its presence also turns the switch invalid. */
|
|
17
|
+
error?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Forces the invalid state without a message — for when an external form
|
|
20
|
+
* library owns the validity. Defaults to whether `error` has content.
|
|
21
|
+
*/
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Which side the label sits on. `end` reads as a caption for the control;
|
|
25
|
+
* `start` is for a settings list, where the labels form a column and every
|
|
26
|
+
* switch lines up on the right.
|
|
27
|
+
* @default 'end'
|
|
28
|
+
*/
|
|
29
|
+
labelPlacement?: PlSwitchLabelPlacement;
|
|
30
|
+
/** Class names for the field wrapper, not for the track. */
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: React.CSSProperties;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An immediate on/off.
|
|
36
|
+
*
|
|
37
|
+
* The difference from a PlCheckbox is not visual, it is temporal: a checkbox is
|
|
38
|
+
* a value that gets submitted with a form, a switch takes effect the moment it
|
|
39
|
+
* moves. If there is a Save button underneath, it should have been a checkbox.
|
|
40
|
+
*/
|
|
41
|
+
export declare const PlSwitch: React.ForwardRefExoticComponent<PlSwitchProps & React.RefAttributes<HTMLElement>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Switch as BaseUISwitch } from '@base-ui/react/switch';
|
|
4
|
+
import { Field } from '@base-ui/react/field';
|
|
5
|
+
import { controlSlots, focusRingClasses, hasContent, metaTextClasses, tickRowTextClasses } from '../../internal/styles.js';
|
|
6
|
+
/**
|
|
7
|
+
* Track and thumb.
|
|
8
|
+
*
|
|
9
|
+
* The thumb is inset 2px on every side, so its diameter is the track's height
|
|
10
|
+
* minus 4 and the `left` it travels to is `100% − 2px − diameter`. That is the
|
|
11
|
+
* one number per step that has to be written out; everything else falls out of
|
|
12
|
+
* `inset-y-0.5` and `aspect-square`.
|
|
13
|
+
*/
|
|
14
|
+
const trackClasses = {
|
|
15
|
+
xs: 'h-3.5 w-6',
|
|
16
|
+
sm: 'h-4 w-7',
|
|
17
|
+
md: 'h-5 w-9',
|
|
18
|
+
lg: 'h-6 w-11',
|
|
19
|
+
xl: 'h-7 w-13'
|
|
20
|
+
};
|
|
21
|
+
const thumbTravelClasses = {
|
|
22
|
+
xs: 'data-[checked]:left-[calc(100%-0.75rem)]',
|
|
23
|
+
sm: 'data-[checked]:left-[calc(100%-0.875rem)]',
|
|
24
|
+
md: 'data-[checked]:left-[calc(100%-1.125rem)]',
|
|
25
|
+
lg: 'data-[checked]:left-[calc(100%-1.375rem)]',
|
|
26
|
+
xl: 'data-[checked]:left-[calc(100%-1.625rem)]'
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* A pill, and one of the two places in the library that is right.
|
|
30
|
+
*
|
|
31
|
+
* Everywhere else the radius stops well short of 50%, because the flat run
|
|
32
|
+
* along the top and bottom edge is what reads as a sheet with its corners cut
|
|
33
|
+
* off. A switch is not a sheet — it is a track something runs along, and a
|
|
34
|
+
* track with corners is a track the thumb would have to climb out of.
|
|
35
|
+
*/
|
|
36
|
+
const trackBaseClasses = /* @__PURE__ */ [
|
|
37
|
+
'relative inline-flex shrink-0 rounded-full',
|
|
38
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
39
|
+
// `background-image` is in the list because the on state is the gradient, and
|
|
40
|
+
// `left` deliberately is not: it belongs to the thumb, which is the one thing
|
|
41
|
+
// in the library that actually moves.
|
|
42
|
+
'[transition-property:background-color,background-image,box-shadow,filter]',
|
|
43
|
+
'[transition-duration:var(--plass-duration)]',
|
|
44
|
+
'[transition-timing-function:var(--plass-ease)]',
|
|
45
|
+
focusRingClasses
|
|
46
|
+
].join(' ');
|
|
47
|
+
/**
|
|
48
|
+
* Off, the track is the **groove** — `--plass-track`, the one neutral ink in the
|
|
49
|
+
* library whose job is to be seen from across a room. On, it is the family's
|
|
50
|
+
* gradient.
|
|
51
|
+
*
|
|
52
|
+
* Off used to be the glass at its most opaque with `--plass-well` falling into
|
|
53
|
+
* it, and it was wrong twice over. It was invisible: a 88%-white pill with a
|
|
54
|
+
* white thumb in it, set on a near-white page, is a switch a reader cannot find
|
|
55
|
+
* until they have already flipped it — and the off state is the one a settings
|
|
56
|
+
* list is mostly made of. And where it *was* visible, in the dark, an inset
|
|
57
|
+
* shadow under a thumb carrying a drop shadow of its own was a moulded rocker
|
|
58
|
+
* in a bevelled slot, which is the one picture this design language exists to
|
|
59
|
+
* not draw.
|
|
60
|
+
*
|
|
61
|
+
* So there is no well, no gloss and no edge either. A groove that is a *tone*
|
|
62
|
+
* rather than a recess needs no hairline to say where it ends, and the hairline
|
|
63
|
+
* it used to have was the second of two lines round the same object once the
|
|
64
|
+
* focus ring arrived.
|
|
65
|
+
*
|
|
66
|
+
* Dropping the border also squares the thumb's travel. `inset-y-0.5` and
|
|
67
|
+
* `left-0.5` are measured from the padding box; the `left` a checked thumb
|
|
68
|
+
* travels to is measured from the track's *width*. With a 1px edge between
|
|
69
|
+
* them the two disagreed, and every switch in the library sat 2px from its
|
|
70
|
+
* track on the left and 4px from it on the right.
|
|
71
|
+
*/
|
|
72
|
+
const restTrackClasses = /* @__PURE__ */ [
|
|
73
|
+
'cursor-pointer bg-(--plass-track)',
|
|
74
|
+
'hover:brightness-[0.97] dark:hover:brightness-110',
|
|
75
|
+
'data-[checked]:[background-image:var(--p-fill)]',
|
|
76
|
+
'data-[checked]:[box-shadow:var(--p-lift)] data-[checked]:hover:brightness-105'
|
|
77
|
+
].join(' ');
|
|
78
|
+
const readOnlyTrackClasses = /* @__PURE__ */ [
|
|
79
|
+
'cursor-default bg-(--plass-track) saturate-[0.55]',
|
|
80
|
+
'data-[checked]:[background-image:var(--p-fill)]',
|
|
81
|
+
'data-[checked]:shadow-none'
|
|
82
|
+
].join(' ');
|
|
83
|
+
const disabledTrackClasses = /* @__PURE__ */ [
|
|
84
|
+
'cursor-not-allowed bg-(--plass-track)',
|
|
85
|
+
'opacity-50 saturate-[0.35] shadow-none',
|
|
86
|
+
'data-[checked]:[background-image:var(--p-fill)]'
|
|
87
|
+
].join(' ');
|
|
88
|
+
/**
|
|
89
|
+
* The thumb is white in both themes — not `--plass-surface`, which is a near
|
|
90
|
+
* navy in the dark and left the off state as a grey lozenge in a grey slot.
|
|
91
|
+
*
|
|
92
|
+
* It keeps a shadow, and it is the smallest one on the ladder rather than the
|
|
93
|
+
* `--plass-shadow-1` it used to carry: the thumb is the one part of a switch
|
|
94
|
+
* that genuinely is above the surface it moves along, so it casts something —
|
|
95
|
+
* but a 14px disc under a 4px-blurred, 14px-wide shadow is a knob, not a light.
|
|
96
|
+
*/
|
|
97
|
+
const thumbClasses = /* @__PURE__ */ [
|
|
98
|
+
'absolute inset-y-0.5 left-0.5 aspect-square rounded-full bg-white',
|
|
99
|
+
'[box-shadow:0_1px_2px_rgb(20_40_90/0.25)]',
|
|
100
|
+
'[transition:left_var(--plass-duration)_var(--plass-ease)]'
|
|
101
|
+
].join(' ');
|
|
102
|
+
/**
|
|
103
|
+
* An immediate on/off.
|
|
104
|
+
*
|
|
105
|
+
* The difference from a PlCheckbox is not visual, it is temporal: a checkbox is
|
|
106
|
+
* a value that gets submitted with a form, a switch takes effect the moment it
|
|
107
|
+
* moves. If there is a Save button underneath, it should have been a checkbox.
|
|
108
|
+
*/
|
|
109
|
+
export const PlSwitch = /* @__PURE__ */ React.forwardRef(function PlSwitch({ size = 'md', color = 'primary', label, description, error, invalid, labelPlacement = 'end', disabled = false, readOnly = false, className, style, ...props }, ref) {
|
|
110
|
+
const hasError = hasContent(error);
|
|
111
|
+
const isInvalid = invalid ?? hasError;
|
|
112
|
+
const family = isInvalid ? 'danger' : color;
|
|
113
|
+
const track = (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: _jsx(BaseUISwitch.Root, { ref: ref, className: [
|
|
114
|
+
trackBaseClasses,
|
|
115
|
+
trackClasses[size],
|
|
116
|
+
disabled ? disabledTrackClasses : readOnly ? readOnlyTrackClasses : restTrackClasses
|
|
117
|
+
].join(' '), disabled: disabled, readOnly: readOnly, ...props, children: _jsx(BaseUISwitch.Thumb, { className: `${thumbClasses} ${thumbTravelClasses[size]}` }) }) }));
|
|
118
|
+
const text = label || description ? (_jsxs("span", { className: [
|
|
119
|
+
'flex min-w-0 flex-col gap-0.5',
|
|
120
|
+
// With the label on the left it has to take the slack, or the switch
|
|
121
|
+
// sits against the text instead of against the edge of the row.
|
|
122
|
+
labelPlacement === 'start' ? 'flex-1' : ''
|
|
123
|
+
]
|
|
124
|
+
.filter(Boolean)
|
|
125
|
+
.join(' '), children: [label ? (_jsx(Field.Label, { className: disabled ? 'text-(--plass-muted-fg)' : 'cursor-pointer text-(--plass-fg)', children: label })) : null, description ? (_jsx(Field.Description, { className: `${metaTextClasses[size]} text-(--plass-muted-fg)`, children: description })) : null] })) : null;
|
|
126
|
+
return (_jsxs(Field.Root, { disabled: disabled, invalid: isInvalid, className: ['inline-flex flex-col gap-1 align-top', className ?? '']
|
|
127
|
+
.filter(Boolean)
|
|
128
|
+
.join(' '),
|
|
129
|
+
// `solid`, because an on track *is* the coloured thing.
|
|
130
|
+
style: { ...controlSlots(family, 0, 'solid'), ...style }, children: [_jsx("div", { className: `flex items-start gap-2.5 ${tickRowTextClasses[size]}`, children: labelPlacement === 'start' ? (_jsxs(_Fragment, { children: [text, track] })) : (_jsxs(_Fragment, { children: [track, text] })) }), hasError ? (_jsx(Field.Error, { match: true, className: `${metaTextClasses[size]} text-(--p-accent)`, children: error })) : null] }));
|
|
131
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlSwitch } from './PlSwitch.js';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/** Which edge the text in a column lines up against. */
|
|
4
|
+
export type PlTableAlign = PlassAlign;
|
|
5
|
+
/**
|
|
6
|
+
* A column: its heading, its default width, and how to get a cell out of a row.
|
|
7
|
+
*
|
|
8
|
+
* This is the whole reason a table takes data rather than markup. A `<td>`
|
|
9
|
+
* written out per row can silently disagree with the `<th>` above it about how
|
|
10
|
+
* many there are or what order they come in; a column list cannot.
|
|
11
|
+
*/
|
|
12
|
+
export interface PlTableColumn<Row> {
|
|
13
|
+
/**
|
|
14
|
+
* Identifies the column, and — unless `render` says otherwise — names the
|
|
15
|
+
* property to read off each row.
|
|
16
|
+
*/
|
|
17
|
+
key: string;
|
|
18
|
+
/** The heading. Defaults to the `key`, which is usually not what you want. */
|
|
19
|
+
header?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* The column's default width. A number is pixels; a string is any CSS length
|
|
22
|
+
* (`'30%'`, `'12rem'`).
|
|
23
|
+
*
|
|
24
|
+
* "Default" is meant: the table still balances its columns to fill the sheet,
|
|
25
|
+
* so this is a starting proportion rather than a guarantee.
|
|
26
|
+
*/
|
|
27
|
+
width?: number | string;
|
|
28
|
+
/**
|
|
29
|
+
* Text alignment. Numbers usually want `end` so their digits line up in a
|
|
30
|
+
* column; everything else wants `start`.
|
|
31
|
+
* @default 'start'
|
|
32
|
+
*/
|
|
33
|
+
align?: PlTableAlign;
|
|
34
|
+
/**
|
|
35
|
+
* Renders the cell. Without it the cell is `row[key]` rendered as-is, which
|
|
36
|
+
* covers strings and numbers and nothing else.
|
|
37
|
+
*/
|
|
38
|
+
render?: (row: Row, index: number) => React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export interface PlTableProps<Row> extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
41
|
+
/**
|
|
42
|
+
* Drop shadow depth. `0` is the default — a table is a grid set into the page
|
|
43
|
+
* rather than a panel floating over it.
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
elevation?: PlassElevation;
|
|
47
|
+
/** The columns, in the order they appear. */
|
|
48
|
+
columns: readonly PlTableColumn<Row>[];
|
|
49
|
+
/** The rows. */
|
|
50
|
+
rows: readonly Row[];
|
|
51
|
+
/**
|
|
52
|
+
* A stable key per row. Defaults to the row's index, which is fine for a
|
|
53
|
+
* static table and wrong for one that sorts or filters.
|
|
54
|
+
*/
|
|
55
|
+
getRowKey?: (row: Row, index: number) => React.Key;
|
|
56
|
+
/** Shown above the grid, and read out as the table's accessible name. */
|
|
57
|
+
caption?: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* What to show instead of rows when `rows` is empty.
|
|
60
|
+
* @default 'No data'
|
|
61
|
+
*/
|
|
62
|
+
empty?: React.ReactNode;
|
|
63
|
+
/**
|
|
64
|
+
* Tints every other row. Useful on a wide table where the eye has to track
|
|
65
|
+
* across; noise on a narrow one.
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
striped?: boolean;
|
|
69
|
+
/** Lights the row under the pointer. @default false */
|
|
70
|
+
hoverable?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Pins the header while the rows scroll under it.
|
|
73
|
+
*
|
|
74
|
+
* It needs something to scroll *in*: a `position: sticky` header in a box
|
|
75
|
+
* that is as tall as its content has nowhere to stick, so this does nothing
|
|
76
|
+
* on its own. `maxHeight` is the usual answer and the two are made for each
|
|
77
|
+
* other; a table inside a pane that already caps its own height works just as
|
|
78
|
+
* well.
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
stickyHeader?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* A hard cap on the grid's height. A number is pixels; a string is any CSS
|
|
84
|
+
* length (`'24rem'`, `'60vh'`).
|
|
85
|
+
*
|
|
86
|
+
* Past it the rows scroll inside the sheet rather than the page growing, and
|
|
87
|
+
* the sheet keeps the size the layout around it was drawn for. It is the
|
|
88
|
+
* other half of `stickyHeader`: capped without pinning, the column names
|
|
89
|
+
* scroll away and the rest of the table is a grid of unlabelled numbers.
|
|
90
|
+
*
|
|
91
|
+
* The **grid** and not the sheet: a `caption` sits above the rows and outside
|
|
92
|
+
* what is capped, because a caption that scrolled away would take the table's
|
|
93
|
+
* accessible name with it.
|
|
94
|
+
*/
|
|
95
|
+
maxHeight?: number | string;
|
|
96
|
+
/** Makes rows activatable. Also turns on the hover treatment. */
|
|
97
|
+
onRowClick?: (row: Row, index: number) => void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A grid of data on a sheet of glass.
|
|
101
|
+
*
|
|
102
|
+
* The sheet is the ordinary Plass container — `variant`, `size`, `color`,
|
|
103
|
+
* `density` and `elevation` all mean what they mean everywhere else, and it is
|
|
104
|
+
* never dyed. What the table adds is the part that is genuinely tabular: the
|
|
105
|
+
* columns, the rows, and the fact that the two cannot drift apart.
|
|
106
|
+
*
|
|
107
|
+
* Not a `forwardRef`, because it is generic: a component wrapped in
|
|
108
|
+
* `React.forwardRef` loses its type parameter, and `Row` is the whole point of
|
|
109
|
+
* the API. `ref` is not offered rather than being offered with `Row` widened to
|
|
110
|
+
* `any`.
|
|
111
|
+
*/
|
|
112
|
+
export declare function PlTable<Row>({ variant, size, color, density, elevation, columns, rows, getRowKey, caption, empty, striped, hoverable, stickyHeader, maxHeight, onRowClick, className, style, ...props }: PlTableProps<Row>): React.JSX.Element;
|