@antadesign/anta 0.3.7 → 0.3.9
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/dist/anta_helpers.d.ts +20 -0
- package/dist/anta_helpers.js +5 -1
- package/dist/components/Button.js +2 -2
- package/dist/components/Card.d.ts +28 -14
- package/dist/components/Card.js +51 -19
- package/dist/components/Card.module.css +35 -0
- package/dist/components/Checkbox.js +2 -2
- package/dist/components/Dialog.js +4 -4
- package/dist/components/Expander.js +4 -4
- package/dist/components/Input.js +2 -2
- package/dist/components/InputTime.js +2 -2
- package/dist/components/Menu.js +4 -4
- package/dist/components/MenuItem.d.ts +60 -32
- package/dist/components/MenuItem.js +35 -9
- package/dist/components/Progress.js +2 -2
- package/dist/components/Tabs.js +3 -3
- package/dist/components/Tag.js +3 -2
- package/dist/components/Text.d.ts +5 -3
- package/dist/components/Text.js +8 -2
- package/dist/components/Title.d.ts +5 -3
- package/dist/components/Title.js +4 -2
- package/dist/components/Tooltip.js +2 -2
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-card.css +1 -211
- package/dist/elements/a-card.js +44 -72
- package/dist/elements/a-checkbox.js +0 -2
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +2 -1
- package/dist/elements/a-icon.shapes.js +1 -0
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.d.ts +13 -0
- package/dist/elements/a-menu-item.js +14 -6
- package/dist/elements/a-menu.d.ts +6 -0
- package/dist/elements/a-menu.js +14 -4
- package/dist/elements/a-radio-group.d.ts +3 -1
- package/dist/elements/a-radio-group.js +3 -3
- package/dist/elements/a-tabs.d.ts +3 -1
- package/dist/elements/a-tabs.js +3 -3
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +55 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -1
- package/package.json +1 -1
package/dist/components/Tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState } from "../jsx-runtime";
|
|
3
|
-
import { nativeStateChange, toneStyle, roundStyle, wrapLabel } from "../anta_helpers";
|
|
3
|
+
import { nativeStateChange, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
4
4
|
import { Tooltip } from "./Tooltip";
|
|
5
5
|
const Tabs = ({
|
|
6
6
|
children,
|
|
@@ -62,7 +62,7 @@ const Tabs = ({
|
|
|
62
62
|
size: size && size !== "medium" ? size : void 0,
|
|
63
63
|
orientation: vertical ? "vertical" : void 0,
|
|
64
64
|
noslide: noslide ? "" : void 0,
|
|
65
|
-
round: round
|
|
65
|
+
round: roundAttr(round),
|
|
66
66
|
disabled: disabled ? "" : void 0,
|
|
67
67
|
onstatechange,
|
|
68
68
|
onchange,
|
|
@@ -85,7 +85,7 @@ const Tabs = ({
|
|
|
85
85
|
"aria-disabled": tabDisabled ? "true" : void 0,
|
|
86
86
|
tabIndex: tabDisabled && !isSelected ? -1 : 0,
|
|
87
87
|
disabled: tabDisabled ? "" : void 0,
|
|
88
|
-
round: round
|
|
88
|
+
round: roundAttr(round) ?? roundAttr(p.round),
|
|
89
89
|
children: [
|
|
90
90
|
p.icon && /* @__PURE__ */ jsx("a-icon", { shape: p.icon, "aria-hidden": "true" }),
|
|
91
91
|
wrapLabel(p.label != null ? p.label : p.children, "a-tab-label"),
|
package/dist/components/Tag.js
CHANGED
|
@@ -15,13 +15,14 @@ const Tag = ({
|
|
|
15
15
|
children,
|
|
16
16
|
...rest
|
|
17
17
|
}) => {
|
|
18
|
-
const
|
|
18
|
+
const toneAttr = tone || void 0;
|
|
19
|
+
const computedStyle = toneStyle(toneAttr, "--tag-tone-source", style);
|
|
19
20
|
const hasValue = value != null;
|
|
20
21
|
const isIconOnly = icon != null && label == null && value == null && children == null && iconTrailing == null;
|
|
21
22
|
return /* @__PURE__ */ jsxs(
|
|
22
23
|
"a-tag",
|
|
23
24
|
{
|
|
24
|
-
tone,
|
|
25
|
+
tone: toneAttr,
|
|
25
26
|
"aria-label": isIconOnly ? `${icon} tag` : void 0,
|
|
26
27
|
priority: priority && priority !== "secondary" ? priority : void 0,
|
|
27
28
|
size: size && size !== "medium" ? size : void 0,
|
|
@@ -23,10 +23,12 @@ export type TextProps = BaseProps & {
|
|
|
23
23
|
* step softer than the strongest foreground; pass `primary` for emphasis.
|
|
24
24
|
* @defaultValue secondary */
|
|
25
25
|
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
|
|
26
|
-
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale;
|
|
27
|
-
*
|
|
26
|
+
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a
|
|
27
|
+
* named tone applies the matching `--text-{N}-{tone}` palette. Any literal CSS
|
|
28
|
+
* color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is
|
|
29
|
+
* kept while lightness/chroma are pinned per priority in oklch.
|
|
28
30
|
* @defaultValue neutral */
|
|
29
|
-
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
|
|
31
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
30
32
|
/** Type scale. `small` = 13/16, `medium` = 15/20, `large` = 17/24.
|
|
31
33
|
* @defaultValue medium */
|
|
32
34
|
size?: 'small' | 'medium' | 'large';
|
package/dist/components/Text.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { toneStyle } from "../anta_helpers";
|
|
2
3
|
const Text = ({ priority, tone, size, inline, truncate, expandable, collapsible, className, style, children, ...rest }) => {
|
|
3
4
|
const n = typeof truncate === "number" ? truncate : truncate ? 1 : null;
|
|
4
5
|
const lineCount = n != null && n >= 1 ? n : null;
|
|
5
|
-
const
|
|
6
|
+
const toneAttr = tone || void 0;
|
|
7
|
+
const computedStyle = toneStyle(
|
|
8
|
+
toneAttr,
|
|
9
|
+
"--text-tone-source",
|
|
10
|
+
lineCount != null ? { ...style, ["--line-clamp"]: lineCount } : style
|
|
11
|
+
);
|
|
6
12
|
const canExpand = expandable && lineCount != null;
|
|
7
13
|
return /* @__PURE__ */ jsx(
|
|
8
14
|
"a-text",
|
|
9
15
|
{
|
|
10
16
|
priority,
|
|
11
|
-
tone,
|
|
17
|
+
tone: toneAttr,
|
|
12
18
|
size,
|
|
13
19
|
inline: inline ? "" : void 0,
|
|
14
20
|
truncate: lineCount != null ? String(lineCount) : void 0,
|
|
@@ -8,10 +8,12 @@ export interface TitleProps extends BaseProps {
|
|
|
8
8
|
/** Visual priority. Maps to text-1..text-5 (`primary` = text-1).
|
|
9
9
|
* @defaultValue primary */
|
|
10
10
|
priority?: 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'quinary';
|
|
11
|
-
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale;
|
|
12
|
-
*
|
|
11
|
+
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale; a
|
|
12
|
+
* named tone applies the matching `--text-{N}-{tone}` palette. Any literal CSS
|
|
13
|
+
* color (`'#ff1493'`, `'rebeccapurple'`) is a one-off custom tone — its hue is
|
|
14
|
+
* kept while lightness/chroma are pinned per priority in oklch.
|
|
13
15
|
* @defaultValue neutral */
|
|
14
|
-
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
|
|
16
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Block-level heading with level 1-6, priority, and tone.
|
package/dist/components/Title.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { toneStyle } from "../anta_helpers";
|
|
2
3
|
const Title = ({ level = 2, priority, tone, className, style, children, ...rest }) => {
|
|
4
|
+
const toneAttr = tone || void 0;
|
|
3
5
|
return /* @__PURE__ */ jsx(
|
|
4
6
|
"a-title",
|
|
5
7
|
{
|
|
6
8
|
level: String(level),
|
|
7
9
|
priority,
|
|
8
|
-
tone,
|
|
10
|
+
tone: toneAttr,
|
|
9
11
|
role: "heading",
|
|
10
12
|
"aria-level": level,
|
|
11
13
|
class: className,
|
|
12
|
-
style,
|
|
14
|
+
style: toneStyle(toneAttr, "--title-tone-source", style),
|
|
13
15
|
...rest,
|
|
14
16
|
children
|
|
15
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { roundStyle } from "../anta_helpers";
|
|
2
|
+
import { roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
const Tooltip = ({
|
|
4
4
|
delay,
|
|
5
5
|
placement,
|
|
@@ -18,7 +18,7 @@ const Tooltip = ({
|
|
|
18
18
|
{
|
|
19
19
|
delay: delay != null ? String(delay) : void 0,
|
|
20
20
|
placement: placement === "top" ? "top" : void 0,
|
|
21
|
-
round: round
|
|
21
|
+
round: roundAttr(round),
|
|
22
22
|
follow: follow ? "" : void 0,
|
|
23
23
|
interactive: interactive ? "" : void 0,
|
|
24
24
|
"truncated-only": truncatedOnly ? "" : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-button,a[role=button][data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-max-width: 100%;--button-max-height: 100%;--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}a-button,a[role=button][data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:var(--button-max-width);max-height:var(--button-max-height);padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
|
|
1
|
+
@layer anta{a-button,a[role=button][data-anta],button[data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand],.dark button[data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical],.dark button[data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info],.dark button[data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success],.dark button[data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning],.dark button[data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}button[data-anta]{box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
|
package/dist/elements/a-card.css
CHANGED
|
@@ -1,211 +1 @@
|
|
|
1
|
-
@layer anta {
|
|
2
|
-
/* Host + token definitions for <a-card>. The visible box lives here (not in the
|
|
3
|
-
shadow) so plain consumer CSS overrides it and it paints before the element
|
|
4
|
-
upgrades; the shadow <style> owns layout + region typography and only
|
|
5
|
-
REFERENCES these --card-* tokens with literal fallbacks. Named tones use
|
|
6
|
-
Anta's theme-aware role tokens, so dark mode is mostly free (same as
|
|
7
|
-
<a-expander> / <a-tag>); only the custom-tone branch needs a .dark re-tune. */
|
|
8
|
-
|
|
9
|
-
a-card {
|
|
10
|
-
/* Text roles: title = the strong foreground, text = the body (a step softer). */
|
|
11
|
-
--card-title: var(--text-1);
|
|
12
|
-
--card-text: var(--text-2);
|
|
13
|
-
|
|
14
|
-
/* Surface pairs per priority. `primary` (the default) is a clean sheet —
|
|
15
|
-
bg-1 in light, bg-4 in dark (see the `.dark` neutral rule), and
|
|
16
|
-
bg-4-{tone} for a toned card; `secondary` is a subtle fill (bg-2);
|
|
17
|
-
`tertiary` is a frosted panel (the primary surface, semi-transparent, +
|
|
18
|
-
a backdrop blur — see below). */
|
|
19
|
-
--card-bg-secondary: var(--bg-2);
|
|
20
|
-
--card-bg-primary: var(--bg-1);
|
|
21
|
-
|
|
22
|
-
/* `primary` is the default surface. */
|
|
23
|
-
--card-bg: var(--card-bg-primary);
|
|
24
|
-
/* Neutral edge hairline: text-2 at 10% (via --card-text). Toned cards override
|
|
25
|
-
this with their border-4-{tone} in the tone rules below. Flat across
|
|
26
|
-
priorities. */
|
|
27
|
-
--card-border: color-mix(in oklch, var(--card-text) 10%, transparent);
|
|
28
|
-
|
|
29
|
-
/* Selected ring (a 2px inset stroke) — the tone's strongest border. */
|
|
30
|
-
--card-selected-ring: var(--border-1);
|
|
31
|
-
|
|
32
|
-
/* Closed-surface hover lift for link cards: an oklch lightness bump that keeps
|
|
33
|
-
hue + chroma, so it works for every priority and tone in light and dark
|
|
34
|
-
(a transparent tertiary surface keeps zero alpha). Tune the amount here. */
|
|
35
|
-
--card-bg-hover-lift: 0.01;
|
|
36
|
-
|
|
37
|
-
--card-radius: 8px;
|
|
38
|
-
--card-padding: 16px;
|
|
39
|
-
|
|
40
|
-
display: block;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
/* Fill the container (grid cell / flex item / block) so width is always
|
|
43
|
-
definite. This is also what keeps `container-type` below from collapsing
|
|
44
|
-
the card to zero width in a shrink-to-fit context (a query container can't
|
|
45
|
-
size to its own content). Same as <a-expander>. */
|
|
46
|
-
width: 100%;
|
|
47
|
-
/* Establish the card as a query container so both the shadow layout and
|
|
48
|
-
consumer slotted content can `@container card (…)` on its width. */
|
|
49
|
-
container-type: inline-size;
|
|
50
|
-
container-name: card;
|
|
51
|
-
|
|
52
|
-
color: var(--card-text);
|
|
53
|
-
background: var(--card-bg);
|
|
54
|
-
/* The edge is a 1px OUTSET shadow ring (spread 1px, no blur), not a border:
|
|
55
|
-
it sits outside the box so full-bleed media reaches the very edge (no 1px
|
|
56
|
-
border inset) and it never adds to layout. `overflow: clip` doesn't clip an
|
|
57
|
-
element's own outset shadow, so the ring shows while the media still clips
|
|
58
|
-
to the rounded corners. */
|
|
59
|
-
box-shadow: 0 0 0 1px var(--card-border);
|
|
60
|
-
border-radius: var(--card-radius);
|
|
61
|
-
/* Clip full-bleed media to the rounded corners. */
|
|
62
|
-
overflow: clip;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
a-card[priority="secondary"] {
|
|
66
|
-
--card-bg: var(--card-bg-secondary);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* `round` re-points --card-radius, so both the host clip-radius and the shadow
|
|
70
|
-
container's ring follow. Bare `round` → 999px (fully round, clamped to the
|
|
71
|
-
box); a length (`round="16px"`, or the wrapper's `round={16}` → inline
|
|
72
|
-
--card-round) sets a custom radius. The typed attr() covers raw-HTML authors. */
|
|
73
|
-
a-card[round] {
|
|
74
|
-
--card-round: attr(round type(<length>));
|
|
75
|
-
--card-radius: var(--card-round, 999px);
|
|
76
|
-
}
|
|
77
|
-
a-card[priority="tertiary"] {
|
|
78
|
-
/* Frosted glass: the primary surface at 1% over a backdrop blur, so the card
|
|
79
|
-
reads over busy / colored / image backgrounds. It keeps the same hairline
|
|
80
|
-
ring as the other priorities (no --card-border override). The blur only
|
|
81
|
-
shows where there's detail behind it; the translucency reads everywhere. */
|
|
82
|
-
--card-bg: color-mix(in oklch, var(--card-bg-primary) 1%, transparent);
|
|
83
|
-
backdrop-filter: blur(8px);
|
|
84
|
-
-webkit-backdrop-filter: blur(8px);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/* Neutral dark: bg-1 (primary's light surface) is pure black in dark mode, so
|
|
88
|
-
step neutral primary up to bg-4. Secondary stays bg-2 via its token, and a
|
|
89
|
-
toned card's --bg-*-{tone} tokens self-flip, so this is scoped to neutral. */
|
|
90
|
-
.dark a-card:not([tone]),
|
|
91
|
-
.dark a-card[tone="neutral"] {
|
|
92
|
-
--card-bg-primary: var(--bg-4);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/* Hover lift, link cards only — gated so it doesn't stick after a tap. */
|
|
96
|
-
@media (hover: hover) and (pointer: fine) {
|
|
97
|
-
a-card[href]:not([loading]):hover {
|
|
98
|
-
background: oklch(from var(--card-bg) calc(l + var(--card-bg-hover-lift)) c h);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* Pre-upgrade skeleton: the host border / background / radius already paint
|
|
103
|
-
(they're defined here, not in the shadow), so only the content inset is
|
|
104
|
-
missing before the shadow's .content exists — supply it here, then the
|
|
105
|
-
shadow owns padding once :defined. */
|
|
106
|
-
a-card:not(:defined) {
|
|
107
|
-
padding: var(--card-padding);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* A slotted heading node — <a-title> (any level) or a raw <h1>–<h6> — carries a
|
|
111
|
-
document TOP margin (Title level 4 is 20px) that would add a leading gap in the
|
|
112
|
-
header; zero it. The BOTTOM margin stays, so a heading header keeps its gap to
|
|
113
|
-
the body. (A plain-STRING header has no margin of its own, so the `<Card>`
|
|
114
|
-
wrapper wraps it in a div with the matching 8px bottom margin — CSS can't tell
|
|
115
|
-
a string from a styled node, so that split lives in the wrapper.) Specificity
|
|
116
|
-
is bumped past `a-title[level="N"]` (0,1,1) and the reset's `hN` (0,0,1);
|
|
117
|
-
`@layer anta` keeps it overridable by un-layered CSS. */
|
|
118
|
-
a-card :is(h1, h2, h3, h4, h5, h6),
|
|
119
|
-
a-card a-title[level] {
|
|
120
|
-
margin-block-start: 0;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/* Named tones — re-point the text roles + the per-priority surface pairs to the
|
|
124
|
-
matching theme tokens (which self-flip for dark mode). */
|
|
125
|
-
a-card[tone="brand"] {
|
|
126
|
-
--card-title: var(--text-1-brand);
|
|
127
|
-
--card-text: var(--text-2-brand);
|
|
128
|
-
--card-bg-secondary: var(--bg-2-brand);
|
|
129
|
-
--card-bg-primary: var(--bg-4-brand);
|
|
130
|
-
--card-border: var(--border-4-brand);
|
|
131
|
-
--card-selected-ring: var(--border-1-brand);
|
|
132
|
-
}
|
|
133
|
-
a-card[tone="info"] {
|
|
134
|
-
--card-title: var(--text-1-info);
|
|
135
|
-
--card-text: var(--text-2-info);
|
|
136
|
-
--card-bg-secondary: var(--bg-2-info);
|
|
137
|
-
--card-bg-primary: var(--bg-4-info);
|
|
138
|
-
--card-border: var(--border-4-info);
|
|
139
|
-
--card-selected-ring: var(--border-1-info);
|
|
140
|
-
}
|
|
141
|
-
a-card[tone="success"] {
|
|
142
|
-
--card-title: var(--text-1-success);
|
|
143
|
-
--card-text: var(--text-2-success);
|
|
144
|
-
--card-bg-secondary: var(--bg-2-success);
|
|
145
|
-
--card-bg-primary: var(--bg-4-success);
|
|
146
|
-
--card-border: var(--border-4-success);
|
|
147
|
-
--card-selected-ring: var(--border-1-success);
|
|
148
|
-
}
|
|
149
|
-
a-card[tone="warning"] {
|
|
150
|
-
--card-title: var(--text-1-warning);
|
|
151
|
-
--card-text: var(--text-2-warning);
|
|
152
|
-
--card-bg-secondary: var(--bg-2-warning);
|
|
153
|
-
--card-bg-primary: var(--bg-4-warning);
|
|
154
|
-
--card-border: var(--border-4-warning);
|
|
155
|
-
--card-selected-ring: var(--border-1-warning);
|
|
156
|
-
}
|
|
157
|
-
a-card[tone="critical"] {
|
|
158
|
-
--card-title: var(--text-1-critical);
|
|
159
|
-
--card-text: var(--text-2-critical);
|
|
160
|
-
--card-bg-secondary: var(--bg-2-critical);
|
|
161
|
-
--card-bg-primary: var(--bg-4-critical);
|
|
162
|
-
--card-border: var(--border-4-critical);
|
|
163
|
-
--card-selected-ring: var(--border-1-critical);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/* Custom tone — any non-named `tone` value keeps the source hue while
|
|
167
|
-
lightness/chroma are pinned per token in oklch, the <a-expander> mechanism.
|
|
168
|
-
The JSX wrapper writes --card-tone-source inline; the typed attr() fallback
|
|
169
|
-
picks up raw <a-card tone="…"> on engines that support it. */
|
|
170
|
-
a-card[tone]:not(
|
|
171
|
-
[tone="neutral"],
|
|
172
|
-
[tone="brand"],
|
|
173
|
-
[tone="info"],
|
|
174
|
-
[tone="success"],
|
|
175
|
-
[tone="warning"],
|
|
176
|
-
[tone="critical"]
|
|
177
|
-
) {
|
|
178
|
-
--card-tone-source: attr(tone type(<color>), currentColor);
|
|
179
|
-
|
|
180
|
-
--card-text: oklch(from var(--card-tone-source) 0.41 0.15 h);
|
|
181
|
-
--card-title: oklch(from var(--card-tone-source) 0.33 0.15 h);
|
|
182
|
-
--card-bg-secondary: oklch(from var(--card-tone-source) 0.99 0.006 h);
|
|
183
|
-
--card-bg-primary: oklch(from var(--card-tone-source) 0.955 0.02 h);
|
|
184
|
-
--card-border: oklch(from var(--card-tone-source) 0.895 0.045 h);
|
|
185
|
-
--card-selected-ring: oklch(from var(--card-tone-source) 0.6 0.15 h);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.dark a-card[tone]:not(
|
|
189
|
-
[tone="neutral"],
|
|
190
|
-
[tone="brand"],
|
|
191
|
-
[tone="info"],
|
|
192
|
-
[tone="success"],
|
|
193
|
-
[tone="warning"],
|
|
194
|
-
[tone="critical"]
|
|
195
|
-
) {
|
|
196
|
-
--card-text: oklch(from var(--card-tone-source) 0.75 0.11 h);
|
|
197
|
-
--card-title: oklch(from var(--card-tone-source) 0.82 0.10 h);
|
|
198
|
-
--card-bg-secondary: oklch(from var(--card-tone-source) 0.13 0.02 h);
|
|
199
|
-
--card-bg-primary: oklch(from var(--card-tone-source) 0.19 0.04 h);
|
|
200
|
-
--card-border: oklch(from var(--card-tone-source) 0.26 0.07 h);
|
|
201
|
-
--card-selected-ring: oklch(from var(--card-tone-source) 0.7 0.13 h);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/* Size — padding scale (medium is the default, set on the base rule). */
|
|
205
|
-
a-card[size="small"] {
|
|
206
|
-
--card-padding: 12px;
|
|
207
|
-
}
|
|
208
|
-
a-card[size="large"] {
|
|
209
|
-
--card-padding: 20px;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
1
|
+
@layer anta{a-card{--card-text: var(--text-2);--card-bg-secondary: var(--bg-2);--card-bg-primary: var(--bg-1);--card-bg: var(--card-bg-primary);--card-border: var(--border-4);--card-border-hover: var(--border-3);--card-selected-ring: var(--border-1);--card-bg-hover-lift: .01;--card-radius: 8px;--card-padding: 12px;--card-content-fs: 15px;--card-content-lh: 20px;--card-icon-size: 40px;--card-icon-bg: var(--bg-4);--card-header-nudge: 2px;display:block;box-sizing:border-box;position:relative;width:100%;container-type:inline-size;container-name:card;color:var(--card-text);background:var(--card-bg);box-shadow:0 0 0 1px var(--card-border);border-radius:var(--card-radius);overflow:clip;transition:background-color .15s ease,box-shadow .15s ease,opacity .18s ease}a-card[priority=secondary]{--card-bg: var(--card-bg-secondary);--card-icon-blend: multiply}.dark a-card:not([priority=tertiary]){--card-icon-blend: exclusion}a-card[round]{--card-round: attr(round type(<length>));--card-radius: var(--card-round, 999px)}a-card[priority=tertiary]{--card-bg: color-mix(in oklch, var(--card-bg-primary) 1%, transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.dark a-card:not([tone]),.dark a-card[tone=neutral]{--card-bg-primary: var(--bg-4);--card-icon-bg: var(--bg-5)}@media(hover:hover)and (pointer:fine){a-card[href]:not([loading]):hover{background:oklch(from var(--card-bg) calc(l + var(--card-bg-hover-lift)) c h)}a-card:not([loading]):hover{box-shadow:0 0 0 1px var(--card-border-hover)}}a-card[href]:not([loading]):active{box-shadow:0 0 0 1px var(--card-border)}@media(prefers-reduced-motion:reduce){a-card{transition:none}}a-card:not(:defined){padding:var(--card-padding);opacity:0}a-card:not(:has(>[slot=media]))::part(media),a-card:not(:has(>[slot=header])):not(:has(>[slot=icon]))::part(header),a-card:not(:has(>[slot=icon]))::part(icon),a-card:not(:has(>[slot=footer]))::part(footer),a-card:not(:has(>:not([slot])))::part(body){display:none}a-card:is(:has(>[slot=header]),:has(>[slot=icon]))::part(body){padding-block-start:0}a-card:has(>[slot=footer])::part(body){padding-block-end:0}a-card :is(h1,h2,h3,h4,h5,h6),a-card a-title[level]{margin-block-start:0}a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header],a-card>a-title[slot=header]{margin-block-end:0}a-card>a-title[slot=header]+a-text[slot=header],a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:1px}a-card[size=large]>a-title[slot=header]+a-text[slot=header],a-card[size=large]>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:2px}a-card[tone=brand]{--card-text: var(--text-2-brand);--card-bg-secondary: var(--bg-4-brand);--card-bg-primary: var(--bg-2-brand);--card-border: var(--border-4-brand);--card-border-hover: var(--border-3-brand);--card-icon-bg: var(--bg-5-brand);--card-selected-ring: var(--border-1-brand)}a-card[tone=info]{--card-text: var(--text-2-info);--card-bg-secondary: var(--bg-4-info);--card-bg-primary: var(--bg-2-info);--card-border: var(--border-4-info);--card-border-hover: var(--border-3-info);--card-icon-bg: var(--bg-5-info);--card-selected-ring: var(--border-1-info)}a-card[tone=success]{--card-text: var(--text-2-success);--card-bg-secondary: var(--bg-4-success);--card-bg-primary: var(--bg-2-success);--card-border: var(--border-4-success);--card-border-hover: var(--border-3-success);--card-icon-bg: var(--bg-5-success);--card-selected-ring: var(--border-1-success)}a-card[tone=warning]{--card-text: var(--text-2-warning);--card-bg-secondary: var(--bg-4-warning);--card-bg-primary: var(--bg-2-warning);--card-border: var(--border-4-warning);--card-border-hover: var(--border-3-warning);--card-icon-bg: var(--bg-5-warning);--card-selected-ring: var(--border-1-warning)}a-card[tone=critical]{--card-text: var(--text-2-critical);--card-bg-secondary: var(--bg-4-critical);--card-bg-primary: var(--bg-2-critical);--card-border: var(--border-4-critical);--card-border-hover: var(--border-3-critical);--card-icon-bg: var(--bg-5-critical);--card-selected-ring: var(--border-1-critical)}.dark a-card[tone=brand]{--card-bg-primary: var(--bg-4-brand);--card-bg-secondary: var(--bg-2-brand)}.dark a-card[tone=info]{--card-bg-primary: var(--bg-4-info);--card-bg-secondary: var(--bg-2-info)}.dark a-card[tone=success]{--card-bg-primary: var(--bg-4-success);--card-bg-secondary: var(--bg-2-success)}.dark a-card[tone=warning]{--card-bg-primary: var(--bg-4-warning);--card-bg-secondary: var(--bg-2-warning)}.dark a-card[tone=critical]{--card-bg-primary: var(--bg-4-critical);--card-bg-secondary: var(--bg-2-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-tone-source: attr(tone type(<color>), currentColor);--card-text: oklch(from var(--card-tone-source) .41 .15 h);--card-bg-secondary: oklch(from var(--card-tone-source) .955 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .99 .006 h);--card-icon-bg: oklch(from var(--card-tone-source) .925 .03 h);--card-border: oklch(from var(--card-tone-source) .895 .045 h);--card-border-hover: oklch(from var(--card-tone-source) .85 .06 h);--card-selected-ring: oklch(from var(--card-tone-source) .6 .15 h)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-text: oklch(from var(--card-tone-source) .75 .11 h);--card-bg-secondary: oklch(from var(--card-tone-source) .13 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .19 .04 h);--card-icon-bg: oklch(from var(--card-tone-source) .22 .05 h);--card-border: oklch(from var(--card-tone-source) .26 .07 h);--card-border-hover: oklch(from var(--card-tone-source) .32 .09 h);--card-selected-ring: oklch(from var(--card-tone-source) .7 .13 h)}a-card[priority=tertiary]{--card-icon-bg: var(--bg-3)}a-card[tone=brand][priority=tertiary]{--card-icon-bg: var(--bg-3-brand)}a-card[tone=info][priority=tertiary]{--card-icon-bg: var(--bg-3-info)}a-card[tone=success][priority=tertiary]{--card-icon-bg: var(--bg-3-success)}a-card[tone=warning][priority=tertiary]{--card-icon-bg: var(--bg-3-warning)}a-card[tone=critical][priority=tertiary]{--card-icon-bg: var(--bg-3-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: oklch(from var(--card-tone-source) .97 .014 h)}.dark a-card[tone=brand][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-brand), white 10%)}.dark a-card[tone=info][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-info), white 10%)}.dark a-card[tone=success][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-success), white 10%)}.dark a-card[tone=warning][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-warning), white 10%)}.dark a-card[tone=critical][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-critical), white 10%)}.dark a-card:not([tone])[priority=tertiary],.dark a-card[tone=neutral][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5), white 10%)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: color-mix(in oklch, oklch(from var(--card-tone-source) .22 .05 h), white 10%)}a-card[size=small]{--card-padding: 8px;--card-header-nudge: 1px;--card-icon-size: 32px;--card-content-fs: 13px;--card-content-lh: 16px}a-card[size=large]{--card-padding: 16px;--card-header-nudge: 4px;--card-icon-size: 44px;--card-content-fs: 17px;--card-content-lh: 24px}}
|
package/dist/elements/a-card.js
CHANGED
|
@@ -26,10 +26,9 @@ const SHADOW_STYLE = `
|
|
|
26
26
|
box-shadow: inset 0 0 0 1px transparent, inset 0 0 0 2px var(--focus-ring);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
[part="media"] { display:
|
|
30
|
-
[part="media"]
|
|
31
|
-
:host([media-position="
|
|
32
|
-
:host([media-position="right"]) [part="media"].has-content { flex: none; }
|
|
29
|
+
[part="media"] { display: block; }
|
|
30
|
+
:host([media-position="left"]) [part="media"],
|
|
31
|
+
:host([media-position="right"]) [part="media"] { flex: none; }
|
|
33
32
|
|
|
34
33
|
.content {
|
|
35
34
|
display: flex;
|
|
@@ -37,55 +36,49 @@ const SHADOW_STYLE = `
|
|
|
37
36
|
flex: 1 1 auto;
|
|
38
37
|
min-width: 0;
|
|
39
38
|
min-height: 0;
|
|
40
|
-
|
|
39
|
+
/* Base type for the content zone, matching the body <a-text> at this size. The
|
|
40
|
+
title / subtitle / body all set their own font, so this changes nothing
|
|
41
|
+
visible \u2014 it defines the em/ch base so the header gap (in ch) resolves against
|
|
42
|
+
the body's type size. */
|
|
43
|
+
font-size: var(--card-content-fs, 15px);
|
|
44
|
+
line-height: var(--card-content-lh, 20px);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
.header
|
|
44
|
-
.header-row.has-content {
|
|
47
|
+
.header {
|
|
45
48
|
display: flex;
|
|
46
|
-
align-items:
|
|
47
|
-
gap:
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 1ch;
|
|
51
|
+
padding: var(--card-padding, 12px);
|
|
52
|
+
padding-block-start: calc(var(--card-padding, 12px) - var(--card-header-nudge, 1px));
|
|
53
|
+
padding-block-end: calc(var(--card-padding, 12px) / 2);
|
|
48
54
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
slot[name="icon"] {
|
|
56
|
+
flex: none;
|
|
57
|
+
display: flex;
|
|
58
|
+
align-items: center;
|
|
59
|
+
/* Off by default; secondary cards in light multiply the chip into the deeper
|
|
60
|
+
surface (see --card-icon-blend in the external sheet). */
|
|
61
|
+
mix-blend-mode: var(--card-icon-blend, normal);
|
|
62
|
+
}
|
|
63
|
+
slot[name="header"] {
|
|
52
64
|
display: block;
|
|
53
65
|
flex: 1 1 auto;
|
|
54
66
|
min-width: 0;
|
|
55
|
-
font-size: 17px;
|
|
56
|
-
line-height: 20px;
|
|
57
|
-
font-weight: 584.62;
|
|
58
|
-
letter-spacing: 0;
|
|
59
|
-
font-feature-settings: 'ss02', 'ss05', 'tnum';
|
|
60
|
-
color: var(--card-title, var(--text-1));
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
slot[name="actions"] { display: none; }
|
|
64
|
-
slot[name="actions"].has-content {
|
|
65
|
-
display: flex;
|
|
66
|
-
align-items: center;
|
|
67
|
-
gap: 4px;
|
|
68
|
-
flex: none;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
68
|
slot[part="body"] {
|
|
72
69
|
display: block;
|
|
73
70
|
flex: 1 1 auto;
|
|
74
71
|
min-width: 0;
|
|
75
72
|
min-height: 0;
|
|
76
|
-
|
|
77
|
-
line-height: 20px;
|
|
78
|
-
color: var(--card-text, var(--text-2));
|
|
73
|
+
padding: var(--card-padding, 12px);
|
|
79
74
|
}
|
|
80
|
-
|
|
81
|
-
slot[name="footer"] { display: none; }
|
|
82
|
-
slot[name="footer"].has-content {
|
|
75
|
+
slot[name="footer"] {
|
|
83
76
|
display: flex;
|
|
84
77
|
align-items: center;
|
|
85
78
|
gap: 8px;
|
|
86
79
|
flex-wrap: wrap;
|
|
87
80
|
justify-content: flex-start;
|
|
88
|
-
padding
|
|
81
|
+
padding: var(--card-padding, 12px);
|
|
89
82
|
}
|
|
90
83
|
|
|
91
84
|
:host([selected]) .container { box-shadow: inset 0 0 0 2px var(--card-selected-ring, var(--focus-ring)); }
|
|
@@ -100,12 +93,8 @@ const SHADOW_STYLE = `
|
|
|
100
93
|
class ACardElement extends HTMLElementBase {
|
|
101
94
|
static observedAttributes = ["href", "target", "rel", "ping", "loading", "aria-label"];
|
|
102
95
|
#container;
|
|
103
|
-
#mediaSlot;
|
|
104
|
-
#headerRow;
|
|
105
96
|
#headerSlot;
|
|
106
|
-
#actionsSlot;
|
|
107
97
|
#bodySlot;
|
|
108
|
-
#footerSlot;
|
|
109
98
|
constructor() {
|
|
110
99
|
super();
|
|
111
100
|
const shadow = this.attachShadow({ mode: "open" });
|
|
@@ -114,56 +103,39 @@ class ACardElement extends HTMLElementBase {
|
|
|
114
103
|
this.#container = document.createElement("a");
|
|
115
104
|
this.#container.className = "container";
|
|
116
105
|
this.#container.setAttribute("part", "container");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
const mediaSlot = document.createElement("slot");
|
|
107
|
+
mediaSlot.name = "media";
|
|
108
|
+
mediaSlot.setAttribute("part", "media");
|
|
120
109
|
const content = document.createElement("div");
|
|
121
110
|
content.className = "content";
|
|
122
111
|
content.setAttribute("part", "content");
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
const headerSection = document.createElement("div");
|
|
113
|
+
headerSection.className = "header";
|
|
114
|
+
headerSection.setAttribute("part", "header");
|
|
115
|
+
const iconSlot = document.createElement("slot");
|
|
116
|
+
iconSlot.name = "icon";
|
|
117
|
+
iconSlot.setAttribute("part", "icon");
|
|
125
118
|
this.#headerSlot = document.createElement("slot");
|
|
126
119
|
this.#headerSlot.name = "header";
|
|
127
|
-
this.#headerSlot.setAttribute("part", "
|
|
128
|
-
this.#
|
|
129
|
-
this.#actionsSlot.name = "actions";
|
|
130
|
-
this.#actionsSlot.setAttribute("part", "actions");
|
|
120
|
+
this.#headerSlot.setAttribute("part", "title");
|
|
121
|
+
headerSection.append(iconSlot, this.#headerSlot);
|
|
131
122
|
this.#bodySlot = document.createElement("slot");
|
|
132
123
|
this.#bodySlot.setAttribute("part", "body");
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
this.#container.append(this.#mediaSlot, content);
|
|
124
|
+
const footerSlot = document.createElement("slot");
|
|
125
|
+
footerSlot.name = "footer";
|
|
126
|
+
footerSlot.setAttribute("part", "footer");
|
|
127
|
+
content.append(headerSection, this.#bodySlot, footerSlot);
|
|
128
|
+
this.#container.append(mediaSlot, content);
|
|
139
129
|
shadow.append(style, this.#container);
|
|
140
|
-
this.#
|
|
141
|
-
this.#footerSlot.addEventListener("slotchange", () => this.#syncHasContent());
|
|
142
|
-
this.#actionsSlot.addEventListener("slotchange", () => this.#syncHasContent());
|
|
143
|
-
this.#headerSlot.addEventListener("slotchange", () => {
|
|
144
|
-
this.#syncHasContent();
|
|
145
|
-
this.#syncName();
|
|
146
|
-
});
|
|
130
|
+
this.#headerSlot.addEventListener("slotchange", () => this.#syncName());
|
|
147
131
|
this.#bodySlot.addEventListener("slotchange", () => this.#syncName());
|
|
148
132
|
}
|
|
149
133
|
connectedCallback() {
|
|
150
|
-
this.#syncHasContent();
|
|
151
134
|
this.#syncLink();
|
|
152
135
|
}
|
|
153
136
|
attributeChangedCallback() {
|
|
154
137
|
this.#syncLink();
|
|
155
138
|
}
|
|
156
|
-
/** Toggle the per-zone `has-content` classes (empty zones reserve no box). */
|
|
157
|
-
#syncHasContent() {
|
|
158
|
-
const set = (el, has) => el.classList.toggle("has-content", has);
|
|
159
|
-
set(this.#mediaSlot, this.#mediaSlot.assignedNodes().length > 0);
|
|
160
|
-
set(this.#footerSlot, this.#footerSlot.assignedNodes().length > 0);
|
|
161
|
-
const header = this.#headerSlot.assignedNodes().length > 0;
|
|
162
|
-
const actions = this.#actionsSlot.assignedNodes().length > 0;
|
|
163
|
-
set(this.#headerSlot, header);
|
|
164
|
-
set(this.#actionsSlot, actions);
|
|
165
|
-
set(this.#headerRow, header || actions);
|
|
166
|
-
}
|
|
167
139
|
/** Mirror the link attributes onto the shadow anchor — but drop `href` while
|
|
168
140
|
* `loading` so a loading card can't navigate. Also reflects `aria-busy`. */
|
|
169
141
|
#syncLink() {
|