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,210 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { controlTextLeadingClasses, focusRingInsetClasses, metaTextClasses, paddingXValues, radiusClasses, sheetRestClasses, surfaceSlots } from '../../internal/styles.js';
|
|
4
|
+
/**
|
|
5
|
+
* Row height, as vertical padding — and, like the horizontal track, a raw
|
|
6
|
+
* length rather than a class. See the note on `paddingXValues`.
|
|
7
|
+
*/
|
|
8
|
+
const cellPaddingYValues = {
|
|
9
|
+
default: { xs: '0.375rem', sm: '0.5rem', md: '0.75rem', lg: '0.875rem', xl: '1rem' },
|
|
10
|
+
compact: { xs: '0.125rem', sm: '0.25rem', md: '0.4375rem', lg: '0.5625rem', xl: '0.6875rem' }
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Everything a table is painted with is written inline, `<table>` included.
|
|
14
|
+
*
|
|
15
|
+
* This is the one component in the library that has to do that, and the reason
|
|
16
|
+
* is the elements it renders. A PlButton owns its `<button>`; nobody else
|
|
17
|
+
* styles it. `<table>`, `<th>` and `<td>` are different — VitePress's
|
|
18
|
+
* `.vp-doc table`, Tailwind Typography's `.prose td` and every CSS framework in
|
|
19
|
+
* existence style them by tag name, at two-class specificity that a one-class
|
|
20
|
+
* Tailwind utility cannot outrank.
|
|
21
|
+
*
|
|
22
|
+
* Padding and alignment were already written inline for that reason. **The
|
|
23
|
+
* borders, the display mode and the margins were not**, and that omission was
|
|
24
|
+
* most of what a Plass table looked like on a documentation page: the host's
|
|
25
|
+
* `td { border: 1px solid }` drew a full grid of cell rules the design never
|
|
26
|
+
* asked for, its `table { display: block }` stopped `width: 100%` filling the
|
|
27
|
+
* sheet, and its `table { margin: 20px 0 }` pushed the whole thing off the
|
|
28
|
+
* top-left corner of the pane it is supposed to be flush inside. A grid of
|
|
29
|
+
* boxed cells floating inside a rounded sheet is not a restrained table with a
|
|
30
|
+
* problem — it is somebody else's table wearing this one's frame.
|
|
31
|
+
*
|
|
32
|
+
* So every cell states `border: 0` and then draws the one rule it actually
|
|
33
|
+
* wants, and the `<table>` states the four properties a prose stylesheet is
|
|
34
|
+
* known to take off it. It is verbose, and it is the only way the component
|
|
35
|
+
* looks the same in a bare app and inside `.prose`.
|
|
36
|
+
*
|
|
37
|
+
* What is *not* inline is the row's own background, because it has a hover
|
|
38
|
+
* state and inline styles have no `:hover`. It reads a `--p-row` slot instead,
|
|
39
|
+
* which classes then set — a custom property is invisible to a host stylesheet,
|
|
40
|
+
* so a one-class variant wins there without a fight.
|
|
41
|
+
*/
|
|
42
|
+
const tableStyle = {
|
|
43
|
+
display: 'table',
|
|
44
|
+
width: '100%',
|
|
45
|
+
margin: 0,
|
|
46
|
+
borderCollapse: 'collapse',
|
|
47
|
+
borderSpacing: 0
|
|
48
|
+
};
|
|
49
|
+
const rowClasses = /* @__PURE__ */ [
|
|
50
|
+
'[--p-row:transparent]',
|
|
51
|
+
'[transition:background-color_var(--plass-duration)_var(--plass-ease)]'
|
|
52
|
+
].join(' ');
|
|
53
|
+
/**
|
|
54
|
+
* What a row that answers a press needs beyond the pointer treatment.
|
|
55
|
+
*
|
|
56
|
+
* `tabIndex` is the whole point: a row whose only way in is `onClick` is a
|
|
57
|
+
* control a keyboard cannot reach at all, and `cursor-pointer` advertises it as
|
|
58
|
+
* one anyway. The ring is inset rather than offset, because the sheet clips at
|
|
59
|
+
* its own rounded edge and an outline drawn outside the first or last row is an
|
|
60
|
+
* outline with its top or bottom sliced off.
|
|
61
|
+
*
|
|
62
|
+
* The `role` is deliberately left alone. `role="button"` on a `<tr>` reads well
|
|
63
|
+
* in isolation and takes the row semantics off it — which orphans every `<td>`
|
|
64
|
+
* inside from the table they belong to, and costs a screen reader the column
|
|
65
|
+
* headers, the row position and the count.
|
|
66
|
+
*/
|
|
67
|
+
const clickableRowClasses = /* @__PURE__ */ [
|
|
68
|
+
'cursor-pointer [outline:none]',
|
|
69
|
+
focusRingInsetClasses
|
|
70
|
+
].join(' ');
|
|
71
|
+
/**
|
|
72
|
+
* Two weights of rule, and the whole of the table's structure.
|
|
73
|
+
*
|
|
74
|
+
* `--plass-divider` scores one row off the next, the same ink a PlCard and a
|
|
75
|
+
* PlList are scored with, so a table on a card and the card's own dividers are
|
|
76
|
+
* one family of lines. The header sits on `--plass-border`, one step firmer,
|
|
77
|
+
* because the break between the names of the columns and the data in them is
|
|
78
|
+
* the one division a reader has to find without looking for it.
|
|
79
|
+
*
|
|
80
|
+
* Both are neutral inks rather than the `--plass-glass-line` this used to use.
|
|
81
|
+
* That line is white, and a white rule between two rows of a white sheet is
|
|
82
|
+
* not a rule — which is why the table had no visible structure of its own in
|
|
83
|
+
* light mode, and why it looked like whatever grid the host page happened to
|
|
84
|
+
* be drawing over it.
|
|
85
|
+
*
|
|
86
|
+
* They are on the *cells* rather than on the `<tr>`, which is where a rule can
|
|
87
|
+
* be written inline and therefore where a host stylesheet cannot reach it.
|
|
88
|
+
*/
|
|
89
|
+
const rowRule = '1px solid var(--plass-divider)';
|
|
90
|
+
const headRule = '1px solid var(--plass-border)';
|
|
91
|
+
/**
|
|
92
|
+
* A grid of data on a sheet of glass.
|
|
93
|
+
*
|
|
94
|
+
* The sheet is the ordinary Plass container — `variant`, `size`, `color`,
|
|
95
|
+
* `density` and `elevation` all mean what they mean everywhere else, and it is
|
|
96
|
+
* never dyed. What the table adds is the part that is genuinely tabular: the
|
|
97
|
+
* columns, the rows, and the fact that the two cannot drift apart.
|
|
98
|
+
*
|
|
99
|
+
* Not a `forwardRef`, because it is generic: a component wrapped in
|
|
100
|
+
* `React.forwardRef` loses its type parameter, and `Row` is the whole point of
|
|
101
|
+
* the API. `ref` is not offered rather than being offered with `Row` widened to
|
|
102
|
+
* `any`.
|
|
103
|
+
*/
|
|
104
|
+
export function PlTable({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, columns, rows, getRowKey, caption, empty = 'No data', striped = false, hoverable = false, stickyHeader = false, maxHeight, onRowClick, className, style, ...props }) {
|
|
105
|
+
const padX = paddingXValues[density][size];
|
|
106
|
+
const padY = cellPaddingYValues[density][size];
|
|
107
|
+
const clickable = Boolean(onRowClick);
|
|
108
|
+
const lit = hoverable || clickable;
|
|
109
|
+
const capped = maxHeight !== undefined;
|
|
110
|
+
const captionId = React.useId();
|
|
111
|
+
// `border: 0` first, then the one edge this cell actually draws. Written as
|
|
112
|
+
// the longhand rather than a `border` shorthand carrying `0` so the rule and
|
|
113
|
+
// the reset cannot be reordered into each other.
|
|
114
|
+
const cellStyle = {
|
|
115
|
+
padding: `${padY} ${padX}`,
|
|
116
|
+
border: 0,
|
|
117
|
+
background: 'none'
|
|
118
|
+
};
|
|
119
|
+
const headCellStyle = {
|
|
120
|
+
...cellStyle,
|
|
121
|
+
// The rule under the column names, and the one place the table draws an
|
|
122
|
+
// edge as a shadow rather than as a border. `border-collapse: collapse`
|
|
123
|
+
// hands a cell's borders to the *table's* border grid, and that grid does
|
|
124
|
+
// not travel with a `position: sticky` cell — so a pinned header keeps its
|
|
125
|
+
// fill and leaves its underline behind at the top of the scroll. An inset
|
|
126
|
+
// shadow belongs to the cell's own box and goes where the cell goes.
|
|
127
|
+
...(stickyHeader
|
|
128
|
+
? { boxShadow: `inset 0 -1px 0 var(--plass-border)` }
|
|
129
|
+
: { borderBottom: headRule }),
|
|
130
|
+
// No band behind the column names.
|
|
131
|
+
//
|
|
132
|
+
// The header used to be `--plass-glass-press`, one step up the glass ladder
|
|
133
|
+
// — and one step up a ladder whose rungs are 62%, 76% and 88% white is, on
|
|
134
|
+
// a light page, a white bar. A filled strip across the top of a grid is the
|
|
135
|
+
// single fastest way to make data look like chrome, and it was doing that
|
|
136
|
+
// while the rules between the rows underneath were invisible: all of the
|
|
137
|
+
// table's weight in the one place that needed none of it. Muted, semibold
|
|
138
|
+
// names over a firmer rule say "these are the columns" with nothing filled
|
|
139
|
+
// in at all.
|
|
140
|
+
//
|
|
141
|
+
// A *pinned* header is the exception, and it is not decoration: rows pass
|
|
142
|
+
// directly underneath it, and a translucent fill lets them through. Two
|
|
143
|
+
// stacked opaque layers stop the light — the sheet's own densest glass over
|
|
144
|
+
// the page's surface colour — which is the same trick a pinned first
|
|
145
|
+
// column needs for the same reason.
|
|
146
|
+
...(stickyHeader
|
|
147
|
+
? {
|
|
148
|
+
background: 'linear-gradient(var(--plass-glass-press), var(--plass-glass-press)),' +
|
|
149
|
+
' linear-gradient(var(--plass-surface), var(--plass-surface))'
|
|
150
|
+
}
|
|
151
|
+
: null)
|
|
152
|
+
};
|
|
153
|
+
/** The rule above a row — every row but the first, which has the header's. */
|
|
154
|
+
const bodyCellStyle = (index) => index === 0 ? cellStyle : { ...cellStyle, borderTop: rowRule };
|
|
155
|
+
return (_jsxs("div", { className: [
|
|
156
|
+
// The sheet clips, and the box inside it scrolls. Two elements rather
|
|
157
|
+
// than one because a `caption` has to stay out of what scrolls: a
|
|
158
|
+
// pinned header over rows that pass under it is the point of
|
|
159
|
+
// `stickyHeader`, and a title that slid away above it would take the
|
|
160
|
+
// table's name off the screen with it.
|
|
161
|
+
'overflow-hidden',
|
|
162
|
+
radiusClasses[size],
|
|
163
|
+
sheetRestClasses[variant],
|
|
164
|
+
className ?? ''
|
|
165
|
+
]
|
|
166
|
+
.filter(Boolean)
|
|
167
|
+
.join(' '), style: { ...surfaceSlots(color, elevation), ...style }, ...props, children: [caption ? (_jsx("div", { id: captionId, className: `${metaTextClasses[size]} font-semibold text-(--plass-muted-fg)`, style: { ...cellStyle, borderBottom: rowRule, textAlign: 'start' }, children: caption })) : null, _jsx("div", { className: [
|
|
168
|
+
'overflow-x-auto',
|
|
169
|
+
// Only when there is a cap to scroll against. A box that is as tall
|
|
170
|
+
// as its content has nothing to scroll, and `overscroll-contain` on
|
|
171
|
+
// one of those would swallow the page's own scroll at its edges.
|
|
172
|
+
capped ? 'overflow-y-auto overscroll-contain' : ''
|
|
173
|
+
]
|
|
174
|
+
.filter(Boolean)
|
|
175
|
+
.join(' '), style: capped ? { maxHeight } : undefined, children: _jsxs("table", { "aria-labelledby": caption ? captionId : undefined, className: `text-start ${controlTextLeadingClasses[size]} text-(--plass-fg)`, style: tableStyle, children: [_jsx("colgroup", { children: columns.map((column) => (_jsx("col", { style: column.width === undefined
|
|
176
|
+
? undefined
|
|
177
|
+
: {
|
|
178
|
+
width: typeof column.width === 'number' ? `${column.width}px` : column.width
|
|
179
|
+
} }, column.key))) }), _jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", className: [
|
|
180
|
+
'font-semibold whitespace-nowrap text-(--plass-muted-fg)',
|
|
181
|
+
stickyHeader ? 'sticky top-0 z-10' : ''
|
|
182
|
+
]
|
|
183
|
+
.filter(Boolean)
|
|
184
|
+
.join(' '), style: { ...headCellStyle, textAlign: column.align ?? 'start' }, children: column.header ?? column.key }, column.key))) }) }), _jsx("tbody", { children: rows.length === 0 ? (_jsx("tr", { className: rowClasses, children: _jsx("td", { colSpan: columns.length, className: "text-(--plass-muted-fg)", style: { ...cellStyle, padding: `2rem ${padX}`, textAlign: 'center' }, children: empty }) })) : (rows.map((row, index) => (_jsx("tr", { className: [
|
|
185
|
+
rowClasses,
|
|
186
|
+
striped && index % 2 === 1 ? '[--p-row:var(--plass-stripe)]' : '',
|
|
187
|
+
lit ? 'hover:[--p-row:var(--p-soft)]' : '',
|
|
188
|
+
clickable ? clickableRowClasses : ''
|
|
189
|
+
]
|
|
190
|
+
.filter(Boolean)
|
|
191
|
+
.join(' '), style: { backgroundColor: 'var(--p-row)' }, tabIndex: clickable ? 0 : undefined, onClick: onRowClick ? () => onRowClick(row, index) : undefined, onKeyDown: onRowClick
|
|
192
|
+
? (event) => {
|
|
193
|
+
// Only the row's own keys. A cell can hold a link or a
|
|
194
|
+
// button, and those have an Enter of their own — running
|
|
195
|
+
// both would open the row and follow the link at once.
|
|
196
|
+
if (event.target !== event.currentTarget) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (event.key !== 'Enter' && event.key !== ' ') {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
// Space scrolls the page otherwise, which is the one
|
|
203
|
+
// thing a reader pressing it on a row did not ask for.
|
|
204
|
+
event.preventDefault();
|
|
205
|
+
onRowClick(row, index);
|
|
206
|
+
}
|
|
207
|
+
: undefined, children: columns.map((column) => (_jsx("td", { style: { ...bodyCellStyle(index), textAlign: column.align ?? 'start' }, children: column.render
|
|
208
|
+
? column.render(row, index)
|
|
209
|
+
: row[column.key] }, column.key))) }, getRowKey ? getRowKey(row, index) : index)))) })] }) })] }));
|
|
210
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlTable } from './PlTable.js';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassOrientation, PlassStyleProps, PlassVariant } from '../../types.js';
|
|
3
|
+
/** A tab's value. The same restraint `PlSelect` puts on its own — an identifier. */
|
|
4
|
+
export type PlTabValue = string | number;
|
|
5
|
+
export interface PlTabsProps extends Omit<PlassStyleProps, 'variant'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
6
|
+
/**
|
|
7
|
+
* What the tab *bar* is made of, not the panels under it.
|
|
8
|
+
*
|
|
9
|
+
* - `solid` — a groove cut into the sheet with a clear pane riding in it, the
|
|
10
|
+
* way a segmented control works. (The tile is deliberately *not* the
|
|
11
|
+
* gradient: that is what a `PlSegmentedButton` is, and a screen with both
|
|
12
|
+
* should be able to tell them apart.)
|
|
13
|
+
* - `glass` — the classic: a rule along the edge of the bar with the indicator
|
|
14
|
+
* riding on it. The default.
|
|
15
|
+
* - `ghost` — the same bar with the rule taken away, for tabs inside a PlCard
|
|
16
|
+
* that already has an edge of its own.
|
|
17
|
+
* @default 'glass'
|
|
18
|
+
*/
|
|
19
|
+
variant?: PlassVariant;
|
|
20
|
+
/** The chosen tab. Use with `onValueChange` for a controlled set. */
|
|
21
|
+
value?: PlTabValue | null;
|
|
22
|
+
/** Which starts chosen, for an uncontrolled set. */
|
|
23
|
+
defaultValue?: PlTabValue | null;
|
|
24
|
+
onValueChange?: (value: PlTabValue | null) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Which way the bar runs. `vertical` puts the tabs down the side and the panel
|
|
27
|
+
* beside them, and moves the arrow keys onto the other axis — which is Base
|
|
28
|
+
* UI's doing, and is what makes a vertical tab bar reachable.
|
|
29
|
+
* @default 'horizontal'
|
|
30
|
+
*/
|
|
31
|
+
orientation?: PlassOrientation;
|
|
32
|
+
/**
|
|
33
|
+
* Whether moving the arrow keys also chooses the tab it lands on.
|
|
34
|
+
*
|
|
35
|
+
* `false` by default. Automatic activation is only kind when every panel is
|
|
36
|
+
* already on the page; the moment one of them fetches, walking past four tabs
|
|
37
|
+
* fires four requests.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
activateOnFocus?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the arrow keys wrap from the last tab back to the first.
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
loopFocus?: boolean;
|
|
46
|
+
/** The tabs share the bar's full width, each taking an equal part of it. */
|
|
47
|
+
fullWidth?: boolean;
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
export interface PlTabProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'color'> {
|
|
51
|
+
/** Identifies the tab, and picks out the panel with the same value. */
|
|
52
|
+
value: PlTabValue;
|
|
53
|
+
/** Content before the label. Sized in `em`, so it tracks the label. */
|
|
54
|
+
startIcon?: React.ReactNode;
|
|
55
|
+
/** Content after the label — a count, a status dot. */
|
|
56
|
+
endIcon?: React.ReactNode;
|
|
57
|
+
/** Unavailable, but still listed. */
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
children?: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
export interface PlTabPanelProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
62
|
+
/** Which tab shows this panel. */
|
|
63
|
+
value: PlTabValue;
|
|
64
|
+
/**
|
|
65
|
+
* Keeps the panel in the DOM while it is hidden. For a panel that is expensive
|
|
66
|
+
* to build, or that holds form state which should survive being switched away
|
|
67
|
+
* from.
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
keepMounted?: boolean;
|
|
71
|
+
children?: React.ReactNode;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One tab, and one place a tab differs from a PlButton: `solid` puts the tile
|
|
75
|
+
* *behind* the tab rather than on it, so the tab needs a stacking context of its
|
|
76
|
+
* own or the indicator would cover the label it is meant to be under.
|
|
77
|
+
*/
|
|
78
|
+
export declare const PlTab: React.ForwardRefExoticComponent<PlTabProps & React.RefAttributes<HTMLButtonElement>>;
|
|
79
|
+
/** The content behind one tab. */
|
|
80
|
+
export declare const PlTabPanel: React.ForwardRefExoticComponent<PlTabPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
/**
|
|
82
|
+
* One set of panels, one of which is shown.
|
|
83
|
+
*
|
|
84
|
+
* Base UI owns everything that makes a tab bar a tab bar rather than a row of
|
|
85
|
+
* buttons: roving focus so the whole bar is one tab stop, the arrow keys on
|
|
86
|
+
* whichever axis the bar runs, Home and End, the `tab` / `tabpanel` roles and
|
|
87
|
+
* the `aria-controls` wiring between them, and the measurement that puts the
|
|
88
|
+
* indicator under the chosen tab. What is here is the surface and the ladders.
|
|
89
|
+
*
|
|
90
|
+
* The tabs and the panels are composed rather than passed as data, unlike
|
|
91
|
+
* `PlSelect` — because a panel is a subtree, and there is no useful shape for
|
|
92
|
+
* "an array of arbitrary React trees" that is not just children.
|
|
93
|
+
*/
|
|
94
|
+
export declare const PlTabs: React.ForwardRefExoticComponent<PlTabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tabs as BaseUITabs } from '@base-ui/react/tabs';
|
|
4
|
+
import { controlHeightClasses, controlTextClasses, focusRingClasses, focusRingInsetClasses, gapClasses, glassClasses, hasContent, iconClasses, paddingXClasses, radiusClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
const TabsContext = /* @__PURE__ */ React.createContext({
|
|
6
|
+
variant: 'glass',
|
|
7
|
+
size: 'md',
|
|
8
|
+
density: 'default',
|
|
9
|
+
orientation: 'horizontal',
|
|
10
|
+
fullWidth: false
|
|
11
|
+
});
|
|
12
|
+
/* ---------------------------------------------------------------------------
|
|
13
|
+
* The bar
|
|
14
|
+
* ------------------------------------------------------------------------- */
|
|
15
|
+
/**
|
|
16
|
+
* What the bar itself looks like, per material and per axis.
|
|
17
|
+
*
|
|
18
|
+
* `glass` is one border on one edge rather than a box, which is why it needs the
|
|
19
|
+
* axis: the rule belongs under a horizontal bar and beside a vertical one. It is
|
|
20
|
+
* `--plass-border` rather than the sheet's own white hairline, because a bar
|
|
21
|
+
* drawn on a light card would otherwise have no rule at all.
|
|
22
|
+
*/
|
|
23
|
+
const listClasses = {
|
|
24
|
+
solid: {
|
|
25
|
+
horizontal: `${glassClasses} inline-flex bg-(--plass-glass) p-1 [box-shadow:var(--plass-well)]`,
|
|
26
|
+
vertical: `${glassClasses} inline-flex flex-col bg-(--plass-glass) p-1 [box-shadow:var(--plass-well)]`
|
|
27
|
+
},
|
|
28
|
+
glass: {
|
|
29
|
+
horizontal: 'flex border-b [border-color:var(--plass-border)]',
|
|
30
|
+
vertical: 'flex flex-col border-e [border-color:var(--plass-border)]'
|
|
31
|
+
},
|
|
32
|
+
ghost: {
|
|
33
|
+
horizontal: 'flex',
|
|
34
|
+
vertical: 'flex flex-col'
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The indicator.
|
|
39
|
+
*
|
|
40
|
+
* `solid` fills the tab — a tile that slides between them. The other two draw a
|
|
41
|
+
* 2px bar along the bar's own edge. All three move by animating `left`/`top` and
|
|
42
|
+
* `width`/`height`, which Base UI measures onto `--active-tab-*`. That is a
|
|
43
|
+
* layout animation on an empty box, not a transform on a label: nothing with
|
|
44
|
+
* text in it moves, which is the distinction the house rule actually draws.
|
|
45
|
+
*
|
|
46
|
+
* `left`, not `inset-inline-start`, and this is one of the two places in the
|
|
47
|
+
* library that reaches for a physical property on purpose. `--active-tab-left`
|
|
48
|
+
* is a measurement — the distance from the list's left edge to the active tab's,
|
|
49
|
+
* in pixels — and it stays a distance from the *left* under RTL. Pairing a
|
|
50
|
+
* physical measurement with a logical property is what would break the
|
|
51
|
+
* direction, not what would fix it. The edge the bar sits on is logical, because
|
|
52
|
+
* that one genuinely flips.
|
|
53
|
+
*/
|
|
54
|
+
const indicatorClasses = {
|
|
55
|
+
solid: {
|
|
56
|
+
horizontal: 'absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height) w-(--active-tab-width)',
|
|
57
|
+
vertical: 'absolute top-(--active-tab-top) left-(--active-tab-left) h-(--active-tab-height) w-(--active-tab-width)'
|
|
58
|
+
},
|
|
59
|
+
glass: {
|
|
60
|
+
horizontal: 'absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)',
|
|
61
|
+
vertical: 'absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5'
|
|
62
|
+
},
|
|
63
|
+
ghost: {
|
|
64
|
+
horizontal: 'absolute bottom-0 left-(--active-tab-left) h-0.5 w-(--active-tab-width)',
|
|
65
|
+
vertical: 'absolute end-0 top-(--active-tab-top) h-(--active-tab-height) w-0.5'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const indicatorSurfaceClasses = {
|
|
69
|
+
solid: `${glassClasses} bg-(--plass-glass-press) [box-shadow:var(--plass-shadow-1),var(--plass-gloss-glass)]`,
|
|
70
|
+
glass: 'bg-(--p-accent)',
|
|
71
|
+
ghost: 'bg-(--p-accent)'
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* A tab is a control, so it takes the control height ladder — a `md` tab and a
|
|
75
|
+
* `md` PlButton are the same 40px, which is what lets a tab bar sit in a toolbar
|
|
76
|
+
* next to one without the row losing its baseline.
|
|
77
|
+
*
|
|
78
|
+
* `data-active`, not `data-selected` — Base UI spells a chosen tab's state that
|
|
79
|
+
* way, and the wrong attribute is a class that silently never matches.
|
|
80
|
+
*/
|
|
81
|
+
const tabStateClasses = 'text-(--plass-muted-fg) hover:text-(--plass-fg) data-[active]:text-(--p-accent)';
|
|
82
|
+
/**
|
|
83
|
+
* One tab, and one place a tab differs from a PlButton: `solid` puts the tile
|
|
84
|
+
* *behind* the tab rather than on it, so the tab needs a stacking context of its
|
|
85
|
+
* own or the indicator would cover the label it is meant to be under.
|
|
86
|
+
*/
|
|
87
|
+
export const PlTab = /* @__PURE__ */ React.forwardRef(function PlTab({ value, startIcon, endIcon, disabled = false, className, children, ...props }, ref) {
|
|
88
|
+
const { variant, size, density, fullWidth } = React.useContext(TabsContext);
|
|
89
|
+
return (_jsxs(BaseUITabs.Tab, { ref: ref, value: value, disabled: disabled, className: [
|
|
90
|
+
'relative z-10 inline-flex shrink-0 cursor-pointer items-center justify-center select-none',
|
|
91
|
+
'font-semibold whitespace-nowrap',
|
|
92
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
93
|
+
controlHeightClasses[size],
|
|
94
|
+
controlTextClasses[size],
|
|
95
|
+
gapClasses[size],
|
|
96
|
+
paddingXClasses[density][size],
|
|
97
|
+
variant === 'solid' ? radiusClasses[size] : '',
|
|
98
|
+
transitionClasses,
|
|
99
|
+
iconClasses,
|
|
100
|
+
tabStateClasses,
|
|
101
|
+
// The ring is inset rather than offset: an offset ring on a tab inside a
|
|
102
|
+
// `solid` groove is drawn on top of its neighbours.
|
|
103
|
+
focusRingInsetClasses,
|
|
104
|
+
'data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50',
|
|
105
|
+
fullWidth ? 'flex-1' : '',
|
|
106
|
+
className ?? ''
|
|
107
|
+
]
|
|
108
|
+
.filter(Boolean)
|
|
109
|
+
.join(' '), ...props, children: [hasContent(startIcon) ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: startIcon })) : null, children, hasContent(endIcon) ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: endIcon })) : null] }));
|
|
110
|
+
});
|
|
111
|
+
/** The content behind one tab. */
|
|
112
|
+
export const PlTabPanel = /* @__PURE__ */ React.forwardRef(function PlTabPanel({ value, keepMounted = false, className, children, ...props }, ref) {
|
|
113
|
+
const { size } = React.useContext(TabsContext);
|
|
114
|
+
return (_jsx(BaseUITabs.Panel, { ref: ref, value: value, keepMounted: keepMounted, className: [
|
|
115
|
+
'min-w-0 flex-1 text-(--plass-fg)',
|
|
116
|
+
// The panel takes focus when it holds nothing focusable of its own, so
|
|
117
|
+
// it is reachable by keyboard — and it gets the house ring rather than
|
|
118
|
+
// the browser's.
|
|
119
|
+
focusRingClasses,
|
|
120
|
+
radiusClasses[size],
|
|
121
|
+
className ?? ''
|
|
122
|
+
]
|
|
123
|
+
.filter(Boolean)
|
|
124
|
+
.join(' '), ...props, children: children }));
|
|
125
|
+
});
|
|
126
|
+
/**
|
|
127
|
+
* One set of panels, one of which is shown.
|
|
128
|
+
*
|
|
129
|
+
* Base UI owns everything that makes a tab bar a tab bar rather than a row of
|
|
130
|
+
* buttons: roving focus so the whole bar is one tab stop, the arrow keys on
|
|
131
|
+
* whichever axis the bar runs, Home and End, the `tab` / `tabpanel` roles and
|
|
132
|
+
* the `aria-controls` wiring between them, and the measurement that puts the
|
|
133
|
+
* indicator under the chosen tab. What is here is the surface and the ladders.
|
|
134
|
+
*
|
|
135
|
+
* The tabs and the panels are composed rather than passed as data, unlike
|
|
136
|
+
* `PlSelect` — because a panel is a subtree, and there is no useful shape for
|
|
137
|
+
* "an array of arbitrary React trees" that is not just children.
|
|
138
|
+
*/
|
|
139
|
+
export const PlTabs = /* @__PURE__ */ React.forwardRef(function PlTabs({ variant = 'glass', size = 'md', color = 'primary', density = 'default', value, defaultValue, onValueChange, orientation = 'horizontal', activateOnFocus = false, loopFocus = true, fullWidth = false, className, style, children, ...props }, ref) {
|
|
140
|
+
const context = React.useMemo(() => ({ variant, size, density, orientation, fullWidth }), [variant, size, density, orientation, fullWidth]);
|
|
141
|
+
// Everything a caller writes between the tags is either a tab or a panel, and
|
|
142
|
+
// the two go in different boxes — so they are sorted here rather than made the
|
|
143
|
+
// caller's problem with a `<PlTabList>` wrapper they would have to remember.
|
|
144
|
+
const tabs = [];
|
|
145
|
+
const panels = [];
|
|
146
|
+
React.Children.forEach(children, (child) => {
|
|
147
|
+
if (React.isValidElement(child) && child.type === PlTabPanel) {
|
|
148
|
+
panels.push(child);
|
|
149
|
+
}
|
|
150
|
+
else if (child !== null && child !== undefined && child !== false) {
|
|
151
|
+
tabs.push(child);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return (_jsx(TabsContext.Provider, { value: context, children: _jsxs(BaseUITabs.Root, { ref: ref, value: value, defaultValue: defaultValue, onValueChange: (next) => onValueChange?.(next), orientation: orientation, className: [
|
|
155
|
+
'flex min-w-0',
|
|
156
|
+
orientation === 'vertical' ? 'flex-row gap-4' : 'flex-col gap-4',
|
|
157
|
+
className ?? ''
|
|
158
|
+
]
|
|
159
|
+
.filter(Boolean)
|
|
160
|
+
.join(' '), style: { ...surfaceSlots(color, 0), ...style }, ...props, children: [_jsxs(BaseUITabs.List, { activateOnFocus: activateOnFocus, loopFocus: loopFocus, className: [
|
|
161
|
+
'relative shrink-0',
|
|
162
|
+
listClasses[variant][orientation],
|
|
163
|
+
variant === 'solid' ? radiusClasses[size] : '',
|
|
164
|
+
fullWidth && orientation === 'horizontal' ? 'w-full' : '',
|
|
165
|
+
// A bar with more tabs than room scrolls rather than wrapping: a tab
|
|
166
|
+
// bar on two lines has stopped being a bar, and the indicator has
|
|
167
|
+
// nowhere sensible to sit.
|
|
168
|
+
orientation === 'horizontal' ? 'overflow-x-auto overflow-y-hidden' : ''
|
|
169
|
+
]
|
|
170
|
+
.filter(Boolean)
|
|
171
|
+
.join(' '), children: [tabs, _jsx(BaseUITabs.Indicator, { className: [
|
|
172
|
+
'pointer-events-none',
|
|
173
|
+
indicatorClasses[variant][orientation],
|
|
174
|
+
indicatorSurfaceClasses[variant],
|
|
175
|
+
variant === 'solid' ? radiusClasses[size] : 'rounded-full',
|
|
176
|
+
// The same easing everything else uses, on the four properties the
|
|
177
|
+
// measurement actually writes.
|
|
178
|
+
'[transition-property:left,top,width,height]',
|
|
179
|
+
'[transition-duration:var(--plass-duration)]',
|
|
180
|
+
'[transition-timing-function:var(--plass-ease)]'
|
|
181
|
+
].join(' ') })] }), panels] }) }));
|
|
182
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlTab, PlTabPanel, PlTabs } from './PlTabs.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { PlassElevation, PlassStyleProps } from '../../types';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
3
|
/** How the multiline control may be resized by the user. Ignored when single line. */
|
|
4
|
-
export type
|
|
4
|
+
export type PlTextFieldResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
5
5
|
/**
|
|
6
6
|
* Native `<input>` attributes, minus the three that collide with the shared
|
|
7
7
|
* vocabulary: `color` and `size` are Plass props here, and `onChange` is widened
|
|
8
8
|
* below so the same handler types against a `<textarea>` in multiline mode.
|
|
9
9
|
*/
|
|
10
10
|
type NativeControlProps = Omit<React.ComponentPropsWithoutRef<'input'>, 'color' | 'size' | 'onChange' | 'children'>;
|
|
11
|
-
export interface
|
|
11
|
+
export interface PlTextFieldProps extends PlassStyleProps, NativeControlProps {
|
|
12
12
|
/**
|
|
13
13
|
* Drop shadow depth. `0` is the default — a field is a well cut into the
|
|
14
14
|
* sheet, not a key resting on it, and the one place in the library where a
|
|
@@ -30,7 +30,7 @@ export interface TextFieldProps extends PlassStyleProps, NativeControlProps {
|
|
|
30
30
|
* breaks a form's column, so only the vertical axis is on by default.
|
|
31
31
|
* @default 'vertical'
|
|
32
32
|
*/
|
|
33
|
-
resize?:
|
|
33
|
+
resize?: PlTextFieldResize;
|
|
34
34
|
/**
|
|
35
35
|
* Label above the control, wired to it by Base UI's Field. There is no
|
|
36
36
|
* floating variant on purpose: a floating label needs a `transform` on the
|
|
@@ -61,5 +61,5 @@ export interface TextFieldProps extends PlassStyleProps, NativeControlProps {
|
|
|
61
61
|
fullWidth?: boolean;
|
|
62
62
|
onChange?: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>;
|
|
63
63
|
}
|
|
64
|
-
export declare const
|
|
64
|
+
export declare const PlTextField: React.ForwardRefExoticComponent<PlTextFieldProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
|
|
65
65
|
export {};
|