@antadesign/anta 0.3.2 → 0.3.4
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 +97 -0
- package/dist/anta_helpers.js +70 -0
- package/dist/calendar-core.d.ts +126 -0
- package/dist/calendar-core.js +289 -0
- package/dist/components/Button.d.ts +9 -1
- package/dist/components/Button.js +5 -2
- package/dist/components/Calendar.d.ts +85 -0
- package/dist/components/Calendar.js +226 -0
- package/dist/components/Checkbox.d.ts +16 -11
- package/dist/components/Checkbox.js +13 -7
- package/dist/components/Expander.d.ts +7 -1
- package/dist/components/Expander.js +4 -2
- package/dist/components/Input.d.ts +13 -5
- package/dist/components/Input.js +14 -6
- package/dist/components/InputDate.d.ts +89 -0
- package/dist/components/InputDate.js +273 -0
- package/dist/components/InputDate.module.css +1 -0
- package/dist/components/Menu.d.ts +14 -1
- package/dist/components/Menu.js +6 -2
- package/dist/components/MenuItem.d.ts +48 -7
- package/dist/components/MenuItem.js +72 -14
- package/dist/components/MenuSeparator.d.ts +13 -2
- package/dist/components/MenuSeparator.js +12 -2
- package/dist/components/Progress.d.ts +4 -1
- package/dist/components/Progress.js +4 -3
- package/dist/components/RadioGroup.d.ts +12 -10
- package/dist/components/RadioGroup.js +5 -5
- package/dist/components/Select.d.ts +319 -0
- package/dist/components/Select.js +341 -0
- package/dist/components/Select.module.css +1 -0
- package/dist/components/Tab.d.ts +3 -0
- package/dist/components/Tab.js +2 -1
- package/dist/components/TabPanel.d.ts +21 -13
- package/dist/components/TabPanel.js +13 -1
- package/dist/components/Tabs.d.ts +75 -40
- package/dist/components/Tabs.js +20 -88
- package/dist/components/Tag.d.ts +10 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.d.ts +6 -5
- package/dist/components/Title.d.ts +4 -2
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +5 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.css +1 -0
- package/dist/elements/a-calendar.d.ts +76 -0
- package/dist/elements/a-calendar.js +190 -0
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.d.ts +1 -2
- package/dist/elements/a-checkbox.js +5 -5
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +16 -5
- package/dist/elements/a-expander.js +59 -8
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +6 -1
- package/dist/elements/a-icon.shapes.js +9 -0
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.d.ts +6 -0
- package/dist/elements/a-input.js +28 -8
- package/dist/elements/a-menu-group.css +1 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu-item.d.ts +22 -10
- package/dist/elements/a-menu-item.js +17 -0
- package/dist/elements/a-menu-separator.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-menu.d.ts +61 -20
- package/dist/elements/a-menu.js +337 -58
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio-group.d.ts +1 -3
- package/dist/elements/a-radio-group.js +13 -13
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-radio.d.ts +3 -11
- package/dist/elements/a-radio.js +3 -34
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tab.d.ts +3 -11
- package/dist/elements/a-tab.js +3 -34
- package/dist/elements/a-tabpanel.css +1 -1
- package/dist/elements/a-tabpanel.d.ts +17 -0
- package/dist/elements/a-tabpanel.js +66 -0
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tabs.d.ts +1 -4
- package/dist/elements/a-tabs.js +14 -14
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.d.ts +14 -13
- package/dist/elements/a-text.js +53 -23
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +1 -11
- package/dist/elements/a-tooltip.js +20 -19
- package/dist/elements/index.d.ts +2 -1
- package/dist/elements/index.js +6 -1
- package/dist/general_types.d.ts +158 -42
- package/dist/index.d.ts +10 -4
- package/dist/index.js +38 -3
- package/dist/jsx-runtime.d.ts +16 -7
- package/dist/jsx-runtime.js +6 -0
- package/dist/reset.css +1 -1
- package/package.json +4 -2
package/dist/components/Tabs.js
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { nativeStateChange, toneStyle, wrapLabel } from "../anta_helpers";
|
|
4
|
-
import { Tab } from "./Tab";
|
|
5
|
-
import { TabPanel } from "./TabPanel";
|
|
6
|
-
import styles from "./Tabs.module.css";
|
|
7
|
-
const flattenChildren = (nodes) => {
|
|
8
|
-
const out = [];
|
|
9
|
-
const visit = (n) => {
|
|
10
|
-
if (n == null || typeof n === "boolean") return;
|
|
11
|
-
if (Array.isArray(n)) {
|
|
12
|
-
n.forEach(visit);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (n && n.type === Fragment) {
|
|
16
|
-
visit(n.props?.children);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
out.push(n);
|
|
20
|
-
};
|
|
21
|
-
visit(nodes);
|
|
22
|
-
return out;
|
|
23
|
-
};
|
|
1
|
+
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { useState } from "../jsx-runtime";
|
|
3
|
+
import { nativeStateChange, toneStyle, roundStyle, wrapLabel } from "../anta_helpers";
|
|
24
4
|
const Tabs = ({
|
|
25
5
|
children,
|
|
6
|
+
options,
|
|
26
7
|
value,
|
|
27
8
|
defaultValue,
|
|
28
9
|
onStateChange,
|
|
@@ -35,8 +16,8 @@ const Tabs = ({
|
|
|
35
16
|
tone,
|
|
36
17
|
size,
|
|
37
18
|
orientation,
|
|
38
|
-
mounting = "display",
|
|
39
19
|
noslide,
|
|
20
|
+
round,
|
|
40
21
|
disabled,
|
|
41
22
|
className,
|
|
42
23
|
style,
|
|
@@ -46,24 +27,12 @@ const Tabs = ({
|
|
|
46
27
|
const controlled = value !== void 0;
|
|
47
28
|
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
48
29
|
const currentValue = controlled ? value : internalValue;
|
|
49
|
-
const
|
|
50
|
-
() => new Set(currentValue != null ? [currentValue] : [])
|
|
51
|
-
);
|
|
52
|
-
if (currentValue != null && !mounted.has(currentValue)) {
|
|
53
|
-
setMounted((m) => m.has(currentValue) ? m : new Set(m).add(currentValue));
|
|
54
|
-
}
|
|
55
|
-
const baseId = useId();
|
|
56
|
-
const tabId = (v) => `${baseId}-tab-${v}`;
|
|
57
|
-
const panelId = (v) => `${baseId}-panel-${v}`;
|
|
58
|
-
const items = flattenChildren(children);
|
|
59
|
-
const tabs = items.filter((c) => c?.type === Tab);
|
|
60
|
-
const panels = items.filter((c) => c?.type === TabPanel);
|
|
61
|
-
const panelValues = new Set(panels.map((pan) => pan.props.value));
|
|
30
|
+
const tabs = options ?? [];
|
|
62
31
|
const seen = /* @__PURE__ */ new Set();
|
|
63
32
|
for (const t of tabs) {
|
|
64
|
-
if (seen.has(t.
|
|
65
|
-
console.warn(`[anta] <Tabs> duplicate
|
|
66
|
-
seen.add(t.
|
|
33
|
+
if (seen.has(t.value))
|
|
34
|
+
console.warn(`[anta] <Tabs> duplicate option value=${JSON.stringify(t.value)} \u2014 values must be unique.`);
|
|
35
|
+
seen.add(t.value);
|
|
67
36
|
}
|
|
68
37
|
const onstatechange = (e) => {
|
|
69
38
|
const { event, detail } = nativeStateChange(e);
|
|
@@ -78,7 +47,6 @@ const Tabs = ({
|
|
|
78
47
|
onValueChange?.(e, { value: e.currentTarget?.value ?? null });
|
|
79
48
|
} : void 0;
|
|
80
49
|
const vertical = orientation === "vertical";
|
|
81
|
-
const needsContainer = panels.length > 0 || vertical;
|
|
82
50
|
const strip = /* @__PURE__ */ jsx(
|
|
83
51
|
"a-tabs",
|
|
84
52
|
{
|
|
@@ -93,32 +61,30 @@ const Tabs = ({
|
|
|
93
61
|
size: size && size !== "medium" ? size : void 0,
|
|
94
62
|
orientation: vertical ? "vertical" : void 0,
|
|
95
63
|
noslide: noslide ? "" : void 0,
|
|
64
|
+
round: round ? "" : void 0,
|
|
96
65
|
disabled: disabled ? "" : void 0,
|
|
97
66
|
onstatechange,
|
|
98
67
|
onchange,
|
|
99
68
|
onfocusin: onFocus,
|
|
100
69
|
onfocusout: onBlur,
|
|
101
|
-
class:
|
|
102
|
-
id
|
|
103
|
-
style: toneStyle(tone, "--tabs-tone-source", style),
|
|
104
|
-
...
|
|
105
|
-
children: tabs.map((
|
|
106
|
-
const p = t.props;
|
|
70
|
+
class: className,
|
|
71
|
+
id,
|
|
72
|
+
style: roundStyle(round, "--tabs-round", toneStyle(tone, "--tabs-tone-source", style)),
|
|
73
|
+
...rest,
|
|
74
|
+
children: tabs.map((p) => {
|
|
107
75
|
const tabDisabled = disabled || p.disabled;
|
|
108
76
|
const isSelected = p.value === currentValue;
|
|
109
|
-
const hasPanel = panelValues.has(p.value);
|
|
110
77
|
return /* @__PURE__ */ jsxs(
|
|
111
78
|
"a-tab",
|
|
112
79
|
{
|
|
113
80
|
role: "tab",
|
|
114
81
|
value: p.value,
|
|
115
|
-
id: tabId(p.value),
|
|
116
82
|
tone: p.tone && p.tone !== "neutral" ? p.tone : void 0,
|
|
117
83
|
style: toneStyle(p.tone, "--tabs-tone-source", void 0),
|
|
118
|
-
"aria-controls": hasPanel ? panelId(p.value) : void 0,
|
|
119
84
|
"aria-disabled": tabDisabled ? "true" : void 0,
|
|
120
85
|
tabIndex: tabDisabled && !isSelected ? -1 : 0,
|
|
121
86
|
disabled: tabDisabled ? "" : void 0,
|
|
87
|
+
round: round || p.round ? "" : void 0,
|
|
122
88
|
children: [
|
|
123
89
|
p.icon && /* @__PURE__ */ jsx("a-icon", { shape: p.icon, "aria-hidden": "true" }),
|
|
124
90
|
wrapLabel(p.label != null ? p.label : p.children, "a-tab-label"),
|
|
@@ -130,44 +96,10 @@ const Tabs = ({
|
|
|
130
96
|
})
|
|
131
97
|
}
|
|
132
98
|
);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
className: className ? `${styles.container} ${className}` : styles.container,
|
|
138
|
-
"data-orientation": vertical ? "vertical" : void 0,
|
|
139
|
-
id,
|
|
140
|
-
...rest,
|
|
141
|
-
children: [
|
|
142
|
-
strip,
|
|
143
|
-
panels.map((pan) => {
|
|
144
|
-
const p = pan.props;
|
|
145
|
-
const active = p.value === currentValue;
|
|
146
|
-
const mode = p.mounting ?? mounting;
|
|
147
|
-
if (mode === "active" && !active) return null;
|
|
148
|
-
if (mode === "lazy" && !active && !mounted.has(p.value)) return null;
|
|
149
|
-
const hidden = !active;
|
|
150
|
-
const hideByVisibility = hidden && mode === "visibility";
|
|
151
|
-
return /* @__PURE__ */ jsx(
|
|
152
|
-
"a-tabpanel",
|
|
153
|
-
{
|
|
154
|
-
role: "tabpanel",
|
|
155
|
-
id: panelId(p.value),
|
|
156
|
-
"aria-labelledby": tabId(p.value),
|
|
157
|
-
tabIndex: active ? 0 : void 0,
|
|
158
|
-
hidden: hidden && !hideByVisibility ? true : void 0,
|
|
159
|
-
"data-hide": hideByVisibility ? "visibility" : void 0,
|
|
160
|
-
inert: hidden ? true : void 0,
|
|
161
|
-
class: p.className,
|
|
162
|
-
style: p.style,
|
|
163
|
-
children: p.children
|
|
164
|
-
},
|
|
165
|
-
p.value
|
|
166
|
-
);
|
|
167
|
-
})
|
|
168
|
-
]
|
|
169
|
-
}
|
|
170
|
-
);
|
|
99
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
100
|
+
strip,
|
|
101
|
+
children
|
|
102
|
+
] });
|
|
171
103
|
};
|
|
172
104
|
export {
|
|
173
105
|
Tabs
|
package/dist/components/Tag.d.ts
CHANGED
|
@@ -28,9 +28,9 @@ export interface TagProps extends BaseProps {
|
|
|
28
28
|
* default — both render identically and emit no DOM attribute.
|
|
29
29
|
* @defaultValue medium */
|
|
30
30
|
size?: 'small' | 'medium' | 'large';
|
|
31
|
-
/** Render in
|
|
32
|
-
* (
|
|
33
|
-
|
|
31
|
+
/** Render in all-caps instead of the default normal (mixed) case
|
|
32
|
+
* (uppercase tracks wider than the default body-text letter-spacing). */
|
|
33
|
+
allcaps?: boolean;
|
|
34
34
|
/** Leading icon shape. Sits flush before the label, scaled to the pill. */
|
|
35
35
|
icon?: IconShape;
|
|
36
36
|
/** Trailing icon shape. Renders last, after the value. */
|
|
@@ -73,16 +73,17 @@ export interface TagProps extends BaseProps {
|
|
|
73
73
|
* are the only numbers to tune and the `.dark` block re-tunes them. The
|
|
74
74
|
* wrapper writes `--tag-tone-source` inline; a typed `attr()` fallback
|
|
75
75
|
* picks up raw `<a-tag tone="…">` on Chrome 133+/Safari 18.2+.
|
|
76
|
-
* - `
|
|
77
|
-
*
|
|
78
|
-
* stay on.
|
|
79
|
-
*
|
|
76
|
+
* - `allcaps` switches on the uppercase transform and widens tracking to
|
|
77
|
+
* 0.08ch (the default mixed case uses the body-text 0.02ch); tabular
|
|
78
|
+
* figures + `ss05` stay on. Each size steps down 1px under `allcaps`
|
|
79
|
+
* (uppercase reads larger than mixed case at the same px), with height
|
|
80
|
+
* unchanged.
|
|
80
81
|
*
|
|
81
82
|
* @example Basic usage
|
|
82
83
|
* ```tsx
|
|
83
84
|
* <Tag tone="success" label="Running" />
|
|
84
85
|
* <Tag tone="info" icon="hourglass" label="Build" value="2m 14s" />
|
|
85
|
-
* <Tag tone="brand" size="small"
|
|
86
|
+
* <Tag tone="brand" size="small" allcaps label="Status" />
|
|
86
87
|
* ```
|
|
87
88
|
*/
|
|
88
|
-
export declare const Tag: ({ icon, iconTrailing, label, value, tone, priority, size,
|
|
89
|
+
export declare const Tag: ({ icon, iconTrailing, label, value, tone, priority, size, allcaps, className, style, children, ...rest }: TagProps) => any;
|
package/dist/components/Tag.js
CHANGED
|
@@ -9,7 +9,7 @@ const Tag = ({
|
|
|
9
9
|
tone,
|
|
10
10
|
priority,
|
|
11
11
|
size,
|
|
12
|
-
|
|
12
|
+
allcaps,
|
|
13
13
|
className,
|
|
14
14
|
style,
|
|
15
15
|
children,
|
|
@@ -25,7 +25,7 @@ const Tag = ({
|
|
|
25
25
|
"aria-label": isIconOnly ? `${icon} tag` : void 0,
|
|
26
26
|
priority: priority && priority !== "secondary" ? priority : void 0,
|
|
27
27
|
size: size && size !== "medium" ? size : void 0,
|
|
28
|
-
|
|
28
|
+
allcaps: allcaps ? "" : void 0,
|
|
29
29
|
class: className,
|
|
30
30
|
style: computedStyle,
|
|
31
31
|
...rest,
|
|
@@ -2,8 +2,8 @@ import type { BaseProps } from "../general_types";
|
|
|
2
2
|
/** Truncation / expansion axis. `expandable` only takes effect with `truncate`;
|
|
3
3
|
* `collapsible` only with `expandable` — so the type forbids `collapsible`
|
|
4
4
|
* unless `expandable` is set (a dynamic `expandable={cond}` is still allowed). */
|
|
5
|
-
type ExpandMode = {
|
|
6
|
-
expandable?:
|
|
5
|
+
export type ExpandMode = {
|
|
6
|
+
expandable?: never;
|
|
7
7
|
collapsible?: never;
|
|
8
8
|
} | {
|
|
9
9
|
/** Show a fade hint and chevron over the truncated text and let the user
|
|
@@ -23,8 +23,10 @@ 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.
|
|
27
|
-
|
|
26
|
+
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale;
|
|
27
|
+
* the others apply the matching `--text-{N}-{tone}` palette.
|
|
28
|
+
* @defaultValue neutral */
|
|
29
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
|
|
28
30
|
/** Type scale. `small` = 13/16, `medium` = 15/20, `large` = 17/24.
|
|
29
31
|
* @defaultValue medium */
|
|
30
32
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -60,4 +62,3 @@ export type TextProps = BaseProps & {
|
|
|
60
62
|
* ```
|
|
61
63
|
*/
|
|
62
64
|
export declare const Text: ({ priority, tone, size, inline, truncate, expandable, collapsible, className, style, children, ...rest }: TextProps) => any;
|
|
63
|
-
export {};
|
|
@@ -8,8 +8,10 @@ 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.
|
|
12
|
-
|
|
11
|
+
/** Color tint. `neutral` (the default) is the untinted `--text-{N}` scale;
|
|
12
|
+
* the others apply the matching `--text-{N}-{tone}` palette.
|
|
13
|
+
* @defaultValue neutral */
|
|
14
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical';
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Block-level heading with level 1-6, priority, and tone.
|
|
@@ -11,6 +11,9 @@ export interface TooltipProps extends BaseProps {
|
|
|
11
11
|
* side when there isn't room.
|
|
12
12
|
* @defaultValue bottom */
|
|
13
13
|
placement?: 'top' | 'bottom';
|
|
14
|
+
/** Round the bubble to a 20px radius (matching a round menu). Pass a `number`
|
|
15
|
+
* (px) or a CSS length string for a custom radius. */
|
|
16
|
+
round?: boolean | number | string;
|
|
14
17
|
/** Follow the cursor instead of pinning under the anchor. The bubble is
|
|
15
18
|
* pinned (anchored beneath the target) by default; pass `follow` for the
|
|
16
19
|
* cursor-tracking behaviour, which fades by distance as the cursor leaves. */
|
|
@@ -73,4 +76,4 @@ export interface TooltipProps extends BaseProps {
|
|
|
73
76
|
* </button>
|
|
74
77
|
* ```
|
|
75
78
|
*/
|
|
76
|
-
export declare const Tooltip: ({ delay, placement, follow, interactive, truncatedOnly, truncatedSelector, className, children, ...rest }: TooltipProps) => any;
|
|
79
|
+
export declare const Tooltip: ({ delay, placement, round, follow, interactive, truncatedOnly, truncatedSelector, className, style, children, ...rest }: TooltipProps) => any;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { roundStyle } from "../anta_helpers";
|
|
2
3
|
const Tooltip = ({
|
|
3
4
|
delay,
|
|
4
5
|
placement,
|
|
6
|
+
round,
|
|
5
7
|
follow,
|
|
6
8
|
interactive,
|
|
7
9
|
truncatedOnly,
|
|
8
10
|
truncatedSelector,
|
|
9
11
|
className,
|
|
12
|
+
style,
|
|
10
13
|
children,
|
|
11
14
|
...rest
|
|
12
15
|
}) => {
|
|
@@ -15,11 +18,13 @@ const Tooltip = ({
|
|
|
15
18
|
{
|
|
16
19
|
delay: delay != null ? String(delay) : void 0,
|
|
17
20
|
placement: placement === "top" ? "top" : void 0,
|
|
21
|
+
round: round ? "" : void 0,
|
|
18
22
|
follow: follow ? "" : void 0,
|
|
19
23
|
interactive: interactive ? "" : void 0,
|
|
20
24
|
"truncated-only": truncatedOnly ? "" : void 0,
|
|
21
25
|
"truncated-selector": truncatedSelector || void 0,
|
|
22
26
|
class: className,
|
|
27
|
+
style: roundStyle(round, "--tooltip-round", style),
|
|
23
28
|
...rest,
|
|
24
29
|
children
|
|
25
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-button,a[role=button]{--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[tone=brand],a[role=button][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][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][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][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][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]{--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][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][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][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][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][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]{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 70%);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);>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;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;& 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}&: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;min-height:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px;min-height:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px;min-height: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,&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[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,&[selected]{--button-bg: var(--button-bg-primary-active)}}&[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,&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}}&[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 1px 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-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,&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[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,&[selected]{--button-bg: var(--button-bg-primary-active)}}&[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,&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}}&[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 1px 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))}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer anta{.anta-calendar{--calendar-cell-width: 32px;--calendar-cell-height: 28px;display:inline-flex;flex-direction:column;gap:6px}.anta-calendar [data-part=header]{display:flex;align-items:center;gap:0}.anta-calendar [data-part=heading]{flex:1 1 auto;justify-content:center;white-space:nowrap}.anta-calendar .year-dot{flex:none;inline-size:6px;block-size:6px;border-radius:999px;background:currentColor}.anta-calendar[data-size=small]{--calendar-cell-width: 28px;--calendar-cell-height: 24px}.anta-calendar[data-size=large]{--calendar-cell-width: 36px;--calendar-cell-height: 32px}.anta-calendar[data-size=small] [data-part=weekday]{font-size:13px;line-height:16px}.anta-calendar[data-size=large] [data-part=weekday]{font-size:17px;line-height:24px}a-calendar{display:inline-grid;grid-template-columns:repeat(7,var(--calendar-cell-width, 32px));gap:1px;font-family:var(--sans-serif)}a-calendar [data-part=weekday]{display:flex;align-items:center;justify-content:center;height:24px;font-size:15px;line-height:20px;font-weight:400;color:var(--text-4);user-select:none}a-calendar [data-part=weekday][data-weekend]{color:var(--text-5)}a-calendar a-button[data-part=day-cell]{padding-inline:0;min-width:var(--calendar-cell-width, 32px);min-height:var(--calendar-cell-height, 28px);justify-content:center}a-calendar a-button[data-part=day-cell] a-button-label{padding-bottom:0}a-calendar a-button[data-part=day-cell]:focus-visible{outline-offset:0}a-calendar a-button[data-part=day-cell][data-today]:not([selected]){font-weight:600}a-calendar a-button[data-part=day-cell][data-outside]:not([selected]){opacity:.5}}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-calendar.css';
|
|
3
|
+
/**
|
|
4
|
+
* `<a-calendar>` — a **light-DOM, form-associated** month grid, and the
|
|
5
|
+
* **interaction authority** for it. It is the grid itself (`a-calendar.css` gives
|
|
6
|
+
* it a flat 7-column CSS grid), owns the form value, and **dispatches the
|
|
7
|
+
* selection and navigation events** — so it works for a vanilla consumer, not
|
|
8
|
+
* only through the JSX wrapper.
|
|
9
|
+
*
|
|
10
|
+
* It does **not** build or mutate its own contents — that would break the
|
|
11
|
+
* no-UI-thread-DOM-mutation rule (app DOM may render off a worker). Whoever
|
|
12
|
+
* renders into it (the `Calendar` JSX wrapper, or a vanilla consumer using the
|
|
13
|
+
* exported `buildMonth` engine) fills it with `<a-button>` day cells + weekday
|
|
14
|
+
* headers and *re-renders* on the element's events. The element confines itself
|
|
15
|
+
* to off-DOM work (form value, `ElementInternals` state), event dispatch, and
|
|
16
|
+
* imperative focus of cells that already exist — the `<a-radio-group>` model.
|
|
17
|
+
*
|
|
18
|
+
* ## Events (all bubble; lowercase so React + Preact bind them)
|
|
19
|
+
*
|
|
20
|
+
* - `statechange` — cancelable, fired BEFORE a pick applies. `detail` is
|
|
21
|
+
* `{ next, prev, reason }`: ISO-string dates (or `null`), `reason` ∈
|
|
22
|
+
* `'user' | 'reset' | 'restore'`. `preventDefault()` vetoes a `'user'` pick in
|
|
23
|
+
* uncontrolled mode.
|
|
24
|
+
* - `change` — fired AFTER a selection applies (uncontrolled), and on
|
|
25
|
+
* reset/restore.
|
|
26
|
+
* - `navigate` — `detail: { date }` (ISO). Fired on keyboard navigation (and
|
|
27
|
+
* when the target month isn't rendered) so the renderer can move the roving tab
|
|
28
|
+
* stop and flip the displayed month.
|
|
29
|
+
*
|
|
30
|
+
* ## Controlled vs uncontrolled (like `<a-radio-group>`)
|
|
31
|
+
*
|
|
32
|
+
* Presence of the **`value`** attribute = controlled: a pick only *requests* a
|
|
33
|
+
* change (fires `statechange`); the consumer answers by updating `value`. With
|
|
34
|
+
* **`defaultvalue`** instead, the element owns selection — a pick self-applies
|
|
35
|
+
* (form value + `change`) unless vetoed.
|
|
36
|
+
*
|
|
37
|
+
* ## Selection & keyboard
|
|
38
|
+
*
|
|
39
|
+
* Day cells are `<a-button>`s, so a click (and Enter/Space, which `<a-button>`
|
|
40
|
+
* turns into a click) bubbles here; the element delegates off `data-part="day-cell"`.
|
|
41
|
+
* Arrow / Home / End / PageUp / PageDown move focus among rendered cells directly,
|
|
42
|
+
* and emit `navigate` for month changes. `data-focus` (`"<iso>#<nonce>"`, set by
|
|
43
|
+
* the renderer) focuses a cell after a re-render lands a new month.
|
|
44
|
+
*/
|
|
45
|
+
export declare class ACalendarElement extends HTMLElementBase {
|
|
46
|
+
#private;
|
|
47
|
+
static formAssociated: boolean;
|
|
48
|
+
static observedAttributes: string[];
|
|
49
|
+
private internals?;
|
|
50
|
+
/** Selection in uncontrolled mode (controlled reads the `value` attribute). */
|
|
51
|
+
private selectedIso;
|
|
52
|
+
constructor();
|
|
53
|
+
connectedCallback(): void;
|
|
54
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
55
|
+
private currentIso;
|
|
56
|
+
private applyFormValue;
|
|
57
|
+
private onClick;
|
|
58
|
+
/** Request selecting `iso`: fire cancelable `statechange`; in uncontrolled mode,
|
|
59
|
+
* if not vetoed, apply the form value and fire `change`. The renderer mirrors
|
|
60
|
+
* the new selection visually off `statechange`. */
|
|
61
|
+
private requestSelect;
|
|
62
|
+
private onKeydown;
|
|
63
|
+
/** Focus the day cell whose `data-date` matches the signal's ISO. Deferred to a
|
|
64
|
+
* microtask so a just-rendered new month has committed. Signal: `"<iso>#<nonce>"`. */
|
|
65
|
+
private focusCell;
|
|
66
|
+
private emitState;
|
|
67
|
+
/** The selected date as an ISO string (`''` when empty). */
|
|
68
|
+
get value(): string;
|
|
69
|
+
set value(v: string);
|
|
70
|
+
/** Form field name — mirrors the `name` attribute, like native `<input>.name`. */
|
|
71
|
+
get name(): string;
|
|
72
|
+
set name(v: string);
|
|
73
|
+
formResetCallback(): void;
|
|
74
|
+
formStateRestoreCallback(state: string): void;
|
|
75
|
+
}
|
|
76
|
+
export declare function register_a_calendar(): void;
|