@antadesign/anta 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -36
- package/dist/anta_helpers.js +5 -0
- package/dist/components/Button.d.ts +20 -64
- package/dist/components/Button.js +15 -27
- package/dist/components/ButtonCopy.d.ts +43 -25
- package/dist/components/ButtonCopy.js +46 -4
- package/dist/components/Expander.js +1 -1
- package/dist/components/InputDate.d.ts +9 -1
- package/dist/components/InputDate.js +4 -1
- package/dist/components/Menu.d.ts +6 -5
- package/dist/components/MenuItem.d.ts +2 -9
- package/dist/components/MenuItem.js +2 -16
- package/dist/components/MenuItemCopy.d.ts +22 -19
- package/dist/components/MenuItemCopy.js +38 -3
- package/dist/components/Select.d.ts +63 -51
- package/dist/components/Select.js +9 -8
- package/dist/components/SelectFaceted.d.ts +21 -16
- package/dist/components/SelectFaceted.js +2 -2
- package/dist/components/Text.d.ts +2 -2
- package/dist/components/Title.d.ts +2 -2
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/copy-props.d.ts +72 -0
- package/dist/components/copy-props.js +20 -0
- package/dist/components/select-options.d.ts +10 -5
- package/dist/components/select-options.js +1 -1
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +0 -7
- package/dist/elements/a-button.js +0 -23
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-copy.css +1 -0
- package/dist/elements/a-copy.d.ts +16 -0
- package/dist/elements/a-copy.js +148 -0
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -18
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +2 -2
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.d.ts +6 -6
- package/dist/elements/a-menu-item.js +0 -4
- package/dist/elements/a-menu.d.ts +6 -2
- package/dist/elements/a-menu.js +67 -31
- package/dist/elements/a-radio-group.css +1 -1
- package/dist/elements/a-radio-group.d.ts +1 -0
- package/dist/elements/a-radio-group.js +11 -2
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.d.ts +1 -0
- package/dist/elements/a-tabs.js +35 -6
- 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-tooltip.js +1 -1
- package/dist/elements/copy-behavior.d.ts +6 -5
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/elements/key-activation.d.ts +5 -9
- package/dist/elements/key-activation.js +0 -1
- package/dist/general_types.d.ts +32 -41
- package/dist/index.d.ts +3 -2
- package/dist/jsx-runtime.d.ts +2 -1
- package/dist/reset.css +1 -1
- package/dist/theme-anta.css +1 -0
- package/dist/tokens.css +1 -1
- package/package.json +2 -1
- package/dist/components/Card.module.css +0 -35
- package/dist/components/Progress.module.css +0 -0
- package/dist/components/Radio.d.ts +0 -37
- package/dist/components/Radio.js +0 -33
- package/dist/components/Tab.d.ts +0 -37
- package/dist/components/Tab.js +0 -5
- package/dist/components/Tabs.module.css +0 -1
- package/dist/components/Text.module.css +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-menu-item:not(:defined){display:none}a[data-anta-menu-item]{text-decoration:none}a-menu-item,a[data-anta-menu-item]{--menu-item-color: var(--text-2);--menu-item-icon-color: var(--text-3);--menu-item-hint-color: var(--text-3);--menu-item-hover: 5%;--menu-item-active: 8%;--menu-item-selected: 8%;--menu-item-timing-in: 60ms ease-in-out;--menu-item-timing-out: .28s ease-out;--menu-item-padding-x: 8px;--menu-item-padding-y: 6px;display:flex;flex-shrink:0;align-items:center;gap:.6ch;box-sizing:border-box;width:100%;min-height:28px;padding-block:var(--menu-item-padding-y);padding-inline:var(--menu-item-padding-x);border-radius:var(--radius-sm, 4px);color:var(--menu-item-color);background:transparent;transition:background-color var(--menu-item-timing-out);font:inherit;font-size:14px;line-height:16px;text-align:left;white-space:nowrap;cursor:pointer;user-select:none;outline:none}a-menu[round] a-menu-item,a-menu[round] a[data-anta-menu-item]{border-radius:999px}a-menu-item:hover,a-menu-item:focus-visible,a[data-anta-menu-item]:hover,a[data-anta-menu-item]:focus-visible,a-menu-item:has(>a-menu:state(open)),a-menu-item:state(active){background:color-mix(in oklch,currentColor var(--menu-item-hover),transparent);transition:background-color var(--menu-item-timing-in)}a-menu-item:active,a[data-anta-menu-item]:active{background:color-mix(in oklch,currentColor var(--menu-item-active),transparent);transition:none}a-menu-item[selected],a[data-anta-menu-item][aria-current=true]{background:color-mix(in oklch,currentColor var(--menu-item-selected),transparent)}a-menu-item:focus-visible,a[data-anta-menu-item]:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}a-menu-item>a-menu-item-label,a-menu-item>a-menu-item-text,a[data-anta-menu-item]>a-menu-item-label,a[data-anta-menu-item]>a-menu-item-text{flex:1 1 auto;min-width:0}a-menu-item>a-menu-item-text,a[data-anta-menu-item]>a-menu-item-text{display:flex;flex-direction:column}a-menu-item:has(>a-menu-item-text),a[data-anta-menu-item]:has(>a-menu-item-text){align-items:flex-start}a-menu-item-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis}a-menu-item-hint{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;margin-block-start:1px;color:var(--menu-item-hint-color);font-size:12px;line-height:15px}a-menu-item>a-icon,a[data-anta-menu-item]>a-icon{flex:none;--icon-size: 16px;color:var(--menu-item-icon-color)}a-menu-item>a-checkbox,a-menu-item>a-radio{flex:none;--checkbox-gap: 0;--radio-gap: 0;pointer-events:none}a-menu-item>a-checkbox:before,a-menu-item>a-checkbox:after,a-menu-item>a-radio:before{margin-block-start:0}a-menu-item>a-radio:after{margin-block-start:calc((var(--radio-control-size) - (var(--radio-dot-size) - var(--_radio-dot-adjust))) / 2)}a-menu-item:has(>:is(a-icon,a-checkbox,a-radio,[data-indicator]):first-child:not(:only-child)),a[data-anta-menu-item]:has(>:is(a-icon,[data-indicator]):first-child:not(:only-child)){padding-inline-start:var(--menu-item-padding-y)}a-menu-item:not([submenu]):has(>a-icon:last-child:not(:only-child)),a[data-anta-menu-item]:has(>a-icon:last-child:not(:only-child)){padding-inline-end:max(0px,var(--menu-item-padding-x) - 2px)}a-menu-item>kbd,a[data-anta-menu-item]>kbd{flex:none;margin-left:auto;padding-left:12px;color:var(--text-5);font:inherit;font-size:1em;letter-spacing:.1ch;white-space:nowrap}a-menu-item[submenu]>a-icon:last-of-type{margin-left:auto}a-menu-item[submenu]>a-icon:last-of-type,a-menu-item>a-icon:last-child:not(:only-child),a[data-anta-menu-item]>a-icon:last-child:not(:only-child){position:relative;inset-inline-end:-2px}a-menu-item[tone=brand],a-menu-item[tone=info],a-menu-item[tone=success],a-menu-item[tone=warning],a-menu-item[tone=critical],a[data-anta-menu-item][tone=brand],a[data-anta-menu-item][tone=info],a[data-anta-menu-item][tone=success],a[data-anta-menu-item][tone=warning],a[data-anta-menu-item][tone=critical]{--menu-item-icon-color: var(--menu-item-color)}a-menu-item[tone=brand],a[data-anta-menu-item][tone=brand]{--menu-item-color: var(--text-2-brand);--menu-item-hint-color: var(--text-3-brand)}a-menu-item[tone=info],a[data-anta-menu-item][tone=info]{--menu-item-color: var(--text-2-info);--menu-item-hint-color: var(--text-3-info)}a-menu-item[tone=success],a[data-anta-menu-item][tone=success]{--menu-item-color: var(--text-2-success);--menu-item-hint-color: var(--text-3-success)}a-menu-item[tone=warning],a[data-anta-menu-item][tone=warning]{--menu-item-color: var(--text-2-warning);--menu-item-hint-color: var(--text-3-warning)}a-menu-item[tone=critical],a[data-anta-menu-item][tone=critical]{--menu-item-color: var(--text-2-critical);--menu-item-hint-color: var(--text-3-critical)}a-menu-item[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[data-anta-menu-item][tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--menu-item-tone-source: attr(tone type(<color>), var(--text-2));--menu-item-color: oklch(from var(--menu-item-tone-source) .45 c h);--menu-item-icon-color: var(--menu-item-color);--menu-item-hint-color: oklch(from var(--menu-item-tone-source) .
|
|
1
|
+
@layer anta{a-menu-item:not(:defined){display:none}a[data-anta-menu-item]{text-decoration:none}a-menu-item,a[data-anta-menu-item]{--menu-item-color: var(--text-2);--menu-item-icon-color: var(--text-3);--menu-item-hint-color: var(--text-3);--menu-item-hover: 5%;--menu-item-active: 8%;--menu-item-selected: 8%;--menu-item-timing-in: 60ms ease-in-out;--menu-item-timing-out: .28s ease-out;--menu-item-padding-x: 8px;--menu-item-padding-y: 6px;display:flex;flex-shrink:0;align-items:center;gap:.6ch;box-sizing:border-box;width:100%;min-height:28px;padding-block:var(--menu-item-padding-y);padding-inline:var(--menu-item-padding-x);border-radius:var(--radius-sm, 4px);color:var(--menu-item-color);background:transparent;transition:background-color var(--menu-item-timing-out);font:inherit;font-size:14px;line-height:16px;text-align:left;white-space:nowrap;cursor:pointer;user-select:none;outline:none}a-menu[round] a-menu-item,a-menu[round] a[data-anta-menu-item]{border-radius:999px}a-menu-item:hover,a-menu-item:focus-visible,a[data-anta-menu-item]:hover,a[data-anta-menu-item]:focus-visible,a-menu-item:has(>a-menu:state(open)),a-menu-item:state(active){background:color-mix(in oklch,currentColor var(--menu-item-hover),transparent);transition:background-color var(--menu-item-timing-in)}a-menu-item:active,a[data-anta-menu-item]:active{background:color-mix(in oklch,currentColor var(--menu-item-active),transparent);transition:none}a-menu-item[selected],a[data-anta-menu-item][aria-current=true]{background:color-mix(in oklch,currentColor var(--menu-item-selected),transparent)}a-menu-item:focus-visible,a[data-anta-menu-item]:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}a-menu-item>a-menu-item-label,a-menu-item>a-menu-item-text,a[data-anta-menu-item]>a-menu-item-label,a[data-anta-menu-item]>a-menu-item-text{flex:1 1 auto;min-width:0}a-menu-item>a-menu-item-text,a[data-anta-menu-item]>a-menu-item-text{display:flex;flex-direction:column}a-menu-item:has(>a-menu-item-text),a[data-anta-menu-item]:has(>a-menu-item-text){align-items:flex-start}a-menu-item-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis}a-menu-item-hint{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;margin-block-start:1px;color:var(--menu-item-hint-color);font-size:12px;line-height:15px}a-menu-item>a-icon,a[data-anta-menu-item]>a-icon{flex:none;--icon-size: 16px;color:var(--menu-item-icon-color)}a-menu-item>a-checkbox,a-menu-item>a-radio{flex:none;--checkbox-gap: 0;--radio-gap: 0;pointer-events:none}a-menu-item>a-checkbox:before,a-menu-item>a-checkbox:after,a-menu-item>a-radio:before{margin-block-start:0}a-menu-item>a-radio:after{margin-block-start:calc((var(--radio-control-size) - (var(--radio-dot-size) - var(--_radio-dot-adjust))) / 2)}a-menu-item:has(>:is(a-icon,a-checkbox,a-radio,[data-indicator]):first-child:not(:only-child)),a[data-anta-menu-item]:has(>:is(a-icon,[data-indicator]):first-child:not(:only-child)){padding-inline-start:var(--menu-item-padding-y)}a-menu-item:not([submenu]):has(>a-icon:last-child:not(:only-child)),a[data-anta-menu-item]:has(>a-icon:last-child:not(:only-child)){padding-inline-end:max(0px,var(--menu-item-padding-x) - 2px)}a-menu-item>kbd,a[data-anta-menu-item]>kbd{flex:none;margin-left:auto;padding-left:12px;color:var(--text-5);font:inherit;font-size:1em;letter-spacing:.1ch;white-space:nowrap}a-menu-item[submenu]>a-icon:last-of-type{margin-left:auto}a-menu-item[submenu]>a-icon:last-of-type,a-menu-item>a-icon:last-child:not(:only-child),a[data-anta-menu-item]>a-icon:last-child:not(:only-child){position:relative;inset-inline-end:-2px}a-menu-item[tone=brand],a-menu-item[tone=info],a-menu-item[tone=success],a-menu-item[tone=warning],a-menu-item[tone=critical],a[data-anta-menu-item][tone=brand],a[data-anta-menu-item][tone=info],a[data-anta-menu-item][tone=success],a[data-anta-menu-item][tone=warning],a[data-anta-menu-item][tone=critical]{--menu-item-icon-color: var(--menu-item-color)}a-menu-item[tone=brand],a[data-anta-menu-item][tone=brand]{--menu-item-color: var(--text-2-brand);--menu-item-hint-color: var(--text-3-brand)}a-menu-item[tone=info],a[data-anta-menu-item][tone=info]{--menu-item-color: var(--text-2-info);--menu-item-hint-color: var(--text-3-info)}a-menu-item[tone=success],a[data-anta-menu-item][tone=success]{--menu-item-color: var(--text-2-success);--menu-item-hint-color: var(--text-3-success)}a-menu-item[tone=warning],a[data-anta-menu-item][tone=warning]{--menu-item-color: var(--text-2-warning);--menu-item-hint-color: var(--text-3-warning)}a-menu-item[tone=critical],a[data-anta-menu-item][tone=critical]{--menu-item-color: var(--text-2-critical);--menu-item-hint-color: var(--text-3-critical)}a-menu-item[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[data-anta-menu-item][tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=info],[tone=success],[tone=warning],[tone=critical]){--menu-item-tone-source: attr(tone type(<color>), var(--text-2));--menu-item-color: oklch(from var(--menu-item-tone-source) .45 c h);--menu-item-icon-color: var(--menu-item-color);--menu-item-hint-color: oklch(from var(--menu-item-tone-source) .45 c h / .8);.dark &{--menu-item-color: oklch(from var(--menu-item-tone-source) .78 c h);--menu-item-hint-color: oklch(from var(--menu-item-tone-source) .78 c h / .8)}}a-menu-item[disabled],a[data-anta-menu-item][aria-disabled=true]{--menu-item-color: var(--text-5);--menu-item-icon-color: var(--text-5);--menu-item-hint-color: var(--text-5);cursor:default;pointer-events:none}.dark a-menu-item,.dark a[data-anta-menu-item]{--menu-item-hover: 10%;--menu-item-active: 14%;--menu-item-selected: 14%}}
|
|
@@ -69,11 +69,11 @@ export declare function isMenuItemEl(el: EventTarget | null | undefined): el is
|
|
|
69
69
|
* from link items (no `<a-menu-item>` ever upgrades) still gets keyboard
|
|
70
70
|
* activation. Idempotent per document.
|
|
71
71
|
*
|
|
72
|
-
* Shares `installKeyActivation` with `<a-button>`: activation is on keyup
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
72
|
+
* Shares `installKeyActivation` with `<a-button>`: activation is on keyup.
|
|
73
|
+
* `.click()` on a link item navigates natively (honoring download / target);
|
|
74
|
+
* on the custom element it routes through the menu's click delegation — one
|
|
75
|
+
* path for both. (The combobox-filter Enter is a separate path handled by
|
|
76
|
+
* `a-menu`.) A slotted `<a-copy>` adds its own keydown pre-request when a row
|
|
77
|
+
* is a copy control — the menu item itself no longer carries copy behavior. */
|
|
78
78
|
export declare function ensureMenuItemKeyListener(doc: Document): void;
|
|
79
79
|
export declare function register_a_menu_item(): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { HTMLElementBase } from "../anta_helpers";
|
|
2
|
-
import { emitCopyRequest, runCopy } from "./copy-behavior";
|
|
3
2
|
import { installKeyActivation } from "./key-activation";
|
|
4
3
|
import "./a-menu-item.css";
|
|
5
4
|
class AMenuItemElement extends HTMLElementBase {
|
|
@@ -7,8 +6,6 @@ class AMenuItemElement extends HTMLElementBase {
|
|
|
7
6
|
constructor() {
|
|
8
7
|
super();
|
|
9
8
|
this.internals = this.attachInternals?.();
|
|
10
|
-
this.addEventListener("menuselect", () => runCopy(this));
|
|
11
|
-
this.addEventListener("pointerdown", () => emitCopyRequest(this));
|
|
12
9
|
}
|
|
13
10
|
/** The active (combobox) cursor. `a-menu` sets this **property** (never an
|
|
14
11
|
* attribute — no DOM mutation, same rule as `a-radio.selected`) as ArrowUp/Down
|
|
@@ -36,7 +33,6 @@ function ensureMenuItemKeyListener(doc) {
|
|
|
36
33
|
keys: ["Enter", " "],
|
|
37
34
|
resolve: (t) => t?.closest?.(MENU_ITEM_SELECTOR),
|
|
38
35
|
blocked: (el) => el.hasAttribute("disabled"),
|
|
39
|
-
preflight: (el) => emitCopyRequest(el),
|
|
40
36
|
activate: (el) => el.click()
|
|
41
37
|
});
|
|
42
38
|
doc.hasKeyListenerForAMenuItem = true;
|
|
@@ -43,6 +43,7 @@ export declare class AMenuElement extends HTMLElementBase {
|
|
|
43
43
|
private activeItem;
|
|
44
44
|
private comboObserver?;
|
|
45
45
|
private _flippedTop;
|
|
46
|
+
private _flippedSide;
|
|
46
47
|
constructor();
|
|
47
48
|
connectedCallback(): void;
|
|
48
49
|
disconnectedCallback(): void;
|
|
@@ -52,8 +53,11 @@ export declare class AMenuElement extends HTMLElementBase {
|
|
|
52
53
|
private syncState;
|
|
53
54
|
/** Controlled iff the consumer is managing the `state` attribute. */
|
|
54
55
|
get isControlled(): boolean;
|
|
55
|
-
/** A submenu is an `<a-menu>`
|
|
56
|
-
* structure, no `submenu` attribute needed (the parent item is the
|
|
56
|
+
/** A submenu is an `<a-menu>` that is a DIRECT child of an `<a-menu-item>` —
|
|
57
|
+
* derived from structure, no `submenu` attribute needed (the parent item is the
|
|
58
|
+
* anchor). A menu merely *nested somewhere inside* an item's subtree (a composed
|
|
59
|
+
* control — `Select` / `InputDate` — slotted into a flyout) is NOT a submenu: it
|
|
60
|
+
* anchors to its own previous sibling and nests as a child of its container. */
|
|
57
61
|
get isSubmenu(): boolean;
|
|
58
62
|
/** Root menu: the previous element sibling is the trigger. Submenu: the
|
|
59
63
|
* enclosing menu item. One deterministic rule per case — no ambiguity. */
|
package/dist/elements/a-menu.js
CHANGED
|
@@ -80,8 +80,6 @@ function pathCrossesTopLayerBeforeAnchor(e, anchor) {
|
|
|
80
80
|
function nodeHitsMenus(node) {
|
|
81
81
|
for (const m of openStack) {
|
|
82
82
|
if (m.contains(node) || m.surface.contains(node)) return true;
|
|
83
|
-
const anchor = m.triggerAnchor;
|
|
84
|
-
if (anchor && anchor.contains(node)) return true;
|
|
85
83
|
}
|
|
86
84
|
return false;
|
|
87
85
|
}
|
|
@@ -172,6 +170,9 @@ class AMenuElement extends HTMLElementBase {
|
|
|
172
170
|
// (filtering changes height) keeps this side rather than re-deciding — a shrunk
|
|
173
171
|
// menu shouldn't hop back under the trigger.
|
|
174
172
|
_flippedTop = null;
|
|
173
|
+
// The horizontal side chosen at open for a `right`/`left` placement (true =
|
|
174
|
+
// flipped to the left of the anchor). Same reanchor-stability role as `_flippedTop`.
|
|
175
|
+
_flippedSide = null;
|
|
175
176
|
constructor() {
|
|
176
177
|
super();
|
|
177
178
|
try {
|
|
@@ -332,10 +333,13 @@ class AMenuElement extends HTMLElementBase {
|
|
|
332
333
|
return this.hasAttribute("state");
|
|
333
334
|
}
|
|
334
335
|
/* --- config getters --- */
|
|
335
|
-
/** A submenu is an `<a-menu>`
|
|
336
|
-
* structure, no `submenu` attribute needed (the parent item is the
|
|
336
|
+
/** A submenu is an `<a-menu>` that is a DIRECT child of an `<a-menu-item>` —
|
|
337
|
+
* derived from structure, no `submenu` attribute needed (the parent item is the
|
|
338
|
+
* anchor). A menu merely *nested somewhere inside* an item's subtree (a composed
|
|
339
|
+
* control — `Select` / `InputDate` — slotted into a flyout) is NOT a submenu: it
|
|
340
|
+
* anchors to its own previous sibling and nests as a child of its container. */
|
|
337
341
|
get isSubmenu() {
|
|
338
|
-
return !!this.
|
|
342
|
+
return !!this.parentElement && isMenuItemEl(this.parentElement);
|
|
339
343
|
}
|
|
340
344
|
get #isContext() {
|
|
341
345
|
return this.hasAttribute("context");
|
|
@@ -354,14 +358,16 @@ class AMenuElement extends HTMLElementBase {
|
|
|
354
358
|
}
|
|
355
359
|
get #placement() {
|
|
356
360
|
const p = this.getAttribute("placement");
|
|
357
|
-
if (p === "bottom-end" || p === "top-start" || p === "top-end" || p === "bottom" || p === "top")
|
|
361
|
+
if (p === "bottom-end" || p === "top-start" || p === "top-end" || p === "bottom" || p === "top" || p === "right-start" || p === "right-end" || p === "left-start" || p === "left-end" || p === "right" || p === "left")
|
|
358
362
|
return p;
|
|
359
363
|
return "bottom-start";
|
|
360
364
|
}
|
|
361
365
|
/** Root menu: the previous element sibling is the trigger. Submenu: the
|
|
362
366
|
* enclosing menu item. One deterministic rule per case — no ambiguity. */
|
|
363
367
|
get triggerAnchor() {
|
|
364
|
-
|
|
368
|
+
const parent = this.parentElement;
|
|
369
|
+
if (parent && isMenuItemEl(parent)) return parent;
|
|
370
|
+
return this.previousElementSibling;
|
|
365
371
|
}
|
|
366
372
|
/** The focusable element to hand focus back to — the anchor itself if it's
|
|
367
373
|
* focusable, else the first focusable within it. Positioning still uses the
|
|
@@ -551,7 +557,8 @@ class AMenuElement extends HTMLElementBase {
|
|
|
551
557
|
case "Enter":
|
|
552
558
|
if (this.activeItem) {
|
|
553
559
|
e.preventDefault();
|
|
554
|
-
|
|
560
|
+
const copyEl = this.activeItem.querySelector(":scope > a-copy");
|
|
561
|
+
if (copyEl) emitCopyRequest(copyEl);
|
|
555
562
|
this.#pendingComboActivate = this.activeItem;
|
|
556
563
|
}
|
|
557
564
|
return true;
|
|
@@ -646,7 +653,14 @@ class AMenuElement extends HTMLElementBase {
|
|
|
646
653
|
}
|
|
647
654
|
} else if (!openStack.includes(this)) {
|
|
648
655
|
const anchor = this.triggerAnchor;
|
|
649
|
-
|
|
656
|
+
let container;
|
|
657
|
+
if (anchor)
|
|
658
|
+
for (let i = openStack.length - 1; i >= 0; i--) {
|
|
659
|
+
if (openStack[i] !== this && openStack[i].contains(anchor)) {
|
|
660
|
+
container = openStack[i];
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
650
664
|
if (container) {
|
|
651
665
|
const idx = openStack.indexOf(container);
|
|
652
666
|
for (let i = openStack.length - 1; i > idx; i--) {
|
|
@@ -715,6 +729,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
715
729
|
this.comboObserver = void 0;
|
|
716
730
|
this.setActive(null);
|
|
717
731
|
this._flippedTop = null;
|
|
732
|
+
this._flippedSide = null;
|
|
718
733
|
const idx = openStack.indexOf(this);
|
|
719
734
|
if (idx === -1) {
|
|
720
735
|
if (this._shown) this._doHide();
|
|
@@ -809,27 +824,46 @@ class AMenuElement extends HTMLElementBase {
|
|
|
809
824
|
if (this.hasAttribute("autowidth")) surface.style.removeProperty("--_anchor-width");
|
|
810
825
|
else surface.style.setProperty("--_anchor-width", `${Math.ceil(a.width)}px`);
|
|
811
826
|
const p = this.#placement;
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
827
|
+
if (p.startsWith("right") || p.startsWith("left")) {
|
|
828
|
+
surface.style.removeProperty("--_anchor-width");
|
|
829
|
+
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, vh - 2 * MARGIN)}px`;
|
|
830
|
+
const box = surface.getBoundingClientRect();
|
|
831
|
+
const spaceRight = vw - a.right - 2 * MARGIN;
|
|
832
|
+
const spaceLeft = a.left - 2 * MARGIN;
|
|
833
|
+
let onLeft = p.startsWith("left");
|
|
834
|
+
if (reanchor && this._flippedSide !== null) onLeft = this._flippedSide;
|
|
835
|
+
else if (onLeft && spaceLeft < box.width && spaceRight > spaceLeft) onLeft = false;
|
|
836
|
+
else if (!onLeft && spaceRight < box.width && spaceLeft > spaceRight) onLeft = true;
|
|
837
|
+
this._flippedSide = onLeft;
|
|
838
|
+
left = onLeft ? a.left - box.width - this.#offset : a.right + this.#offset;
|
|
839
|
+
left = Math.max(MARGIN, Math.min(left, vw - box.width - MARGIN));
|
|
840
|
+
const valign = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
841
|
+
top = valign === "center" ? a.top + a.height / 2 - box.height / 2 : valign === "end" ? a.bottom - box.height : a.top;
|
|
842
|
+
if (top + box.height > vh - MARGIN) top = vh - box.height - MARGIN;
|
|
843
|
+
top = Math.max(MARGIN, top);
|
|
819
844
|
} else {
|
|
820
|
-
|
|
821
|
-
|
|
845
|
+
const spaceBelow = vh - a.bottom - 2 * MARGIN;
|
|
846
|
+
const spaceAbove = a.top - 2 * MARGIN;
|
|
847
|
+
let onTop = p.startsWith("top");
|
|
848
|
+
surface.style.maxHeight = "";
|
|
849
|
+
const natural = surface.scrollHeight;
|
|
850
|
+
if (reanchor && this._flippedTop !== null) {
|
|
851
|
+
onTop = this._flippedTop;
|
|
852
|
+
} else {
|
|
853
|
+
if (onTop && spaceAbove < natural && spaceBelow > spaceAbove) onTop = false;
|
|
854
|
+
else if (!onTop && spaceBelow < natural && spaceAbove > spaceBelow) onTop = true;
|
|
855
|
+
}
|
|
856
|
+
this._flippedTop = onTop;
|
|
857
|
+
const space = onTop ? spaceAbove : spaceBelow;
|
|
858
|
+
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, Math.floor(space))}px`;
|
|
859
|
+
const box = surface.getBoundingClientRect();
|
|
860
|
+
const align = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
861
|
+
left = align === "center" ? a.left + a.width / 2 - box.width / 2 : align === "end" ? a.right - box.width : a.left;
|
|
862
|
+
if (left + box.width > vw - MARGIN) left = vw - box.width - MARGIN;
|
|
863
|
+
left = Math.max(MARGIN, left);
|
|
864
|
+
top = onTop ? a.top - box.height - this.#offset : a.bottom + this.#offset;
|
|
865
|
+
top = Math.max(MARGIN, top);
|
|
822
866
|
}
|
|
823
|
-
this._flippedTop = onTop;
|
|
824
|
-
const space = onTop ? spaceAbove : spaceBelow;
|
|
825
|
-
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, Math.floor(space))}px`;
|
|
826
|
-
const box = surface.getBoundingClientRect();
|
|
827
|
-
const align = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
828
|
-
left = align === "center" ? a.left + a.width / 2 - box.width / 2 : align === "end" ? a.right - box.width : a.left;
|
|
829
|
-
if (left + box.width > vw - MARGIN) left = vw - box.width - MARGIN;
|
|
830
|
-
left = Math.max(MARGIN, left);
|
|
831
|
-
top = onTop ? a.top - box.height - this.#offset : a.bottom + this.#offset;
|
|
832
|
-
top = Math.max(MARGIN, top);
|
|
833
867
|
}
|
|
834
868
|
surface.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
|
|
835
869
|
this.updateScrollFade();
|
|
@@ -855,7 +889,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
855
889
|
for (const node of e.composedPath()) {
|
|
856
890
|
if (node === this.surface) break;
|
|
857
891
|
if (node instanceof AMenuItemElement) {
|
|
858
|
-
if (!node.hasAttribute("disabled") && !node.querySelector("a-menu") && node.closest("a-menu") === this) {
|
|
892
|
+
if (!node.hasAttribute("disabled") && !node.querySelector(":scope > a-menu") && node.closest("a-menu") === this) {
|
|
859
893
|
node.dispatchEvent(
|
|
860
894
|
new MouseEvent("menuselect", {
|
|
861
895
|
bubbles: false,
|
|
@@ -878,7 +912,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
878
912
|
e.preventDefault();
|
|
879
913
|
return;
|
|
880
914
|
}
|
|
881
|
-
if (node.querySelector("a-menu")) return;
|
|
915
|
+
if (node.querySelector(":scope > a-menu")) return;
|
|
882
916
|
return this.closeSystem(e);
|
|
883
917
|
}
|
|
884
918
|
if (node.matches("a[data-anta-menu-item]")) return this.closeSystem(e);
|
|
@@ -971,7 +1005,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
971
1005
|
}
|
|
972
1006
|
submenuOf(item) {
|
|
973
1007
|
if (!item || !(item instanceof AMenuItemElement)) return null;
|
|
974
|
-
return item.querySelector("a-menu");
|
|
1008
|
+
return item.querySelector(":scope > a-menu");
|
|
975
1009
|
}
|
|
976
1010
|
typeahead(ch, items) {
|
|
977
1011
|
this.typeBuffer += ch.toLowerCase();
|
|
@@ -1088,6 +1122,8 @@ class AMenuElement extends HTMLElementBase {
|
|
|
1088
1122
|
this.cancelOpenTimer();
|
|
1089
1123
|
if (!this._shown) return;
|
|
1090
1124
|
if (this.#hasKeyboardFocusInside) return;
|
|
1125
|
+
if (openStack.some((m) => m !== this && (this.contains(m) || m.triggerAnchor != null && this.contains(m.triggerAnchor))))
|
|
1126
|
+
return;
|
|
1091
1127
|
this.cancelCloseTimer();
|
|
1092
1128
|
this.closeTimer = setTimeout(() => {
|
|
1093
1129
|
this.closeTimer = void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{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-
|
|
1
|
+
@layer anta{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)}}
|
|
@@ -9,6 +9,7 @@ export declare class ARadioGroupElement extends HTMLElementBase {
|
|
|
9
9
|
private seeded;
|
|
10
10
|
private observer?;
|
|
11
11
|
private alive;
|
|
12
|
+
private childrenReady;
|
|
12
13
|
/** The selected option's value, or `null` when nothing is selected. */
|
|
13
14
|
get value(): string | null;
|
|
14
15
|
constructor();
|
|
@@ -10,6 +10,10 @@ class ARadioGroupElement extends HTMLElementBase {
|
|
|
10
10
|
// True after the first connect — gates the native `change` event so it never
|
|
11
11
|
// fires for the initial seed (only for real, post-connect selection changes).
|
|
12
12
|
alive = false;
|
|
13
|
+
// Gates sync() until the child <a-radio>s are upgraded (set a microtask
|
|
14
|
+
// after connect) — same hazard as a-tabs' childrenReady: adopted HTML
|
|
15
|
+
// upgrades the parent first, and an eager sync() clobbers the children.
|
|
16
|
+
childrenReady = false;
|
|
13
17
|
/** The selected option's value, or `null` when nothing is selected. */
|
|
14
18
|
get value() {
|
|
15
19
|
return this.#currentValue;
|
|
@@ -34,8 +38,12 @@ class ARadioGroupElement extends HTMLElementBase {
|
|
|
34
38
|
if (touchedOptions) this.sync();
|
|
35
39
|
});
|
|
36
40
|
this.observer.observe(this, { childList: true, subtree: true });
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
queueMicrotask(() => {
|
|
42
|
+
if (!this.isConnected) return;
|
|
43
|
+
this.childrenReady = true;
|
|
44
|
+
this.sync();
|
|
45
|
+
this.alive = true;
|
|
46
|
+
});
|
|
39
47
|
}
|
|
40
48
|
disconnectedCallback() {
|
|
41
49
|
this.observer?.disconnect();
|
|
@@ -71,6 +79,7 @@ class ARadioGroupElement extends HTMLElementBase {
|
|
|
71
79
|
return Array.from(this.querySelectorAll("a-radio"));
|
|
72
80
|
}
|
|
73
81
|
sync = () => {
|
|
82
|
+
if (!this.childrenReady) return;
|
|
74
83
|
const value = this.#currentValue;
|
|
75
84
|
const radios = this.#radios;
|
|
76
85
|
const selectedEl = radios.find((r) => r.value === value && value != null) ?? null;
|
|
@@ -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: #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}}
|
|
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-tone-source: var(--anta-seed-neutral);--_tone-l-rest: .6;--_tone-l-hover: .45;--_tone-l-active: .4;--radio-bg-selected: oklch(from var(--radio-tone-source) var(--_tone-l-rest) c h);--radio-bg-selected-hover: oklch(from var(--radio-tone-source) var(--_tone-l-hover) c h);--radio-bg-selected-active: oklch(from var(--radio-tone-source) var(--_tone-l-active) 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: #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-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: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[tone-selected]:not([tone-selected=""],[tone-selected=neutral]),a-radio-group[tone]:not([tone=""],[tone=neutral]) a-radio:not([tone]),a-radio-group[tone-selected]:not([tone-selected=""],[tone-selected=neutral]) a-radio:not([tone-selected]){--_tone-l-rest: .5;--_tone-l-hover: .45;--_tone-l-active: .4}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-tone-source: var(--anta-seed-brand)}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-tone-source: var(--anta-seed-info)}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-tone-source: var(--anta-seed-success)}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-tone-source: var(--anta-seed-warning)}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-tone-source: var(--anta-seed-critical)}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-tone-source: var(--anta-seed-neutral)}a-radio[tone]:not([tone=""],[tone=neutral]),a-radio-group[tone]:not([tone=""],[tone=neutral]) 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-bg-selected) 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)}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)}.dark a-radio{--_radio-dot-adjust: 1px;&:after{box-shadow:0 0 1px 1px color-mix(in oklch,black 40%,transparent)}--radio-border-neutral: var(--border-3);--radio-border-hover: var(--border-2);--radio-border-active: var(--border-1);--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);--_tone-l-rest: .42;--_tone-l-hover: .45;--_tone-l-active: .5}.dark a-radio[tone]:not([tone=""],[tone=neutral]),.dark a-radio[tone-selected]:not([tone-selected=""],[tone-selected=neutral]),.dark a-radio-group[tone]:not([tone=""],[tone=neutral]) a-radio:not([tone]),.dark a-radio-group[tone-selected]:not([tone-selected=""],[tone-selected=neutral]) a-radio:not([tone-selected]){--_tone-l-rest: .45;--_tone-l-hover: .5;--_tone-l-active: .57}.dark a-radio[tone]:not([tone=""],[tone=neutral]),.dark a-radio-group[tone]:not([tone=""],[tone=neutral]) a-radio:not([tone]){--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)}}
|
package/dist/elements/a-tabs.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-tabs{--_fs: 15px;--_lh: 20px;--_pb: 1px;--tab-padding-x: 9px;--tab-height: 28px;--tab-radius: 4px;--tabs-gap: 3px;--tab-timing: .15s ease-out;--tabs-tone-source:
|
|
1
|
+
@layer anta{a-tabs{--_fs: 15px;--_lh: 20px;--_pb: 1px;--tab-padding-x: 9px;--tab-height: 28px;--tab-radius: 4px;--tabs-gap: 3px;--tab-timing: .15s ease-out;--tabs-tone-source: var(--anta-seed-neutral);--tab-fg-rest: var(--text-3);--tab-selected-text: var(--text-1);--tab-text-2: var(--text-2);--_track-l: .55;--_track-c: .008;--_track-a: .06;--_sec-a: .03;--tabs-track-bg: oklch(from var(--tabs-tone-source) var(--_track-l) var(--_track-c) h / var(--_track-a));--tabs-track-border: var(--border-4);--tabs-track-shadow: inset 0 0 0px .5px var(--tabs-track-border);--tab-selected-bg: var(--bg-1);--tab-selected-border: var(--border-2);--tab-selected-shadow: inset 0 0 0px .5px var(--tab-selected-border);--tab-secondary-bg: oklch(from var(--tabs-tone-source) var(--_track-l) var(--_track-c) h / var(--_sec-a));display:flex;flex-direction:row;align-items:stretch;gap:var(--tabs-gap);padding:0;width:fit-content;align-self:flex-start;min-width:0;max-width:100%;overflow:hidden;scroll-behavior:smooth}a-tabs[size=small]{--_fs: 13px;--_lh: 16px;--_pb: .5px;--tab-padding-x: 7px;--tab-height: 24px}a-tabs[size=large]{--_fs: 17px;--_lh: 24px;--_pb: 1.5px;--tab-padding-x: 13px;--tab-height: 32px}a-tabs a-tab a-icon{--icon-size: 16px}a-tabs[size=small] a-tab a-icon{--icon-size: 14px}a-tabs[size=large] a-tab a-icon{--icon-size: 18px}a-tabs[tone=brand],a-tab[tone=brand]{--tabs-tone-source: var(--anta-seed-brand);--tab-selected-text: var(--text-1-brand);--tab-text-2: var(--text-2-brand);--tab-rest-tone: var(--text-3-brand);--tabs-track-border: var(--border-4-brand);--tab-selected-border: var(--border-2-brand)}a-tabs[tone=info],a-tab[tone=info]{--tabs-tone-source: var(--anta-seed-info);--tab-selected-text: var(--text-1-info);--tab-text-2: var(--text-2-info);--tab-rest-tone: var(--text-3-info);--tabs-track-border: var(--border-4-info);--tab-selected-border: var(--border-2-info)}a-tabs[tone=success],a-tab[tone=success]{--tabs-tone-source: var(--anta-seed-success);--tab-selected-text: var(--text-1-success);--tab-text-2: var(--text-2-success);--tab-rest-tone: var(--text-3-success);--tabs-track-border: var(--border-4-success);--tab-selected-border: var(--border-2-success)}a-tabs[tone=warning],a-tab[tone=warning]{--tabs-tone-source: var(--anta-seed-warning);--tab-selected-text: var(--text-1-warning);--tab-text-2: var(--text-2-warning);--tab-rest-tone: var(--text-3-warning);--tabs-track-border: var(--border-4-warning);--tab-selected-border: var(--border-2-warning)}a-tabs[tone=critical],a-tab[tone=critical]{--tabs-tone-source: var(--anta-seed-critical);--tab-selected-text: var(--text-1-critical);--tab-text-2: var(--text-2-critical);--tab-rest-tone: var(--text-3-critical);--tabs-track-border: var(--border-4-critical);--tab-selected-border: var(--border-2-critical)}a-tabs[tone]:not([tone=""],[tone=neutral]),a-tab[tone]:not([tone=""],[tone=neutral]){--_track-c: .14}a-tabs:has(>a-tab[tone=brand]:state(selected)){--tabs-tone-source: var(--anta-seed-brand);--tab-selected-text: var(--text-1-brand);--tab-selected-border: var(--border-2-brand)}a-tabs:has(>a-tab[tone=info]:state(selected)){--tabs-tone-source: var(--anta-seed-info);--tab-selected-text: var(--text-1-info);--tab-selected-border: var(--border-2-info)}a-tabs:has(>a-tab[tone=success]:state(selected)){--tabs-tone-source: var(--anta-seed-success);--tab-selected-text: var(--text-1-success);--tab-selected-border: var(--border-2-success)}a-tabs:has(>a-tab[tone=warning]:state(selected)){--tabs-tone-source: var(--anta-seed-warning);--tab-selected-text: var(--text-1-warning);--tab-selected-border: var(--border-2-warning)}a-tabs:has(>a-tab[tone=critical]:state(selected)){--tabs-tone-source: var(--anta-seed-critical);--tab-selected-text: var(--text-1-critical);--tab-selected-border: var(--border-2-critical)}a-tabs:has(>a-tab[tone]:state(selected):not([tone=""],[tone=neutral])){--_track-c: .14}a-tabs[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a-tab[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--tabs-tone-source: attr(tone type(<color>), #635b65);--tab-selected-text: oklch(from var(--tabs-tone-source) .38 .13 h);--tab-text-2: oklch(from var(--tabs-tone-source) .45 .13 h);--tab-rest-tone: oklch(from var(--tabs-tone-source) .45 .13 h / .8);--tabs-track-border: oklch(from var(--tabs-tone-source) .9 .045 h);--tab-selected-border: oklch(from var(--tabs-tone-source) .8 .09 h)}a-tabs a-tab{--tab-fg: var(--tab-fg-rest);--tab-bg: transparent}a-tabs:not([orientation=vertical]) a-tab{flex:1 1 0;max-width:max-content}@media(hover:hover)and (pointer:fine){a-tabs a-tab:hover{--tab-fg: var(--tab-selected-text)}}a-tabs:not([priority=secondary],[priority=tertiary]){background:var(--tabs-track-bg);box-shadow:var(--tabs-track-shadow);border-radius:4px}a-tabs[round]{--tab-radius: 999px;--tabs-round: attr(round type(<length>), 999px)}a-tabs[round]:not([priority=secondary],[priority=tertiary]){border-radius:var(--tabs-round, 999px)}a-tabs:not([priority=secondary],[priority=tertiary]) a-tab:state(selected){--tab-fg: var(--tab-selected-text);--tab-bg: var(--tab-selected-bg);box-shadow:var(--tab-selected-shadow)}a-tabs[tone]:not([tone=""],[tone=neutral]),a-tab[tone]:not([tone=""],[tone=neutral]){--tab-fg-rest: var(--tab-rest-tone)}@media(hover:hover)and (pointer:fine){a-tabs[priority=secondary] a-tab:hover{--tab-fg: var(--tab-selected-text)}}a-tabs[priority=secondary] a-tab:state(selected){--tab-fg: var(--tab-selected-text);--tab-bg: var(--tab-secondary-bg);box-shadow:var(--tab-selected-shadow)}a-tabs[priority=tertiary] a-tab{--tab-underline-size: 1px;--tab-underline-color: transparent;position:relative;border-radius:0}a-tabs[priority=tertiary] a-tab:after{content:"";position:absolute;inset:0;box-sizing:border-box;pointer-events:none;border-bottom:var(--tab-underline-size) solid var(--tab-underline-color);transition:border-width var(--tab-timing),border-color var(--tab-timing)}a-tabs[orientation=vertical][priority=tertiary] a-tab:after{border-bottom:0;border-inline-end:var(--tab-underline-size) solid var(--tab-underline-color)}@media(hover:hover)and (pointer:fine){a-tabs[priority=tertiary] a-tab:hover{--tab-fg: var(--tab-text-2)}}a-tabs[priority=tertiary] a-tab:state(selected){--tab-fg: var(--tab-selected-text);--tab-underline-size: 1px;--tab-underline-color: var(--tab-selected-text)}a-tabs[orientation=vertical]{flex-direction:column;align-items:stretch;max-width:none;overflow-x:hidden;overflow-y:auto;flex-shrink:0}a-tabs[orientation=vertical] a-tab{justify-content:flex-start;flex-shrink:0}@supports (anchor-scope: all){a-tabs:not([noslide]){position:relative;anchor-scope:all}a-tabs:not([noslide]) a-tab{position:relative;z-index:1}a-tabs:not([noslide]) a-tab:state(selected){anchor-name:--tabs-active}a-tabs:not([noslide]):before{content:"";position:absolute;z-index:0;box-sizing:border-box;position-anchor:--tabs-active;top:anchor(top);right:anchor(right);bottom:anchor(bottom);left:anchor(left);transition:top var(--tab-timing),right var(--tab-timing),bottom var(--tab-timing),left var(--tab-timing)}a-tabs:not([noslide]):not(:has(a-tab:state(selected))):before{display:none}@media(prefers-reduced-motion:reduce){a-tabs:not([noslide]):before{transition:none}}a-tabs:not([noslide]) a-tab:state(selected){--tab-bg: transparent;box-shadow:none}a-tabs:not([noslide],[priority=secondary],[priority=tertiary]):before{background:var(--tab-selected-bg);border-radius:var(--tab-radius);box-shadow:var(--tab-selected-shadow)}a-tabs:not([noslide])[priority=secondary]:before{background:var(--tab-secondary-bg);border-radius:var(--tab-radius);box-shadow:var(--tab-selected-shadow)}a-tabs:not([noslide])[priority=tertiary] a-tab:state(selected){--tab-underline-size: 1px;--tab-underline-color: transparent}a-tabs:not([noslide])[priority=tertiary]:before{z-index:2;border-bottom:1px solid var(--tab-selected-text)}a-tabs[orientation=vertical]:not([noslide])[priority=tertiary]:before{border-bottom:0;border-inline-end:1px solid var(--tab-selected-text)}}.dark a-tabs{--_track-l: .8;--_track-a: .07;--_sec-a: .08}.dark a-tabs[tone]:not([tone=""],[tone=neutral]),.dark a-tab[tone]:not([tone=""],[tone=neutral]){--_track-c: .12}.dark a-tabs:has(>a-tab[tone]:state(selected):not([tone=""],[tone=neutral])){--_track-c: .12}.dark a-tabs[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),.dark a-tab[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--tab-selected-text: oklch(from var(--tabs-tone-source) .83 .1 h);--tab-text-2: oklch(from var(--tabs-tone-source) .76 .11 h);--tab-rest-tone: oklch(from var(--tabs-tone-source) .76 .11 h / .8);--tabs-track-border: oklch(from var(--tabs-tone-source) .26 .055 h);--tab-selected-border: oklch(from var(--tabs-tone-source) .4 .11 h)}}
|
|
@@ -9,6 +9,7 @@ export declare class ATabsElement extends HTMLElementBase {
|
|
|
9
9
|
private observer?;
|
|
10
10
|
private lastSelected;
|
|
11
11
|
private alive;
|
|
12
|
+
private childrenReady;
|
|
12
13
|
/** The selected tab's value, or `null` when nothing is selected. */
|
|
13
14
|
get value(): string | null;
|
|
14
15
|
constructor();
|
package/dist/elements/a-tabs.js
CHANGED
|
@@ -12,6 +12,12 @@ class ATabsElement extends HTMLElementBase {
|
|
|
12
12
|
// True after the first connect — gates the native `change` event so it never fires
|
|
13
13
|
// for the initial seed, and gates scroll-into-view so mounting doesn't jump the page.
|
|
14
14
|
alive = false;
|
|
15
|
+
// Gates sync() until the child <a-tab>s are upgraded (set a microtask after
|
|
16
|
+
// connect). Adopted HTML (a ClientRouter swap, innerHTML) upgrades the parent
|
|
17
|
+
// first, so an eager sync() reads `t.value` as undefined and writes
|
|
18
|
+
// `t.selected` as own properties that shadow the accessors after upgrade.
|
|
19
|
+
// Microtasks run after the adopting task's upgrades, so deferring is enough.
|
|
20
|
+
childrenReady = false;
|
|
15
21
|
/** The selected tab's value, or `null` when nothing is selected. */
|
|
16
22
|
get value() {
|
|
17
23
|
return this.#currentValue;
|
|
@@ -36,8 +42,12 @@ class ATabsElement extends HTMLElementBase {
|
|
|
36
42
|
if (touchedTabs) this.sync();
|
|
37
43
|
});
|
|
38
44
|
this.observer.observe(this, { childList: true, subtree: true });
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
queueMicrotask(() => {
|
|
46
|
+
if (!this.isConnected) return;
|
|
47
|
+
this.childrenReady = true;
|
|
48
|
+
this.sync();
|
|
49
|
+
this.alive = true;
|
|
50
|
+
});
|
|
41
51
|
}
|
|
42
52
|
disconnectedCallback() {
|
|
43
53
|
this.observer?.disconnect();
|
|
@@ -65,6 +75,7 @@ class ATabsElement extends HTMLElementBase {
|
|
|
65
75
|
return Array.from(this.querySelectorAll("a-tab"));
|
|
66
76
|
}
|
|
67
77
|
sync = () => {
|
|
78
|
+
if (!this.childrenReady) return;
|
|
68
79
|
const value = this.#currentValue;
|
|
69
80
|
const tabs = this.#tabs;
|
|
70
81
|
const selectedEl = tabs.find((t) => t.value === value && value != null) ?? null;
|
|
@@ -73,10 +84,28 @@ class ATabsElement extends HTMLElementBase {
|
|
|
73
84
|
this.internals.ariaActiveDescendantElement = selectedEl;
|
|
74
85
|
}
|
|
75
86
|
if (this.alive && selectedEl && selectedEl !== this.lastSelected) {
|
|
76
|
-
selectedEl
|
|
87
|
+
this.#revealTab(selectedEl);
|
|
77
88
|
}
|
|
78
89
|
this.lastSelected = selectedEl;
|
|
79
90
|
};
|
|
91
|
+
// Reveal a tab inside the strip's OWN scrollport — never the document. `scrollIntoView()`
|
|
92
|
+
// walks up and scrolls every scroll ancestor, so inside a `position: sticky` header with
|
|
93
|
+
// `scroll-behavior: smooth` it glides the whole page a few px on every switch. Scrolling
|
|
94
|
+
// only this element's scrollLeft/scrollTop keeps the correction where it belongs: a no-op
|
|
95
|
+
// when the strip fits (the default horizontal strip is `overflow: hidden` and ellipsizes),
|
|
96
|
+
// a real move for a vertical (`overflow-y: auto`) or opt-in scrollable strip. Reads layout,
|
|
97
|
+
// writes only this element's scroll offset (declarative-DOM safe: scroll, not a DOM mutation).
|
|
98
|
+
#revealTab(tab) {
|
|
99
|
+
const s = this.getBoundingClientRect();
|
|
100
|
+
const t = tab.getBoundingClientRect();
|
|
101
|
+
if (this.#isVertical) {
|
|
102
|
+
if (t.top < s.top) this.scrollTop -= s.top - t.top;
|
|
103
|
+
else if (t.bottom > s.bottom) this.scrollTop += t.bottom - s.bottom;
|
|
104
|
+
} else {
|
|
105
|
+
if (t.left < s.left) this.scrollLeft -= s.left - t.left;
|
|
106
|
+
else if (t.right > s.right) this.scrollLeft += t.right - s.right;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
80
109
|
// The shared state algorithm: fire the cancelable `statechange` *before* applying.
|
|
81
110
|
// Controlled never self-applies; uncontrolled applies unless vetoed.
|
|
82
111
|
requestSelect(next) {
|
|
@@ -111,7 +140,7 @@ class ATabsElement extends HTMLElementBase {
|
|
|
111
140
|
if (this.#isDisabled) return;
|
|
112
141
|
const tab = e.target?.closest("a-tab");
|
|
113
142
|
if (!tab || tab.hasAttribute("disabled")) return;
|
|
114
|
-
tab.focus();
|
|
143
|
+
tab.focus({ preventScroll: true });
|
|
115
144
|
this.requestSelect(tab.value);
|
|
116
145
|
};
|
|
117
146
|
onKeyDown = (e) => {
|
|
@@ -129,7 +158,7 @@ class ATabsElement extends HTMLElementBase {
|
|
|
129
158
|
if (e.key === "Home" || e.key === "End") {
|
|
130
159
|
e.preventDefault();
|
|
131
160
|
const target = e.key === "Home" ? enabled[0] : enabled[enabled.length - 1];
|
|
132
|
-
target.focus();
|
|
161
|
+
target.focus({ preventScroll: true });
|
|
133
162
|
this.requestSelect(target.value);
|
|
134
163
|
return;
|
|
135
164
|
}
|
|
@@ -141,7 +170,7 @@ class ATabsElement extends HTMLElementBase {
|
|
|
141
170
|
if (i === -1) i = enabled.findIndex((t) => t.value === this.#currentValue);
|
|
142
171
|
if (i === -1) i = 0;
|
|
143
172
|
const next = enabled[(i + (forward ? 1 : -1) + enabled.length) % enabled.length];
|
|
144
|
-
next.focus();
|
|
173
|
+
next.focus({ preventScroll: true });
|
|
145
174
|
this.requestSelect(next.value);
|
|
146
175
|
};
|
|
147
176
|
}
|
package/dist/elements/a-tag.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-tag{--tag-
|
|
1
|
+
@layer anta{a-tag{--tag-tone-source: var(--anta-seed-neutral);--_tag-tint-l: .55;--_tag-tint-c: .03;--_tag-solid-l: .55;--_tag-solid-c: .015;--tag-tint: oklch(from var(--tag-tone-source) var(--_tag-tint-l) var(--_tag-tint-c) h);--tag-bg-solid: oklch(from var(--tag-tone-source) var(--_tag-solid-l) var(--_tag-solid-c) h);--tag-text: var(--text-3);--tag-edge: var(--text-2);--_tag-bg-alpha: 10%;--_tag-border-alpha: 15%;--_tag-edge-alpha: 20%;--tag-bg: color-mix(in oklch, var(--tag-tint) var(--_tag-bg-alpha), transparent);--tag-border: color-mix(in oklch, var(--tag-tint) var(--_tag-border-alpha), transparent);--tag-separator: color-mix(in oklch, var(--tag-text) 30%, transparent);--tag-padding-block: 1.5px;--tag-padding-inline: 6.5px;--tag-icon-size: 13px;--tag-label-weight: 600;--tag-gap: .6ch;display:inline-flex;align-items:center;gap:var(--tag-gap);box-sizing:border-box;max-width:100%;vertical-align:middle;overflow:hidden;white-space:nowrap;-webkit-user-drag:none;color:var(--tag-text);background:var(--tag-bg);border:.5px solid var(--tag-border);border-radius:22px;padding-block:var(--tag-padding-block);padding-inline:var(--tag-padding-inline);font-family:var(--sans-serif);font-weight:450;font-size:12px;line-height:16px;text-transform:none;letter-spacing:.02ch;font-feature-settings:"tnum" 1,"ss05" 1,"lnum","ss01","ss04","case","calt"}a-tag a-icon{--icon-size: var(--tag-icon-size);flex:none}a-tag a-tag-label,a-tag a-tag-value{display:inline-block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}a-tag a-tag-value{font-weight:450}a-tag a-tag-label{font-weight:var(--tag-label-weight)}a-tag:has(>a-icon:first-child){padding-inline-start:max(0px,var(--tag-padding-inline) - 2px)}a-tag:has(>a-icon:last-child){padding-inline-end:max(0px,var(--tag-padding-inline) - 2px)}a-tag>:not(a-icon,a-tag-label,a-tag-value)~:not(a-icon,a-tag-label,a-tag-value){padding-left:var(--tag-gap);border-left:.5px solid var(--tag-separator)}a-tag[tone]:not([tone=""],[tone=neutral]){--_tag-tint-l: .57;--_tag-tint-c: .16;--_tag-solid-l: .58;--_tag-solid-c: .175}a-tag[tone=brand]{--tag-tone-source: var(--anta-seed-brand);--tag-text: var(--text-3-brand);--tag-edge: var(--text-2-brand)}a-tag[tone=info]{--tag-tone-source: var(--anta-seed-info);--tag-text: var(--text-3-info);--tag-edge: var(--text-2-info)}a-tag[tone=success]{--tag-tone-source: var(--anta-seed-success);--tag-text: var(--text-3-success);--tag-edge: var(--text-2-success)}a-tag[tone=warning]{--tag-tone-source: var(--anta-seed-warning);--tag-text: var(--text-3-warning);--tag-edge: var(--text-2-warning)}a-tag[tone=critical]{--tag-tone-source: var(--anta-seed-critical);--tag-text: var(--text-3-critical);--tag-edge: var(--text-2-critical)}.dark a-tag:not([tone]),.dark a-tag[tone=neutral]{--_tag-tint-l: .63;--_tag-tint-c: .04;--_tag-solid-l: .48;--_tag-bg-alpha: 20%;--_tag-border-alpha: 25%;--_tag-edge-alpha: 30%}.dark a-tag[tone]:not([tone=""],[tone=neutral]){--_tag-tint-l: .63;--_tag-tint-c: .17;--_tag-solid-l: .46;--_tag-solid-c: .165;--_tag-bg-alpha: 20%;--_tag-border-alpha: 25%;--_tag-edge-alpha: 30%}a-tag[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--tag-tone-source: attr(tone type(<color>), currentColor);--tag-text: color-mix(in oklch, oklch(from var(--tag-tone-source) .43 .15 h) 80%, transparent);--tag-edge: oklch(from var(--tag-tone-source) .43 .15 h)}.dark a-tag[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--tag-text: color-mix(in oklch, oklch(from var(--tag-tone-source) .77 .11 h) 80%, transparent);--tag-edge: oklch(from var(--tag-tone-source) .77 .11 h)}a-tag[priority=primary]{--tag-bg: var(--tag-bg-solid);--tag-text: #fff}a-tag[priority=primary][tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--tag-text: #fff}a-tag[priority=tertiary]{--tag-bg: transparent;--tag-border: color-mix(in oklch, var(--tag-edge) var(--_tag-edge-alpha), transparent)}a-tag[size=small]{--tag-padding-block: .5px;--tag-padding-inline: 4.5px;--tag-icon-size: 11px;font-size:11px;line-height:14px}a-tag[size=large]{--tag-padding-block: 2.5px;--tag-padding-inline: 8.5px;--tag-icon-size: 15px;font-size:13px;line-height:18px}a-tag[allcaps]{font-size:11px;text-transform:uppercase;letter-spacing:.08ch;font-feature-settings:"tnum" 1,"ss05" 1,"ss01","case","calt"}a-tag[size=small][allcaps]{font-size:10px}a-tag[size=large][allcaps]{font-size:12px}}
|
package/dist/elements/a-text.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-text{--text-color: var(--text-2);--text-link-color: var(--link-color);--text-link-hover: var(--link-color-hover);display:block;font-family:var(--sans-serif);color:var(--text-color);font-size:15px;line-height:20px;text-wrap:pretty;font-feature-settings:"ss02","ss05","tnum"}a-text[size=small]{font-size:13px;line-height:16px}a-text[size=medium]{font-size:15px;line-height:20px}a-text[size=large]{font-size:17px;line-height:24px}a-text[inline]{display:inline-block}a-text[truncate]{min-width:0}a-text[priority=primary]{--text-color: var(--text-1)}a-text[priority=tertiary]{--text-color: var(--text-3);--text-link-color: currentColor;--text-link-hover: var(--text-2)}a-text[priority=quaternary]{--text-color: var(--text-4);--text-link-color: currentColor;--text-link-hover: var(--text-3)}a-text[
|
|
1
|
+
@layer anta{a-text{--text-color: var(--text-2);--text-link-color: var(--link-color);--text-link-hover: var(--link-color-hover);display:block;font-family:var(--sans-serif);color:var(--text-color);font-size:15px;line-height:20px;text-wrap:pretty;font-feature-settings:"ss02","ss05","tnum"}a-text[size=small]{font-size:13px;line-height:16px}a-text[size=medium]{font-size:15px;line-height:20px}a-text[size=large]{font-size:17px;line-height:24px}a-text[inline]{display:inline-block}a-text[truncate]{min-width:0}a-text[priority=primary]{--text-color: var(--text-1)}a-text[priority=tertiary]{--text-color: var(--text-3);--text-link-color: currentColor;--text-link-hover: var(--text-2)}a-text[priority=quaternary]{--text-color: var(--text-4);--text-link-color: currentColor;--text-link-hover: var(--text-3)}a-text[tone=brand]{--text-color: var(--text-2-brand);--text-link-color: currentColor;--text-link-hover: var(--text-1-brand)}a-text[tone=brand][priority=primary]{--text-color: var(--text-1-brand)}a-text[tone=brand][priority=tertiary]{--text-color: var(--text-3-brand);--text-link-hover: var(--text-2-brand)}a-text[tone=brand][priority=quaternary]{--text-color: var(--text-4-brand);--text-link-hover: var(--text-3-brand)}a-text[tone=success]{--text-color: var(--text-2-success);--text-link-color: currentColor;--text-link-hover: var(--text-1-success)}a-text[tone=success][priority=primary]{--text-color: var(--text-1-success)}a-text[tone=success][priority=tertiary]{--text-color: var(--text-3-success);--text-link-hover: var(--text-2-success)}a-text[tone=success][priority=quaternary]{--text-color: var(--text-4-success);--text-link-hover: var(--text-3-success)}a-text[tone=critical]{--text-color: var(--text-2-critical);--text-link-color: currentColor;--text-link-hover: var(--text-1-critical)}a-text[tone=critical][priority=primary]{--text-color: var(--text-1-critical)}a-text[tone=critical][priority=tertiary]{--text-color: var(--text-3-critical);--text-link-hover: var(--text-2-critical)}a-text[tone=critical][priority=quaternary]{--text-color: var(--text-4-critical);--text-link-hover: var(--text-3-critical)}a-text[tone=warning]{--text-color: var(--text-2-warning);--text-link-color: currentColor;--text-link-hover: var(--text-1-warning)}a-text[tone=warning][priority=primary]{--text-color: var(--text-1-warning)}a-text[tone=warning][priority=tertiary]{--text-color: var(--text-3-warning);--text-link-hover: var(--text-2-warning)}a-text[tone=warning][priority=quaternary]{--text-color: var(--text-4-warning);--text-link-hover: var(--text-3-warning)}a-text[tone=info]{--text-color: var(--text-2-info);--text-link-color: currentColor;--text-link-hover: var(--text-1-info)}a-text[tone=info][priority=primary]{--text-color: var(--text-1-info)}a-text[tone=info][priority=tertiary]{--text-color: var(--text-3-info);--text-link-hover: var(--text-2-info)}a-text[tone=info][priority=quaternary]{--text-color: var(--text-4-info);--text-link-hover: var(--text-3-info)}a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--text-tone-source: attr(tone type(<color>), currentColor);--_text-tone: oklch(from var(--text-tone-source) .41 .15 h);--text-color: var(--_text-tone);--text-link-color: currentColor;--text-link-hover: oklch(from var(--text-tone-source) .33 .15 h)}a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=primary]{--text-color: oklch(from var(--text-tone-source) .33 .15 h)}a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--text-color: color-mix(in oklch, var(--_text-tone) 80%, transparent);--text-link-hover: var(--_text-tone)}a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=quaternary]{--text-color: color-mix(in oklch, var(--_text-tone) 60%, transparent)}.dark a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_text-tone: oklch(from var(--text-tone-source) .75 .11 h);--text-link-hover: oklch(from var(--text-tone-source) .82 .1 h)}.dark a-text[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=primary]{--text-color: oklch(from var(--text-tone-source) .82 .1 h)}a-text a,a-text a:link,a-text a:visited{color:var(--text-link-color)}@media(hover:hover)and (pointer:fine){a-text a:hover{color:var(--text-link-hover);text-decoration-color:var(--text-link-hover)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-title{display:block;font-family:var(--sans-serif);color:var(--text-1);font-weight:584.62;letter-spacing:0;text-wrap:balance;font-feature-settings:"ss02","ss05","tnum"}a-title a-icon{transform:translateY(-.05em)}a-title[level="1"]{font-size:28px;line-height:32px}a-title[level="2"]{font-size:24px;line-height:28px}a-title[level="3"]{font-size:20px;line-height:24px}a-title[level="4"]{font-size:17px;line-height:20px}a-title[level="5"]{font-size:15px;line-height:20px}a-title[level="6"]{font-size:13px;line-height:16px}a-title[priority=secondary]{color:var(--text-2)}a-title[priority=tertiary]{color:var(--text-3)}a-title[priority=quaternary]{color:var(--text-4)}a-title[
|
|
1
|
+
@layer anta{a-title{display:block;font-family:var(--sans-serif);color:var(--text-1);font-weight:584.62;letter-spacing:0;text-wrap:balance;font-feature-settings:"ss02","ss05","tnum"}a-title a-icon{transform:translateY(-.05em)}a-title[level="1"]{font-size:28px;line-height:32px}a-title[level="2"]{font-size:24px;line-height:28px}a-title[level="3"]{font-size:20px;line-height:24px}a-title[level="4"]{font-size:17px;line-height:20px}a-title[level="5"]{font-size:15px;line-height:20px}a-title[level="6"]{font-size:13px;line-height:16px}a-title[priority=secondary]{color:var(--text-2)}a-title[priority=tertiary]{color:var(--text-3)}a-title[priority=quaternary]{color:var(--text-4)}a-title[tone=brand]{color:var(--text-1-brand)}a-title[tone=brand][priority=secondary]{color:var(--text-2-brand)}a-title[tone=brand][priority=tertiary]{color:var(--text-3-brand)}a-title[tone=brand][priority=quaternary]{color:var(--text-4-brand)}a-title[tone=success]{color:var(--text-1-success)}a-title[tone=success][priority=secondary]{color:var(--text-2-success)}a-title[tone=success][priority=tertiary]{color:var(--text-3-success)}a-title[tone=success][priority=quaternary]{color:var(--text-4-success)}a-title[tone=critical]{color:var(--text-1-critical)}a-title[tone=critical][priority=secondary]{color:var(--text-2-critical)}a-title[tone=critical][priority=tertiary]{color:var(--text-3-critical)}a-title[tone=critical][priority=quaternary]{color:var(--text-4-critical)}a-title[tone=warning]{color:var(--text-1-warning)}a-title[tone=warning][priority=secondary]{color:var(--text-2-warning)}a-title[tone=warning][priority=tertiary]{color:var(--text-3-warning)}a-title[tone=warning][priority=quaternary]{color:var(--text-4-warning)}a-title[tone=info]{color:var(--text-1-info)}a-title[tone=info][priority=secondary]{color:var(--text-2-info)}a-title[tone=info][priority=tertiary]{color:var(--text-3-info)}a-title[tone=info][priority=quaternary]{color:var(--text-4-info)}a-title[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--title-tone-source: attr(tone type(<color>), currentColor);--_title-tone: oklch(from var(--title-tone-source) .41 .15 h);color:oklch(from var(--title-tone-source) .33 .15 h)}a-title[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=secondary]{color:var(--_title-tone)}a-title[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{color:color-mix(in oklch,var(--_title-tone) 80%,transparent)}a-title[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=quaternary]{color:color-mix(in oklch,var(--_title-tone) 60%,transparent)}.dark a-title[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_title-tone: oklch(from var(--title-tone-source) .75 .11 h);color:oklch(from var(--title-tone-source) .82 .1 h)}}
|