@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
package/README.md
CHANGED
|
@@ -3,33 +3,78 @@
|
|
|
3
3
|
Accessible React components for Zenith, styled with Griffel and designed for
|
|
4
4
|
independent micro-frontend delivery.
|
|
5
5
|
|
|
6
|
+
## Install
|
|
7
|
+
|
|
6
8
|
```sh
|
|
7
|
-
|
|
9
|
+
npm install @epilot/zenith-react
|
|
8
10
|
```
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
the
|
|
12
|
+
`@epilot/zenith-runtime` installs with it; do not override it unless the host
|
|
13
|
+
serves the identical `/v1` ABI. Tokens are built in, so there is no third
|
|
14
|
+
package. React and React DOM 18 or newer are peers.
|
|
15
|
+
|
|
16
|
+
Zenith is an ordinary per-application dependency, not something loaded through a
|
|
17
|
+
shared component-library import map.
|
|
18
|
+
|
|
19
|
+
## Render
|
|
12
20
|
|
|
13
21
|
```tsx
|
|
14
22
|
import { Button } from "@epilot/zenith-react"
|
|
23
|
+
import { gray11 } from "@epilot/zenith-react/tokens"
|
|
24
|
+
|
|
25
|
+
export const Example = () => <Button variant="primary">Continue</Button>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
There is no setup step: components install their token stylesheet as they
|
|
29
|
+
render. To install it at startup instead:
|
|
30
|
+
|
|
31
|
+
```ts
|
|
15
32
|
import { prepareCoreTokens } from "@epilot/zenith-react/delivery"
|
|
16
33
|
|
|
17
34
|
await prepareCoreTokens()
|
|
35
|
+
```
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
Optional; no network. Do not add the token CSS as a second stylesheet, and do
|
|
38
|
+
not write generated namespace hashes by hand.
|
|
39
|
+
|
|
40
|
+
Use `AppearanceBoundary` for a scoped appearance that must also reach portalled
|
|
41
|
+
content — a theme or surface attribute on a subtree does not follow a Dialog,
|
|
42
|
+
Popover, Select, Tooltip or menu into `document.body`.
|
|
43
|
+
|
|
44
|
+
## Validate the host
|
|
45
|
+
|
|
46
|
+
- Exercise the application under its real content-security policy.
|
|
47
|
+
- Open and close every portalled component.
|
|
48
|
+
- Test keyboard order, focus restoration, screen-reader names and error states.
|
|
49
|
+
- Test two independently bundled Zenith consumers on one page, where that is a
|
|
50
|
+
supported host scenario.
|
|
51
|
+
- Measure the actual entry and lazy chunks.
|
|
52
|
+
|
|
53
|
+
## Migrate deliberately
|
|
54
|
+
|
|
55
|
+
Move one surface at a time. Do not reuse custom-property names, styling
|
|
56
|
+
selectors or internal DOM structure from another component system. Where APIs
|
|
57
|
+
differ, adapt at the application boundary and remove the adapter once the
|
|
58
|
+
surface is fully on Zenith.
|
|
59
|
+
|
|
60
|
+
## Which version you get
|
|
61
|
+
|
|
62
|
+
`npm install @epilot/zenith-react` resolves the `latest` dist-tag, which only
|
|
63
|
+
ever points at a deliberately promoted version. Until a first promotion happens,
|
|
64
|
+
`latest` does not exist.
|
|
65
|
+
|
|
66
|
+
Unproven builds go to `next` with a prerelease version:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm install @epilot/zenith-react@next # e.g. 0.1.0-next.0
|
|
20
70
|
```
|
|
21
71
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
React-package token and delivery subpaths remain compatibility aliases for the
|
|
25
|
-
`0.1` line. Do not write generated namespace hashes or install a second copy of
|
|
26
|
-
the core sheet by hand.
|
|
72
|
+
These are opt-in twice over — you name the tag, and a range like `^0.1.0` never
|
|
73
|
+
resolves a prerelease. Pin an exact version if you adopt one.
|
|
27
74
|
|
|
28
|
-
|
|
29
|
-
versions of `@epilot/zenith-runtime` and `@epilot/zenith-react/tokens`; React and
|
|
30
|
-
`csstype` are the only external declaration dependencies. The optional Jest
|
|
31
|
-
helper is exported from
|
|
32
|
-
`@epilot/zenith-react/testing/jest-preset.cjs`.
|
|
75
|
+
## Reference
|
|
33
76
|
|
|
34
|
-
|
|
35
|
-
|
|
77
|
+
The package is ESM-only and tree-shakeable. Resolved literal token values are in
|
|
78
|
+
`@epilot/zenith-react/tokens.json`, and an optional Jest helper in
|
|
79
|
+
`@epilot/zenith-react/testing/jest-preset.cjs`. Development rules are in
|
|
80
|
+
`AGENTS.md`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appearance-boundary.js","sources":["../../../src/components/appearance-boundary/appearance-boundary.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { ComposeAsChild } from \"../slot/compose-as-child\"\n\n/**\n * A region that carries its own appearance — `packages/tokens/SPEC.md` §2 rule 3's document\n * boundary, as a component instead of two hand-written DOM attributes.\n *\n * **What it is for.** Mode is the page's: the shell stamps `data-theme` on `<html>` and every token\n * resolves from there through ordinary CSS inheritance. The one exception is a region that renders\n * content the page does not own — a variable, email or journey preview, a code editor — which brings\n * its own theme regardless of the shell's. The generated sheet already supports that: it emits every\n * treatment's light values under `.light[data-surface=\"<t>\"], [data-theme=\"light\"][data-surface=\"<t>\"]`\n * after the dark blocks, and the dark compounds `[data-theme=\"dark\"][data-surface=\"<t>\"]` alongside\n * them, so an element carrying BOTH attributes wins over an ancestor's mode on specificity and\n * source order. This component is the supported way to stamp that pair.\n *\n * **Why both props are required.** The two attributes are one boundary, not two independent\n * switches. The role tokens (`surface.*`, `border.*`, `shadow.*`, `blur.*`) resolve through the\n * compound `[data-theme=…][data-surface=…]` selector; stamping only `data-theme` would reset the\n * mode while leaving the treatment to be inherited from whatever ancestor happens to declare one —\n * so a boundary would silently render the page's treatment under the region's mode, which is a\n * combination nobody designed. Requiring `surface` makes the caller say which treatment the region\n * is, rather than having this component fabricate a plausible one.\n *\n * **Without a boundary nothing changes.** No component reads `document.documentElement`, and none\n * of them consults this context for anything except re-stamping portalled content (below). A tree\n * with no `AppearanceBoundary` behaves exactly as it does today: live shell attributes stay\n * authoritative, including when the shell flips them after mount.\n *\n * **Density is a separate axis** and stays that way. `DensityProvider` is independent, its context\n * is a different context, and this component neither reads nor writes `data-density`. A region can\n * be inside both, in either nesting order.\n *\n * **Scope limit, stated plainly.** The React context below is per bundled copy of this package. Two\n * independently bundled micro-frontends do not share it, so a boundary in one does not reach\n * portalled content rendered by the other. The DOM attributes it stamps *are* shared — they are\n * ordinary CSS — so the non-portal case works across copies; it is only the portal re-stamp that is\n * copy-local. Each MFE wraps its own root.\n */\n\nexport type AppearanceMode = \"light\" | \"dark\"\n\nexport type AppearanceSurface = \"plain\" | \"bordered\" | \"glass\" | \"tint\" | \"card\"\n\nexport type Appearance = {\n mode: AppearanceMode\n surface: AppearanceSurface\n}\n\nconst CANONICAL_MODES: readonly AppearanceMode[] = [\"light\", \"dark\"]\nconst CANONICAL_SURFACES: readonly AppearanceSurface[] = [\n \"plain\",\n \"bordered\",\n \"glass\",\n \"tint\",\n \"card\",\n]\n\n/**\n * Per-axis normalization of invalid runtime input, mirroring `canonicalDensity`. A typed caller\n * cannot reach this; a plain-JavaScript one can, and a bad string would otherwise be stamped\n * verbatim into `data-theme`/`data-surface`, where no generated selector matches it — leaving the\n * region with the shell's appearance while `useAppearance()` reported the boundary's.\n *\n * Per axis, not all-or-nothing: a valid `mode` with a garbage `surface` keeps the mode. Collapsing\n * both to the default because one was wrong would throw away information the caller did supply.\n */\nexport const canonicalAppearance = (appearance: Appearance): Appearance => ({\n mode: CANONICAL_MODES.includes(appearance.mode) ? appearance.mode : \"light\",\n surface: CANONICAL_SURFACES.includes(appearance.surface)\n ? appearance.surface\n : \"plain\",\n})\n\n/**\n * Unexported, same as `DensityContext` — read only through `useAppearance()`. Default `undefined`:\n * a component with no `AppearanceBoundary` ancestor gets `undefined`, never a fabricated\n * `{light, plain}`, which would be this package inventing a reading of the live shell attributes it\n * deliberately does not read.\n */\nconst AppearanceContext = React.createContext<Appearance | undefined>(undefined)\n\ntype AppearanceBoundaryBaseProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\"\n> & {\n /** The mode this region renders in, regardless of the page's. No default. */\n mode: AppearanceMode\n /** The treatment this region restates. Required — see the note on both props above. */\n surface: AppearanceSurface\n}\n\nexport type AppearanceBoundaryProps =\n | (AppearanceBoundaryBaseProps & {\n asChild?: false\n children?: React.ReactNode\n })\n | (AppearanceBoundaryBaseProps & {\n asChild: true\n children: React.ReactElement\n })\n\n/**\n * The default is one ordinary HTML div. `asChild` stamps the same authoritative pair on one actual\n * child without a wrapper, while keeping the context provider around it so portal descendants keep\n * their nearest explicit appearance. Child markers remain the child's identity.\n */\nexport const AppearanceBoundary = React.forwardRef<\n HTMLDivElement,\n AppearanceBoundaryProps\n>(function AppearanceBoundary(\n { mode, surface, asChild = false, className, children, ...props },\n ref\n) {\n const value = React.useMemo(\n () => canonicalAppearance({ mode, surface }),\n [mode, surface]\n )\n\n const content = asChild ? (\n <ComposeAsChild\n {...props}\n ref={ref}\n className={className}\n forceProps={{ \"data-theme\": value.mode, \"data-surface\": value.surface }}\n // Authoritative, spread LAST: required normalized props win over conflicting child attrs.\n data-theme={value.mode}\n data-surface={value.surface}\n >\n {children as React.ReactElement}\n </ComposeAsChild>\n ) : (\n <div\n ref={ref}\n data-slot=\"appearance-boundary\"\n {...{ [SLOT_ATTR]: \"appearance-boundary\" }}\n className={className}\n {...props}\n // Authoritative, spread LAST — the same ordering rule `DensityProvider` applies to\n // `data-density`. `AppearanceBoundaryProps` extends every native div prop, so a caller can\n // pass a raw conflicting `data-theme`/`data-surface`; the normalized required props win, and\n // the DOM attributes then always agree with the context value below.\n data-theme={value.mode}\n data-surface={value.surface}\n >\n {children}\n </div>\n )\n\n return (\n <AppearanceContext.Provider value={value}>\n {content}\n </AppearanceContext.Provider>\n )\n})\n\n/**\n * The nearest explicit boundary, or `undefined` when there is none. Package-internal — NOT exported\n * from `src/index.ts`; `AppearanceBoundary` is the whole public surface. Never reads\n * `getComputedStyle` or `documentElement`: `undefined` means \"no explicit boundary in the React\n * tree\", not \"the ambient appearance is unknown\".\n */\nexport const useAppearance = (): Appearance | undefined =>\n React.useContext(AppearanceContext)\n\n/**\n * The attributes a portal-content element re-stamps, or nothing at all.\n *\n * Portalled content is a React-tree descendant but a DOM sibling, so a boundary's DOM attributes do\n * not reach it while its context does — exactly the asymmetry `DensityProvider` was built around\n * (DENSITY-SPEC.md §4.4). One helper rather than the same ternary pair at nine call sites, and one\n * place where \"no explicit boundary ⇒ stamp NEITHER attribute\" is decided: stamping a fabricated\n * `light`/`plain` would mask the live shell inheritance that already reaches the portal correctly,\n * and stamping only one of the pair would produce the mode-without-treatment combination the\n * required props exist to prevent.\n *\n * Package-internal, and deliberately a hook returning a spreadable object rather than a public\n * `useAppearance()` + a public attribute builder — there is one consumer shape and it is inside\n * this package.\n */\nexport const useAppearanceAttributes = (): {\n \"data-theme\"?: AppearanceMode\n \"data-surface\"?: AppearanceSurface\n} => {\n const appearance = useAppearance()\n return appearance === undefined\n ? {}\n : { \"data-theme\": appearance.mode, \"data-surface\": appearance.surface }\n}\n"],"names":["CANONICAL_MODES","CANONICAL_SURFACES","canonicalAppearance","appearance","AppearanceContext","React","AppearanceBoundary","mode","surface","asChild","className","children","props","ref","value","content","jsx","ComposeAsChild","SLOT_ATTR","useAppearance","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D,CAAiB,GAiBvBgB,IAA0B,MAGlC;AACH,QAAMjB,IAAagB,EAAA;AACnB,SAAOhB,MAAe,SAClB,CAAA,IACA,EAAE,cAAcA,EAAW,MAAM,gBAAgBA,EAAW,QAAA;AAClE;"}
|
|
1
|
+
{"version":3,"file":"appearance-boundary.js","sources":["../../../src/components/appearance-boundary/appearance-boundary.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { ComposeAsChild } from \"../slot/compose-as-child\"\n\n/**\n * A region that carries its own appearance — `packages/tokens/SPEC.md` §2 rule 3's document\n * boundary, as a component instead of two hand-written DOM attributes.\n */\n\nexport type AppearanceMode = \"light\" | \"dark\"\n\nexport type AppearanceSurface = \"plain\" | \"bordered\" | \"glass\" | \"tint\" | \"card\"\n\nexport type Appearance = {\n mode: AppearanceMode\n surface: AppearanceSurface\n}\n\nconst CANONICAL_MODES: readonly AppearanceMode[] = [\"light\", \"dark\"]\nconst CANONICAL_SURFACES: readonly AppearanceSurface[] = [\n \"plain\",\n \"bordered\",\n \"glass\",\n \"tint\",\n \"card\",\n]\n\n/** Per-axis normalization of invalid runtime input, mirroring `canonicalDensity`. */\nexport const canonicalAppearance = (appearance: Appearance): Appearance => ({\n mode: CANONICAL_MODES.includes(appearance.mode) ? appearance.mode : \"light\",\n surface: CANONICAL_SURFACES.includes(appearance.surface)\n ? appearance.surface\n : \"plain\",\n})\n\n/**\n * Unexported, same as `DensityContext` — read only through `useAppearance()`. Default `undefined`:\n * a component with no `AppearanceBoundary` ancestor gets `undefined`, never a fabricated\n * `{light, plain}`, which would be this package inventing a reading of the live shell attributes it\n * deliberately does not read.\n */\nconst AppearanceContext = React.createContext<Appearance | undefined>(undefined)\n\ntype AppearanceBoundaryBaseProps = Omit<\n React.ComponentProps<\"div\">,\n \"children\"\n> & {\n /** The mode this region renders in, regardless of the page's. No default. */\n mode: AppearanceMode\n /** The treatment this region restates. Required — see the note on both props above. */\n surface: AppearanceSurface\n}\n\nexport type AppearanceBoundaryProps =\n | (AppearanceBoundaryBaseProps & {\n asChild?: false\n children?: React.ReactNode\n })\n | (AppearanceBoundaryBaseProps & {\n asChild: true\n children: React.ReactElement\n })\n\n/**\n * The default is one ordinary HTML div. `asChild` stamps the same authoritative pair on one actual\n * child without a wrapper, while keeping the context provider around it so portal descendants keep\n * their nearest explicit appearance. Child markers remain the child's identity.\n */\nexport const AppearanceBoundary = React.forwardRef<\n HTMLDivElement,\n AppearanceBoundaryProps\n>(function AppearanceBoundary(\n { mode, surface, asChild = false, className, children, ...props },\n ref\n) {\n const value = React.useMemo(\n () => canonicalAppearance({ mode, surface }),\n [mode, surface]\n )\n\n const content = asChild ? (\n <ComposeAsChild\n {...props}\n ref={ref}\n className={className}\n forceProps={{ \"data-theme\": value.mode, \"data-surface\": value.surface }}\n // Authoritative, spread LAST: required normalized props win over conflicting child attrs.\n data-theme={value.mode}\n data-surface={value.surface}\n >\n {children as React.ReactElement}\n </ComposeAsChild>\n ) : (\n <div\n ref={ref}\n data-slot=\"appearance-boundary\"\n {...{ [SLOT_ATTR]: \"appearance-boundary\" }}\n className={className}\n {...props}\n // Authoritative, spread LAST — the same ordering rule `DensityProvider` applies to\n // `data-density`. `AppearanceBoundaryProps` extends every native div prop, so a caller can\n // pass a raw conflicting `data-theme`/`data-surface`; the normalized required props win, and\n // the DOM attributes then always agree with the context value below.\n data-theme={value.mode}\n data-surface={value.surface}\n >\n {children}\n </div>\n )\n\n return (\n <AppearanceContext.Provider value={value}>\n {content}\n </AppearanceContext.Provider>\n )\n})\n\n/**\n * The nearest explicit boundary, or `undefined` when there is none. Package-internal — NOT exported\n * from `src/index.ts`; `AppearanceBoundary` is the whole public surface. Never reads\n * `getComputedStyle` or `documentElement`: `undefined` means \"no explicit boundary in the React\n * tree\", not \"the ambient appearance is unknown\".\n */\nexport const useAppearance = (): Appearance | undefined =>\n React.useContext(AppearanceContext)\n\n/**\n * The attributes a portal-content element re-stamps, or nothing at all. Portalled content is a\n * React-tree descendant but a DOM sibling, so a boundary's DOM attributes do not reach it while\n * its context does — exactly the asymmetry `DensityProvider` was built around (DENSITY-SPEC.md\n * §4.4).\n */\nexport const useAppearanceAttributes = (): {\n \"data-theme\"?: AppearanceMode\n \"data-surface\"?: AppearanceSurface\n} => {\n const appearance = useAppearance()\n return appearance === undefined\n ? {}\n : { \"data-theme\": appearance.mode, \"data-surface\": appearance.surface }\n}\n"],"names":["CANONICAL_MODES","CANONICAL_SURFACES","canonicalAppearance","appearance","AppearanceContext","React","AppearanceBoundary","mode","surface","asChild","className","children","props","ref","value","content","jsx","ComposeAsChild","SLOT_ATTR","useAppearance","useAppearanceAttributes"],"mappings":";;;;AAmBA,MAAMA,IAA6C,CAAC,SAAS,MAAM,GAC7DC,IAAmD;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAAsB,CAACC,OAAwC;AAAA,EAC1E,MAAMH,EAAgB,SAASG,EAAW,IAAI,IAAIA,EAAW,OAAO;AAAA,EACpE,SAASF,EAAmB,SAASE,EAAW,OAAO,IACnDA,EAAW,UACX;AACN,IAQMC,IAAoBC,EAAM,cAAsC,MAAS,GA2BlEC,IAAqBD,EAAM,WAGtC,SACA,EAAE,MAAAE,GAAM,SAAAC,GAAS,SAAAC,IAAU,IAAO,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAC1DC,GACA;AACA,QAAMC,IAAQT,EAAM;AAAA,IAClB,MAAMH,EAAoB,EAAE,MAAAK,GAAM,SAAAC,GAAS;AAAA,IAC3C,CAACD,GAAMC,CAAO;AAAA,EAAA,GAGVO,IAAUN,IACd,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGL;AAAA,MACJ,KAAAC;AAAA,MACA,WAAAH;AAAA,MACA,YAAY,EAAE,cAAcI,EAAM,MAAM,gBAAgBA,EAAM,QAAA;AAAA,MAE9D,cAAYA,EAAM;AAAA,MAClB,gBAAcA,EAAM;AAAA,MAEnB,UAAAH;AAAA,IAAA;AAAA,EAAA,IAGH,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAH;AAAA,MACA,aAAU;AAAA,MACJ,CAACK,CAAS,GAAG;AAAA,MACnB,WAAAR;AAAA,MACC,GAAGE;AAAA,MAKJ,cAAYE,EAAM;AAAA,MAClB,gBAAcA,EAAM;AAAA,MAEnB,UAAAH;AAAA,IAAA;AAAA,EAAA;AAIL,SACE,gBAAAK,EAACZ,EAAkB,UAAlB,EAA2B,OAAAU,GACzB,UAAAC,GACH;AAEJ,CAAC,GAQYI,IAAgB,MAC3Bd,EAAM,WAAWD,CAAiB,GAQvBgB,IAA0B,MAGlC;AACH,QAAMjB,IAAagB,EAAA;AACnB,SAAOhB,MAAe,SAClB,CAAA,IACA,EAAE,cAAcA,EAAW,MAAM,gBAAgBA,EAAW,QAAA;AAClE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sources":["../../../src/components/badge/badge.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 { NS, PALETTE_NS } from \"../../tokens\"\nimport { isCoreFamily } from \"../../tokens/install\"\nimport { useZenithPaletteTokensFor } from \"../../tokens/use-palette-tokens\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * REFERENCE COMPONENT — the colour-matrix collapse. Read this before writing another component\n * that takes a `color` prop.\n *\n * v1 enumerates 20 colours x 3 styles as 60 `compoundVariants`, each a distinct class string like\n * `volt-bg-mint-soft`. Because those names are built by interpolation, Tailwind's scanner cannot\n * see them, which is what `safelist.css` exists to force — 9 lines that emit ~945 rules, 65.6 KB\n * and 59% of v1's entire rule count. The Griffel PoC carried the same shape forward as 60 static\n * style objects.\n *\n * Here the colour is a VALUE, not part of a class name. Three atoms read three custom properties;\n * the component sets those properties inline from the `color` prop. Total rules: one small set per\n * style variant, regardless of how many colours exist. Adding a 22nd palette family costs zero\n * rules.\n *\n * Two consequences worth knowing:\n * - `color` may legitimately arrive from a runtime expression (`getColorForEntityLabel(label)` and\n * `WCAG_BADGE_MAP[level].color` both exist in consumer code today), which no build step can\n * resolve. That is exactly why the palette sheet cannot be statically shaken, and why this\n * component calls `ensurePaletteTokens()`.\n * - Selectors key on SLOT_ATTR, never on `data-slot`. `data-slot` values are shared with v1, so a\n * rule keyed on one also matches v1-rendered DOM — the StyleX track had a v1 icon compute to\n * 0x0 through a green gate this way. `data-slot` is still emitted, purely as a diagnostic.\n */\n\nconst COLORS = [\n \"accent\",\n \"neutral\",\n \"gray\",\n \"success\",\n \"warning\",\n \"error\",\n \"info\",\n \"blue\",\n \"sky\",\n \"mint\",\n \"lime\",\n \"green\",\n \"teal\",\n \"cyan\",\n \"indigo\",\n \"purple\",\n \"pink\",\n \"red\",\n \"orange\",\n \"yellow\",\n \"bronze\",\n] as const\n\nexport type BadgeColor = (typeof COLORS)[number]\nexport type BadgeVariant = \"soft\" | \"solid\" | \"surface\"\nexport type BadgeSize = \"sm\" | \"base\" | \"lg\"\n\n/** The three slots a variant can paint. Set inline; read by the atoms below. */\nconst BG = \"--zenith-badge-bg\"\nconst FG = \"--zenith-badge-fg\"\nconst BD = \"--zenith-badge-bd\"\n\nconst resolveColor = (color: BadgeColor): string =>\n color === \"neutral\" ? \"gray\" : color\n\n/**\n * The namespace fix. `resolveColor` runs FIRST so `neutral` is classified as `gray` (core) rather\n * than as the literal string \"neutral\" (which is in neither sheet's family list) — same order\n * `semantic`/`primitive` already apply it in. This does not touch `useZenithPaletteTokensFor(color)`\n * above, which still receives the raw, unresolved `color` prop and therefore still installs the\n * palette sheet for `color=\"neutral\"` even though the resolved family needs none of it — a\n * separate, pre-existing inefficiency this fix does not optimize.\n */\nconst namespaceFor = (family: string): string =>\n isCoreFamily(family) ? NS : PALETTE_NS\n\nconst semantic = (color: BadgeColor, slot: string): string => {\n const family = resolveColor(color)\n return `var(--zenith-${namespaceFor(family)}-sem-${family}-${slot})`\n}\nconst primitive = (color: BadgeColor, step: string): string => {\n const family = resolveColor(color)\n return `var(--zenith-${namespaceFor(family)}-${family}-${step})`\n}\n\n/**\n * Which token each variant pulls into each slot. This replaces the 60-entry compound matrix: it is\n * data about three variants, not about 60 combinations.\n */\nconst VARIANT_SLOTS: Record<\n BadgeVariant,\n (color: BadgeColor) => Record<string, string>\n> = {\n soft: (c) => ({\n [BG]: semantic(c, \"soft\"),\n [FG]: semantic(c, \"default\"),\n [BD]: \"transparent\",\n }),\n solid: (c) => ({\n [BG]: semantic(c, \"solid\"),\n [FG]: semantic(c, \"contrast\"),\n [BD]: \"transparent\",\n }),\n surface: (c) => ({\n [BG]: semantic(c, \"surface\"),\n [FG]: semantic(c, \"default\"),\n [BD]: primitive(c, \"a6\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"fit-content\",\n whiteSpace: \"nowrap\",\n flexShrink: 0,\n overflow: \"hidden\",\n fontWeight: tokens.fontWeightNormal,\n // NEVER write a CSS shorthand in a Griffel style object. Atoms are one declaration each, so a\n // shorthand cannot be resolved against a longhand — `border` and a later `borderColor` would\n // both survive with the winner decided by insertion order. Griffel warns at runtime, which\n // means the mistake ships silently in production where nobody reads the console.\n // `shorthands.*` expands to the individual longhands.\n ...shorthands.border(\"1px\", \"solid\", `var(${BD})`),\n // The whole point: one rule each, colour supplied per instance.\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n transitionProperty: \"color, box-shadow\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.accentA8,\n },\n // v1 `aria-invalid:outline-error-a8`. Declared after the focus ring so an invalid focused\n // badge paints the error ring, matching v1's variant ordering.\n \"&[aria-invalid]\": {\n outlineColor: tokens.errorA8,\n },\n \"& > svg\": { pointerEvents: \"none\" },\n },\n sm: {\n fontSize: tokens.textXs,\n lineHeight: \"1rem\",\n letterSpacing: \"0.04px\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement1,\n minWidth: \"1rem\",\n borderRadius: \"3px\",\n \"& > svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n base: {\n fontSize: tokens.textSm,\n lineHeight: \"1.25rem\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement2,\n minWidth: \"1.25rem\",\n borderRadius: tokens.radiusSm,\n \"& > svg\": { width: \"1rem\", height: \"1rem\" },\n },\n lg: {\n fontSize: tokens.textBase,\n lineHeight: \"1.5rem\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement3,\n minWidth: \"1.5rem\",\n borderRadius: tokens.radiusMd,\n \"& > svg\": { width: \"1rem\", height: \"1rem\" },\n },\n})\n\nexport type BadgeProps = Omit<React.ComponentProps<\"span\">, \"color\"> & {\n color?: BadgeColor\n /**\n * Named `variant`, not `style`. v1 called this `style`, which shadows the HTML `style` attribute\n * and made a badge unable to take both a visual treatment and an inline style. Retrocompat is\n * not a requirement here, so the collision is fixed rather than inherited.\n */\n variant?: BadgeVariant\n size?: BadgeSize\n}\n\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n function Badge(\n {\n className,\n color = \"accent\",\n variant = \"soft\",\n size = \"base\",\n style,\n ...props\n },\n ref\n ) {\n // A decorative family can still arrive from an expression the build cannot see, so this has to\n // be re-evaluated every commit (WP2B2 — the hook closes over this render's resolved value) —\n // but it is the resolved family that decides, and a core one needs no palette sheet.\n useZenithPaletteTokensFor(color)\n\n const styles = useStyles()\n\n return (\n <span\n ref={ref}\n data-slot=\"badge\"\n {...{ [SLOT_ATTR]: \"badge\" }}\n className={mergeClasses(styles.root, styles[size], className)}\n style={\n { ...VARIANT_SLOTS[variant](color), ...style } as React.CSSProperties\n }\n {...props}\n />\n )\n }\n)\n\nexport { COLORS as BADGE_COLORS }\n"],"names":["COLORS","BG","FG","BD","resolveColor","color","namespaceFor","family","isCoreFamily","NS","PALETTE_NS","semantic","slot","primitive","step","VARIANT_SLOTS","c","useStyles","makeZenithStyles","tokens.fontWeightNormal","shorthands","tokens.accentA8","tokens.errorA8","tokens.textXs","tokens.spacingElement1","tokens.textSm","tokens.spacingElement2","tokens.radiusSm","tokens.textBase","tokens.spacingElement3","tokens.radiusMd","Badge","React","className","variant","size","style","props","ref","useZenithPaletteTokensFor","styles","jsx","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;;;AAoCA,MAAMA,IAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOMC,IAAK,qBACLC,IAAK,qBACLC,IAAK,qBAELC,IAAe,CAACC,MACpBA,MAAU,YAAY,SAASA,GAU3BC,IAAe,CAACC,MACpBC,EAAaD,CAAM,IAAIE,IAAKC,GAExBC,IAAW,CAACN,GAAmBO,MAAyB;AAC5D,QAAML,IAASH,EAAaC,CAAK;AACjC,SAAO,gBAAgBC,EAAaC,CAAM,CAAC,QAAQA,CAAM,IAAIK,CAAI;AACnE,GACMC,IAAY,CAACR,GAAmBS,MAAyB;AAC7D,QAAMP,IAASH,EAAaC,CAAK;AACjC,SAAO,gBAAgBC,EAAaC,CAAM,CAAC,IAAIA,CAAM,IAAIO,CAAI;AAC/D,GAMMC,IAGF;AAAA,EACF,MAAM,CAACC,OAAO;AAAA,IACZ,CAACf,CAAE,GAAGU,EAASK,GAAG,MAAM;AAAA,IACxB,CAACd,CAAE,GAAGS,EAASK,GAAG,SAAS;AAAA,IAC3B,CAACb,CAAE,GAAG;AAAA,EAAA;AAAA,EAER,OAAO,C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AAAA,IACL,eAAeE;AAAAA,IACf,UAAU;AAAA,IACV,cAAcC;AAAAA,IACd,WAAW,EAAE,OAAO,QAAQ,QAAQ,OAAA;AAAA,EAAO;AAAA,EAE7C,IAAI;AAAA,IACF,UAAUC;AAAAA,IACV,YAAY;AAAA,IACZ,KAAKJ;AAAAA,IACL,eAAeK;AAAAA,IACf,UAAU;AAAA,IACV,cAAcC;AAAAA,IACd,WAAW,EAAE,OAAO,QAAQ,QAAQ,OAAA;AAAA,EAAO;AAE/C,CAAC,GAaYC,IAAQC,EAAM;AAAA,EACzB,SACE;AAAA,IACE,WAAAC;AAAA,IACA,OAAA5B,IAAQ;AAAA,IACR,SAAA6B,IAAU;AAAA,IACV,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,GACA;AAIA,IAAAC,EAA0BlC,CAAK;AAE/B,UAAMmC,IAASvB,EAAA;AAEf,WACE,gBAAAwB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAH;AAAA,QACA,aAAU;AAAA,QACJ,CAACI,CAAS,GAAG;AAAA,QACnB,WAAWC,EAAaH,EAAO,MAAMA,EAAOL,CAAI,GAAGF,CAAS;AAAA,QAC5D,OACE,EAAE,GAAGlB,EAAcmB,CAAO,EAAE7B,CAAK,GAAG,GAAG+B,EAAA;AAAA,QAExC,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
1
|
+
{"version":3,"file":"badge.js","sources":["../../../src/components/badge/badge.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 { NS, PALETTE_NS } from \"../../tokens\"\nimport { isCoreFamily } from \"../../tokens/install\"\nimport { useZenithPaletteTokensFor } from \"../../tokens/use-palette-tokens\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * REFERENCE COMPONENT — the colour-matrix collapse. Read this before writing another component\n * that takes a `color` prop.\n */\n\nconst COLORS = [\n \"accent\",\n \"neutral\",\n \"gray\",\n \"success\",\n \"warning\",\n \"error\",\n \"info\",\n \"blue\",\n \"sky\",\n \"mint\",\n \"lime\",\n \"green\",\n \"teal\",\n \"cyan\",\n \"indigo\",\n \"purple\",\n \"pink\",\n \"red\",\n \"orange\",\n \"yellow\",\n \"bronze\",\n] as const\n\nexport type BadgeColor = (typeof COLORS)[number]\nexport type BadgeVariant = \"soft\" | \"solid\" | \"surface\"\nexport type BadgeSize = \"sm\" | \"base\" | \"lg\"\n\n/** The three slots a variant can paint. Set inline; read by the atoms below. */\nconst BG = \"--zenith-badge-bg\"\nconst FG = \"--zenith-badge-fg\"\nconst BD = \"--zenith-badge-bd\"\n\nconst resolveColor = (color: BadgeColor): string =>\n color === \"neutral\" ? \"gray\" : color\n\n/**\n * The namespace fix. `resolveColor` runs FIRST so `neutral` is classified as `gray` (core) rather\n * than as the literal string \"neutral\" (which is in neither sheet's family list) — same order\n * `semantic`/`primitive` already apply it in.\n */\nconst namespaceFor = (family: string): string =>\n isCoreFamily(family) ? NS : PALETTE_NS\n\nconst semantic = (color: BadgeColor, slot: string): string => {\n const family = resolveColor(color)\n return `var(--zenith-${namespaceFor(family)}-sem-${family}-${slot})`\n}\nconst primitive = (color: BadgeColor, step: string): string => {\n const family = resolveColor(color)\n return `var(--zenith-${namespaceFor(family)}-${family}-${step})`\n}\n\n/**\n * Which token each variant pulls into each slot. This replaces the 60-entry compound matrix: it is\n * data about three variants, not about 60 combinations.\n */\nconst VARIANT_SLOTS: Record<\n BadgeVariant,\n (color: BadgeColor) => Record<string, string>\n> = {\n soft: (c) => ({\n [BG]: semantic(c, \"soft\"),\n [FG]: semantic(c, \"default\"),\n [BD]: \"transparent\",\n }),\n solid: (c) => ({\n [BG]: semantic(c, \"solid\"),\n [FG]: semantic(c, \"contrast\"),\n [BD]: \"transparent\",\n }),\n surface: (c) => ({\n [BG]: semantic(c, \"surface\"),\n [FG]: semantic(c, \"default\"),\n [BD]: primitive(c, \"a6\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"fit-content\",\n whiteSpace: \"nowrap\",\n flexShrink: 0,\n overflow: \"hidden\",\n fontWeight: tokens.fontWeightNormal,\n // NEVER write a CSS shorthand in a Griffel style object. Atoms are one declaration each, so a\n // shorthand cannot be resolved against a longhand — `border` and a later `borderColor` would\n // both survive with the winner decided by insertion order. Griffel warns at runtime, which\n // means the mistake ships silently in production where nobody reads the console.\n // `shorthands.*` expands to the individual longhands.\n ...shorthands.border(\"1px\", \"solid\", `var(${BD})`),\n // The whole point: one rule each, colour supplied per instance.\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n transitionProperty: \"color, box-shadow\",\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.accentA8,\n },\n // v1 `aria-invalid:outline-error-a8`. Declared after the focus ring so an invalid focused\n // badge paints the error ring, matching v1's variant ordering.\n \"&[aria-invalid]\": {\n outlineColor: tokens.errorA8,\n },\n \"& > svg\": { pointerEvents: \"none\" },\n },\n sm: {\n fontSize: tokens.textXs,\n lineHeight: \"1rem\",\n letterSpacing: \"0.04px\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement1,\n minWidth: \"1rem\",\n borderRadius: \"3px\",\n \"& > svg\": { width: \"0.75rem\", height: \"0.75rem\" },\n },\n base: {\n fontSize: tokens.textSm,\n lineHeight: \"1.25rem\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement2,\n minWidth: \"1.25rem\",\n borderRadius: tokens.radiusSm,\n \"& > svg\": { width: \"1rem\", height: \"1rem\" },\n },\n lg: {\n fontSize: tokens.textBase,\n lineHeight: \"1.5rem\",\n gap: tokens.spacingElement1,\n paddingInline: tokens.spacingElement3,\n minWidth: \"1.5rem\",\n borderRadius: tokens.radiusMd,\n \"& > svg\": { width: \"1rem\", height: \"1rem\" },\n },\n})\n\nexport type BadgeProps = Omit<React.ComponentProps<\"span\">, \"color\"> & {\n color?: BadgeColor\n /**\n * Named `variant`, not `style`. v1 called this `style`, which shadows the HTML `style` attribute\n * and made a badge unable to take both a visual treatment and an inline style. Retrocompat is\n * not a requirement here, so the collision is fixed rather than inherited.\n */\n variant?: BadgeVariant\n size?: BadgeSize\n}\n\nexport const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(\n function Badge(\n {\n className,\n color = \"accent\",\n variant = \"soft\",\n size = \"base\",\n style,\n ...props\n },\n ref\n ) {\n // A decorative family can still arrive from an expression the build cannot see, so this has to\n // be re-evaluated every commit (WP2B2 — the hook closes over this render's resolved value) —\n // but it is the resolved family that decides, and a core one needs no palette sheet.\n useZenithPaletteTokensFor(color)\n\n const styles = useStyles()\n\n return (\n <span\n ref={ref}\n data-slot=\"badge\"\n {...{ [SLOT_ATTR]: \"badge\" }}\n className={mergeClasses(styles.root, styles[size], className)}\n style={\n { ...VARIANT_SLOTS[variant](color), ...style } as React.CSSProperties\n }\n {...props}\n />\n )\n }\n)\n\nexport { COLORS as BADGE_COLORS }\n"],"names":["COLORS","BG","FG","BD","resolveColor","color","namespaceFor","family","isCoreFamily","NS","PALETTE_NS","semantic","slot","primitive","step","VARIANT_SLOTS","c","useStyles","makeZenithStyles","tokens.fontWeightNormal","shorthands","tokens.accentA8","tokens.errorA8","tokens.textXs","tokens.spacingElement1","tokens.textSm","tokens.spacingElement2","tokens.radiusSm","tokens.textBase","tokens.spacingElement3","tokens.radiusMd","Badge","React","className","variant","size","style","props","ref","useZenithPaletteTokensFor","styles","jsx","SLOT_ATTR","mergeClasses"],"mappings":";;;;;;;;;AAgBA,MAAMA,IAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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,IACA,GAAGC;AAAA,EAAA,GAELC,GACA;AAIA,IAAAC,EAA0BlC,CAAK;AAE/B,UAAMmC,IAASvB,EAAA;AAEf,WACE,gBAAAwB;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAH;AAAA,QACA,aAAU;AAAA,QACJ,CAACI,CAAS,GAAG;AAAA,QACnB,WAAWC,EAAaH,EAAO,MAAMA,EAAOL,CAAI,GAAGF,CAAS;AAAA,QAC5D,OACE,EAAE,GAAGlB,EAAcmB,CAAO,EAAE7B,CAAK,GAAG,GAAG+B,EAAA;AAAA,QAExC,GAAGC;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","sources":["../../../src/components/breadcrumb/breadcrumb.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 { Slot } from \"@radix-ui/react-slot\"\n\n
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","sources":["../../../src/components/breadcrumb/breadcrumb.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 { Slot } from \"@radix-ui/react-slot\"\n\n/** Breadcrumb — Card's compound pattern applied to the nav / ol / li structure. */\n\nexport type BreadcrumbProps = React.ComponentProps<\"nav\"> & {\n separator?: React.ReactNode\n}\n\nconst useStyles = makeZenithStyles({\n list: {\n display: \"flex\",\n alignItems: \"center\",\n // gap-2\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n },\n separator: {\n color: tokens.semGrayLight,\n },\n item: {\n display: \"inline-flex\",\n alignItems: \"center\",\n // gap-1\n ...shorthands.gap(tokens.spacingElement1),\n },\n link: {\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.semGrayLight,\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 cursor: \"pointer\",\n \":hover\": {\n color: tokens.semGrayDefault,\n textDecorationLine: \"underline\",\n },\n \":focus-visible\": {\n outlineWidth: \"2px\",\n outlineStyle: \"solid\",\n outlineOffset: \"2px\",\n outlineColor: tokens.accentA8,\n },\n },\n page: {\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.semGrayDefault,\n },\n})\n\nexport const Breadcrumb = React.forwardRef<HTMLElement, BreadcrumbProps>(\n function Breadcrumb({ separator = \"/\", className, children, ...props }, ref) {\n const styles = useStyles()\n const items = React.Children.toArray(children).filter(React.isValidElement)\n\n return (\n <nav\n ref={ref}\n data-slot=\"breadcrumb\"\n {...{ [SLOT_ATTR]: \"breadcrumb\" }}\n aria-label=\"Breadcrumb\"\n className={className}\n {...props}\n >\n <ol className={styles.list}>\n {items.map((child, index) => (\n <React.Fragment key={index}>\n {index > 0 && (\n <li\n role=\"presentation\"\n aria-hidden=\"true\"\n className={styles.separator}\n >\n {separator}\n </li>\n )}\n {child}\n </React.Fragment>\n ))}\n </ol>\n </nav>\n )\n }\n)\n\nexport type BreadcrumbItemProps = Omit<React.ComponentProps<\"a\">, \"href\"> & {\n href?: string\n isCurrent?: boolean\n /**\n * Render the child instead of the built-in `a`, keeping the link styling and slot markers. This\n * is how a consumer supplies a router link. v1 supports it; it was dropped here while the package\n * was on Base UI and restored once it moved back to Radix.\n */\n asChild?: boolean\n}\n\nexport const BreadcrumbItem = React.forwardRef<\n HTMLLIElement,\n BreadcrumbItemProps\n>(function BreadcrumbItem(\n { href, isCurrent = false, className, children, asChild = false, ...props },\n ref\n) {\n const styles = useStyles()\n const isLink = !!href\n\n const LinkRoot = asChild ? Slot : \"a\"\n\n const content =\n isLink || asChild ? (\n <LinkRoot\n data-slot=\"breadcrumb-link\"\n {...{ [SLOT_ATTR]: \"breadcrumb-link\" }}\n {...(href ? { href } : {})}\n className={mergeClasses(styles.link, className)}\n {...(isCurrent ? { \"aria-current\": \"page\" as const } : {})}\n {...props}\n >\n {children}\n </LinkRoot>\n ) : (\n <span\n data-slot=\"breadcrumb-page\"\n {...{ [SLOT_ATTR]: \"breadcrumb-page\" }}\n className={mergeClasses(styles.page, className)}\n {...(isCurrent ? { \"aria-current\": \"page\" as const } : {})}\n >\n {children}\n </span>\n )\n\n return (\n <li\n ref={ref}\n data-slot=\"breadcrumb-item\"\n {...{ [SLOT_ATTR]: \"breadcrumb-item\" }}\n className={styles.item}\n >\n {content}\n </li>\n )\n})\n"],"names":["useStyles","makeZenithStyles","shorthands","tokens.spacingElement2","tokens.textBase","tokens.leadingBase","tokens.semGrayLight","tokens.spacingElement1","tokens.fontWeightSemibold","tokens.semGrayDefault","tokens.accentA8","Breadcrumb","React","separator","className","children","props","ref","styles","items","jsx","SLOT_ATTR","child","index","jsxs","BreadcrumbItem","href","isCurrent","asChild","content","Slot","mergeClasses"],"mappings":";;;;;;AAeA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGC,EAAW,IAAIC,CAAsB;AAAA,IACxC,UAAUC;AAAAA,IACV,YAAYC;AAAAA,EAAO;AAAA,EAErB,WAAW;AAAA,IACT,OAAOC;AAAAA,EAAO;AAAA,EAEhB,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA;AAAA,IAEZ,GAAGJ,EAAW,IAAIK,CAAsB;AAAA,EAAA;AAAA,EAE1C,MAAM;AAAA,IACJ,YAAYC;AAAAA,IACZ,OAAOF;AAAAA,IACP,oBACE;AAAA,IACF,oBAAoB;AAAA,IACpB,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MC,IAASlB,EAAA,GAKT6B,IAJS,CAAC,CAACH,KAKLE,IACR,gBAAAR;AAAA,IAJaQ,IAAUE,IAAO;AAAA,IAI7B;AAAA,MACC,aAAU;AAAA,MACJ,CAACT,CAAS,GAAG;AAAA,MAClB,GAAIK,IAAO,EAAE,MAAAA,EAAA,IAAS,CAAA;AAAA,MACvB,WAAWK,EAAab,EAAO,MAAMJ,CAAS;AAAA,MAC7C,GAAIa,IAAY,EAAE,gBAAgB,OAAA,IAAoB,CAAA;AAAA,MACtD,GAAGX;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA,IAGH,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACJ,CAACC,CAAS,GAAG;AAAA,MACnB,WAAWU,EAAab,EAAO,MAAMJ,CAAS;AAAA,MAC7C,GAAIa,IAAY,EAAE,gBAAgB,OAAA,IAAoB,CAAA;AAAA,MAEtD,UAAAZ;AAAA,IAAA;AAAA,EAAA;AAIP,SACE,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAH;AAAA,MACA,aAAU;AAAA,MACJ,CAACI,CAAS,GAAG;AAAA,MACnB,WAAWH,EAAO;AAAA,MAEjB,UAAAW;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-group.js","sources":["../../../src/components/button-group/button-group.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 { Separator, type SeparatorProps } from \"../separator/separator\"\n\n/**\n * ButtonGroup — compound component family for grouping buttons, text, and separators
|
|
1
|
+
{"version":3,"file":"button-group.js","sources":["../../../src/components/button-group/button-group.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 { Separator, type SeparatorProps } from \"../separator/separator\"\n\n/**\n * ButtonGroup — compound component family for grouping buttons, text, and separators. One\n * `makeZenithStyles` call for the whole family, one slot per sub-component (following `card.tsx`).\n */\n\nexport type ButtonGroupOrientation = \"horizontal\" | \"vertical\"\n\nconst useStyles = makeZenithStyles({\n root: {\n display: \"flex\",\n width: \"fit-content\",\n alignItems: \"stretch\",\n \"& > *:focus-visible\": {\n zIndex: 10,\n position: \"relative\",\n },\n [`&:has(> [${SLOT_ATTR}=\"button-group\"])`]: {\n ...shorthands.gap(tokens.spacingElement2),\n },\n },\n horizontal: {\n \"& > *:not(:first-child)\": {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n borderLeftWidth: 0,\n },\n \"& > *:not(:last-child)\": {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n },\n vertical: {\n flexDirection: \"column\",\n \"& > *:not(:first-child)\": {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTopWidth: 0,\n },\n \"& > *:not(:last-child)\": {\n borderBottomLeftRadius: 0,\n borderBottomRightRadius: 0,\n },\n },\n text: {\n backgroundColor: tokens.grayA4,\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n ...shorthands.borderRadius(tokens.radiusMd),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA5),\n ...shorthands.padding(tokens.spacingElement3, tokens.spacingGroup2),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightMedium,\n // Tailwind `shadow-xs` — literal per CONVENTIONS B7\n boxShadow: \"0 1px 2px 0 #0000000d\",\n \"& svg\": {\n pointerEvents: \"none\",\n width: \"1rem\",\n height: \"1rem\",\n },\n },\n separator: {\n ...shorthands.margin(0),\n position: \"relative\",\n alignSelf: \"stretch\",\n backgroundColor: \"transparent\",\n },\n separatorVertical: {\n height: \"1px\",\n },\n})\n\nexport type ButtonGroupProps = React.ComponentProps<\"div\"> & {\n orientation?: ButtonGroupOrientation\n}\n\nexport const ButtonGroup = React.forwardRef<HTMLDivElement, ButtonGroupProps>(\n function ButtonGroup(\n { className, orientation = \"horizontal\", ...props },\n ref\n ) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"button-group\"\n {...{ [SLOT_ATTR]: \"button-group\" }}\n data-orientation={orientation}\n className={mergeClasses(styles.root, styles[orientation], className)}\n {...props}\n />\n )\n }\n)\n\nexport type ButtonGroupTextProps = React.ComponentProps<\"div\">\n\nexport const ButtonGroupText = React.forwardRef<\n HTMLDivElement,\n ButtonGroupTextProps\n>(function ButtonGroupText({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"button-group-text\"\n {...{ [SLOT_ATTR]: \"button-group-text\" }}\n className={mergeClasses(styles.text, className)}\n {...props}\n />\n )\n})\n\nexport type ButtonGroupSeparatorProps = SeparatorProps\n\nexport const ButtonGroupSeparator = React.forwardRef<\n HTMLDivElement,\n ButtonGroupSeparatorProps\n>(function ButtonGroupSeparator(\n { className, orientation = \"vertical\", ...props },\n ref\n) {\n const styles = useStyles()\n\n return (\n <Separator\n ref={ref}\n data-slot=\"button-group-separator\"\n {...{ [SLOT_ATTR]: \"button-group-separator\" }}\n orientation={orientation}\n className={mergeClasses(\n styles.separator,\n orientation === \"vertical\" && styles.separatorVertical,\n className\n )}\n {...props}\n />\n )\n})\n"],"names":["useStyles","makeZenithStyles","SLOT_ATTR","shorthands","tokens.spacingElement2","tokens.grayA4","tokens.radiusMd","tokens.grayA5","tokens.spacingElement3","tokens.spacingGroup2","tokens.textSm","tokens.leadingSm","tokens.fontWeightMedium","ButtonGroup","React","className","orientation","props","ref","styles","jsx","mergeClasses","ButtonGroupText","ButtonGroupSeparator","Separator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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.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 { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles call.\n *\n * v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`, ...).\n * Every variant is the same style shape — soft background, default-graded text — so the family is a\n * VALUE, not a class: two atoms read two inline custom properties that the component sets from the\n * `variant` prop. Adding a family costs zero rules, which the rule-count test asserts.\n *\n * Only five families appear — accent, gray, success, warning, error — and all five are core\n * families (accent / gray / error / warning / success / info ship in the core sheet), so no\n * `ensurePaletteTokens()` install is needed (CONVENTIONS rule 3).\n *\n * The icon/copy grid is gated on the `data-hide-icon` attribute exactly as v1 gates it with the\n * `data-[hide-icon=false]:` variants: when an icon is shown the root becomes a grid whose columns\n * reflow from `0 1fr auto` to `1rem 1fr` whenever an icon child is present. Selectors key on\n * SLOT_ATTR, never on `data-slot` (CONVENTIONS rule 4): v1's `[&>[data-slot=callout-icon]]` and\n * `has-data-[slot=callout-icon]` become a direct-child and a `:has()` rule over SLOT_ATTR.\n *\n * Values ported as literals because no token fits: `p-3` (0.75rem) padding, the icon gap (0.75rem),\n * `size-5` (1.25rem), `pr-10` (2.5rem), `gap-y-0.5` (0.125rem), and `leading-relaxed` (1.625).\n * `leading-none`-style numbers and Tailwind's `calc(var(--spacing)*4)` are resolved to real values.\n *\n * The dismiss button is the shared `ClearButton` from `lib/clear-button.tsx`, exactly as v1\n * composes it — the root keeps only the positioning (`absolute top-2 right-2 size-6`) and passes a\n * size-4 `CloseIcon` child (`lib/icons.tsx`), so hover tint, focus ring and the icon are identical\n * to v1's. `text-current` on the button is a no-op here (the root's `color: var(--FG)` inherits),\n * so it is not passed.\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\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})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-sem-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAwCA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IA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C,KAAK;AACH,aAAO,gBAAAE,EAACE,GAAA,EAAU,KAAAH,GAAW,GAAGD,EAAA,CAAO;AAAA,IACzC,KAAK;AACH,aAAO,gBAAAE,EAACC,GAAA,EAAY,KAAAF,GAAW,GAAGD,EAAA,CAAO;AAAA,IAC3C,KAAK;AACH,aAAO,gBAAAE,EAACG,GAAA,EAAU,KAAAJ,GAAW,GAAGD,EAAA,CAAO;AAAA,EAAA;AAI3C,SAAO;AACT,CAAC,GAMK4C,IAAc7C,EAAM;AAAA,EACxB,SAAqB,EAAE,WAAA+B,GAAW,YAAAG,GAAY,GAAGjC,EAAA,GAASC,GAAK;AAC7D,WACE,gBAAAC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
1
|
+
{"version":3,"file":"callout.js","sources":["../../../src/components/callout/callout.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 { NS } from \"../../tokens\"\nimport * as tokens from \"../../tokens\"\nimport { ClearButton } from \"../../lib/clear-button\"\nimport { CloseIcon } from \"../../lib/icons\"\n\n/**\n * Callout — Badge's colour collapse applied to Card's compound pattern, in one makeZenithStyles\n * call. v1 hardcodes two variants per family as class strings (`bg-accent-soft text-accent-a12`,\n * ...).\n */\n\nconst InfoIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function InfoIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nconst WarningIcon = React.forwardRef<\n SVGSVGElement,\n React.ComponentProps<\"svg\">\n>(function WarningIcon(props, ref) {\n return (\n <svg\n ref={ref}\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})\n\nconst CheckIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function CheckIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nconst ErrorIcon = React.forwardRef<SVGSVGElement, React.ComponentProps<\"svg\">>(\n function ErrorIcon(props, ref) {\n return (\n <svg\n ref={ref}\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 }\n)\n\nexport type CalloutVariant =\n \"info\" | \"gray\" | \"success\" | \"warning\" | \"destructive\"\n\ntype CalloutContextValue = {\n variant: CalloutVariant\n hideIcon: boolean\n}\n\nconst CalloutContext = React.createContext<CalloutContextValue>({\n variant: \"info\",\n hideIcon: false,\n})\n\n/**\n * The two slots a variant paints. Set inline; read by the root's atoms. Every variant is the same\n * style shape (soft background, default-graded text), so the five entries are data about five\n * families, not five class strings.\n */\nconst BG = \"--zenith-callout-bg\"\nconst FG = \"--zenith-callout-fg\"\n\nconst semantic = (family: string, slot: string): string =>\n `var(--zenith-${NS}-sem-${family}-${slot})`\n\nconst VARIANT_SLOTS: Record<CalloutVariant, () => Record<string, string>> = {\n info: () => ({\n [BG]: semantic(\"accent\", \"soft\"),\n [FG]: semantic(\"accent\", \"default\"),\n }),\n gray: () => ({\n [BG]: semantic(\"gray\", \"soft\"),\n [FG]: semantic(\"gray\", \"default\"),\n }),\n success: () => ({\n [BG]: semantic(\"success\", \"soft\"),\n [FG]: semantic(\"success\", \"default\"),\n }),\n warning: () => ({\n [BG]: semantic(\"warning\", \"soft\"),\n [FG]: semantic(\"warning\", \"default\"),\n }),\n destructive: () => ({\n [BG]: semantic(\"error\", \"soft\"),\n [FG]: semantic(\"error\", \"default\"),\n }),\n}\n\nconst useStyles = makeZenithStyles({\n root: {\n position: \"relative\",\n width: \"100%\",\n // p-3 — no token for 0.75rem.\n paddingTop: tokens.spacingElement3,\n paddingRight: tokens.spacingElement3,\n paddingBottom: tokens.spacingElement3,\n paddingLeft: tokens.spacingElement3,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n backgroundColor: `var(${BG})`,\n color: `var(${FG})`,\n // `items-center`: present in every state, like v1's base string.\n alignItems: \"center\",\n // v1's `data-[hide-icon=false]:` block — the icon grid kicks in only when an icon renders.\n \"&[data-hide-icon='false']\": {\n display: \"grid\",\n gridTemplateColumns: \"0 1fr auto\",\n // gap-y-0.5 — no token for 0.125rem.\n rowGap: \"0.125rem\",\n // `has-[>svg]` and `has-data-[slot=callout-icon]` collapse to the same re-laid-out grid.\n \"&:has(>svg)\": {\n gridTemplateColumns: \"1rem 1fr\",\n // gap-x-3 — no token for 0.75rem.\n columnGap: tokens.spacingElement3,\n },\n [`&:has([${SLOT_ATTR}=\"callout-icon\"])`]: {\n gridTemplateColumns: \"1rem 1fr\",\n columnGap: tokens.spacingElement3,\n },\n },\n // v1 `[&>[data-slot=callout-icon]]` — SLOT_ATTR, never data-slot (CONVENTIONS rule 4).\n [`& > [${SLOT_ATTR}=\"callout-icon\"]`]: {\n // size-5 — no token for 1.25rem.\n width: \"1.25rem\",\n height: \"1.25rem\",\n flexShrink: 0,\n },\n },\n dismissible: {\n // pr-10 — no token for 2.5rem.\n paddingRight: \"2.5rem\",\n },\n title: {\n gridColumnStart: 2,\n ...shorthands.overflow(\"hidden\"),\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 1,\n // min-h-4\n minHeight: tokens.spacingGroup2,\n fontSize: tokens.textBase,\n lineHeight: tokens.leadingBase,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n gridColumnStart: 2,\n display: \"grid\",\n justifyItems: \"start\",\n ...shorthands.gap(tokens.spacingElement1),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n \"& p\": {\n // leading-relaxed — no token for a 1.625 line-height.\n lineHeight: 1.625,\n },\n },\n action: {\n display: \"flex\",\n width: \"100%\",\n gridColumnEnd: \"span 3\",\n // mt-2\n marginTop: tokens.spacingElement2,\n },\n actionStart: {\n justifyContent: \"flex-start\",\n },\n actionStartIcon: {\n justifyContent: \"flex-start\",\n // ml-8\n marginLeft: tokens.spacingLayout2,\n },\n actionEnd: {\n justifyContent: \"flex-end\",\n },\n dismiss: {\n position: \"absolute\",\n // top-2 right-2\n top: tokens.spacingElement2,\n right: tokens.spacingElement2,\n // size-6 — the ClearButton itself supplies centering, rounding, hover and focus.\n width: tokens.spacingLayout1,\n height: tokens.spacingLayout1,\n },\n dismissIcon: {\n // size-4\n width: tokens.spacingGroup2,\n height: tokens.spacingGroup2,\n },\n})\n\nexport type CalloutProps = React.ComponentProps<\"div\"> & {\n variant?: CalloutVariant\n hideIcon?: boolean\n customIcon?: React.ReactNode\n /** Shows a top-right close button that dismisses the callout. */\n dismissible?: boolean\n /** Called when the close button is clicked, after the callout hides itself. */\n onDismiss?: () => void\n}\n\nexport const Callout = React.forwardRef<HTMLDivElement, CalloutProps>(\n function Callout(\n {\n className,\n variant = \"info\",\n hideIcon = false,\n customIcon,\n dismissible = false,\n onDismiss,\n style,\n children,\n ...props\n },\n ref\n ) {\n const [open, setOpen] = React.useState(true)\n const styles = useStyles()\n\n if (!open) {\n return null\n }\n\n const handleDismiss = () => {\n setOpen(false)\n onDismiss?.()\n }\n\n return (\n <CalloutContext.Provider value={{ variant, hideIcon }}>\n <div\n ref={ref}\n data-callout-variant={variant}\n data-slot=\"callout\"\n data-hide-icon={hideIcon ? \"true\" : \"false\"}\n data-dismissible={dismissible ? \"true\" : \"false\"}\n role=\"alert\"\n {...{ [SLOT_ATTR]: \"callout\" }}\n className={mergeClasses(\n styles.root,\n dismissible && styles.dismissible,\n className\n )}\n style={\n { ...VARIANT_SLOTS[variant](), ...style } as React.CSSProperties\n }\n {...props}\n >\n {!hideIcon && <CalloutIcon customIcon={customIcon} />}\n {children}\n {dismissible && (\n <ClearButton\n label=\"Dismiss\"\n onClick={handleDismiss}\n className={styles.dismiss}\n >\n <CloseIcon className={styles.dismissIcon} />\n </ClearButton>\n )}\n </div>\n </CalloutContext.Provider>\n )\n }\n)\n\nexport type CalloutTitleProps = React.ComponentProps<\"div\">\n\nexport const CalloutTitle = React.forwardRef<HTMLDivElement, CalloutTitleProps>(\n function CalloutTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-title\"\n {...{ [SLOT_ATTR]: \"callout-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport type CalloutDescriptionProps = React.ComponentProps<\"div\">\n\nexport const CalloutDescription = React.forwardRef<\n HTMLDivElement,\n CalloutDescriptionProps\n>(function CalloutDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-description\"\n {...{ [SLOT_ATTR]: \"callout-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport type CalloutActionProps = React.ComponentProps<\"div\"> & {\n align?: \"start\" | \"end\"\n}\n\nexport const CalloutAction = React.forwardRef<\n HTMLDivElement,\n CalloutActionProps\n>(function CalloutAction({ className, align = \"start\", ...props }, ref) {\n const { hideIcon } = React.useContext(CalloutContext)\n const styles = useStyles()\n\n const alignment =\n align === \"end\"\n ? styles.actionEnd\n : hideIcon\n ? styles.actionStart\n : styles.actionStartIcon\n\n return (\n <div\n ref={ref}\n data-slot=\"callout-action\"\n data-align={align}\n {...{ [SLOT_ATTR]: \"callout-action\" }}\n className={mergeClasses(styles.action, alignment, className)}\n {...props}\n />\n )\n})\n\ntype CalloutVariantIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutVariantIcon = React.forwardRef<\n SVGSVGElement,\n CalloutVariantIconProps\n>(function CalloutVariantIcon({ customIcon, ...props }, ref) {\n const { variant } = React.useContext(CalloutContext)\n\n if (customIcon) {\n return customIcon\n }\n\n switch (variant) {\n case \"info\":\n return <InfoIcon ref={ref} {...props} />\n case \"success\":\n return <CheckIcon ref={ref} {...props} />\n case \"warning\":\n return <WarningIcon ref={ref} {...props} />\n case \"destructive\":\n return <ErrorIcon ref={ref} {...props} />\n }\n\n // gray has no default icon; v1 renders nothing for it.\n return null\n})\n\nexport type CalloutIconProps = React.ComponentProps<\"svg\"> & {\n customIcon?: React.ReactNode\n}\n\nconst CalloutIcon = React.forwardRef<SVGSVGElement, CalloutIconProps>(\n function CalloutIcon({ className, customIcon, ...props }, ref) {\n return (\n <CalloutVariantIcon\n ref={ref}\n data-slot=\"callout-icon\"\n {...{ [SLOT_ATTR]: \"callout-icon\" }}\n customIcon={customIcon}\n className={className}\n {...props}\n />\n )\n }\n)\n"],"names":["InfoIcon","React","props","ref","jsx","WarningIcon","CheckIcon","ErrorIcon","CalloutContext","BG","FG","semantic","family","slot","NS","VARIANT_SLOTS","useStyles","makeZenithStyles","tokens.spacingElement3","tokens.textSm","tokens.leadingSm","SLOT_ATTR","shorthands","tokens.spacingGroup2","tokens.textBase","tokens.leadingBase","tokens.fontWeightSemibold","tokens.spacingElement1","tokens.spacingElement2","tokens.spacingLayout2","tokens.spacingLayout1","Callout","className","variant","hideIcon","customIcon","dismissible","onDismiss","style","children","open","setOpen","styles","handleDismiss","jsxs","mergeClasses","CalloutIcon","ClearButton","CloseIcon","CalloutTitle","CalloutDescription","CalloutAction","align","alignment","CalloutVariantIcon"],"mappings":";;;;;;;;AAiBA,MAAMA,IAAWC,EAAM;AAAA,EACrB,SAAkBC,GAAOC,GAAK;AAC5B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAAD;AAAA,QACA,OAAM;AAAA,QACN,SAAQ;AAAA,QACR,MAAK;AAAA,QACJ,GAAGD;AAAA,QAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,m8CAAA,CAAm8C;AAAA,MAAA;AAAA,IAAA;AAAA,EAGj9C;AACF,GAEMC,IAAcJ,EAAM,WAGxB,SAAqBC,GAAOC,GAAK;AACjC,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,OAAM;AAAA,MACN,SAAQ;AAAA,MACR,MAAK;AAAA,MACJ,GAAGD;AAAA,MAEJ,UAAA,gBAAAE,EAAC,QAAA,EAAK,GAAE,i1CAAA,CAAi1C;AAAA,IAAA;AAAA,EAAA;AAG/1C,CAAC,GAEKE,IAAYL,EAAM;AAAA,EACtB,SAAmBC,GAAOC,GAAK;AAC7B,WACE,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA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Ac7C,EAAM;AAAA,EACxB,SAAqB,EAAE,WAAA+B,GAAW,YAAAG,GAAY,GAAGjC,EAAA,GAASC,GAAK;AAC7D,WACE,gBAAAC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,KAAAnD;AAAA,QACA,aAAU;AAAA,QACJ,CAACkB,CAAS,GAAG;AAAA,QACnB,YAAAc;AAAA,QACA,WAAAH;AAAA,QACC,GAAG9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sources":["../../../src/components/card/card.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\"\n\n/**\n * Card — the first compound component: ONE `makeZenithStyles` call for the whole family, one slot
|
|
1
|
+
{"version":3,"file":"card.js","sources":["../../../src/components/card/card.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\"\n\n/**\n * Card — the first compound component: ONE `makeZenithStyles` call for the whole family, one slot\n * per sub-component, and each sub-component reads its own slot. Callout, Breadcrumb and Table copy\n * this pattern.\n */\n\nconst useStyles = makeZenithStyles({\n root: {\n backgroundColor: tokens.body,\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingGroup2),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", \"transparent\"),\n paddingTop: tokens.spacingGroup2,\n paddingBottom: tokens.spacingGroup2,\n boxShadow: \"0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)\",\n },\n header: {\n containerType: \"inline-size\",\n containerName: \"card-header\",\n display: \"grid\",\n gridAutoRows: \"min-content\",\n gridTemplateRows: \"auto auto\",\n alignItems: \"start\",\n ...shorthands.gap(tokens.spacingElement2),\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n \"&:is(.border-b)\": {\n paddingBottom: tokens.spacingGroup2,\n },\n [`&:has([${SLOT_ATTR}=\"card-action\"])`]: {\n gridTemplateColumns: \"1fr auto\",\n },\n },\n title: {\n // v1 `leading-none` — a literal 1 because no token exists for it.\n lineHeight: 1,\n fontWeight: tokens.fontWeightSemibold,\n },\n description: {\n color: tokens.grayA11,\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n },\n action: {\n gridColumnStart: 2,\n gridRowStart: 1,\n gridRowEnd: \"span 2\",\n alignSelf: \"start\",\n justifySelf: \"end\",\n },\n content: {\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n },\n footer: {\n display: \"flex\",\n alignItems: \"center\",\n paddingLeft: tokens.spacingGroup2,\n paddingRight: tokens.spacingGroup2,\n \"&:is(.border-t)\": {\n paddingTop: tokens.spacingGroup2,\n },\n },\n})\n\nexport type CardProps = React.ComponentProps<\"div\">\n\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(\n { className, ...props },\n ref\n) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card\"\n {...{ [SLOT_ATTR]: \"card\" }}\n className={mergeClasses(styles.root, className)}\n {...props}\n />\n )\n})\n\nexport const CardHeader = React.forwardRef<HTMLDivElement, CardProps>(\n function CardHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-header\"\n {...{ [SLOT_ATTR]: \"card-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardTitle = React.forwardRef<HTMLDivElement, CardProps>(\n function CardTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-title\"\n {...{ [SLOT_ATTR]: \"card-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardDescription = React.forwardRef<HTMLDivElement, CardProps>(\n function CardDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-description\"\n {...{ [SLOT_ATTR]: \"card-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardAction = React.forwardRef<HTMLDivElement, CardProps>(\n function CardAction({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-action\"\n {...{ [SLOT_ATTR]: \"card-action\" }}\n className={mergeClasses(styles.action, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardContent = React.forwardRef<HTMLDivElement, CardProps>(\n function CardContent({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-content\"\n {...{ [SLOT_ATTR]: \"card-content\" }}\n className={mergeClasses(styles.content, className)}\n {...props}\n />\n )\n }\n)\n\nexport const CardFooter = React.forwardRef<HTMLDivElement, CardProps>(\n function CardFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"card-footer\"\n {...{ [SLOT_ATTR]: \"card-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n }\n)\n"],"names":["useStyles","makeZenithStyles","tokens.body","shorthands","tokens.spacingGroup2","tokens.radiusXl","tokens.spacingElement2","SLOT_ATTR","tokens.fontWeightSemibold","tokens.grayA11","tokens.textSm","tokens.leadingSm","Card","React","className","props","ref","styles","jsx","mergeClasses","CardHeader","CardTitle","CardDescription","CardAction","CardContent","CardFooter"],"mappings":";;;;;AAcA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,MAAM;AAAA,IACJ,iBAAiBC;AAAAA,IACjB,SAAS;AAAA,IACT,eAAe;AAAA,IAC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