plass-ui 1.2.0 → 1.4.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/CHANGELOG.md +668 -0
- package/README.md +1 -1
- package/dist/components/accordion/PlAccordion.js +1 -1
- package/dist/components/alert/PlAlert.js +1 -1
- package/dist/components/anchor/PlAnchor.d.ts +72 -0
- package/dist/components/anchor/PlAnchor.js +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +1 -0
- package/dist/components/animate-appear/PlAnimateAppear.d.ts +10 -0
- package/dist/components/animate-appear/PlAnimateAppear.js +1 -1
- package/dist/components/animate-blink/PlAnimateBlink.d.ts +2 -2
- package/dist/components/animate-blink/PlAnimateBlink.js +1 -1
- package/dist/components/animate-counter/PlAnimateCounter.d.ts +83 -0
- package/dist/components/animate-counter/PlAnimateCounter.js +1 -0
- package/dist/components/animate-counter/index.d.ts +2 -0
- package/dist/components/animate-counter/index.js +1 -0
- package/dist/components/animate-fade/PlAnimateFade.d.ts +2 -2
- package/dist/components/animate-fade/PlAnimateFade.js +1 -1
- package/dist/components/animate-float/PlAnimateFloat.d.ts +51 -0
- package/dist/components/animate-float/PlAnimateFloat.js +1 -0
- package/dist/components/animate-float/index.d.ts +2 -0
- package/dist/components/animate-float/index.js +1 -0
- package/dist/components/animate-grow/PlAnimateGrow.d.ts +2 -2
- package/dist/components/animate-grow/PlAnimateGrow.js +1 -1
- package/dist/components/animate-headline/PlAnimateHeadline.js +1 -1
- package/dist/components/animate-lighting/PlAnimateLighting.js +1 -1
- package/dist/components/animate-reveal/PlAnimateReveal.d.ts +51 -0
- package/dist/components/animate-reveal/PlAnimateReveal.js +1 -0
- package/dist/components/animate-reveal/index.d.ts +2 -0
- package/dist/components/animate-reveal/index.js +1 -0
- package/dist/components/animate-rotate/PlAnimateRotate.d.ts +2 -2
- package/dist/components/animate-rotate/PlAnimateRotate.js +1 -1
- package/dist/components/animate-scramble/PlAnimateScramble.d.ts +75 -0
- package/dist/components/animate-scramble/PlAnimateScramble.js +1 -0
- package/dist/components/animate-scramble/index.d.ts +2 -0
- package/dist/components/animate-scramble/index.js +1 -0
- package/dist/components/animate-shake/PlAnimateShake.d.ts +57 -0
- package/dist/components/animate-shake/PlAnimateShake.js +1 -0
- package/dist/components/animate-shake/index.d.ts +2 -0
- package/dist/components/animate-shake/index.js +1 -0
- package/dist/components/animate-slide/PlAnimateSlide.d.ts +2 -2
- package/dist/components/animate-slide/PlAnimateSlide.js +1 -1
- package/dist/components/animate-split/PlAnimateSplit.d.ts +54 -0
- package/dist/components/animate-split/PlAnimateSplit.js +1 -0
- package/dist/components/animate-split/index.d.ts +2 -0
- package/dist/components/animate-split/index.js +1 -0
- package/dist/components/animate-typing/PlAnimateTyping.js +1 -1
- package/dist/components/animate-zoom/PlAnimateZoom.d.ts +2 -2
- package/dist/components/animate-zoom/PlAnimateZoom.js +1 -1
- package/dist/components/app-logo/PlAppLogo.d.ts +78 -0
- package/dist/components/app-logo/PlAppLogo.js +1 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/PlAreaChart.d.ts +54 -0
- package/dist/components/area-chart/PlAreaChart.js +1 -0
- package/dist/components/area-chart/index.d.ts +2 -0
- package/dist/components/area-chart/index.js +1 -0
- package/dist/components/aspect-ratio/PlAspectRatio.js +1 -1
- package/dist/components/avatar/PlAvatar.js +1 -1
- package/dist/components/back-top/PlBackTop.d.ts +55 -0
- package/dist/components/back-top/PlBackTop.js +1 -0
- package/dist/components/back-top/index.d.ts +2 -0
- package/dist/components/back-top/index.js +1 -0
- package/dist/components/badge/PlBadge.js +1 -1
- package/dist/components/bar-chart/PlBarChart.d.ts +63 -0
- package/dist/components/bar-chart/PlBarChart.js +1 -0
- package/dist/components/bar-chart/index.d.ts +2 -0
- package/dist/components/bar-chart/index.js +1 -0
- package/dist/components/blockquote/PlBlockquote.js +1 -1
- package/dist/components/bottom-navigation/PlBottomNavigation.js +1 -1
- package/dist/components/box/PlBox.js +1 -1
- package/dist/components/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button/PlButton.js +1 -1
- package/dist/components/button-group/PlButtonGroup.js +1 -1
- package/dist/components/calendar/PlCalendar.d.ts +104 -0
- package/dist/components/calendar/PlCalendar.js +1 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/card/PlCard.js +1 -1
- package/dist/components/carousel/PlCarousel.js +1 -1
- package/dist/components/chat-bubble/PlChatBubble.js +1 -1
- package/dist/components/checkbox/PlCheckbox.js +1 -1
- package/dist/components/chip/PlChip.js +1 -1
- package/dist/components/code-block/PlCodeBlock.d.ts +175 -0
- package/dist/components/code-block/PlCodeBlock.js +1 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/PlCollapsible.js +1 -1
- package/dist/components/color-picker/PlColorPicker.js +1 -1
- package/dist/components/combobox/PlCombobox.d.ts +11 -2
- package/dist/components/combobox/PlCombobox.js +1 -1
- package/dist/components/command-palette/PlCommandPalette.d.ts +1 -1
- package/dist/components/command-palette/PlCommandPalette.js +1 -1
- package/dist/components/confirm/PlConfirmProvider.d.ts +100 -0
- package/dist/components/confirm/PlConfirmProvider.js +1 -0
- package/dist/components/confirm/index.d.ts +2 -0
- package/dist/components/confirm/index.js +1 -0
- package/dist/components/container/PlContainer.d.ts +22 -6
- package/dist/components/container/PlContainer.js +1 -1
- package/dist/components/data-list/PlDataList.d.ts +74 -0
- package/dist/components/data-list/PlDataList.js +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.js +1 -0
- package/dist/components/data-table/PlDataTable.d.ts +202 -0
- package/dist/components/data-table/PlDataTable.js +1 -0
- package/dist/components/data-table/index.d.ts +2 -0
- package/dist/components/data-table/index.js +1 -0
- package/dist/components/date-picker/PlDatePicker.d.ts +41 -2
- package/dist/components/date-picker/PlDatePicker.js +1 -1
- package/dist/components/date-range-picker/PlDateRangePicker.js +1 -1
- package/dist/components/date-time-picker/PlDateTimePicker.js +1 -1
- package/dist/components/divider/PlDivider.js +1 -1
- package/dist/components/drawer/PlDrawer.d.ts +1 -1
- package/dist/components/drawer/PlDrawer.js +1 -1
- package/dist/components/empty/PlEmpty.d.ts +47 -0
- package/dist/components/empty/PlEmpty.js +1 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.js +1 -0
- package/dist/components/file-picker/PlFilePicker.js +1 -1
- package/dist/components/flex/PlFlex.d.ts +83 -0
- package/dist/components/flex/PlFlex.js +1 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +1 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.d.ts +81 -0
- package/dist/components/floating-action-button/PlFloatingActionButton.js +1 -0
- package/dist/components/floating-action-button/index.d.ts +2 -0
- package/dist/components/floating-action-button/index.js +1 -0
- package/dist/components/floating-bottom-navigation/PlFloatingBottomNavigation.js +1 -1
- package/dist/components/footer/PlFooter.d.ts +4 -3
- package/dist/components/footer/PlFooter.js +1 -1
- package/dist/components/gallery/PlGallery.d.ts +154 -0
- package/dist/components/gallery/PlGallery.js +1 -0
- package/dist/components/gallery/PlGalleryViewer.d.ts +31 -0
- package/dist/components/gallery/PlGalleryViewer.js +1 -0
- package/dist/components/gallery/index.d.ts +2 -0
- package/dist/components/gallery/index.js +1 -0
- package/dist/components/gauge-chart/PlGaugeChart.d.ts +64 -0
- package/dist/components/gauge-chart/PlGaugeChart.js +1 -0
- package/dist/components/gauge-chart/index.d.ts +2 -0
- package/dist/components/gauge-chart/index.js +1 -0
- package/dist/components/grid/PlGrid.js +1 -1
- package/dist/components/grid/PlGridItem.js +1 -1
- package/dist/components/header/PlHeader.d.ts +4 -3
- package/dist/components/header/PlHeader.js +1 -1
- package/dist/components/heatmap-chart/PlHeatmapChart.d.ts +69 -0
- package/dist/components/heatmap-chart/PlHeatmapChart.js +1 -0
- package/dist/components/heatmap-chart/index.d.ts +2 -0
- package/dist/components/heatmap-chart/index.js +1 -0
- package/dist/components/highlight/PlHighlight.js +1 -1
- package/dist/components/hot-keys/PlHotKeys.js +1 -1
- package/dist/components/hover-card/PlHoverCard.d.ts +94 -0
- package/dist/components/hover-card/PlHoverCard.js +1 -0
- package/dist/components/hover-card/index.d.ts +2 -0
- package/dist/components/hover-card/index.js +1 -0
- package/dist/components/how-to-steps/PlHowToSteps.d.ts +87 -0
- package/dist/components/how-to-steps/PlHowToSteps.js +1 -0
- package/dist/components/how-to-steps/index.d.ts +2 -0
- package/dist/components/how-to-steps/index.js +1 -0
- package/dist/components/image/PlImage.d.ts +72 -0
- package/dist/components/image/PlImage.js +1 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +1 -0
- package/dist/components/line-chart/PlLineChart.d.ts +74 -0
- package/dist/components/line-chart/PlLineChart.js +1 -0
- package/dist/components/line-chart/index.d.ts +2 -0
- package/dist/components/line-chart/index.js +1 -0
- package/dist/components/list/PlList.js +1 -1
- package/dist/components/menu/PlMenu.d.ts +2 -2
- package/dist/components/menu/PlMenu.js +1 -1
- package/dist/components/menubar/PlMenubar.js +1 -1
- package/dist/components/meter/PlMeter.d.ts +83 -0
- package/dist/components/meter/PlMeter.js +1 -0
- package/dist/components/meter/index.d.ts +2 -0
- package/dist/components/meter/index.js +1 -0
- package/dist/components/mockup/PlMockup.d.ts +146 -0
- package/dist/components/mockup/PlMockup.js +1 -0
- package/dist/components/mockup/index.d.ts +2 -0
- package/dist/components/mockup/index.js +1 -0
- package/dist/components/modal/PlModal.d.ts +1 -1
- package/dist/components/modal/PlModal.js +1 -1
- package/dist/components/navigation-menu/PlNavigationMenu.js +1 -1
- package/dist/components/number-field/PlNumberField.d.ts +11 -2
- package/dist/components/number-field/PlNumberField.js +1 -1
- package/dist/components/otp-field/PlOtpField.d.ts +10 -1
- package/dist/components/otp-field/PlOtpField.js +1 -1
- package/dist/components/overlay/PlOverlay.d.ts +1 -1
- package/dist/components/overlay/PlOverlay.js +1 -1
- package/dist/components/page-layout/PlPageLayout.js +1 -1
- package/dist/components/pagination/PlPagination.js +1 -1
- package/dist/components/panes/PlPanes.d.ts +2 -2
- package/dist/components/panes/PlPanes.js +1 -1
- package/dist/components/pie-chart/PlPieChart.d.ts +58 -0
- package/dist/components/pie-chart/PlPieChart.js +1 -0
- package/dist/components/pie-chart/index.d.ts +2 -0
- package/dist/components/pie-chart/index.js +1 -0
- package/dist/components/pill/PlPill.js +1 -1
- package/dist/components/popconfirm/PlPopconfirm.d.ts +61 -0
- package/dist/components/popconfirm/PlPopconfirm.js +1 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +1 -0
- package/dist/components/popover/PlPopover.d.ts +1 -1
- package/dist/components/popover/PlPopover.js +1 -1
- package/dist/components/portal/PlPortal.d.ts +78 -0
- package/dist/components/portal/PlPortal.js +1 -0
- package/dist/components/portal/index.d.ts +2 -0
- package/dist/components/portal/index.js +1 -0
- package/dist/components/progress-box/PlProgressBox.js +1 -1
- package/dist/components/progress-circular/PlProgressCircular.js +1 -1
- package/dist/components/progress-linear/PlProgressLinear.js +1 -1
- package/dist/components/radio-group/PlRadioGroup.js +1 -1
- package/dist/components/rating/PlRating.js +1 -1
- package/dist/components/scatter-chart/PlScatterChart.d.ts +46 -0
- package/dist/components/scatter-chart/PlScatterChart.js +1 -0
- package/dist/components/scatter-chart/index.d.ts +2 -0
- package/dist/components/scatter-chart/index.js +1 -0
- package/dist/components/scroll-area/PlScrollArea.d.ts +98 -0
- package/dist/components/scroll-area/PlScrollArea.js +1 -0
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.js +1 -0
- package/dist/components/scroll-zone/PlScrollZone.d.ts +9 -5
- package/dist/components/scroll-zone/PlScrollZone.js +1 -1
- package/dist/components/segmented-button/PlSegmentedButton.js +1 -1
- package/dist/components/select/PlSelect.d.ts +10 -1
- package/dist/components/select/PlSelect.js +1 -1
- package/dist/components/show/PlShow.d.ts +60 -0
- package/dist/components/show/PlShow.js +1 -0
- package/dist/components/show/index.d.ts +2 -0
- package/dist/components/show/index.js +1 -0
- package/dist/components/sidebar/PlSidebar.js +1 -1
- package/dist/components/skeleton/PlSkeleton.js +1 -1
- package/dist/components/slider/PlSlider.js +1 -1
- package/dist/components/sparkline/PlSparkline.d.ts +68 -0
- package/dist/components/sparkline/PlSparkline.js +1 -0
- package/dist/components/sparkline/index.d.ts +2 -0
- package/dist/components/sparkline/index.js +1 -0
- package/dist/components/spoiler/PlSpoiler.d.ts +8 -0
- package/dist/components/spoiler/PlSpoiler.js +1 -1
- package/dist/components/stack/PlStack.d.ts +114 -0
- package/dist/components/stack/PlStack.js +1 -0
- package/dist/components/stack/index.d.ts +2 -0
- package/dist/components/stack/index.js +1 -0
- package/dist/components/stat/PlStat.d.ts +66 -0
- package/dist/components/stat/PlStat.js +1 -0
- package/dist/components/stat/index.d.ts +2 -0
- package/dist/components/stat/index.js +1 -0
- package/dist/components/stepper/PlStepper.d.ts +86 -0
- package/dist/components/stepper/PlStepper.js +1 -0
- package/dist/components/stepper/index.d.ts +2 -0
- package/dist/components/stepper/index.js +1 -0
- package/dist/components/switch/PlSwitch.js +1 -1
- package/dist/components/table/PlTable.js +1 -1
- package/dist/components/tabs/PlTabs.d.ts +2 -2
- package/dist/components/tabs/PlTabs.js +1 -1
- package/dist/components/text-field/PlTextField.d.ts +10 -1
- package/dist/components/text-field/PlTextField.js +1 -1
- package/dist/components/text-link/PlTextLink.js +1 -1
- package/dist/components/time-picker/PlTimePicker.js +1 -1
- package/dist/components/timeline/PlTimeline.d.ts +7 -10
- package/dist/components/timeline/PlTimeline.js +1 -1
- package/dist/components/timeline-chart/PlTimelineChart.d.ts +44 -0
- package/dist/components/timeline-chart/PlTimelineChart.js +1 -0
- package/dist/components/timeline-chart/index.d.ts +2 -0
- package/dist/components/timeline-chart/index.js +1 -0
- package/dist/components/toast/PlToast.d.ts +1 -1
- package/dist/components/toast/PlToast.js +1 -1
- package/dist/components/toggle/PlToggle.js +1 -1
- package/dist/components/toggle/PlToggleGroup.js +1 -1
- package/dist/components/toolbar/PlToolbar.js +1 -1
- package/dist/components/tooltip/PlTooltip.d.ts +1 -1
- package/dist/components/tooltip/PlTooltip.js +1 -1
- package/dist/components/tour/PlTour.d.ts +134 -0
- package/dist/components/tour/PlTour.js +1 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +1 -0
- package/dist/components/transfer/PlTransfer.js +1 -1
- package/dist/components/tree/PlTree.d.ts +67 -0
- package/dist/components/tree/PlTree.js +1 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/tree/index.js +1 -0
- package/dist/components/tree-select/PlTreeSelect.d.ts +99 -0
- package/dist/components/tree-select/PlTreeSelect.js +1 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +1 -0
- package/dist/components/visually-hidden/PlVisuallyHidden.d.ts +46 -0
- package/dist/components/visually-hidden/PlVisuallyHidden.js +1 -0
- package/dist/components/visually-hidden/index.d.ts +2 -0
- package/dist/components/visually-hidden/index.js +1 -0
- package/dist/components/window-pane/PlWindowPane.d.ts +179 -0
- package/dist/components/window-pane/PlWindowPane.js +1 -0
- package/dist/components/window-pane/index.d.ts +2 -0
- package/dist/components/window-pane/index.js +1 -0
- package/dist/css/anchor.css +2 -0
- package/dist/css/animate-counter.css +2 -0
- package/dist/css/animate-float.css +2 -0
- package/dist/css/animate-reveal.css +2 -0
- package/dist/css/animate-scramble.css +2 -0
- package/dist/css/animate-shake.css +2 -0
- package/dist/css/animate-split.css +2 -0
- package/dist/css/app-logo.css +2 -0
- package/dist/css/area-chart.css +2 -0
- package/dist/css/back-top.css +2 -0
- package/dist/css/bar-chart.css +2 -0
- package/dist/css/calendar.css +2 -0
- package/dist/css/code-block.css +2 -0
- package/dist/css/confirm.css +2 -0
- package/dist/css/data-list.css +2 -0
- package/dist/css/data-table.css +2 -0
- package/dist/css/empty.css +2 -0
- package/dist/css/flex.css +2 -0
- package/dist/css/floating-action-button.css +2 -0
- package/dist/css/gallery.css +2 -0
- package/dist/css/gauge-chart.css +2 -0
- package/dist/css/heatmap-chart.css +2 -0
- package/dist/css/hover-card.css +2 -0
- package/dist/css/how-to-steps.css +2 -0
- package/dist/css/image.css +2 -0
- package/dist/css/line-chart.css +2 -0
- package/dist/css/meter.css +2 -0
- package/dist/css/mockup.css +2 -0
- package/dist/css/pie-chart.css +2 -0
- package/dist/css/popconfirm.css +2 -0
- package/dist/css/portal.css +2 -0
- package/dist/css/scatter-chart.css +2 -0
- package/dist/css/scroll-area.css +2 -0
- package/dist/css/show.css +2 -0
- package/dist/css/sparkline.css +2 -0
- package/dist/css/stack.css +2 -0
- package/dist/css/stat.css +2 -0
- package/dist/css/stepper.css +2 -0
- package/dist/css/timeline-chart.css +2 -0
- package/dist/css/tour.css +2 -0
- package/dist/css/tree-select.css +2 -0
- package/dist/css/tree.css +2 -0
- package/dist/css/visually-hidden.css +2 -0
- package/dist/css/window-pane.css +2 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/usePlBreakpoint.d.ts +41 -0
- package/dist/hooks/usePlBreakpoint.js +1 -0
- package/dist/hooks/usePlColorScheme.d.ts +66 -0
- package/dist/hooks/usePlColorScheme.js +1 -0
- package/dist/hooks/usePlDisclosure.d.ts +44 -0
- package/dist/hooks/usePlDisclosure.js +1 -0
- package/dist/hooks/usePlElementSize.d.ts +31 -0
- package/dist/hooks/usePlElementSize.js +1 -0
- package/dist/hooks/usePlHotKeys.d.ts +81 -0
- package/dist/hooks/usePlHotKeys.js +1 -0
- package/dist/hooks/usePlMediaQuery.d.ts +22 -0
- package/dist/hooks/usePlMediaQuery.js +1 -0
- package/dist/hooks/usePlOnScreen.d.ts +50 -0
- package/dist/hooks/usePlOnScreen.js +1 -0
- package/dist/hooks/usePlReducedMotion.d.ts +22 -0
- package/dist/hooks/usePlReducedMotion.js +1 -0
- package/dist/index.d.ts +46 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +91 -6
- package/dist/internal/animate.js +1 -1
- package/dist/internal/breakpoints.d.ts +31 -0
- package/dist/internal/breakpoints.js +1 -0
- package/dist/internal/button-group.d.ts +29 -2
- package/dist/internal/button-group.js +2 -2
- package/dist/internal/calendar.d.ts +33 -36
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +458 -0
- package/dist/internal/chart-frame.js +1 -0
- package/dist/internal/chart-line.d.ts +44 -0
- package/dist/internal/chart-line.js +1 -0
- package/dist/internal/chart.d.ts +473 -0
- package/dist/internal/chart.js +1 -0
- package/dist/internal/color-scheme.d.ts +23 -0
- package/dist/internal/color-scheme.js +1 -0
- package/dist/internal/data-table.d.ts +69 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/date.d.ts +21 -0
- package/dist/internal/date.js +1 -1
- package/dist/internal/defaults.d.ts +74 -0
- package/dist/internal/defaults.js +1 -0
- package/dist/internal/direction.d.ts +4 -0
- package/dist/internal/direction.js +1 -0
- package/dist/internal/drag.d.ts +49 -0
- package/dist/internal/drag.js +1 -0
- package/dist/internal/format.d.ts +2 -0
- package/dist/internal/format.js +1 -1
- package/dist/internal/gallery.d.ts +34 -0
- package/dist/internal/gallery.js +1 -0
- package/dist/internal/grid.d.ts +6 -25
- package/dist/internal/grid.js +1 -1
- package/dist/internal/highlight.d.ts +98 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/icons.d.ts +10 -0
- package/dist/internal/icons.js +1 -1
- package/dist/internal/keys.d.ts +93 -0
- package/dist/internal/keys.js +1 -0
- package/dist/internal/labels.d.ts +138 -0
- package/dist/internal/labels.js +1 -0
- package/dist/internal/media.d.ts +26 -0
- package/dist/internal/media.js +1 -0
- package/dist/internal/mockup.d.ts +193 -0
- package/dist/internal/mockup.js +1 -0
- package/dist/internal/page-layout.d.ts +6 -6
- package/dist/internal/page-layout.js +1 -1
- package/dist/internal/progress.d.ts +6 -0
- package/dist/internal/responsive.d.ts +108 -0
- package/dist/internal/responsive.js +1 -0
- package/dist/internal/scramble.d.ts +31 -0
- package/dist/internal/scramble.js +1 -0
- package/dist/internal/steps.d.ts +76 -0
- package/dist/internal/steps.js +1 -0
- package/dist/internal/styles.d.ts +15 -0
- package/dist/internal/styles.js +1 -1
- package/dist/internal/table.d.ts +86 -0
- package/dist/internal/table.js +1 -0
- package/dist/internal/threshold.d.ts +19 -0
- package/dist/internal/threshold.js +1 -0
- package/dist/internal/tour.d.ts +42 -0
- package/dist/internal/tour.js +1 -0
- package/dist/internal/window.d.ts +201 -0
- package/dist/internal/window.js +1 -0
- package/dist/locales/de.d.ts +3 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/en.d.ts +2 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +3 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +3 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/index.d.ts +33 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/ja.d.ts +3 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +3 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/zh-Hans.d.ts +3 -0
- package/dist/locales/zh-Hans.js +1 -0
- package/dist/provider/PlColorSchemeScript.d.ts +40 -0
- package/dist/provider/PlColorSchemeScript.js +1 -0
- package/dist/provider/PlassProvider.d.ts +39 -0
- package/dist/provider/PlassProvider.js +1 -0
- package/dist/provider/index.d.ts +6 -0
- package/dist/provider/index.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1133 -20
- package/dist/tokens.css +1133 -20
- package/dist/types.d.ts +398 -2
- package/package.json +30 -4
- package/dist/components/avatar-group/PlAvatarGroup.d.ts +0 -47
- package/dist/components/avatar-group/PlAvatarGroup.js +0 -1
- package/dist/components/avatar-group/index.d.ts +0 -2
- package/dist/components/avatar-group/index.js +0 -1
- package/dist/css/avatar-group.css +0 -2
- package/dist/internal/avatar-group.d.ts +0 -25
- package/dist/internal/avatar-group.js +0 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type CartesianChartProps } from '../../internal/chart-frame.js';
|
|
3
|
+
import type { PlassChartCategory, PlassTimelineSeries } from '../../types.js';
|
|
4
|
+
export interface PlTimelineChartProps extends Omit<CartesianChartProps, 'series' | 'categories' | 'legend'> {
|
|
5
|
+
/**
|
|
6
|
+
* One row per series, and the spans on it. A row's name is what the axis
|
|
7
|
+
* says down the left-hand side.
|
|
8
|
+
*/
|
|
9
|
+
series: readonly PlassTimelineSeries[];
|
|
10
|
+
/**
|
|
11
|
+
* Where the time axis starts and ends. Taken from the spans otherwise, and
|
|
12
|
+
* rounded outward to a date a calendar has a name for.
|
|
13
|
+
*/
|
|
14
|
+
min?: PlassChartCategory;
|
|
15
|
+
max?: PlassChartCategory;
|
|
16
|
+
/**
|
|
17
|
+
* How thick a bar may get, in pixels. Below the cap the bars fill their share
|
|
18
|
+
* of the row; above it the leftover stays as air.
|
|
19
|
+
* @default the `size` ladder — 24 at `md`
|
|
20
|
+
*/
|
|
21
|
+
barSize?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Cuts the corners off a span.
|
|
24
|
+
*
|
|
25
|
+
* Both ends, unlike a [`PlBarChart`](./bar-chart), where the baseline end stays
|
|
26
|
+
* square. A span grows from nothing: neither of its ends is a zero, so
|
|
27
|
+
* neither is the one the reader is measuring from.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
rounded?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Work against time — a row per thing, a bar per stretch of it.
|
|
34
|
+
*
|
|
35
|
+
* The two axes are a set of rows and a calendar, which makes this a
|
|
36
|
+
* [`PlBarChart`](./bar-chart) turned on its side with the baseline taken away:
|
|
37
|
+
* every bar starts where its own data says rather than at zero, so what the
|
|
38
|
+
* chart is about is *when* rather than *how much*.
|
|
39
|
+
*
|
|
40
|
+
* Not to be confused with [`PlTimeline`](../display/timeline), which is a list of
|
|
41
|
+
* steps and draws no axis at all. That one is for a sequence of events; this
|
|
42
|
+
* one is for how long each of them took.
|
|
43
|
+
*/
|
|
44
|
+
export declare function PlTimelineChart({ series, min, max, barSize, rounded, size: sizeProp, density: densityProp, xAxis, yAxis, locale: localeProp, ...props }: PlTimelineChartProps): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{CartesianChart as o,markTransitionClasses as r}from"../../internal/chart-frame.js";import{barBandRatio as a,barMaxThickness as s,barRadius as l,formatTimeTicks as i,formatTimeValue as c,markGap as m,resolveColor as d,seriesColor as u,timeScale as h,toNumber as f}from"../../internal/chart.js";import{srOnlyClasses as p}from"../../internal/styles.js";import{useDefaults as x}from"../../internal/defaults.js";export function PlTimelineChart({series:n,min:r,max:l,barSize:d,rounded:p=!0,size:M,density:b,xAxis:y,yAxis:k,locale:g,...v}){const j=x(),$=M??j.size??"md",w=b??j.density??"default",C=g??j.locale,T=t.useMemo(()=>n.map(packRow),[n]),z=t.useMemo(()=>T.map(e=>e.spans),[T]),A=t.useMemo(()=>{let e=1/0,n=-1/0,t=!1;for(const o of z)for(const r of o)r&&(t=!0,e=Math.min(e,r.from),n=Math.max(n,r.to));return t?{min:e,max:n}:null},[z]),P=t.useMemo(()=>h(A,{min:f(r)??void 0,max:f(l)??void 0,tickCount:k?.tickCount}),[A,r,l,k?.tickCount]),E=t.useMemo(()=>i(P.ticks,P.unit,C),[P,C]),R=t.useMemo(()=>n.map((e,n)=>u(e,n)),[n]),S=t.useMemo(()=>[{data:z.map(e=>e.some(Boolean)?1:null)}],[z]),B=t.useMemo(()=>n.map((e,n)=>e.name??`${n+1}`),[n]),I=d??s[$],N=t.useCallback(e=>{const n=[];return T.forEach((t,o)=>{const r=Math.min(I,Math.max(1,(e.band.band-m*(t.lanes-1))/t.lanes)),a=r*t.lanes+m*(t.lanes-1),s=e.plot.top+e.categoryPx(o)-a/2+r/2;t.spans.forEach((t,a)=>{if(!t)return;const l=e.valuePx(t.from),i=e.valuePx(t.to);n.push({series:o,index:a,x:(l+i)/2,y:s+t.lane*(r+m),r:r/2,rx:Math.max(0,(i-l)/2),ry:r/2})})}),n},[T,I]),F=t.useCallback(e=>{const n=z[e.series]?.[e.index];if(!n)return null;const t=[{seriesIndex:e.series,name:B[e.series],color:n.color??R[e.series],value:n.to-n.from,formatted:`${c(n.from,P.unit,C)} – ${c(n.to,P.unit,C)}`}];return{heading:n.span.label??B[e.series],items:t}},[z,B,R,P.unit,C]);return e(o,{...v,series:S,categories:B,size:$,density:w,locale:C,horizontal:!0,scale:P,xAxis:y,yAxis:{tickFormat:(e,n)=>E[n]??"",...k},legend:!1,bandRatio:a[w],marks:N,markTooltip:F,table:t=>e(TimelineTable,{id:t,names:B,series:n,spans:z,unit:P.unit,label:v.label,corner:y?.label,locale:C}),children:n=>e(Spans,{context:n,spans:z,colors:R,rounded:p})})}function packRow(e){const n=e.data.map(e=>{const n=f(e.start),t=f(e.end);return null===n||null===t?null:{from:Math.min(n,t),to:Math.max(n,t),lane:0,color:e.color?d(e.color):void 0,span:e}}),t=[];return n.map((e,n)=>({one:e,index:n})).filter(e=>Boolean(e.one)).sort((e,n)=>e.one.from-n.one.from).forEach(({one:e})=>{const n=t.findIndex(n=>n<=e.from),o=-1===n?t.length:n;t[o]=e.to,e.lane=o}),{spans:n,lanes:Math.max(1,t.length)}}function Spans({context:n,spans:t,colors:o,rounded:a}){const{marks:s,activeMark:i,plot:c}=n,m=a?l:0;return e("g",{children:s.map(n=>{const a=t[n.series]?.[n.index];if(!a)return null;const s=i?.series===n.series&&i?.index===n.index,l=n.rx??n.r,d=2*(n.ry??n.r),u=Math.max(c.left,n.x-l),h=Math.min(c.left+c.width,n.x+l);if(h<c.left||u>c.left+c.width)return null;const f=Math.max(1,h-u);return e("rect",{x:u,y:n.y-d/2,width:f,height:d,rx:Math.min(m,f/2,d/2),fill:a.color??o[n.series],opacity:s?1:.92,className:r},`${n.series}-${n.index}`)})})}function TimelineTable({id:t,names:o,series:r,spans:a,unit:s,label:l,corner:i,locale:m}){const d=r.some(e=>e.data.some(e=>void 0!==e.label));return n("table",{id:t,className:p,children:[l?e("caption",{children:l}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:i??""}),d?e("th",{scope:"col",children:"label"}):null,e("th",{scope:"col",children:"start"}),e("th",{scope:"col",children:"end"})]})}),e("tbody",{children:a.flatMap((t,a)=>t.map((t,l)=>n("tr",{children:[e("th",{scope:"row",children:o[a]}),d?e("td",{children:r[a].data[l]?.label??""}):null,e("td",{children:t?c(t.from,s,m):""}),e("td",{children:t?c(t.to,s,m):""})]},`${a}-${l}`)))})]})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlTimelineChart}from"./PlTimelineChart.js";
|
|
@@ -129,4 +129,4 @@ export declare function usePlToast(): {
|
|
|
129
129
|
* swipe, the F6 focus hotkey, and the live region that makes a message which
|
|
130
130
|
* appeared out of nowhere reach a screen reader at all.
|
|
131
131
|
*/
|
|
132
|
-
export declare function PlToastProvider({ variant, size, color, density, position, timeout, limit, width, closeLabel, children }: PlToastProviderProps): React.JSX.Element;
|
|
132
|
+
export declare function PlToastProvider({ variant, size: sizeProp, color: colorProp, density: densityProp, position, timeout, limit, width, closeLabel: closeLabelProp, children }: PlToastProviderProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import*as e from"react";import{
|
|
1
|
+
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import*as e from"react";import{useDefaults as o}from"../../internal/defaults.js";import{useLabels as a}from"../../internal/labels.js";import{Toast as i}from"@base-ui/react/toast";import{CloseIcon as r,severityIcon as n}from"../../internal/icons.js";import{controlSlots as l,focusRingClasses as c,glassClasses as p,hasContent as d,iconClasses as m,metaTextClasses as u,radiusClasses as f,sheetBodyClasses as h,sheetHeaderGapClasses as g,sheetPaddingXClasses as v,sheetPaddingYClasses as x,sheetSectionGapClasses as b,sheetTitleClasses as y}from"../../internal/styles.js";const w={"top-start":"top-0 items-start","top-center":"top-0 items-center","top-end":"top-0 items-end","bottom-start":"bottom-0 flex-col-reverse items-start","bottom-center":"bottom-0 flex-col-reverse items-center","bottom-end":"bottom-0 flex-col-reverse items-end"},j={solid:/* @__PURE__ */["text-(--p-on-solid) [background-image:var(--p-fill)]","[box-shadow:var(--plass-shadow-3),var(--p-lift)]"].join(" "),glass:/* @__PURE__ */[p,"border text-(--plass-fg) bg-(--plass-glass-press)","[border-color:var(--p-line)]","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]"].join(" "),ghost:/* @__PURE__ */[p,"text-(--plass-fg) bg-(--plass-glass-press)","[box-shadow:var(--plass-shadow-3),var(--plass-gloss-glass)]"].join(" ")},N={solid:"",glass:"text-(--p-accent)",ghost:"text-(--p-accent)"};function toManagerOptions(t){const{color:s,variant:e,icon:o,className:a,style:i,actionLabel:r,onAction:n,...l}=t;return{...l,data:{color:s,variant:e,icon:o,className:a,style:i},actionProps:void 0===r?void 0:{children:r,onClick:n}}}export function usePlToast(){const t=i.useToastManager();return e.useMemo(()=>({add:s=>t.add(toManagerOptions(s)),close:s=>t.close(s),update:(s,e)=>t.update(s,toManagerOptions(e)),promise:(s,e)=>t.promise(s,{loading:toManagerOptions(e.loading),success:t=>toManagerOptions("function"==typeof e.success?e.success(t):e.success),error:t=>toManagerOptions("function"==typeof e.error?e.error(t):e.error)}),toasts:t.toasts}),[t])}function ToastItem({toast:e,variant:o,color:a,size:p,density:w,closeLabel:T,swipeDirection:M}){const z=e.data?.variant??o??"glass",O=e.data?.color??a,P=void 0===e.data?.icon?n(O):e.data.icon,k=N[z],$=d(e.title);return s(i.Root,{toast:e,swipeDirection:M,className:["pointer-events-auto flex w-full items-start",v[w??"default"][p],x[w??"default"][p],f[p],b[p],h[p],j[z],m,"[transition:opacity_var(--plass-duration)_var(--plass-ease)]","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0","data-[limited]:hidden",c,"[outline:none]",e.data?.className??""].filter(Boolean).join(" "),style:{...l(O,3,z),...e.data?.style},children:[d(P)?t("span",{className:`flex h-[1lh] shrink-0 items-center ${k}`,children:P}):null,s("div",{className:`flex min-w-0 flex-1 flex-col ${g[p]}`,children:[t(i.Title,{className:`plass-title font-semibold ${y[p]} ${k}`}),t(i.Description,{className:$&&"solid"!==z?"text-(--plass-muted-fg)":""})]}),t(i.Action,{className:["flex h-[1lh] shrink-0 cursor-pointer items-center rounded-full px-2","font-medium underline-offset-2",k||"text-(--p-on-solid)","hover:underline",c,u[p]].join(" ")}),t("span",{className:"flex h-[1lh] shrink-0 items-center",children:t(i.Close,{"aria-label":T,className:["inline-flex size-[1.15em] cursor-pointer items-center justify-center rounded-full","opacity-70 [transition:opacity_var(--plass-duration)_var(--plass-ease)]","hover:opacity-100 focus-visible:opacity-100",c].join(" "),children:t(r,{})})})]})}function ToastViewport(s){const{toasts:e}=i.useToastManager(),{position:o,width:a,...r}=s,n=[o.startsWith("top")?"up":"down","left","right"];return t(i.Portal,{children:t(i.Viewport,{className:["plass-portal pointer-events-none fixed inset-x-0 z-(--plass-z-portal) flex flex-col gap-2 p-4",w[o]].join(" "),children:e.map(s=>t("div",{className:"w-full",style:{maxWidth:"number"==typeof a?`${a}px`:a},children:t(ToastItem,{toast:s,swipeDirection:n,...r})},s.id))})})}export function PlToastProvider({variant:e="glass",size:r,color:n,density:l,position:c="bottom-end",timeout:p=5e3,limit:d=3,width:m=380,closeLabel:u,children:f}){const h=o(),g=a(),v=u??g.close,x=r??h.size??"md",b=n??h.color??"primary",y=l??h.density??"default";return s(i.Provider,{timeout:p,limit:d,children:[f,t(ToastViewport,{position:c,variant:e,size:x,color:b,density:y,width:m,closeLabel:v})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as s}from"react/jsx-runtime";import*as e from"react";import{
|
|
1
|
+
"use client";import{jsxs as s}from"react/jsx-runtime";import*as e from"react";import{useDefaults as o}from"../../internal/defaults.js";import{Toggle as l}from"@base-ui/react/toggle";import{ButtonGroupContext as a}from"../../internal/button-group.js";import{controlHeightClasses as r,controlSlots as t,controlSquareClasses as p,controlTextClasses as i,disabledClasses as n,focusRingClasses as g,gapClasses as v,glassClasses as d,hasContent as h,iconClasses as x,paddingXClasses as c,radiusClasses as m,transitionClasses as f}from"../../internal/styles.js";const b={xs:`${r.xs} ${v.xs} ${m.xs} ${i.xs}`,sm:`${r.sm} ${v.sm} ${m.sm} ${i.sm}`,md:`${r.md} ${v.md} ${m.md} ${i.md}`,lg:`${r.lg} ${v.lg} ${m.lg} ${i.lg}`,xl:`${r.xl} ${v.xl} ${m.xl} ${i.xl}`},$={xs:`${p.xs} px-0`,sm:`${p.sm} px-0`,md:`${p.md} px-0`,lg:`${p.lg} px-0`,xl:`${p.xl} px-0`},u=/* @__PURE__ */["relative inline-flex shrink-0 select-none items-center justify-center","whitespace-nowrap align-middle font-semibold leading-none","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",f,g,x].join(" "),w={solid:/* @__PURE__ */[d,"text-(--plass-muted-fg) bg-(--plass-glass-hover)","[box-shadow:var(--p-elev),var(--plass-gloss-glass)]"].join(" "),glass:/* @__PURE__ */[d,"border text-(--plass-muted-fg) bg-(--plass-glass)","[border-color:var(--plass-glass-line)]","[box-shadow:var(--p-elev),var(--plass-gloss-glass)]"].join(" "),ghost:"text-(--plass-muted-fg) bg-transparent"},j={solid:/* @__PURE__ */["hover:bg-(--plass-glass-press) hover:text-(--plass-fg)","hover:[box-shadow:var(--p-elev-hover),var(--plass-gloss-glass)]","active:[box-shadow:var(--p-elev-press),var(--plass-gloss-glass)]"].join(" "),glass:/* @__PURE__ */["hover:bg-(--plass-glass-hover) hover:text-(--plass-fg) hover:[border-color:var(--p-line)]","hover:[box-shadow:var(--p-elev-hover),var(--plass-gloss-glass)]","active:bg-(--plass-glass-press)","active:[box-shadow:var(--p-elev-press),var(--plass-gloss-glass)]"].join(" "),ghost:"hover:bg-(--plass-glass-hover) hover:text-(--plass-fg) active:bg-(--plass-glass-press)"},y={solid:/* @__PURE__ */["text-(--p-on-solid) [background-image:var(--p-fill)]","[box-shadow:var(--p-elev),var(--p-lift)]"].join(" "),glass:/* @__PURE__ */[d,"border text-(--p-accent) bg-(--p-soft)","[border-color:var(--p-line-hover)]","[box-shadow:var(--p-elev),var(--plass-gloss-glass)]"].join(" "),ghost:"text-(--p-accent) bg-(--p-soft)"},P={solid:/* @__PURE__ */["hover:brightness-105 hover:[box-shadow:var(--p-elev-hover),var(--p-lift-hover)]","active:brightness-95 active:[box-shadow:var(--p-elev-press),var(--p-lift-press)]"].join(" "),glass:"hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)",ghost:"hover:bg-(--p-soft-hover) active:bg-(--p-soft-press)"};export const PlToggle=/* @__PURE__ */e.forwardRef(function PlToggle({variant:r,size:p,color:i,density:g,elevation:v,pressed:d,defaultPressed:x,onPressedChange:m,value:f,startIcon:T,endIcon:k,fullWidth:z=!1,disabled:C,className:E,style:I,children:M,onPointerMove:N,...B},R){const W=o(),X=e.useContext(a),Y=r??X?.variant??"glass",q=p??X?.size??W.size??"md",A=i??X?.color??W.color??"primary",D=g??X?.density??W.density??"default",F=v??X?.elevation??0,G=C??X?.disabled??!1,H=!h(M);return s(l,{ref:R,value:f,pressed:d,defaultPressed:x,onPressedChange:s=>m?.(s),disabled:G,className:s=>[u,b[q],H?$[q]:c[D][q],G?n[Y]:s.pressed?`${y[Y]} ${P[Y]}`:`${w[Y]} ${j[Y]}`,G?"":"plass-glow cursor-pointer",z?"w-full":"",E??""].filter(Boolean).join(" "),style:{...t(A,F,Y),...I},onPointerMove:s=>{const e=s.currentTarget;e.style.setProperty("--p-mx",`${s.nativeEvent.offsetX}px`),e.style.setProperty("--p-my",`${s.nativeEvent.offsetY}px`),N?.(s)},...B,children:[T,M,k]})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import*as l from"react";import{ToggleGroup as o}from"@base-ui/react/toggle-group";import{ButtonGroupContext as r,groupBaseClasses as a,groupJoinClasses as t,groupOverlapClasses as i}from"../../internal/button-group.js";import{cx as s}from"../../internal/styles.js";export const PlToggleGroup=/* @__PURE__ */l.forwardRef(function PlToggleGroup({variant:n,size:u,color:c,density:f,elevation:d,value:m,defaultValue:p,onValueChange:g,multiple:v=!1,orientation:h="horizontal",disabled:x,loopFocus:b=!0,fullWidth:j=!1,className:V,children:w,...y},z){const G=l.useMemo(()=>({variant:n,size:u,color:c,density:f,elevation:d,disabled:x}),[n,u,c,f,d,x]);return e(r.Provider,{value:G,children:e(o,{ref:z,value:m,defaultValue:p,onValueChange:e=>g?.(e),multiple:v,orientation:h,disabled:x,loopFocus:b,className:s(a,"vertical"===h?"flex-col":"flex-row",t[h],"glass"===(n??"glass")?i[h]:"",j?"flex w-full [&>*]:flex-1":"",V),...y,children:w})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as s from"react";import{
|
|
1
|
+
"use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import*as s from"react";import{useDefaults as i}from"../../internal/defaults.js";import{useRender as o}from"@base-ui/react/use-render";import{cx as a,hasContent as l,radiusClasses as n,sheetPaddingXClasses as d,sheetPaddingYClasses as c,sheetRestClasses as m,sheetSectionGapClasses as p,surfaceSlots as f,transitionClasses as b}from"../../internal/styles.js";const x=m,u={static:{top:"",bottom:""},sticky:{top:"sticky top-0 z-20",bottom:"sticky bottom-0 z-20"},fixed:{top:"fixed inset-x-0 top-0 z-30",bottom:"fixed inset-x-0 bottom-0 z-30"}},v={top:"border-b [border-color:var(--plass-divider)]",bottom:"border-t [border-color:var(--plass-divider)]"};export const PlToolbar=/* @__PURE__ */s.forwardRef(function PlToolbar({variant:s="glass",size:m,color:y,density:h,elevation:w=0,position:z="static",side:g="top",divider:j=!1,start:k,end:N,render:P,className:T,style:F,children:R,...q},A){const B=i(),C=m??B.size??"md",D=y??B.color??"primary",E=h??B.density??"default",G=a("flex w-full min-w-0 items-center",d[E][C],c[E][C],p[C],"static"===z?n[C]:"",x[s],j?v[g]:"",u[z][g],b,T);return o({render:P??e("div",{}),ref:A,props:{className:G,style:{...f(D,w),...F},children:r(t,{children:[l(k)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:k}):null,e("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:R}),l(N)?e("div",{className:"flex min-w-0 shrink-0 items-center gap-2",children:N}):null]}),...q}})});
|
|
@@ -89,4 +89,4 @@ export type PlTooltipProviderProps = React.ComponentProps<typeof BaseUITooltip.P
|
|
|
89
89
|
* this component wires both, and drops the reference while it is closed rather
|
|
90
90
|
* than pointing at an element that is not in the document.
|
|
91
91
|
*/
|
|
92
|
-
export declare function PlTooltip({ content, children, size, color, density, side, align, sideOffset, delay, closeDelay, arrow, open, defaultOpen, onOpenChange, disabled, className, style, ...props }: PlTooltipProps): React.JSX.Element;
|
|
92
|
+
export declare function PlTooltip({ content, children, size: sizeProp, color: colorProp, density: densityProp, side, align, sideOffset, delay, closeDelay, arrow, open, defaultOpen, onOpenChange, disabled, className, style, ...props }: PlTooltipProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as a}from"react/jsx-runtime";import*as e from"react";import{
|
|
1
|
+
"use client";import{jsx as s,jsxs as a}from"react/jsx-runtime";import*as e from"react";import{useDefaults as t}from"../../internal/defaults.js";import{Tooltip as o}from"@base-ui/react/tooltip";import{glassClasses as l,metaTextClasses as i,paddingXClasses as r,radiusClasses as n,surfaceSlots as d}from"../../internal/styles.js";export const PlTooltipProvider=o.Provider;const p=/* @__PURE__ */[l,"max-w-64 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","data-[instant]:[transition-duration:0ms]"].join(" "),c={xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1.5",xl:"py-2"},m={xs:6,sm:7,md:8,lg:9,xl:10};export function PlTooltip({content:l,children:g,size:f,color:h,density:y,side:u="top",align:x="center",sideOffset:b=6,delay:v,closeDelay:j,arrow:w=!0,open:P,defaultOpen:z,onOpenChange:O,disabled:N=!1,className:T,style:B,...C}){const D=t(),L=f??D.size??"sm",M=h??D.color??"secondary",_=y??D.density??"default",k=m[L],A=e.useId(),[I,R]=e.useState(z??!1),S=P??I;return a(o.Root,{open:P,defaultOpen:z,onOpenChange:s=>{R(s),O?.(s)},children:[s(o.Trigger,{render:g,delay:v,closeDelay:j,disabled:N,"aria-describedby":S?A:void 0}),s(o.Portal,{children:s(o.Positioner,{className:"plass-portal z-(--plass-z-portal) [outline:none]",side:u,align:x,sideOffset:b,children:a(o.Popup,{id:A,role:"tooltip",className:[p,n[L],r[_][L],c[L],i[L],T??""].filter(Boolean).join(" "),style:{...d(M,3),...B},...C,children:[w?s(o.Arrow,{className:["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"].join(" "),children:a("svg",{width:k,height:k/2,viewBox:"0 0 10 5","aria-hidden":"true",className:"block",children:[s("path",{d:"M0 0h10L5 5z",fill:"var(--plass-glass-line)"}),s("path",{d:"M0 0h10L5 5z",fill:"var(--plass-glass-press)",transform:"translate(0 -1)"})]})}):null,l]})})})]})}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassAlign, PlassColor, PlassDensity, PlassSide, PlassSize } from '../../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a step is about.
|
|
5
|
+
*
|
|
6
|
+
* Three forms, and the first is the one to reach for. A **ref** is checked by
|
|
7
|
+
* the compiler and survives a rename; a **selector** is a string that can stop
|
|
8
|
+
* matching the moment somebody renames a class, and the tour would go on
|
|
9
|
+
* running with the hole over an empty piece of background. The selector is here
|
|
10
|
+
* because it is the only form that works when the target belongs to something
|
|
11
|
+
* this page does not render — a third-party widget, a page rendered by a
|
|
12
|
+
* framework's router — and the **getter** is for the case where finding it is
|
|
13
|
+
* more than one query.
|
|
14
|
+
*/
|
|
15
|
+
export type PlTourTarget = string | React.RefObject<Element | null> | (() => Element | null | undefined);
|
|
16
|
+
/** One stop on the tour. */
|
|
17
|
+
export interface PlTourStep {
|
|
18
|
+
/**
|
|
19
|
+
* What this step is about. Left out, the step is centred over the page with
|
|
20
|
+
* nothing cut out of the dimming — which is what a welcome step and a closing
|
|
21
|
+
* step are.
|
|
22
|
+
*/
|
|
23
|
+
target?: PlTourTarget;
|
|
24
|
+
/** The step's heading. */
|
|
25
|
+
title?: React.ReactNode;
|
|
26
|
+
/** What it says. */
|
|
27
|
+
content?: React.ReactNode;
|
|
28
|
+
/** Which edge of the target the card sits on. @default 'bottom' */
|
|
29
|
+
side?: PlassSide;
|
|
30
|
+
/** Where along that edge. @default 'center' */
|
|
31
|
+
align?: PlassAlign;
|
|
32
|
+
/**
|
|
33
|
+
* How far the cut-out is grown past the target, in pixels.
|
|
34
|
+
*
|
|
35
|
+
* A control with a focus ring wants a few, so the ring is inside the light
|
|
36
|
+
* rather than cut in half by its edge; a whole panel wants none.
|
|
37
|
+
* @default 6
|
|
38
|
+
*/
|
|
39
|
+
padding?: number;
|
|
40
|
+
/** The cut-out's corner radius, in pixels. Defaults to the size's own. */
|
|
41
|
+
radius?: number;
|
|
42
|
+
}
|
|
43
|
+
/** The parts of a tour a caller can reach past the card itself. */
|
|
44
|
+
export interface PlTourClassNames {
|
|
45
|
+
/**
|
|
46
|
+
* The dimming, which is a sibling of the card rather than something inside
|
|
47
|
+
* it and so has no other way in.
|
|
48
|
+
*/
|
|
49
|
+
mask?: string;
|
|
50
|
+
/** The heading. */
|
|
51
|
+
title?: string;
|
|
52
|
+
/** The body. */
|
|
53
|
+
content?: string;
|
|
54
|
+
/** The × in the corner. */
|
|
55
|
+
close?: string;
|
|
56
|
+
/** The row holding the counter and the buttons. */
|
|
57
|
+
footer?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface PlTourProps {
|
|
60
|
+
/** The stops, in order. */
|
|
61
|
+
steps: readonly PlTourStep[];
|
|
62
|
+
/** Whether the tour is running. Pass it with `onOpenChange` to control one. */
|
|
63
|
+
open?: boolean;
|
|
64
|
+
/** Whether it starts running, when the tour keeps that itself. @default false */
|
|
65
|
+
defaultOpen?: boolean;
|
|
66
|
+
onOpenChange?: (open: boolean) => void;
|
|
67
|
+
/** Which stop, counted from `0`. Pass it with `onStepChange` to control one. */
|
|
68
|
+
step?: number;
|
|
69
|
+
/** Which one it starts on, when the tour keeps that itself. @default 0 */
|
|
70
|
+
defaultStep?: number;
|
|
71
|
+
onStepChange?: (step: number) => void;
|
|
72
|
+
/** Called when the last step's button is pressed, before the tour closes. */
|
|
73
|
+
onFinish?: () => void;
|
|
74
|
+
/**
|
|
75
|
+
* Dims the page and cuts the target out of the dimming.
|
|
76
|
+
*
|
|
77
|
+
* Off, the card is the only thing the tour draws, which is right for a tour
|
|
78
|
+
* over a page the reader is meant to keep working in.
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
mask?: boolean;
|
|
82
|
+
/** Draws the Skip button beside the counter. @default true */
|
|
83
|
+
skippable?: boolean;
|
|
84
|
+
/** Whether Escape and the × end the tour. @default true */
|
|
85
|
+
dismissible?: boolean;
|
|
86
|
+
/** Scrolls each target into view as the tour reaches it. @default true */
|
|
87
|
+
scrollIntoView?: boolean;
|
|
88
|
+
/** The Previous button. Defaults to the locale's word. */
|
|
89
|
+
previousLabel?: React.ReactNode;
|
|
90
|
+
/** The Next button. */
|
|
91
|
+
nextLabel?: React.ReactNode;
|
|
92
|
+
/** What Next becomes on the last step. */
|
|
93
|
+
doneLabel?: React.ReactNode;
|
|
94
|
+
/** The Skip button. */
|
|
95
|
+
skipLabel?: React.ReactNode;
|
|
96
|
+
/** Type scale and the card's width. */
|
|
97
|
+
size?: PlassSize;
|
|
98
|
+
/** Semantic colour role: the buttons, the focus ring and the ring round the light. */
|
|
99
|
+
color?: PlassColor;
|
|
100
|
+
/** The card's padding. Never the type scale. */
|
|
101
|
+
density?: PlassDensity;
|
|
102
|
+
/** Class names for the card. */
|
|
103
|
+
className?: string;
|
|
104
|
+
/** Class names for the parts around it. */
|
|
105
|
+
classNames?: PlTourClassNames;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A guided walk over a page that already exists — the three things a new reader
|
|
109
|
+
* has to be shown once, pointed at where they actually are.
|
|
110
|
+
*
|
|
111
|
+
* It is [`PlHowToSteps`](../surfaces/how-to-steps) turned inside out. That
|
|
112
|
+
* component puts the instructions *in* the page and the reader follows them;
|
|
113
|
+
* this one leaves the page as it is and stands over it. So a step says what it
|
|
114
|
+
* is about rather than describing it: what a tour points at is already on
|
|
115
|
+
* screen, and a second copy inside the card is a second copy to keep in step.
|
|
116
|
+
*
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <PlTour
|
|
119
|
+
* defaultOpen
|
|
120
|
+
* steps={[
|
|
121
|
+
* { target: filterRef, title: 'Narrow the list', content: 'Type here…' },
|
|
122
|
+
* { target: '#export', title: 'Take it with you', side: 'left' }
|
|
123
|
+
* ]}
|
|
124
|
+
* />
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* **The dimming takes the pointer and the light does not.** The scrim is one
|
|
128
|
+
* element clipped to the whole viewport with the target cut out of it, and a
|
|
129
|
+
* clipped-away region is not hit-tested — so the control being pointed at can
|
|
130
|
+
* be used and nothing else can. That is the difference between a tour and a
|
|
131
|
+
* dialog with a picture of a control in it, and it falls out of the geometry
|
|
132
|
+
* rather than being a second mechanism that has to agree with it.
|
|
133
|
+
*/
|
|
134
|
+
export declare function PlTour({ steps, open, defaultOpen, onOpenChange, step, defaultStep, onStepChange, onFinish, mask, skippable, dismissible, scrollIntoView, previousLabel, nextLabel, doneLabel, skipLabel, size: sizeProp, color: colorProp, density: densityProp, className, classNames }: PlTourProps): React.JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import*as t from"react";import{Popover as l}from"@base-ui/react/popover";import{PlButton as n}from"../button/index.js";import{useDefaults as a}from"../../internal/defaults.js";import{CloseIcon as o}from"../../internal/icons.js";import{useLabels as r}from"../../internal/labels.js";import{inflate as i,spotlightPath as c}from"../../internal/tour.js";import{cx as d,focusRingClasses as p,glassClasses as m,hasContent as u,metaTextClasses as f,radiusClasses as v,sheetBodyClasses as h,sheetHeaderGapClasses as g,sheetPaddingXClasses as x,sheetPaddingYClasses as b,sheetSectionGapClasses as w,sheetTitleClasses as y,surfaceSlots as k}from"../../internal/styles.js";const z={xs:"max-w-56",sm:"max-w-64",md:"max-w-80",lg:"max-w-96",xl:"max-w-lg"},N={xs:"xs",sm:"xs",md:"sm",lg:"sm",xl:"md"},j={xs:6,sm:8,md:10,lg:12,xl:14},_=/* @__PURE__ */[m,"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(" "),L=/* @__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)",p].join(" ");function resolve(e){return void 0===e?null:"string"==typeof e?document.querySelector(e):"function"==typeof e?e()??null:e.current??null}export function PlTour({steps:p,open:m,defaultOpen:C=!1,onOpenChange:P,step:E,defaultStep:O=0,onStepChange:S,onFinish:R,mask:F=!0,skippable:M=!0,dismissible:T=!0,scrollIntoView:q=!0,previousLabel:A,nextLabel:I,doneLabel:V,skipLabel:B,size:D,color:H,density:G,className:J,classNames:K}){const Q=a(),U=r(),W=D??Q.size??"md",X=H??Q.color??"primary",Y=G??Q.density??"default",[Z,$]=t.useState(C),[ee,se]=t.useState(O),te=m??Z,le=Math.min(E??ee,Math.max(0,p.length-1)),ne=p[le],[ae,oe]=t.useState(null),setOpen=e=>{void 0===m&&$(e),P?.(e)},goTo=e=>{void 0===E&&se(e),S?.(e)},re=ne?.target,ie=ne?.padding??6;if(t.useEffect(()=>{if(!te)return;const e=resolve(re);if(!(e instanceof HTMLElement))return;q&&e.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"});let s=0;const read=()=>{s=0;const t=e.getBoundingClientRect();oe({at:le,spot:i({top:t.top,left:t.left,width:t.width,height:t.height},ie)})},schedule=()=>{0===s&&(s=requestAnimationFrame(read))};read();const t="undefined"==typeof ResizeObserver?null:new ResizeObserver(schedule);return t?.observe(e),window.addEventListener("scroll",schedule,{passive:!0,capture:!0}),window.addEventListener("resize",schedule,{passive:!0}),()=>{0!==s&&cancelAnimationFrame(s),t?.disconnect(),window.removeEventListener("scroll",schedule,!0),window.removeEventListener("resize",schedule)}},[te,re,ie,le,q]),0===p.length)return null;const ce=te&&ae?.at===le?ae.spot:null,de=0===le,pe=le===p.length-1,me=x[Y][W],ue=b[Y][W],fe=N[W],ve=u(ne?.title)||u(ne?.content);return e(l.Root,{open:te,onOpenChange:(e,s)=>{(e||T||"escape-key"!==s.reason)&&(e||"outside-press"!==s.reason&&"focus-out"!==s.reason)?setOpen(e):s.cancel()},children:s(l.Portal,{children:[te&&F?e("div",{"aria-hidden":"true","data-testid":"plass-tour-mask",className:d("plass-portal fixed inset-0 z-(--plass-z-portal)","bg-(--plass-scrim) [backdrop-filter:blur(2px)] [-webkit-backdrop-filter:blur(2px)]","[transition:opacity_var(--plass-duration-slow)_var(--plass-ease)]",K?.mask),style:{clipPath:c(ce,ne?.radius??j[W])}}):null,e(l.Positioner,{className:"plass-portal z-(--plass-z-portal) [outline:none]",side:ne?.side??"bottom",align:ne?.align??"center",sideOffset:10,collisionPadding:12,anchor:()=>resolve(ne?.target),children:s(l.Popup,{className:d(_,v[W],h[W],w[W],z[W],me,ue,J),style:k(X,3),children:[ve?s("div",{className:"flex items-start gap-3",children:[s("div",{className:d("flex min-w-0 flex-1 flex-col",g[W]),children:[u(ne?.title)?e(l.Title,{className:d("m-0 font-semibold",y[W],K?.title),children:ne?.title}):null,u(ne?.content)?e(l.Description,{className:d("m-0 min-w-0",K?.content),children:ne?.content}):null]}),T?e("button",{type:"button","aria-label":U.close,onClick:()=>setOpen(!1),className:d(L,K?.close),children:e(o,{})}):null]}):null,s("div",{className:d("flex items-center gap-2",K?.footer),children:[s("span",{className:d("shrink-0 tabular-nums text-(--plass-muted-fg)",f[W]),children:[le+1," / ",p.length]}),s("div",{className:"ms-auto flex items-center gap-2",children:[M&&!pe?e(n,{size:fe,variant:"ghost",color:"secondary",onClick:()=>setOpen(!1),children:B??U.skip}):null,de?null:e(n,{size:fe,variant:"ghost",color:X,onClick:()=>goTo(le-1),children:A??U.previous}),e(n,{size:fe,color:X,onClick:()=>pe?(R?.(),void setOpen(!1)):goTo(le+1),children:pe?V??U.done:I??U.next})]})]})]})})]})})}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlTour}from"./PlTour.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as a from"react";import{useDefaults as s}from"../../internal/defaults.js";import{useLabels as t}from"../../internal/labels.js";import{PlCheckbox as r}from"../checkbox/PlCheckbox.js";import{PlIconButton as i}from"../icon-button/PlIconButton.js";import{PlTextField as n}from"../text-field/PlTextField.js";import{ArrowRightIcon as o}from"../../internal/icons.js";import{searchText as c}from"../../internal/search.js";import{cx as d,fieldRestClasses as h,hasContent as m,metaTextClasses as f,paddingXClasses as u,radiusClasses as b,surfaceSlots as p,toLength as v}from"../../internal/styles.js";const g={xs:"py-1",sm:"py-1.5",md:"py-2",lg:"py-2.5",xl:"py-3"},y={xs:"py-0.5",sm:"py-1",md:"py-1",lg:"py-1.5",xl:"py-2"};function Panel({title:a,rows:s,ticked:t,onTick:i,onTickAll:o,search:c,onSearch:m,searchable:v,disabled:x,height:k,emptyLabel:w,searchLabel:S,selectAllLabel:L,style:N}){const{variant:T,size:j,color:A,density:z}=N,C=s.filter(e=>!e.disabled),P=C.filter(e=>t.has(e.value)),M=C.length>0&&P.length===C.length,V=P.length>0&&!M,_=u[z][j];return l("div",{className:d("flex min-w-0 flex-col overflow-hidden",h[T],b[j]),style:p(A,0),children:[l("div",{className:d("flex items-center gap-2 border-b [border-color:var(--plass-divider)]",_,g[j]),children:[e(r,{size:j,color:A,checked:M,indeterminate:V,disabled:x||0===C.length,"aria-label":L,onCheckedChange:e=>o(!0===e)}),e("span",{className:d("min-w-0 flex-1 truncate font-medium",f[j]),children:a}),l("span",{className:d("shrink-0 tabular-nums text-(--plass-muted-fg)",f[j]),children:[P.length,"/",s.length]})]}),v?e("div",{className:d(_,g[j]),children:e(n,{size:j,color:A,density:z,fullWidth:!0,variant:"ghost",disabled:x,placeholder:S,"aria-label":S,value:c,onChange:e=>m(e.target.value)})}):null,e("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",style:void 0===k?void 0:{height:k},children:e("div",{className:d("flex flex-col",_,g[j]),children:0===s.length?e("span",{className:d("text-(--plass-muted-fg)",f[j],y[j]),children:w}):s.map(l=>e(r,{size:j,color:A,className:y[j],label:l.label,checked:t.has(l.value),disabled:x||l.disabled,onCheckedChange:e=>i(l.value,!0===e)},l.value))})})]})}function narrow(e,l){const a=c(l);return""===a?e:e.filter(e=>"string"!=typeof e.label||c(e.label).includes(a))}export const PlTransfer=/* @__PURE__ */a.forwardRef(function PlTransfer({items:r,value:n,defaultValue:c,onValueChange:h,sourceLabel:f,targetLabel:u,searchable:b=!1,searchLabel:p,emptyLabel:g,selectAllLabel:y,toTargetLabel:x,toSourceLabel:k,height:w=220,disabled:S=!1,variant:L="glass",size:N,color:T,density:j,className:A,...z},C){const P=s(),M=t(),V=f??M.transferAvailable,_=u??M.transferSelected,B=p??M.search,F=g??M.empty,I=y??M.selectAll,R=x??M.transferToSelected,W=k??M.transferToAvailable,q=N??P.size??"md",D=T??P.color??"primary",E=j??P.density??"default",[G,H]=a.useState(c??[]),J=n??G,[K,O]=a.useState(()=>new Set),[Q,U]=a.useState(""),[X,Y]=a.useState(""),Z=a.useMemo(()=>new Set(J),[J]),$=a.useMemo(()=>r.filter(e=>!Z.has(e.value)),[r,Z]),ee=a.useMemo(()=>r.filter(e=>Z.has(e.value)),[r,Z]),tick=(e,l)=>{O(a=>{const s=new Set(a);return l?s.add(e):s.delete(e),s})},tickAll=(e,l)=>{O(a=>{const s=new Set(a);for(const a of e)a.disabled||(l?s.add(a.value):s.delete(a.value));return s})},move=(e,l)=>{const a=e.filter(e=>!e.disabled&&K.has(e.value));if(0===a.length)return;const s=new Set(a.map(e=>e.value)),t=l?r.filter(e=>Z.has(e.value)||s.has(e.value)).map(e=>e.value):J.filter(e=>!s.has(e));O(e=>new Set([...e].filter(e=>!s.has(e)))),(e=>{void 0===n&&H(e),h?.(e)})(t)},le=narrow($,Q),ae=narrow(ee,X),se=le.some(e=>!e.disabled&&K.has(e.value)),te=ae.some(e=>!e.disabled&&K.has(e.value)),re=v(w),ie={variant:L,size:q,color:D,density:E},ne="ghost"===L?"ghost":"glass";return l("div",{ref:C,className:d("grid w-full items-center gap-3","[grid-template-columns:minmax(0,1fr)_auto_minmax(0,1fr)]",A),...z,children:[e(Panel,{title:m(V)?V:"Available",rows:le,ticked:K,onTick:tick,onTickAll:e=>tickAll(le,e),search:Q,onSearch:U,searchable:b,disabled:S,height:re,emptyLabel:F,searchLabel:B,selectAllLabel:I,style:ie}),l("div",{className:"flex flex-col gap-2",children:[e(i,{size:q,color:D,variant:ne,label:R,disabled:S||!se,onClick:()=>move(le,!0),icon:e(o,{})}),e(i,{size:q,color:D,variant:ne,label:W,disabled:S||!te,onClick:()=>move(ae,!1),icon:e("span",{className:"flex rotate-180",children:e(o,{})})})]}),e(Panel,{title:m(_)?_:"Selected",rows:ae,ticked:K,onTick:tick,onTickAll:e=>tickAll(ae,e),search:X,onSearch:Y,searchable:b,disabled:S,height:re,emptyLabel:F,searchLabel:B,selectAllLabel:I,style:ie})]})});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassDensity, PlassSize } from '../../types.js';
|
|
3
|
+
/** One node. A branch is a node with `children`; a leaf is one without. */
|
|
4
|
+
export interface PlTreeNode {
|
|
5
|
+
/** What identifies it. Unique across the whole tree. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** What the row says. */
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
/** A glyph before the label. */
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
/** Its own children. An **empty array is a branch with nothing in it**, which
|
|
12
|
+
* is not the same as a leaf: the first opens and shows nothing, the second
|
|
13
|
+
* has no twisty at all. `undefined` is the leaf. */
|
|
14
|
+
children?: readonly PlTreeNode[];
|
|
15
|
+
/** In the tree but not selectable, and not a stop for the arrow keys. */
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** How many rows a click can leave selected. */
|
|
19
|
+
export type PlTreeSelection = 'none' | 'single' | 'multiple';
|
|
20
|
+
export interface PlTreeProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color'> {
|
|
21
|
+
/** The whole tree, as data. */
|
|
22
|
+
items: readonly PlTreeNode[];
|
|
23
|
+
/** The ids of the branches that are open. Use with `onExpandedChange` to control them. */
|
|
24
|
+
expanded?: readonly string[];
|
|
25
|
+
/** The branches that start open, for an uncontrolled tree. */
|
|
26
|
+
defaultExpanded?: readonly string[];
|
|
27
|
+
onExpandedChange?: (expanded: string[]) => void;
|
|
28
|
+
/** The ids of the selected rows. Use with `onSelectedChange` to control them. */
|
|
29
|
+
selected?: readonly string[];
|
|
30
|
+
/** What starts selected, for an uncontrolled tree. */
|
|
31
|
+
defaultSelected?: readonly string[];
|
|
32
|
+
onSelectedChange?: (selected: string[]) => void;
|
|
33
|
+
/**
|
|
34
|
+
* How many rows a click can leave selected.
|
|
35
|
+
*
|
|
36
|
+
* `single` by default. `none` makes the tree a browser rather than a
|
|
37
|
+
* chooser — every row still expands, and a click reports through
|
|
38
|
+
* `onItemClick` without anything staying lit.
|
|
39
|
+
* @default 'single'
|
|
40
|
+
*/
|
|
41
|
+
selection?: PlTreeSelection;
|
|
42
|
+
/** Called when a row is clicked, selectable or not. */
|
|
43
|
+
onItemClick?: (node: PlTreeNode) => void;
|
|
44
|
+
/** @default 'md' */
|
|
45
|
+
size?: PlassSize;
|
|
46
|
+
/** @default 'primary' */
|
|
47
|
+
color?: PlassColor;
|
|
48
|
+
/** @default 'default' */
|
|
49
|
+
density?: PlassDensity;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A hierarchy, opened one branch at a time.
|
|
53
|
+
*
|
|
54
|
+
* It takes its nodes as **data** rather than as children, which is the opposite
|
|
55
|
+
* of what most of this library does and is the right way round here for one
|
|
56
|
+
* reason: a tree is recursive, and recursion written in JSX is a component
|
|
57
|
+
* every caller has to write for themselves. `PlTable` takes its columns the
|
|
58
|
+
* same way and for the same reason.
|
|
59
|
+
*
|
|
60
|
+
* The keyboard is the ARIA tree pattern and it is most of what makes this a
|
|
61
|
+
* tree rather than a nested list: **one tab stop** for the whole thing, the up
|
|
62
|
+
* and down arrows walking the rows that are actually visible, and the left and
|
|
63
|
+
* right arrows opening a branch, stepping into it, and going back out to the
|
|
64
|
+
* parent. A tree where Tab walked four hundred rows would be one nobody reaches
|
|
65
|
+
* the end of.
|
|
66
|
+
*/
|
|
67
|
+
export declare const PlTree: React.ForwardRefExoticComponent<PlTreeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import*as t from"react";import{useDefaults as i}from"../../internal/defaults.js";import{Collapsible as a}from"@base-ui/react/collapsible";import{ChevronIcon as n}from"../../internal/icons.js";import{controlTextLeadingClasses as s,cx as d,focusRingClasses as r,gapClasses as o,iconClasses as c,radiusClasses as p,surfaceSlots as m,transitionClasses as u}from"../../internal/styles.js";const f=/* @__PURE__ */["h-(--collapsible-panel-height) overflow-hidden","[transition:height_var(--plass-duration-slow)_var(--plass-ease)]","data-[starting-style]:h-0 data-[ending-style]:h-0"].join(" "),h={xs:14,sm:16,md:20,lg:24,xl:28},v={default:{xs:"py-1",sm:"py-1",md:"py-1.5",lg:"py-2",xl:"py-2.5"},compact:{xs:"py-0.5",sm:"py-0.5",md:"py-1",lg:"py-1",xl:"py-1.5"}};function visibleRows(e,l,t=1,i=[]){for(const a of e)i.push({node:a,level:t}),a.children&&l.has(a.id)&&visibleRows(a.children,l,t+1,i);return i}export const PlTree=/* @__PURE__ */t.forwardRef(function PlTree({items:b,expanded:x,defaultExpanded:y,onExpandedChange:g,selected:w,defaultSelected:k,onSelectedChange:D,selection:S="single",onItemClick:j,size:N,color:I,density:R,className:C,style:E,...A},_){const M=i(),P=N??M.size??"md",z=I??M.color??"primary",F=R??M.density??"default",[T,$]=t.useState(y??[]),B=x??T,H=t.useMemo(()=>new Set(B),[B]),[K,L]=t.useState(k??[]),U=w??K,q=t.useMemo(()=>new Set(U),[U]),G=t.useMemo(()=>visibleRows(b,H),[b,H]),[J,O]=t.useState(null),Q=G.filter(e=>!e.node.disabled),V=J&&Q.some(e=>e.node.id===J)?J:Q[0]?.node.id??null,toggle=(e,l)=>{var t;t=l??!H.has(e)?[...B.filter(l=>l!==e),e]:B.filter(l=>l!==e),void 0===x&&$(t),g?.(t)},select=e=>{if("none"===S)return;const l="multiple"===S?q.has(e.id)?U.filter(l=>l!==e.id):[...U,e.id]:[e.id];void 0===w&&L(l),D?.(l)},W=t.useId(),rowId=e=>`${W}-${e}`,focusRow=e=>{O(e),document.getElementById(rowId(e))?.focus()},renderRow=({node:i,level:m})=>{const b=void 0!==i.children,x=H.has(i.id),y=q.has(i.id);return l(t.Fragment,{children:[l("div",{id:rowId(i.id),role:"treeitem","aria-level":m,"aria-expanded":b?x:void 0,"aria-selected":"none"===S?void 0:y,"aria-disabled":i.disabled||void 0,tabIndex:i.disabled?void 0:V===i.id?0:-1,onFocus:()=>O(i.id),onKeyDown:e=>{i.disabled||((e,l,t)=>{const i=Q.findIndex(e=>e.node.id===l.id),a=void 0!==l.children,n=H.has(l.id);switch(e.key){case"ArrowDown":e.preventDefault(),Q[i+1]&&focusRow(Q[i+1].node.id);break;case"ArrowUp":e.preventDefault(),Q[i-1]&&focusRow(Q[i-1].node.id);break;case"ArrowRight":e.preventDefault(),a&&!n?toggle(l.id,!0):a&&Q[i+1]&&focusRow(Q[i+1].node.id);break;case"ArrowLeft":if(e.preventDefault(),a&&n){toggle(l.id,!1);break}for(let e=i-1;e>=0;e-=1)if(Q[e].level<t){focusRow(Q[e].node.id);break}break;case"Home":e.preventDefault(),Q[0]&&focusRow(Q[0].node.id);break;case"End":e.preventDefault(),Q.length&&focusRow(Q[Q.length-1].node.id);break;case"Enter":case" ":e.preventDefault(),a&&toggle(l.id),select(l),j?.(l)}})(e,i,m)},onClick:()=>{i.disabled||(b&&toggle(i.id),select(i),j?.(i))},className:d("flex cursor-pointer items-center select-none",o[P],v[F][P],s[P],p[P],r,u,c,i.disabled?"cursor-not-allowed opacity-50":y?"bg-(--p-soft) text-(--p-accent) font-medium":"text-(--plass-fg) hover:bg-(--p-soft)"),style:{paddingInlineStart:(m-1)*h[P]+6+"px"},children:[e("span",{"aria-hidden":"true",className:d("flex shrink-0 items-center text-(--plass-muted-fg)","[transition:rotate_var(--plass-duration)_var(--plass-ease)]",b?"":"invisible",x?"rotate-0":"-rotate-90 rtl:rotate-90"),children:e(n,{})}),i.icon?e("span",{className:"flex shrink-0 items-center",children:i.icon}):null,e("span",{className:"truncate",children:i.label})]}),b&&i.children.length>0?e(a.Root,{open:x,children:e(a.Panel,{role:"group",className:f,children:i.children.map(e=>renderRow({node:e,level:m+1}))})}):null]},i.id)};return e("div",{ref:_,role:"tree","aria-multiselectable":"multiple"===S||void 0,className:d("flex flex-col",C),style:{...m(z,0),...E},...A,children:b.map(e=>renderRow({node:e,level:1}))})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlTree}from"./PlTree.js";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type PlassPickerShellProps } from '../../internal/picker.js';
|
|
3
|
+
import { type PlTreeNode } from '../tree/PlTree.js';
|
|
4
|
+
/**
|
|
5
|
+
* One node of the tree a reader is choosing from.
|
|
6
|
+
*
|
|
7
|
+
* A `PlTree`'s node with two more answers on it, both of which only mean
|
|
8
|
+
* anything once the tree is behind a field: what a filter matches the node
|
|
9
|
+
* against, and whether the node is one of the answers or only the road to one.
|
|
10
|
+
*/
|
|
11
|
+
export interface PlTreeSelectNode extends PlTreeNode {
|
|
12
|
+
/**
|
|
13
|
+
* What a search matches against.
|
|
14
|
+
*
|
|
15
|
+
* `label` is a `ReactNode` and the text inside one is not something to guess
|
|
16
|
+
* at, so a node whose label is anything but a string says here what it can be
|
|
17
|
+
* found by. Falls back to the label when that is a string, and to the `id`
|
|
18
|
+
* when it is not.
|
|
19
|
+
*/
|
|
20
|
+
searchLabel?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Whether this node may itself be chosen.
|
|
23
|
+
*
|
|
24
|
+
* Defaults to `true` for a leaf and to `selectableBranches` for a node that
|
|
25
|
+
* has children. Set it either way to override both.
|
|
26
|
+
*/
|
|
27
|
+
selectable?: boolean;
|
|
28
|
+
children?: readonly PlTreeSelectNode[];
|
|
29
|
+
}
|
|
30
|
+
export interface PlTreeSelectProps extends PlassPickerShellProps {
|
|
31
|
+
/** The whole tree, as data. */
|
|
32
|
+
items: readonly PlTreeSelectNode[];
|
|
33
|
+
/** The chosen ids. Use with `onValueChange` for a controlled picker. */
|
|
34
|
+
value?: readonly string[];
|
|
35
|
+
/** What starts chosen, for an uncontrolled one. */
|
|
36
|
+
defaultValue?: readonly string[];
|
|
37
|
+
onValueChange?: (value: string[]) => void;
|
|
38
|
+
/** Whether more than one node may be held at once. @default false */
|
|
39
|
+
multiple?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether a node that has children may itself be chosen.
|
|
42
|
+
*
|
|
43
|
+
* Off by default, which is the shape most of these trees have: the branches
|
|
44
|
+
* are the taxonomy and the leaves are the answers, and a "Europe" held
|
|
45
|
+
* alongside "France" is usually a data model nobody meant. A node's own
|
|
46
|
+
* `selectable` overrides it either way, and a branch that cannot be chosen
|
|
47
|
+
* still opens and closes — pressing it is how you get at what is under it.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
selectableBranches?: boolean;
|
|
51
|
+
/** The ids of the branches that are open. Use with `onExpandedChange` to control them. */
|
|
52
|
+
expanded?: readonly string[];
|
|
53
|
+
/** The branches that start open, for an uncontrolled tree. */
|
|
54
|
+
defaultExpanded?: readonly string[];
|
|
55
|
+
onExpandedChange?: (expanded: string[]) => void;
|
|
56
|
+
/** Whether the popup is open. Use with `onOpenChange` to control it. */
|
|
57
|
+
open?: boolean;
|
|
58
|
+
defaultOpen?: boolean;
|
|
59
|
+
onOpenChange?: (open: boolean) => void;
|
|
60
|
+
/** Shown in the trigger while nothing is chosen. */
|
|
61
|
+
placeholder?: React.ReactNode;
|
|
62
|
+
/** Offers the × that empties the control. @default false */
|
|
63
|
+
clearable?: boolean;
|
|
64
|
+
/** Closes the popup as soon as a node is chosen. @default `!multiple` */
|
|
65
|
+
closeOnSelect?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Offers a field above the tree that filters it.
|
|
68
|
+
*
|
|
69
|
+
* A match keeps its ancestors, because a node with its parents cut away is a
|
|
70
|
+
* node the reader cannot place — a "Seoul" under nothing at all does not say
|
|
71
|
+
* which taxonomy it came out of. Every branch a filter keeps is opened, since
|
|
72
|
+
* a match folded inside a shut parent is a match nobody was shown.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
searchable?: boolean;
|
|
76
|
+
/** The word in the filter field. @default 'Search' */
|
|
77
|
+
searchLabel?: string;
|
|
78
|
+
/** What the popup says when the filter matched nothing. @default 'Nothing here' */
|
|
79
|
+
emptyLabel?: string;
|
|
80
|
+
/** How the trigger writes what is held. Defaults to the labels, comma-joined. */
|
|
81
|
+
format?: (chosen: PlTreeSelectNode[]) => React.ReactNode;
|
|
82
|
+
/** Identifies the field when a form is submitted. One hidden input per value. */
|
|
83
|
+
name?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A value chosen out of a hierarchy rather than out of a list.
|
|
87
|
+
*
|
|
88
|
+
* The gap between a `PlSelect` and a `PlTree`: the first is a flat list behind
|
|
89
|
+
* a field, the second is a hierarchy that shows what it holds but has no field
|
|
90
|
+
* to put it in. A category, a folder, a region and an org chart node are all
|
|
91
|
+
* chosen from a shape a flat list flattens away.
|
|
92
|
+
*
|
|
93
|
+
* It is the two of them composed and almost nothing else — the trigger is the
|
|
94
|
+
* same `PickerShell` all four pickers wear, and what is in the popup is a
|
|
95
|
+
* `PlTree` with a `PlTextField` over it. What it adds is the arithmetic between
|
|
96
|
+
* them: which nodes a query keeps, which branches that opens, and which of the
|
|
97
|
+
* ids coming back out of the tree are answers rather than roads.
|
|
98
|
+
*/
|
|
99
|
+
export declare const PlTreeSelect: React.ForwardRefExoticComponent<PlTreeSelectProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsxs as e,jsx as l}from"react/jsx-runtime";import*as t from"react";import{useDefaults as n}from"../../internal/defaults.js";import{useLabels as r}from"../../internal/labels.js";import{PickerShell as a}from"../../internal/picker.js";import{searchHaystack as i,searchText as o}from"../../internal/search.js";import{cx as s,metaTextClasses as d}from"../../internal/styles.js";import{PlTextField as c}from"../text-field/PlTextField.js";import{PlTree as h}from"../tree/PlTree.js";function flatten(e,l=new Map){for(const t of e)l.set(t.id,t),t.children&&flatten(t.children,l);return l}function haystackOf(e){return i([e.searchLabel??("string"==typeof e.label?e.label:e.id)])}function filterTree(e,l){const t=[];for(const n of e){const e=n.children?filterTree(n.children,l):void 0,r=haystackOf(n).includes(l);(r||e&&e.length>0)&&t.push(r?n:{...n,children:e})}return t}function branchIds(e,l=[]){for(const t of e)t.children&&t.children.length>0&&(l.push(t.id),branchIds(t.children,l));return l}export const PlTreeSelect=/* @__PURE__ */t.forwardRef(function PlTreeSelect({items:i,value:f,defaultValue:m,onValueChange:u,multiple:p=!1,selectableBranches:g=!1,expanded:b,defaultExpanded:v,onExpandedChange:y,open:x,defaultOpen:j,onOpenChange:C,placeholder:O,clearable:S=!1,closeOnSelect:T,searchable:w=!1,searchLabel:z,emptyLabel:M,format:P,name:k,size:E,color:I,density:L,readOnly:N=!1,disabled:V=!1,...F},R){const B=n(),W=E??B.size??"md",q=I??B.color??"primary",A=L??B.density??"default",D=r(),G=z??D.search,H=M??D.empty,[J,K]=t.useState(m??[]),Q=f??J,[U,X]=t.useState(j??!1),Y=x??U,[Z,$]=t.useState(""),_=o(Z),ee=t.useMemo(()=>flatten(i),[i]),le=t.useMemo(()=>""===_?i:filterTree(i,_),[i,_]),te=""!==_,[ne,re]=t.useState(v??[]),ae=t.useMemo(()=>te?branchIds(le):void 0,[te,le])??b??ne,setOpen=e=>{e&&(V||N)||(void 0===x&&X(e),e||$(""),C?.(e))},commit=e=>{void 0===f&&K(e),u?.(e)},isSelectable=e=>!e.disabled&&(e.selectable??(!(e.children&&e.children.length>0)||g)),ie=Q.map(e=>ee.get(e)).filter(e=>void 0!==e),oe=0===ie.length?O??"":P?P(ie):ie.map((l,n)=>e(t.Fragment,{children:[0===n?null:", ",l.label]},l.id));return l(a,{...F,size:W,color:q,density:A,readOnly:N,disabled:V,triggerRef:R,display:oe,empty:0===ie.length,clearable:S,onClear:()=>commit([]),open:Y,onOpenChange:setOpen,labels:D,hiddenValues:k?Q.map(e=>({name:k,value:e})):void 0,children:e("div",{className:"flex max-h-80 w-64 flex-col gap-1.5 overflow-hidden",children:[w?l(c,{size:W,color:q,density:A,variant:"ghost",fullWidth:!0,placeholder:G,"aria-label":G,value:Z,onChange:e=>$(e.target.value)}):null,l("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:0===le.length?l("p",{className:s("px-1.5 py-1 text-(--plass-muted-fg)",d[W]),children:H}):l(h,{items:le,size:W,color:q,density:A,selection:p?"multiple":"single",selected:Q,onSelectedChange:e=>{if(!p){const l=1===e.length?ee.get(e[0]):void 0;if(!l||!isSelectable(l))return;return commit([l.id]),void((T??!0)&&setOpen(!1))}const l=e.filter(e=>{const l=ee.get(e);return void 0!==l&&isSelectable(l)});(l.length!==Q.length||l.some((e,l)=>e!==Q[l]))&&(commit(l),T&&setOpen(!1))},expanded:ae,onExpandedChange:e=>{te||(void 0===b&&re(e),y?.(e))}})})]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlTreeSelect}from"./PlTreeSelect.js";
|