plass-ui 1.3.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 +590 -0
- package/README.md +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-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-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/avatar/PlAvatar.js +1 -1
- package/dist/components/back-top/PlBackTop.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/breadcrumb/PlBreadcrumb.js +1 -1
- package/dist/components/button-group/PlButtonGroup.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/combobox/PlCombobox.d.ts +1 -1
- 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/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/drawer/PlDrawer.d.ts +1 -1
- package/dist/components/drawer/PlDrawer.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/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/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.js +1 -1
- 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/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/number-field/PlNumberField.d.ts +1 -1
- package/dist/components/number-field/PlNumberField.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/popconfirm/PlPopconfirm.d.ts +1 -1
- package/dist/components/popconfirm/PlPopconfirm.js +1 -1
- 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/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/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/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/stepper/PlStepper.d.ts +2 -2
- package/dist/components/stepper/PlStepper.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-link/PlTextLink.js +1 -1
- package/dist/components/timeline/PlTimeline.d.ts +2 -2
- 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/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.js +1 -1
- 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/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/bar-chart.css +2 -0
- package/dist/css/code-block.css +2 -0
- package/dist/css/data-list.css +2 -0
- package/dist/css/data-table.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/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/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/timeline-chart.css +2 -0
- package/dist/css/tour.css +2 -0
- package/dist/css/tree-select.css +2 -0
- package/dist/css/window-pane.css +2 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/usePlBreakpoint.d.ts +3 -0
- package/dist/hooks/usePlBreakpoint.js +1 -1
- 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/usePlOnScreen.d.ts +50 -0
- package/dist/hooks/usePlOnScreen.js +1 -0
- package/dist/index.d.ts +34 -1
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +91 -5
- 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 +11 -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/data-table.d.ts +69 -0
- package/dist/internal/data-table.js +1 -0
- package/dist/internal/defaults.d.ts +8 -3
- 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 -27
- 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/labels.d.ts +138 -0
- package/dist/internal/labels.js +1 -0
- package/dist/internal/mockup.d.ts +193 -0
- package/dist/internal/mockup.js +1 -0
- 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/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/index.d.ts +1 -0
- package/dist/provider/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1104 -19
- package/dist/tokens.css +1104 -19
- package/dist/types.d.ts +381 -2
- package/package.json +14 -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
package/README.md
CHANGED
|
@@ -150,7 +150,7 @@ This package is installed and run from its own folder; there is no install at th
|
|
|
150
150
|
|
|
151
151
|
```bash
|
|
152
152
|
npm install
|
|
153
|
-
npm test # Vitest,
|
|
153
|
+
npm test # Vitest, three shards of headless Chromium
|
|
154
154
|
npm run typecheck # tsc --noEmit over both TS projects
|
|
155
155
|
npm run build # tsc + terser + build-styles → dist/
|
|
156
156
|
npm run lint # ESLint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as e}from"react/jsx-runtime";import*as l from"react";import{useDefaults as t}from"../../internal/defaults.js";import{CloseIcon as
|
|
1
|
+
"use client";import{jsx as s,jsxs as e}from"react/jsx-runtime";import*as l from"react";import{useDefaults as t}from"../../internal/defaults.js";import{useLabels as a}from"../../internal/labels.js";import{CloseIcon as i,severityIcon as r}from"../../internal/icons.js";import{controlSlots as o,focusRingClasses as n,glassClasses as c,hasContent as d,iconClasses as m,radiusClasses as f,sheetBodyClasses as p,sheetHeaderGapClasses as u,sheetPaddingXClasses as h,sheetPaddingYClasses as v,sheetSectionGapClasses as x,sheetTitleClasses as g,transitionClasses as b}from"../../internal/styles.js";const y={solid:/* @__PURE__ */["text-(--p-on-solid) [background-image:var(--p-fill)]","[box-shadow:var(--p-elev),var(--p-lift)]"].join(" "),glass:/* @__PURE__ */[c,"border text-(--plass-fg) bg-(--plass-glass)","[border-color:var(--p-line)]","[box-shadow:var(--p-elev),var(--plass-gloss-glass)]"].join(" "),ghost:"text-(--plass-fg) bg-(--p-soft)"},j={solid:"",glass:"text-(--p-accent)",ghost:"text-(--p-accent)"},N={solid:"",glass:"text-(--plass-muted-fg)",ghost:"text-(--plass-muted-fg)"},w={primary:"status",secondary:"status",info:"status",success:"status",warning:"alert",danger:"alert"};export const PlAlert=/* @__PURE__ */l.forwardRef(function PlAlert({variant:l="glass",size:c,color:k,density:$,elevation:z=0,title:A,icon:C,action:P,onClose:_,closeLabel:B,className:L,style:R,children:q,...D},E){const F=t(),G=a(),H=B??G.dismiss,I=c??F.size??"md",J=k??F.color??"info",K=$??F.density??"default",M=void 0===C?r(J):C,O=j[l],Q=d(A);return e("div",{ref:E,role:w[J],className:["flex w-full items-start",h[K][I],v[K][I],f[I],x[I],p[I],b,y[l],m,L??""].filter(Boolean).join(" "),style:{...o(J,z,l),...R},...D,children:[d(M)?s("span",{className:`flex h-[1lh] shrink-0 items-center ${O}`,children:M}):null,e("div",{className:`flex min-w-0 flex-1 flex-col ${u[I]}`,children:[Q?s("div",{className:`plass-title font-semibold ${g[I]} ${O}`,children:A}):null,d(q)?s("div",{className:Q?N[l]:void 0,children:q}):null]}),d(P)?s("div",{className:"flex h-[1lh] shrink-0 items-center",children:P}):null,_?s("span",{className:"flex h-[1lh] shrink-0 items-center",children:s("button",{type:"button","aria-label":H,onClick:_,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",n].join(" "),children:s(i,{})})}):null]})});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PlassColor, PlassSize } from '../../types.js';
|
|
3
|
+
/** One heading in the list. */
|
|
4
|
+
export interface PlAnchorItem {
|
|
5
|
+
/**
|
|
6
|
+
* The fragment it points at — `#getting-started`. The `id` it names is what
|
|
7
|
+
* the list watches, so a heading with no `id` cannot be tracked.
|
|
8
|
+
*/
|
|
9
|
+
href: string;
|
|
10
|
+
/** What the row says. */
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* How deep the heading sits, from `0`. Only the indent depends on it.
|
|
14
|
+
* @default 0
|
|
15
|
+
*/
|
|
16
|
+
depth?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PlAnchorProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'onSelect'> {
|
|
19
|
+
/** The headings, in the order they appear in the document. */
|
|
20
|
+
items: readonly PlAnchorItem[];
|
|
21
|
+
/**
|
|
22
|
+
* The `href` of the row that is lit, taking the tracking over.
|
|
23
|
+
*
|
|
24
|
+
* For a list driven by a router rather than by the scroll — a documentation
|
|
25
|
+
* site whose sections are separate pages, say. Leaving it out is the ordinary
|
|
26
|
+
* case and the reason the component exists.
|
|
27
|
+
*/
|
|
28
|
+
active?: string;
|
|
29
|
+
/**
|
|
30
|
+
* How far below the top of the window the reading line sits, in pixels.
|
|
31
|
+
*
|
|
32
|
+
* The height of whatever is pinned over the page. Without it a heading goes
|
|
33
|
+
* on counting as the *next* one after it has already slid out of sight behind
|
|
34
|
+
* a sticky header — so the list stays a section behind the reader for the
|
|
35
|
+
* height of the bar.
|
|
36
|
+
* @default 0
|
|
37
|
+
*/
|
|
38
|
+
offset?: number;
|
|
39
|
+
/** Called with the item that was clicked, before the browser moves. */
|
|
40
|
+
onSelect?: (item: PlAnchorItem, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
41
|
+
/** A heading for the list itself. Drawn above it. */
|
|
42
|
+
label?: React.ReactNode;
|
|
43
|
+
/** Accessible name of the navigation region. Never drawn. @default 'On this page' */
|
|
44
|
+
navLabel?: string;
|
|
45
|
+
/** @default 'sm' */
|
|
46
|
+
size?: PlassSize;
|
|
47
|
+
/** The family the lit row takes. @default 'primary' */
|
|
48
|
+
color?: PlassColor;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A table of contents that follows the reader down the page.
|
|
52
|
+
*
|
|
53
|
+
* It takes its headings as **data** rather than as children, which is the
|
|
54
|
+
* opposite of most of this library and the right way round here: a table of
|
|
55
|
+
* contents is generated — from a Markdown file, from a CMS, from the document's
|
|
56
|
+
* own headings — and the thing that generates it produces a flat list, in
|
|
57
|
+
* document order, with a level on each entry.
|
|
58
|
+
*
|
|
59
|
+
* **It is a flat list and not a nested one**, and that is a decision rather
|
|
60
|
+
* than a shortcut. Real documents skip levels — an `h2` followed by an `h4` —
|
|
61
|
+
* so a nesting built from a flat list is a guess at a shape nobody wrote. The
|
|
62
|
+
* depth is carried by the indent, and the reading order is the document's own.
|
|
63
|
+
*
|
|
64
|
+
* The tracking is the component. What is lit is **the last heading whose top has
|
|
65
|
+
* passed the reading line**, not whichever heading happens to be on screen:
|
|
66
|
+
* three can be visible at once, and the one the reader is inside is the highest
|
|
67
|
+
* of them that is already above them. `offset` is where that line sits, and it
|
|
68
|
+
* is the height of whatever is pinned over the page — without it a heading goes
|
|
69
|
+
* on counting as the next one after it has slid out of sight behind the bar,
|
|
70
|
+
* and the list stays a section behind.
|
|
71
|
+
*/
|
|
72
|
+
export declare const PlAnchor: React.ForwardRefExoticComponent<PlAnchorProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import*as t from"react";import{useDefaults as n}from"../../internal/defaults.js";import{useLabels as s}from"../../internal/labels.js";import{controlTextLeadingClasses as o,cx as l,focusRingClasses as a,surfaceSlots as i,transitionClasses as c}from"../../internal/styles.js";export const PlAnchor=/* @__PURE__ */t.forwardRef(function PlAnchor({items:m,active:d,offset:f=0,onSelect:p,label:u,navLabel:h,size:g,color:v,className:w,style:x,...b},y){const E=n(),j=s(),N=h??j.onThisPage,A=g??E.size??"sm",L=v??E.color??"primary",[z,H]=t.useState(void 0),P=void 0!==d;t.useEffect(()=>{if(P)return;let e=0;const measure=()=>{e=0,H(function readingAt(e,r){if(0===e.length)return;const t=document.documentElement.scrollHeight;if(t>window.innerHeight+1&&window.innerHeight+window.scrollY>=t-2)return e[e.length-1].href;let n;for(const t of e){const e=document.getElementById(t.href.replace(/^#/,""));e&&e.getBoundingClientRect().top-r<=1&&(n=t.href)}return n}(m,f))},onScroll=()=>{e||=requestAnimationFrame(measure)};return measure(),window.addEventListener("scroll",onScroll,{passive:!0}),window.addEventListener("resize",onScroll,{passive:!0}),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",onScroll),window.removeEventListener("resize",onScroll)}},[P,m,f]);const S=P?d:z;return r("nav",{ref:y,"aria-label":N,className:l("flex flex-col gap-2",o[A],w),style:{...i(L,0),...x},...b,children:[u?e("span",{className:"font-semibold text-(--plass-fg)",children:u}):null,e("ul",{className:"m-0 flex list-none flex-col gap-0.5 p-0",children:m.map(r=>{const t=r.href===S;return e("li",{className:"min-w-0",children:e("a",{href:r.href,"aria-current":t?"location":void 0,onClick:e=>p?.(r,e),className:l("block truncate rounded-(--plass-radius-xs) px-2 py-1","border-s-2",c,a,t?"[border-color:var(--p-accent)] bg-(--p-soft) font-medium text-(--p-accent)":"border-transparent text-(--plass-muted-fg) hover:bg-(--plass-glass-hover) hover:text-(--plass-fg)"),style:{paddingInlineStart:`calc(0.5rem + ${r.depth??0} * 0.75rem)`},children:r.label})},r.href)})})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnchor}from"./PlAnchor.js";
|
|
@@ -5,9 +5,19 @@ export interface PlAnimateAppearProps extends PlassAnimateProps, React.Component
|
|
|
5
5
|
/**
|
|
6
6
|
* How long after one child the next one starts, in milliseconds. This is the
|
|
7
7
|
* whole effect — everything else is what a single child does.
|
|
8
|
+
*
|
|
9
|
+
* The same prop the six single-keyframe effects take, and the same machinery
|
|
10
|
+
* under it; what differs is the default, because a stagger of `0` on a set is
|
|
11
|
+
* a set that is not a set.
|
|
8
12
|
* @default 70
|
|
9
13
|
*/
|
|
10
14
|
stagger?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Milliseconds added to each child's duration, so later children take longer
|
|
17
|
+
* — or, negative, less long. Floored at `0`.
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
durationStep?: number;
|
|
11
21
|
/**
|
|
12
22
|
* Which edge each child drifts in from.
|
|
13
23
|
* @default 'bottom'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{animBaseClass as t,animateChildren as r,animationClasses as n,animationSlots as s,isInfinite as i,slideOffsets as o,staggerSlots as d,useAnimationRun as p}from"../../internal/animate.js";export const PlAnimateAppear=/* @__PURE__ */e.forwardRef(function PlAnimateAppear({duration:e=380,delay:l=0,easing:m,repeat:c=1,alternate:u,paused:f,trigger:g="mount",play:y,once:h=!0,threshold:x=.2,stagger:A=70,durationStep:b=0,from:v="bottom",distance:N="0.75rem",fade:P=!0,reverse:S=!1,render:$,className:j,style:w,children:R,...k},q){const z=p({trigger:g,play:y,once:h,threshold:x,paused:f,infinite:i(c)}),{x:B,y:C}=o(v,N),D=r(R,`${t} ${n.slide}`,(a,t)=>s(d({duration:e,delay:l,easing:m,repeat:c,alternate:u,x:B,y:C,opacity:P?0:1},{index:a,count:t,stagger:A,durationStep:b,reverse:S})));return a({render:$,ref:[q,z.ref],props:{...k,className:j,style:{"--p-anim-state":z.state,...w},...z.handlers,"data-plass-animation":"appear","data-state":z.state,children:D}})});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { PlassAnimateProps } from '../../types.js';
|
|
4
|
-
export interface PlAnimateBlinkProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps } from '../../types.js';
|
|
4
|
+
export interface PlAnimateBlinkProps extends PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* How faint it gets at the bottom of the cycle, between `0` and `1`. Raise it
|
|
7
7
|
* for something that has to stay readable while it pulses.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as n}from"../../internal/animate.js";import{cx as a}from"../../internal/styles.js";export const PlAnimateBlink=/* @__PURE__ */e.forwardRef(function PlAnimateBlink({duration:e=1e3,delay:i=0,easing:s,repeat:l="infinite",alternate:o,paused:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as n}from"../../internal/animate.js";import{cx as a}from"../../internal/styles.js";export const PlAnimateBlink=/* @__PURE__ */e.forwardRef(function PlAnimateBlink({duration:e=1e3,delay:i=0,easing:s,repeat:l="infinite",alternate:o,paused:d,trigger:m="mount",play:p,once:c=!0,threshold:f=.2,timeline:g,range:u,stagger:y=0,durationStep:h=0,reverse:k=!1,min:N=0,render:b,className:j,style:v,children:A,...B},P){const S=n({effect:"blink",duration:e,delay:i,easing:s,repeat:l,alternate:o,opacity:N,trigger:m,play:p,once:c,threshold:f,paused:d,infinite:t(l),timeline:g,range:u,stagger:y,durationStep:h,reverse:k,children:A});return r({render:b,ref:[P,S.ref],props:{...B,className:a(S.className,j),style:{...S.style,...v},...S.props,children:S.children}})});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAnimateTrigger } from '../../types.js';
|
|
4
|
+
export interface PlAnimateCounterProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
5
|
+
/** The number it arrives at, and the one a screen reader is told. */
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* The number it starts from.
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
from?: number;
|
|
12
|
+
/**
|
|
13
|
+
* How long the count takes, in milliseconds.
|
|
14
|
+
* @default 1200
|
|
15
|
+
*/
|
|
16
|
+
duration?: number;
|
|
17
|
+
/** How long it waits before starting, in milliseconds. @default 0 */
|
|
18
|
+
delay?: number;
|
|
19
|
+
/**
|
|
20
|
+
* How the number is written — `Intl.NumberFormat` options, so a currency, a
|
|
21
|
+
* percentage or a compact `1.2M` all work.
|
|
22
|
+
*
|
|
23
|
+
* This is the reason the count is JavaScript rather than a `@property` and a
|
|
24
|
+
* CSS counter, which is otherwise the neater way to animate a number: CSS can
|
|
25
|
+
* tick a value, and it cannot put a thousands separator in one.
|
|
26
|
+
*/
|
|
27
|
+
format?: Intl.NumberFormatOptions;
|
|
28
|
+
/**
|
|
29
|
+
* The shape of the count, as a function from `0`…`1` to `0`…`1`.
|
|
30
|
+
*
|
|
31
|
+
* A function rather than a CSS easing string, and not for want of trying: no
|
|
32
|
+
* CSS animation is running here, so there is nothing to hand a string to. It
|
|
33
|
+
* eases out by default, which is what a number arriving should do — quick
|
|
34
|
+
* enough to read as counting, slow enough at the end to land on the figure
|
|
35
|
+
* rather than snap to it.
|
|
36
|
+
*/
|
|
37
|
+
easing?: (t: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* What starts the count.
|
|
40
|
+
*
|
|
41
|
+
* **`visible` by default**, and it is the one component in the library that
|
|
42
|
+
* does not start on mount. That is deliberate rather than an oversight: an
|
|
43
|
+
* entrance played off screen has still delivered its content, and a count
|
|
44
|
+
* that ran off screen delivered a number that was simply already there. A
|
|
45
|
+
* counter is the one effect whose whole point is being watched.
|
|
46
|
+
* @default 'visible'
|
|
47
|
+
*/
|
|
48
|
+
trigger?: PlassAnimateTrigger;
|
|
49
|
+
/** Runs it, when `trigger` is `manual`. */
|
|
50
|
+
play?: boolean;
|
|
51
|
+
/** With `visible`, whether it counts only the first time. @default true */
|
|
52
|
+
once?: boolean;
|
|
53
|
+
/** With `visible`, how much has to be on screen to count. @default 0.2 */
|
|
54
|
+
threshold?: number;
|
|
55
|
+
/** Holds the count where it is. */
|
|
56
|
+
paused?: boolean;
|
|
57
|
+
/** Renders something other than a `<span>`. Base UI's own escape hatch. */
|
|
58
|
+
render?: useRender.RenderProp;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A number counting up to what it is.
|
|
62
|
+
*
|
|
63
|
+
* The one effect in the group that animates **content** rather than a box: what
|
|
64
|
+
* moves is the figure itself, one frame at a time, from `from` to `value`.
|
|
65
|
+
*
|
|
66
|
+
* It is JavaScript and not a keyframe, and the reason is formatting. A
|
|
67
|
+
* registered custom property and a CSS counter can tick a number perfectly
|
|
68
|
+
* well — and cannot put a thousands separator in one, or a currency symbol, or
|
|
69
|
+
* fold 1,200,000 into `1.2M`. A counter that cannot be formatted is a counter
|
|
70
|
+
* nobody can use on a dashboard, so `Intl.NumberFormat` decides what is drawn
|
|
71
|
+
* and the frame loop only decides which number it is drawing.
|
|
72
|
+
*
|
|
73
|
+
* **It starts when it is seen, not when it mounts**, which is the one place a
|
|
74
|
+
* `PlAnimate*` here departs from the rest. An entrance played off screen has
|
|
75
|
+
* still delivered its content; a count that ran off screen delivered a number
|
|
76
|
+
* that was already sitting there when the reader arrived.
|
|
77
|
+
*
|
|
78
|
+
* **What a screen reader hears is the final number, once.** The ticking figure
|
|
79
|
+
* is `aria-hidden` and the answer is beside it in a clipped span, because a
|
|
80
|
+
* number changing sixty times a second in the accessibility tree is either
|
|
81
|
+
* silence or sixty announcements, and neither is the figure.
|
|
82
|
+
*/
|
|
83
|
+
export declare const PlAnimateCounter: React.ForwardRefExoticComponent<PlAnimateCounterProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as r,jsxs as t}from"react/jsx-runtime";import*as a from"react";import{useRender as n}from"@base-ui/react/use-render";import{useAnimationRun as s}from"../../internal/animate.js";import{useDefaults as i}from"../../internal/defaults.js";import{usePrefersReducedMotion as o}from"../../internal/media.js";import{cx as m,srOnlyClasses as l}from"../../internal/styles.js";function easeOut(e){return 1-(1-e)**3}export const PlAnimateCounter=/* @__PURE__ */a.forwardRef(function PlAnimateCounter({value:u,from:c=0,duration:d=1200,delay:f=0,format:p,easing:h=easeOut,trigger:j="visible",play:g,once:A=!0,threshold:F=.2,paused:x,render:b,className:v,...y},N){const q=i(),M=o(),w=s({trigger:j,play:g,once:A,threshold:F,paused:x,infinite:!1,nonce:u}),C=a.useMemo(()=>new Intl.NumberFormat(q.locale,p),[q.locale,p]),[O,P]=a.useState(()=>M?u:c);a.useEffect(()=>{if(M)return void P(u);if(!w.started)return void P(c);if(x)return;let e=0,r=0;const step=t=>{r||=t;const a=Math.min(1,(t-r-f)/Math.max(1,d));a<0?e=requestAnimationFrame(step):(P(c+(u-c)*h(a)),a<1&&(e=requestAnimationFrame(step)))};return e=requestAnimationFrame(step),()=>cancelAnimationFrame(e)},[w.started,M,x,u,c,d,f,h]);const E=C.format(u);return n({render:b??e("span",{}),ref:[N,w.ref],props:{className:m("tabular-nums",v),...w.handlers,"data-plass-animation":"counter","data-state":w.state,children:t(r,{children:[e("span",{className:l,children:E}),e("span",{"aria-hidden":"true",children:C.format(O)})]}),...y}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnimateCounter}from"./PlAnimateCounter.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { PlassAnimateMode, PlassAnimateProps } from '../../types.js';
|
|
4
|
-
export interface PlAnimateFadeProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { PlassAnimateMode, PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps } from '../../types.js';
|
|
4
|
+
export interface PlAnimateFadeProps extends PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content arrives or leaves.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const PlAnimateFade=/* @__PURE__ */e.forwardRef(function PlAnimateFade({duration:e=300,delay:i=0,easing:s,repeat:o=1,alternate:l,paused:d,trigger:m="mount",play:p,once:c=!0,threshold:f=.2,timeline:g,range:u,stagger:y=0,durationStep:h=0,reverse:N=!1,mode:j="in",from:v=0,render:A,className:F,style:P,children:S,...b},w){const x=a({effect:"fade",duration:e,delay:i,easing:s,repeat:o,alternate:l,mode:j,opacity:v,trigger:m,play:p,once:c,threshold:f,paused:d,infinite:t(o),timeline:g,range:u,stagger:y,durationStep:h,reverse:N,children:S});return r({render:A,ref:[w,x.ref],props:{...b,className:n(x.className,F),style:{...x.style,...P},...x.props,children:x.children}})});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAnimateProps, PlassOrientation } from '../../types.js';
|
|
4
|
+
export interface PlAnimateFloatProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* How far it drifts from where it started. A number is pixels.
|
|
7
|
+
*
|
|
8
|
+
* Small on purpose. A float is meant to be noticed at the edge of attention
|
|
9
|
+
* and not looked at, and past about a dozen pixels it stops being a drift and
|
|
10
|
+
* starts being something moving on the page.
|
|
11
|
+
* @default 8
|
|
12
|
+
*/
|
|
13
|
+
distance?: number | string;
|
|
14
|
+
/**
|
|
15
|
+
* Which way it drifts.
|
|
16
|
+
* @default 'vertical'
|
|
17
|
+
*/
|
|
18
|
+
orientation?: PlassOrientation;
|
|
19
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
20
|
+
render?: useRender.RenderProp;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Content drifting gently, and not going anywhere.
|
|
25
|
+
*
|
|
26
|
+
* The odd one out among the `PlAnimate*` components, and the page says so: the
|
|
27
|
+
* other effects are **entrances**, played once when content arrives. This one
|
|
28
|
+
* never finishes. It is for the thing that is meant to read as weightless — an
|
|
29
|
+
* illustration on a landing page, a mark over an empty state — and for nothing
|
|
30
|
+
* that a reader has to read while it moves.
|
|
31
|
+
*
|
|
32
|
+
* That is also why it is **not** in `PlassAnimation`, the union `mode`,
|
|
33
|
+
* `stagger` and the shared effect map are built on. That union is the set of
|
|
34
|
+
* ways content can arrive; an endless drift is not an arrival, and every
|
|
35
|
+
* component importing the map would have paid for a row nothing else could
|
|
36
|
+
* want.
|
|
37
|
+
*
|
|
38
|
+
* The cycle is symmetric — home, out, home — so however many times it runs it
|
|
39
|
+
* ends where it started. A float stopped mid-cycle would leave the element
|
|
40
|
+
* permanently a few pixels out of place, which reads as a layout bug rather
|
|
41
|
+
* than as an effect that ended.
|
|
42
|
+
*
|
|
43
|
+
* `easing` defaults to `ease-in-out` rather than to the house curve, which is
|
|
44
|
+
* the one place in the library that is right: the house curve is an entrance's,
|
|
45
|
+
* fast out of the gate and slow into place, and a drift with it would lurch at
|
|
46
|
+
* each end of the cycle instead of turning around.
|
|
47
|
+
*
|
|
48
|
+
* A reader who asked for less motion sees none of it, as with every effect
|
|
49
|
+
* here. Nothing may depend on the movement.
|
|
50
|
+
*/
|
|
51
|
+
export declare const PlAnimateFloat: React.ForwardRefExoticComponent<PlAnimateFloatProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{animBaseClass as t,lengthValue as r,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const PlAnimateFloat=/* @__PURE__ */e.forwardRef(function PlAnimateFloat({duration:e=3e3,delay:l=0,easing:s="ease-in-out",repeat:o="infinite",alternate:c,paused:d,trigger:m="mount",play:p,once:f=!0,threshold:u=.2,distance:y=8,orientation:h="vertical",render:g,className:N,style:j,children:v,...x},A){const F=r(y),P="vertical"===h,b=n({effect:null,duration:e,delay:l,easing:s,repeat:o,alternate:c,x:P?"0":F,y:P?`-${F}`:"0",trigger:m,play:p,once:f,threshold:u,paused:d,infinite:!0,children:v});return a({render:g,ref:[A,b.ref],props:{...x,className:i(t,"plass-anim-float",b.className,N),style:{...b.style,...j},...b.props,"data-plass-animation":"float",children:b.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnimateFloat}from"./PlAnimateFloat.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { PlassAnimateMode, PlassAnimateProps } from '../../types.js';
|
|
4
|
-
export interface PlAnimateGrowProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { PlassAnimateMode, PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps } from '../../types.js';
|
|
4
|
+
export interface PlAnimateGrowProps extends PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content unfolds or folds away.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const PlAnimateGrow=/* @__PURE__ */e.forwardRef(function PlAnimateGrow({duration:e=320,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const PlAnimateGrow=/* @__PURE__ */e.forwardRef(function PlAnimateGrow({duration:e=320,delay:i=0,easing:o,repeat:s=1,alternate:l,paused:d,trigger:m="mount",play:c,once:p=!0,threshold:g=.2,timeline:f,range:u,stagger:y=0,durationStep:h=0,reverse:w=!1,mode:N="in",from:j=.8,origin:v="center",fade:A=!0,render:G,className:P,style:S,children:b,...x},R){const k=a({effect:"grow",duration:e,delay:i,easing:o,repeat:s,alternate:l,mode:N,scale:j,opacity:A?0:1,trigger:m,play:c,once:p,threshold:g,paused:d,infinite:t(s),timeline:f,range:u,origin:v,stagger:y,durationStep:h,reverse:w,children:b});return r({render:G,ref:[R,k.ref],props:{...x,className:n(k.className,P),style:{...k.style,...S},...k.props,children:k.children}})});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAnimateMode, PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, PlassSide } from '../../types.js';
|
|
4
|
+
export interface PlAnimateRevealProps extends PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the content is uncovered or covered again. `out` is the same wipe
|
|
7
|
+
* run backwards, so it closes from the edge it opened towards.
|
|
8
|
+
* @default 'in'
|
|
9
|
+
*/
|
|
10
|
+
mode?: PlassAnimateMode;
|
|
11
|
+
/**
|
|
12
|
+
* Which edge the wipe starts at. Physical, as `PlassSide` is everywhere — a
|
|
13
|
+
* heading uncovered from the top is uncovered from the top in every writing
|
|
14
|
+
* direction.
|
|
15
|
+
* @default 'left'
|
|
16
|
+
*/
|
|
17
|
+
from?: PlassSide;
|
|
18
|
+
/**
|
|
19
|
+
* Fades in behind the wipe.
|
|
20
|
+
*
|
|
21
|
+
* **Off by default**, which is the opposite of every other effect here and is
|
|
22
|
+
* the whole point of this one: a reveal is not a fade. Turn it on only if you
|
|
23
|
+
* want both.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
fade?: boolean;
|
|
27
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
28
|
+
render?: useRender.RenderProp;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Content uncovered behind a moving edge.
|
|
33
|
+
*
|
|
34
|
+
* The only entrance in the set where **nothing moves and no colour changes**.
|
|
35
|
+
* A fade changes the ink, a slide changes the position, a grow changes the
|
|
36
|
+
* size; this changes how much of the element is drawn and leaves every pixel it
|
|
37
|
+
* has drawn exactly where it will finally be. That makes it the effect for
|
|
38
|
+
* anything whose position is itself the information — a heading over the
|
|
39
|
+
* paragraph it belongs to, a rule between two sections, the plot area of a
|
|
40
|
+
* chart, a row of figures that must not be read from the wrong place.
|
|
41
|
+
*
|
|
42
|
+
* It is also the cheapest entrance in the set to lay out, because there is
|
|
43
|
+
* nothing to lay out: no wrapper, no `overflow` box, no second element in the
|
|
44
|
+
* flow. `clip-path` paints less of the element and the page around it never
|
|
45
|
+
* learns that anything happened.
|
|
46
|
+
*
|
|
47
|
+
* `fade` is off by default, alone among the effects that offer it. Fading a
|
|
48
|
+
* reveal is asking for two entrances at once, and the reason to have reached
|
|
49
|
+
* for this one is usually that the first was the problem.
|
|
50
|
+
*/
|
|
51
|
+
export declare const PlAnimateReveal: React.ForwardRefExoticComponent<PlAnimateRevealProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,revealClip as a,useAnimateElement as n}from"../../internal/animate.js";import{cx as i}from"../../internal/styles.js";export const PlAnimateReveal=/* @__PURE__ */e.forwardRef(function PlAnimateReveal({duration:e=520,delay:l=0,easing:s,repeat:o=1,alternate:d,paused:m,trigger:p="mount",play:c,once:f=!0,threshold:g=.2,timeline:u,range:y,stagger:h=0,durationStep:v=0,reverse:N=!1,mode:R="in",from:j="left",fade:A=!1,render:P,className:S,style:b,children:w,...x},k){const q=n({effect:"reveal",duration:e,delay:l,easing:s,repeat:o,alternate:d,mode:R,clip:a(j),opacity:A?0:1,trigger:p,play:c,once:f,threshold:g,paused:m,infinite:t(o),timeline:u,range:y,stagger:h,durationStep:v,reverse:N,children:w});return r({render:P,ref:[k,q.ref],props:{...x,className:i(q.className,S),style:{...q.style,...b},...q.props,children:q.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnimateReveal}from"./PlAnimateReveal.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { PlassAnimateMode, PlassAnimateProps } from '../../types.js';
|
|
4
|
-
export interface PlAnimateRotateProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
3
|
+
import type { PlassAnimateMode, PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps } from '../../types.js';
|
|
4
|
+
export interface PlAnimateRotateProps extends PlassAnimateProps, PlassAnimateStaggerProps, PlassAnimateTimelineProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
5
|
/**
|
|
6
6
|
* Whether the content turns into place or out of it.
|
|
7
7
|
* @default 'in'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const PlAnimateRotate=/* @__PURE__ */e.forwardRef(function PlAnimateRotate({duration:e=440,delay:
|
|
1
|
+
"use client";import*as e from"react";import{useRender as r}from"@base-ui/react/use-render";import{isInfinite as t,useAnimateElement as a}from"../../internal/animate.js";import{cx as n}from"../../internal/styles.js";export const PlAnimateRotate=/* @__PURE__ */e.forwardRef(function PlAnimateRotate({duration:e=440,delay:i=0,easing:o,repeat:s=1,alternate:l,paused:d,trigger:m="mount",play:c,once:g=!0,threshold:p=.2,timeline:f,range:u,stagger:y=0,durationStep:h=0,reverse:N=!1,mode:R="in",from:j=-180,to:v=0,origin:A="center",fade:P=!0,render:S,className:$,style:b,children:w,...x},T){const k=a({effect:"rotate",duration:e,delay:i,easing:o,repeat:s,alternate:l,mode:R,angle:`${j}deg`,angleTo:`${v}deg`,opacity:P?0:1,trigger:m,play:c,once:g,threshold:p,paused:d,infinite:t(s),timeline:f,range:u,origin:A,stagger:y,durationStep:h,reverse:N,children:w});return r({render:S,ref:[T,k.ref],props:{...x,className:n(k.className,$),style:{...k.style,...b},...k.props,children:k.children}})});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAnimateTrigger } from '../../types.js';
|
|
4
|
+
export interface PlAnimateScrambleProps extends Omit<React.ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* The line that resolves. A string, and it has to be: the effect works on
|
|
7
|
+
* characters, and there is no character in a `<strong>`.
|
|
8
|
+
*/
|
|
9
|
+
children: string;
|
|
10
|
+
/**
|
|
11
|
+
* The glyphs the unsettled characters are drawn from.
|
|
12
|
+
*
|
|
13
|
+
* Left out, it is **the line's own characters**. Every scrambler that ships a
|
|
14
|
+
* default alphabet ships an English one, and English noise over a Korean or a
|
|
15
|
+
* Greek headline is a different script flickering rather than a word
|
|
16
|
+
* arriving. Set it for the caller who genuinely wants a terminal look.
|
|
17
|
+
*/
|
|
18
|
+
characters?: string;
|
|
19
|
+
/**
|
|
20
|
+
* How long the line takes to settle, in milliseconds.
|
|
21
|
+
* @default 1200
|
|
22
|
+
*/
|
|
23
|
+
duration?: number;
|
|
24
|
+
/** How long it waits before starting, in milliseconds. @default 0 */
|
|
25
|
+
delay?: number;
|
|
26
|
+
/**
|
|
27
|
+
* How often the unsettled characters are redrawn, in milliseconds.
|
|
28
|
+
*
|
|
29
|
+
* Not every frame, on purpose. At sixty a second a line of changing glyphs
|
|
30
|
+
* strobes, which is unpleasant to look at and is the kind of flicker a
|
|
31
|
+
* reader with a sensitivity to it should never be handed.
|
|
32
|
+
* @default 45
|
|
33
|
+
*/
|
|
34
|
+
tick?: number;
|
|
35
|
+
/**
|
|
36
|
+
* What starts it. `visible` for `PlAnimateCounter`'s reason: a line that
|
|
37
|
+
* resolved off screen delivered text that was simply already there.
|
|
38
|
+
* @default 'visible'
|
|
39
|
+
*/
|
|
40
|
+
trigger?: PlassAnimateTrigger;
|
|
41
|
+
/** Runs it, when `trigger` is `manual`. */
|
|
42
|
+
play?: boolean;
|
|
43
|
+
/** With `visible`, whether it runs only the first time. @default true */
|
|
44
|
+
once?: boolean;
|
|
45
|
+
/** With `visible`, how much has to be on screen to count. @default 0.2 */
|
|
46
|
+
threshold?: number;
|
|
47
|
+
/** Holds it where it is. */
|
|
48
|
+
paused?: boolean;
|
|
49
|
+
/** Renders something other than a `<span>`. Base UI's own escape hatch. */
|
|
50
|
+
render?: useRender.RenderProp;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A line of text resolving out of noise.
|
|
54
|
+
*
|
|
55
|
+
* The second of the two effects that animate **content** rather than a box, and
|
|
56
|
+
* it takes a `string` rather than a node for the same reason a
|
|
57
|
+
* [PlAnimateCounter](./animate-counter) takes a number: there is no character
|
|
58
|
+
* to scramble inside a `<strong>`.
|
|
59
|
+
*
|
|
60
|
+
* **The noise is made of the line's own characters.** Every scrambler that
|
|
61
|
+
* ships a default alphabet ships an English one, and English noise over a
|
|
62
|
+
* Korean, Greek or Arabic headline is not a word arriving — it is a different
|
|
63
|
+
* script flickering where a word is about to be. Shuffling the string's own
|
|
64
|
+
* glyphs costs nothing and is right in every script; it also keeps the line's
|
|
65
|
+
* colour and width steady, because every frame is drawn out of exactly the
|
|
66
|
+
* characters the finished line is made of.
|
|
67
|
+
*
|
|
68
|
+
* It settles **left to right**, which is what makes it read as a word arriving
|
|
69
|
+
* rather than as a slot machine, and whitespace is never scrambled — the gaps
|
|
70
|
+
* between words are what keeps a line of noise looking like a sentence.
|
|
71
|
+
*
|
|
72
|
+
* **A screen reader is told the line, once**, and never the noise. Everything a
|
|
73
|
+
* `PlAnimateCounter` says about that applies here word for word.
|
|
74
|
+
*/
|
|
75
|
+
export declare const PlAnimateScramble: React.ForwardRefExoticComponent<PlAnimateScrambleProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,Fragment as r,jsxs as a}from"react/jsx-runtime";import*as t from"react";import{useRender as n}from"@base-ui/react/use-render";import{useAnimationRun as s}from"../../internal/animate.js";import{usePrefersReducedMotion as i}from"../../internal/media.js";import{poolOf as m,scrambleAt as o}from"../../internal/scramble.js";import{cx as c,srOnlyClasses as l}from"../../internal/styles.js";export const PlAnimateScramble=/* @__PURE__ */t.forwardRef(function PlAnimateScramble({children:d,characters:f,duration:p=1200,delay:u=0,tick:h=45,trigger:x="visible",play:j,once:M=!0,threshold:b=.2,paused:g,render:A,className:y,...F},v){const N=i(),S=s({trigger:x,play:j,once:M,threshold:b,paused:g,infinite:!1,nonce:d}),q=t.useMemo(()=>f??m(d),[f,d]),[w,P]=t.useState(()=>d);return t.useEffect(()=>{if(N)return void P(d);if(!S.started)return void P(o(d,q,0,0));if(g)return;const e=performance.now();let r=0,a=0,t=-1;const step=n=>{const s=n-e-u,i=Math.min(1,s/Math.max(1,p)),m=Math.floor(Math.max(0,s)/Math.max(1,h));m!==t&&(t=m,a+=1,P(o(d,q,Math.max(0,i),a))),i<1?r=requestAnimationFrame(step):P(d)};return r=requestAnimationFrame(step),()=>cancelAnimationFrame(r)},[S.started,N,g,d,q,p,u,h]),n({render:A??e("span",{}),ref:[v,S.ref],props:{className:c(y),...S.handlers,"data-plass-animation":"scramble","data-state":S.state,children:a(r,{children:[e("span",{className:l,children:d}),e("span",{"aria-hidden":"true",children:w})]}),...F}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnimateScramble}from"./PlAnimateScramble.js";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
+
import type { PlassAnimateProps } from '../../types.js';
|
|
4
|
+
export interface PlAnimateShakeProps extends PlassAnimateProps, React.ComponentPropsWithoutRef<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* Plays the shake again whenever this value changes, and never on the first
|
|
7
|
+
* render.
|
|
8
|
+
*
|
|
9
|
+
* The prop the component exists around. `play` is a boolean, so replaying
|
|
10
|
+
* with it means toggling off and on — two renders for one event, and a piece
|
|
11
|
+
* of state whose only job is to be flipped back. A refusal is an **event**,
|
|
12
|
+
* and a value that has changed is the closest React has to one: a count of
|
|
13
|
+
* failed attempts already is this.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <PlAnimateShake replay={attempts}>…</PlAnimateShake>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
replay?: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* How far it travels either side of where it started. A number is pixels.
|
|
22
|
+
* @default 6
|
|
23
|
+
*/
|
|
24
|
+
distance?: number | string;
|
|
25
|
+
/** Renders something other than a `<div>`. Base UI's own escape hatch. */
|
|
26
|
+
render?: useRender.RenderProp;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A refusal.
|
|
31
|
+
*
|
|
32
|
+
* The one effect in the set that is a **response** rather than an entrance: it
|
|
33
|
+
* is what a form does when the password was wrong again, what a locked control
|
|
34
|
+
* does when it is pressed. So it starts held still and plays only when it is
|
|
35
|
+
* told to, where every other effect here starts on mount.
|
|
36
|
+
*
|
|
37
|
+
* `replay` is the prop it exists around. A refusal can happen twice, and
|
|
38
|
+
* `play`, being a boolean, cannot say "again" — replaying with it means
|
|
39
|
+
* toggling off and on, which is two renders for one event and a piece of state
|
|
40
|
+
* whose only job is to be flipped back. A value that has changed is the closest
|
|
41
|
+
* React has to an event, and the count of failed attempts a form already keeps
|
|
42
|
+
* is exactly that value.
|
|
43
|
+
*
|
|
44
|
+
* It is not in `PlassAnimation`, for `PlAnimateFloat`'s reason: that union is
|
|
45
|
+
* the set of ways content can arrive, and this is not an arrival.
|
|
46
|
+
*
|
|
47
|
+
* Three shudders either side of home and back to nothing, so a shaken element
|
|
48
|
+
* is exactly where it was. This is the one effect a caller will run over
|
|
49
|
+
* content that is still being typed into, and a field left a few pixels off its
|
|
50
|
+
* label would be worse than the error it was reporting.
|
|
51
|
+
*
|
|
52
|
+
* **A reader who asked for less motion sees none of it**, which is the whole
|
|
53
|
+
* reason the words matter more than the shake: whatever a refusal is saying has
|
|
54
|
+
* to be said in text as well, in something a screen reader is told about. The
|
|
55
|
+
* shake is emphasis, never the message.
|
|
56
|
+
*/
|
|
57
|
+
export declare const PlAnimateShake: React.ForwardRefExoticComponent<PlAnimateShakeProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import*as e from"react";import{useRender as a}from"@base-ui/react/use-render";import{animBaseClass as r,lengthValue as n,useAnimateElement as t}from"../../internal/animate.js";import{cx as s}from"../../internal/styles.js";export const PlAnimateShake=/* @__PURE__ */e.forwardRef(function PlAnimateShake({duration:e=400,delay:l=0,easing:i,repeat:o=1,alternate:c,paused:d,trigger:p="manual",play:m=!1,once:f=!0,threshold:h=.2,replay:u,distance:y=6,render:g,className:k,style:N,children:j,...x},A){const P=t({effect:null,duration:e,delay:l,easing:i,repeat:o,alternate:c,x:n(y),trigger:p,play:m,once:f,threshold:h,paused:d,infinite:!1,nonce:u,children:j});return a({render:g,ref:[A,P.ref],props:{...x,className:s(r,"plass-anim-shake",P.className,k),style:{...P.style,...N},...P.props,"data-plass-animation":"shake",children:P.children}})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{PlAnimateShake}from"./PlAnimateShake.js";
|