@antadesign/anta 0.3.6 → 0.3.7

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.
@@ -0,0 +1,86 @@
1
+ import type { BaseProps } from "../general_types";
2
+ export interface CardProps extends BaseProps {
3
+ /** Header content, rendered in the top zone with the default title
4
+ * typography. A string is respected as-is; pass a `<Title>` (or `<h2>`–`<h6>`)
5
+ * for real heading semantics in the document outline. Omit for no header. */
6
+ header?: React.ReactNode;
7
+ /** Footer content, usually action buttons. Rendered as a **left-aligned** row
8
+ * (wraps under pressure) — the opposite of `Dialog`'s right-aligned footer. */
9
+ footer?: React.ReactNode;
10
+ /** Controls rendered at the top-right of the header row, OUTSIDE the header
11
+ * (e.g. a "more" button, a tag) — the same slot as `Expander`'s `actions`. */
12
+ actions?: React.ReactNode;
13
+ /** Media (image, illustration) rendered full-bleed to the card edge, clipped to
14
+ * its corners. Position it with `mediaPosition`. */
15
+ media?: React.ReactNode;
16
+ /** Which edge the `media` bleeds to.
17
+ * @defaultValue 'top' */
18
+ mediaPosition?: "top" | "bottom" | "left" | "right";
19
+ /** The card body. A string renders with the default `<Text>`-like typography;
20
+ * scopes the color hierarchy for any nested content. */
21
+ children?: React.ReactNode;
22
+ /** Semantic tone, or any literal CSS color (`'#ff1493'`, `'rebeccapurple'`) for
23
+ * a one-off custom tone. Named tones re-point the surface + text; a custom
24
+ * color keeps its hue while lightness/chroma are pinned. `'neutral'` (the
25
+ * default) is the same as omitting it.
26
+ * @defaultValue 'neutral' */
27
+ tone?: "neutral" | "brand" | "info" | "success" | "warning" | "critical" | (string & {});
28
+ /** Surface emphasis. `primary` (the default) is a clean sheet; `secondary` is a
29
+ * subtle fill; `tertiary` is a frosted, semi-transparent panel with a backdrop
30
+ * blur.
31
+ * @defaultValue 'primary' */
32
+ priority?: "primary" | "secondary" | "tertiary";
33
+ /** Size variant — scales the padding.
34
+ * @defaultValue 'medium' */
35
+ size?: "small" | "medium" | "large";
36
+ /** Selected / chosen state — draws an inset ring in the tone color, for
37
+ * choice-card / plan-picker patterns. */
38
+ selected?: boolean;
39
+ /** Loading state — dims the card with a skeleton pulse, sets `aria-busy`, and (in
40
+ * link mode) blocks navigation. */
41
+ loading?: boolean;
42
+ /** Fully-round corners (`border-radius: 999px`, clamped to the box). Pass a
43
+ * `number` (px) or a CSS length string (`'1rem'`) for a custom radius. Omit for
44
+ * the default `--card-radius`. */
45
+ round?: boolean | number | string;
46
+ /** Turn the whole card into a link. The card renders a focusable anchor and its
47
+ * accessible name comes from `header` → body → this URL (override with
48
+ * `aria-label`). A link card is display content — don't nest interactive
49
+ * controls inside it. */
50
+ href?: string;
51
+ /** Anchor target (only with `href`). */
52
+ target?: string;
53
+ /** Anchor rel (only with `href`). */
54
+ rel?: string;
55
+ /** Space-separated URLs the browser pings on navigation (only with `href`). */
56
+ ping?: string;
57
+ }
58
+ /**
59
+ * A surface container: a bordered, toned box laying out an optional `media`
60
+ * region plus a `header` / body / `footer` stack. Pass `href` to turn the whole
61
+ * card into a link.
62
+ *
63
+ * Renders an `<a-card>` web component. A pure, stateless pass-through — the
64
+ * element owns layout, the link, and the accessible name — so the wrapper only
65
+ * maps props to attributes and projects content into the `media` / `header` /
66
+ * `actions` / body / `footer` slots. Header / body / footer are respected as
67
+ * passed; the element supplies their default typography.
68
+ *
69
+ * Requires `@antadesign/anta/elements` to be imported (client-side only) to
70
+ * register the underlying custom element.
71
+ *
72
+ * @example Basic usage
73
+ * ```tsx
74
+ * <Card header="Deployment ready" footer={<Button priority="primary" label="Deploy" />}>
75
+ * Your build passed all checks and is ready to ship.
76
+ * </Card>
77
+ * ```
78
+ *
79
+ * @example Link card
80
+ * ```tsx
81
+ * <Card href="/docs/ci" header="CI integration guide">
82
+ * Wire Antithesis into your pipeline in a few minutes.
83
+ * </Card>
84
+ * ```
85
+ */
86
+ export declare const Card: ({ header, footer, actions, media, mediaPosition, tone, priority, size, selected, loading, round, href, target, rel, ping, className, style, children, ...rest }: CardProps) => any;
@@ -0,0 +1,72 @@
1
+ import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
2
+ import { toneStyle, roundStyle } from "../anta_helpers";
3
+ const Card = ({
4
+ header,
5
+ footer,
6
+ actions,
7
+ media,
8
+ mediaPosition,
9
+ tone,
10
+ priority,
11
+ size,
12
+ selected,
13
+ loading,
14
+ round,
15
+ href,
16
+ target,
17
+ rel,
18
+ ping,
19
+ className,
20
+ style,
21
+ children,
22
+ ...rest
23
+ }) => {
24
+ const toneAttr = tone || void 0;
25
+ const computedStyle = roundStyle(
26
+ round,
27
+ "--card-round",
28
+ toneStyle(toneAttr, "--card-tone-source", style)
29
+ );
30
+ return /* @__PURE__ */ jsxs(
31
+ "a-card",
32
+ {
33
+ tone: toneAttr,
34
+ priority: priority && priority !== "primary" ? priority : void 0,
35
+ size: size && size !== "medium" ? size : void 0,
36
+ "media-position": mediaPosition && mediaPosition !== "top" ? mediaPosition : void 0,
37
+ selected: selected ? "" : void 0,
38
+ loading: loading ? "" : void 0,
39
+ round: round ? "" : void 0,
40
+ href,
41
+ target: href ? target : void 0,
42
+ rel: href ? rel : void 0,
43
+ ping: href ? ping : void 0,
44
+ class: className,
45
+ style: computedStyle,
46
+ ...rest,
47
+ children: [
48
+ media != null && /* @__PURE__ */ jsx("div", { slot: "media", children: media }),
49
+ header != null && // A plain-string (or number) header imitates a `<Title>`: the element's
50
+ // header slot supplies the level-4 type scale, and this div adds the
51
+ // matching 8px bottom padding (inside the box — no margin-collapse). A
52
+ // *node* header brings its own margin (a slotted `<Title>` keeps its
53
+ // bottom margin; the element zeroes only the top), so it gets no wrapper
54
+ // padding — otherwise the gap would double.
55
+ /* @__PURE__ */ jsx(
56
+ "div",
57
+ {
58
+ slot: "header",
59
+ style: typeof header === "string" || typeof header === "number" ? { paddingBlockEnd: "8px" } : void 0,
60
+ children: header
61
+ }
62
+ ),
63
+ actions != null && /* @__PURE__ */ jsx("span", { slot: "actions", style: { display: "contents" }, children: actions }),
64
+ children,
65
+ footer != null && /* @__PURE__ */ jsx("span", { slot: "footer", style: { display: "contents" }, children: footer })
66
+ ]
67
+ }
68
+ );
69
+ };
70
+ export {
71
+ Card
72
+ };
@@ -136,9 +136,8 @@ const InputDate = ({
136
136
  },
137
137
  onChange: (e) => resolve(e.currentTarget.value),
138
138
  onKeyDown: (e) => {
139
- if (e.key === "ArrowDown" && !disabled) {
139
+ if ((e.key === "ArrowDown" || e.key === "ArrowUp") && !disabled) {
140
140
  e.preventDefault();
141
- if (!open) e.currentTarget.click();
142
141
  setFocusNonce((n) => n + 1);
143
142
  }
144
143
  if (e.key === "Enter" && !disabled) {
@@ -254,12 +254,6 @@ const Select = (props) => {
254
254
  round,
255
255
  "aria-haspopup": "menu",
256
256
  "aria-expanded": open ? "true" : "false",
257
- onKeyDown: (e) => {
258
- if (!open && (e.key === "Enter" || e.key === " " || e.key === "ArrowDown")) {
259
- e.preventDefault();
260
- e.currentTarget.click();
261
- }
262
- },
263
257
  trailing: (
264
258
  // Chevron rotates down → up when open (spacing + rotation in the CSS
265
259
  // module, matching the Input "Select dropdown" example).
@@ -0,0 +1,211 @@
1
+ @layer anta {
2
+ /* Host + token definitions for <a-card>. The visible box lives here (not in the
3
+ shadow) so plain consumer CSS overrides it and it paints before the element
4
+ upgrades; the shadow <style> owns layout + region typography and only
5
+ REFERENCES these --card-* tokens with literal fallbacks. Named tones use
6
+ Anta's theme-aware role tokens, so dark mode is mostly free (same as
7
+ <a-expander> / <a-tag>); only the custom-tone branch needs a .dark re-tune. */
8
+
9
+ a-card {
10
+ /* Text roles: title = the strong foreground, text = the body (a step softer). */
11
+ --card-title: var(--text-1);
12
+ --card-text: var(--text-2);
13
+
14
+ /* Surface pairs per priority. `primary` (the default) is a clean sheet —
15
+ bg-1 in light, bg-4 in dark (see the `.dark` neutral rule), and
16
+ bg-4-{tone} for a toned card; `secondary` is a subtle fill (bg-2);
17
+ `tertiary` is a frosted panel (the primary surface, semi-transparent, +
18
+ a backdrop blur — see below). */
19
+ --card-bg-secondary: var(--bg-2);
20
+ --card-bg-primary: var(--bg-1);
21
+
22
+ /* `primary` is the default surface. */
23
+ --card-bg: var(--card-bg-primary);
24
+ /* Neutral edge hairline: text-2 at 10% (via --card-text). Toned cards override
25
+ this with their border-4-{tone} in the tone rules below. Flat across
26
+ priorities. */
27
+ --card-border: color-mix(in oklch, var(--card-text) 10%, transparent);
28
+
29
+ /* Selected ring (a 2px inset stroke) — the tone's strongest border. */
30
+ --card-selected-ring: var(--border-1);
31
+
32
+ /* Closed-surface hover lift for link cards: an oklch lightness bump that keeps
33
+ hue + chroma, so it works for every priority and tone in light and dark
34
+ (a transparent tertiary surface keeps zero alpha). Tune the amount here. */
35
+ --card-bg-hover-lift: 0.01;
36
+
37
+ --card-radius: 8px;
38
+ --card-padding: 16px;
39
+
40
+ display: block;
41
+ box-sizing: border-box;
42
+ /* Fill the container (grid cell / flex item / block) so width is always
43
+ definite. This is also what keeps `container-type` below from collapsing
44
+ the card to zero width in a shrink-to-fit context (a query container can't
45
+ size to its own content). Same as <a-expander>. */
46
+ width: 100%;
47
+ /* Establish the card as a query container so both the shadow layout and
48
+ consumer slotted content can `@container card (…)` on its width. */
49
+ container-type: inline-size;
50
+ container-name: card;
51
+
52
+ color: var(--card-text);
53
+ background: var(--card-bg);
54
+ /* The edge is a 1px OUTSET shadow ring (spread 1px, no blur), not a border:
55
+ it sits outside the box so full-bleed media reaches the very edge (no 1px
56
+ border inset) and it never adds to layout. `overflow: clip` doesn't clip an
57
+ element's own outset shadow, so the ring shows while the media still clips
58
+ to the rounded corners. */
59
+ box-shadow: 0 0 0 1px var(--card-border);
60
+ border-radius: var(--card-radius);
61
+ /* Clip full-bleed media to the rounded corners. */
62
+ overflow: clip;
63
+ }
64
+
65
+ a-card[priority="secondary"] {
66
+ --card-bg: var(--card-bg-secondary);
67
+ }
68
+
69
+ /* `round` re-points --card-radius, so both the host clip-radius and the shadow
70
+ container's ring follow. Bare `round` → 999px (fully round, clamped to the
71
+ box); a length (`round="16px"`, or the wrapper's `round={16}` → inline
72
+ --card-round) sets a custom radius. The typed attr() covers raw-HTML authors. */
73
+ a-card[round] {
74
+ --card-round: attr(round type(<length>));
75
+ --card-radius: var(--card-round, 999px);
76
+ }
77
+ a-card[priority="tertiary"] {
78
+ /* Frosted glass: the primary surface at 1% over a backdrop blur, so the card
79
+ reads over busy / colored / image backgrounds. It keeps the same hairline
80
+ ring as the other priorities (no --card-border override). The blur only
81
+ shows where there's detail behind it; the translucency reads everywhere. */
82
+ --card-bg: color-mix(in oklch, var(--card-bg-primary) 1%, transparent);
83
+ backdrop-filter: blur(8px);
84
+ -webkit-backdrop-filter: blur(8px);
85
+ }
86
+
87
+ /* Neutral dark: bg-1 (primary's light surface) is pure black in dark mode, so
88
+ step neutral primary up to bg-4. Secondary stays bg-2 via its token, and a
89
+ toned card's --bg-*-{tone} tokens self-flip, so this is scoped to neutral. */
90
+ .dark a-card:not([tone]),
91
+ .dark a-card[tone="neutral"] {
92
+ --card-bg-primary: var(--bg-4);
93
+ }
94
+
95
+ /* Hover lift, link cards only — gated so it doesn't stick after a tap. */
96
+ @media (hover: hover) and (pointer: fine) {
97
+ a-card[href]:not([loading]):hover {
98
+ background: oklch(from var(--card-bg) calc(l + var(--card-bg-hover-lift)) c h);
99
+ }
100
+ }
101
+
102
+ /* Pre-upgrade skeleton: the host border / background / radius already paint
103
+ (they're defined here, not in the shadow), so only the content inset is
104
+ missing before the shadow's .content exists — supply it here, then the
105
+ shadow owns padding once :defined. */
106
+ a-card:not(:defined) {
107
+ padding: var(--card-padding);
108
+ }
109
+
110
+ /* A slotted heading node — <a-title> (any level) or a raw <h1>–<h6> — carries a
111
+ document TOP margin (Title level 4 is 20px) that would add a leading gap in the
112
+ header; zero it. The BOTTOM margin stays, so a heading header keeps its gap to
113
+ the body. (A plain-STRING header has no margin of its own, so the `<Card>`
114
+ wrapper wraps it in a div with the matching 8px bottom margin — CSS can't tell
115
+ a string from a styled node, so that split lives in the wrapper.) Specificity
116
+ is bumped past `a-title[level="N"]` (0,1,1) and the reset's `hN` (0,0,1);
117
+ `@layer anta` keeps it overridable by un-layered CSS. */
118
+ a-card :is(h1, h2, h3, h4, h5, h6),
119
+ a-card a-title[level] {
120
+ margin-block-start: 0;
121
+ }
122
+
123
+ /* Named tones — re-point the text roles + the per-priority surface pairs to the
124
+ matching theme tokens (which self-flip for dark mode). */
125
+ a-card[tone="brand"] {
126
+ --card-title: var(--text-1-brand);
127
+ --card-text: var(--text-2-brand);
128
+ --card-bg-secondary: var(--bg-2-brand);
129
+ --card-bg-primary: var(--bg-4-brand);
130
+ --card-border: var(--border-4-brand);
131
+ --card-selected-ring: var(--border-1-brand);
132
+ }
133
+ a-card[tone="info"] {
134
+ --card-title: var(--text-1-info);
135
+ --card-text: var(--text-2-info);
136
+ --card-bg-secondary: var(--bg-2-info);
137
+ --card-bg-primary: var(--bg-4-info);
138
+ --card-border: var(--border-4-info);
139
+ --card-selected-ring: var(--border-1-info);
140
+ }
141
+ a-card[tone="success"] {
142
+ --card-title: var(--text-1-success);
143
+ --card-text: var(--text-2-success);
144
+ --card-bg-secondary: var(--bg-2-success);
145
+ --card-bg-primary: var(--bg-4-success);
146
+ --card-border: var(--border-4-success);
147
+ --card-selected-ring: var(--border-1-success);
148
+ }
149
+ a-card[tone="warning"] {
150
+ --card-title: var(--text-1-warning);
151
+ --card-text: var(--text-2-warning);
152
+ --card-bg-secondary: var(--bg-2-warning);
153
+ --card-bg-primary: var(--bg-4-warning);
154
+ --card-border: var(--border-4-warning);
155
+ --card-selected-ring: var(--border-1-warning);
156
+ }
157
+ a-card[tone="critical"] {
158
+ --card-title: var(--text-1-critical);
159
+ --card-text: var(--text-2-critical);
160
+ --card-bg-secondary: var(--bg-2-critical);
161
+ --card-bg-primary: var(--bg-4-critical);
162
+ --card-border: var(--border-4-critical);
163
+ --card-selected-ring: var(--border-1-critical);
164
+ }
165
+
166
+ /* Custom tone — any non-named `tone` value keeps the source hue while
167
+ lightness/chroma are pinned per token in oklch, the <a-expander> mechanism.
168
+ The JSX wrapper writes --card-tone-source inline; the typed attr() fallback
169
+ picks up raw <a-card tone="…"> on engines that support it. */
170
+ a-card[tone]:not(
171
+ [tone="neutral"],
172
+ [tone="brand"],
173
+ [tone="info"],
174
+ [tone="success"],
175
+ [tone="warning"],
176
+ [tone="critical"]
177
+ ) {
178
+ --card-tone-source: attr(tone type(<color>), currentColor);
179
+
180
+ --card-text: oklch(from var(--card-tone-source) 0.41 0.15 h);
181
+ --card-title: oklch(from var(--card-tone-source) 0.33 0.15 h);
182
+ --card-bg-secondary: oklch(from var(--card-tone-source) 0.99 0.006 h);
183
+ --card-bg-primary: oklch(from var(--card-tone-source) 0.955 0.02 h);
184
+ --card-border: oklch(from var(--card-tone-source) 0.895 0.045 h);
185
+ --card-selected-ring: oklch(from var(--card-tone-source) 0.6 0.15 h);
186
+ }
187
+
188
+ .dark a-card[tone]:not(
189
+ [tone="neutral"],
190
+ [tone="brand"],
191
+ [tone="info"],
192
+ [tone="success"],
193
+ [tone="warning"],
194
+ [tone="critical"]
195
+ ) {
196
+ --card-text: oklch(from var(--card-tone-source) 0.75 0.11 h);
197
+ --card-title: oklch(from var(--card-tone-source) 0.82 0.10 h);
198
+ --card-bg-secondary: oklch(from var(--card-tone-source) 0.13 0.02 h);
199
+ --card-bg-primary: oklch(from var(--card-tone-source) 0.19 0.04 h);
200
+ --card-border: oklch(from var(--card-tone-source) 0.26 0.07 h);
201
+ --card-selected-ring: oklch(from var(--card-tone-source) 0.7 0.13 h);
202
+ }
203
+
204
+ /* Size — padding scale (medium is the default, set on the base rule). */
205
+ a-card[size="small"] {
206
+ --card-padding: 12px;
207
+ }
208
+ a-card[size="large"] {
209
+ --card-padding: 20px;
210
+ }
211
+ }
@@ -0,0 +1,10 @@
1
+ import { HTMLElementBase } from '../anta_helpers';
2
+ import './a-card.css';
3
+ export declare class ACardElement extends HTMLElementBase {
4
+ #private;
5
+ static observedAttributes: string[];
6
+ constructor();
7
+ connectedCallback(): void;
8
+ attributeChangedCallback(): void;
9
+ }
10
+ export declare function register_a_card(): void;
@@ -0,0 +1,213 @@
1
+ import { HTMLElementBase } from "../anta_helpers";
2
+ import "./a-card.css";
3
+ const SHADOW_STYLE = `
4
+ .container {
5
+ display: flex;
6
+ flex-direction: column;
7
+ box-sizing: border-box;
8
+ width: 100%;
9
+ height: 100%;
10
+ min-width: 0;
11
+ color: inherit;
12
+ text-decoration: none;
13
+ cursor: default;
14
+ border-radius: var(--card-radius, 8px);
15
+ -webkit-user-drag: none;
16
+ }
17
+ :host([media-position="bottom"]) .container { flex-direction: column-reverse; }
18
+ :host([media-position="left"]) .container { flex-direction: row; }
19
+ :host([media-position="right"]) .container { flex-direction: row-reverse; }
20
+
21
+ :host([href]) .container { user-select: none; }
22
+ :host([href]:not([loading])) .container { cursor: pointer; }
23
+
24
+ .container:focus-visible {
25
+ outline: none;
26
+ box-shadow: inset 0 0 0 1px transparent, inset 0 0 0 2px var(--focus-ring);
27
+ }
28
+
29
+ [part="media"] { display: none; }
30
+ [part="media"].has-content { display: block; }
31
+ :host([media-position="left"]) [part="media"].has-content,
32
+ :host([media-position="right"]) [part="media"].has-content { flex: none; }
33
+
34
+ .content {
35
+ display: flex;
36
+ flex-direction: column;
37
+ flex: 1 1 auto;
38
+ min-width: 0;
39
+ min-height: 0;
40
+ padding: var(--card-padding, 16px);
41
+ }
42
+
43
+ .header-row { display: none; }
44
+ .header-row.has-content {
45
+ display: flex;
46
+ align-items: flex-start;
47
+ gap: 8px;
48
+ }
49
+
50
+ slot[name="header"] { display: none; }
51
+ slot[name="header"].has-content {
52
+ display: block;
53
+ flex: 1 1 auto;
54
+ min-width: 0;
55
+ font-size: 17px;
56
+ line-height: 20px;
57
+ font-weight: 584.62;
58
+ letter-spacing: 0;
59
+ font-feature-settings: 'ss02', 'ss05', 'tnum';
60
+ color: var(--card-title, var(--text-1));
61
+ }
62
+
63
+ slot[name="actions"] { display: none; }
64
+ slot[name="actions"].has-content {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 4px;
68
+ flex: none;
69
+ }
70
+
71
+ slot[part="body"] {
72
+ display: block;
73
+ flex: 1 1 auto;
74
+ min-width: 0;
75
+ min-height: 0;
76
+ font-size: 15px;
77
+ line-height: 20px;
78
+ color: var(--card-text, var(--text-2));
79
+ }
80
+
81
+ slot[name="footer"] { display: none; }
82
+ slot[name="footer"].has-content {
83
+ display: flex;
84
+ align-items: center;
85
+ gap: 8px;
86
+ flex-wrap: wrap;
87
+ justify-content: flex-start;
88
+ padding-block-start: var(--card-padding, 16px);
89
+ }
90
+
91
+ :host([selected]) .container { box-shadow: inset 0 0 0 2px var(--card-selected-ring, var(--focus-ring)); }
92
+ :host([selected]) .container:focus-visible { box-shadow: inset 0 0 0 1px transparent, inset 0 0 0 2px var(--focus-ring); }
93
+
94
+ :host([loading]) .container { pointer-events: none; }
95
+ @media (prefers-reduced-motion: no-preference) {
96
+ :host([loading]) [part="content"] { animation: card-pulse 1.4s ease-in-out infinite; }
97
+ }
98
+ @keyframes card-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
99
+ `;
100
+ class ACardElement extends HTMLElementBase {
101
+ static observedAttributes = ["href", "target", "rel", "ping", "loading", "aria-label"];
102
+ #container;
103
+ #mediaSlot;
104
+ #headerRow;
105
+ #headerSlot;
106
+ #actionsSlot;
107
+ #bodySlot;
108
+ #footerSlot;
109
+ constructor() {
110
+ super();
111
+ const shadow = this.attachShadow({ mode: "open" });
112
+ const style = document.createElement("style");
113
+ style.textContent = SHADOW_STYLE;
114
+ this.#container = document.createElement("a");
115
+ this.#container.className = "container";
116
+ this.#container.setAttribute("part", "container");
117
+ this.#mediaSlot = document.createElement("slot");
118
+ this.#mediaSlot.name = "media";
119
+ this.#mediaSlot.setAttribute("part", "media");
120
+ const content = document.createElement("div");
121
+ content.className = "content";
122
+ content.setAttribute("part", "content");
123
+ this.#headerRow = document.createElement("div");
124
+ this.#headerRow.className = "header-row";
125
+ this.#headerSlot = document.createElement("slot");
126
+ this.#headerSlot.name = "header";
127
+ this.#headerSlot.setAttribute("part", "header");
128
+ this.#actionsSlot = document.createElement("slot");
129
+ this.#actionsSlot.name = "actions";
130
+ this.#actionsSlot.setAttribute("part", "actions");
131
+ this.#bodySlot = document.createElement("slot");
132
+ this.#bodySlot.setAttribute("part", "body");
133
+ this.#footerSlot = document.createElement("slot");
134
+ this.#footerSlot.name = "footer";
135
+ this.#footerSlot.setAttribute("part", "footer");
136
+ this.#headerRow.append(this.#headerSlot, this.#actionsSlot);
137
+ content.append(this.#headerRow, this.#bodySlot, this.#footerSlot);
138
+ this.#container.append(this.#mediaSlot, content);
139
+ shadow.append(style, this.#container);
140
+ this.#mediaSlot.addEventListener("slotchange", () => this.#syncHasContent());
141
+ this.#footerSlot.addEventListener("slotchange", () => this.#syncHasContent());
142
+ this.#actionsSlot.addEventListener("slotchange", () => this.#syncHasContent());
143
+ this.#headerSlot.addEventListener("slotchange", () => {
144
+ this.#syncHasContent();
145
+ this.#syncName();
146
+ });
147
+ this.#bodySlot.addEventListener("slotchange", () => this.#syncName());
148
+ }
149
+ connectedCallback() {
150
+ this.#syncHasContent();
151
+ this.#syncLink();
152
+ }
153
+ attributeChangedCallback() {
154
+ this.#syncLink();
155
+ }
156
+ /** Toggle the per-zone `has-content` classes (empty zones reserve no box). */
157
+ #syncHasContent() {
158
+ const set = (el, has) => el.classList.toggle("has-content", has);
159
+ set(this.#mediaSlot, this.#mediaSlot.assignedNodes().length > 0);
160
+ set(this.#footerSlot, this.#footerSlot.assignedNodes().length > 0);
161
+ const header = this.#headerSlot.assignedNodes().length > 0;
162
+ const actions = this.#actionsSlot.assignedNodes().length > 0;
163
+ set(this.#headerSlot, header);
164
+ set(this.#actionsSlot, actions);
165
+ set(this.#headerRow, header || actions);
166
+ }
167
+ /** Mirror the link attributes onto the shadow anchor — but drop `href` while
168
+ * `loading` so a loading card can't navigate. Also reflects `aria-busy`. */
169
+ #syncLink() {
170
+ const href = this.getAttribute("href");
171
+ const loading = this.hasAttribute("loading");
172
+ if (href != null && !loading) {
173
+ this.#container.setAttribute("href", href);
174
+ for (const name of ["target", "rel", "ping"]) {
175
+ const v = this.getAttribute(name);
176
+ if (v != null) this.#container.setAttribute(name, v);
177
+ else this.#container.removeAttribute(name);
178
+ }
179
+ } else {
180
+ for (const name of ["href", "target", "rel", "ping"]) {
181
+ this.#container.removeAttribute(name);
182
+ }
183
+ }
184
+ if (loading) this.#container.setAttribute("aria-busy", "true");
185
+ else this.#container.removeAttribute("aria-busy");
186
+ this.#syncName();
187
+ }
188
+ /** Name the anchor (link mode only): explicit aria-label → header → body → href. */
189
+ #syncName() {
190
+ if (!this.#container.hasAttribute("href")) {
191
+ this.#container.removeAttribute("aria-label");
192
+ return;
193
+ }
194
+ const explicit = this.getAttribute("aria-label")?.trim();
195
+ const name = explicit || this.#slotText(this.#headerSlot) || this.#slotText(this.#bodySlot) || this.getAttribute("href") || "";
196
+ if (name) this.#container.setAttribute("aria-label", name);
197
+ else this.#container.removeAttribute("aria-label");
198
+ }
199
+ #slotText(slot) {
200
+ return slot.assignedNodes().map((n) => n.textContent ?? "").join(" ").replace(/\s+/g, " ").trim();
201
+ }
202
+ }
203
+ function register_a_card() {
204
+ if (typeof customElements === "undefined") return;
205
+ if (!customElements.get("a-card")) {
206
+ customElements.define("a-card", ACardElement);
207
+ }
208
+ }
209
+ register_a_card();
210
+ export {
211
+ ACardElement,
212
+ register_a_card
213
+ };
@@ -1 +1 @@
1
- @layer anta{a-checkbox{--checkbox-gap: 8px;--checkbox-box-size: 16px;--checkbox-bg: var(--bg-1);--checkbox-fill: #878089;--checkbox-fill-hover: #776e77;--checkbox-fill-active: #635b65;--checkbox-border-neutral: #d4ced4;--checkbox-border: var(--checkbox-border-neutral);--checkbox-border-hover: #c1b9c1;--checkbox-border-active: #9f99a1;--checkbox-icon: #f1eff1;--checkbox-icon-disabled: #c1b9c1;--checkbox-bg-disabled: color-mix(in oklch, #44374b 10%, transparent);--checkbox-border-disabled: color-mix(in oklch, #44374b 10%, transparent);--checkbox-mask-size: 12px;--checkbox-mask-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");--checkbox-mask-indeterminate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");--checkbox-label-color: var(--text-2);--checkbox-label-color-disabled: var(--text-4);--checkbox-hint-color: var(--text-3);--checkbox-label-fs: 15px;--checkbox-label-lh: 20px;--checkbox-hint-fs: 13px;--checkbox-hint-lh: 16px;display:inline-grid;grid-template-columns:auto 1fr;align-items:start;column-gap:var(--checkbox-gap);vertical-align:middle;cursor:pointer;user-select:none;-webkit-user-drag:none;outline:none;color:var(--checkbox-label-color);font-family:var(--sans-serif);font-size:var(--checkbox-label-fs);line-height:var(--checkbox-label-lh);font-feature-settings:"ss02","ss05","tnum";&:before{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--checkbox-label-lh) - var(--checkbox-box-size)) / 2);box-sizing:border-box;inline-size:16px;block-size:16px;border-radius:4px;background:var(--checkbox-bg);border:1.5px solid var(--checkbox-border);transition:background-color .15s ease-out,border-color .15s ease-out}&[round]{--checkbox-round: attr(round type(<length>), 999px)}&[round]:before{border-radius:var(--checkbox-round, 999px)}&:after{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--checkbox-label-lh) - var(--checkbox-box-size)) / 2);inline-size:16px;block-size:16px;background-color:transparent;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:var(--checkbox-mask-size);mask-size:var(--checkbox-mask-size)}@media(hover:hover)and (pointer:fine){&:not(:disabled):hover:before{border-color:var(--checkbox-border-hover);transition:background-color 75ms ease-in,border-color 75ms ease-in}&:not(:disabled):hover:is(:state(checked),:state(indeterminate)):before{background:var(--checkbox-fill-hover);border-color:var(--checkbox-fill-hover)}}&:not(:disabled):active:before{border-color:var(--checkbox-border-active);transition:background-color 50ms linear,border-color 50ms linear}&:not(:disabled):active:is(:state(checked),:state(indeterminate)):before{background:var(--checkbox-fill-active);border-color:var(--checkbox-fill-active)}&:is(:state(checked),:state(indeterminate)){&:before{background:var(--checkbox-fill);border-color:var(--checkbox-fill)}&:after{background-color:var(--checkbox-icon)}}&:state(checked):after{-webkit-mask-image:var(--checkbox-mask-check);mask-image:var(--checkbox-mask-check)}&:state(indeterminate):after{-webkit-mask-image:var(--checkbox-mask-indeterminate);mask-image:var(--checkbox-mask-indeterminate)}&:focus-visible:before{outline:1px solid var(--focus-ring);outline-offset:1px}&:disabled{cursor:not-allowed;color:var(--checkbox-label-color-disabled);&:before{background:var(--checkbox-bg-disabled);border-color:var(--checkbox-border-disabled);transition:none}&:is(:state(checked),:state(indeterminate)):after{background-color:var(--checkbox-icon-disabled)}a-checkbox-hint{color:var(--checkbox-label-color-disabled)}}&[size=small]{--checkbox-gap: 6px;--checkbox-box-size: 14px;--checkbox-label-fs: 13px;--checkbox-label-lh: 16px;--checkbox-hint-fs: 12px;--checkbox-hint-lh: 14px;--checkbox-mask-size: 10px;&:before,&:after{inline-size:14px;block-size:14px}}&[size=large]{--checkbox-box-size: 18px;--checkbox-label-fs: 17px;--checkbox-label-lh: 22px;--checkbox-hint-fs: 15px;--checkbox-hint-lh: 19px;--checkbox-mask-size: 14px;&:before,&:after{inline-size:18px;block-size:18px}}}.dark a-checkbox{--checkbox-mask-size: 13px}.dark a-checkbox[size=small]{--checkbox-mask-size: 11px}.dark a-checkbox[size=large]{--checkbox-mask-size: 15px}a-checkbox-label,a-checkbox-hint{display:block;grid-column:2;min-width:0}a-checkbox-hint{color:var(--checkbox-hint-color);font-size:var(--checkbox-hint-fs);line-height:var(--checkbox-hint-lh);margin-block-start:2px}a-checkbox[tone=brand],a-checkbox[tone-selected=brand]{--checkbox-fill: #5f4bc3;--checkbox-fill-hover: #503cb4;--checkbox-fill-active: #483493}a-checkbox[tone=neutral],a-checkbox[tone-selected=neutral]{--checkbox-fill: #878089;--checkbox-fill-hover: #776e77;--checkbox-fill-active: #635b65}a-checkbox[tone=info],a-checkbox[tone-selected=info]{--checkbox-fill: #1f6eb2;--checkbox-fill-hover: #1a5b93;--checkbox-fill-active: #175082}a-checkbox[tone=success],a-checkbox[tone-selected=success]{--checkbox-fill: #2a7e43;--checkbox-fill-hover: #226737;--checkbox-fill-active: #1f5c31}a-checkbox[tone=warning],a-checkbox[tone-selected=warning]{--checkbox-fill: #c37416;--checkbox-fill-hover: #ae6613;--checkbox-fill-active: #995200}a-checkbox[tone=critical],a-checkbox[tone-selected=critical]{--checkbox-fill: #c9302c;--checkbox-fill-hover: #b02120;--checkbox-fill-active: #a01c1c}a-checkbox[tone=brand]{--checkbox-bg: #fcfcfe;--checkbox-border: #bcb1f1;--checkbox-border-hover: #9e8eeb;--checkbox-border-active: #9081df}a-checkbox[tone=info]{--checkbox-bg: #fbfcfe;--checkbox-border: #93c5ec;--checkbox-border-hover: #69ace5;--checkbox-border-active: #56a1e1}a-checkbox[tone=success]{--checkbox-bg: #f7fcf9;--checkbox-border: #88d7a0;--checkbox-border-hover: #5bc87b;--checkbox-border-active: #44c169}a-checkbox[tone=warning]{--checkbox-bg: #fefbf6;--checkbox-border: #edb25a;--checkbox-border-hover: #e09127;--checkbox-border-active: #d88118}a-checkbox[tone=critical]{--checkbox-bg: #fefbfb;--checkbox-border: #efa4a4;--checkbox-border-hover: #e87f7f;--checkbox-border-active: #e56c6c}a-checkbox[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--checkbox-bg: oklch(from var(--checkbox-tone-source) .99 calc(c*.03) h);--_checkbox-border-base: color-mix(in oklch, var(--checkbox-fill) 70%, var(--checkbox-border-neutral));--checkbox-border: oklch(from var(--_checkbox-border-base) calc(l + .17) c h);--checkbox-border-hover: oklch(from var(--_checkbox-border-base) calc(l + .1) c h);--checkbox-border-active: var(--_checkbox-border-base);.dark &{--checkbox-bg: oklch(from var(--checkbox-tone-source) .15 calc(c*.18) h);--checkbox-border: var(--_checkbox-border-base);--checkbox-border-hover: oklch(from var(--_checkbox-border-base) calc(l + .1) c h);--checkbox-border-active: oklch(from var(--_checkbox-border-base) calc(l + .17) c h)}}a-checkbox[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--checkbox-tone-source: attr(tone type(<color>), transparent)}a-checkbox[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--checkbox-tone-source: attr(tone-selected type(<color>), transparent)}a-checkbox[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-checkbox[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--_tone-l-rest: .5;--_tone-l-hover: .45;--_tone-l-active: .4;--checkbox-fill: oklch(from var(--checkbox-tone-source) var(--_tone-l-rest) c h);--checkbox-fill-hover: oklch(from var(--checkbox-tone-source) var(--_tone-l-hover) c h);--checkbox-fill-active: oklch(from var(--checkbox-tone-source) var(--_tone-l-active) c h);.dark &{--_tone-l-rest: .45;--_tone-l-hover: .5;--_tone-l-active: .57}}.dark a-checkbox{--checkbox-border-neutral: #49424c;--checkbox-border-hover: #635b65;--checkbox-border-active: #776e77;--checkbox-fill: #49424c;--checkbox-fill-hover: #534c57;--checkbox-fill-active: #635b65;--checkbox-icon: #d4ced4;--checkbox-icon-disabled: #534c57;--checkbox-bg-disabled: color-mix(in oklch, #e4d1ef 10%, transparent);--checkbox-border-disabled: color-mix(in oklch, #e4d1ef 10%, transparent)}.dark a-checkbox[tone=brand],.dark a-checkbox[tone-selected=brand]{--checkbox-fill: #503cb4;--checkbox-fill-hover: #5f4bc3;--checkbox-fill-active: #7460d7}.dark a-checkbox[tone=neutral],.dark a-checkbox[tone-selected=neutral]{--checkbox-fill: #49424c;--checkbox-fill-hover: #534c57;--checkbox-fill-active: #635b65}.dark a-checkbox[tone=info],.dark a-checkbox[tone-selected=info]{--checkbox-fill: #1a5b93;--checkbox-fill-hover: #1f6eb2;--checkbox-fill-active: #2686d9}.dark a-checkbox[tone=success],.dark a-checkbox[tone-selected=success]{--checkbox-fill: #226737;--checkbox-fill-hover: #2a7e43;--checkbox-fill-active: #329550}.dark a-checkbox[tone=warning],.dark a-checkbox[tone-selected=warning]{--checkbox-fill: #7f410b;--checkbox-fill-hover: #995200;--checkbox-fill-active: #ae6613}.dark a-checkbox[tone=critical],.dark a-checkbox[tone-selected=critical]{--checkbox-fill: #b02120;--checkbox-fill-hover: #c9302c;--checkbox-fill-active: #de4545}.dark a-checkbox[tone=brand]{--checkbox-bg: #0b0916;--checkbox-border: #483493;--checkbox-border-hover: #5f4bc3;--checkbox-border-active: #7460d7}.dark a-checkbox[tone=info]{--checkbox-bg: #040d18;--checkbox-border: #175082;--checkbox-border-hover: #1f6eb2;--checkbox-border-active: #2686d9}.dark a-checkbox[tone=success]{--checkbox-bg: #041008;--checkbox-border: #1f5c31;--checkbox-border-hover: #2a7e43;--checkbox-border-active: #329550}.dark a-checkbox[tone=warning]{--checkbox-bg: #120a03;--checkbox-border: #6a3b0c;--checkbox-border-hover: #995200;--checkbox-border-active: #ae6613}.dark a-checkbox[tone=critical]{--checkbox-bg: #190405;--checkbox-border: #a01c1c;--checkbox-border-hover: #c9302c;--checkbox-border-active: #de4545}}
1
+ @layer anta{a-checkbox{--checkbox-gap: 8px;--checkbox-box-size: 16px;--checkbox-bg: var(--bg-1);--checkbox-fill: #878089;--checkbox-fill-hover: #776e77;--checkbox-fill-active: #635b65;--checkbox-border-neutral: #d4ced4;--checkbox-border: var(--checkbox-border-neutral);--checkbox-border-hover: #c1b9c1;--checkbox-border-active: #9f99a1;--checkbox-icon: #f6f4f6;--checkbox-icon-disabled: #c1b9c1;--checkbox-bg-disabled: color-mix(in oklch, #44374b 10%, transparent);--checkbox-border-disabled: color-mix(in oklch, #44374b 10%, transparent);--checkbox-mask-size: 12px;--checkbox-mask-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");--checkbox-mask-indeterminate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");--checkbox-label-color: var(--text-2);--checkbox-label-color-disabled: var(--text-4);--checkbox-hint-color: var(--text-3);--checkbox-label-fs: 15px;--checkbox-label-lh: 20px;--checkbox-hint-fs: 13px;--checkbox-hint-lh: 16px;display:inline-grid;grid-template-columns:auto 1fr;align-items:start;column-gap:var(--checkbox-gap);vertical-align:middle;cursor:pointer;user-select:none;-webkit-user-drag:none;outline:none;color:var(--checkbox-label-color);font-family:var(--sans-serif);font-size:var(--checkbox-label-fs);line-height:var(--checkbox-label-lh);font-feature-settings:"ss02","ss05","tnum";&:before{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--checkbox-label-lh) - var(--checkbox-box-size)) / 2);box-sizing:border-box;inline-size:16px;block-size:16px;border-radius:4px;background:var(--checkbox-bg);border:1.5px solid var(--checkbox-border);transition:background-color .15s ease-out,border-color .15s ease-out}&[round]{--checkbox-round: attr(round type(<length>), 999px)}&[round]:before{border-radius:var(--checkbox-round, 999px)}&:after{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--checkbox-label-lh) - var(--checkbox-box-size)) / 2);inline-size:16px;block-size:16px;background-color:transparent;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-position:center;mask-position:center;-webkit-mask-size:var(--checkbox-mask-size);mask-size:var(--checkbox-mask-size)}@media(hover:hover)and (pointer:fine){&:not(:disabled):hover:before{border-color:var(--checkbox-border-hover);transition:background-color 75ms ease-in,border-color 75ms ease-in}&:not(:disabled):hover:is(:state(checked),:state(indeterminate)):before{background:var(--checkbox-fill-hover);border-color:var(--checkbox-fill-hover)}}&:not(:disabled):active:before{border-color:var(--checkbox-border-active);transition:background-color 50ms linear,border-color 50ms linear}&:not(:disabled):active:is(:state(checked),:state(indeterminate)):before{background:var(--checkbox-fill-active);border-color:var(--checkbox-fill-active)}&:is(:state(checked),:state(indeterminate)){&:before{background:var(--checkbox-fill);border-color:var(--checkbox-fill)}&:after{background-color:var(--checkbox-icon)}}&:state(checked):after{-webkit-mask-image:var(--checkbox-mask-check);mask-image:var(--checkbox-mask-check)}&:state(indeterminate):after{-webkit-mask-image:var(--checkbox-mask-indeterminate);mask-image:var(--checkbox-mask-indeterminate)}&:focus-visible:before{outline:1px solid var(--focus-ring);outline-offset:1px}&:disabled{cursor:not-allowed;color:var(--checkbox-label-color-disabled);&:before{background:var(--checkbox-bg-disabled);border-color:var(--checkbox-border-disabled);transition:none}&:is(:state(checked),:state(indeterminate)):after{background-color:var(--checkbox-icon-disabled)}a-checkbox-hint{color:var(--checkbox-label-color-disabled)}}&[size=small]{--checkbox-gap: 6px;--checkbox-box-size: 14px;--checkbox-label-fs: 13px;--checkbox-label-lh: 16px;--checkbox-hint-fs: 12px;--checkbox-hint-lh: 14px;--checkbox-mask-size: 10px;&:before,&:after{inline-size:14px;block-size:14px}}&[size=large]{--checkbox-box-size: 18px;--checkbox-label-fs: 17px;--checkbox-label-lh: 22px;--checkbox-hint-fs: 15px;--checkbox-hint-lh: 19px;--checkbox-mask-size: 14px;&:before,&:after{inline-size:18px;block-size:18px}}}.dark a-checkbox{--checkbox-mask-size: 13px}.dark a-checkbox[size=small]{--checkbox-mask-size: 11px}.dark a-checkbox[size=large]{--checkbox-mask-size: 15px}a-checkbox-label,a-checkbox-hint{display:block;grid-column:2;min-width:0}a-checkbox-hint{color:var(--checkbox-hint-color);font-size:var(--checkbox-hint-fs);line-height:var(--checkbox-hint-lh);margin-block-start:2px}a-checkbox[tone=brand],a-checkbox[tone-selected=brand]{--checkbox-fill: #5f4bc3;--checkbox-fill-hover: #503cb4;--checkbox-fill-active: #483493}a-checkbox[tone=neutral],a-checkbox[tone-selected=neutral]{--checkbox-fill: #878089;--checkbox-fill-hover: #776e77;--checkbox-fill-active: #635b65}a-checkbox[tone=info],a-checkbox[tone-selected=info]{--checkbox-fill: #1f6eb2;--checkbox-fill-hover: #1a5b93;--checkbox-fill-active: #175082}a-checkbox[tone=success],a-checkbox[tone-selected=success]{--checkbox-fill: #2a7e43;--checkbox-fill-hover: #226737;--checkbox-fill-active: #1f5c31}a-checkbox[tone=warning],a-checkbox[tone-selected=warning]{--checkbox-fill: #c37416;--checkbox-fill-hover: #ae6613;--checkbox-fill-active: #995200}a-checkbox[tone=critical],a-checkbox[tone-selected=critical]{--checkbox-fill: #c9302c;--checkbox-fill-hover: #b02120;--checkbox-fill-active: #a01c1c}a-checkbox[tone=brand]{--checkbox-bg: #fcfcfe;--checkbox-border: #bcb1f1;--checkbox-border-hover: #9e8eeb;--checkbox-border-active: #9081df}a-checkbox[tone=info]{--checkbox-bg: #fbfcfe;--checkbox-border: #93c5ec;--checkbox-border-hover: #69ace5;--checkbox-border-active: #56a1e1}a-checkbox[tone=success]{--checkbox-bg: #f7fcf9;--checkbox-border: #88d7a0;--checkbox-border-hover: #5bc87b;--checkbox-border-active: #44c169}a-checkbox[tone=warning]{--checkbox-bg: #fefbf6;--checkbox-border: #edb25a;--checkbox-border-hover: #e09127;--checkbox-border-active: #d88118}a-checkbox[tone=critical]{--checkbox-bg: #fefbfb;--checkbox-border: #efa4a4;--checkbox-border-hover: #e87f7f;--checkbox-border-active: #e56c6c}a-checkbox[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--checkbox-bg: oklch(from var(--checkbox-tone-source) .99 calc(c*.03) h);--_checkbox-border-base: color-mix(in oklch, var(--checkbox-fill) 70%, var(--checkbox-border-neutral));--checkbox-border: oklch(from var(--_checkbox-border-base) calc(l + .17) c h);--checkbox-border-hover: oklch(from var(--_checkbox-border-base) calc(l + .1) c h);--checkbox-border-active: var(--_checkbox-border-base);.dark &{--checkbox-bg: oklch(from var(--checkbox-tone-source) .15 calc(c*.18) h);--checkbox-border: var(--_checkbox-border-base);--checkbox-border-hover: oklch(from var(--_checkbox-border-base) calc(l + .1) c h);--checkbox-border-active: oklch(from var(--_checkbox-border-base) calc(l + .17) c h)}}a-checkbox[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--checkbox-tone-source: attr(tone type(<color>), transparent)}a-checkbox[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--checkbox-tone-source: attr(tone-selected type(<color>), transparent)}a-checkbox[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-checkbox[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--_tone-l-rest: .5;--_tone-l-hover: .45;--_tone-l-active: .4;--checkbox-fill: oklch(from var(--checkbox-tone-source) var(--_tone-l-rest) c h);--checkbox-fill-hover: oklch(from var(--checkbox-tone-source) var(--_tone-l-hover) c h);--checkbox-fill-active: oklch(from var(--checkbox-tone-source) var(--_tone-l-active) c h);.dark &{--_tone-l-rest: .45;--_tone-l-hover: .5;--_tone-l-active: .57}}.dark a-checkbox{--checkbox-border-neutral: #49424c;--checkbox-border-hover: #635b65;--checkbox-border-active: #776e77;--checkbox-fill: #49424c;--checkbox-fill-hover: #534c57;--checkbox-fill-active: #635b65;--checkbox-icon: #ece9ec;--checkbox-icon-disabled: #534c57;--checkbox-bg-disabled: color-mix(in oklch, #e4d1ef 10%, transparent);--checkbox-border-disabled: color-mix(in oklch, #e4d1ef 10%, transparent)}.dark a-checkbox[tone=brand],.dark a-checkbox[tone-selected=brand]{--checkbox-fill: #503cb4;--checkbox-fill-hover: #5f4bc3;--checkbox-fill-active: #7460d7}.dark a-checkbox[tone=neutral],.dark a-checkbox[tone-selected=neutral]{--checkbox-fill: #49424c;--checkbox-fill-hover: #534c57;--checkbox-fill-active: #635b65}.dark a-checkbox[tone=info],.dark a-checkbox[tone-selected=info]{--checkbox-fill: #1a5b93;--checkbox-fill-hover: #1f6eb2;--checkbox-fill-active: #2686d9}.dark a-checkbox[tone=success],.dark a-checkbox[tone-selected=success]{--checkbox-fill: #226737;--checkbox-fill-hover: #2a7e43;--checkbox-fill-active: #329550}.dark a-checkbox[tone=warning],.dark a-checkbox[tone-selected=warning]{--checkbox-fill: #7f410b;--checkbox-fill-hover: #995200;--checkbox-fill-active: #ae6613}.dark a-checkbox[tone=critical],.dark a-checkbox[tone-selected=critical]{--checkbox-fill: #b02120;--checkbox-fill-hover: #c9302c;--checkbox-fill-active: #de4545}.dark a-checkbox[tone=brand]{--checkbox-bg: #0b0916;--checkbox-border: #483493;--checkbox-border-hover: #5f4bc3;--checkbox-border-active: #7460d7}.dark a-checkbox[tone=info]{--checkbox-bg: #040d18;--checkbox-border: #175082;--checkbox-border-hover: #1f6eb2;--checkbox-border-active: #2686d9}.dark a-checkbox[tone=success]{--checkbox-bg: #041008;--checkbox-border: #1f5c31;--checkbox-border-hover: #2a7e43;--checkbox-border-active: #329550}.dark a-checkbox[tone=warning]{--checkbox-bg: #120a03;--checkbox-border: #6a3b0c;--checkbox-border-hover: #995200;--checkbox-border-active: #ae6613}.dark a-checkbox[tone=critical]{--checkbox-bg: #190405;--checkbox-border: #a01c1c;--checkbox-border-hover: #c9302c;--checkbox-border-active: #de4545}}
@@ -45,6 +45,8 @@ export declare class AInputElement extends HTMLElementBase {
45
45
  private syncStatus;
46
46
  private onInput;
47
47
  private onChange;
48
+ private onFocus;
49
+ private onBlur;
48
50
  private onLabelSlotChange;
49
51
  private applyLabelAria;
50
52
  private onHintSlotChange;
@@ -22,6 +22,18 @@ const FORWARDED = [
22
22
  "aria-label"
23
23
  ];
24
24
  const BOOL_FORWARDED = /* @__PURE__ */ new Set(["readonly", "required"]);
25
+ let focusFromKeyboard = false;
26
+ const modalityDocs = /* @__PURE__ */ new WeakSet();
27
+ function trackFocusModality(doc) {
28
+ if (modalityDocs.has(doc)) return;
29
+ modalityDocs.add(doc);
30
+ doc.addEventListener("keydown", () => {
31
+ focusFromKeyboard = true;
32
+ }, true);
33
+ doc.addEventListener("pointerdown", () => {
34
+ focusFromKeyboard = false;
35
+ }, true);
36
+ }
25
37
  const CLEAR_TRIGGER = "clearrequest";
26
38
  const CLEAR_CLICK_EVENT = "clearclick";
27
39
  const CLEAR_INPUT_EVENT = "clearinput";
@@ -72,7 +84,8 @@ const SHADOW_STYLE = `
72
84
  @media (hover: hover) and (pointer: fine) {
73
85
  :host(:not(:disabled)) .field:hover { --_bc: var(--input-border-hover); }
74
86
  }
75
- .field:has(input:focus, textarea:focus) {
87
+ :host(:not([readonly])) .field:has(input:focus, textarea:focus),
88
+ :host([readonly]:state(kb-focus)) .field {
76
89
  --_bc: var(--input-border-hover);
77
90
  outline: 1px solid var(--focus-ring);
78
91
  outline-offset: 1px;
@@ -269,6 +282,7 @@ class AInputElement extends HTMLElementBase {
269
282
  return this.field.getBoundingClientRect();
270
283
  }
271
284
  connectedCallback() {
285
+ trackFocusModality(this.doc);
272
286
  if (Object.prototype.hasOwnProperty.call(this, "value")) {
273
287
  const v = this.value;
274
288
  delete this.value;
@@ -336,6 +350,8 @@ class AInputElement extends HTMLElementBase {
336
350
  next.value = value;
337
351
  next.addEventListener("input", this.onInput);
338
352
  next.addEventListener("change", this.onChange);
353
+ next.addEventListener("focus", this.onFocus);
354
+ next.addEventListener("blur", this.onBlur);
339
355
  if (refocus) {
340
356
  next.focus();
341
357
  if (selStart != null) try {
@@ -415,6 +431,23 @@ class AInputElement extends HTMLElementBase {
415
431
  onChange = () => {
416
432
  this.dispatchEvent(new Event("change", { bubbles: true }));
417
433
  };
434
+ // Stamp the off-DOM `:state(kb-focus)` when this focus arrived via the keyboard
435
+ // (see `trackFocusModality`), so the read-only field's ring can draw for keyboard
436
+ // focus but not a mouse click — the one distinction Chromium's `:focus-visible`
437
+ // won't make for an <input>. Editable fields ignore the state (ring on `:focus`).
438
+ onFocus = () => {
439
+ try {
440
+ if (focusFromKeyboard) this.internals?.states.add("kb-focus");
441
+ else this.internals?.states.delete("kb-focus");
442
+ } catch {
443
+ }
444
+ };
445
+ onBlur = () => {
446
+ try {
447
+ this.internals?.states.delete("kb-focus");
448
+ } catch {
449
+ }
450
+ };
418
451
  onLabelSlotChange = () => {
419
452
  this.labelBox.classList.toggle("has-label", this.labelSlot.assignedNodes().length > 0);
420
453
  this.applyLabelAria();
@@ -7,6 +7,8 @@ const SUBMENU_OPEN_DELAY = 130;
7
7
  const SUBMENU_CLOSE_DELAY = 130;
8
8
  const TYPEAHEAD_RESET = 500;
9
9
  const ANCHOR_VISIBLE_RATIO = 0.5;
10
+ const SELF_ACTIVATING = 'a-button, button, a[href], input[type="button"], input[type="submit"], input[type="reset"], [role="button"]';
11
+ const EDITABLE_FIELD = "input:not([readonly]), textarea:not([readonly]), a-input:not([readonly]), a-input-time:not([readonly])";
10
12
  const openStack = [];
11
13
  let docBound = false;
12
14
  let boundDoc = null;
@@ -947,6 +949,12 @@ class AMenuElement extends HTMLElementBase {
947
949
  return ((label ?? it).textContent ?? "").trim().toLowerCase();
948
950
  }
949
951
  /* ====================== trigger listener wiring ====================== */
952
+ /** Pointer coord for a keyboard-opened `coord` menu: the trigger's own rect
953
+ * (a DOM read, not a mutation) instead of the 0,0 a keyboard event reports. */
954
+ #anchorCoord(anchor) {
955
+ const r = anchorRect(anchor);
956
+ return [r.left, r.bottom];
957
+ }
950
958
  setupListeners() {
951
959
  if (this.listening) return;
952
960
  const anchor = this.triggerAnchor;
@@ -997,21 +1005,25 @@ class AMenuElement extends HTMLElementBase {
997
1005
  } else {
998
1006
  const onClick = (e) => {
999
1007
  const viaKeyboard = e.detail === 0;
1000
- let coord;
1001
- if (this.#isCoord) {
1002
- if (viaKeyboard) {
1003
- const r = anchorRect(anchor);
1004
- coord = [r.left, r.bottom];
1005
- } else {
1006
- coord = [e.clientX, e.clientY];
1007
- }
1008
- }
1008
+ const coord = this.#isCoord ? viaKeyboard ? this.#anchorCoord(anchor) : [e.clientX, e.clientY] : void 0;
1009
1009
  if (this._shown) this.requestClose(e);
1010
1010
  else this.requestOpen({ coord, viaKeyboard, originEvent: e });
1011
1011
  };
1012
+ const onKey = (e) => {
1013
+ if (this._shown) return;
1014
+ if (anchor.matches(SELF_ACTIVATING) || anchor.hasAttribute("disabled")) return;
1015
+ const editable = anchor.matches(EDITABLE_FIELD);
1016
+ const opens = e.key === "ArrowDown" || e.key === "ArrowUp" || !editable && (e.key === "Enter" || e.key === " ");
1017
+ if (!opens) return;
1018
+ e.preventDefault();
1019
+ const coord = this.#isCoord ? this.#anchorCoord(anchor) : void 0;
1020
+ this.requestOpen({ coord, viaKeyboard: true, originEvent: e });
1021
+ };
1012
1022
  anchor.addEventListener("click", onClick);
1023
+ anchor.addEventListener("keydown", onKey);
1013
1024
  this.teardown = () => {
1014
1025
  anchor.removeEventListener("click", onClick);
1026
+ anchor.removeEventListener("keydown", onKey);
1015
1027
  this.listening = false;
1016
1028
  };
1017
1029
  }
@@ -1 +1 @@
1
- @layer anta{a-radio{--radio-control-size: 16px;--radio-border-width: 1.5px;--radio-dot-size: 6px;--_radio-dot-adjust: 0px;--radio-gap: 8px;--radio-bg: var(--bg-1);--radio-fill: #878089;--radio-fill-hover: #776e77;--radio-fill-active: #635b65;--radio-border-neutral: #d4ced4;--radio-border: var(--radio-border-neutral);--radio-border-hover: #c1b9c1;--radio-border-active: #9f99a1;--radio-dot: #f1eff1;--radio-dot-disabled: #c1b9c1;--radio-bg-disabled: color-mix(in oklch, #44374b 10%, transparent);--radio-border-disabled: color-mix(in oklch, #44374b 10%, transparent);--radio-label-color: var(--text-2);--radio-label-color-disabled: var(--text-4);--radio-hint-color: var(--text-3);--radio-label-fs: 15px;--radio-label-lh: 20px;--radio-hint-fs: 14px;--radio-hint-lh: 17px;display:inline-grid;grid-template-columns:auto 1fr;align-items:start;column-gap:var(--radio-gap);cursor:pointer;user-select:none;-webkit-user-drag:none;vertical-align:middle;outline:none;color:var(--radio-label-color);font-family:var(--sans-serif);font-size:var(--radio-label-fs);line-height:var(--radio-label-lh);font-feature-settings:"ss02","ss05","tnum";&:before{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--radio-label-lh) - var(--radio-control-size)) / 2);box-sizing:border-box;inline-size:var(--radio-control-size);block-size:var(--radio-control-size);border-radius:50%;background:var(--radio-bg);border:var(--radio-border-width) solid var(--radio-border);transition:background-color .15s ease-out,border-color .15s ease-out}&:after{content:"";grid-column:1;grid-row:1 / -1;align-self:start;justify-self:center;margin-block-start:calc((var(--radio-label-lh) - (var(--radio-dot-size) - var(--_radio-dot-adjust))) / 2);inline-size:calc(var(--radio-dot-size) - var(--_radio-dot-adjust));block-size:calc(var(--radio-dot-size) - var(--_radio-dot-adjust));border-radius:50%;background:var(--radio-dot);transform:scale(0);transition:transform .12s ease-out;pointer-events:none}@media(hover:hover)and (pointer:fine){&:not([disabled]):hover:before{border-color:var(--radio-border-hover);transition:background-color 75ms ease-in,border-color 75ms ease-in}&:not([disabled]):hover:state(selected):before{background:var(--radio-fill-hover);border-color:var(--radio-fill-hover)}}&:not([disabled]):active:before{border-color:var(--radio-border-active);transition:background-color 50ms linear,border-color 50ms linear}&:not([disabled]):active:state(selected):before{background:var(--radio-fill-active);border-color:var(--radio-fill-active)}&:state(selected){&:before{background:var(--radio-fill);border-color:var(--radio-fill)}&:after{transform:scale(1)}}&:focus-visible:before{outline:1px solid var(--focus-ring);outline-offset:1px}&[disabled]{cursor:not-allowed;color:var(--radio-label-color-disabled);&:before{background:var(--radio-bg-disabled);border-color:var(--radio-border-disabled);transition:none}&:state(selected):after{background:var(--radio-dot-disabled)}a-radio-hint{color:var(--radio-label-color-disabled)}}&[size=small]{--radio-control-size: 14px;--radio-dot-size: 5px;--radio-gap: 6px;--radio-label-fs: 13px;--radio-label-lh: 16px;--radio-hint-fs: 12px;--radio-hint-lh: 14px}&[size=large]{--radio-control-size: 18px;--radio-dot-size: 7px;--radio-label-fs: 17px;--radio-label-lh: 22px;--radio-hint-fs: 16px;--radio-hint-lh: 21px}}a-radio-label,a-radio-hint{display:block;grid-column:2;min-width:0}a-radio-hint{color:var(--radio-hint-color);font-size:var(--radio-hint-fs);line-height:var(--radio-hint-lh);margin-block-start:2px}a-radio-group:focus-visible a-radio:state(selected):before{outline:1px solid var(--focus-ring);outline-offset:1px}a-radio[tone=brand],a-radio[tone-selected=brand],a-radio-group[tone=brand] a-radio:not([tone]),a-radio-group[tone-selected=brand] a-radio:not([tone-selected]){--radio-fill: #5f4bc3;--radio-fill-hover: #503cb4;--radio-fill-active: #483493}a-radio[tone=neutral],a-radio[tone-selected=neutral],a-radio-group[tone=neutral] a-radio:not([tone]),a-radio-group[tone-selected=neutral] a-radio:not([tone-selected]){--radio-fill: #878089;--radio-fill-hover: #776e77;--radio-fill-active: #635b65}a-radio[tone=info],a-radio[tone-selected=info],a-radio-group[tone=info] a-radio:not([tone]),a-radio-group[tone-selected=info] a-radio:not([tone-selected]){--radio-fill: #1f6eb2;--radio-fill-hover: #1a5b93;--radio-fill-active: #175082}a-radio[tone=success],a-radio[tone-selected=success],a-radio-group[tone=success] a-radio:not([tone]),a-radio-group[tone-selected=success] a-radio:not([tone-selected]){--radio-fill: #2a7e43;--radio-fill-hover: #226737;--radio-fill-active: #1f5c31}a-radio[tone=warning],a-radio[tone-selected=warning],a-radio-group[tone=warning] a-radio:not([tone]),a-radio-group[tone-selected=warning] a-radio:not([tone-selected]){--radio-fill: #c37416;--radio-fill-hover: #ae6613;--radio-fill-active: #995200}a-radio[tone=critical],a-radio[tone-selected=critical],a-radio-group[tone=critical] a-radio:not([tone]),a-radio-group[tone-selected=critical] a-radio:not([tone-selected]){--radio-fill: #c9302c;--radio-fill-hover: #b02120;--radio-fill-active: #a01c1c}a-radio[tone=brand],a-radio-group[tone=brand] a-radio:not([tone]){--radio-bg: #fcfcfe;--radio-border: #bcb1f1;--radio-border-hover: #9e8eeb;--radio-border-active: #9081df}a-radio[tone=info],a-radio-group[tone=info] a-radio:not([tone]){--radio-bg: #fbfcfe;--radio-border: #93c5ec;--radio-border-hover: #69ace5;--radio-border-active: #56a1e1}a-radio[tone=success],a-radio-group[tone=success] a-radio:not([tone]){--radio-bg: #f7fcf9;--radio-border: #88d7a0;--radio-border-hover: #5bc87b;--radio-border-active: #44c169}a-radio[tone=warning],a-radio-group[tone=warning] a-radio:not([tone]){--radio-bg: #fefbf6;--radio-border: #edb25a;--radio-border-hover: #e09127;--radio-border-active: #d88118}a-radio[tone=critical],a-radio-group[tone=critical] a-radio:not([tone]){--radio-bg: #fefbfb;--radio-border: #efa4a4;--radio-border-hover: #e87f7f;--radio-border-active: #e56c6c}a-radio[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-radio-group[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]) a-radio:not([tone]){--radio-bg: oklch(from var(--radio-tone-source) .99 calc(c*.03) h);--_radio-border-base: color-mix(in oklch, var(--radio-fill) 70%, var(--radio-border-neutral));--radio-border: oklch(from var(--_radio-border-base) calc(l + .17) c h);--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: var(--_radio-border-base);.dark &{--radio-bg: oklch(from var(--radio-tone-source) .15 calc(c*.18) h);--radio-border: var(--_radio-border-base);--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: oklch(from var(--_radio-border-base) calc(l + .17) c h)}}a-radio[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: attr(tone type(<color>), transparent)}a-radio[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--radio-tone-source: attr(tone-selected type(<color>), transparent)}a-radio[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-radio[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]),a-radio-group[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]) a-radio:not([tone]),a-radio-group[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]) a-radio:not([tone-selected]){--_tone-l-rest: .5;--_tone-l-hover: .45;--_tone-l-active: .4;--radio-fill: oklch(from var(--radio-tone-source) var(--_tone-l-rest) c h);--radio-fill-hover: oklch(from var(--radio-tone-source) var(--_tone-l-hover) c h);--radio-fill-active: oklch(from var(--radio-tone-source) var(--_tone-l-active) c h);.dark &{--_tone-l-rest: .45;--_tone-l-hover: .5;--_tone-l-active: .57}}.dark a-radio{--_radio-dot-adjust: 1px;&:after{box-shadow:0 0 1px 1px color-mix(in oklch,black 40%,transparent)}--radio-border-neutral: #49424c;--radio-border-hover: #635b65;--radio-border-active: #776e77;--radio-fill: #49424c;--radio-fill-hover: #534c57;--radio-fill-active: #635b65;--radio-dot: #d4ced4;--radio-dot-disabled: #534c57;--radio-bg-disabled: color-mix(in oklch, #e4d1ef 10%, transparent);--radio-border-disabled: color-mix(in oklch, #e4d1ef 10%, transparent)}.dark a-radio[tone=brand],.dark a-radio[tone-selected=brand],.dark a-radio-group[tone=brand] a-radio:not([tone]),.dark a-radio-group[tone-selected=brand] a-radio:not([tone-selected]){--radio-fill: #503cb4;--radio-fill-hover: #5f4bc3;--radio-fill-active: #7460d7}.dark a-radio[tone=neutral],.dark a-radio[tone-selected=neutral],.dark a-radio-group[tone=neutral] a-radio:not([tone]),.dark a-radio-group[tone-selected=neutral] a-radio:not([tone-selected]){--radio-fill: #49424c;--radio-fill-hover: #534c57;--radio-fill-active: #635b65}.dark a-radio[tone=info],.dark a-radio[tone-selected=info],.dark a-radio-group[tone=info] a-radio:not([tone]),.dark a-radio-group[tone-selected=info] a-radio:not([tone-selected]){--radio-fill: #1a5b93;--radio-fill-hover: #1f6eb2;--radio-fill-active: #2686d9}.dark a-radio[tone=success],.dark a-radio[tone-selected=success],.dark a-radio-group[tone=success] a-radio:not([tone]),.dark a-radio-group[tone-selected=success] a-radio:not([tone-selected]){--radio-fill: #226737;--radio-fill-hover: #2a7e43;--radio-fill-active: #329550}.dark a-radio[tone=warning],.dark a-radio[tone-selected=warning],.dark a-radio-group[tone=warning] a-radio:not([tone]),.dark a-radio-group[tone-selected=warning] a-radio:not([tone-selected]){--radio-fill: #7f410b;--radio-fill-hover: #995200;--radio-fill-active: #ae6613}.dark a-radio[tone=critical],.dark a-radio[tone-selected=critical],.dark a-radio-group[tone=critical] a-radio:not([tone]),.dark a-radio-group[tone-selected=critical] a-radio:not([tone-selected]){--radio-fill: #b02120;--radio-fill-hover: #c9302c;--radio-fill-active: #de4545}.dark a-radio[tone=brand],.dark a-radio-group[tone=brand] a-radio:not([tone]){--radio-bg: #0b0916;--radio-border: #483493;--radio-border-hover: #5f4bc3;--radio-border-active: #7460d7}.dark a-radio[tone=info],.dark a-radio-group[tone=info] a-radio:not([tone]){--radio-bg: #040d18;--radio-border: #175082;--radio-border-hover: #1f6eb2;--radio-border-active: #2686d9}.dark a-radio[tone=success],.dark a-radio-group[tone=success] a-radio:not([tone]){--radio-bg: #041008;--radio-border: #1f5c31;--radio-border-hover: #2a7e43;--radio-border-active: #329550}.dark a-radio[tone=warning],.dark a-radio-group[tone=warning] a-radio:not([tone]){--radio-bg: #120a03;--radio-border: #6a3b0c;--radio-border-hover: #995200;--radio-border-active: #ae6613}.dark a-radio[tone=critical],.dark a-radio-group[tone=critical] a-radio:not([tone]){--radio-bg: #190405;--radio-border: #a01c1c;--radio-border-hover: #c9302c;--radio-border-active: #de4545}}
1
+ @layer anta{a-radio{--radio-control-size: 16px;--radio-border-width: 1.5px;--radio-dot-size: 6px;--_radio-dot-adjust: 0px;--radio-gap: 8px;--radio-bg: var(--bg-1);--radio-fill: #878089;--radio-fill-hover: #776e77;--radio-fill-active: #635b65;--radio-border-neutral: #d4ced4;--radio-border: var(--radio-border-neutral);--radio-border-hover: #c1b9c1;--radio-border-active: #9f99a1;--radio-dot: #f6f4f6;--radio-dot-disabled: #c1b9c1;--radio-bg-disabled: color-mix(in oklch, #44374b 10%, transparent);--radio-border-disabled: color-mix(in oklch, #44374b 10%, transparent);--radio-label-color: var(--text-2);--radio-label-color-disabled: var(--text-4);--radio-hint-color: var(--text-3);--radio-label-fs: 15px;--radio-label-lh: 20px;--radio-hint-fs: 14px;--radio-hint-lh: 17px;display:inline-grid;grid-template-columns:auto 1fr;align-items:start;column-gap:var(--radio-gap);cursor:pointer;user-select:none;-webkit-user-drag:none;vertical-align:middle;outline:none;color:var(--radio-label-color);font-family:var(--sans-serif);font-size:var(--radio-label-fs);line-height:var(--radio-label-lh);font-feature-settings:"ss02","ss05","tnum";&:before{content:"";grid-column:1;grid-row:1 / -1;align-self:start;margin-block-start:calc((var(--radio-label-lh) - var(--radio-control-size)) / 2);box-sizing:border-box;inline-size:var(--radio-control-size);block-size:var(--radio-control-size);border-radius:50%;background:var(--radio-bg);border:var(--radio-border-width) solid var(--radio-border);transition:background-color .15s ease-out,border-color .15s ease-out}&:after{content:"";grid-column:1;grid-row:1 / -1;align-self:start;justify-self:center;margin-block-start:calc((var(--radio-label-lh) - (var(--radio-dot-size) - var(--_radio-dot-adjust))) / 2);inline-size:calc(var(--radio-dot-size) - var(--_radio-dot-adjust));block-size:calc(var(--radio-dot-size) - var(--_radio-dot-adjust));border-radius:50%;background:var(--radio-dot);transform:scale(0);transition:transform .12s ease-out;pointer-events:none}@media(hover:hover)and (pointer:fine){&:not([disabled]):hover:before{border-color:var(--radio-border-hover);transition:background-color 75ms ease-in,border-color 75ms ease-in}&:not([disabled]):hover:state(selected):before{background:var(--radio-fill-hover);border-color:var(--radio-fill-hover)}}&:not([disabled]):active:before{border-color:var(--radio-border-active);transition:background-color 50ms linear,border-color 50ms linear}&:not([disabled]):active:state(selected):before{background:var(--radio-fill-active);border-color:var(--radio-fill-active)}&:state(selected){&:before{background:var(--radio-fill);border-color:var(--radio-fill)}&:after{transform:scale(1)}}&:focus-visible:before{outline:1px solid var(--focus-ring);outline-offset:1px}&[disabled]{cursor:not-allowed;color:var(--radio-label-color-disabled);&:before{background:var(--radio-bg-disabled);border-color:var(--radio-border-disabled);transition:none}&:state(selected):after{background:var(--radio-dot-disabled)}a-radio-hint{color:var(--radio-label-color-disabled)}}&[size=small]{--radio-control-size: 14px;--radio-dot-size: 5px;--radio-gap: 6px;--radio-label-fs: 13px;--radio-label-lh: 16px;--radio-hint-fs: 12px;--radio-hint-lh: 14px}&[size=large]{--radio-control-size: 18px;--radio-dot-size: 7px;--radio-label-fs: 17px;--radio-label-lh: 22px;--radio-hint-fs: 16px;--radio-hint-lh: 21px}}a-radio-label,a-radio-hint{display:block;grid-column:2;min-width:0}a-radio-hint{color:var(--radio-hint-color);font-size:var(--radio-hint-fs);line-height:var(--radio-hint-lh);margin-block-start:2px}a-radio-group:focus-visible a-radio:state(selected):before{outline:1px solid var(--focus-ring);outline-offset:1px}a-radio[tone=brand],a-radio[tone-selected=brand],a-radio-group[tone=brand] a-radio:not([tone]),a-radio-group[tone-selected=brand] a-radio:not([tone-selected]){--radio-fill: #5f4bc3;--radio-fill-hover: #503cb4;--radio-fill-active: #483493}a-radio[tone=neutral],a-radio[tone-selected=neutral],a-radio-group[tone=neutral] a-radio:not([tone]),a-radio-group[tone-selected=neutral] a-radio:not([tone-selected]){--radio-fill: #878089;--radio-fill-hover: #776e77;--radio-fill-active: #635b65}a-radio[tone=info],a-radio[tone-selected=info],a-radio-group[tone=info] a-radio:not([tone]),a-radio-group[tone-selected=info] a-radio:not([tone-selected]){--radio-fill: #1f6eb2;--radio-fill-hover: #1a5b93;--radio-fill-active: #175082}a-radio[tone=success],a-radio[tone-selected=success],a-radio-group[tone=success] a-radio:not([tone]),a-radio-group[tone-selected=success] a-radio:not([tone-selected]){--radio-fill: #2a7e43;--radio-fill-hover: #226737;--radio-fill-active: #1f5c31}a-radio[tone=warning],a-radio[tone-selected=warning],a-radio-group[tone=warning] a-radio:not([tone]),a-radio-group[tone-selected=warning] a-radio:not([tone-selected]){--radio-fill: #c37416;--radio-fill-hover: #ae6613;--radio-fill-active: #995200}a-radio[tone=critical],a-radio[tone-selected=critical],a-radio-group[tone=critical] a-radio:not([tone]),a-radio-group[tone-selected=critical] a-radio:not([tone-selected]){--radio-fill: #c9302c;--radio-fill-hover: #b02120;--radio-fill-active: #a01c1c}a-radio[tone=brand],a-radio-group[tone=brand] a-radio:not([tone]){--radio-bg: #fcfcfe;--radio-border: #bcb1f1;--radio-border-hover: #9e8eeb;--radio-border-active: #9081df}a-radio[tone=info],a-radio-group[tone=info] a-radio:not([tone]){--radio-bg: #fbfcfe;--radio-border: #93c5ec;--radio-border-hover: #69ace5;--radio-border-active: #56a1e1}a-radio[tone=success],a-radio-group[tone=success] a-radio:not([tone]){--radio-bg: #f7fcf9;--radio-border: #88d7a0;--radio-border-hover: #5bc87b;--radio-border-active: #44c169}a-radio[tone=warning],a-radio-group[tone=warning] a-radio:not([tone]){--radio-bg: #fefbf6;--radio-border: #edb25a;--radio-border-hover: #e09127;--radio-border-active: #d88118}a-radio[tone=critical],a-radio-group[tone=critical] a-radio:not([tone]){--radio-bg: #fefbfb;--radio-border: #efa4a4;--radio-border-hover: #e87f7f;--radio-border-active: #e56c6c}a-radio[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-radio-group[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]) a-radio:not([tone]){--radio-bg: oklch(from var(--radio-tone-source) .99 calc(c*.03) h);--_radio-border-base: color-mix(in oklch, var(--radio-fill) 70%, var(--radio-border-neutral));--radio-border: oklch(from var(--_radio-border-base) calc(l + .17) c h);--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: var(--_radio-border-base);.dark &{--radio-bg: oklch(from var(--radio-tone-source) .15 calc(c*.18) h);--radio-border: var(--_radio-border-base);--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: oklch(from var(--_radio-border-base) calc(l + .17) c h)}}a-radio[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: attr(tone type(<color>), transparent)}a-radio[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]){--radio-tone-source: attr(tone-selected type(<color>), transparent)}a-radio[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-radio[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]),a-radio-group[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]) a-radio:not([tone]),a-radio-group[tone-selected]:not([tone-selected=""],[tone-selected=brand],[tone-selected=neutral],[tone-selected=info],[tone-selected=success],[tone-selected=warning],[tone-selected=critical]) a-radio:not([tone-selected]){--_tone-l-rest: .5;--_tone-l-hover: .45;--_tone-l-active: .4;--radio-fill: oklch(from var(--radio-tone-source) var(--_tone-l-rest) c h);--radio-fill-hover: oklch(from var(--radio-tone-source) var(--_tone-l-hover) c h);--radio-fill-active: oklch(from var(--radio-tone-source) var(--_tone-l-active) c h);.dark &{--_tone-l-rest: .45;--_tone-l-hover: .5;--_tone-l-active: .57}}.dark a-radio{--_radio-dot-adjust: 1px;&:after{box-shadow:0 0 1px 1px color-mix(in oklch,black 40%,transparent)}--radio-border-neutral: #49424c;--radio-border-hover: #635b65;--radio-border-active: #776e77;--radio-fill: #49424c;--radio-fill-hover: #534c57;--radio-fill-active: #635b65;--radio-dot: #ece9ec;--radio-dot-disabled: #534c57;--radio-bg-disabled: color-mix(in oklch, #e4d1ef 10%, transparent);--radio-border-disabled: color-mix(in oklch, #e4d1ef 10%, transparent)}.dark a-radio[tone=brand],.dark a-radio[tone-selected=brand],.dark a-radio-group[tone=brand] a-radio:not([tone]),.dark a-radio-group[tone-selected=brand] a-radio:not([tone-selected]){--radio-fill: #503cb4;--radio-fill-hover: #5f4bc3;--radio-fill-active: #7460d7}.dark a-radio[tone=neutral],.dark a-radio[tone-selected=neutral],.dark a-radio-group[tone=neutral] a-radio:not([tone]),.dark a-radio-group[tone-selected=neutral] a-radio:not([tone-selected]){--radio-fill: #49424c;--radio-fill-hover: #534c57;--radio-fill-active: #635b65}.dark a-radio[tone=info],.dark a-radio[tone-selected=info],.dark a-radio-group[tone=info] a-radio:not([tone]),.dark a-radio-group[tone-selected=info] a-radio:not([tone-selected]){--radio-fill: #1a5b93;--radio-fill-hover: #1f6eb2;--radio-fill-active: #2686d9}.dark a-radio[tone=success],.dark a-radio[tone-selected=success],.dark a-radio-group[tone=success] a-radio:not([tone]),.dark a-radio-group[tone-selected=success] a-radio:not([tone-selected]){--radio-fill: #226737;--radio-fill-hover: #2a7e43;--radio-fill-active: #329550}.dark a-radio[tone=warning],.dark a-radio[tone-selected=warning],.dark a-radio-group[tone=warning] a-radio:not([tone]),.dark a-radio-group[tone-selected=warning] a-radio:not([tone-selected]){--radio-fill: #7f410b;--radio-fill-hover: #995200;--radio-fill-active: #ae6613}.dark a-radio[tone=critical],.dark a-radio[tone-selected=critical],.dark a-radio-group[tone=critical] a-radio:not([tone]),.dark a-radio-group[tone-selected=critical] a-radio:not([tone-selected]){--radio-fill: #b02120;--radio-fill-hover: #c9302c;--radio-fill-active: #de4545}.dark a-radio[tone=brand],.dark a-radio-group[tone=brand] a-radio:not([tone]){--radio-bg: #0b0916;--radio-border: #483493;--radio-border-hover: #5f4bc3;--radio-border-active: #7460d7}.dark a-radio[tone=info],.dark a-radio-group[tone=info] a-radio:not([tone]){--radio-bg: #040d18;--radio-border: #175082;--radio-border-hover: #1f6eb2;--radio-border-active: #2686d9}.dark a-radio[tone=success],.dark a-radio-group[tone=success] a-radio:not([tone]){--radio-bg: #041008;--radio-border: #1f5c31;--radio-border-hover: #2a7e43;--radio-border-active: #329550}.dark a-radio[tone=warning],.dark a-radio-group[tone=warning] a-radio:not([tone]){--radio-bg: #120a03;--radio-border: #6a3b0c;--radio-border-hover: #995200;--radio-border-active: #ae6613}.dark a-radio[tone=critical],.dark a-radio-group[tone=critical] a-radio:not([tone]){--radio-bg: #190405;--radio-border: #a01c1c;--radio-border-hover: #c9302c;--radio-border-active: #de4545}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antadesign/anta",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",