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,58 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { iconSizeClasses } from '../../internal/styles.js';
|
|
4
|
+
/**
|
|
5
|
+
* The same five lengths as `iconSizeClasses`, as a font size.
|
|
6
|
+
*
|
|
7
|
+
* Written out rather than inherited: an icon set hands back an `<svg>` sized in
|
|
8
|
+
* `em` about as often as one sized in `px`, and the only way both come out right
|
|
9
|
+
* is for the box's own font size to *be* the box. `text-[length:inherit]` would
|
|
10
|
+
* take the surrounding paragraph's, which is the one size the box deliberately
|
|
11
|
+
* is not.
|
|
12
|
+
*/
|
|
13
|
+
const glyphFontClasses = {
|
|
14
|
+
xs: 'text-[0.875rem]',
|
|
15
|
+
sm: 'text-[1rem]',
|
|
16
|
+
md: 'text-[1.25rem]',
|
|
17
|
+
lg: 'text-[1.5rem]',
|
|
18
|
+
xl: 'text-[1.75rem]'
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A glyph at a known size, in a known colour.
|
|
22
|
+
*
|
|
23
|
+
* The library draws no icons of its own beyond the handful its components need —
|
|
24
|
+
* an icon set is a decision that belongs to the app, not to the component
|
|
25
|
+
* library it installs. What this does is give whatever icon the app chose the
|
|
26
|
+
* same two axes everything else here has.
|
|
27
|
+
*
|
|
28
|
+
* The box is `inline-flex` with the glyph told to fill it, and `font-size` is
|
|
29
|
+
* set to the same length — so an `<svg>` with its own `width`, an `<svg>` sized
|
|
30
|
+
* in `em`, and a bare character all come out the same size. That is the whole
|
|
31
|
+
* component: a box, a length written twice, and a colour.
|
|
32
|
+
*
|
|
33
|
+
* There is no `variant` and no `elevation`. An icon is not a surface: it is ink,
|
|
34
|
+
* and the only thing the design language has to say about ink is which family it
|
|
35
|
+
* is drawn in.
|
|
36
|
+
*/
|
|
37
|
+
export const PlIcon = /* @__PURE__ */ React.forwardRef(function PlIcon({ icon, size = 'md', color = 'inherit', label, className, style, ...props }, ref) {
|
|
38
|
+
const classNames = [
|
|
39
|
+
'inline-flex shrink-0 items-center justify-center align-middle',
|
|
40
|
+
iconSizeClasses[size],
|
|
41
|
+
// The glyph fills the box however it was authored. `[font-size:100%]` on the
|
|
42
|
+
// box itself would be a no-op; what makes an em-sized drawing come out right
|
|
43
|
+
// is the box being an em, which `size-*` and this pair together arrange.
|
|
44
|
+
'[&>svg]:block [&>svg]:size-full [&>img]:block [&>img]:size-full',
|
|
45
|
+
`leading-none ${glyphFontClasses[size]}`,
|
|
46
|
+
color === 'inherit' ? '' : 'text-(--p-accent)',
|
|
47
|
+
className ?? ''
|
|
48
|
+
]
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join(' ');
|
|
51
|
+
return (_jsx("span", { ref: ref, className: classNames, style: (color === 'inherit'
|
|
52
|
+
? style
|
|
53
|
+
: { '--p-accent': `var(--plass-${color}-accent)`, ...style }),
|
|
54
|
+
// An icon with something to say is an `img` with a name; one without is
|
|
55
|
+
// furniture. There is no third case, and `role="img"` on a decorative glyph
|
|
56
|
+
// is the most common way a screen reader ends up saying "graphic".
|
|
57
|
+
role: label ? 'img' : undefined, "aria-label": label, "aria-hidden": label ? undefined : true, ...props, children: icon }));
|
|
58
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlIcon } from './PlIcon.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlButtonProps } from '../button/PlButton.js';
|
|
3
|
+
export interface PlIconButtonProps extends Omit<PlButtonProps, 'children' | 'startIcon' | 'endIcon'> {
|
|
4
|
+
/**
|
|
5
|
+
* The glyph. Wrap it in a `PlIcon` when it needs a size of its own; passed
|
|
6
|
+
* bare it is sized in `em` against the button, exactly as a `startIcon` is.
|
|
7
|
+
*/
|
|
8
|
+
icon: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* What the button does, in words.
|
|
11
|
+
*
|
|
12
|
+
* Required, and the one prop here that is. A button whose whole label is a
|
|
13
|
+
* drawing has no accessible name at all, and "an icon button with no
|
|
14
|
+
* `aria-label`" is the single most common accessibility defect a component
|
|
15
|
+
* library ships. Making it required is the only fix that survives review.
|
|
16
|
+
*/
|
|
17
|
+
label: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A round button with a glyph in it and nothing else.
|
|
21
|
+
*
|
|
22
|
+
* A `PlButton` with an icon and no children already goes square — the same
|
|
23
|
+
* height, the same width, the house fillet cut off it. This is the other shape:
|
|
24
|
+
* a disc.
|
|
25
|
+
*
|
|
26
|
+
* That disc is a deliberate exception to the radius rule, which holds every
|
|
27
|
+
* corner well short of the 50% that would make a control a pill, because the
|
|
28
|
+
* flat run along the top and bottom edge is what still reads as a sheet with its
|
|
29
|
+
* corners cut. The rule is about *labelled* controls: the flat run is there for
|
|
30
|
+
* the line of text to sit on, and a glyph has no line of text. A circle with a
|
|
31
|
+
* single mark centred in it is a punched token rather than a moulded key, so it
|
|
32
|
+
* says the thing the rule exists to protect by a different route.
|
|
33
|
+
*
|
|
34
|
+
* Everything else is `PlButton`'s, unchanged and on purpose: the three
|
|
35
|
+
* materials, the elevation ladder, the pointer light, `loading`, `readOnly` and
|
|
36
|
+
* `disabled`. Two components that draw the same surface out of two copies of the
|
|
37
|
+
* same table are two components that will eventually disagree.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PlIconButton: React.ForwardRefExoticComponent<PlIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { PlButton } from '../button/PlButton.js';
|
|
4
|
+
/**
|
|
5
|
+
* A round button with a glyph in it and nothing else.
|
|
6
|
+
*
|
|
7
|
+
* A `PlButton` with an icon and no children already goes square — the same
|
|
8
|
+
* height, the same width, the house fillet cut off it. This is the other shape:
|
|
9
|
+
* a disc.
|
|
10
|
+
*
|
|
11
|
+
* That disc is a deliberate exception to the radius rule, which holds every
|
|
12
|
+
* corner well short of the 50% that would make a control a pill, because the
|
|
13
|
+
* flat run along the top and bottom edge is what still reads as a sheet with its
|
|
14
|
+
* corners cut. The rule is about *labelled* controls: the flat run is there for
|
|
15
|
+
* the line of text to sit on, and a glyph has no line of text. A circle with a
|
|
16
|
+
* single mark centred in it is a punched token rather than a moulded key, so it
|
|
17
|
+
* says the thing the rule exists to protect by a different route.
|
|
18
|
+
*
|
|
19
|
+
* Everything else is `PlButton`'s, unchanged and on purpose: the three
|
|
20
|
+
* materials, the elevation ladder, the pointer light, `loading`, `readOnly` and
|
|
21
|
+
* `disabled`. Two components that draw the same surface out of two copies of the
|
|
22
|
+
* same table are two components that will eventually disagree.
|
|
23
|
+
*/
|
|
24
|
+
export const PlIconButton = /* @__PURE__ */ React.forwardRef(function PlIconButton({ icon, label, style, ...props }, ref) {
|
|
25
|
+
return (_jsx(PlButton, { ref: ref, "aria-label": label,
|
|
26
|
+
// The icon goes in `startIcon` rather than in `children`, which is what
|
|
27
|
+
// puts PlButton on its icon-only path: square footprint, no horizontal
|
|
28
|
+
// padding, and the spinner taking the glyph's place while `loading`.
|
|
29
|
+
startIcon: icon,
|
|
30
|
+
// An inline style rather than a `rounded-full`, and for once not as a
|
|
31
|
+
// shortcut. PlButton already writes a `rounded-*` utility of its own, and
|
|
32
|
+
// two utilities setting the same property resolve by their order in the
|
|
33
|
+
// generated stylesheet — which is not something a component may depend
|
|
34
|
+
// on. An inline declaration is the one form that wins deterministically,
|
|
35
|
+
// and it still leaves the caller's own `style` free to override it below.
|
|
36
|
+
style: { borderRadius: '9999px', ...style }, ...props }));
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlIconButton } from './PlIconButton.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
4
|
+
export interface PlListProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'ul'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* Drop shadow depth. `0` is the default — a list is a sheet lying flat, not a
|
|
7
|
+
* key resting on one.
|
|
8
|
+
* @default 0
|
|
9
|
+
*/
|
|
10
|
+
elevation?: PlassElevation;
|
|
11
|
+
/**
|
|
12
|
+
* Separates the rows with a hairline instead of with space.
|
|
13
|
+
*
|
|
14
|
+
* It changes more than it sounds like: with dividers the rules have to reach
|
|
15
|
+
* both edges of the sheet, so the list gives up its inner padding and the rows
|
|
16
|
+
* give up their rounded corners. A row cannot be a floating tile and a ruled
|
|
17
|
+
* line at the same time.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
dividers?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Renders something other than a `<ul>` — `render={<ol />}` for a list where
|
|
23
|
+
* the order is the point. Base UI's own escape hatch.
|
|
24
|
+
*/
|
|
25
|
+
render?: useRender.RenderProp;
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export interface PlListItemProps extends Omit<React.ComponentPropsWithoutRef<'li'>, 'color' | 'onClick'> {
|
|
29
|
+
/**
|
|
30
|
+
* Passing it is what turns the row into a real `<button>`. It lands on that
|
|
31
|
+
* button rather than on the `<li>`, which is why the type is loosened from the
|
|
32
|
+
* list item the shell actually is.
|
|
33
|
+
*/
|
|
34
|
+
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
35
|
+
/** Content before the label — an icon, an avatar, a status dot. */
|
|
36
|
+
startIcon?: React.ReactNode;
|
|
37
|
+
/** Content after the label, inside the pressable area. */
|
|
38
|
+
endIcon?: React.ReactNode;
|
|
39
|
+
/** A second line under the label, one step down the type scale and muted. */
|
|
40
|
+
description?: React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* A control pinned to the end of the row — a switch, a menu button.
|
|
43
|
+
*
|
|
44
|
+
* Deliberately outside the pressable area: a row that both navigates and holds
|
|
45
|
+
* a toggle has two things to press, and nesting one button inside another is
|
|
46
|
+
* markup the browser rewrites on parse.
|
|
47
|
+
*/
|
|
48
|
+
action?: React.ReactNode;
|
|
49
|
+
/** Renders the row as a link. Mutually exclusive with `onClick` in practice. */
|
|
50
|
+
href?: string;
|
|
51
|
+
/** Marks the row as the chosen one — the open page, the current filter. */
|
|
52
|
+
selected?: boolean;
|
|
53
|
+
/** Unavailable. The light goes out, the same way it does everywhere else. */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** The label. */
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A stack of rows.
|
|
60
|
+
*
|
|
61
|
+
* The list is a sheet and the rows are what is on it, which is the whole reason
|
|
62
|
+
* the two are separate components: `size` and `density` are properties of the
|
|
63
|
+
* stack, not of any one line in it, and a context is what carries them down.
|
|
64
|
+
*
|
|
65
|
+
* There is no Base UI primitive under this on purpose. A list is not a composite
|
|
66
|
+
* widget — it has no roving focus, no selection model, no keyboard contract of
|
|
67
|
+
* its own. Reaching for a menu or a listbox primitive to get one would hand
|
|
68
|
+
* every consumer's plain list of links the semantics of a menu, which is the
|
|
69
|
+
* most common way a component library breaks a screen reader.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PlList: React.ForwardRefExoticComponent<PlListProps & React.RefAttributes<HTMLUListElement>>;
|
|
72
|
+
/**
|
|
73
|
+
* One row.
|
|
74
|
+
*
|
|
75
|
+
* The shell is always an `<li>`. What changes is what is inside it: a plain run
|
|
76
|
+
* of content, or — when `onClick` or `href` is given — a real `<button>` or
|
|
77
|
+
* `<a>` wrapping that content, with `action` sitting outside it as a separate
|
|
78
|
+
* control. This is the same shape a `PlChip` uses, for the same two reasons: a
|
|
79
|
+
* `<span>` carrying a click handler is invisible to a keyboard, and a
|
|
80
|
+
* `<button>` inside a `<button>` is markup the browser silently un-nests.
|
|
81
|
+
*/
|
|
82
|
+
export declare const PlListItem: React.ForwardRefExoticComponent<PlListItemProps & React.RefAttributes<HTMLLIElement>>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { focusRingClasses, gapClasses, glassClasses, hasContent, iconClasses, metaTextClasses, paddingXClasses, radiusClasses, sheetBodyClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
const ListContext = /* @__PURE__ */ React.createContext({
|
|
6
|
+
size: 'md',
|
|
7
|
+
density: 'default',
|
|
8
|
+
dividers: false
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* The three materials, said the way a *container* says them — the sheet is never
|
|
12
|
+
* dyed, exactly as on a `PlCard`. A list holds other people's content, and that
|
|
13
|
+
* content arrives with its own colours.
|
|
14
|
+
*
|
|
15
|
+
* `ghost` is the one to reach for inside a card: the card is already a sheet,
|
|
16
|
+
* and a second bordered rectangle inside it is a second rectangle.
|
|
17
|
+
*/
|
|
18
|
+
const variantClasses = {
|
|
19
|
+
solid: /* @__PURE__ */ [
|
|
20
|
+
glassClasses,
|
|
21
|
+
'text-(--plass-fg) bg-(--plass-glass-press)',
|
|
22
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
23
|
+
].join(' '),
|
|
24
|
+
glass: /* @__PURE__ */ [
|
|
25
|
+
glassClasses,
|
|
26
|
+
'border text-(--plass-fg) bg-(--plass-glass)',
|
|
27
|
+
'[border-color:var(--plass-glass-line)]',
|
|
28
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
29
|
+
].join(' '),
|
|
30
|
+
ghost: 'text-(--plass-fg) bg-transparent'
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A row's vertical padding. Its own ladder rather than a sheet's, because a row
|
|
34
|
+
* is a line of text in a stack of them and a sheet is a container: the same `md`
|
|
35
|
+
* that gives a card 20px of air would give a list of eight rows the height of a
|
|
36
|
+
* page.
|
|
37
|
+
*/
|
|
38
|
+
const rowPaddingYClasses = {
|
|
39
|
+
default: { xs: 'py-1', sm: 'py-1.5', md: 'py-2', lg: 'py-2.5', xl: 'py-3' },
|
|
40
|
+
compact: { xs: 'py-0.5', sm: 'py-0.5', md: 'py-1', lg: 'py-1.5', xl: 'py-2' }
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A row's horizontal padding: a control's, not a sheet's. The words in a row are
|
|
44
|
+
* a label on a line rather than a paragraph inside a container, and a sheet's
|
|
45
|
+
* inset would push every row's text a third of the way across a narrow list.
|
|
46
|
+
*/
|
|
47
|
+
const rowPaddingXClasses = paddingXClasses;
|
|
48
|
+
/**
|
|
49
|
+
* A row sits one step down the radius ladder from the sheet it is inside — a
|
|
50
|
+
* tile cut out of a sheet cannot have the same corner as the sheet, or the two
|
|
51
|
+
* curves fight along the edge.
|
|
52
|
+
*/
|
|
53
|
+
const rowRadiusClasses = {
|
|
54
|
+
xs: radiusClasses.xs,
|
|
55
|
+
sm: radiusClasses.xs,
|
|
56
|
+
md: radiusClasses.sm,
|
|
57
|
+
lg: radiusClasses.sm,
|
|
58
|
+
xl: radiusClasses.md
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The rule between two rows, and the rule that makes the sheet give up its
|
|
62
|
+
* padding: `>li+li` rather than a class on each item, so it holds however the
|
|
63
|
+
* caller composed the rows — through a `.map()`, through fragments, through a
|
|
64
|
+
* component of their own that renders a `PlListItem`.
|
|
65
|
+
*
|
|
66
|
+
* `--plass-divider` and not the sheet's white hairline, for the reason a
|
|
67
|
+
* checkbox's edge takes a neutral one: white light on a translucent pane is
|
|
68
|
+
* invisible the moment the list is set on something opaque. It is the same ink
|
|
69
|
+
* a PlCard is scored with and a PlTable rules its rows in, so a list on a card
|
|
70
|
+
* inside a table cell is one family of lines rather than three.
|
|
71
|
+
*/
|
|
72
|
+
const dividerClasses = '[&>li+li]:border-t [&>li+li]:[border-color:var(--plass-divider)]';
|
|
73
|
+
/**
|
|
74
|
+
* A stack of rows.
|
|
75
|
+
*
|
|
76
|
+
* The list is a sheet and the rows are what is on it, which is the whole reason
|
|
77
|
+
* the two are separate components: `size` and `density` are properties of the
|
|
78
|
+
* stack, not of any one line in it, and a context is what carries them down.
|
|
79
|
+
*
|
|
80
|
+
* There is no Base UI primitive under this on purpose. A list is not a composite
|
|
81
|
+
* widget — it has no roving focus, no selection model, no keyboard contract of
|
|
82
|
+
* its own. Reaching for a menu or a listbox primitive to get one would hand
|
|
83
|
+
* every consumer's plain list of links the semantics of a menu, which is the
|
|
84
|
+
* most common way a component library breaks a screen reader.
|
|
85
|
+
*/
|
|
86
|
+
export const PlList = /* @__PURE__ */ React.forwardRef(function PlList({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, dividers = false, render, className, style, children, ...props }, ref) {
|
|
87
|
+
const context = React.useMemo(() => ({ size, density, dividers }), [size, density, dividers]);
|
|
88
|
+
const classNames = [
|
|
89
|
+
'flex flex-col',
|
|
90
|
+
radiusClasses[size],
|
|
91
|
+
variantClasses[variant],
|
|
92
|
+
transitionClasses,
|
|
93
|
+
// Without dividers the rows are tiles and the sheet keeps a hair of padding
|
|
94
|
+
// so a hovered row does not run into the edge. With them the rules have to
|
|
95
|
+
// reach the edge, so the padding goes and the rows square off.
|
|
96
|
+
dividers ? `overflow-hidden ${dividerClasses}` : 'p-1',
|
|
97
|
+
className ?? ''
|
|
98
|
+
]
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.join(' ');
|
|
101
|
+
const element = useRender({
|
|
102
|
+
render,
|
|
103
|
+
ref,
|
|
104
|
+
props: {
|
|
105
|
+
// Tailwind's reset takes the bullets off every `<ul>`, and Safari takes
|
|
106
|
+
// the list semantics off with them. Saying `role="list"` out loud is the
|
|
107
|
+
// one-line fix, and it costs nothing when the reset is not there.
|
|
108
|
+
role: 'list',
|
|
109
|
+
className: classNames,
|
|
110
|
+
style: { ...surfaceSlots(color, elevation), ...style },
|
|
111
|
+
children,
|
|
112
|
+
...props
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return _jsx(ListContext.Provider, { value: context, children: element });
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* One row.
|
|
119
|
+
*
|
|
120
|
+
* The shell is always an `<li>`. What changes is what is inside it: a plain run
|
|
121
|
+
* of content, or — when `onClick` or `href` is given — a real `<button>` or
|
|
122
|
+
* `<a>` wrapping that content, with `action` sitting outside it as a separate
|
|
123
|
+
* control. This is the same shape a `PlChip` uses, for the same two reasons: a
|
|
124
|
+
* `<span>` carrying a click handler is invisible to a keyboard, and a
|
|
125
|
+
* `<button>` inside a `<button>` is markup the browser silently un-nests.
|
|
126
|
+
*/
|
|
127
|
+
export const PlListItem = /* @__PURE__ */ React.forwardRef(function PlListItem({ startIcon, endIcon, description, action, href, selected = false, disabled = false, className, children, onClick, ...props }, ref) {
|
|
128
|
+
const { size, density, dividers } = React.useContext(ListContext);
|
|
129
|
+
const interactive = Boolean(onClick || href) && !disabled;
|
|
130
|
+
const padX = rowPaddingXClasses[density][size];
|
|
131
|
+
const padY = rowPaddingYClasses[density][size];
|
|
132
|
+
const bodyClassNames = [
|
|
133
|
+
'flex min-w-0 flex-1 items-center text-start',
|
|
134
|
+
padX,
|
|
135
|
+
padY,
|
|
136
|
+
gapClasses[size],
|
|
137
|
+
sheetBodyClasses[size],
|
|
138
|
+
transitionClasses,
|
|
139
|
+
iconClasses,
|
|
140
|
+
// Squared off when the rows are ruled, for the reason `dividerClasses`
|
|
141
|
+
// exists: a tile and a line are two different ideas about what a row is.
|
|
142
|
+
dividers ? '' : rowRadiusClasses[size],
|
|
143
|
+
// An if/else rather than stacked variants: two Tailwind classes of equal
|
|
144
|
+
// specificity resolve by their order in the generated stylesheet.
|
|
145
|
+
disabled
|
|
146
|
+
? 'cursor-not-allowed opacity-50 saturate-[0.35]'
|
|
147
|
+
: selected
|
|
148
|
+
? 'bg-(--p-soft-press) font-medium text-(--p-accent)'
|
|
149
|
+
: '',
|
|
150
|
+
interactive ? `cursor-pointer ${focusRingClasses}` : '',
|
|
151
|
+
// Hover deepens the same tint `selected` already uses, one step down, so a
|
|
152
|
+
// hovered row and the chosen row are the same idea at two strengths.
|
|
153
|
+
interactive && !selected ? 'hover:bg-(--p-soft)' : '',
|
|
154
|
+
interactive && selected ? 'hover:bg-(--p-soft-press)' : ''
|
|
155
|
+
]
|
|
156
|
+
.filter(Boolean)
|
|
157
|
+
.join(' ');
|
|
158
|
+
const body = (_jsxs(_Fragment, { children: [hasContent(startIcon) ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)", children: startIcon })) : null, _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [hasContent(children) ? _jsx("span", { className: "truncate", children: children }) : null, hasContent(description) ? (_jsx("span", { className: `truncate text-(--plass-muted-fg) ${metaTextClasses[size]}`, children: description })) : null] }), hasContent(endIcon) ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)", children: endIcon })) : null] }));
|
|
159
|
+
return (_jsxs("li", { ref: ref, className: ['flex w-full items-center', className ?? ''].filter(Boolean).join(' '), ...props, children: [interactive && href ? (_jsx("a", { href: href, className: bodyClassNames, "aria-current": selected ? 'page' : undefined, onClick: onClick, children: body })) : interactive ? (_jsx("button", { type: "button", className: bodyClassNames, "aria-current": selected ? true : undefined, onClick: onClick, children: body })) : (_jsx("div", { className: bodyClassNames, "aria-disabled": disabled || undefined, children: body })), hasContent(action) ? (_jsx("div", { className: `flex shrink-0 items-center ${padX}`, children: action })) : null] }));
|
|
160
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlList, PlListItem } from './PlList.js';
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassColor, PlassSide, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A menu takes `size`, `color` and `density` and stops there.
|
|
5
|
+
*
|
|
6
|
+
* There is no `variant`, for the reason `PlModal` has none: the three materials
|
|
7
|
+
* answer "how much does this surface assert itself against the page", and a
|
|
8
|
+
* popup that has taken the pointer has already answered it. There is no
|
|
9
|
+
* `elevation` either — a menu genuinely floats, which is the one case the
|
|
10
|
+
* ladder exists for, so it is fixed at its top rung.
|
|
11
|
+
*/
|
|
12
|
+
interface MenuSurfaceProps extends Pick<PlassStyleProps, 'size' | 'color' | 'density'> {
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
export interface PlMenuProps extends MenuSurfaceProps {
|
|
17
|
+
/**
|
|
18
|
+
* The element that opens the menu, wired up by Base UI. Optional — a
|
|
19
|
+
* controlled menu opened from elsewhere needs no trigger of its own.
|
|
20
|
+
*/
|
|
21
|
+
trigger?: React.ReactElement;
|
|
22
|
+
/** Whether the menu is open. Use with `onOpenChange` for a controlled menu. */
|
|
23
|
+
open?: boolean;
|
|
24
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
25
|
+
defaultOpen?: boolean;
|
|
26
|
+
onOpenChange?: (open: boolean) => void;
|
|
27
|
+
/** Which edge of the trigger it hangs off. @default 'bottom' */
|
|
28
|
+
side?: PlassSide;
|
|
29
|
+
/** Where it sits along that edge. @default 'start' */
|
|
30
|
+
align?: PlassAlign;
|
|
31
|
+
/** Distance from the trigger, in pixels. @default 6 */
|
|
32
|
+
sideOffset?: number;
|
|
33
|
+
/** Whether the page behind is taken away while the menu is open. @default true */
|
|
34
|
+
modal?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Opens on hover as well as on click. For a menu bar, where crossing the row
|
|
37
|
+
* with an open menu should walk through the others rather than close them.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
openOnHover?: boolean;
|
|
41
|
+
/** Whether the arrow keys wrap from the last row back to the first. @default true */
|
|
42
|
+
loopFocus?: boolean;
|
|
43
|
+
/** Unavailable. The trigger stops opening anything. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** The rows. */
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
export interface PlContextMenuProps extends MenuSurfaceProps {
|
|
49
|
+
/** The rows, exactly as they are written inside a `PlMenu`. */
|
|
50
|
+
content: React.ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* The area that answers a right-click or a long press. Rendered inside a
|
|
53
|
+
* `<div>` of Base UI's, which is what listens for the gesture.
|
|
54
|
+
*/
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
open?: boolean;
|
|
57
|
+
defaultOpen?: boolean;
|
|
58
|
+
onOpenChange?: (open: boolean) => void;
|
|
59
|
+
/** @default true */
|
|
60
|
+
loopFocus?: boolean;
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface PlMenuItemProps {
|
|
64
|
+
/** What the row does. Not given, and not a link, the row is a label. */
|
|
65
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
66
|
+
/** Renders the row as a real `<a>`. A menu of links has to be links. */
|
|
67
|
+
href?: string;
|
|
68
|
+
/** Where the link opens — `_blank` and the rest. Ignored without `href`. */
|
|
69
|
+
target?: string;
|
|
70
|
+
/** Content before the label — an icon, a swatch, a check. */
|
|
71
|
+
startIcon?: React.ReactNode;
|
|
72
|
+
/** Content after the label, before any `shortcut`. */
|
|
73
|
+
endIcon?: React.ReactNode;
|
|
74
|
+
/**
|
|
75
|
+
* The keystroke that does the same thing, set at the end of the row and
|
|
76
|
+
* muted. Text only — the row does not bind it, the application does.
|
|
77
|
+
*/
|
|
78
|
+
shortcut?: React.ReactNode;
|
|
79
|
+
/** A second line under the label, one step down the type scale and muted. */
|
|
80
|
+
description?: React.ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Re-points the row's colour family — `danger` for the one that deletes.
|
|
83
|
+
* Defaults to the menu's own.
|
|
84
|
+
*/
|
|
85
|
+
color?: PlassColor;
|
|
86
|
+
/** Whether picking the row closes the menu. @default true */
|
|
87
|
+
closeOnClick?: boolean;
|
|
88
|
+
/** Unavailable. Still listed, and still found by typeahead. */
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
/** What typeahead matches against, when the label is not a plain string. */
|
|
91
|
+
label?: string;
|
|
92
|
+
/** The label. */
|
|
93
|
+
children?: React.ReactNode;
|
|
94
|
+
className?: string;
|
|
95
|
+
style?: React.CSSProperties;
|
|
96
|
+
}
|
|
97
|
+
export interface PlMenuSubmenuProps {
|
|
98
|
+
/** The label on the row that opens it. */
|
|
99
|
+
label?: React.ReactNode;
|
|
100
|
+
startIcon?: React.ReactNode;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
/** Which edge of the parent row it opens against. @default 'right' */
|
|
103
|
+
side?: PlassSide;
|
|
104
|
+
/** Distance from the parent menu, in pixels. @default 4 */
|
|
105
|
+
sideOffset?: number;
|
|
106
|
+
/** The nested rows. */
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
className?: string;
|
|
109
|
+
style?: React.CSSProperties;
|
|
110
|
+
}
|
|
111
|
+
export interface PlMenuGroupProps {
|
|
112
|
+
/** The heading over the group. Wired to it by Base UI. */
|
|
113
|
+
label?: React.ReactNode;
|
|
114
|
+
children?: React.ReactNode;
|
|
115
|
+
className?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface PlMenuCheckboxItemProps extends Omit<PlMenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
|
|
118
|
+
checked?: boolean;
|
|
119
|
+
defaultChecked?: boolean;
|
|
120
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
121
|
+
/**
|
|
122
|
+
* Whether ticking the row closes the menu. `false` here, against the `true` a
|
|
123
|
+
* plain row takes: a list of things to tick is a list you tick more than one
|
|
124
|
+
* of.
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
closeOnClick?: boolean;
|
|
128
|
+
}
|
|
129
|
+
export interface PlMenuRadioGroupProps {
|
|
130
|
+
value?: string | number;
|
|
131
|
+
defaultValue?: string | number;
|
|
132
|
+
onValueChange?: (value: string | number) => void;
|
|
133
|
+
disabled?: boolean;
|
|
134
|
+
children?: React.ReactNode;
|
|
135
|
+
className?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface PlMenuRadioItemProps extends Omit<PlMenuItemProps, 'href' | 'target' | 'startIcon' | 'onClick'> {
|
|
138
|
+
/** What this row sets the group to. */
|
|
139
|
+
value: string | number;
|
|
140
|
+
/** @default false */
|
|
141
|
+
closeOnClick?: boolean;
|
|
142
|
+
}
|
|
143
|
+
export type PlMenuSeparatorProps = React.ComponentPropsWithoutRef<'div'>;
|
|
144
|
+
/**
|
|
145
|
+
* One row of a menu.
|
|
146
|
+
*
|
|
147
|
+
* Renders a real `<a>` when it is given an `href` and Base UI's own item
|
|
148
|
+
* otherwise — the same split `PlListItem` makes, for the same reason. A menu of
|
|
149
|
+
* links that are not links cannot be opened in a new tab, cannot be copied, and
|
|
150
|
+
* tells a screen reader the wrong thing about every one of them.
|
|
151
|
+
*/
|
|
152
|
+
export declare function PlMenuItem({ onClick, href, target, startIcon, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: PlMenuItemProps): React.JSX.Element;
|
|
153
|
+
/** A row that ticks. The tick lands in the same slot a `startIcon` would. */
|
|
154
|
+
export declare function PlMenuCheckboxItem({ checked, defaultChecked, onCheckedChange, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: PlMenuCheckboxItemProps): React.JSX.Element;
|
|
155
|
+
/** One choice out of a set. Wraps the rows that make up the set. */
|
|
156
|
+
export declare function PlMenuRadioGroup({ value, defaultValue, onValueChange, disabled, children, className }: PlMenuRadioGroupProps): React.JSX.Element;
|
|
157
|
+
/**
|
|
158
|
+
* A row inside a `PlMenuRadioGroup`.
|
|
159
|
+
*
|
|
160
|
+
* Marked with a dot rather than a tick, which is the same distinction
|
|
161
|
+
* `PlCheckbox` and `PlRadioGroup` make everywhere else: a tick says "and", a dot
|
|
162
|
+
* says "instead of".
|
|
163
|
+
*/
|
|
164
|
+
export declare function PlMenuRadioItem({ value, endIcon, shortcut, description, color, closeOnClick, disabled, label, children, className, style }: PlMenuRadioItemProps): React.JSX.Element;
|
|
165
|
+
/** A named run of rows. The label is a heading, not a row — it cannot be picked. */
|
|
166
|
+
export declare function PlMenuGroup({ label, children, className }: PlMenuGroupProps): React.JSX.Element;
|
|
167
|
+
/** The hairline between two runs of rows. */
|
|
168
|
+
export declare function PlMenuSeparator({ className, ...props }: PlMenuSeparatorProps): React.JSX.Element;
|
|
169
|
+
/**
|
|
170
|
+
* A menu inside a menu.
|
|
171
|
+
*
|
|
172
|
+
* The row that opens it is the same row every other item is, wearing a chevron —
|
|
173
|
+
* and it opens on hover, on <kbd>Enter</kbd> and on the arrow key that points at
|
|
174
|
+
* it, all of which is Base UI's. What is here is the surface and the glyph.
|
|
175
|
+
*
|
|
176
|
+
* Nesting is unlimited: a `PlMenuSubmenu` renders its children inside a popup
|
|
177
|
+
* that is itself a menu, so a submenu of a submenu needs no different component.
|
|
178
|
+
*/
|
|
179
|
+
export declare function PlMenuSubmenu({ label, startIcon, disabled, side, sideOffset, children, className, style }: PlMenuSubmenuProps): React.JSX.Element;
|
|
180
|
+
/**
|
|
181
|
+
* A list of actions that appears when something is pressed.
|
|
182
|
+
*
|
|
183
|
+
* Everything that makes a menu a menu rather than a floating list of `<div>`s is
|
|
184
|
+
* Base UI's: roving focus with the arrow keys, <kbd>Home</kbd> and
|
|
185
|
+
* <kbd>End</kbd>, typeahead, <kbd>Esc</kbd>, closing on an outside click,
|
|
186
|
+
* restoring focus to the trigger, submenus opening on hover with the safe
|
|
187
|
+
* triangle so a diagonal reach does not close them, and the `menu` / `menuitem`
|
|
188
|
+
* roles that make any of it mean something to a screen reader. What is here is
|
|
189
|
+
* the surface, the ladders and the row layout.
|
|
190
|
+
*
|
|
191
|
+
* The rows are **composed rather than passed as data** — the opposite of
|
|
192
|
+
* `PlSelect`, and deliberately. A select's options are values from a list a
|
|
193
|
+
* caller already has; a menu's rows are *code*, each one a different handler, a
|
|
194
|
+
* different icon, sometimes a submenu. Data would mean an `items` type with a
|
|
195
|
+
* variant for every shape a row can take, which is a component tree spelled as a
|
|
196
|
+
* discriminated union.
|
|
197
|
+
*/
|
|
198
|
+
export declare function PlMenu({ size, color, density, trigger, open, defaultOpen, onOpenChange, side, align, sideOffset, modal, openOnHover, loopFocus, disabled, className, style, children }: PlMenuProps): React.JSX.Element;
|
|
199
|
+
/**
|
|
200
|
+
* The same menu, opened by a right-click or a long press instead of by a button.
|
|
201
|
+
*
|
|
202
|
+
* It takes the rows as `content` and the area as `children`, which is
|
|
203
|
+
* `PlTooltip`'s shape rather than `PlMenu`'s — because here the trigger is not
|
|
204
|
+
* one element you hand over, it is a region of the page, and the region is the
|
|
205
|
+
* thing being wrapped. Base UI positions the popup at the pointer rather than
|
|
206
|
+
* against an anchor, and the long press is what makes it reachable on a touch
|
|
207
|
+
* screen at all.
|
|
208
|
+
*/
|
|
209
|
+
export declare function PlContextMenu({ size, color, density, content, children, open, defaultOpen, onOpenChange, loopFocus, disabled, className, style }: PlContextMenuProps): React.JSX.Element;
|
|
210
|
+
export {};
|