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,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,99 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Radio as BaseUIRadio } from '@base-ui/react/radio';
|
|
4
|
+
import { RadioGroup as BaseUIRadioGroup } from '@base-ui/react/radio-group';
|
|
5
|
+
import { Field } from '@base-ui/react/field';
|
|
6
|
+
import { controlSlots, focusRingClasses, glassClasses, hasContent, metaTextClasses, tickDotClasses, tickRowTextClasses, tickSizeClasses, transitionClasses } from '../../internal/styles.js';
|
|
7
|
+
const RadioGroupContext = /* @__PURE__ */ React.createContext({
|
|
8
|
+
size: 'md',
|
|
9
|
+
color: 'primary',
|
|
10
|
+
readOnly: false
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The dot. Round, and one of the two things in the library allowed to be —
|
|
14
|
+
* roundness is exactly what tells a reader "one of these" rather than "any of
|
|
15
|
+
* these", and it is the one convention old enough that breaking it would cost
|
|
16
|
+
* more than it bought.
|
|
17
|
+
*/
|
|
18
|
+
const dotBaseClasses = /* @__PURE__ */ [
|
|
19
|
+
'relative inline-flex shrink-0 items-center justify-center rounded-full border',
|
|
20
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
21
|
+
transitionClasses,
|
|
22
|
+
focusRingClasses
|
|
23
|
+
].join(' ');
|
|
24
|
+
/**
|
|
25
|
+
* No gloss line and no tinted lift, for the reason a PlCheckbox's tick has
|
|
26
|
+
* neither: a 1px white edge is light on a cut edge at 40px and a grey smudge at
|
|
27
|
+
* 18px, and a `0 6px 16px` shadow under an 18px circle is bigger than the
|
|
28
|
+
* circle. The glass stays; only the two decorations go.
|
|
29
|
+
*
|
|
30
|
+
* The edge is `--plass-border` rather than the sheet's own `--plass-glass-line`,
|
|
31
|
+
* and that is not a slip. The glass hairline is white light on a translucent
|
|
32
|
+
* pane, which is invisible the moment the tick is set on a light card rather
|
|
33
|
+
* than on the page wash — and a tick nobody can see is a control nobody can
|
|
34
|
+
* find. A neutral hairline reads on both.
|
|
35
|
+
*/
|
|
36
|
+
const restDotClasses = /* @__PURE__ */ [
|
|
37
|
+
glassClasses,
|
|
38
|
+
'cursor-pointer bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
39
|
+
'hover:bg-(--plass-glass-hover) hover:[border-color:var(--p-line)]',
|
|
40
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
41
|
+
'data-[checked]:[border-color:transparent] data-[checked]:hover:brightness-105'
|
|
42
|
+
].join(' ');
|
|
43
|
+
const readOnlyDotClasses = /* @__PURE__ */ [
|
|
44
|
+
glassClasses,
|
|
45
|
+
'cursor-default bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
46
|
+
'saturate-[0.55]',
|
|
47
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
48
|
+
'data-[checked]:[border-color:transparent]'
|
|
49
|
+
].join(' ');
|
|
50
|
+
const disabledDotClasses = /* @__PURE__ */ [
|
|
51
|
+
glassClasses,
|
|
52
|
+
'cursor-not-allowed bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
53
|
+
'opacity-50 saturate-[0.35]',
|
|
54
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
55
|
+
'data-[checked]:[border-color:transparent]'
|
|
56
|
+
].join(' ');
|
|
57
|
+
/** The inner dot: `currentColor`, so it inherits the on-fill ink. */
|
|
58
|
+
const indicatorClasses = 'rounded-full bg-current';
|
|
59
|
+
/**
|
|
60
|
+
* One option in a `PlRadioGroup`.
|
|
61
|
+
*
|
|
62
|
+
* It has no `size` and no `color` of its own — both come from the group, which
|
|
63
|
+
* is the only place they can be set once and mean the same thing for every
|
|
64
|
+
* option in the set.
|
|
65
|
+
*/
|
|
66
|
+
export const PlRadio = /* @__PURE__ */ React.forwardRef(function PlRadio({ label, description, disabled = false, className, style, ...props }, ref) {
|
|
67
|
+
const group = React.useContext(RadioGroupContext);
|
|
68
|
+
const readOnly = props.readOnly ?? group.readOnly;
|
|
69
|
+
return (_jsx(Field.Root, { disabled: disabled, className: ['flex flex-col', className ?? ''].filter(Boolean).join(' '), style: style, children: _jsxs("div", { className: `flex items-start gap-2 ${tickRowTextClasses[group.size]}`, children: [_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: _jsx(BaseUIRadio.Root, { ref: ref, className: [
|
|
70
|
+
dotBaseClasses,
|
|
71
|
+
tickSizeClasses[group.size],
|
|
72
|
+
disabled ? disabledDotClasses : readOnly ? readOnlyDotClasses : restDotClasses
|
|
73
|
+
].join(' '), disabled: disabled, ...props, children: _jsx(BaseUIRadio.Indicator, { className: `${indicatorClasses} ${tickDotClasses[group.size]}` }) }) }), label || description ? (_jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", 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[group.size]} text-(--plass-muted-fg)`, children: description })) : null] })) : null] }) }));
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* A set of options where exactly one is chosen.
|
|
77
|
+
*
|
|
78
|
+
* Base UI owns the roving tab index and the arrow-key navigation, which is the
|
|
79
|
+
* whole reason a radio group is a component at all rather than a `<div>` full of
|
|
80
|
+
* inputs: the set takes one tab stop, and the arrows move within it.
|
|
81
|
+
*/
|
|
82
|
+
export const PlRadioGroup = /* @__PURE__ */ React.forwardRef(function PlRadioGroup({ size = 'md', color = 'primary', orientation = 'vertical', label, description, error, invalid, disabled = false, readOnly = false, className, style, children, ...props }, ref) {
|
|
83
|
+
const hasError = hasContent(error);
|
|
84
|
+
const isInvalid = invalid ?? hasError;
|
|
85
|
+
// Invalid re-points the whole slot family at `danger`, so every dot, the
|
|
86
|
+
// ring and the message all turn over together.
|
|
87
|
+
const family = isInvalid ? 'danger' : color;
|
|
88
|
+
const context = React.useMemo(() => ({ size, color: family, readOnly }), [size, family, readOnly]);
|
|
89
|
+
return (_jsx(RadioGroupContext.Provider, { value: context, children: _jsxs(Field.Root, { disabled: disabled, invalid: isInvalid, className: ['flex flex-col gap-1.5', className ?? ''].filter(Boolean).join(' '),
|
|
90
|
+
// `solid`, because a checked dot *is* the coloured thing.
|
|
91
|
+
style: { ...controlSlots(family, 0, 'solid'), ...style }, children: [label ? (_jsx(Field.Label, { className: [
|
|
92
|
+
metaTextClasses[size],
|
|
93
|
+
'font-semibold',
|
|
94
|
+
disabled ? 'text-(--plass-muted-fg)' : 'text-(--plass-fg)'
|
|
95
|
+
].join(' '), children: label })) : null, description ? (_jsx(Field.Description, { className: `${metaTextClasses[size]} text-(--plass-muted-fg)`, children: description })) : null, _jsx(BaseUIRadioGroup, { ref: ref, disabled: disabled, readOnly: readOnly, className: [
|
|
96
|
+
'flex',
|
|
97
|
+
orientation === 'horizontal' ? 'flex-row flex-wrap gap-x-5 gap-y-2' : 'flex-col gap-2'
|
|
98
|
+
].join(' '), ...props, children: children }), hasError ? (_jsx(Field.Error, { match: true, className: `${metaTextClasses[size]} text-(--p-accent)`, children: error })) : null] }) }));
|
|
99
|
+
});
|
|
@@ -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,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { StarIcon, StarOutlineIcon } from '../../internal/icons.js';
|
|
4
|
+
import { controlSlots, cx, focusWithinRingClasses, gapClasses, iconSizeClasses, radiusClasses, srOnlyClasses, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* The box one copy of the glyph is drawn in. Both copies get exactly this, or
|
|
7
|
+
* the clipped one would not line up with the outline underneath it.
|
|
8
|
+
*/
|
|
9
|
+
const starClasses = 'flex items-center justify-center';
|
|
10
|
+
/** The default accessible name of a score. */
|
|
11
|
+
function defaultValueLabel(value, count) {
|
|
12
|
+
return value <= 0 ? 'No rating' : `${value} out of ${count}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A score out of five, as a row of stars.
|
|
16
|
+
*
|
|
17
|
+
* Underneath an interactive rating is a radio group of real `<input>`s, one per
|
|
18
|
+
* choosable score, each visually hidden under the fraction of a star it stands
|
|
19
|
+
* for. That is the whole accessibility argument: a rating *is* "exactly one of
|
|
20
|
+
* these", so it gets one tab stop for the row, arrow keys within it,
|
|
21
|
+
* `aria-checked` on the one that is taken, and a value in a form submission —
|
|
22
|
+
* none of which a row of `<button>`s or a `<div>` with a click handler would
|
|
23
|
+
* have.
|
|
24
|
+
*
|
|
25
|
+
* The fraction is drawn by laying the filled star over the empty one and
|
|
26
|
+
* clipping it to a percentage of the width. Nothing is transformed and no glyph
|
|
27
|
+
* is scaled, so a half star is the left half of exactly the star beside it —
|
|
28
|
+
* which is also the no-transform rule holding on a component whose whole job is
|
|
29
|
+
* a partial shape. The clip runs from the inline start, so it fills from the
|
|
30
|
+
* right under RTL without anything being told to.
|
|
31
|
+
*
|
|
32
|
+
* `readOnly` is a different component in the same clothes: no inputs, no radio
|
|
33
|
+
* group, and one `role="img"` carrying the score as a sentence. A star display
|
|
34
|
+
* that kept twenty focusable radios would be twenty tab stops on a page that
|
|
35
|
+
* was only reporting a number.
|
|
36
|
+
*/
|
|
37
|
+
export const PlRating = /* @__PURE__ */ React.forwardRef(function PlRating({ value: valueProp, defaultValue = 0, onValueChange, count = 5, precision = 1, icon, emptyIcon, clearable = true, readOnly = false, disabled = false, name: nameProp, required = false, size = 'md', color = 'warning', label = 'Rating', valueLabel = defaultValueLabel, className, style, onPointerLeave, ...props }, ref) {
|
|
38
|
+
const generatedName = React.useId();
|
|
39
|
+
const name = nameProp ?? generatedName;
|
|
40
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
41
|
+
const controlled = valueProp !== undefined;
|
|
42
|
+
const value = controlled ? valueProp : uncontrolled;
|
|
43
|
+
// What the pointer is currently promising, which is not the value until it is
|
|
44
|
+
// clicked. `null` is "the pointer is not on the row", not "zero stars".
|
|
45
|
+
const [hovered, setHovered] = React.useState(null);
|
|
46
|
+
const stars = Math.max(1, Math.floor(count));
|
|
47
|
+
const step = precision > 0 && precision <= 1 ? precision : 1;
|
|
48
|
+
const stepsPerStar = Math.round(1 / step);
|
|
49
|
+
const shown = Math.max(0, Math.min(stars, hovered ?? value));
|
|
50
|
+
const change = (next) => {
|
|
51
|
+
if (!controlled) {
|
|
52
|
+
setUncontrolled(next);
|
|
53
|
+
}
|
|
54
|
+
onValueChange?.(next);
|
|
55
|
+
};
|
|
56
|
+
const marks = Array.from({ length: stars }, (_, index) => {
|
|
57
|
+
// How much of *this* star is filled, from 0 to 1.
|
|
58
|
+
const fill = Math.max(0, Math.min(1, shown - index));
|
|
59
|
+
return (_jsxs("span", { className: cx('relative inline-flex shrink-0', iconSizeClasses[size], radiusClasses.xs, readOnly || disabled ? '' : focusWithinRingClasses), children: [_jsx("span", { className: cx(starClasses, iconSizeClasses[size], 'text-(--p-empty)'), children: emptyIcon ?? _jsx(StarOutlineIcon, {}) }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-y-0 start-0 overflow-hidden", style: { width: `${fill * 100}%` }, children: _jsx("span", { className: cx(starClasses, iconSizeClasses[size], 'text-(--p-accent)', transitionClasses), children: icon ?? _jsx(StarIcon, {}) }) }), readOnly
|
|
60
|
+
? null
|
|
61
|
+
: Array.from({ length: stepsPerStar }, (_, part) => {
|
|
62
|
+
const score = Number((index + (part + 1) * step).toFixed(4));
|
|
63
|
+
return (_jsx("label", { className: cx('absolute inset-y-0', disabled ? 'cursor-not-allowed' : 'cursor-pointer'), style: {
|
|
64
|
+
insetInlineStart: `${(part * 100) / stepsPerStar}%`,
|
|
65
|
+
width: `${100 / stepsPerStar}%`
|
|
66
|
+
}, onPointerEnter: () => {
|
|
67
|
+
if (!disabled) {
|
|
68
|
+
setHovered(score);
|
|
69
|
+
}
|
|
70
|
+
}, children: _jsx("input", { type: "radio", className: srOnlyClasses, name: name, value: score, checked: value === score, disabled: disabled, required: required, "aria-label": valueLabel(score, stars), onChange: () => change(score),
|
|
71
|
+
// Clearing cannot ride on `change`: clicking a radio that is
|
|
72
|
+
// already checked fires a click and no change at all, and
|
|
73
|
+
// that click is exactly the gesture being listened for.
|
|
74
|
+
onClick: () => {
|
|
75
|
+
if (clearable && value === score) {
|
|
76
|
+
change(0);
|
|
77
|
+
}
|
|
78
|
+
} }) }, score));
|
|
79
|
+
})] }, index));
|
|
80
|
+
});
|
|
81
|
+
const classNames = cx('inline-flex items-center align-middle', gapClasses[size],
|
|
82
|
+
// The house treatment, not a grey token: the light goes out of the row and
|
|
83
|
+
// the page shows through it, which is what unavailable looks like
|
|
84
|
+
// everywhere else in the library.
|
|
85
|
+
disabled ? 'cursor-not-allowed opacity-50 saturate-[0.35]' : '', className);
|
|
86
|
+
const styles = {
|
|
87
|
+
...controlSlots(color, 0, 'solid'),
|
|
88
|
+
// An empty star is not a disabled one and not a hairline: it is the ghost of
|
|
89
|
+
// the star beside it, so it takes the muted ink at enough strength to read
|
|
90
|
+
// as a shape and not enough to compete with the ones that are filled.
|
|
91
|
+
'--p-empty': 'color-mix(in oklab, var(--plass-muted-fg) 40%, transparent)',
|
|
92
|
+
...style
|
|
93
|
+
};
|
|
94
|
+
if (readOnly) {
|
|
95
|
+
return (_jsx("div", { ref: ref, role: "img", "aria-label": valueLabel(Math.max(0, Math.min(stars, value)), stars), className: classNames, style: styles, onPointerLeave: onPointerLeave, ...props, children: marks }));
|
|
96
|
+
}
|
|
97
|
+
return (_jsx("div", { ref: ref, role: "radiogroup", "aria-label": label, "aria-disabled": disabled || undefined, "aria-required": required || undefined, className: classNames, style: styles, onPointerLeave: (event) => {
|
|
98
|
+
setHovered(null);
|
|
99
|
+
onPointerLeave?.(event);
|
|
100
|
+
}, ...props, children: marks }));
|
|
101
|
+
});
|
|
@@ -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>>;
|