@photon-ai/pho-ui 2.7.0 → 2.8.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/basic-page-BI8y4hHk.js +1449 -0
- package/dist/chunks/basic-page-BI8y4hHk.js.map +1 -0
- package/dist/chunks/{checkbox-Cdm08HWG.js → checkbox-CznlNhDY.js} +40 -37
- package/dist/chunks/checkbox-CznlNhDY.js.map +1 -0
- package/dist/chunks/data-table-Cmz0p-jt.js +279 -0
- package/dist/chunks/data-table-Cmz0p-jt.js.map +1 -0
- package/dist/chunks/rolldown-runtime-wKSmTnsc.js +22 -0
- package/dist/components/accordion.js +87 -28
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/phone-input.js +1 -1
- package/dist/components/radio-group.js +50 -43
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/select.js +7 -7
- package/dist/components/select.js.map +1 -1
- package/dist/index.js +2 -2
- 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 +1 -1
- package/dist/sections/basic-page.js +2 -2
- package/dist/src/components/accordion/accordion.d.ts +45 -8
- package/dist/src/components/checkbox/checkbox-card.d.ts +2 -1
- package/dist/src/components/data-table/data-table.d.ts +3 -2
- package/dist/src/components/radio-group/radio-card.d.ts +3 -2
- package/dist/src/sections/basic-page/basic-page.d.ts +43 -11
- package/package.json +1 -1
- package/src/styles/theme.css +54 -0
- package/dist/chunks/basic-page-DR5szOOs.js +0 -1373
- package/dist/chunks/basic-page-DR5szOOs.js.map +0 -1
- package/dist/chunks/checkbox-Cdm08HWG.js.map +0 -1
- package/dist/chunks/data-table-DwbPU0zt.js +0 -2970
- package/dist/chunks/data-table-DwbPU0zt.js.map +0 -1
- package/dist/chunks/rolldown-runtime-DG5F_Nuu.js +0 -27
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox-CznlNhDY.js","names":[],"sources":["../../src/components/checkbox/check-glyph.tsx","../../src/components/checkbox/checkbox.tsx","../../src/components/checkbox/checkbox-group.tsx","../../src/components/checkbox/checkbox-card.tsx"],"sourcesContent":["import { motion } from \"motion/react\";\n\n// Tabler's IconCheck / IconMinus paths, redrawn as a single animatable\n// `motion.path` — same 24×24 outline geometry, round caps/joins. Tabler\n// draws at stroke 2 for a 24px icon; the box shows this one at 12–14px,\n// where 2 thins to a hair, so it strokes at 3 and reads with the same\n// weight the icons around it have.\nconst CHECK_PATH = \"M5 12l5 5l10 -10\";\nconst MINUS_PATH = \"M5 12l14 0\";\n\nconst DRAW_TRANSITION = { duration: 0.22, ease: \"easeOut\" } as const;\n\n/**\n * The checkbox glyph, stroked on rather than popped in solid — same\n * considered-motion spirit as Button's press/wake effects. Re-keyed per\n * state (check vs. dash) so every appearance draws fresh from empty instead\n * of resuming a stroke left mid-way by whatever the glyph showed before.\n */\nexport function DrawnCheckGlyph({\n indeterminate,\n className,\n}: {\n indeterminate?: boolean;\n className?: string;\n}) {\n return (\n <svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={className}\n aria-hidden=\"true\"\n >\n <motion.path\n key={indeterminate ? \"minus\" : \"check\"}\n d={indeterminate ? MINUS_PATH : CHECK_PATH}\n initial={{ pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={DRAW_TRANSITION}\n />\n </svg>\n );\n}\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\n\nexport type CheckboxSize = \"sm\" | \"md\";\n\nconst BOX: Record<CheckboxSize, string> = { sm: \"size-4\", md: \"size-5\" };\nconst ICON: Record<CheckboxSize, string> = { sm: \"size-3\", md: \"size-3.5\" };\n\nexport interface CheckboxProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\"\n> {\n className?: string;\n /** Text rendered beside the box; the whole row toggles the checkbox. */\n label?: ReactNode;\n /** Size variant. @default \"md\" */\n size?: CheckboxSize;\n}\n\n/**\n * Checkbox built on Base UI `Checkbox`. Supports checked, unchecked, and\n * `indeterminate` states; pass `label` for a clickable text row, or omit it\n * and provide an `aria-label`. For a set of related options that submit\n * together, wrap them in `CheckboxGroup`.\n *\n * Animation is the Effect Button family scaled to a toggle, kept restrained:\n * a quick shallow press pulse on pointer-down (always plays out), the\n * fill/stroke easing between states, and the glyph popping in.\n */\nexport function Checkbox({\n className,\n label,\n size = \"md\",\n disabled,\n indeterminate,\n ...props\n}: CheckboxProps) {\n const { motionProps } = usePressPulse({\n scale: 0.94,\n disabled: Boolean(disabled),\n });\n // With a label, the whole row is the hit target — press-trigger from there\n // (pointerdown bubbles up from the label text too) so the box still\n // animates when the text, not the box itself, is what's clicked.\n const { onPointerDown, ...boxMotionProps } = motionProps;\n\n const box = (\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n render={\n <motion.span\n {...boxMotionProps}\n onPointerDown={label ? undefined : onPointerDown}\n />\n }\n className={cn(\n // Flat field surface with the input-strength ring; the glyph only shows\n // on the brand-solid checked fill, so it must be on-brand (not white —\n // brand-solid is white in dark mode).\n \"group/cb outline-pho-brand bg-pho-primary ring-pho-primary text-pho-on-brand flex shrink-0 cursor-pointer items-center justify-center rounded-sm ring-1 ring-inset focus-visible:outline-2 focus-visible:outline-offset-2\",\n // Fill and stroke ease between states (stroke dissolves into the\n // fill on tick). Transform stays out — Motion owns the press pulse.\n \"transition-[background-color,box-shadow,color,outline-color] duration-150 ease-out\",\n // group-hover covers hovering the label text, not just the box itself.\n \"hover:bg-pho-primary-hover hover:ring-pho-ink group-hover:bg-pho-primary-hover group-hover:ring-pho-ink\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:ring-transparent\",\n \"data-[checked]:hover:bg-pho-brand-solid-hover data-[checked]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[indeterminate]:hover:bg-pho-brand-solid-hover data-[indeterminate]:group-hover:bg-pho-brand-solid-hover\",\n \"data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50\",\n BOX[size],\n className,\n )}\n {...props}\n >\n {/* The glyph draws itself on (see DrawnCheckGlyph) — no separate\n pop-in needed. A quick fade covers the exit, since an unmount\n can't play the stroke backwards. */}\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph indeterminate={indeterminate} className={ICON[size]} />\n </BaseCheckbox.Indicator>\n </BaseCheckbox.Root>\n );\n\n if (!label) return box;\n return (\n <label\n className=\"group flex cursor-pointer items-center gap-2 select-none\"\n onPointerDown={onPointerDown}\n >\n {box}\n <span className=\"text-pho-secondary text-base\">{label}</span>\n </label>\n );\n}\n\nCheckbox.displayName = \"Checkbox\";\n","import { type ComponentProps } from \"react\";\nimport { CheckboxGroup as BaseCheckboxGroup } from \"@base-ui/react/checkbox-group\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface CheckboxGroupProps extends Omit<\n ComponentProps<typeof BaseCheckboxGroup>,\n \"className\"\n> {\n className?: string;\n}\n\n/**\n * Groups related `Checkbox`es and tracks their values as one. Built on Base UI\n * `CheckboxGroup` — supports a parent \"select all\" checkbox via `allValues`.\n * Control with `value` / `onValueChange` or leave uncontrolled with\n * `defaultValue`.\n */\nexport function CheckboxGroup({ className, ...props }: CheckboxGroupProps) {\n return (\n <BaseCheckboxGroup\n className={cn(\"flex flex-col gap-3\", className)}\n {...props}\n />\n );\n}\n\nCheckboxGroup.displayName = \"CheckboxGroup\";\n","import { type ComponentProps, type ReactNode } from \"react\";\nimport { Checkbox as BaseCheckbox } from \"@base-ui/react/checkbox\";\nimport { motion } from \"motion/react\";\nimport { DrawnCheckGlyph } from \"./check-glyph\";\nimport { cn } from \"../../utils/cn\";\nimport { usePressPulse } from \"../../utils/use-press-pulse\";\nimport {\n CHOICE_CARD_BASE,\n CHOICE_CARD_WITH_ICON,\n CHOICE_CARD_PRESS_SCALE,\n CHOICE_CARD_PRESS_TRANSITION,\n} from \"../../utils/choice-card\";\n\nexport interface CheckboxCardProps extends Omit<\n ComponentProps<typeof BaseCheckbox.Root>,\n \"className\" | \"title\"\n> {\n className?: string;\n /** Tile heading. */\n title: ReactNode;\n /** Supporting copy shown below the title. */\n description?: ReactNode;\n /** Glyph stacked above the title. When set, it replaces the checkbox box. */\n icon?: ReactNode;\n}\n\nfunction CardCopy({\n title,\n description,\n}: {\n title: ReactNode;\n description?: ReactNode;\n}) {\n return (\n <span className=\"flex min-w-0 flex-1 flex-col\">\n <span className=\"text-pho-primary block font-medium\">{title}</span>\n {description ? (\n <span className=\"text-pho-description block\">{description}</span>\n ) : null}\n </span>\n );\n}\n\n/**\n * A `Checkbox` styled as a bordered, selectable tile — title, optional\n * description, and either a stacked icon above them or the checkbox box at\n * the end of the title row. The tile is a\n * `<label>` around the control so clicks (including on the icon/title) are a\n * trusted activation of the hidden input Base UI renders beside the root.\n */\nexport function CheckboxCard({\n className,\n title,\n description,\n icon,\n disabled,\n indeterminate,\n ...props\n}: CheckboxCardProps) {\n const { motionProps } = usePressPulse({\n scale: CHOICE_CARD_PRESS_SCALE,\n disabled: Boolean(disabled),\n transition: CHOICE_CARD_PRESS_TRANSITION,\n });\n const hasIcon = icon != null;\n\n return (\n <motion.label\n {...motionProps}\n className={cn(\n CHOICE_CARD_BASE,\n hasIcon && CHOICE_CARD_WITH_ICON,\n className,\n )}\n data-disabled={disabled ? \"\" : undefined}\n >\n {hasIcon ? (\n <span\n aria-hidden\n className=\"text-pho-secondary flex size-6 shrink-0 items-center justify-center [&>svg]:size-6\"\n >\n {icon}\n </span>\n ) : null}\n <CardCopy title={title} description={description} />\n {/* The box sits at the end of the title row, centered on the title's\n line and the same half step from the right edge, square in the\n corner; with an icon it is the hidden control the label\n activates. */}\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n className={\n hasIcon\n ? \"sr-only\"\n : cn(\n \"bg-pho-primary ring-pho-primary text-pho-on-brand mt-0.5 mr-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm ring-1 ring-inset\",\n \"group-hover:bg-pho-primary-hover group-hover:ring-pho-ink transition-[background-color,box-shadow,color] duration-150 ease-out\",\n \"data-[checked]:bg-pho-brand-solid data-[checked]:group-hover:bg-pho-brand-solid-hover data-[checked]:ring-transparent\",\n \"data-[indeterminate]:bg-pho-brand-solid data-[indeterminate]:group-hover:bg-pho-brand-solid-hover data-[indeterminate]:ring-transparent\",\n )\n }\n {...props}\n >\n {hasIcon ? null : (\n <BaseCheckbox.Indicator\n className={cn(\n \"flex items-center justify-center transition-opacity duration-100 ease-out\",\n \"data-[ending-style]:opacity-0\",\n )}\n >\n <DrawnCheckGlyph\n indeterminate={indeterminate}\n className=\"size-2.5\"\n />\n </BaseCheckbox.Indicator>\n )}\n </BaseCheckbox.Root>\n </motion.label>\n );\n}\n\nCheckboxCard.displayName = \"CheckboxCard\";\n"],"mappings":";;;;;;;;;AAOA,IAAM,IAAa,oBACb,IAAa,cAEb,IAAkB;AAAA,EAAE,UAAU;AAAA,EAAM,MAAM;AAAU;AAQ1D,SAAgB,EAAgB,EAC9B,eAAA,GACA,WAAA,EAAA,GAIC;AACD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAa;AAAA,IACb,eAAc;AAAA,IACd,gBAAe;AAAA,IACJ,WAAA;AAAA,IACX,eAAY;AAAA,IAEZ,UAAA,gBAAA,EAAC,EAAO,MAAR;AAAA,MAEE,GAAG,IAAgB,IAAa;AAAA,MAChC,SAAS,EAAE,YAAY,EAAE;AAAA,MACzB,SAAS,EAAE,YAAY,EAAE;AAAA,MACzB,YAAY;AAAA,IACb,GALM,IAAgB,UAAU,OAKhC;AAAA,EACE,CAAA;AAET;ACpCA,IAAM,IAAoC;AAAA,EAAE,IAAI;AAAA,EAAU,IAAI;AAAS,GACjE,IAAqC;AAAA,EAAE,IAAI;AAAA,EAAU,IAAI;AAAW;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c"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as m } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import { n as se } from "./link-provider-DXzDQ08N.js";
|
|
4
|
+
import { SPRING_ENTRANCE as ae } from "../motion.js";
|
|
5
|
+
import { t as K } from "./createReactComponent-BqCmnqfX.js";
|
|
6
|
+
import { t as ie } from "./IconChevronDown-CZilB71T.js";
|
|
7
|
+
import { t as ce } from "./IconSearch-BKAHkLyX.js";
|
|
8
|
+
import { t as ue } from "./animated-height-CCO-Ocoz.js";
|
|
9
|
+
import { t as de } from "./skeleton-DwjSl4vC.js";
|
|
10
|
+
import { r as $ } from "./checkbox-CznlNhDY.js";
|
|
11
|
+
import { Fragment as pe, createContext as V, useContext as q, useEffect as me, useLayoutEffect as Q, useMemo as he, useState as T, useSyncExternalStore as fe } from "react";
|
|
12
|
+
import { Fragment as J, jsx as t, jsxs as p } from "react/jsx-runtime";
|
|
13
|
+
import { FlexRender as F, columnFilteringFeature as ge, createColumnHelper as be, createFilteredRowModel as xe, createSortedRowModel as Se, filterFn_includesString as ve, globalFilteringFeature as ye, rowSelectionFeature as we, rowSortingFeature as Ce, sortFn_alphanumeric as Ne, sortFn_basic as Fe, sortFn_datetime as Re, sortFn_text as ke, tableFeatures as _e, useTable as Me } from "@tanstack/react-table";
|
|
14
|
+
var Ee = [["path", {
|
|
15
|
+
d: "M6 15l6 -6l6 6",
|
|
16
|
+
key: "svg-0"
|
|
17
|
+
}]], Te = K("outline", "chevron-up", "ChevronUp", Ee), Ae = [["path", {
|
|
18
|
+
d: "M8 9l4 -4l4 4",
|
|
19
|
+
key: "svg-0"
|
|
20
|
+
}], ["path", {
|
|
21
|
+
d: "M16 15l-4 4l-4 -4",
|
|
22
|
+
key: "svg-1"
|
|
23
|
+
}]], Ie = K("outline", "selector", "Selector", Ae), Le = _e({
|
|
24
|
+
rowSortingFeature: Ce,
|
|
25
|
+
rowSelectionFeature: we,
|
|
26
|
+
columnFilteringFeature: ge,
|
|
27
|
+
globalFilteringFeature: ye,
|
|
28
|
+
sortedRowModel: Se(),
|
|
29
|
+
filteredRowModel: xe(),
|
|
30
|
+
filterFns: { includesString: ve },
|
|
31
|
+
sortFns: {
|
|
32
|
+
alphanumeric: Ne,
|
|
33
|
+
basic: Fe,
|
|
34
|
+
datetime: Re,
|
|
35
|
+
text: ke
|
|
36
|
+
},
|
|
37
|
+
columnMeta: {}
|
|
38
|
+
});
|
|
39
|
+
function De() {
|
|
40
|
+
return be();
|
|
41
|
+
}
|
|
42
|
+
var ze = De().display({
|
|
43
|
+
id: "select",
|
|
44
|
+
enableSorting: !1,
|
|
45
|
+
header: ({ table: o }) => {
|
|
46
|
+
const l = o.getRowModel().rows, i = l.filter((c) => c.getIsSelected()).length, a = l.length > 0 && i === l.length;
|
|
47
|
+
return /* @__PURE__ */ t($, {
|
|
48
|
+
size: "sm",
|
|
49
|
+
"aria-label": "Select all",
|
|
50
|
+
checked: a,
|
|
51
|
+
indeterminate: i > 0 && !a,
|
|
52
|
+
onCheckedChange: (c) => {
|
|
53
|
+
o.setRowSelection((h) => {
|
|
54
|
+
const f = { ...h };
|
|
55
|
+
for (const x of l) c === !0 ? f[x.id] = !0 : delete f[x.id];
|
|
56
|
+
return f;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
cell: ({ row: o }) => /* @__PURE__ */ t("span", {
|
|
62
|
+
className: "relative z-10 flex",
|
|
63
|
+
children: /* @__PURE__ */ t($, {
|
|
64
|
+
size: "sm",
|
|
65
|
+
"aria-label": "Select row",
|
|
66
|
+
checked: o.getIsSelected(),
|
|
67
|
+
onCheckedChange: (l) => o.toggleSelected(l === !0)
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}), Oe = V(null);
|
|
71
|
+
function ot() {
|
|
72
|
+
let o = {
|
|
73
|
+
api: null,
|
|
74
|
+
adopted: !1
|
|
75
|
+
};
|
|
76
|
+
const l = /* @__PURE__ */ new Set(), i = () => {
|
|
77
|
+
for (const a of l) a();
|
|
78
|
+
};
|
|
79
|
+
return {
|
|
80
|
+
get: () => o,
|
|
81
|
+
subscribe(a) {
|
|
82
|
+
return l.add(a), () => l.delete(a);
|
|
83
|
+
},
|
|
84
|
+
publish(a) {
|
|
85
|
+
o = {
|
|
86
|
+
...o,
|
|
87
|
+
api: a
|
|
88
|
+
}, i();
|
|
89
|
+
},
|
|
90
|
+
adopt(a) {
|
|
91
|
+
o = {
|
|
92
|
+
...o,
|
|
93
|
+
adopted: a
|
|
94
|
+
}, i();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
var Ue = V(null), je = () => () => {
|
|
99
|
+
};
|
|
100
|
+
function He({ value: o, onChange: l, className: i, ...a }) {
|
|
101
|
+
return /* @__PURE__ */ p("label", {
|
|
102
|
+
className: m("flex min-w-40 flex-1 items-center gap-2", i),
|
|
103
|
+
children: [/* @__PURE__ */ t(ce, {
|
|
104
|
+
"aria-hidden": !0,
|
|
105
|
+
className: "text-pho-description size-4 shrink-0"
|
|
106
|
+
}), /* @__PURE__ */ t("input", {
|
|
107
|
+
type: "search",
|
|
108
|
+
value: o,
|
|
109
|
+
onChange: (c) => l(c.target.value),
|
|
110
|
+
className: "text-pho-primary placeholder:text-pho-description outline-pho-brand w-full min-w-0 rounded-sm bg-transparent text-sm focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
111
|
+
...a
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
var Ge = "rounded-base border border-pho-secondary bg-pho-primary", Pe = 5;
|
|
116
|
+
function Be(o, l) {
|
|
117
|
+
const i = o?.id;
|
|
118
|
+
return String(typeof i == "string" || typeof i == "number" ? i : l);
|
|
119
|
+
}
|
|
120
|
+
function rt({ columns: o, data: l, getRowId: i, rowHref: a, current: c, selected: h, onSelectedChange: f, defaultSort: x, sort: A, onSortChange: W, search: S, toolbar: I, group: R, animateHeight: L, loading: b, empty: X = "Nothing here yet.", className: Y, ...Z }) {
|
|
121
|
+
const ee = se(), v = q(Oe), u = S === !0 || typeof S == "string", [g, k] = T(""), y = typeof S == "string" ? S : "Search", d = q(Ue), D = fe(d?.subscribe ?? je, () => d?.get().adopted ?? !1, () => !1);
|
|
122
|
+
Q(() => {
|
|
123
|
+
if (v != null)
|
|
124
|
+
return v(!0), () => v(!1);
|
|
125
|
+
}, [v]);
|
|
126
|
+
const w = h != null || f != null, [te, ne] = T({}), z = h != null ? Object.fromEntries(h.map((e) => [e, !0])) : te, [oe, re] = T(x ?? []), O = A ?? oe, C = Me({
|
|
127
|
+
features: Le,
|
|
128
|
+
columns: w ? [ze, ...o] : o,
|
|
129
|
+
data: l,
|
|
130
|
+
getRowId: i ? (e) => i(e) : Be,
|
|
131
|
+
state: {
|
|
132
|
+
sorting: O,
|
|
133
|
+
...u ? { globalFilter: g } : {},
|
|
134
|
+
...w ? { rowSelection: z } : {}
|
|
135
|
+
},
|
|
136
|
+
...w ? {
|
|
137
|
+
enableRowSelection: !0,
|
|
138
|
+
onRowSelectionChange: (e) => {
|
|
139
|
+
const n = typeof e == "function" ? e(z) : e;
|
|
140
|
+
h == null && ne(n), f?.(Object.keys(n));
|
|
141
|
+
}
|
|
142
|
+
} : {},
|
|
143
|
+
...u ? {
|
|
144
|
+
onGlobalFilterChange: k,
|
|
145
|
+
globalFilterFn: "includesString"
|
|
146
|
+
} : {},
|
|
147
|
+
onSortingChange: (e) => {
|
|
148
|
+
const n = typeof e == "function" ? e(O) : e;
|
|
149
|
+
A == null && re(n), W?.(n);
|
|
150
|
+
}
|
|
151
|
+
}), N = C.getRowModel().rows, _ = l.length, U = u ? N.length : _;
|
|
152
|
+
Q(() => {
|
|
153
|
+
!u || d == null || d.publish({
|
|
154
|
+
placeholder: y,
|
|
155
|
+
query: g,
|
|
156
|
+
setQuery: k,
|
|
157
|
+
matched: U,
|
|
158
|
+
total: _
|
|
159
|
+
});
|
|
160
|
+
}, [
|
|
161
|
+
u,
|
|
162
|
+
d,
|
|
163
|
+
y,
|
|
164
|
+
g,
|
|
165
|
+
U,
|
|
166
|
+
_
|
|
167
|
+
]), me(() => {
|
|
168
|
+
if (d != null)
|
|
169
|
+
return () => d.publish(null);
|
|
170
|
+
}, [d]);
|
|
171
|
+
const j = C.getAllLeafColumns().length, H = he(() => b ? Array.from({ length: b === !0 ? Pe : b }) : [], [b]), G = (e) => {
|
|
172
|
+
const n = a?.(e.original), s = c != null && c === e.id;
|
|
173
|
+
return /* @__PURE__ */ t("tr", {
|
|
174
|
+
className: m("relative", n != null && "hover:bg-pho-primary-hover outline-pho-brand transition-colors has-[a:focus-visible]:outline-2 has-[a:focus-visible]:-outline-offset-2", (s || e.getIsSelected()) && "bg-pho-primary-hover"),
|
|
175
|
+
children: e.getAllCells().map((r, E) => {
|
|
176
|
+
const le = r.column.columnDef.meta?.align ?? "start";
|
|
177
|
+
return /* @__PURE__ */ t("td", {
|
|
178
|
+
className: m("text-pho-primary h-12 px-5 align-middle whitespace-nowrap", le === "end" && "text-right tabular-nums"),
|
|
179
|
+
children: E === (w ? 1 : 0) && n != null ? /* @__PURE__ */ t(ee, {
|
|
180
|
+
href: n,
|
|
181
|
+
"aria-current": s ? "page" : void 0,
|
|
182
|
+
className: "outline-none after:absolute after:inset-0 after:content-['']",
|
|
183
|
+
children: /* @__PURE__ */ t(F, { cell: r })
|
|
184
|
+
}) : /* @__PURE__ */ t(F, { cell: r })
|
|
185
|
+
}, r.id);
|
|
186
|
+
})
|
|
187
|
+
}, e.id);
|
|
188
|
+
};
|
|
189
|
+
let M = N, P = [];
|
|
190
|
+
if (R != null) {
|
|
191
|
+
M = [];
|
|
192
|
+
const e = /* @__PURE__ */ new Map(), n = [];
|
|
193
|
+
for (const s of l) {
|
|
194
|
+
const r = R(s);
|
|
195
|
+
r != null && !e.has(r) && (e.set(r, []), n.push(r));
|
|
196
|
+
}
|
|
197
|
+
for (const s of N) {
|
|
198
|
+
const r = R(s.original);
|
|
199
|
+
r == null ? M.push(s) : (e.has(r) || (e.set(r, []), n.push(r)), e.get(r).push(s));
|
|
200
|
+
}
|
|
201
|
+
P = n.map((s) => [s, e.get(s)]).filter(([, s]) => s.length > 0);
|
|
202
|
+
}
|
|
203
|
+
const B = /* @__PURE__ */ p("table", {
|
|
204
|
+
className: "w-full border-collapse text-sm",
|
|
205
|
+
"aria-busy": b ? !0 : void 0,
|
|
206
|
+
children: [/* @__PURE__ */ t("thead", { children: C.getHeaderGroups().map((e) => /* @__PURE__ */ t("tr", { children: e.headers.map((n) => {
|
|
207
|
+
const s = n.column.columnDef.meta?.align ?? "start", r = n.column.getIsSorted(), E = !n.isPlaceholder && n.column.getCanSort();
|
|
208
|
+
return /* @__PURE__ */ t("th", {
|
|
209
|
+
scope: "col",
|
|
210
|
+
colSpan: n.colSpan,
|
|
211
|
+
"aria-sort": r === "asc" ? "ascending" : r === "desc" ? "descending" : void 0,
|
|
212
|
+
className: m("text-pho-description h-10 px-5 text-left align-middle font-normal whitespace-nowrap", s === "end" && "text-right"),
|
|
213
|
+
children: n.isPlaceholder ? null : E ? /* @__PURE__ */ p("button", {
|
|
214
|
+
type: "button",
|
|
215
|
+
onClick: n.column.getToggleSortingHandler(),
|
|
216
|
+
className: m("group/sort outline-pho-brand hover:text-pho-primary -mx-1 inline-flex items-center gap-1 rounded-sm px-1 transition-colors focus-visible:outline-2", s === "end" && "flex-row-reverse", r && "text-pho-primary"),
|
|
217
|
+
children: [/* @__PURE__ */ t(F, { header: n }), /* @__PURE__ */ t($e, { sorted: r })]
|
|
218
|
+
}) : /* @__PURE__ */ t(F, { header: n })
|
|
219
|
+
}, n.id);
|
|
220
|
+
}) }, e.id)) }), /* @__PURE__ */ t("tbody", {
|
|
221
|
+
className: "divide-pho-secondary border-pho-secondary divide-y border-t",
|
|
222
|
+
children: H.length > 0 ? H.map((e, n) => /* @__PURE__ */ t("tr", { children: C.getAllLeafColumns().map((s) => /* @__PURE__ */ t("td", {
|
|
223
|
+
className: "h-12 px-5 align-middle",
|
|
224
|
+
children: /* @__PURE__ */ t(de, { className: m("h-3.5 w-24", s.columnDef.meta?.align === "end" && "ml-auto") })
|
|
225
|
+
}, s.id)) }, n)) : N.length === 0 ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ t("td", {
|
|
226
|
+
colSpan: j,
|
|
227
|
+
className: "text-pho-description px-5 py-10 text-center",
|
|
228
|
+
children: u && g !== "" && l.length > 0 ? /* @__PURE__ */ p(J, { children: [
|
|
229
|
+
"Nothing matches “",
|
|
230
|
+
g,
|
|
231
|
+
"”."
|
|
232
|
+
] }) : X
|
|
233
|
+
}) }) : /* @__PURE__ */ p(J, { children: [M.map(G), P.map(([e, n]) => /* @__PURE__ */ p(pe, { children: [/* @__PURE__ */ t("tr", {
|
|
234
|
+
"data-table-group": "",
|
|
235
|
+
children: /* @__PURE__ */ t("td", {
|
|
236
|
+
colSpan: j,
|
|
237
|
+
className: "bg-pho-page text-pho-description h-9 px-5 align-middle text-xs font-medium",
|
|
238
|
+
children: e
|
|
239
|
+
})
|
|
240
|
+
}), n.map(G)] }, e))] })
|
|
241
|
+
})]
|
|
242
|
+
});
|
|
243
|
+
return /* @__PURE__ */ p("div", {
|
|
244
|
+
"data-data-table": "",
|
|
245
|
+
className: m(Ge, "scroll-mt-12 contain-inline-size", !L && "overflow-x-auto", Y),
|
|
246
|
+
...Z,
|
|
247
|
+
children: [(I != null || u && !D) && /* @__PURE__ */ p("div", {
|
|
248
|
+
className: "border-pho-secondary flex min-h-11 flex-wrap items-center gap-x-4 gap-y-1 border-b px-5 py-2",
|
|
249
|
+
children: [u && !D && /* @__PURE__ */ t(He, {
|
|
250
|
+
value: g,
|
|
251
|
+
onChange: k,
|
|
252
|
+
placeholder: y,
|
|
253
|
+
"aria-label": y
|
|
254
|
+
}), I]
|
|
255
|
+
}), L ? /* @__PURE__ */ t(ue, {
|
|
256
|
+
transition: ae,
|
|
257
|
+
className: "overflow-x-auto",
|
|
258
|
+
children: B
|
|
259
|
+
}) : B]
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
function $e({ sorted: o }) {
|
|
263
|
+
return /* @__PURE__ */ t("span", {
|
|
264
|
+
"aria-hidden": !0,
|
|
265
|
+
className: m("inline-flex shrink-0 [&>svg]:size-3.5", !o && "opacity-0 transition-opacity group-hover/sort:opacity-100 group-focus-visible/sort:opacity-100"),
|
|
266
|
+
children: o === "asc" ? /* @__PURE__ */ t(Te, {}) : o === "desc" ? /* @__PURE__ */ t(ie, {}) : /* @__PURE__ */ t(Ie, {})
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
export {
|
|
270
|
+
Ue as a,
|
|
271
|
+
Oe as i,
|
|
272
|
+
rt as n,
|
|
273
|
+
De as o,
|
|
274
|
+
He as r,
|
|
275
|
+
ot as s,
|
|
276
|
+
Ge as t
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
//# sourceMappingURL=data-table-Cmz0p-jt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table-Cmz0p-jt.js","names":["__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconChevronUp.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.46.0_react@19.2.8/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.mjs","../../src/components/data-table/data-table.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M6 15l6 -6l6 6\", \"key\": \"svg-0\" }]];\nconst IconChevronUp = createReactComponent(\"outline\", \"chevron-up\", \"ChevronUp\", __iconNode);\n\nexport { __iconNode, IconChevronUp as default };\n//# sourceMappingURL=IconChevronUp.mjs.map\n","/**\n * @license @tabler/icons-react v3.46.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M8 9l4 -4l4 4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M16 15l-4 4l-4 -4\", \"key\": \"svg-1\" }]];\nconst IconSelector = createReactComponent(\"outline\", \"selector\", \"Selector\", __iconNode);\n\nexport { __iconNode, IconSelector as default };\n//# sourceMappingURL=IconSelector.mjs.map\n","import {\n createContext,\n Fragment,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n columnFilteringFeature,\n createColumnHelper,\n createFilteredRowModel,\n createSortedRowModel,\n filterFn_includesString,\n FlexRender,\n globalFilteringFeature,\n rowSelectionFeature,\n rowSortingFeature,\n sortFn_alphanumeric,\n sortFn_basic,\n sortFn_datetime,\n sortFn_text,\n tableFeatures,\n useTable,\n type ColumnDef,\n type RowData,\n type SortingState,\n} from \"@tanstack/react-table\";\nimport {\n IconChevronDown,\n IconChevronUp,\n IconSearch,\n IconSelector,\n} from \"@tabler/icons-react\";\nimport { Skeleton } from \"../skeleton\";\nimport { Checkbox } from \"../checkbox\";\nimport { SPRING_ENTRANCE } from \"../../motion\";\nimport { AnimatedHeight } from \"../../utils/animated-height\";\nimport { cn } from \"../../utils/cn\";\nimport { useLinkComponent } from \"../../utils/link-provider\";\n\n/**\n * DataTable — a table of records with column semantics: sortable headers,\n * aligned cells, rows that are links into a subpage. TanStack Table (v9)\n * does the thinking — column defs, sorting, row identity — and renders\n * nothing; every pixel here is Pho's.\n *\n * Design notes:\n * - The surface is `BasicPage.Card`'s: hairline border, `base` radius, the\n * page's primary fill, hairline rules between rows. A table is a card of\n * rows that happen to line up in columns, so it sits in a page's `Stack`\n * as any card does.\n * - Header cells are description ink at body size — never small caps, never\n * bold. Hierarchy comes from ink alone; the header is a label row, not a\n * banner.\n * - A sortable header is a button inside the cell: the label and its\n * indicator (`IconSelector` at rest, a chevron once sorted). `aria-sort`\n * sits on the `th`.\n * - Rows that navigate stretch one link across the row (the first cell's\n * link, extended with a pseudo-element), so the whole row is one target\n * for pointer and one stop for keyboard. Hover washes the row; the row\n * whose page is open beside the table (`current`) keeps the wash — the\n * same cue `BasicPage.RowLink` gives under `aria-current`.\n * - Numbers align to the end with tabular figures (`meta.align: \"end\"`).\n * - `search` is one box over every column — plain contains matching, and\n * the body says when nothing matches. In a page, `BasicPage.Search` in\n * the section header adopts the box; alone, the table keeps one in a\n * toolbar row inside its frame. Server-side search keeps its own box\n * outside.\n * - A wide table scrolls sideways inside its own frame; the page never does.\n * `contain: inline-size` keeps the table's intrinsic width out of the\n * page's — a host that sizes to content (a scroll area's fit-content\n * pane, a grid's auto column) would otherwise grow to the widest row.\n *\n * Reach for it when a list needs column semantics — sorting, aligned\n * figures, several fields side by side. A list where each row is one\n * label and a chevron stays `BasicPage.RowLink`.\n */\n\n/** Column metadata a `DataTable` understands. */\nexport interface DataTableColumnMeta {\n /** Cell alignment — `end` for figures (right-aligned, tabular). */\n align?: \"start\" | \"end\";\n}\n\n/**\n * The feature set every `DataTable` runs on — sorting with the stock sort\n * functions, the column meta above. Fixed, so column definitions written\n * once fit every table.\n */\nconst features = tableFeatures({\n rowSortingFeature,\n rowSelectionFeature,\n columnFilteringFeature,\n globalFilteringFeature,\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n filterFns: { includesString: filterFn_includesString },\n sortFns: {\n alphanumeric: sortFn_alphanumeric,\n basic: sortFn_basic,\n datetime: sortFn_datetime,\n text: sortFn_text,\n },\n columnMeta: {} as DataTableColumnMeta,\n});\n\nexport type DataTableFeatures = typeof features;\n\n/** A column definition for a `DataTable` of `TData` rows. */\nexport type DataTableColumn<\n TData extends RowData,\n TValue = unknown,\n> = ColumnDef<DataTableFeatures, TData, TValue>;\n\n/**\n * The column helper, bound to the table's feature set — `accessor`,\n * `display`, `group`, and `columns` to collect them with their types\n * intact.\n *\n * @example\n * const col = createColumns<Request>();\n * const columns = col.columns([\n * col.accessor(\"actor\", { header: \"Actor\" }),\n * col.accessor(\"amount\", { header: \"Amount\", meta: { align: \"end\" } }),\n * ]);\n */\nexport function createColumns<TData extends RowData>() {\n return createColumnHelper<DataTableFeatures, TData>();\n}\n\n/**\n * The leading checkbox column selection adds. The header checkbox works\n * the visible set: everything the search still shows toggles together,\n * while rows selected earlier and then hidden stay selected.\n */\nconst SELECT_COLUMN = createColumns<RowData>().display({\n id: \"select\",\n enableSorting: false,\n header: ({ table }) => {\n const visible = table.getRowModel().rows;\n const chosen = visible.filter((row) => row.getIsSelected()).length;\n const all = visible.length > 0 && chosen === visible.length;\n return (\n <Checkbox\n size=\"sm\"\n aria-label=\"Select all\"\n checked={all}\n indeterminate={chosen > 0 && !all}\n onCheckedChange={(checked) => {\n table.setRowSelection((old) => {\n const next = { ...old };\n for (const row of visible) {\n if (checked === true) next[row.id] = true;\n else delete next[row.id];\n }\n return next;\n });\n }}\n />\n );\n },\n cell: ({ row }) => (\n // Above a row link's stretched overlay — the box stays clickable.\n // `relative` alone makes no stacking context; without `z-10` the\n // overlay's ::after paints later and eats the click.\n <span className=\"relative z-10 flex\">\n <Checkbox\n size=\"sm\"\n aria-label=\"Select row\"\n checked={row.getIsSelected()}\n onCheckedChange={(checked) => row.toggleSelected(checked === true)}\n />\n </span>\n ),\n});\n\nexport interface DataTableProps<TData extends RowData> extends Omit<\n ComponentProps<\"div\">,\n \"children\"\n> {\n columns: ReadonlyArray<DataTableColumn<TData, any>>;\n data: ReadonlyArray<TData>;\n /**\n * A row's identity — what `current` is matched against, and what keeps a\n * row itself across sorts. Defaults to the row's `id` field, else its\n * index.\n */\n getRowId?: (row: TData) => string;\n /**\n * Rows that navigate: each row is one link into a subpage, through the\n * host's `LinkProvider`. Beside a `BasicPage.Aside`, the subpage opens\n * next to the table. Return nothing for a row with no page yet (one\n * still in flight) and that row stays plain.\n */\n rowHref?: (row: TData) => string | null | undefined;\n /** The row whose page is open (its id) — it keeps the wash. */\n current?: string | null;\n /**\n * Sorting is on for every accessor column (`enableSorting: false` on a\n * column turns it off there). Uncontrolled by default; `defaultSort`\n * seeds it. Pass `sort` with `onSortChange` to own it — the way to sort\n * on the server.\n */\n defaultSort?: SortingState;\n sort?: SortingState;\n onSortChange?: (sort: SortingState) => void;\n /**\n * A search box on the table — `true`, or the placeholder it should\n * show. One box searches every column (a column opts out with\n * `enableGlobalFilter: false`); matching is a plain case-insensitive\n * contains, on the client. With no matches the body says so. When the\n * list doesn't all come down, keep the box outside and ask the server.\n */\n search?: boolean | string;\n /**\n * Controls in the frame's top band — a `BasicPage.Search` first, then a\n * filter or two. The band is part of the table (one surface, a hairline\n * above the header row), so nothing floats over the page and the\n * spacing above and below is the frame's own. A `Search` here adopts\n * the table's box the way a header one does.\n */\n toolbar?: ReactNode;\n /**\n * Row selection: hand either of these and rows grow a leading checkbox\n * column. The header checkbox works the visible set — everything the\n * search still shows — so select-all after a search means what it says;\n * rows selected earlier and then hidden stay selected. `selected` is\n * the selected ids (ids come from `getRowId`; pair with\n * `onSelectedChange` to own the state); `onSelectedChange` alone\n * listens while the table keeps it. The page renders its own bulk\n * actions from the ids — the table only keeps the score.\n */\n selected?: readonly string[];\n onSelectedChange?: (ids: string[]) => void;\n /**\n * File rows into labeled groups: return a label and the row renders\n * under it, `null` and it stays in the main body. Groups follow the\n * main body, in the order their labels first appear in `data`, each\n * under a quiet label row — and only while they have rows, so a group\n * a search empties simply leaves. Sorting orders rows within their\n * group.\n */\n group?: (row: TData) => string | null;\n /**\n * Glide the frame's height when the rows change — a search narrowing,\n * a filter, bones becoming rows. The height follows the content on the\n * page spring instead of jumping; reserve it for tables whose rows\n * change while mounted (same contract as `BasicPage.Card`'s).\n */\n animateHeight?: boolean;\n /** Bones while the rows are on their way — `true` for five, or a count. */\n loading?: boolean | number;\n /** What the body says when there are no rows. */\n empty?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/**\n * A host that sizes itself around tables provides this; each table\n * announces itself while mounted. `BasicPage.Root` runs wide when the\n * page carries one and `width` was left unsaid.\n */\nexport const TableHostContext = createContext<\n ((present: boolean) => void) | null\n>(null);\n\n/** A searchable table's search, published for a header to adopt. */\nexport interface TableSearchApi {\n placeholder: string;\n query: string;\n setQuery: (query: string) => void;\n /** Rows still showing after the current query. */\n matched: number;\n /** Rows in the list, before search. */\n total: number;\n}\n\ninterface TableSearchState {\n api: TableSearchApi | null;\n adopted: boolean;\n}\n\n/**\n * The channel between a searchable table and a `BasicPage.Search` placed\n * in a section header: the table publishes its search (placeholder,\n * query, the setter); a mounted `Search` adopts it, and the table's own\n * box yields. Provided by `BasicPage.Root`; a table outside any page\n * keeps its built-in box. One searchable table per page — a later\n * publisher takes the slot.\n */\nexport interface TableSearchStore {\n get: () => TableSearchState;\n subscribe: (listener: () => void) => () => void;\n publish: (api: TableSearchApi | null) => void;\n adopt: (adopted: boolean) => void;\n}\n\nexport function createTableSearchStore(): TableSearchStore {\n let state: TableSearchState = { api: null, adopted: false };\n const listeners = new Set<() => void>();\n const emit = () => {\n for (const listener of listeners) listener();\n };\n return {\n get: () => state,\n subscribe(listener) {\n listeners.add(listener);\n return () => listeners.delete(listener);\n },\n publish(api) {\n state = { ...state, api };\n emit();\n },\n adopt(adopted) {\n state = { ...state, adopted };\n emit();\n },\n };\n}\n\nexport const TableSearchContext = createContext<TableSearchStore | null>(null);\n\nconst subscribeToNothing = () => () => {};\n\nexport interface GhostSearchProps extends Omit<\n ComponentProps<\"input\">,\n \"value\" | \"onChange\" | \"type\" | \"children\"\n> {\n value: string;\n onChange: (value: string) => void;\n}\n\n/**\n * The search's ghost face — a magnifier and a bare field, quiet ink on a\n * text line, no box around it. What a table wears in its own toolbar\n * band; `BasicPage.Search variant=\"ghost\"` is the same face wherever a\n * page wants it. Presentational: hand it the value and the setter.\n */\nexport function GhostSearch({\n value,\n onChange,\n className,\n ...props\n}: GhostSearchProps) {\n return (\n <label className={cn(\"flex min-w-40 flex-1 items-center gap-2\", className)}>\n <IconSearch\n aria-hidden\n className=\"text-pho-description size-4 shrink-0\"\n />\n <input\n type=\"search\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n className=\"text-pho-primary placeholder:text-pho-description outline-pho-brand w-full min-w-0 rounded-sm bg-transparent text-sm focus-visible:outline-2 focus-visible:outline-offset-2\"\n {...props}\n />\n </label>\n );\n}\n\n/** Same chrome as `BasicPage.Card`, minus its dividers — rows draw their own. */\nconst DATA_TABLE_SURFACE =\n \"rounded-base border border-pho-secondary bg-pho-primary\";\n\nconst DEFAULT_BONES = 5;\n\nfunction defaultRowId(row: unknown, index: number): string {\n const id = (row as { id?: unknown } | null)?.id;\n return typeof id === \"string\" || typeof id === \"number\"\n ? String(id)\n : String(index);\n}\n\nfunction DataTable<TData extends RowData>({\n columns,\n data,\n getRowId,\n rowHref,\n current,\n selected,\n onSelectedChange,\n defaultSort,\n sort,\n onSortChange,\n search,\n toolbar,\n group,\n animateHeight,\n loading,\n empty = \"Nothing here yet.\",\n className,\n ...props\n}: DataTableProps<TData>) {\n const Link = useLinkComponent();\n const announce = useContext(TableHostContext);\n const searching = search === true || typeof search === \"string\";\n const [query, setQuery] = useState(\"\");\n const placeholder = typeof search === \"string\" ? search : \"Search\";\n // A `BasicPage.Search` in a section header adopts the box; the table\n // then renders no toolbar of its own.\n const searchStore = useContext(TableSearchContext);\n const adopted = useSyncExternalStore(\n searchStore?.subscribe ?? subscribeToNothing,\n () => searchStore?.get().adopted ?? false,\n () => false,\n );\n useLayoutEffect(() => {\n if (announce == null) return;\n announce(true);\n return () => announce(false);\n }, [announce]);\n const selecting = selected != null || onSelectedChange != null;\n const [ownSelection, setOwnSelection] = useState<Record<string, true>>({});\n const rowSelection: Record<string, true> =\n selected != null\n ? Object.fromEntries(selected.map((id) => [id, true as const]))\n : ownSelection;\n // Sorting mirrors selection: the component always owns a fallback state,\n // so `defaultSort` + `onSortChange` without `sort` still sorts — a custom\n // `onSortingChange` replaces the table's own updater entirely.\n const [ownSort, setOwnSort] = useState<SortingState>(defaultSort ?? []);\n const sorting: SortingState = sort ?? ownSort;\n const table = useTable<DataTableFeatures, TData>({\n features,\n columns: (selecting\n ? [SELECT_COLUMN as DataTableColumn<TData, any>, ...columns]\n : columns) as Array<DataTableColumn<TData, any>>,\n data: data as Array<TData>,\n getRowId: getRowId ? (row) => getRowId(row) : defaultRowId,\n // Keys only when meant: a present-but-undefined slice of `state` reads\n // as \"controlled, with nobody listening\".\n state: {\n sorting,\n ...(searching ? { globalFilter: query } : {}),\n ...(selecting ? { rowSelection } : {}),\n },\n ...(selecting\n ? {\n enableRowSelection: true,\n onRowSelectionChange: (\n updater:\n | Record<string, true>\n | ((old: Record<string, true>) => Record<string, true>),\n ) => {\n const next =\n typeof updater === \"function\" ? updater(rowSelection) : updater;\n if (selected == null) setOwnSelection(next);\n onSelectedChange?.(Object.keys(next));\n },\n }\n : {}),\n ...(searching\n ? {\n onGlobalFilterChange: setQuery,\n globalFilterFn: \"includesString\" as const,\n }\n : {}),\n onSortingChange: (\n updater: SortingState | ((prev: SortingState) => SortingState),\n ) => {\n const next = typeof updater === \"function\" ? updater(sorting) : updater;\n if (sort == null) setOwnSort(next);\n onSortChange?.(next);\n },\n });\n const rows = table.getRowModel().rows;\n const total = data.length;\n const matched = searching ? rows.length : total;\n useLayoutEffect(() => {\n if (!searching || searchStore == null) return;\n searchStore.publish({ placeholder, query, setQuery, matched, total });\n }, [searching, searchStore, placeholder, query, matched, total]);\n useEffect(() => {\n if (searchStore == null) return;\n return () => searchStore.publish(null);\n }, [searchStore]);\n const leafCount = table.getAllLeafColumns().length;\n const bones = useMemo(\n () =>\n loading\n ? Array.from({ length: loading === true ? DEFAULT_BONES : loading })\n : [],\n [loading],\n );\n\n const renderRow = (row: (typeof rows)[number]) => {\n const href = rowHref?.(row.original);\n const isCurrent = current != null && current === row.id;\n return (\n <tr\n key={row.id}\n className={cn(\n \"relative\",\n href != null &&\n \"hover:bg-pho-primary-hover outline-pho-brand transition-colors has-[a:focus-visible]:outline-2 has-[a:focus-visible]:-outline-offset-2\",\n (isCurrent || row.getIsSelected()) && \"bg-pho-primary-hover\",\n )}\n >\n {row.getAllCells().map((cell, index) => {\n const align = cell.column.columnDef.meta?.align ?? \"start\";\n return (\n <td\n key={cell.id}\n className={cn(\n \"text-pho-primary h-12 px-5 align-middle whitespace-nowrap\",\n align === \"end\" && \"text-right tabular-nums\",\n )}\n >\n {/* The link lives in the first data cell; with selection on,\n cell 0 is the checkbox and must stay outside the anchor. */}\n {index === (selecting ? 1 : 0) && href != null ? (\n // The row's one link, stretched over the row; the\n // ring is the row's (`has-[a:focus-visible]`).\n <Link\n href={href}\n aria-current={isCurrent ? \"page\" : undefined}\n className=\"outline-none after:absolute after:inset-0 after:content-['']\"\n >\n <FlexRender cell={cell} />\n </Link>\n ) : (\n <FlexRender cell={cell} />\n )}\n </td>\n );\n })}\n </tr>\n );\n };\n\n // Partition the (sorted, filtered) rows: the main body, then each\n // labeled group in the order labels first appear in `data`.\n let mainRows = rows;\n let groupSections: Array<[string, typeof rows]> = [];\n if (group != null) {\n mainRows = [];\n const byLabel = new Map<string, typeof rows>();\n const order: string[] = [];\n for (const item of data) {\n const label = group(item);\n if (label != null && !byLabel.has(label)) {\n byLabel.set(label, []);\n order.push(label);\n }\n }\n for (const row of rows) {\n const label = group(row.original);\n if (label == null) {\n mainRows.push(row);\n } else {\n if (!byLabel.has(label)) {\n byLabel.set(label, []);\n order.push(label);\n }\n byLabel.get(label)!.push(row);\n }\n }\n groupSections = order\n .map((label) => [label, byLabel.get(label)!] as [string, typeof rows])\n .filter(([, sectionRows]) => sectionRows.length > 0);\n }\n\n const grid = (\n <table\n className=\"w-full border-collapse text-sm\"\n aria-busy={loading ? true : undefined}\n >\n <thead>\n {table.getHeaderGroups().map((headerGroup) => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n const align = header.column.columnDef.meta?.align ?? \"start\";\n const sorted = header.column.getIsSorted();\n const sortable =\n !header.isPlaceholder && header.column.getCanSort();\n return (\n <th\n key={header.id}\n scope=\"col\"\n colSpan={header.colSpan}\n aria-sort={\n sorted === \"asc\"\n ? \"ascending\"\n : sorted === \"desc\"\n ? \"descending\"\n : undefined\n }\n className={cn(\n \"text-pho-description h-10 px-5 text-left align-middle font-normal whitespace-nowrap\",\n align === \"end\" && \"text-right\",\n )}\n >\n {header.isPlaceholder ? null : sortable ? (\n <button\n type=\"button\"\n onClick={header.column.getToggleSortingHandler()}\n className={cn(\n \"group/sort outline-pho-brand hover:text-pho-primary -mx-1 inline-flex items-center gap-1 rounded-sm px-1 transition-colors focus-visible:outline-2\",\n align === \"end\" && \"flex-row-reverse\",\n sorted && \"text-pho-primary\",\n )}\n >\n <FlexRender header={header} />\n <SortIndicator sorted={sorted} />\n </button>\n ) : (\n <FlexRender header={header} />\n )}\n </th>\n );\n })}\n </tr>\n ))}\n </thead>\n <tbody className=\"divide-pho-secondary border-pho-secondary divide-y border-t\">\n {bones.length > 0 ? (\n bones.map((_, index) => (\n <tr key={index}>\n {table.getAllLeafColumns().map((column) => (\n <td key={column.id} className=\"h-12 px-5 align-middle\">\n <Skeleton\n className={cn(\n \"h-3.5 w-24\",\n column.columnDef.meta?.align === \"end\" && \"ml-auto\",\n )}\n />\n </td>\n ))}\n </tr>\n ))\n ) : rows.length === 0 ? (\n <tr>\n <td\n colSpan={leafCount}\n className=\"text-pho-description px-5 py-10 text-center\"\n >\n {searching && query !== \"\" && data.length > 0 ? (\n <>Nothing matches “{query}”.</>\n ) : (\n empty\n )}\n </td>\n </tr>\n ) : (\n <>\n {mainRows.map(renderRow)}\n {groupSections.map(([label, sectionRows]) => (\n <Fragment key={label}>\n <tr data-table-group=\"\">\n <td\n colSpan={leafCount}\n // A tinted band, not spacing: the wash marks the group\n // off, the height stays compact.\n className=\"bg-pho-page text-pho-description h-9 px-5 align-middle text-xs font-medium\"\n >\n {label}\n </td>\n </tr>\n {sectionRows.map(renderRow)}\n </Fragment>\n ))}\n </>\n )}\n </tbody>\n </table>\n );\n\n return (\n <div\n data-data-table=\"\"\n className={cn(\n DATA_TABLE_SURFACE,\n \"scroll-mt-12 contain-inline-size\",\n !animateHeight && \"overflow-x-auto\",\n className,\n )}\n {...props}\n >\n {(toolbar != null || (searching && !adopted)) && (\n // The toolbar band — table chrome, like the header row: the ghost\n // search on the cells' text line (`px-5`), filters at the end.\n // Quiet ink, no boxes in the box; the hairline below is the only\n // border it brings.\n <div className=\"border-pho-secondary flex min-h-11 flex-wrap items-center gap-x-4 gap-y-1 border-b px-5 py-2\">\n {searching && !adopted && (\n <GhostSearch\n value={query}\n onChange={setQuery}\n placeholder={placeholder}\n aria-label={placeholder}\n />\n )}\n {toolbar}\n </div>\n )}\n {animateHeight ? (\n // The height glides on the page spring while the rows inside swap;\n // sideways scrolling moves onto the measured layer so the frame\n // clips height only.\n <AnimatedHeight\n transition={SPRING_ENTRANCE}\n className=\"overflow-x-auto\"\n >\n {grid}\n </AnimatedHeight>\n ) : (\n grid\n )}\n </div>\n );\n}\n\n/**\n * The sort cue beside a sortable header: the two-way glyph at rest (shown\n * on hover and focus, so a header reads as plain text until it matters), a\n * chevron pointing the way once the column is sorted.\n */\nfunction SortIndicator({ sorted }: { sorted: false | \"asc\" | \"desc\" }) {\n return (\n <span\n aria-hidden\n className={cn(\n \"inline-flex shrink-0 [&>svg]:size-3.5\",\n !sorted &&\n \"opacity-0 transition-opacity group-hover/sort:opacity-100 group-focus-visible/sort:opacity-100\",\n )}\n >\n {sorted === \"asc\" ? (\n <IconChevronUp />\n ) : sorted === \"desc\" ? (\n <IconChevronDown />\n ) : (\n <IconSelector />\n )}\n </span>\n );\n}\n\nexport { DataTable, DATA_TABLE_SURFACE };\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;AASA,IAAMA,KAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;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A,QACC,CAAA;AAAA,MACF,CAAA,GACH,EAAY,IAAI,CAAS,CAClB,EAAA,GAZK,CAYL,CACX,CACD,EAAA,CAAA;AAAA,IAEC,CAAA,CACF;AAAA;AAGT,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,mBAAgB;AAAA,IAChB,WAAW,EACT,IACA,oCACA,CAAC,KAAiB,mBAClB,CACF;AAAA,IACA,GAAI;AAAA,IARN,UAAA,EAUI,KAAW,QAAS,KAAa,CAAC,MAKlC,gBAAA,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAf,UAAA,CACG,KAAa,CAAC,KACb,gBAAA,EAAC,IAAD;AAAA,QACE,OAAO;AAAA,QACP,UAAU;AAAA,QACG,aAAA;AAAA,QACb,cAAY;AAAA,MACb,CAAA,GAEF,CACE;AAAA,IAEN,CAAA,GAAA,IAIC,gBAAA,EAAC,IAAD;AAAA,MACE,YAAY;AAAA,MACZ,WAAU;AAAA,MAET,UAAA;AAAA,IACa,CAAA,IAEhB,CAEC;AAAA;AAET;AAOA,SAAS,GAAc,EAAE,QAAA,EAAA,GAA8C;AACrE,SACE,gBAAA,EAAC,QAAD;AAAA,IACE,eAAA;AAAA,IACA,WAAW,EACT,yCACA,CAAC,KACC,gGACJ;AAAA,IAEC,UAAA,MAAW,QACV,gBAAA,EAAC,IAAD,CAAgB,CAAA,IACd,MAAW,SACb,gBAAA,EAAC,IAAD,CAAkB,CAAA,IAElB,gBAAA,EAAC,IAAD,CAAe,CAAA;AAAA,EAEb,CAAA;AAEV"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var o = Object.defineProperty, v = Object.getOwnPropertyDescriptor, O = Object.getOwnPropertyNames, c = Object.prototype.hasOwnProperty, g = (r, e) => {
|
|
3
|
+
let t = {};
|
|
4
|
+
for (var n in r)
|
|
5
|
+
o(t, n, {
|
|
6
|
+
get: r[n],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return e || o(t, Symbol.toStringTag, { value: "Module" }), t;
|
|
10
|
+
}, _ = (r, e, t, n) => {
|
|
11
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
12
|
+
for (var l = O(e), p = 0, u = l.length, a; p < u; p++)
|
|
13
|
+
a = l[p], !c.call(r, a) && a !== t && o(r, a, {
|
|
14
|
+
get: ((b) => e[b]).bind(null, a),
|
|
15
|
+
enumerable: !(n = v(e, a)) || n.enumerable
|
|
16
|
+
});
|
|
17
|
+
return r;
|
|
18
|
+
}, P = (r, e, t) => (_(r, e, "default"), t && _(t, e, "default"));
|
|
19
|
+
export {
|
|
20
|
+
P as n,
|
|
21
|
+
g as t
|
|
22
|
+
};
|
|
@@ -1,42 +1,101 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import "react";
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { Accordion as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { t as n } from "../chunks/cn-ChIgwEl3.js";
|
|
3
|
+
import { createContext as d, useContext as l } from "react";
|
|
4
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
import { Accordion as s } from "@base-ui/react/accordion";
|
|
6
|
+
var i = {
|
|
7
|
+
sm: {
|
|
8
|
+
item: "py-3",
|
|
9
|
+
hit: "before:-top-3 before:-bottom-3",
|
|
10
|
+
question: "text-base",
|
|
11
|
+
gap: "pt-1",
|
|
12
|
+
answer: "text-xs"
|
|
13
|
+
},
|
|
14
|
+
md: {
|
|
15
|
+
item: "py-4",
|
|
16
|
+
hit: "before:-top-4 before:-bottom-4",
|
|
17
|
+
question: "text-md",
|
|
18
|
+
gap: "pt-1.5",
|
|
19
|
+
answer: "text-base"
|
|
20
|
+
},
|
|
21
|
+
lg: {
|
|
22
|
+
item: "py-5",
|
|
23
|
+
hit: "before:-top-5 before:-bottom-5",
|
|
24
|
+
question: "text-xl leading-7",
|
|
25
|
+
gap: "pt-2",
|
|
26
|
+
answer: "text-lg"
|
|
27
|
+
}
|
|
28
|
+
}, p = d("md");
|
|
29
|
+
function u({ className: e, multiple: t = !0, size: o = "md", ...a }) {
|
|
30
|
+
return /* @__PURE__ */ r(p.Provider, {
|
|
31
|
+
value: o,
|
|
32
|
+
children: /* @__PURE__ */ r(s.Root, {
|
|
33
|
+
multiple: t,
|
|
34
|
+
"data-size": o,
|
|
35
|
+
className: n("w-full", e),
|
|
36
|
+
...a
|
|
37
|
+
})
|
|
10
38
|
});
|
|
11
39
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
className:
|
|
16
|
-
...
|
|
40
|
+
function m({ className: e, ...t }) {
|
|
41
|
+
const o = l(p);
|
|
42
|
+
return /* @__PURE__ */ r(s.Item, {
|
|
43
|
+
className: n("border-pho-secondary -mb-px border-b last:mb-0 last:border-b-0", i[o].item, e),
|
|
44
|
+
...t
|
|
17
45
|
});
|
|
18
46
|
}
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
className:
|
|
22
|
-
...
|
|
47
|
+
function g({ className: e, ...t }) {
|
|
48
|
+
return /* @__PURE__ */ r(s.Header, {
|
|
49
|
+
className: n("flex", e),
|
|
50
|
+
...t
|
|
23
51
|
});
|
|
24
52
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
53
|
+
function f({ className: e, children: t, ...o }) {
|
|
54
|
+
const a = l(p);
|
|
55
|
+
return /* @__PURE__ */ c(s.Trigger, {
|
|
56
|
+
className: n("group/trigger text-pho-primary outline-pho-brand relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium tracking-[-0.1px]", "ease-pho-spring-reveal data-[panel-open]:text-pho-description transition-colors duration-500", "focus-visible:outline-2 focus-visible:outline-offset-4", "before:absolute before:inset-x-0", i[a].question, i[a].hit, e),
|
|
57
|
+
...o,
|
|
58
|
+
children: [t, /* @__PURE__ */ r("svg", {
|
|
59
|
+
"aria-hidden": "true",
|
|
60
|
+
viewBox: "0 0 24 24",
|
|
61
|
+
fill: "none",
|
|
62
|
+
stroke: "currentColor",
|
|
63
|
+
strokeWidth: 1.5,
|
|
64
|
+
strokeLinecap: "round",
|
|
65
|
+
strokeLinejoin: "round",
|
|
66
|
+
"data-accordion-chevron": "",
|
|
67
|
+
className: "text-pho-primary ease-pho-spring-reveal size-6 shrink-0 transition-[rotate] duration-500 group-data-[panel-open]/trigger:rotate-180",
|
|
68
|
+
children: /* @__PURE__ */ r("path", {
|
|
69
|
+
d: "M 6.5 0 L 3.25 3.5 L 0 0",
|
|
70
|
+
transform: "translate(8.75 10.75)"
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
29
73
|
});
|
|
30
74
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
75
|
+
function h({ className: e, children: t, ...o }) {
|
|
76
|
+
const a = l(p);
|
|
77
|
+
return /* @__PURE__ */ r(s.Panel, {
|
|
78
|
+
className: n("group/panel ease-pho-spring-reveal h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-500", "data-[ending-style]:h-0 data-[starting-style]:h-0", e),
|
|
79
|
+
...o,
|
|
80
|
+
children: /* @__PURE__ */ r("div", {
|
|
81
|
+
className: n("overflow-clip", i[a].gap),
|
|
82
|
+
children: /* @__PURE__ */ r("div", {
|
|
83
|
+
"data-accordion-answer": "",
|
|
84
|
+
className: n("text-pho-primary font-medium tracking-[-0.1px]", "ease-pho-spring-appear transition-[opacity,translate] delay-100 duration-700", "group-data-[starting-style]/panel:translate-y-5 group-data-[starting-style]/panel:opacity-0", "group-data-[ending-style]/panel:opacity-0 group-data-[ending-style]/panel:transition-none", i[a].answer),
|
|
85
|
+
children: t
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var w = {
|
|
91
|
+
Root: u,
|
|
92
|
+
Item: m,
|
|
93
|
+
Header: g,
|
|
94
|
+
Trigger: f,
|
|
95
|
+
Panel: h
|
|
37
96
|
};
|
|
38
97
|
export {
|
|
39
|
-
|
|
98
|
+
w as Accordion
|
|
40
99
|
};
|
|
41
100
|
|
|
42
101
|
//# sourceMappingURL=accordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","names":[],"sources":["../../src/components/accordion/accordion.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"accordion.js","names":[],"sources":["../../src/components/accordion/accordion.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n type ComponentProps,\n type ElementType,\n} from \"react\";\nimport { Accordion as BaseAccordion } from \"@base-ui/react/accordion\";\nimport { cn } from \"../../utils/cn\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\nexport type AccordionSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Three sizes, one step of the type scale apart. `lg` is photon.codes's\n * FAQ to the pixel: the question at 20/28, the answer at 18/28, 20px\n * above and below, 8px between. `md` and `sm` step the type, the\n * padding, and the gap down together; the chevron is the same small\n * glyph in the same 24px box at every size, so a row is never shorter\n * than it.\n */\nconst SIZE: Record<\n AccordionSize,\n { item: string; hit: string; question: string; gap: string; answer: string }\n> = {\n sm: {\n item: \"py-3\",\n hit: \"before:-top-3 before:-bottom-3\",\n question: \"text-base\",\n gap: \"pt-1\",\n answer: \"text-xs\",\n },\n md: {\n item: \"py-4\",\n hit: \"before:-top-4 before:-bottom-4\",\n question: \"text-md\",\n gap: \"pt-1.5\",\n answer: \"text-base\",\n },\n lg: {\n item: \"py-5\",\n hit: \"before:-top-5 before:-bottom-5\",\n question: \"text-xl leading-7\",\n gap: \"pt-2\",\n answer: \"text-lg\",\n },\n};\n\nconst SizeContext = createContext<AccordionSize>(\"md\");\n\nexport interface AccordionRootProps extends StyledProps<\n typeof BaseAccordion.Root\n> {\n /** @default \"md\" */\n size?: AccordionSize;\n}\n\n/**\n * The list — bare, so the page decides the surface: on photon.codes the\n * FAQ card is the section's, 32px around the list; in a settings page it\n * is a `Card`. Items divide with a hairline and the list has no outer\n * lines. Items are independent, as on the site, so `multiple` is on\n * unless said otherwise.\n */\nfunction Root({\n className,\n multiple = true,\n size = \"md\",\n ...props\n}: AccordionRootProps) {\n return (\n <SizeContext.Provider value={size}>\n <BaseAccordion.Root\n multiple={multiple}\n data-size={size}\n className={cn(\"w-full\", className)}\n {...props}\n />\n </SizeContext.Provider>\n );\n}\n\n/**\n * One question, padded above and below, whatever is open inside. The\n * hairline under it overlaps the next item by its own pixel, the way\n * Framer draws a border inside the box, so an item advances by exactly\n * its padding and its rows: 68px at `lg`, the site's figure. The last\n * item draws none.\n */\nfunction Item({ className, ...props }: StyledProps<typeof BaseAccordion.Item>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Item\n className={cn(\n \"border-pho-secondary -mb-px border-b last:mb-0 last:border-b-0\",\n SIZE[size].item,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Header({\n className,\n ...props\n}: StyledProps<typeof BaseAccordion.Header>) {\n return <BaseAccordion.Header className={cn(\"flex\", className)} {...props} />;\n}\n\n/**\n * The question row: the question in medium with the chevron at the row's\n * end. The chevron is the site's small one (a 6.5×3.5 stroke in a 24px\n * box, weight 1.5) and the trigger wears it itself — pass only the\n * question. Open, the question settles to the description tone and the\n * chevron makes a half turn, both on the section spring; the chevron keeps\n * the primary ink. The whole item is the target, as on the site: the hit\n * area reaches through the item's padding above and below the row.\n */\nfunction Trigger({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseAccordion.Trigger>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Trigger\n className={cn(\n \"group/trigger text-pho-primary outline-pho-brand relative flex flex-1 cursor-pointer items-center justify-between gap-3 text-left font-medium tracking-[-0.1px]\",\n \"ease-pho-spring-reveal data-[panel-open]:text-pho-description transition-colors duration-500\",\n \"focus-visible:outline-2 focus-visible:outline-offset-4\",\n \"before:absolute before:inset-x-0\",\n SIZE[size].question,\n SIZE[size].hit,\n className,\n )}\n {...props}\n >\n {children}\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n data-accordion-chevron=\"\"\n className=\"text-pho-primary ease-pho-spring-reveal size-6 shrink-0 transition-[rotate] duration-500 group-data-[panel-open]/trigger:rotate-180\"\n >\n <path d=\"M 6.5 0 L 3.25 3.5 L 0 0\" transform=\"translate(8.75 10.75)\" />\n </svg>\n </BaseAccordion.Trigger>\n );\n}\n\n/**\n * The answer: medium in the primary ink, one type step under the\n * question, a short gap below it. Opening, the panel's height rides the\n * section spring while the answer arrives 100ms later on the appear\n * spring, fading in as it rises 20px. Closing, the answer is gone at once\n * and the height settles on the section spring — the site's way round.\n */\nfunction Panel({\n className,\n children,\n ...props\n}: StyledProps<typeof BaseAccordion.Panel>) {\n const size = useContext(SizeContext);\n return (\n <BaseAccordion.Panel\n className={cn(\n \"group/panel ease-pho-spring-reveal h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-500\",\n \"data-[ending-style]:h-0 data-[starting-style]:h-0\",\n className,\n )}\n {...props}\n >\n {/* The gap and the clip live on one wrapper, the rise on another:\n the panel measures its height from layout, and a translated\n child would count its 20px of overflow into that measure. */}\n <div className={cn(\"overflow-clip\", SIZE[size].gap)}>\n <div\n data-accordion-answer=\"\"\n className={cn(\n \"text-pho-primary font-medium tracking-[-0.1px]\",\n \"ease-pho-spring-appear transition-[opacity,translate] delay-100 duration-700\",\n \"group-data-[starting-style]/panel:translate-y-5 group-data-[starting-style]/panel:opacity-0\",\n \"group-data-[ending-style]/panel:opacity-0 group-data-[ending-style]/panel:transition-none\",\n SIZE[size].answer,\n )}\n >\n {children}\n </div>\n </div>\n </BaseAccordion.Panel>\n );\n}\n\n/**\n * Questions that each reveal an answer — photon.codes's FAQ, as a\n * component, built on Base UI `Accordion`. Each `Accordion.Item` needs a\n * `value`; control the open set with `value` / `onValueChange` or\n * `defaultValue`. Items are independent by default; `multiple={false}`\n * opens one at a time. Three sizes; `lg` is the site's.\n */\nexport const Accordion = { Root, Item, Header, Trigger, Panel };\n"],"mappings":";;;;;AA2BA,IAAM,IAGF;AAAA,EACF,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,IACV,KAAK;AAAA,IACL,QAAQ;AAAA,EACV;AACF,GAEM,IAAc,EAA6B,IAAI;AAgBrD,SAAS,EAAK,EACZ,WAAA,GACA,UAAA,IAAW,IACX,MAAA,IAAO,MACP,GAAG,EAAA,GACkB;AACrB,SACE,gBAAA,EAAC,EAAY,UAAb;AAAA,IAAsB,OAAO;AAAA,IAC3B,UAAA,gBAAA,EAAC,EAAc,MAAf;AAAA,MACY,UAAA;AAAA,MACV,aAAW;AAAA,MACX,WAAW,EAAG,UAAU,CAAS;AAAA,MACjC,GAAI;AAAA,IACL,CAAA;AAAA,EACmB,CAAA;AAE1B;AASA,SAAS,EAAK,EAAE,WAAA,GAAW,GAAG,EAAA,GAAiD;AAC7E,QAAM,IAAO,EAAW,CAAW;AACnC,SACE,gBAAA,EAAC,EAAc,MAAf;AAAA,IACE,WAAW,EACT,kEACA,EAAK,CAAA,EAAM,MACX,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAO,EACd,WAAA,GACA,GAAG,EAAA,GACwC;AAC3C,SAAO,gBAAA,EAA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AAAA,EAAQ,SAAA;AAAA,EAAS,OAAA;AAAM"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { t as f4 } from "../chunks/rolldown-runtime-wKSmTnsc.js";
|
|
3
3
|
import { t as S1 } from "../chunks/cn-ChIgwEl3.js";
|
|
4
4
|
import { SPRING_PRESS_INLINE as $4 } from "../motion.js";
|
|
5
5
|
import { r as E4 } from "../chunks/use-press-pulse-IbNstUT0.js";
|