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,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The props are a `<figure>`'s rather than a `<blockquote>`'s, which is a
|
|
5
|
+
* consequence of where the drawing happens: everything a caller passes lands on
|
|
6
|
+
* the wrapper, and the wrapper is a figure or a div. Both are `HTMLElement`, so
|
|
7
|
+
* an event handler written against one works on the other.
|
|
8
|
+
*/
|
|
9
|
+
export interface PlBlockquoteProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'figure'>, 'color'> {
|
|
10
|
+
/**
|
|
11
|
+
* Drop shadow depth. `0` is the default — a quote is set *into* a page rather
|
|
12
|
+
* than floating over it, so it is raised even less often than a `PlCard`.
|
|
13
|
+
* @default 0
|
|
14
|
+
*/
|
|
15
|
+
elevation?: PlassElevation;
|
|
16
|
+
/**
|
|
17
|
+
* Who said it. Its presence is what turns the quote into a `<figure>` with a
|
|
18
|
+
* `<figcaption>`, which is the markup the HTML spec asks for: an attribution
|
|
19
|
+
* is *about* the quote and is not part of what was said.
|
|
20
|
+
*/
|
|
21
|
+
author?: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Where it is from — a book, a talk, a page. Rendered inside a `<cite>`, which
|
|
24
|
+
* is the element for the title of a work and, per the spec, never for the name
|
|
25
|
+
* of a person. That is what `author` is.
|
|
26
|
+
*/
|
|
27
|
+
source?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* URL of the document the quote was taken from. Lands on the `<blockquote>`'s
|
|
30
|
+
* own `cite` attribute, which is machine-readable and shown to nobody — use
|
|
31
|
+
* `source` for the part a reader should see.
|
|
32
|
+
*/
|
|
33
|
+
cite?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The mark drawn before the quote. Omit it for the house glyph, pass a node to
|
|
36
|
+
* replace it, pass `false` to take it away — the same three-way spelling
|
|
37
|
+
* `PlAlert` uses for the same idea.
|
|
38
|
+
*/
|
|
39
|
+
icon?: React.ReactNode | false;
|
|
40
|
+
/** What was said. */
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Somebody else's words, set apart from your own.
|
|
45
|
+
*
|
|
46
|
+
* There is no Base UI primitive under this and there should not be: a quote has
|
|
47
|
+
* no state, no keyboard contract and nothing to interact with. What it has is
|
|
48
|
+
* markup that is easy to get wrong, and getting it right is most of the point.
|
|
49
|
+
*
|
|
50
|
+
* **Nothing is drawn on the `<blockquote>` itself.** The surface, the rule and
|
|
51
|
+
* the padding all belong to the element around it, and that is not tidiness —
|
|
52
|
+
* `blockquote` is one of the handful of tags a host stylesheet still styles by
|
|
53
|
+
* name. VitePress's `.vp-doc blockquote` sets a grey `border-left`, a
|
|
54
|
+
* `padding-left` and a `color`, all at a specificity a one-class utility cannot
|
|
55
|
+
* outrank, so a rule drawn on the quote itself would silently come out grey and
|
|
56
|
+
* a pixel too thin. Moving the drawing onto a wrapper is what lets the docs undo
|
|
57
|
+
* VitePress's version without also undoing this one.
|
|
58
|
+
*
|
|
59
|
+
* The wrapper is a `<figure>` when there is an attribution and a `<div>` when
|
|
60
|
+
* there is not, because the HTML spec is explicit that the attribution goes
|
|
61
|
+
* *outside* the blockquote — a name inside it claims the speaker said their own
|
|
62
|
+
* name — and a `<figure>` with no `<figcaption>` in it is a figure of nothing.
|
|
63
|
+
*/
|
|
64
|
+
export declare const PlBlockquote: React.ForwardRefExoticComponent<PlBlockquoteProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { glassClasses, hasContent, metaTextClasses, radiusClasses, sheetPaddingXClasses, sheetPaddingYClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
4
|
+
/**
|
|
5
|
+
* The quote itself, one step above body copy with the leading opened up.
|
|
6
|
+
*
|
|
7
|
+
* The sizes are `sheetTitleClasses`', because a quote is set at a heading's
|
|
8
|
+
* scale — but the leading is not: a title is a line or two and a quote is a
|
|
9
|
+
* paragraph somebody has to read, so it gets the air a paragraph needs.
|
|
10
|
+
*/
|
|
11
|
+
const quoteTextClasses = {
|
|
12
|
+
xs: 'text-[0.75rem]/[1.25rem]',
|
|
13
|
+
sm: 'text-[0.8125rem]/[1.375rem]',
|
|
14
|
+
md: 'text-[0.9375rem]/[1.625rem]',
|
|
15
|
+
lg: 'text-[1.0625rem]/[1.875rem]',
|
|
16
|
+
xl: 'text-[1.25rem]/[2.125rem]'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The rule down the leading edge, and the one thing every variant has.
|
|
20
|
+
*
|
|
21
|
+
* `border-s`, not `border-l`: the rule belongs on the side the text starts on,
|
|
22
|
+
* which is the right edge under RTL. Its width is the one number here that does
|
|
23
|
+
* not come off a ladder — a quote rule is 2px at every size, because it is a
|
|
24
|
+
* mark in the margin rather than a part of the type.
|
|
25
|
+
*/
|
|
26
|
+
const ruleClasses = 'border-s-2 [border-inline-start-color:var(--p-accent)]';
|
|
27
|
+
/**
|
|
28
|
+
* The three materials, said the way a *container* says them — the sheet is never
|
|
29
|
+
* dyed, exactly as on a `PlCard`. A quote holds somebody else's words, and words
|
|
30
|
+
* on a tinted pane are words on a background nobody chose them against. The
|
|
31
|
+
* family reaches the rule and stops.
|
|
32
|
+
*
|
|
33
|
+
* `ghost` is the default and the one that belongs in running prose: a rule in
|
|
34
|
+
* the margin and nothing else, which is what a quote has looked like since long
|
|
35
|
+
* before there were surfaces to put one on.
|
|
36
|
+
*/
|
|
37
|
+
const variantClasses = {
|
|
38
|
+
solid: /* @__PURE__ */ [
|
|
39
|
+
glassClasses,
|
|
40
|
+
'bg-(--plass-glass-press)',
|
|
41
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
42
|
+
].join(' '),
|
|
43
|
+
// `border-s-2` again, after `border`, so the hairline on the other three edges
|
|
44
|
+
// does not flatten the rule back to a pixel.
|
|
45
|
+
glass: /* @__PURE__ */ [
|
|
46
|
+
glassClasses,
|
|
47
|
+
'border border-s-2 bg-(--plass-glass)',
|
|
48
|
+
'[border-color:var(--plass-glass-line)]',
|
|
49
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
50
|
+
].join(' '),
|
|
51
|
+
ghost: 'bg-transparent'
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The quotation mark: a pair of commas turned up, drawn rather than typed.
|
|
55
|
+
*
|
|
56
|
+
* A real `“` would be set in whatever face the page uses and would change shape,
|
|
57
|
+
* weight and baseline with it — and at 2em it is the largest single glyph in the
|
|
58
|
+
* component, so it changing is the most visible thing that could. This is one
|
|
59
|
+
* drawing at one weight, and it lives here rather than in `internal/icons.tsx`
|
|
60
|
+
* because exactly one component draws it.
|
|
61
|
+
*/
|
|
62
|
+
function QuoteMarkIcon() {
|
|
63
|
+
return (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M6.4 3.6c-2.3.9-3.7 2.8-3.7 5.1 0 2 1.2 3.3 2.8 3.3 1.4 0 2.5-1 2.5-2.4 0-1.3-.9-2.2-2.1-2.2-.2 0-.4 0-.6.1.3-1 1.1-1.8 2.2-2.3l-1.1-1.6ZM13.3 3.6c-2.3.9-3.7 2.8-3.7 5.1 0 2 1.2 3.3 2.8 3.3 1.4 0 2.5-1 2.5-2.4 0-1.3-.9-2.2-2.1-2.2-.2 0-.4 0-.6.1.3-1 1.1-1.8 2.2-2.3l-1.1-1.6Z", fill: "currentColor" }) }));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Somebody else's words, set apart from your own.
|
|
67
|
+
*
|
|
68
|
+
* There is no Base UI primitive under this and there should not be: a quote has
|
|
69
|
+
* no state, no keyboard contract and nothing to interact with. What it has is
|
|
70
|
+
* markup that is easy to get wrong, and getting it right is most of the point.
|
|
71
|
+
*
|
|
72
|
+
* **Nothing is drawn on the `<blockquote>` itself.** The surface, the rule and
|
|
73
|
+
* the padding all belong to the element around it, and that is not tidiness —
|
|
74
|
+
* `blockquote` is one of the handful of tags a host stylesheet still styles by
|
|
75
|
+
* name. VitePress's `.vp-doc blockquote` sets a grey `border-left`, a
|
|
76
|
+
* `padding-left` and a `color`, all at a specificity a one-class utility cannot
|
|
77
|
+
* outrank, so a rule drawn on the quote itself would silently come out grey and
|
|
78
|
+
* a pixel too thin. Moving the drawing onto a wrapper is what lets the docs undo
|
|
79
|
+
* VitePress's version without also undoing this one.
|
|
80
|
+
*
|
|
81
|
+
* The wrapper is a `<figure>` when there is an attribution and a `<div>` when
|
|
82
|
+
* there is not, because the HTML spec is explicit that the attribution goes
|
|
83
|
+
* *outside* the blockquote — a name inside it claims the speaker said their own
|
|
84
|
+
* name — and a `<figure>` with no `<figcaption>` in it is a figure of nothing.
|
|
85
|
+
*/
|
|
86
|
+
export const PlBlockquote = /* @__PURE__ */ React.forwardRef(function PlBlockquote({ variant = 'ghost', size = 'md', color = 'primary', density = 'default', elevation = 0, author, source, cite, icon, className, style, children, ...props }, ref) {
|
|
87
|
+
const attributed = hasContent(author) || hasContent(source);
|
|
88
|
+
const glyph = icon === undefined ? _jsx(QuoteMarkIcon, {}) : icon;
|
|
89
|
+
const shellClasses = [
|
|
90
|
+
'flex flex-col text-(--plass-fg)',
|
|
91
|
+
ruleClasses,
|
|
92
|
+
// The corners on the ruled edge stay square: a 2px rule that curves away
|
|
93
|
+
// from the text it marks is a bracket, not a margin rule.
|
|
94
|
+
variant === 'ghost' ? '' : `${radiusClasses[size]} rounded-s-none`,
|
|
95
|
+
variantClasses[variant],
|
|
96
|
+
sheetPaddingXClasses[density][size],
|
|
97
|
+
sheetPaddingYClasses[density][size],
|
|
98
|
+
transitionClasses,
|
|
99
|
+
className ?? ''
|
|
100
|
+
]
|
|
101
|
+
.filter(Boolean)
|
|
102
|
+
.join(' ');
|
|
103
|
+
const quote = (_jsxs("blockquote", { cite: cite, className: quoteTextClasses[size], children: [hasContent(glyph) ? (_jsx("span", { "aria-hidden": "true", className: "mb-1 block size-[2em] text-(--p-soft-press) [&>svg]:size-full", children: glyph })) : null, children] }));
|
|
104
|
+
const shellStyle = { ...surfaceSlots(color, elevation), ...style };
|
|
105
|
+
if (!attributed) {
|
|
106
|
+
return (_jsx("div", { ref: ref, className: shellClasses, style: shellStyle, ...props, children: quote }));
|
|
107
|
+
}
|
|
108
|
+
return (_jsxs("figure", { ref: ref, className: shellClasses, style: shellStyle, ...props, children: [quote, _jsxs("figcaption", { className: [
|
|
109
|
+
'mt-2 flex flex-wrap items-baseline gap-x-1.5 text-(--plass-muted-fg)',
|
|
110
|
+
metaTextClasses[size]
|
|
111
|
+
].join(' '), children: [hasContent(author) ? (_jsxs("span", { className: "font-medium text-(--plass-fg)", children: [_jsx("span", { "aria-hidden": "true", children: "\u2014 " }), author] })) : null, hasContent(source) ? _jsx("cite", { className: "not-italic", children: source }) : null] })] }));
|
|
112
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlBlockquote } from './PlBlockquote.js';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassElevation, PlassPosition, PlassStyleProps } from '../../types.js';
|
|
4
|
+
/** A destination's value. The same restraint `PlTabs` and `PlSegmentedButton` put on theirs. */
|
|
5
|
+
export type PlBottomNavigationValue = string | number;
|
|
6
|
+
/**
|
|
7
|
+
* Which names are drawn.
|
|
8
|
+
*
|
|
9
|
+
* - `all` — every destination is named. The default, and the only one that works
|
|
10
|
+
* for a reader who has not used the app before.
|
|
11
|
+
* - `selected` — only the destination that is current. The bar keeps its height
|
|
12
|
+
* either way, because the named one is always the tallest; what changes is how
|
|
13
|
+
* much of the row is words. The names the other items lose are still in the
|
|
14
|
+
* document for a screen reader.
|
|
15
|
+
* - `none` — glyphs only, with every name read out but never drawn.
|
|
16
|
+
*/
|
|
17
|
+
export type PlBottomNavigationLabels = 'all' | 'selected' | 'none';
|
|
18
|
+
export interface PlBottomNavigationProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'nav'>, 'color' | 'defaultValue' | 'onChange'> {
|
|
19
|
+
/** The destination the reader is on. Use with `onValueChange` for a controlled bar. */
|
|
20
|
+
value?: PlBottomNavigationValue | null;
|
|
21
|
+
/** Which starts current, for an uncontrolled bar. */
|
|
22
|
+
defaultValue?: PlBottomNavigationValue | null;
|
|
23
|
+
onValueChange?: (value: PlBottomNavigationValue) => void;
|
|
24
|
+
/**
|
|
25
|
+
* How the bar sits in the page's scroll.
|
|
26
|
+
*
|
|
27
|
+
* `fixed` — the default here, against the `static` a layout component would
|
|
28
|
+
* take — is what a bottom navigation *is*: held against the bottom edge of the
|
|
29
|
+
* window whatever the page does.
|
|
30
|
+
* @default 'fixed'
|
|
31
|
+
*/
|
|
32
|
+
position?: PlassPosition;
|
|
33
|
+
/** Which names are drawn. @default 'all' */
|
|
34
|
+
labels?: PlBottomNavigationLabels;
|
|
35
|
+
/**
|
|
36
|
+
* Draws a hairline along the top edge, against the content the bar is over.
|
|
37
|
+
*
|
|
38
|
+
* On by default: a bar pinned over a scrolling page has content passing
|
|
39
|
+
* underneath it at every moment, and a translucent sheet with nothing marking
|
|
40
|
+
* its edge reads as part of that.
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
divider?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Keeps the bar clear of the home indicator on a phone, by adding
|
|
46
|
+
* `env(safe-area-inset-bottom)` under it. The sheet still reaches the bottom
|
|
47
|
+
* of the screen; only the items move up.
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
safeArea?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Drop shadow depth. `0` is the default and it is flat: the bar is attached to
|
|
53
|
+
* the edge of the window rather than floating over the middle of it, and
|
|
54
|
+
* `divider` is what separates it from the content.
|
|
55
|
+
* @default 0
|
|
56
|
+
*/
|
|
57
|
+
elevation?: PlassElevation;
|
|
58
|
+
/** Every destination stops answering. */
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
/** The name the bar is announced by — "Main", "Sections". */
|
|
61
|
+
label?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Renders something other than a `<nav>`. Base UI's own escape hatch, and
|
|
64
|
+
* rarely what you want here: a row of destinations is navigation.
|
|
65
|
+
*/
|
|
66
|
+
render?: useRender.RenderProp;
|
|
67
|
+
/** The `PlBottomNavigationItem`s. */
|
|
68
|
+
children?: React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
export interface PlBottomNavigationItemProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'value' | 'color'> {
|
|
71
|
+
/** Identifies the destination. What `onValueChange` reports. */
|
|
72
|
+
value: PlBottomNavigationValue;
|
|
73
|
+
/** The glyph above the name. Sized on the standalone-glyph ladder. */
|
|
74
|
+
icon?: React.ReactNode;
|
|
75
|
+
/** Renders the item as a link rather than as a button. */
|
|
76
|
+
href?: string;
|
|
77
|
+
/** Unavailable, but still part of the set. */
|
|
78
|
+
disabled?: boolean;
|
|
79
|
+
/** The destination's name. Read out even when `labels` keeps it undrawn. */
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* A row of destinations held against the bottom edge of the window.
|
|
84
|
+
*
|
|
85
|
+
* It is a `<nav>` rather than a `role="tablist"`, and its items are ordinary
|
|
86
|
+
* links or buttons rather than tabs. That is a deliberate choice about what is
|
|
87
|
+
* being promised: a tab list owes a keyboard reader one tab stop for the whole
|
|
88
|
+
* set and arrow keys within it, and it owes a screen reader a panel per tab. A
|
|
89
|
+
* bottom navigation switches what the *page* is, not which panel of one is
|
|
90
|
+
* showing, and claiming the role without the behaviour is worse for a keyboard
|
|
91
|
+
* reader than never claiming it. What is claimed instead is `aria-current`,
|
|
92
|
+
* which is the honest statement: this is the destination you are on.
|
|
93
|
+
*
|
|
94
|
+
* The sheet is never dyed, exactly as on a `PlCard`. What carries the colour
|
|
95
|
+
* family is the one item that is current.
|
|
96
|
+
*/
|
|
97
|
+
export declare const PlBottomNavigation: React.ForwardRefExoticComponent<PlBottomNavigationProps & React.RefAttributes<HTMLElement>>;
|
|
98
|
+
/**
|
|
99
|
+
* One destination.
|
|
100
|
+
*
|
|
101
|
+
* It has no `size`, no `color` and no `variant` of its own: all three belong to
|
|
102
|
+
* the bar, which is the only place they can be set once and mean the same thing
|
|
103
|
+
* for every item.
|
|
104
|
+
*
|
|
105
|
+
* With an `href` it is a real `<a>`, which is what makes a long press offer
|
|
106
|
+
* "open in a new tab" and what puts the destination in the status bar — neither
|
|
107
|
+
* of which a `<button>` that calls `router.push` can do. Without one it is a
|
|
108
|
+
* `<button>`, because a `<div>` carrying a click handler is invisible to a
|
|
109
|
+
* keyboard.
|
|
110
|
+
*/
|
|
111
|
+
export declare const PlBottomNavigationItem: React.ForwardRefExoticComponent<PlBottomNavigationItemProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cx, focusRingInsetClasses, hasContent, iconSizeClasses, metaTextClasses, radiusClasses, sheetLineClasses, sheetRestClasses, srOnlyClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
const BottomNavigationContext = /* @__PURE__ */ React.createContext({
|
|
6
|
+
value: null,
|
|
7
|
+
change: () => { },
|
|
8
|
+
size: 'md',
|
|
9
|
+
density: 'default',
|
|
10
|
+
labels: 'all',
|
|
11
|
+
disabled: false
|
|
12
|
+
});
|
|
13
|
+
const positionClasses = {
|
|
14
|
+
static: '',
|
|
15
|
+
sticky: 'sticky bottom-0 z-20',
|
|
16
|
+
fixed: 'fixed inset-x-0 bottom-0 z-30'
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The row's floor.
|
|
20
|
+
*
|
|
21
|
+
* `md` is 56px, which is the height a bottom navigation has had since the first
|
|
22
|
+
* one — tall enough for a glyph with a word under it, short enough that it is
|
|
23
|
+
* not competing with the page it is on. The ladder around it keeps the same
|
|
24
|
+
* proportion to the glyph and the name it holds.
|
|
25
|
+
*/
|
|
26
|
+
const rowMinHeightClasses = {
|
|
27
|
+
xs: 'min-h-10',
|
|
28
|
+
sm: 'min-h-12',
|
|
29
|
+
md: 'min-h-14',
|
|
30
|
+
lg: 'min-h-16',
|
|
31
|
+
xl: 'min-h-18'
|
|
32
|
+
};
|
|
33
|
+
/** The air inside the sheet, around the row of items. */
|
|
34
|
+
const rowPaddingClasses = {
|
|
35
|
+
default: { xs: 'p-1', sm: 'p-1', md: 'p-1.5', lg: 'p-2', xl: 'p-2.5' },
|
|
36
|
+
compact: { xs: 'p-0.5', sm: 'p-0.5', md: 'p-1', lg: 'p-1', xl: 'p-1.5' }
|
|
37
|
+
};
|
|
38
|
+
/** Between the glyph and the name under it. */
|
|
39
|
+
const itemGapClasses = {
|
|
40
|
+
xs: 'gap-0.5',
|
|
41
|
+
sm: 'gap-0.5',
|
|
42
|
+
md: 'gap-1',
|
|
43
|
+
lg: 'gap-1',
|
|
44
|
+
xl: 'gap-1.5'
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* A row of destinations held against the bottom edge of the window.
|
|
48
|
+
*
|
|
49
|
+
* It is a `<nav>` rather than a `role="tablist"`, and its items are ordinary
|
|
50
|
+
* links or buttons rather than tabs. That is a deliberate choice about what is
|
|
51
|
+
* being promised: a tab list owes a keyboard reader one tab stop for the whole
|
|
52
|
+
* set and arrow keys within it, and it owes a screen reader a panel per tab. A
|
|
53
|
+
* bottom navigation switches what the *page* is, not which panel of one is
|
|
54
|
+
* showing, and claiming the role without the behaviour is worse for a keyboard
|
|
55
|
+
* reader than never claiming it. What is claimed instead is `aria-current`,
|
|
56
|
+
* which is the honest statement: this is the destination you are on.
|
|
57
|
+
*
|
|
58
|
+
* The sheet is never dyed, exactly as on a `PlCard`. What carries the colour
|
|
59
|
+
* family is the one item that is current.
|
|
60
|
+
*/
|
|
61
|
+
export const PlBottomNavigation = /* @__PURE__ */ React.forwardRef(function PlBottomNavigation({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, value: valueProp, defaultValue = null, onValueChange, position = 'fixed', labels = 'all', divider = true, safeArea = true, disabled = false, label, render, className, style, children, ...props }, ref) {
|
|
62
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
63
|
+
const controlled = valueProp !== undefined;
|
|
64
|
+
const value = controlled ? valueProp : uncontrolled;
|
|
65
|
+
const change = React.useCallback((next) => {
|
|
66
|
+
if (!controlled) {
|
|
67
|
+
setUncontrolled(next);
|
|
68
|
+
}
|
|
69
|
+
onValueChange?.(next);
|
|
70
|
+
}, [controlled, onValueChange]);
|
|
71
|
+
const context = React.useMemo(() => ({ value: value ?? null, change, size, density, labels, disabled }), [value, change, size, density, labels, disabled]);
|
|
72
|
+
const classNames = cx('w-full min-w-0',
|
|
73
|
+
// A bar spanning an edge of the window has nothing behind its corners, so
|
|
74
|
+
// only one sitting in the flow is a sheet with corners at all.
|
|
75
|
+
position === 'static' ? radiusClasses[size] : '', sheetRestClasses[variant],
|
|
76
|
+
// A bar that is not in the flow has three edges against the window and one
|
|
77
|
+
// against the content, so only that one is ever drawn — a hairline down
|
|
78
|
+
// the left of the screen is a hairline nobody asked for. In the flow it is
|
|
79
|
+
// an ordinary sheet and keeps the whole outline `sheetRestClasses` gave it.
|
|
80
|
+
variant === 'glass' && position !== 'static' ? 'border-0' : '', divider ? sheetLineClasses : '', positionClasses[position],
|
|
81
|
+
// The sheet keeps reaching the bottom of the screen; what the inset moves
|
|
82
|
+
// is the row inside it. A bar that stopped above the home indicator would
|
|
83
|
+
// leave a stripe of page showing under the glass.
|
|
84
|
+
safeArea ? 'pb-[env(safe-area-inset-bottom)]' : '', transitionClasses, className);
|
|
85
|
+
return useRender({
|
|
86
|
+
render: render ?? _jsx("nav", {}),
|
|
87
|
+
ref,
|
|
88
|
+
props: {
|
|
89
|
+
'aria-label': label,
|
|
90
|
+
className: classNames,
|
|
91
|
+
style: { ...surfaceSlots(color, elevation), ...style },
|
|
92
|
+
children: (_jsx(BottomNavigationContext.Provider, { value: context, children: _jsx("div", { className: cx('flex w-full items-stretch', rowMinHeightClasses[size], rowPaddingClasses[density][size]), children: children }) })),
|
|
93
|
+
...props
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* One destination.
|
|
99
|
+
*
|
|
100
|
+
* It has no `size`, no `color` and no `variant` of its own: all three belong to
|
|
101
|
+
* the bar, which is the only place they can be set once and mean the same thing
|
|
102
|
+
* for every item.
|
|
103
|
+
*
|
|
104
|
+
* With an `href` it is a real `<a>`, which is what makes a long press offer
|
|
105
|
+
* "open in a new tab" and what puts the destination in the status bar — neither
|
|
106
|
+
* of which a `<button>` that calls `router.push` can do. Without one it is a
|
|
107
|
+
* `<button>`, because a `<div>` carrying a click handler is invisible to a
|
|
108
|
+
* keyboard.
|
|
109
|
+
*/
|
|
110
|
+
export const PlBottomNavigationItem = /* @__PURE__ */ React.forwardRef(function PlBottomNavigationItem({ value, icon, href, disabled: disabledProp = false, className, children, onClick, ...props }, ref) {
|
|
111
|
+
const bar = React.useContext(BottomNavigationContext);
|
|
112
|
+
const disabled = disabledProp || bar.disabled;
|
|
113
|
+
const selected = bar.value !== null && bar.value === value;
|
|
114
|
+
const named = bar.labels === 'all' || (bar.labels === 'selected' && selected);
|
|
115
|
+
const classNames = cx('flex min-w-0 flex-1 flex-col items-center justify-center px-1 py-1.5', itemGapClasses[bar.size], radiusClasses[bar.size], '[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]', transitionClasses,
|
|
116
|
+
// Inset rather than offset: the item is inside a sheet that clips, and a
|
|
117
|
+
// ring drawn outside it would have its top sliced off.
|
|
118
|
+
focusRingInsetClasses,
|
|
119
|
+
// An if/else rather than stacked variants: two Tailwind classes of equal
|
|
120
|
+
// specificity resolve by their order in the generated stylesheet.
|
|
121
|
+
disabled
|
|
122
|
+
? 'cursor-not-allowed opacity-50 saturate-[0.35] text-(--plass-muted-fg)'
|
|
123
|
+
: selected
|
|
124
|
+
? 'cursor-pointer font-medium text-(--p-accent) bg-(--p-soft) hover:bg-(--p-soft-hover)'
|
|
125
|
+
: 'cursor-pointer text-(--plass-muted-fg) hover:text-(--plass-fg) hover:bg-(--plass-glass-hover)', className);
|
|
126
|
+
const body = (_jsxs(_Fragment, { children: [hasContent(icon) ? (_jsx("span", { className: cx('flex shrink-0 items-center justify-center', iconSizeClasses[bar.size]), children: icon })) : null, hasContent(children) ? (_jsx("span", { className: named
|
|
127
|
+
? cx('max-w-full truncate leading-tight', metaTextClasses[bar.size])
|
|
128
|
+
: srOnlyClasses, children: children })) : null] }));
|
|
129
|
+
const press = (event) => {
|
|
130
|
+
if (disabled) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
bar.change(value);
|
|
135
|
+
onClick?.(event);
|
|
136
|
+
};
|
|
137
|
+
if (href) {
|
|
138
|
+
return (_jsx("a", { ref: ref, href: disabled ? undefined : href, "aria-current": selected ? 'page' : undefined, "aria-disabled": disabled || undefined, className: classNames, onClick: press, ...props, children: body }));
|
|
139
|
+
}
|
|
140
|
+
return (_jsx("button", { ref: ref, type: "button", disabled: disabled, "aria-current": selected ? 'page' : undefined, className: classNames, onClick: press, ...props, children: body }));
|
|
141
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlBottomNavigation, PlBottomNavigationItem } from './PlBottomNavigation.js';
|
|
@@ -0,0 +1,50 @@
|
|
|
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 PlBoxProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* Drop shadow depth. `0` is the default and it is flat — the glass edge is
|
|
7
|
+
* what separates the box from the page. Raise it only for a surface that
|
|
8
|
+
* genuinely floats above the content around it.
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
elevation?: PlassElevation;
|
|
12
|
+
/**
|
|
13
|
+
* Inner padding, on the `size` / `density` scale. Turn it off for full-bleed
|
|
14
|
+
* content — an image, a table, a list that draws its own rows.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
padded?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Renders something other than a `<div>`: `render={<section />}`,
|
|
20
|
+
* `render={<li />}`, or a function for full control. Base UI's own escape
|
|
21
|
+
* hatch, so it behaves the same here as on every Base UI primitive.
|
|
22
|
+
*/
|
|
23
|
+
render?: useRender.RenderProp;
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A sheet of glass with content on it. The plainest surface in the library: it
|
|
28
|
+
* groups things, and that is all it does.
|
|
29
|
+
*
|
|
30
|
+
* Everything structural — a title, a footer, hairlines between sections —
|
|
31
|
+
* belongs to `PlCard`, which is a box with those sections laid out on it. What
|
|
32
|
+
* is left here is the sheet itself, and the reason it is worth having on its own
|
|
33
|
+
* is that most of what a screen groups has no heading: a well behind a form, a
|
|
34
|
+
* tile in a shelf, a panel round a chart.
|
|
35
|
+
*
|
|
36
|
+
* `size` means something different here from what it means on a control, and
|
|
37
|
+
* this is the one place in the library where that is true. A box is as tall as
|
|
38
|
+
* what it holds, and its children bring their own typography — a container that
|
|
39
|
+
* reset the type scale would render the same paragraph at two sizes depending
|
|
40
|
+
* on what it was wrapped in. So `size` is the size of the **sheet**: its radius
|
|
41
|
+
* and its padding, and nothing else.
|
|
42
|
+
*
|
|
43
|
+
* The three materials say what they say everywhere else, read as a container's:
|
|
44
|
+
* the sheet is never dyed, because what a box holds arrives with its own
|
|
45
|
+
* colours and tinting the pane under them puts every one on a background it was
|
|
46
|
+
* not chosen against. The family reaches the hairline and the focus ring and
|
|
47
|
+
* stops. `ghost` is the one to reach for inside another surface, where a second
|
|
48
|
+
* bordered rectangle is a second rectangle.
|
|
49
|
+
*/
|
|
50
|
+
export declare const PlBox: React.ForwardRefExoticComponent<PlBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
4
|
+
import { cx, radiusClasses, sheetPaddingXClasses, sheetPaddingYClasses, sheetRestClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* A sheet of glass with content on it. The plainest surface in the library: it
|
|
7
|
+
* groups things, and that is all it does.
|
|
8
|
+
*
|
|
9
|
+
* Everything structural — a title, a footer, hairlines between sections —
|
|
10
|
+
* belongs to `PlCard`, which is a box with those sections laid out on it. What
|
|
11
|
+
* is left here is the sheet itself, and the reason it is worth having on its own
|
|
12
|
+
* is that most of what a screen groups has no heading: a well behind a form, a
|
|
13
|
+
* tile in a shelf, a panel round a chart.
|
|
14
|
+
*
|
|
15
|
+
* `size` means something different here from what it means on a control, and
|
|
16
|
+
* this is the one place in the library where that is true. A box is as tall as
|
|
17
|
+
* what it holds, and its children bring their own typography — a container that
|
|
18
|
+
* reset the type scale would render the same paragraph at two sizes depending
|
|
19
|
+
* on what it was wrapped in. So `size` is the size of the **sheet**: its radius
|
|
20
|
+
* and its padding, and nothing else.
|
|
21
|
+
*
|
|
22
|
+
* The three materials say what they say everywhere else, read as a container's:
|
|
23
|
+
* the sheet is never dyed, because what a box holds arrives with its own
|
|
24
|
+
* colours and tinting the pane under them puts every one on a background it was
|
|
25
|
+
* not chosen against. The family reaches the hairline and the focus ring and
|
|
26
|
+
* stops. `ghost` is the one to reach for inside another surface, where a second
|
|
27
|
+
* bordered rectangle is a second rectangle.
|
|
28
|
+
*/
|
|
29
|
+
export const PlBox = /* @__PURE__ */ React.forwardRef(function PlBox({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, padded = true, render, className, style, children, ...props }, ref) {
|
|
30
|
+
const classNames = cx('block', radiusClasses[size], padded ? `${sheetPaddingXClasses[density][size]} ${sheetPaddingYClasses[density][size]}` : '', sheetRestClasses[variant],
|
|
31
|
+
// The same property list and duration as everything else, so a box whose
|
|
32
|
+
// colour or elevation changes settles at the house pace. There is no
|
|
33
|
+
// `:active` treatment because a box is not pressed — it holds things that
|
|
34
|
+
// are.
|
|
35
|
+
transitionClasses, className);
|
|
36
|
+
return useRender({
|
|
37
|
+
render: render ?? _jsx("div", {}),
|
|
38
|
+
ref,
|
|
39
|
+
props: {
|
|
40
|
+
className: classNames,
|
|
41
|
+
style: { ...surfaceSlots(color, elevation), ...style },
|
|
42
|
+
children,
|
|
43
|
+
...props
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlBox } from './PlBox.js';
|