@antadesign/anta 0.3.12 → 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 +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 +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/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-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.d.ts +6 -2
- package/dist/elements/a-menu.js +65 -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-tooltip.js +1 -1
- package/dist/general_types.d.ts +12 -9
- package/dist/index.d.ts +1 -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
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 {
|
|
@@ -330,10 +333,13 @@ class AMenuElement extends HTMLElementBase {
|
|
|
330
333
|
return this.hasAttribute("state");
|
|
331
334
|
}
|
|
332
335
|
/* --- config getters --- */
|
|
333
|
-
/** A submenu is an `<a-menu>`
|
|
334
|
-
* 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. */
|
|
335
341
|
get isSubmenu() {
|
|
336
|
-
return !!this.
|
|
342
|
+
return !!this.parentElement && isMenuItemEl(this.parentElement);
|
|
337
343
|
}
|
|
338
344
|
get #isContext() {
|
|
339
345
|
return this.hasAttribute("context");
|
|
@@ -352,14 +358,16 @@ class AMenuElement extends HTMLElementBase {
|
|
|
352
358
|
}
|
|
353
359
|
get #placement() {
|
|
354
360
|
const p = this.getAttribute("placement");
|
|
355
|
-
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")
|
|
356
362
|
return p;
|
|
357
363
|
return "bottom-start";
|
|
358
364
|
}
|
|
359
365
|
/** Root menu: the previous element sibling is the trigger. Submenu: the
|
|
360
366
|
* enclosing menu item. One deterministic rule per case — no ambiguity. */
|
|
361
367
|
get triggerAnchor() {
|
|
362
|
-
|
|
368
|
+
const parent = this.parentElement;
|
|
369
|
+
if (parent && isMenuItemEl(parent)) return parent;
|
|
370
|
+
return this.previousElementSibling;
|
|
363
371
|
}
|
|
364
372
|
/** The focusable element to hand focus back to — the anchor itself if it's
|
|
365
373
|
* focusable, else the first focusable within it. Positioning still uses the
|
|
@@ -645,7 +653,14 @@ class AMenuElement extends HTMLElementBase {
|
|
|
645
653
|
}
|
|
646
654
|
} else if (!openStack.includes(this)) {
|
|
647
655
|
const anchor = this.triggerAnchor;
|
|
648
|
-
|
|
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
|
+
}
|
|
649
664
|
if (container) {
|
|
650
665
|
const idx = openStack.indexOf(container);
|
|
651
666
|
for (let i = openStack.length - 1; i > idx; i--) {
|
|
@@ -714,6 +729,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
714
729
|
this.comboObserver = void 0;
|
|
715
730
|
this.setActive(null);
|
|
716
731
|
this._flippedTop = null;
|
|
732
|
+
this._flippedSide = null;
|
|
717
733
|
const idx = openStack.indexOf(this);
|
|
718
734
|
if (idx === -1) {
|
|
719
735
|
if (this._shown) this._doHide();
|
|
@@ -808,27 +824,46 @@ class AMenuElement extends HTMLElementBase {
|
|
|
808
824
|
if (this.hasAttribute("autowidth")) surface.style.removeProperty("--_anchor-width");
|
|
809
825
|
else surface.style.setProperty("--_anchor-width", `${Math.ceil(a.width)}px`);
|
|
810
826
|
const p = this.#placement;
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
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);
|
|
818
844
|
} else {
|
|
819
|
-
|
|
820
|
-
|
|
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);
|
|
821
866
|
}
|
|
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
867
|
}
|
|
833
868
|
surface.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
|
|
834
869
|
this.updateScrollFade();
|
|
@@ -854,7 +889,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
854
889
|
for (const node of e.composedPath()) {
|
|
855
890
|
if (node === this.surface) break;
|
|
856
891
|
if (node instanceof AMenuItemElement) {
|
|
857
|
-
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) {
|
|
858
893
|
node.dispatchEvent(
|
|
859
894
|
new MouseEvent("menuselect", {
|
|
860
895
|
bubbles: false,
|
|
@@ -877,7 +912,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
877
912
|
e.preventDefault();
|
|
878
913
|
return;
|
|
879
914
|
}
|
|
880
|
-
if (node.querySelector("a-menu")) return;
|
|
915
|
+
if (node.querySelector(":scope > a-menu")) return;
|
|
881
916
|
return this.closeSystem(e);
|
|
882
917
|
}
|
|
883
918
|
if (node.matches("a[data-anta-menu-item]")) return this.closeSystem(e);
|
|
@@ -970,7 +1005,7 @@ class AMenuElement extends HTMLElementBase {
|
|
|
970
1005
|
}
|
|
971
1006
|
submenuOf(item) {
|
|
972
1007
|
if (!item || !(item instanceof AMenuItemElement)) return null;
|
|
973
|
-
return item.querySelector("a-menu");
|
|
1008
|
+
return item.querySelector(":scope > a-menu");
|
|
974
1009
|
}
|
|
975
1010
|
typeahead(ch, items) {
|
|
976
1011
|
this.typeBuffer += ch.toLowerCase();
|
|
@@ -1087,6 +1122,8 @@ class AMenuElement extends HTMLElementBase {
|
|
|
1087
1122
|
this.cancelOpenTimer();
|
|
1088
1123
|
if (!this._shown) return;
|
|
1089
1124
|
if (this.#hasKeyboardFocusInside) return;
|
|
1125
|
+
if (openStack.some((m) => m !== this && (this.contains(m) || m.triggerAnchor != null && this.contains(m.triggerAnchor))))
|
|
1126
|
+
return;
|
|
1090
1127
|
this.cancelCloseTimer();
|
|
1091
1128
|
this.closeTimer = setTimeout(() => {
|
|
1092
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)}}
|
package/dist/general_types.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { IconShape } from './elements/a-icon.shapes';
|
|
2
2
|
/** Common props for JSX component wrappers. */
|
|
3
3
|
export interface BaseProps {
|
|
4
|
-
/** CSS class
|
|
4
|
+
/** CSS class on the component's root element (merged with the component's own
|
|
5
|
+
* classes). Use it directly for layout and positioning — grid/flex placement,
|
|
6
|
+
* margins, alignment — rather than wrapping the component in a `<div>`/`<span>`. */
|
|
5
7
|
className?: string;
|
|
6
|
-
/** Inline styles
|
|
8
|
+
/** Inline styles on the component's root element. Set layout/positioning here
|
|
9
|
+
* (or via `className`) directly on the component instead of adding a wrapper. */
|
|
7
10
|
style?: React.CSSProperties;
|
|
8
11
|
/** Child elements. When provided, replaces the component's default label/content. */
|
|
9
12
|
children?: React.ReactNode;
|
|
@@ -172,8 +175,8 @@ export interface AProgressAttributes extends BaseAttributes {
|
|
|
172
175
|
* from `@antadesign/anta`.
|
|
173
176
|
*/
|
|
174
177
|
export interface ATextAttributes extends BaseAttributes {
|
|
175
|
-
/** Visual priority. Maps to text-1..text-
|
|
176
|
-
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary'
|
|
178
|
+
/** Visual priority. Maps to text-1..text-4. */
|
|
179
|
+
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary';
|
|
177
180
|
/** Color tint. `neutral` (default) is the untinted `--text-{N}` scale; a named
|
|
178
181
|
* tone applies the matching `--text-{N}-{tone}` palette; any literal CSS color
|
|
179
182
|
* is a custom tone (hue kept, lightness/chroma pinned per priority in oklch). */
|
|
@@ -207,8 +210,8 @@ export interface ATextAttributes extends BaseAttributes {
|
|
|
207
210
|
export interface ATitleAttributes extends BaseAttributes {
|
|
208
211
|
/** Heading level as a string attribute, '1'-'6'. */
|
|
209
212
|
level?: string;
|
|
210
|
-
/** Visual priority. Maps to text-1..text-
|
|
211
|
-
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary'
|
|
213
|
+
/** Visual priority. Maps to text-1..text-4. */
|
|
214
|
+
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary';
|
|
212
215
|
/** Color tint. `neutral` (default) is the untinted `--text-{N}` scale; a named
|
|
213
216
|
* tone applies the matching `--text-{N}-{tone}` palette; any literal CSS color
|
|
214
217
|
* is a custom tone (hue kept, lightness/chroma pinned per priority in oklch). */
|
|
@@ -374,7 +377,7 @@ export interface AIconAttributes extends BaseAttributes {
|
|
|
374
377
|
* `Tooltip` from `@antadesign/anta`.
|
|
375
378
|
*/
|
|
376
379
|
export interface ATooltipAttributes extends BaseAttributes {
|
|
377
|
-
/** Show delay in milliseconds. Never use `0` — use ~`50`. Defaults to
|
|
380
|
+
/** Show delay in milliseconds. Never use `0` — use ~`50`. Defaults to 300. */
|
|
378
381
|
delay?: number | string;
|
|
379
382
|
/** Preferred side; auto-flips when there's no room. Defaults to `'bottom'`. */
|
|
380
383
|
placement?: 'top' | 'bottom';
|
|
@@ -635,8 +638,8 @@ export interface ACalendarAttributes extends BaseAttributes {
|
|
|
635
638
|
*/
|
|
636
639
|
export interface AMenuAttributes extends BaseAttributes {
|
|
637
640
|
/** Preferred placement relative to the trigger; auto-flips / clamps.
|
|
638
|
-
* Defaults to `'bottom-start'`. */
|
|
639
|
-
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top';
|
|
641
|
+
* Defaults to `'bottom-start'`. `right` / `left` place the menu beside the trigger. */
|
|
642
|
+
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top' | 'right-start' | 'right-end' | 'left-start' | 'left-end' | 'right' | 'left';
|
|
640
643
|
/** Open on right-click of the trigger region, positioned at the pointer.
|
|
641
644
|
* Presence-based (`''` on, omit off). */
|
|
642
645
|
context?: boolean | '';
|
package/dist/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ export type { CalendarDay, CalendarWeekday, CalendarMonth, BuildMonthOptions, Pa
|
|
|
63
63
|
export { RadioGroup } from './components/RadioGroup';
|
|
64
64
|
export type { RadioGroupProps, RadioOption } from './components/RadioGroup';
|
|
65
65
|
export { Select, optionsWithSelection } from './components/Select';
|
|
66
|
-
export type { SelectProps, SelectCommonProps, SelectOption, SelectGroup, SelectSubmenu, SelectItem, SelectChangeAttrs, OptionState, TriggerState, EmptyState, SelectionState, SelectedOption, SelectedGroup, SelectedSubmenu, SelectedItem, } from './components/Select';
|
|
66
|
+
export type { SelectProps, SelectCommonProps, OptionValue, SelectOption, SelectGroup, SelectSubmenu, SelectItem, SelectChangeAttrs, OptionState, TriggerState, EmptyState, SelectionState, SelectedOption, SelectedGroup, SelectedSubmenu, SelectedItem, } from './components/Select';
|
|
67
67
|
export { SelectFaceted } from './components/SelectFaceted';
|
|
68
68
|
export type { SelectFacetedProps, SelectFacet, SelectFacetSingle, SelectFacetMultiple, SelectFacetText, SelectFacetCustom, SelectFacetCustomContext, SelectFacetedValue, SelectFacetedChangeAttrs, SelectFacetedTriggerState, } from './components/SelectFaceted';
|
|
69
69
|
export { Tabs } from './components/Tabs';
|
package/dist/reset.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{*,*:before,*:after{box-sizing:border-box}*{margin:0}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}h1,h2,h3,h4,h5,h6{color:var(--text-1);font-weight:584.62;letter-spacing:0}h1{font-size:28px;line-height:32px;margin-block:0 16px}h2{font-size:24px;line-height:28px;margin-block:32px 12px}h3{font-size:20px;line-height:24px;margin-block:24px 12px}h4{font-size:17px;line-height:20px;margin-block:20px 8px}h5{font-size:15px;line-height:20px;margin-block:16px 8px}h6{font-size:13px;line-height:16px;margin-block:16px 4px}strong{font-weight:600}code{line-height:1em}code,kbd,samp,pre{letter-spacing:0}ul,ol{padding-left:3ch}:is(ul,ol)>li{margin-bottom:.5em}:is(ul,ol)>li::marker{color:var(--text-5)}menu{list-style:none;padding:0;margin:0}menu>li{margin:0}a:not(:where([role=button])),a:not(:where([role=button])):link,a:not(:where([role=button])):visited{color:var(--link-color);text-decoration:underline;text-decoration-style:solid;text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:.5px;text-underline-offset:3px}@media(hover:hover)and (pointer:fine){a:not(:where([role=button])):hover{color:var(--link-color-hover);text-decoration-thickness:1px}}a:not(:where([role=button])):active{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent)}::selection{background:color-mix(in oklch,var(--focus-ring) 20%,transparent)}.dark ::selection{background:color-mix(in oklch,var(--focus-ring) 30%,transparent)}table{border-collapse:collapse;font-variant-numeric:lining-nums tabular-nums}caption{text-align:left;color:var(--text-3);padding-left:10px;margin-bottom:.25em}th,td{padding:5px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--border-4)}thead th{font-weight:600}tfoot tr:last-child>:is(th,td),table:not(:has(tfoot)) tbody tr:last-child>:is(th,td){border-bottom:none}table[data-bordered]{border-collapse:separate;border-spacing:0;border:1px solid var(--border-4);border-radius:3px}table[data-bordered] :is(th,td){border-right:1px solid var(--border-4)}table[data-bordered] tr>:is(th,td):last-child{border-right:0}}
|
|
1
|
+
@layer anta{*,*:before,*:after{box-sizing:border-box}*{margin:0}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}h1,h2,h3,h4,h5,h6{color:var(--text-1);font-weight:584.62;letter-spacing:0}h1{font-size:28px;line-height:32px;margin-block:0 16px}h2{font-size:24px;line-height:28px;margin-block:32px 12px}h3{font-size:20px;line-height:24px;margin-block:24px 12px}h4{font-size:17px;line-height:20px;margin-block:20px 8px}h5{font-size:15px;line-height:20px;margin-block:16px 8px}h6{font-size:13px;line-height:16px;margin-block:16px 4px}strong{font-weight:600}dfn{font-style:normal;text-decoration:underline dotted;text-underline-offset:3px;text-decoration-color:color-mix(in oklch,currentColor 50%,transparent)}code{line-height:1em}code,kbd,samp,pre{letter-spacing:0}ul,ol{padding-left:3ch}:is(ul,ol)>li{margin-bottom:.5em}:is(ul,ol)>li::marker{color:var(--text-5)}menu{list-style:none;padding:0;margin:0}menu>li{margin:0}a:not(:where([role=button])),a:not(:where([role=button])):link,a:not(:where([role=button])):visited{color:var(--link-color);text-decoration:underline;text-decoration-style:solid;text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:.5px;text-underline-offset:3px}@media(hover:hover)and (pointer:fine){a:not(:where([role=button])):hover{color:var(--link-color-hover);text-decoration-thickness:1px}}a:not(:where([role=button])):active{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent)}::selection{background:color-mix(in oklch,var(--focus-ring) 20%,transparent)}.dark ::selection{background:color-mix(in oklch,var(--focus-ring) 30%,transparent)}table{border-collapse:collapse;font-variant-numeric:lining-nums tabular-nums}caption{text-align:left;color:var(--text-3);padding-left:10px;margin-bottom:.25em}th,td{padding:5px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--border-4)}thead th{font-weight:600}tfoot tr:last-child>:is(th,td),table:not(:has(tfoot)) tbody tr:last-child>:is(th,td){border-bottom:none}table[data-bordered]{border-collapse:separate;border-spacing:0;border:1px solid var(--border-4);border-radius:3px}table[data-bordered] :is(th,td){border-right:1px solid var(--border-4)}table[data-bordered] tr>:is(th,td):last-child{border-right:0}}
|