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,206 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CheckIcon, ClockIcon, LinkIcon, severityIcon } from '../../internal/icons.js';
|
|
4
|
+
import { controlSlots, focusRingClasses, glassClasses, hasContent, metaTextClasses, radiusClasses, sheetBodyClasses, sheetHeaderGapClasses, srOnlyClasses, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* A bubble's own padding track, tighter than a sheet's.
|
|
7
|
+
*
|
|
8
|
+
* A sheet is a region of a page and a bubble is a sentence with a surface behind
|
|
9
|
+
* it: 20px of padding around eight words is a card, not a message. Both axes,
|
|
10
|
+
* because unlike a control a bubble has no height to fight.
|
|
11
|
+
*/
|
|
12
|
+
const bubblePaddingClasses = {
|
|
13
|
+
default: {
|
|
14
|
+
xs: 'px-2 py-1',
|
|
15
|
+
sm: 'px-2.5 py-1.5',
|
|
16
|
+
md: 'px-3 py-2',
|
|
17
|
+
lg: 'px-3.5 py-2.5',
|
|
18
|
+
xl: 'px-4 py-3'
|
|
19
|
+
},
|
|
20
|
+
compact: {
|
|
21
|
+
xs: 'px-1.5 py-0.5',
|
|
22
|
+
sm: 'px-2 py-1',
|
|
23
|
+
md: 'px-2.5 py-1.5',
|
|
24
|
+
lg: 'px-3 py-1.5',
|
|
25
|
+
xl: 'px-3.5 py-2'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The corner nearest the speaker is cut short.
|
|
30
|
+
*
|
|
31
|
+
* This is the library's one piece of chat vocabulary, and it does the job a
|
|
32
|
+
* drawn tail does elsewhere: it says which end of the row the message came from,
|
|
33
|
+
* without hanging a triangle off a sheet of glass that is supposed to have been
|
|
34
|
+
* cut with a straight edge. Written as the logical properties rather than as
|
|
35
|
+
* `rounded-tl`, so a thread in Arabic squares the other corner without being
|
|
36
|
+
* told.
|
|
37
|
+
*
|
|
38
|
+
* A flat 4px rather than a step down the radius ladder, and that is the whole
|
|
39
|
+
* point of writing it out: the ladder runs 8px to 16px, so `--plass-radius-xs`
|
|
40
|
+
* against `--plass-radius-md` is a four-pixel difference nobody would ever read
|
|
41
|
+
* as meaning something. The cut has to be obvious at a glance in a column of
|
|
42
|
+
* forty messages or it is not saying anything.
|
|
43
|
+
*/
|
|
44
|
+
const tailClasses = {
|
|
45
|
+
start: '[border-start-start-radius:0.25rem]',
|
|
46
|
+
end: '[border-start-end-radius:0.25rem]'
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The three materials.
|
|
50
|
+
*
|
|
51
|
+
* A bubble *is* the thing being coloured — unlike a `PlCard`, which holds other
|
|
52
|
+
* people's content and so keeps its sheet undyed — so `solid` floods it and the
|
|
53
|
+
* text switches to `--p-on-solid`. That is what makes a column of your own
|
|
54
|
+
* messages read as yours at a glance rather than one line at a time.
|
|
55
|
+
*/
|
|
56
|
+
const variantClasses = {
|
|
57
|
+
solid: /* @__PURE__ */ [
|
|
58
|
+
'text-(--p-on-solid) [background-image:var(--p-fill)]',
|
|
59
|
+
'[box-shadow:var(--p-elev),var(--p-lift)]'
|
|
60
|
+
].join(' '),
|
|
61
|
+
glass: /* @__PURE__ */ [
|
|
62
|
+
glassClasses,
|
|
63
|
+
'border text-(--plass-fg) bg-(--plass-glass)',
|
|
64
|
+
'[border-color:var(--plass-glass-line)]',
|
|
65
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
66
|
+
].join(' '),
|
|
67
|
+
ghost: 'text-(--plass-fg) bg-(--p-soft) [box-shadow:var(--p-elev)]'
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The double tick, drawn here rather than in `internal/icons` because it is the
|
|
71
|
+
* one glyph in the library only one component has any use for.
|
|
72
|
+
*
|
|
73
|
+
* Two ticks overlapping by a third of their width, which is what says "two"
|
|
74
|
+
* without doubling the width of the mark — a delivered message and a sent one
|
|
75
|
+
* have to be told apart at 12px, side by side, in a column.
|
|
76
|
+
*/
|
|
77
|
+
function DoubleCheckIcon() {
|
|
78
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [_jsx("path", { d: "m1.5 8.5 2.75 2.75L9.5 6", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M7 10.75 8.25 12l5.25-5.25", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
79
|
+
}
|
|
80
|
+
/** One glyph per step. `read` shares the mark with `delivered` and takes the colour. */
|
|
81
|
+
const statusIcons = {
|
|
82
|
+
sending: _jsx(ClockIcon, {}),
|
|
83
|
+
sent: _jsx(CheckIcon, {}),
|
|
84
|
+
delivered: _jsx(DoubleCheckIcon, {}),
|
|
85
|
+
read: _jsx(DoubleCheckIcon, {}),
|
|
86
|
+
failed: /* @__PURE__ */ severityIcon('danger')
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* What each mark is read out as. English, like every other default string in the
|
|
90
|
+
* library — a page already knows its own language, and `statusLabel` is where it
|
|
91
|
+
* says so.
|
|
92
|
+
*/
|
|
93
|
+
const statusLabels = {
|
|
94
|
+
sending: 'Sending',
|
|
95
|
+
sent: 'Sent',
|
|
96
|
+
delivered: 'Delivered',
|
|
97
|
+
read: 'Read',
|
|
98
|
+
failed: 'Not delivered'
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Only two of the five carry a colour: the one that arrived and the one that did
|
|
102
|
+
* not. The three in between are the ordinary course of events, and a thread
|
|
103
|
+
* where every message is marked in colour is a thread where the colour has
|
|
104
|
+
* stopped meaning anything.
|
|
105
|
+
*/
|
|
106
|
+
const statusToneClasses = {
|
|
107
|
+
sending: 'text-(--plass-muted-fg)',
|
|
108
|
+
sent: 'text-(--plass-muted-fg)',
|
|
109
|
+
delivered: 'text-(--plass-muted-fg)',
|
|
110
|
+
read: 'text-(--p-accent)',
|
|
111
|
+
failed: 'text-(--plass-danger-accent)'
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The card a link unfurls into.
|
|
115
|
+
*
|
|
116
|
+
* Its surface is mixed out of `currentColor` rather than out of a token, because
|
|
117
|
+
* it is the one part of a bubble that has to work on both a filled surface and a
|
|
118
|
+
* bare one: on `solid` the text is white and the card is a white wash, on
|
|
119
|
+
* `glass` the text is the page's ink and the card is a grey one. A fixed token
|
|
120
|
+
* would be invisible against one of the two.
|
|
121
|
+
*/
|
|
122
|
+
const previewSurfaceClasses = /* @__PURE__ */ [
|
|
123
|
+
'block overflow-hidden rounded-(--plass-radius-sm) border no-underline',
|
|
124
|
+
'[border-color:color-mix(in_oklab,currentColor_18%,transparent)]',
|
|
125
|
+
'[background-color:color-mix(in_oklab,currentColor_7%,transparent)]',
|
|
126
|
+
'hover:[background-color:color-mix(in_oklab,currentColor_12%,transparent)]',
|
|
127
|
+
'[transition-property:background-color] [transition-duration:var(--plass-duration)]',
|
|
128
|
+
'[transition-timing-function:var(--plass-ease)]',
|
|
129
|
+
focusRingClasses
|
|
130
|
+
].join(' ');
|
|
131
|
+
/**
|
|
132
|
+
* The affordance stays out of the way of the message until the row is reached
|
|
133
|
+
* for — the same allowance a chip's × takes, and for the same reason: this is
|
|
134
|
+
* not a control changing what it is, it is a handle that would otherwise sit in
|
|
135
|
+
* the middle of a conversation being read.
|
|
136
|
+
*
|
|
137
|
+
* A pointer that cannot hover has nothing to reveal it, so it is simply always
|
|
138
|
+
* there on touch.
|
|
139
|
+
*/
|
|
140
|
+
const actionsClasses = /* @__PURE__ */ [
|
|
141
|
+
'shrink-0 opacity-0',
|
|
142
|
+
'[transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
143
|
+
'group-hover/bubble:opacity-100 group-focus-within/bubble:opacity-100',
|
|
144
|
+
'[@media(hover:none)]:opacity-100'
|
|
145
|
+
].join(' ');
|
|
146
|
+
/**
|
|
147
|
+
* One message in a conversation.
|
|
148
|
+
*
|
|
149
|
+
* Everything around the bubble is optional and nothing about it is fixed by
|
|
150
|
+
* `side`: the avatar, the sender's name, the time, the delivery mark, the media
|
|
151
|
+
* above the text and the link card below it are each drawn only when they are
|
|
152
|
+
* given something. What `side` decides is which way the row runs and which
|
|
153
|
+
* corner of the sheet is cut short.
|
|
154
|
+
*
|
|
155
|
+
* `variant` is what tells your own messages from everyone else's, and it is
|
|
156
|
+
* deliberately not tied to `side` — filling the right-hand column is a
|
|
157
|
+
* convention, not a law, and a thread that fills neither is a perfectly good
|
|
158
|
+
* thread.
|
|
159
|
+
*/
|
|
160
|
+
export const PlChatBubble = /* @__PURE__ */ React.forwardRef(function PlChatBubble({ side = 'start', name, time, avatar, status, statusLabel, typing = false, typingLabel = 'Typing…', media, preview, actions, variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, className, style, children, ...props }, ref) {
|
|
161
|
+
const end = side === 'end';
|
|
162
|
+
const hasHeader = hasContent(name) || hasContent(time);
|
|
163
|
+
const hasBody = typing || hasContent(children) || Boolean(preview);
|
|
164
|
+
const bubbleClasses = [
|
|
165
|
+
'flex min-w-0 flex-col overflow-hidden',
|
|
166
|
+
radiusClasses[size],
|
|
167
|
+
tailClasses[side],
|
|
168
|
+
variantClasses[variant],
|
|
169
|
+
transitionClasses
|
|
170
|
+
].join(' ');
|
|
171
|
+
return (_jsxs("div", { ref: ref, className: [
|
|
172
|
+
'group/bubble flex w-full items-start gap-2',
|
|
173
|
+
end ? 'flex-row-reverse' : '',
|
|
174
|
+
className ?? ''
|
|
175
|
+
]
|
|
176
|
+
.filter(Boolean)
|
|
177
|
+
.join(' '), style: { ...controlSlots(color, elevation, variant), ...style }, ...props, children: [hasContent(avatar) ? _jsx("div", { className: "shrink-0", children: avatar }) : null, _jsxs("div", { className: [
|
|
178
|
+
'flex max-w-[min(100%,32rem)] min-w-0 flex-col',
|
|
179
|
+
sheetHeaderGapClasses[size],
|
|
180
|
+
end ? 'items-end' : 'items-start'
|
|
181
|
+
].join(' '), children: [hasHeader ? (_jsxs("div", { className: `flex items-baseline gap-2 ${metaTextClasses[size]}`, children: [hasContent(name) ? _jsx("span", { className: "font-semibold", children: name }) : null, hasContent(time) ? _jsx("span", { className: "text-(--plass-muted-fg)", children: time }) : null] })) : null, _jsxs("div", { className: `flex min-w-0 items-center gap-1 ${end ? 'flex-row-reverse' : ''}`, children: [_jsxs("div", { className: bubbleClasses, children: [hasContent(media) ? (_jsx("div", { className: "[&_img]:block [&_img]:w-full [&_video]:block [&_video]:w-full", children: media })) : null, hasBody ? (_jsxs("div", { className: [
|
|
182
|
+
bubblePaddingClasses[density][size],
|
|
183
|
+
'flex min-w-0 flex-col gap-2',
|
|
184
|
+
sheetBodyClasses[size]
|
|
185
|
+
].join(' '), children: [typing ? (_jsx(TypingDots, { label: typingLabel })) : hasContent(children) ? (_jsx("div", { className: "min-w-0 break-words whitespace-pre-line", children: children })) : null, preview ? _jsx(LinkPreview, { preview: preview }) : null] })) : null] }), hasContent(actions) ? _jsx("div", { className: actionsClasses, children: actions }) : null] }), status ? (_jsxs("div", { className: [
|
|
186
|
+
'flex items-center gap-1',
|
|
187
|
+
metaTextClasses[size],
|
|
188
|
+
statusToneClasses[status],
|
|
189
|
+
'[&_svg]:size-[1.15em] [&_svg]:shrink-0'
|
|
190
|
+
].join(' '), children: [statusIcons[status], _jsx("span", { className: srOnlyClasses, children: statusLabel ?? statusLabels[status] })] })) : null] })] }));
|
|
191
|
+
});
|
|
192
|
+
/**
|
|
193
|
+
* Three dots that light in sequence.
|
|
194
|
+
*
|
|
195
|
+
* Colour only, like every other indeterminate indicator in the library — the
|
|
196
|
+
* dots never move, so a bubble that is being typed into does not bounce in a
|
|
197
|
+
* thread somebody is reading. The delay is carried per dot in `--p-i`.
|
|
198
|
+
*/
|
|
199
|
+
function TypingDots({ label }) {
|
|
200
|
+
return (_jsxs("div", { className: "flex items-center gap-1 py-[0.35em]", role: "status", children: [[0, 1, 2].map((index) => (_jsx("span", { "aria-hidden": "true", className: "plass-typing-dot size-[0.45em] rounded-full", style: { '--p-i': index } }, index))), _jsx("span", { className: srOnlyClasses, children: label })] }));
|
|
201
|
+
}
|
|
202
|
+
/** The unfurled link: an image, who published it, a title and two lines of summary. */
|
|
203
|
+
function LinkPreview({ preview }) {
|
|
204
|
+
const { url, title, description, image, site, newTab = false } = preview;
|
|
205
|
+
return (_jsxs("a", { href: url, target: newTab ? '_blank' : undefined, rel: newTab ? 'noopener noreferrer' : undefined, className: previewSurfaceClasses, children: [image ? (_jsx("img", { src: image, alt: "", className: "block h-28 w-full object-cover" })) : null, _jsxs("div", { className: "flex flex-col gap-0.5 p-2", children: [hasContent(site) ? (_jsxs("span", { className: "flex items-center gap-1 text-[0.85em] opacity-70 [&_svg]:size-[1em] [&_svg]:shrink-0", children: [_jsx(LinkIcon, {}), _jsx("span", { className: "truncate", children: site })] })) : null, hasContent(title) ? _jsx("span", { className: "font-semibold", children: title }) : null, hasContent(description) ? (_jsx("span", { className: "line-clamp-2 text-[0.9em] opacity-80", children: description })) : null] })] }));
|
|
206
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlChatBubble } from './PlChatBubble.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Checkbox as BaseUICheckbox } from '@base-ui/react/checkbox';
|
|
3
|
+
import type { PlassColor, PlassSize } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Base UI's own props, minus the ones this component owns: `className` and
|
|
6
|
+
* `style` land on the field wrapper rather than on the tick, and `render` would
|
|
7
|
+
* replace the tick with something that is no longer a checkbox.
|
|
8
|
+
*/
|
|
9
|
+
type BaseCheckboxProps = Omit<React.ComponentPropsWithoutRef<typeof BaseUICheckbox.Root>, 'className' | 'style' | 'render' | 'children'>;
|
|
10
|
+
export interface PlCheckboxProps extends BaseCheckboxProps {
|
|
11
|
+
/** @default 'md' */
|
|
12
|
+
size?: PlassSize;
|
|
13
|
+
/** @default 'primary' */
|
|
14
|
+
color?: PlassColor;
|
|
15
|
+
/** The text beside the tick. Wired to it by Base UI's Field. */
|
|
16
|
+
label?: React.ReactNode;
|
|
17
|
+
/** Helper text under the label. */
|
|
18
|
+
description?: React.ReactNode;
|
|
19
|
+
/** Error message below. Its presence also turns the checkbox invalid. */
|
|
20
|
+
error?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Forces the invalid state without a message — for when an external form
|
|
23
|
+
* library owns the validity. Defaults to whether `error` has content.
|
|
24
|
+
*/
|
|
25
|
+
invalid?: boolean;
|
|
26
|
+
/** Class names for the field wrapper, not for the tick itself. */
|
|
27
|
+
className?: string;
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A single yes/no, or one member of a set of them.
|
|
32
|
+
*
|
|
33
|
+
* `label`, `description` and `error` are props rather than children for the same
|
|
34
|
+
* reason they are on PlTextField: the arrangement is fixed and what a caller
|
|
35
|
+
* wants to decide is what goes in each slot. `children` is not accepted at all —
|
|
36
|
+
* anything a checkbox has to say belongs in one of the three.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PlCheckbox: React.ForwardRefExoticComponent<PlCheckboxProps & React.RefAttributes<HTMLElement>>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Checkbox as BaseUICheckbox } from '@base-ui/react/checkbox';
|
|
4
|
+
import { Field } from '@base-ui/react/field';
|
|
5
|
+
import { controlSlots, focusRingClasses, glassClasses, hasContent, metaTextClasses, tickRadiusClasses, tickRowTextClasses, tickSizeClasses, transitionClasses } from '../../internal/styles.js';
|
|
6
|
+
/**
|
|
7
|
+
* The tick.
|
|
8
|
+
*
|
|
9
|
+
* Unchecked it is a small pane of clear glass with a hairline round it — the
|
|
10
|
+
* same material a `glass` button is. Checked it fills with the family's
|
|
11
|
+
* gradient, which is the one place this library expresses a state by swapping
|
|
12
|
+
* the whole surface rather than shifting it a step: "on" and "off" are not two
|
|
13
|
+
* strengths of the same thing.
|
|
14
|
+
*/
|
|
15
|
+
const tickBaseClasses = /* @__PURE__ */ [
|
|
16
|
+
'relative inline-flex shrink-0 items-center justify-center border',
|
|
17
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
18
|
+
transitionClasses,
|
|
19
|
+
focusRingClasses
|
|
20
|
+
].join(' ');
|
|
21
|
+
/**
|
|
22
|
+
* No gloss line on a tick, and no tinted lift under it.
|
|
23
|
+
*
|
|
24
|
+
* `--plass-gloss-glass` is a 1px white edge along the top of a pane. On a 40px
|
|
25
|
+
* button that reads as light catching a cut edge; on an 18px square it is a
|
|
26
|
+
* bevel drawn at a twentieth of the object and it turns into a grey smudge.
|
|
27
|
+
* The tinted lift goes for the same reason from the other direction — a
|
|
28
|
+
* `0 6px 16px` shadow under an 18px box is a shadow bigger than the box.
|
|
29
|
+
*
|
|
30
|
+
* The material stays. It is only the two decorations that go.
|
|
31
|
+
*
|
|
32
|
+
* The edge is `--plass-border` rather than the sheet's own `--plass-glass-line`,
|
|
33
|
+
* and that is not a slip. The glass hairline is white light on a translucent
|
|
34
|
+
* pane, which is invisible the moment the tick is set on a light card rather
|
|
35
|
+
* than on the page wash — and a tick nobody can see is a control nobody can
|
|
36
|
+
* find. A neutral hairline reads on both.
|
|
37
|
+
*/
|
|
38
|
+
const restClasses = /* @__PURE__ */ [
|
|
39
|
+
glassClasses,
|
|
40
|
+
'cursor-pointer bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
41
|
+
'hover:bg-(--plass-glass-hover) hover:[border-color:var(--p-line)]',
|
|
42
|
+
// `data-checked` rather than `:checked`: the visible tick is a `<span>`, and
|
|
43
|
+
// the real input is hidden beside it.
|
|
44
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
45
|
+
'data-[checked]:[border-color:transparent] data-[checked]:hover:brightness-105',
|
|
46
|
+
'data-[indeterminate]:[background-image:var(--p-fill)] data-[indeterminate]:text-(--p-on-solid)',
|
|
47
|
+
'data-[indeterminate]:[border-color:transparent]'
|
|
48
|
+
].join(' ');
|
|
49
|
+
const readOnlyClasses = /* @__PURE__ */ [
|
|
50
|
+
glassClasses,
|
|
51
|
+
'cursor-default bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
52
|
+
'saturate-[0.55]',
|
|
53
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
54
|
+
'data-[checked]:[border-color:transparent]'
|
|
55
|
+
].join(' ');
|
|
56
|
+
/** Disabled is the light going out, exactly as it is on a PlButton. */
|
|
57
|
+
const disabledTickClasses = /* @__PURE__ */ [
|
|
58
|
+
glassClasses,
|
|
59
|
+
'cursor-not-allowed bg-(--plass-glass) [border-color:var(--plass-border)]',
|
|
60
|
+
'opacity-50 saturate-[0.35]',
|
|
61
|
+
'data-[checked]:[background-image:var(--p-fill)] data-[checked]:text-(--p-on-solid)',
|
|
62
|
+
'data-[checked]:[border-color:transparent]',
|
|
63
|
+
'data-[indeterminate]:[background-image:var(--p-fill)] data-[indeterminate]:text-(--p-on-solid)'
|
|
64
|
+
].join(' ');
|
|
65
|
+
/** The mark is drawn at 70% of the box, so it never touches the corners. */
|
|
66
|
+
const markClasses = 'flex size-[70%] items-center justify-center';
|
|
67
|
+
function CheckMark() {
|
|
68
|
+
return (_jsx("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: "size-full", children: _jsx("path", { d: "M2 6.2 4.6 8.8 10 3.4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
69
|
+
}
|
|
70
|
+
function DashMark() {
|
|
71
|
+
return (_jsx("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: "size-full", children: _jsx("path", { d: "M2.5 6h7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A single yes/no, or one member of a set of them.
|
|
75
|
+
*
|
|
76
|
+
* `label`, `description` and `error` are props rather than children for the same
|
|
77
|
+
* reason they are on PlTextField: the arrangement is fixed and what a caller
|
|
78
|
+
* wants to decide is what goes in each slot. `children` is not accepted at all —
|
|
79
|
+
* anything a checkbox has to say belongs in one of the three.
|
|
80
|
+
*/
|
|
81
|
+
export const PlCheckbox = /* @__PURE__ */ React.forwardRef(function PlCheckbox({ size = 'md', color = 'primary', label, description, error, invalid, disabled = false, readOnly = false, className, style, ...props }, ref) {
|
|
82
|
+
const hasError = hasContent(error);
|
|
83
|
+
const isInvalid = invalid ?? hasError;
|
|
84
|
+
// Invalid re-points the whole slot family at `danger`, so the tick, the ring
|
|
85
|
+
// and the message all turn over together.
|
|
86
|
+
const family = isInvalid ? 'danger' : color;
|
|
87
|
+
const tickClasses = [
|
|
88
|
+
tickBaseClasses,
|
|
89
|
+
tickSizeClasses[size],
|
|
90
|
+
tickRadiusClasses[size],
|
|
91
|
+
// An if/else rather than stacked variants: two Tailwind classes of equal
|
|
92
|
+
// specificity resolve by their order in the generated stylesheet.
|
|
93
|
+
disabled ? disabledTickClasses : readOnly ? readOnlyClasses : restClasses
|
|
94
|
+
].join(' ');
|
|
95
|
+
return (_jsxs(Field.Root, { disabled: disabled, invalid: isInvalid, className: ['inline-flex flex-col gap-1 align-top', className ?? '']
|
|
96
|
+
.filter(Boolean)
|
|
97
|
+
.join(' '),
|
|
98
|
+
// `solid`, because a checked tick *is* the coloured thing.
|
|
99
|
+
style: { ...controlSlots(family, 0, 'solid'), ...style }, children: [_jsxs("div", { className: `flex items-start gap-2 ${tickRowTextClasses[size]}`, children: [_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: _jsx(BaseUICheckbox.Root, { ref: ref, className: tickClasses, disabled: disabled, readOnly: readOnly, ...props, children: _jsx(BaseUICheckbox.Indicator, { className: markClasses, children: props.indeterminate ? _jsx(DashMark, {}) : _jsx(CheckMark, {}) }) }) }), 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[size]} text-(--plass-muted-fg)`, children: description })) : null] })) : null] }), hasError ? (_jsx(Field.Error, { match: true, className: `${metaTextClasses[size]} text-(--p-accent)`, children: error })) : null] }));
|
|
100
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlCheckbox } from './PlCheckbox.js';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
export interface PlChipProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
4
|
+
/**
|
|
5
|
+
* Drop shadow depth. `0` is the default — a chip is a token sitting *on*
|
|
6
|
+
* something else, so it is raised even less often than a `PlButton`.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
elevation?: PlassElevation;
|
|
10
|
+
/** Content placed before the label — an icon, a status dot, an avatar. */
|
|
11
|
+
startIcon?: React.ReactNode;
|
|
12
|
+
/** Content placed after the label, before any `count`. */
|
|
13
|
+
endIcon?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* A number set into the end of the chip. Drawn on its own small plate, so
|
|
16
|
+
* "Errors 12" reads as one token with a count rather than as two words.
|
|
17
|
+
*/
|
|
18
|
+
count?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the chip's delete affordance is pressed. Passing it is what
|
|
21
|
+
* makes the affordance appear.
|
|
22
|
+
*/
|
|
23
|
+
onDelete?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Accessible name of the delete button. Never drawn.
|
|
26
|
+
* @default 'Remove'
|
|
27
|
+
*/
|
|
28
|
+
deleteLabel?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Marks the chip as chosen — a filter that is on.
|
|
31
|
+
*
|
|
32
|
+
* It moves the chip one step up the ladder its own variant already sits on,
|
|
33
|
+
* rather than changing the colour family, so a row of chips stays one row of
|
|
34
|
+
* chips.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
/** Unavailable. The light goes out, the same way it does everywhere else. */
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
children?: React.ReactNode;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A compact token: a tag, a filter, a status, an entity plucked out of a list.
|
|
44
|
+
*
|
|
45
|
+
* The shell is always a `<span>`. What changes is what is inside it: a plain run
|
|
46
|
+
* of content, or — when `onClick` is given — a real `<button>` wrapping that
|
|
47
|
+
* content, plus a second button for `onDelete`. Both are reachable by keyboard,
|
|
48
|
+
* and neither is nested inside the other.
|
|
49
|
+
*
|
|
50
|
+
* An inert `<span>` carrying a click handler is the single most common way a
|
|
51
|
+
* component library loses its keyboard users, and a `<button>` inside a
|
|
52
|
+
* `<button>` is the most common way it invents a chip that Chrome silently
|
|
53
|
+
* rewrites. This shape is what avoids both.
|
|
54
|
+
*/
|
|
55
|
+
export declare const PlChip: React.ForwardRefExoticComponent<PlChipProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CloseIcon } from '../../internal/icons.js';
|
|
4
|
+
import { chipRemoveClasses, controlHeightClasses, controlSlots, controlTextClasses, disabledClasses, focusRingClasses, gapClasses, glassClasses, hasContent, iconClasses, paddingXClasses, radiusClasses, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* A chip sits one step down the control ladder from everything else: a `md` chip
|
|
7
|
+
* is a `sm` control — 32px, not 40px.
|
|
8
|
+
*
|
|
9
|
+
* This is the whole size difference between a chip and a button, and it is
|
|
10
|
+
* deliberate. A chip is a token *inside* a row of content, not a control the row
|
|
11
|
+
* lines up against; at full control height a `glass` chip and a `glass` button
|
|
12
|
+
* are the same object, and a screen full of them says nothing about which one
|
|
13
|
+
* can be pressed.
|
|
14
|
+
*
|
|
15
|
+
* Shifting the index rather than inventing a second set of numbers keeps a chip
|
|
16
|
+
* inside the same five-step vocabulary, and keeps `xs` from falling off the
|
|
17
|
+
* bottom of it.
|
|
18
|
+
*/
|
|
19
|
+
const chipScale = {
|
|
20
|
+
xs: 'xs',
|
|
21
|
+
sm: 'xs',
|
|
22
|
+
md: 'sm',
|
|
23
|
+
lg: 'md',
|
|
24
|
+
xl: 'lg'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The three materials. A chip **is** the thing being coloured — a tag names one
|
|
28
|
+
* particular thing — so unlike a `PlCard` its sheet takes the tint.
|
|
29
|
+
*
|
|
30
|
+
* `glass` is the default rather than `solid`: a filter bar is a row of chips,
|
|
31
|
+
* and a row of gradient keys is a row in which nothing is the primary action
|
|
32
|
+
* because everything is.
|
|
33
|
+
*/
|
|
34
|
+
const restClasses = {
|
|
35
|
+
solid: 'text-(--p-on-solid) [background-image:var(--p-fill)] [box-shadow:var(--p-elev)]',
|
|
36
|
+
glass: /* @__PURE__ */ [
|
|
37
|
+
glassClasses,
|
|
38
|
+
'border text-(--p-accent) bg-(--plass-glass)',
|
|
39
|
+
'[border-color:var(--plass-glass-line)]',
|
|
40
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
41
|
+
].join(' '),
|
|
42
|
+
ghost: 'text-(--p-accent) bg-(--p-soft)'
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Chosen is one step further up the ladder the chip is already on — the sheet
|
|
46
|
+
* holds more light. Deliberately not a different colour family: a filter that is
|
|
47
|
+
* on is still the same filter.
|
|
48
|
+
*
|
|
49
|
+
* `solid` has no opacity ladder to climb, because a gradient fill is the fill.
|
|
50
|
+
* So it answers the other way the design language allows: it casts its own
|
|
51
|
+
* colour onto the sheet under it. A chosen key lifts; an unchosen one lies flat.
|
|
52
|
+
*/
|
|
53
|
+
const selectedClasses = {
|
|
54
|
+
solid: '[box-shadow:var(--p-elev),var(--p-lift)]',
|
|
55
|
+
glass: 'bg-(--plass-glass-press) [border-color:var(--p-line-hover)]',
|
|
56
|
+
ghost: 'bg-(--p-soft-press)'
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Only a chip that can be pressed answers the pointer, and it answers the way
|
|
60
|
+
* every other control does: `brightness()` on the gradient, a step up the
|
|
61
|
+
* opacity ladder on the other two.
|
|
62
|
+
*/
|
|
63
|
+
const hoverClasses = {
|
|
64
|
+
solid: 'hover:brightness-105 active:brightness-95',
|
|
65
|
+
glass: 'hover:bg-(--plass-glass-hover) hover:[border-color:var(--p-line)] active:bg-(--plass-glass-press)',
|
|
66
|
+
ghost: 'hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)'
|
|
67
|
+
};
|
|
68
|
+
const baseClasses = /* @__PURE__ */ [
|
|
69
|
+
// `items-center`, not `items-stretch`: everything in a chip — the icon, the
|
|
70
|
+
// label, the count plate, the × — is centred on one line. The pressable label
|
|
71
|
+
// asks for the height it needs with `self-stretch` instead, so making the
|
|
72
|
+
// shell stretch to suit it would knock every other child off the centre line.
|
|
73
|
+
'relative inline-flex max-w-full shrink-0 items-center select-none',
|
|
74
|
+
'align-middle leading-none font-medium whitespace-nowrap',
|
|
75
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
76
|
+
transitionClasses,
|
|
77
|
+
iconClasses
|
|
78
|
+
].join(' ');
|
|
79
|
+
/**
|
|
80
|
+
* The label, when the chip is pressable, is its own `<button>` inside the shell
|
|
81
|
+
* rather than the shell itself.
|
|
82
|
+
*
|
|
83
|
+
* That looks like indirection and is not: a chip can carry a delete affordance,
|
|
84
|
+
* which has to be a button too, and a `<button>` inside a `<button>` is invalid
|
|
85
|
+
* HTML that browsers un-nest on parse. Keeping the shell a `<span>` is what lets
|
|
86
|
+
* "activate this chip" and "remove this chip" both be real, focusable buttons.
|
|
87
|
+
*
|
|
88
|
+
* `self-stretch` so its hit area is the full height of the chip rather than the
|
|
89
|
+
* height of the words, and `rounded-[inherit]` so the focus ring traces the
|
|
90
|
+
* shell's corners rather than drawing a second, squarer rectangle inside them.
|
|
91
|
+
*/
|
|
92
|
+
const labelButtonClasses = /* @__PURE__ */ [
|
|
93
|
+
'flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch rounded-[inherit]',
|
|
94
|
+
focusRingClasses
|
|
95
|
+
].join(' ');
|
|
96
|
+
/**
|
|
97
|
+
* A compact token: a tag, a filter, a status, an entity plucked out of a list.
|
|
98
|
+
*
|
|
99
|
+
* The shell is always a `<span>`. What changes is what is inside it: a plain run
|
|
100
|
+
* of content, or — when `onClick` is given — a real `<button>` wrapping that
|
|
101
|
+
* content, plus a second button for `onDelete`. Both are reachable by keyboard,
|
|
102
|
+
* and neither is nested inside the other.
|
|
103
|
+
*
|
|
104
|
+
* An inert `<span>` carrying a click handler is the single most common way a
|
|
105
|
+
* component library loses its keyboard users, and a `<button>` inside a
|
|
106
|
+
* `<button>` is the most common way it invents a chip that Chrome silently
|
|
107
|
+
* rewrites. This shape is what avoids both.
|
|
108
|
+
*/
|
|
109
|
+
export const PlChip = /* @__PURE__ */ React.forwardRef(function PlChip({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, startIcon, endIcon, count, onDelete, deleteLabel = 'Remove', selected = false, disabled = false, className, style, children, onClick, ...props }, ref) {
|
|
110
|
+
const interactive = Boolean(onClick) && !disabled;
|
|
111
|
+
const step = chipScale[size];
|
|
112
|
+
const padX = paddingXClasses[density][step];
|
|
113
|
+
const shellClasses = [
|
|
114
|
+
baseClasses,
|
|
115
|
+
controlHeightClasses[step],
|
|
116
|
+
controlTextClasses[step],
|
|
117
|
+
gapClasses[step],
|
|
118
|
+
radiusClasses[step],
|
|
119
|
+
// An if/else rather than stacked variants: two Tailwind classes of equal
|
|
120
|
+
// specificity resolve by their order in the generated stylesheet.
|
|
121
|
+
disabled ? disabledClasses[variant] : restClasses[variant],
|
|
122
|
+
!disabled && selected ? selectedClasses[variant] : '',
|
|
123
|
+
interactive ? hoverClasses[variant] : '',
|
|
124
|
+
// With a pressable label the padding belongs to the button, so its hit area
|
|
125
|
+
// covers the whole chip rather than just the words.
|
|
126
|
+
interactive ? 'ps-0' : padX,
|
|
127
|
+
// The delete button brings its own padding; stacking the chip's on top of it
|
|
128
|
+
// would leave the × floating in the middle of a gap.
|
|
129
|
+
onDelete ? 'pe-1' : interactive ? 'pe-0' : '',
|
|
130
|
+
className ?? ''
|
|
131
|
+
]
|
|
132
|
+
.filter(Boolean)
|
|
133
|
+
.join(' ');
|
|
134
|
+
const label = (_jsxs(_Fragment, { children: [startIcon, hasContent(children) ? _jsx("span", { className: "min-w-0 truncate", children: children }) : null, endIcon, hasContent(count) ? (_jsx("span", { className: [
|
|
135
|
+
'ms-0.5 inline-flex shrink-0 items-center justify-center rounded-full px-1.5 py-px',
|
|
136
|
+
'text-[0.85em] leading-none font-semibold tabular-nums',
|
|
137
|
+
// On a filled chip the plate is light let through the fill; on a
|
|
138
|
+
// tinted or a bare one it is the accent showing under the words.
|
|
139
|
+
variant === 'solid'
|
|
140
|
+
? 'bg-(--plass-glow-on-fill) text-(--p-on-solid)'
|
|
141
|
+
: 'bg-(--p-soft-press) text-(--p-accent)'
|
|
142
|
+
].join(' '), children: count })) : null] }));
|
|
143
|
+
return (_jsxs("span", { ref: ref, className: shellClasses, style: { ...controlSlots(color, elevation, variant), ...style }, "aria-disabled": disabled && !interactive ? true : undefined, ...props, children: [interactive ? (_jsx("button", { type: "button", "aria-pressed": selected, className: `${labelButtonClasses} ${gapClasses[step]} ${padX}`, onClick: onClick, children: label })) : (label), onDelete ? (_jsx("button", { type: "button", "aria-label": deleteLabel, disabled: disabled, className: chipRemoveClasses, onClick: onDelete, children: _jsx(CloseIcon, {}) })) : null] }));
|
|
144
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlChip } from './PlChip.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
export interface PlCollapsibleProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'onChange'> {
|
|
4
|
+
/**
|
|
5
|
+
* Drop shadow depth. `0` is the default — a fold is part of the page it is set
|
|
6
|
+
* into, not a panel floating over it.
|
|
7
|
+
* @default 0
|
|
8
|
+
*/
|
|
9
|
+
elevation?: PlassElevation;
|
|
10
|
+
/** Whether the panel is showing. Use with `onOpenChange` for a controlled fold. */
|
|
11
|
+
open?: boolean;
|
|
12
|
+
/** Where an uncontrolled fold starts. @default false */
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
/** The heading on the trigger. */
|
|
16
|
+
title?: React.ReactNode;
|
|
17
|
+
/** A second line under the title, one step down the type scale and muted. */
|
|
18
|
+
subtitle?: React.ReactNode;
|
|
19
|
+
/** Content before the title — an icon, a status dot, a count. */
|
|
20
|
+
startIcon?: React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* A control pinned to the end of the header, outside the trigger.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately outside it: a header that both folds and holds a switch has
|
|
25
|
+
* two things to press, and one of them cannot be nested inside the other —
|
|
26
|
+
* the browser rewrites a `<button>` inside a `<button>` on parse. The same
|
|
27
|
+
* shape `PlAccordionItem` uses.
|
|
28
|
+
*/
|
|
29
|
+
action?: React.ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Replaces the header entirely with a control of your own — a `PlButton`, a
|
|
32
|
+
* `PlChip`, a line of text you made pressable.
|
|
33
|
+
*
|
|
34
|
+
* The element you pass *becomes* the trigger: it is handed the click handler,
|
|
35
|
+
* `aria-expanded` and the `aria-controls` pointing at the panel, so nothing
|
|
36
|
+
* has to be wired up. `title` and the slots around it are for the far commoner
|
|
37
|
+
* case of wanting the header that is already there.
|
|
38
|
+
*/
|
|
39
|
+
trigger?: React.ReactElement;
|
|
40
|
+
/** The chevron at the end of the header, turned to report the state. @default true */
|
|
41
|
+
indicator?: boolean;
|
|
42
|
+
/** Unavailable. The trigger stops answering and the panel stays as it is. */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Inner padding around the panel's content. Turn it off for something that
|
|
46
|
+
* should reach the edges — a table, a picture, a list of its own.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
padded?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Keeps a closed panel in the DOM so the browser's own page search can find
|
|
52
|
+
* and open it. Overrides `keepMounted`.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
hiddenUntilFound?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Keeps a closed panel in the DOM. For content that is expensive to build, or
|
|
58
|
+
* that holds form state which should survive being folded away.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
keepMounted?: boolean;
|
|
62
|
+
/** The body. */
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One section that folds, standing on its own.
|
|
67
|
+
*
|
|
68
|
+
* A `PlAccordion` is a *set* of these and owns which one of them is open; this
|
|
69
|
+
* is the same fold with nothing else beside it, so what it needs is an `open` of
|
|
70
|
+
* its own rather than a place in somebody's list. Reach for it for a "Show more"
|
|
71
|
+
* on a form, an optional block of settings, the details under a row.
|
|
72
|
+
*
|
|
73
|
+
* Base UI owns the parts that are genuinely hard: the `button` / panel pairing
|
|
74
|
+
* and the `aria-controls` / `aria-expanded` wiring between them,
|
|
75
|
+
* `hidden="until-found"`, and measuring the panel so it has a height to animate
|
|
76
|
+
* from.
|
|
77
|
+
*
|
|
78
|
+
* The panel's height *is* animated, which looks like an exception to the rule
|
|
79
|
+
* against moving things and is not: nothing is transformed, no text is
|
|
80
|
+
* resampled, and the content does not shift relative to the panel it is in — the
|
|
81
|
+
* panel is a window opening onto it. Content that appears instantly is a page
|
|
82
|
+
* that jumps, which is the failure the rule exists to prevent.
|
|
83
|
+
*/
|
|
84
|
+
export declare const PlCollapsible: React.ForwardRefExoticComponent<PlCollapsibleProps & React.RefAttributes<HTMLDivElement>>;
|