@antadesign/anta 0.3.12 → 0.3.14
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.d.ts +10 -2
- package/dist/anta_helpers.js +5 -0
- package/dist/components/Banner.d.ts +79 -0
- package/dist/components/Banner.js +69 -0
- package/dist/components/Button.d.ts +17 -4
- package/dist/components/Button.js +8 -0
- 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/Select.d.ts +81 -51
- package/dist/components/Select.js +21 -9
- package/dist/components/SelectFaceted.d.ts +21 -16
- package/dist/components/SelectFaceted.js +4 -4
- package/dist/components/SelectFaceted.module.css +1 -1
- package/dist/components/Text.d.ts +2 -2
- package/dist/components/Title.d.ts +2 -2
- package/dist/components/Toaster.d.ts +48 -0
- package/dist/components/Toaster.js +56 -0
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/select-options.d.ts +10 -5
- package/dist/components/select-options.js +1 -1
- package/dist/elements/a-banner.css +1 -0
- package/dist/elements/a-banner.d.ts +10 -0
- package/dist/elements/a-banner.js +141 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -0
- 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.js +6 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +6 -2
- package/dist/elements/a-menu.js +67 -28
- 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-toast.css +1 -0
- package/dist/elements/a-toast.d.ts +70 -0
- package/dist/elements/a-toast.js +283 -0
- package/dist/elements/a-toaster.css +1 -0
- package/dist/elements/a-toaster.d.ts +30 -0
- package/dist/elements/a-toaster.js +98 -0
- package/dist/elements/a-tooltip.js +1 -1
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +52 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +3 -1
- package/dist/reset.css +1 -1
- package/dist/theme-anta.css +1 -0
- package/dist/toaster.d.ts +99 -0
- package/dist/toaster.js +100 -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
package/dist/elements/a-menu.js
CHANGED
|
@@ -170,6 +170,9 @@ class AMenuElement extends HTMLElementBase {
|
|
|
170
170
|
// (filtering changes height) keeps this side rather than re-deciding — a shrunk
|
|
171
171
|
// menu shouldn't hop back under the trigger.
|
|
172
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;
|
|
173
176
|
constructor() {
|
|
174
177
|
super();
|
|
175
178
|
try {
|
|
@@ -213,6 +216,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
213
216
|
transition:
|
|
214
217
|
opacity 140ms ease-out,
|
|
215
218
|
translate 140ms ease-out,
|
|
219
|
+
width var(--menu-width-duration, 160ms) ease,
|
|
216
220
|
display 140ms allow-discrete,
|
|
217
221
|
overlay 140ms allow-discrete;
|
|
218
222
|
}
|
|
@@ -224,6 +228,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
224
228
|
transition:
|
|
225
229
|
opacity 100ms ease-out,
|
|
226
230
|
translate 100ms ease-out,
|
|
231
|
+
width var(--menu-width-duration, 160ms) ease,
|
|
227
232
|
display 100ms allow-discrete,
|
|
228
233
|
overlay 100ms allow-discrete;
|
|
229
234
|
}
|
|
@@ -330,10 +335,13 @@ class AMenuElement extends HTMLElementBase {
|
|
|
330
335
|
return this.hasAttribute("state");
|
|
331
336
|
}
|
|
332
337
|
/* --- config getters --- */
|
|
333
|
-
/** A submenu is an `<a-menu>`
|
|
334
|
-
* structure, no `submenu` attribute needed (the parent item is the
|
|
338
|
+
/** A submenu is an `<a-menu>` that is a DIRECT child of an `<a-menu-item>` —
|
|
339
|
+
* derived from structure, no `submenu` attribute needed (the parent item is the
|
|
340
|
+
* anchor). A menu merely *nested somewhere inside* an item's subtree (a composed
|
|
341
|
+
* control — `Select` / `InputDate` — slotted into a flyout) is NOT a submenu: it
|
|
342
|
+
* anchors to its own previous sibling and nests as a child of its container. */
|
|
335
343
|
get isSubmenu() {
|
|
336
|
-
return !!this.
|
|
344
|
+
return !!this.parentElement && isMenuItemEl(this.parentElement);
|
|
337
345
|
}
|
|
338
346
|
get #isContext() {
|
|
339
347
|
return this.hasAttribute("context");
|
|
@@ -352,14 +360,16 @@ class AMenuElement extends HTMLElementBase {
|
|
|
352
360
|
}
|
|
353
361
|
get #placement() {
|
|
354
362
|
const p = this.getAttribute("placement");
|
|
355
|
-
if (p === "bottom-end" || p === "top-start" || p === "top-end" || p === "bottom" || p === "top")
|
|
363
|
+
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")
|
|
356
364
|
return p;
|
|
357
365
|
return "bottom-start";
|
|
358
366
|
}
|
|
359
367
|
/** Root menu: the previous element sibling is the trigger. Submenu: the
|
|
360
368
|
* enclosing menu item. One deterministic rule per case — no ambiguity. */
|
|
361
369
|
get triggerAnchor() {
|
|
362
|
-
|
|
370
|
+
const parent = this.parentElement;
|
|
371
|
+
if (parent && isMenuItemEl(parent)) return parent;
|
|
372
|
+
return this.previousElementSibling;
|
|
363
373
|
}
|
|
364
374
|
/** The focusable element to hand focus back to — the anchor itself if it's
|
|
365
375
|
* focusable, else the first focusable within it. Positioning still uses the
|
|
@@ -645,7 +655,14 @@ class AMenuElement extends HTMLElementBase {
|
|
|
645
655
|
}
|
|
646
656
|
} else if (!openStack.includes(this)) {
|
|
647
657
|
const anchor = this.triggerAnchor;
|
|
648
|
-
|
|
658
|
+
let container;
|
|
659
|
+
if (anchor)
|
|
660
|
+
for (let i = openStack.length - 1; i >= 0; i--) {
|
|
661
|
+
if (openStack[i] !== this && openStack[i].contains(anchor)) {
|
|
662
|
+
container = openStack[i];
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
649
666
|
if (container) {
|
|
650
667
|
const idx = openStack.indexOf(container);
|
|
651
668
|
for (let i = openStack.length - 1; i > idx; i--) {
|
|
@@ -714,6 +731,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
714
731
|
this.comboObserver = void 0;
|
|
715
732
|
this.setActive(null);
|
|
716
733
|
this._flippedTop = null;
|
|
734
|
+
this._flippedSide = null;
|
|
717
735
|
const idx = openStack.indexOf(this);
|
|
718
736
|
if (idx === -1) {
|
|
719
737
|
if (this._shown) this._doHide();
|
|
@@ -808,27 +826,46 @@ class AMenuElement extends HTMLElementBase {
|
|
|
808
826
|
if (this.hasAttribute("autowidth")) surface.style.removeProperty("--_anchor-width");
|
|
809
827
|
else surface.style.setProperty("--_anchor-width", `${Math.ceil(a.width)}px`);
|
|
810
828
|
const p = this.#placement;
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
829
|
+
if (p.startsWith("right") || p.startsWith("left")) {
|
|
830
|
+
surface.style.removeProperty("--_anchor-width");
|
|
831
|
+
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, vh - 2 * MARGIN)}px`;
|
|
832
|
+
const box = surface.getBoundingClientRect();
|
|
833
|
+
const spaceRight = vw - a.right - 2 * MARGIN;
|
|
834
|
+
const spaceLeft = a.left - 2 * MARGIN;
|
|
835
|
+
let onLeft = p.startsWith("left");
|
|
836
|
+
if (reanchor && this._flippedSide !== null) onLeft = this._flippedSide;
|
|
837
|
+
else if (onLeft && spaceLeft < box.width && spaceRight > spaceLeft) onLeft = false;
|
|
838
|
+
else if (!onLeft && spaceRight < box.width && spaceLeft > spaceRight) onLeft = true;
|
|
839
|
+
this._flippedSide = onLeft;
|
|
840
|
+
left = onLeft ? a.left - box.width - this.#offset : a.right + this.#offset;
|
|
841
|
+
left = Math.max(MARGIN, Math.min(left, vw - box.width - MARGIN));
|
|
842
|
+
const valign = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
843
|
+
top = valign === "center" ? a.top + a.height / 2 - box.height / 2 : valign === "end" ? a.bottom - box.height : a.top;
|
|
844
|
+
if (top + box.height > vh - MARGIN) top = vh - box.height - MARGIN;
|
|
845
|
+
top = Math.max(MARGIN, top);
|
|
818
846
|
} else {
|
|
819
|
-
|
|
820
|
-
|
|
847
|
+
const spaceBelow = vh - a.bottom - 2 * MARGIN;
|
|
848
|
+
const spaceAbove = a.top - 2 * MARGIN;
|
|
849
|
+
let onTop = p.startsWith("top");
|
|
850
|
+
surface.style.maxHeight = "";
|
|
851
|
+
const natural = surface.scrollHeight;
|
|
852
|
+
if (reanchor && this._flippedTop !== null) {
|
|
853
|
+
onTop = this._flippedTop;
|
|
854
|
+
} else {
|
|
855
|
+
if (onTop && spaceAbove < natural && spaceBelow > spaceAbove) onTop = false;
|
|
856
|
+
else if (!onTop && spaceBelow < natural && spaceAbove > spaceBelow) onTop = true;
|
|
857
|
+
}
|
|
858
|
+
this._flippedTop = onTop;
|
|
859
|
+
const space = onTop ? spaceAbove : spaceBelow;
|
|
860
|
+
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, Math.floor(space))}px`;
|
|
861
|
+
const box = surface.getBoundingClientRect();
|
|
862
|
+
const align = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
863
|
+
left = align === "center" ? a.left + a.width / 2 - box.width / 2 : align === "end" ? a.right - box.width : a.left;
|
|
864
|
+
if (left + box.width > vw - MARGIN) left = vw - box.width - MARGIN;
|
|
865
|
+
left = Math.max(MARGIN, left);
|
|
866
|
+
top = onTop ? a.top - box.height - this.#offset : a.bottom + this.#offset;
|
|
867
|
+
top = Math.max(MARGIN, top);
|
|
821
868
|
}
|
|
822
|
-
this._flippedTop = onTop;
|
|
823
|
-
const space = onTop ? spaceAbove : spaceBelow;
|
|
824
|
-
surface.style.maxHeight = `${Math.max(MIN_HEIGHT, Math.floor(space))}px`;
|
|
825
|
-
const box = surface.getBoundingClientRect();
|
|
826
|
-
const align = p.endsWith("end") ? "end" : p.endsWith("start") ? "start" : "center";
|
|
827
|
-
left = align === "center" ? a.left + a.width / 2 - box.width / 2 : align === "end" ? a.right - box.width : a.left;
|
|
828
|
-
if (left + box.width > vw - MARGIN) left = vw - box.width - MARGIN;
|
|
829
|
-
left = Math.max(MARGIN, left);
|
|
830
|
-
top = onTop ? a.top - box.height - this.#offset : a.bottom + this.#offset;
|
|
831
|
-
top = Math.max(MARGIN, top);
|
|
832
869
|
}
|
|
833
870
|
surface.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
|
|
834
871
|
this.updateScrollFade();
|
|
@@ -854,7 +891,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
854
891
|
for (const node of e.composedPath()) {
|
|
855
892
|
if (node === this.surface) break;
|
|
856
893
|
if (node instanceof AMenuItemElement) {
|
|
857
|
-
if (!node.hasAttribute("disabled") && !node.querySelector("a-menu") && node.closest("a-menu") === this) {
|
|
894
|
+
if (!node.hasAttribute("disabled") && !node.querySelector(":scope > a-menu") && node.closest("a-menu") === this) {
|
|
858
895
|
node.dispatchEvent(
|
|
859
896
|
new MouseEvent("menuselect", {
|
|
860
897
|
bubbles: false,
|
|
@@ -877,7 +914,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
877
914
|
e.preventDefault();
|
|
878
915
|
return;
|
|
879
916
|
}
|
|
880
|
-
if (node.querySelector("a-menu")) return;
|
|
917
|
+
if (node.querySelector(":scope > a-menu")) return;
|
|
881
918
|
return this.closeSystem(e);
|
|
882
919
|
}
|
|
883
920
|
if (node.matches("a[data-anta-menu-item]")) return this.closeSystem(e);
|
|
@@ -970,7 +1007,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
970
1007
|
}
|
|
971
1008
|
submenuOf(item) {
|
|
972
1009
|
if (!item || !(item instanceof AMenuItemElement)) return null;
|
|
973
|
-
return item.querySelector("a-menu");
|
|
1010
|
+
return item.querySelector(":scope > a-menu");
|
|
974
1011
|
}
|
|
975
1012
|
typeahead(ch, items) {
|
|
976
1013
|
this.typeBuffer += ch.toLowerCase();
|
|
@@ -1087,6 +1124,8 @@ class AMenuElement extends HTMLElementBase {
|
|
|
1087
1124
|
this.cancelOpenTimer();
|
|
1088
1125
|
if (!this._shown) return;
|
|
1089
1126
|
if (this.#hasKeyboardFocusInside) return;
|
|
1127
|
+
if (openStack.some((m) => m !== this && (this.contains(m) || m.triggerAnchor != null && this.contains(m.triggerAnchor))))
|
|
1128
|
+
return;
|
|
1090
1129
|
this.cancelCloseTimer();
|
|
1091
1130
|
this.closeTimer = setTimeout(() => {
|
|
1092
1131
|
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)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@property --toast-remaining{syntax: "<number>"; inherits: true; initial-value: 1;}@layer anta{a-toast{--toast-dur: .22s}a-toast:not(:defined){display:none}}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-toast.css';
|
|
3
|
+
/**
|
|
4
|
+
* `<a-toast>` — one item inside an `<a-toaster>`. A style-neutral container around
|
|
5
|
+
* slotted content (a `Banner`, `Card`, `Sticker`, a string, or a raw DOM node):
|
|
6
|
+
* it owns the enter / exit animation and the auto-dismiss timer (paused while
|
|
7
|
+
* hovered or focused), nothing else. No chrome of its own — no ✕, no surface; the
|
|
8
|
+
* toasted content brings its own look and its own dismiss affordance. Its `slot`
|
|
9
|
+
* attribute (`slot="bottom-right"`, …) routes it to a placement zone.
|
|
10
|
+
*
|
|
11
|
+
* Content arrives one of two ways: as slotted light-DOM children (a string / JSX
|
|
12
|
+
* the `<Toaster>` renders through the reconciler), or as a live DOM node set on
|
|
13
|
+
* the `content` property (the wrapper's DOM-node branch), which the element slots
|
|
14
|
+
* into its own light DOM. Either way it projects through the shadow `<slot>`.
|
|
15
|
+
*
|
|
16
|
+
* ## Time left — `--toast-remaining`
|
|
17
|
+
*
|
|
18
|
+
* While the auto-dismiss timer runs, the element animates `--toast-remaining` from
|
|
19
|
+
* `1` to `0` on the slot (paused in lockstep with the timer on hover / focus).
|
|
20
|
+
* It's a registered `@property` (see `a-toast.css`) with `inherits: true`, so
|
|
21
|
+
* slotted content inherits the live value and can draw a countdown with one CSS
|
|
22
|
+
* rule — `transform: scaleX(var(--toast-remaining))` — with no timer of its own
|
|
23
|
+
* and no re-render. Display only: the real dismiss is the JS timer, so it degrades
|
|
24
|
+
* to a full bar where custom-property animation is unsupported. Sticky
|
|
25
|
+
* (`duration="0"`) runs no countdown; the var stays `1`.
|
|
26
|
+
*
|
|
27
|
+
* ## Dismiss from an action — `data-toast-dismiss`
|
|
28
|
+
*
|
|
29
|
+
* Any element inside the toast carrying `data-toast-dismiss` dismisses it on click
|
|
30
|
+
* — the same convention as `<a-banner>`'s `data-banner-dismiss` and `<a-dialog>`'s
|
|
31
|
+
* `data-dialog-close`. It's a click listener (a light-DOM READ, declarative-safe),
|
|
32
|
+
* so it catches any activated control — native `<button>`, `<a>`, `<a-button>`,
|
|
33
|
+
* `<a-menu-item>` — and keyboard activation for free. A toasted `<Banner>` instead
|
|
34
|
+
* dismisses through its own `onDismiss` (wire it to `manager.dismiss(id)`); its
|
|
35
|
+
* built-in ✕ and any `data-banner-dismiss` action ride that channel.
|
|
36
|
+
*
|
|
37
|
+
* It **never removes itself**. Dismissal — from the timer, a `data-toast-dismiss`
|
|
38
|
+
* control, or the `leaving` attribute the wrapper sets for a programmatic
|
|
39
|
+
* `dismiss` — fades the host out (an off-DOM `:state(leaving)`), then emits a
|
|
40
|
+
* bubbling **`dismiss`**; the owner removes the node on that event. So the element
|
|
41
|
+
* writes only its own shadow + internals, reads its own attributes (and, read-only,
|
|
42
|
+
* the light DOM for the dismiss trigger), appends only its own (wrapper-supplied)
|
|
43
|
+
* content node, and dispatches events.
|
|
44
|
+
*
|
|
45
|
+
* Shadow structure — the host IS the box (no wrappers):
|
|
46
|
+
*
|
|
47
|
+
* :host ← the fade/slide layer
|
|
48
|
+
* <slot> ← the content
|
|
49
|
+
*/
|
|
50
|
+
export declare class AToastElement extends HTMLElementBase {
|
|
51
|
+
#private;
|
|
52
|
+
static observedAttributes: string[];
|
|
53
|
+
constructor();
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
disconnectedCallback(): void;
|
|
56
|
+
attributeChangedCallback(name: string): void;
|
|
57
|
+
/** A live DOM node to show as the content (set by the wrapper's DOM-node
|
|
58
|
+
* branch). Paired getter/setter so React 19's property assignment works. */
|
|
59
|
+
get content(): Node | null;
|
|
60
|
+
set content(node: Node | null);
|
|
61
|
+
/** Restart the auto-dismiss timer from the current `duration` (an in-place
|
|
62
|
+
* update). If the toast is currently paused, the fresh time is banked and the
|
|
63
|
+
* countdown stays paused until hover / focus releases. */
|
|
64
|
+
restart(): void;
|
|
65
|
+
/** Play the exit (shadow only), then emit a bubbling `dismiss`. The owner
|
|
66
|
+
* removes the node on that event — the element never removes itself.
|
|
67
|
+
* Idempotent. */
|
|
68
|
+
dismiss(): void;
|
|
69
|
+
}
|
|
70
|
+
export declare function register_a_toast(): void;
|