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,111 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { NumberField as BaseUINumberField } from '@base-ui/react/number-field';
|
|
3
|
+
import { Field } from '@base-ui/react/field';
|
|
4
|
+
import { MinusIcon, PlusIcon } from '../../internal/icons.js';
|
|
5
|
+
import { controlHeightClasses, controlTextLeadingClasses, disabledClasses, fieldReadOnlyClasses, fieldRestClasses, focusRingClasses, focusWithinRingClasses, gapClasses, hasContent, iconClasses, metaTextClasses, paddingXClasses, radiusClasses, stackGapClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
6
|
+
/** The shell is a `PlTextField`'s, to the pixel — see `fieldRestClasses`. */
|
|
7
|
+
const shellBaseClasses = /* @__PURE__ */ [
|
|
8
|
+
'group relative flex w-full cursor-text items-center',
|
|
9
|
+
'[-webkit-tap-highlight-color:transparent]',
|
|
10
|
+
transitionClasses,
|
|
11
|
+
'focus-within:[transition-duration:0ms]',
|
|
12
|
+
focusWithinRingClasses,
|
|
13
|
+
iconClasses
|
|
14
|
+
].join(' ');
|
|
15
|
+
/**
|
|
16
|
+
* A stepper. Square, tracking the text rather than the control, so the same
|
|
17
|
+
* button works at every step of the scale without a table of its own.
|
|
18
|
+
*
|
|
19
|
+
* No `transform` on it, the same rule every control in the library keeps: what
|
|
20
|
+
* moves under the finger is the tint, not the button.
|
|
21
|
+
*/
|
|
22
|
+
const stepperClasses = /* @__PURE__ */ [
|
|
23
|
+
'inline-flex size-[1.7em] shrink-0 cursor-pointer items-center justify-center',
|
|
24
|
+
'rounded-(--plass-radius-xs) text-(--plass-muted-fg) select-none',
|
|
25
|
+
'[&_svg]:size-[0.9em] [&_svg]:shrink-0',
|
|
26
|
+
'[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]',
|
|
27
|
+
'[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease),opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
28
|
+
'active:[transition-duration:0ms]',
|
|
29
|
+
'hover:bg-(--p-soft) hover:text-(--p-accent)',
|
|
30
|
+
'active:bg-(--p-soft-press)',
|
|
31
|
+
focusRingClasses,
|
|
32
|
+
// A stepper that has run into `min` goes out like everything else that is
|
|
33
|
+
// unavailable here: the page shows through it.
|
|
34
|
+
'disabled:cursor-not-allowed disabled:bg-transparent disabled:opacity-40'
|
|
35
|
+
].join(' ');
|
|
36
|
+
/**
|
|
37
|
+
* A field that only holds a number.
|
|
38
|
+
*
|
|
39
|
+
* The shell is a `PlTextField`'s, to the pixel, because a form where the
|
|
40
|
+
* quantity box is a different height or radius from the boxes around it is a
|
|
41
|
+
* form that looks assembled rather than designed. What is added on top is a real
|
|
42
|
+
* numeric control: arrow keys and the steppers move by `step` (Shift for
|
|
43
|
+
* `largeStep`, Alt for `smallStep`), the value clamps to `min`/`max`, and
|
|
44
|
+
* `format` writes it as currency or a percentage while `value` stays a plain
|
|
45
|
+
* number.
|
|
46
|
+
*
|
|
47
|
+
* Base UI owns the hard parts — parsing what was typed against the locale,
|
|
48
|
+
* clamping, the press-and-hold repeat on the steppers, and the hidden input that
|
|
49
|
+
* submits with a form.
|
|
50
|
+
*/
|
|
51
|
+
export function PlNumberField({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, value, defaultValue, onValueChange, onValueCommitted, min, max, step, largeStep, smallStep, snapOnStep, allowWheelScrub = false, format, locale, steppers = 'end', incrementLabel = 'Increase', decrementLabel = 'Decrease', label, description, error, invalid, startIcon, endIcon, fullWidth = false, disabled = false, readOnly = false, required = false, name, placeholder, id, className, style, ...props }) {
|
|
52
|
+
const hasError = hasContent(error);
|
|
53
|
+
const isInvalid = invalid ?? hasError;
|
|
54
|
+
// Invalid re-points the whole slot family at `danger`, so the edge, the ring,
|
|
55
|
+
// the caret and the message all turn over together.
|
|
56
|
+
const family = isInvalid ? 'danger' : color;
|
|
57
|
+
// The steppers bring their own padding; stacking the shell's on top of them
|
|
58
|
+
// would leave the buttons floating in the middle of a gap. The shell keeps the
|
|
59
|
+
// padding on whichever side has no button.
|
|
60
|
+
const padX = paddingXClasses[density][size];
|
|
61
|
+
const insetClasses = {
|
|
62
|
+
end: `${padX} pe-1`,
|
|
63
|
+
split: 'px-1',
|
|
64
|
+
none: padX
|
|
65
|
+
};
|
|
66
|
+
const decrement = (_jsx(BaseUINumberField.Decrement, { "aria-label": decrementLabel, className: stepperClasses, children: _jsx(MinusIcon, {}) }));
|
|
67
|
+
const increment = (_jsx(BaseUINumberField.Increment, { "aria-label": incrementLabel, className: stepperClasses, children: _jsx(PlusIcon, {}) }));
|
|
68
|
+
const showSteppers = steppers !== 'none' && !readOnly;
|
|
69
|
+
return (_jsxs(Field.Root, { disabled: disabled, invalid: isInvalid, className: [
|
|
70
|
+
'flex-col align-top',
|
|
71
|
+
stackGapClasses[size],
|
|
72
|
+
fullWidth ? 'flex w-full' : 'inline-flex',
|
|
73
|
+
className ?? ''
|
|
74
|
+
]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(' '), style: { ...surfaceSlots(family, elevation), ...style }, ...props, children: [label ? (_jsx(Field.Label, { className: [
|
|
77
|
+
metaTextClasses[size],
|
|
78
|
+
'font-medium text-(--plass-fg)',
|
|
79
|
+
disabled ? 'opacity-50' : ''
|
|
80
|
+
]
|
|
81
|
+
.filter(Boolean)
|
|
82
|
+
.join(' '), children: label })) : null, _jsx(BaseUINumberField.Root, { id: id, name: name, className: "contents", value: value, defaultValue: defaultValue, onValueChange: (next) => onValueChange?.(next), onValueCommitted: (next) => onValueCommitted?.(next), min: min, max: max, step: step, largeStep: largeStep, smallStep: smallStep, snapOnStep: snapOnStep, allowWheelScrub: allowWheelScrub, format: format, locale: locale, disabled: disabled, readOnly: readOnly, required: required, children: _jsxs(BaseUINumberField.Group, { className: [
|
|
83
|
+
shellBaseClasses,
|
|
84
|
+
controlHeightClasses[size],
|
|
85
|
+
controlTextLeadingClasses[size],
|
|
86
|
+
radiusClasses[size],
|
|
87
|
+
gapClasses[size],
|
|
88
|
+
showSteppers ? insetClasses[steppers] : padX,
|
|
89
|
+
// An if/else rather than stacked variants: two Tailwind classes of
|
|
90
|
+
// equal specificity resolve by their order in the generated sheet.
|
|
91
|
+
disabled
|
|
92
|
+
? disabledClasses[variant]
|
|
93
|
+
: readOnly
|
|
94
|
+
? fieldReadOnlyClasses[variant]
|
|
95
|
+
: fieldRestClasses[variant]
|
|
96
|
+
].join(' '), children: [showSteppers && steppers === 'split' ? decrement : null, startIcon ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)", children: startIcon })) : null, _jsx(BaseUINumberField.Input, { placeholder: placeholder, className: [
|
|
97
|
+
'min-w-0 flex-1 self-stretch bg-transparent [font:inherit] text-inherit',
|
|
98
|
+
// Not `outline-none`: that utility zeroes `--tw-outline-style`, and
|
|
99
|
+
// the shell's focus ring is drawn from the same family.
|
|
100
|
+
'[outline:none]',
|
|
101
|
+
'tabular-nums',
|
|
102
|
+
// Split steppers put the number between the two buttons, so it
|
|
103
|
+
// belongs in the middle rather than against an edge.
|
|
104
|
+
steppers === 'split' && showSteppers ? 'text-center' : '',
|
|
105
|
+
'placeholder:text-(--plass-muted-fg)',
|
|
106
|
+
'caret-(--p-accent) selection:bg-(--p-soft-press)',
|
|
107
|
+
'disabled:cursor-not-allowed'
|
|
108
|
+
]
|
|
109
|
+
.filter(Boolean)
|
|
110
|
+
.join(' ') }), endIcon ? (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center text-(--plass-muted-fg)", children: endIcon })) : null, showSteppers && steppers === 'end' ? (_jsxs("span", { className: "flex shrink-0 items-center gap-0.5", children: [decrement, increment] })) : null, showSteppers && steppers === 'split' ? increment : null] }) }), description ? (_jsx(Field.Description, { className: `${metaTextClasses[size]} text-(--plass-muted-fg)`, children: description })) : null, hasError ? (_jsx(Field.Error, { match: true, className: `${metaTextClasses[size]} text-(--p-accent)`, children: error })) : null] }));
|
|
111
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlNumberField } from './PlNumberField.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What may be typed into a slot.
|
|
5
|
+
*
|
|
6
|
+
* `numeric` is the default because that is what a texted code is, and it is
|
|
7
|
+
* also what puts a number pad in front of a phone. `any` accepts whatever the
|
|
8
|
+
* keyboard produces — for a licence key with punctuation in it.
|
|
9
|
+
*/
|
|
10
|
+
export type PlOtpCharset = 'numeric' | 'alpha' | 'alphanumeric' | 'any';
|
|
11
|
+
export interface PlOtpFieldProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'defaultValue' | 'onChange' | 'children'> {
|
|
12
|
+
/** Drop shadow depth. `0` is the default — a field is cut into the sheet. */
|
|
13
|
+
elevation?: PlassElevation;
|
|
14
|
+
/**
|
|
15
|
+
* How many characters the code has. Clamped to 2–12: a single box is a
|
|
16
|
+
* `PlTextField`, and past twelve the row stops fitting a phone.
|
|
17
|
+
* @default 6
|
|
18
|
+
*/
|
|
19
|
+
length?: number;
|
|
20
|
+
/**
|
|
21
|
+
* What may be typed. Anything rejected is dropped rather than shown, and
|
|
22
|
+
* `onValueInvalid` reports it.
|
|
23
|
+
* @default 'numeric'
|
|
24
|
+
*/
|
|
25
|
+
charset?: PlOtpCharset;
|
|
26
|
+
/** Hides the characters, the way a password field does. @default false */
|
|
27
|
+
mask?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Splits the row every `groupSize` slots with a separator. `3` on a six-digit
|
|
30
|
+
* code gives the familiar two blocks of three.
|
|
31
|
+
*/
|
|
32
|
+
groupSize?: number;
|
|
33
|
+
/** What is drawn between two groups. @default '–' */
|
|
34
|
+
separator?: React.ReactNode;
|
|
35
|
+
/** The code. Use with `onValueChange` for a controlled field. */
|
|
36
|
+
value?: string;
|
|
37
|
+
/** What it starts as, for an uncontrolled one. */
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
onValueChange?: (value: string) => void;
|
|
40
|
+
/** Fires once every slot is filled — the moment to verify the code. */
|
|
41
|
+
onComplete?: (value: string) => void;
|
|
42
|
+
/** Fires when typed or pasted text held characters the charset rejects. */
|
|
43
|
+
onValueInvalid?: (value: string) => void;
|
|
44
|
+
/** Submits the owning form as soon as the code is complete. @default false */
|
|
45
|
+
autoSubmit?: boolean;
|
|
46
|
+
/** Label above the row, wired to the slots by Base UI's Field. */
|
|
47
|
+
label?: React.ReactNode;
|
|
48
|
+
/** Helper text below the row. */
|
|
49
|
+
description?: React.ReactNode;
|
|
50
|
+
/** Error message below the row. Its presence also turns the field invalid. */
|
|
51
|
+
error?: React.ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Forces the invalid state without a message — for when a form library owns
|
|
54
|
+
* the validity. Defaults to whether `error` has content.
|
|
55
|
+
*/
|
|
56
|
+
invalid?: boolean;
|
|
57
|
+
/** Identifies the field when a form is submitted. */
|
|
58
|
+
name?: string;
|
|
59
|
+
/** The form must have a complete code before it submits. @default false */
|
|
60
|
+
required?: boolean;
|
|
61
|
+
/** Unavailable. Every slot stops answering. */
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
/** Readable and copyable, but not typeable. @default false */
|
|
64
|
+
readOnly?: boolean;
|
|
65
|
+
/** Puts the caret in the first slot on mount. @default false */
|
|
66
|
+
autoFocus?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A row of one-character slots: a PIN, a texted verification code, an invite
|
|
70
|
+
* key.
|
|
71
|
+
*
|
|
72
|
+
* Base UI owns everything that makes this harder than it looks — one hidden
|
|
73
|
+
* value behind however many inputs, paste spread across the slots from wherever
|
|
74
|
+
* the caret was, backspace stepping back a box, a click landing on the first
|
|
75
|
+
* empty slot rather than the one under the pointer, and the autofill hook that
|
|
76
|
+
* lets a phone offer the code straight from the message.
|
|
77
|
+
*
|
|
78
|
+
* What is here is the ladder a slot is drawn on and the field shell it shares
|
|
79
|
+
* with `PlTextField` and `PlSelect` — a slot is a field-shaped box, and a form
|
|
80
|
+
* holding both should not look like two form kits stacked on each other.
|
|
81
|
+
*/
|
|
82
|
+
export declare const PlOtpField: React.ForwardRefExoticComponent<PlOtpFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Field } from '@base-ui/react/field';
|
|
4
|
+
import { OTPField } from '@base-ui/react/otp-field';
|
|
5
|
+
import { cx, disabledClasses, fieldReadOnlyClasses, fieldRestClasses, hasContent, metaTextClasses, stackGapClasses, surfaceSlots, transitionClasses } from '../../internal/styles.js';
|
|
6
|
+
/** How many slots a code may have. Two is the shortest thing worth splitting. */
|
|
7
|
+
const MIN_LENGTH = 2;
|
|
8
|
+
const MAX_LENGTH = 12;
|
|
9
|
+
/**
|
|
10
|
+
* A slot's box.
|
|
11
|
+
*
|
|
12
|
+
* Its own ladder rather than `controlHeightClasses`, for the reason a tick box
|
|
13
|
+
* has one: a slot is not a control in a row of controls, it is a character
|
|
14
|
+
* standing on its own, and an `md` slot the height of an `md` `PlButton` would
|
|
15
|
+
* be too small to read a code out of across a desk. Every step is taller than it
|
|
16
|
+
* is wide, which is what makes a row of them read as places for one character
|
|
17
|
+
* each rather than as a row of tiny fields.
|
|
18
|
+
*/
|
|
19
|
+
const slotSizeClasses = {
|
|
20
|
+
xs: 'h-7 w-6',
|
|
21
|
+
sm: 'h-8 w-7',
|
|
22
|
+
md: 'h-10 w-8',
|
|
23
|
+
lg: 'h-12 w-10',
|
|
24
|
+
xl: 'h-14 w-12'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* And its own radius, for the reason a tick box has one.
|
|
28
|
+
*
|
|
29
|
+
* `radiusClasses` is a percentage of a *control's height*, which is a cut corner
|
|
30
|
+
* on something wide and a lozenge on something nearly square: `md` is 12px, and
|
|
31
|
+
* a 12px corner on a 32px-wide box is most of the way to a pill. These are
|
|
32
|
+
* ~22% of the slot's width instead, which is the same amount of cut on this
|
|
33
|
+
* shape — a sheet with the corners taken off, never a pill.
|
|
34
|
+
*/
|
|
35
|
+
const slotRadiusClasses = {
|
|
36
|
+
xs: 'rounded-[0.3125rem]',
|
|
37
|
+
sm: 'rounded-[0.375rem]',
|
|
38
|
+
md: 'rounded-[0.4375rem]',
|
|
39
|
+
lg: 'rounded-[0.5625rem]',
|
|
40
|
+
xl: 'rounded-[0.6875rem]'
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* And its own type scale, two steps up the control ladder. A verification code
|
|
44
|
+
* is read out loud off a phone and typed with the other hand; it is the one
|
|
45
|
+
* piece of text in a form that should be bigger than the label above it.
|
|
46
|
+
*/
|
|
47
|
+
const slotTextClasses = {
|
|
48
|
+
xs: 'text-[0.8125rem]',
|
|
49
|
+
sm: 'text-[0.9375rem]',
|
|
50
|
+
md: 'text-[1.0625rem]',
|
|
51
|
+
lg: 'text-[1.25rem]',
|
|
52
|
+
xl: 'text-[1.5rem]'
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Between the slots, and the only thing `density` touches here — spacing, never
|
|
56
|
+
* the box and never the type scale, exactly as everywhere else in the library.
|
|
57
|
+
*/
|
|
58
|
+
const slotGapClasses = {
|
|
59
|
+
default: { xs: 'gap-1', sm: 'gap-1', md: 'gap-1.5', lg: 'gap-2', xl: 'gap-2.5' },
|
|
60
|
+
compact: { xs: 'gap-0.5', sm: 'gap-0.5', md: 'gap-1', lg: 'gap-1', xl: 'gap-1.5' }
|
|
61
|
+
};
|
|
62
|
+
/** `charset` is the library's word; Base UI's is `validationType`. */
|
|
63
|
+
const validationTypes = {
|
|
64
|
+
numeric: 'numeric',
|
|
65
|
+
alpha: 'alpha',
|
|
66
|
+
alphanumeric: 'alphanumeric',
|
|
67
|
+
any: 'none'
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A row of one-character slots: a PIN, a texted verification code, an invite
|
|
71
|
+
* key.
|
|
72
|
+
*
|
|
73
|
+
* Base UI owns everything that makes this harder than it looks — one hidden
|
|
74
|
+
* value behind however many inputs, paste spread across the slots from wherever
|
|
75
|
+
* the caret was, backspace stepping back a box, a click landing on the first
|
|
76
|
+
* empty slot rather than the one under the pointer, and the autofill hook that
|
|
77
|
+
* lets a phone offer the code straight from the message.
|
|
78
|
+
*
|
|
79
|
+
* What is here is the ladder a slot is drawn on and the field shell it shares
|
|
80
|
+
* with `PlTextField` and `PlSelect` — a slot is a field-shaped box, and a form
|
|
81
|
+
* holding both should not look like two form kits stacked on each other.
|
|
82
|
+
*/
|
|
83
|
+
export const PlOtpField = /* @__PURE__ */ React.forwardRef(function PlOtpField({ variant = 'glass', size = 'md', color = 'primary', density = 'default', elevation = 0, length = 6, charset = 'numeric', mask = false, groupSize, separator = '–', value, defaultValue, onValueChange, onComplete, onValueInvalid, autoSubmit = false, label, description, error, invalid, name, required = false, disabled = false, readOnly = false, autoFocus = false, className, style, ...props }, ref) {
|
|
84
|
+
const slots = Math.min(MAX_LENGTH, Math.max(MIN_LENGTH, Math.round(length)));
|
|
85
|
+
const hasError = hasContent(error);
|
|
86
|
+
const isInvalid = invalid ?? hasError;
|
|
87
|
+
// Invalid re-points the whole slot family at `danger`, exactly as on
|
|
88
|
+
// PlTextField, so the edge, the ring, the caret and the message all turn over
|
|
89
|
+
// together and no state needs tokens of its own.
|
|
90
|
+
const family = isInvalid ? 'danger' : color;
|
|
91
|
+
const slotClassNames = cx(
|
|
92
|
+
// `font-family` rather than the `font` shorthand: the shorthand would take
|
|
93
|
+
// the inherited font *size* with it and undo the ladder set on the next
|
|
94
|
+
// line.
|
|
95
|
+
'text-center font-medium [font-family:inherit]', slotSizeClasses[size], slotTextClasses[size], slotRadiusClasses[size], transitionClasses, 'caret-(--p-accent) selection:bg-(--p-soft-press)',
|
|
96
|
+
// `focus` rather than `focus-visible`: a slot is put in focus by clicking it
|
|
97
|
+
// as often as by typing into it, and the ring is the only thing saying which
|
|
98
|
+
// character the next keystroke lands on.
|
|
99
|
+
'focus:[outline:2px_solid_var(--p-ring)] focus:[outline-offset:0px]', 'focus:[transition-duration:0ms]',
|
|
100
|
+
// An if/else rather than stacked variants: two Tailwind classes of equal
|
|
101
|
+
// specificity resolve by their order in the generated stylesheet.
|
|
102
|
+
disabled
|
|
103
|
+
? disabledClasses[variant]
|
|
104
|
+
: readOnly
|
|
105
|
+
? fieldReadOnlyClasses[variant]
|
|
106
|
+
: fieldRestClasses[variant]);
|
|
107
|
+
const separatorEvery = groupSize && groupSize > 0 ? Math.round(groupSize) : 0;
|
|
108
|
+
return (_jsxs(Field.Root, { disabled: disabled, invalid: isInvalid, className: cx('inline-flex flex-col align-top', stackGapClasses[size], className), style: { ...surfaceSlots(family, elevation), ...style }, children: [hasContent(label) ? (_jsx(Field.Label, { className: cx(metaTextClasses[size], 'font-medium', disabled ? 'text-(--plass-muted-fg)' : 'text-(--plass-fg)'), children: label })) : null, _jsx(OTPField.Root, { ref: ref, length: slots, validationType: validationTypes[charset], mask: mask, name: name, required: required, disabled: disabled, readOnly: readOnly, autoSubmit: autoSubmit, value: value, defaultValue: defaultValue, onValueChange: (next) => onValueChange?.(next), onValueComplete: (next) => onComplete?.(next), onValueInvalid: (next) => onValueInvalid?.(next), className: cx('flex items-center', slotGapClasses[density][size]), ...props, children: Array.from({ length: slots }, (_, index) => (_jsxs(React.Fragment, { children: [separatorEvery > 0 && index > 0 && index % separatorEvery === 0 ? (_jsx("span", { "aria-hidden": "true", className: cx('select-none px-0.5 text-(--plass-muted-fg)', slotTextClasses[size]), children: separator })) : null, _jsx(OTPField.Input, { className: slotClassNames, autoFocus: autoFocus && index === 0 })] }, index))) }), hasContent(description) ? (_jsx(Field.Description, { className: cx(metaTextClasses[size], 'text-(--plass-muted-fg)'), children: description })) : null, hasError ? (_jsx(Field.Error, { match: true, className: cx(metaTextClasses[size], 'text-(--p-accent)'), children: error })) : null] }));
|
|
109
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlOtpField } from './PlOtpField.js';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassColor, PlassSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* How much of the page the overlay takes away.
|
|
5
|
+
*
|
|
6
|
+
* The four steps are one axis — how legible is what is behind — and they are
|
|
7
|
+
* tuned with the blur radius as much as with the alpha, because past about 16px
|
|
8
|
+
* a backdrop smears into flat colour and the scrim reads opaque no matter how
|
|
9
|
+
* low its alpha goes.
|
|
10
|
+
*
|
|
11
|
+
* - `scrim` — the neutral dim a `PlModal` puts behind itself. The page is still
|
|
12
|
+
* there and still readable; it has only stopped being reachable.
|
|
13
|
+
* - `glass` — the house material at full strength, turned on the whole page. A
|
|
14
|
+
* lighter dim over a real blur, so what is behind is present as shape and
|
|
15
|
+
* colour but not as words. For "this is being replaced".
|
|
16
|
+
* - `solid` — the page surface, opaque. For a screen that is genuinely gone.
|
|
17
|
+
* - `clear` — nothing drawn at all. Still blocks the pointer, which is the whole
|
|
18
|
+
* reason to reach for it: an invisible sheet that catches a click.
|
|
19
|
+
*/
|
|
20
|
+
export type PlOverlayTone = 'scrim' | 'glass' | 'solid' | 'clear';
|
|
21
|
+
/**
|
|
22
|
+
* An overlay takes `size`, `color` and `align` and stops there.
|
|
23
|
+
*
|
|
24
|
+
* There is no `variant` — the three materials answer "how much does this surface
|
|
25
|
+
* assert itself against the page", and an overlay has taken the page; `tone` is
|
|
26
|
+
* the question it actually has to answer. There is no `elevation` either: the
|
|
27
|
+
* overlay *is* the plane everything else floats above, and a scrim with a drop
|
|
28
|
+
* shadow is a scrim with an edge.
|
|
29
|
+
*/
|
|
30
|
+
export interface PlOverlayProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {
|
|
31
|
+
/** The overlay is shown. Use with `onOpenChange` for a controlled overlay. */
|
|
32
|
+
open?: boolean;
|
|
33
|
+
/** Whether the overlay starts shown, for an uncontrolled one. */
|
|
34
|
+
defaultOpen?: boolean;
|
|
35
|
+
onOpenChange?: (open: boolean) => void;
|
|
36
|
+
/**
|
|
37
|
+
* How much of the page is taken away.
|
|
38
|
+
* @default 'scrim'
|
|
39
|
+
*/
|
|
40
|
+
tone?: PlOverlayTone;
|
|
41
|
+
/**
|
|
42
|
+
* Whether clicking the overlay or pressing Escape closes it.
|
|
43
|
+
*
|
|
44
|
+
* Off by default, which is the other way round from `PlModal`. A modal asks a
|
|
45
|
+
* question and Escape is the universal "no"; an overlay is not asking anything
|
|
46
|
+
* — it is saying *wait* — and a save that can be dismissed by a stray click is
|
|
47
|
+
* a save the user will think finished. Turn it on for the overlay whose job is
|
|
48
|
+
* to catch a click outside something.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
dismissible?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the page behind is taken away for the keyboard too. `'trap-focus'`
|
|
54
|
+
* leaves the page scrollable and clickable while still holding focus inside,
|
|
55
|
+
* which is what a `clear` overlay usually wants.
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
modal?: boolean | 'trap-focus';
|
|
59
|
+
/**
|
|
60
|
+
* Where the content sits down the viewport.
|
|
61
|
+
* @default 'center'
|
|
62
|
+
*/
|
|
63
|
+
align?: PlassAlign;
|
|
64
|
+
/**
|
|
65
|
+
* Scale of the padding around the content.
|
|
66
|
+
* @default 'md'
|
|
67
|
+
*/
|
|
68
|
+
size?: PlassSize;
|
|
69
|
+
/** Semantic colour role. Reaches the focus ring and whatever the content reads. */
|
|
70
|
+
color?: PlassColor;
|
|
71
|
+
/**
|
|
72
|
+
* The accessible name of the overlay. Never drawn.
|
|
73
|
+
*
|
|
74
|
+
* An overlay that holds nothing readable — a bare spinner, a `clear` sheet —
|
|
75
|
+
* still has to say what it is, which is why this has a default rather than
|
|
76
|
+
* being left empty.
|
|
77
|
+
* @default 'Overlay'
|
|
78
|
+
*/
|
|
79
|
+
label?: string;
|
|
80
|
+
/** What sits on top of the scrim — a spinner, a line of text, a small card. */
|
|
81
|
+
children?: React.ReactNode;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A sheet over the whole page that stops it being used.
|
|
85
|
+
*
|
|
86
|
+
* The difference from a `PlModal` is what is *not* here: no surface, no border,
|
|
87
|
+
* no title, no actions. An overlay is the scrim on its own, with whatever the
|
|
88
|
+
* caller puts on top of it — most often a spinner and a line saying what is
|
|
89
|
+
* being waited for.
|
|
90
|
+
*
|
|
91
|
+
* It is not dismissible by default, and that is the one prop worth reading
|
|
92
|
+
* twice. Everything else Base UI owns: the portal, the scroll lock, the focus
|
|
93
|
+
* held inside, the page behind going inert, and focus returning to wherever it
|
|
94
|
+
* came from when the overlay closes.
|
|
95
|
+
*/
|
|
96
|
+
export declare function PlOverlay({ open, defaultOpen, onOpenChange, tone, dismissible, modal, align, size, color, label, className, style, children, ...props }: PlOverlayProps): React.JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as BaseUIDialog } from '@base-ui/react/dialog';
|
|
3
|
+
import { surfaceSlots } from '../../internal/styles.js';
|
|
4
|
+
/**
|
|
5
|
+
* The four tones.
|
|
6
|
+
*
|
|
7
|
+
* `scrim` matches `PlModal`'s backdrop exactly — the two have to, or a modal
|
|
8
|
+
* opened over an overlay would show a seam. `clear` draws nothing and still
|
|
9
|
+
* covers the viewport, so it goes on catching pointer events.
|
|
10
|
+
*/
|
|
11
|
+
const toneClasses = {
|
|
12
|
+
scrim: 'bg-(--plass-scrim) [backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]',
|
|
13
|
+
glass: /* @__PURE__ */ [
|
|
14
|
+
'[background-color:color-mix(in_oklab,var(--plass-scrim)_45%,transparent)]',
|
|
15
|
+
'[backdrop-filter:var(--plass-blur)] [-webkit-backdrop-filter:var(--plass-blur)]'
|
|
16
|
+
].join(' '),
|
|
17
|
+
solid: 'bg-(--plass-surface)',
|
|
18
|
+
clear: ''
|
|
19
|
+
};
|
|
20
|
+
const alignClasses = {
|
|
21
|
+
start: 'items-start',
|
|
22
|
+
center: 'items-center',
|
|
23
|
+
end: 'items-end'
|
|
24
|
+
};
|
|
25
|
+
/** The padding between the content and the edge of the viewport. */
|
|
26
|
+
const insetClasses = {
|
|
27
|
+
xs: 'p-3',
|
|
28
|
+
sm: 'p-4',
|
|
29
|
+
md: 'p-6',
|
|
30
|
+
lg: 'p-8',
|
|
31
|
+
xl: 'p-10'
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Opacity only, on both the scrim and the content. An overlay that scales or
|
|
35
|
+
* slides drags whatever is written on it across the screen, which is the one
|
|
36
|
+
* thing the house style is against — and unlike a control, this one is usually
|
|
37
|
+
* carrying a sentence.
|
|
38
|
+
*/
|
|
39
|
+
const fadeClasses = /* @__PURE__ */ [
|
|
40
|
+
'[transition:opacity_var(--plass-duration)_var(--plass-ease)]',
|
|
41
|
+
'data-[starting-style]:opacity-0 data-[ending-style]:opacity-0'
|
|
42
|
+
].join(' ');
|
|
43
|
+
/**
|
|
44
|
+
* A sheet over the whole page that stops it being used.
|
|
45
|
+
*
|
|
46
|
+
* The difference from a `PlModal` is what is *not* here: no surface, no border,
|
|
47
|
+
* no title, no actions. An overlay is the scrim on its own, with whatever the
|
|
48
|
+
* caller puts on top of it — most often a spinner and a line saying what is
|
|
49
|
+
* being waited for.
|
|
50
|
+
*
|
|
51
|
+
* It is not dismissible by default, and that is the one prop worth reading
|
|
52
|
+
* twice. Everything else Base UI owns: the portal, the scroll lock, the focus
|
|
53
|
+
* held inside, the page behind going inert, and focus returning to wherever it
|
|
54
|
+
* came from when the overlay closes.
|
|
55
|
+
*/
|
|
56
|
+
export function PlOverlay({ open, defaultOpen, onOpenChange, tone = 'scrim', dismissible = false, modal = true, align = 'center', size = 'md', color = 'primary', label = 'Overlay', className, style, children, ...props }) {
|
|
57
|
+
return (_jsx(BaseUIDialog.Root, { open: open, defaultOpen: defaultOpen, modal: modal, disablePointerDismissal: !dismissible, onOpenChange: (next, details) => {
|
|
58
|
+
// `disablePointerDismissal` covers the click; Escape has no prop of its
|
|
59
|
+
// own, so it is cancelled here by the reason the change arrives with.
|
|
60
|
+
if (!dismissible && !next && details.reason === 'escape-key') {
|
|
61
|
+
details.cancel();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
onOpenChange?.(next);
|
|
65
|
+
}, children: _jsxs(BaseUIDialog.Portal, { children: [_jsx(BaseUIDialog.Backdrop, { className: `plass-portal fixed inset-0 z-50 ${fadeClasses} ${toneClasses[tone]}` }), _jsx(BaseUIDialog.Viewport, { className: [
|
|
66
|
+
'plass-portal fixed inset-0 z-50 flex justify-center',
|
|
67
|
+
alignClasses[align],
|
|
68
|
+
insetClasses[size]
|
|
69
|
+
].join(' '), children: _jsx(BaseUIDialog.Popup, { "aria-label": label, className: [
|
|
70
|
+
'flex max-h-full max-w-full flex-col items-center justify-center',
|
|
71
|
+
'[outline:none]',
|
|
72
|
+
fadeClasses,
|
|
73
|
+
className ?? ''
|
|
74
|
+
]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(' '), style: { ...surfaceSlots(color, 0), ...style }, ...props, children: children }) })] }) }));
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PlOverlay } from './PlOverlay.js';
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassStyleProps } from '../../types.js';
|
|
3
|
+
export interface PlPaginationProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'nav'>, 'color' | 'onChange'> {
|
|
4
|
+
/** How many pages there are. Fewer than two and the whole control renders nothing. */
|
|
5
|
+
count: number;
|
|
6
|
+
/** The current page, 1-based. Use with `onPageChange` for a controlled row. */
|
|
7
|
+
page?: number;
|
|
8
|
+
/** Which page starts current, for an uncontrolled one. @default 1 */
|
|
9
|
+
defaultPage?: number;
|
|
10
|
+
onPageChange?: (page: number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* How many pages are always shown on either side of the current one.
|
|
13
|
+
* @default 1
|
|
14
|
+
*/
|
|
15
|
+
siblingCount?: number;
|
|
16
|
+
/**
|
|
17
|
+
* How many pages are always shown at each end, whatever the current page is.
|
|
18
|
+
* `0` drops the first and last page from the row, leaving only the window.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
|
+
boundaryCount?: number;
|
|
22
|
+
/** Shows the jump-to-first and jump-to-last steppers. @default false */
|
|
23
|
+
showEdges?: boolean;
|
|
24
|
+
/** Shows the previous and next steppers. @default true */
|
|
25
|
+
showArrows?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Drop shadow depth of the page buttons. `0` is the default: a row of nine
|
|
28
|
+
* keys each casting its own shadow is nine shadows.
|
|
29
|
+
* @default 0
|
|
30
|
+
*/
|
|
31
|
+
elevation?: PlassElevation;
|
|
32
|
+
/** Unavailable. Every button in the row stops answering. */
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The address of a page, which turns every number in the row into a real
|
|
36
|
+
* link.
|
|
37
|
+
*
|
|
38
|
+
* Without it the row is buttons, and a crawler cannot press one — so a paged
|
|
39
|
+
* list of articles, products or search results exists for a reader and stops
|
|
40
|
+
* at page one for everything else. With it the numbers are `<a href>`, the
|
|
41
|
+
* two arrows carry `rel="prev"` / `rel="next"`, and the browser's own
|
|
42
|
+
* behaviour comes back: open in a new tab, copy the address, see where a
|
|
43
|
+
* press is going before making it.
|
|
44
|
+
*
|
|
45
|
+
* `onPageChange` still fires and the press is still cancelled first, so a
|
|
46
|
+
* client-side router keeps the page it already has. A link with nowhere to go
|
|
47
|
+
* — the current page, a stepper at the end of the row — stays a `<button>`,
|
|
48
|
+
* because `disabled` is not something an `<a>` can be.
|
|
49
|
+
*/
|
|
50
|
+
getPageHref?: (page: number) => string;
|
|
51
|
+
/**
|
|
52
|
+
* The accessible names, none of which is ever drawn.
|
|
53
|
+
*
|
|
54
|
+
* They are props rather than being read from a message catalogue for the same
|
|
55
|
+
* reason `PlTable` takes its `empty` line as one: a library that shipped
|
|
56
|
+
* translations would have to be told which language a page is in, and the page
|
|
57
|
+
* already knows.
|
|
58
|
+
*/
|
|
59
|
+
label?: string;
|
|
60
|
+
/** Accessible name of a page button. @default `Page {n}` */
|
|
61
|
+
pageLabel?: (page: number) => string;
|
|
62
|
+
previousLabel?: string;
|
|
63
|
+
nextLabel?: string;
|
|
64
|
+
firstLabel?: string;
|
|
65
|
+
lastLabel?: string;
|
|
66
|
+
/** The live-region sentence a screen reader hears when the page changes. */
|
|
67
|
+
statusLabel?: (page: number, count: number) => string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A row of page numbers.
|
|
71
|
+
*
|
|
72
|
+
* Every button in it is a real `PlButton`, which is the point: a pagination is
|
|
73
|
+
* not a new kind of control, it is buttons in a row that happen to know about
|
|
74
|
+
* each other. Reusing the component means the row inherits the glass, the
|
|
75
|
+
* pointer bloom, the press signature, the focus ring and every future change to
|
|
76
|
+
* any of them for free — and it means an `lg` pagination lines up with an `lg`
|
|
77
|
+
* button beside it, because it *is* one.
|
|
78
|
+
*
|
|
79
|
+
* `variant` sets how the pages at rest look; the current page is always `solid`,
|
|
80
|
+
* which is the one thing the row has to say without being read. That is why the
|
|
81
|
+
* default here is `ghost` rather than the `solid` a lone PlButton takes — nine
|
|
82
|
+
* panes of tinted glass in a row say that all nine are the primary action.
|
|
83
|
+
*
|
|
84
|
+
* The markup is a `<nav>` around a `<ul>` because that is what a screen reader
|
|
85
|
+
* needs to hear: a named landmark it can skip, holding a list whose length says
|
|
86
|
+
* how far the pages go, with `aria-current="page"` marking where it is.
|
|
87
|
+
*/
|
|
88
|
+
export declare const PlPagination: React.ForwardRefExoticComponent<PlPaginationProps & React.RefAttributes<HTMLElement>>;
|