@antadesign/anta 0.3.28 → 0.3.30
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/NOTICES.md +32 -1
- package/dist/anta_helpers.d.ts +21 -0
- package/dist/anta_helpers.js +24 -0
- package/dist/box-observation.d.ts +8 -0
- package/dist/box-observation.js +41 -0
- package/dist/box-types.d.ts +2 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +66 -29
- package/dist/components/Box.d.ts +28 -12
- package/dist/components/Box.js +18 -11
- package/dist/components/Breadcrumbs.css +1 -1
- package/dist/components/Breadcrumbs.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/ButtonCopy.d.ts +1 -1
- package/dist/components/Calendar.js +3 -5
- package/dist/components/Checkbox.d.ts +2 -2
- package/dist/components/Input.d.ts +8 -2
- package/dist/components/Input.js +4 -0
- package/dist/components/InputAutocomplete.js +3 -12
- package/dist/components/InputDate.css +1 -1
- package/dist/components/InputDate.js +2 -0
- package/dist/components/Menu.d.ts +4 -4
- package/dist/components/Menu.js +1 -1
- package/dist/components/Panel.d.ts +17 -0
- package/dist/components/Panel.js +22 -0
- package/dist/components/RadioGroup.d.ts +2 -1
- package/dist/components/Select.d.ts +14 -14
- package/dist/components/Select.js +47 -35
- package/dist/components/SelectFaceted.d.ts +17 -6
- package/dist/components/SelectFaceted.js +61 -41
- package/dist/components/Steps.css +1 -1
- package/dist/components/Switch.d.ts +3 -3
- package/dist/components/TabPanel.d.ts +3 -8
- package/dist/components/TabPanel.js +2 -1
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tabs.js +2 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/select-parts.css +1 -1
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-box.css +1 -1
- package/dist/elements/a-box.d.ts +6 -6
- package/dist/elements/a-box.js +76 -23
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +9 -1
- package/dist/elements/a-button.js +64 -1
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-capture.css +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.d.ts +3 -0
- package/dist/elements/a-checkbox.js +17 -1
- package/dist/elements/a-copy.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-icon.css +1 -1
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +1 -1
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.d.ts +8 -0
- package/dist/elements/a-input-time.js +115 -8
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.d.ts +27 -1
- package/dist/elements/a-input.js +176 -35
- package/dist/elements/a-loader.css +1 -1
- package/dist/elements/a-menu-group.css +1 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.js +1 -0
- package/dist/elements/a-menu-separator.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +8 -13
- package/dist/elements/a-menu.js +146 -45
- package/dist/elements/a-panel.css +1 -0
- package/dist/elements/a-panel.d.ts +16 -0
- package/dist/elements/a-panel.js +153 -0
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio-group.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-radio.d.ts +4 -0
- package/dist/elements/a-radio.js +18 -0
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.d.ts +1 -0
- package/dist/elements/a-slider.js +3 -3
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-switch.d.ts +3 -0
- package/dist/elements/a-switch.js +17 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabpanel.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-toast.css +1 -1
- package/dist/elements/a-toaster.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.js +30 -7
- package/dist/elements/focus.d.ts +9 -0
- package/dist/elements/focus.js +41 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/elements/panel-focus.d.ts +10 -0
- package/dist/elements/panel-focus.js +86 -0
- package/dist/elements/shadow-aria.d.ts +10 -0
- package/dist/elements/shadow-aria.js +155 -0
- package/dist/general_types.d.ts +48 -19
- package/dist/generate-icons.mjs +3 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +20 -1
- package/dist/jsx-runtime.js +12 -0
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +1 -1
- package/dist/theme-antune.css +1 -1
- package/dist/toaster.d.ts +1 -1
- package/dist/tokens.css +1 -1
- package/docs/accessibility.md +4 -2
- package/docs/changelog.md +89 -4
- package/docs/colors.md +6 -6
- package/docs/components/box.md +98 -34
- package/docs/components/breadcrumbs.md +33 -0
- package/docs/components/button.md +2 -2
- package/docs/components/capture.md +8 -8
- package/docs/components/checkbox.md +9 -4
- package/docs/components/input-autocomplete.md +6 -0
- package/docs/components/input-date.md +8 -2
- package/docs/components/input.md +99 -40
- package/docs/components/menu.md +3 -3
- package/docs/components/panel.md +189 -0
- package/docs/components/radio.md +4 -2
- package/docs/components/select-faceted.md +57 -2
- package/docs/components/select.md +63 -51
- package/docs/components/steps.md +4 -4
- package/docs/components/switch.md +12 -6
- package/docs/components/tabs.md +21 -8
- package/docs/components/tooltip.md +6 -4
- package/docs/index.md +2 -0
- package/docs/install-config.md +5 -4
- package/docs/normalization.md +3 -1
- package/docs/packages/plot.md +3771 -0
- package/docs/theming.md +1 -1
- package/package.json +16 -9
package/dist/elements/a-menu.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
HTMLElementBase,
|
|
3
|
+
SYNC_POPUP_ARIA,
|
|
4
|
+
anchorRect,
|
|
5
|
+
isPopupAriaReceiver,
|
|
6
|
+
setMenuPresence
|
|
7
|
+
} from "../anta_helpers";
|
|
8
|
+
import { AMenuItemElement, MENU_ITEM_SELECTOR, isMenuItemEl, ensureMenuItemKeyListener } from "./a-menu-item";
|
|
9
|
+
import { activeFocus, cycleFocus, focusParent, tabStops } from "./focus";
|
|
3
10
|
import { emitCopyRequest } from "./copy-behavior";
|
|
4
11
|
import "./a-menu.css";
|
|
5
12
|
const MARGIN = 4;
|
|
@@ -7,7 +14,7 @@ const MIN_HEIGHT = 96;
|
|
|
7
14
|
const SUBMENU_OPEN_DELAY = 130;
|
|
8
15
|
const SUBMENU_CLOSE_DELAY = 130;
|
|
9
16
|
const TYPEAHEAD_RESET = 500;
|
|
10
|
-
const SELF_ACTIVATING = 'a-button, button, a[href], input[type="button"], input[type="submit"], input[type="reset"], [role="button"]';
|
|
17
|
+
const SELF_ACTIVATING = 'a-button, a-input[button], button, a[href], input[type="button"], input[type="submit"], input[type="reset"], [role="button"]';
|
|
11
18
|
const EDITABLE_FIELD = "input:not([readonly]), textarea:not([readonly]), a-input:not([readonly]), a-input-time:not([readonly])";
|
|
12
19
|
const DECLARATIVE_TRIGGER = "[data-dialog-open], [data-dialog-close], [data-toast-dismiss], [data-banner-dismiss]";
|
|
13
20
|
const openStack = [];
|
|
@@ -36,16 +43,17 @@ function unbindDocListeners() {
|
|
|
36
43
|
boundView = null;
|
|
37
44
|
docBound = false;
|
|
38
45
|
}
|
|
39
|
-
function
|
|
46
|
+
function menuIndexForEvent(e, primaryClick = false) {
|
|
40
47
|
const path = e.composedPath();
|
|
41
|
-
for (
|
|
42
|
-
|
|
48
|
+
for (let i = openStack.length - 1; i >= 0; i--) {
|
|
49
|
+
const m = openStack[i];
|
|
50
|
+
if (path.includes(m.surface)) return i;
|
|
43
51
|
const anchor = m.triggerAnchor;
|
|
44
52
|
if (!anchor) continue;
|
|
45
53
|
if (primaryClick && m.hasAttribute("context")) continue;
|
|
46
|
-
if (path.includes(anchor)) return
|
|
54
|
+
if (path.includes(anchor)) return i;
|
|
47
55
|
}
|
|
48
|
-
return
|
|
56
|
+
return -1;
|
|
49
57
|
}
|
|
50
58
|
function pathCrossesTopLayerBeforeAnchor(e, anchor) {
|
|
51
59
|
for (const node of e.composedPath()) {
|
|
@@ -67,11 +75,12 @@ setMenuPresence({
|
|
|
67
75
|
});
|
|
68
76
|
function onDocPointerDown(e) {
|
|
69
77
|
if (!openStack.length) return;
|
|
70
|
-
|
|
78
|
+
const index = menuIndexForEvent(e, e.button === 0);
|
|
79
|
+
openStack[index + 1]?.requestClose(e);
|
|
71
80
|
}
|
|
72
81
|
function onDocContextMenu(e) {
|
|
73
82
|
if (!openStack.length) return;
|
|
74
|
-
if (
|
|
83
|
+
if (menuIndexForEvent(e) === -1) dismiss(e);
|
|
75
84
|
}
|
|
76
85
|
function onResize() {
|
|
77
86
|
if (!openStack.length) return;
|
|
@@ -116,7 +125,7 @@ function handleIntersection(entries) {
|
|
|
116
125
|
}
|
|
117
126
|
const lazyObserver = typeof IntersectionObserver !== "undefined" ? new IntersectionObserver(handleIntersection, { root: null, rootMargin: "0px", threshold: 0 }) : null;
|
|
118
127
|
class AMenuElement extends HTMLElementBase {
|
|
119
|
-
static observedAttributes = ["placement", "context", "coord", "offset", "nohover", "state", "stop-propagation"];
|
|
128
|
+
static observedAttributes = ["placement", "context", "coord", "offset", "nohover", "state", "stop-propagation", "role"];
|
|
120
129
|
/** Shadow-internal popover surface — the only thing we ever mutate. */
|
|
121
130
|
surface;
|
|
122
131
|
/** The scrolling body inside the surface (holds the items). */
|
|
@@ -140,10 +149,18 @@ class AMenuElement extends HTMLElementBase {
|
|
|
140
149
|
typeTimer;
|
|
141
150
|
// Combobox (filter) state — engaged when a `[data-menu-search]` field is slotted
|
|
142
151
|
// in (e.g. `Select` with `filter`). Focus stays in that field; ArrowUp/Down move
|
|
143
|
-
// `activeItem` (a cursor, not DOM focus) and
|
|
144
|
-
//
|
|
152
|
+
// `activeItem` (a cursor, not DOM focus) and associates it directly with an
|
|
153
|
+
// Anta Input's native field. The public `activedescendant` event remains an
|
|
154
|
+
// observation hook for raw/custom compositions.
|
|
145
155
|
activeItem = null;
|
|
146
156
|
comboObserver;
|
|
157
|
+
// A dialog-style filtered popup keeps its text field outside the menu role.
|
|
158
|
+
// The existing shadow scroll region becomes the menu that owns the option
|
|
159
|
+
// rows; this observer only tracks whether that region currently has items.
|
|
160
|
+
accessibilityObserver;
|
|
161
|
+
// Anta-owned trigger/search fields associated with this popup through direct
|
|
162
|
+
// ARIA element reflection. No renderer-local IDs are involved.
|
|
163
|
+
#ariaRelationTargets = /* @__PURE__ */ new Set();
|
|
147
164
|
// An open menu follows its anchor vertically through scrolling, transforms, and
|
|
148
165
|
// layout shifts. Those movements do not all produce a DOM observer callback, so
|
|
149
166
|
// this frame is active only while the menu is visible.
|
|
@@ -301,18 +318,26 @@ class AMenuElement extends HTMLElementBase {
|
|
|
301
318
|
connectedCallback() {
|
|
302
319
|
ensureMenuItemKeyListener(this.doc);
|
|
303
320
|
this.#syncStopPropagation();
|
|
321
|
+
this.#syncAccessibilityRegions();
|
|
304
322
|
const anchor = this.triggerAnchor;
|
|
305
323
|
if (anchor) {
|
|
306
324
|
anchorToMenu.set(anchor, this);
|
|
307
325
|
lazyObserver?.observe(anchor);
|
|
308
326
|
}
|
|
327
|
+
this.#syncPopupAriaRelations();
|
|
328
|
+
queueMicrotask(() => {
|
|
329
|
+
if (this.isConnected) this.#syncPopupAriaRelations();
|
|
330
|
+
});
|
|
309
331
|
if (this.hasAttribute("state")) requestAnimationFrame(() => this.syncState());
|
|
310
332
|
}
|
|
311
333
|
disconnectedCallback() {
|
|
312
|
-
this.hide();
|
|
334
|
+
this.hide(false);
|
|
313
335
|
this.teardownListeners();
|
|
314
336
|
this.cancelOpenTimer();
|
|
315
337
|
this.cancelCloseTimer();
|
|
338
|
+
this.accessibilityObserver?.disconnect();
|
|
339
|
+
this.accessibilityObserver = void 0;
|
|
340
|
+
this.#clearPopupAriaRelations();
|
|
316
341
|
const anchor = this.triggerAnchor;
|
|
317
342
|
if (anchor && anchorToMenu.get(anchor) === this) {
|
|
318
343
|
anchorToMenu.delete(anchor);
|
|
@@ -328,6 +353,10 @@ class AMenuElement extends HTMLElementBase {
|
|
|
328
353
|
this.#syncStopPropagation();
|
|
329
354
|
return;
|
|
330
355
|
}
|
|
356
|
+
if (name === "role") {
|
|
357
|
+
this.#syncAccessibilityRegions();
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
331
360
|
if (this.listening) {
|
|
332
361
|
this.teardownListeners();
|
|
333
362
|
this.setupListeners();
|
|
@@ -427,11 +456,9 @@ class AMenuElement extends HTMLElementBase {
|
|
|
427
456
|
}
|
|
428
457
|
return el.getClientRects().length > 0;
|
|
429
458
|
}
|
|
430
|
-
/**
|
|
431
|
-
* End / type-ahead navigation). Same visibility / disabled / ownership
|
|
432
|
-
* filter — just narrowed to `a-menu-item`. */
|
|
459
|
+
/** Custom menu rows that support the combobox cursor and selection state. */
|
|
433
460
|
focusableItems() {
|
|
434
|
-
return this.
|
|
461
|
+
return this.navigableItems().filter(
|
|
435
462
|
(el) => el instanceof AMenuItemElement
|
|
436
463
|
);
|
|
437
464
|
}
|
|
@@ -441,18 +468,22 @@ class AMenuElement extends HTMLElementBase {
|
|
|
441
468
|
* custom-element-only because the combobox cursor (`setActive`) and selection
|
|
442
469
|
* seating are `a-menu-item` affordances a plain link doesn't carry. */
|
|
443
470
|
navigableItems() {
|
|
444
|
-
return this.
|
|
445
|
-
}
|
|
446
|
-
/** Every tabbable element belonging to THIS menu (items + nested controls
|
|
447
|
-
* like inputs / sliders / buttons), in DOM order, visible and enabled —
|
|
448
|
-
* used to trap Tab within the open menu. Submenu contents are excluded
|
|
449
|
-
* (their nearest `a-menu` is the submenu). */
|
|
450
|
-
focusables() {
|
|
451
|
-
const sel = 'a-menu-item, a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), a-input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [data-menu-search]';
|
|
452
|
-
return Array.from(this.querySelectorAll(sel)).filter(
|
|
471
|
+
return [...this.querySelectorAll(MENU_ITEM_SELECTOR)].filter(
|
|
453
472
|
(el) => el.closest("a-menu") === this && !el.hasAttribute("disabled") && this.isVisible(el)
|
|
454
473
|
);
|
|
455
474
|
}
|
|
475
|
+
/** Tab stops in rendered order, excluding controls owned by nested menus. */
|
|
476
|
+
focusables() {
|
|
477
|
+
return tabStops(this.surface).filter((el) => {
|
|
478
|
+
if (el.hasAttribute("disabled")) return false;
|
|
479
|
+
let node = el;
|
|
480
|
+
while (node) {
|
|
481
|
+
if (node.nodeType === 1 && node.localName === "a-menu") return node === this;
|
|
482
|
+
node = focusParent(node);
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
});
|
|
486
|
+
}
|
|
456
487
|
/** On open, seat initial focus like a native `<select>` / macOS menu: a menu
|
|
457
488
|
* carrying a current value opens *at* that value, not at the top. Brings the
|
|
458
489
|
* first selected row into view and, when opened via keyboard, focuses it;
|
|
@@ -513,10 +544,79 @@ class AMenuElement extends HTMLElementBase {
|
|
|
513
544
|
if (el && el.closest("a-menu") === this) return el;
|
|
514
545
|
return this.#comboAnchor;
|
|
515
546
|
}
|
|
516
|
-
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
|
|
547
|
+
/** Give a dialog's scrolling body menu semantics when it contains menu items.
|
|
548
|
+
* Headers and footers stay outside the menu. Empty bodies and plain editors
|
|
549
|
+
* have no inner menu role. All mutations stay in shadow DOM. */
|
|
550
|
+
#syncAccessibilityRegions() {
|
|
551
|
+
if (!this.scrollEl) return;
|
|
552
|
+
const dialog = this.getAttribute("role") === "dialog";
|
|
553
|
+
if (dialog && this.isConnected && !this.accessibilityObserver) {
|
|
554
|
+
this.accessibilityObserver = new this.view.MutationObserver(() => this.#syncAccessibilityRegions());
|
|
555
|
+
this.accessibilityObserver.observe(this, {
|
|
556
|
+
childList: true,
|
|
557
|
+
subtree: true,
|
|
558
|
+
attributes: true,
|
|
559
|
+
attributeFilter: ["data-menu-search", "slot"]
|
|
560
|
+
});
|
|
561
|
+
} else if (!dialog && this.accessibilityObserver) {
|
|
562
|
+
this.accessibilityObserver.disconnect();
|
|
563
|
+
this.accessibilityObserver = void 0;
|
|
564
|
+
}
|
|
565
|
+
const hasBodyItem = dialog && [...this.querySelectorAll(MENU_ITEM_SELECTOR)].some((item) => {
|
|
566
|
+
if (item.closest("a-menu") !== this) return false;
|
|
567
|
+
let region = item;
|
|
568
|
+
while (region.parentElement && region.parentElement !== this) region = region.parentElement;
|
|
569
|
+
const slot = region.getAttribute("slot");
|
|
570
|
+
return slot !== "header" && slot !== "footer";
|
|
571
|
+
});
|
|
572
|
+
if (hasBodyItem) {
|
|
573
|
+
this.scrollEl.setAttribute("role", "menu");
|
|
574
|
+
this.scrollEl.setAttribute("aria-label", "Options");
|
|
575
|
+
this.scrollEl.setAttribute("aria-orientation", "vertical");
|
|
576
|
+
} else {
|
|
577
|
+
this.scrollEl.removeAttribute("role");
|
|
578
|
+
this.scrollEl.removeAttribute("aria-label");
|
|
579
|
+
this.scrollEl.removeAttribute("aria-orientation");
|
|
580
|
+
}
|
|
581
|
+
this.#syncPopupAriaRelations();
|
|
582
|
+
}
|
|
583
|
+
/** Associate the popup with its Anta-owned trigger and filter field. Both
|
|
584
|
+
* control the popup host; the active option is a direct element reference.
|
|
585
|
+
* The host target also works when the options region lives in another shadow
|
|
586
|
+
* root, which ARIA element reflection does not expose through its getter. */
|
|
587
|
+
#syncPopupAriaRelations() {
|
|
588
|
+
if (!this.isConnected) return;
|
|
589
|
+
const next = /* @__PURE__ */ new Map();
|
|
590
|
+
const anchor = this.triggerAnchor;
|
|
591
|
+
const search = this.#searchField;
|
|
592
|
+
if (isPopupAriaReceiver(anchor)) {
|
|
593
|
+
next.set(anchor, {
|
|
594
|
+
controls: this,
|
|
595
|
+
activeDescendant: search === anchor ? this.activeItem : null
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
if (search !== anchor && isPopupAriaReceiver(search)) {
|
|
599
|
+
next.set(search, {
|
|
600
|
+
controls: this,
|
|
601
|
+
activeDescendant: this.activeItem
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
for (const target of this.#ariaRelationTargets) {
|
|
605
|
+
if (!next.has(target)) target[SYNC_POPUP_ARIA]({ source: this, clear: true });
|
|
606
|
+
}
|
|
607
|
+
for (const [target, relations] of next) {
|
|
608
|
+
target[SYNC_POPUP_ARIA]({ source: this, ...relations });
|
|
609
|
+
}
|
|
610
|
+
this.#ariaRelationTargets = new Set(next.keys());
|
|
611
|
+
}
|
|
612
|
+
#clearPopupAriaRelations() {
|
|
613
|
+
for (const target of this.#ariaRelationTargets)
|
|
614
|
+
target[SYNC_POPUP_ARIA]({ source: this, clear: true });
|
|
615
|
+
this.#ariaRelationTargets.clear();
|
|
616
|
+
}
|
|
617
|
+
/** Move the combobox cursor. Sets the item's `active` property for its
|
|
618
|
+
* off-DOM highlight/selected state, associates it directly with an Anta
|
|
619
|
+
* Input, and reports it for raw/custom observers. `null` clears the cursor. */
|
|
520
620
|
setActive(item) {
|
|
521
621
|
if (this.activeItem && this.activeItem !== item) this.activeItem.active = false;
|
|
522
622
|
this.activeItem = item;
|
|
@@ -524,6 +624,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
524
624
|
item.active = true;
|
|
525
625
|
item.scrollIntoView?.({ block: "nearest" });
|
|
526
626
|
}
|
|
627
|
+
this.#syncPopupAriaRelations();
|
|
527
628
|
this.dispatchEvent(
|
|
528
629
|
new CustomEvent("activedescendant", { detail: { id: item?.id ?? null } })
|
|
529
630
|
);
|
|
@@ -719,9 +820,9 @@ class AMenuElement extends HTMLElementBase {
|
|
|
719
820
|
});
|
|
720
821
|
this.comboObserver.observe(this, { childList: true });
|
|
721
822
|
}
|
|
722
|
-
/** Apply CLOSE
|
|
723
|
-
*
|
|
724
|
-
hide() {
|
|
823
|
+
/** Apply CLOSE without notifying this menu's owner. Notify nested menus so
|
|
824
|
+
* their controlled state follows the closing parent. */
|
|
825
|
+
hide(notifyDescendants = true) {
|
|
725
826
|
this.comboObserver?.disconnect();
|
|
726
827
|
this.comboObserver = void 0;
|
|
727
828
|
this.setActive(null);
|
|
@@ -732,7 +833,11 @@ class AMenuElement extends HTMLElementBase {
|
|
|
732
833
|
if (this._shown) this._doHide();
|
|
733
834
|
return;
|
|
734
835
|
}
|
|
735
|
-
for (let i = openStack.length - 1; i >= idx; i--)
|
|
836
|
+
for (let i = openStack.length - 1; i >= idx; i--) {
|
|
837
|
+
const menu = openStack[i];
|
|
838
|
+
if (notifyDescendants && i > idx && menu.isOpen && !menu._dismissNotified) menu.emitChange("closed");
|
|
839
|
+
menu._doHide();
|
|
840
|
+
}
|
|
736
841
|
openStack.length = idx;
|
|
737
842
|
if (openStack.length === 0) unbindDocListeners();
|
|
738
843
|
}
|
|
@@ -1038,16 +1143,10 @@ class AMenuElement extends HTMLElementBase {
|
|
|
1038
1143
|
this.requestClose(e);
|
|
1039
1144
|
return;
|
|
1040
1145
|
}
|
|
1041
|
-
const
|
|
1042
|
-
if (!
|
|
1146
|
+
const targets = this.focusables();
|
|
1147
|
+
if (!targets.length) return;
|
|
1043
1148
|
e.preventDefault();
|
|
1044
|
-
|
|
1045
|
-
if (i === -1) {
|
|
1046
|
-
f[0]?.focus();
|
|
1047
|
-
return;
|
|
1048
|
-
}
|
|
1049
|
-
const next = e.shiftKey ? i === 0 ? f.length - 1 : i - 1 : i === f.length - 1 ? 0 : i + 1;
|
|
1050
|
-
f[next]?.focus();
|
|
1149
|
+
cycleFocus(targets, activeFocus(this.doc), e.shiftKey);
|
|
1051
1150
|
return;
|
|
1052
1151
|
}
|
|
1053
1152
|
const search = this.#searchField;
|
|
@@ -1181,7 +1280,9 @@ class AMenuElement extends HTMLElementBase {
|
|
|
1181
1280
|
};
|
|
1182
1281
|
const onKey = (e) => {
|
|
1183
1282
|
if (this._shown) return;
|
|
1184
|
-
if (anchor.
|
|
1283
|
+
if (anchor.hasAttribute("disabled") || anchor.hasAttribute("loading")) return;
|
|
1284
|
+
const arrow = e.key === "ArrowDown" || e.key === "ArrowUp";
|
|
1285
|
+
if (!arrow && anchor.matches(SELF_ACTIVATING)) return;
|
|
1185
1286
|
const editable = anchor.matches(EDITABLE_FIELD);
|
|
1186
1287
|
const opens = e.key === "ArrowDown" || e.key === "ArrowUp" || !editable && (e.key === "Enter" || e.key === " ");
|
|
1187
1288
|
if (!opens) return;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer base,anta,components,utilities;@layer anta.reset,anta.components,anta.theme;@layer anta.components{a-panel{display:block;box-sizing:border-box;width:100%;height:100%;min-width:0;min-height:0;overflow:scroll}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-panel.css';
|
|
3
|
+
/** A persistent container whose slotted surface can occupy the viewport. */
|
|
4
|
+
export declare class APanelElement extends HTMLElementBase {
|
|
5
|
+
#private;
|
|
6
|
+
static observedAttributes: string[];
|
|
7
|
+
constructor();
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
disconnectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(): void;
|
|
11
|
+
/** Request viewport maximization. Controlled panels wait for `state`. */
|
|
12
|
+
requestMaximize(): void;
|
|
13
|
+
/** Request a return to normal layout, keeping the content mounted. */
|
|
14
|
+
requestRestore(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function register_a_panel(): void;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
+
import { activeFocus, PanelFocusScope } from "./panel-focus";
|
|
3
|
+
import "./a-panel.css";
|
|
4
|
+
const SHADOW_STYLE = `
|
|
5
|
+
slot:not([popover]) { display: contents; }
|
|
6
|
+
slot:popover-open {
|
|
7
|
+
display: block;
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
width: auto;
|
|
11
|
+
height: auto;
|
|
12
|
+
max-width: none;
|
|
13
|
+
max-height: none;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
border: 0;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
overflow: scroll;
|
|
19
|
+
overscroll-behavior: contain;
|
|
20
|
+
color: inherit;
|
|
21
|
+
background: inherit;
|
|
22
|
+
}
|
|
23
|
+
slot::backdrop { background: transparent; pointer-events: none; }
|
|
24
|
+
.placeholder { display: none; }
|
|
25
|
+
.placeholder.active {
|
|
26
|
+
display: block;
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
max-width: 100%;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const parseState = (value) => value === "maximized" ? "maximized" : "normal";
|
|
33
|
+
class APanelElement extends HTMLElementBase {
|
|
34
|
+
static observedAttributes = ["state"];
|
|
35
|
+
#surface;
|
|
36
|
+
#placeholder;
|
|
37
|
+
#internals;
|
|
38
|
+
#wanted = "normal";
|
|
39
|
+
#seeded = false;
|
|
40
|
+
#ready = false;
|
|
41
|
+
#focus;
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.#internals = this.attachInternals();
|
|
45
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
46
|
+
const doc = this.ownerDocument;
|
|
47
|
+
const style = doc.createElement("style");
|
|
48
|
+
style.textContent = SHADOW_STYLE;
|
|
49
|
+
this.#surface = doc.createElement("slot");
|
|
50
|
+
this.#surface.setAttribute("part", "content");
|
|
51
|
+
this.#focus = new PanelFocusScope(this.#surface);
|
|
52
|
+
this.#placeholder = doc.createElement("div");
|
|
53
|
+
this.#placeholder.className = "placeholder";
|
|
54
|
+
this.#placeholder.setAttribute("aria-hidden", "true");
|
|
55
|
+
shadow.append(style, this.#placeholder, this.#surface);
|
|
56
|
+
this.#surface.addEventListener("toggle", () => {
|
|
57
|
+
if (this.#ready && this.isConnected) this.#apply();
|
|
58
|
+
});
|
|
59
|
+
this.addEventListener("panelmaximizerequest", this.#onRequest);
|
|
60
|
+
this.addEventListener("panelrestorerequest", this.#onRequest);
|
|
61
|
+
this.addEventListener("paneltoggle", this.#onRequest);
|
|
62
|
+
}
|
|
63
|
+
get #current() {
|
|
64
|
+
return typeof this.#surface.showPopover === "function" && this.#surface.matches(":popover-open") ? "maximized" : "normal";
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
if (this.hasAttribute("state")) this.#wanted = parseState(this.getAttribute("state"));
|
|
68
|
+
else if (!this.#seeded) this.#wanted = parseState(this.getAttribute("default-state"));
|
|
69
|
+
this.#seeded = true;
|
|
70
|
+
queueMicrotask(() => {
|
|
71
|
+
if (!this.isConnected) return;
|
|
72
|
+
this.#ready = true;
|
|
73
|
+
this.#apply();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
this.#ready = false;
|
|
78
|
+
this.#restoreSurface(false);
|
|
79
|
+
}
|
|
80
|
+
attributeChangedCallback() {
|
|
81
|
+
if (!this.hasAttribute("state")) return;
|
|
82
|
+
this.#wanted = parseState(this.getAttribute("state"));
|
|
83
|
+
if (this.#ready && this.isConnected) this.#apply();
|
|
84
|
+
}
|
|
85
|
+
/** Request viewport maximization. Controlled panels wait for `state`. */
|
|
86
|
+
requestMaximize() {
|
|
87
|
+
this.#request("maximized");
|
|
88
|
+
}
|
|
89
|
+
/** Request a return to normal layout, keeping the content mounted. */
|
|
90
|
+
requestRestore() {
|
|
91
|
+
this.#request("normal");
|
|
92
|
+
}
|
|
93
|
+
#onRequest = (event) => {
|
|
94
|
+
const owner = event.composedPath().find((node) => node instanceof Element && node.localName === "a-panel");
|
|
95
|
+
if (owner !== this || event.defaultPrevented) return;
|
|
96
|
+
this.#request(event.type === "paneltoggle" ? this.#current === "maximized" ? "normal" : "maximized" : event.type === "panelmaximizerequest" ? "maximized" : "normal");
|
|
97
|
+
};
|
|
98
|
+
#request(next) {
|
|
99
|
+
const prev = this.#current;
|
|
100
|
+
if (next === prev) return;
|
|
101
|
+
const accepted = this.dispatchEvent(new CustomEvent("statechange", {
|
|
102
|
+
cancelable: true,
|
|
103
|
+
detail: { next, prev }
|
|
104
|
+
}));
|
|
105
|
+
if (!accepted || this.hasAttribute("state")) return;
|
|
106
|
+
this.#wanted = next;
|
|
107
|
+
if (this.#ready && this.isConnected) this.#apply();
|
|
108
|
+
}
|
|
109
|
+
#apply() {
|
|
110
|
+
if (this.#current === this.#wanted && (this.#wanted === "maximized" || !this.#surface.hasAttribute("popover"))) return;
|
|
111
|
+
if (this.#wanted === "maximized") {
|
|
112
|
+
if (typeof this.#surface.showPopover !== "function") return;
|
|
113
|
+
const focused = activeFocus(this.ownerDocument);
|
|
114
|
+
const styles = this.ownerDocument.defaultView.getComputedStyle(this);
|
|
115
|
+
const borderBox = styles.boxSizing === "border-box";
|
|
116
|
+
const borderWidth = parseFloat(styles.borderLeftWidth) + parseFloat(styles.borderRightWidth);
|
|
117
|
+
const borderHeight = parseFloat(styles.borderTopWidth) + parseFloat(styles.borderBottomWidth);
|
|
118
|
+
const scrollbarWidth = Math.max(0, this.offsetWidth - this.clientWidth - Math.round(borderWidth));
|
|
119
|
+
const scrollbarHeight = Math.max(0, this.offsetHeight - this.clientHeight - Math.round(borderHeight));
|
|
120
|
+
const width = parseFloat(styles.width) - (borderBox ? parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight) + borderWidth : 0) - scrollbarWidth;
|
|
121
|
+
const height = parseFloat(styles.height) - (borderBox ? parseFloat(styles.paddingTop) + parseFloat(styles.paddingBottom) + borderHeight : 0) - scrollbarHeight;
|
|
122
|
+
this.#placeholder.style.width = `${Math.max(0, width || 0)}px`;
|
|
123
|
+
this.#placeholder.style.height = `${Math.max(0, height || 0)}px`;
|
|
124
|
+
this.#placeholder.classList.add("active");
|
|
125
|
+
this.#surface.tabIndex = -1;
|
|
126
|
+
this.#surface.setAttribute("popover", "manual");
|
|
127
|
+
this.#focus.activate(focused);
|
|
128
|
+
this.#surface.showPopover();
|
|
129
|
+
this.#internals.states?.add("maximized");
|
|
130
|
+
this.#focus.focusInside(focused);
|
|
131
|
+
} else {
|
|
132
|
+
this.#restoreSurface();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
#restoreSurface(restoreFocus = true) {
|
|
136
|
+
const returnFocus = this.#focus.deactivate();
|
|
137
|
+
if (this.#current === "maximized") this.#surface.hidePopover();
|
|
138
|
+
this.#surface.removeAttribute("popover");
|
|
139
|
+
this.#surface.removeAttribute("tabindex");
|
|
140
|
+
this.#placeholder.classList.remove("active");
|
|
141
|
+
this.#internals.states?.delete("maximized");
|
|
142
|
+
if (restoreFocus) returnFocus();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function register_a_panel() {
|
|
146
|
+
if (typeof customElements === "undefined") return;
|
|
147
|
+
if (!customElements.get("a-panel")) customElements.define("a-panel", APanelElement);
|
|
148
|
+
}
|
|
149
|
+
register_a_panel();
|
|
150
|
+
export {
|
|
151
|
+
APanelElement,
|
|
152
|
+
register_a_panel
|
|
153
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{:where(a-progress,progress[data-anta]){--progress-bg: var(--bg-4);--progress-border-color: var(--border-4);--progress-indicator-bg: var(--bg-5);--progress-indicator-edge: linear-gradient( 90deg, var(--progress-indicator-bg) 0%, var(--progress-border-color) 100% );--progress-text-color: var(--text-2);--progress-hint-color: var(--text-3);--progress-loading-angle: 125deg;--progress-loading-x-period: calc(40px + 5cqi) ;--progress-loading-period: calc( var(--progress-loading-x-period) * cos(var(--progress-loading-angle) - 90deg) );--progress-loading-stripe: calc(var(--progress-loading-period) * 2 / 5);--progress-loading-stripe-gap: calc(var(--progress-loading-period) * 3 / 5);--progress-loading-opacity: .15;--progress-loading-blur: clamp(8px, 2cqi, 16px);--progress-loading-duration: .5s;--progress-padding-block: 4px;--progress-padding-inline: 8px;--progress-min-height: 8px;--progress-label-size: 13px;--progress-label-line-height: 16px}a-progress{display:block;container-type:inline-size;padding:var(--progress-padding-block) var(--progress-padding-inline);min-height:var(--progress-min-height);background:var(--progress-bg);border:0px solid var(--progress-border-color);border-radius:0}:where(a-progress,progress[data-anta])[size=small]{--progress-padding-block: 2px;--progress-padding-inline: 6px;--progress-label-size: 12px;--progress-label-line-height: 14px}:where(a-progress,progress[data-anta])[size=large]{--progress-padding-block: 6px;--progress-padding-inline: 10px;--progress-label-size: 15px;--progress-label-line-height: 20px}a-progress[round]{--progress-round: 999px;border-radius:var(--progress-round)}@supports (border-radius: attr(round type(<length>),999px)){a-progress[round]{--progress-round: attr(round type(<length>), 999px)}}:where(a-progress,progress[data-anta])[tone=brand]{--progress-bg: var(--bg-4-brand);--progress-border-color: var(--border-4-brand);--progress-indicator-bg: var(--bg-5-brand);--progress-text-color: var(--text-2-brand);--progress-hint-color: var(--text-3-brand)}:where(a-progress,progress[data-anta])[tone=info]{--progress-bg: var(--bg-4-info);--progress-border-color: var(--border-4-info);--progress-indicator-bg: var(--bg-5-info);--progress-text-color: var(--text-2-info);--progress-hint-color: var(--text-3-info)}:where(a-progress,progress[data-anta])[tone=success]{--progress-bg: var(--bg-4-success);--progress-border-color: var(--border-4-success);--progress-indicator-bg: var(--bg-5-success);--progress-text-color: var(--text-2-success);--progress-hint-color: var(--text-3-success)}:where(a-progress,progress[data-anta])[tone=warning]{--progress-bg: var(--bg-4-warning);--progress-border-color: var(--border-4-warning);--progress-indicator-bg: var(--bg-5-warning);--progress-text-color: var(--text-2-warning);--progress-hint-color: var(--text-3-warning)}:where(a-progress,progress[data-anta])[tone=critical]{--progress-bg: var(--bg-4-critical);--progress-border-color: var(--border-4-critical);--progress-indicator-bg: var(--bg-5-critical);--progress-text-color: var(--text-2-critical);--progress-hint-color: var(--text-3-critical)}@supports (color: attr(tone type(<color>),transparent)){:where(a-progress,progress[data-anta])[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--progress-tone-source: attr(tone type(<color>), transparent);--progress-bg: light-dark(oklch(from var(--progress-tone-source) .955 .02 h), oklch(from var(--progress-tone-source) .185 .05 h));--progress-border-color: light-dark(oklch(from var(--progress-tone-source) .9 .04 h), oklch(from var(--progress-tone-source) .26 .06 h));--progress-indicator-bg: light-dark(oklch(from var(--progress-tone-source) .935 .03 h), oklch(from var(--progress-tone-source) .205 .055 h));--progress-text-color: light-dark(oklch(from var(--progress-tone-source) .43 .15 h), oklch(from var(--progress-tone-source) .77 .11 h));--progress-hint-color: light-dark( color-mix(in oklch, var(--progress-text-color) 82%, transparent), color-mix(in oklch, var(--progress-text-color) 80%, transparent) )}}a-progress-label{display:flex;align-items:flex-start;gap:.5ch;font-variant-numeric:lining-nums tabular-nums;letter-spacing:.
|
|
1
|
+
@layer base,anta,components,utilities;@layer anta.reset,anta.components,anta.theme;@layer anta.components{:where(a-progress,progress[data-anta]){--progress-bg: var(--bg-4);--progress-border-color: var(--border-4);--progress-indicator-bg: var(--bg-5);--progress-indicator-edge: linear-gradient( 90deg, var(--progress-indicator-bg) 0%, var(--progress-border-color) 100% );--progress-text-color: var(--text-2);--progress-hint-color: var(--text-3);--progress-loading-angle: 125deg;--progress-loading-x-period: calc(40px + 5cqi) ;--progress-loading-period: calc( var(--progress-loading-x-period) * cos(var(--progress-loading-angle) - 90deg) );--progress-loading-stripe: calc(var(--progress-loading-period) * 2 / 5);--progress-loading-stripe-gap: calc(var(--progress-loading-period) * 3 / 5);--progress-loading-opacity: .15;--progress-loading-blur: clamp(8px, 2cqi, 16px);--progress-loading-duration: .5s;--progress-padding-block: 4px;--progress-padding-inline: 8px;--progress-min-height: 8px;--progress-label-size: 13px;--progress-label-line-height: 16px}a-progress{display:block;container-type:inline-size;padding:var(--progress-padding-block) var(--progress-padding-inline);min-height:var(--progress-min-height);background:var(--progress-bg);border:0px solid var(--progress-border-color);border-radius:0}:where(a-progress,progress[data-anta])[size=small]{--progress-padding-block: 2px;--progress-padding-inline: 6px;--progress-label-size: 12px;--progress-label-line-height: 14px}:where(a-progress,progress[data-anta])[size=large]{--progress-padding-block: 6px;--progress-padding-inline: 10px;--progress-label-size: 15px;--progress-label-line-height: 20px}a-progress[round]{--progress-round: 999px;border-radius:var(--progress-round)}@supports (border-radius: attr(round type(<length>),999px)){a-progress[round]{--progress-round: attr(round type(<length>), 999px)}}:where(a-progress,progress[data-anta])[tone=brand]{--progress-bg: var(--bg-4-brand);--progress-border-color: var(--border-4-brand);--progress-indicator-bg: var(--bg-5-brand);--progress-text-color: var(--text-2-brand);--progress-hint-color: var(--text-3-brand)}:where(a-progress,progress[data-anta])[tone=info]{--progress-bg: var(--bg-4-info);--progress-border-color: var(--border-4-info);--progress-indicator-bg: var(--bg-5-info);--progress-text-color: var(--text-2-info);--progress-hint-color: var(--text-3-info)}:where(a-progress,progress[data-anta])[tone=success]{--progress-bg: var(--bg-4-success);--progress-border-color: var(--border-4-success);--progress-indicator-bg: var(--bg-5-success);--progress-text-color: var(--text-2-success);--progress-hint-color: var(--text-3-success)}:where(a-progress,progress[data-anta])[tone=warning]{--progress-bg: var(--bg-4-warning);--progress-border-color: var(--border-4-warning);--progress-indicator-bg: var(--bg-5-warning);--progress-text-color: var(--text-2-warning);--progress-hint-color: var(--text-3-warning)}:where(a-progress,progress[data-anta])[tone=critical]{--progress-bg: var(--bg-4-critical);--progress-border-color: var(--border-4-critical);--progress-indicator-bg: var(--bg-5-critical);--progress-text-color: var(--text-2-critical);--progress-hint-color: var(--text-3-critical)}@supports (color: attr(tone type(<color>),transparent)){:where(a-progress,progress[data-anta])[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--progress-tone-source: attr(tone type(<color>), transparent);--progress-bg: light-dark(oklch(from var(--progress-tone-source) .955 .02 h), oklch(from var(--progress-tone-source) .185 .05 h));--progress-border-color: light-dark(oklch(from var(--progress-tone-source) .9 .04 h), oklch(from var(--progress-tone-source) .26 .06 h));--progress-indicator-bg: light-dark(oklch(from var(--progress-tone-source) .935 .03 h), oklch(from var(--progress-tone-source) .205 .055 h));--progress-text-color: light-dark(oklch(from var(--progress-tone-source) .43 .15 h), oklch(from var(--progress-tone-source) .77 .11 h));--progress-hint-color: light-dark( color-mix(in oklch, var(--progress-text-color) 82%, transparent), color-mix(in oklch, var(--progress-text-color) 80%, transparent) )}}a-progress-label{display:flex;align-items:flex-start;gap:.5ch;font-variant-numeric:lining-nums tabular-nums;letter-spacing:.02em;font-size:var(--progress-label-size);line-height:var(--progress-label-line-height)}a-progress-number{flex-shrink:0;color:var(--progress-text-color)}a-progress-text{flex:1 1 auto;min-width:0;color:var(--progress-text-color)}a-progress-hint{flex-shrink:0;margin-left:auto;color:var(--progress-hint-color)}progress[data-anta]{--anta-native-progress-height: calc( var(--progress-min-height) + var(--progress-padding-block) + var(--progress-padding-block) );--anta-native-progress-radius: 0px;--anta-native-progress-fill: linear-gradient( 90deg, var(--progress-indicator-bg) 0%, var(--progress-indicator-bg) calc(100% - 90px) , var(--progress-border-color) 100% );box-sizing:border-box;display:block;position:relative;container-type:inline-size;inline-size:100%;block-size:var(--anta-native-progress-height);margin:0;padding:0;border:0;border-radius:var(--anta-native-progress-radius);appearance:none;-webkit-appearance:none;-moz-appearance:none;background:var(--progress-bg);overflow:hidden;vertical-align:middle}progress[data-anta][round]{--anta-native-progress-radius: 999px}@supports (border-radius: attr(round type(<length>),999px)){progress[data-anta][round]{--anta-native-progress-radius: attr(round type(<length>), 999px)}}progress[data-anta]::-webkit-progress-bar{border-radius:var(--anta-native-progress-radius);background:var(--progress-bg)}progress[data-anta]::-webkit-progress-value{border-radius:var(--anta-native-progress-radius);background:var(--anta-native-progress-fill)}progress[data-anta]::-moz-progress-bar{border:0;border-radius:var(--anta-native-progress-radius);background:var(--anta-native-progress-fill)}progress[data-anta]:not([value]):before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--progress-loading-x-period));width:calc(100% + var(--progress-loading-x-period));pointer-events:none;background:repeating-linear-gradient(var(--progress-loading-angle),transparent 0,transparent var(--progress-loading-stripe-gap),var(--progress-text-color) var(--progress-loading-stripe-gap),var(--progress-text-color) calc(var(--progress-loading-stripe-gap) + var(--progress-loading-stripe)));filter:blur(var(--progress-loading-blur));opacity:var(--progress-loading-opacity);will-change:transform}@media(prefers-reduced-motion:no-preference){progress[data-anta]:not([value]):before{animation:progress-native-loading-slide var(--progress-loading-duration) linear infinite;animation-delay:-9999s}}@keyframes progress-native-loading-slide{to{transform:translate(var(--progress-loading-x-period))}}@media(forced-colors:active){:where(a-progress,progress[data-anta]){forced-color-adjust:none;--progress-bg: Canvas !important;--progress-border-color: CanvasText !important;--progress-indicator-bg: light-dark(SelectedItem, Highlight) !important;--progress-indicator-edge: light-dark(SelectedItem, Highlight) !important;--progress-indicator-edge-border: 1px solid light-dark(SelectedItemText, HighlightText) !important;--progress-text-color: CanvasText !important;--progress-hint-color: CanvasText !important;border:1px dotted CanvasText!important}}}a-progress>p:last-child,a-progress>:not([slot])>p:last-child{margin-block-end:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{a-radio-group{--radio-group-hint: var(--text-3);display:flex;flex-direction:column}a-radio-list{display:flex;flex-direction:column;gap:8px}a-radio-group[orientation=horizontal] a-radio-list{flex-direction:row;flex-wrap:wrap;gap:16px}a-radio-list:not(:first-child){margin-block-start:10px}a-radio-group-label{display:block;color:var(--text-3);font-family:var(--sans-serif);font-size:15px;line-height:20px;font-weight:500}a-radio-group-hint{display:block;color:var(--radio-group-hint);font-size:14px;line-height:17px;margin-block-start:2px}a-radio-group[status=critical]{--radio-group-hint: var(--text-2-critical)}a-radio-group[status=warning]{--radio-group-hint: var(--text-2-warning)}a-radio-group[status=success]{--radio-group-hint: var(--text-2-success)}a-radio-group[status=info]{--radio-group-hint: var(--text-2-info)}a-radio-group[status=brand]{--radio-group-hint: var(--text-2-brand)}a-radio-group[size=small] a-radio:not([size]){--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}a-radio-group[size=large] a-radio:not([size]){--radio-control-size: 18px;--radio-dot-size: 7px;--radio-label-fs: 17px;--radio-label-lh: 24px;--radio-hint-fs: 16px;--radio-hint-lh: 21px}a-radio-group[disabled]{--radio-group-hint: var(--text-5)}a-radio-group[disabled] a-radio{cursor:not-allowed;pointer-events:none;color:var(--radio-label-color-disabled);--radio-hint-color: var(--radio-label-color-disabled);--radio-bg: var(--radio-bg-disabled);--radio-border: var(--radio-border-disabled);--radio-border-hover: var(--radio-border-disabled);--radio-border-active: var(--radio-border-disabled);--radio-bg-selected: var(--radio-bg-disabled);--radio-bg-selected-hover: var(--radio-bg-disabled);--radio-bg-selected-active: var(--radio-bg-disabled);--radio-dot: var(--radio-dot-disabled)}}
|
|
1
|
+
@layer base,anta,components,utilities;@layer anta.reset,anta.components,anta.theme;@layer anta.components{a-radio-group{--radio-group-hint: var(--text-3);display:flex;flex-direction:column}a-radio-list{display:flex;flex-direction:column;gap:8px}a-radio-group[orientation=horizontal] a-radio-list{flex-direction:row;flex-wrap:wrap;gap:16px}a-radio-list:not(:first-child){margin-block-start:10px}a-radio-group-label{display:block;color:var(--text-3);font-family:var(--sans-serif);font-size:15px;line-height:20px;font-weight:500}a-radio-group-hint{display:block;color:var(--radio-group-hint);font-size:14px;line-height:17px;margin-block-start:2px}a-radio-group[status=critical]{--radio-group-hint: var(--text-2-critical)}a-radio-group[status=warning]{--radio-group-hint: var(--text-2-warning)}a-radio-group[status=success]{--radio-group-hint: var(--text-2-success)}a-radio-group[status=info]{--radio-group-hint: var(--text-2-info)}a-radio-group[status=brand]{--radio-group-hint: var(--text-2-brand)}a-radio-group[size=small] a-radio:not([size]){--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}a-radio-group[size=large] a-radio:not([size]){--radio-control-size: 18px;--radio-dot-size: 7px;--radio-label-fs: 17px;--radio-label-lh: 24px;--radio-hint-fs: 16px;--radio-hint-lh: 21px}a-radio-group[disabled]{--radio-group-hint: var(--text-5)}a-radio-group[disabled] a-radio{cursor:not-allowed;pointer-events:none;color:var(--radio-label-color-disabled);--radio-hint-color: var(--radio-label-color-disabled);--radio-bg: var(--radio-bg-disabled);--radio-border: var(--radio-border-disabled);--radio-border-hover: var(--radio-border-disabled);--radio-border-active: var(--radio-border-disabled);--radio-bg-selected: var(--radio-bg-disabled);--radio-bg-selected-hover: var(--radio-bg-disabled);--radio-bg-selected-active: var(--radio-bg-disabled);--radio-dot: var(--radio-dot-disabled)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{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-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .6 c h), oklch(from var(--radio-tone-source) .42 c h));--radio-bg-selected-hover: oklch(from var(--radio-tone-source) .45 c h);--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-border-neutral: var(--border-3);--radio-border: var(--radio-border-neutral);--radio-border-hover: var(--border-2);--radio-border-active: var(--border-1);--radio-dot: light-dark(#f6f4f6, #ece9ec);--radio-dot-disabled: light-dark(#c1b9c1, #534c57);--radio-bg-disabled: light-dark(color-mix(in oklch, #44374b 10%, transparent), color-mix(in oklch, #e4d1ef 10%, transparent));--radio-border-disabled: var(--radio-bg-disabled);--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);&: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);box-shadow:0 0 1px 1px light-dark(transparent,color-mix(in oklch,black 40%,transparent));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-bg-selected-hover);border-color:var(--radio-bg-selected-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-bg-selected-active);border-color:var(--radio-bg-selected-active)}&:state(selected){&:before{background:var(--radio-bg-selected);border-color:var(--radio-bg-selected)}&:after{transform:scale(1)}}&:focus-visible{outline:none}&: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]:not([tone=""],[tone=neutral]),a-radio-group[tone]:not([tone=""],[tone=neutral]) a-radio:not([tone]){--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .5 c h), oklch(from var(--radio-tone-source) .45 c h));--radio-bg-selected-hover: light-dark(oklch(from var(--radio-tone-source) .45 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .57 c h))}a-radio[tone=brand],a-radio-group[tone=brand] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-brand);--radio-off-tone-source: var(--anta-seed-brand)}a-radio[tone=info],a-radio-group[tone=info] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-info);--radio-off-tone-source: var(--anta-seed-info)}a-radio[tone=success],a-radio-group[tone=success] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-success);--radio-off-tone-source: var(--anta-seed-success)}a-radio[tone=warning],a-radio-group[tone=warning] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-warning);--radio-off-tone-source: var(--anta-seed-warning)}a-radio[tone=critical],a-radio-group[tone=critical] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-critical);--radio-off-tone-source: var(--anta-seed-critical)}a-radio[tone=neutral],a-radio-group[tone=neutral] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral)}a-radio[tone]:not([tone=""],[tone=neutral],[tone-scope=selected]),a-radio-group[tone]:not([tone=""],[tone=neutral],[tone-scope=selected]) a-radio:not([tone],[tone-scope=selected]),a-radio-group[tone]:not([tone=""],[tone=neutral])[tone-scope=selected] a-radio[tone-scope=all]:not([tone]){--radio-bg: light-dark(oklch(from var(--radio-off-tone-source) .99 calc(c*.03) h), oklch(from var(--radio-off-tone-source) .15 calc(c*.18) h));--_radio-off-bg-selected: var(--radio-bg-selected);--_radio-border-base: color-mix(in oklch, var(--_radio-off-bg-selected) 70%, var(--radio-border-neutral));--radio-border: light-dark(oklch(from var(--_radio-border-base) calc(l + .17) c h), var(--_radio-border-base));--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: light-dark(var(--_radio-border-base), 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: transparent;--radio-off-tone-source: transparent;@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), transparent);--radio-off-tone-source: attr(tone type(<color>), transparent)}}a-radio-group[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: transparent;--radio-off-tone-source: transparent;@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), transparent);--radio-off-tone-source: attr(tone type(<color>), transparent)}}a-radio-group[tone]:where(:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical])) a-radio:not([tone]){--radio-tone-source: inherit;--radio-off-tone-source: inherit}.dark a-radio{--_radio-dot-adjust: 1px}label:has(>input[data-anta][type=radio]){display:inline-flex;align-items:center;gap:8px;color:var(--text-2);font-family:var(--sans-serif);font-size:15px;line-height:20px}input[data-anta][type=radio]{--radio-control-size: 16px;--radio-dot-core: 3px;--radio-dot-edge: 3.5px;--radio-bg: var(--bg-1);--radio-border-neutral: var(--border-3);--radio-border: var(--radio-border-neutral);--radio-border-hover: var(--border-2);--radio-border-active: var(--border-1);--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .6 c h), oklch(from var(--radio-tone-source) .42 c h));--radio-bg-selected-hover: oklch(from var(--radio-tone-source) .45 c h);--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-dot: light-dark(#f6f4f6, #ece9ec);box-sizing:border-box;flex:0 0 var(--radio-control-size);inline-size:var(--radio-control-size);block-size:var(--radio-control-size);margin:0;appearance:none;-webkit-appearance:none;border:1.5px solid var(--radio-border);border-radius:50%;background-color:var(--radio-bg);cursor:pointer;vertical-align:middle;transition:background-color .15s ease-out,border-color .15s ease-out}label:has(>input[data-anta][type=radio][size=small]){gap:6px;font-size:13px;line-height:16px}label:has(>input[data-anta][type=radio][size=large]){font-size:17px;line-height:22px}input[data-anta][type=radio][size=small]{--radio-control-size: 14px;--radio-dot-core: 2.5px;--radio-dot-edge: 3px}input[data-anta][type=radio][size=large]{--radio-control-size: 18px;--radio-dot-core: 3.5px;--radio-dot-edge: 4px}input[data-anta][type=radio][tone]:not([tone=""],[tone=neutral]){--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .5 c h), oklch(from var(--radio-tone-source) .45 c h));--radio-bg-selected-hover: light-dark(oklch(from var(--radio-tone-source) .45 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .57 c h))}input[data-anta][type=radio][tone=brand]{--radio-tone-source: var(--anta-seed-brand);--radio-off-tone-source: var(--anta-seed-brand)}input[data-anta][type=radio][tone=info]{--radio-tone-source: var(--anta-seed-info);--radio-off-tone-source: var(--anta-seed-info)}input[data-anta][type=radio][tone=success]{--radio-tone-source: var(--anta-seed-success);--radio-off-tone-source: var(--anta-seed-success)}input[data-anta][type=radio][tone=warning]{--radio-tone-source: var(--anta-seed-warning);--radio-off-tone-source: var(--anta-seed-warning)}input[data-anta][type=radio][tone=critical]{--radio-tone-source: var(--anta-seed-critical);--radio-off-tone-source: var(--anta-seed-critical)}input[data-anta][type=radio][tone=neutral]{--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral)}input[data-anta][type=radio][tone]:not([tone=""],[tone=neutral],[tone-scope=selected]){--radio-bg: light-dark(oklch(from var(--radio-off-tone-source) .99 calc(c*.03) h), oklch(from var(--radio-off-tone-source) .15 calc(c*.18) h));--_radio-off-bg-selected: var(--radio-bg-selected);--_radio-border-base: color-mix(in oklch, var(--_radio-off-bg-selected) 70%, var(--radio-border-neutral));--radio-border: light-dark(oklch(from var(--_radio-border-base) calc(l + .17) c h), var(--_radio-border-base));--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: light-dark(var(--_radio-border-base), oklch(from var(--_radio-border-base) calc(l + .17) c h))}input[data-anta][type=radio][tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), var(--anta-seed-neutral));--radio-off-tone-source: attr(tone type(<color>), var(--anta-seed-neutral))}}@media(hover:hover)and (pointer:fine){input[data-anta][type=radio]:not(:disabled):hover{border-color:var(--radio-border-hover)}input[data-anta][type=radio]:not(:disabled):hover:checked{border-color:var(--radio-bg-selected-hover);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected-hover) var(--radio-dot-edge))}}input[data-anta][type=radio]:not(:disabled):active{border-color:var(--radio-border-active)}input[data-anta][type=radio]:not(:disabled):active:checked{border-color:var(--radio-bg-selected-active);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected-active) var(--radio-dot-edge))}input[data-anta][type=radio]:checked{border-color:var(--radio-bg-selected);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected) var(--radio-dot-edge))}input[data-anta][type=radio]:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}input[data-anta][type=radio]:disabled{border-color:color-mix(in oklch,var(--text-1) 10%,transparent);background-color:color-mix(in oklch,var(--text-1) 10%,transparent);cursor:not-allowed}input[data-anta][type=radio]:disabled:checked{border-color:color-mix(in oklch,var(--text-1) 10%,transparent);background:radial-gradient(circle,var(--text-4) 0 var(--radio-dot-core),color-mix(in oklch,var(--text-1) 10%,transparent) var(--radio-dot-edge))}@media(forced-colors:active){a-radio:state(selected):before{forced-color-adjust:none;background-color:Highlight;border-color:Highlight}a-radio:state(selected):after{forced-color-adjust:none;background-color:HighlightText;box-shadow:none}a-radio[disabled]:before{background-color:Canvas;border-color:GrayText}a-radio[disabled]:state(selected):after{background-color:GrayText}}}
|
|
1
|
+
@layer base,anta,components,utilities;@layer anta.reset,anta.components,anta.theme;@layer anta.components{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-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .6 c h), oklch(from var(--radio-tone-source) .42 c h));--radio-bg-selected-hover: oklch(from var(--radio-tone-source) .45 c h);--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-border-neutral: var(--border-3);--radio-border: var(--radio-border-neutral);--radio-border-hover: var(--border-2);--radio-border-active: var(--border-1);--radio-dot: light-dark(#f6f4f6, #ece9ec);--radio-dot-disabled: light-dark(#c1b9c1, #534c57);--radio-bg-disabled: light-dark(color-mix(in oklch, #44374b 10%, transparent), color-mix(in oklch, #e4d1ef 10%, transparent));--radio-border-disabled: var(--radio-bg-disabled);--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);&: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);box-shadow:0 0 1px 1px light-dark(transparent,color-mix(in oklch,black 40%,transparent));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-bg-selected-hover);border-color:var(--radio-bg-selected-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-bg-selected-active);border-color:var(--radio-bg-selected-active)}&:state(selected){&:before{background:var(--radio-bg-selected);border-color:var(--radio-bg-selected)}&:after{transform:scale(1)}}&:focus-visible{outline:none}&: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]:not([tone=""],[tone=neutral]),a-radio-group[tone]:not([tone=""],[tone=neutral]) a-radio:not([tone]){--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .5 c h), oklch(from var(--radio-tone-source) .45 c h));--radio-bg-selected-hover: light-dark(oklch(from var(--radio-tone-source) .45 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .57 c h))}a-radio[tone=brand],a-radio-group[tone=brand] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-brand);--radio-off-tone-source: var(--anta-seed-brand)}a-radio[tone=info],a-radio-group[tone=info] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-info);--radio-off-tone-source: var(--anta-seed-info)}a-radio[tone=success],a-radio-group[tone=success] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-success);--radio-off-tone-source: var(--anta-seed-success)}a-radio[tone=warning],a-radio-group[tone=warning] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-warning);--radio-off-tone-source: var(--anta-seed-warning)}a-radio[tone=critical],a-radio-group[tone=critical] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-critical);--radio-off-tone-source: var(--anta-seed-critical)}a-radio[tone=neutral],a-radio-group[tone=neutral] a-radio:not([tone]){--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral)}a-radio[tone]:not([tone=""],[tone=neutral],[tone-scope=selected]),a-radio-group[tone]:not([tone=""],[tone=neutral],[tone-scope=selected]) a-radio:not([tone],[tone-scope=selected]),a-radio-group[tone]:not([tone=""],[tone=neutral])[tone-scope=selected] a-radio[tone-scope=all]:not([tone]){--radio-bg: light-dark(oklch(from var(--radio-off-tone-source) .99 calc(c*.03) h), oklch(from var(--radio-off-tone-source) .15 calc(c*.18) h));--_radio-off-bg-selected: var(--radio-bg-selected);--_radio-border-base: color-mix(in oklch, var(--_radio-off-bg-selected) 70%, var(--radio-border-neutral));--radio-border: light-dark(oklch(from var(--_radio-border-base) calc(l + .17) c h), var(--_radio-border-base));--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: light-dark(var(--_radio-border-base), 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: transparent;--radio-off-tone-source: transparent;@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), transparent);--radio-off-tone-source: attr(tone type(<color>), transparent)}}a-radio-group[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: transparent;--radio-off-tone-source: transparent;@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), transparent);--radio-off-tone-source: attr(tone type(<color>), transparent)}}a-radio-group[tone]:where(:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical])) a-radio:not([tone]){--radio-tone-source: inherit;--radio-off-tone-source: inherit}.dark a-radio{--_radio-dot-adjust: 1px}label:has(>input[data-anta][type=radio]){display:inline-flex;align-items:center;gap:8px;color:var(--text-2);font-family:var(--sans-serif);font-size:15px;line-height:20px}input[data-anta][type=radio]{--radio-control-size: 16px;--radio-dot-core: 3px;--radio-dot-edge: 3.5px;--radio-bg: var(--bg-1);--radio-border-neutral: var(--border-3);--radio-border: var(--radio-border-neutral);--radio-border-hover: var(--border-2);--radio-border-active: var(--border-1);--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .6 c h), oklch(from var(--radio-tone-source) .42 c h));--radio-bg-selected-hover: oklch(from var(--radio-tone-source) .45 c h);--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-dot: light-dark(#f6f4f6, #ece9ec);box-sizing:border-box;flex:0 0 var(--radio-control-size);inline-size:var(--radio-control-size);block-size:var(--radio-control-size);margin:0;appearance:none;-webkit-appearance:none;border:1.5px solid var(--radio-border);border-radius:50%;background-color:var(--radio-bg);cursor:pointer;vertical-align:middle;transition:background-color .15s ease-out,border-color .15s ease-out}label:has(>input[data-anta][type=radio][size=small]){gap:6px;font-size:13px;line-height:16px}label:has(>input[data-anta][type=radio][size=large]){font-size:17px;line-height:22px}input[data-anta][type=radio][size=small]{--radio-control-size: 14px;--radio-dot-core: 2.5px;--radio-dot-edge: 3px}input[data-anta][type=radio][size=large]{--radio-control-size: 18px;--radio-dot-core: 3.5px;--radio-dot-edge: 4px}input[data-anta][type=radio][tone]:not([tone=""],[tone=neutral]){--radio-bg-selected: light-dark(oklch(from var(--radio-tone-source) .5 c h), oklch(from var(--radio-tone-source) .45 c h));--radio-bg-selected-hover: light-dark(oklch(from var(--radio-tone-source) .45 c h), oklch(from var(--radio-tone-source) .5 c h));--radio-bg-selected-active: light-dark(oklch(from var(--radio-tone-source) .4 c h), oklch(from var(--radio-tone-source) .57 c h))}input[data-anta][type=radio][tone=brand]{--radio-tone-source: var(--anta-seed-brand);--radio-off-tone-source: var(--anta-seed-brand)}input[data-anta][type=radio][tone=info]{--radio-tone-source: var(--anta-seed-info);--radio-off-tone-source: var(--anta-seed-info)}input[data-anta][type=radio][tone=success]{--radio-tone-source: var(--anta-seed-success);--radio-off-tone-source: var(--anta-seed-success)}input[data-anta][type=radio][tone=warning]{--radio-tone-source: var(--anta-seed-warning);--radio-off-tone-source: var(--anta-seed-warning)}input[data-anta][type=radio][tone=critical]{--radio-tone-source: var(--anta-seed-critical);--radio-off-tone-source: var(--anta-seed-critical)}input[data-anta][type=radio][tone=neutral]{--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral)}input[data-anta][type=radio][tone]:not([tone=""],[tone=neutral],[tone-scope=selected]){--radio-bg: light-dark(oklch(from var(--radio-off-tone-source) .99 calc(c*.03) h), oklch(from var(--radio-off-tone-source) .15 calc(c*.18) h));--_radio-off-bg-selected: var(--radio-bg-selected);--_radio-border-base: color-mix(in oklch, var(--_radio-off-bg-selected) 70%, var(--radio-border-neutral));--radio-border: light-dark(oklch(from var(--_radio-border-base) calc(l + .17) c h), var(--_radio-border-base));--radio-border-hover: oklch(from var(--_radio-border-base) calc(l + .1) c h);--radio-border-active: light-dark(var(--_radio-border-base), oklch(from var(--_radio-border-base) calc(l + .17) c h))}input[data-anta][type=radio][tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--radio-tone-source: var(--anta-seed-neutral);--radio-off-tone-source: var(--anta-seed-neutral);@supports (color: attr(probe type(<color>),red)){--radio-tone-source: attr(tone type(<color>), var(--anta-seed-neutral));--radio-off-tone-source: attr(tone type(<color>), var(--anta-seed-neutral))}}@media(hover:hover)and (pointer:fine){input[data-anta][type=radio]:not(:disabled):hover{border-color:var(--radio-border-hover)}input[data-anta][type=radio]:not(:disabled):hover:checked{border-color:var(--radio-bg-selected-hover);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected-hover) var(--radio-dot-edge))}}input[data-anta][type=radio]:not(:disabled):active{border-color:var(--radio-border-active)}input[data-anta][type=radio]:not(:disabled):active:checked{border-color:var(--radio-bg-selected-active);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected-active) var(--radio-dot-edge))}input[data-anta][type=radio]:checked{border-color:var(--radio-bg-selected);background:radial-gradient(circle,var(--radio-dot) 0 var(--radio-dot-core),var(--radio-bg-selected) var(--radio-dot-edge))}input[data-anta][type=radio]:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}input[data-anta][type=radio]:disabled{border-color:color-mix(in oklch,var(--text-1) 10%,transparent);background-color:color-mix(in oklch,var(--text-1) 10%,transparent);cursor:not-allowed}input[data-anta][type=radio]:disabled:checked{border-color:color-mix(in oklch,var(--text-1) 10%,transparent);background:radial-gradient(circle,var(--text-4) 0 var(--radio-dot-core),color-mix(in oklch,var(--text-1) 10%,transparent) var(--radio-dot-edge))}@media(forced-colors:active){a-radio:state(selected):before{forced-color-adjust:none;background-color:Highlight;border-color:Highlight}a-radio:state(selected):after{forced-color-adjust:none;background-color:HighlightText;box-shadow:none}a-radio[disabled]:before{background-color:Canvas;border-color:GrayText}a-radio[disabled]:state(selected):after{background-color:GrayText}}}
|
|
@@ -2,5 +2,9 @@ import { SelectableChildElement } from "../anta_helpers";
|
|
|
2
2
|
import "./a-radio.css";
|
|
3
3
|
export declare class ARadioElement extends SelectableChildElement {
|
|
4
4
|
protected ariaProp: "ariaChecked";
|
|
5
|
+
private accessibilityObserver?;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
private syncAccessibilityRelations;
|
|
5
9
|
}
|
|
6
10
|
export declare function register_a_radio(): void;
|
package/dist/elements/a-radio.js
CHANGED
|
@@ -2,6 +2,24 @@ import { SelectableChildElement } from "../anta_helpers";
|
|
|
2
2
|
import "./a-radio.css";
|
|
3
3
|
class ARadioElement extends SelectableChildElement {
|
|
4
4
|
ariaProp = "ariaChecked";
|
|
5
|
+
accessibilityObserver;
|
|
6
|
+
connectedCallback() {
|
|
7
|
+
super.connectedCallback();
|
|
8
|
+
this.syncAccessibilityRelations();
|
|
9
|
+
this.accessibilityObserver ??= new this.view.MutationObserver(
|
|
10
|
+
() => this.syncAccessibilityRelations()
|
|
11
|
+
);
|
|
12
|
+
this.accessibilityObserver.observe(this, { childList: true });
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
this.accessibilityObserver?.disconnect();
|
|
16
|
+
}
|
|
17
|
+
syncAccessibilityRelations() {
|
|
18
|
+
this.applyAccessibilityRelations(
|
|
19
|
+
Array.from(this.querySelectorAll(":scope > a-radio-label")),
|
|
20
|
+
Array.from(this.querySelectorAll(":scope > a-radio-hint"))
|
|
21
|
+
);
|
|
22
|
+
}
|
|
5
23
|
}
|
|
6
24
|
function register_a_radio() {
|
|
7
25
|
if (typeof customElements === "undefined") return;
|