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,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Tooltip as BaseUITooltip } from '@base-ui/react/tooltip';
|
|
3
|
+
import type { PlassAlign, PlassSide, PlassStyleProps } from '../../types.js';
|
|
4
|
+
export interface PlTooltipProps extends Pick<PlassStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'content' | 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* What the tooltip says.
|
|
7
|
+
*
|
|
8
|
+
* A short phrase. A tooltip is not a container — it cannot be reached by a
|
|
9
|
+
* pointer on a touch screen, it disappears the moment attention moves, and
|
|
10
|
+
* anything inside it that could be clicked cannot be. Content that needs
|
|
11
|
+
* either of those belongs in a sheet that stays put.
|
|
12
|
+
*/
|
|
13
|
+
content: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* The element the tooltip hangs off. Exactly one element, which must accept a
|
|
16
|
+
* ref and spread props — every Plass component does.
|
|
17
|
+
*/
|
|
18
|
+
children: React.ReactElement;
|
|
19
|
+
/**
|
|
20
|
+
* Which edge of the trigger it appears on. May flip to the opposite side when
|
|
21
|
+
* there is no room, which is Base UI's doing and is the right behaviour.
|
|
22
|
+
* @default 'top'
|
|
23
|
+
*/
|
|
24
|
+
side?: PlassSide;
|
|
25
|
+
/**
|
|
26
|
+
* Where it sits along that edge.
|
|
27
|
+
* @default 'center'
|
|
28
|
+
*/
|
|
29
|
+
align?: PlassAlign;
|
|
30
|
+
/**
|
|
31
|
+
* Distance from the trigger, in pixels.
|
|
32
|
+
* @default 6
|
|
33
|
+
*/
|
|
34
|
+
sideOffset?: number;
|
|
35
|
+
/**
|
|
36
|
+
* How long the pointer has to rest before it opens, in milliseconds.
|
|
37
|
+
* @default 600
|
|
38
|
+
*/
|
|
39
|
+
delay?: number;
|
|
40
|
+
/**
|
|
41
|
+
* How long it waits before closing once the pointer leaves.
|
|
42
|
+
* @default 0
|
|
43
|
+
*/
|
|
44
|
+
closeDelay?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Draws the little wedge pointing at the trigger.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
arrow?: boolean;
|
|
50
|
+
/** Whether the tooltip is open. Use with `onOpenChange` for a controlled one. */
|
|
51
|
+
open?: boolean;
|
|
52
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
53
|
+
defaultOpen?: boolean;
|
|
54
|
+
onOpenChange?: (open: boolean) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Stops the tooltip from opening at all, without disabling the trigger. For
|
|
57
|
+
* the tooltip that only exists while a label is truncated.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Shares one delay across a group of tooltips: once any of them has opened, its
|
|
64
|
+
* neighbours open instantly, and the wait comes back after a pause.
|
|
65
|
+
*
|
|
66
|
+
* Worth wrapping a toolbar in. Without it, moving along a row of icon buttons
|
|
67
|
+
* means waiting out the full delay at every stop, which is what makes tooltips
|
|
68
|
+
* feel like they are fighting the pointer.
|
|
69
|
+
*/
|
|
70
|
+
export declare const PlTooltipProvider: React.FC<import("@base-ui/react").TooltipProviderProps>;
|
|
71
|
+
export type PlTooltipProviderProps = React.ComponentProps<typeof BaseUITooltip.Provider>;
|
|
72
|
+
/**
|
|
73
|
+
* A short label that appears when the pointer rests on something.
|
|
74
|
+
*
|
|
75
|
+
* The whole component is a wrapper:
|
|
76
|
+
* `<PlTooltip content="Copy"><PlButton …/></PlTooltip>`. Base UI's Trigger
|
|
77
|
+
* merges itself onto the child rather than rendering a box of its own, so the
|
|
78
|
+
* tooltip adds no element to the layout and the child stays whatever it was — a
|
|
79
|
+
* button, a chip, a truncated cell.
|
|
80
|
+
*
|
|
81
|
+
* Base UI owns the parts that are genuinely hard: the delay and the group
|
|
82
|
+
* timeout, opening on focus but not on a focus that came from a click, closing
|
|
83
|
+
* on Escape, and keeping the popup off the edges of the window.
|
|
84
|
+
*
|
|
85
|
+
* The one thing it deliberately leaves open is the part that makes a tooltip
|
|
86
|
+
* mean anything to a screen reader — `role="tooltip"` on the plate and an
|
|
87
|
+
* `aria-describedby` pointing at it from the trigger — because a popup can be
|
|
88
|
+
* many things and only the caller knows which. Here it is always a tooltip, so
|
|
89
|
+
* this component wires both, and drops the reference while it is closed rather
|
|
90
|
+
* than pointing at an element that is not in the document.
|
|
91
|
+
*/
|
|
92
|
+
export declare function PlTooltip({ content, children, size, color, density, side, align, sideOffset, delay, closeDelay, arrow, open, defaultOpen, onOpenChange, disabled, className, style, ...props }: PlTooltipProps): React.JSX.Element;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Tooltip as BaseUITooltip } from '@base-ui/react/tooltip';
|
|
4
|
+
import { glassClasses, metaTextClasses, paddingXClasses, radiusClasses, surfaceSlots } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* Shares one delay across a group of tooltips: once any of them has opened, its
|
|
7
|
+
* neighbours open instantly, and the wait comes back after a pause.
|
|
8
|
+
*
|
|
9
|
+
* Worth wrapping a toolbar in. Without it, moving along a row of icon buttons
|
|
10
|
+
* means waiting out the full delay at every stop, which is what makes tooltips
|
|
11
|
+
* feel like they are fighting the pointer.
|
|
12
|
+
*/
|
|
13
|
+
export const PlTooltipProvider = BaseUITooltip.Provider;
|
|
14
|
+
/**
|
|
15
|
+
* The plate, and it is the same floating sheet a `PlSelect`'s popup is: the
|
|
16
|
+
* glass at its most opaque, a white hairline round it, shadow 3 under it.
|
|
17
|
+
*
|
|
18
|
+
* Not a filled key, which is what most libraries draw a tooltip as. A tooltip is
|
|
19
|
+
* a note *about* something rather than a thing to press, and the library already
|
|
20
|
+
* has one answer for a surface that floats over arbitrary content — inventing a
|
|
21
|
+
* second would put two kinds of floating sheet on the same screen.
|
|
22
|
+
*
|
|
23
|
+
* `--plass-glass-press` is what makes that safe: at its most opaque the sheet is
|
|
24
|
+
* dense enough to read a line of text off, which the 62% pane is not.
|
|
25
|
+
*/
|
|
26
|
+
const popupClasses = /* @__PURE__ */ [
|
|
27
|
+
glassClasses,
|
|
28
|
+
'max-w-64 border text-(--plass-fg) bg-(--plass-glass-press)',
|
|
29
|
+
'[border-color:var(--plass-glass-line)]',
|
|
30
|
+
'[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]',
|
|
31
|
+
'[outline:none]',
|
|
32
|
+
// Opacity only, and fast: a tooltip that slides in has moved its own text
|
|
33
|
+
// while the reader was already looking at it.
|
|
34
|
+
'[transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
35
|
+
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0',
|
|
36
|
+
// Base UI sets this while the pointer is moving between grouped tooltips.
|
|
37
|
+
// Fading in a tooltip that is meant to appear instantly is worse than not
|
|
38
|
+
// fading at all — it reads as lag.
|
|
39
|
+
'data-[instant]:[transition-duration:0ms]'
|
|
40
|
+
].join(' ');
|
|
41
|
+
/** A row's vertical padding, against the horizontal track `paddingXClasses` sets. */
|
|
42
|
+
const paddingYClasses = {
|
|
43
|
+
xs: 'py-0.5',
|
|
44
|
+
sm: 'py-0.5',
|
|
45
|
+
md: 'py-1',
|
|
46
|
+
lg: 'py-1.5',
|
|
47
|
+
xl: 'py-2'
|
|
48
|
+
};
|
|
49
|
+
/** The wedge, at roughly a third of the plate's corner radius per step. */
|
|
50
|
+
const arrowSizes = {
|
|
51
|
+
xs: 6,
|
|
52
|
+
sm: 7,
|
|
53
|
+
md: 8,
|
|
54
|
+
lg: 9,
|
|
55
|
+
xl: 10
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* A short label that appears when the pointer rests on something.
|
|
59
|
+
*
|
|
60
|
+
* The whole component is a wrapper:
|
|
61
|
+
* `<PlTooltip content="Copy"><PlButton …/></PlTooltip>`. Base UI's Trigger
|
|
62
|
+
* merges itself onto the child rather than rendering a box of its own, so the
|
|
63
|
+
* tooltip adds no element to the layout and the child stays whatever it was — a
|
|
64
|
+
* button, a chip, a truncated cell.
|
|
65
|
+
*
|
|
66
|
+
* Base UI owns the parts that are genuinely hard: the delay and the group
|
|
67
|
+
* timeout, opening on focus but not on a focus that came from a click, closing
|
|
68
|
+
* on Escape, and keeping the popup off the edges of the window.
|
|
69
|
+
*
|
|
70
|
+
* The one thing it deliberately leaves open is the part that makes a tooltip
|
|
71
|
+
* mean anything to a screen reader — `role="tooltip"` on the plate and an
|
|
72
|
+
* `aria-describedby` pointing at it from the trigger — because a popup can be
|
|
73
|
+
* many things and only the caller knows which. Here it is always a tooltip, so
|
|
74
|
+
* this component wires both, and drops the reference while it is closed rather
|
|
75
|
+
* than pointing at an element that is not in the document.
|
|
76
|
+
*/
|
|
77
|
+
export function PlTooltip({ content, children, size = 'sm',
|
|
78
|
+
// A tooltip is a note about something else, never the thing itself, so the
|
|
79
|
+
// neutral family is the honest default. A red tooltip on a delete button would
|
|
80
|
+
// be saying something the tooltip does not know.
|
|
81
|
+
color = 'secondary', density = 'default', side = 'top', align = 'center', sideOffset = 6, delay, closeDelay, arrow = true, open, defaultOpen, onOpenChange, disabled = false, className, style, ...props }) {
|
|
82
|
+
const arrowSize = arrowSizes[size];
|
|
83
|
+
const popupId = React.useId();
|
|
84
|
+
// Mirrored rather than owned: `open` still drives a controlled tooltip and
|
|
85
|
+
// Base UI still drives an uncontrolled one. This copy exists only so the
|
|
86
|
+
// trigger knows whether the plate it describes is on the page yet.
|
|
87
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);
|
|
88
|
+
const isOpen = open ?? uncontrolledOpen;
|
|
89
|
+
return (_jsxs(BaseUITooltip.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: (next) => {
|
|
90
|
+
setUncontrolledOpen(next);
|
|
91
|
+
onOpenChange?.(next);
|
|
92
|
+
}, children: [_jsx(BaseUITooltip.Trigger, { render: children, delay: delay, closeDelay: closeDelay, disabled: disabled, "aria-describedby": isOpen ? popupId : undefined }), _jsx(BaseUITooltip.Portal, { children: _jsx(BaseUITooltip.Positioner, { className: "plass-portal z-50 [outline:none]", side: side, align: align, sideOffset: sideOffset, children: _jsxs(BaseUITooltip.Popup, { id: popupId, role: "tooltip", className: [
|
|
93
|
+
popupClasses,
|
|
94
|
+
radiusClasses[size],
|
|
95
|
+
paddingXClasses[density][size],
|
|
96
|
+
paddingYClasses[size],
|
|
97
|
+
metaTextClasses[size],
|
|
98
|
+
className ?? ''
|
|
99
|
+
]
|
|
100
|
+
.filter(Boolean)
|
|
101
|
+
.join(' '), style: { ...surfaceSlots(color, 3), ...style }, ...props, children: [arrow ? (_jsx(BaseUITooltip.Arrow
|
|
102
|
+
// Base UI positions the arrow and reports which side it ended up
|
|
103
|
+
// on. The wedge is drawn pointing down and turned to match — a
|
|
104
|
+
// rotation of a glyph, which is the same allowance the chevron
|
|
105
|
+
// takes. Nothing with text in it moves.
|
|
106
|
+
, {
|
|
107
|
+
// Base UI positions the arrow and reports which side it ended up
|
|
108
|
+
// on. The wedge is drawn pointing down and turned to match — a
|
|
109
|
+
// rotation of a glyph, which is the same allowance the chevron
|
|
110
|
+
// takes. Nothing with text in it moves.
|
|
111
|
+
className: [
|
|
112
|
+
'data-[side=top]:bottom-[-1px]',
|
|
113
|
+
'data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180',
|
|
114
|
+
'data-[side=left]:right-[-1px] data-[side=left]:-rotate-90',
|
|
115
|
+
'data-[side=right]:left-[-1px] data-[side=right]:rotate-90'
|
|
116
|
+
].join(' '), children: _jsxs("svg", { width: arrowSize, height: arrowSize / 2, viewBox: "0 0 10 5", "aria-hidden": "true", className: "block", children: [_jsx("path", { d: "M0 0h10L5 5z", fill: "var(--plass-glass-line)" }), _jsx("path", { d: "M0 0h10L5 5z", fill: "var(--plass-glass-press)", transform: "translate(0 -1)" })] }) })) : null, content] }) }) })] }));
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlTooltip, PlTooltipProvider } from './PlTooltip.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassColor } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* What a piece of text *is*, which decides both its type scale and the element
|
|
6
|
+
* it renders as.
|
|
7
|
+
*
|
|
8
|
+
* This is deliberately not called `variant`. In this library `variant` names
|
|
9
|
+
* what a surface is made of — `solid` / `glass` / `ghost` — and a second meaning
|
|
10
|
+
* for the same word is exactly what the prop conventions forbid.
|
|
11
|
+
*/
|
|
12
|
+
export type PlTypographyLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'body' | 'lead' | 'caption' | 'overline';
|
|
13
|
+
export type PlTypographyAlign = 'start' | 'center' | 'end' | 'justify';
|
|
14
|
+
export type PlTypographyWeight = 'regular' | 'medium' | 'semibold' | 'bold';
|
|
15
|
+
export interface PlTypographyProps extends Omit<React.ComponentPropsWithoutRef<'p'>, 'color' | 'children'> {
|
|
16
|
+
/**
|
|
17
|
+
* The type scale, and the element that carries it. `h1`–`h6` render the
|
|
18
|
+
* matching heading, `lead`/`body` a `<p>`, `caption`/`overline` a `<span>`.
|
|
19
|
+
* @default 'body'
|
|
20
|
+
*/
|
|
21
|
+
level?: PlTypographyLevel;
|
|
22
|
+
/**
|
|
23
|
+
* Semantic colour role. Unlike every other component this has **no default**:
|
|
24
|
+
* text inherits the page's own colour unless a role is asked for, because the
|
|
25
|
+
* common case for a paragraph is to look like the paragraphs around it.
|
|
26
|
+
*/
|
|
27
|
+
color?: PlassColor;
|
|
28
|
+
/** Overrides the weight the level would otherwise pick. */
|
|
29
|
+
weight?: PlTypographyWeight;
|
|
30
|
+
align?: PlTypographyAlign;
|
|
31
|
+
/**
|
|
32
|
+
* Clamps the text to this many lines with an ellipsis. `1` is a single-line
|
|
33
|
+
* truncation. Omit it and the text wraps as far as it needs to.
|
|
34
|
+
*/
|
|
35
|
+
lines?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Adds the space below that a run of prose expects. Off by default: a library
|
|
38
|
+
* component that injects margins is one a layout has to fight.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
gutter?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Renders a different element without changing the type scale — an `h2`-sized
|
|
44
|
+
* line that is semantically a `<p>`, or the other way round. Base UI's own
|
|
45
|
+
* escape hatch.
|
|
46
|
+
*/
|
|
47
|
+
render?: useRender.RenderProp;
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Text at one of the library's sizes.
|
|
52
|
+
*
|
|
53
|
+
* The type scale is the one thing in a design system that everything else is
|
|
54
|
+
* measured against, and until now it only existed inside the components that
|
|
55
|
+
* happened to need it — a card's title, a field's label. This is that ladder on
|
|
56
|
+
* its own, so a page can use it without wrapping its prose in a card.
|
|
57
|
+
*
|
|
58
|
+
* `level` sets the scale *and* the element, which is the common case. When they
|
|
59
|
+
* have to differ — a subheading that should not enter the document outline, a
|
|
60
|
+
* `<p>` that has to look like an `h3` — `render` breaks the tie.
|
|
61
|
+
*
|
|
62
|
+
* There is no `variant` and no `elevation`, and there is no `size` either.
|
|
63
|
+
* `level` is the size: a `size` prop alongside it would let a caller ask for an
|
|
64
|
+
* `h1` at `xs`, which is a heading that is not a heading.
|
|
65
|
+
*/
|
|
66
|
+
export declare const PlTypography: React.ForwardRefExoticComponent<PlTypographyProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
/**
|
|
4
|
+
* The scale.
|
|
5
|
+
*
|
|
6
|
+
* Body sits on the sheet body ladder at `md` (13px/22px), so a paragraph inside
|
|
7
|
+
* a `PlCard` and a standalone one are the same text. The headings step up from
|
|
8
|
+
* there by roughly a major third, and the leading tightens as they grow — a 30px
|
|
9
|
+
* line does not want the same 1.7 ratio a 13px one does.
|
|
10
|
+
*/
|
|
11
|
+
const levelClasses = {
|
|
12
|
+
h1: 'text-[1.875rem]/[2.25rem] tracking-[-0.02em]',
|
|
13
|
+
h2: 'text-[1.5rem]/[1.875rem] tracking-[-0.015em]',
|
|
14
|
+
h3: 'text-[1.25rem]/[1.625rem] tracking-[-0.01em]',
|
|
15
|
+
h4: 'text-[1.0625rem]/[1.5rem]',
|
|
16
|
+
h5: 'text-[0.9375rem]/[1.375rem]',
|
|
17
|
+
h6: 'text-[0.8125rem]/[1.25rem]',
|
|
18
|
+
lead: 'text-[1.0625rem]/[1.75rem]',
|
|
19
|
+
body: 'text-[0.8125rem]/[1.375rem]',
|
|
20
|
+
caption: 'text-[0.75rem]/[1.125rem]',
|
|
21
|
+
overline: 'text-[0.6875rem]/[1rem] tracking-[0.08em] uppercase'
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Weight is kept out of `levelClasses` and resolved here so that exactly one
|
|
25
|
+
* `font-*` class is ever emitted. Passing both the level's weight and an
|
|
26
|
+
* override would leave two utilities of equal specificity on the element, and
|
|
27
|
+
* which of them wins is decided by their order in the generated stylesheet —
|
|
28
|
+
* `font-semibold` beats `font-normal` there no matter which one was asked for.
|
|
29
|
+
*/
|
|
30
|
+
const levelWeights = {
|
|
31
|
+
h1: 'semibold',
|
|
32
|
+
h2: 'semibold',
|
|
33
|
+
h3: 'semibold',
|
|
34
|
+
h4: 'semibold',
|
|
35
|
+
h5: 'semibold',
|
|
36
|
+
h6: 'semibold',
|
|
37
|
+
lead: 'regular',
|
|
38
|
+
body: 'regular',
|
|
39
|
+
caption: 'regular',
|
|
40
|
+
overline: 'medium'
|
|
41
|
+
};
|
|
42
|
+
/** The element each level renders as when `render` is not given. */
|
|
43
|
+
const levelElements = {
|
|
44
|
+
h1: 'h1',
|
|
45
|
+
h2: 'h2',
|
|
46
|
+
h3: 'h3',
|
|
47
|
+
h4: 'h4',
|
|
48
|
+
h5: 'h5',
|
|
49
|
+
h6: 'h6',
|
|
50
|
+
lead: 'p',
|
|
51
|
+
body: 'p',
|
|
52
|
+
caption: 'span',
|
|
53
|
+
overline: 'span'
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The two quiet levels are muted by default. Everything else takes the page's
|
|
57
|
+
* own foreground — a heading that arrived pre-greyed is a heading a designer has
|
|
58
|
+
* to undo.
|
|
59
|
+
*/
|
|
60
|
+
const mutedLevels = new Set(['caption', 'overline']);
|
|
61
|
+
/** How much room a level leaves under itself when `gutter` is on. */
|
|
62
|
+
const gutterClasses = {
|
|
63
|
+
h1: 'mb-4',
|
|
64
|
+
h2: 'mb-3.5',
|
|
65
|
+
h3: 'mb-3',
|
|
66
|
+
h4: 'mb-2.5',
|
|
67
|
+
h5: 'mb-2',
|
|
68
|
+
h6: 'mb-2',
|
|
69
|
+
lead: 'mb-4',
|
|
70
|
+
body: 'mb-3',
|
|
71
|
+
caption: 'mb-2',
|
|
72
|
+
overline: 'mb-2'
|
|
73
|
+
};
|
|
74
|
+
const weightClasses = {
|
|
75
|
+
regular: 'font-normal',
|
|
76
|
+
medium: 'font-medium',
|
|
77
|
+
semibold: 'font-semibold',
|
|
78
|
+
bold: 'font-bold'
|
|
79
|
+
};
|
|
80
|
+
const alignClasses = {
|
|
81
|
+
start: 'text-start',
|
|
82
|
+
center: 'text-center',
|
|
83
|
+
end: 'text-end',
|
|
84
|
+
justify: 'text-justify'
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Clamping is two different mechanisms. One line is `text-overflow: ellipsis`,
|
|
88
|
+
* which keeps the text on its own baseline; more than one needs the line-clamp
|
|
89
|
+
* box, which only ellipsises because WebKit says so.
|
|
90
|
+
*/
|
|
91
|
+
const clampClasses = {
|
|
92
|
+
1: 'truncate',
|
|
93
|
+
2: 'line-clamp-2',
|
|
94
|
+
3: 'line-clamp-3',
|
|
95
|
+
4: 'line-clamp-4',
|
|
96
|
+
5: 'line-clamp-5',
|
|
97
|
+
6: 'line-clamp-6'
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Text at one of the library's sizes.
|
|
101
|
+
*
|
|
102
|
+
* The type scale is the one thing in a design system that everything else is
|
|
103
|
+
* measured against, and until now it only existed inside the components that
|
|
104
|
+
* happened to need it — a card's title, a field's label. This is that ladder on
|
|
105
|
+
* its own, so a page can use it without wrapping its prose in a card.
|
|
106
|
+
*
|
|
107
|
+
* `level` sets the scale *and* the element, which is the common case. When they
|
|
108
|
+
* have to differ — a subheading that should not enter the document outline, a
|
|
109
|
+
* `<p>` that has to look like an `h3` — `render` breaks the tie.
|
|
110
|
+
*
|
|
111
|
+
* There is no `variant` and no `elevation`, and there is no `size` either.
|
|
112
|
+
* `level` is the size: a `size` prop alongside it would let a caller ask for an
|
|
113
|
+
* `h1` at `xs`, which is a heading that is not a heading.
|
|
114
|
+
*/
|
|
115
|
+
export const PlTypography = /* @__PURE__ */ React.forwardRef(function PlTypography({ level = 'body', color, weight, align, lines, gutter = false, render, className, style, children, ...props }, ref) {
|
|
116
|
+
const classNames = [
|
|
117
|
+
levelClasses[level],
|
|
118
|
+
weightClasses[weight ?? levelWeights[level]],
|
|
119
|
+
align ? alignClasses[align] : '',
|
|
120
|
+
lines ? (clampClasses[lines] ?? 'line-clamp-6') : '',
|
|
121
|
+
gutter ? gutterClasses[level] : '',
|
|
122
|
+
color
|
|
123
|
+
? 'text-(--p-accent)'
|
|
124
|
+
: mutedLevels.has(level)
|
|
125
|
+
? 'text-(--plass-muted-fg)'
|
|
126
|
+
: 'text-(--plass-fg)',
|
|
127
|
+
className ?? ''
|
|
128
|
+
]
|
|
129
|
+
.filter(Boolean)
|
|
130
|
+
.join(' ');
|
|
131
|
+
return useRender({
|
|
132
|
+
render: render ?? React.createElement(levelElements[level]),
|
|
133
|
+
ref,
|
|
134
|
+
props: {
|
|
135
|
+
className: classNames,
|
|
136
|
+
style: (color
|
|
137
|
+
? { '--p-accent': `var(--plass-${color}-accent)`, ...style }
|
|
138
|
+
: style),
|
|
139
|
+
children,
|
|
140
|
+
...props
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlTypography } from './PlTypography.js';
|
package/dist/css/box.css
ADDED