plass-ui 0.0.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordion/PlAccordion.d.ts +98 -0
- package/dist/components/accordion/PlAccordion.js +1 -0
- package/dist/components/accordion/index.d.ts +2 -0
- package/dist/components/accordion/index.js +1 -0
- package/dist/components/alert/PlAlert.d.ts +50 -0
- package/dist/components/alert/PlAlert.js +1 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +1 -0
- package/dist/components/animate-appear/PlAnimateAppear.d.ts +55 -0
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -0
- package/dist/components/animate-appear/index.d.ts +2 -0
- package/dist/components/animate-appear/index.js +1 -0
- package/dist/components/animate-blink/PlAnimateBlink.d.ts +30 -0
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -0
- package/dist/components/animate-blink/index.d.ts +2 -0
- package/dist/components/animate-blink/index.js +1 -0
- package/dist/components/animate-fade/PlAnimateFade.d.ts +35 -0
- package/dist/components/animate-fade/PlAnimateFade.js +1 -0
- package/dist/components/animate-fade/index.d.ts +2 -0
- package/dist/components/animate-fade/index.js +1 -0
- package/dist/components/animate-grow/PlAnimateGrow.d.ts +45 -0
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -0
- package/dist/components/animate-grow/index.d.ts +2 -0
- package/dist/components/animate-grow/index.js +1 -0
- package/dist/components/animate-headline/PlAnimateHeadline.d.ts +55 -0
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -0
- package/dist/components/animate-headline/index.d.ts +2 -0
- package/dist/components/animate-headline/index.js +1 -0
- package/dist/components/animate-lighting/PlAnimateLighting.d.ts +67 -0
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -0
- package/dist/components/animate-lighting/index.d.ts +2 -0
- package/dist/components/animate-lighting/index.js +1 -0
- package/dist/components/animate-marquee/PlAnimateMarquee.d.ts +65 -0
- package/dist/components/animate-marquee/PlAnimateMarquee.js +1 -0
- package/dist/components/animate-marquee/index.d.ts +2 -0
- package/dist/components/animate-marquee/index.js +1 -0
- package/dist/components/animate-rotate/PlAnimateRotate.d.ts +52 -0
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -0
- package/dist/components/animate-rotate/index.d.ts +2 -0
- package/dist/components/animate-rotate/index.js +1 -0
- package/dist/components/animate-slide/PlAnimateSlide.d.ts +47 -0
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -0
- package/dist/components/animate-slide/index.d.ts +2 -0
- package/dist/components/animate-slide/index.js +1 -0
- package/dist/components/animate-typing/PlAnimateTyping.d.ts +56 -0
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -0
- package/dist/components/animate-typing/index.d.ts +2 -0
- package/dist/components/animate-typing/index.js +1 -0
- package/dist/components/animate-zoom/PlAnimateZoom.d.ts +37 -0
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -0
- package/dist/components/animate-zoom/index.d.ts +2 -0
- package/dist/components/animate-zoom/index.js +1 -0
- package/dist/components/aspect-ratio/PlAspectRatio.d.ts +64 -0
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -0
- package/dist/components/aspect-ratio/index.d.ts +2 -0
- package/dist/components/aspect-ratio/index.js +1 -0
- package/dist/components/avatar/PlAvatar.d.ts +102 -0
- package/dist/components/avatar/PlAvatar.js +1 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/badge/PlBadge.d.ts +86 -0
- package/dist/components/badge/PlBadge.js +1 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/blockquote/PlBlockquote.d.ts +64 -0
- package/dist/components/blockquote/PlBlockquote.js +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.js +1 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.d.ts +111 -0
- package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -0
- package/dist/components/bottom-navigation/index.d.ts +2 -0
- package/dist/components/bottom-navigation/index.js +1 -0
- package/dist/components/box/PlBox.d.ts +50 -0
- package/dist/components/box/PlBox.js +1 -0
- package/dist/components/box/index.d.ts +2 -0
- package/dist/components/box/index.js +1 -0
- package/dist/components/breadcrumb/PlBreadcrumb.d.ts +138 -0
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/button/{Button.d.ts → PlButton.d.ts} +3 -3
- package/dist/components/button/PlButton.js +1 -0
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/PlButtonGroup.d.ts +32 -0
- package/dist/components/button-group/PlButtonGroup.js +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/PlCard.d.ts +81 -0
- package/dist/components/card/PlCard.js +1 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/carousel/PlCarousel.d.ts +78 -0
- package/dist/components/carousel/PlCarousel.js +1 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +1 -0
- package/dist/components/chat-bubble/PlChatBubble.d.ts +127 -0
- package/dist/components/chat-bubble/PlChatBubble.js +1 -0
- package/dist/components/chat-bubble/index.d.ts +2 -0
- package/dist/components/chat-bubble/index.js +1 -0
- package/dist/components/checkbox/PlCheckbox.d.ts +39 -0
- package/dist/components/checkbox/PlCheckbox.js +1 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/PlChip.d.ts +55 -0
- package/dist/components/chip/PlChip.js +1 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/collapsible/PlCollapsible.d.ts +84 -0
- package/dist/components/collapsible/PlCollapsible.js +1 -0
- package/dist/components/collapsible/index.d.ts +2 -0
- package/dist/components/collapsible/index.js +1 -0
- package/dist/components/combobox/PlCombobox.d.ts +140 -0
- package/dist/components/combobox/PlCombobox.js +1 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1 -0
- package/dist/components/container/PlContainer.d.ts +66 -0
- package/dist/components/container/PlContainer.js +1 -0
- package/dist/components/container/index.d.ts +2 -0
- package/dist/components/container/index.js +1 -0
- package/dist/components/date-picker/PlDatePicker.d.ts +73 -0
- package/dist/components/date-picker/PlDatePicker.js +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-range-picker/PlDateRangePicker.d.ts +91 -0
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-time-picker/PlDateTimePicker.d.ts +74 -0
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -0
- package/dist/components/date-time-picker/index.d.ts +2 -0
- package/dist/components/date-time-picker/index.js +1 -0
- package/dist/components/divider/PlDivider.d.ts +73 -0
- package/dist/components/divider/PlDivider.js +1 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/drawer/PlDrawer.d.ts +144 -0
- package/dist/components/drawer/PlDrawer.js +1 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/file-picker/PlFilePicker.d.ts +105 -0
- package/dist/components/file-picker/PlFilePicker.js +1 -0
- package/dist/components/file-picker/index.d.ts +2 -0
- package/dist/components/file-picker/index.js +1 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.d.ts +118 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -0
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -0
- package/dist/components/floating-bottom-navigation/index.js +1 -0
- package/dist/components/grid/PlGrid.d.ts +67 -0
- package/dist/components/grid/PlGrid.js +1 -0
- package/dist/components/grid/PlGridItem.d.ts +50 -0
- package/dist/components/grid/PlGridItem.js +1 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/highlight/PlHighlight.d.ts +90 -0
- package/dist/components/highlight/PlHighlight.js +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.js +1 -0
- package/dist/components/hot-keys/PlHotKeys.d.ts +93 -0
- package/dist/components/hot-keys/PlHotKeys.js +1 -0
- package/dist/components/hot-keys/index.d.ts +2 -0
- package/dist/components/hot-keys/index.js +1 -0
- package/dist/components/icon/PlIcon.d.ts +62 -0
- package/dist/components/icon/PlIcon.js +1 -0
- package/dist/components/icon/index.d.ts +2 -0
- package/dist/components/icon/index.js +1 -0
- package/dist/components/icon-button/PlIconButton.d.ts +39 -0
- package/dist/components/icon-button/PlIconButton.js +1 -0
- package/dist/components/icon-button/index.d.ts +2 -0
- package/dist/components/icon-button/index.js +1 -0
- package/dist/components/list/PlList.d.ts +82 -0
- package/dist/components/list/PlList.js +1 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/menu/PlMenu.d.ts +210 -0
- package/dist/components/menu/PlMenu.js +1 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/modal/PlModal.d.ts +112 -0
- package/dist/components/modal/PlModal.js +1 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/number-field/PlNumberField.d.ts +133 -0
- package/dist/components/number-field/PlNumberField.js +1 -0
- package/dist/components/number-field/index.d.ts +2 -0
- package/dist/components/number-field/index.js +1 -0
- package/dist/components/otp-field/PlOtpField.d.ts +82 -0
- package/dist/components/otp-field/PlOtpField.js +1 -0
- package/dist/components/otp-field/index.d.ts +2 -0
- package/dist/components/otp-field/index.js +1 -0
- package/dist/components/overlay/PlOverlay.d.ts +96 -0
- package/dist/components/overlay/PlOverlay.js +1 -0
- package/dist/components/overlay/index.d.ts +2 -0
- package/dist/components/overlay/index.js +1 -0
- package/dist/components/pagination/PlPagination.d.ts +88 -0
- package/dist/components/pagination/PlPagination.js +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +1 -0
- package/dist/components/panes/PlPanes.d.ts +79 -0
- package/dist/components/panes/PlPanes.js +1 -0
- package/dist/components/panes/index.d.ts +2 -0
- package/dist/components/panes/index.js +1 -0
- package/dist/components/pill/PlPill.d.ts +81 -0
- package/dist/components/pill/PlPill.js +1 -0
- package/dist/components/pill/index.d.ts +2 -0
- package/dist/components/pill/index.js +1 -0
- package/dist/components/popover/PlPopover.d.ts +107 -0
- package/dist/components/popover/PlPopover.js +1 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +1 -0
- package/dist/components/progress-box/PlProgressBox.d.ts +32 -0
- package/dist/components/progress-box/PlProgressBox.js +1 -0
- package/dist/components/progress-box/index.d.ts +2 -0
- package/dist/components/progress-box/index.js +1 -0
- package/dist/components/progress-circular/PlProgressCircular.d.ts +22 -0
- package/dist/components/progress-circular/PlProgressCircular.js +1 -0
- package/dist/components/progress-circular/index.d.ts +2 -0
- package/dist/components/progress-circular/index.js +1 -0
- package/dist/components/progress-linear/PlProgressLinear.d.ts +31 -0
- package/dist/components/progress-linear/PlProgressLinear.js +1 -0
- package/dist/components/progress-linear/index.d.ts +2 -0
- package/dist/components/progress-linear/index.js +1 -0
- package/dist/components/radio-group/PlRadioGroup.d.ts +54 -0
- package/dist/components/radio-group/PlRadioGroup.js +1 -0
- package/dist/components/radio-group/index.d.ts +2 -0
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/rating/PlRating.d.ts +90 -0
- package/dist/components/rating/PlRating.js +1 -0
- package/dist/components/rating/index.d.ts +2 -0
- package/dist/components/rating/index.js +1 -0
- package/dist/components/scroll-zone/PlScrollZone.d.ts +132 -0
- package/dist/components/scroll-zone/PlScrollZone.js +1 -0
- package/dist/components/scroll-zone/index.d.ts +2 -0
- package/dist/components/scroll-zone/index.js +1 -0
- package/dist/components/segmented-button/PlSegmentedButton.d.ts +79 -0
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -0
- package/dist/components/segmented-button/index.d.ts +2 -0
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/select/PlSelect.d.ts +77 -0
- package/dist/components/select/PlSelect.js +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/skeleton/PlSkeleton.d.ts +73 -0
- package/dist/components/skeleton/PlSkeleton.js +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +1 -0
- package/dist/components/slider/PlSlider.d.ts +44 -0
- package/dist/components/slider/PlSlider.js +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +1 -0
- package/dist/components/spoiler/PlSpoiler.d.ts +84 -0
- package/dist/components/spoiler/PlSpoiler.js +1 -0
- package/dist/components/spoiler/index.d.ts +2 -0
- package/dist/components/spoiler/index.js +1 -0
- package/dist/components/switch/PlSwitch.d.ts +42 -0
- package/dist/components/switch/PlSwitch.js +1 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/table/PlTable.d.ts +112 -0
- package/dist/components/table/PlTable.js +1 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/tabs/PlTabs.d.ts +94 -0
- package/dist/components/tabs/PlTabs.js +1 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/text-field/{TextField.d.ts → PlTextField.d.ts} +5 -5
- package/dist/components/text-field/PlTextField.js +1 -0
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-link/PlTextLink.d.ts +80 -0
- package/dist/components/text-link/PlTextLink.js +1 -0
- package/dist/components/text-link/index.d.ts +2 -0
- package/dist/components/text-link/index.js +1 -0
- package/dist/components/time-picker/PlTimePicker.d.ts +88 -0
- package/dist/components/time-picker/PlTimePicker.js +1 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/timeline/PlTimeline.d.ts +98 -0
- package/dist/components/timeline/PlTimeline.js +1 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/toast/PlToast.d.ts +122 -0
- package/dist/components/toast/PlToast.js +1 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toolbar/PlToolbar.d.ts +68 -0
- package/dist/components/toolbar/PlToolbar.js +1 -0
- package/dist/components/toolbar/index.d.ts +2 -0
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/tooltip/PlTooltip.d.ts +92 -0
- package/dist/components/tooltip/PlTooltip.js +1 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/components/typography/PlTypography.d.ts +66 -0
- package/dist/components/typography/PlTypography.js +1 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/css/accordion.css +2 -0
- package/dist/css/alert.css +2 -0
- package/dist/css/animate-appear.css +2 -0
- package/dist/css/animate-blink.css +2 -0
- package/dist/css/animate-fade.css +2 -0
- package/dist/css/animate-grow.css +2 -0
- package/dist/css/animate-headline.css +2 -0
- package/dist/css/animate-lighting.css +2 -0
- package/dist/css/animate-marquee.css +2 -0
- package/dist/css/animate-rotate.css +2 -0
- package/dist/css/animate-slide.css +2 -0
- package/dist/css/animate-typing.css +2 -0
- package/dist/css/animate-zoom.css +2 -0
- package/dist/css/aspect-ratio.css +2 -0
- package/dist/css/avatar.css +2 -0
- package/dist/css/badge.css +2 -0
- package/dist/css/base.css +4 -0
- package/dist/css/blockquote.css +2 -0
- package/dist/css/bottom-navigation.css +2 -0
- package/dist/css/box.css +2 -0
- package/dist/css/breadcrumb.css +2 -0
- package/dist/css/button-group.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/card.css +2 -0
- package/dist/css/carousel.css +2 -0
- package/dist/css/chat-bubble.css +2 -0
- package/dist/css/checkbox.css +2 -0
- package/dist/css/chip.css +2 -0
- package/dist/css/collapsible.css +2 -0
- package/dist/css/combobox.css +2 -0
- package/dist/css/container.css +2 -0
- package/dist/css/date-picker.css +2 -0
- package/dist/css/date-range-picker.css +2 -0
- package/dist/css/date-time-picker.css +2 -0
- package/dist/css/divider.css +2 -0
- package/dist/css/drawer.css +2 -0
- package/dist/css/file-picker.css +2 -0
- package/dist/css/floating-bottom-navigation.css +2 -0
- package/dist/css/grid.css +2 -0
- package/dist/css/highlight.css +2 -0
- package/dist/css/hot-keys.css +2 -0
- package/dist/css/icon-button.css +2 -0
- package/dist/css/icon.css +2 -0
- package/dist/css/list.css +2 -0
- package/dist/css/menu.css +2 -0
- package/dist/css/modal.css +2 -0
- package/dist/css/number-field.css +2 -0
- package/dist/css/otp-field.css +2 -0
- package/dist/css/overlay.css +2 -0
- package/dist/css/pagination.css +2 -0
- package/dist/css/panes.css +2 -0
- package/dist/css/pill.css +2 -0
- package/dist/css/popover.css +2 -0
- package/dist/css/progress-box.css +2 -0
- package/dist/css/progress-circular.css +2 -0
- package/dist/css/progress-linear.css +2 -0
- package/dist/css/radio-group.css +2 -0
- package/dist/css/rating.css +2 -0
- package/dist/css/scroll-zone.css +2 -0
- package/dist/css/segmented-button.css +2 -0
- package/dist/css/select.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/slider.css +2 -0
- package/dist/css/spoiler.css +2 -0
- package/dist/css/switch.css +2 -0
- package/dist/css/table.css +2 -0
- package/dist/css/tabs.css +2 -0
- package/dist/css/text-field.css +2 -0
- package/dist/css/text-link.css +2 -0
- package/dist/css/time-picker.css +2 -0
- package/dist/css/timeline.css +2 -0
- package/dist/css/toast.css +2 -0
- package/dist/css/toolbar.css +2 -0
- package/dist/css/tooltip.css +2 -0
- package/dist/css/typography.css +2 -0
- package/dist/index.d.ts +75 -3
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +161 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/button-group.d.ts +27 -0
- package/dist/internal/button-group.js +2 -0
- package/dist/internal/calendar.d.ts +148 -0
- package/dist/internal/calendar.js +1 -0
- package/dist/internal/date.d.ts +173 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/format.d.ts +24 -0
- package/dist/internal/format.js +1 -0
- package/dist/internal/grid.d.ts +67 -0
- package/dist/internal/grid.js +1 -0
- package/dist/internal/icons.d.ts +86 -1
- package/dist/internal/icons.js +1 -1
- package/dist/internal/menu.d.ts +20 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/picker.d.ts +118 -0
- package/dist/internal/picker.js +1 -0
- package/dist/internal/progress.d.ts +145 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/sizer.d.ts +32 -0
- package/dist/internal/sizer.js +1 -0
- package/dist/internal/styles.d.ts +198 -8
- package/dist/internal/styles.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +899 -125
- package/dist/tokens.css +1275 -0
- package/dist/types.d.ts +150 -8
- package/dist/types.js +0 -8
- package/package.json +32 -27
- package/README.md +0 -111
- package/dist/components/button/Button.js +0 -1
- package/dist/components/text-field/TextField.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassProgressProps } from '../../internal/progress.js';
|
|
3
|
+
export interface PlProgressBoxProps extends PlassProgressProps {
|
|
4
|
+
/** Size of one plate. */
|
|
5
|
+
size?: PlassProgressProps['size'];
|
|
6
|
+
/**
|
|
7
|
+
* How many plates the row is made of.
|
|
8
|
+
*
|
|
9
|
+
* Four by default: enough that the wave reads as a wave, few enough that a
|
|
10
|
+
* determinate row can be counted at a glance rather than measured. Set it to
|
|
11
|
+
* the number of steps when the thing being waited on genuinely has steps.
|
|
12
|
+
* @default 4
|
|
13
|
+
*/
|
|
14
|
+
count?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A row of small glass plates that light up.
|
|
18
|
+
*
|
|
19
|
+
* The third shape, and the one that is about the material rather than about the
|
|
20
|
+
* quantity. A bar and a ring both say "this much of it is done"; a row of
|
|
21
|
+
* plates says "this is working" in the library's own vocabulary — the same
|
|
22
|
+
* groove, the same corner, the same gradient — which is what makes it the right
|
|
23
|
+
* one for a loading state inside a Plass surface, where a foreign grey spinner
|
|
24
|
+
* would look borrowed.
|
|
25
|
+
*
|
|
26
|
+
* It answers a value when it has one: the plates fill in order, the leading one
|
|
27
|
+
* partially, so four plates read as a four-segment bar rather than as four
|
|
28
|
+
* quarters. Without a value they cycle, each held back by its own index — and
|
|
29
|
+
* what cycles is the fill's **opacity**, because a gradient has no interpolation
|
|
30
|
+
* between itself and nothing.
|
|
31
|
+
*/
|
|
32
|
+
export declare const PlProgressBox: React.ForwardRefExoticComponent<PlProgressBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as l from"react";import{Progress as s}from"@base-ui/react/progress";import{fillTransitionClasses as r,plateGapClasses as t,plateRadiusClasses as n,plateSizeClasses as i,progressAriaText as o,progressFraction as m,progressSlots as c,progressText as u,trackClasses as f}from"../../internal/progress.js";import{cx as d,metaTextClasses as p,stackGapClasses as x}from"../../internal/styles.js";export const PlProgressBox=/* @__PURE__ */l.forwardRef(function PlProgressBox({size:l="md",color:h="primary",count:g=4,value:y=null,min:b=0,max:v=100,label:w,showValue:N=!1,format:j,className:M,style:P,...k},V){const A=m(y,b,v),B=null===A,R=void 0!==j,T=Math.max(1,Math.floor(g));return a(s.Root,{ref:V,value:y??null,min:b,max:v,format:j,getAriaValueText:o(A,R),className:d("inline-flex flex-col",x[l],M),style:{...c(h),...P},...k,children:[w||N?a("div",{className:d("flex items-baseline gap-2",w?"justify-between":"justify-end",p[l]),children:[w?e(s.Label,{className:"min-w-0 truncate text-(--plass-fg)",children:w}):null,N?e(s.Value,{className:"shrink-0 tabular-nums text-(--plass-muted-fg)",children:e=>u(A,e,R)}):null]}):null,e(s.Track,{className:d("flex",t[l]),children:Array.from({length:T},(a,s)=>e("span",{className:d("relative overflow-hidden",f,i[l],n[l]),children:e("span",{"aria-hidden":"true",className:d("absolute inset-y-0 start-0 [background-image:var(--p-fill)]",B?"plass-plate-wave w-full":r),style:B?{"--p-i":s}:{width:`${Math.min(100,Math.max(0,100*(A*T-s)))}%`}})},s))})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlProgressBox}from"./PlProgressBox.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassProgressProps } from '../../internal/progress.js';
|
|
3
|
+
export interface PlProgressCircularProps extends PlassProgressProps {
|
|
4
|
+
/** Diameter of the ring. Sits just under the control ladder at every step. */
|
|
5
|
+
size?: PlassProgressProps['size'];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A ring that fills, and the one to reach for where there is no room for a bar
|
|
9
|
+
* — inside a button, at the end of a table row, next to a field.
|
|
10
|
+
*
|
|
11
|
+
* The arc is the family's gradient rather than a flat colour, which takes a
|
|
12
|
+
* `<linearGradient>` of its own: an SVG stroke cannot be given a CSS gradient,
|
|
13
|
+
* so the two ends of the fill are lifted out of the slots and rebuilt at 135°.
|
|
14
|
+
* It is worth the extra element — a flat ring beside a swept bar is two
|
|
15
|
+
* materials for one idea.
|
|
16
|
+
*
|
|
17
|
+
* The value and the label sit *beside* the ring rather than inside it. A number
|
|
18
|
+
* in the middle of a dial is the picture everyone has of this component, and it
|
|
19
|
+
* only works at two of the five sizes: at `xs` the ring is fourteen pixels
|
|
20
|
+
* across and there is nowhere for "40%" to go. Beside it, every size reads.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PlProgressCircular: React.ForwardRefExoticComponent<PlProgressCircularProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as r,jsxs as s}from"react/jsx-runtime";import*as e from"react";import{Progress as a}from"@base-ui/react/progress";import{progressAriaText as t,progressFraction as l,progressSlots as o,progressText as i,ringDiameters as n,ringStrokes as c}from"../../internal/progress.js";import{cx as m,gapClasses as f,metaTextClasses as u}from"../../internal/styles.js";export const PlProgressCircular=/* @__PURE__ */e.forwardRef(function PlProgressCircular({size:d="md",color:p="primary",value:h=null,min:x=0,max:k=100,label:g,showValue:v=!1,format:y,className:$,style:w,...N},j){const P=l(h,x,k),b=null===P,C=void 0!==y,V=`${e.useId()}-fill`,D=n[d],I=c[d],L=D/2,R=L-I/2,W=2*Math.PI*R,_=b?`${.28*W} ${W}`:`${W}`,z=b?0:W*(1-P);return s(a.Root,{ref:j,value:h??null,min:x,max:k,format:y,getAriaValueText:t(P,C),className:m("inline-flex items-center",f[d],u[d],$),style:{...o(p),...w},...N,children:[s("svg",{className:m("shrink-0",b&&"plass-ring-spin"),width:D,height:D,viewBox:`0 0 ${D} ${D}`,fill:"none","aria-hidden":"true",children:[r("defs",{children:s("linearGradient",{id:V,x1:"0",y1:"0",x2:"1",y2:"1",children:[r("stop",{offset:"0%",stopColor:"var(--p-solid)"}),r("stop",{offset:"100%",stopColor:"var(--p-solid-to)"})]})}),r("circle",{cx:L,cy:L,r:R,stroke:"var(--plass-track)",strokeWidth:I}),r("circle",{cx:L,cy:L,r:R,stroke:`url(#${V})`,strokeWidth:I,strokeLinecap:"round",strokeDasharray:_,strokeDashoffset:z,transform:`rotate(-90 ${L} ${L})`,className:"[transition:stroke-dashoffset_var(--plass-duration-slow)_var(--plass-ease)]"})]}),g?r(a.Label,{className:"min-w-0 truncate text-(--plass-fg)",children:g}):null,v?r(a.Value,{className:"shrink-0 tabular-nums text-(--plass-muted-fg)",children:r=>i(P,r,C)}):null]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlProgressCircular}from"./PlProgressCircular.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassProgressProps } from '../../internal/progress.js';
|
|
3
|
+
export interface PlProgressLinearProps extends PlassProgressProps {
|
|
4
|
+
/** Thickness of the groove. Nothing else on a bar has a size. */
|
|
5
|
+
size?: PlassProgressProps['size'];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A bar that fills.
|
|
9
|
+
*
|
|
10
|
+
* The workhorse of the three: it is the only one that can show *how much* is
|
|
11
|
+
* left at a glance, because length is the one quantity a reader can compare
|
|
12
|
+
* without counting.
|
|
13
|
+
*
|
|
14
|
+
* The groove is `--plass-track`, the same neutral ink a PlSlider's rail and a
|
|
15
|
+
* PlSwitch's off state are cut in, and the segment over it is the family's
|
|
16
|
+
* gradient — so the filled part of the run is made of exactly the same material
|
|
17
|
+
* as the button that submits the form it is in. Which is also why the movement
|
|
18
|
+
* is on `width`: a gradient cannot be transitioned, and a length can.
|
|
19
|
+
*
|
|
20
|
+
* Both the groove and the segment are fully rounded, and that is the one place
|
|
21
|
+
* the library's rule about pills does not apply. The rule protects the flat run
|
|
22
|
+
* along a control's edge that a line of text sits on; at six pixels tall there
|
|
23
|
+
* is no flat run left to protect, and a square-ended bar reads as a rendering
|
|
24
|
+
* fault rather than as a cut edge.
|
|
25
|
+
*
|
|
26
|
+
* Base UI owns the semantics — `role="progressbar"`, the value and range
|
|
27
|
+
* attributes, `aria-valuetext`, and dropping the value entirely when the bar is
|
|
28
|
+
* indeterminate — and it computes the fill width too, so the determinate case
|
|
29
|
+
* here is a class list and nothing else.
|
|
30
|
+
*/
|
|
31
|
+
export declare const PlProgressLinear: React.ForwardRefExoticComponent<PlProgressLinearProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as s from"react";import{Progress as r}from"@base-ui/react/progress";import{barThicknessClasses as a,fillTransitionClasses as t,progressAriaText as n,progressFraction as o,progressSlots as i,progressText as m,trackClasses as u}from"../../internal/progress.js";import{cx as c,metaTextClasses as f,stackGapClasses as d}from"../../internal/styles.js";export const PlProgressLinear=/* @__PURE__ */s.forwardRef(function PlProgressLinear({size:s="md",color:p="primary",value:x=null,min:g=0,max:b=100,label:h,showValue:w=!1,format:j,className:v,style:N,...y},P){const k=o(x,g,b),L=null===k,V=void 0!==j;return l(r.Root,{ref:P,value:x??null,min:g,max:b,format:j,getAriaValueText:n(k,V),className:c("flex w-full flex-col",d[s],v),style:{...i(p),...N},...y,children:[h||w?l("div",{className:c("flex items-baseline gap-2",h?"justify-between":"justify-end",f[s]),children:[h?e(r.Label,{className:"min-w-0 truncate text-(--plass-fg)",children:h}):null,w?e(r.Value,{className:"shrink-0 tabular-nums text-(--plass-muted-fg)",children:e=>m(k,e,V)}):null]}):null,e(r.Track,{className:c("relative w-full overflow-hidden rounded-full",u,a[s]),children:e(r.Indicator,{className:c("rounded-full [background-image:var(--p-fill)]",L?"plass-progress-sweep":`absolute top-0 ${t}`)})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlProgressLinear}from"./PlProgressLinear.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Radio as BaseUIRadio } from '@base-ui/react/radio';
|
|
3
|
+
import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group';
|
|
4
|
+
import type { PlassColor, PlassOrientation, PlassSize } from '../../types.js';
|
|
5
|
+
export interface PlRadioGroupProps extends Omit<React.ComponentPropsWithoutRef<typeof BaseUIRadioGroup>, 'className' | 'style' | 'render'> {
|
|
6
|
+
/** @default 'md' */
|
|
7
|
+
size?: PlassSize;
|
|
8
|
+
/** @default 'primary' */
|
|
9
|
+
color?: PlassColor;
|
|
10
|
+
/**
|
|
11
|
+
* Which way the options stack. Vertical by default — a column of options is
|
|
12
|
+
* scannable at any length, and a row silently becomes unreadable the moment
|
|
13
|
+
* one label is longer than expected.
|
|
14
|
+
* @default 'vertical'
|
|
15
|
+
*/
|
|
16
|
+
orientation?: PlassOrientation;
|
|
17
|
+
/** The question the options answer. Rendered as the group's label. */
|
|
18
|
+
label?: React.ReactNode;
|
|
19
|
+
/** Helper text under the label. */
|
|
20
|
+
description?: React.ReactNode;
|
|
21
|
+
/** Error message below the options. Its presence also turns the group invalid. */
|
|
22
|
+
error?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Forces the invalid state without a message — for when an external form
|
|
25
|
+
* library owns the validity. Defaults to whether `error` has content.
|
|
26
|
+
*/
|
|
27
|
+
invalid?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
}
|
|
31
|
+
export interface PlRadioProps extends Omit<React.ComponentPropsWithoutRef<typeof BaseUIRadio.Root>, 'className' | 'style' | 'render' | 'children'> {
|
|
32
|
+
/** The text beside the dot. Wired to it by Base UI's Field. */
|
|
33
|
+
label?: React.ReactNode;
|
|
34
|
+
/** Helper text under the label. */
|
|
35
|
+
description?: React.ReactNode;
|
|
36
|
+
className?: string;
|
|
37
|
+
style?: React.CSSProperties;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* One option in a `PlRadioGroup`.
|
|
41
|
+
*
|
|
42
|
+
* It has no `size` and no `color` of its own — both come from the group, which
|
|
43
|
+
* is the only place they can be set once and mean the same thing for every
|
|
44
|
+
* option in the set.
|
|
45
|
+
*/
|
|
46
|
+
export declare const PlRadio: React.ForwardRefExoticComponent<PlRadioProps & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
/**
|
|
48
|
+
* A set of options where exactly one is chosen.
|
|
49
|
+
*
|
|
50
|
+
* Base UI owns the roving tab index and the arrow-key navigation, which is the
|
|
51
|
+
* whole reason a radio group is a component at all rather than a `<div>` full of
|
|
52
|
+
* inputs: the set takes one tab stop, and the arrows move within it.
|
|
53
|
+
*/
|
|
54
|
+
export declare const PlRadioGroup: React.ForwardRefExoticComponent<PlRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as r from"react";import{Radio as l}from"@base-ui/react/radio";import{RadioGroup as o}from"@base-ui/react/radio-group";import{Field as s}from"@base-ui/react/field";import{controlSlots as t,focusRingClasses as i,glassClasses as d,hasContent as n,metaTextClasses as c,tickDotClasses as p,tickRowTextClasses as m,tickSizeClasses as f,transitionClasses as u}from"../../internal/styles.js";const h=/* @__PURE__ */r.createContext({size:"md",color:"primary",readOnly:!1}),b=/* @__PURE__ */["relative inline-flex shrink-0 items-center justify-center rounded-full border","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",u,i].join(" "),g=/* @__PURE__ */[d,"cursor-pointer bg-(--plass-glass) [border-color:var(--plass-border)]","hover:bg-(--plass-glass-hover) hover:[border-color:var(--p-line)]","data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)","data-[checked]:[border-color:transparent] data-[checked]:hover:brightness-105"].join(" "),x=/* @__PURE__ */[d,"cursor-default bg-(--plass-glass) [border-color:var(--plass-border)]","saturate-[0.55]","data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)","data-[checked]:[border-color:transparent]"].join(" "),v=/* @__PURE__ */[d,"cursor-not-allowed bg-(--plass-glass) [border-color:var(--plass-border)]","opacity-50 saturate-[0.35]","data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)","data-[checked]:[border-color:transparent]"].join(" ");export const PlRadio=/* @__PURE__ */r.forwardRef(function PlRadio({label:o,description:t,disabled:i=!1,className:d,style:n,...u},k){const y=r.useContext(h),N=u.readOnly??y.readOnly;return e(s.Root,{disabled:i,className:["flex flex-col",d??""].filter(Boolean).join(" "),style:n,children:a("div",{className:`flex items-start gap-2 ${m[y.size]}`,children:[e("span",{className:"flex h-[1lh] shrink-0 items-center",children:e(l.Root,{ref:k,className:[b,f[y.size],i?v:N?x:g].join(" "),disabled:i,...u,children:e(l.Indicator,{className:`rounded-full bg-current ${p[y.size]}`})})}),o||t?a("span",{className:"flex min-w-0 flex-col gap-0.5",children:[o?e(s.Label,{className:i?"text-(--plass-muted-fg)":"cursor-pointer text-(--plass-fg)",children:o}):null,t?e(s.Description,{className:`${c[y.size]} text-(--plass-muted-fg)`,children:t}):null]}):null]})})});export const PlRadioGroup=/* @__PURE__ */r.forwardRef(function PlRadioGroup({size:l="md",color:i="primary",orientation:d="vertical",label:p,description:m,error:f,invalid:u,disabled:b=!1,readOnly:g=!1,className:x,style:v,children:k,...y},N){const j=n(f),R=u??j,z=R?"danger":i,w=r.useMemo(()=>({size:l,color:z,readOnly:g}),[l,z,g]);return e(h.Provider,{value:w,children:a(s.Root,{disabled:b,invalid:R,className:["flex flex-col gap-1.5",x??""].filter(Boolean).join(" "),style:{...t(z,0,"solid"),...v},children:[p?e(s.Label,{className:[c[l],"font-semibold",b?"text-(--plass-muted-fg)":"text-(--plass-fg)"].join(" "),children:p}):null,m?e(s.Description,{className:`${c[l]} text-(--plass-muted-fg)`,children:m}):null,e(o,{ref:N,disabled:b,readOnly:g,className:["flex","horizontal"===d?"flex-row flex-wrap gap-x-5 gap-y-2":"flex-col gap-2"].join(" "),...y,children:k}),j?e(s.Error,{match:!0,className:`${c[l]} text-(--p-accent)`,children:f}):null]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlRadio,PlRadioGroup}from"./PlRadioGroup.js";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassSize } from '../../types.js';
|
|
3
|
+
export interface PlRatingProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
4
|
+
/** How much is rated. Use with `onValueChange` for a controlled rating. */
|
|
5
|
+
value?: number;
|
|
6
|
+
/** Where an uncontrolled rating starts. @default 0 */
|
|
7
|
+
defaultValue?: number;
|
|
8
|
+
/** Called with the new score. `0` is what a cleared rating reports. */
|
|
9
|
+
onValueChange?: (value: number) => void;
|
|
10
|
+
/** How many stars there are, and therefore the highest score. @default 5 */
|
|
11
|
+
count?: number;
|
|
12
|
+
/**
|
|
13
|
+
* The smallest step that can be *chosen*, as a fraction of one star — `0.5`
|
|
14
|
+
* gives half stars, `1` whole ones. Anything outside `0 < precision <= 1`
|
|
15
|
+
* falls back to `1`.
|
|
16
|
+
*
|
|
17
|
+
* It bounds what a reader can pick and nothing else: a `value` of `4.3` is
|
|
18
|
+
* drawn as four stars and a third at every precision, because an average is
|
|
19
|
+
* not a choice and rounding it to the nearest half would be reporting a
|
|
20
|
+
* different number from the one the component was handed.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
precision?: number;
|
|
24
|
+
/** The glyph a filled star is drawn with. */
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
/** And the one an empty star is drawn with. Has to be the same shape. */
|
|
27
|
+
emptyIcon?: React.ReactNode;
|
|
28
|
+
/** Choosing the score that is already chosen clears it back to `0`. @default true */
|
|
29
|
+
clearable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Shows the score without letting it be changed — a product's average, a
|
|
32
|
+
* rating somebody else left.
|
|
33
|
+
*
|
|
34
|
+
* This is the one `readOnly` in the library that does **not** drain the
|
|
35
|
+
* saturation, because it is not a control being held still: there are no
|
|
36
|
+
* inputs at all, and what is left is a picture of a number. A row of grey
|
|
37
|
+
* stars would say the score itself was unavailable.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
readOnly?: boolean;
|
|
41
|
+
/** Unavailable. The light goes out of the whole row. */
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/** Identifies the value when a form is submitted. */
|
|
44
|
+
name?: string;
|
|
45
|
+
/** A form will not submit until a star has been chosen. */
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/** Height of one star, on the standalone-glyph ladder. @default 'md' */
|
|
48
|
+
size?: PlassSize;
|
|
49
|
+
/**
|
|
50
|
+
* Semantic colour role.
|
|
51
|
+
*
|
|
52
|
+
* `warning` by default — the amber a star is expected to be — rather than the
|
|
53
|
+
* `primary` everything else takes. It is the one place in the library where a
|
|
54
|
+
* component's default colour is chosen by what the object *is* instead of by
|
|
55
|
+
* what it means.
|
|
56
|
+
* @default 'warning'
|
|
57
|
+
*/
|
|
58
|
+
color?: PlassColor;
|
|
59
|
+
/** Names the whole control. @default 'Rating' */
|
|
60
|
+
label?: string;
|
|
61
|
+
/**
|
|
62
|
+
* What one star, and the whole control once it is read only, is called.
|
|
63
|
+
* @default `{value} out of {count}`
|
|
64
|
+
*/
|
|
65
|
+
valueLabel?: (value: number, count: number) => string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A score out of five, as a row of stars.
|
|
69
|
+
*
|
|
70
|
+
* Underneath an interactive rating is a radio group of real `<input>`s, one per
|
|
71
|
+
* choosable score, each visually hidden under the fraction of a star it stands
|
|
72
|
+
* for. That is the whole accessibility argument: a rating *is* "exactly one of
|
|
73
|
+
* these", so it gets one tab stop for the row, arrow keys within it,
|
|
74
|
+
* `aria-checked` on the one that is taken, and a value in a form submission —
|
|
75
|
+
* none of which a row of `<button>`s or a `<div>` with a click handler would
|
|
76
|
+
* have.
|
|
77
|
+
*
|
|
78
|
+
* The fraction is drawn by laying the filled star over the empty one and
|
|
79
|
+
* clipping it to a percentage of the width. Nothing is transformed and no glyph
|
|
80
|
+
* is scaled, so a half star is the left half of exactly the star beside it —
|
|
81
|
+
* which is also the no-transform rule holding on a component whose whole job is
|
|
82
|
+
* a partial shape. The clip runs from the inline start, so it fills from the
|
|
83
|
+
* right under RTL without anything being told to.
|
|
84
|
+
*
|
|
85
|
+
* `readOnly` is a different component in the same clothes: no inputs, no radio
|
|
86
|
+
* group, and one `role="img"` carrying the score as a sentence. A star display
|
|
87
|
+
* that kept twenty focusable radios would be twenty tab stops on a page that
|
|
88
|
+
* was only reporting a number.
|
|
89
|
+
*/
|
|
90
|
+
export declare const PlRating: React.ForwardRefExoticComponent<PlRatingProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{StarIcon as n,StarOutlineIcon as r}from"../../internal/icons.js";import{controlSlots as l,cx as i,focusWithinRingClasses as s,gapClasses as o,iconSizeClasses as c,radiusClasses as d,srOnlyClasses as u,transitionClasses as m}from"../../internal/styles.js";const h="flex items-center justify-center";function defaultValueLabel(e,a){return e<=0?"No rating":`${e} out of ${a}`}export const PlRating=/* @__PURE__ */t.forwardRef(function PlRating({value:p,defaultValue:f=0,onValueChange:y,count:b=5,precision:x=1,icon:v,emptyIcon:g,clearable:N=!0,readOnly:M=!1,disabled:w=!1,name:j,required:L=!1,size:P="md",color:k="warning",label:R="Rating",valueLabel:V=defaultValueLabel,className:q,style:C,onPointerLeave:I,...S},A){const $=t.useId(),z=j??$,[E,F]=t.useState(f),O=void 0!==p,B=O?p:E,[D,G]=t.useState(null),H=Math.max(1,Math.floor(b)),J=x>0&&x<=1?x:1,K=Math.round(1/J),Q=Math.max(0,Math.min(H,D??B)),change=e=>{O||F(e),y?.(e)},T=Array.from({length:H},(t,l)=>{const o=Math.max(0,Math.min(1,Q-l));return a("span",{className:i("relative inline-flex shrink-0",c[P],d.xs,M||w?"":s),children:[e("span",{className:i(h,c[P],"text-(--p-empty)"),children:g??e(r,{})}),e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 start-0 overflow-hidden",style:{width:100*o+"%"},children:e("span",{className:i(h,c[P],"text-(--p-accent)",m),children:v??e(n,{})})}),M?null:Array.from({length:K},(a,t)=>{const n=Number((l+(t+1)*J).toFixed(4));return e("label",{className:i("absolute inset-y-0",w?"cursor-not-allowed":"cursor-pointer"),style:{insetInlineStart:100*t/K+"%",width:100/K+"%"},onPointerEnter:()=>{w||G(n)},children:e("input",{type:"radio",className:u,name:z,value:n,checked:B===n,disabled:w,required:L,"aria-label":V(n,H),onChange:()=>change(n),onClick:()=>{N&&B===n&&change(0)}})},n)})]},l)}),U=i("inline-flex items-center align-middle",o[P],w?"cursor-not-allowed opacity-50 saturate-[0.35]":"",q),W={...l(k,0,"solid"),"--p-empty":"color-mix(in oklab, var(--plass-muted-fg) 40%, transparent)",...C};return e("div",M?{ref:A,role:"img","aria-label":V(Math.max(0,Math.min(H,B)),H),className:U,style:W,onPointerLeave:I,...S,children:T}:{ref:A,role:"radiogroup","aria-label":R,"aria-disabled":w||void 0,"aria-required":L||void 0,className:U,style:W,onPointerLeave:e=>{G(null),I?.(e)},...S,children:T})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlRating}from"./PlRating.js";
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassOrientation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* When the scroll buttons are drawn.
|
|
5
|
+
*
|
|
6
|
+
* - `auto` — only the one that has somewhere to go, and neither of them while
|
|
7
|
+
* everything fits. The default: a control that cannot do anything is worse
|
|
8
|
+
* than no control, and a row that does not overflow is not a scroller.
|
|
9
|
+
* - `always` — both, from the first paint, with the one that has nowhere to go
|
|
10
|
+
* `disabled` rather than gone. What a row whose content arrives later wants,
|
|
11
|
+
* since the buttons do not appear under the pointer half a second in.
|
|
12
|
+
* - `none` — none at all. Dragging, the wheel and the arrow keys are still
|
|
13
|
+
* there; this is the strip that scrolls the way a phone scrolls.
|
|
14
|
+
*/
|
|
15
|
+
export type PlScrollZoneButtons = 'auto' | 'always' | 'none';
|
|
16
|
+
/**
|
|
17
|
+
* What pressing a scroll button does.
|
|
18
|
+
*
|
|
19
|
+
* - `item` — moves to the next child along, `step` of them at a time. The
|
|
20
|
+
* default, and the only one that lands on something rather than between two
|
|
21
|
+
* things.
|
|
22
|
+
* - `page` — moves by everything currently on screen, the way Page Down does.
|
|
23
|
+
* - `hold` — scrolls for as long as the button is held, at `speed` pixels a
|
|
24
|
+
* second. A press too short to be a hold falls back to one `item`, so the
|
|
25
|
+
* button is never dead to a quick tap.
|
|
26
|
+
*/
|
|
27
|
+
export type PlScrollZoneMode = 'item' | 'page' | 'hold';
|
|
28
|
+
/**
|
|
29
|
+
* Where the scroll buttons sit, which is also where the strip ends.
|
|
30
|
+
*
|
|
31
|
+
* - `overlay` — over the ends of the strip, which keeps every pixel of the box
|
|
32
|
+
* for content and lets an item pass under a button. The default, and what a
|
|
33
|
+
* shelf of pictures wants.
|
|
34
|
+
* - `inline` — beside the strip, in the layout. The scroller stops where the
|
|
35
|
+
* button starts, so an item is *cut off* at the button's edge rather than
|
|
36
|
+
* sliding beneath it: nothing is ever half-hidden behind a control, and the
|
|
37
|
+
* button is legible over the page rather than over whatever it landed on.
|
|
38
|
+
*
|
|
39
|
+
* The lane an `inline` button sits in is kept even while that button has
|
|
40
|
+
* nowhere to go, or the strip would resize under the pointer every time it
|
|
41
|
+
* reached an end.
|
|
42
|
+
*/
|
|
43
|
+
export type PlScrollZoneButtonPlacement = 'overlay' | 'inline';
|
|
44
|
+
export interface PlScrollZoneProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
45
|
+
/**
|
|
46
|
+
* Which way the children run, and therefore which way the zone scrolls.
|
|
47
|
+
* @default 'horizontal'
|
|
48
|
+
*/
|
|
49
|
+
orientation?: PlassOrientation;
|
|
50
|
+
/**
|
|
51
|
+
* How many rows a horizontal zone lays its children out in before it starts a
|
|
52
|
+
* new column — and how many columns a vertical one uses. `2` is the shelf
|
|
53
|
+
* that holds twice as much in the same width.
|
|
54
|
+
* @default 1
|
|
55
|
+
*/
|
|
56
|
+
lines?: number;
|
|
57
|
+
/**
|
|
58
|
+
* The gap between children, on Tailwind's spacing scale: `2` is `0.5rem`, the
|
|
59
|
+
* same step `gap-2` is. The same ladder `PlGrid`'s own `spacing` is on.
|
|
60
|
+
* @default 2
|
|
61
|
+
*/
|
|
62
|
+
spacing?: number;
|
|
63
|
+
/** When the scroll buttons are drawn. @default 'auto' */
|
|
64
|
+
buttons?: PlScrollZoneButtons;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the buttons sit over the strip or beside it. `inline` is what to
|
|
67
|
+
* reach for when an item disappearing under a button reads as a bug rather
|
|
68
|
+
* than as depth.
|
|
69
|
+
* @default 'overlay'
|
|
70
|
+
*/
|
|
71
|
+
buttonPlacement?: PlScrollZoneButtonPlacement;
|
|
72
|
+
/** What pressing one does. @default 'item' */
|
|
73
|
+
mode?: PlScrollZoneMode;
|
|
74
|
+
/** How many children one press moves, in `item` mode. @default 1 */
|
|
75
|
+
step?: number;
|
|
76
|
+
/** How fast a held button scrolls, in pixels a second. @default 900 */
|
|
77
|
+
speed?: number;
|
|
78
|
+
/**
|
|
79
|
+
* Snaps the nearest child to the leading edge when the scrolling stops —
|
|
80
|
+
* dragging and the wheel included, not only the buttons.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
snap?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Lets a mouse or a pen drag the strip along, the way a finger already does.
|
|
86
|
+
* Touch is left to the browser, whose own scrolling is better than anything a
|
|
87
|
+
* handler can imitate: momentum, rubber-banding and the scrollbar all come
|
|
88
|
+
* with it.
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
drag?: boolean;
|
|
92
|
+
/** Shows the native scrollbar. @default false */
|
|
93
|
+
scrollbar?: boolean;
|
|
94
|
+
/** What the scrollable region is called — "Categories", "Recent files". */
|
|
95
|
+
label?: string;
|
|
96
|
+
/**
|
|
97
|
+
* What the buttons are called. Never drawn — a disc with a chevron in it has
|
|
98
|
+
* no accessible name of its own, which is the defect `PlIconButton`'s `label`
|
|
99
|
+
* exists to make impossible.
|
|
100
|
+
* @default 'Previous'
|
|
101
|
+
*/
|
|
102
|
+
previousLabel?: string;
|
|
103
|
+
/** @default 'Next' */
|
|
104
|
+
nextLabel?: string;
|
|
105
|
+
/** What is being laid out. Every top-level child is one item of the strip. */
|
|
106
|
+
children?: React.ReactNode;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A strip of anything, laid out in one direction and scrolled in it.
|
|
110
|
+
*
|
|
111
|
+
* The mechanism is an ordinary scroll container, and everything the component
|
|
112
|
+
* offers is a way of driving one. Swiping on a phone, two-finger dragging on a
|
|
113
|
+
* trackpad, the wheel, the arrow keys and the scrollbar are the browser's own
|
|
114
|
+
* and are never intercepted; what is added on top is a pair of buttons for the
|
|
115
|
+
* pointer that has neither a wheel nor a finger, and a mouse drag for the strip
|
|
116
|
+
* that reads as something to pull rather than something to page.
|
|
117
|
+
*
|
|
118
|
+
* Nothing is transformed. A translated track would have to argue for an
|
|
119
|
+
* exception to the house rule; a scroll offset does not, and it is also what
|
|
120
|
+
* makes the strip run the other way under RTL without being told, keeps the
|
|
121
|
+
* scrollbar honest, and lets the browser scroll a focused child into view.
|
|
122
|
+
*
|
|
123
|
+
* It draws no sheet of its own, and there is no `elevation` to give it one: a
|
|
124
|
+
* shelf is a way of laying children out, and the children arrive with their own
|
|
125
|
+
* surfaces. `variant`, `size`, `color` and `density` reach the two buttons,
|
|
126
|
+
* which are real `PlIconButton`s.
|
|
127
|
+
*
|
|
128
|
+
* `lines` is what separates this from a `PlCarousel`: a carousel is one thing at
|
|
129
|
+
* a time and knows which one, a scroll zone is a shelf that happens to be longer
|
|
130
|
+
* than the room it is in.
|
|
131
|
+
*/
|
|
132
|
+
export declare const PlScrollZone: React.ForwardRefExoticComponent<PlScrollZoneProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{PlIconButton as r}from"../icon-button/PlIconButton.js";import{spacingValue as o}from"../../internal/grid.js";import{ChevronIcon as s}from"../../internal/icons.js";import{cx as i}from"../../internal/styles.js";const l={xs:"p-1",sm:"p-1.5",md:"p-2",lg:"p-3",xl:"p-4"},a={xs:"gap-1",sm:"gap-1.5",md:"gap-2",lg:"gap-3",xl:"gap-4"};export const PlScrollZone=/* @__PURE__ */n.forwardRef(function PlScrollZone({orientation:c="horizontal",lines:u=1,spacing:d=2,buttons:p="auto",buttonPlacement:f="overlay",mode:m="item",step:v=1,speed:b=900,snap:g=!1,drag:w=!0,scrollbar:h=!1,variant:y="glass",size:x="md",color:k="primary",density:L="default",label:E,previousLabel:C="Previous",nextLabel:P="Next",className:R,style:B,children:j,...N},M){const T="horizontal"===c,A=Math.max(1,Math.round(u)),z=Math.max(1,Math.round(v)),D=n.useRef(null),S=n.useRef(null),[H,F]=n.useState({back:!1,forward:!1}),I=n.useCallback(()=>{const e=D.current;if(!e)return;const t=T?e.clientWidth:e.clientHeight,n=T?e.scrollWidth:e.scrollHeight,r=Math.abs(T?e.scrollLeft:e.scrollTop);F(e=>{const o=r>1,s=n-t-r>1;return e.back===o&&e.forward===s?e:{back:o,forward:s}})},[T]);n.useEffect(()=>{const e=D.current,t=S.current;if(!e)return;if(I(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(I);return n.observe(e),t&&n.observe(t),()=>n.disconnect()},[I]);const W=n.useCallback(()=>{const e=D.current;return e&&T&&"rtl"===getComputedStyle(e).direction?-1:1},[T]),$=n.useCallback((e,t)=>{const n=D.current;if(!n)return;const r=t?function scrollBehavior(){return"undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}():"auto";n.scrollBy(T?{left:e,behavior:r}:{top:e,behavior:r})},[T]),q=n.useCallback(()=>{const e=D.current,t=S.current;if(!e||!t)return[];const n=T&&"rtl"===getComputedStyle(e).direction,r=T?n?"right":"left":"top",o=n?-1:1,s=e.getBoundingClientRect()[r],i=[];for(const e of Array.from(t.children)){const t=Math.round((e.getBoundingClientRect()[r]-s)*o);i.includes(t)||i.push(t)}return i.sort((e,t)=>e-t)},[T]),O=n.useCallback((e,t=m)=>{const n=D.current;if(!n)return;const r=W(),o=T?n.clientWidth:n.clientHeight;if("page"===t)return void $(o*(e?1:-1)*r,!0);const s=q(),i=s.filter(e=>e>1),l=s.filter(e=>e<-1),a=e?i[z-1]:l[l.length-z];$(void 0!==a?a*r:o*(e?1:-1)*r,!0)},[W,T,q,z,m,$]),X=n.useRef(null);n.useEffect(()=>()=>X.current?.(),[]);const Y=n.useCallback((e,t)=>{if(X.current)return;const n=W(),r=performance.now();let o=r,s=0;const tick=t=>{const r=t-o;o=t,$(b*r/1e3*(e?1:-1)*n,!1),s=requestAnimationFrame(tick)};s=requestAnimationFrame(tick);const release=()=>{cancelAnimationFrame(s),X.current=null,window.removeEventListener(t,release),window.removeEventListener("pointercancel",release),window.removeEventListener("blur",release),performance.now()-r<140&&O(e,"item")};X.current=release,window.addEventListener(t,release),window.addEventListener("pointercancel",release),window.addEventListener("blur",release)},[O,W,$,b]),Z=n.useRef(null);function pressHandlers(e){return"hold"!==m?{onClick:()=>O(e)}:{onPointerDown:t=>{0===t.button&&Y(e,"pointerup")},onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y(e,"keyup"))}}}n.useEffect(()=>()=>Z.current?.(),[]);const _="none"!==p&&("always"===p||H.back||H.forward),K="inline"===f;function scrollButton(t){const n=t?H.forward:H.back;if("auto"===p&&!n&&!K)return e("span",{});const o="auto"===p&&!n,l=e(r,{variant:y,size:x,color:k,density:L,elevation:1,label:t?P:C,disabled:!n,className:"pointer-events-auto",icon:e("span",{className:i("flex items-center",T?t?"-rotate-90 rtl:rotate-90":"rotate-90 rtl:-rotate-90":t?"":"rotate-180"),children:e(s,{})}),...pressHandlers(t)});return K?e("span",{className:i("flex shrink-0 items-center justify-center",o?"invisible":""),inert:o,children:l}):l}return t("div",{ref:M,className:i("relative flex min-w-0",K&&T?"flex-row items-stretch":"flex-col",K?a[x]:"",R),style:{"--p-ring":`var(--plass-${k}-ring)`,...B},...N,children:[_&&K?scrollButton(!1):null,e("div",{ref:D,tabIndex:0,role:E?"group":void 0,"aria-label":E,className:i("min-h-0 min-w-0 grow",T?"overflow-x-auto overflow-y-hidden":"overflow-y-auto overflow-x-hidden",g?T?"snap-x snap-mandatory":"snap-y snap-mandatory":"",h?"":"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",w&&(H.back||H.forward)?"cursor-grab data-[dragging]:cursor-grabbing":"","focus-visible:[outline:2px_solid_var(--p-ring)] focus-visible:[outline-offset:-2px]"),onScroll:I,onPointerDown:function beginDrag(e){if(!w||"touch"===e.pointerType||0!==e.button)return;Z.current?.();const t=e.currentTarget,n=e.clientX,r=e.clientY,o=t.scrollLeft,s=t.scrollTop;let i=!1;const l=document.body.style.getPropertyValue("-webkit-user-select"),move=e=>{const l=e.clientX-n,a=e.clientY-r;if(!i){if(Math.abs(T?l:a)<4)return;i=!0,t.setPointerCapture(e.pointerId),t.dataset.dragging="true",document.body.style.setProperty("-webkit-user-select","none")}T?t.scrollLeft=o-l:t.scrollTop=s-a},release=()=>{Z.current=null,t.removeEventListener("pointermove",move),t.removeEventListener("pointerup",end),t.removeEventListener("pointercancel",release),delete t.dataset.dragging,l?document.body.style.setProperty("-webkit-user-select",l):document.body.style.removeProperty("-webkit-user-select")},end=()=>{const e=i;if(release(),!e)return;const swallow=e=>{e.stopPropagation(),e.preventDefault()};t.addEventListener("click",swallow,{capture:!0,once:!0}),window.setTimeout(()=>t.removeEventListener("click",swallow,!0),0)};Z.current=release,t.addEventListener("pointermove",move),t.addEventListener("pointerup",end),t.addEventListener("pointercancel",release)},children:e("div",{ref:S,className:i(g?"[&>*]:snap-start":""),style:{display:"grid",gap:o(d),gridAutoFlow:T?"column":"row",...T?{width:"max-content",gridTemplateRows:`repeat(${A}, auto)`,gridAutoColumns:"max-content"}:{gridTemplateColumns:`repeat(${A}, minmax(0, 1fr))`,gridAutoRows:"max-content"}},children:j})}),_&&K?scrollButton(!0):null,_&&!K?t("div",{className:i("pointer-events-none absolute inset-0 flex justify-between",T?"items-center":"flex-col items-center",l[x]),children:[scrollButton(!1),scrollButton(!0)]}):null]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlScrollZone}from"./PlScrollZone.js";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps, PlassVariant } from '../../types.js';
|
|
3
|
+
/** A segment's value. The same restraint `PlSelect` puts on its own. */
|
|
4
|
+
export type PlSegmentValue = string | number;
|
|
5
|
+
export interface PlSegmentedButtonProps extends Omit<PlassStyleProps, 'variant'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
6
|
+
/**
|
|
7
|
+
* What the groove and the tile riding in it are made of.
|
|
8
|
+
*
|
|
9
|
+
* - `solid` — a groove cut into the sheet with a **tinted-glass key** riding
|
|
10
|
+
* in it. The loudest, and the one for a control a screen is about to be
|
|
11
|
+
* steered by.
|
|
12
|
+
* - `glass` — the same groove with a hairline round it and a clear tile
|
|
13
|
+
* rather than a coloured one. The default.
|
|
14
|
+
* - `ghost` — no groove at all: the segments sit straight on the page and only
|
|
15
|
+
* the chosen one has a surface.
|
|
16
|
+
* @default 'glass'
|
|
17
|
+
*/
|
|
18
|
+
variant?: PlassVariant;
|
|
19
|
+
/** The chosen segment. Use with `onValueChange` for a controlled set. */
|
|
20
|
+
value?: PlSegmentValue | null;
|
|
21
|
+
/** Which starts chosen, for an uncontrolled set. */
|
|
22
|
+
defaultValue?: PlSegmentValue | null;
|
|
23
|
+
onValueChange?: (value: PlSegmentValue | null) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Drop shadow depth of the groove. `0` is the default — a groove is cut into
|
|
26
|
+
* the page, not laid on it.
|
|
27
|
+
* @default 0
|
|
28
|
+
*/
|
|
29
|
+
elevation?: PlassElevation;
|
|
30
|
+
/** Disables every segment at once. */
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
/** Shows which one is chosen but does not let it be changed. */
|
|
33
|
+
readOnly?: boolean;
|
|
34
|
+
/** Identifies the value when a form is submitted. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** The segments share the full width, each taking an equal part of it. */
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export interface PlSegmentProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'value' | 'color'> {
|
|
41
|
+
/** Identifies the segment. What `onValueChange` reports. */
|
|
42
|
+
value: PlSegmentValue;
|
|
43
|
+
/** Content before the label. Sized in `em`, so it tracks the label. */
|
|
44
|
+
startIcon?: React.ReactNode;
|
|
45
|
+
/** Content after the label — a count, a status dot. */
|
|
46
|
+
endIcon?: React.ReactNode;
|
|
47
|
+
/** Unavailable, but still part of the set. */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One choice in a segmented button.
|
|
53
|
+
*
|
|
54
|
+
* It has no `size`, no `color` and no `variant` of its own: all three belong to
|
|
55
|
+
* the set, which is the only place they can be set once and mean the same thing
|
|
56
|
+
* for every segment.
|
|
57
|
+
*/
|
|
58
|
+
export declare const PlSegment: React.ForwardRefExoticComponent<PlSegmentProps & React.RefAttributes<HTMLElement>>;
|
|
59
|
+
/**
|
|
60
|
+
* Two or more choices in one pill, exactly one of them taken.
|
|
61
|
+
*
|
|
62
|
+
* Underneath it is a radio group, and that is the whole accessibility argument:
|
|
63
|
+
* a segmented button *is* "exactly one of these", so it gets
|
|
64
|
+
* `role="radiogroup"`, one tab stop for the set, arrow keys within it, and
|
|
65
|
+
* `aria-checked` on the one that is taken. Building it out of `aria-pressed`
|
|
66
|
+
* toggles — which is what a row of buttons would give — would announce four
|
|
67
|
+
* independent switches, three of which happen to be off.
|
|
68
|
+
*
|
|
69
|
+
* The tile slides because its `left`, `top`, `width` and `height` are measured
|
|
70
|
+
* off the chosen segment and animated. Nothing is transformed: the tile is an
|
|
71
|
+
* empty box, and no label is resampled while it travels. That is what lets the
|
|
72
|
+
* house no-transform rule survive a component whose entire point is that
|
|
73
|
+
* something moves.
|
|
74
|
+
*
|
|
75
|
+
* `left`, not `inset-inline-start`: `offsetLeft` is a distance from the left
|
|
76
|
+
* edge and stays one under RTL, and pairing a physical measurement with a
|
|
77
|
+
* logical property is what would break the direction.
|
|
78
|
+
*/
|
|
79
|
+
export declare const PlSegmentedButton: React.ForwardRefExoticComponent<PlSegmentedButtonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as t from"react";import{Radio as a}from"@base-ui/react/radio";import{RadioGroup as r}from"@base-ui/react/radio-group";import{controlHeightClasses as l,controlSlots as n,controlTextClasses as o,focusRingInsetClasses as i,gapClasses as d,glassClasses as u,hasContent as c,iconClasses as p,paddingXClasses as f,transitionClasses as h}from"../../internal/styles.js";const g=/* @__PURE__ */t.createContext({variant:"glass",size:"md",density:"default",fullWidth:!1}),m={solid:`${u} bg-(--plass-glass-press) p-1 [box-shadow:var(--p-elev),var(--plass-well)]`,glass:`${u} border bg-(--plass-glass) p-1 [border-color:var(--plass-glass-line)] [box-shadow:var(--p-elev),var(--plass-well)]`,ghost:""},v={solid:"[background-image:var(--p-fill)] [box-shadow:var(--plass-shadow-1),var(--p-lift)]",glass:`${u} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`,ghost:`${u} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`},y={solid:"data-[checked]:text-(--p-on-solid)",glass:"data-[checked]:text-(--p-accent)",ghost:"data-[checked]:text-(--p-accent)"};export const PlSegment=/* @__PURE__ */t.forwardRef(function PlSegment({value:r,startIcon:n,endIcon:u,disabled:m=!1,className:v,children:b,...x},w){const{variant:k,size:P,density:j,fullWidth:R}=t.useContext(g);return s(a.Root,{ref:w,value:r,disabled:m,"data-segment":"",className:["relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none","font-semibold whitespace-nowrap","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",l[P],o[P],d[P],f[j][P],"rounded-full",h,p,"text-(--plass-muted-fg) hover:text-(--plass-fg)",y[k],i,"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50","data-[readonly]:cursor-default",R?"flex-1":"",v??""].filter(Boolean).join(" "),...x,children:[c(n)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:n}):null,b,c(u)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:u}):null]})});export const PlSegmentedButton=/* @__PURE__ */t.forwardRef(function PlSegmentedButton({variant:a="glass",size:l="md",color:o="primary",density:i="default",elevation:d=0,value:u,defaultValue:c=null,onValueChange:p,disabled:f=!1,readOnly:y=!1,name:b,fullWidth:x=!1,className:w,style:k,children:P,...j},R){const[$,N]=t.useState(c),z=void 0!==u,S=z?u:$,W=t.useRef(null),C=t.useRef(null),B=t.useCallback(e=>{const s=W.current,t=C.current;if(!s||!t)return;const a=s.querySelector("[data-segment][data-checked]");if(!a)return;const r=!e||!t.hasAttribute("data-ready");r&&t.removeAttribute("data-ready"),t.style.setProperty("--p-seg-x",`${a.offsetLeft}px`),t.style.setProperty("--p-seg-y",`${a.offsetTop}px`),t.style.setProperty("--p-seg-w",`${a.offsetWidth}px`),t.style.setProperty("--p-seg-h",`${a.offsetHeight}px`),r&&t.offsetWidth,t.setAttribute("data-ready","")},[]);t.useLayoutEffect(()=>{B(!0)},[B,S,a,l,i,x,P]),t.useEffect(()=>{const e=W.current;if(!e)return;const s=new ResizeObserver(()=>B(!1));return s.observe(e),()=>s.disconnect()},[B]);const A=t.useMemo(()=>({variant:a,size:l,density:i,fullWidth:x}),[a,l,i,x]);return e(g.Provider,{value:A,children:s(r,{ref:e=>{W.current=e,"function"==typeof R?R(e):R&&(R.current=e)},value:S,onValueChange:e=>{const s=e??null;z||N(s),p?.(s)},disabled:f,readOnly:y,name:b,className:["relative inline-flex items-center rounded-full",m[a],h,y?"saturate-[0.55]":"",f?"opacity-50 saturate-[0.35]":"",x?"flex w-full":"",w??""].filter(Boolean).join(" "),style:{...n(o,d,a),...k},...j,children:[null!=S?e("span",{ref:C,"aria-hidden":"true",className:["pointer-events-none absolute rounded-full","top-(--p-seg-y) left-(--p-seg-x) h-(--p-seg-h) w-(--p-seg-w)",v[a],"[transition-property:left,top,width,height]","[transition-timing-function:var(--plass-ease)]","[transition-duration:0ms] data-[ready]:[transition-duration:var(--plass-duration)]"].join(" ")}):null,P]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlSegment,PlSegmentedButton}from"./PlSegmentedButton.js";
|