@epilot/zenith-react 0.1.0-next.1 → 0.2.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -10
- package/dist/components/alert-dialog/alert-dialog.js +48 -47
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/appearance-boundary/appearance-boundary.js +32 -34
- package/dist/components/appearance-boundary/appearance-boundary.js.map +1 -1
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +10 -10
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button.js +28 -28
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/callout/callout.js +42 -40
- package/dist/components/callout/callout.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +13 -13
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/code-block/code-block.js +6 -6
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/code-editor/code-editor.js +1 -1
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/command/command.js +6 -6
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/data-table/data-table-body.js +120 -66
- package/dist/components/data-table/data-table-body.js.map +1 -1
- package/dist/components/data-table/data-table-column-header.js +7 -7
- package/dist/components/data-table/data-table-column-header.js.map +1 -1
- package/dist/components/data-table/data-table-column-order.js +277 -0
- package/dist/components/data-table/data-table-column-order.js.map +1 -0
- package/dist/components/data-table/data-table-content.js +72 -58
- package/dist/components/data-table/data-table-content.js.map +1 -1
- package/dist/components/data-table/data-table-context.js +8 -4
- package/dist/components/data-table/data-table-context.js.map +1 -1
- package/dist/components/data-table/data-table-footer.js +31 -0
- package/dist/components/data-table/data-table-footer.js.map +1 -0
- package/dist/components/data-table/data-table-header-draggable.js +151 -0
- package/dist/components/data-table/data-table-header-draggable.js.map +1 -0
- package/dist/components/data-table/data-table-header.js +130 -57
- package/dist/components/data-table/data-table-header.js.map +1 -1
- package/dist/components/data-table/data-table-resize-handle.js +137 -0
- package/dist/components/data-table/data-table-resize-handle.js.map +1 -0
- package/dist/components/data-table/data-table.js +184 -156
- package/dist/components/data-table/data-table.js.map +1 -1
- package/dist/components/data-table/hooks/use-data-table-virtualizer.js +9 -0
- package/dist/components/data-table/hooks/use-data-table-virtualizer.js.map +1 -0
- package/dist/components/date-range-picker/date-range-picker.js +196 -179
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-time-picker/calendar.js +29 -29
- package/dist/components/date-time-picker/calendar.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-input.js +127 -114
- package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker.js +91 -88
- package/dist/components/date-time-picker/date-time-picker.js.map +1 -1
- package/dist/components/date-time-picker/time-picker.js +55 -55
- package/dist/components/date-time-picker/time-picker.js.map +1 -1
- package/dist/components/dialog/dialog.js +74 -72
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +69 -67
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +36 -36
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field-combobox.js +4 -4
- package/dist/components/field/field-combobox.js.map +1 -1
- package/dist/components/field/field.js +207 -176
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/list/list.js +40 -40
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/option-card/option-card.js +27 -25
- package/dist/components/option-card/option-card.js.map +1 -1
- package/dist/components/pill/pill.js +9 -9
- package/dist/components/pill/pill.js.map +1 -1
- package/dist/components/radio/radio.js +14 -14
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +9 -9
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +1 -1
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.js +11 -11
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/switch/switch.js +11 -11
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table-pagination.js +1 -1
- package/dist/components/table/table-pagination.js.map +1 -1
- package/dist/components/table/table.js +15 -15
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.js +131 -76
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/text/text.js +10 -1
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/toast/toast.js +26 -26
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.js +20 -20
- package/dist/components/toggle/toggle.js.map +1 -1
- package/dist/index.d.ts +1940 -1867
- package/dist/index.js +133 -121
- package/dist/index.js.map +1 -1
- package/dist/packages/tokens/dist/generated/core.generated.js +13 -22
- package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -1
- package/dist/packages/tokens/dist/generated/palette.generated.js +5 -5
- package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
- package/dist/packages/tokens/dist/install.js +5 -5
- package/dist/packages/tokens/dist/install.js.map +1 -1
- package/dist/tokens/core.meta.generated.js +2 -2
- package/dist/tokens/core.meta.generated.js.map +1 -1
- package/dist/tokens/index.d.ts +1029 -1104
- package/dist/tokens/index.js +1031 -1106
- package/dist/tokens/index.js.map +1 -1
- package/dist/tokens/palette.generated.js +2 -2
- package/dist/tokens/palette.generated.js.map +1 -1
- package/dist/tokens.json +605 -755
- package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js +385 -340
- package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js.map +1 -1
- package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js +344 -229
- package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
- package/dist/vendor/.bun/@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js +1 -1
- package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js +36 -0
- package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js.map +1 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js +450 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js.map +1 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js +50 -0
- package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js.map +1 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -20,7 +20,6 @@ shared component-library import map.
|
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
22
|
import { Button } from "@epilot/zenith-react"
|
|
23
|
-
import { gray11 } from "@epilot/zenith-react/tokens"
|
|
24
23
|
|
|
25
24
|
export const Example = () => <Button variant="primary">Continue</Button>
|
|
26
25
|
```
|
|
@@ -34,13 +33,55 @@ import { prepareCoreTokens } from "@epilot/zenith-react/delivery"
|
|
|
34
33
|
await prepareCoreTokens()
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
Optional; no network.
|
|
38
|
-
|
|
36
|
+
Optional; no network.
|
|
37
|
+
|
|
38
|
+
Application styles that need a design token import a named binding from
|
|
39
|
+
`@epilot/zenith-react/tokens`. Do not add the token CSS as a second stylesheet,
|
|
40
|
+
and do not write generated `--zenith-<hash>-*` names by hand.
|
|
41
|
+
|
|
42
|
+
Zenith ships no `.css` files, and its `exports` map has no stylesheet entry:
|
|
43
|
+
there is nothing to import. Porting from Volt, drop its `style.css`,
|
|
44
|
+
`preflight.css` and `font.css` imports and add no replacement — the token CSS
|
|
45
|
+
above is the only stylesheet, and the package installs it itself.
|
|
39
46
|
|
|
40
47
|
Use `AppearanceBoundary` for a scoped appearance that must also reach portalled
|
|
41
48
|
content — a theme or surface attribute on a subtree does not follow a Dialog,
|
|
42
49
|
Popover, Select, Tooltip or menu into `document.body`.
|
|
43
50
|
|
|
51
|
+
## Lay your own screens out
|
|
52
|
+
|
|
53
|
+
Zenith ships components, not a layout system: there is no `Grid`, `Stack`,
|
|
54
|
+
`Box` or `Spacer`, and there never will be. The space between components is
|
|
55
|
+
yours.
|
|
56
|
+
|
|
57
|
+
`makeZenithStyles` is **public API for that purpose**, exported from the
|
|
58
|
+
package root alongside `mergeClasses` and `shorthands`. It is the same Griffel
|
|
59
|
+
API Zenith's own components use, so your layout ships its CSS with your
|
|
60
|
+
components and depends on no stylesheet loaded from somewhere else.
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { makeZenithStyles, shorthands } from "@epilot/zenith-react"
|
|
64
|
+
import { spacingLayout1, containerXl } from "@epilot/zenith-react/tokens"
|
|
65
|
+
|
|
66
|
+
const useStyles = makeZenithStyles({
|
|
67
|
+
page: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
flexDirection: "column",
|
|
70
|
+
maxWidth: containerXl,
|
|
71
|
+
...shorthands.gap(spacingLayout1),
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Take every value from `@epilot/zenith-react/tokens`. A literal hex, a utility
|
|
77
|
+
class from another stylesheet, or a raw pixel value is how a screen drifts away
|
|
78
|
+
from the system and stops following a token change.
|
|
79
|
+
|
|
80
|
+
A utility-class framework works too, but understand what you are depending on:
|
|
81
|
+
those classes come from a stylesheet your component does not ship, so what your
|
|
82
|
+
screen looks like is decided by whichever version of that stylesheet is
|
|
83
|
+
deployed beside it.
|
|
84
|
+
|
|
44
85
|
## Validate the host
|
|
45
86
|
|
|
46
87
|
- Exercise the application under its real content-security policy.
|
|
@@ -57,16 +98,41 @@ selectors or internal DOM structure from another component system. Where APIs
|
|
|
57
98
|
differ, adapt at the application boundary and remove the adapter once the
|
|
58
99
|
surface is fully on Zenith.
|
|
59
100
|
|
|
101
|
+
## Connect an MCP client
|
|
102
|
+
|
|
103
|
+
A read-only Model Context Protocol (MCP) server for Zenith runs dynamically on
|
|
104
|
+
the documentation site at `/api/mcp`. It serves component APIs, design tokens,
|
|
105
|
+
and design guidelines directly to AI coding tools.
|
|
106
|
+
|
|
107
|
+
The catalogue is built from the commit the current `latest` release was
|
|
108
|
+
published from, so it describes exactly what `npm install @epilot/zenith-react`
|
|
109
|
+
installs — not unreleased work on `main`.
|
|
110
|
+
|
|
111
|
+
Point an MCP client (such as Cursor or Claude) at the Streamable HTTP endpoint:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"mcpServers": {
|
|
116
|
+
"zenith": {
|
|
117
|
+
"url": "https://main.d8s2wyuq7fsgk.amplifyapp.com/api/mcp"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Replace `https://main.d8s2wyuq7fsgk.amplifyapp.com` with your custom domain if
|
|
124
|
+
configured. All queries and tools are strictly read-only and require no
|
|
125
|
+
credentials.
|
|
126
|
+
|
|
60
127
|
## Which version you get
|
|
61
128
|
|
|
62
|
-
`npm install @epilot/zenith-react` resolves the `latest` dist-tag, which
|
|
63
|
-
|
|
64
|
-
`latest` does not exist.
|
|
129
|
+
`npm install @epilot/zenith-react` resolves the `latest` dist-tag, which points
|
|
130
|
+
at `0.1.0` — published to `next`, verified, then promoted by hand.
|
|
65
131
|
|
|
66
|
-
Unproven builds
|
|
132
|
+
Unproven builds stay on `next` with a prerelease version:
|
|
67
133
|
|
|
68
134
|
```sh
|
|
69
|
-
npm install @epilot/zenith-react@next
|
|
135
|
+
npm install @epilot/zenith-react@next
|
|
70
136
|
```
|
|
71
137
|
|
|
72
138
|
These are opt-in twice over — you name the tag, and a range like `^0.1.0` never
|
|
@@ -76,5 +142,8 @@ resolves a prerelease. Pin an exact version if you adopt one.
|
|
|
76
142
|
|
|
77
143
|
The package is ESM-only and tree-shakeable. Resolved literal token values are in
|
|
78
144
|
`@epilot/zenith-react/tokens.json`, and an optional Jest helper in
|
|
79
|
-
`@epilot/zenith-react/testing/jest-preset.cjs`.
|
|
80
|
-
|
|
145
|
+
`@epilot/zenith-react/testing/jest-preset.cjs`.
|
|
146
|
+
|
|
147
|
+
Component reference, guidelines and examples are on the documentation site — the
|
|
148
|
+
same catalogue the MCP endpoint above serves. Development and contribution rules
|
|
149
|
+
live in the repository.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as x, Fragment as h } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
|
-
import { Root as
|
|
4
|
-
import { SLOT_ATTR as n, mergeClasses as
|
|
5
|
-
import { useAppearanceAttributes as
|
|
3
|
+
import { Root as b, Action as R, Cancel as T, Content as w, Description as C, Overlay as v, Portal as S, Title as N, Trigger as z } from "../../vendor/.bun/@radix-ui_react-alert-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-alert-dialog/dist/index.js";
|
|
4
|
+
import { SLOT_ATTR as n, mergeClasses as g, shorthands as d } from "@epilot/zenith-runtime/v1";
|
|
5
|
+
import { useAppearanceAttributes as y } from "../appearance-boundary/appearance-boundary.js";
|
|
6
6
|
import { useDensity as F } from "../density-provider/density-provider.js";
|
|
7
7
|
import { makeZenithStyles as W } from "../../styles/make-styles.js";
|
|
8
8
|
import { grayA11 as O, leadingSm as H, textSm as P, grayA12 as X, fontWeightSemibold as j, leadingXl as k, textXl as _, containerXl as I, containerLg as L, containerMd as B, containerSm as E, body as G, spacingElement2 as p, spacingGroup2 as u, grayA1 as M, radiusXl as Z } from "../../tokens/index.js";
|
|
9
|
-
import { Button as
|
|
10
|
-
const
|
|
9
|
+
import { Button as A } from "../button/button.js";
|
|
10
|
+
const m = W({
|
|
11
11
|
overlay: {
|
|
12
12
|
position: "fixed",
|
|
13
13
|
top: 0,
|
|
@@ -43,10 +43,10 @@ const g = W({
|
|
|
43
43
|
display: "grid",
|
|
44
44
|
width: "100%",
|
|
45
45
|
maxWidth: "calc(100% - 2rem)",
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
...
|
|
46
|
+
...d.gap(u),
|
|
47
|
+
...d.borderRadius(Z),
|
|
48
|
+
...d.border("1px", "solid", M),
|
|
49
|
+
...d.padding(u),
|
|
50
50
|
// v1 shadow-lg
|
|
51
51
|
boxShadow: "0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a",
|
|
52
52
|
outlineStyle: "none",
|
|
@@ -96,12 +96,12 @@ const g = W({
|
|
|
96
96
|
header: {
|
|
97
97
|
display: "flex",
|
|
98
98
|
flexDirection: "column",
|
|
99
|
-
...
|
|
99
|
+
...d.gap(p),
|
|
100
100
|
textAlign: "left"
|
|
101
101
|
},
|
|
102
102
|
footer: {
|
|
103
103
|
display: "flex",
|
|
104
|
-
...
|
|
104
|
+
...d.gap(p),
|
|
105
105
|
justifyContent: "flex-end"
|
|
106
106
|
},
|
|
107
107
|
title: {
|
|
@@ -117,11 +117,11 @@ const g = W({
|
|
|
117
117
|
}
|
|
118
118
|
}), at = i.forwardRef(
|
|
119
119
|
function(t, a) {
|
|
120
|
-
return /* @__PURE__ */ r(
|
|
120
|
+
return /* @__PURE__ */ r(b, { "data-slot": "alert-dialog", ...t });
|
|
121
121
|
}
|
|
122
122
|
), ot = i.forwardRef(function({ className: t, ...a }, o) {
|
|
123
123
|
return /* @__PURE__ */ r(
|
|
124
|
-
|
|
124
|
+
z,
|
|
125
125
|
{
|
|
126
126
|
ref: o,
|
|
127
127
|
"data-slot": "alert-dialog-trigger",
|
|
@@ -132,7 +132,7 @@ const g = W({
|
|
|
132
132
|
);
|
|
133
133
|
}), et = i.forwardRef(function(t, a) {
|
|
134
134
|
return /* @__PURE__ */ r(
|
|
135
|
-
|
|
135
|
+
S,
|
|
136
136
|
{
|
|
137
137
|
"data-slot": "alert-dialog-portal",
|
|
138
138
|
[n]: "alert-dialog-portal",
|
|
@@ -140,80 +140,81 @@ const g = W({
|
|
|
140
140
|
}
|
|
141
141
|
);
|
|
142
142
|
}), q = i.forwardRef(function({ className: t, ...a }, o) {
|
|
143
|
-
const e =
|
|
143
|
+
const e = m(), s = y();
|
|
144
144
|
return /* @__PURE__ */ r(
|
|
145
|
-
|
|
145
|
+
v,
|
|
146
146
|
{
|
|
147
147
|
ref: o,
|
|
148
148
|
"data-slot": "alert-dialog-overlay",
|
|
149
149
|
[n]: "alert-dialog-overlay",
|
|
150
|
-
|
|
150
|
+
...s,
|
|
151
|
+
className: g(e.overlay, t),
|
|
151
152
|
...a
|
|
152
153
|
}
|
|
153
154
|
);
|
|
154
|
-
}), rt = i.forwardRef(function({ className: t, size: a = "xl", children: o, ...e },
|
|
155
|
-
const
|
|
156
|
-
return /* @__PURE__ */
|
|
155
|
+
}), rt = i.forwardRef(function({ className: t, size: a = "xl", children: o, ...e }, s) {
|
|
156
|
+
const c = m(), f = F(), D = y();
|
|
157
|
+
return /* @__PURE__ */ x(h, { children: [
|
|
157
158
|
/* @__PURE__ */ r(q, {}),
|
|
158
159
|
/* @__PURE__ */ r(
|
|
159
|
-
|
|
160
|
+
w,
|
|
160
161
|
{
|
|
161
|
-
ref:
|
|
162
|
+
ref: s,
|
|
162
163
|
"data-slot": "alert-dialog-content",
|
|
163
164
|
[n]: "alert-dialog-content",
|
|
164
165
|
...f !== void 0 ? { "data-density": f } : {},
|
|
165
|
-
...
|
|
166
|
-
className:
|
|
166
|
+
...D,
|
|
167
|
+
className: g(c.content, c[a], t),
|
|
167
168
|
...e,
|
|
168
169
|
children: o
|
|
169
170
|
}
|
|
170
171
|
)
|
|
171
172
|
] });
|
|
172
173
|
}), it = i.forwardRef(function({ className: t, ...a }, o) {
|
|
173
|
-
const e =
|
|
174
|
+
const e = m();
|
|
174
175
|
return /* @__PURE__ */ r(
|
|
175
176
|
"div",
|
|
176
177
|
{
|
|
177
178
|
ref: o,
|
|
178
179
|
"data-slot": "alert-dialog-header",
|
|
179
180
|
[n]: "alert-dialog-header",
|
|
180
|
-
className:
|
|
181
|
+
className: g(e.header, t),
|
|
181
182
|
...a
|
|
182
183
|
}
|
|
183
184
|
);
|
|
184
185
|
}), lt = i.forwardRef(function({ className: t, ...a }, o) {
|
|
185
|
-
const e =
|
|
186
|
+
const e = m();
|
|
186
187
|
return /* @__PURE__ */ r(
|
|
187
188
|
"div",
|
|
188
189
|
{
|
|
189
190
|
ref: o,
|
|
190
191
|
"data-slot": "alert-dialog-footer",
|
|
191
192
|
[n]: "alert-dialog-footer",
|
|
192
|
-
className:
|
|
193
|
+
className: g(e.footer, t),
|
|
193
194
|
...a
|
|
194
195
|
}
|
|
195
196
|
);
|
|
196
197
|
}), nt = i.forwardRef(function({ className: t, ...a }, o) {
|
|
197
|
-
const e =
|
|
198
|
+
const e = m();
|
|
198
199
|
return /* @__PURE__ */ r(
|
|
199
|
-
|
|
200
|
+
N,
|
|
200
201
|
{
|
|
201
202
|
ref: o,
|
|
202
203
|
"data-slot": "alert-dialog-title",
|
|
203
204
|
[n]: "alert-dialog-title",
|
|
204
|
-
className:
|
|
205
|
+
className: g(e.title, t),
|
|
205
206
|
...a
|
|
206
207
|
}
|
|
207
208
|
);
|
|
208
209
|
}), st = i.forwardRef(function({ className: t, ...a }, o) {
|
|
209
|
-
const e =
|
|
210
|
+
const e = m();
|
|
210
211
|
return /* @__PURE__ */ r(
|
|
211
|
-
|
|
212
|
+
C,
|
|
212
213
|
{
|
|
213
214
|
ref: o,
|
|
214
215
|
"data-slot": "alert-dialog-description",
|
|
215
216
|
[n]: "alert-dialog-description",
|
|
216
|
-
className:
|
|
217
|
+
className: g(e.description, t),
|
|
217
218
|
...a
|
|
218
219
|
}
|
|
219
220
|
);
|
|
@@ -222,19 +223,19 @@ const g = W({
|
|
|
222
223
|
size: a = "base",
|
|
223
224
|
destructive: o = !1,
|
|
224
225
|
className: e,
|
|
225
|
-
...
|
|
226
|
-
},
|
|
227
|
-
return /* @__PURE__ */ r(
|
|
228
|
-
|
|
226
|
+
...s
|
|
227
|
+
}, c) {
|
|
228
|
+
return /* @__PURE__ */ r(R, { asChild: !0, children: /* @__PURE__ */ r(
|
|
229
|
+
A,
|
|
229
230
|
{
|
|
230
|
-
ref:
|
|
231
|
+
ref: c,
|
|
231
232
|
"data-slot": "alert-dialog-action",
|
|
232
233
|
[n]: "alert-dialog-action",
|
|
233
234
|
variant: t,
|
|
234
235
|
size: a,
|
|
235
236
|
destructive: o,
|
|
236
237
|
className: e,
|
|
237
|
-
...
|
|
238
|
+
...s
|
|
238
239
|
}
|
|
239
240
|
) });
|
|
240
241
|
}), dt = i.forwardRef(function({
|
|
@@ -242,19 +243,19 @@ const g = W({
|
|
|
242
243
|
size: a = "base",
|
|
243
244
|
destructive: o = !1,
|
|
244
245
|
className: e,
|
|
245
|
-
...
|
|
246
|
-
},
|
|
247
|
-
return /* @__PURE__ */ r(
|
|
248
|
-
|
|
246
|
+
...s
|
|
247
|
+
}, c) {
|
|
248
|
+
return /* @__PURE__ */ r(T, { asChild: !0, children: /* @__PURE__ */ r(
|
|
249
|
+
A,
|
|
249
250
|
{
|
|
250
|
-
ref:
|
|
251
|
+
ref: c,
|
|
251
252
|
"data-slot": "alert-dialog-cancel",
|
|
252
253
|
[n]: "alert-dialog-cancel",
|
|
253
254
|
variant: t,
|
|
254
255
|
size: a,
|
|
255
256
|
destructive: o,
|
|
256
257
|
className: e,
|
|
257
|
-
...
|
|
258
|
+
...s
|
|
258
259
|
}
|
|
259
260
|
) });
|
|
260
261
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","sources":["../../../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { useAppearanceAttributes } from \"../appearance-boundary/appearance-boundary\"\nimport { useDensity } from \"../density-provider/density-provider\"\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport {\n Button,\n type ButtonProps,\n type ButtonSize,\n type ButtonVariant,\n} from \"../button/button\"\n\nconst useStyles = makeZenithStyles({\n overlay: {\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 50,\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n \"&[data-state='open']\": {\n animationName: {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n animationDuration: \"150ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n },\n \"&[data-state='closed']\": {\n animationName: {\n from: { opacity: 1 },\n to: { opacity: 0 },\n },\n animationDuration: \"100ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 1, 1)\",\n },\n },\n content: {\n backgroundColor: tokens.body,\n position: \"fixed\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n zIndex: 50,\n display: \"grid\",\n width: \"100%\",\n maxWidth: \"calc(100% - 2rem)\",\n ...shorthands.gap(tokens.spacingGroup2),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA1),\n ...shorthands.padding(tokens.spacingGroup2),\n // v1 shadow-lg\n boxShadow: \"0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a\",\n outlineStyle: \"none\",\n \"&[data-state='open']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: \"translate(-50%, -50%) scale(0.95)\",\n },\n to: {\n opacity: 1,\n transform: \"translate(-50%, -50%) scale(1)\",\n },\n },\n animationDuration: \"150ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n },\n \"&[data-state='closed']\": {\n animationName: {\n from: {\n opacity: 1,\n transform: \"translate(-50%, -50%) scale(1)\",\n },\n to: {\n opacity: 0,\n transform: \"translate(-50%, -50%) scale(0.95)\",\n },\n },\n animationDuration: \"100ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 1, 1)\",\n },\n },\n sm: {\n maxWidth: tokens.containerSm,\n },\n md: {\n maxWidth: tokens.containerMd,\n },\n lg: {\n maxWidth: tokens.containerLg,\n },\n xl: {\n \"@media (min-width: 640px)\": {\n maxWidth: tokens.containerXl,\n },\n },\n header: {\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingElement2),\n textAlign: \"left\",\n },\n footer: {\n display: \"flex\",\n ...shorthands.gap(tokens.spacingElement2),\n justifyContent: \"flex-end\",\n },\n title: {\n fontSize: tokens.textXl,\n lineHeight: tokens.leadingXl,\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.grayA12,\n },\n description: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA11,\n },\n})\n\nexport type AlertDialogProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Root\n>\n\nexport type AlertDialogTriggerProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Trigger\n>\n\nexport type AlertDialogPortalProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Portal\n>\n\nexport type AlertDialogOverlayProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Overlay\n>\n\nexport type AlertDialogSize = \"xl\" | \"lg\" | \"md\" | \"sm\"\n\nexport type AlertDialogContentProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Content\n> & {\n size?: AlertDialogSize\n}\n\nexport type AlertDialogHeaderProps = React.ComponentProps<\"div\">\nexport type AlertDialogFooterProps = React.ComponentProps<\"div\">\n\nexport type AlertDialogTitleProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Title\n>\n\nexport type AlertDialogDescriptionProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Description\n>\n\nexport type AlertDialogActionProps = Omit<\n ButtonProps,\n \"variant\" | \"size\" | \"destructive\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n destructive?: boolean\n}\n\nexport type AlertDialogCancelProps = Omit<\n ButtonProps,\n \"variant\" | \"size\" | \"destructive\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n destructive?: boolean\n}\n\nexport const AlertDialog = React.forwardRef<HTMLElement, AlertDialogProps>(\n function AlertDialog(props, _ref) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n }\n)\n\nexport const AlertDialogTrigger = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Trigger>,\n AlertDialogTriggerProps\n>(function AlertDialogTrigger({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Trigger\n ref={ref}\n data-slot=\"alert-dialog-trigger\"\n {...{ [SLOT_ATTR]: \"alert-dialog-trigger\" }}\n className={className}\n {...props}\n />\n )\n})\n\nexport const AlertDialogPortal = React.forwardRef<\n HTMLElement,\n AlertDialogPortalProps\n>(function AlertDialogPortal(props, _ref) {\n return (\n <AlertDialogPrimitive.Portal\n data-slot=\"alert-dialog-portal\"\n {...{ [SLOT_ATTR]: \"alert-dialog-portal\" }}\n {...props}\n />\n )\n})\n\nexport const AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n AlertDialogOverlayProps\n>(function AlertDialogOverlay({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n {...{ [SLOT_ATTR]: \"alert-dialog-overlay\" }}\n className={mergeClasses(styles.overlay, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(function AlertDialogContent(\n { className, size = \"xl\", children, ...props },\n ref\n) {\n const styles = useStyles()\n // DENSITY-SPEC.md §4.4 — portal content boundary; see dialog.tsx's identical comment.\n const override = useDensity()\n // SPEC.md §2 rule 3 — the same portal asymmetry, for the appearance pair: re-stamp the\n // nearest explicit AppearanceBoundary's mode+surface, or neither attribute when there is\n // none, leaving live shell inheritance in place.\n const appearance = useAppearanceAttributes()\n\n return (\n <>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n data-slot=\"alert-dialog-content\"\n {...{ [SLOT_ATTR]: \"alert-dialog-content\" }}\n {...(override !== undefined ? { \"data-density\": override } : {})}\n {...appearance}\n className={mergeClasses(styles.content, styles[size], className)}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Content>\n </>\n )\n})\n\nexport const AlertDialogHeader = React.forwardRef<\n HTMLDivElement,\n AlertDialogHeaderProps\n>(function AlertDialogHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"alert-dialog-header\"\n {...{ [SLOT_ATTR]: \"alert-dialog-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogFooter = React.forwardRef<\n HTMLDivElement,\n AlertDialogFooterProps\n>(function AlertDialogFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"alert-dialog-footer\"\n {...{ [SLOT_ATTR]: \"alert-dialog-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n AlertDialogTitleProps\n>(function AlertDialogTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n {...{ [SLOT_ATTR]: \"alert-dialog-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n AlertDialogDescriptionProps\n>(function AlertDialogDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n {...{ [SLOT_ATTR]: \"alert-dialog-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogAction = React.forwardRef<\n HTMLButtonElement,\n AlertDialogActionProps\n>(function AlertDialogAction(\n {\n variant = \"primary\",\n size = \"base\",\n destructive = false,\n className,\n ...props\n },\n ref\n) {\n return (\n <AlertDialogPrimitive.Action asChild>\n <Button\n ref={ref}\n data-slot=\"alert-dialog-action\"\n {...{ [SLOT_ATTR]: \"alert-dialog-action\" }}\n variant={variant}\n size={size}\n destructive={destructive}\n className={className}\n {...props}\n />\n </AlertDialogPrimitive.Action>\n )\n})\n\nexport const AlertDialogCancel = React.forwardRef<\n HTMLButtonElement,\n AlertDialogCancelProps\n>(function AlertDialogCancel(\n {\n variant = \"secondary\",\n size = \"base\",\n destructive = false,\n className,\n ...props\n },\n ref\n) {\n return (\n <AlertDialogPrimitive.Cancel asChild>\n <Button\n ref={ref}\n data-slot=\"alert-dialog-cancel\"\n {...{ [SLOT_ATTR]: \"alert-dialog-cancel\" }}\n variant={variant}\n size={size}\n destructive={destructive}\n className={className}\n {...props}\n />\n </AlertDialogPrimitive.Cancel>\n )\n})\n"],"names":["useStyles","makeZenithStyles","tokens.body","shorthands","tokens.spacingGroup2","tokens.radiusXl","tokens.grayA1","tokens.containerSm","tokens.containerMd","tokens.containerLg","tokens.containerXl","tokens.spacingElement2","tokens.textXl","tokens.leadingXl","tokens.fontWeightSemibold","tokens.grayA12","tokens.textSm","tokens.leadingSm","tokens.grayA11","AlertDialog","React","props","_ref","AlertDialogPrimitive.Root","AlertDialogTrigger","className","ref","jsx","AlertDialogPrimitive.Trigger","SLOT_ATTR","AlertDialogPortal","AlertDialogPrimitive.Portal","AlertDialogOverlay","styles","AlertDialogPrimitive.Overlay","mergeClasses","AlertDialogContent","size","children","override","useDensity","appearance","useAppearanceAttributes","jsxs","Fragment","AlertDialogPrimitive.Content","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogPrimitive.Title","AlertDialogDescription","AlertDialogPrimitive.Description","AlertDialogAction","variant","destructive","AlertDialogPrimitive.Action","Button","AlertDialogCancel","AlertDialogPrimitive.Cancel"],"mappings":";;;;;;;;;AAiBA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,SAAS;AAAA,IACP,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,wBAAwB;AAAA,MACtB,eAAe;AAAA,QACb,MAAM,EAAE,SAAS,EAAA;AAAA,QACjB,IAAI,EAAE,SAAS,EAAA;AAAA,MAAE;AAAA,MAEnB,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,IAAA;AAAA,IAE3B,0BAA0B;AAAA,MACxB,eAAe;AAAA,QACb,MAAM,EAAE,SAAS,EAAA;AAAA,QACjB,IAAI,EAAE,SAAS,EAAA;AAAA,MAAE;AAAA,MAEnB,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,IAAA;AAAA,EAC3B;AAAA,EAEF,SAAS;AAAA,IACP,iBAAiBC;AAAAA,IACjB,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,GAAGC,EAAW,IAAIC,CAAoB;AAAA,IACtC,GAAGD,EAAW,aAAaE,CAAe;AAAA,IAC1C,GAAGF,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,MAAAhB;AAAA,MACA,aAAAiB;AAAA,MACA,WAAA7B;AAAA,MACC,GAAGJ;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","sources":["../../../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\"\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { useAppearanceAttributes } from \"../appearance-boundary/appearance-boundary\"\nimport { useDensity } from \"../density-provider/density-provider\"\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\nimport {\n Button,\n type ButtonProps,\n type ButtonSize,\n type ButtonVariant,\n} from \"../button/button\"\n\nconst useStyles = makeZenithStyles({\n overlay: {\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n zIndex: 50,\n backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n \"&[data-state='open']\": {\n animationName: {\n from: { opacity: 0 },\n to: { opacity: 1 },\n },\n animationDuration: \"150ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n },\n \"&[data-state='closed']\": {\n animationName: {\n from: { opacity: 1 },\n to: { opacity: 0 },\n },\n animationDuration: \"100ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 1, 1)\",\n },\n },\n content: {\n backgroundColor: tokens.body,\n position: \"fixed\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n zIndex: 50,\n display: \"grid\",\n width: \"100%\",\n maxWidth: \"calc(100% - 2rem)\",\n ...shorthands.gap(tokens.spacingGroup2),\n ...shorthands.borderRadius(tokens.radiusXl),\n ...shorthands.border(\"1px\", \"solid\", tokens.grayA1),\n ...shorthands.padding(tokens.spacingGroup2),\n // v1 shadow-lg\n boxShadow: \"0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a\",\n outlineStyle: \"none\",\n \"&[data-state='open']\": {\n animationName: {\n from: {\n opacity: 0,\n transform: \"translate(-50%, -50%) scale(0.95)\",\n },\n to: {\n opacity: 1,\n transform: \"translate(-50%, -50%) scale(1)\",\n },\n },\n animationDuration: \"150ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 0.2, 1)\",\n },\n \"&[data-state='closed']\": {\n animationName: {\n from: {\n opacity: 1,\n transform: \"translate(-50%, -50%) scale(1)\",\n },\n to: {\n opacity: 0,\n transform: \"translate(-50%, -50%) scale(0.95)\",\n },\n },\n animationDuration: \"100ms\",\n animationTimingFunction: \"cubic-bezier(0.4, 0, 1, 1)\",\n },\n },\n sm: {\n maxWidth: tokens.containerSm,\n },\n md: {\n maxWidth: tokens.containerMd,\n },\n lg: {\n maxWidth: tokens.containerLg,\n },\n xl: {\n \"@media (min-width: 640px)\": {\n maxWidth: tokens.containerXl,\n },\n },\n header: {\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingElement2),\n textAlign: \"left\",\n },\n footer: {\n display: \"flex\",\n ...shorthands.gap(tokens.spacingElement2),\n justifyContent: \"flex-end\",\n },\n title: {\n fontSize: tokens.textXl,\n lineHeight: tokens.leadingXl,\n fontWeight: tokens.fontWeightSemibold,\n color: tokens.grayA12,\n },\n description: {\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA11,\n },\n})\n\nexport type AlertDialogProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Root\n>\n\nexport type AlertDialogTriggerProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Trigger\n>\n\nexport type AlertDialogPortalProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Portal\n>\n\nexport type AlertDialogOverlayProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Overlay\n>\n\nexport type AlertDialogSize = \"xl\" | \"lg\" | \"md\" | \"sm\"\n\nexport type AlertDialogContentProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Content\n> & {\n size?: AlertDialogSize\n}\n\nexport type AlertDialogHeaderProps = React.ComponentProps<\"div\">\nexport type AlertDialogFooterProps = React.ComponentProps<\"div\">\n\nexport type AlertDialogTitleProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Title\n>\n\nexport type AlertDialogDescriptionProps = React.ComponentProps<\n typeof AlertDialogPrimitive.Description\n>\n\nexport type AlertDialogActionProps = Omit<\n ButtonProps,\n \"variant\" | \"size\" | \"destructive\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n destructive?: boolean\n}\n\nexport type AlertDialogCancelProps = Omit<\n ButtonProps,\n \"variant\" | \"size\" | \"destructive\"\n> & {\n variant?: ButtonVariant\n size?: ButtonSize\n destructive?: boolean\n}\n\nexport const AlertDialog = React.forwardRef<HTMLElement, AlertDialogProps>(\n function AlertDialog(props, _ref) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />\n }\n)\n\nexport const AlertDialogTrigger = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Trigger>,\n AlertDialogTriggerProps\n>(function AlertDialogTrigger({ className, ...props }, ref) {\n return (\n <AlertDialogPrimitive.Trigger\n ref={ref}\n data-slot=\"alert-dialog-trigger\"\n {...{ [SLOT_ATTR]: \"alert-dialog-trigger\" }}\n className={className}\n {...props}\n />\n )\n})\n\nexport const AlertDialogPortal = React.forwardRef<\n HTMLElement,\n AlertDialogPortalProps\n>(function AlertDialogPortal(props, _ref) {\n return (\n <AlertDialogPrimitive.Portal\n data-slot=\"alert-dialog-portal\"\n {...{ [SLOT_ATTR]: \"alert-dialog-portal\" }}\n {...props}\n />\n )\n})\n\nexport const AlertDialogOverlay = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Overlay>,\n AlertDialogOverlayProps\n>(function AlertDialogOverlay({ className, ...props }, ref) {\n const styles = useStyles()\n // The overlay is portalled too, so it re-stamps the boundary's appearance like the content (#8).\n const appearance = useAppearanceAttributes()\n\n return (\n <AlertDialogPrimitive.Overlay\n ref={ref}\n data-slot=\"alert-dialog-overlay\"\n {...{ [SLOT_ATTR]: \"alert-dialog-overlay\" }}\n {...appearance}\n className={mergeClasses(styles.overlay, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogContent = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Content>,\n AlertDialogContentProps\n>(function AlertDialogContent(\n { className, size = \"xl\", children, ...props },\n ref\n) {\n const styles = useStyles()\n // DENSITY-SPEC.md §4.4 — portal content boundary; see dialog.tsx's identical comment.\n const override = useDensity()\n // SPEC.md §2 rule 3 — the same portal asymmetry, for the appearance pair: re-stamp the\n // nearest explicit AppearanceBoundary's mode+surface, or neither attribute when there is\n // none, leaving live shell inheritance in place.\n const appearance = useAppearanceAttributes()\n\n return (\n <>\n <AlertDialogOverlay />\n <AlertDialogPrimitive.Content\n ref={ref}\n data-slot=\"alert-dialog-content\"\n {...{ [SLOT_ATTR]: \"alert-dialog-content\" }}\n {...(override !== undefined ? { \"data-density\": override } : {})}\n {...appearance}\n className={mergeClasses(styles.content, styles[size], className)}\n {...props}\n >\n {children}\n </AlertDialogPrimitive.Content>\n </>\n )\n})\n\nexport const AlertDialogHeader = React.forwardRef<\n HTMLDivElement,\n AlertDialogHeaderProps\n>(function AlertDialogHeader({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"alert-dialog-header\"\n {...{ [SLOT_ATTR]: \"alert-dialog-header\" }}\n className={mergeClasses(styles.header, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogFooter = React.forwardRef<\n HTMLDivElement,\n AlertDialogFooterProps\n>(function AlertDialogFooter({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"alert-dialog-footer\"\n {...{ [SLOT_ATTR]: \"alert-dialog-footer\" }}\n className={mergeClasses(styles.footer, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogTitle = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Title>,\n AlertDialogTitleProps\n>(function AlertDialogTitle({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <AlertDialogPrimitive.Title\n ref={ref}\n data-slot=\"alert-dialog-title\"\n {...{ [SLOT_ATTR]: \"alert-dialog-title\" }}\n className={mergeClasses(styles.title, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogDescription = React.forwardRef<\n React.ElementRef<typeof AlertDialogPrimitive.Description>,\n AlertDialogDescriptionProps\n>(function AlertDialogDescription({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <AlertDialogPrimitive.Description\n ref={ref}\n data-slot=\"alert-dialog-description\"\n {...{ [SLOT_ATTR]: \"alert-dialog-description\" }}\n className={mergeClasses(styles.description, className)}\n {...props}\n />\n )\n})\n\nexport const AlertDialogAction = React.forwardRef<\n HTMLButtonElement,\n AlertDialogActionProps\n>(function AlertDialogAction(\n {\n variant = \"primary\",\n size = \"base\",\n destructive = false,\n className,\n ...props\n },\n ref\n) {\n return (\n <AlertDialogPrimitive.Action asChild>\n <Button\n ref={ref}\n data-slot=\"alert-dialog-action\"\n {...{ [SLOT_ATTR]: \"alert-dialog-action\" }}\n variant={variant}\n size={size}\n destructive={destructive}\n className={className}\n {...props}\n />\n </AlertDialogPrimitive.Action>\n )\n})\n\nexport const AlertDialogCancel = React.forwardRef<\n HTMLButtonElement,\n AlertDialogCancelProps\n>(function AlertDialogCancel(\n {\n variant = \"secondary\",\n size = \"base\",\n destructive = false,\n className,\n ...props\n },\n ref\n) {\n return (\n <AlertDialogPrimitive.Cancel asChild>\n <Button\n ref={ref}\n data-slot=\"alert-dialog-cancel\"\n {...{ [SLOT_ATTR]: \"alert-dialog-cancel\" }}\n variant={variant}\n size={size}\n destructive={destructive}\n className={className}\n {...props}\n />\n </AlertDialogPrimitive.Cancel>\n )\n})\n"],"names":["useStyles","makeZenithStyles","tokens.body","shorthands","tokens.spacingGroup2","tokens.radiusXl","tokens.grayA1","tokens.containerSm","tokens.containerMd","tokens.containerLg","tokens.containerXl","tokens.spacingElement2","tokens.textXl","tokens.leadingXl","tokens.fontWeightSemibold","tokens.grayA12","tokens.textSm","tokens.leadingSm","tokens.grayA11","AlertDialog","React","props","_ref","AlertDialogPrimitive.Root","AlertDialogTrigger","className","ref","jsx","AlertDialogPrimitive.Trigger","SLOT_ATTR","AlertDialogPortal","AlertDialogPrimitive.Portal","AlertDialogOverlay","styles","appearance","useAppearanceAttributes","AlertDialogPrimitive.Overlay","mergeClasses","AlertDialogContent","size","children","override","useDensity","jsxs","Fragment","AlertDialogPrimitive.Content","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogPrimitive.Title","AlertDialogDescription","AlertDialogPrimitive.Description","AlertDialogAction","variant","destructive","AlertDialogPrimitive.Action","Button","AlertDialogCancel","AlertDialogPrimitive.Cancel"],"mappings":";;;;;;;;;AAiBA,MAAMA,IAAYC,EAAiB;AAAA,EACjC,SAAS;AAAA,IACP,UAAU;AAAA,IACV,KAAK;AAAA,IACL,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,iBAAiB;AAAA,IACjB,wBAAwB;AAAA,MACtB,eAAe;AAAA,QACb,MAAM,EAAE,SAAS,EAAA;AAAA,QACjB,IAAI,EAAE,SAAS,EAAA;AAAA,MAAE;AAAA,MAEnB,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,IAAA;AAAA,IAE3B,0BAA0B;AAAA,MACxB,eAAe;AAAA,QACb,MAAM,EAAE,SAAS,EAAA;AAAA,QACjB,IAAI,EAAE,SAAS,EAAA;AAAA,MAAE;AAAA,MAEnB,mBAAmB;AAAA,MACnB,yBAAyB;AAAA,IAAA;AAAA,EAC3B;AAAA,EAEF,SAAS;AAAA,IACP,iBAAiBC;AAAAA,IACjB,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,WAAW;AAAA,IACX,QAAQ;AAAA,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,SACE,gBAAAC,EAAC+B,GAAA,EAA4B,SAAO,IAClC,UAAA,gBAAA/B;AAAA,IAAC6B;AAAA,IAAA;AAAA,MACC,KAAA9B;AAAA,MACA,aAAU;AAAA,MACJ,CAACG,CAAS,GAAG;AAAA,MACnB,SAAAwB;AAAA,MACA,MAAAd;AAAA,MACA,aAAAe;AAAA,MACA,WAAA7B;AAAA,MACC,GAAGJ;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ,CAAC;"}
|
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
), p = m ? /* @__PURE__ */ o(
|
|
19
|
-
f,
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { mergeClasses as v, SLOT_ATTR as y } from "@epilot/zenith-runtime/v1";
|
|
4
|
+
import { makeZenithStyles as h } from "../../styles/make-styles.js";
|
|
5
|
+
import { body as b } from "../../tokens/index.js";
|
|
6
|
+
import { ComposeAsChild as S } from "../slot/compose-as-child.js";
|
|
7
|
+
const g = ["light", "dark"], x = ["flat", "bordered"], N = (e) => ({
|
|
8
|
+
mode: g.includes(e.mode) ? e.mode : "light",
|
|
9
|
+
surface: x.includes(e.surface) ? e.surface : "flat"
|
|
10
|
+
}), p = o.createContext(void 0), O = h({
|
|
11
|
+
canvas: { backgroundColor: b }
|
|
12
|
+
}), B = o.forwardRef(function({ mode: r, surface: c, asChild: l = !1, className: n, children: d, ...m }, u) {
|
|
13
|
+
const a = o.useMemo(
|
|
14
|
+
() => N({ mode: r, surface: c }),
|
|
15
|
+
[r, c]
|
|
16
|
+
), t = i(), A = O(), f = (t == null ? void 0 : t.mode) === a.mode ? n : v(A.canvas, n), C = l ? /* @__PURE__ */ s(
|
|
17
|
+
S,
|
|
20
18
|
{
|
|
21
|
-
...
|
|
19
|
+
...m,
|
|
22
20
|
ref: u,
|
|
23
|
-
className:
|
|
21
|
+
className: f,
|
|
24
22
|
forceProps: { "data-theme": a.mode, "data-surface": a.surface },
|
|
25
23
|
"data-theme": a.mode,
|
|
26
24
|
"data-surface": a.surface,
|
|
27
|
-
children:
|
|
25
|
+
children: d
|
|
28
26
|
}
|
|
29
|
-
) : /* @__PURE__ */
|
|
27
|
+
) : /* @__PURE__ */ s(
|
|
30
28
|
"div",
|
|
31
29
|
{
|
|
32
30
|
ref: u,
|
|
33
31
|
"data-slot": "appearance-boundary",
|
|
34
|
-
[
|
|
35
|
-
className:
|
|
36
|
-
...
|
|
32
|
+
[y]: "appearance-boundary",
|
|
33
|
+
className: f,
|
|
34
|
+
...m,
|
|
37
35
|
"data-theme": a.mode,
|
|
38
36
|
"data-surface": a.surface,
|
|
39
|
-
children:
|
|
37
|
+
children: d
|
|
40
38
|
}
|
|
41
39
|
);
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
}),
|
|
44
|
-
const e =
|
|
40
|
+
return /* @__PURE__ */ s(p.Provider, { value: a, children: C });
|
|
41
|
+
}), i = () => o.useContext(p), E = () => {
|
|
42
|
+
const e = i();
|
|
45
43
|
return e === void 0 ? {} : { "data-theme": e.mode, "data-surface": e.surface };
|
|
46
44
|
};
|
|
47
45
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
B as AppearanceBoundary,
|
|
47
|
+
N as canonicalAppearance,
|
|
48
|
+
i as useAppearance,
|
|
49
|
+
E as useAppearanceAttributes
|
|
52
50
|
};
|
|
53
51
|
//# sourceMappingURL=appearance-boundary.js.map
|
|
@@ -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\nexport type AppearanceMode = \"light\" | \"dark\"\n\
|
|
1
|
+
{"version":3,"file":"appearance-boundary.js","sources":["../../../src/components/appearance-boundary/appearance-boundary.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport * as tokens from \"../../tokens\"\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\n/**\n * Reduced from five to two on 2026-09-17: `glass`, `tint` and `card` were removed and `plain`\n * was renamed `flat`. `flat` is the root anchor, `bordered` the inheritance base (SPEC §2 rule 3).\n */\nexport type AppearanceSurface = \"flat\" | \"bordered\"\n\nexport type Appearance = {\n mode: AppearanceMode\n surface: AppearanceSurface\n}\n\nconst CANONICAL_MODES: readonly AppearanceMode[] = [\"light\", \"dark\"]\nconst CANONICAL_SURFACES: readonly AppearanceSurface[] = [\"flat\", \"bordered\"]\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 : \"flat\",\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\n/**\n * A mode is a canvas, so a region that restates one has to paint it. `flat` leaves\n * `surface.object` transparent, which means a boundary that only stamped the attributes let the\n * page behind it show through: a `mode=\"light\"` region on a dark page rendered light ink onto the\n * dark page at 1.08:1. Painting `body` is what makes \"regardless of the page's\" true.\n *\n * Skipped when the nearest ancestor boundary already declares this mode, so restating a mode\n * inside a region that has one stays transparent and composes as before.\n */\nconst useCanvasStyles = makeZenithStyles({\n canvas: { backgroundColor: tokens.body },\n})\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 inherited = useAppearance()\n const styles = useCanvasStyles()\n const merged =\n inherited?.mode === value.mode\n ? className\n : mergeClasses(styles.canvas, className)\n\n const content = asChild ? (\n <ComposeAsChild\n {...props}\n ref={ref}\n className={merged}\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={merged}\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","useCanvasStyles","makeZenithStyles","tokens.body","AppearanceBoundary","mode","surface","asChild","className","children","props","ref","value","inherited","useAppearance","styles","merged","mergeClasses","content","jsx","ComposeAsChild","SLOT_ATTR","useAppearanceAttributes"],"mappings":";;;;;;AA2BA,MAAMA,IAA6C,CAAC,SAAS,MAAM,GAC7DC,IAAmD,CAAC,QAAQ,UAAU,GAG/DC,IAAsB,CAACC,OAAwC;AAAA,EAC1E,MAAMH,EAAgB,SAASG,EA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WD,CAAiB,GAQvBuB,IAA0B,MAGlC;AACH,QAAMxB,IAAagB,EAAA;AACnB,SAAOhB,MAAe,SAClB,CAAA,IACA,EAAE,cAAcA,EAAW,MAAM,gBAAgBA,EAAW,QAAA;AAClE;"}
|
|
@@ -31,7 +31,7 @@ const X = [
|
|
|
31
31
|
"bronze"
|
|
32
32
|
], o = "--zenith-badge-bg", a = "--zenith-badge-fg", s = "--zenith-badge-bd", m = (e) => e === "neutral" ? "gray" : e, d = (e) => I(e) ? W : E, n = (e, r) => {
|
|
33
33
|
const t = m(e);
|
|
34
|
-
return `var(--zenith-${d(t)}
|
|
34
|
+
return `var(--zenith-${d(t)}-${t}-${r})`;
|
|
35
35
|
}, F = (e, r) => {
|
|
36
36
|
const t = m(e);
|
|
37
37
|
return `var(--zenith-${d(t)}-${t}-${r})`;
|
|
@@ -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\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)}
|
|
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)}-${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,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,GAO3BC,IAAe,CAACC,MACpBC,EAAaD,CAAM,IAAIE,IAAKC,GAExBC,IAAW,CAACN,GAAmBO,MAAyB;AAC5D,QAAML,IAASH,EAAaC,CAAK;AACjC,SAAO,gBAAgBC,EAAaC,CAAM,CAAC,IAAIA,CAAM,IAAIK,CAAI;AAC/D,GACMC,IAAY,CAACR,GAAmBS,MAA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