@photon-ai/pho-ui 4.26.0 → 4.27.1
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/README.md +2 -2
- package/dist/chunks/{avatar-PgBOfszL.js → avatar-BJvgi8ON.js} +24 -30
- package/dist/chunks/avatar-BJvgi8ON.js.map +1 -0
- package/dist/chunks/{basic-page-aep8pM4s.js → basic-page-DSPzDKrZ.js} +79 -82
- package/dist/chunks/basic-page-DSPzDKrZ.js.map +1 -0
- package/dist/chunks/{box-search-CMl5bQ7Y.js → box-search-DD2EPtDy.js} +18 -19
- package/dist/chunks/box-search-DD2EPtDy.js.map +1 -0
- package/dist/chunks/{calendar-DDWITGo4.js → calendar-s-QRks1Z.js} +66 -69
- package/dist/chunks/calendar-s-QRks1Z.js.map +1 -0
- package/dist/chunks/{chat-D98GCjbe.js → chat-D6SGRahp.js} +226 -276
- package/dist/chunks/chat-D6SGRahp.js.map +1 -0
- package/dist/chunks/{checkbox-D8smFViR.js → checkbox-B3fVczYP.js} +2 -2
- package/dist/chunks/checkbox-B3fVczYP.js.map +1 -0
- package/dist/chunks/{close-button-Ck4rY1Fp.js → close-button-Bwv_OoCZ.js} +2 -2
- package/dist/chunks/close-button-Bwv_OoCZ.js.map +1 -0
- package/dist/chunks/{code-block-CthLWfxd.js → code-block-CiZWZBO2.js} +169 -238
- package/dist/chunks/code-block-CiZWZBO2.js.map +1 -0
- package/dist/chunks/copy-button-DNNZu6r4.js +69 -0
- package/dist/chunks/copy-button-DNNZu6r4.js.map +1 -0
- package/dist/chunks/{data-table-C1tLUdw0.js → data-table-CshUlqIu.js} +11 -12
- package/dist/chunks/data-table-CshUlqIu.js.map +1 -0
- package/dist/chunks/{date-picker-D-sWo3i8.js → date-picker-BaAkim2u.js} +126 -151
- package/dist/chunks/date-picker-BaAkim2u.js.map +1 -0
- package/dist/chunks/{description-list-DcTvBHzI.js → description-list-VTNz1MmJ.js} +2 -2
- package/dist/chunks/{description-list-DcTvBHzI.js.map → description-list-VTNz1MmJ.js.map} +1 -1
- package/dist/chunks/{dialog-H72fZGtf.js → dialog-C116Qr0w.js} +2 -2
- package/dist/chunks/{dialog-H72fZGtf.js.map → dialog-C116Qr0w.js.map} +1 -1
- package/dist/chunks/{filter-bar-D_sBAT5Y.js → filter-bar-DI5JO1Cd.js} +63 -72
- package/dist/chunks/filter-bar-DI5JO1Cd.js.map +1 -0
- package/dist/chunks/{ghost-search-CMUI2UH0.js → ghost-search-DhADxaWi.js} +11 -12
- package/dist/chunks/ghost-search-DhADxaWi.js.map +1 -0
- package/dist/chunks/icons-eq5FZ3Yc.js +1254 -0
- package/dist/chunks/icons-eq5FZ3Yc.js.map +1 -0
- package/dist/chunks/{input-DWnb33UF.js → input-hrrPhzXp.js} +37 -56
- package/dist/chunks/input-hrrPhzXp.js.map +1 -0
- package/dist/chunks/{message-DRAWQlW-.js → message-DO-zoM2w.js} +7 -8
- package/dist/chunks/message-DO-zoM2w.js.map +1 -0
- package/dist/chunks/{select-Dux2SBVc.js → select-DlyDd7AB.js} +10 -10
- package/dist/chunks/select-DlyDd7AB.js.map +1 -0
- package/dist/chunks/{sidebar-ttBkgGRh.js → sidebar-DTRcoxrB.js} +95 -111
- package/dist/chunks/sidebar-DTRcoxrB.js.map +1 -0
- package/dist/chunks/{toast-Cbnn8lcA.js → toast-Btwu5Kjk.js} +7 -7
- package/dist/chunks/toast-Btwu5Kjk.js.map +1 -0
- package/dist/chunks/{trace-ClMpG82z.js → trace-CKYAff2U.js} +498 -607
- package/dist/chunks/trace-CKYAff2U.js.map +1 -0
- package/dist/components/avatar.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/code-block.js +1 -1
- package/dist/components/command.js +36 -37
- package/dist/components/command.js.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.js +2 -2
- package/dist/components/date-picker.js +1 -1
- package/dist/components/description-list.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/error.js +252 -11
- package/dist/components/error.js.map +1 -0
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/message.js +1 -1
- package/dist/components/notification.js +27 -34
- package/dist/components/notification.js.map +1 -1
- package/dist/components/phone-input.js +3 -4
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/scope.js +52 -53
- package/dist/components/scope.js.map +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/theme-toggle.js +69 -95
- package/dist/components/theme-toggle.js.map +1 -1
- package/dist/components/toast.js +1 -1
- package/dist/components/trace.js +1 -1
- package/dist/icons.js +235 -78
- package/dist/icons.js.map +1 -1
- package/dist/index.js +158 -158
- package/dist/sections/basic-page.js +2 -2
- package/dist/sections/sidebar.js +1 -1
- package/dist/src/components/avatar/avatar.d.ts +1 -1
- package/dist/src/components/message/message-status.d.ts +7 -8
- package/dist/src/components/notification/notification.d.ts +2 -2
- package/dist/src/components/trace/decorations.d.ts +3 -3
- package/dist/src/icons/index.d.ts +1 -0
- package/dist/src/icons/photon/icons.d.ts +315 -0
- package/dist/src/icons/photon/index.d.ts +2 -0
- package/dist/src/icons/photon/photon-icon.d.ts +51 -0
- package/package.json +5 -3
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js +0 -14
- package/dist/chunks/IconArrowUpRight-OK8Fp0KQ.js.map +0 -1
- package/dist/chunks/IconCheck-DwSMn1wK.js +0 -11
- package/dist/chunks/IconCheck-DwSMn1wK.js.map +0 -1
- package/dist/chunks/IconChevronDown-Cd68NnX2.js +0 -11
- package/dist/chunks/IconChevronDown-Cd68NnX2.js.map +0 -1
- package/dist/chunks/IconChevronLeft-CptqhdxO.js +0 -11
- package/dist/chunks/IconChevronLeft-CptqhdxO.js.map +0 -1
- package/dist/chunks/IconChevronRight-BNkXCTk6.js +0 -11
- package/dist/chunks/IconChevronRight-BNkXCTk6.js.map +0 -1
- package/dist/chunks/IconChevronUp-Bxllwz8J.js +0 -11
- package/dist/chunks/IconChevronUp-Bxllwz8J.js.map +0 -1
- package/dist/chunks/IconInfoCircle-CTAynhe8.js +0 -21
- package/dist/chunks/IconInfoCircle-CTAynhe8.js.map +0 -1
- package/dist/chunks/IconSearch-DkcWWZ1H.js +0 -14
- package/dist/chunks/IconSearch-DkcWWZ1H.js.map +0 -1
- package/dist/chunks/IconX-DnPlFC68.js +0 -14
- package/dist/chunks/IconX-DnPlFC68.js.map +0 -1
- package/dist/chunks/avatar-PgBOfszL.js.map +0 -1
- package/dist/chunks/basic-page-aep8pM4s.js.map +0 -1
- package/dist/chunks/box-search-CMl5bQ7Y.js.map +0 -1
- package/dist/chunks/calendar-DDWITGo4.js.map +0 -1
- package/dist/chunks/chat-D98GCjbe.js.map +0 -1
- package/dist/chunks/checkbox-D8smFViR.js.map +0 -1
- package/dist/chunks/close-button-Ck4rY1Fp.js.map +0 -1
- package/dist/chunks/code-block-CthLWfxd.js.map +0 -1
- package/dist/chunks/copy-button-BLvirhXk.js +0 -76
- package/dist/chunks/copy-button-BLvirhXk.js.map +0 -1
- package/dist/chunks/data-table-C1tLUdw0.js.map +0 -1
- package/dist/chunks/date-picker-D-sWo3i8.js.map +0 -1
- package/dist/chunks/error-BT71wcUd.js +0 -270
- package/dist/chunks/error-BT71wcUd.js.map +0 -1
- package/dist/chunks/filter-bar-D_sBAT5Y.js.map +0 -1
- package/dist/chunks/ghost-search-CMUI2UH0.js.map +0 -1
- package/dist/chunks/input-DWnb33UF.js.map +0 -1
- package/dist/chunks/message-DRAWQlW-.js.map +0 -1
- package/dist/chunks/select-Dux2SBVc.js.map +0 -1
- package/dist/chunks/sidebar-ttBkgGRh.js.map +0 -1
- package/dist/chunks/toast-Cbnn8lcA.js.map +0 -1
- package/dist/chunks/trace-ClMpG82z.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-table-C1tLUdw0.js","names":["_Fragment","cn","resolveVariant","useLinkComponent","SPRING_ENTRANCE","createReactComponent","IconChevronDown","IconChevronUp","AnimatedHeight","Checkbox","Skeleton","DATA_TABLE_TEXT","DATA_TABLE_HEADER_CELL","DATA_TABLE_SURFACE","DATA_TABLE_BODY","GhostSearch","Fragment","createContext","useContext","useEffect","useLayoutEffect","useMemo","useState","useSyncExternalStore","Fragment$1","jsx","jsxs","FlexRender","columnFilteringFeature","createColumnHelper","createFilteredRowModel","createSortedRowModel","filterFn_includesString","globalFilteringFeature","rowSelectionFeature","rowSortingFeature","sortFn_alphanumeric","sortFn_basic","sortFn_datetime","sortFn_text","tableFeatures","useTable","__iconNode","IconSelector","features","DATA_TABLE_SIZES","createColumns","SELECT_COLUMN","table","visible","chosen","row","all","checked","old","next","TableHostContext","createTableSearchStore","state","listeners","emit","listener","api","adopted","TableSearchContext","subscribeToNothing","DEFAULT_BONES","defaultRowId","index","id","ROW_NAV_IGNORE","shouldIgnoreRowNav","target","activateRowHref","event","href","newTab","DataTable","columns","data","getRowId","rowHref","onRowClick","current","selected","onSelectedChange","defaultSort","sort","onSortChange","search","toolbar","group","animateHeight","loading","empty","layout","size","className","props","fixed","rowSize","rowText","Link","announce","searching","query","setQuery","placeholder","searchStore","selecting","ownSelection","setOwnSelection","rowSelection","ownSort","setOwnSort","sorting","updater","rows","total","matched","leafCount","bones","renderRow","isCurrent","navigable","onActivate","onRowKeyDown","cell","align","mainRows","groupSections","byLabel","order","item","label","sectionRows","grid","headerGroup","header","sorted","sortable","SortIndicator","_","column"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconSelector.mjs","../../src/components/data-table/data-table.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.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","import {\n createContext,\n Fragment,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n type ComponentProps,\n type KeyboardEvent,\n type MouseEvent,\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 IconSelector,\n} from \"@tabler/icons-react\";\nimport { Skeleton } from \"../skeleton\";\nimport {\n DATA_TABLE_BODY,\n DATA_TABLE_HEADER_CELL,\n DATA_TABLE_SURFACE,\n DATA_TABLE_TEXT,\n} from \"./chrome\";\nimport { Checkbox } from \"../checkbox\";\nimport { SPRING_ENTRANCE } from \"../../motion\";\nimport { AnimatedHeight } from \"../../utils/animated-height\";\nimport { cn } from \"../../utils/cn\";\nimport { resolveVariant, type VariantMap } from \"../../utils/resolve-variant\";\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 * Left with no width of its own, the frame takes its container's\n * (`w-full`); a shrink-to-fit host (a flex row) would collapse it.\n * `layout=\"fixed\"` is the other way out: columns size from the frame,\n * and a long cell truncates instead of stretching the table.\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 * Extra classes on every `th` and `td` in this column. With\n * `layout=\"fixed\"`, size a short column here (`w-24`) and leave the\n * flexible ones unsaid — they share what remains. Prefer this over\n * `nth-child` width hacks on the table's `className`.\n */\n className?: string;\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/** Body row height — the header keeps its own `h-10` on every size. */\nexport const DATA_TABLE_SIZES = {\n sm: {\n classes: \"h-10\",\n description: \"Small — 40px at 13px; the header's height, for dense lists\",\n },\n base: {\n classes: \"h-12\",\n description: \"Base — 48px at 14px; one line of body type\",\n },\n lg: {\n classes: \"h-14\",\n description:\n \"Large — 56px at 16px; two-line cells (a number and a caption)\",\n },\n} satisfies VariantMap;\n\nexport type DataTableSize = keyof typeof DATA_TABLE_SIZES;\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 <Checkbox\n size=\"sm\"\n aria-label=\"Select row\"\n checked={row.getIsSelected()}\n onCheckedChange={(checked) => row.toggleSelected(checked === true)}\n />\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 /**\n * A click on the row (not on a link, button, or other control). The\n * table still activates `rowHref` unless the handler calls\n * `preventDefault`.\n */\n onRowClick?: (\n row: TData,\n event: MouseEvent<HTMLTableRowElement> | KeyboardEvent<HTMLTableRowElement>,\n ) => void;\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 /**\n * How columns take width. `auto` (the default) sizes them from their\n * content — a long cell grows the table and the frame scrolls sideways.\n * `fixed` sizes them from the table's width (`table-layout: fixed`):\n * short columns take a width hint on `meta.className`, the rest share\n * what remains, and cells get `min-w-0` so an inner `truncate` can\n * shrink. `width: 0` (`w-0`) is not a content-size hint here — fixed\n * layout treats it as a real zero — so give a short column a real\n * width (`w-24`) rather than the auto-layout shrink-wrap trick.\n */\n layout?: \"auto\" | \"fixed\";\n /**\n * Body row height and the type that comes with it. `base` (the default)\n * is 48px rows at 14px — one line of body type. `sm` is 40px at 13px,\n * the header's own height, for a dense list scanned more than read.\n * `lg` is 56px at 16px, for a two-line cell (a number and a caption)\n * that would crowd `base`. The header row keeps its 40px on every size\n * and follows the type.\n */\n size?: DataTableSize;\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 { GhostSearch, type GhostSearchProps } from \"../../utils/ghost-search\";\nimport { GhostSearch } from \"../../utils/ghost-search\";\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\n/** Controls keep their own click; the row only navigates from empty surface. */\n// A copy view (CopyButton's children) is the copy, not the row's link.\nconst ROW_NAV_IGNORE =\n \"a, button, input, textarea, select, label, [data-copy-view]\";\n\nfunction shouldIgnoreRowNav(target: EventTarget | null): boolean {\n return target instanceof Element && target.closest(ROW_NAV_IGNORE) != null;\n}\n\nfunction activateRowHref(event: MouseEvent<HTMLTableRowElement>, href: string) {\n const newTab =\n event.button === 1 || event.metaKey || event.ctrlKey || event.shiftKey;\n if (event.button === 1) event.preventDefault();\n if (event.button !== 0 && event.button !== 1) return;\n if (newTab) {\n window.open(href, \"_blank\", \"noopener,noreferrer\");\n return;\n }\n event.currentTarget.querySelector<HTMLAnchorElement>(\"a[href]\")?.click();\n}\n\nfunction DataTable<TData extends RowData>({\n columns,\n data,\n getRowId,\n rowHref,\n onRowClick,\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 layout = \"auto\",\n size = \"base\",\n className,\n ...props\n}: DataTableProps<TData>) {\n const fixed = layout === \"fixed\";\n const rowSize = resolveVariant(DATA_TABLE_SIZES, size);\n const rowText = DATA_TABLE_TEXT[size] ?? DATA_TABLE_TEXT.base;\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 const navigable = href != null || onRowClick != null;\n const onActivate = (event: MouseEvent<HTMLTableRowElement>) => {\n if (event.button !== 0 && event.button !== 1) return;\n if (event.defaultPrevented || shouldIgnoreRowNav(event.target)) return;\n onRowClick?.(row.original, event);\n if (event.defaultPrevented || href == null) return;\n activateRowHref(event, href);\n };\n const onRowKeyDown = (event: KeyboardEvent<HTMLTableRowElement>) => {\n if (href != null) return;\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n if (event.defaultPrevented || shouldIgnoreRowNav(event.target)) return;\n event.preventDefault();\n onRowClick?.(row.original, event);\n };\n return (\n <tr\n key={row.id}\n className={cn(\n navigable &&\n \"hover:bg-pho-primary-hover outline-pho-brand cursor-pointer 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 tabIndex={navigable && href == null ? 0 : undefined}\n onClick={navigable ? onActivate : undefined}\n onAuxClick={navigable ? onActivate : undefined}\n onKeyDown={navigable && href == null ? onRowKeyDown : undefined}\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 px-5 align-middle whitespace-nowrap\",\n rowSize,\n fixed && \"min-w-0\",\n align === \"end\" && \"text-right tabular-nums\",\n cell.column.columnDef.meta?.className,\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 // One real link for keyboard and right-click; the row\n // click handler covers the rest of the surface.\n <Link\n href={href}\n aria-current={isCurrent ? \"page\" : undefined}\n className=\"outline-none\"\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={cn(\"w-full border-collapse\", rowText, fixed && \"table-fixed\")}\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 DATA_TABLE_HEADER_CELL,\n \"px-5\",\n fixed && \"min-w-0\",\n align === \"end\" && \"text-right\",\n header.column.columnDef.meta?.className,\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={DATA_TABLE_BODY}>\n {bones.length > 0 ? (\n bones.map((_, index) => (\n <tr key={index}>\n {table.getAllLeafColumns().map((column) => (\n <td\n key={column.id}\n className={cn(\n \"px-5 align-middle\",\n rowSize,\n fixed && \"min-w-0\",\n column.columnDef.meta?.className,\n )}\n >\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 font-heading 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 className={cn(\n DATA_TABLE_SURFACE,\n \"w-full scroll-mt-12 contain-inline-size\",\n !animateHeight && \"overflow-x-auto\",\n className,\n )}\n {...props}\n data-data-table=\"\"\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 onClear={() => 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"],"ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;AASA,IAAM0C,KAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAiB,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAqB,KAAO;AAAQ,CAAC,CAAC,GACxHC,KAAetC,GAAqB,WAAW,YAAY,YAAYqC,EAAU,GCwGjFE,KAAWJ,GAAc;AAAA,EAC7B,mBAAAL;AAAA,EACA,qBAAAD;AAAA,EACA,wBAAAN;AAAA,EACA,wBAAAK;AAAA,EACA,gBAAgBF,GAAqB;AAAA,EACrC,kBAAkBD,GAAuB;AAAA,EACzC,WAAW,EAAE,gBAAgBE,GAAwB;AAAA,EACrD,SAAS;AAAA,IACP,cAAcI;AAAA,IACd,OAAOC;AAAA,IACP,UAAUC;AAAA,IACV,MAAMC;AAAA,EACR;AAAA,EACA,YAAY,CAAC;AACf,CAAC,GAKYM,KAAmB;AAAA,EAC9B,IAAI;AAAA,IACF,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,IAAI;AAAA,IACF,SAAS;AAAA,IACT,aACE;AAAA,EACJ;AACF;AAsBA,SAAgBC,KAAuC;AACrD,SAAOjB,GAA6C;AACtD;AAOA,IAAMkB,KAAgBD,GAAuB,EAAE,QAAQ;AAAA,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AAtC,EAACV,IAAD;AAAA,QACE,OAAO0F;AAAA,QACP,UAAUC;AAAA,QACV,SAAA,MAAeA,EAAS,EAAE;AAAA,QACb,aAAAC;AAAA,QACb,cAAYA;AAAA,MACb,CAAA,GAEFjB,CACE;AAAA,IAEN,CAAA,GAAAE,IAIC,gBAAAnE,EAACjB,IAAD;AAAA,MACE,YAAYJ;AAAA,MACZ,WAAU;AAAA,MAET,UAAAoI;AAAA,IACa,CAAA,IAEhBA,CAEC;AAAA,E;AAET;AAOA,SAASK,GAAc,EAAE,QAAAF,EAAA,GAA8C;AACrE,SACE,gBAAAlH,EAAC,QAAD;AAAA,IACE,eAAA;AAAA,IACA,WAAWxB,EACT,yCACA,CAAC0I,KACC,gGACJ;AAAA,IAEC,UAAAA,MAAW,QACV,gBAAAlH,EAAClB,IAAD,CAAgB,CAAA,IACdoI,MAAW,SACb,gBAAAlH,EAACnB,IAAD,CAAkB,CAAA,IAElB,gBAAAmB,EAACkB,IAAD,CAAe,CAAA;AAAA,EAEb,CAAA;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker-D-sWo3i8.js","names":["_Fragment","cn","createReactComponent","Calendar","Popover","useCallback","useEffect","useId","useRef","useState","useSyncExternalStore","Fragment$1","jsx","jsxs","__iconNode","IconCalendar","TIME_STEP","SIZE_PAD","SIZE_RADIUS","TRIGGER_BASE","TRIGGER_FIELD","TRIGGER_NATIVE","PRESET","PRESET_ON","SPACE_SEPARATORS","flattenSpaces","words","NUMERIC_DATE","NUMERIC_CLOCK","SPAN_DASH","SAMPLE","numericFormat","locales","time","isDatePart","type","numericOrder","part","MASK","dateFieldMask","formatDateLabel","value","format","joinSpan","from","to","hasClock","a","b","text","parts","same","at","cut","keep","pad","n","toDateValue","date","toClockValue","hm","toDateTimeValue","fromInputValue","match","y","m","d","hh","mm","ss","makeLocalDate","shortYear","month","day","clock","year","parseDateText","trimmed","numbers","slots","made","spelled","clampTime","next","valueKey","withDay","keepTimeFrom","startOfMonth","endOfMonth","startOfDay","endOfDay","later","earlier","nativeBounds","calendarProps","min","max","rules","rule","COARSE_POINTER","useCoarsePointer","subscribe","notify","query","ClockField","label","disabled","onChange","event","DatePicker","props","mode","defaultValue","onValueChange","hint","placeholder","invalid","required","size","width","id","className","selectedPreset","align","ariaLabel","presets","minDays","maxDays","controlled","ownValue","setOwnValue","open","setOpen","picks","fieldPlaceholder","generatedId","triggerId","hintId","calendarId","gridFocus","setGridFocus","openPicker","focusGrid","setMonth","commit","details","setIgnoreSelected","setChosen","single","range","anchor","draft","setDraft","chosen","ignoreSelected","presetLabel","hugChars","hugToWords","pickPreset","preset","thisMonth","shownMonth","fieldRef","popupRef","coarse","bounds","native","face","typed","parsed","grid","clicked","first","kept"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconCalendar.mjs","../../src/components/date-picker/date-picker.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.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\": \"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\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M16 3v4\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M8 3v4\", \"key\": \"svg-2\" }], [\"path\", { \"d\": \"M4 11h16\", \"key\": \"svg-3\" }], [\"path\", { \"d\": \"M11 15h1\", \"key\": \"svg-4\" }], [\"path\", { \"d\": \"M12 15v3\", \"key\": \"svg-5\" }]];\nconst IconCalendar = createReactComponent(\"outline\", \"calendar\", \"Calendar\", __iconNode);\n\nexport { __iconNode, IconCalendar as default };\n","import {\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\nimport { IconCalendar } from \"@tabler/icons-react\";\nimport type { DateRange, Matcher, PropsBase } from \"react-day-picker\";\nimport { Calendar } from \"../calendar\";\nimport { Popover } from \"../popover\";\nimport type { InputSize } from \"../input\";\nimport { cn } from \"../../utils/cn\";\n\n/** The trigger wears Input's sizes so the two line up in one form. */\nexport type DatePickerSize = InputSize;\n\n/**\n * How fine the time is asked for, and read back. Omit it for a date alone.\n * The value is always a `Date`; the granularity says which of its parts the\n * viewer sets, and everything below is zeroed.\n */\nexport type DatePickerTime = \"hour\" | \"minute\" | \"second\";\n\n/** `step` for a native time field — the unit it moves and shows. */\nconst TIME_STEP: Record<DatePickerTime, number> = {\n hour: 3600,\n minute: 60,\n second: 1,\n};\n\n// Effective padding matches Input's (12/8px, lg 14/10px); Input reaches it\n// through a 2px wrapper inset it has to compensate for, the trigger directly.\nconst SIZE_PAD: Record<DatePickerSize, string> = {\n // 16px until there is room — a 14px control next to a 16px field looks shrunk.\n sm: \"px-3 py-2 text-md md:text-base\",\n md: \"px-3 py-2 text-md\",\n lg: \"px-3.5 py-2.5 text-md\",\n};\n\nconst SIZE_RADIUS: Record<DatePickerSize, string> = {\n sm: \"rounded-base\",\n md: \"rounded-base\",\n lg: \"squircle rounded-base\",\n};\n\nconst TRIGGER_BASE = cn(\n \"bg-pho-primary ring-pho-primary text-pho-primary relative flex cursor-pointer items-center gap-2 text-left ring-1 ring-inset\",\n \"transition-shadow duration-100 ease-linear focus-visible:outline-none\",\n // Invalid is mid-weight — thicker than the rest hairline, thinner than focus.\n \"data-[invalid]:ring-pho-error-subtle data-[invalid]:ring-[1.5px]\",\n);\n\n// Open or focused, the edge is Input's: the brand ring at 2px in place of the\n// hairline. The popover path focuses the button itself; the native path puts a\n// system field over it, so the ring follows the field inside.\nconst TRIGGER_FIELD = cn(\n \"has-[input:focus-visible]:ring-pho-brand data-[popup-open]:ring-pho-brand has-[input:focus-visible]:ring-2 data-[popup-open]:ring-2\",\n \"data-[invalid]:has-[input:focus-visible]:ring-pho-error data-[invalid]:data-[popup-open]:ring-pho-error\",\n \"has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50\",\n);\n\nconst TRIGGER_NATIVE = cn(\n \"has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2\",\n \"data-[invalid]:has-[input:focus-visible]:ring-pho-error\",\n \"has-[input:disabled]:cursor-not-allowed has-[input:disabled]:opacity-50\",\n);\n\n/**\n * A named window in the rail beside the calendar — the Menu row's manners,\n * since that is what a list of choices is.\n */\nconst PRESET = cn(\n \"flex shrink-0 cursor-pointer items-center rounded-sm px-2.5 py-1.5 text-left text-base whitespace-nowrap select-none\",\n \"text-pho-secondary transition-[color,background-color] duration-150 ease-out\",\n \"hover:bg-pho-ghost-hover hover:text-pho-primary\",\n \"outline-pho-brand focus-visible:outline-2 focus-visible:-outline-offset-1\",\n \"sm:w-full\",\n);\n\n/** The one in play. Quiet, like a highlighted menu row — not an action fill. */\nconst PRESET_ON = \"bg-pho-ghost-hover text-pho-primary font-medium\";\n\n/* ------------------------------------------------------------------ words */\n\n/**\n * ICU disagrees with itself about which space belongs before `AM` and around\n * a range dash: Node sends a narrow no-break space and a thin space where\n * Chrome sends ordinary ones. The two strings look identical and are not, so\n * a server-rendered label would fail to hydrate. Flattening every space\n * separator to the ordinary one makes the words the same on both sides.\n */\nconst SPACE_SEPARATORS = /[\\u00a0\\u2000-\\u200a\\u202f\\u205f\\u3000]/g;\nconst flattenSpaces = (words: string) => words.replace(SPACE_SEPARATORS, \" \");\n\n/** The date's parts, all in figures — the shape that is quickest to type. */\nconst NUMERIC_DATE = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n} as const;\n\n/** The clock, on a 24-hour dial: `15:04` is fewer keystrokes than `3:04 PM`. */\nconst NUMERIC_CLOCK: Record<DatePickerTime, Intl.DateTimeFormatOptions> = {\n hour: { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" },\n minute: { hour: \"2-digit\", minute: \"2-digit\", hourCycle: \"h23\" },\n second: {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n hourCycle: \"h23\",\n },\n};\n\n/**\n * What sits between the two ends of a span. No spaces around it — the field\n * is tight and the dates are already grouped by their own separators. An en\n * dash rather than a hyphen because a hyphen is one: `2026-09-01-08` in a\n * year-first locale would read as three numbers, `2026-09-01–08` as two dates.\n */\nconst SPAN_DASH = \"\\u2013\";\n\n/** A day whose parts are all different, so the locale's order reads clearly. */\nconst SAMPLE = new Date(2026, 8, 12, 15, 4, 5);\n\nfunction numericFormat(\n locales: Intl.LocalesArgument,\n time: DatePickerTime | undefined,\n) {\n return new Intl.DateTimeFormat(locales, {\n ...NUMERIC_DATE,\n ...(time ? NUMERIC_CLOCK[time] : {}),\n });\n}\n\ntype DatePart = \"year\" | \"month\" | \"day\";\nconst isDatePart = (type: string): type is DatePart =>\n type === \"year\" || type === \"month\" || type === \"day\";\n\n/** Which of year, month and day comes first here, and which comes last. */\nfunction numericOrder(locales: Intl.LocalesArgument): DatePart[] {\n return new Intl.DateTimeFormat(locales, NUMERIC_DATE)\n .formatToParts(SAMPLE)\n .map((part) => part.type)\n .filter(isDatePart);\n}\n\nconst MASK: Record<DatePart, string> = {\n year: \"yyyy\",\n month: \"mm\",\n day: \"dd\",\n};\n\n/**\n * The shape to type, in this locale's own order — `mm/dd/yyyy`,\n * `yyyy-mm-dd`, `dd.mm.yyyy`. Lowercase, the way a browser's own date field\n * writes it, so the two paths read alike.\n */\nexport function dateFieldMask(\n locales?: Intl.LocalesArgument,\n time?: DatePickerTime,\n): string {\n return flattenSpaces(\n numericFormat(locales, time)\n .formatToParts(SAMPLE)\n .map((part) =>\n isDatePart(part.type)\n ? MASK[part.type]\n : part.type === \"hour\"\n ? \"hh\"\n : part.type === \"minute\"\n ? \"mm\"\n : part.type === \"second\"\n ? \"ss\"\n : part.value,\n )\n .join(\"\"),\n );\n}\n\n/**\n * The figures in the field — `09/12/2026`, or `09/10/2026–09/13/2026` for a\n * span, in the viewer's locale. An empty or half-finished range prints just\n * the day that is settled; nothing selected prints nothing. Pass `time` to\n * print the clock too, at the precision that was asked for.\n *\n * Figures rather than words (`Sep 12, 2026`) because the field is typed into:\n * a month's name is the one part of a date nobody wants to spell.\n */\nexport function formatDateLabel(\n value: Date | DateRange | undefined,\n locales?: Intl.LocalesArgument,\n time?: DatePickerTime,\n): string {\n if (value == null) return \"\";\n const format = numericFormat(locales, time);\n if (value instanceof Date) return flattenSpaces(format.format(value));\n if (value.from == null) return \"\";\n if (value.to == null) return flattenSpaces(format.format(value.from));\n // A span of one day is a day: printing it twice says nothing the once did\n // not, and the first click of a range makes exactly that shape.\n if (\n time == null &&\n value.from.getFullYear() === value.to.getFullYear() &&\n value.from.getMonth() === value.to.getMonth() &&\n value.from.getDate() === value.to.getDate()\n ) {\n return flattenSpaces(format.format(value.from));\n }\n return flattenSpaces(joinSpan(format, value.from, value.to, time != null));\n}\n\n/**\n * Both ends of a span, with whatever they say twice said once — a shared\n * year, and a shared month behind it, printed at the end that carries it.\n * `09/01–09/08/2026`, `01.–08.09.2026`, `2026-09-01–08`. A span carrying a\n * clock is printed whole.\n *\n * Joined here rather than by `Intl.formatRange`, which does this in `de-DE`\n * and `sv-SE` and not in `en-US` or `en-GB`, and which drops the padding the\n * single-date format asks for. Whole fields only, taken from whichever end\n * the year sits at, so the half that is dropped is never the half that\n * distinguishes the two dates.\n */\nfunction joinSpan(\n format: Intl.DateTimeFormat,\n from: Date,\n to: Date,\n hasClock: boolean,\n): string {\n const a = format.formatToParts(from);\n const b = format.formatToParts(to);\n const text = (parts: Intl.DateTimeFormatPart[]) =>\n parts.map((part) => part.value).join(\"\");\n\n // With a clock in it there is nothing worth merging: the tail fields are\n // hours and minutes, the saving is a year that would then print after a\n // time, and a trim that lands mid-clock eats one end's `:00`.\n if (hasClock || a.length !== b.length) {\n return `${text(a)}${SPAN_DASH}${text(b)}`;\n }\n const same = (at: number) =>\n a[at]!.type === b[at]!.type && a[at]!.value === b[at]!.value;\n\n // The year leads (`yyyy-mm-dd`): the second date drops the shared head.\n if (a[0]?.type === \"year\") {\n let cut = 0;\n while (cut < a.length && same(cut)) cut += 1;\n // Back off to a field boundary so a half-written number never survives.\n while (cut > 0 && b[cut - 1]!.type !== \"literal\") cut -= 1;\n if (cut > 0 && cut < a.length) {\n return `${text(a)}${SPAN_DASH}${text(b.slice(cut))}`;\n }\n return `${text(a)}${SPAN_DASH}${text(b)}`;\n }\n\n // The year trails (`mm/dd/yyyy`, `dd.mm.yyyy`): the first date drops the\n // shared tail.\n let keep = a.length;\n while (keep > 0 && same(keep - 1)) keep -= 1;\n while (keep < a.length && a[keep]!.type !== \"literal\") keep += 1;\n if (keep > 0 && keep < a.length) {\n return `${text(a.slice(0, keep))}${SPAN_DASH}${text(b)}`;\n }\n return `${text(a)}${SPAN_DASH}${text(b)}`;\n}\n\n/* ------------------------------------------------------- date arithmetic */\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\n/** `YYYY-MM-DD` in the viewer's own zone — never `toISOString`, which is UTC. */\nfunction toDateValue(date: Date): string {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\nfunction toClockValue(date: Date, time: DatePickerTime): string {\n const hm = `${pad(date.getHours())}:${pad(date.getMinutes())}`;\n return time === \"second\" ? `${hm}:${pad(date.getSeconds())}` : hm;\n}\n\n/** The `datetime-local` spelling of an instant, at the asked-for precision. */\nfunction toDateTimeValue(date: Date, time: DatePickerTime): string {\n return `${toDateValue(date)}T${toClockValue(date, time)}`;\n}\n\n/**\n * Read back a `date` or `datetime-local` field. Parsed part by part rather\n * than handed to `new Date(string)`, which reads a bare `YYYY-MM-DD` as UTC\n * midnight and lands on the day before west of Greenwich.\n */\nfunction fromInputValue(value: string): Date | undefined {\n const match =\n /^(\\d{4})-(\\d{2})-(\\d{2})(?:T(\\d{2}):(\\d{2})(?::(\\d{2}))?)?$/.exec(value);\n if (!match) return undefined;\n const [, y, m, d, hh, mm, ss] = match;\n const date = new Date(\n Number(y),\n Number(m) - 1,\n Number(d),\n Number(hh ?? 0),\n Number(mm ?? 0),\n Number(ss ?? 0),\n 0,\n );\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\n/** A date the calendar could actually show — `Feb 31` rolled over, so no. */\nfunction makeLocalDate(\n shortYear: number,\n month: number,\n day: number,\n clock: number[],\n): Date | undefined {\n // `12/25/26` means 2026, not the year 26 — and `new Date(26, …)` would say\n // 1926. Two figures are this century.\n const year = shortYear < 100 ? 2000 + shortYear : shortYear;\n if (month < 1 || month > 12 || day < 1 || day > 31) return undefined;\n const [hh = 0, mm = 0, ss = 0] = clock;\n if (hh > 23 || mm > 59 || ss > 59) return undefined;\n const date = new Date(year, month - 1, day, hh, mm, ss, 0);\n return date.getMonth() === month - 1 && date.getDate() === day\n ? date\n : undefined;\n}\n\n/**\n * A date out of whatever the viewer typed, read in the same order the field\n * writes it — so what it shows is what it takes back. `yyyy-mm-dd` is read as\n * itself wherever it turns up, since nothing else starts with four figures,\n * and a date spelled out in words still parses so a paste of `Sep 12, 2026`\n * lands. Three numbers at least: the field must not flicker through\n * Decembers on the way to one date.\n */\nfunction parseDateText(\n text: string,\n locales: Intl.LocalesArgument,\n): Date | undefined {\n const trimmed = text.trim();\n if (trimmed === \"\") return undefined;\n\n const numbers = (trimmed.match(/\\d+/g) ?? []).map(Number);\n if (numbers.length >= 3) {\n const clock = numbers.slice(3);\n // `3:04 pm` is not the shape the field writes, but it is a shape people\n // type; move it onto the 24-hour dial the rest of this speaks.\n if (/\\bpm\\b/i.test(trimmed) && clock[0] !== undefined && clock[0] < 12) {\n clock[0] += 12;\n } else if (/\\bam\\b/i.test(trimmed) && clock[0] === 12) {\n clock[0] = 0;\n }\n\n // Four figures up front can only be a year; no locale puts a day or a\n // month there.\n if (/^\\d{4}\\D/.test(trimmed)) {\n const [year, month, day] = numbers;\n return makeLocalDate(year!, month!, day!, clock);\n }\n\n const slots: Partial<Record<DatePart, number>> = {};\n numericOrder(locales).forEach((part, at) => {\n slots[part] = numbers[at];\n });\n if (slots.year != null && slots.month != null && slots.day != null) {\n const made = makeLocalDate(slots.year, slots.month, slots.day, clock);\n if (made) return made;\n }\n }\n\n // Words — a pasted `Sep 12, 2026`. Only worth trying with letters in it and\n // a four-figure year to go with them: `new Date` turns a bare `Sep 12` into\n // this year's, which is a guess the field should not make.\n if (!/[a-z]/i.test(trimmed)) return undefined;\n if (numbers.length < 2 || !/\\b\\d{4}\\b/.test(trimmed)) return undefined;\n const spelled = new Date(trimmed);\n return Number.isNaN(spelled.getTime()) ? undefined : spelled;\n}\n\n/** Zero everything finer than the granularity, so the value means what it says. */\nfunction clampTime(date: Date, time: DatePickerTime | undefined): Date {\n const next = new Date(date);\n next.setMilliseconds(0);\n if (time === \"second\") return next;\n next.setSeconds(0);\n if (time === \"minute\") return next;\n next.setMinutes(0);\n if (time === \"hour\") return next;\n next.setHours(0);\n return next;\n}\n\n/**\n * A value's identity, for telling whether the window on screen is still the\n * one a preset put there. Instants, so a re-render cannot change the answer.\n */\nfunction valueKey(value: Date | DateRange | undefined): string {\n if (value == null) return \"\";\n if (value instanceof Date) return String(value.getTime());\n return `${value.from?.getTime() ?? \"\"}-${value.to?.getTime() ?? \"\"}`;\n}\n\n/** A day from the calendar, wearing the clock the value already carried. */\nfunction withDay(day: Date, keepTimeFrom: Date | undefined): Date {\n const next = new Date(day);\n if (keepTimeFrom) {\n next.setHours(\n keepTimeFrom.getHours(),\n keepTimeFrom.getMinutes(),\n keepTimeFrom.getSeconds(),\n 0,\n );\n }\n return next;\n}\n\nconst startOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth(), 1);\nconst endOfMonth = (d: Date) => new Date(d.getFullYear(), d.getMonth() + 1, 0);\n// DayPicker's matchers count calendar days, so a bound carrying a time of day\n// disables nothing extra on the calendar. Widen each to its whole day before\n// handing it to a system picker, which would otherwise enforce the clock too.\nconst startOfDay = (d: Date) =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate());\nconst endOfDay = (d: Date) =>\n new Date(d.getFullYear(), d.getMonth(), d.getDate(), 23, 59, 59, 999);\nconst later = (a: Date | undefined, b: Date) => (a && a > b ? a : b);\nconst earlier = (a: Date | undefined, b: Date) => (a && a < b ? a : b);\n\n/**\n * The only rules a system picker enforces are its first and last day. Returns\n * them, or `null` when the page asked for something the OS cannot express — a\n * weekday rule, a predicate, a hidden set — in which case the calendar, which\n * can enforce it, stays on every device.\n */\nfunction nativeBounds(\n calendarProps: PropsBase | undefined,\n): { min?: Date; max?: Date } | null {\n if (calendarProps?.hidden != null) return null;\n\n let min: Date | undefined;\n let max: Date | undefined;\n const rules: Matcher[] =\n calendarProps?.disabled == null\n ? []\n : Array.isArray(calendarProps.disabled)\n ? calendarProps.disabled\n : [calendarProps.disabled];\n\n for (const rule of rules) {\n if (rule == null || typeof rule !== \"object\" || rule instanceof Date) {\n return null;\n }\n const keys = Object.keys(rule);\n // `{ before }` and `{ after }` alone are the two the OS understands; the\n // pair of them is DayPicker's *interval*, which means the opposite.\n if (keys.length !== 1) return null;\n if (\"before\" in rule && rule.before instanceof Date) {\n min = later(min, startOfDay(rule.before));\n } else if (\"after\" in rule && rule.after instanceof Date) {\n max = earlier(max, endOfDay(rule.after));\n } else {\n return null;\n }\n }\n\n if (calendarProps?.startMonth) {\n min = later(min, startOfMonth(calendarProps.startMonth));\n }\n if (calendarProps?.endMonth) {\n max = earlier(max, endOfDay(endOfMonth(calendarProps.endMonth)));\n }\n return { min, max };\n}\n\n/* --------------------------------------------------------------- devices */\n\nconst COARSE_POINTER = \"(pointer: coarse)\";\n\n/**\n * True where the primary input is a finger. `useSyncExternalStore` so the\n * server and the first client render agree (no match) and the swap happens in\n * the same commit as hydration, rather than as a mismatch.\n */\nfunction useCoarsePointer(): boolean {\n const subscribe = useCallback((notify: () => void) => {\n if (typeof window === \"undefined\" || !window.matchMedia) return () => {};\n const query = window.matchMedia(COARSE_POINTER);\n query.addEventListener(\"change\", notify);\n return () => query.removeEventListener(\"change\", notify);\n }, []);\n\n return useSyncExternalStore(\n subscribe,\n () =>\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(COARSE_POINTER).matches,\n () => false,\n );\n}\n\n/* ------------------------------------------------------------------ props */\n\n/**\n * A window the page offers by name — `Last 7 days` — beside the calendar.\n * Pass a function for anything measured from now, so it is resolved at the\n * click rather than at render.\n */\nexport interface DatePickerPreset<T> {\n label: string;\n value: T | (() => T);\n}\n\n/** Extra about a change — present when the value came from a named window. */\nexport interface DatePickerChangeDetails<T> {\n preset: DatePickerPreset<T>;\n}\n\ninterface DatePickerBaseProps {\n /** Field label (associated for accessibility). */\n label?: ReactNode;\n /** Helper text below the field; rendered in the error color when `invalid`. */\n hint?: ReactNode;\n /**\n * What the field shows until something is chosen.\n * @default the shape to type, in this locale's order (`mm/dd/yyyy`)\n */\n placeholder?: string;\n /** Render the invalid state (error ring + error-colored hint). */\n invalid?: boolean;\n disabled?: boolean;\n /** Marks the label with the required asterisk. */\n required?: boolean;\n /** Size variant. @default \"md\" */\n size?: DatePickerSize;\n /**\n * `fill` takes the column it is in, like every other field. `hug` shrinks\n * to the words it is showing, for a field that sits in a toolbar or beside\n * a title rather than in a form.\n * @default \"fill\"\n */\n width?: \"fill\" | \"hug\";\n /**\n * Ask for a time as well as a day, this fine. `hour` sets the hour and\n * zeroes the rest, `minute` the hour and minute, `second` all three. Omit\n * it and the value is midnight on the chosen day.\n */\n time?: DatePickerTime;\n /** Locale for the trigger's words. Defaults to the viewer's. */\n locales?: Intl.LocalesArgument;\n /**\n * Everything else React DayPicker takes — `disabled` days, `startMonth` /\n * `endMonth`, `numberOfMonths`, `weekStartsOn`, `captionLayout`.\n */\n calendarProps?: PropsBase;\n /** Id for the trigger, if the page needs its own. */\n id?: string;\n /** Class applied to the trigger. */\n className?: string;\n /**\n * Accessible name when there is no visible label — a toolbar control\n * beside a page title, which already says what the field is for.\n */\n \"aria-label\"?: string;\n /**\n * The named window the field should read. A page that already knows the\n * name (`Last 24 hours` in the URL) passes it so a remount, and a rolling\n * window recomputed each render, still write the name rather than the\n * figures. The name drops the moment the value is no longer that window\n * — a day picked by hand, or the page clearing this.\n */\n selectedPreset?: string;\n /**\n * How the popover lines up with the field. A hug field on the right of a\n * header wants `end`, so the calendar grows left instead of off-screen.\n * @default \"start\"\n */\n align?: \"start\" | \"center\" | \"end\";\n}\n\nexport interface DatePickerSingleProps extends DatePickerBaseProps {\n /** @default \"single\" */\n mode?: \"single\";\n value?: Date;\n defaultValue?: Date;\n onValueChange?: (\n value: Date | undefined,\n details?: DatePickerChangeDetails<Date>,\n ) => void;\n /** Named days offered beside the calendar. */\n presets?: DatePickerPreset<Date>[];\n}\n\nexport interface DatePickerRangeProps extends DatePickerBaseProps {\n mode: \"range\";\n value?: DateRange;\n defaultValue?: DateRange;\n onValueChange?: (\n value: DateRange | undefined,\n details?: DatePickerChangeDetails<DateRange>,\n ) => void;\n /** Named windows offered beside the calendar — `Last 7 days`, and so on. */\n presets?: DatePickerPreset<DateRange>[];\n /**\n * Shortest and longest span the viewer may pick, counted in days. A pick\n * that would break either restarts the span from the day just clicked, so\n * the bound is felt rather than explained.\n */\n minDays?: number;\n maxDays?: number;\n}\n\nexport type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;\n\n/* ------------------------------------------------------------- the clock */\n\n/** One labelled time field — the popover's way of asking for the clock. */\nfunction ClockField({\n label,\n value,\n time,\n disabled,\n onChange,\n}: {\n label: string;\n value: Date | undefined;\n time: DatePickerTime;\n disabled?: boolean;\n onChange: (next: string) => void;\n}) {\n return (\n <>\n <span className=\"text-pho-description text-xs\">{label}</span>\n <label\n className={cn(\n \"bg-pho-primary ring-pho-primary rounded-sm px-2 py-1 ring-1 ring-inset\",\n \"focus-within:ring-pho-brand transition-shadow duration-100 ease-linear focus-within:ring-2\",\n )}\n >\n <input\n type=\"time\"\n step={TIME_STEP[time]}\n disabled={disabled}\n aria-label={label}\n value={value ? toClockValue(value, time) : \"\"}\n onChange={(event) => onChange(event.target.value)}\n className={cn(\n \"text-pho-primary w-full bg-transparent text-base tabular-nums outline-none\",\n // The browser's own clock glyph is off-brand and unstyleable;\n // the field's words are the control.\n \"[&::-webkit-calendar-picker-indicator]:hidden\",\n )}\n />\n </label>\n </>\n );\n}\n\n/* ------------------------------------------------------------ the picker */\n\n/**\n * Date Picker — a field that shows the chosen date and opens a `Calendar` to\n * change it. `mode=\"range\"` picks a span instead of a day; the popover stays\n * open until both ends are down.\n *\n * The value is a `Date` (or a `{ from, to }` range), never a string: pass\n * `value` to control it, `defaultValue` to let it keep its own. Clearing is\n * built in — clicking the chosen day again unsets it.\n *\n * `time` asks for the clock as well, to the hour, the minute, or the second.\n *\n * On a touch device the field hands off to the system picker — the OS wheel or\n * dialog, which people already know — as long as the rules the page set are\n * ones it can enforce. A weekday rule or a predicate keeps the calendar, which\n * can; so does `mode=\"range\"`, which no system picker offers.\n */\nexport function DatePicker(props: DatePickerProps) {\n const {\n mode = \"single\",\n defaultValue,\n onValueChange,\n label,\n hint,\n placeholder,\n invalid,\n disabled,\n required,\n size = \"md\",\n width = \"fill\",\n time,\n locales,\n calendarProps,\n id,\n className,\n selectedPreset,\n align = \"start\",\n \"aria-label\": ariaLabel,\n } = props;\n const presets = props.presets as\n DatePickerPreset<Date | DateRange>[] | undefined;\n // Range-only, and read off the union the same way.\n const { minDays, maxDays } = props as DatePickerRangeProps;\n\n // Presence of the prop, not its value: an empty controlled picker is the\n // normal starting state, so `value === undefined` cannot mean \"uncontrolled\".\n const controlled = \"value\" in props;\n const [ownValue, setOwnValue] = useState<Date | DateRange | undefined>(\n defaultValue,\n );\n const value = controlled ? props.value : ownValue;\n const [open, setOpen] = useState(false);\n // A range takes two clicks, and the first one already reads as a complete\n // one-day range ({ from, to } both set), so the value alone can't say when\n // the question is answered. Count the picks in this opening instead.\n const picks = useRef(0);\n\n // Empty, the field shows the shape to type. A span cannot be typed, so it\n // asks in words instead.\n const fieldPlaceholder =\n placeholder ??\n (mode === \"range\" ? \"Pick a date range\" : dateFieldMask(locales, time));\n\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n const hintId = hint ? `${triggerId}-hint` : undefined;\n const calendarId = `${triggerId}-calendar`;\n\n // Whether the calendar should take the caret as it appears — true only when\n // a key asked for it, so a click leaves the caret in the field.\n const [gridFocus, setGridFocus] = useState(false);\n\n // The field is not a `Popover.Trigger`, so Base UI never routes its own\n // opening through `onOpenChange`: a controlled `open` is written straight\n // into the store. Every way in goes through here instead, or the reset an\n // opening owes — the pick count, the month on screen — silently never runs.\n const openPicker = (focusGrid = false) => {\n if (open) return;\n picks.current = 0;\n setMonth(undefined);\n setGridFocus(focusGrid);\n setOpen(true);\n };\n\n const notify = onValueChange as\n | ((\n v: Date | DateRange | undefined,\n d?: DatePickerChangeDetails<Date | DateRange>,\n ) => void)\n | undefined;\n\n const commit = (\n next: Date | DateRange | undefined,\n details?: DatePickerChangeDetails<Date | DateRange>,\n ) => {\n if (details) {\n setIgnoreSelected(false);\n } else {\n setIgnoreSelected(true);\n setChosen(null);\n }\n if (!controlled) setOwnValue(next);\n // The two modes have disjoint value types, and the union's callback is\n // only ever handed the shape its own mode produces. A second argument\n // is reserved for a named window, so a calendar pick stays a one-arg\n // call — existing listeners keep matching.\n if (details) notify?.(next, details);\n else notify?.(next);\n };\n\n const single = mode === \"single\" ? (value as Date | undefined) : undefined;\n const range = mode === \"range\" ? (value as DateRange | undefined) : undefined;\n // Reopen where the value lives, not on today's month.\n const anchor = single ?? range?.from;\n\n // The field is a text input, so the words in it are the viewer's until they\n // leave: `null` means \"whatever the value says\", anything else is what they\n // typed. Blur, a pick, and closing all hand the field back to the value.\n const [draft, setDraft] = useState<string | null>(null);\n // A preset names the window it set; the name stands only while the value is\n // still the one it produced, so a day picked afterwards drops the name with\n // no bookkeeping.\n const [chosen, setChosen] = useState<{ label: string; key: string } | null>(\n null,\n );\n // `selectedPreset` is the page's name for a rolling window. A hand pick\n // has to drop that name even if the page is a frame late clearing it —\n // otherwise the field still says \"Last 24 hours\" over a day the viewer\n // just chose. A new name from the page (or the same name after a remount)\n // starts honoring it again.\n const [ignoreSelected, setIgnoreSelected] = useState(false);\n useEffect(() => {\n setIgnoreSelected(false);\n }, [selectedPreset]);\n const presetLabel =\n selectedPreset && !ignoreSelected\n ? selectedPreset\n : chosen && chosen.key === valueKey(value)\n ? chosen.label\n : null;\n\n const text = draft ?? presetLabel ?? formatDateLabel(value, locales, time);\n // A typeable field stays wide enough for the shape to type, so it does\n // not jump when a date answers it. A span is read-only — hug the words\n // on screen, not the empty-state sentence sitting underneath.\n const hugChars = Math.max(\n text.length,\n mode === \"range\" ? 0 : fieldPlaceholder.length,\n 1,\n );\n const hugToWords = width === \"hug\" && mode === \"range\";\n\n const pickPreset = (preset: DatePickerPreset<Date | DateRange>) => {\n const next =\n typeof preset.value === \"function\" ? preset.value() : preset.value;\n setChosen({ label: preset.label, key: valueKey(next) });\n setDraft(null);\n commit(next, { preset });\n // A named window is the whole answer, clock included.\n setOpen(false);\n };\n\n // The month on screen follows what is typed, and resets to the value's own\n // month each time the calendar opens. Held from the first render rather than\n // handed over later: DayPicker keeps its own month until the prop arrives,\n // and a calendar that starts uncontrolled would ignore the first jump.\n const [month, setMonth] = useState<Date | undefined>(undefined);\n const [thisMonth] = useState(() => calendarProps?.today ?? new Date());\n const shownMonth =\n month ?? calendarProps?.defaultMonth ?? anchor ?? thisMonth;\n\n const fieldRef = useRef<HTMLDivElement>(null);\n const popupRef = useRef<HTMLDivElement>(null);\n\n const coarse = useCoarsePointer();\n const bounds = nativeBounds(calendarProps);\n // No system picker offers a range, so that mode keeps the calendar; so does\n // a rule the OS cannot enforce.\n const native =\n coarse && mode === \"single\" && bounds != null && !presets?.length;\n\n const face = (\n <>\n <IconCalendar className=\"text-pho-secondary size-4 shrink-0\" />\n <span\n className={cn(\n \"min-w-0 flex-1 truncate\",\n text === \"\" && \"text-pho-placeholder\",\n )}\n >\n {text === \"\" ? fieldPlaceholder : text}\n </span>\n </>\n );\n\n return (\n <div\n className={cn(\n \"flex flex-col gap-1.5\",\n width === \"hug\" ? \"w-fit\" : \"w-full\",\n )}\n >\n {label ? (\n <label\n htmlFor={triggerId}\n className=\"text-pho-secondary flex w-fit cursor-default items-center gap-0.5 text-base font-medium\"\n >\n {label}\n {required ? <span className=\"text-pho-brand\">*</span> : null}\n </label>\n ) : null}\n\n {native ? (\n <div\n data-invalid={invalid || undefined}\n className={cn(\n TRIGGER_BASE,\n TRIGGER_NATIVE,\n width === \"hug\" ? \"w-fit\" : \"w-full\",\n SIZE_PAD[size],\n SIZE_RADIUS[size],\n className,\n )}\n >\n {face}\n {/* The system field lies over the whole control at zero opacity:\n the tap opens the OS picker, the words underneath stay Pho's. */}\n <input\n id={triggerId}\n type={time ? \"datetime-local\" : \"date\"}\n step={time ? TIME_STEP[time] : undefined}\n min={\n bounds?.min\n ? time\n ? toDateTimeValue(clampTime(bounds.min, time), time)\n : toDateValue(bounds.min)\n : undefined\n }\n max={\n bounds?.max\n ? time\n ? toDateTimeValue(clampTime(bounds.max, time), time)\n : toDateValue(bounds.max)\n : undefined\n }\n required={required}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={hintId}\n value={\n single\n ? time\n ? toDateTimeValue(single, time)\n : toDateValue(single)\n : \"\"\n }\n onChange={(event) => {\n const next = fromInputValue(event.target.value);\n commit(next ? clampTime(next, time) : undefined);\n }}\n className=\"absolute inset-0 size-full cursor-pointer opacity-0\"\n />\n </div>\n ) : (\n <Popover.Root\n open={open}\n onOpenChange={(next, details) => {\n // Clicking in the field is how the viewer reaches the caret, so it\n // opens the calendar and never takes it away again — the field is\n // not a trigger Base UI knows about, so its own presses arrive\n // here as presses from outside.\n if (\n !next &&\n details.reason === \"outside-press\" &&\n details.event.target instanceof Node &&\n fieldRef.current?.contains(details.event.target)\n ) {\n return;\n }\n // Opening is `openPicker`'s job; this only ever hears about\n // closes (Escape, a click outside) and the odd programmatic open.\n if (next) {\n picks.current = 0;\n setMonth(undefined);\n } else {\n setDraft(null);\n setGridFocus(false);\n }\n setOpen(next);\n }}\n >\n <div\n ref={fieldRef}\n data-invalid={invalid || undefined}\n data-popup-open={open || undefined}\n className={cn(\n TRIGGER_BASE,\n TRIGGER_FIELD,\n width === \"hug\" ? \"w-fit\" : \"w-full\",\n SIZE_PAD[size],\n SIZE_RADIUS[size],\n className,\n )}\n >\n <IconCalendar className=\"text-pho-secondary size-4 shrink-0\" />\n <input\n id={triggerId}\n type=\"text\"\n // A span is two dates and a separator; there is nothing\n // sensible to type, so the field only opens the calendar.\n readOnly={mode === \"range\"}\n disabled={disabled}\n required={required}\n placeholder={fieldPlaceholder}\n aria-label={ariaLabel}\n aria-describedby={hintId}\n // The APG's date-picker combobox: a text field that also says\n // what it opens. `textbox` alone does not support `aria-expanded`.\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? calendarId : undefined}\n autoComplete=\"off\"\n spellCheck={false}\n value={text}\n onFocus={() => openPicker()}\n onMouseDown={() => openPicker()}\n onChange={(event) => {\n const typed = event.target.value;\n setDraft(typed);\n if (typed.trim() === \"\") {\n commit(undefined);\n return;\n }\n const parsed = parseDateText(typed, locales);\n if (parsed) {\n commit(clampTime(parsed, time));\n // Follow the words: the calendar shows what was typed.\n setMonth(parsed);\n }\n }}\n onBlur={() => setDraft(null)}\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && open) {\n event.preventDefault();\n setDraft(null);\n setOpen(false);\n return;\n }\n if (event.key === \"ArrowDown\") {\n event.preventDefault();\n // Hand the caret to the grid, where the arrows mean days.\n const grid = popupRef.current?.querySelector<HTMLElement>(\n \"td[data-day] button[tabindex='0']\",\n );\n if (grid) {\n grid.focus();\n return;\n }\n // Closed: the grid is not mounted yet, so the calendar takes\n // the caret itself as it appears — one press, not two.\n openPicker(true);\n }\n }}\n // Typed fields use `size`, not `field-sizing: content` — that\n // sizes from the current content and ignores `size` outright,\n // so a one-letter draft collapsed the field to 20px against\n // the shape to type. A span cannot be typed, so it hugs the\n // glyphs on screen (`Last 30 minutes`, not sixteen `M`s).\n size={width === \"hug\" && !hugToWords ? hugChars : undefined}\n className={cn(\n \"text-pho-primary placeholder:text-pho-placeholder bg-transparent outline-none\",\n hugToWords\n ? \"field-sizing-content w-auto min-w-min\"\n : width === \"hug\"\n ? \"min-w-0\"\n : \"min-w-0 flex-1\",\n mode === \"range\" && \"cursor-pointer\",\n )}\n />\n </div>\n\n <Popover.Portal>\n <Popover.Positioner anchor={fieldRef} align={align} sideOffset={6}>\n {/* Two months on a phone are taller than the room under the\n field; cap the popup at what Base UI measured and let it\n scroll rather than running off the screen. */}\n <Popover.Popup\n ref={popupRef}\n id={calendarId}\n // The field keeps the caret: the viewer is mid-word, and the\n // calendar is a second way to answer, not a takeover.\n initialFocus={false}\n finalFocus={false}\n className=\"max-h-[var(--available-height)] overflow-y-auto p-3\"\n >\n <div className=\"flex flex-col gap-3 sm:flex-row\">\n {presets?.length ? (\n // Beside the calendar where there is room, above it on a\n // phone, where a row that scrolls sideways costs no height.\n <div\n // A labelled set of buttons, not a form section.\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role\n role=\"group\"\n aria-label=\"Presets\"\n className={cn(\n \"flex shrink-0 gap-1 overflow-x-auto\",\n \"sm:border-pho-secondary sm:w-36 sm:flex-col sm:gap-0.5 sm:overflow-visible sm:border-r sm:pr-3\",\n )}\n >\n {presets.map((preset) => (\n <button\n key={preset.label}\n type=\"button\"\n aria-pressed={preset.label === presetLabel}\n onClick={() => pickPreset(preset)}\n className={cn(\n PRESET,\n preset.label === presetLabel && PRESET_ON,\n )}\n >\n {preset.label}\n </button>\n ))}\n </div>\n ) : null}\n\n <div>\n {mode === \"range\" ? (\n <Calendar\n {...calendarProps}\n mode=\"range\"\n min={minDays}\n max={maxDays}\n month={shownMonth}\n onMonthChange={setMonth}\n // DayPicker's own prop, not the DOM attribute.\n // oxlint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={gridFocus}\n selected={range}\n onSelect={(next, clicked) => {\n const first = picks.current === 0;\n picks.current += 1;\n // Reopened on a span that is already settled: the first\n // click starts a new one. DayPicker would otherwise drag\n // the nearer end over, so asking for Sep 20 – 25 on top\n // of Sep 1 – 8 would land on Sep 1 – 25.\n if (first && range?.to) {\n const day = clampTime(\n withDay(clicked, time ? range.from : undefined),\n time,\n );\n commit({ from: day, to: new Date(day) });\n setDraft(null);\n return;\n }\n const kept = next && {\n from:\n next.from &&\n clampTime(\n withDay(\n next.from,\n time ? range?.from : undefined,\n ),\n time,\n ),\n to:\n next.to &&\n clampTime(\n withDay(next.to, time ? range?.to : undefined),\n time,\n ),\n };\n commit(kept);\n setDraft(null);\n // Second pick, and the question is answered either way:\n // both ends down, or the same day twice, which DayPicker\n // reads as clearing the span. Unless a time is still to\n // be set, which lives below.\n if (\n !time &&\n picks.current >= 2 &&\n (!kept || (kept.from && kept.to))\n ) {\n setOpen(false);\n }\n }}\n />\n ) : (\n <Calendar\n {...calendarProps}\n mode=\"single\"\n month={shownMonth}\n onMonthChange={setMonth}\n // oxlint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={gridFocus}\n selected={single}\n onSelect={(next) => {\n commit(\n next &&\n clampTime(\n withDay(next, time ? single : undefined),\n time,\n ),\n );\n setDraft(null);\n // The clock is still to be set, and it is below.\n if (!time) setOpen(false);\n }}\n />\n )}\n\n {time ? (\n <div className=\"border-pho-secondary mt-3 grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 border-t pt-3\">\n {mode === \"range\" ? (\n <>\n <ClockField\n label=\"From\"\n value={range?.from}\n time={time}\n onChange={(clock) => {\n if (!range?.from) return;\n const next = fromInputValue(\n `${toDateValue(range.from)}T${clock}`,\n );\n if (next) {\n commit({\n ...range,\n from: clampTime(next, time),\n });\n }\n }}\n disabled={!range?.from}\n />\n <ClockField\n label=\"To\"\n value={range?.to}\n time={time}\n onChange={(clock) => {\n if (!range?.to) return;\n const next = fromInputValue(\n `${toDateValue(range.to)}T${clock}`,\n );\n if (next) {\n commit({\n ...range,\n to: clampTime(next, time),\n });\n }\n }}\n disabled={!range?.to}\n />\n </>\n ) : (\n <ClockField\n label=\"Time\"\n value={single}\n time={time}\n onChange={(clock) => {\n if (!single) return;\n const next = fromInputValue(\n `${toDateValue(single)}T${clock}`,\n );\n if (next) commit(clampTime(next, time));\n }}\n disabled={!single}\n />\n )}\n </div>\n ) : null}\n </div>\n </div>\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n )}\n\n {hint ? (\n <p\n id={hintId}\n className={cn(\n \"text-pho-description text-base\",\n invalid && \"text-pho-error\",\n )}\n >\n {hint}\n </p>\n ) : null}\n </div>\n );\n}\n\nDatePicker.displayName = \"DatePicker\";"],"ignoreList":[0],"mappings":";;;;;;;AASA,IAAMc,KAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAkF,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAW,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAU,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAY,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAY,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAY,KAAO;AAAA,EAAQ,CAAC;AAAC,GACzWC,KAAeb,GAAqB,WAAW,YAAY,YAAYY,EAAU,GCiBjFE,KAA4C;AAAA,EAChD,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV,GAIMC,KAA2C;AAAA,EAE/C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEM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CAAA,IACD;AAAA,IACD;AAAA,E;AAET;AAEAL,GAAW,cAAc"}
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { t as p } from "./cn-CPbhpG1q.js";
|
|
3
|
-
import { a as E, o as R } from "./button-KM0lAQ4x.js";
|
|
4
|
-
import { t as C } from "./createReactComponent-yKZn9MIX.js";
|
|
5
|
-
import { t as S } from "./IconInfoCircle-CTAynhe8.js";
|
|
6
|
-
import { t as g } from "./IconAlertCircleFilled-D6mUlVaE.js";
|
|
7
|
-
import { t as A } from "./IconAlertTriangleFilled-QV-gsVQW.js";
|
|
8
|
-
import { t as l } from "./popover-Dtp9C6Qg.js";
|
|
9
|
-
import { i as _ } from "./status-view-Buhh1UBJ.js";
|
|
10
|
-
import { useEffect as P, useRef as L, useState as k } from "react";
|
|
11
|
-
import { Fragment as c, jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
12
|
-
var z = [
|
|
13
|
-
["path", {
|
|
14
|
-
d: "M12 9v4",
|
|
15
|
-
key: "svg-0"
|
|
16
|
-
}],
|
|
17
|
-
["path", {
|
|
18
|
-
d: "M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0",
|
|
19
|
-
key: "svg-1"
|
|
20
|
-
}],
|
|
21
|
-
["path", {
|
|
22
|
-
d: "M12 16h.01",
|
|
23
|
-
key: "svg-2"
|
|
24
|
-
}]
|
|
25
|
-
], D = C("outline", "alert-triangle", "AlertTriangle", z);
|
|
26
|
-
function f(t) {
|
|
27
|
-
if (typeof t != "object" || t === null) return !1;
|
|
28
|
-
const e = t;
|
|
29
|
-
return typeof e.title == "string" && typeof e.status == "number" && Number.isInteger(e.status) && e.status >= 400 && e.status <= 599 && (e.code === void 0 || typeof e.code == "string");
|
|
30
|
-
}
|
|
31
|
-
function F(t) {
|
|
32
|
-
let e = t;
|
|
33
|
-
for (let n = 0; n < 8 && typeof e == "object" && e !== null; n++) {
|
|
34
|
-
if (f(e)) return e;
|
|
35
|
-
const i = e.problem;
|
|
36
|
-
if (f(i)) return i;
|
|
37
|
-
e = e.cause;
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
var $ = "Something went wrong.", h = {
|
|
42
|
-
400: "Bad Request",
|
|
43
|
-
401: "Unauthorized",
|
|
44
|
-
403: "Forbidden",
|
|
45
|
-
404: "Not Found",
|
|
46
|
-
408: "Request Timeout",
|
|
47
|
-
409: "Conflict",
|
|
48
|
-
410: "Gone",
|
|
49
|
-
413: "Payload Too Large",
|
|
50
|
-
415: "Unsupported Media Type",
|
|
51
|
-
422: "Unprocessable Entity",
|
|
52
|
-
429: "Too Many Requests",
|
|
53
|
-
500: "Internal Server Error",
|
|
54
|
-
501: "Not Implemented",
|
|
55
|
-
502: "Bad Gateway",
|
|
56
|
-
503: "Service Unavailable",
|
|
57
|
-
504: "Gateway Timeout"
|
|
58
|
-
}, j = {
|
|
59
|
-
400: "The request was malformed or incomplete.",
|
|
60
|
-
401: "You need to sign in again.",
|
|
61
|
-
403: "You don't have permission to do that.",
|
|
62
|
-
404: "The requested resource was not found.",
|
|
63
|
-
408: "The request timed out before the server responded.",
|
|
64
|
-
409: "The request conflicts with the current state.",
|
|
65
|
-
410: "That resource is no longer available.",
|
|
66
|
-
413: "The request was too large for the server to accept.",
|
|
67
|
-
415: "That media type isn't supported.",
|
|
68
|
-
422: "The request was understood but couldn't be processed.",
|
|
69
|
-
429: "Request rate limit exceeded. Wait a moment before trying again.",
|
|
70
|
-
500: "The server hit an unexpected error.",
|
|
71
|
-
501: "The server doesn't support that operation.",
|
|
72
|
-
502: "The gateway got an invalid response from an upstream server.",
|
|
73
|
-
503: "The service is temporarily unavailable.",
|
|
74
|
-
504: "The gateway timed out waiting for an upstream server."
|
|
75
|
-
};
|
|
76
|
-
function B(t) {
|
|
77
|
-
return typeof t.code == "string" && t.code !== "";
|
|
78
|
-
}
|
|
79
|
-
function v(t, e) {
|
|
80
|
-
if (h[t]) return h[t];
|
|
81
|
-
if (e && e !== "Something went wrong." && e !== "Request failed") return e.replace(/\.$/, "");
|
|
82
|
-
}
|
|
83
|
-
function U(t) {
|
|
84
|
-
return j[t] ?? "The request failed with an unexpected status.";
|
|
85
|
-
}
|
|
86
|
-
function u(t) {
|
|
87
|
-
if (!t) return t;
|
|
88
|
-
const e = t.charAt(0), n = e.toUpperCase();
|
|
89
|
-
return e === n ? t : n + t.slice(1);
|
|
90
|
-
}
|
|
91
|
-
function y(t) {
|
|
92
|
-
const e = F(t);
|
|
93
|
-
if (e == null) return { title: $ };
|
|
94
|
-
const n = [e.detail, e.remediation?.action].filter((i) => typeof i == "string" && i !== "").join(" ") || void 0;
|
|
95
|
-
return !B(e) && n == null ? {
|
|
96
|
-
title: u(v(e.status, e.title) ?? "Something went wrong."),
|
|
97
|
-
description: U(e.status),
|
|
98
|
-
requestId: e.requestId,
|
|
99
|
-
problem: e
|
|
100
|
-
} : {
|
|
101
|
-
title: u(e.title || "Something went wrong."),
|
|
102
|
-
description: n ? u(n) : void 0,
|
|
103
|
-
documentation: e.remediation?.documentation,
|
|
104
|
-
requestId: e.requestId,
|
|
105
|
-
problem: e
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function d(t) {
|
|
109
|
-
return typeof t == "string" ? u(t) : t;
|
|
110
|
-
}
|
|
111
|
-
var T = "Learn more", M = "Try again";
|
|
112
|
-
function O({ error: t, children: e, className: n, ...i }) {
|
|
113
|
-
if (t == null && e == null) return null;
|
|
114
|
-
const o = y(t);
|
|
115
|
-
return /* @__PURE__ */ s("div", {
|
|
116
|
-
role: "alert",
|
|
117
|
-
className: p("text-pho-error flex min-w-0 items-start gap-1.5 text-base", n),
|
|
118
|
-
...i,
|
|
119
|
-
children: [/* @__PURE__ */ r("span", {
|
|
120
|
-
"aria-hidden": !0,
|
|
121
|
-
className: "flex h-[1lh] shrink-0 items-center",
|
|
122
|
-
children: /* @__PURE__ */ r(g, { className: "size-4" })
|
|
123
|
-
}), /* @__PURE__ */ s("span", {
|
|
124
|
-
className: "min-w-0",
|
|
125
|
-
children: [
|
|
126
|
-
d(e ?? o.description ?? o.title),
|
|
127
|
-
o.documentation != null && /* @__PURE__ */ s(c, { children: [" ", /* @__PURE__ */ r("a", {
|
|
128
|
-
href: o.documentation,
|
|
129
|
-
target: "_blank",
|
|
130
|
-
rel: "noreferrer",
|
|
131
|
-
className: "font-medium underline underline-offset-2",
|
|
132
|
-
children: T
|
|
133
|
-
})] }),
|
|
134
|
-
" ",
|
|
135
|
-
/* @__PURE__ */ r(H, { copy: o })
|
|
136
|
-
]
|
|
137
|
-
})]
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
O.displayName = "Error";
|
|
141
|
-
function G({ children: t, className: e, ...n }) {
|
|
142
|
-
const i = t != null && t !== !1 && t !== "";
|
|
143
|
-
return /* @__PURE__ */ r("output", {
|
|
144
|
-
className: i ? p("text-pho-warning flex min-w-0 items-start gap-1.5 text-base", e) : "sr-only",
|
|
145
|
-
...n,
|
|
146
|
-
children: i && /* @__PURE__ */ s(c, { children: [/* @__PURE__ */ r("span", {
|
|
147
|
-
"aria-hidden": !0,
|
|
148
|
-
className: "flex h-[1lh] shrink-0 items-center",
|
|
149
|
-
children: /* @__PURE__ */ r(A, { className: "size-4" })
|
|
150
|
-
}), /* @__PURE__ */ r("span", {
|
|
151
|
-
className: "min-w-0",
|
|
152
|
-
children: d(t)
|
|
153
|
-
})] })
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
G.displayName = "Warning";
|
|
157
|
-
function H({ copy: t }) {
|
|
158
|
-
const { problem: e, requestId: n } = t;
|
|
159
|
-
if (e == null && n == null) return null;
|
|
160
|
-
let i = null;
|
|
161
|
-
if (e != null)
|
|
162
|
-
if (e.code) i = `${e.status} ${e.code}`;
|
|
163
|
-
else {
|
|
164
|
-
const o = v(e.status, e.title);
|
|
165
|
-
i = o ? `${e.status} ${o}` : String(e.status);
|
|
166
|
-
}
|
|
167
|
-
return /* @__PURE__ */ s(l.Root, { children: [/* @__PURE__ */ r(l.Trigger, {
|
|
168
|
-
openOnHover: !0,
|
|
169
|
-
delay: 150,
|
|
170
|
-
"aria-label": "Error details",
|
|
171
|
-
className: "outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2",
|
|
172
|
-
children: /* @__PURE__ */ r(S, { className: "size-3.5" })
|
|
173
|
-
}), /* @__PURE__ */ r(l.Portal, { children: /* @__PURE__ */ r(l.Positioner, {
|
|
174
|
-
align: "start",
|
|
175
|
-
children: /* @__PURE__ */ s(l.Popup, {
|
|
176
|
-
className: "text-pho-error",
|
|
177
|
-
children: [
|
|
178
|
-
/* @__PURE__ */ s(l.Title, {
|
|
179
|
-
className: "text-pho-error flex items-start gap-1.5",
|
|
180
|
-
children: [/* @__PURE__ */ r("span", {
|
|
181
|
-
"aria-hidden": !0,
|
|
182
|
-
className: "flex h-[1lh] shrink-0 items-center",
|
|
183
|
-
children: /* @__PURE__ */ r(g, { className: "size-4" })
|
|
184
|
-
}), t.title]
|
|
185
|
-
}),
|
|
186
|
-
t.description != null && /* @__PURE__ */ r(l.Description, {
|
|
187
|
-
className: "text-pho-error",
|
|
188
|
-
children: t.description
|
|
189
|
-
}),
|
|
190
|
-
(i != null || n != null) && /* @__PURE__ */ s("div", {
|
|
191
|
-
className: "text-pho-error mt-1 font-mono text-[10px] leading-snug",
|
|
192
|
-
children: [i != null && /* @__PURE__ */ r("p", { children: i }), n != null && /* @__PURE__ */ r(b, {
|
|
193
|
-
requestId: n,
|
|
194
|
-
className: "mt-0"
|
|
195
|
-
})]
|
|
196
|
-
})
|
|
197
|
-
]
|
|
198
|
-
})
|
|
199
|
-
}) })] });
|
|
200
|
-
}
|
|
201
|
-
function b({ requestId: t, className: e }) {
|
|
202
|
-
const [n, i] = k(!1), o = L(null);
|
|
203
|
-
return P(() => () => {
|
|
204
|
-
o.current && clearTimeout(o.current);
|
|
205
|
-
}, []), /* @__PURE__ */ s("span", {
|
|
206
|
-
className: p("mt-1 block font-mono text-[10px] leading-snug", e),
|
|
207
|
-
children: [
|
|
208
|
-
"Request ID:",
|
|
209
|
-
" ",
|
|
210
|
-
/* @__PURE__ */ r("button", {
|
|
211
|
-
type: "button",
|
|
212
|
-
className: "outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1",
|
|
213
|
-
"aria-label": n ? "Request ID copied" : `Copy request ID ${t}`,
|
|
214
|
-
onClick: async () => {
|
|
215
|
-
try {
|
|
216
|
-
await navigator.clipboard.writeText(t);
|
|
217
|
-
} catch {
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
i(!0), o.current && clearTimeout(o.current), o.current = setTimeout(() => i(!1), 1500);
|
|
221
|
-
},
|
|
222
|
-
children: t
|
|
223
|
-
}),
|
|
224
|
-
/* @__PURE__ */ r("output", {
|
|
225
|
-
className: "sr-only",
|
|
226
|
-
"aria-live": "polite",
|
|
227
|
-
children: n ? "Copied" : ""
|
|
228
|
-
})
|
|
229
|
-
]
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
function V({ error: t, title: e, description: n, icon: i, onRetry: o, actions: N, size: w = "base", ...x }) {
|
|
233
|
-
if (t == null && e == null) return null;
|
|
234
|
-
const a = y(t), m = d(n ?? a.description), q = m != null || a.requestId != null ? /* @__PURE__ */ s(c, { children: [m, a.requestId != null && /* @__PURE__ */ r(b, { requestId: a.requestId })] }) : void 0, I = N ?? (o != null || a.documentation != null ? /* @__PURE__ */ s(c, { children: [o != null && /* @__PURE__ */ r(E, {
|
|
235
|
-
size: "sm",
|
|
236
|
-
onClick: o,
|
|
237
|
-
children: M
|
|
238
|
-
}), a.documentation != null && /* @__PURE__ */ r(R, {
|
|
239
|
-
size: "sm",
|
|
240
|
-
variant: "outlined",
|
|
241
|
-
href: a.documentation,
|
|
242
|
-
target: "_blank",
|
|
243
|
-
rel: "noreferrer",
|
|
244
|
-
children: T
|
|
245
|
-
})] }) : void 0);
|
|
246
|
-
return /* @__PURE__ */ r(_, {
|
|
247
|
-
role: "alert",
|
|
248
|
-
size: w,
|
|
249
|
-
icon: i ?? /* @__PURE__ */ r(D, {}),
|
|
250
|
-
title: d(e ?? a.title),
|
|
251
|
-
description: q,
|
|
252
|
-
actions: I,
|
|
253
|
-
...x
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
V.displayName = "ErrorView";
|
|
257
|
-
export {
|
|
258
|
-
u as a,
|
|
259
|
-
U as c,
|
|
260
|
-
$ as i,
|
|
261
|
-
f as l,
|
|
262
|
-
V as n,
|
|
263
|
-
y as o,
|
|
264
|
-
G as r,
|
|
265
|
-
v as s,
|
|
266
|
-
O as t,
|
|
267
|
-
F as u
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
//# sourceMappingURL=error-BT71wcUd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-BT71wcUd.js","names":["_Fragment","cn","Button","ButtonLink","createReactComponent","IconInfoCircle","IconAlertCircleFilled","IconAlertTriangleFilled","Popover","StatusView","useEffect","useRef","useState","Fragment$1","jsx","jsxs","__iconNode","IconAlertTriangle","isProblem","value","v","parseProblem","error","current","depth","carried","GENERIC_ERROR_TITLE","HTTP_REASON_PHRASE","HTTP_STATUS_EXPLANATION","hasContractCode","problem","httpReasonPhrase","status","fallbackTitle","httpStatusExplanation","capitalizeFirst","text","first","upper","describeError","description","part","displayCopy","DOC_LINK_LABEL","RETRY_LABEL","Error","children","className","props","copy","ErrorDetails","Warning","shown","requestId","statusLine","reason","RequestId","copied","setCopied","copiedTimer","ErrorView","title","icon","onRetry","actions","size","resolvedDescription","body","resolvedActions"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.49.0_react@19.3.1/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertTriangle.mjs","../../src/components/error/problem.ts","../../src/components/error/error.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.49.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\": \"M12 9v4\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M12 16h.01\", \"key\": \"svg-2\" }]];\nconst IconAlertTriangle = createReactComponent(\"outline\", \"alert-triangle\", \"AlertTriangle\", __iconNode);\n\nexport { __iconNode, IconAlertTriangle as default };\n","/**\n * Client-side mirror of the `@photon-hq/error` response contract — the\n * RFC 9457 Problem Details body every Photon service returns for 4xx / 5xx.\n * Machine logic branches on `code`; `title` / `detail` / `remediation` are\n * the human-readable copy, already reviewed server-side and safe to render.\n *\n * Fetch layers may also hand us a thin status-only shape when the response\n * was not ok but the body was not a contract problem — `title` + `status`\n * still count so the UI can disclose the HTTP code we already know.\n */\n\nexport interface ProblemRemediation {\n /** What the user can do about it — a full sentence. */\n action?: string;\n /** Docs URL explaining the problem. */\n documentation?: string;\n}\n\nexport interface Problem {\n /** Stable machine-readable key (`RATE_LIMITED`) — the field to branch on. */\n code?: string;\n /** Human summary of the problem type (\"Too Many Requests\"). */\n title: string;\n /** HTTP status (4xx / 5xx). */\n status: number;\n /** Problem type URI (`urn:photon:problem:*` or an https URL). */\n type?: string;\n /** Occurrence-specific human sentence. */\n detail?: string;\n /** Correlation id for support (`X-Request-ID`). */\n requestId?: string;\n remediation?: ProblemRemediation;\n /** RFC 9457 extensions (`issues`, `actualVersion`, …). */\n [extension: string]: unknown;\n}\n\n/** Structural check: `title` + a 4xx/5xx status. `code` is optional. */\nexport function isProblem(value: unknown): value is Problem {\n if (typeof value !== \"object\" || value === null) return false;\n const v = value as Record<string, unknown>;\n return (\n typeof v.title === \"string\" &&\n typeof v.status === \"number\" &&\n Number.isInteger(v.status) &&\n v.status >= 400 &&\n v.status <= 599 &&\n (v.code === undefined || typeof v.code === \"string\")\n );\n}\n\n/**\n * Find the problem a caught value carries — the value itself, one typed onto\n * an error as a `problem` field (dashboard's `ApiError` shape), or one\n * wrapped in an `Error` `cause` chain (how fetch layers usually rethrow a\n * parsed body). Returns `null` when there is none.\n */\nexport function parseProblem(error: unknown): Problem | null {\n let current: unknown = error;\n for (\n let depth = 0;\n depth < 8 && typeof current === \"object\" && current !== null;\n depth++\n ) {\n if (isProblem(current)) return current;\n const carried = (current as { problem?: unknown }).problem;\n if (isProblem(carried)) return carried;\n current = (current as { cause?: unknown }).cause;\n }\n return null;\n}\n\nexport interface ErrorDescription {\n /** Short name of the failure — the problem `title`, or a generic fallback. */\n title: string;\n /** Sentence(s) to show — `detail` and `remediation.action` joined. */\n description?: string;\n /** Docs URL from `remediation.documentation`. */\n documentation?: string;\n /** Correlation id for support. */\n requestId?: string;\n /** The matched problem, when the input carried one. */\n problem?: Problem;\n}\n\n/**\n * Anything that isn't a problem renders as this — raw `Error` messages are\n * not contract copy and never shown (the same fail-closed stance as the\n * server side of `@photon-hq/error`). Always a full sentence (trailing\n * period).\n */\nexport const GENERIC_ERROR_TITLE = \"Something went wrong.\";\n\n/** Standard reason phrases for statuses we commonly surface without a body. */\nconst HTTP_REASON_PHRASE: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 408: \"Request Timeout\",\n 409: \"Conflict\",\n 410: \"Gone\",\n 413: \"Payload Too Large\",\n 415: \"Unsupported Media Type\",\n 422: \"Unprocessable Entity\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 501: \"Not Implemented\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n 504: \"Gateway Timeout\",\n};\n\n/** One-sentence explanations when the server gave a status but no problem copy. */\nconst HTTP_STATUS_EXPLANATION: Record<number, string> = {\n 400: \"The request was malformed or incomplete.\",\n 401: \"You need to sign in again.\",\n 403: \"You don't have permission to do that.\",\n 404: \"The requested resource was not found.\",\n 408: \"The request timed out before the server responded.\",\n 409: \"The request conflicts with the current state.\",\n 410: \"That resource is no longer available.\",\n 413: \"The request was too large for the server to accept.\",\n 415: \"That media type isn't supported.\",\n 422: \"The request was understood but couldn't be processed.\",\n 429: \"Request rate limit exceeded. Wait a moment before trying again.\",\n 500: \"The server hit an unexpected error.\",\n 501: \"The server doesn't support that operation.\",\n 502: \"The gateway got an invalid response from an upstream server.\",\n 503: \"The service is temporarily unavailable.\",\n 504: \"The gateway timed out waiting for an upstream server.\",\n};\n\nfunction hasContractCode(problem: Problem): boolean {\n return typeof problem.code === \"string\" && problem.code !== \"\";\n}\n\n/** Reason phrase for a status — map first, then a non-generic `problem.title`. */\nexport function httpReasonPhrase(\n status: number,\n fallbackTitle?: string,\n): string | undefined {\n if (HTTP_REASON_PHRASE[status]) return HTTP_REASON_PHRASE[status];\n if (\n fallbackTitle &&\n fallbackTitle !== GENERIC_ERROR_TITLE &&\n fallbackTitle !== \"Request failed\"\n ) {\n return fallbackTitle.replace(/\\.$/, \"\");\n }\n return undefined;\n}\n\n/** Human sentence for a bare HTTP status, when the body carried no copy. */\nexport function httpStatusExplanation(status: number): string {\n return (\n HTTP_STATUS_EXPLANATION[status] ??\n \"The request failed with an unexpected status.\"\n );\n}\n\n/**\n * Sentence-case the first character. Server `detail` / `title` sometimes\n * arrive fully lowercase; UI copy always leads with a capital.\n */\nexport function capitalizeFirst(text: string): string {\n if (!text) return text;\n const first = text.charAt(0);\n const upper = first.toUpperCase();\n if (first === upper) return text;\n return upper + text.slice(1);\n}\n\n/**\n * Turn a caught value into displayable copy. `Error` and `ErrorView` call\n * this internally; use it directly for other surfaces (a toast, a banner).\n *\n * Status-only failures (HTTP not ok, but no contract `code` / copy) still\n * keep `problem` so the details panel can show the status. Title becomes the\n * reason phrase (e.g. \"Bad Gateway\"); description is a short explanation —\n * not just the numeric code.\n */\nexport function describeError(error: unknown): ErrorDescription {\n const problem = parseProblem(error);\n if (problem == null) return { title: GENERIC_ERROR_TITLE };\n\n const description =\n [problem.detail, problem.remediation?.action]\n .filter((part): part is string => typeof part === \"string\" && part !== \"\")\n .join(\" \") || undefined;\n\n if (!hasContractCode(problem) && description == null) {\n const reason = httpReasonPhrase(problem.status, problem.title);\n return {\n title: capitalizeFirst(reason ?? GENERIC_ERROR_TITLE),\n description: httpStatusExplanation(problem.status),\n requestId: problem.requestId,\n problem,\n };\n }\n\n return {\n title: capitalizeFirst(problem.title || GENERIC_ERROR_TITLE),\n description: description ? capitalizeFirst(description) : undefined,\n documentation: problem.remediation?.documentation,\n requestId: problem.requestId,\n problem,\n };\n}\n","import {\n useEffect,\n useRef,\n useState,\n type ComponentProps,\n type ReactNode,\n} from \"react\";\nimport {\n IconAlertCircleFilled,\n IconAlertTriangle,\n IconAlertTriangleFilled,\n IconInfoCircle,\n} from \"@tabler/icons-react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, ButtonLink } from \"../button/button\";\nimport { Popover } from \"../popover/popover\";\nimport { StatusView, type StatusViewSize } from \"../status-view/status-view\";\nimport {\n capitalizeFirst,\n describeError,\n httpReasonPhrase,\n type ErrorDescription,\n} from \"./problem\";\n\n/** Capitalize string copy; leave custom ReactNode overrides alone. */\nfunction displayCopy(value: ReactNode): ReactNode {\n return typeof value === \"string\" ? capitalizeFirst(value) : value;\n}\n\n/**\n * Design notes:\n * - ONE input: `error` is the caught value, whatever it is — a Problem\n * Details body from `@photon-hq/error`, an `Error` carrying one as\n * `cause`, or something unknown. The component derives its copy via\n * `describeError`; unknowns fall back to a generic line rather than\n * leaking raw messages.\n * - TWO presentations, one per altitude: `Error` is the inline line for\n * forms, cards, and action rows; `ErrorView` is the region / page state\n * built on StatusView (same `sm` / `base` size axis).\n * - Both render `null` when there is nothing to show, so they can sit\n * unconditionally in JSX (`<Error error={mutation.error} />`).\n * - `Warning` is the inline line's second state: the same row in warning\n * ink, for something the user may go ahead with but should look at\n * twice. It never blocks, so it takes its copy and nothing else.\n * - Client-side *validation* is not this component's job — that belongs to\n * `Field.Error`, wired to control validity.\n */\n\nconst DOC_LINK_LABEL = \"Learn more\";\nconst RETRY_LABEL = \"Try again\";\n\ninterface ErrorBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived message. */\n children?: ReactNode;\n}\n\nexport interface ErrorProps\n extends ErrorBaseProps, Omit<ComponentProps<\"div\">, keyof ErrorBaseProps> {}\n\n/**\n * Error — one line of red ink naming a server failure (4xx / 5xx), placed\n * inline: under a form, in a card, beside the action that failed. Give it the\n * caught value and it renders the problem's `detail` (falling back to `title`,\n * then to a generic line), plus a docs link when the problem carries one.\n * Renders nothing while `error` is nullish, so it can stay mounted.\n *\n * For a region or page that failed to load, use {@link ErrorView}.\n */\nexport function Error({ error, children, className, ...props }: ErrorProps) {\n if (error == null && children == null) return null;\n const copy = describeError(error);\n return (\n <div\n role=\"alert\"\n className={cn(\n \"text-pho-error flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )}\n {...props}\n >\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">\n {displayCopy(children ?? copy.description ?? copy.title)}\n {copy.documentation != null && (\n <>\n {\" \"}\n <a\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"font-medium underline underline-offset-2\"\n >\n {DOC_LINK_LABEL}\n </a>\n </>\n )}\n {/* Trailing whitespace collapses when the details render null. */}{\" \"}\n <ErrorDetails copy={copy} />\n </span>\n </div>\n );\n}\n\nError.displayName = \"Error\";\n\nexport interface WarningProps extends Omit<\n ComponentProps<\"output\">,\n \"children\"\n> {\n /** What to look at twice. Shows nothing while nullish. */\n children?: ReactNode;\n}\n\n/**\n * Warning — the inline `Error` line in warning ink, a triangle in place of\n * the circle: something the user can go ahead with but may not mean (an\n * address outside the team, a value that differs from the usual one). Same\n * row, glyph seat and type as `Error`, so the two can take turns in one\n * place. It doesn't stop anything, so it announces politely (an `output`,\n * role `status`) and carries no details disclosure.\n *\n * A polite region is announced when its content changes, not when it is\n * inserted, so the `output` stays mounted while the copy is nullish:\n * empty and `sr-only`, the way pho-ui's other live regions sit, it keeps\n * its role and, out of flow, adds no gap to a stack.\n */\nexport function Warning({ children, className, ...props }: WarningProps) {\n // `{cond && copy}` leaves false behind: no copy either.\n const shown = children != null && children !== false && children !== \"\";\n return (\n <output\n className={\n shown\n ? cn(\n \"text-pho-warning flex min-w-0 items-start gap-1.5 text-base\",\n className,\n )\n : \"sr-only\"\n }\n {...props}\n >\n {shown && (\n <>\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertTriangleFilled className=\"size-4\" />\n </span>\n <span className=\"min-w-0\">{displayCopy(children)}</span>\n </>\n )}\n </output>\n );\n}\n\nWarning.displayName = \"Warning\";\n\n/**\n * Hover / focus disclosure on the inline line — the request's fuller story:\n * problem `title` (with the same alert icon + `text-pho-error` ink as the\n * inline line), the untruncated description, then `status` + `code` and the\n * copyable request id grouped below for a support handoff. Renders only when\n * the caught value actually carried a problem (or at least a request id); a\n * generic unknown has nothing more to disclose. Built on `Popover` rather\n * than `Tooltip` because the panel holds an interactive control (the copy\n * button) — `openOnHover` keeps the tooltip-like gesture.\n */\nfunction ErrorDetails({ copy }: { copy: ErrorDescription }) {\n const { problem, requestId } = copy;\n if (problem == null && requestId == null) return null;\n\n // Contract problems show `status CODE`; status-only shows `status Reason`.\n let statusLine: string | null = null;\n if (problem != null) {\n if (problem.code) {\n statusLine = `${problem.status} ${problem.code}`;\n } else {\n const reason = httpReasonPhrase(problem.status, problem.title);\n statusLine = reason\n ? `${problem.status} ${reason}`\n : String(problem.status);\n }\n }\n\n return (\n <Popover.Root>\n <Popover.Trigger\n openOnHover\n delay={150}\n aria-label=\"Error details\"\n className=\"outline-pho-brand inline-flex size-4 shrink-0 translate-y-[3px] cursor-help items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-2\"\n >\n <IconInfoCircle className=\"size-3.5\" />\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner align=\"start\">\n <Popover.Popup className=\"text-pho-error\">\n <Popover.Title className=\"text-pho-error flex items-start gap-1.5\">\n <span aria-hidden className=\"flex h-[1lh] shrink-0 items-center\">\n <IconAlertCircleFilled className=\"size-4\" />\n </span>\n {copy.title}\n </Popover.Title>\n {copy.description != null && (\n <Popover.Description className=\"text-pho-error\">\n {copy.description}\n </Popover.Description>\n )}\n {(statusLine != null || requestId != null) && (\n <div className=\"text-pho-error mt-1 font-mono text-[10px] leading-snug\">\n {statusLine != null && <p>{statusLine}</p>}\n {requestId != null && (\n <RequestId requestId={requestId} className=\"mt-0\" />\n )}\n </div>\n )}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n\n/** Request-id footnote — click copies the id for support handoff. */\nfunction RequestId({\n requestId,\n className,\n}: {\n requestId: string;\n className?: string;\n}) {\n const [copied, setCopied] = useState(false);\n const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n },\n [],\n );\n\n return (\n <span\n className={cn(\"mt-1 block font-mono text-[10px] leading-snug\", className)}\n >\n Request ID:{\" \"}\n <button\n type=\"button\"\n className=\"outline-pho-brand inline cursor-pointer underline-offset-2 select-all hover:underline focus-visible:underline focus-visible:outline-2 focus-visible:-outline-offset-1\"\n aria-label={\n copied ? \"Request ID copied\" : `Copy request ID ${requestId}`\n }\n onClick={async () => {\n try {\n await navigator.clipboard.writeText(requestId);\n } catch {\n return;\n }\n setCopied(true);\n if (copiedTimer.current) clearTimeout(copiedTimer.current);\n copiedTimer.current = setTimeout(() => setCopied(false), 1500);\n }}\n >\n {requestId}\n </button>\n <output className=\"sr-only\" aria-live=\"polite\">\n {copied ? \"Copied\" : \"\"}\n </output>\n </span>\n );\n}\n\ninterface ErrorViewBaseProps {\n /** The caught value — a problem body, an `Error` wrapping one, or unknown. */\n error?: unknown;\n /** Override the derived title. */\n title?: ReactNode;\n /** Override the derived description. */\n description?: ReactNode;\n /** Override the warning glyph. */\n icon?: ReactNode;\n /** Offer a retry — renders a \"Try again\" button. */\n onRetry?: () => void;\n /** Replace the built-in action row entirely. */\n actions?: ReactNode;\n /** Size variant — StatusView's axis. @default \"base\" */\n size?: StatusViewSize;\n}\n\nexport interface ErrorViewProps\n extends\n ErrorViewBaseProps,\n Omit<ComponentProps<\"div\">, keyof ErrorViewBaseProps | \"children\"> {}\n\n/**\n * ErrorView — the failed state of a region or page, built on StatusView:\n * warning icon over the problem's `title`, its `detail` and remediation\n * below, an action row (`onRetry` and the problem's docs link), and the\n * request id as a footnote for support. Announces via `role=\"alert\"`.\n *\n * Use `size=\"sm\"` inside cards and panels, the default `base` for whole\n * pages. Renders nothing while `error` is nullish (unless given a static\n * `title`), so it can sit unconditionally next to a query.\n */\nexport function ErrorView({\n error,\n title,\n description,\n icon,\n onRetry,\n actions,\n size = \"base\",\n ...props\n}: ErrorViewProps) {\n if (error == null && title == null) return null;\n const copy = describeError(error);\n\n const resolvedDescription = displayCopy(description ?? copy.description);\n const body =\n resolvedDescription != null || copy.requestId != null ? (\n <>\n {resolvedDescription}\n {copy.requestId != null && <RequestId requestId={copy.requestId} />}\n </>\n ) : undefined;\n\n const resolvedActions =\n actions ??\n (onRetry != null || copy.documentation != null ? (\n <>\n {onRetry != null && (\n <Button size=\"sm\" onClick={onRetry}>\n {RETRY_LABEL}\n </Button>\n )}\n {copy.documentation != null && (\n <ButtonLink\n size=\"sm\"\n variant=\"outlined\"\n href={copy.documentation}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {DOC_LINK_LABEL}\n </ButtonLink>\n )}\n </>\n ) : undefined);\n\n return (\n <StatusView\n role=\"alert\"\n size={size}\n icon={icon ?? <IconAlertTriangle />}\n title={displayCopy(title ?? copy.title)}\n description={body}\n actions={resolvedActions}\n {...props}\n />\n );\n}\n\nErrorView.displayName = \"ErrorView\";\n"],"ignoreList":[0],"mappings":";;;;;;;;;;;AASA,IAAMgB,IAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAW,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAA4I,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAc,KAAO;AAAA,EAAQ,CAAC;AAAC,GAC1RC,IAAoBb,EAAqB,WAAW,kBAAkB,iBAAiBY,CAAU;AC2BvG,SAAgBE,EAAUC,GAAkC;AAC1D,MAAI,OAAOA,KAAU,YAAYA,MAAU,KAAM,QAAO;AACxD,QAAMC,IAAID;AACV,SACE,OAAOC,EAAE,SAAU,YACnB,OAAOA,EAAE,UAAW,YACpB,OAAO,UAAUA,EAAE,MAAM,KACzBA,EAAE,UAAU,OACZA,EAAE,UAAU,QACXA,EAAE,SAAS,UAAa,OAAOA,EAAE,QAAS;AAE/C;AAQA,SAAgBC,EAAaC,GAAgC;AAC3D,MAAIC,IAAmBD;AACvB,WACME,IAAQ,GACZA,IAAQ,KAAK,OAAOD,KAAY,YAAYA,MAAY,MACxDC,KACA;AACA,QAAIN,EAAUK,CAAO,EAAG,QAAOA;AAC/B,UAAME,IAAWF,EAAkC;AACnD,QAAIL,EAAUO,CAAO,EAAG,QAAOA;AAC/B,IAAAF,IAAWA,EAAgC;AAAA,EAC7C;AACA,SAAO;AACT;AAqBA,IAAaG,IAAsB,yBAG7BC,IAA6C;AAAA,EACjD,KAAK;AAAA,EACL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