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
|
+
/** What a caller gets back: the answer, and the four ways to change it. */
|
|
2
|
+
export interface PlDisclosureResult {
|
|
3
|
+
/** Whether the thing is open. */
|
|
4
|
+
open: boolean;
|
|
5
|
+
/** Opens it. */
|
|
6
|
+
onOpen: () => void;
|
|
7
|
+
/** Closes it. */
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
/** Turns it round. */
|
|
10
|
+
onToggle: () => void;
|
|
11
|
+
/** Sets it to a value, for the caller who already has one. */
|
|
12
|
+
setOpen: (open: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* One boolean and the four callbacks that change it.
|
|
16
|
+
*
|
|
17
|
+
* The smallest hook in the library and the one that saves the most typing: a
|
|
18
|
+
* dialog, a drawer, a popover and a menu each need exactly this, and written by
|
|
19
|
+
* hand it is a `useState` plus three arrow functions **that are new on every
|
|
20
|
+
* render**. That last part is the reason it is worth a hook rather than a
|
|
21
|
+
* snippet — an inline `() => setOpen(false)` handed to a memoised trigger
|
|
22
|
+
* defeats the memo, and every one of the callbacks here is stable for the life
|
|
23
|
+
* of the component.
|
|
24
|
+
*
|
|
25
|
+
* The names are the props they are handed to. `onOpenChange` is the one shape
|
|
26
|
+
* every openable component in this library takes, and `setOpen` fits it
|
|
27
|
+
* exactly, so the ordinary use is a spread:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const dialog = usePlDisclosure();
|
|
31
|
+
*
|
|
32
|
+
* <PlButton onClick={dialog.onOpen}>Delete</PlButton>
|
|
33
|
+
* <PlModal open={dialog.open} onOpenChange={dialog.setOpen} title="Delete this?">
|
|
34
|
+
* <PlButton onClick={dialog.onClose}>Cancel</PlButton>
|
|
35
|
+
* </PlModal>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* It holds no DOM, watches nothing and has no effect in it, so it costs the
|
|
39
|
+
* same on a server as it does in a browser.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const drawer = usePlDisclosure(true);
|
|
43
|
+
*/
|
|
44
|
+
export declare function usePlDisclosure(initial?: boolean): PlDisclosureResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";export function usePlDisclosure(o=!1){const[s,l]=e.useState(o),n=e.useCallback(()=>l(!0),[]),t=e.useCallback(()=>l(!1),[]),u=e.useCallback(()=>l(e=>!e),[]);return e.useMemo(()=>({open:s,onOpen:n,onClose:t,onToggle:u,setOpen:l}),[s,n,t,u])}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/** The box an element is laid out at, in pixels. */
|
|
3
|
+
export interface PlElementSize {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* How big an element is, kept up to date as it changes.
|
|
9
|
+
*
|
|
10
|
+
* A `ResizeObserver` and the two things a hook has to add. The first is
|
|
11
|
+
* **when**: the size is read in a layout effect as well as from the observer,
|
|
12
|
+
* because an observer's first callback arrives after a frame has been painted
|
|
13
|
+
* and a component that laid itself out from `0 × 0` for one frame flashes.
|
|
14
|
+
*
|
|
15
|
+
* The second is what it reports: the **content box**, the room actually left
|
|
16
|
+
* inside the element once its own padding has been taken off. A hand-written
|
|
17
|
+
* version nearly always reports `getBoundingClientRect` or `borderBoxSize`
|
|
18
|
+
* instead, which is a different number — and the wrong one for the question
|
|
19
|
+
* that made somebody measure the element.
|
|
20
|
+
*
|
|
21
|
+
* `null` until there is an element to measure, which is the honest answer on a
|
|
22
|
+
* server and on the first render: guessing `0` there would let a caller divide
|
|
23
|
+
* by it.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const box = React.useRef<HTMLDivElement>(null);
|
|
27
|
+
* const size = usePlElementSize(box);
|
|
28
|
+
*
|
|
29
|
+
* <div ref={box}>{size ? `${Math.round(size.width)}px` : null}</div>
|
|
30
|
+
*/
|
|
31
|
+
export declare function usePlElementSize(target: React.RefObject<HTMLElement | null>): PlElementSize | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as t from"react";export function usePlElementSize(e){const[n,i]=t.useState(null);return t.useLayoutEffect(()=>{const t=e.current;if(!t)return;const read=()=>{const e=function contentBoxOf(t){const e=getComputedStyle(t),n=parseFloat(e.paddingInlineStart)+parseFloat(e.paddingInlineEnd),i=parseFloat(e.paddingBlockStart)+parseFloat(e.paddingBlockEnd);return{width:Math.max(0,t.clientWidth-n),height:Math.max(0,t.clientHeight-i)}}(t);i(t=>t?.width===e.width&&t.height===e.height?t:e)};if(read(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(read);return n.observe(t),()=>n.disconnect()},[e]),n}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassHotKeys } from '../types.js';
|
|
3
|
+
/** Anything a listener can be attached to, plus the ref a React caller holds. */
|
|
4
|
+
export type PlHotKeysTarget = Window | Document | HTMLElement | React.RefObject<HTMLElement | null> | null;
|
|
5
|
+
export interface PlHotKeysOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the chords are bound at all. `false` removes the listener rather
|
|
8
|
+
* than making the handlers no-ops, so a shortcut that is off does not consume
|
|
9
|
+
* the key from whatever else wanted it.
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* What the listener is attached to.
|
|
15
|
+
*
|
|
16
|
+
* `window` is the default and is what a global shortcut means. A ref, an
|
|
17
|
+
* element or `document` scopes the binding to a region — but note that a
|
|
18
|
+
* `keydown` only reaches an element that contains the focus, so scoping to a
|
|
19
|
+
* panel nobody has tabbed into binds nothing.
|
|
20
|
+
* @default window
|
|
21
|
+
*/
|
|
22
|
+
target?: PlHotKeysTarget;
|
|
23
|
+
/**
|
|
24
|
+
* Whether a chord is answered while the focus is in a text field.
|
|
25
|
+
*
|
|
26
|
+
* Off by default, and this is the decision the hook exists to get right: a
|
|
27
|
+
* global `/` that jumps to search must not eat the slash out of a URL
|
|
28
|
+
* somebody is typing into a form.
|
|
29
|
+
*
|
|
30
|
+
* It is narrower than it sounds, and only two kinds of chord are ever held
|
|
31
|
+
* back. A chord carrying **`Mod`, `Ctrl`, `Meta` or `Alt` is answered either
|
|
32
|
+
* way**, because none of those can appear in a field's value — so the
|
|
33
|
+
* ordinary `Mod+K` needs nothing set here. Shift does not count as one:
|
|
34
|
+
* `Shift+A` is how a capital A is typed. And a key that **does nothing in a
|
|
35
|
+
* field** is answered either way too: `Escape` is the one that matters, since
|
|
36
|
+
* a panel that closes on Escape has to close from inside its own form.
|
|
37
|
+
*
|
|
38
|
+
* What is left is exactly the case this is for: a printable character, or one
|
|
39
|
+
* of the keys that edits or moves through text, pressed while the focus is in
|
|
40
|
+
* a field. Turn it on for a chord that belongs to the field the reader is in.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
whileTyping?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Binds keyboard chords outside any one control.
|
|
47
|
+
*
|
|
48
|
+
* The map is the same `PlassHotKeys` a field's `hotKeys` prop takes and the
|
|
49
|
+
* chords are spelled the way `PlHotKeys` draws them, which is the whole point:
|
|
50
|
+
* a shortcut that is **displayed** on a key cap and a shortcut that is **bound**
|
|
51
|
+
* are one string rather than two that drift. `Mod` is Command on a Mac and
|
|
52
|
+
* Control everywhere else.
|
|
53
|
+
*
|
|
54
|
+
* `PlCommandPalette` is the hook's first caller — it has bound its own opener
|
|
55
|
+
* this way since it existed, with a private copy of the matcher — and an
|
|
56
|
+
* application's own shortcuts are the reason it is public.
|
|
57
|
+
*
|
|
58
|
+
* Three rules it shares with the `hotKeys` prop:
|
|
59
|
+
*
|
|
60
|
+
* - **A modifier is checked in both directions.** `Enter` does not fire on
|
|
61
|
+
* `Shift+Enter`, and `Mod+K` does not fire on `Mod+Shift+K`.
|
|
62
|
+
* - **A chord that matches is consumed** — `preventDefault()`, so the browser's
|
|
63
|
+
* own `Mod+K` search bar does not also open. Read from the other end, an
|
|
64
|
+
* event that is **already** consumed is left alone: a field's own `hotKeys`
|
|
65
|
+
* map wins over a page's.
|
|
66
|
+
* - **These are chords rather than letters.** A single unmodified key is
|
|
67
|
+
* allowed and is sometimes right (`?` for help), but it is the case
|
|
68
|
+
* `whileTyping` is about.
|
|
69
|
+
*
|
|
70
|
+
* The handlers are read fresh on every keystroke, so an inline object literal
|
|
71
|
+
* costs nothing and a handler closing over current state is never stale. What
|
|
72
|
+
* rebinds the listener is the **set of chords** changing, not the map's
|
|
73
|
+
* identity.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* usePlHotKeys({
|
|
77
|
+
* 'Mod+K': () => setPaletteOpen(true),
|
|
78
|
+
* 'Mod+S': save
|
|
79
|
+
* });
|
|
80
|
+
*/
|
|
81
|
+
export declare function usePlHotKeys(hotKeys: PlassHotKeys | undefined, options?: PlHotKeysOptions): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{editsText as n,hasHardModifier as t,isTypingTarget as r,matchesHotKey as o}from"../internal/keys.js";export function usePlHotKeys(i,u={}){const{enabled:s=!0,target:f,whileTyping:c=!1}=u,l=e.useRef(i);e.useEffect(()=>{l.current=i});const d=Object.keys(i??{}).join("\n");e.useEffect(()=>{const e=function resolve(e){return void 0===e?"undefined"==typeof window?null:window:null===e?null:"current"in e?e.current:e}(f);if(!s||!e||""===d)return;const i=d.split("\n"),onKeyDown=e=>{const u=e;if(!u.defaultPrevented)for(const e of i)if(o(u,e)){if(!c&&!t(e)&&n(u.key)&&r(u.target))return;return u.preventDefault(),void l.current?.[e]?.()}};return e.addEventListener("keydown",onKeyDown),()=>e.removeEventListener("keydown",onKeyDown)},[d,f,s,c])}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the window matches a CSS media query, as a boolean that re-renders
|
|
3
|
+
* when the answer changes.
|
|
4
|
+
*
|
|
5
|
+
* The library has always had this — it is how a `PlSidebar` knows it has become
|
|
6
|
+
* a drawer and how a `PlAnimate*` finds out that the reader asked for less
|
|
7
|
+
* motion — and it is public now because the alternative in application code is
|
|
8
|
+
* a `useState`, an effect and a listener that is nearly always subscribed one
|
|
9
|
+
* render too late.
|
|
10
|
+
*
|
|
11
|
+
* **The first answer in a browser is the server's answer.** There is no window
|
|
12
|
+
* to measure while the HTML is being generated, so this returns `false` on the
|
|
13
|
+
* server and through the hydrating render, and the real answer arrives in the
|
|
14
|
+
* render after that. Anything that has to be right in the *first* frame belongs
|
|
15
|
+
* in CSS — a Tailwind variant, or the `--plass-*` token that variant sets — and
|
|
16
|
+
* this hook is for the decisions CSS cannot make, like whether a component
|
|
17
|
+
* exists at all.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const coarse = usePlMediaQuery('(pointer: coarse)');
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePlMediaQuery(query: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useMediaQuery as e}from"../internal/media.js";export function usePlMediaQuery(r){return e(r)}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface PlOnScreenOptions {
|
|
3
|
+
/**
|
|
4
|
+
* How much of the element has to be showing before it counts, from `0` to
|
|
5
|
+
* `1`.
|
|
6
|
+
* @default 0
|
|
7
|
+
*/
|
|
8
|
+
threshold?: number;
|
|
9
|
+
/**
|
|
10
|
+
* How far outside the viewport still counts, as a CSS margin — `'200px'`
|
|
11
|
+
* starts a fetch a screen early.
|
|
12
|
+
*/
|
|
13
|
+
rootMargin?: string;
|
|
14
|
+
/**
|
|
15
|
+
* What it is measured against. The viewport when it is not given; a scrolling
|
|
16
|
+
* panel otherwise.
|
|
17
|
+
*/
|
|
18
|
+
root?: React.RefObject<Element | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Stops watching the first time it appears.
|
|
21
|
+
*
|
|
22
|
+
* On by default, because the question a caller almost always has is "has this
|
|
23
|
+
* been seen yet" rather than "is it on screen right now" — a lazily loaded
|
|
24
|
+
* picture, a section that animates once, a page that fetches the next batch.
|
|
25
|
+
* Turn it off for the answer that keeps changing.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
once?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether an element is on screen.
|
|
32
|
+
*
|
|
33
|
+
* An `IntersectionObserver` with the three things a hook has to decide, and
|
|
34
|
+
* the interesting one is `once`. It is **on** by default: the question a caller
|
|
35
|
+
* almost always has is "has this been seen yet", not "is it on screen right
|
|
36
|
+
* now", and a hook that kept answering the second one would re-render a page of
|
|
37
|
+
* lazily loaded pictures every time the reader scrolled past any of them.
|
|
38
|
+
*
|
|
39
|
+
* `false` on a server and on the first render, which is the safe answer for
|
|
40
|
+
* both of the things this is used for: nothing is fetched that did not need to
|
|
41
|
+
* be, and nothing is played before a reader could see it.
|
|
42
|
+
*
|
|
43
|
+
* A browser with no observer is told **yes** rather than no. There is no way to
|
|
44
|
+
* find out, and a picture that never loads is worse than one that loads early.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const section = React.useRef<HTMLDivElement>(null);
|
|
48
|
+
* const seen = usePlOnScreen(section, { rootMargin: '200px' });
|
|
49
|
+
*/
|
|
50
|
+
export declare function usePlOnScreen(target: React.RefObject<Element | null>, { threshold, rootMargin, root, once }?: PlOnScreenOptions): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";export function usePlOnScreen(r,{threshold:t=0,rootMargin:n,root:o,once:s=!0}={}){const[c,i]=e.useState(!1);return e.useEffect(()=>{const e=r.current;if(!e)return;if("undefined"==typeof IntersectionObserver)return void i(!0);const c=new IntersectionObserver(([e])=>{e.isIntersecting?(i(!0),s&&c.disconnect()):s||i(!1)},{threshold:t,rootMargin:n,root:o?.current??null});return c.observe(e),()=>c.disconnect()},[r,t,n,o,s]),c}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the reader has asked their platform for less movement.
|
|
3
|
+
*
|
|
4
|
+
* `prefers-reduced-motion: reduce`, read as a boolean that re-renders when it
|
|
5
|
+
* changes. The library answers it on its own behalf everywhere it moves — every
|
|
6
|
+
* keyframe in the stylesheet is switched off at once, a typewriter simply
|
|
7
|
+
* arrives finished — and this is the same answer, for the motion an application
|
|
8
|
+
* writes itself.
|
|
9
|
+
*
|
|
10
|
+
* **"Reduced" is not "none", and the library's own components disagree with
|
|
11
|
+
* each other on purpose.** An entrance is dropped entirely, because an
|
|
12
|
+
* animation that never played has still delivered everything it was carrying. A
|
|
13
|
+
* loading indicator is *slowed* rather than stopped, because a spinner that
|
|
14
|
+
* stopped would be lying about whether anything is still happening. Which of
|
|
15
|
+
* those two an effect is, is the question to answer before reaching for this.
|
|
16
|
+
*
|
|
17
|
+
* The server's answer is `false` — it has no reader and so no preference — and
|
|
18
|
+
* so is the first answer in a browser. See `usePlMediaQuery` for why, and note
|
|
19
|
+
* that it is the safe direction here: the reader gets their preference in the
|
|
20
|
+
* render after hydration, before any of this has had a frame to run in.
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePlReducedMotion(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{usePrefersReducedMotion as e}from"../internal/media.js";export function usePlReducedMotion(){return e()}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,85 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
+
export * from './hooks/index.js';
|
|
3
|
+
export * from './provider/index.js';
|
|
2
4
|
export * from './components/accordion/index.js';
|
|
3
5
|
export * from './components/alert/index.js';
|
|
6
|
+
export * from './components/anchor/index.js';
|
|
4
7
|
export * from './components/animate-appear/index.js';
|
|
5
8
|
export * from './components/animate-blink/index.js';
|
|
9
|
+
export * from './components/animate-counter/index.js';
|
|
6
10
|
export * from './components/animate-fade/index.js';
|
|
11
|
+
export * from './components/animate-float/index.js';
|
|
7
12
|
export * from './components/animate-grow/index.js';
|
|
8
13
|
export * from './components/animate-headline/index.js';
|
|
9
14
|
export * from './components/animate-lighting/index.js';
|
|
10
15
|
export * from './components/animate-marquee/index.js';
|
|
16
|
+
export * from './components/animate-reveal/index.js';
|
|
11
17
|
export * from './components/animate-rotate/index.js';
|
|
18
|
+
export * from './components/animate-scramble/index.js';
|
|
19
|
+
export * from './components/animate-shake/index.js';
|
|
12
20
|
export * from './components/animate-slide/index.js';
|
|
21
|
+
export * from './components/animate-split/index.js';
|
|
13
22
|
export * from './components/animate-typing/index.js';
|
|
14
23
|
export * from './components/animate-zoom/index.js';
|
|
24
|
+
export * from './components/app-logo/index.js';
|
|
25
|
+
export * from './components/area-chart/index.js';
|
|
15
26
|
export * from './components/aspect-ratio/index.js';
|
|
16
27
|
export * from './components/avatar/index.js';
|
|
17
|
-
export * from './components/
|
|
28
|
+
export * from './components/back-top/index.js';
|
|
18
29
|
export * from './components/badge/index.js';
|
|
30
|
+
export * from './components/bar-chart/index.js';
|
|
19
31
|
export * from './components/blockquote/index.js';
|
|
20
32
|
export * from './components/bottom-navigation/index.js';
|
|
21
33
|
export * from './components/box/index.js';
|
|
22
34
|
export * from './components/breadcrumb/index.js';
|
|
23
35
|
export * from './components/button/index.js';
|
|
24
36
|
export * from './components/button-group/index.js';
|
|
37
|
+
export * from './components/calendar/index.js';
|
|
25
38
|
export * from './components/card/index.js';
|
|
26
39
|
export * from './components/carousel/index.js';
|
|
27
40
|
export * from './components/chat-bubble/index.js';
|
|
28
41
|
export * from './components/checkbox/index.js';
|
|
29
42
|
export * from './components/chip/index.js';
|
|
43
|
+
export * from './components/code-block/index.js';
|
|
30
44
|
export * from './components/collapsible/index.js';
|
|
31
45
|
export * from './components/color-picker/index.js';
|
|
32
46
|
export * from './components/combobox/index.js';
|
|
47
|
+
export * from './components/confirm/index.js';
|
|
33
48
|
export * from './components/command-palette/index.js';
|
|
34
49
|
export * from './components/container/index.js';
|
|
50
|
+
export * from './components/data-list/index.js';
|
|
51
|
+
export * from './components/data-table/index.js';
|
|
35
52
|
export * from './components/date-picker/index.js';
|
|
36
53
|
export * from './components/date-range-picker/index.js';
|
|
37
54
|
export * from './components/date-time-picker/index.js';
|
|
38
55
|
export * from './components/divider/index.js';
|
|
39
56
|
export * from './components/drawer/index.js';
|
|
57
|
+
export * from './components/empty/index.js';
|
|
40
58
|
export * from './components/fieldset/index.js';
|
|
41
59
|
export * from './components/file-picker/index.js';
|
|
60
|
+
export * from './components/flex/index.js';
|
|
61
|
+
export * from './components/floating-action-button/index.js';
|
|
42
62
|
export * from './components/floating-bottom-navigation/index.js';
|
|
43
63
|
export * from './components/footer/index.js';
|
|
44
64
|
export * from './components/form/index.js';
|
|
65
|
+
export * from './components/gallery/index.js';
|
|
66
|
+
export * from './components/gauge-chart/index.js';
|
|
45
67
|
export * from './components/grid/index.js';
|
|
46
68
|
export * from './components/header/index.js';
|
|
69
|
+
export * from './components/heatmap-chart/index.js';
|
|
47
70
|
export * from './components/highlight/index.js';
|
|
48
71
|
export * from './components/hot-keys/index.js';
|
|
72
|
+
export * from './components/hover-card/index.js';
|
|
73
|
+
export * from './components/how-to-steps/index.js';
|
|
49
74
|
export * from './components/icon/index.js';
|
|
50
75
|
export * from './components/icon-button/index.js';
|
|
76
|
+
export * from './components/image/index.js';
|
|
77
|
+
export * from './components/line-chart/index.js';
|
|
51
78
|
export * from './components/list/index.js';
|
|
52
79
|
export * from './components/menu/index.js';
|
|
53
80
|
export * from './components/menubar/index.js';
|
|
81
|
+
export * from './components/meter/index.js';
|
|
82
|
+
export * from './components/mockup/index.js';
|
|
54
83
|
export * from './components/modal/index.js';
|
|
55
84
|
export * from './components/navigation-menu/index.js';
|
|
56
85
|
export * from './components/number-field/index.js';
|
|
@@ -59,20 +88,30 @@ export * from './components/overlay/index.js';
|
|
|
59
88
|
export * from './components/page-layout/index.js';
|
|
60
89
|
export * from './components/pagination/index.js';
|
|
61
90
|
export * from './components/panes/index.js';
|
|
91
|
+
export * from './components/pie-chart/index.js';
|
|
62
92
|
export * from './components/pill/index.js';
|
|
93
|
+
export * from './components/popconfirm/index.js';
|
|
63
94
|
export * from './components/popover/index.js';
|
|
95
|
+
export * from './components/portal/index.js';
|
|
64
96
|
export * from './components/progress-box/index.js';
|
|
65
97
|
export * from './components/progress-circular/index.js';
|
|
66
98
|
export * from './components/progress-linear/index.js';
|
|
67
99
|
export * from './components/radio-group/index.js';
|
|
68
100
|
export * from './components/rating/index.js';
|
|
101
|
+
export * from './components/scatter-chart/index.js';
|
|
102
|
+
export * from './components/scroll-area/index.js';
|
|
69
103
|
export * from './components/scroll-zone/index.js';
|
|
70
104
|
export * from './components/segmented-button/index.js';
|
|
71
105
|
export * from './components/select/index.js';
|
|
106
|
+
export * from './components/show/index.js';
|
|
72
107
|
export * from './components/sidebar/index.js';
|
|
73
108
|
export * from './components/skeleton/index.js';
|
|
74
109
|
export * from './components/slider/index.js';
|
|
110
|
+
export * from './components/sparkline/index.js';
|
|
75
111
|
export * from './components/spoiler/index.js';
|
|
112
|
+
export * from './components/stack/index.js';
|
|
113
|
+
export * from './components/stat/index.js';
|
|
114
|
+
export * from './components/stepper/index.js';
|
|
76
115
|
export * from './components/switch/index.js';
|
|
77
116
|
export * from './components/table/index.js';
|
|
78
117
|
export * from './components/tabs/index.js';
|
|
@@ -80,9 +119,15 @@ export * from './components/text-field/index.js';
|
|
|
80
119
|
export * from './components/text-link/index.js';
|
|
81
120
|
export * from './components/time-picker/index.js';
|
|
82
121
|
export * from './components/timeline/index.js';
|
|
122
|
+
export * from './components/timeline-chart/index.js';
|
|
83
123
|
export * from './components/toast/index.js';
|
|
84
124
|
export * from './components/toggle/index.js';
|
|
85
125
|
export * from './components/toolbar/index.js';
|
|
86
126
|
export * from './components/tooltip/index.js';
|
|
127
|
+
export * from './components/tour/index.js';
|
|
128
|
+
export * from './components/tree/index.js';
|
|
129
|
+
export * from './components/tree-select/index.js';
|
|
87
130
|
export * from './components/transfer/index.js';
|
|
88
131
|
export * from './components/typography/index.js';
|
|
132
|
+
export * from './components/visually-hidden/index.js';
|
|
133
|
+
export * from './components/window-pane/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/
|
|
1
|
+
export*from"./types.js";export*from"./hooks/index.js";export*from"./provider/index.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/anchor/index.js";export*from"./components/animate-appear/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-counter/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-float/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-reveal/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-scramble/index.js";export*from"./components/animate-shake/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-split/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/app-logo/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/back-top/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/calendar/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/confirm/index.js";export*from"./components/command-palette/index.js";export*from"./components/container/index.js";export*from"./components/data-list/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/fieldset/index.js";export*from"./components/file-picker/index.js";export*from"./components/flex/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/form/index.js";export*from"./components/gallery/index.js";export*from"./components/gauge-chart/index.js";export*from"./components/grid/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/hot-keys/index.js";export*from"./components/hover-card/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/image/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/menubar/index.js";export*from"./components/meter/index.js";export*from"./components/mockup/index.js";export*from"./components/modal/index.js";export*from"./components/navigation-menu/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popconfirm/index.js";export*from"./components/popover/index.js";export*from"./components/portal/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-area/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/show/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/stack/index.js";export*from"./components/stat/index.js";export*from"./components/stepper/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toggle/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tour/index.js";export*from"./components/tree/index.js";export*from"./components/tree-select/index.js";export*from"./components/transfer/index.js";export*from"./components/typography/index.js";export*from"./components/visually-hidden/index.js";export*from"./components/window-pane/index.js";
|
|
@@ -25,15 +25,27 @@
|
|
|
25
25
|
* `rotate` properties rather than on the `transform` shorthand, so a caller's
|
|
26
26
|
* own transform on the same element survives.
|
|
27
27
|
*
|
|
28
|
+
* ## Telling the children apart
|
|
29
|
+
*
|
|
30
|
+
* `stagger`, `durationStep` and `reverse` move an effect off the box and onto
|
|
31
|
+
* the things inside it, one after another. There is no `PlAnimateStagger`
|
|
32
|
+
* component and there should not be: a stagger is a *differential* rather than
|
|
33
|
+
* an effect, and a wrapper would be a second way to spell something all six
|
|
34
|
+
* effects can already say. `animateChildren` and `staggerSlots` are what
|
|
35
|
+
* `PlAnimateAppear` — which was staggering long before the six could — now runs
|
|
36
|
+
* on as well, because two implementations of "one after another" is two
|
|
37
|
+
* opinions about the arithmetic.
|
|
38
|
+
*
|
|
28
39
|
* ## What is deliberately not here
|
|
29
40
|
*
|
|
30
41
|
* An effect that has to know what its children *are* — a marquee that lays them
|
|
31
42
|
* down twice, a headline that swaps between them, a typewriter that counts
|
|
32
43
|
* graphemes — cannot be a class name and a few numbers. Those are components,
|
|
33
|
-
* and their logic stays in their own files.
|
|
44
|
+
* and their logic stays in their own files. They are also the four that cannot
|
|
45
|
+
* take a `stagger`, for the same reason: their children are already spoken for.
|
|
34
46
|
*/
|
|
35
47
|
import * as React from 'react';
|
|
36
|
-
import type { PlassAnimateRepeat, PlassAnimateTrigger, PlassAnimation, PlassSide } from '../types.js';
|
|
48
|
+
import type { PlassAnimateRepeat, PlassAnimateStaggerProps, PlassAnimateTimelineProps, PlassAnimateTrigger, PlassAnimation, PlassSide } from '../types.js';
|
|
37
49
|
/**
|
|
38
50
|
* Which keyframe an effect runs.
|
|
39
51
|
*
|
|
@@ -59,7 +71,15 @@ export declare function isInfinite(repeat: PlassAnimateRepeat | undefined): bool
|
|
|
59
71
|
* is `both`, so a faded-out element stays faded out instead of snapping back.
|
|
60
72
|
*/
|
|
61
73
|
export declare function directionValue(mode: 'in' | 'out', alternate: boolean | undefined): string;
|
|
62
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Where a scroll-linked effect starts and finishes, as an `animation-range`.
|
|
76
|
+
*
|
|
77
|
+
* Finished while the element is still arriving rather than when it reaches the
|
|
78
|
+
* middle of the screen: an entrance that is only half drawn by the time a
|
|
79
|
+
* reader has read past it is an entrance that never happened.
|
|
80
|
+
*/
|
|
81
|
+
export declare const defaultViewRange = "entry 0% cover 45%";
|
|
82
|
+
export interface AnimationSlotOptions extends PlassAnimateTimelineProps {
|
|
63
83
|
duration: number;
|
|
64
84
|
delay: number;
|
|
65
85
|
easing?: string;
|
|
@@ -73,6 +93,8 @@ export interface AnimationSlotOptions {
|
|
|
73
93
|
y?: string;
|
|
74
94
|
angle?: string;
|
|
75
95
|
angleTo?: string;
|
|
96
|
+
/** The `clip-path` a reveal is uncovered from. */
|
|
97
|
+
clip?: string;
|
|
76
98
|
}
|
|
77
99
|
/**
|
|
78
100
|
* The `--p-anim-*` slots, as an inline style object.
|
|
@@ -82,6 +104,14 @@ export interface AnimationSlotOptions {
|
|
|
82
104
|
* has never seen written down.
|
|
83
105
|
*/
|
|
84
106
|
export declare function animationSlots(options: AnimationSlotOptions): React.CSSProperties;
|
|
107
|
+
/**
|
|
108
|
+
* The `clip-path` a reveal starts from, given the edge it uncovers from.
|
|
109
|
+
*
|
|
110
|
+
* `inset()` takes its four sides in the physical order CSS writes them, and
|
|
111
|
+
* `PlassSide` is physical for the same reason it is on a slide: a title wiped
|
|
112
|
+
* in from the top is wiped in from the top in every writing direction.
|
|
113
|
+
*/
|
|
114
|
+
export declare function revealClip(from: PlassSide): string;
|
|
85
115
|
/**
|
|
86
116
|
* Which way a slide starts, given the edge it comes from.
|
|
87
117
|
*
|
|
@@ -93,7 +123,6 @@ export declare function slideOffsets(from: PlassSide, distance: number | string)
|
|
|
93
123
|
x: string;
|
|
94
124
|
y: string;
|
|
95
125
|
};
|
|
96
|
-
export declare function usePrefersReducedMotion(): boolean;
|
|
97
126
|
export interface AnimationRunOptions {
|
|
98
127
|
trigger: PlassAnimateTrigger;
|
|
99
128
|
play?: boolean;
|
|
@@ -102,6 +131,17 @@ export interface AnimationRunOptions {
|
|
|
102
131
|
paused?: boolean;
|
|
103
132
|
/** An infinite effect stops when the pointer leaves; a finite one finishes. */
|
|
104
133
|
infinite: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* A value that plays the effect again whenever it changes, and never on the
|
|
136
|
+
* first render.
|
|
137
|
+
*
|
|
138
|
+
* `play` is a boolean, so replaying with it means toggling off and on — two
|
|
139
|
+
* renders for one event, and a piece of state whose only job is to be
|
|
140
|
+
* flipped back. A response to something that can happen twice needs the
|
|
141
|
+
* *event*, and a value that has changed is the closest React has to one: a
|
|
142
|
+
* count of failed attempts already is this.
|
|
143
|
+
*/
|
|
144
|
+
nonce?: unknown;
|
|
105
145
|
}
|
|
106
146
|
export interface AnimationRun {
|
|
107
147
|
/** Goes on the animated element. */
|
|
@@ -132,10 +172,53 @@ export interface AnimationRun {
|
|
|
132
172
|
* style to settle, and putting it back is the one move that rewinds the element
|
|
133
173
|
* and leaves everything inside it alone.
|
|
134
174
|
*/
|
|
135
|
-
export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite }: AnimationRunOptions): AnimationRun;
|
|
136
|
-
export interface
|
|
175
|
+
export declare function useAnimationRun({ trigger, play, once, threshold, paused, infinite, nonce }: AnimationRunOptions): AnimationRun;
|
|
176
|
+
export interface StaggerPosition extends Required<PlassAnimateStaggerProps> {
|
|
177
|
+
index: number;
|
|
178
|
+
count: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Where one child sits in a staggered run.
|
|
182
|
+
*
|
|
183
|
+
* `reverse` turns the *order* round and nothing else: the last child goes
|
|
184
|
+
* first and every child still plays forwards. An effect that ran backwards is
|
|
185
|
+
* `mode="out"`, which is a different question and already has an answer.
|
|
186
|
+
*
|
|
187
|
+
* The duration is floored at zero rather than allowed to go negative, because a
|
|
188
|
+
* negative `animation-duration` is invalid and an invalid declaration is
|
|
189
|
+
* dropped — which would leave that one child playing at the CSS default while
|
|
190
|
+
* its neighbours honoured the prop.
|
|
191
|
+
*/
|
|
192
|
+
export declare function staggerSlots(slots: AnimationSlotOptions, { index, count, stagger, durationStep, reverse }: StaggerPosition): AnimationSlotOptions;
|
|
193
|
+
/**
|
|
194
|
+
* Writes one effect onto each child, with that child's own slots.
|
|
195
|
+
*
|
|
196
|
+
* Onto the children **themselves** rather than onto wrappers around them, which
|
|
197
|
+
* is the whole reason this is worth sharing: a row of `<li>`s stays a row of
|
|
198
|
+
* `<li>`s, a grid's cells stay its direct children, and nothing about the
|
|
199
|
+
* layout changes because the set is being animated. A wrapper per child would
|
|
200
|
+
* break every one of those.
|
|
201
|
+
*
|
|
202
|
+
* The trade is the one `React.cloneElement` always makes — a child has to
|
|
203
|
+
* accept a `className` and a `style` — and it is taken here and nowhere else in
|
|
204
|
+
* the library. It is bearable because what is being copied is *only* the
|
|
205
|
+
* animation, so a child that ignores both is a child that does not animate,
|
|
206
|
+
* rather than a child that lands in the wrong place. `PlStack` draws a wrapper
|
|
207
|
+
* per item instead, and takes the layout cost, precisely because *there* the
|
|
208
|
+
* failure would not be survivable: a child that dropped the class would land in
|
|
209
|
+
* the wrong place rather than merely arriving without an entrance.
|
|
210
|
+
*
|
|
211
|
+
* A bare string has no element to write onto, so that one is wrapped in a
|
|
212
|
+
* `<span>`. It is the only case that gets a wrapper.
|
|
213
|
+
*/
|
|
214
|
+
export declare function animateChildren(children: React.ReactNode, className: string, slotsFor: (index: number, count: number) => React.CSSProperties): React.ReactNode[];
|
|
215
|
+
export interface AnimateElementParams extends AnimationSlotOptions, AnimationRunOptions, PlassAnimateStaggerProps {
|
|
137
216
|
/** Which keyframe. `null` for the components that write their own. */
|
|
138
217
|
effect: PlassAnimation | null;
|
|
218
|
+
/** `transform-origin`, for the two effects that turn about a point. */
|
|
219
|
+
origin?: string;
|
|
220
|
+
/** Needed only to be handed back staggered. Passed straight through otherwise. */
|
|
221
|
+
children?: React.ReactNode;
|
|
139
222
|
}
|
|
140
223
|
export interface AnimateElement {
|
|
141
224
|
ref: React.RefCallback<HTMLElement>;
|
|
@@ -143,6 +226,8 @@ export interface AnimateElement {
|
|
|
143
226
|
style: React.CSSProperties;
|
|
144
227
|
/** The hover handlers and the two data attributes, ready to be spread. */
|
|
145
228
|
props: React.HTMLAttributes<HTMLElement> & Record<string, unknown>;
|
|
229
|
+
/** The children, with the effect written onto them if it was staggered. */
|
|
230
|
+
children: React.ReactNode;
|
|
146
231
|
}
|
|
147
232
|
/**
|
|
148
233
|
* Everything a one-keyframe `PlAnimate*` root needs, in one call.
|
package/dist/internal/animate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"react";export const animationClasses={fade:"plass-anim-fade",grow:"plass-anim-scale",slide:"plass-anim-slide",zoom:"plass-anim-scale",rotate:"plass-anim-rotate",blink:"plass-anim-blink"};export const animBaseClass="plass-anim";export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}export function directionValue(e,n){return"out"===e?n?"alternate-reverse":"reverse":n?"alternate":"normal"}export function animationSlots(e){const n={"--p-anim-duration":`${e.duration}ms`,"--p-anim-delay":`${e.delay}ms`,"--p-anim-repeat":repeatValue(e.repeat),"--p-anim-direction":directionValue(e.mode??"in",e.alternate)};return e.easing&&(n["--p-anim-ease"]=e.easing),void 0!==e.opacity&&(n["--p-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--p-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--p-anim-x"]=e.x),void 0!==e.y&&(n["--p-anim-y"]=e.y),void 0!==e.angle&&(n["--p-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--p-anim-angle-to"]=e.angleTo),n}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}
|
|
1
|
+
import*as e from"react";import{cx as n}from"./styles.js";export const animationClasses={fade:"plass-anim-fade",grow:"plass-anim-scale",slide:"plass-anim-slide",zoom:"plass-anim-scale",rotate:"plass-anim-rotate",blink:"plass-anim-blink",reveal:"plass-anim-reveal"};export const animBaseClass="plass-anim";export function lengthValue(e){return"number"==typeof e?`${e}px`:e}export function repeatValue(e){return"infinite"===e?"infinite":String(e)}export function isInfinite(e){return"infinite"===e}export function directionValue(e,n){return"out"===e?n?"alternate-reverse":"reverse":n?"alternate":"normal"}export const defaultViewRange="entry 0% cover 45%";export function animationSlots(e){const n={"--p-anim-duration":`${e.duration}ms`,"--p-anim-delay":`${e.delay}ms`,"--p-anim-repeat":repeatValue(e.repeat),"--p-anim-direction":directionValue(e.mode??"in",e.alternate)};return e.easing&&(n["--p-anim-ease"]=e.easing),"view"===e.timeline&&(n["--p-anim-timeline"]="view()",n["--p-anim-range"]=e.range??defaultViewRange),void 0!==e.opacity&&(n["--p-anim-opacity"]=String(e.opacity)),void 0!==e.scale&&(n["--p-anim-scale"]=String(e.scale)),void 0!==e.x&&(n["--p-anim-x"]=e.x),void 0!==e.y&&(n["--p-anim-y"]=e.y),void 0!==e.angle&&(n["--p-anim-angle"]=e.angle),void 0!==e.angleTo&&(n["--p-anim-angle-to"]=e.angleTo),void 0!==e.clip&&(n["--p-anim-clip"]=e.clip),n}export function revealClip(e){switch(e){case"top":return"inset(0 0 100% 0)";case"bottom":return"inset(100% 0 0 0)";case"right":return"inset(0 0 0 100%)";default:return"inset(0 100% 0 0)"}}export function slideOffsets(e,n){const t=lengthValue(n),a="number"==typeof n?-n+"px":`calc(-1 * ${t})`;switch(e){case"top":return{x:"0px",y:a};case"bottom":return{x:"0px",y:t};case"left":return{x:a,y:"0px"};default:return{x:t,y:"0px"}}}export function useAnimationRun({trigger:n,play:t,once:a,threshold:i,paused:r,infinite:s,nonce:o}){const l=e.useRef(null),[c,u]=e.useState("mount"===n),[p,m]=e.useState(0),d=e.useCallback(()=>{u(!0),m(e=>e+1)},[]);e.useLayoutEffect(()=>{const e=l.current;if(!e||0===p)return;const n=[e,...e.querySelectorAll(".plass-anim, .plass-marquee-track")];for(const e of n)e.style.animationName="none";e.offsetWidth;for(const e of n)e.style.animationName=""},[p]),e.useEffect(()=>{if("visible"!==n)return;const e=l.current;if(!e||"undefined"==typeof IntersectionObserver)return void u(!0);const t=new IntersectionObserver(([e])=>{e.isIntersecting?(d(),a&&t.disconnect()):a||u(!1)},{threshold:i});return t.observe(e),()=>t.disconnect()},[n,a,i,d]);const f=e.useRef(o);e.useEffect(()=>{Object.is(o,f.current)||(f.current=o,d())},[o,d]),e.useEffect(()=>{"manual"===n&&(t?d():u(!1))},[n,t,d]);const g="hover"===n?{onPointerEnter:d,onFocus:d,onPointerLeave:()=>{s&&u(!1)},onBlur:()=>{s&&u(!1)}}:{};return{ref:e.useCallback(e=>{l.current=e},[]),state:c&&!r?"running":"paused",started:c,handlers:g}}export function staggerSlots(e,{index:n,count:t,stagger:a,durationStep:i,reverse:r}){const s=r?t-1-n:n;return{...e,delay:e.delay+s*a,duration:Math.max(0,e.duration+s*i)}}export function animateChildren(t,a,i){const r=e.Children.toArray(t);return r.map((t,s)=>{const o=i(s,r.length);if(!e.isValidElement(t))return e.createElement("span",{key:s,className:a,style:o},t);const l=t.props;return e.cloneElement(t,{className:n(a,l.className),style:{...o,...l.style}})})}export function useAnimateElement(e){const{effect:n,trigger:t,play:a,once:i,threshold:r,paused:s,infinite:o,nonce:l,stagger:c=0,durationStep:u=0,reverse:p=!1,origin:m,children:d,...f}=e,g=useAnimationRun({trigger:"view"===f.timeline?"mount":t,play:a,once:i,threshold:r,paused:s,infinite:o,nonce:l}),y=n?`plass-anim ${animationClasses[n]}`:"",x=0!==c&&null!==n,v=void 0===m?null:{transformOrigin:m};return{ref:g.ref,className:x?"":y,style:{...v,...x?null:animationSlots(f),"--p-anim-state":g.state},props:{...g.handlers,"data-plass-animation":n??void 0,"data-state":g.state},children:x?animateChildren(d,y,(e,n)=>({...v,...animationSlots(staggerSlots(f,{index:e,count:n,stagger:c,durationStep:u,reverse:p}))})):d}}
|