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,291 @@
|
|
|
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 { controlHeightClasses, controlSlots, controlSquareClasses, cx, focusRingClasses, glassClasses, hasContent, iconSizeClasses, srOnlyClasses, transitionClasses } from '../../internal/styles.js';
|
|
5
|
+
const FloatingBarContext = /* @__PURE__ */ React.createContext({
|
|
6
|
+
value: null,
|
|
7
|
+
change: () => { },
|
|
8
|
+
size: 'md',
|
|
9
|
+
disabled: false
|
|
10
|
+
});
|
|
11
|
+
/** How far off the floor the capsule sits, on the size ladder. */
|
|
12
|
+
const floatGapClasses = {
|
|
13
|
+
xs: 'pb-2',
|
|
14
|
+
sm: 'pb-3',
|
|
15
|
+
md: 'pb-4',
|
|
16
|
+
lg: 'pb-5',
|
|
17
|
+
xl: 'pb-6'
|
|
18
|
+
};
|
|
19
|
+
/** The same, with the home indicator added underneath it. */
|
|
20
|
+
const floatGapSafeClasses = {
|
|
21
|
+
xs: 'pb-[calc(env(safe-area-inset-bottom)+0.5rem)]',
|
|
22
|
+
sm: 'pb-[calc(env(safe-area-inset-bottom)+0.75rem)]',
|
|
23
|
+
md: 'pb-[calc(env(safe-area-inset-bottom)+1rem)]',
|
|
24
|
+
lg: 'pb-[calc(env(safe-area-inset-bottom)+1.25rem)]',
|
|
25
|
+
xl: 'pb-[calc(env(safe-area-inset-bottom)+1.5rem)]'
|
|
26
|
+
};
|
|
27
|
+
/** The air inside the capsule, around the discs. */
|
|
28
|
+
const capsulePaddingClasses = {
|
|
29
|
+
default: { xs: 'p-1', sm: 'p-1', md: 'p-1.5', lg: 'p-2', xl: 'p-2.5' },
|
|
30
|
+
compact: { xs: 'p-0.5', sm: 'p-0.5', md: 'p-1', lg: 'p-1', xl: 'p-1.5' }
|
|
31
|
+
};
|
|
32
|
+
/** Between two discs. */
|
|
33
|
+
const discGapClasses = {
|
|
34
|
+
default: { xs: 'gap-1', sm: 'gap-1', md: 'gap-1.5', lg: 'gap-2', xl: 'gap-2.5' },
|
|
35
|
+
compact: { xs: 'gap-0.5', sm: 'gap-0.5', md: 'gap-1', lg: 'gap-1', xl: 'gap-1.5' }
|
|
36
|
+
};
|
|
37
|
+
const positionClasses = {
|
|
38
|
+
static: '',
|
|
39
|
+
sticky: 'sticky bottom-0 z-20',
|
|
40
|
+
fixed: 'fixed inset-x-0 bottom-0 z-30'
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The capsule.
|
|
44
|
+
*
|
|
45
|
+
* `rounded-full` is one of the very few places the library allows a pill, and it
|
|
46
|
+
* is allowed for the reason a `PlSegmentedButton`'s groove is: this is not a
|
|
47
|
+
* sheet lying on the page, it is an object floating clear of one. The house
|
|
48
|
+
* fillet is about a sheet with its corners cut, and a sheet that is not on
|
|
49
|
+
* anything has no corners to cut.
|
|
50
|
+
*/
|
|
51
|
+
const capsuleClasses = {
|
|
52
|
+
solid: /* @__PURE__ */ [
|
|
53
|
+
glassClasses,
|
|
54
|
+
'bg-(--plass-glass-press)',
|
|
55
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
56
|
+
].join(' '),
|
|
57
|
+
glass: /* @__PURE__ */ [
|
|
58
|
+
glassClasses,
|
|
59
|
+
'border bg-(--plass-glass)',
|
|
60
|
+
'[border-color:var(--plass-glass-line)]',
|
|
61
|
+
'[box-shadow:var(--p-elev),var(--plass-gloss-glass)]'
|
|
62
|
+
].join(' '),
|
|
63
|
+
ghost: ''
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The key that slides.
|
|
67
|
+
*
|
|
68
|
+
* Always the family's own gradient with that family's tinted shadow under it,
|
|
69
|
+
* whatever the capsule is made of — a key of tinted glass riding in a clear
|
|
70
|
+
* sheet is the design language's own sentence, and `variant` is a statement
|
|
71
|
+
* about the *capsule*. A `ghost` bar is a row of discs with no sheet behind
|
|
72
|
+
* them; the one that is current is still the one that is current.
|
|
73
|
+
*
|
|
74
|
+
* `left`, `top`, `width` and `height` rather than a `translate`: the key is
|
|
75
|
+
* measured off the disc it belongs under, and moving it by its own box is what
|
|
76
|
+
* keeps every glyph in the row unresampled while it travels. `left` and not
|
|
77
|
+
* `inset-inline-start`, because `offsetLeft` is a distance from the left edge
|
|
78
|
+
* and stays one under RTL — pairing a physical measurement with a logical
|
|
79
|
+
* property is what would break the direction.
|
|
80
|
+
*
|
|
81
|
+
* `data-quiet` is the current destination being unavailable, which is the one
|
|
82
|
+
* state the key cannot read off its own props: the light goes out on the key
|
|
83
|
+
* the same way it goes out on the disc over it, or a disabled destination is a
|
|
84
|
+
* dimmed glyph on a fully lit gradient.
|
|
85
|
+
*/
|
|
86
|
+
const keyClasses = /* @__PURE__ */ [
|
|
87
|
+
'pointer-events-none absolute rounded-full',
|
|
88
|
+
'top-(--p-disc-y) left-(--p-disc-x) h-(--p-disc-h) w-(--p-disc-w)',
|
|
89
|
+
'[background-image:var(--p-fill)]',
|
|
90
|
+
'[box-shadow:var(--plass-shadow-1),var(--p-lift)]',
|
|
91
|
+
'data-[quiet]:opacity-50 data-[quiet]:saturate-[0.35]',
|
|
92
|
+
'[transition-property:left,top,width,height,opacity,filter]',
|
|
93
|
+
'[transition-timing-function:var(--plass-ease)]',
|
|
94
|
+
// Nothing until the first measurement has landed; the house duration from
|
|
95
|
+
// then on.
|
|
96
|
+
'[transition-duration:0ms] data-[ready]:[transition-duration:var(--plass-duration)]'
|
|
97
|
+
].join(' ');
|
|
98
|
+
/**
|
|
99
|
+
* A row of round destinations floating clear of the bottom edge of the window.
|
|
100
|
+
*
|
|
101
|
+
* The other half of `PlBottomNavigation`, and a different object rather than a
|
|
102
|
+
* variant of one: that bar is **attached** to the edge of the window — full
|
|
103
|
+
* width, a hairline against the content, its sheet running under the home
|
|
104
|
+
* indicator — and this one is **not part of the page at all**. Everything that
|
|
105
|
+
* follows comes from that one difference: the capsule, the gap under it, the
|
|
106
|
+
* shadow it defaults to, and the pill corners it is allowed.
|
|
107
|
+
*
|
|
108
|
+
* Every destination is a disc with a glyph in it and no name drawn, which is
|
|
109
|
+
* what keeps a row of five inside the width of a phone. The name is still
|
|
110
|
+
* required and still read out — a row of glyphs with no accessible names is the
|
|
111
|
+
* defect `PlIconButton`'s `label` exists to make impossible, and it would be
|
|
112
|
+
* exactly as easy to ship here.
|
|
113
|
+
*
|
|
114
|
+
* The current destination is a key of **tinted glass** riding in the clear
|
|
115
|
+
* sheet, which is the design language's own sentence with nothing added to it.
|
|
116
|
+
* The key is **one element that travels**, measured off whichever disc is
|
|
117
|
+
* current and animated the way a `PlSegmentedButton`'s tile is — not a fill
|
|
118
|
+
* that appears on one disc while it disappears from another. Two discs
|
|
119
|
+
* cross-fading is two objects; a bar with a key in it has one, and where it
|
|
120
|
+
* goes is the whole of what the component has to say.
|
|
121
|
+
*
|
|
122
|
+
* Nothing is transformed: the key is an empty box, and no glyph is resampled
|
|
123
|
+
* while it travels. That is what lets the house no-transform rule survive a
|
|
124
|
+
* component whose entire point is that something moves.
|
|
125
|
+
*
|
|
126
|
+
* It reads `controlSlots` and not the `surfaceSlots` every other container
|
|
127
|
+
* takes, which is the one place this bar is not a container: the slots a
|
|
128
|
+
* container is given are deliberately undyed — no `--p-fill`, no `--p-on-solid`
|
|
129
|
+
* and no `--p-lift` — and the key is made of all three. Asking a container's
|
|
130
|
+
* slot set for a control's colours is asking for `var(--p-fill)` to resolve to
|
|
131
|
+
* nothing, which is a `background-image` the browser drops on the floor and a
|
|
132
|
+
* current destination that looks exactly like the four beside it.
|
|
133
|
+
*/
|
|
134
|
+
export const PlFloatingBottomNavigation = /* @__PURE__ */ React.forwardRef(function PlFloatingBottomNavigation({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 2, value: valueProp, defaultValue = null, onValueChange, position = 'fixed', safeArea = true, disabled = false, label, render, className, style, children, ...props }, ref) {
|
|
135
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultValue);
|
|
136
|
+
const controlled = valueProp !== undefined;
|
|
137
|
+
const value = controlled ? valueProp : uncontrolled;
|
|
138
|
+
const capsuleRef = React.useRef(null);
|
|
139
|
+
const keyRef = React.useRef(null);
|
|
140
|
+
/**
|
|
141
|
+
* Writes the current disc's box onto the key as four custom properties.
|
|
142
|
+
*
|
|
143
|
+
* Written straight to the element rather than held in state, exactly as
|
|
144
|
+
* `PlSegmentedButton` writes its tile: a `setState` here would re-render
|
|
145
|
+
* every disc on every resize, and nothing in the tree depends on the numbers
|
|
146
|
+
* except four CSS declarations.
|
|
147
|
+
*
|
|
148
|
+
* `animate` is what separates the two callers. A change of destination is the
|
|
149
|
+
* thing this exists to animate; a resize is the capsule moving under a key
|
|
150
|
+
* that was already in the right place, and animating that is a key that lags
|
|
151
|
+
* behind the window being dragged.
|
|
152
|
+
*/
|
|
153
|
+
const measure = React.useCallback((animate) => {
|
|
154
|
+
const capsule = capsuleRef.current;
|
|
155
|
+
const disc = keyRef.current;
|
|
156
|
+
if (!capsule || !disc) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const current = capsule.querySelector('[data-disc][data-current]');
|
|
160
|
+
if (!current) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// A key that has only just mounted has nowhere to travel *from*, so its
|
|
164
|
+
// first placement is instant however it was asked for — that is what makes
|
|
165
|
+
// the first destination appear under its disc rather than fly in from the
|
|
166
|
+
// left edge of the capsule.
|
|
167
|
+
const instant = !animate || !disc.hasAttribute('data-ready');
|
|
168
|
+
if (instant) {
|
|
169
|
+
disc.removeAttribute('data-ready');
|
|
170
|
+
}
|
|
171
|
+
// `offsetLeft`/`offsetTop` are measured from the offsetParent's padding
|
|
172
|
+
// edge, and `left`/`top` on an absolutely positioned child resolve against
|
|
173
|
+
// the same box — so the capsule's own padding is already accounted for and
|
|
174
|
+
// must not be subtracted again.
|
|
175
|
+
disc.style.setProperty('--p-disc-x', `${current.offsetLeft}px`);
|
|
176
|
+
disc.style.setProperty('--p-disc-y', `${current.offsetTop}px`);
|
|
177
|
+
disc.style.setProperty('--p-disc-w', `${current.offsetWidth}px`);
|
|
178
|
+
disc.style.setProperty('--p-disc-h', `${current.offsetHeight}px`);
|
|
179
|
+
// Read off the disc rather than off a prop, because the bar does not know
|
|
180
|
+
// which of its children is unavailable — the items are `children` and the
|
|
181
|
+
// disabled one is whichever of them said so. The same query that measures
|
|
182
|
+
// the box answers it, so there is no second pass.
|
|
183
|
+
disc.toggleAttribute('data-quiet', current.hasAttribute('data-disabled'));
|
|
184
|
+
if (instant) {
|
|
185
|
+
// Reading a layout property commits the four writes above while the
|
|
186
|
+
// duration is still 0ms, so turning the transition back on cannot
|
|
187
|
+
// animate a move that has already happened.
|
|
188
|
+
void disc.offsetWidth;
|
|
189
|
+
}
|
|
190
|
+
disc.setAttribute('data-ready', '');
|
|
191
|
+
}, []);
|
|
192
|
+
// Before the browser paints, or the key is visibly at nothing for a frame.
|
|
193
|
+
React.useLayoutEffect(() => {
|
|
194
|
+
measure(true);
|
|
195
|
+
}, [measure, value, variant, size, density, disabled, children]);
|
|
196
|
+
React.useEffect(() => {
|
|
197
|
+
const capsule = capsuleRef.current;
|
|
198
|
+
if (!capsule || typeof ResizeObserver === 'undefined') {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const observer = new ResizeObserver(() => measure(false));
|
|
202
|
+
observer.observe(capsule);
|
|
203
|
+
return () => observer.disconnect();
|
|
204
|
+
}, [measure]);
|
|
205
|
+
const change = React.useCallback((next) => {
|
|
206
|
+
if (!controlled) {
|
|
207
|
+
setUncontrolled(next);
|
|
208
|
+
}
|
|
209
|
+
onValueChange?.(next);
|
|
210
|
+
}, [controlled, onValueChange]);
|
|
211
|
+
const context = React.useMemo(() => ({ value: value ?? null, change, size, disabled }), [value, change, size, disabled]);
|
|
212
|
+
const classNames = cx('flex w-full justify-center px-4',
|
|
213
|
+
// The strip the capsule is centred in spans the window, and a transparent
|
|
214
|
+
// band across the bottom of a page that swallowed presses would be a band
|
|
215
|
+
// nobody could scroll through. Only the capsule takes them back.
|
|
216
|
+
position === 'static' ? '' : 'pointer-events-none', safeArea ? floatGapSafeClasses[size] : floatGapClasses[size], positionClasses[position], className);
|
|
217
|
+
return useRender({
|
|
218
|
+
render: render ?? _jsx("nav", {}),
|
|
219
|
+
ref,
|
|
220
|
+
props: {
|
|
221
|
+
'aria-label': label,
|
|
222
|
+
className: classNames,
|
|
223
|
+
// `controlSlots` and not `surfaceSlots`: the capsule is undyed like every
|
|
224
|
+
// other container, but the key riding in it is a control's surface and is
|
|
225
|
+
// made of three slots a container's set does not carry.
|
|
226
|
+
style: { ...controlSlots(color, elevation, 'solid'), ...style },
|
|
227
|
+
children: (_jsx(FloatingBarContext.Provider, { value: context, children: _jsxs("div", { ref: capsuleRef, className: cx(
|
|
228
|
+
// `relative` is load-bearing twice over: it is what makes the
|
|
229
|
+
// capsule the discs' offsetParent, and what the key is positioned
|
|
230
|
+
// in.
|
|
231
|
+
'pointer-events-auto relative inline-flex items-center rounded-full', capsuleClasses[variant], capsulePaddingClasses[density][size], discGapClasses[density][size], transitionClasses), children: [value !== null && value !== undefined ? (_jsx("span", { ref: keyRef, "aria-hidden": "true", className: keyClasses })) : null, children] }) })),
|
|
232
|
+
...props
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
/**
|
|
237
|
+
* One destination, as a disc.
|
|
238
|
+
*
|
|
239
|
+
* It has no `size`, no `color` and no `variant` of its own: all three belong to
|
|
240
|
+
* the bar, which is the only place they can be set once and mean the same thing
|
|
241
|
+
* for every disc.
|
|
242
|
+
*/
|
|
243
|
+
export const PlFloatingBottomNavigationItem = /* @__PURE__ */ React.forwardRef(function PlFloatingBottomNavigationItem({ value, icon, href, disabled: disabledProp = false, className, children, onClick, ...props }, ref) {
|
|
244
|
+
const bar = React.useContext(FloatingBarContext);
|
|
245
|
+
const disabled = disabledProp || bar.disabled;
|
|
246
|
+
const selected = bar.value !== null && bar.value === value;
|
|
247
|
+
const classNames = cx(
|
|
248
|
+
// `z-10` and a stacking context of its own: the key is painted behind the
|
|
249
|
+
// discs, and without this it would cover the glyph it is under.
|
|
250
|
+
'relative z-10 inline-flex shrink-0 items-center justify-center rounded-full', controlHeightClasses[bar.size], controlSquareClasses[bar.size], '[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]', transitionClasses,
|
|
251
|
+
// Offset rather than inset: a disc inside a capsule that is only padding has
|
|
252
|
+
// room around it, and a flush ring on a circle is the circle's own edge
|
|
253
|
+
// thickening — which is the one shape where that reads as a border rather
|
|
254
|
+
// than as focus.
|
|
255
|
+
focusRingClasses, disabled
|
|
256
|
+
? 'cursor-not-allowed opacity-50 saturate-[0.35] text-(--plass-muted-fg)'
|
|
257
|
+
: selected
|
|
258
|
+
? // No surface of its own. What is under the glyph is the key, which
|
|
259
|
+
// belongs to the bar and is the one thing in the row that travels;
|
|
260
|
+
// a disc that drew its own fill would be a second key appearing
|
|
261
|
+
// wherever the first one had just left.
|
|
262
|
+
'cursor-pointer text-(--p-on-solid)'
|
|
263
|
+
: 'cursor-pointer text-(--plass-muted-fg) hover:text-(--plass-fg) hover:bg-(--plass-glass-hover)', className);
|
|
264
|
+
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: srOnlyClasses, children: children }) : null] }));
|
|
265
|
+
/**
|
|
266
|
+
* The hooks the key is measured from.
|
|
267
|
+
*
|
|
268
|
+
* Attributes rather than a ref per disc, for the reason a `PlSegment` carries
|
|
269
|
+
* `data-segment`: a ref array would mean keeping it in step with however the
|
|
270
|
+
* caller composed the items — through a `.map()`, through a fragment, through
|
|
271
|
+
* a component of their own — and an attribute is the version of that which
|
|
272
|
+
* cannot fall out of step.
|
|
273
|
+
*/
|
|
274
|
+
const discAttributes = {
|
|
275
|
+
'data-disc': '',
|
|
276
|
+
'data-current': selected ? '' : undefined,
|
|
277
|
+
'data-disabled': disabled ? '' : undefined
|
|
278
|
+
};
|
|
279
|
+
const press = (event) => {
|
|
280
|
+
if (disabled) {
|
|
281
|
+
event.preventDefault();
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
bar.change(value);
|
|
285
|
+
onClick?.(event);
|
|
286
|
+
};
|
|
287
|
+
if (href) {
|
|
288
|
+
return (_jsx("a", { ref: ref, href: disabled ? undefined : href, "aria-current": selected ? 'page' : undefined, "aria-disabled": disabled || undefined, ...discAttributes, className: classNames, onClick: press, ...props, children: body }));
|
|
289
|
+
}
|
|
290
|
+
return (_jsx("button", { ref: ref, type: "button", disabled: disabled, "aria-current": selected ? 'page' : undefined, ...discAttributes, className: classNames, onClick: press, ...props, children: body }));
|
|
291
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlFloatingBottomNavigation, PlFloatingBottomNavigationItem } from './PlFloatingBottomNavigation.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAlignItems, PlassJustify, PlassResponsive } from '../../types.js';
|
|
4
|
+
export interface PlGridProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How many columns a row is divided into. Every `span` and every `offset`
|
|
7
|
+
* inside is read against this number, so `columns={24}` makes `span={12}` a
|
|
8
|
+
* half and not a full width.
|
|
9
|
+
* @default 12
|
|
10
|
+
*/
|
|
11
|
+
columns?: PlassResponsive<number>;
|
|
12
|
+
/**
|
|
13
|
+
* The gutter between items, on Tailwind's spacing scale — `spacing={4}` is
|
|
14
|
+
* `1rem`, the same length `gap-4` is. Fractions are allowed, so `1.5` is
|
|
15
|
+
* `0.375rem`.
|
|
16
|
+
* @default 2
|
|
17
|
+
*/
|
|
18
|
+
spacing?: PlassResponsive<number>;
|
|
19
|
+
/** The gutter between rows only. Falls back to `spacing`. */
|
|
20
|
+
rowSpacing?: PlassResponsive<number>;
|
|
21
|
+
/** The gutter between columns only. Falls back to `spacing`. */
|
|
22
|
+
columnSpacing?: PlassResponsive<number>;
|
|
23
|
+
/** How a row distributes the space its items did not use. */
|
|
24
|
+
justify?: PlassJustify;
|
|
25
|
+
/** How items sit against each other across the row. @default 'stretch' */
|
|
26
|
+
alignItems?: PlassAlignItems;
|
|
27
|
+
/** Where the rows sit when the grid is shorter than the box holding it. */
|
|
28
|
+
alignContent?: PlassJustify;
|
|
29
|
+
/**
|
|
30
|
+
* Whether a row that runs out of columns continues on the next one. Turning
|
|
31
|
+
* it off gives one row that overflows, which is what a horizontally scrolling
|
|
32
|
+
* strip wants.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
wrap?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Renders something other than a `<div>`: `render={<section />}`,
|
|
38
|
+
* `render={<ul />}`. Base UI's own escape hatch.
|
|
39
|
+
*/
|
|
40
|
+
render?: useRender.RenderProp;
|
|
41
|
+
/** The `PlGridItem`s. */
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A twelve-column row, and the parent every `PlGridItem` needs.
|
|
46
|
+
*
|
|
47
|
+
* It owns the three numbers an item cannot know on its own — how many columns
|
|
48
|
+
* there are and how wide the two gutters are — and hands them down as inherited
|
|
49
|
+
* custom properties rather than through a React context. That is not a
|
|
50
|
+
* shortcut: the values are responsive, and a media query can change an inherited
|
|
51
|
+
* custom property without React hearing about it, so the column count an item
|
|
52
|
+
* lays itself out against is always the one that is actually on screen. A
|
|
53
|
+
* context would have to re-render the tree at every breakpoint to say the same
|
|
54
|
+
* thing.
|
|
55
|
+
*
|
|
56
|
+
* It draws nothing, and it takes no `variant`, `color`, `elevation`, `size` or
|
|
57
|
+
* `density`. A grid is not a surface — it is the arrangement of the surfaces
|
|
58
|
+
* inside it — and there is no padding here either: the gutter round a page is a
|
|
59
|
+
* `PlContainer`'s and the padding round content is a `PlCard`'s, and a grid that
|
|
60
|
+
* had a track of its own would be a third one to keep in step. `spacing` is the
|
|
61
|
+
* only measurement it owns, and it is the space *between* items.
|
|
62
|
+
*
|
|
63
|
+
* Nesting is a `PlGrid` inside a `PlGridItem`, not an item that is also a grid:
|
|
64
|
+
* the inner grid re-declares the column count for its own subtree while the item
|
|
65
|
+
* around it keeps the width the outer grid gave it.
|
|
66
|
+
*/
|
|
67
|
+
export declare const PlGrid: React.ForwardRefExoticComponent<PlGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { alignContentClasses, alignItemsClasses, columnCount, justifyClasses, responsiveSlots, spacingValue, withBaseline } from '../../internal/grid.js';
|
|
4
|
+
import { cx } from '../../internal/styles.js';
|
|
5
|
+
const DEFAULT_COLUMNS = 12;
|
|
6
|
+
/** Two Tailwind steps, and the reason a bare `PlGrid` already looks like one. */
|
|
7
|
+
const DEFAULT_SPACING = 2;
|
|
8
|
+
/**
|
|
9
|
+
* A twelve-column row, and the parent every `PlGridItem` needs.
|
|
10
|
+
*
|
|
11
|
+
* It owns the three numbers an item cannot know on its own — how many columns
|
|
12
|
+
* there are and how wide the two gutters are — and hands them down as inherited
|
|
13
|
+
* custom properties rather than through a React context. That is not a
|
|
14
|
+
* shortcut: the values are responsive, and a media query can change an inherited
|
|
15
|
+
* custom property without React hearing about it, so the column count an item
|
|
16
|
+
* lays itself out against is always the one that is actually on screen. A
|
|
17
|
+
* context would have to re-render the tree at every breakpoint to say the same
|
|
18
|
+
* thing.
|
|
19
|
+
*
|
|
20
|
+
* It draws nothing, and it takes no `variant`, `color`, `elevation`, `size` or
|
|
21
|
+
* `density`. A grid is not a surface — it is the arrangement of the surfaces
|
|
22
|
+
* inside it — and there is no padding here either: the gutter round a page is a
|
|
23
|
+
* `PlContainer`'s and the padding round content is a `PlCard`'s, and a grid that
|
|
24
|
+
* had a track of its own would be a third one to keep in step. `spacing` is the
|
|
25
|
+
* only measurement it owns, and it is the space *between* items.
|
|
26
|
+
*
|
|
27
|
+
* Nesting is a `PlGrid` inside a `PlGridItem`, not an item that is also a grid:
|
|
28
|
+
* the inner grid re-declares the column count for its own subtree while the item
|
|
29
|
+
* around it keeps the width the outer grid gave it.
|
|
30
|
+
*/
|
|
31
|
+
export const PlGrid = /* @__PURE__ */ React.forwardRef(function PlGrid({ columns, spacing, rowSpacing, columnSpacing, justify, alignItems, alignContent, wrap = true, render, className, style, children, ...props }, ref) {
|
|
32
|
+
const classNames = cx('plass-grid flex', wrap ? 'flex-wrap' : 'flex-nowrap',
|
|
33
|
+
// Both gutters are read from the slots below, which is what lets a media
|
|
34
|
+
// query change them without React re-rendering.
|
|
35
|
+
'gap-x-(--p-gap-x) gap-y-(--p-gap-y)', justify ? justifyClasses[justify] : '', alignItems ? alignItemsClasses[alignItems] : '', alignContent ? alignContentClasses[alignContent] : '', className);
|
|
36
|
+
return useRender({
|
|
37
|
+
render,
|
|
38
|
+
ref,
|
|
39
|
+
props: {
|
|
40
|
+
className: classNames,
|
|
41
|
+
style: {
|
|
42
|
+
...responsiveSlots('cols', withBaseline(columns, DEFAULT_COLUMNS), columnCount),
|
|
43
|
+
...responsiveSlots('gap-x', withBaseline(columnSpacing ?? spacing, DEFAULT_SPACING), spacingValue),
|
|
44
|
+
...responsiveSlots('gap-y', withBaseline(rowSpacing ?? spacing, DEFAULT_SPACING), spacingValue),
|
|
45
|
+
...style
|
|
46
|
+
},
|
|
47
|
+
children,
|
|
48
|
+
...props
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAlignSelf, PlassResponsive } from '../../types.js';
|
|
4
|
+
export interface PlGridItemProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How many of the grid's columns the item takes. Read against the grid's
|
|
7
|
+
* `columns`, so `span={6}` is a half of the default twelve and a quarter of
|
|
8
|
+
* `columns={24}`.
|
|
9
|
+
*
|
|
10
|
+
* Responsive: `span={{ xs: 12, md: 6, lg: 4 }}` is full width on a phone, half
|
|
11
|
+
* from 48rem and a third from 64rem. Every entry applies from its own
|
|
12
|
+
* breakpoint up, so two of them usually describe a whole layout.
|
|
13
|
+
*
|
|
14
|
+
* A span wider than the row is clamped to the row rather than overflowing.
|
|
15
|
+
* @default the grid's full width
|
|
16
|
+
*/
|
|
17
|
+
span?: PlassResponsive<number>;
|
|
18
|
+
/**
|
|
19
|
+
* Columns left empty *before* the item — space pushed in ahead of it, not an
|
|
20
|
+
* absolute position in the row. First in a twelve-column row, `offset={4}`
|
|
21
|
+
* with `span={4}` is the middle third; after an item that already took four
|
|
22
|
+
* columns, the same offset skips four more and lands on the last third.
|
|
23
|
+
*
|
|
24
|
+
* Responsive in the same way `span` is.
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
offset?: PlassResponsive<number>;
|
|
28
|
+
/** Overrides the row's `alignItems` for this item alone. */
|
|
29
|
+
alignSelf?: PlassAlignSelf;
|
|
30
|
+
/**
|
|
31
|
+
* Renders something other than a `<div>`: `render={<li />}`,
|
|
32
|
+
* `render={<article />}`. Base UI's own escape hatch.
|
|
33
|
+
*/
|
|
34
|
+
render?: useRender.RenderProp;
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One cell of a `PlGrid`.
|
|
39
|
+
*
|
|
40
|
+
* It is a width and nothing else — no sheet, no padding, no typography. What
|
|
41
|
+
* goes inside brings its own, which is the whole reason a cell and a `PlCard`
|
|
42
|
+
* are two components: wrapping something in a layout must not change how it
|
|
43
|
+
* looks, and a cell that drew a sheet would make `span` a visual decision.
|
|
44
|
+
*
|
|
45
|
+
* The column count it divides by is inherited from the grid as a custom
|
|
46
|
+
* property, so an item with no `PlGrid` above it falls back to twelve rather
|
|
47
|
+
* than breaking — but it will be a lone width in a plain parent, which is not a
|
|
48
|
+
* layout. Always wrap.
|
|
49
|
+
*/
|
|
50
|
+
export declare const PlGridItem: React.ForwardRefExoticComponent<PlGridItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import { alignSelfClasses, offsetValue, responsiveSlots, spanValue } from '../../internal/grid.js';
|
|
4
|
+
import { cx } from '../../internal/styles.js';
|
|
5
|
+
/**
|
|
6
|
+
* One cell of a `PlGrid`.
|
|
7
|
+
*
|
|
8
|
+
* It is a width and nothing else — no sheet, no padding, no typography. What
|
|
9
|
+
* goes inside brings its own, which is the whole reason a cell and a `PlCard`
|
|
10
|
+
* are two components: wrapping something in a layout must not change how it
|
|
11
|
+
* looks, and a cell that drew a sheet would make `span` a visual decision.
|
|
12
|
+
*
|
|
13
|
+
* The column count it divides by is inherited from the grid as a custom
|
|
14
|
+
* property, so an item with no `PlGrid` above it falls back to twelve rather
|
|
15
|
+
* than breaking — but it will be a lone width in a plain parent, which is not a
|
|
16
|
+
* layout. Always wrap.
|
|
17
|
+
*/
|
|
18
|
+
export const PlGridItem = /* @__PURE__ */ React.forwardRef(function PlGridItem({ span, offset, alignSelf, render, className, style, children, ...props }, ref) {
|
|
19
|
+
const classNames = cx('plass-grid-item', alignSelf ? alignSelfClasses[alignSelf] : '', className);
|
|
20
|
+
return useRender({
|
|
21
|
+
render,
|
|
22
|
+
ref,
|
|
23
|
+
props: {
|
|
24
|
+
className: classNames,
|
|
25
|
+
style: {
|
|
26
|
+
...responsiveSlots('span', span, spanValue),
|
|
27
|
+
...responsiveSlots('offset', offset, offsetValue),
|
|
28
|
+
...style
|
|
29
|
+
},
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlTypographyWeight } from '../typography/PlTypography.js';
|
|
3
|
+
import type { PlassColor, PlassVariant } from '../../types.js';
|
|
4
|
+
export interface PlHighlightProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'color'> {
|
|
5
|
+
/**
|
|
6
|
+
* What to find.
|
|
7
|
+
*
|
|
8
|
+
* A string is one term, an array is several — the longest is tried first, so
|
|
9
|
+
* `['data', 'database']` marks the whole word rather than the first four
|
|
10
|
+
* letters of it. A `RegExp` is used as written, with the global flag forced
|
|
11
|
+
* on; `caseSensitive` and `wholeWord` are ignored for it, because a regular
|
|
12
|
+
* expression already says both of those things itself.
|
|
13
|
+
*/
|
|
14
|
+
query: string | string[] | RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* What the mark is made of.
|
|
17
|
+
*
|
|
18
|
+
* - `solid` — the family's gradient with its own ink on it: the highlighter
|
|
19
|
+
* pen. The default.
|
|
20
|
+
* - `glass` — a hairline box with the family's soft tint inside it, for a page
|
|
21
|
+
* where a filled run would be too much.
|
|
22
|
+
* - `ghost` — the accent colour and nothing else, for marking a word inside a
|
|
23
|
+
* heading that is already loud.
|
|
24
|
+
*
|
|
25
|
+
* `glass` is deliberately **not** blurred here, which is the one place in the
|
|
26
|
+
* library the material is quoted rather than used. A mark is a 20px-tall
|
|
27
|
+
* inline box sitting on a line of text; there is no backdrop behind it worth
|
|
28
|
+
* smearing, and `box-decoration-clone` across a line break would smear two.
|
|
29
|
+
* @default 'solid'
|
|
30
|
+
*/
|
|
31
|
+
variant?: PlassVariant;
|
|
32
|
+
/**
|
|
33
|
+
* Semantic colour role. `warning` by default, and not arbitrarily: it is the
|
|
34
|
+
* one family whose gradient is light with dark ink on it, so a `solid`
|
|
35
|
+
* `warning` mark is a yellow highlighter over black text rather than a white
|
|
36
|
+
* word on a block of colour.
|
|
37
|
+
* @default 'warning'
|
|
38
|
+
*/
|
|
39
|
+
color?: PlassColor;
|
|
40
|
+
/**
|
|
41
|
+
* Whether `a` and `A` are different letters.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
caseSensitive?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether a term has to be a word on its own — `cat` marking "cat" but not
|
|
47
|
+
* "concatenate".
|
|
48
|
+
*
|
|
49
|
+
* A word here is a run of letters, digits and underscores in any script, so it
|
|
50
|
+
* means what it should for `café` and `naïve`. It means very little for Korean
|
|
51
|
+
* or Japanese, where a phrase is not delimited by spaces at all; that is a
|
|
52
|
+
* property of the writing system rather than of this prop, and is the reason
|
|
53
|
+
* it is off by default.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
wholeWord?: boolean;
|
|
57
|
+
/** Underlines the mark as well. Combines with every variant. */
|
|
58
|
+
underline?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Sets the mark's weight. Omit it and the mark is the weight of the text
|
|
61
|
+
* around it — the surface is already saying "this one", and a bolded word
|
|
62
|
+
* inside a sentence changes the rhythm of the whole line.
|
|
63
|
+
*/
|
|
64
|
+
weight?: PlTypographyWeight;
|
|
65
|
+
/**
|
|
66
|
+
* The text to search. Elements are walked into and left otherwise untouched,
|
|
67
|
+
* so a match inside a `<strong>` is still marked and the `<strong>` survives.
|
|
68
|
+
*/
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Marks the words a reader is looking for, inside text they were already
|
|
73
|
+
* reading.
|
|
74
|
+
*
|
|
75
|
+
* The component is the search, not just the styling: `query` is what a search
|
|
76
|
+
* box holds, and everything about *how* the matching is done — case, whole
|
|
77
|
+
* words, a regular expression — is a prop rather than something a caller has to
|
|
78
|
+
* pre-compute into a list of offsets.
|
|
79
|
+
*
|
|
80
|
+
* The mark is a real `<mark>`, which is the element for "text of relevance to
|
|
81
|
+
* the reader" and is announced as such. That has one consequence worth knowing:
|
|
82
|
+
* marking eleven words in a paragraph tells a screen reader that eleven things
|
|
83
|
+
* are important, which is a way of saying nothing. A highlight is for a handful
|
|
84
|
+
* of matches.
|
|
85
|
+
*
|
|
86
|
+
* Nothing here is stateful and nothing measures — the whole component is a pure
|
|
87
|
+
* function of `children` and `query`, so it re-marks on its own the moment the
|
|
88
|
+
* search box changes.
|
|
89
|
+
*/
|
|
90
|
+
export declare const PlHighlight: React.ForwardRefExoticComponent<PlHighlightProps & React.RefAttributes<HTMLSpanElement>>;
|