@photon-ai/pho-ui 4.0.0 → 4.3.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-DlLTmGnH.js → basic-page-65eFgq8o.js} +674 -670
- package/dist/chunks/basic-page-65eFgq8o.js.map +1 -0
- package/dist/chunks/card-N-tvFsuV.js +64 -0
- package/dist/chunks/card-N-tvFsuV.js.map +1 -0
- package/dist/chunks/{command-CTYrSz9a.js → command-ZagVyDx7.js} +2 -2
- package/dist/chunks/{command-CTYrSz9a.js.map → command-ZagVyDx7.js.map} +1 -1
- package/dist/chunks/date-picker-CZbcNIe-.js +428 -0
- package/dist/chunks/date-picker-CZbcNIe-.js.map +1 -0
- package/dist/chunks/{dialog-BwfUFn6B.js → dialog-BYiAFetB.js} +4 -4
- package/dist/chunks/{dialog-BwfUFn6B.js.map → dialog-BYiAFetB.js.map} +1 -1
- package/dist/chunks/{filter-bar-D9lBBr4z.js → filter-bar-DTaLgQr0.js} +2 -2
- package/dist/chunks/{filter-bar-D9lBBr4z.js.map → filter-bar-DTaLgQr0.js.map} +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/filter-bar.js +1 -1
- package/dist/index.js +5 -5
- package/dist/sections/basic-page.js +1 -1
- package/dist/src/components/card/card.d.ts +20 -4
- package/dist/src/components/date-picker/date-picker.d.ts +40 -3
- package/dist/src/components/date-picker/index.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/sections/basic-page/basic-page.d.ts +17 -6
- package/package.json +1 -1
- package/dist/chunks/basic-page-DlLTmGnH.js.map +0 -1
- package/dist/chunks/card-DhDwtSi9.js +0 -56
- package/dist/chunks/card-DhDwtSi9.js.map +0 -1
- package/dist/chunks/date-picker-DnQuw-B1.js +0 -404
- package/dist/chunks/date-picker-DnQuw-B1.js.map +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as r } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
5
|
+
var i = "border-pho-secondary bg-pho-primary overflow-hidden rounded-lg border";
|
|
6
|
+
function n({ className: t, ...a }) {
|
|
7
|
+
return /* @__PURE__ */ e("div", {
|
|
8
|
+
className: r(i, "flex flex-col gap-4 pt-5 pb-4", "has-[>[data-stat-group]:first-child]:pt-0 has-[>[data-stat]:first-child]:pt-0", "has-[>[data-stat-group]:last-child]:pb-0 has-[>[data-stat]:last-child]:pb-0", "has-[>:first-child:has([data-chart])]:pt-0", t),
|
|
9
|
+
...a
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function o({ className: t, ...a }) {
|
|
13
|
+
return /* @__PURE__ */ e("div", {
|
|
14
|
+
className: r("grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-4 gap-y-0 px-5", t),
|
|
15
|
+
...a
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function d({ className: t, children: a, ...s }) {
|
|
19
|
+
return /* @__PURE__ */ e("h3", {
|
|
20
|
+
className: r("text-display-xs text-pho-primary min-w-0 font-medium", t),
|
|
21
|
+
...s,
|
|
22
|
+
children: a
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function p({ className: t, ...a }) {
|
|
26
|
+
return /* @__PURE__ */ e("div", {
|
|
27
|
+
"data-card-value": "",
|
|
28
|
+
className: r("text-display-sm text-pho-primary min-w-0 justify-self-end truncate font-medium tabular-nums", t),
|
|
29
|
+
...a
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function l({ className: t, ...a }) {
|
|
33
|
+
return /* @__PURE__ */ e("p", {
|
|
34
|
+
className: r("text-pho-description text-display-xs col-span-2 font-normal", t),
|
|
35
|
+
...a
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function c({ className: t, ...a }) {
|
|
39
|
+
return /* @__PURE__ */ e("div", {
|
|
40
|
+
className: r("px-5", t),
|
|
41
|
+
...a
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function m({ className: t, ...a }) {
|
|
45
|
+
return /* @__PURE__ */ e("div", {
|
|
46
|
+
className: r("flex items-center gap-2 px-5", t),
|
|
47
|
+
...a
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
var x = {
|
|
51
|
+
Root: n,
|
|
52
|
+
Header: o,
|
|
53
|
+
Title: d,
|
|
54
|
+
Value: p,
|
|
55
|
+
Description: l,
|
|
56
|
+
Content: c,
|
|
57
|
+
Footer: m
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
x as n,
|
|
61
|
+
i as t
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=card-N-tvFsuV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-N-tvFsuV.js","names":[],"sources":["../../src/components/card/card.tsx"],"sourcesContent":["import { type ComponentProps, type Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/**\n * Design notes:\n * - A card is a flat bordered panel on the page surface — hairline border,\n * primary background, no shadow. Elevation shadows stay on floating layers\n * (menus, dialogs); see the same rule on Input and Select.\n * - Radius sits at the `lg` stop (16px) like Dialog — a standalone content\n * panel reads bigger than a control, so it takes the panel radius rather\n * than the control default (`base`). `overflow-hidden` clips with it:\n * a flush `Stat.Group` (opaque tiles, `pt-0`) would otherwise paint\n * square over the curve. The same clip is what makes an edge-to-edge\n * image or table follow the panel, the way `BasicPage.Card` already does.\n * - Vertical rhythm: `pt-5` / `pb-4`, `gap-4` between parts. Parts carry\n * `px-5`, so a child without padding (an image, a table, a `Separator`)\n * runs edge-to-edge on its own. A `Stat` / `Stat.Group` already pads\n * its tiles — when it is the first or last child the matching inset\n * drops so the row sits flush on the card edge. A chart as the first\n * child drops the top inset the same way; the plot keeps its own\n * bottom band.\n * - No size or color axes. A card is chrome, not a signal — content sets the\n * tone. Sizing belongs to the layout that places the card.\n */\n\n/** Surface chrome — exported for hosts that need the look on another element. */\nexport const CARD_SURFACE =\n \"border-pho-secondary bg-pho-primary overflow-hidden rounded-lg border\";\n\n/** The panel: bordered surface, vertical rhythm between parts. */\nfunction Root({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n CARD_SURFACE,\n \"flex flex-col gap-4 pt-5 pb-4\",\n // Stat tiles pad themselves; a chart's plot already insets.\n \"has-[>[data-stat-group]:first-child]:pt-0 has-[>[data-stat]:first-child]:pt-0\",\n \"has-[>[data-stat-group]:last-child]:pb-0 has-[>[data-stat]:last-child]:pb-0\",\n \"has-[>:first-child:has([data-chart])]:pt-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Title row + optional description. The title and a trailing `Value`\n * share the first line; the description sits on the next with no row\n * gap — title and subtitle read as one block.\n */\nfunction Header({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n className={cn(\n \"grid grid-cols-[minmax(0,1fr)_minmax(0,auto)] items-baseline gap-x-4 gap-y-0 px-5\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Card heading — an `<h3>` so it nests under page (`h1`) and section (`h2`)\n * headings without skipping levels.\n */\nfunction Title({\n className,\n children,\n ...props\n}: ComponentProps<\"h3\"> & { ref?: Ref<HTMLHeadingElement> }) {\n return (\n <h3\n className={cn(\n \"text-display-xs text-pho-primary min-w-0 font-medium\",\n className,\n )}\n {...props}\n >\n {children}\n </h3>\n );\n}\n\n/**\n * A count or figure at the end of the title row. One display step above\n * the title, primary ink — the number is the loud thing on the line.\n */\nfunction Value({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div\n data-card-value=\"\"\n className={cn(\n \"text-display-sm text-pho-primary min-w-0 justify-self-end truncate font-medium tabular-nums\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Supporting copy under the title — Dialog's description: same step, description ink. */\nfunction Description({\n className,\n ...props\n}: ComponentProps<\"p\"> & { ref?: Ref<HTMLParagraphElement> }) {\n return (\n <p\n className={cn(\n \"text-pho-description text-display-xs col-span-2 font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** The card body. Carries the horizontal padding; bring your own layout. */\nfunction Content({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return <div className={cn(\"px-5\", className)} {...props} />;\n}\n\n/**\n * Trailing row — actions, a status line. Unopinionated about justification;\n * add `justify-end` for a dialog-style action bar.\n */\nfunction Footer({\n className,\n ...props\n}: ComponentProps<\"div\"> & { ref?: Ref<HTMLDivElement> }) {\n return (\n <div className={cn(\"flex items-center gap-2 px-5\", className)} {...props} />\n );\n}\n\n/**\n * Card — a bordered content panel: header (title + description), body,\n * optional footer. It's static chrome with no interactivity of its own.\n * For a label/control list use `BasicPage.Card`; for a featured\n * block on the page surface use `BasicPage.Callout`.\n *\n * ```tsx\n * <Card.Root>\n * <Card.Header>\n * <Card.Title>Usage</Card.Title>\n * <Card.Value>1.2k</Card.Value>\n * <Card.Description>Since Aug 1.</Card.Description>\n * </Card.Header>\n * <Card.Content>…</Card.Content>\n * <Card.Footer className=\"justify-end\">\n * <Button size=\"sm\">Upgrade</Button>\n * </Card.Footer>\n * </Card.Root>\n * ```\n */\nexport const Card = {\n Root,\n Header,\n Title,\n Value,\n Description,\n Content,\n Footer,\n};\n"],"mappings":";;;;AA0BA,IAAa,IACX;AAGF,SAAS,EAAK,EACZ,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,GACA,iCAEA,iFACA,+EACA,8CACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAOA,SAAS,EAAO,EACd,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,qFACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAMA,SAAS,EAAM,EACb,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACwD;AAC3D,SACE,gBAAA,EAAC,MAAD;AAAA,IACE,WAAW,EACT,wDACA,CACF;AAAA,IACA,GAAI;AAAA,IAEH,UAAA;AAAA,EACC,CAAA;AAER;AAMA,SAAS,EAAM,EACb,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,mBAAgB;AAAA,IAChB,WAAW,EACT,+FACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,SAAS,EAAY,EACnB,WAAA,GACA,GAAG,EAAA,GACyD;AAC5D,SACE,gBAAA,EAAC,KAAD;AAAA,IACE,WAAW,EACT,+DACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,SAAS,EAAQ,EACf,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SAAO,gBAAA,EAAC,OAAD;AAAA,IAAK,WAAW,EAAG,QAAQ,CAAS;AAAA,IAAG,GAAI;AAAA,EAAQ,CAAA;AAC5D;AAMA,SAAS,EAAO,EACd,WAAA,GACA,GAAG,EAAA,GACqD;AACxD,SACE,gBAAA,EAAC,OAAD;AAAA,IAAK,WAAW,EAAG,gCAAgC,CAAS;AAAA,IAAG,GAAI;AAAA,EAAQ,CAAA;AAE/E;AAsBA,IAAa,IAAO;AAAA,EAClB,MAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AACF"}
|
|
@@ -4,7 +4,7 @@ import { SPRING_SETTLE as z } from "../motion.js";
|
|
|
4
4
|
import { t as C } from "./IconArrowUpRight-DGgKzQwV.js";
|
|
5
5
|
import { t as M } from "./IconChevronLeft-CSWMKQ4C.js";
|
|
6
6
|
import { t as O } from "./animated-height-CCO-Ocoz.js";
|
|
7
|
-
import { t as d } from "./dialog-
|
|
7
|
+
import { t as d } from "./dialog-BYiAFetB.js";
|
|
8
8
|
import { useEffect as T, useId as D, useLayoutEffect as V, useRef as $ } from "react";
|
|
9
9
|
import { Fragment as w, jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
10
10
|
import { LayoutGroup as A, motion as x, useReducedMotion as F } from "motion/react";
|
|
@@ -189,4 +189,4 @@ export {
|
|
|
189
189
|
ue as t
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
//# sourceMappingURL=command-
|
|
192
|
+
//# sourceMappingURL=command-ZagVyDx7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-CTYrSz9a.js","names":[],"sources":["../../src/components/command/command.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { IconArrowUpRight, IconChevronLeft } from \"@tabler/icons-react\";\nimport { SPRING_SETTLE } from \"../../motion\";\nimport { Command as CommandPrimitive, useCommandState } from \"cmdk\";\nimport { LayoutGroup, motion, useReducedMotion } from \"motion/react\";\nimport { AnimatedHeight } from \"../../utils/animated-height\";\nimport { cn } from \"../../utils/cn\";\nimport { Dialog as PhoDialog } from \"../dialog\";\n\n/**\n * Spring for row moves (FLIP / shared-layout) — same feel as\n * `AnimatedHeight`: quick and critically damped, so rows glide to their new\n * slot without overshooting into neighbours.\n */\nconst ROW_MOVE_SPRING = SPRING_SETTLE;\n\nfunction Root({\n // Filtering is yours by default: filter in render (state above the\n // palette) so the rows' FLIP diff can glide survivors to their slots.\n // cmdk's built-in matcher reorders DOM imperatively — invisible to the\n // layout pass — so it is opt-in: pass `shouldFilter` to hand matching\n // and ranking back to cmdk at the cost of the animation.\n shouldFilter = false,\n className,\n children,\n ...props\n}: ComponentProps<typeof CommandPrimitive>) {\n // Namespace row layoutIds per palette instance — the docs page mounts the\n // inline demo and the dialog demo at once, with identical item values.\n const layoutNamespace = useId();\n return (\n <CommandPrimitive\n className={cn(\n \"bg-pho-primary text-pho-primary flex w-full flex-col overflow-hidden outline-none\",\n className,\n )}\n shouldFilter={shouldFilter}\n {...props}\n >\n <LayoutGroup id={layoutNamespace}>{children}</LayoutGroup>\n </CommandPrimitive>\n );\n}\n\n/**\n * The input row — a bottom hairline separates it from the list. Position\n * leading icons absolutely and pad the input (`pl-9`), mirroring\n * `Autocomplete.InputGroup`.\n */\nfunction InputGroup({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"border-pho-secondary relative flex items-center border-b\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** SSR-safe layout effect (same pattern cmdk uses internally). */\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\nfunction Input({\n className,\n value,\n ref: consumerRef,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Input>) {\n const inputRef = useRef<HTMLInputElement>(null);\n const search = useCommandState((state) => state.search);\n\n // cmdk stays uncontrolled here on purpose. Its controlled path syncs the\n // `value` prop into the search store through a passive effect — one painted\n // frame late — so on that stale frame the old row is still \"selected\" while\n // the list has already reflowed, and the selection pill visibly rides it\n // before snapping to the re-selected first row. Uncontrolled keystrokes\n // update search + first-row selection synchronously (pre-paint), killing\n // that frame in both directions (typing and clearing).\n //\n // The consumer-facing API is still controlled: external `value` changes\n // (programmatic reset, initial query) are replayed through the native input\n // path below so store, display, and selection take the same sync route.\n useIsomorphicLayoutEffect(() => {\n const input = inputRef.current;\n if (value == null || input == null || value === search) return;\n const setNativeValue = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n )?.set;\n setNativeValue?.call(input, value);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }, [value, search]);\n\n return (\n <CommandPrimitive.Input\n className={cn(\n // Borderless inside the palette surface — the InputGroup hairline\n // carries the edge. display-xs (18px) keeps iOS from zooming in.\n \"text-pho-primary placeholder:text-pho-placeholder text-display-xs w-full bg-transparent px-3 py-3 outline-none disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n ref={(node) => {\n inputRef.current = node;\n assignRef(consumerRef, node);\n }}\n />\n );\n}\n\nfunction List({\n className,\n children,\n ...props\n}: ComponentProps<typeof CommandPrimitive.List>) {\n return (\n // Same spring as the onboarding / invite Card shell — list height glides\n // when idle ↔ search (or filter) changes instead of jumping.\n <AnimatedHeight>\n {/* The scroller is a motion element with layoutScroll so the rows'\n FLIP projections account for its scroll offset — without it,\n scrolling reads as a layout change and every row glides to\n compensate. scroll-py keeps a breath above and below the row\n being scrolled into view. */}\n <motion.div\n layoutScroll\n className=\"max-h-[min(24rem,60vh)] scroll-py-1 overflow-y-auto overscroll-contain\"\n >\n <CommandPrimitive.List\n className={cn(\"relative isolate p-1\", className)}\n {...props}\n >\n {children}\n </CommandPrimitive.List>\n </motion.div>\n </AnimatedHeight>\n );\n}\n\nfunction Empty({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className={cn(\n \"text-pho-description px-2.5 py-6 text-center text-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Group({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n className={cn(\n // cmdk renders the `heading` prop in a [cmdk-group-heading] wrapper —\n // typography mirrors `Autocomplete.GroupLabel`.\n \"[&_[cmdk-group-heading]]:text-pho-secondary [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Row layout mode:\n * - `item` / `subitem` / `subsubitem` — idle hierarchy (icon column + indent)\n * - `result` — flat search hit (breadcrumb + trailing scope)\n */\nexport type CommandItemLevel = \"item\" | \"subitem\" | \"subsubitem\" | \"result\";\n\ntype ItemPrimitiveProps = ComponentProps<typeof CommandPrimitive.Item>;\n\nexport interface CommandItemProps extends Omit<\n ItemPrimitiveProps,\n \"children\" | \"title\"\n> {\n /**\n * Row depth / mode in the palette:\n * - `item` — page / top destination (icon + title)\n * - `subitem` — section under an item (label aligns with the item title)\n * - `subsubitem` — row under a section (one step deeper)\n * - `result` — flat search hit (`title` + `path` crumbs + `scope`)\n */\n level?: CommandItemLevel;\n /**\n * Leading glyph. On idle `item` rows (and reserved for sub-levels). On\n * `result` rows, pass the resolved icon (self → parent → grandparent).\n */\n icon?: ReactNode;\n /**\n * When `level=\"result\"`, force the icon column so labels align across the\n * list even if this row's `icon` is empty. Set true when any sibling result\n * has an icon; omit when the whole result set is icon-less.\n */\n iconSlot?: boolean;\n /** Primary label. Prefer this over free-form children for the shared layout. */\n title?: ReactNode;\n /**\n * Ancestors after `title` for `level=\"result\"` — parent → page\n * (e.g. `[\"Agent profile\", \"Settings\"]` → `Name < Agent profile < Settings`).\n */\n path?: ReactNode[];\n /**\n * Trailing scope for `level=\"result\"` — `Project` vs `Personal`, not a nav group.\n */\n scope?: ReactNode;\n /** Shows a trailing external-link glyph (opens outside the app). */\n external?: boolean;\n /**\n * Free-form content. When `title` is set, rendered after the label stack.\n * When `title` is omitted, becomes the row body (legacy / simple items).\n */\n children?: ReactNode;\n}\n\n/** Leading icon column — `size-4`, secondary ink. */\nfunction ItemIcon({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"text-pho-secondary flex size-4 shrink-0 items-center justify-center [&>svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Primary label — medium + primary ink on `item` rows. */\nfunction ItemTitle({\n className,\n level = \"item\",\n ...props\n}: ComponentProps<\"span\"> & { level?: CommandItemLevel }) {\n return (\n <span\n className={cn(\n \"text-md block truncate\",\n level === \"item\" && \"text-pho-primary\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * One selectable row. Idle palettes use `level` + `icon` / `title`\n * (item → subitem → subsubitem). Searching uses `level=\"result\"` with `path`\n * crumbs and a trailing `scope` (Project / Personal). No description line —\n * match via `keywords` / aliases instead.\n */\nfunction ExternalGlyph() {\n return (\n <IconArrowUpRight\n aria-hidden\n className=\"text-pho-description size-4 shrink-0\"\n />\n );\n}\n\nfunction Item({\n className,\n level = \"item\",\n icon,\n iconSlot,\n title,\n path,\n scope,\n external,\n children,\n value,\n ...props\n}: CommandItemProps) {\n const reduceMotion = useReducedMotion();\n // cmdk registers `value.trim()` and exposes the selected one as\n // `state.value` — mirrors cmdk's own `data-selected` computation.\n const trimmedValue = typeof value === \"string\" ? value.trim() : \"\";\n const selectedValue = useCommandState((state) => state.value);\n const isSelected = trimmedValue !== \"\" && selectedValue === trimmedValue;\n const structured = title != null;\n const isResult = level === \"result\";\n // Reserve the icon column when the row has an icon, or when the list asks\n // for alignment (`iconSlot`) even if this row's glyph is empty.\n const showResultIcon = isResult && (icon != null || iconSlot);\n\n const row = (\n <CommandPrimitive.Item\n data-level={level}\n value={value}\n className={cn(\n \"text-pho-secondary flex cursor-pointer items-center gap-2 rounded-[calc(var(--radius-base)-4px)] py-2 pr-2.5 text-base outline-none select-none\",\n // subsubitem steps in; item/subitem share the base gutter.\n level === \"subsubitem\" ? \"pl-6\" : \"pl-2\",\n // Secondary at rest; selection lifts to primary ink (Menu idiom).\n // The wash lands with it instantly — stepping through rows is a\n // snap, not a flight.\n \"data-[selected=true]:text-pho-primary data-[selected=true]:bg-pho-ghost-hover\",\n \"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50\",\n className,\n )}\n {...props}\n >\n {structured && isResult ? (\n <>\n {showResultIcon ? (\n <ItemIcon aria-hidden={icon == null ? true : undefined}>\n {icon ?? null}\n </ItemIcon>\n ) : null}\n {/* Same text-md line box as idle ItemTitle so row height matches (36px). */}\n <span className=\"text-md flex min-w-0 flex-1 items-center gap-1 overflow-hidden\">\n <span className=\"text-pho-primary truncate\">{title}</span>\n {(path ?? []).map((segment, index) => (\n <span\n key={index}\n className=\"text-pho-description flex shrink-0 items-center gap-0.5\"\n >\n <IconChevronLeft aria-hidden className=\"size-4 shrink-0\" />\n {segment}\n </span>\n ))}\n </span>\n {scope != null && scope !== \"\" ? (\n <span className=\"text-pho-description shrink-0 text-xs\">\n {scope}\n </span>\n ) : null}\n {external ? <ExternalGlyph /> : null}\n {children}\n </>\n ) : structured ? (\n <>\n {/* Icon column always reserved so subitem labels share the item title edge. */}\n <ItemIcon aria-hidden={icon == null ? true : undefined}>\n {icon ?? null}\n </ItemIcon>\n <span className=\"min-w-0 flex-1\">\n <ItemTitle level={level}>{title}</ItemTitle>\n </span>\n {external ? <ExternalGlyph /> : null}\n {children}\n </>\n ) : (\n children\n )}\n </CommandPrimitive.Item>\n );\n\n if (reduceMotion) return row;\n\n return (\n // FLIP wrapper: rows that stay mounted glide when neighbours enter or\n // leave, and a row remounting elsewhere with the same `value` (idle group\n // ↔ flat search result) inherits the old bounds via its layoutId and\n // slides to the new slot — the iOS list-diff feel. Rows without a match\n // simply appear / disappear so the whole list never swarms.\n //\n // The selected row is the exception: it skips the travel and appears at\n // its final slot immediately, so the selection wash is never sitting on\n // empty space waiting for its row to fly in.\n <motion.div\n layout=\"position\"\n layoutId={typeof value === \"string\" ? value : undefined}\n initial={false}\n transition={isSelected ? { duration: 0 } : ROW_MOVE_SPRING}\n >\n {row}\n </motion.div>\n );\n}\n\nfunction Separator({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn(\n \"-mx-1 my-1 h-px bg-[var(--border-color-pho-secondary)]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Loading({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Loading>) {\n return (\n <CommandPrimitive.Loading\n className={cn(\"text-pho-description px-2.5 py-1.5 text-base\", className)}\n {...props}\n />\n );\n}\n\ntype DialogRootProps = ComponentProps<typeof PhoDialog.Root>;\n\ninterface CommandDialogProps extends ComponentProps<typeof CommandPrimitive> {\n /** Controlled dialog state — pass straight through to `Dialog.Root`. */\n open?: DialogRootProps[\"open\"];\n onOpenChange?: DialogRootProps[\"onOpenChange\"];\n /** Accessible name for the palette (dialog and command menu). */\n label?: string;\n /** Extra classes for the dialog panel (not the command root). */\n className?: string;\n}\n\n/**\n * A command palette in a modal — Pho's `Dialog` overlay (Base UI) around a\n * `Command.Root`, raised above center. We deliberately skip cmdk's own\n * `Command.Dialog` (Radix) so overlays stay on one primitive stack.\n *\n * List height springs via `AnimatedHeight` (same feel as the Card shell on\n * onboarding / invite) — the input row stays put while results resize.\n */\nfunction Dialog({\n open,\n onOpenChange,\n label,\n className,\n children,\n ...props\n}: CommandDialogProps) {\n return (\n <PhoDialog.Root open={open} onOpenChange={onOpenChange}>\n <PhoDialog.Portal>\n <PhoDialog.Backdrop />\n <PhoDialog.Popup\n aria-label={label}\n // Palette sits above center so the list grows downward from a\n // stable top edge instead of jumping around it.\n className={cn(\n \"top-[max(4rem,18vh)] max-w-xl translate-y-0 overflow-hidden p-0\",\n className,\n )}\n >\n {/* The popup is position: fixed; layout animations inside a fixed\n element need a layoutRoot to project against, or their\n measurements drift with the page scroll. */}\n <motion.div layoutRoot>\n <Root label={label} {...props}>\n {children}\n </Root>\n </motion.div>\n </PhoDialog.Popup>\n </PhoDialog.Portal>\n </PhoDialog.Root>\n );\n}\n\n/**\n * Command menu built on `cmdk` — a filterable list of actions driven from a\n * single input, keyboard-first. Compose inline (`Command.Root`) or as a\n * ⌘K-style modal palette (`Command.Dialog`, which owns the overlay).\n * Filtering is yours by default — filter in render so the rows' diff can\n * glide; pass `shouldFilter` to hand matching and ranking to cmdk (its\n * imperative reorder skips the animation).\n *\n * Rows share one layout via `Command.Item` `level` — idle\n * `item` → `subitem` → `subsubitem`, or flat `result` while searching.\n */\nexport const Command = {\n Root,\n InputGroup,\n Input,\n List,\n Empty,\n Group,\n Item,\n ItemIcon,\n ItemTitle,\n Separator,\n Loading,\n Dialog,\n};\n\n/** Re-export of cmdk's state selector hook (search, value, filtered counts). */\nexport { useCommandState };\n"],"mappings":";;;;;;;;;;;AAsBA,IAAM,IAAkB;AAExB,SAAS,EAAK,EAMZ,cAAA,IAAe,IACf,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACuC;AAG1C,QAAM,IAAkB,EAAM;AAC9B,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,WAAW,EACT,qFACA,CACF;AAAA,IACc,cAAA;AAAA,IACd,GAAI;AAAA,IAEJ,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAa,IAAI;AAAA,MAAkB,UAAA;AAAA,IAAsB,CAAA;AAAA,EACzC,CAAA;AAEtB;AAOA,SAAS,EAAW,EAAE,WAAA,GAAW,GAAG,EAAA,GAAgC;AAClE,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,4DACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,IAAM,IACJ,OAAO,SAAW,MAAc,IAAY;AAE9C,SAAS,EAAa,GAAyB,GAAiB;AAC9D,EAAI,OAAO,KAAQ,aAAY,EAAI,CAAK,IAC/B,MAAK,EAAI,UAAU;AAC9B;AAEA,SAAS,EAAM,EACb,WAAA,GACA,OAAA,GACA,KAAK,GACL,GAAG,EAAA,GAC6C;AAChD,QAAM,IAAW,EAAyB,IAAI,GACxC,IAAS,EAAA,CAAiB,MAAU,EAAM,MAAM;AAatD,SAAA,EAAA,MAAgC;AAC9B,UAAM,IAAQ,EAAS;AACvB,IAAI,KAAS,QAAQ,KAAS,QAAQ,MAAU,MACzB,OAAO,yBAC5B,iBAAiB,WACjB,OACF,GAAG,KACa,KAAK,GAAO,CAAK,GACjC,EAAM,cAAc,IAAI,MAAM,SAAS,EAAE,SAAS,GAAK,CAAC,CAAC;AAAA,EAC3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ACA,OAAA,GACA,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACkB;AACrB,SACE,gBAAA,EAAC,EAAU,MAAX;AAAA,IAAsB,MAAA;AAAA,IAAoB,cAAA;AAAA,IACxC,UAAA,gBAAA,EAAC,EAAU,QAAX,EAAA,UAAA,CACE,gBAAA,EAAC,EAAU,UAAX,CAAqB,CAAA,GACrB,gBAAA,EAAC,EAAU,OAAX;AAAA,MACE,cAAY;AAAA,MAGZ,WAAW,EACT,mEACA,CACF;AAAA,MAKA,UAAA,gBAAA,EAAC,EAAO,KAAR;AAAA,QAAY,YAAA;AAAA,QACV,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAa,OAAA;AAAA,UAAO,GAAI;AAAA,UACrB,UAAA;AAAA,QACG,CAAA;AAAA,MACI,CAAA;AAAA,IACG,CAAA,CACD,EAAA,CAAA;AAAA,EACJ,CAAA;AAEpB;AAaA,IAAa,KAAU;AAAA,EACrB,MAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AACF"}
|
|
1
|
+
{"version":3,"file":"command-ZagVyDx7.js","names":[],"sources":["../../src/components/command/command.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n type ComponentProps,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport { IconArrowUpRight, IconChevronLeft } from \"@tabler/icons-react\";\nimport { SPRING_SETTLE } from \"../../motion\";\nimport { Command as CommandPrimitive, useCommandState } from \"cmdk\";\nimport { LayoutGroup, motion, useReducedMotion } from \"motion/react\";\nimport { AnimatedHeight } from \"../../utils/animated-height\";\nimport { cn } from \"../../utils/cn\";\nimport { Dialog as PhoDialog } from \"../dialog\";\n\n/**\n * Spring for row moves (FLIP / shared-layout) — same feel as\n * `AnimatedHeight`: quick and critically damped, so rows glide to their new\n * slot without overshooting into neighbours.\n */\nconst ROW_MOVE_SPRING = SPRING_SETTLE;\n\nfunction Root({\n // Filtering is yours by default: filter in render (state above the\n // palette) so the rows' FLIP diff can glide survivors to their slots.\n // cmdk's built-in matcher reorders DOM imperatively — invisible to the\n // layout pass — so it is opt-in: pass `shouldFilter` to hand matching\n // and ranking back to cmdk at the cost of the animation.\n shouldFilter = false,\n className,\n children,\n ...props\n}: ComponentProps<typeof CommandPrimitive>) {\n // Namespace row layoutIds per palette instance — the docs page mounts the\n // inline demo and the dialog demo at once, with identical item values.\n const layoutNamespace = useId();\n return (\n <CommandPrimitive\n className={cn(\n \"bg-pho-primary text-pho-primary flex w-full flex-col overflow-hidden outline-none\",\n className,\n )}\n shouldFilter={shouldFilter}\n {...props}\n >\n <LayoutGroup id={layoutNamespace}>{children}</LayoutGroup>\n </CommandPrimitive>\n );\n}\n\n/**\n * The input row — a bottom hairline separates it from the list. Position\n * leading icons absolutely and pad the input (`pl-9`), mirroring\n * `Autocomplete.InputGroup`.\n */\nfunction InputGroup({ className, ...props }: ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\n \"border-pho-secondary relative flex items-center border-b\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** SSR-safe layout effect (same pattern cmdk uses internally). */\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nfunction assignRef<T>(ref: Ref<T> | undefined, value: T | null) {\n if (typeof ref === \"function\") ref(value);\n else if (ref) ref.current = value;\n}\n\nfunction Input({\n className,\n value,\n ref: consumerRef,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Input>) {\n const inputRef = useRef<HTMLInputElement>(null);\n const search = useCommandState((state) => state.search);\n\n // cmdk stays uncontrolled here on purpose. Its controlled path syncs the\n // `value` prop into the search store through a passive effect — one painted\n // frame late — so on that stale frame the old row is still \"selected\" while\n // the list has already reflowed, and the selection pill visibly rides it\n // before snapping to the re-selected first row. Uncontrolled keystrokes\n // update search + first-row selection synchronously (pre-paint), killing\n // that frame in both directions (typing and clearing).\n //\n // The consumer-facing API is still controlled: external `value` changes\n // (programmatic reset, initial query) are replayed through the native input\n // path below so store, display, and selection take the same sync route.\n useIsomorphicLayoutEffect(() => {\n const input = inputRef.current;\n if (value == null || input == null || value === search) return;\n const setNativeValue = Object.getOwnPropertyDescriptor(\n HTMLInputElement.prototype,\n \"value\",\n )?.set;\n setNativeValue?.call(input, value);\n input.dispatchEvent(new Event(\"input\", { bubbles: true }));\n }, [value, search]);\n\n return (\n <CommandPrimitive.Input\n className={cn(\n // Borderless inside the palette surface — the InputGroup hairline\n // carries the edge. display-xs (18px) keeps iOS from zooming in.\n \"text-pho-primary placeholder:text-pho-placeholder text-display-xs w-full bg-transparent px-3 py-3 outline-none disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n {...props}\n ref={(node) => {\n inputRef.current = node;\n assignRef(consumerRef, node);\n }}\n />\n );\n}\n\nfunction List({\n className,\n children,\n ...props\n}: ComponentProps<typeof CommandPrimitive.List>) {\n return (\n // Same spring as the onboarding / invite Card shell — list height glides\n // when idle ↔ search (or filter) changes instead of jumping.\n <AnimatedHeight>\n {/* The scroller is a motion element with layoutScroll so the rows'\n FLIP projections account for its scroll offset — without it,\n scrolling reads as a layout change and every row glides to\n compensate. scroll-py keeps a breath above and below the row\n being scrolled into view. */}\n <motion.div\n layoutScroll\n className=\"max-h-[min(24rem,60vh)] scroll-py-1 overflow-y-auto overscroll-contain\"\n >\n <CommandPrimitive.List\n className={cn(\"relative isolate p-1\", className)}\n {...props}\n >\n {children}\n </CommandPrimitive.List>\n </motion.div>\n </AnimatedHeight>\n );\n}\n\nfunction Empty({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n className={cn(\n \"text-pho-description px-2.5 py-6 text-center text-base\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Group({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n className={cn(\n // cmdk renders the `heading` prop in a [cmdk-group-heading] wrapper —\n // typography mirrors `Autocomplete.GroupLabel`.\n \"[&_[cmdk-group-heading]]:text-pho-secondary [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * Row layout mode:\n * - `item` / `subitem` / `subsubitem` — idle hierarchy (icon column + indent)\n * - `result` — flat search hit (breadcrumb + trailing scope)\n */\nexport type CommandItemLevel = \"item\" | \"subitem\" | \"subsubitem\" | \"result\";\n\ntype ItemPrimitiveProps = ComponentProps<typeof CommandPrimitive.Item>;\n\nexport interface CommandItemProps extends Omit<\n ItemPrimitiveProps,\n \"children\" | \"title\"\n> {\n /**\n * Row depth / mode in the palette:\n * - `item` — page / top destination (icon + title)\n * - `subitem` — section under an item (label aligns with the item title)\n * - `subsubitem` — row under a section (one step deeper)\n * - `result` — flat search hit (`title` + `path` crumbs + `scope`)\n */\n level?: CommandItemLevel;\n /**\n * Leading glyph. On idle `item` rows (and reserved for sub-levels). On\n * `result` rows, pass the resolved icon (self → parent → grandparent).\n */\n icon?: ReactNode;\n /**\n * When `level=\"result\"`, force the icon column so labels align across the\n * list even if this row's `icon` is empty. Set true when any sibling result\n * has an icon; omit when the whole result set is icon-less.\n */\n iconSlot?: boolean;\n /** Primary label. Prefer this over free-form children for the shared layout. */\n title?: ReactNode;\n /**\n * Ancestors after `title` for `level=\"result\"` — parent → page\n * (e.g. `[\"Agent profile\", \"Settings\"]` → `Name < Agent profile < Settings`).\n */\n path?: ReactNode[];\n /**\n * Trailing scope for `level=\"result\"` — `Project` vs `Personal`, not a nav group.\n */\n scope?: ReactNode;\n /** Shows a trailing external-link glyph (opens outside the app). */\n external?: boolean;\n /**\n * Free-form content. When `title` is set, rendered after the label stack.\n * When `title` is omitted, becomes the row body (legacy / simple items).\n */\n children?: ReactNode;\n}\n\n/** Leading icon column — `size-4`, secondary ink. */\nfunction ItemIcon({ className, ...props }: ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\n \"text-pho-secondary flex size-4 shrink-0 items-center justify-center [&>svg]:size-4\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/** Primary label — medium + primary ink on `item` rows. */\nfunction ItemTitle({\n className,\n level = \"item\",\n ...props\n}: ComponentProps<\"span\"> & { level?: CommandItemLevel }) {\n return (\n <span\n className={cn(\n \"text-md block truncate\",\n level === \"item\" && \"text-pho-primary\",\n className,\n )}\n {...props}\n />\n );\n}\n\n/**\n * One selectable row. Idle palettes use `level` + `icon` / `title`\n * (item → subitem → subsubitem). Searching uses `level=\"result\"` with `path`\n * crumbs and a trailing `scope` (Project / Personal). No description line —\n * match via `keywords` / aliases instead.\n */\nfunction ExternalGlyph() {\n return (\n <IconArrowUpRight\n aria-hidden\n className=\"text-pho-description size-4 shrink-0\"\n />\n );\n}\n\nfunction Item({\n className,\n level = \"item\",\n icon,\n iconSlot,\n title,\n path,\n scope,\n external,\n children,\n value,\n ...props\n}: CommandItemProps) {\n const reduceMotion = useReducedMotion();\n // cmdk registers `value.trim()` and exposes the selected one as\n // `state.value` — mirrors cmdk's own `data-selected` computation.\n const trimmedValue = typeof value === \"string\" ? value.trim() : \"\";\n const selectedValue = useCommandState((state) => state.value);\n const isSelected = trimmedValue !== \"\" && selectedValue === trimmedValue;\n const structured = title != null;\n const isResult = level === \"result\";\n // Reserve the icon column when the row has an icon, or when the list asks\n // for alignment (`iconSlot`) even if this row's glyph is empty.\n const showResultIcon = isResult && (icon != null || iconSlot);\n\n const row = (\n <CommandPrimitive.Item\n data-level={level}\n value={value}\n className={cn(\n \"text-pho-secondary flex cursor-pointer items-center gap-2 rounded-[calc(var(--radius-base)-4px)] py-2 pr-2.5 text-base outline-none select-none\",\n // subsubitem steps in; item/subitem share the base gutter.\n level === \"subsubitem\" ? \"pl-6\" : \"pl-2\",\n // Secondary at rest; selection lifts to primary ink (Menu idiom).\n // The wash lands with it instantly — stepping through rows is a\n // snap, not a flight.\n \"data-[selected=true]:text-pho-primary data-[selected=true]:bg-pho-ghost-hover\",\n \"data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50\",\n className,\n )}\n {...props}\n >\n {structured && isResult ? (\n <>\n {showResultIcon ? (\n <ItemIcon aria-hidden={icon == null ? true : undefined}>\n {icon ?? null}\n </ItemIcon>\n ) : null}\n {/* Same text-md line box as idle ItemTitle so row height matches (36px). */}\n <span className=\"text-md flex min-w-0 flex-1 items-center gap-1 overflow-hidden\">\n <span className=\"text-pho-primary truncate\">{title}</span>\n {(path ?? []).map((segment, index) => (\n <span\n key={index}\n className=\"text-pho-description flex shrink-0 items-center gap-0.5\"\n >\n <IconChevronLeft aria-hidden className=\"size-4 shrink-0\" />\n {segment}\n </span>\n ))}\n </span>\n {scope != null && scope !== \"\" ? (\n <span className=\"text-pho-description shrink-0 text-xs\">\n {scope}\n </span>\n ) : null}\n {external ? <ExternalGlyph /> : null}\n {children}\n </>\n ) : structured ? (\n <>\n {/* Icon column always reserved so subitem labels share the item title edge. */}\n <ItemIcon aria-hidden={icon == null ? true : undefined}>\n {icon ?? null}\n </ItemIcon>\n <span className=\"min-w-0 flex-1\">\n <ItemTitle level={level}>{title}</ItemTitle>\n </span>\n {external ? <ExternalGlyph /> : null}\n {children}\n </>\n ) : (\n children\n )}\n </CommandPrimitive.Item>\n );\n\n if (reduceMotion) return row;\n\n return (\n // FLIP wrapper: rows that stay mounted glide when neighbours enter or\n // leave, and a row remounting elsewhere with the same `value` (idle group\n // ↔ flat search result) inherits the old bounds via its layoutId and\n // slides to the new slot — the iOS list-diff feel. Rows without a match\n // simply appear / disappear so the whole list never swarms.\n //\n // The selected row is the exception: it skips the travel and appears at\n // its final slot immediately, so the selection wash is never sitting on\n // empty space waiting for its row to fly in.\n <motion.div\n layout=\"position\"\n layoutId={typeof value === \"string\" ? value : undefined}\n initial={false}\n transition={isSelected ? { duration: 0 } : ROW_MOVE_SPRING}\n >\n {row}\n </motion.div>\n );\n}\n\nfunction Separator({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n className={cn(\n \"-mx-1 my-1 h-px bg-[var(--border-color-pho-secondary)]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Loading({\n className,\n ...props\n}: ComponentProps<typeof CommandPrimitive.Loading>) {\n return (\n <CommandPrimitive.Loading\n className={cn(\"text-pho-description px-2.5 py-1.5 text-base\", className)}\n {...props}\n />\n );\n}\n\ntype DialogRootProps = ComponentProps<typeof PhoDialog.Root>;\n\ninterface CommandDialogProps extends ComponentProps<typeof CommandPrimitive> {\n /** Controlled dialog state — pass straight through to `Dialog.Root`. */\n open?: DialogRootProps[\"open\"];\n onOpenChange?: DialogRootProps[\"onOpenChange\"];\n /** Accessible name for the palette (dialog and command menu). */\n label?: string;\n /** Extra classes for the dialog panel (not the command root). */\n className?: string;\n}\n\n/**\n * A command palette in a modal — Pho's `Dialog` overlay (Base UI) around a\n * `Command.Root`, raised above center. We deliberately skip cmdk's own\n * `Command.Dialog` (Radix) so overlays stay on one primitive stack.\n *\n * List height springs via `AnimatedHeight` (same feel as the Card shell on\n * onboarding / invite) — the input row stays put while results resize.\n */\nfunction Dialog({\n open,\n onOpenChange,\n label,\n className,\n children,\n ...props\n}: CommandDialogProps) {\n return (\n <PhoDialog.Root open={open} onOpenChange={onOpenChange}>\n <PhoDialog.Portal>\n <PhoDialog.Backdrop />\n <PhoDialog.Popup\n aria-label={label}\n // Palette sits above center so the list grows downward from a\n // stable top edge instead of jumping around it.\n className={cn(\n \"top-[max(4rem,18vh)] max-w-xl translate-y-0 overflow-hidden p-0\",\n className,\n )}\n >\n {/* The popup is position: fixed; layout animations inside a fixed\n element need a layoutRoot to project against, or their\n measurements drift with the page scroll. */}\n <motion.div layoutRoot>\n <Root label={label} {...props}>\n {children}\n </Root>\n </motion.div>\n </PhoDialog.Popup>\n </PhoDialog.Portal>\n </PhoDialog.Root>\n );\n}\n\n/**\n * Command menu built on `cmdk` — a filterable list of actions driven from a\n * single input, keyboard-first. Compose inline (`Command.Root`) or as a\n * ⌘K-style modal palette (`Command.Dialog`, which owns the overlay).\n * Filtering is yours by default — filter in render so the rows' diff can\n * glide; pass `shouldFilter` to hand matching and ranking to cmdk (its\n * imperative reorder skips the animation).\n *\n * Rows share one layout via `Command.Item` `level` — idle\n * `item` → `subitem` → `subsubitem`, or flat `result` while searching.\n */\nexport const Command = {\n Root,\n InputGroup,\n Input,\n List,\n Empty,\n Group,\n Item,\n ItemIcon,\n ItemTitle,\n Separator,\n Loading,\n Dialog,\n};\n\n/** Re-export of cmdk's state selector hook (search, value, filtered counts). */\nexport { useCommandState };\n"],"mappings":";;;;;;;;;;;AAsBA,IAAM,IAAkB;AAExB,SAAS,EAAK,EAMZ,cAAA,IAAe,IACf,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACuC;AAG1C,QAAM,IAAkB,EAAM;AAC9B,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,WAAW,EACT,qFACA,CACF;AAAA,IACc,cAAA;AAAA,IACd,GAAI;AAAA,IAEJ,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAa,IAAI;AAAA,MAAkB,UAAA;AAAA,IAAsB,CAAA;AAAA,EACzC,CAAA;AAEtB;AAOA,SAAS,EAAW,EAAE,WAAA,GAAW,GAAG,EAAA,GAAgC;AAClE,SACE,gBAAA,EAAC,OAAD;AAAA,IACE,WAAW,EACT,4DACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAGA,IAAM,IACJ,OAAO,SAAW,MAAc,IAAY;AAE9C,SAAS,EAAa,GAAyB,GAAiB;AAC9D,EAAI,OAAO,KAAQ,aAAY,EAAI,CAAK,IAC/B,MAAK,EAAI,UAAU;AAC9B;AAEA,SAAS,EAAM,EACb,WAAA,GACA,OAAA,GACA,KAAK,GACL,GAAG,EAAA,GAC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D,SACE,gBAAA,EAAC,EAAiB,WAAlB;AAAA,IACE,WAAW,EACT,0DACA,CACF;AAAA,IACA,GAAI;AAAA,EACL,CAAA;AAEL;AAEA,SAAS,EAAQ,EACf,WAAA,GACA,GAAG,EAAA,GAC+C;AAClD,SACE,gBAAA,EAAC,EAAiB,SAAlB;AAAA,IACE,WAAW,EAAG,gDAAgD,CAAS;AAAA,IACvE,GAAI;AAAA,EACL,CAAA;AAEL;AAsBA,SAAS,GAAO,EACd,MAAA,GACA,cAAA,GACA,OAAA,GACA,WAAA,GACA,UAAA,GACA,GAAG,EAAA,GACkB;AACrB,SACE,gBAAA,EAAC,EAAU,MAAX;AAAA,IAAsB,MAAA;AAAA,IAAoB,cAAA;AAAA,IACxC,UAAA,gBAAA,EAAC,EAAU,QAAX,EAAA,UAAA,CACE,gBAAA,EAAC,EAAU,UAAX,CAAqB,CAAA,GACrB,gBAAA,EAAC,EAAU,OAAX;AAAA,MACE,cAAY;AAAA,MAGZ,WAAW,EACT,mEACA,CACF;AAAA,MAKA,UAAA,gBAAA,EAAC,EAAO,KAAR;AAAA,QAAY,YAAA;AAAA,QACV,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAa,OAAA;AAAA,UAAO,GAAI;AAAA,UACrB,UAAA;AAAA,QACG,CAAA;AAAA,MACI,CAAA;AAAA,IACG,CAAA,CACD,EAAA,CAAA;AAAA,EACJ,CAAA;AAEpB;AAaA,IAAa,KAAU;AAAA,EACrB,MAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AACF"}
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as p } from "./cn-ChIgwEl3.js";
|
|
3
|
+
import { t as Ue } from "./createReactComponent-BqCmnqfX.js";
|
|
4
|
+
import { t as me } from "./calendar-4OFiCLAv.js";
|
|
5
|
+
import { t as V } from "./popover-BhBJO346.js";
|
|
6
|
+
import { useCallback as Ze, useEffect as We, useId as Je, useRef as Q, useState as x, useSyncExternalStore as Qe } from "react";
|
|
7
|
+
import { Fragment as te, jsx as f, jsxs as y } from "react/jsx-runtime";
|
|
8
|
+
var Xe = [
|
|
9
|
+
["path", {
|
|
10
|
+
d: "M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12",
|
|
11
|
+
key: "svg-0"
|
|
12
|
+
}],
|
|
13
|
+
["path", {
|
|
14
|
+
d: "M16 3v4",
|
|
15
|
+
key: "svg-1"
|
|
16
|
+
}],
|
|
17
|
+
["path", {
|
|
18
|
+
d: "M8 3v4",
|
|
19
|
+
key: "svg-2"
|
|
20
|
+
}],
|
|
21
|
+
["path", {
|
|
22
|
+
d: "M4 11h16",
|
|
23
|
+
key: "svg-3"
|
|
24
|
+
}],
|
|
25
|
+
["path", {
|
|
26
|
+
d: "M11 15h1",
|
|
27
|
+
key: "svg-4"
|
|
28
|
+
}],
|
|
29
|
+
["path", {
|
|
30
|
+
d: "M12 15v3",
|
|
31
|
+
key: "svg-5"
|
|
32
|
+
}]
|
|
33
|
+
], pe = Ue("outline", "calendar", "Calendar", Xe), $e = {
|
|
34
|
+
hour: 3600,
|
|
35
|
+
minute: 60,
|
|
36
|
+
second: 1
|
|
37
|
+
}, ge = {
|
|
38
|
+
sm: "px-3 py-2 text-md md:text-base",
|
|
39
|
+
md: "px-3 py-2 text-md",
|
|
40
|
+
lg: "px-3.5 py-2.5 text-md"
|
|
41
|
+
}, ve = {
|
|
42
|
+
sm: "rounded-base",
|
|
43
|
+
md: "rounded-base",
|
|
44
|
+
lg: "squircle rounded-base"
|
|
45
|
+
}, be = p("bg-pho-primary ring-pho-primary text-pho-primary relative flex cursor-pointer items-center gap-2 text-left ring-1 ring-inset", "transition-shadow duration-100 ease-linear focus-visible:outline-none", "data-[invalid]:ring-pho-error-subtle data-[invalid]:ring-[1.5px]"), et = p("has-[input:focus-visible]:ring-pho-brand data-[popup-open]:ring-pho-brand has-[input:focus-visible]:ring-2 data-[popup-open]:ring-2", "data-[invalid]:has-[input:focus-visible]:ring-pho-error data-[invalid]:data-[popup-open]:ring-pho-error", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50"), tt = p("has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2", "data-[invalid]:has-[input:focus-visible]:ring-pho-error", "has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50"), nt = p("flex shrink-0 cursor-pointer items-center rounded-sm px-2.5 py-1.5 text-left text-base whitespace-nowrap select-none", "text-pho-secondary transition-[color,background-color] duration-150 ease-out", "hover:bg-pho-ghost-hover hover:text-pho-primary", "outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-1", "sm:w-full"), rt = "bg-pho-ghost-hover text-pho-primary font-medium", ot = /[\u00a0\u2000-\u200a\u202f\u205f\u3000]/g, A = (e) => e.replace(ot, " "), Ce = {
|
|
46
|
+
year: "numeric",
|
|
47
|
+
month: "2-digit",
|
|
48
|
+
day: "2-digit"
|
|
49
|
+
}, at = {
|
|
50
|
+
hour: {
|
|
51
|
+
hour: "2-digit",
|
|
52
|
+
minute: "2-digit",
|
|
53
|
+
hourCycle: "h23"
|
|
54
|
+
},
|
|
55
|
+
minute: {
|
|
56
|
+
hour: "2-digit",
|
|
57
|
+
minute: "2-digit",
|
|
58
|
+
hourCycle: "h23"
|
|
59
|
+
},
|
|
60
|
+
second: {
|
|
61
|
+
hour: "2-digit",
|
|
62
|
+
minute: "2-digit",
|
|
63
|
+
second: "2-digit",
|
|
64
|
+
hourCycle: "h23"
|
|
65
|
+
}
|
|
66
|
+
}, R = "–", ke = new Date(2026, 8, 12, 15, 4, 5);
|
|
67
|
+
function Se(e, t) {
|
|
68
|
+
return new Intl.DateTimeFormat(e, {
|
|
69
|
+
...Ce,
|
|
70
|
+
...t ? at[t] : {}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
var Te = (e) => e === "year" || e === "month" || e === "day";
|
|
74
|
+
function it(e) {
|
|
75
|
+
return new Intl.DateTimeFormat(e, Ce).formatToParts(ke).map((t) => t.type).filter(Te);
|
|
76
|
+
}
|
|
77
|
+
var st = {
|
|
78
|
+
year: "yyyy",
|
|
79
|
+
month: "mm",
|
|
80
|
+
day: "dd"
|
|
81
|
+
};
|
|
82
|
+
function lt(e, t) {
|
|
83
|
+
return A(Se(e, t).formatToParts(ke).map((n) => Te(n.type) ? st[n.type] : n.type === "hour" ? "hh" : n.type === "minute" ? "mm" : n.type === "second" ? "ss" : n.value).join(""));
|
|
84
|
+
}
|
|
85
|
+
function ut(e, t, n) {
|
|
86
|
+
if (e == null) return "";
|
|
87
|
+
const c = Se(t, n);
|
|
88
|
+
return e instanceof Date ? A(c.format(e)) : e.from == null ? "" : e.to == null || n == null && e.from.getFullYear() === e.to.getFullYear() && e.from.getMonth() === e.to.getMonth() && e.from.getDate() === e.to.getDate() ? A(c.format(e.from)) : A(ct(c, e.from, e.to, n != null));
|
|
89
|
+
}
|
|
90
|
+
function ct(e, t, n, c) {
|
|
91
|
+
const o = e.formatToParts(t), s = e.formatToParts(n), l = (d) => d.map((N) => N.value).join("");
|
|
92
|
+
if (c || o.length !== s.length) return `${l(o)}${R}${l(s)}`;
|
|
93
|
+
const h = (d) => o[d].type === s[d].type && o[d].value === s[d].value;
|
|
94
|
+
if (o[0]?.type === "year") {
|
|
95
|
+
let d = 0;
|
|
96
|
+
for (; d < o.length && h(d); ) d += 1;
|
|
97
|
+
for (; d > 0 && s[d - 1].type !== "literal"; ) d -= 1;
|
|
98
|
+
return d > 0 && d < o.length ? `${l(o)}${R}${l(s.slice(d))}` : `${l(o)}${R}${l(s)}`;
|
|
99
|
+
}
|
|
100
|
+
let u = o.length;
|
|
101
|
+
for (; u > 0 && h(u - 1); ) u -= 1;
|
|
102
|
+
for (; u < o.length && o[u].type !== "literal"; ) u += 1;
|
|
103
|
+
return u > 0 && u < o.length ? `${l(o.slice(0, u))}${R}${l(s)}` : `${l(o)}${R}${l(s)}`;
|
|
104
|
+
}
|
|
105
|
+
var O = (e) => String(e).padStart(2, "0");
|
|
106
|
+
function M(e) {
|
|
107
|
+
return `${e.getFullYear()}-${O(e.getMonth() + 1)}-${O(e.getDate())}`;
|
|
108
|
+
}
|
|
109
|
+
function Ee(e, t) {
|
|
110
|
+
const n = `${O(e.getHours())}:${O(e.getMinutes())}`;
|
|
111
|
+
return t === "second" ? `${n}:${O(e.getSeconds())}` : n;
|
|
112
|
+
}
|
|
113
|
+
function X(e, t) {
|
|
114
|
+
return `${M(e)}T${Ee(e, t)}`;
|
|
115
|
+
}
|
|
116
|
+
function j(e) {
|
|
117
|
+
const t = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2}))?)?$/.exec(e);
|
|
118
|
+
if (!t) return;
|
|
119
|
+
const [, n, c, o, s, l, h] = t, u = new Date(Number(n), Number(c) - 1, Number(o), Number(s ?? 0), Number(l ?? 0), Number(h ?? 0), 0);
|
|
120
|
+
return Number.isNaN(u.getTime()) ? void 0 : u;
|
|
121
|
+
}
|
|
122
|
+
function ye(e, t, n, c) {
|
|
123
|
+
const o = e < 100 ? 2e3 + e : e;
|
|
124
|
+
if (t < 1 || t > 12 || n < 1 || n > 31) return;
|
|
125
|
+
const [s = 0, l = 0, h = 0] = c;
|
|
126
|
+
if (s > 23 || l > 59 || h > 59) return;
|
|
127
|
+
const u = new Date(o, t - 1, n, s, l, h, 0);
|
|
128
|
+
return u.getMonth() === t - 1 && u.getDate() === n ? u : void 0;
|
|
129
|
+
}
|
|
130
|
+
function dt(e, t) {
|
|
131
|
+
const n = e.trim();
|
|
132
|
+
if (n === "") return;
|
|
133
|
+
const c = (n.match(/\d+/g) ?? []).map(Number);
|
|
134
|
+
if (c.length >= 3) {
|
|
135
|
+
const s = c.slice(3);
|
|
136
|
+
if (/\bpm\b/i.test(n) && s[0] !== void 0 && s[0] < 12 ? s[0] += 12 : /\bam\b/i.test(n) && s[0] === 12 && (s[0] = 0), /^\d{4}\D/.test(n)) {
|
|
137
|
+
const [h, u, d] = c;
|
|
138
|
+
return ye(h, u, d, s);
|
|
139
|
+
}
|
|
140
|
+
const l = {};
|
|
141
|
+
if (it(t).forEach((h, u) => {
|
|
142
|
+
l[h] = c[u];
|
|
143
|
+
}), l.year != null && l.month != null && l.day != null) {
|
|
144
|
+
const h = ye(l.year, l.month, l.day, s);
|
|
145
|
+
if (h) return h;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (!/[a-z]/i.test(n) || c.length < 2 || !/\b\d{4}\b/.test(n)) return;
|
|
149
|
+
const o = new Date(n);
|
|
150
|
+
return Number.isNaN(o.getTime()) ? void 0 : o;
|
|
151
|
+
}
|
|
152
|
+
function g(e, t) {
|
|
153
|
+
const n = new Date(e);
|
|
154
|
+
return n.setMilliseconds(0), t === "second" || (n.setSeconds(0), t === "minute") || (n.setMinutes(0), t === "hour") || n.setHours(0), n;
|
|
155
|
+
}
|
|
156
|
+
function we(e) {
|
|
157
|
+
return e == null ? "" : e instanceof Date ? String(e.getTime()) : `${e.from?.getTime() ?? ""}-${e.to?.getTime() ?? ""}`;
|
|
158
|
+
}
|
|
159
|
+
function z(e, t) {
|
|
160
|
+
const n = new Date(e);
|
|
161
|
+
return t && n.setHours(t.getHours(), t.getMinutes(), t.getSeconds(), 0), n;
|
|
162
|
+
}
|
|
163
|
+
var ft = (e) => new Date(e.getFullYear(), e.getMonth(), 1), ht = (e) => new Date(e.getFullYear(), e.getMonth() + 1, 0), mt = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate()), xe = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59, 999), De = (e, t) => e && e > t ? e : t, Me = (e, t) => e && e < t ? e : t;
|
|
164
|
+
function pt(e) {
|
|
165
|
+
if (e?.hidden != null) return null;
|
|
166
|
+
let t, n;
|
|
167
|
+
const c = e?.disabled == null ? [] : Array.isArray(e.disabled) ? e.disabled : [e.disabled];
|
|
168
|
+
for (const o of c) {
|
|
169
|
+
if (o == null || typeof o != "object" || o instanceof Date || Object.keys(o).length !== 1) return null;
|
|
170
|
+
if ("before" in o && o.before instanceof Date) t = De(t, mt(o.before));
|
|
171
|
+
else if ("after" in o && o.after instanceof Date) n = Me(n, xe(o.after));
|
|
172
|
+
else return null;
|
|
173
|
+
}
|
|
174
|
+
return e?.startMonth && (t = De(t, ft(e.startMonth))), e?.endMonth && (n = Me(n, xe(ht(e.endMonth)))), {
|
|
175
|
+
min: t,
|
|
176
|
+
max: n
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
var Ne = "(pointer: coarse)";
|
|
180
|
+
function gt() {
|
|
181
|
+
const e = Ze((t) => {
|
|
182
|
+
if (typeof window > "u" || !window.matchMedia) return () => {
|
|
183
|
+
};
|
|
184
|
+
const n = window.matchMedia(Ne);
|
|
185
|
+
return n.addEventListener("change", t), () => n.removeEventListener("change", t);
|
|
186
|
+
}, []);
|
|
187
|
+
return Qe(e, () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(Ne).matches, () => !1);
|
|
188
|
+
}
|
|
189
|
+
function ee({ label: e, value: t, time: n, disabled: c, onChange: o }) {
|
|
190
|
+
return /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f("span", {
|
|
191
|
+
className: "text-pho-description text-xs",
|
|
192
|
+
children: e
|
|
193
|
+
}), /* @__PURE__ */ f("label", {
|
|
194
|
+
className: p("bg-pho-primary ring-pho-primary rounded-sm px-2 py-1 ring-1 ring-inset", "focus-within:ring-pho-brand transition-shadow duration-100 ease-linear focus-within:ring-2"),
|
|
195
|
+
children: /* @__PURE__ */ f("input", {
|
|
196
|
+
type: "time",
|
|
197
|
+
step: $e[n],
|
|
198
|
+
disabled: c,
|
|
199
|
+
"aria-label": e,
|
|
200
|
+
value: t ? Ee(t, n) : "",
|
|
201
|
+
onChange: (s) => o(s.target.value),
|
|
202
|
+
className: p("text-pho-primary w-full bg-transparent text-base tabular-nums outline-none", "[&::-webkit-calendar-picker-indicator]:hidden")
|
|
203
|
+
})
|
|
204
|
+
})] });
|
|
205
|
+
}
|
|
206
|
+
function vt(e) {
|
|
207
|
+
const { mode: t = "single", defaultValue: n, onValueChange: c, label: o, hint: s, placeholder: l, invalid: h, disabled: u, required: d, size: N = "md", width: $ = "fill", time: a, locales: G, calendarProps: S, id: Ie, className: ne, selectedPreset: H, align: Fe = "start", "aria-label": re } = e, Y = e.presets, { minDays: Pe, maxDays: Re } = e, oe = "value" in e, [Ae, Oe] = x(n), _ = oe ? e.value : Ae, [C, k] = x(!1), T = Q(0), q = l ?? (t === "range" ? "Pick a date range" : lt(G, a)), _e = Je(), E = Ie ?? _e, K = s ? `${E}-hint` : void 0, ae = `${E}-calendar`, [ie, se] = x(!1), B = (r = !1) => {
|
|
208
|
+
C || (T.current = 0, F(void 0), se(r), k(!0));
|
|
209
|
+
}, le = c, v = (r, i) => {
|
|
210
|
+
i ? Z(!1) : (Z(!0), ue(null)), oe || Oe(r), i ? le?.(r, i) : le?.(r);
|
|
211
|
+
}, b = t === "single" ? _ : void 0, m = t === "range" ? _ : void 0, Le = b ?? m?.from, [Ve, w] = x(null), [U, ue] = x(null), [je, Z] = x(!1);
|
|
212
|
+
We(() => {
|
|
213
|
+
Z(!1);
|
|
214
|
+
}, [H]);
|
|
215
|
+
const W = H && !je ? H : U && U.key === we(_) ? U.label : null, I = Ve ?? W ?? ut(_, G, a), ze = Math.max(I.length, t === "range" ? 0 : q.length, 1), ce = $ === "hug" && t === "range", Ge = (r) => {
|
|
216
|
+
const i = typeof r.value == "function" ? r.value() : r.value;
|
|
217
|
+
ue({
|
|
218
|
+
label: r.label,
|
|
219
|
+
key: we(i)
|
|
220
|
+
}), w(null), v(i, { preset: r }), k(!1);
|
|
221
|
+
}, [He, F] = x(void 0), [Ye] = x(() => S?.today ?? /* @__PURE__ */ new Date()), de = He ?? S?.defaultMonth ?? Le ?? Ye, J = Q(null), fe = Q(null), qe = gt(), D = pt(S), Ke = qe && t === "single" && D != null && !Y?.length, Be = /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f(pe, { className: "text-pho-secondary size-4 shrink-0" }), /* @__PURE__ */ f("span", {
|
|
222
|
+
className: p("min-w-0 flex-1 truncate", I === "" && "text-pho-placeholder"),
|
|
223
|
+
children: I === "" ? q : I
|
|
224
|
+
})] });
|
|
225
|
+
return /* @__PURE__ */ y("div", {
|
|
226
|
+
className: p("flex flex-col gap-1.5", $ === "hug" ? "w-fit" : "w-full"),
|
|
227
|
+
children: [
|
|
228
|
+
o ? /* @__PURE__ */ y("label", {
|
|
229
|
+
htmlFor: E,
|
|
230
|
+
className: "text-pho-secondary flex w-fit cursor-default items-center gap-0.5 text-base font-medium",
|
|
231
|
+
children: [o, d ? /* @__PURE__ */ f("span", {
|
|
232
|
+
className: "text-pho-brand",
|
|
233
|
+
children: "*"
|
|
234
|
+
}) : null]
|
|
235
|
+
}) : null,
|
|
236
|
+
Ke ? /* @__PURE__ */ y("div", {
|
|
237
|
+
"data-invalid": h || void 0,
|
|
238
|
+
className: p(be, tt, $ === "hug" ? "w-fit" : "w-full", ge[N], ve[N], ne),
|
|
239
|
+
children: [Be, /* @__PURE__ */ f("input", {
|
|
240
|
+
id: E,
|
|
241
|
+
type: a ? "datetime-local" : "date",
|
|
242
|
+
step: a ? $e[a] : void 0,
|
|
243
|
+
min: D?.min ? a ? X(g(D.min, a), a) : M(D.min) : void 0,
|
|
244
|
+
max: D?.max ? a ? X(g(D.max, a), a) : M(D.max) : void 0,
|
|
245
|
+
required: d,
|
|
246
|
+
disabled: u,
|
|
247
|
+
"aria-label": re,
|
|
248
|
+
"aria-describedby": K,
|
|
249
|
+
value: b ? a ? X(b, a) : M(b) : "",
|
|
250
|
+
onChange: (r) => {
|
|
251
|
+
const i = j(r.target.value);
|
|
252
|
+
v(i ? g(i, a) : void 0);
|
|
253
|
+
},
|
|
254
|
+
className: "absolute inset-0 size-full cursor-pointer opacity-0"
|
|
255
|
+
})]
|
|
256
|
+
}) : /* @__PURE__ */ y(V.Root, {
|
|
257
|
+
open: C,
|
|
258
|
+
onOpenChange: (r, i) => {
|
|
259
|
+
!r && i.reason === "outside-press" && i.event.target instanceof Node && J.current?.contains(i.event.target) || (r ? (T.current = 0, F(void 0)) : (w(null), se(!1)), k(r));
|
|
260
|
+
},
|
|
261
|
+
children: [/* @__PURE__ */ y("div", {
|
|
262
|
+
ref: J,
|
|
263
|
+
"data-invalid": h || void 0,
|
|
264
|
+
"data-popup-open": C || void 0,
|
|
265
|
+
className: p(be, et, $ === "hug" ? "w-fit" : "w-full", ge[N], ve[N], ne),
|
|
266
|
+
children: [/* @__PURE__ */ f(pe, { className: "text-pho-secondary size-4 shrink-0" }), /* @__PURE__ */ f("input", {
|
|
267
|
+
id: E,
|
|
268
|
+
type: "text",
|
|
269
|
+
readOnly: t === "range",
|
|
270
|
+
disabled: u,
|
|
271
|
+
required: d,
|
|
272
|
+
placeholder: q,
|
|
273
|
+
"aria-label": re,
|
|
274
|
+
"aria-describedby": K,
|
|
275
|
+
role: "combobox",
|
|
276
|
+
"aria-haspopup": "dialog",
|
|
277
|
+
"aria-expanded": C,
|
|
278
|
+
"aria-controls": C ? ae : void 0,
|
|
279
|
+
autoComplete: "off",
|
|
280
|
+
spellCheck: !1,
|
|
281
|
+
value: I,
|
|
282
|
+
onFocus: () => B(),
|
|
283
|
+
onMouseDown: () => B(),
|
|
284
|
+
onChange: (r) => {
|
|
285
|
+
const i = r.target.value;
|
|
286
|
+
if (w(i), i.trim() === "") {
|
|
287
|
+
v(void 0);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const P = dt(i, G);
|
|
291
|
+
P && (v(g(P, a)), F(P));
|
|
292
|
+
},
|
|
293
|
+
onBlur: () => w(null),
|
|
294
|
+
onKeyDown: (r) => {
|
|
295
|
+
if (r.key === "Escape" && C) {
|
|
296
|
+
r.preventDefault(), w(null), k(!1);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (r.key === "ArrowDown") {
|
|
300
|
+
r.preventDefault();
|
|
301
|
+
const i = fe.current?.querySelector("td[data-day] button[tabindex='0']");
|
|
302
|
+
if (i) {
|
|
303
|
+
i.focus();
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
B(!0);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
size: $ === "hug" && !ce ? ze : void 0,
|
|
310
|
+
className: p("text-pho-primary placeholder:text-pho-placeholder bg-transparent outline-none", ce ? "field-sizing-content w-auto min-w-min" : $ === "hug" ? "min-w-0" : "min-w-0 flex-1", t === "range" && "cursor-pointer")
|
|
311
|
+
})]
|
|
312
|
+
}), /* @__PURE__ */ f(V.Portal, { children: /* @__PURE__ */ f(V.Positioner, {
|
|
313
|
+
anchor: J,
|
|
314
|
+
align: Fe,
|
|
315
|
+
sideOffset: 6,
|
|
316
|
+
children: /* @__PURE__ */ f(V.Popup, {
|
|
317
|
+
ref: fe,
|
|
318
|
+
id: ae,
|
|
319
|
+
initialFocus: !1,
|
|
320
|
+
finalFocus: !1,
|
|
321
|
+
className: "max-h-[var(--available-height)] overflow-y-auto p-3",
|
|
322
|
+
children: /* @__PURE__ */ y("div", {
|
|
323
|
+
className: "flex flex-col gap-3 sm:flex-row",
|
|
324
|
+
children: [Y?.length ? /* @__PURE__ */ f("div", {
|
|
325
|
+
role: "group",
|
|
326
|
+
"aria-label": "Presets",
|
|
327
|
+
className: p("flex shrink-0 gap-1 overflow-x-auto", "sm:border-pho-secondary sm:w-36 sm:flex-col sm:gap-0.5 sm:overflow-visible sm:border-r sm:pr-3"),
|
|
328
|
+
children: Y.map((r) => /* @__PURE__ */ f("button", {
|
|
329
|
+
type: "button",
|
|
330
|
+
"aria-pressed": r.label === W,
|
|
331
|
+
onClick: () => Ge(r),
|
|
332
|
+
className: p(nt, r.label === W && rt),
|
|
333
|
+
children: r.label
|
|
334
|
+
}, r.label))
|
|
335
|
+
}) : null, /* @__PURE__ */ y("div", { children: [t === "range" ? /* @__PURE__ */ f(me, {
|
|
336
|
+
...S,
|
|
337
|
+
mode: "range",
|
|
338
|
+
min: Pe,
|
|
339
|
+
max: Re,
|
|
340
|
+
month: de,
|
|
341
|
+
onMonthChange: F,
|
|
342
|
+
autoFocus: ie,
|
|
343
|
+
selected: m,
|
|
344
|
+
onSelect: (r, i) => {
|
|
345
|
+
const P = T.current === 0;
|
|
346
|
+
if (T.current += 1, P && m?.to) {
|
|
347
|
+
const he = g(z(i, a ? m.from : void 0), a);
|
|
348
|
+
v({
|
|
349
|
+
from: he,
|
|
350
|
+
to: new Date(he)
|
|
351
|
+
}), w(null);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const L = r && {
|
|
355
|
+
from: r.from && g(z(r.from, a ? m?.from : void 0), a),
|
|
356
|
+
to: r.to && g(z(r.to, a ? m?.to : void 0), a)
|
|
357
|
+
};
|
|
358
|
+
v(L), w(null), !a && T.current >= 2 && (!L || L.from && L.to) && k(!1);
|
|
359
|
+
}
|
|
360
|
+
}) : /* @__PURE__ */ f(me, {
|
|
361
|
+
...S,
|
|
362
|
+
mode: "single",
|
|
363
|
+
month: de,
|
|
364
|
+
onMonthChange: F,
|
|
365
|
+
autoFocus: ie,
|
|
366
|
+
selected: b,
|
|
367
|
+
onSelect: (r) => {
|
|
368
|
+
v(r && g(z(r, a ? b : void 0), a)), w(null), a || k(!1);
|
|
369
|
+
}
|
|
370
|
+
}), a ? /* @__PURE__ */ f("div", {
|
|
371
|
+
className: "border-pho-secondary mt-3 grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 border-t pt-3",
|
|
372
|
+
children: t === "range" ? /* @__PURE__ */ y(te, { children: [/* @__PURE__ */ f(ee, {
|
|
373
|
+
label: "From",
|
|
374
|
+
value: m?.from,
|
|
375
|
+
time: a,
|
|
376
|
+
onChange: (r) => {
|
|
377
|
+
if (!m?.from) return;
|
|
378
|
+
const i = j(`${M(m.from)}T${r}`);
|
|
379
|
+
i && v({
|
|
380
|
+
...m,
|
|
381
|
+
from: g(i, a)
|
|
382
|
+
});
|
|
383
|
+
},
|
|
384
|
+
disabled: !m?.from
|
|
385
|
+
}), /* @__PURE__ */ f(ee, {
|
|
386
|
+
label: "To",
|
|
387
|
+
value: m?.to,
|
|
388
|
+
time: a,
|
|
389
|
+
onChange: (r) => {
|
|
390
|
+
if (!m?.to) return;
|
|
391
|
+
const i = j(`${M(m.to)}T${r}`);
|
|
392
|
+
i && v({
|
|
393
|
+
...m,
|
|
394
|
+
to: g(i, a)
|
|
395
|
+
});
|
|
396
|
+
},
|
|
397
|
+
disabled: !m?.to
|
|
398
|
+
})] }) : /* @__PURE__ */ f(ee, {
|
|
399
|
+
label: "Time",
|
|
400
|
+
value: b,
|
|
401
|
+
time: a,
|
|
402
|
+
onChange: (r) => {
|
|
403
|
+
if (!b) return;
|
|
404
|
+
const i = j(`${M(b)}T${r}`);
|
|
405
|
+
i && v(g(i, a));
|
|
406
|
+
},
|
|
407
|
+
disabled: !b
|
|
408
|
+
})
|
|
409
|
+
}) : null] })]
|
|
410
|
+
})
|
|
411
|
+
})
|
|
412
|
+
}) })]
|
|
413
|
+
}),
|
|
414
|
+
s ? /* @__PURE__ */ f("p", {
|
|
415
|
+
id: K,
|
|
416
|
+
className: p("text-pho-description text-base", h && "text-pho-error"),
|
|
417
|
+
children: s
|
|
418
|
+
}) : null
|
|
419
|
+
]
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
vt.displayName = "DatePicker";
|
|
423
|
+
export {
|
|
424
|
+
ut as n,
|
|
425
|
+
vt as t
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
//# sourceMappingURL=date-picker-CZbcNIe-.js.map
|