@photon-ai/pho-ui 2.5.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/IconChevronDown-CZilB71T.js +11 -0
- package/dist/chunks/IconChevronDown-CZilB71T.js.map +1 -0
- package/dist/chunks/IconSearch-BKAHkLyX.js +14 -0
- package/dist/chunks/IconSearch-BKAHkLyX.js.map +1 -0
- package/dist/chunks/animated-height-CCO-Ocoz.js +48 -0
- package/dist/chunks/animated-height-CCO-Ocoz.js.map +1 -0
- package/dist/chunks/basic-page-DR5szOOs.js +1373 -0
- package/dist/chunks/basic-page-DR5szOOs.js.map +1 -0
- package/dist/chunks/{button-DNNs5RsT.js → button-CdqS_t5a.js} +62 -65
- package/dist/chunks/button-CdqS_t5a.js.map +1 -0
- package/dist/chunks/checkbox-Cdm08HWG.js +129 -0
- package/dist/chunks/checkbox-Cdm08HWG.js.map +1 -0
- package/dist/chunks/{choice-card-CunOnY9l.js → choice-card-BVNP1NB6.js} +2 -2
- package/dist/chunks/{choice-card-CunOnY9l.js.map → choice-card-BVNP1NB6.js.map} +1 -1
- package/dist/chunks/data-table-DwbPU0zt.js +2970 -0
- package/dist/chunks/data-table-DwbPU0zt.js.map +1 -0
- package/dist/chunks/{dialog-8SRNi_rv.js → dialog-BxKACOj5.js} +4 -4
- package/dist/chunks/{dialog-8SRNi_rv.js.map → dialog-BxKACOj5.js.map} +1 -1
- package/dist/chunks/{error-Crs-wqMC.js → error-D0yoFxCv.js} +2 -2
- package/dist/chunks/{error-Crs-wqMC.js.map → error-D0yoFxCv.js.map} +1 -1
- package/dist/chunks/is-react-component-DSnjtBmo.js +10 -0
- package/dist/chunks/is-react-component-DSnjtBmo.js.map +1 -0
- package/dist/chunks/link-provider-DXzDQ08N.js +24 -0
- package/dist/chunks/link-provider-DXzDQ08N.js.map +1 -0
- package/dist/chunks/rolldown-runtime-DG5F_Nuu.js +27 -0
- package/dist/chunks/{scroll-area-Bu7egArU.js → scroll-area-BO-9PMM7.js} +27 -26
- package/dist/chunks/scroll-area-BO-9PMM7.js.map +1 -0
- package/dist/chunks/sidebar-DVzZsCts.js +223 -0
- package/dist/chunks/sidebar-DVzZsCts.js.map +1 -0
- package/dist/chunks/skeleton-DwjSl4vC.js +18 -0
- package/dist/chunks/skeleton-DwjSl4vC.js.map +1 -0
- package/dist/chunks/{toast-DoXaRPIZ.js → toast-iSf6NuAS.js} +43 -45
- package/dist/chunks/toast-iSf6NuAS.js.map +1 -0
- package/dist/chunks/use-press-pulse-IbNstUT0.js +58 -0
- package/dist/chunks/use-press-pulse-IbNstUT0.js.map +1 -0
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox.js +4 -126
- package/dist/components/command.js +54 -57
- package/dist/components/command.js.map +1 -1
- package/dist/components/data-table.js +11 -0
- package/dist/components/dialog.js +1 -1
- package/dist/components/error.js +1 -1
- package/dist/components/phone-input.js +609 -616
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.js +35 -39
- package/dist/components/select.js.map +1 -1
- package/dist/components/skeleton.js +2 -15
- package/dist/components/toast.js +1 -1
- package/dist/index.js +94 -73
- package/dist/motion.js +89 -0
- package/dist/motion.js.map +1 -0
- package/dist/primitives/accordion.js +1 -1
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/autocomplete.js +1 -1
- package/dist/primitives/avatar.js +1 -1
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox-group.js +1 -1
- package/dist/primitives/checkbox.js +1 -1
- package/dist/primitives/collapsible.js +1 -1
- package/dist/primitives/combobox.js +1 -1
- package/dist/primitives/context-menu.js +1 -1
- package/dist/primitives/csp-provider.js +1 -1
- package/dist/primitives/dialog.js +1 -1
- package/dist/primitives/direction-provider.js +1 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/field.js +1 -1
- package/dist/primitives/fieldset.js +1 -1
- package/dist/primitives/form.js +1 -1
- package/dist/primitives/input.js +1 -1
- package/dist/primitives/menu.js +1 -1
- package/dist/primitives/menubar.js +1 -1
- package/dist/primitives/meter.js +1 -1
- package/dist/primitives/navigation-menu.js +1 -1
- package/dist/primitives/number-field.js +1 -1
- package/dist/primitives/otp-field.js +1 -1
- package/dist/primitives/popover.js +1 -1
- package/dist/primitives/preview-card.js +1 -1
- package/dist/primitives/progress.js +1 -1
- package/dist/primitives/radio-group.js +1 -1
- package/dist/primitives/radio.js +1 -1
- package/dist/primitives/scroll-area.js +1 -1
- package/dist/primitives/select.js +1 -1
- package/dist/primitives/separator.js +1 -1
- package/dist/primitives/slider.js +1 -1
- package/dist/primitives/switch.js +1 -1
- package/dist/primitives/tabs.js +1 -1
- package/dist/primitives/toast.js +1 -1
- package/dist/primitives/toggle-group.js +1 -1
- package/dist/primitives/toggle.js +1 -1
- package/dist/primitives/toolbar.js +1 -1
- package/dist/primitives/tooltip.js +1 -1
- package/dist/primitives.js +3 -3
- package/dist/sections/basic-page.js +16 -14
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/data-table/data-table.d.ts +227 -0
- package/dist/src/components/data-table/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/motion/index.d.ts +149 -0
- package/dist/src/sections/basic-page/basic-page.d.ts +63 -14
- package/dist/src/sections/basic-page/index.d.ts +1 -0
- package/dist/utils.js +13 -12
- package/package.json +10 -1
- package/dist/chunks/animated-height-C2eQstGy.js +0 -51
- package/dist/chunks/animated-height-C2eQstGy.js.map +0 -1
- package/dist/chunks/basic-page-w6ftlo0h.js +0 -1284
- package/dist/chunks/basic-page-w6ftlo0h.js.map +0 -1
- package/dist/chunks/button-DNNs5RsT.js.map +0 -1
- package/dist/chunks/link-provider-9TFNyDqO.js +0 -28
- package/dist/chunks/link-provider-9TFNyDqO.js.map +0 -1
- package/dist/chunks/rolldown-runtime-wKSmTnsc.js +0 -22
- package/dist/chunks/scroll-area-Bu7egArU.js.map +0 -1
- package/dist/chunks/sidebar-DvB-G0BP.js +0 -231
- package/dist/chunks/sidebar-DvB-G0BP.js.map +0 -1
- package/dist/chunks/toast-DoXaRPIZ.js.map +0 -1
- package/dist/chunks/use-press-pulse-8iorQPsh.js +0 -62
- package/dist/chunks/use-press-pulse-8iorQPsh.js.map +0 -1
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/skeleton.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, ComponentProps, ReactNode, Ref } from 'react';
|
|
2
2
|
import { ButtonLinkProps, ButtonProps } from '../../components/button';
|
|
3
3
|
import { Form as FormElement } from '../../components/form';
|
|
4
|
+
import { DataTable } from '../../components/data-table';
|
|
4
5
|
/** Bordered card that stacks rows with hairline dividers. */
|
|
5
6
|
export declare const BASIC_PAGE_CARD = "rounded-base border border-pho-secondary bg-pho-primary divide-y divide-pho-secondary [&>:has(+[data-basic-page-alert])]:border-b-0";
|
|
6
7
|
/**
|
|
@@ -71,11 +72,14 @@ export interface BasicPageRootProps extends ComponentProps<"div"> {
|
|
|
71
72
|
*/
|
|
72
73
|
condense?: boolean;
|
|
73
74
|
/**
|
|
74
|
-
* The content column. `base`
|
|
75
|
-
* settings page uses
|
|
76
|
-
* first — rows with several columns
|
|
77
|
-
* `
|
|
78
|
-
*
|
|
75
|
+
* The content column's cap. `base` is the 42rem reading column every
|
|
76
|
+
* settings page uses; `wide` opens it to 80rem for a page that is a
|
|
77
|
+
* list first — rows with several columns. Left unsaid, the page sizes
|
|
78
|
+
* itself: `base`, until it carries a `Table` — records in columns run
|
|
79
|
+
* wide on their own. Forms stay on `base`: across a wide row a label
|
|
80
|
+
* and its control drift out of one glance. Either width can host an
|
|
81
|
+
* `Aside` — the column keeps its cap beside the panel, and leftover
|
|
82
|
+
* space is margin, not content width.
|
|
79
83
|
*/
|
|
80
84
|
width?: "base" | "wide";
|
|
81
85
|
}
|
|
@@ -191,7 +195,7 @@ export interface BasicPageStackProps extends Omit<ComponentProps<"div">, RevealM
|
|
|
191
195
|
*
|
|
192
196
|
* Static under reduced motion.
|
|
193
197
|
*/
|
|
194
|
-
declare function Stack({ className, children, ...props }: BasicPageStackProps): import("react").JSX.Element;
|
|
198
|
+
declare function Stack({ className, children, ref: forwardedRef, ...props }: BasicPageStackProps): import("react").JSX.Element;
|
|
195
199
|
/**
|
|
196
200
|
* Title + optional description pair. No gap between them — the block's
|
|
197
201
|
* `gap-3` only applies between this header and the card.
|
|
@@ -221,6 +225,19 @@ declare function SectionTitle({ id, className, children, ...props }: ComponentPr
|
|
|
221
225
|
declare function Description({ className, ...props }: ComponentProps<"p"> & {
|
|
222
226
|
ref?: Ref<HTMLParagraphElement>;
|
|
223
227
|
}): import("react").JSX.Element;
|
|
228
|
+
/**
|
|
229
|
+
* How many rows the searchable table is showing — a `Description` that
|
|
230
|
+
* reads the table's search. Idle: "12 people." A query: "3 of 12."
|
|
231
|
+
* Renders nothing until a table with `search` is on the page. Put it in
|
|
232
|
+
* the `Header` under the section title.
|
|
233
|
+
*/
|
|
234
|
+
declare function TableCount({ one, other, ...props }: ComponentProps<"p"> & {
|
|
235
|
+
/** Singular noun — "1 person." */
|
|
236
|
+
one: string;
|
|
237
|
+
/** Plural noun — "12 people." */
|
|
238
|
+
other: string;
|
|
239
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
240
|
+
}): import("react").JSX.Element | null;
|
|
224
241
|
/**
|
|
225
242
|
* Optional caption below a section's `Card` (outside the card). One step
|
|
226
243
|
* smaller than `Description` (`text-xs`). Not the card-internal dirty-state
|
|
@@ -661,6 +678,11 @@ export interface BasicPageAsideProps {
|
|
|
661
678
|
* the URL.
|
|
662
679
|
*/
|
|
663
680
|
open?: boolean;
|
|
681
|
+
/**
|
|
682
|
+
* The empty panel's face — a quiet line that says what opens here.
|
|
683
|
+
* Optional; without it the reserved panel stands empty.
|
|
684
|
+
*/
|
|
685
|
+
placeholder?: ReactNode;
|
|
664
686
|
/**
|
|
665
687
|
* The way out for a page that carries no `Back` — the close in the
|
|
666
688
|
* panel's corner calls it. A page with a `Back` closes through that link.
|
|
@@ -670,17 +692,43 @@ export interface BasicPageAsideProps {
|
|
|
670
692
|
}
|
|
671
693
|
/**
|
|
672
694
|
* A subpage beside the page. On a pane wide enough for two columns (48rem,
|
|
673
|
-
* Tailwind's `md`) it is a panel at the right edge
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
|
|
680
|
-
|
|
695
|
+
* Tailwind's `md`) it is a panel at the right edge, and the panel holds
|
|
696
|
+
* its ground from the first paint: the page beside it never reflows as
|
|
697
|
+
* subpages open and close — only the panel's face changes, `placeholder`
|
|
698
|
+
* while empty, the subpage while one is open. The subpage scrolls on its
|
|
699
|
+
* own, its `Back` is the close in the corner, Escape closes too. On a
|
|
700
|
+
* narrower pane the same subpage is the page — the list steps aside, the
|
|
701
|
+
* subpage takes the pane with its own `Back` — so one subpage component
|
|
702
|
+
* serves both. Works under either `Root` width: the page keeps its own
|
|
703
|
+
* column cap beside the panel, and leftover space is margin.
|
|
704
|
+
*/
|
|
705
|
+
declare function Aside({ open, placeholder, onClose, children }: BasicPageAsideProps): import('react').ReactPortal | null;
|
|
706
|
+
/**
|
|
707
|
+
* The table's search, standing at the end of a section header — put it in
|
|
708
|
+
* the `Header` beside the title and it adopts the searchable table's box
|
|
709
|
+
* (the table then renders none of its own). On a header at least 36rem
|
|
710
|
+
* wide the box simply stands open: the header is a container, CSS
|
|
711
|
+
* decides, nothing is measured. On a narrower one a round button holds
|
|
712
|
+
* the place; clicking it opens the box — the width glides linearly, the
|
|
713
|
+
* page's travel — with focus landing inside. Emptied and blurred it
|
|
714
|
+
* glides shut and the button returns; Escape clears, blurs, and shuts.
|
|
715
|
+
* Renders nothing until a table with `search` is on the page.
|
|
716
|
+
*/
|
|
717
|
+
declare function Search({ variant, className, ...props }: ComponentProps<"div"> & {
|
|
718
|
+
/**
|
|
719
|
+
* The face. `box` (default) is the bordered field beside a section
|
|
720
|
+
* title — open on a wide header, a round button that glides it open on
|
|
721
|
+
* a narrow one. `ghost` is the table-chrome face: a magnifier and a
|
|
722
|
+
* bare field on the text line, no box — for a toolbar band or anywhere
|
|
723
|
+
* a boxed control would be noise; it flexes instead of folding.
|
|
724
|
+
*/
|
|
725
|
+
variant?: "box" | "ghost";
|
|
726
|
+
}): import("react").JSX.Element;
|
|
681
727
|
export declare const BasicPage: {
|
|
682
728
|
Root: typeof Root;
|
|
683
729
|
Aside: typeof Aside;
|
|
730
|
+
Search: typeof Search;
|
|
731
|
+
Table: typeof DataTable;
|
|
684
732
|
CondenseScope: typeof CondenseScope;
|
|
685
733
|
Breadcrumbs: typeof Breadcrumbs;
|
|
686
734
|
Crumb: typeof Crumb;
|
|
@@ -690,6 +738,7 @@ export declare const BasicPage: {
|
|
|
690
738
|
Header: typeof Header;
|
|
691
739
|
SectionTitle: typeof SectionTitle;
|
|
692
740
|
Description: typeof Description;
|
|
741
|
+
TableCount: typeof TableCount;
|
|
693
742
|
SectionFooter: typeof SectionFooter;
|
|
694
743
|
Card: typeof Card;
|
|
695
744
|
Item: typeof Item;
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export { BasicPage, formToasts, AUTO_SAVE_DELAY_MS, useCondense, useAutoSave, type BasicPageCondense, BASIC_PAGE_CARD, CONDENSE_BAR_ENTER, CONDENSE_BAR_TRAVEL, CONDENSE_BAR_RISE_PX, BASIC_PAGE_CALLOUT, BASIC_PAGE_ROW, BASIC_PAGE_ITEM, BASIC_PAGE_ITEM_PANEL, BASIC_PAGE_ITEM_PANEL_DIVIDED, type BasicPageRootProps, type BasicPageAsideProps, type BasicPageRowProps, type BasicPageRowLinkProps, type BasicPageBackProps, type BasicPageBreadcrumbsProps, type BasicPageCrumbProps, type BasicPageFooterProps, type BasicPageFormProps, type BasicPageFormErrors, type BasicPageItemPanelProps, } from './basic-page';
|
|
2
|
+
export { createColumns, type DataTableColumn, type DataTableColumnMeta, type DataTableProps, type SortingState, } from '../../components/data-table';
|
package/dist/utils.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
2
|
+
import { t as r } from "./chunks/cn-ChIgwEl3.js";
|
|
3
|
+
import { t } from "./chunks/is-react-component-DSnjtBmo.js";
|
|
4
|
+
import { t as m } from "./chunks/resolve-variant-CcD8iG5l.js";
|
|
5
|
+
import { n as i, t as n } from "./chunks/link-provider-DXzDQ08N.js";
|
|
6
|
+
import { n as P, r as R, t as S } from "./chunks/use-press-pulse-IbNstUT0.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
S as CONTROL_PRESS_SCALE,
|
|
9
|
+
P as CONTROL_PRESS_SPRING,
|
|
10
|
+
n as LinkProvider,
|
|
11
|
+
r as cn,
|
|
12
|
+
t as isReactComponent,
|
|
13
|
+
m as resolveVariant,
|
|
14
|
+
i as useLinkComponent,
|
|
15
|
+
R as usePressPulse
|
|
15
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photon-ai/pho-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Pho Design System — Photon's React component library, built on Base UI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
"types": "./dist/src/components/button/index.d.ts",
|
|
34
34
|
"import": "./dist/components/button.js"
|
|
35
35
|
},
|
|
36
|
+
"./components/data-table": {
|
|
37
|
+
"types": "./dist/src/components/data-table/index.d.ts",
|
|
38
|
+
"import": "./dist/components/data-table.js"
|
|
39
|
+
},
|
|
36
40
|
"./components/input": {
|
|
37
41
|
"types": "./dist/src/components/input/index.d.ts",
|
|
38
42
|
"import": "./dist/components/input.js"
|
|
@@ -233,6 +237,10 @@
|
|
|
233
237
|
"types": "./dist/src/utils/index.d.ts",
|
|
234
238
|
"import": "./dist/utils.js"
|
|
235
239
|
},
|
|
240
|
+
"./motion": {
|
|
241
|
+
"types": "./dist/src/motion/index.d.ts",
|
|
242
|
+
"import": "./dist/motion.js"
|
|
243
|
+
},
|
|
236
244
|
"./primitives": {
|
|
237
245
|
"types": "./dist/src/primitives/index.d.ts",
|
|
238
246
|
"import": "./dist/primitives.js"
|
|
@@ -430,6 +438,7 @@
|
|
|
430
438
|
},
|
|
431
439
|
"dependencies": {
|
|
432
440
|
"@base-ui/react": "^1.7.0",
|
|
441
|
+
"@tanstack/react-table": "^9.2.3",
|
|
433
442
|
"clsx": "^2.1.1",
|
|
434
443
|
"cmdk": "^1.1.1",
|
|
435
444
|
"country-flag-icons": "^1.6.20",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect as v, useRef as a } from "react";
|
|
3
|
-
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
-
import { animate as g, motion as R, useMotionValue as x, useReducedMotion as H } from "motion/react";
|
|
5
|
-
var M = {
|
|
6
|
-
type: "spring",
|
|
7
|
-
stiffness: 640,
|
|
8
|
-
damping: 50
|
|
9
|
-
};
|
|
10
|
-
function y({ className: d, transition: r, children: p }) {
|
|
11
|
-
const s = a(null), i = a(null), t = x("auto"), c = H();
|
|
12
|
-
return v(() => {
|
|
13
|
-
const h = s.current, n = i.current;
|
|
14
|
-
if (!h || !n) return;
|
|
15
|
-
let e = null;
|
|
16
|
-
const u = new ResizeObserver((b) => {
|
|
17
|
-
const f = b[0]?.borderBoxSize?.[0], o = f ? f.blockSize : n.offsetHeight, l = t.get();
|
|
18
|
-
if (l === "auto" || c) {
|
|
19
|
-
e?.stop(), e = null, t.set(o);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
!e && Math.abs(l - o) < 0.5 || (e?.stop(), e = g(t, o, {
|
|
23
|
-
...r ?? M,
|
|
24
|
-
onComplete: () => {
|
|
25
|
-
e = null;
|
|
26
|
-
}
|
|
27
|
-
}));
|
|
28
|
-
});
|
|
29
|
-
return u.observe(n), () => {
|
|
30
|
-
u.disconnect(), e?.stop();
|
|
31
|
-
};
|
|
32
|
-
}, [
|
|
33
|
-
t,
|
|
34
|
-
c,
|
|
35
|
-
r
|
|
36
|
-
]), /* @__PURE__ */ m(R.div, {
|
|
37
|
-
ref: s,
|
|
38
|
-
className: "min-h-0 overflow-hidden",
|
|
39
|
-
style: { height: t },
|
|
40
|
-
children: /* @__PURE__ */ m("div", {
|
|
41
|
-
ref: i,
|
|
42
|
-
className: d,
|
|
43
|
-
children: p
|
|
44
|
-
})
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
y as t
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
//# sourceMappingURL=animated-height-C2eQstGy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"animated-height-C2eQstGy.js","names":[],"sources":["../../src/utils/animated-height.tsx"],"sourcesContent":["import { useEffect, useRef, type ReactNode } from \"react\";\nimport {\n animate,\n motion,\n useMotionValue,\n useReducedMotion,\n type ValueAnimationTransition,\n} from \"motion/react\";\n\n/**\n * Height spring for container-size transitions — same feel as the onboarding /\n * invite card and BasicPage footer reveal: quick, critically damped (no\n * overshoot that would flash clipped content).\n */\nconst HEIGHT_SPRING = { type: \"spring\", stiffness: 640, damping: 50 } as const;\n\n/**\n * Animates its own height to follow the measured height of `children`, so\n * content swaps (search filtering, skeleton → data) glide instead of jumping.\n * Honors `prefers-reduced-motion` by snapping height with no spring.\n */\nexport function AnimatedHeight({\n className,\n transition,\n children,\n}: {\n className?: string;\n /** Spring override for the height follow. @default the Command spring */\n transition?: ValueAnimationTransition<number | \"auto\">;\n children: ReactNode;\n}) {\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const height = useMotionValue<number | \"auto\">(\"auto\");\n const reduceMotion = useReducedMotion();\n\n useEffect(() => {\n const container = containerRef.current;\n const content = contentRef.current;\n if (!container || !content) return;\n\n let animation: ReturnType<typeof animate> | null = null;\n\n const observer = new ResizeObserver((entries) => {\n const box = entries[0]?.borderBoxSize?.[0];\n const next = box ? box.blockSize : content.offsetHeight;\n const current = height.get();\n if (current === \"auto\" || reduceMotion) {\n animation?.stop();\n animation = null;\n height.set(next);\n return;\n }\n if (!animation && Math.abs(current - next) < 0.5) return;\n animation?.stop();\n animation = animate(height, next, {\n ...(transition ?? HEIGHT_SPRING),\n onComplete: () => {\n animation = null;\n },\n });\n });\n observer.observe(content);\n\n return () => {\n observer.disconnect();\n animation?.stop();\n };\n }, [height, reduceMotion, transition]);\n\n return (\n <motion.div\n ref={containerRef}\n // Stack (and other flex parents) set `min-height: auto` on children,\n // which sizes to content and swallows the height spring. Clip and\n // allow shrinking so the measured height can actually animate.\n className=\"min-h-0 overflow-hidden\"\n style={{ height }}\n >\n <div ref={contentRef} className={className}>\n {children}\n </div>\n </motion.div>\n );\n}\n"],"mappings":";;;;AAcA,IAAM,IAAgB;AAAA,EAAE,MAAM;AAAA,EAAU,WAAW;AAAA,EAAK,SAAS;AAAG;AAOpE,SAAgB,EAAe,EAC7B,WAAA,GACA,YAAA,GACA,UAAA,EAAA,GAMC;AACD,QAAM,IAAe,EAAuB,IAAI,GAC1C,IAAa,EAAuB,IAAI,GACxC,IAAS,EAAgC,MAAM,GAC/C,IAAe,EAAiB;AAEtC,SAAA,EAAA,MAAgB;AACd,UAAM,IAAY,EAAa,SACzB,IAAU,EAAW;AAC3B,QAAI,CAAC,KAAa,CAAC,EAAS;AAE5B,QAAI,IAA+C;AAEnD,UAAM,IAAW,IAAI,eAAA,CAAgB,MAAY;AAC/C,YAAM,IAAM,EAAQ,CAAA,GAAI,gBAAgB,CAAA,GAClC,IAAO,IAAM,EAAI,YAAY,EAAQ,cACrC,IAAU,EAAO,IAAI;AAC3B,UAAI,MAAY,UAAU,GAAc;AACtC,QAAA,GAAW,KAAK,GAChB,IAAY,MACZ,EAAO,IAAI,CAAI;AACf;AAAA,MACF;AACA,MAAI,CAAC,KAAa,KAAK,IAAI,IAAU,CAAI,IAAI,QAC7C,GAAW,KAAK,GAChB,IAAY,EAAQ,GAAQ,GAAM;AAAA,QAChC,GAAI,KAAc;AAAA,QAClB,YAAA,MAAkB;AAChB,UAAA,IAAY;AAAA,QACd;AAAA,MACF,CAAC;AAAA,IACH,CAAC;AACD,WAAA,EAAS,QAAQ,CAAO,GAExB,MAAa;AACX,MAAA,EAAS,WAAW,GACpB,GAAW,KAAK;AAAA,IAClB;AAAA,EACF,GAAG;AAAA,IAAC;AAAA,IAAQ;AAAA,IAAc;AAAA,EAAU,CAAC,GAGnC,gBAAA,EAAC,EAAO,KAAR;AAAA,IACE,KAAK;AAAA,IAIL,WAAU;AAAA,IACV,OAAO,EAAE,QAAA,EAAO;AAAA,IAEhB,UAAA,gBAAA,EAAC,OAAD;AAAA,MAAK,KAAK;AAAA,MAAuB,WAAA;AAAA,MAC9B,UAAA;AAAA,IACE,CAAA;AAAA,EACK,CAAA;AAEhB"}
|