plass-ui 0.0.1 → 1.0.1
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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -0
- package/dist/components/grid/PlGridItem.d.ts +50 -0
- package/dist/components/grid/PlGridItem.js +1 -0
- package/dist/components/grid/index.d.ts +4 -0
- package/dist/components/grid/index.js +1 -0
- package/dist/components/highlight/PlHighlight.d.ts +90 -0
- package/dist/components/highlight/PlHighlight.js +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -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 +1 -1
- package/dist/internal/animate.d.ts +161 -0
- package/dist/internal/animate.js +1 -0
- package/dist/internal/button-group.d.ts +27 -0
- package/dist/internal/button-group.js +2 -0
- package/dist/internal/calendar.d.ts +148 -0
- package/dist/internal/calendar.js +1 -0
- package/dist/internal/date.d.ts +173 -0
- package/dist/internal/date.js +1 -0
- package/dist/internal/format.d.ts +24 -0
- package/dist/internal/format.js +1 -0
- package/dist/internal/grid.d.ts +67 -0
- package/dist/internal/grid.js +1 -0
- package/dist/internal/icons.d.ts +86 -1
- package/dist/internal/icons.js +1 -1
- package/dist/internal/menu.d.ts +20 -0
- package/dist/internal/menu.js +1 -0
- package/dist/internal/picker.d.ts +118 -0
- package/dist/internal/picker.js +1 -0
- package/dist/internal/progress.d.ts +145 -0
- package/dist/internal/progress.js +1 -0
- package/dist/internal/sizer.d.ts +32 -0
- package/dist/internal/sizer.js +1 -0
- package/dist/internal/styles.d.ts +198 -8
- package/dist/internal/styles.js +1 -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 +0 -8
- package/package.json +32 -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,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 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{Field as l}from"@base-ui/react/field";import{OTPField as r}from"@base-ui/react/otp-field";import{cx as n,disabledClasses as s,fieldReadOnlyClasses as i,fieldRestClasses as o,hasContent as m,metaTextClasses as d,stackGapClasses as u,surfaceSlots as c,transitionClasses as p}from"../../internal/styles.js";const f={xs:"h-7 w-6",sm:"h-8 w-7",md:"h-10 w-8",lg:"h-12 w-10",xl:"h-14 w-12"},x={xs:"rounded-[0.3125rem]",sm:"rounded-[0.375rem]",md:"rounded-[0.4375rem]",lg:"rounded-[0.5625rem]",xl:"rounded-[0.6875rem]"},g={xs:"text-[0.8125rem]",sm:"text-[0.9375rem]",md:"text-[1.0625rem]",lg:"text-[1.25rem]",xl:"text-[1.5rem]"},h={default:{xs:"gap-1",sm:"gap-1",md:"gap-1.5",lg:"gap-2",xl:"gap-2.5"},compact:{xs:"gap-0.5",sm:"gap-0.5",md:"gap-1",lg:"gap-1",xl:"gap-1.5"}},y={numeric:"numeric",alpha:"alpha",alphanumeric:"alphanumeric",any:"none"};export const PlOtpField=/* @__PURE__ */t.forwardRef(function PlOtpField({variant:b="glass",size:v="md",color:N="primary",density:V="default",elevation:w=0,length:F=6,charset:j="numeric",mask:C=!1,groupSize:M,separator:O="–",value:I,defaultValue:R,onValueChange:S,onComplete:k,onValueInvalid:q,autoSubmit:z=!1,label:P,description:_,error:A,invalid:D,name:E,required:L=!1,disabled:T=!1,readOnly:B=!1,autoFocus:G=!1,className:H,style:J,...K},Q){const U=Math.min(12,Math.max(2,Math.round(F))),W=m(A),X=D??W,Y=X?"danger":N,Z=n("text-center font-medium [font-family:inherit]",f[v],g[v],x[v],p,"caret-(--p-accent) selection:bg-(--p-soft-press)","focus:[outline:2px_solid_var(--p-ring)] focus:[outline-offset:0px]","focus:[transition-duration:0ms]",T?s[b]:B?i[b]:o[b]),$=M&&M>0?Math.round(M):0;return a(l.Root,{disabled:T,invalid:X,className:n("inline-flex flex-col align-top",u[v],H),style:{...c(Y,w),...J},children:[m(P)?e(l.Label,{className:n(d[v],"font-medium",T?"text-(--plass-muted-fg)":"text-(--plass-fg)"),children:P}):null,e(r.Root,{ref:Q,length:U,validationType:y[j],mask:C,name:E,required:L,disabled:T,readOnly:B,autoSubmit:z,value:I,defaultValue:R,onValueChange:e=>S?.(e),onValueComplete:e=>k?.(e),onValueInvalid:e=>q?.(e),className:n("flex items-center",h[V][v]),...K,children:Array.from({length:U},(l,s)=>a(t.Fragment,{children:[$>0&&s>0&&s%$===0?e("span",{"aria-hidden":"true",className:n("select-none px-0.5 text-(--plass-muted-fg)",g[v]),children:O}):null,e(r.Input,{className:Z,autoFocus:G&&0===s})]},s))}),m(_)?e(l.Description,{className:n(d[v],"text-(--plass-muted-fg)"),children:_}):null,W?e(l.Error,{match:!0,className:n(d[v],"text-(--p-accent)"),children:A}):null]})});
|
|
@@ -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 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{Dialog as s}from"@base-ui/react/dialog";import{surfaceSlots as l}from"../../internal/styles.js";const r={scrim:"bg-(--plass-scrim) [backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]",glass:/* @__PURE__ */["[background-color:color-mix(in_oklab,var(--plass-scrim)_45%,transparent)]","[backdrop-filter:var(--plass-blur)] [-webkit-backdrop-filter:var(--plass-blur)]"].join(" "),solid:"bg-(--plass-surface)",clear:""},i={start:"items-start",center:"items-center",end:"items-end"},t={xs:"p-3",sm:"p-4",md:"p-6",lg:"p-8",xl:"p-10"},n=/* @__PURE__ */["[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" ");export function PlOverlay({open:o,defaultOpen:c,onOpenChange:p,tone:m="scrim",dismissible:d=!1,modal:f=!0,align:u="center",size:b="md",color:x="primary",label:y="Overlay",className:g,style:j,children:k,...h}){return e(s.Root,{open:o,defaultOpen:c,modal:f,disablePointerDismissal:!d,onOpenChange:(e,a)=>{d||e||"escape-key"!==a.reason?p?.(e):a.cancel()},children:a(s.Portal,{children:[e(s.Backdrop,{className:`plass-portal fixed inset-0 z-50 ${n} ${r[m]}`}),e(s.Viewport,{className:["plass-portal fixed inset-0 z-50 flex justify-center",i[u],t[b]].join(" "),children:e(s.Popup,{"aria-label":y,className:["flex max-h-full max-w-full flex-col items-center justify-center","[outline:none]",n,g??""].filter(Boolean).join(" "),style:{...l(x,0),...j},...h,children:k})})]})})}
|
|
@@ -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>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{PlButton as n}from"../button/PlButton.js";import{ChevronIcon as r}from"../../internal/icons.js";import{controlTextClasses as l,gapClasses as i,srOnlyClasses as o}from"../../internal/styles.js";function range(e,a){return Array.from({length:Math.max(0,a-e+1)},(a,t)=>e+t)}function DoubleChevronIcon(){return e("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e("path",{d:"m7.5 4.5 3.5 3.5-3.5 3.5M3.5 4.5 7 8l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}const s={xs:"h-6 min-w-6",sm:"h-8 min-w-8",md:"h-10 min-w-10",lg:"h-12 min-w-12",xl:"h-14 min-w-14"};export const PlPagination=/* @__PURE__ */t.forwardRef(function PlPagination({variant:c="ghost",size:m="md",color:u="primary",density:h="compact",elevation:d=0,count:f,page:g,defaultPage:p=1,onPageChange:x,siblingCount:b=1,boundaryCount:v=1,showEdges:y=!1,showArrows:M=!0,disabled:P=!1,getPageHref:j,label:w="Pagination",pageLabel:N=e=>`Page ${e}`,previousLabel:C="Previous page",nextLabel:L="Next page",firstLabel:k="First page",lastLabel:$="Last page",statusLabel:D=(e,a)=>`Page ${e} of ${a}`,className:I,children:K,...z},B){const[A,R]=t.useState(p),E=Math.min(Math.max(g??A,1),Math.max(f,1));if(f<2)return null;const F=function paginationRange(e,a,t,n){const r=range(1,Math.min(n,e)),l=range(Math.max(e-n+1,n+1),e),i=Math.max(Math.min(a-t,e-n-2*t-1),n+2),o=Math.min(Math.max(a+t,n+2*t+2),l.length>0?l[0]-2:e-1);return[...r,...i>n+2?["start-ellipsis"]:n+1<e-n?[n+1]:[],...range(i,o),...o<e-n-1?["end-ellipsis"]:e-n>n?[e-n]:[],...l]}(f,E,b,v),H=E<=1,S=E>=f,linkProps=(a,t,n)=>j&&!t?{render:e("a",{href:j(a),rel:n})}:null,press=(e,a)=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||j&&!x||(e.preventDefault(),(e=>{const a=Math.min(Math.max(e,1),f);a!==E&&(void 0===g&&R(a),x?.(a))})(a))},stepper=(a,t,r,l,i,o,s)=>e("li",{className:"flex",children:e(n,{variant:c,size:m,color:u,density:h,elevation:d,disabled:P||l,"aria-label":t,startIcon:e("span",{className:`flex items-center ${i}`,children:o}),onClick:e=>press(e,r),...linkProps(r,P||l,s)})},a);return a("nav",{ref:B,"aria-label":w,className:["flex items-center",I??""].filter(Boolean).join(" "),...z,children:[a("ul",{role:"list",className:`m-0 flex list-none items-center p-0 ${i[m]}`,children:[y?stepper("first",k,1,H,"rotate-180 rtl:rotate-0",e(DoubleChevronIcon,{})):null,M?stepper("previous",C,E-1,H,"rotate-90 rtl:-rotate-90",e(r,{}),"prev"):null,F.map((a,t)=>e("li","number"==typeof a?{className:"flex",children:e(n,{variant:a===E?"solid":c,size:m,color:u,density:h,elevation:d,disabled:P,"aria-label":N(a),"aria-current":a===E?"page":void 0,className:"tabular-nums",onClick:e=>press(e,a),...linkProps(a,P||a===E),children:a})}:{"aria-hidden":"true",className:["flex select-none items-center justify-center","text-(--plass-muted-fg)",l[m],s[m]].join(" "),children:"…"},`slot-${t}`)),M?stepper("next",L,E+1,S,"-rotate-90 rtl:rotate-90",e(r,{}),"next"):null,y?stepper("last",$,f,S,"rtl:rotate-180",e(DoubleChevronIcon,{})):null]}),e("span",{className:o,"aria-live":"polite",children:D(E,f)}),K]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlPagination}from"./PlPagination.js";
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassOrientation, PlassSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A pane's share of the split, as a percentage of the container or as a CSS
|
|
5
|
+
* length.
|
|
6
|
+
*
|
|
7
|
+
* A bare number is a percentage — that is what a split is usually described in,
|
|
8
|
+
* and a percentage keeps its meaning when the window changes size. A string is
|
|
9
|
+
* an absolute length (`'240px'`, `'15rem'`, `'20%'`), which is what a sidebar
|
|
10
|
+
* with a minimum actually needs: "at least 200 pixels" does not survive being
|
|
11
|
+
* written down as a percentage of a width nobody knows yet.
|
|
12
|
+
*/
|
|
13
|
+
export type PlPaneSize = number | string;
|
|
14
|
+
export interface PlPanesProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
15
|
+
/**
|
|
16
|
+
* Which way the panes run. `horizontal` puts them side by side with upright
|
|
17
|
+
* handles between them; `vertical` stacks them.
|
|
18
|
+
* @default 'horizontal'
|
|
19
|
+
*/
|
|
20
|
+
orientation?: PlassOrientation;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the handles between the panes can be dragged. Turn it off for a
|
|
23
|
+
* split that is a layout rather than a control.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
resizable?: boolean;
|
|
27
|
+
/** The colour family the handles light up in. @default 'primary' */
|
|
28
|
+
color?: PlassColor;
|
|
29
|
+
/** How thick a handle is, and how far it reaches. @default 'md' */
|
|
30
|
+
size?: PlassSize;
|
|
31
|
+
/** Fires with every pane's share, in percent, while a handle is dragged. */
|
|
32
|
+
onResize?: (sizes: number[]) => void;
|
|
33
|
+
/** Fires once, with the same shape, when the handle is let go. */
|
|
34
|
+
onResizeEnd?: (sizes: number[]) => void;
|
|
35
|
+
/** The panes. Anything that is not a `PlPane` is still laid out, but has no size. */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export interface PlPaneProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
39
|
+
/**
|
|
40
|
+
* The share this pane starts with. Panes with no `defaultSize` split whatever
|
|
41
|
+
* is left over equally.
|
|
42
|
+
*/
|
|
43
|
+
defaultSize?: PlPaneSize;
|
|
44
|
+
/** How small it may be dragged. @default 0 */
|
|
45
|
+
minSize?: PlPaneSize;
|
|
46
|
+
/** How large it may be dragged. Unbounded when left out. */
|
|
47
|
+
maxSize?: PlPaneSize;
|
|
48
|
+
/** What is inside the pane. */
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A set of panes with draggable handles between them.
|
|
53
|
+
*
|
|
54
|
+
* The panes are sized in **fractions**, written out as
|
|
55
|
+
* `flex-basis: calc((100% - gutters) * fraction)`. That is the one decision the
|
|
56
|
+
* rest of this file follows from: a split described in percentages survives the
|
|
57
|
+
* window being resized without a single line of JavaScript running, so the
|
|
58
|
+
* component measures itself only twice — once on mount, to turn a `'240px'`
|
|
59
|
+
* default into a fraction, and once at the start of each drag, to know what a
|
|
60
|
+
* pixel of pointer movement is worth.
|
|
61
|
+
*
|
|
62
|
+
* The handles are interleaved here rather than written by the caller, so the
|
|
63
|
+
* children of a `PlPanes` are just panes. That does mean the direct children have
|
|
64
|
+
* to *be* `PlPane`s: the constraints are read off their props, and a pane wrapped
|
|
65
|
+
* in something else is a pane with no minimum.
|
|
66
|
+
*/
|
|
67
|
+
export declare const PlPanes: React.ForwardRefExoticComponent<PlPanesProps & React.RefAttributes<HTMLDivElement>>;
|
|
68
|
+
/**
|
|
69
|
+
* One region of a split.
|
|
70
|
+
*
|
|
71
|
+
* It carries no surface of its own on purpose: a split is layout, and the moment
|
|
72
|
+
* a pane drew a sheet it would stop being usable as the thing a `PlCard`, a
|
|
73
|
+
* `PlTable` or an editor is put inside. Put a `PlCard` in it when a surface is
|
|
74
|
+
* wanted.
|
|
75
|
+
*
|
|
76
|
+
* `defaultSize`, `minSize` and `maxSize` are read by the `PlPanes` around it
|
|
77
|
+
* rather than used here — a pane cannot know what "half" is, only the split can.
|
|
78
|
+
*/
|
|
79
|
+
export declare const PlPane: React.ForwardRefExoticComponent<PlPaneProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as n from"react";import{cx as r,transitionClasses as i}from"../../internal/styles.js";const s=/* @__PURE__ */n.createContext({basis:null}),o={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},a={xs:4,sm:6,md:8,lg:10,xl:12};function toPixels(e,t,n){if(null==e)return;if("number"==typeof e)return t*e/100;const r=/^\s*(-?[\d.]+)\s*(px|rem|em|%)\s*$/.exec(e);if(!r)return;const i=Number(r[1]);if(!Number.isNaN(i))switch(r[2]){case"px":return i;case"%":return t*i/100;case"rem":return i*parseFloat(getComputedStyle(document.documentElement).fontSize||"16");case"em":return i*parseFloat(n&&getComputedStyle(n).fontSize||"16");default:return}}export const PlPanes=/* @__PURE__ */n.forwardRef(function PlPanes({orientation:l="horizontal",resizable:c=!0,color:u="primary",size:d="md",onResize:m,onResizeEnd:p,className:f,style:g,children:h,...x},v){const b=n.Children.toArray(h).filter(n.isValidElement),y=b.length,w=n.useRef(null),z=n.useCallback(e=>{w.current=e,"function"==typeof v?v(e):v&&(v.current=e)},[v]),P=n.useRef([]);P.current=b.map(e=>e.props);const[S,R]=n.useState(null),E=S&&S.length===y?S:null,k=n.useRef(null);k.current=E;const C="horizontal"===l,N=a[d]*Math.max(0,y-1);function grip(e){const t=w.current,n=k.current;if(!c||!t||!n||void 0===n[e+1])return null;const r=t.getBoundingClientRect(),i=(C?r.width:r.height)-N;if(i<=0)return null;const s=P.current[e],o=P.current[e+1],a=n[e]*i,l=a+n[e+1]*i,u=Math.max(toPixels(s?.minSize,i,t)??0,l-(toPixels(o?.maxSize,i,t)??l)),d=Math.min(toPixels(s?.maxSize,i,t)??l,l-(toPixels(o?.minSize,i,t)??0));return d<u?null:{root:t,current:n,extent:i,start:a,pair:l,resize(t){const r=Math.min(d,Math.max(u,a+t)),s=[...n];return s[e]=r/i,s[e+1]=(l-r)/i,R(s),m?.(s.map(e=>100*e)),s}}}n.useEffect(()=>{const e=w.current;if(!e)return;const measure=()=>{const t=e.getBoundingClientRect(),n=(C?t.width:t.height)-N;n<=0||R(t=>t&&t.length===y?t:function initialFractions(e,t,n){const r=e.map(e=>toPixels(e.defaultSize,t,n)),i=r.reduce((e,t)=>e+(t??0),0),s=r.filter(e=>void 0===e).length,o=s>0?Math.max(0,t-i)/s:0,a=r.map(e=>Math.max(0,e??o)),l=a.reduce((e,t)=>e+t,0);return l<=0?a.map(()=>1/Math.max(1,a.length)):a.map(e=>e/l)}(P.current,n,e))};measure();const t=new ResizeObserver(measure);return t.observe(e),()=>t.disconnect()},[y,C,N]);const M=n.useRef(null);n.useEffect(()=>()=>M.current?.(),[]);const L=r("group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",o[d],i,"[outline:none] focus-visible:[outline:2px_solid_var(--p-ring)] focus-visible:outline-offset-0",c?r(C?"cursor-col-resize":"cursor-row-resize","hover:bg-(--p-soft) data-[dragging]:bg-(--p-soft)"):"");return e("div",{ref:z,className:r("flex h-full w-full",C?"flex-row":"flex-col","min-h-0 min-w-0",f),style:{"--p-accent":`var(--plass-${u}-accent)`,"--p-soft":`var(--plass-${u}-soft)`,"--p-ring":`var(--plass-${u}-ring)`,...g},...x,children:b.map((o,a)=>t(n.Fragment,{children:[a>0?e("div",{role:"separator","aria-orientation":C?"vertical":"horizontal","aria-valuenow":E?Math.round(100*E[a-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!c||void 0,tabIndex:c?0:-1,className:L,onPointerDown:e=>{0===e.button&&function beginDrag(e,t){const n=grip(e);if(!n)return;const r=t.currentTarget;r.setPointerCapture(t.pointerId),r.dataset.dragging="true";const i=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const s=C?t.clientX:t.clientY,o=C&&"rtl"===getComputedStyle(n.root).direction?-1:1;let a=n.current;const move=e=>{const t=C?e.clientX:e.clientY;a=n.resize((t-s)*o)},release=()=>{M.current=null,r.removeEventListener("pointermove",move),r.removeEventListener("pointerup",end),r.removeEventListener("pointercancel",end),delete r.dataset.dragging,i?document.body.style.setProperty("-webkit-user-select",i):document.body.style.removeProperty("-webkit-user-select")},end=()=>{release(),p?.(a.map(e=>100*e))};M.current=release,r.addEventListener("pointermove",move),r.addEventListener("pointerup",end),r.addEventListener("pointercancel",end)}(a-1,e)},onKeyDown:e=>{const t=C?"ArrowLeft":"ArrowUp",n=C?"ArrowRight":"ArrowDown";e.key!==t&&e.key!==n||(e.preventDefault(),function nudge(e,t){const n=grip(e);if(!n)return;const r=n.resize(t);p?.(r.map(e=>100*e))}(a-1,e.key===n?16:-16))},children:e("span",{"aria-hidden":"true",className:r("pointer-events-none bg-(--plass-border)",i,C?"h-full w-px":"h-px w-full",c?"group-hover/handle:bg-(--p-accent) group-focus-visible/handle:bg-(--p-accent) group-data-[dragging]/handle:bg-(--p-accent)":"")})}):null,e(s.Provider,{value:{basis:E?`calc((100% - ${N}px) * ${E[a].toFixed(6)})`:null},children:o})]},o.key??a))})});export const PlPane=/* @__PURE__ */n.forwardRef(function PlPane({defaultSize:t,minSize:i,maxSize:o,className:a,style:l,children:c,...u},d){const{basis:m}=n.useContext(s);return e("div",{ref:d,className:r("relative min-h-0 min-w-0 overflow-auto",a),style:{flex:m?`0 0 ${m}`:"1 1 0%",...l},...u,children:c})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlPane,PlPanes}from"./PlPanes.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassElevation, PlassPosition, PlassStyleProps } from '../../types.js';
|
|
3
|
+
export interface PlPillProps extends PlassStyleProps, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'onClick' | 'title'> {
|
|
4
|
+
/**
|
|
5
|
+
* Drop shadow depth. `2` here, against the `0` almost everything else takes.
|
|
6
|
+
*
|
|
7
|
+
* That is not an inconsistency: a pill is defined by **not** being part of the
|
|
8
|
+
* page. Every other surface in the library rests on the page and earns its
|
|
9
|
+
* separation from the glass edge, so a shadow is opt-in. This one hovers over
|
|
10
|
+
* whatever is underneath it, and a lozenge lying flat on the content it is
|
|
11
|
+
* floating over reads as a mistake — the same argument
|
|
12
|
+
* `PlFloatingBottomNavigation` makes for its own `2`.
|
|
13
|
+
* @default 2
|
|
14
|
+
*/
|
|
15
|
+
elevation?: PlassElevation;
|
|
16
|
+
/**
|
|
17
|
+
* The leading slot — a glyph, an avatar, a status dot, a photo.
|
|
18
|
+
*
|
|
19
|
+
* It is given a square box of its own and clipped to a circle, so an `<img>`
|
|
20
|
+
* lands in it as readily as an icon does: the image fills the box and is
|
|
21
|
+
* cropped rather than letterboxed, which is what a 20px portrait wants.
|
|
22
|
+
*/
|
|
23
|
+
startIcon?: React.ReactNode;
|
|
24
|
+
/** The trailing slot. Outside the pressable area, so it can be a control. */
|
|
25
|
+
endIcon?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* The headline in the middle — what the pill is currently about.
|
|
28
|
+
*
|
|
29
|
+
* A prop rather than something to compose, for the reason `PlCard`'s title is
|
|
30
|
+
* one: the arrangement is fixed and what a caller wants to decide is what goes
|
|
31
|
+
* in each slot. Almost every pill is a line of text and an optional second
|
|
32
|
+
* line under it, and spelling that as children means every caller inventing
|
|
33
|
+
* their own centring and type scale.
|
|
34
|
+
*/
|
|
35
|
+
title?: React.ReactNode;
|
|
36
|
+
/** The second line, under the title. One step down and quieter. */
|
|
37
|
+
description?: React.ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* The second half, revealed when `expanded`.
|
|
40
|
+
*
|
|
41
|
+
* The pill grows downward into it rather than swapping to a different shape:
|
|
42
|
+
* one object saying more.
|
|
43
|
+
*/
|
|
44
|
+
details?: React.ReactNode;
|
|
45
|
+
/** Whether `details` is showing. @default false */
|
|
46
|
+
expanded?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* How it sits in the page's scroll. `fixed` pins it against the viewport and
|
|
49
|
+
* centres it horizontally, which is the arrangement this shape exists for.
|
|
50
|
+
* @default 'static'
|
|
51
|
+
*/
|
|
52
|
+
position?: PlassPosition;
|
|
53
|
+
/** Which edge it is held against when `position` is not `static`. @default 'top' */
|
|
54
|
+
side?: 'top' | 'bottom';
|
|
55
|
+
/** Passing it makes the middle a real button. */
|
|
56
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
57
|
+
/**
|
|
58
|
+
* Anything the middle needs that `title` and `description` cannot say — a
|
|
59
|
+
* pair of small readouts, a live counter. Rendered under them, in the same
|
|
60
|
+
* centred column.
|
|
61
|
+
*/
|
|
62
|
+
children?: React.ReactNode;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A floating lozenge holding a small amount of live information.
|
|
66
|
+
*
|
|
67
|
+
* The shape is a **stadium**, which the house radius rule otherwise forbids:
|
|
68
|
+
* every control is held just short of the 50% that would make it a pill, because
|
|
69
|
+
* the flat run along its top and bottom edge is what still reads as a sheet with
|
|
70
|
+
* the corners cut off it. This is the exception the rule is drawn against, and
|
|
71
|
+
* it works for the same reason the rule does — this is not a sheet lying on the
|
|
72
|
+
* page. It is an object hovering over one, and an object hovering over the page
|
|
73
|
+
* should not look as though it was cut from the same material.
|
|
74
|
+
*
|
|
75
|
+
* `details` is revealed by animating a measured height, exactly as a
|
|
76
|
+
* `PlAccordion` panel is: nothing is transformed and no text is resampled, the
|
|
77
|
+
* pill is simply a window that opens. The measurement is a `ResizeObserver`
|
|
78
|
+
* rather than a hardcoded height, so a details area whose content changes —
|
|
79
|
+
* which is what live information does — grows with it.
|
|
80
|
+
*/
|
|
81
|
+
export declare const PlPill: React.ForwardRefExoticComponent<PlPillProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as s,Fragment as t}from"react/jsx-runtime";import*as l from"react";import{controlSlots as n,controlTextClasses as r,cx as o,focusRingClasses as i,gapClasses as a,glassClasses as c,hasContent as d,iconClasses as m,iconSizeClasses as p,metaTextClasses as f,paddingXClasses as x,sheetBodyClasses as u,transitionClasses as h}from"../../internal/styles.js";const g={solid:"text-(--p-on-solid) [background-image:var(--p-fill)] [box-shadow:var(--p-elev),var(--p-lift)]",glass:/* @__PURE__ */[c,"border text-(--p-accent) bg-(--plass-glass)","[border-color:var(--plass-glass-line)]","[box-shadow:var(--p-elev),var(--plass-gloss-glass)]"].join(" "),ghost:`${c} text-(--p-accent) bg-(--p-soft)`},v={solid:"hover:brightness-105 active:brightness-95",glass:"hover:bg-(--plass-glass-hover) hover:[border-color:var(--p-line)] active:bg-(--plass-glass-press)",ghost:"hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)"},b={xs:"min-h-5.5",sm:"min-h-6.5",md:"min-h-8",lg:"min-h-10",xl:"min-h-12"},w={xs:"rounded-[0.6875rem]",sm:"rounded-[0.8125rem]",md:"rounded-[1rem]",lg:"rounded-[1.25rem]",xl:"rounded-[1.5rem]"},y={default:{xs:"px-3",sm:"px-4",md:"px-5",lg:"px-6",xl:"px-8"},compact:{xs:"px-1.5",sm:"px-2",md:"px-2.5",lg:"px-3",xl:"px-4"}},N={static:{top:"",bottom:""},sticky:{top:"sticky top-3 z-20",bottom:"sticky bottom-3 z-20"},fixed:{top:"fixed inset-x-0 top-3 z-30 mx-auto w-fit",bottom:"fixed inset-x-0 bottom-3 z-30 mx-auto w-fit"}};export const PlPill=/* @__PURE__ */l.forwardRef(function PlPill({variant:c="solid",size:k="md",color:j="secondary",density:z="default",elevation:_=2,startIcon:P,endIcon:R,title:C,description:H,details:I,expanded:O=!1,position:$="static",side:B="top",className:E,style:F,children:S,onClick:q,...A},D){const G=l.useRef(null),[J,K]=l.useState(0);l.useEffect(()=>{const e=G.current;if(!e||"undefined"==typeof ResizeObserver)return;const s=new ResizeObserver(()=>K(e.scrollHeight));return s.observe(e),K(e.scrollHeight),()=>s.disconnect()},[I]);const L=Boolean(q),M=x[z][k],Q=s(t,{children:[d(P)?e("span",{className:o("flex shrink-0 items-center justify-center overflow-hidden rounded-full [&_img]:size-full [&_img]:object-cover",p[k]),children:P}):null,d(C)||d(H)||d(S)?s("span",{className:o("flex min-w-0 flex-1 flex-col items-center justify-center text-center",y[z][k]),children:[d(C)?e("span",{className:"max-w-full truncate",children:C}):null,d(H)?e("span",{className:o("max-w-full truncate font-normal",f[k],"[color:color-mix(in_oklab,currentColor_72%,transparent)]"),children:H}):null,S]}):null]});return s("div",{ref:D,className:o("inline-flex max-w-full flex-col overflow-hidden align-middle",w[k],"font-medium whitespace-nowrap select-none",r[k],g[c],h,m,L?`plass-glow ${v[c]}`:"",N[$][B],E),style:{...n(j,_,c),...F},...A,children:[s("div",{className:o("flex shrink-0 items-center py-1",b[k],a[k],L?"ps-0":M,d(R)?"pe-1":L?"pe-0":""),children:[L?e("button",{type:"button",className:o("flex min-w-0 flex-1 cursor-pointer items-center justify-center self-stretch","rounded-[inherit]",a[k],M,i),onClick:q,children:Q}):Q,d(R)?e("span",{className:"flex h-[1lh] shrink-0 items-center",children:R}):null]}),d(I)?e("div",{className:o("overflow-hidden","[transition:height_var(--plass-duration-slow)_var(--plass-ease)]","motion-reduce:[transition-duration:0ms]"),style:{height:O?J:0},inert:!O,children:e("div",{ref:G,className:o("whitespace-normal pb-2",M,u[k]),children:I})}):null]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlPill}from"./PlPill.js";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Popover as BaseUIPopover } from '@base-ui/react/popover';
|
|
3
|
+
import type { PlassAlign, PlassSide, PlassStyleProps } from '../../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A popover takes `size`, `color` and `density` and stops there.
|
|
6
|
+
*
|
|
7
|
+
* There is no `variant`, for `PlMenu`'s reason: the three materials answer "how
|
|
8
|
+
* much does this surface assert itself against the page", and a popup that had
|
|
9
|
+
* to be asked for has already answered it. There is no `elevation` either — a
|
|
10
|
+
* popover genuinely floats, which is the one case the ladder exists for, so it
|
|
11
|
+
* is fixed at its top rung.
|
|
12
|
+
*/
|
|
13
|
+
export interface PlPopoverProps extends Pick<PlassStyleProps, 'size' | 'color' | 'density'>, Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'title' | 'children'> {
|
|
14
|
+
/**
|
|
15
|
+
* The element the popup hangs off and that opens it. Exactly one element,
|
|
16
|
+
* which must accept a ref and spread props — every Plass component does.
|
|
17
|
+
*
|
|
18
|
+
* Optional: a controlled popover anchored from elsewhere needs none, though it
|
|
19
|
+
* then has nothing to position against and will sit against the viewport.
|
|
20
|
+
*/
|
|
21
|
+
trigger?: React.ReactElement;
|
|
22
|
+
/** The heading, rendered as the element that names the popup. */
|
|
23
|
+
title?: React.ReactNode;
|
|
24
|
+
/** A line under the title, and the popup's accessible description. */
|
|
25
|
+
description?: React.ReactNode;
|
|
26
|
+
/** The body. */
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Which edge of the trigger it appears on. Flips to the opposite side when
|
|
30
|
+
* there is no room, which is Base UI's doing and is the right behaviour.
|
|
31
|
+
* @default 'bottom'
|
|
32
|
+
*/
|
|
33
|
+
side?: PlassSide;
|
|
34
|
+
/** Where it sits along that edge. @default 'center' */
|
|
35
|
+
align?: PlassAlign;
|
|
36
|
+
/** Distance from the trigger, in pixels. @default 6 */
|
|
37
|
+
sideOffset?: number;
|
|
38
|
+
/** Shift along that edge, in pixels. @default 0 */
|
|
39
|
+
alignOffset?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Draws the little wedge pointing at the trigger.
|
|
42
|
+
*
|
|
43
|
+
* Off by default, unlike on a `PlTooltip`. A tooltip is a filled plate and its
|
|
44
|
+
* wedge is the same solid colour; this surface is translucent over a blurred
|
|
45
|
+
* backdrop, and a wedge sticking out past the popup's own box cannot carry
|
|
46
|
+
* that backdrop with it. Turn it on where the trigger is far enough away that
|
|
47
|
+
* the popup needs to say what it belongs to.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
arrow?: boolean;
|
|
51
|
+
/** Whether the popover is open. Use with `onOpenChange` for a controlled one. */
|
|
52
|
+
open?: boolean;
|
|
53
|
+
/** Whether it starts open, for an uncontrolled one. */
|
|
54
|
+
defaultOpen?: boolean;
|
|
55
|
+
onOpenChange?: (open: boolean) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the page behind is taken away. `false` — the default — leaves the
|
|
58
|
+
* page scrollable and clickable, which is what separates a popover from a
|
|
59
|
+
* `PlModal`: it is a detail beside the page, not instead of it.
|
|
60
|
+
* `'trap-focus'` holds focus inside without locking the scroll.
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
modal?: boolean | 'trap-focus';
|
|
64
|
+
/**
|
|
65
|
+
* Whether pressing Escape or clicking outside closes the popup. Turn it off
|
|
66
|
+
* only for a popup with its own way out, because there will be no other.
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
dismissible?: boolean;
|
|
70
|
+
/** Shows the × in the corner. @default false */
|
|
71
|
+
showClose?: boolean;
|
|
72
|
+
/** Accessible name of the × button. Never drawn. @default 'Close' */
|
|
73
|
+
closeLabel?: string;
|
|
74
|
+
/**
|
|
75
|
+
* A hard cap on the popup's width, overriding the one `size` implies. Numbers
|
|
76
|
+
* are pixels. For the popover whose content decides its width — a form, a
|
|
77
|
+
* single line of help — rather than for tuning the scale, which is `size`.
|
|
78
|
+
*/
|
|
79
|
+
width?: number | string;
|
|
80
|
+
}
|
|
81
|
+
export type PlPopoverCloseProps = React.ComponentPropsWithoutRef<typeof BaseUIPopover.Close>;
|
|
82
|
+
/**
|
|
83
|
+
* Closes the popover it is inside.
|
|
84
|
+
*
|
|
85
|
+
* Exported for `PlModalClose`'s reason: an uncontrolled popover has no `setOpen`
|
|
86
|
+
* for its Cancel button to call, and making every popover controlled is a piece
|
|
87
|
+
* of state per popover that exists only to answer a button.
|
|
88
|
+
*
|
|
89
|
+
* `render` is Base UI's own escape hatch, so a real Plass button dismisses:
|
|
90
|
+
* `<PlPopoverClose render={<PlButton variant="ghost">Cancel</PlButton>} />`.
|
|
91
|
+
*/
|
|
92
|
+
export declare const PlPopoverClose: React.ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
93
|
+
/**
|
|
94
|
+
* A sheet that opens beside the thing that opened it.
|
|
95
|
+
*
|
|
96
|
+
* The difference from a `PlTooltip` is that this one can be **reached**: it
|
|
97
|
+
* stays up until it is dismissed, it can be entered with the pointer or the
|
|
98
|
+
* keyboard, and what is inside it can be clicked and typed into. The difference
|
|
99
|
+
* from a `PlModal` is that it does not take the page — it is anchored to a
|
|
100
|
+
* control, and the page behind goes on working.
|
|
101
|
+
*
|
|
102
|
+
* Base UI owns everything hard about it: the anchoring and the flip at the
|
|
103
|
+
* window edge, the click-outside and Escape, returning focus to the trigger, and
|
|
104
|
+
* the `aria-labelledby` / `aria-describedby` wiring. What is left here is the
|
|
105
|
+
* surface, the width ladder and the header.
|
|
106
|
+
*/
|
|
107
|
+
export declare function PlPopover({ size, color, density, trigger, title, description, children, side, align, sideOffset, alignOffset, arrow, open, defaultOpen, onOpenChange, modal, dismissible, showClose, closeLabel, width, className, style, ...props }: PlPopoverProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Popover as a}from"@base-ui/react/popover";import{CloseIcon as l}from"../../internal/icons.js";import{cx as t,focusRingClasses as o,glassClasses as r,hasContent as i,metaTextClasses as n,radiusClasses as d,sheetBodyClasses as p,sheetHeaderGapClasses as c,sheetPaddingXClasses as m,sheetPaddingYClasses as f,sheetSectionGapClasses as g,sheetTitleClasses as h,surfaceSlots as u}from"../../internal/styles.js";const x={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},v=/* @__PURE__ */[r,"relative flex flex-col","border text-(--plass-fg) bg-(--plass-glass-press)","[border-color:var(--plass-glass-line)]","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]","[outline:none]","[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"].join(" "),b={xs:8,sm:9,md:10,lg:11,xl:12},w=/* @__PURE__ */["flex size-[1.6em] shrink-0 cursor-pointer items-center justify-center","rounded-full text-(--plass-muted-fg)","[&_svg]:size-[1.1em] [&_svg]:shrink-0","[transition:background-color_var(--plass-duration)_var(--plass-ease),color_var(--plass-duration)_var(--plass-ease)]","hover:bg-(--p-soft) hover:text-(--plass-fg)",o].join(" ");export const PlPopoverClose=a.Close;export function PlPopover({size:o="md",color:r="primary",density:y="default",trigger:N,title:k,description:j,children:O,side:P="bottom",align:_="center",sideOffset:C=6,alignOffset:z=0,arrow:L=!1,open:M,defaultOpen:T,onOpenChange:W,modal:A=!1,dismissible:B=!0,showClose:D=!1,closeLabel:E="Close",width:R,className:$,style:q,...F}){const G=m[y][o],H=f[y][o],I=b[o],J=i(k)||i(j);return s(a.Root,{open:M,defaultOpen:T,modal:A,onOpenChange:(e,s)=>{B||e||"escape-key"!==s.reason&&"outside-press"!==s.reason&&"focus-out"!==s.reason?W?.(e):s.cancel()},children:[N?e(a.Trigger,{render:N}):null,e(a.Portal,{children:e(a.Positioner,{className:"plass-portal z-50 [outline:none]",side:P,align:_,sideOffset:C,alignOffset:z,children:s(a.Popup,{className:t(v,d[o],p[o],g[o],G,H,void 0===R?x[o]:"",$),style:{...u(r,3),...void 0===R?null:{maxWidth:"number"==typeof R?`${R}px`:R},...q},...F,children:[L?e(a.Arrow,{className:t("data-[side=top]:bottom-[-1px]","data-[side=bottom]:top-[-1px] data-[side=bottom]:rotate-180","data-[side=left]:right-[-1px] data-[side=left]:-rotate-90","data-[side=right]:left-[-1px] data-[side=right]:rotate-90"),children:s("svg",{width:I,height:I/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[e("path",{d:"M0 0h10L5 5z",fill:"var(--plass-glass-press)"}),e("path",{d:"M0 0 5 5 10 0",fill:"none",stroke:"var(--plass-glass-line)",strokeWidth:"1",vectorEffect:"non-scaling-stroke"})]})}):null,J||D?s("div",{className:"flex shrink-0 items-start gap-3",children:[s("div",{className:t("flex min-w-0 flex-1 flex-col",c[o]),children:[i(k)?e(a.Title,{className:t("m-0 font-semibold",h[o]),children:k}):null,i(j)?e(a.Description,{className:t("m-0 text-(--plass-muted-fg)",n[o]),children:j}):null]}),D?e(a.Close,{"aria-label":E,className:w,children:e(l,{})}):null]}):null,i(O)?e("div",{className:"min-w-0",children:O}):null]})})})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlPopover,PlPopoverClose}from"./PlPopover.js";
|