@epilot/zenith-react 0.1.0-next.0 → 0.1.0-next.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 +61 -16
- package/dist/components/appearance-boundary/appearance-boundary.js.map +1 -1
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/callout/callout.js.map +1 -1
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/code-editor/indent.js.map +1 -1
- package/dist/components/command/command.js +1 -7
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +3 -8
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/time-picker.js.map +1 -1
- package/dist/components/density-provider/density-provider.js.map +1 -1
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/label/label.js +0 -28
- package/dist/components/label/label.js.map +1 -1
- package/dist/components/list/list.js +2 -12
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/pill/pill.js.map +1 -1
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slot/compose-as-child.js.map +1 -1
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/toast/toast.js +4 -6
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/delivery/index.d.ts +10 -44
- package/dist/delivery/index.js +5 -9
- package/dist/index.d.ts +69 -410
- package/dist/lib/clear-button.js.map +1 -1
- package/dist/lib/code-highlight.js.map +1 -1
- package/dist/lib/code-tokens.js.map +1 -1
- package/dist/lib/pagination.js.map +1 -1
- package/dist/packages/tokens/dist/delivery/index.js +18 -48
- package/dist/packages/tokens/dist/delivery/index.js.map +1 -1
- package/dist/{token-assets/core/5cd4072decf5df2a664f0b1d5f2ec250a3309101ded3056c1f87c8bbe3738d50.css → packages/tokens/dist/generated/core.generated.js} +8 -3
- package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -0
- package/dist/packages/tokens/dist/install.js +4 -4
- package/dist/packages/tokens/dist/install.js.map +1 -1
- package/dist/styles/document-context.js.map +1 -1
- package/dist/styles/make-styles.js.map +1 -1
- package/dist/tokens/core.meta.generated.js.map +1 -1
- package/dist/tokens/use-palette-tokens.js.map +1 -1
- package/dist/tokens.json +1 -1
- package/package.json +3 -4
- package/scripts/migration-diagnostics-core.mjs +19 -90
- package/scripts/migration-diagnostics.mjs +1 -16
- package/scripts/migration-sweep.mjs +2 -12
- package/ADOPTING.md +0 -73
- package/dist/packages/tokens/dist/delivery/internal.js +0 -181
- package/dist/packages/tokens/dist/delivery/internal.js.map +0 -1
- package/dist/packages/tokens/dist/generated/core.meta.generated.js +0 -10
- package/dist/packages/tokens/dist/generated/core.meta.generated.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport {\n canonicalDensity,\n DensityContextBoundary,\n} from \"../density-provider/density-provider\"\n\n/**\n * Table — the primitive set (Table, TableHeader, TableBody, TableFooter, TableRow, TableHead,\n * TableCell, TableCaption) in Card's compound pattern: one `makeZenithStyles` call, one slot per\n * sub-component, each reading its own slot.\n *\n * Density (approved 2026-09-09, replacing the earlier context-only mechanism — and with it the\n * open question of whether Table and List could agree on one, now resolved; corrected in review\n * the same day, see the two notes below):\n * `TableHead`/`TableCell` read `tokens.tableHeadHeight`/`tokens.tableCellPaddingY` directly —\n * generated CSS custom properties that cascade from the nearest `[data-density]` ancestor, exactly\n * like Button/Field/Select. `Table`'s own `density` prop, when explicit, stamps `data-density` on\n * the `<table>` element itself; when omitted, no attribute is stamped and ambient shell density\n * (or an outer `DensityProvider`) inherits through ordinary DOM/CSS with no React involvement — a\n * shell attribute mutation restyles an already-mounted table without a rerender. Per-cell\n * `TableHead`/`TableCell` `density` props stamp their own `data-density` the same way, overriding\n * locally. `TableDensityContext` (below) is a deprecated, now-inert compatibility export — see its\n * own doc comment.\n *\n * Two corrections from that review, both applied identically to `Table`, `DataTable`\n * (`data-table.tsx`), `TableHead` and `TableCell`:\n *\n * 1. An explicit `density` establishes a `DensityContextBoundary`, not just a DOM stamp. A DOM\n * attribute alone reaches ordinary CSS-inheriting descendants, but a Radix `Portal` (a real\n * `Select`/`Popover`/etc. rendered inside a cell) is a DOM sibling, not descendant, of that cell\n * — its own `useDensity()` read needs the REACT context updated too, or it silently reports a\n * stale ancestor value instead of the cell's own override.\n * 2. The DOM stamp and the context value both run through the SAME `canonicalDensity` function\n * (from `density-provider.tsx`, package-internal). Before this fix, `DensityContextBoundary`\n * normalized invalid runtime input (e.g. a bad string bypassing TypeScript) for the context, but\n * the DOM attribute was written raw/unnormalized — an invalid value could stamp `data-density`\n * with something no generated CSS selector matches while `useDensity()` reported the normalized\n * `\"normal\"`, disagreeing about what density is actually in effect.\n *\n * Selectors carry over untouched where they do not involve `data-slot`: `[&_tr]:border-b`,\n * `[&_tr:last-child]:border-0`, `data-[state=selected]:bg-accent-a3` (Radix selection state) and\n * the `role=\"checkbox\"` column-reflow rules all obey the original attribute.\n *\n * Values explicit where no token exists: `px-3` (0.75rem) on head/cell. The row's\n * `transition-colors` expands to Tailwind v4's default property list plus the 150ms\n * `cubic-bezier(0.4, 0, 0.2, 1)` easing — visible motion from the framework's default theme,\n * which the v1 file does not state (Rule 0: flagged, not approximated away). The checkbox\n * `translate-y-[2px]` maps to the modern `translate` property, which is what Tailwind v4 emits.\n */\n\nexport type TableDensity = \"compact\" | \"normal\" | \"comfortable\"\n\n/**\n * @deprecated No longer a supported way to control Table/DataTable geometry (approved\n * 2026-09-09). `Table`/`DataTable` no longer provide a value into this\n * context, and `TableHead`/`TableCell` no longer read it — density now flows entirely through CSS\n * custom-property inheritance from the nearest `[data-density]` ancestor (ambient shell or\n * `DensityProvider`), plus each component's own `density` prop stamping its own `data-density`\n * when explicit. This context simply no longer controls or reports Table/DataTable geometry —\n * `useContext(TableDensityContext)` still returns whatever a consumer's own raw\n * `TableDensityContext.Provider` sets (or the bare `\"normal\"` default with no such Provider), it\n * just has no bearing on what actually renders any more. Kept only so existing\n * `import { TableDensityContext }` statements and `useContext(TableDensityContext)` call sites do\n * not hard-error. Use the `density` prop on `Table`/`DataTable`/`TableHead`/`TableCell`, or wrap a\n * subtree in `DensityProvider`, instead. This is a disclosed behavioural change; the context's own\n * type and default value are unchanged.\n */\nconst TableDensityContext = React.createContext<TableDensity>(\"normal\")\n\nconst useStyles = makeZenithStyles({\n wrapper: {\n position: \"relative\",\n width: \"100%\",\n ...shorthands.overflow(\"auto\"),\n },\n root: {\n width: \"100%\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n },\n header: {\n \"& tr\": {\n ...shorthands.borderBottom(\"1px\", \"solid\", tokens.grayA5),\n },\n },\n body: {\n \"& tr:last-child\": {\n ...shorthands.borderWidth(0),\n },\n },\n footer: {\n ...shorthands.borderTop(\"1px\", \"solid\", tokens.grayA5),\n backgroundColor: tokens.semGraySoft,\n fontWeight: tokens.fontWeightMedium,\n \"& > tr:last-child\": {\n borderBottomWidth: 0,\n },\n },\n row: {\n ...shorthands.borderBottom(\"1px\", \"solid\", tokens.grayA5),\n transitionProperty:\n \"color, background-color, border-color, text-decoration-color, fill, stroke\",\n transitionDuration: \"150ms\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"&[data-state='selected']\": {\n backgroundColor: tokens.accentA3,\n },\n },\n rowHover: {\n \":hover\": {\n backgroundColor: tokens.accentA3,\n },\n },\n head: {\n // px-3\n paddingLeft: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n // Density-bound: cascades from the nearest [data-density] ancestor — 32/36/40px for\n // compact/normal/comfortable. No JS density switch needed.\n height: tokens.tableHeadHeight,\n verticalAlign: \"middle\",\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n \"&:has([role='checkbox'])\": {\n paddingRight: 0,\n },\n \"& > [role='checkbox']\": {\n // v1 `translate-y-[2px]`.\n translate: \"0 2px\",\n },\n },\n alignLeft: {\n textAlign: \"left\",\n },\n alignCenter: {\n textAlign: \"center\",\n },\n alignRight: {\n textAlign: \"right\",\n },\n cell: {\n // px-3\n paddingLeft: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n // Density-bound: cascades from the nearest [data-density] ancestor — 6/8/12px for\n // compact/normal/comfortable. No JS density switch needed.\n paddingTop: tokens.tableCellPaddingY,\n paddingBottom: tokens.tableCellPaddingY,\n verticalAlign: \"middle\",\n fontWeight: tokens.fontWeightNormal,\n color: tokens.grayA12,\n \"&:has([role='checkbox'])\": {\n paddingRight: 0,\n },\n \"& > [role='checkbox']\": {\n // v1 `translate-y-[2px]`.\n translate: \"0 2px\",\n },\n },\n cellNumeric: {\n fontVariantNumeric: \"tabular-nums\",\n },\n caption: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA11,\n },\n captionTop: {\n captionSide: \"top\",\n // mb-4\n marginBottom: tokens.spacingGroup2,\n },\n captionBottom: {\n captionSide: \"bottom\",\n // mt-4\n marginTop: tokens.spacingGroup2,\n },\n})\n\nexport type TableProps = React.ComponentProps<\"table\"> & {\n density?: TableDensity\n}\n\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n function Table({ className, density, children, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div className={styles.wrapper}>\n <table\n ref={ref}\n data-slot=\"table\"\n {...{ [SLOT_ATTR]: \"table\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n // Authoritative, spread last: a raw caller data-density prop (part of {...props}, since\n // TableProps extends every native table prop) must never win over the normalized density\n // prop — same invariant DensityProvider enforces for its own data-density stamp.\n // canonicalDensity here is the SAME normalization DensityContextBoundary below applies to\n // the context value, so an invalid density can never make the DOM and context disagree\n // (correction 2 in this file's header comment).\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </table>\n </div>\n )\n }\n)\n\nexport const TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"thead\">\n>(function TableHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <thead\n ref={ref}\n data-slot=\"table-header\"\n {...{ [SLOT_ATTR]: \"table-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n})\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"tbody\">\n>(function TableBody({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tbody\n ref={ref}\n data-slot=\"table-body\"\n {...{ [SLOT_ATTR]: \"table-body\" }}\n className={mergeClasses(styles.body, className)}\n {...props}\n />\n )\n})\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"tfoot\">\n>(function TableFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tfoot\n ref={ref}\n data-slot=\"table-footer\"\n {...{ [SLOT_ATTR]: \"table-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n})\n\nexport type TableRowProps = React.ComponentProps<\"tr\"> & {\n /** Disable hover background effect */\n noHover?: boolean\n}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n function TableRow({ className, noHover, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tr\n ref={ref}\n data-slot=\"table-row\"\n {...{ [SLOT_ATTR]: \"table-row\" }}\n className={mergeClasses(\n styles.row,\n !noHover && styles.rowHover,\n className\n )}\n {...props}\n />\n )\n }\n)\n\nexport type TableHeadProps = React.ComponentProps<\"th\"> & {\n align?: \"left\" | \"center\" | \"right\"\n density?: TableDensity\n}\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n function TableHead(\n { className, align = \"left\", density, scope = \"col\", children, ...props },\n ref\n ) {\n const styles = useStyles()\n\n const alignment =\n align === \"center\"\n ? styles.alignCenter\n : align === \"right\"\n ? styles.alignRight\n : styles.alignLeft\n\n return (\n <th\n ref={ref}\n data-slot=\"table-head\"\n {...{ [SLOT_ATTR]: \"table-head\" }}\n scope={scope}\n className={mergeClasses(styles.head, alignment, className)}\n {...props}\n // Authoritative, normalized, spread last — see the matching comment on Table above.\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n {/* Correction 1 above: an explicit per-cell override must also establish the\n context boundary, not just the DOM stamp — a real portal (Select/Popover/etc.) rendered\n inside this cell is a DOM sibling, not a descendant, so only useDensity() reaches it. */}\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </th>\n )\n }\n)\n\nexport type TableCellProps = React.ComponentProps<\"td\"> & {\n align?: \"left\" | \"center\" | \"right\"\n numeric?: boolean\n density?: TableDensity\n}\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n function TableCell(\n { className, align = \"left\", numeric, density, children, ...props },\n ref\n ) {\n const styles = useStyles()\n\n const alignment =\n align === \"center\"\n ? styles.alignCenter\n : align === \"right\"\n ? styles.alignRight\n : styles.alignLeft\n\n return (\n <td\n ref={ref}\n data-slot=\"table-cell\"\n {...{ [SLOT_ATTR]: \"table-cell\" }}\n className={mergeClasses(\n styles.cell,\n alignment,\n numeric && styles.cellNumeric,\n className\n )}\n {...props}\n // Authoritative, normalized, spread last — see the matching comment on Table above.\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n {/* Correction 1 above: see the matching comment on TableHead. */}\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </td>\n )\n }\n)\n\nexport type TableCaptionProps = React.ComponentProps<\"caption\"> & {\n position?: \"top\" | \"bottom\"\n}\n\nexport const TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n TableCaptionProps\n>(function TableCaption({ className, position = \"bottom\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <caption\n ref={ref}\n data-slot=\"table-caption\"\n {...{ [SLOT_ATTR]: \"table-caption\" }}\n className={mergeClasses(\n styles.caption,\n position === \"top\" ? styles.captionTop : styles.captionBottom,\n className\n )}\n {...props}\n />\n )\n})\n\nexport { TableDensityContext }\n"],"names":["TableDensityContext","React","useStyles","makeZenithStyles","shorthands","tokens.textSm","tokens.leadingSm","tokens.grayA5","tokens.semGraySoft","tokens.fontWeightMedium","tokens.accentA3","tokens.spacingElement3","tokens.tableHeadHeight","tokens.grayA12","tokens.tableCellPaddingY","tokens.fontWeightNormal","tokens.grayA11","tokens.spacingGroup2","Table","className","density","children","props","ref","styles","jsx","SLOT_ATTR","mergeClasses","canonicalDensity","DensityContextBoundary","TableHeader","TableBody","TableFooter","TableRow","noHover","TableHead","align","scope","alignment","TableCell","numeric","TableCaption","position"],"mappings":";;;;;;AAyEA,MAAMA,IAAsBC,EAAM,cAA4B,QAAQ,GAEhEC,IAAYC,EAAiB;AAAA,EACjC,SAAS;AAAA,IACP,UAAU;AAAA,IACV,OAAO;AAAA,IACP,GAAGC,EAAW,SAAS,MAAM;AAAA,EAAA;AAAA,EAE/B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAUC;AAAAA,IACV,YAAYC;AAAAA,EAAO;AAAA,EAErB,QAAQ;AAAA,IACN,QAAQ;AAAA,MACN,GAAGF,EAAW,aAAa,OAAO,SAASG,CAAa;AAAA,IAAA;AAAA,EAC1D;AAAA,EAEF,MAAM;AAAA,IACJ,mBAAmB;AAAA,MACjB,GAAGH,EAAW,YAAY,CAAC;AAAA,IAAA;AAAA,EAC7B;AAAA,EAEF,Q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G,CAAS,GAAG;AAAA,MACnB,WAAWC;AAAA,QACTH,EAAO;AAAA,QACPkB,MAAa,QAAQlB,EAAO,aAAaA,EAAO;AAAA,QAChDL;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
|
|
1
|
+
{"version":3,"file":"table.js","sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport {\n canonicalDensity,\n DensityContextBoundary,\n} from \"../density-provider/density-provider\"\n\n/**\n * Table — the primitive set (Table, TableHeader, TableBody, TableFooter, TableRow, TableHead,\n * TableCell, TableCaption) in Card's compound pattern: one `makeZenithStyles` call, one slot per\n * sub-component, each reading its own slot.\n */\n\nexport type TableDensity = \"compact\" | \"normal\" | \"comfortable\"\n\n/**\n * 2026-09-09).\n * @deprecated No longer a supported way to control Table/DataTable geometry (approved\n */\nconst TableDensityContext = React.createContext<TableDensity>(\"normal\")\n\nconst useStyles = makeZenithStyles({\n wrapper: {\n position: \"relative\",\n width: \"100%\",\n ...shorthands.overflow(\"auto\"),\n },\n root: {\n width: \"100%\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n },\n header: {\n \"& tr\": {\n ...shorthands.borderBottom(\"1px\", \"solid\", tokens.grayA5),\n },\n },\n body: {\n \"& tr:last-child\": {\n ...shorthands.borderWidth(0),\n },\n },\n footer: {\n ...shorthands.borderTop(\"1px\", \"solid\", tokens.grayA5),\n backgroundColor: tokens.semGraySoft,\n fontWeight: tokens.fontWeightMedium,\n \"& > tr:last-child\": {\n borderBottomWidth: 0,\n },\n },\n row: {\n ...shorthands.borderBottom(\"1px\", \"solid\", tokens.grayA5),\n transitionProperty:\n \"color, background-color, border-color, text-decoration-color, fill, stroke\",\n transitionDuration: \"150ms\",\n transitionTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n \"&[data-state='selected']\": {\n backgroundColor: tokens.accentA3,\n },\n },\n rowHover: {\n \":hover\": {\n backgroundColor: tokens.accentA3,\n },\n },\n head: {\n // px-3\n paddingLeft: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n // Density-bound: cascades from the nearest [data-density] ancestor — 32/36/40px for\n // compact/normal/comfortable. No JS density switch needed.\n height: tokens.tableHeadHeight,\n verticalAlign: \"middle\",\n fontWeight: tokens.fontWeightMedium,\n color: tokens.grayA12,\n \"&:has([role='checkbox'])\": {\n paddingRight: 0,\n },\n \"& > [role='checkbox']\": {\n // v1 `translate-y-[2px]`.\n translate: \"0 2px\",\n },\n },\n alignLeft: {\n textAlign: \"left\",\n },\n alignCenter: {\n textAlign: \"center\",\n },\n alignRight: {\n textAlign: \"right\",\n },\n cell: {\n // px-3\n paddingLeft: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n // Density-bound: cascades from the nearest [data-density] ancestor — 6/8/12px for\n // compact/normal/comfortable. No JS density switch needed.\n paddingTop: tokens.tableCellPaddingY,\n paddingBottom: tokens.tableCellPaddingY,\n verticalAlign: \"middle\",\n fontWeight: tokens.fontWeightNormal,\n color: tokens.grayA12,\n \"&:has([role='checkbox'])\": {\n paddingRight: 0,\n },\n \"& > [role='checkbox']\": {\n // v1 `translate-y-[2px]`.\n translate: \"0 2px\",\n },\n },\n cellNumeric: {\n fontVariantNumeric: \"tabular-nums\",\n },\n caption: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA11,\n },\n captionTop: {\n captionSide: \"top\",\n // mb-4\n marginBottom: tokens.spacingGroup2,\n },\n captionBottom: {\n captionSide: \"bottom\",\n // mt-4\n marginTop: tokens.spacingGroup2,\n },\n})\n\nexport type TableProps = React.ComponentProps<\"table\"> & {\n density?: TableDensity\n}\n\nexport const Table = React.forwardRef<HTMLTableElement, TableProps>(\n function Table({ className, density, children, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div className={styles.wrapper}>\n <table\n ref={ref}\n data-slot=\"table\"\n {...{ [SLOT_ATTR]: \"table\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n // Authoritative, spread last: a raw caller data-density prop (part of {...props}, since\n // TableProps extends every native table prop) must never win over the normalized density\n // prop — same invariant DensityProvider enforces for its own data-density stamp.\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </table>\n </div>\n )\n }\n)\n\nexport const TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"thead\">\n>(function TableHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <thead\n ref={ref}\n data-slot=\"table-header\"\n {...{ [SLOT_ATTR]: \"table-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n})\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"tbody\">\n>(function TableBody({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tbody\n ref={ref}\n data-slot=\"table-body\"\n {...{ [SLOT_ATTR]: \"table-body\" }}\n className={mergeClasses(styles.body, className)}\n {...props}\n />\n )\n})\n\nexport const TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.ComponentProps<\"tfoot\">\n>(function TableFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tfoot\n ref={ref}\n data-slot=\"table-footer\"\n {...{ [SLOT_ATTR]: \"table-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n})\n\nexport type TableRowProps = React.ComponentProps<\"tr\"> & {\n /** Disable hover background effect */\n noHover?: boolean\n}\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n function TableRow({ className, noHover, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <tr\n ref={ref}\n data-slot=\"table-row\"\n {...{ [SLOT_ATTR]: \"table-row\" }}\n className={mergeClasses(\n styles.row,\n !noHover && styles.rowHover,\n className\n )}\n {...props}\n />\n )\n }\n)\n\nexport type TableHeadProps = React.ComponentProps<\"th\"> & {\n align?: \"left\" | \"center\" | \"right\"\n density?: TableDensity\n}\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableHeadProps>(\n function TableHead(\n { className, align = \"left\", density, scope = \"col\", children, ...props },\n ref\n ) {\n const styles = useStyles()\n\n const alignment =\n align === \"center\"\n ? styles.alignCenter\n : align === \"right\"\n ? styles.alignRight\n : styles.alignLeft\n\n return (\n <th\n ref={ref}\n data-slot=\"table-head\"\n {...{ [SLOT_ATTR]: \"table-head\" }}\n scope={scope}\n className={mergeClasses(styles.head, alignment, className)}\n {...props}\n // Authoritative, normalized, spread last — see the matching comment on Table above.\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n {/* Correction 1 above: an explicit per-cell override must also establish the\n context boundary, not just the DOM stamp — a real portal (Select/Popover/etc.) rendered\n inside this cell is a DOM sibling, not a descendant, so only useDensity() reaches it. */}\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </th>\n )\n }\n)\n\nexport type TableCellProps = React.ComponentProps<\"td\"> & {\n align?: \"left\" | \"center\" | \"right\"\n numeric?: boolean\n density?: TableDensity\n}\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n function TableCell(\n { className, align = \"left\", numeric, density, children, ...props },\n ref\n ) {\n const styles = useStyles()\n\n const alignment =\n align === \"center\"\n ? styles.alignCenter\n : align === \"right\"\n ? styles.alignRight\n : styles.alignLeft\n\n return (\n <td\n ref={ref}\n data-slot=\"table-cell\"\n {...{ [SLOT_ATTR]: \"table-cell\" }}\n className={mergeClasses(\n styles.cell,\n alignment,\n numeric && styles.cellNumeric,\n className\n )}\n {...props}\n // Authoritative, normalized, spread last — see the matching comment on Table above.\n {...(density !== undefined\n ? { \"data-density\": canonicalDensity(density) }\n : {})}\n >\n {/* Correction 1 above: see the matching comment on TableHead. */}\n <DensityContextBoundary density={density}>\n {children}\n </DensityContextBoundary>\n </td>\n )\n }\n)\n\nexport type TableCaptionProps = React.ComponentProps<\"caption\"> & {\n position?: \"top\" | \"bottom\"\n}\n\nexport const TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n TableCaptionProps\n>(function TableCaption({ className, position = \"bottom\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <caption\n ref={ref}\n data-slot=\"table-caption\"\n {...{ [SLOT_ATTR]: \"table-caption\" }}\n className={mergeClasses(\n styles.caption,\n position === \"top\" ? styles.captionTop : styles.captionBottom,\n className\n )}\n {...props}\n />\n )\n})\n\nexport { TableDensityContext }\n"],"names":["TableDensityContext","React","useStyles","makeZenithStyles","shorthands","tokens.textSm","tokens.leadingSm","tokens.grayA5","tokens.semGraySoft","tokens.fontWeightMedium","tokens.accentA3","tokens.spacingElement3","tokens.tableHeadHeight","tokens.grayA12","tokens.tableCellPaddingY","tokens.fontWeightNormal","tokens.grayA11","tokens.spacingGroup2","Table","className","density","children","props","ref","styles","jsx","SLOT_ATTR","mergeClasses","canonicalDensity","DensityContextBoundary","TableHeader","TableBody","TableFooter","TableRow","noHover","TableHead","align","scope","alignment","TableCell","numeric","TableCaption","position"],"mappings":";;;;;;AAwBA,MAAMA,IAAsBC,EAAM,cAA4B,QAAQ,GAEhEC,IAAYC,EAAiB;AAAA,EACjC,SAAS;AAAA,IACP,UAAU;AAAA,IACV,OAAO;AAAA,IACP,GAAGC,EAAW,SAAS,MAAM;AAAA,EAAA;AAAA,EAE/B,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,UAAUC;AAAAA,IACV,YAAYC;AAAAA,EAAO;AAAA,EAErB,QAAQ;AAAA,IACN,QAAQ;AAAA,MACN,GAAGF,EAAW,aAAa,OAAO,SAASG,CAAa;AAAA,IAAA;AAAA,EAC1D;AAAA,EAEF,MAAM;AAAA,IACJ,mBAAmB;AAAA,MACjB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C;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,aAAU;AAAA,MACJ,CAACG,CAAS,GAAG;AAAA,MACnB,WAAWC;AAAA,QACTH,EAAO;AAAA,QACPkB,MAAa,QAAQlB,EAAO,aAAaA,EAAO;AAAA,QAChDL;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sources":["../../../src/components/text/text.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Text — the v1 text scale ported to Griffel atoms
|
|
1
|
+
{"version":3,"file":"text.js","sources":["../../../src/components/text/text.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Text — the v1 text scale ported to Griffel atoms. v1 expressed the ten variants as cva classes\n * (`text-3xl tracking-tighter font-bold` etc.), one per variant.\n */\n\nexport type TextVariant =\n | \"title3\"\n | \"title2\"\n | \"title1\"\n | \"heading3\"\n | \"heading2\"\n | \"heading1\"\n | \"body2\"\n | \"body1\"\n | \"helper2\"\n | \"helper1\"\n\nconst useStyles = makeZenithStyles({\n // Title variants\n title3: {\n fontSize: tokens.text3xl,\n lineHeight: tokens.leading3xl,\n letterSpacing: tokens.trackingTighter,\n fontWeight: tokens.fontWeightBold,\n },\n title2: {\n fontSize: tokens.text2xl,\n lineHeight: tokens.leading2xl,\n letterSpacing: tokens.trackingTight,\n fontWeight: tokens.fontWeightBold,\n },\n title1: {\n fontSize: tokens.textXl,\n lineHeight: tokens.leadingXl,\n letterSpacing: tokens.trackingTight,\n fontWeight: tokens.fontWeightBold,\n },\n // Heading variants\n heading3: {\n fontSize: tokens.textLg,\n lineHeight: tokens.leadingLg,\n letterSpacing: tokens.trackingTight,\n fontWeight: tokens.fontWeightBold,\n },\n heading2: {\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n letterSpacing: tokens.trackingNormal,\n fontWeight: tokens.fontWeightBold,\n },\n heading1: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n letterSpacing: tokens.trackingNormal,\n fontWeight: tokens.fontWeightBold,\n },\n // Body variants\n body2: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n letterSpacing: tokens.trackingNormal,\n display: \"inline-block\",\n },\n body1: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n letterSpacing: tokens.trackingNormal,\n display: \"inline-block\",\n },\n // Helper variants\n helper2: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n letterSpacing: tokens.trackingNormal,\n display: \"inline-block\",\n color: tokens.grayA11,\n },\n helper1: {\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n letterSpacing: tokens.trackingNormal,\n display: \"inline-block\",\n color: tokens.grayA11,\n },\n})\n\nexport type TextProps = React.ComponentProps<\"span\"> & {\n /**\n * The role and size of the text, as one value. **The number runs opposite to HTML heading\n * convention: 3 is the largest of its group and 1 the smallest.** `title3` is `text3xl` and\n * `title1` is `textXl`; `heading3` is `textLg` and `heading1` is `textSm`. Reading `title1` as\n * \"the primary title\" gives you the smallest one.\n */\n variant?: TextVariant\n}\n\nexport const Text = React.forwardRef<HTMLSpanElement, TextProps>(function Text(\n { variant = \"body2\", className, ...props },\n ref\n) {\n const styles = useStyles()\n\n return (\n <span\n ref={ref}\n data-slot=\"text\"\n {...{ [SLOT_ATTR]: \"text\" }}\n className={mergeClasses(styles[variant], className)}\n {...props}\n />\n )\n})\n"],"names":["useStyles","makeZenithStyles","tokens.text3xl","tokens.leading3xl","tokens.trackingTighter","tokens.fontWeightBold","tokens.text2xl","tokens.leading2xl","tokens.trackingTight","tokens.textXl","tokens.leadingXl","tokens.textLg","tokens.leadingLg","tokens.textBase","tokens.leadingBase","tokens.trackingNormal","tokens.textSm","tokens.leadingSm","tokens.textXs","tokens.leadingXs","tokens.grayA11","Text","React","variant","className","props","ref","styles","jsx","SLOT_ATTR","mergeClasses"],"mappings":";;;;;AAyBA,MAAMA,IAAYC,EAAiB;AAAA;AAAA,EAEjC,QAAQ;AAAA,IACN,UAAUC;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeC;AAAAA,IACf,YAAYC;AAAAA,EAAO;AAAA,EAErB,QAAQ;AAAA,IACN,UAAUC;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeC;AAAAA,IACf,YAAYH;AAAAA,EAAO;AAAA,EAErB,QAAQ;AAAA,IACN,UAAUI;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeF;AAAAA,IACf,YAAYH;AAAAA,EAAO;AAAA;AAAA,EAGrB,UAAU;AAAA,IACR,UAAUM;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeJ;AAAAA,IACf,YAAYH;AAAAA,EAAO;AAAA,EAErB,UAAU;AAAA,IACR,UAAUQ;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeC;AAAAA,IACf,YAAYV;AAAAA,EAAO;AAAA,EAErB,UAAU;AAAA,IACR,UAAUW;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeF;AAAAA,IACf,YAAYV;AAAAA,EAAO;AAAA;AAAA,EAGrB,OAAO;AAAA,IACL,UAAUW;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeF;AAAAA,IACf,SAAS;AAAA,EAAA;AAAA,EAEX,OAAO;AAAA,IACL,UAAUG;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeJ;AAAAA,IACf,SAAS;AAAA,EAAA;AAAA;AAAA,EAGX,SAAS;AAAA,IACP,UAAUC;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeF;AAAAA,IACf,SAAS;AAAA,IACT,OAAOK;AAAAA,EAAO;AAAA,EAEhB,SAAS;AAAA,IACP,UAAUF;AAAAA,IACV,YAAYC;AAAAA,IACZ,eAAeJ;AAAAA,IACf,SAAS;AAAA,IACT,OAAOK;AAAAA,EAAO;AAElB,CAAC,GAYYC,IAAOC,EAAM,WAAuC,SAC/D,EAAE,SAAAC,IAAU,SAAS,WAAAC,GAAW,GAAGC,EAAA,GACnCC,GACA;AACA,QAAMC,IAAS3B,EAAA;AAEf,SACE,gBAAA4B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,aAAU;AAAA,MACJ,CAACG,CAAS,GAAG;AAAA,MACnB,WAAWC,EAAaH,EAAOJ,CAAO,GAAGC,CAAS;AAAA,MACjD,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
|
|
@@ -247,12 +247,10 @@ const l1 = Object.assign(o1, {
|
|
|
247
247
|
loading: (o, e) => i.loading(o, e),
|
|
248
248
|
dismiss: (o) => i.dismiss(o),
|
|
249
249
|
/**
|
|
250
|
-
* Declared here rather than passed through: sonner's own signature references
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
* ignores it. A caller who needs that handle must cast, which is a narrowing
|
|
255
|
-
* we accept in exchange for owning the type.
|
|
250
|
+
* Declared here rather than passed through: sonner's own signature references types its bundle
|
|
251
|
+
* does not name publicly, which makes the emitted `.d.ts` unbuildable (TS4023). The return is
|
|
252
|
+
* `unknown` on purpose -- sonner returns an internally-typed handle, and every use in this
|
|
253
|
+
* repository and its docs ignores it.
|
|
256
254
|
*/
|
|
257
255
|
promise: (o, e) => i.promise(
|
|
258
256
|
o,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast.js","sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as Sonner from \"sonner\"\nimport { shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Spinner } from \"../spinner/spinner\"\n\nconst InfoIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst WarningIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst ErrorIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst useStyles = makeZenithStyles({\n toast: {\n pointerEvents: \"auto\",\n position: \"relative\",\n width: \"100%\",\n display: \"flex\",\n alignItems: \"baseline\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.padding(tokens.spacingGroup2, tokens.spacingElement3),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderWidth(0),\n ...shorthands.borderColor(tokens.grayA6),\n backgroundColor: tokens.body,\n color: tokens.grayA12,\n boxShadow: \"0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineColor: tokens.grayA8,\n },\n },\n default: {\n backgroundColor: tokens.body,\n ...shorthands.borderColor(tokens.grayA6),\n ...shorthands.gap(tokens.spacingElement2),\n color: tokens.grayA12,\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(\"0.125rem\"),\n },\n title: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightSemibold,\n ...shorthands.margin(0),\n },\n description: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n ...shorthands.margin(0),\n },\n icon: {\n alignSelf: \"flex-start\",\n display: \"flex\",\n width: \"1.25rem\",\n height: \"1.25rem\",\n position: \"relative\",\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n flexShrink: 0,\n marginLeft: \"var(--toast-icon-margin-start)\",\n marginRight: \"var(--toast-icon-margin-end)\",\n },\n actionButton: {\n ...shorthands.borderRadius(\"9999px\"),\n flexShrink: 0,\n alignSelf: \"flex-end\",\n cursor: \"pointer\",\n marginLeft: \"auto\",\n marginTop: tokens.spacingGroup2,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n ...shorthands.padding(\"0.3125rem\", tokens.spacingElement2),\n color: tokens.semAccentContrast,\n backgroundColor: tokens.gray12,\n \":hover\": {\n backgroundColor: tokens.gray11,\n },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.grayA8,\n },\n },\n cancelButton: {\n backgroundColor: tokens.semGraySoft,\n color: tokens.grayA12,\n \":hover\": {\n backgroundColor: tokens.semGraySoftHover,\n },\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightMedium,\n ...shorthands.padding(\"0.3125rem\", tokens.spacingElement2),\n ...shorthands.borderRadius(tokens.radiusMd),\n },\n closeButton: {\n position: \"absolute\",\n right: \"0.625rem\",\n top: \"0.625rem\",\n ...shorthands.borderRadius(\"9999px\"),\n color: \"currentColor\",\n cursor: \"pointer\",\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: \"inherit\",\n },\n \"& > svg\": {\n width: \"1rem\",\n height: \"1rem\",\n strokeWidth: \"2px\",\n },\n },\n success: {\n ...shorthands.borderColor(tokens.semSuccessUi),\n backgroundColor: tokens.success4,\n color: tokens.successA12,\n \"& [data-icon]\": {\n color: tokens.successA11,\n },\n },\n info: {\n ...shorthands.borderColor(tokens.semInfoUi),\n backgroundColor: tokens.info3,\n color: tokens.infoA12,\n \"& [data-icon]\": {\n color: tokens.infoA11,\n },\n },\n warning: {\n ...shorthands.borderColor(tokens.semWarningUi),\n backgroundColor: tokens.warning3,\n color: tokens.warningA12,\n \"& [data-icon]\": {\n color: tokens.warningA11,\n },\n },\n error: {\n ...shorthands.borderColor(tokens.semErrorUi),\n backgroundColor: tokens.error4,\n color: tokens.errorA12,\n \"& [data-icon]\": {\n color: tokens.errorA11,\n },\n },\n loading: {},\n spinner: {\n width: \"1.125rem\",\n height: \"1.125rem\",\n },\n})\n\n/**\n * Zenith's own Toaster surface. Declared rather than intersected with\n * `Sonner.ToasterProps` so a sonner release cannot move this package's public\n * API without a change in this repository. Props sonner supports but Zenith\n * does not intend to own -- `invert`, `hotkey`, `richColors`, `swipeDirections`\n * and `icons` -- are deliberately absent: Zenith owns the toast's appearance.\n */\nexport type ToasterProps = {\n id?: string\n theme?: \"light\" | \"dark\"\n position?: ToastPosition\n duration?: number\n gap?: number\n visibleToasts?: number\n closeButton?: boolean\n expand?: boolean\n dir?: \"rtl\" | \"ltr\" | \"auto\"\n offset?: ToastOffset\n mobileOffset?: ToastOffset\n className?: string\n style?: React.CSSProperties\n containerAriaLabel?: string\n /** Per-toast defaults. Zenith supplies the class names; these merge over them. */\n toastOptions?: {\n className?: string\n descriptionClassName?: string\n style?: React.CSSProperties\n duration?: number\n closeButton?: boolean\n closeButtonAriaLabel?: string\n classNames?: Partial<\n Record<\n | \"toast\"\n | \"title\"\n | \"description\"\n | \"loader\"\n | \"closeButton\"\n | \"cancelButton\"\n | \"actionButton\"\n | \"success\"\n | \"error\"\n | \"info\"\n | \"warning\"\n | \"loading\"\n | \"default\"\n | \"content\"\n | \"icon\",\n string\n >\n >\n }\n}\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-right\"\n | \"top-center\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"bottom-center\"\n\nexport type ToastOffset =\n | string\n | number\n | {\n top?: string | number\n right?: string | number\n bottom?: string | number\n left?: string | number\n }\n\n/**\n * @slot-foreign-dom sonner renders and owns this DOM. `Toaster` returns `<Sonner.Toaster>`, whose\n * root element and entire subtree are sonner's; we style it through sonner's own `toastOptions`\n * class hooks rather than by selecting it. There is no element of ours here to put `data-slot` or\n * `SLOT_ATTR` on, and a marker set on sonner's root would name a node we do not control.\n *\n * This is ownership, not debt — distinct from `@slot-exempt`, which means our element, rule\n * knowingly skipped. See the public-surface audit for the related finding that `toast` itself is\n * re-exported verbatim out of sonner.\n */\nexport const Toaster = React.forwardRef<HTMLElement, ToasterProps>(\n function Toaster({ theme, toastOptions, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <Sonner.Toaster\n ref={ref}\n closeButton={true}\n theme={theme}\n toastOptions={{\n ...toastOptions,\n unstyled: true,\n classNames: {\n toast: styles.toast,\n default: styles.default,\n content: styles.content,\n title: styles.title,\n description: styles.description,\n icon: styles.icon,\n actionButton: styles.actionButton,\n cancelButton: styles.cancelButton,\n closeButton: styles.closeButton,\n success: styles.success,\n info: styles.info,\n warning: styles.warning,\n error: styles.error,\n loading: styles.loading,\n ...toastOptions?.classNames,\n },\n }}\n icons={{\n success: <CheckIcon />,\n info: <InfoIcon />,\n warning: <WarningIcon />,\n error: <ErrorIcon />,\n loading: <Spinner className={styles.spinner} />,\n }}\n {...props}\n />\n )\n }\n)\n\n/**\n * Zenith's own per-toast options. Previously `Parameters<typeof Sonner.toast>[1]`,\n * which made every option sonner declared part of this package's public API.\n *\n * `onDismiss`/`onAutoClose` receive sonner's internal toast record. It is typed\n * as `unknown` on purpose: re-exporting that record would reintroduce exactly\n * the coupling this type exists to remove.\n */\nexport type ToastOptions = {\n id?: string | number\n description?: React.ReactNode\n duration?: number\n icon?: React.ReactNode\n className?: string\n style?: React.CSSProperties\n position?: ToastPosition\n dismissible?: boolean\n action?: {\n label: React.ReactNode\n /** Call `event.preventDefault()` here to keep the toast open after the action. */\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void\n }\n cancel?: {\n label: React.ReactNode\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void\n }\n onDismiss?: (toast: unknown) => void\n onAutoClose?: (toast: unknown) => void\n /** Routes this toast to `<Toaster id>`; without it a second Toaster renders nothing. */\n toasterId?: string\n}\n\n/**\n * Sonner's own options type, used only to cast at the delegation boundary. It is\n * never referenced by an exported declaration, so it does not reach this\n * package's `.d.ts`.\n */\ntype SonnerOptions = Parameters<typeof Sonner.toast>[1]\n\n/**\n * Every key Zenith declares must still exist on sonner's own options type. The\n * delegation casts below would otherwise hide a rename or removal: the cast\n * stays assignable because every property is optional, so a sonner release that\n * drops `dismissible` would compile cleanly and stop working at runtime. This\n * turns that into a build failure.\n */\ntype _ZenithToastOptionsExistOnSonner =\n keyof ToastOptions extends keyof NonNullable<SonnerOptions> ? true : never\nconst _zenithToastOptionsConform: _ZenithToastOptionsExistOnSonner = true\nvoid _zenithToastOptionsConform\n\nfunction toastFn(message: React.ReactNode, options?: ToastOptions) {\n return Sonner.toast(message, options as SonnerOptions)\n}\n\n/**\n * Zenith's toast entry point. Delegates to sonner, but the callable surface is\n * this package's own: a sonner release can no longer add, remove or reshape a\n * method here without a change in this repository.\n *\n * `promise` is the one member passed through rather than re-wrapped. Its generic\n * over the settled value is what callers depend on, and re-declaring it by hand\n * is where a narrowing bug would be introduced. That is a named exception, not\n * the previous situation where the entire object was sonner's.\n *\n * `custom` and `message` are intentionally absent -- neither is used anywhere in\n * this repository or its documentation.\n */\nexport const toast = Object.assign(toastFn, {\n success: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.success(message, options as SonnerOptions),\n error: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.error(message, options as SonnerOptions),\n warning: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.warning(message, options as SonnerOptions),\n info: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.info(message, options as SonnerOptions),\n loading: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.loading(message, options as SonnerOptions),\n dismiss: (id?: string | number) => Sonner.toast.dismiss(id),\n /**\n * Declared here rather than passed through: sonner's own signature references\n * types its bundle does not name publicly, which makes the emitted `.d.ts`\n * unbuildable (TS4023). The return is `unknown` on purpose -- sonner returns an\n * internally-typed handle, and every use in this repository and its docs\n * ignores it. A caller who needs that handle must cast, which is a narrowing\n * we accept in exchange for owning the type.\n */\n promise: <T,>(\n promise: Promise<T> | (() => Promise<T>),\n data?: {\n loading?: React.ReactNode\n success?: React.ReactNode | ((data: T) => React.ReactNode)\n error?: React.ReactNode | ((error: unknown) => React.ReactNode)\n description?: React.ReactNode\n finally?: () => void | Promise<void>\n }\n ): unknown =>\n Sonner.toast.promise(\n promise as Parameters<typeof Sonner.toast.promise>[0],\n data as Parameters<typeof Sonner.toast.promise>[1]\n ),\n})\n"],"names":["InfoIcon","props","jsx","WarningIcon","CheckIcon","ErrorIcon","useStyles","makeZenithStyles","shorthands","tokens.spacingElement2","tokens.spacingGroup2","tokens.spacingElement3","tokens.radiusXl","tokens.grayA6","tokens.body","tokens.grayA12","tokens.grayA8","tokens.textSm","tokens.leadingSm","tokens.fontWeightSemibold","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.semAccentContrast","tokens.gray12","tokens.gray11","tokens.semGraySoft","tokens.semGraySoftHover","tokens.radiusMd","tokens.semSuccessUi","tokens.success4","tokens.successA12","tokens.successA11","tokens.semInfoUi","tokens.info3","tokens.infoA12","tokens.infoA11","tokens.semWarningUi","tokens.warning3","tokens.warningA12","tokens.warningA11","tokens.semErrorUi","tokens.error4","tokens.errorA12","tokens.errorA11","Toaster","React","theme","toastOptions","ref","styles","Sonner.Toaster","Spinner","toastFn","message","options","Sonner.toast","toast","id","promise","data"],"mappings":";;;;;;;AAQA,MAAMA,IAAW,CAACC,MAChB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MAAK;AAAA,IACJ,GAAGD;AAAA,IAEJ,UAAA,gBAAAC,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,EAAA;AAC78C,GAGIC,IAAc,CAACF,MACnB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MAAK;AAAA,IACJ,GAAGD;AAAA,IAEJ,UAAA,gBAAAC,EAAC,QAAA,EAAK,GAAE,i1CAAA,CAAi1C;AAAA,EAAA;AA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,MAClCC,EAAa,QAAQF,GAASC,CAAwB;AAAA,EACxD,MAAM,CAACD,GAA0BC,MAC/BC,EAAa,KAAKF,GAASC,CAAwB;AAAA,EACrD,SAAS,CAACD,GAA0BC,MAClCC,EAAa,QAAQF,GAASC,CAAwB;AAAA,EACxD,SAAS,CAACG,MAAyBF,EAAa,QAAQE,CAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS1D,SAAS,CACPC,GACAC,MAQAJ,EAAa;AAAA,IACXG;AAAA,IACAC;AAAA,EAAA;AAEN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"toast.js","sources":["../../../src/components/toast/toast.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as Sonner from \"sonner\"\nimport { shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport { Spinner } from \"../spinner/spinner\"\n\nconst InfoIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5345 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V11.75C12.75 11.5375 12.6781 11.3593 12.5343 11.2155C12.3904 11.0718 12.2122 11 11.9997 11C11.7871 11 11.609 11.0718 11.4655 11.2155C11.3218 11.3593 11.25 11.5375 11.25 11.75V16C11.25 16.2125 11.3219 16.3906 11.4658 16.5343C11.6096 16.6781 11.7878 16.75 12.0003 16.75ZM12 9.2885C12.2288 9.2885 12.4207 9.21108 12.5755 9.05625C12.7303 8.90142 12.8077 8.70958 12.8077 8.48075C12.8077 8.25192 12.7303 8.06008 12.5755 7.90525C12.4207 7.75058 12.2288 7.67325 12 7.67325C11.7712 7.67325 11.5793 7.75058 11.4245 7.90525C11.2697 8.06008 11.1923 8.25192 11.1923 8.48075C11.1923 8.70958 11.2697 8.90142 11.4245 9.05625C11.5793 9.21108 11.7712 9.2885 12 9.2885ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst WarningIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M3.4255 20.5C3.256 20.5 3.10375 20.4586 2.96875 20.3757C2.83375 20.2929 2.72883 20.1837 2.654 20.048C2.576 19.9133 2.53308 19.7675 2.52525 19.6105C2.51742 19.4535 2.55975 19.298 2.65225 19.144L11.213 4.356C11.3057 4.202 11.4215 4.08817 11.5605 4.0145C11.6997 3.94083 11.8462 3.904 12 3.904C12.1538 3.904 12.3003 3.94083 12.4395 4.0145C12.5785 4.08817 12.6943 4.202 12.787 4.356L21.3477 19.144C21.4402 19.298 21.4826 19.4535 21.4747 19.6105C21.4669 19.7675 21.424 19.9133 21.346 20.048C21.2712 20.1837 21.1663 20.2929 21.0313 20.3757C20.8963 20.4586 20.744 20.5 20.5745 20.5H3.4255ZM12 17.8077C12.2288 17.8077 12.4207 17.7303 12.5755 17.5755C12.7303 17.4207 12.8078 17.2288 12.8078 17C12.8078 16.7712 12.7303 16.5793 12.5755 16.4245C12.4207 16.2697 12.2288 16.1923 12 16.1923C11.7712 16.1923 11.5793 16.2697 11.4245 16.4245C11.2697 16.5793 11.1923 16.7712 11.1923 17C11.1923 17.2288 11.2697 17.4207 11.4245 17.5755C11.5793 17.7303 11.7712 17.8077 12 17.8077ZM12.0003 15.1923C12.2129 15.1923 12.391 15.1204 12.5345 14.9768C12.6782 14.8329 12.75 14.6548 12.75 14.4423V10.9423C12.75 10.7298 12.6781 10.5517 12.5342 10.408C12.3904 10.2642 12.2122 10.1923 11.9997 10.1923C11.7871 10.1923 11.609 10.2642 11.4655 10.408C11.3218 10.5517 11.25 10.7298 11.25 10.9423V14.4423C11.25 14.6548 11.3219 14.8329 11.4658 14.9768C11.6096 15.1204 11.7878 15.1923 12.0003 15.1923Z\" />\n </svg>\n)\n\nconst CheckIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M10.5808 14.1463L8.25775 11.823C8.11925 11.6847 7.94517 11.6138 7.7355 11.6105C7.526 11.6073 7.34875 11.6782 7.20375 11.823C7.05892 11.968 6.9865 12.1437 6.9865 12.35C6.9865 12.5563 7.05892 12.732 7.20375 12.877L9.948 15.6212C10.1288 15.8019 10.3398 15.8922 10.5808 15.8922C10.8218 15.8922 11.0327 15.8019 11.2135 15.6212L16.777 10.0577C16.9153 9.91925 16.9862 9.74517 16.9895 9.5355C16.9927 9.326 16.9218 9.14875 16.777 9.00375C16.632 8.85892 16.4563 8.7865 16.25 8.7865C16.0437 8.7865 15.868 8.85892 15.723 9.00375L10.5808 14.1463ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst ErrorIcon = (props: React.ComponentProps<\"svg\">) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n {...props}\n >\n <path d=\"M12 16.7307C12.2288 16.7307 12.4207 16.6533 12.5755 16.4985C12.7303 16.3437 12.8077 16.1518 12.8077 15.923C12.8077 15.6942 12.7303 15.5023 12.5755 15.3475C12.4207 15.1928 12.2288 15.1155 12 15.1155C11.7712 15.1155 11.5793 15.1928 11.4245 15.3475C11.2697 15.5023 11.1923 15.6942 11.1923 15.923C11.1923 16.1518 11.2697 16.3437 11.4245 16.4985C11.5793 16.6533 11.7712 16.7307 12 16.7307ZM12.0003 13.077C12.2129 13.077 12.391 13.0051 12.5345 12.8613C12.6782 12.7176 12.75 12.5395 12.75 12.327V7.827C12.75 7.6145 12.6781 7.43633 12.5343 7.2925C12.3904 7.14883 12.2122 7.077 11.9997 7.077C11.7871 7.077 11.609 7.14883 11.4655 7.2925C11.3218 7.43633 11.25 7.6145 11.25 7.827V12.327C11.25 12.5395 11.3219 12.7176 11.4658 12.8613C11.6096 13.0051 11.7878 13.077 12.0003 13.077ZM12.0017 21.5C10.6877 21.5 9.45267 21.2507 8.2965 20.752C7.14033 20.2533 6.13467 19.5766 5.2795 18.7218C4.42433 17.8669 3.74725 16.8617 3.24825 15.706C2.74942 14.5503 2.5 13.3156 2.5 12.0017C2.5 10.6877 2.74933 9.45267 3.248 8.2965C3.74667 7.14033 4.42342 6.13467 5.27825 5.2795C6.13308 4.42433 7.13833 3.74725 8.294 3.24825C9.44967 2.74942 10.6844 2.5 11.9982 2.5C13.3122 2.5 14.5473 2.74933 15.7035 3.248C16.8597 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.13308 20.2528 7.13833 20.7518 8.294C21.2506 9.44967 21.5 10.6844 21.5 11.9982C21.5 13.3122 21.2507 14.5473 20.752 15.7035C20.2533 16.8597 19.5766 17.8653 18.7218 18.7205C17.8669 19.5757 16.8617 20.2528 15.706 20.7518C14.5503 21.2506 13.3156 21.5 12.0017 21.5Z\" />\n </svg>\n)\n\nconst useStyles = makeZenithStyles({\n toast: {\n pointerEvents: \"auto\",\n position: \"relative\",\n width: \"100%\",\n display: \"flex\",\n alignItems: \"baseline\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.padding(tokens.spacingGroup2, tokens.spacingElement3),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.borderStyle(\"solid\"),\n ...shorthands.borderWidth(0),\n ...shorthands.borderColor(tokens.grayA6),\n backgroundColor: tokens.body,\n color: tokens.grayA12,\n boxShadow: \"0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineColor: tokens.grayA8,\n },\n },\n default: {\n backgroundColor: tokens.body,\n ...shorthands.borderColor(tokens.grayA6),\n ...shorthands.gap(tokens.spacingElement2),\n color: tokens.grayA12,\n },\n content: {\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(\"0.125rem\"),\n },\n title: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightSemibold,\n ...shorthands.margin(0),\n },\n description: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n ...shorthands.margin(0),\n },\n icon: {\n alignSelf: \"flex-start\",\n display: \"flex\",\n width: \"1.25rem\",\n height: \"1.25rem\",\n position: \"relative\",\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n flexShrink: 0,\n marginLeft: \"var(--toast-icon-margin-start)\",\n marginRight: \"var(--toast-icon-margin-end)\",\n },\n actionButton: {\n ...shorthands.borderRadius(\"9999px\"),\n flexShrink: 0,\n alignSelf: \"flex-end\",\n cursor: \"pointer\",\n marginLeft: \"auto\",\n marginTop: tokens.spacingGroup2,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightMedium,\n ...shorthands.padding(\"0.3125rem\", tokens.spacingElement2),\n color: tokens.semAccentContrast,\n backgroundColor: tokens.gray12,\n \":hover\": {\n backgroundColor: tokens.gray11,\n },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.grayA8,\n },\n },\n cancelButton: {\n backgroundColor: tokens.semGraySoft,\n color: tokens.grayA12,\n \":hover\": {\n backgroundColor: tokens.semGraySoftHover,\n },\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightMedium,\n ...shorthands.padding(\"0.3125rem\", tokens.spacingElement2),\n ...shorthands.borderRadius(tokens.radiusMd),\n },\n closeButton: {\n position: \"absolute\",\n right: \"0.625rem\",\n top: \"0.625rem\",\n ...shorthands.borderRadius(\"9999px\"),\n color: \"currentColor\",\n cursor: \"pointer\",\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: \"inherit\",\n },\n \"& > svg\": {\n width: \"1rem\",\n height: \"1rem\",\n strokeWidth: \"2px\",\n },\n },\n success: {\n ...shorthands.borderColor(tokens.semSuccessUi),\n backgroundColor: tokens.success4,\n color: tokens.successA12,\n \"& [data-icon]\": {\n color: tokens.successA11,\n },\n },\n info: {\n ...shorthands.borderColor(tokens.semInfoUi),\n backgroundColor: tokens.info3,\n color: tokens.infoA12,\n \"& [data-icon]\": {\n color: tokens.infoA11,\n },\n },\n warning: {\n ...shorthands.borderColor(tokens.semWarningUi),\n backgroundColor: tokens.warning3,\n color: tokens.warningA12,\n \"& [data-icon]\": {\n color: tokens.warningA11,\n },\n },\n error: {\n ...shorthands.borderColor(tokens.semErrorUi),\n backgroundColor: tokens.error4,\n color: tokens.errorA12,\n \"& [data-icon]\": {\n color: tokens.errorA11,\n },\n },\n loading: {},\n spinner: {\n width: \"1.125rem\",\n height: \"1.125rem\",\n },\n})\n\n/**\n * Zenith's own Toaster surface. Declared rather than intersected with\n * `Sonner.ToasterProps` so a sonner release cannot move this package's public\n * API without a change in this repository. Props sonner supports but Zenith\n * does not intend to own -- `invert`, `hotkey`, `richColors`, `swipeDirections`\n * and `icons` -- are deliberately absent: Zenith owns the toast's appearance.\n */\nexport type ToasterProps = {\n id?: string\n theme?: \"light\" | \"dark\"\n position?: ToastPosition\n duration?: number\n gap?: number\n visibleToasts?: number\n closeButton?: boolean\n expand?: boolean\n dir?: \"rtl\" | \"ltr\" | \"auto\"\n offset?: ToastOffset\n mobileOffset?: ToastOffset\n className?: string\n style?: React.CSSProperties\n containerAriaLabel?: string\n /** Per-toast defaults. Zenith supplies the class names; these merge over them. */\n toastOptions?: {\n className?: string\n descriptionClassName?: string\n style?: React.CSSProperties\n duration?: number\n closeButton?: boolean\n closeButtonAriaLabel?: string\n classNames?: Partial<\n Record<\n | \"toast\"\n | \"title\"\n | \"description\"\n | \"loader\"\n | \"closeButton\"\n | \"cancelButton\"\n | \"actionButton\"\n | \"success\"\n | \"error\"\n | \"info\"\n | \"warning\"\n | \"loading\"\n | \"default\"\n | \"content\"\n | \"icon\",\n string\n >\n >\n }\n}\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-right\"\n | \"top-center\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"bottom-center\"\n\nexport type ToastOffset =\n | string\n | number\n | {\n top?: string | number\n right?: string | number\n bottom?: string | number\n left?: string | number\n }\n\n/**\n * root element and entire subtree are sonner's; we style it through sonner's own `toastOptions`\n * class hooks rather than by selecting it. There is no element of ours here to put `data-slot` or\n * `SLOT_ATTR` on, and a marker set on sonner's root would name a node we do not control. knowingly\n * skipped.\n * @slot-foreign-dom sonner renders and owns this DOM. `Toaster` returns `<Sonner.Toaster>`, whose\n * This is ownership, not debt — distinct from `@slot-exempt`, which means our element, rule\n */\nexport const Toaster = React.forwardRef<HTMLElement, ToasterProps>(\n function Toaster({ theme, toastOptions, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <Sonner.Toaster\n ref={ref}\n closeButton={true}\n theme={theme}\n toastOptions={{\n ...toastOptions,\n unstyled: true,\n classNames: {\n toast: styles.toast,\n default: styles.default,\n content: styles.content,\n title: styles.title,\n description: styles.description,\n icon: styles.icon,\n actionButton: styles.actionButton,\n cancelButton: styles.cancelButton,\n closeButton: styles.closeButton,\n success: styles.success,\n info: styles.info,\n warning: styles.warning,\n error: styles.error,\n loading: styles.loading,\n ...toastOptions?.classNames,\n },\n }}\n icons={{\n success: <CheckIcon />,\n info: <InfoIcon />,\n warning: <WarningIcon />,\n error: <ErrorIcon />,\n loading: <Spinner className={styles.spinner} />,\n }}\n {...props}\n />\n )\n }\n)\n\n/**\n * Zenith's own per-toast options. Previously `Parameters<typeof Sonner.toast>[1]`, which made\n * every option sonner declared part of this package's public API. `onDismiss`/`onAutoClose`\n * receive sonner's internal toast record.\n */\nexport type ToastOptions = {\n id?: string | number\n description?: React.ReactNode\n duration?: number\n icon?: React.ReactNode\n className?: string\n style?: React.CSSProperties\n position?: ToastPosition\n dismissible?: boolean\n action?: {\n label: React.ReactNode\n /** Call `event.preventDefault()` here to keep the toast open after the action. */\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void\n }\n cancel?: {\n label: React.ReactNode\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void\n }\n onDismiss?: (toast: unknown) => void\n onAutoClose?: (toast: unknown) => void\n /** Routes this toast to `<Toaster id>`; without it a second Toaster renders nothing. */\n toasterId?: string\n}\n\n/**\n * Sonner's own options type, used only to cast at the delegation boundary. It is\n * never referenced by an exported declaration, so it does not reach this\n * package's `.d.ts`.\n */\ntype SonnerOptions = Parameters<typeof Sonner.toast>[1]\n\n/**\n * Every key Zenith declares must still exist on sonner's own options type. The\n * delegation casts below would otherwise hide a rename or removal: the cast\n * stays assignable because every property is optional, so a sonner release that\n * drops `dismissible` would compile cleanly and stop working at runtime. This\n * turns that into a build failure.\n */\ntype _ZenithToastOptionsExistOnSonner =\n keyof ToastOptions extends keyof NonNullable<SonnerOptions> ? true : never\nconst _zenithToastOptionsConform: _ZenithToastOptionsExistOnSonner = true\nvoid _zenithToastOptionsConform\n\nfunction toastFn(message: React.ReactNode, options?: ToastOptions) {\n return Sonner.toast(message, options as SonnerOptions)\n}\n\n/**\n * Zenith's toast entry point. Delegates to sonner, but the callable surface is this package's own:\n * a sonner release can no longer add, remove or reshape a method here without a change in this\n * repository. `promise` is the one member passed through rather than re-wrapped.\n */\nexport const toast = Object.assign(toastFn, {\n success: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.success(message, options as SonnerOptions),\n error: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.error(message, options as SonnerOptions),\n warning: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.warning(message, options as SonnerOptions),\n info: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.info(message, options as SonnerOptions),\n loading: (message: React.ReactNode, options?: ToastOptions) =>\n Sonner.toast.loading(message, options as SonnerOptions),\n dismiss: (id?: string | number) => Sonner.toast.dismiss(id),\n /**\n * Declared here rather than passed through: sonner's own signature references types its bundle\n * does not name publicly, which makes the emitted `.d.ts` unbuildable (TS4023). The return is\n * `unknown` on purpose -- sonner returns an internally-typed handle, and every use in this\n * repository and its docs ignores it.\n */\n promise: <T,>(\n promise: Promise<T> | (() => Promise<T>),\n data?: {\n loading?: React.ReactNode\n success?: React.ReactNode | ((data: T) => React.ReactNode)\n error?: React.ReactNode | ((error: unknown) => React.ReactNode)\n description?: React.ReactNode\n finally?: () => void | Promise<void>\n }\n ): unknown =>\n Sonner.toast.promise(\n promise as Parameters<typeof Sonner.toast.promise>[0],\n data as Parameters<typeof Sonner.toast.promise>[1]\n ),\n})\n"],"names":["InfoIcon","props","jsx","WarningIcon","CheckIcon","ErrorIcon","useStyles","makeZenithStyles","shorthands","tokens.spacingElement2","tokens.spacingGroup2","tokens.spacingElement3","tokens.radiusXl","tokens.grayA6","tokens.body","tokens.grayA12","tokens.grayA8","tokens.textSm","tokens.leadingSm","tokens.fontWeightSemibold","tokens.textXs","tokens.leadingXs","tokens.fontWeightMedium","tokens.semAccentContrast","tokens.gray12","tokens.gray11","tokens.semGraySoft","tokens.semGraySoftHover","tokens.radiusMd","tokens.semSuccessUi","tokens.success4","tokens.successA12","tokens.successA11","tokens.semInfoUi","tokens.info3","tokens.infoA12","tokens.infoA11","tokens.semWarningUi","tokens.warning3","tokens.warningA12","tokens.warningA11","tokens.semErrorUi","tokens.error4","tokens.errorA12","tokens.errorA11","Toaster","React","theme","toastOptions","ref","styles","Sonner.Toaster","Spinner","toastFn","message","options","Sonner.toast","toast","id","promise","data"],"mappings":";;;;;;;AAQA,MAAMA,IAAW,CAACC,MAChB,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,SAAQ;AAAA,IACR,MAAK;AAAA,IACJ,GAAGD;AAAA,IAEJ,UAAA,gBAAAC,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,EAAA;AAC78C,GAGIC,IAAc,CAACF,MACnB,gBAAAC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OAAOJ,IAAS;AAAA,EAC1C,SAAS,CAACC,GAA0BC,MAClCC,EAAa,QAAQF,GAASC,CAAwB;AAAA,EACxD,OAAO,CAACD,GAA0BC,MAChCC,EAAa,MAAMF,GAASC,CAAwB;AAAA,EACtD,SAAS,CAACD,GAA0BC,MAClCC,EAAa,QAAQF,GAASC,CAAwB;AAAA,EACxD,MAAM,CAACD,GAA0BC,MAC/BC,EAAa,KAAKF,GAASC,CAAwB;AAAA,EACrD,SAAS,CAACD,GAA0BC,MAClCC,EAAa,QAAQF,GAASC,CAAwB;AAAA,EACxD,SAAS,CAACG,MAAyBF,EAAa,QAAQE,CAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO1D,SAAS,CACPC,GACAC,MAQAJ,EAAa;AAAA,IACXG;AAAA,IACAC;AAAA,EAAA;AAEN,CAAC;"}
|
package/dist/delivery/index.d.ts
CHANGED
|
@@ -1,56 +1,22 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Core-token stylesheet delivery. The sheet is compiled in and installed through the runtime's
|
|
3
|
+
* `ensureSheet`, which keys on its content hash — see `DECISIONS.md` D3.
|
|
4
|
+
*/
|
|
2
5
|
interface CoreTokenAssetDescriptor {
|
|
3
|
-
readonly url: string;
|
|
4
|
-
readonly integrity: string;
|
|
5
6
|
readonly namespace: string;
|
|
6
7
|
readonly sheetHash: string;
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
+
/** Generated; never hand-written. */
|
|
9
10
|
declare const CORE_TOKEN_ASSET: CoreTokenAssetDescriptor;
|
|
10
11
|
declare const TOKENS_ATTR = "data-zenith-tokens";
|
|
11
|
-
declare class CoreTokensNotPreparedError extends Error {
|
|
12
|
-
readonly sheetHash: string;
|
|
13
|
-
constructor(sheetHash: string);
|
|
14
|
-
}
|
|
15
|
-
declare class CoreTokensFetchError extends Error {
|
|
16
|
-
readonly url: string;
|
|
17
|
-
constructor(url: string, reason: string);
|
|
18
|
-
}
|
|
19
|
-
declare class CoreTokensIntegrityError extends Error {
|
|
20
|
-
readonly url: string;
|
|
21
|
-
readonly expected: string;
|
|
22
|
-
readonly actual: string;
|
|
23
|
-
constructor(url: string, expected: string, actual: string);
|
|
24
|
-
}
|
|
25
|
-
declare class CoreTokensTimeoutError extends Error {
|
|
26
|
-
readonly url: string;
|
|
27
|
-
readonly timeoutMs: number;
|
|
28
|
-
constructor(url: string, timeoutMs: number);
|
|
29
|
-
}
|
|
30
12
|
interface PrepareCoreTokensOptions {
|
|
31
|
-
/**
|
|
32
|
-
* Target Document instance. Defaults to ambient global `document` when omitted.
|
|
33
|
-
* SSR / non-DOM environments resolve immediately without network fetch.
|
|
34
|
-
*/
|
|
13
|
+
/** Defaults to the ambient `document`; without one, this resolves and does nothing. */
|
|
35
14
|
document?: Document;
|
|
36
|
-
/**
|
|
37
|
-
* Optional base URL for asset resolution when assets are hosted under an explicit CDN/origin.
|
|
38
|
-
* If omitted, relative or absolute URLs resolve against `document.location.origin`.
|
|
39
|
-
*/
|
|
40
|
-
assetBaseUrl?: string;
|
|
41
15
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Prepares the generated core-token asset for a document. The descriptor cannot be overridden.
|
|
44
|
-
* Marked inline sheets are adopted only after integrity verification, concurrent calls share one
|
|
45
|
-
* request per document, and failed requests remain retryable. Failures reject the returned promise
|
|
46
|
-
* rather than throwing synchronously.
|
|
47
|
-
*/
|
|
48
|
-
declare function prepareCoreTokens(options?: PrepareCoreTokensOptions): Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Restores prepared core tokens synchronously. Throws `CoreTokensNotPreparedError` if preparation
|
|
51
|
-
* has not completed; returns `false` without network access outside the DOM.
|
|
52
|
-
*/
|
|
16
|
+
/** Installs the core sheet. Returns true when this call inserted it. Idempotent. */
|
|
53
17
|
declare function ensureCoreTokens(doc?: Document): boolean;
|
|
18
|
+
/** Optional: components install the sheet themselves as they render. */
|
|
19
|
+
declare function prepareCoreTokens(options?: PrepareCoreTokensOptions): Promise<void>;
|
|
54
20
|
|
|
55
|
-
export { CORE_TOKEN_ASSET,
|
|
21
|
+
export { CORE_TOKEN_ASSET, TOKENS_ATTR, ensureCoreTokens, prepareCoreTokens };
|
|
56
22
|
export type { CoreTokenAssetDescriptor, PrepareCoreTokensOptions };
|
package/dist/delivery/index.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { CORE_TOKEN_ASSET as
|
|
1
|
+
import { CORE_TOKEN_ASSET as T, TOKENS_ATTR as o, ensureCoreTokens as E, prepareCoreTokens as n } from "../packages/tokens/dist/delivery/index.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
s as CoreTokensTimeoutError,
|
|
8
|
-
C as TOKENS_ATTR,
|
|
9
|
-
k as ensureCoreTokens,
|
|
10
|
-
t as prepareCoreTokens
|
|
3
|
+
T as CORE_TOKEN_ASSET,
|
|
4
|
+
o as TOKENS_ATTR,
|
|
5
|
+
E as ensureCoreTokens,
|
|
6
|
+
n as prepareCoreTokens
|
|
11
7
|
};
|
|
12
8
|
//# sourceMappingURL=index.js.map
|