@antadesign/anta 0.3.27 → 0.3.28
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 +4 -0
- package/dist/anta_helpers.js +4 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +36 -42
- package/dist/components/Banner.js +2 -2
- package/dist/components/Button.js +2 -2
- package/dist/components/Card.js +2 -2
- package/dist/components/Checkbox.d.ts +10 -11
- package/dist/components/Checkbox.js +5 -13
- package/dist/components/Expander.js +2 -2
- package/dist/components/Input.js +2 -2
- package/dist/components/InputTime.js +2 -2
- package/dist/components/Loader.js +2 -1
- package/dist/components/MenuItem.d.ts +7 -8
- package/dist/components/MenuItem.js +4 -4
- package/dist/components/Progress.js +2 -2
- package/dist/components/RadioGroup.d.ts +12 -13
- package/dist/components/RadioGroup.js +7 -23
- package/dist/components/Select.d.ts +12 -7
- package/dist/components/Select.js +4 -3
- package/dist/components/SelectFaceted.d.ts +7 -5
- package/dist/components/SelectFaceted.js +4 -3
- package/dist/components/Slider.js +3 -3
- package/dist/components/Steps.css +1 -1
- package/dist/components/Switch.d.ts +7 -8
- package/dist/components/Switch.js +3 -11
- package/dist/components/Tabs.js +2 -2
- package/dist/components/Tag.d.ts +7 -9
- package/dist/components/Tag.js +2 -2
- package/dist/components/Text.js +2 -2
- package/dist/components/Title.js +2 -2
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-button.d.ts +7 -9
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.js +1 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +5 -7
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +4 -6
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.css +1 -1
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-slider.css +1 -1
- package/dist/elements/a-slider.js +0 -3
- package/dist/elements/a-switch.css +1 -1
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-text.css +1 -1
- package/dist/elements/a-text.js +1 -0
- package/dist/elements/a-title.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +3 -4
- package/dist/elements/a-tooltip.js +0 -1
- package/dist/general_types.d.ts +22 -23
- package/dist/index.d.ts +1 -1
- package/dist/reset.css +1 -1
- package/dist/theme-antithesis.css +1 -0
- package/dist/theme-antune.css +1 -0
- package/dist/tokens.css +1 -1
- package/docs/changelog.md +57 -0
- package/docs/colors.md +1 -1
- package/docs/comparison.md +2 -2
- package/docs/components/breadcrumbs.md +42 -6
- package/docs/components/checkbox.md +13 -13
- package/docs/components/menu.md +4 -5
- package/docs/components/radio.md +13 -12
- package/docs/components/select-faceted.md +2 -1
- package/docs/components/select.md +10 -9
- package/docs/components/switch.md +7 -7
- package/docs/components/tag.md +5 -3
- package/docs/install-config.md +18 -8
- package/docs/normalization.md +3 -3
- package/docs/theming.md +94 -16
- package/package.json +5 -4
- package/dist/components/InputDate.module.css +0 -1
- package/dist/components/Select.module.css +0 -1
- package/dist/components/SelectFaceted.module.css +0 -1
- package/dist/search-index.json +0 -0
- package/dist/theme-anta.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { nativeStateChange, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
4
|
const Banner = ({
|
|
5
5
|
message,
|
|
@@ -29,7 +29,7 @@ const Banner = ({
|
|
|
29
29
|
{
|
|
30
30
|
state: controlled ? dismissed ? "closed" : "open" : void 0,
|
|
31
31
|
"default-state": !controlled ? defaultDismissed ? "closed" : "open" : void 0,
|
|
32
|
-
tone: tone
|
|
32
|
+
tone: neutralToneAttr(tone),
|
|
33
33
|
align: align === "center" ? "center" : void 0,
|
|
34
34
|
round: roundAttr(round),
|
|
35
35
|
role,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
2
|
+
import { neutralToneAttr, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
3
3
|
const Button = ({
|
|
4
4
|
priority,
|
|
5
5
|
tone,
|
|
@@ -27,7 +27,7 @@ const Button = ({
|
|
|
27
27
|
children,
|
|
28
28
|
...rest
|
|
29
29
|
}) => {
|
|
30
|
-
const toneAttr = tone
|
|
30
|
+
const toneAttr = neutralToneAttr(tone);
|
|
31
31
|
const unavailable = disabled || loading;
|
|
32
32
|
const computedStyle = roundStyle(round, "--button-round", toneStyle(toneAttr, "--button-tone-source", style));
|
|
33
33
|
const isIconOnly = icon != null && label == null && children == null && iconTrailing == null;
|
package/dist/components/Card.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
import { Title } from "./Title";
|
|
4
4
|
import { Text } from "./Text";
|
|
5
5
|
import { Icon } from "./Icon";
|
|
@@ -25,7 +25,7 @@ const Card = ({
|
|
|
25
25
|
children,
|
|
26
26
|
...rest
|
|
27
27
|
}) => {
|
|
28
|
-
const toneAttr = tone
|
|
28
|
+
const toneAttr = neutralToneAttr(tone);
|
|
29
29
|
const computedStyle = roundStyle(
|
|
30
30
|
round,
|
|
31
31
|
"--card-round",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from "../general_types";
|
|
1
|
+
import type { BaseProps, ToneScope } from "../general_types";
|
|
2
2
|
/** The wrapper-level checked value: a boolean for the binary axis, the string
|
|
3
3
|
* `'indeterminate'` for the third state. Mirrors Radix's `Checkbox.Root`. */
|
|
4
4
|
export type CheckboxValue = boolean | 'indeterminate';
|
|
@@ -51,21 +51,20 @@ export interface CheckboxProps extends BaseProps {
|
|
|
51
51
|
/** Value submitted with the form when checked — like a native checkbox.
|
|
52
52
|
* @defaultValue "on" */
|
|
53
53
|
value?: string;
|
|
54
|
-
/** Color of the **mark
|
|
55
|
-
* unselected box border. A named tone or any literal CSS color (`'#ff1493'`,
|
|
54
|
+
/** Color of the **mark**. In the default `all` scope this colors the checked-box
|
|
55
|
+
* fill and unselected box border. A named tone or any literal CSS color (`'#ff1493'`,
|
|
56
56
|
* `'rebeccapurple'`) for a one-off custom tone. Named tones track light/dark mode
|
|
57
57
|
* automatically; a custom color keeps its hue + chroma and pins lightness to the
|
|
58
|
-
* fill curve.
|
|
58
|
+
* fill curve. Set `toneScope="selected"` to tone only the checked mark and leave
|
|
59
59
|
* the empty box neutral. The label + hint stay neutral — recolor them in plain
|
|
60
60
|
* CSS via the theme-aware `--text-N-{tone}` tokens.
|
|
61
61
|
* @defaultValue 'neutral' */
|
|
62
62
|
tone?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
63
|
-
/**
|
|
64
|
-
* neutral
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
toneSelected?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
63
|
+
/** Apply `tone` to every state, or only while checked so the empty box stays
|
|
64
|
+
* neutral. `selected` is useful when a tinted resting border would read as a
|
|
65
|
+
* validation state.
|
|
66
|
+
* @defaultValue 'all' */
|
|
67
|
+
toneScope?: ToneScope;
|
|
69
68
|
/** Size variant. small=14px, medium=16px, large=18px box.
|
|
70
69
|
* @defaultValue 'medium' */
|
|
71
70
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -98,5 +97,5 @@ export interface CheckboxProps extends BaseProps {
|
|
|
98
97
|
* <Checkbox defaultChecked label="Remember me" hint="On this device" />
|
|
99
98
|
* ```
|
|
100
99
|
*/
|
|
101
|
-
export declare const Checkbox: ({ checked, defaultChecked, disabled, tone,
|
|
100
|
+
export declare const Checkbox: ({ checked, defaultChecked, disabled, tone, toneScope, size, round, onStateChange, onChange, onValueChange, label, hint, className, style, children, tabIndex, ...rest }: CheckboxProps) => any;
|
|
102
101
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { nativeStateChange, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
const valueToState = (v) => v === "indeterminate" ? "indeterminate" : v ? "checked" : "unchecked";
|
|
4
4
|
const stateToValue = (s) => s === "indeterminate" ? "indeterminate" : s === "checked";
|
|
5
5
|
const checkboxAttrsOf = (el) => ({
|
|
@@ -13,7 +13,7 @@ const Checkbox = ({
|
|
|
13
13
|
defaultChecked,
|
|
14
14
|
disabled,
|
|
15
15
|
tone,
|
|
16
|
-
|
|
16
|
+
toneScope,
|
|
17
17
|
size,
|
|
18
18
|
round,
|
|
19
19
|
onStateChange,
|
|
@@ -30,15 +30,7 @@ const Checkbox = ({
|
|
|
30
30
|
const computedStyle = roundStyle(
|
|
31
31
|
round,
|
|
32
32
|
"--checkbox-round",
|
|
33
|
-
toneStyle(
|
|
34
|
-
toneSelected,
|
|
35
|
-
"--checkbox-tone-source",
|
|
36
|
-
toneStyle(
|
|
37
|
-
tone,
|
|
38
|
-
"--checkbox-off-tone-source",
|
|
39
|
-
toneSelected == null ? toneStyle(tone, "--checkbox-tone-source", style) : style
|
|
40
|
-
)
|
|
41
|
-
)
|
|
33
|
+
toneStyle(tone, "--checkbox-tone-source", toneStyle(tone, "--checkbox-off-tone-source", style))
|
|
42
34
|
);
|
|
43
35
|
const explicitAriaLabel = rest["aria-label"];
|
|
44
36
|
const ariaLabel = (typeof explicitAriaLabel === "string" ? explicitAriaLabel : void 0) ?? label ?? (typeof children === "string" ? children : void 0);
|
|
@@ -67,8 +59,8 @@ const Checkbox = ({
|
|
|
67
59
|
state: stateAttr,
|
|
68
60
|
"default-state": defaultStateAttr,
|
|
69
61
|
disabled: disabled ? "" : void 0,
|
|
70
|
-
tone: tone
|
|
71
|
-
"tone-
|
|
62
|
+
tone: neutralToneAttr(tone),
|
|
63
|
+
"tone-scope": toneScope && toneScope !== "all" ? toneScope : void 0,
|
|
72
64
|
size: size && size !== "medium" ? size : void 0,
|
|
73
65
|
round: roundAttr(round),
|
|
74
66
|
tabIndex: disabled ? -1 : tabIndex ?? 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { nativeStateChange, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
const Expander = ({
|
|
4
4
|
title,
|
|
5
5
|
level,
|
|
@@ -26,7 +26,7 @@ const Expander = ({
|
|
|
26
26
|
state: controlled ? open ? "open" : "closed" : void 0,
|
|
27
27
|
"default-state": !controlled && defaultOpen ? "open" : void 0,
|
|
28
28
|
level: level != null ? String(level) : void 0,
|
|
29
|
-
tone: tone
|
|
29
|
+
tone: neutralToneAttr(tone),
|
|
30
30
|
priority: priority && priority !== "secondary" ? priority : void 0,
|
|
31
31
|
outdent: outdent ? "" : void 0,
|
|
32
32
|
round: roundAttr(round),
|
package/dist/components/Input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { nativeStateChange, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
const presence = (on) => on ? "" : void 0;
|
|
@@ -91,7 +91,7 @@ const Input = ({
|
|
|
91
91
|
rows: rows != null ? String(rows) : void 0,
|
|
92
92
|
maxrows: maxRows != null ? String(maxRows) : void 0,
|
|
93
93
|
status: statusTone,
|
|
94
|
-
tone: tone
|
|
94
|
+
tone: neutralToneAttr(tone),
|
|
95
95
|
type: !multiline && rows == null ? nativeType : void 0,
|
|
96
96
|
name,
|
|
97
97
|
placeholder,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { nativeStateChange, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
import { Button } from "./Button";
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
const presence = (on) => on ? "" : void 0;
|
|
@@ -65,7 +65,7 @@ const InputTime = ({
|
|
|
65
65
|
min,
|
|
66
66
|
max,
|
|
67
67
|
status: statusTone,
|
|
68
|
-
tone: tone
|
|
68
|
+
tone: neutralToneAttr(tone),
|
|
69
69
|
name,
|
|
70
70
|
disabled: presence(disabled),
|
|
71
71
|
required: presence(required),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { neutralToneAttr } from "../anta_helpers";
|
|
2
3
|
const Loader = ({ tone, value, max = 100, size, speed, label, className, style, ...rest }) => {
|
|
3
4
|
const determinate = typeof value === "number" && Number.isFinite(value);
|
|
4
5
|
const safeMax = Number.isFinite(max) && max > 0 ? max : 100;
|
|
@@ -20,7 +21,7 @@ const Loader = ({ tone, value, max = 100, size, speed, label, className, style,
|
|
|
20
21
|
return /* @__PURE__ */ jsx(
|
|
21
22
|
"a-loader",
|
|
22
23
|
{
|
|
23
|
-
tone,
|
|
24
|
+
tone: neutralToneAttr(tone),
|
|
24
25
|
...determinate ? { value: clampedValue } : {},
|
|
25
26
|
class: className,
|
|
26
27
|
style: computedStyle,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from '../general_types';
|
|
1
|
+
import type { BaseProps, ToneScope } from '../general_types';
|
|
2
2
|
import type { IconShape } from '../elements/a-icon.shapes';
|
|
3
3
|
/** Props shared by every menu item, link or not. */
|
|
4
4
|
export interface MenuItemCommonProps extends BaseProps {
|
|
@@ -39,12 +39,11 @@ export interface MenuItemCommonProps extends BaseProps {
|
|
|
39
39
|
* gray.
|
|
40
40
|
* @defaultValue neutral */
|
|
41
41
|
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
toneSelected?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
42
|
+
/** Apply `tone` to every row state, or only while the row is selected. In
|
|
43
|
+
* `selected` scope, an unselected row and its checkbox/radio indicator stay
|
|
44
|
+
* neutral.
|
|
45
|
+
* @defaultValue 'all' */
|
|
46
|
+
toneScope?: ToneScope;
|
|
48
47
|
/** An opaque value identifying this item, handed back in `onSelect`'s detail
|
|
49
48
|
* so a shared handler can tell which row was chosen without a per-item
|
|
50
49
|
* closure. */
|
|
@@ -139,4 +138,4 @@ export type MenuItemProps = MenuItemCommonProps & (MenuItemLinkMode | MenuItemAc
|
|
|
139
138
|
* </MenuItem>
|
|
140
139
|
* ```
|
|
141
140
|
*/
|
|
142
|
-
export declare const MenuItem: ({ icon, label, hint, kbd, iconTrailing, disabled, selected, selectionIndicator, indeterminate, indicator, tone,
|
|
141
|
+
export declare const MenuItem: ({ icon, label, hint, kbd, iconTrailing, disabled, selected, selectionIndicator, indeterminate, indicator, tone, toneScope, submenu, value, onSelect, href, target, rel, download, ping, role: roleOverride, className, style, children, ...rest }: MenuItemProps) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { toneStyle } from "../anta_helpers";
|
|
2
|
+
import { neutralToneAttr, toneStyle } from "../anta_helpers";
|
|
3
3
|
const SHORTCUT_KEYS = {
|
|
4
4
|
"\u2318": "Meta",
|
|
5
5
|
cmd: "Meta",
|
|
@@ -77,7 +77,7 @@ const MenuItem = ({
|
|
|
77
77
|
indeterminate,
|
|
78
78
|
indicator,
|
|
79
79
|
tone,
|
|
80
|
-
|
|
80
|
+
toneScope,
|
|
81
81
|
submenu,
|
|
82
82
|
value,
|
|
83
83
|
onSelect,
|
|
@@ -97,8 +97,8 @@ const MenuItem = ({
|
|
|
97
97
|
const role = selectionIndicator === "checkbox" ? "menuitemcheckbox" : selectionIndicator === "radio" || selectionIndicator === "check" ? "menuitemradio" : "menuitem";
|
|
98
98
|
const ariaChecked = !checkable ? void 0 : selectionIndicator === "checkbox" && indeterminate ? "mixed" : selected ? "true" : "false";
|
|
99
99
|
const keepTint = selected && (selectionIndicator === void 0 || selectionIndicator === "check");
|
|
100
|
-
const effectiveTone = selected &&
|
|
101
|
-
const toneAttr = effectiveTone
|
|
100
|
+
const effectiveTone = toneScope === "selected" && !selected ? void 0 : tone;
|
|
101
|
+
const toneAttr = neutralToneAttr(effectiveTone);
|
|
102
102
|
const declaredShortcuts = rest["aria-keyshortcuts"];
|
|
103
103
|
const keyShortcuts = kbd ? shortcutLabel(kbd) : void 0;
|
|
104
104
|
const kbdNode = kbd ? /* @__PURE__ */ jsx("kbd", { "aria-hidden": declaredShortcuts ?? keyShortcuts ? "true" : void 0, children: kbd }) : null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { hasChildren, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
2
|
+
import { hasChildren, neutralToneAttr, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
3
|
const Progress = ({ value, max = 100, tone, size, round, label, hint, className, style, children, ...rest }) => {
|
|
4
4
|
const indeterminate = value == null || value === false;
|
|
5
5
|
const numericValue = typeof value === "number" ? value : 0;
|
|
@@ -11,7 +11,7 @@ const Progress = ({ value, max = 100, tone, size, round, label, hint, className,
|
|
|
11
11
|
{
|
|
12
12
|
value: indeterminate ? false : numericValue,
|
|
13
13
|
max,
|
|
14
|
-
tone: tone
|
|
14
|
+
tone: neutralToneAttr(tone),
|
|
15
15
|
size: size && size !== "medium" ? size : void 0,
|
|
16
16
|
round: roundAttr(round),
|
|
17
17
|
role: "progressbar",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps, OptionPresentationProps } from "../general_types";
|
|
1
|
+
import type { BaseProps, OptionPresentationProps, ToneScope } from "../general_types";
|
|
2
2
|
/** The element's `statechange` payload. `next`/`prev` are values (`null` = nothing
|
|
3
3
|
* selected); `reason` distinguishes a user pick from a form reset / bfcache restore. */
|
|
4
4
|
type StateReason = "user" | "reset" | "restore";
|
|
@@ -27,8 +27,8 @@ export interface RadioOption extends OptionPresentationProps {
|
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
/** Override this one option's mark tone (defaults to the group's `tone`). */
|
|
29
29
|
tone?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
|
|
30
|
-
/** Override this
|
|
31
|
-
|
|
30
|
+
/** Override this option's tone scope. The group scope is inherited when omitted. */
|
|
31
|
+
toneScope?: ToneScope;
|
|
32
32
|
/** Override this one option's size (defaults to the group's `size`). */
|
|
33
33
|
size?: "small" | "medium" | "large";
|
|
34
34
|
}
|
|
@@ -78,18 +78,17 @@ export interface RadioGroupProps extends Omit<BaseProps, "children" | "onChange"
|
|
|
78
78
|
* @defaultValue 'neutral' */
|
|
79
79
|
status?: "neutral" | "brand" | "info" | "success" | "warning" | "critical";
|
|
80
80
|
/** Mark tone applied to every option (an option's own `tone` wins), or any literal
|
|
81
|
-
* CSS color for a one-off custom tone.
|
|
82
|
-
* the unselected ring border. Named tones track
|
|
83
|
-
*
|
|
81
|
+
* CSS color for a one-off custom tone. In the default `all` scope it colors the
|
|
82
|
+
* selected-ring fill + dot and the unselected ring border. Named tones track
|
|
83
|
+
* light/dark mode. Set `toneScope="selected"` to tone only the selected option
|
|
84
|
+
* and leave the rest neutral. The option
|
|
84
85
|
* text stays neutral — recolor it in plain CSS via the `--text-N-{tone}` tokens.
|
|
85
86
|
* @defaultValue 'neutral' */
|
|
86
87
|
tone?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
* @defaultValue 'neutral' */
|
|
92
|
-
toneSelected?: "brand" | "neutral" | "info" | "success" | "warning" | "critical" | (string & {});
|
|
88
|
+
/** Apply `tone` to every state, or only to the selected option so unselected
|
|
89
|
+
* rings stay neutral. An option's own `toneScope` wins.
|
|
90
|
+
* @defaultValue 'all' */
|
|
91
|
+
toneScope?: ToneScope;
|
|
93
92
|
/** Size applied to every option (an option's own `size` wins).
|
|
94
93
|
* @defaultValue 'medium' */
|
|
95
94
|
size?: "small" | "medium" | "large";
|
|
@@ -116,5 +115,5 @@ export interface RadioGroupProps extends Omit<BaseProps, "children" | "onChange"
|
|
|
116
115
|
*
|
|
117
116
|
* Requires `@antadesign/anta/elements` (client-side only).
|
|
118
117
|
*/
|
|
119
|
-
export declare const RadioGroup: ({ options, value, defaultValue, onStateChange, onChange, onValueChange, onFocus, onBlur, name, label, hint, status, tone,
|
|
118
|
+
export declare const RadioGroup: ({ options, value, defaultValue, onStateChange, onChange, onValueChange, onFocus, onBlur, name, label, hint, status, tone, toneScope, size, disabled, orientation, className, style, ...rest }: RadioGroupProps) => any;
|
|
120
119
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useId, useState } from "../jsx-runtime";
|
|
3
|
-
import { nativeStateChange, optionPresentationAttrs, toneStyle } from "../anta_helpers";
|
|
3
|
+
import { nativeStateChange, neutralToneAttr, optionPresentationAttrs, toneStyle } from "../anta_helpers";
|
|
4
4
|
const radioAttrsOf = (el) => ({
|
|
5
5
|
value: el?.value ?? null,
|
|
6
6
|
name: el?.getAttribute?.("name") ?? void 0
|
|
@@ -19,7 +19,7 @@ const RadioGroup = ({
|
|
|
19
19
|
hint,
|
|
20
20
|
status,
|
|
21
21
|
tone,
|
|
22
|
-
|
|
22
|
+
toneScope,
|
|
23
23
|
size,
|
|
24
24
|
disabled,
|
|
25
25
|
orientation,
|
|
@@ -63,8 +63,8 @@ const RadioGroup = ({
|
|
|
63
63
|
"default-state": !controlled ? defaultValue : void 0,
|
|
64
64
|
name,
|
|
65
65
|
status: status && status !== "neutral" ? status : void 0,
|
|
66
|
-
tone: tone
|
|
67
|
-
"tone-
|
|
66
|
+
tone: neutralToneAttr(tone),
|
|
67
|
+
"tone-scope": toneScope && toneScope !== "all" ? toneScope : void 0,
|
|
68
68
|
size: size && size !== "medium" ? size : void 0,
|
|
69
69
|
disabled: disabled ? "" : void 0,
|
|
70
70
|
orientation: orientation && orientation !== "vertical" ? orientation : void 0,
|
|
@@ -73,15 +73,7 @@ const RadioGroup = ({
|
|
|
73
73
|
onfocusin: onFocus,
|
|
74
74
|
onfocusout: onBlur,
|
|
75
75
|
class: className,
|
|
76
|
-
style: toneStyle(
|
|
77
|
-
toneSelected,
|
|
78
|
-
"--radio-tone-source",
|
|
79
|
-
toneStyle(
|
|
80
|
-
tone,
|
|
81
|
-
"--radio-off-tone-source",
|
|
82
|
-
toneSelected == null ? toneStyle(tone, "--radio-tone-source", style) : style
|
|
83
|
-
)
|
|
84
|
-
),
|
|
76
|
+
style: toneStyle(tone, "--radio-tone-source", toneStyle(tone, "--radio-off-tone-source", style)),
|
|
85
77
|
children: [
|
|
86
78
|
label && /* @__PURE__ */ jsx("a-radio-group-label", { id: labelId, children: label }),
|
|
87
79
|
hint && /* @__PURE__ */ jsx("a-radio-group-hint", { id: hintId, children: hint }),
|
|
@@ -97,19 +89,11 @@ const RadioGroup = ({
|
|
|
97
89
|
"aria-disabled": optDisabled ? "true" : void 0,
|
|
98
90
|
tabIndex: o.value === tabStopValue ? 0 : -1,
|
|
99
91
|
tone: o.tone || void 0,
|
|
100
|
-
"tone-
|
|
92
|
+
"tone-scope": o.toneScope ?? (o.tone ? toneScope : void 0),
|
|
101
93
|
size: o.size && o.size !== "medium" ? o.size : void 0,
|
|
102
94
|
disabled: o.disabled ? "" : void 0,
|
|
103
95
|
class: optionClassName,
|
|
104
|
-
style: toneStyle(
|
|
105
|
-
o.toneSelected,
|
|
106
|
-
"--radio-tone-source",
|
|
107
|
-
toneStyle(
|
|
108
|
-
o.tone,
|
|
109
|
-
"--radio-off-tone-source",
|
|
110
|
-
o.toneSelected == null ? toneStyle(o.tone, "--radio-tone-source", optionStyle) : optionStyle
|
|
111
|
-
)
|
|
112
|
-
),
|
|
96
|
+
style: toneStyle(o.tone, "--radio-tone-source", toneStyle(o.tone, "--radio-off-tone-source", optionStyle)),
|
|
113
97
|
children: [
|
|
114
98
|
/* @__PURE__ */ jsx("a-radio-label", { children: o.label }),
|
|
115
99
|
o.hint != null && /* @__PURE__ */ jsx("a-radio-hint", { children: o.hint })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps, OptionPresentationProps } from '../general_types';
|
|
1
|
+
import type { BaseProps, OptionPresentationProps, ToneScope } from '../general_types';
|
|
2
2
|
import type { IconShape } from '../elements/a-icon.shapes';
|
|
3
3
|
import { type MenuProps } from './Menu';
|
|
4
4
|
import './select-parts.css';
|
|
@@ -30,6 +30,9 @@ export interface SelectOption<V extends OptionValue = string> extends OptionPres
|
|
|
30
30
|
/** Tone for this option's row (label, icon, hint, selected tint, and the
|
|
31
31
|
* checkbox/radio indicator). A named tone or a custom CSS color. */
|
|
32
32
|
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
33
|
+
/** Override where this option applies its tone. The Select scope is inherited
|
|
34
|
+
* when omitted. */
|
|
35
|
+
toneScope?: ToneScope;
|
|
33
36
|
/** Tooltip for this option's row — a string or any node. In a `multiple`
|
|
34
37
|
* select with `selectAll`, a row with no `tooltip` falls back to a default
|
|
35
38
|
* hint for the Alt/Option-click "select only this" accelerator; set `tooltip`
|
|
@@ -185,12 +188,14 @@ export interface SelectCommonProps<V extends OptionValue = string> extends Omit<
|
|
|
185
188
|
round?: boolean | number | string;
|
|
186
189
|
/** Disable the whole select. */
|
|
187
190
|
disabled?: boolean;
|
|
188
|
-
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
/** Default option-row tone. An option's own `tone` wins. A named tone or a
|
|
192
|
+
* custom CSS color. Most visible with tint-based marks (`indicator` `'none'` /
|
|
193
|
+
* `'check'`); with `'radio'` / `'checkbox'` it also tones the indicator. */
|
|
194
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
195
|
+
/** Apply the default row tone in every state, or only to selected rows. An
|
|
196
|
+
* option's own `toneScope` wins.
|
|
197
|
+
* @defaultValue 'all' */
|
|
198
|
+
toneScope?: ToneScope;
|
|
194
199
|
/** Add a search field at the top of the menu that filters the options as you
|
|
195
200
|
* type. `true` uses the built-in matcher — a case-insensitive substring of the
|
|
196
201
|
* option's **value / label / hint**. Pass a **function** `(option, query) =>
|
|
@@ -54,7 +54,8 @@ const Select = (props) => {
|
|
|
54
54
|
statusIcon,
|
|
55
55
|
round,
|
|
56
56
|
disabled,
|
|
57
|
-
|
|
57
|
+
tone,
|
|
58
|
+
toneScope,
|
|
58
59
|
filter,
|
|
59
60
|
selectAll = true,
|
|
60
61
|
selectAllLabel = "Select all",
|
|
@@ -183,8 +184,8 @@ const Select = (props) => {
|
|
|
183
184
|
label: custom ? void 0 : highlight(o.label ?? String(o.value), queryRe),
|
|
184
185
|
hint: custom ? void 0 : o.hint ? highlight(o.hint, queryRe) : o.hint,
|
|
185
186
|
icon: custom ? void 0 : o.icon,
|
|
186
|
-
tone: o.tone,
|
|
187
|
-
|
|
187
|
+
tone: o.tone ?? tone,
|
|
188
|
+
toneScope: o.toneScope ?? toneScope,
|
|
188
189
|
selected: isSelected(o.value),
|
|
189
190
|
disabled: disabled2 || void 0,
|
|
190
191
|
"data-menu-open": multiple ? "" : void 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from '../general_types';
|
|
1
|
+
import type { BaseProps, ToneScope } from '../general_types';
|
|
2
2
|
import type { IconShape } from '../elements/a-icon.shapes';
|
|
3
3
|
import type { OptionValue, SelectItem, SelectOption } from './Select';
|
|
4
4
|
import { type MenuProps } from './Menu';
|
|
@@ -142,10 +142,12 @@ export interface SelectFacetedProps extends Omit<BaseProps, 'children'> {
|
|
|
142
142
|
priority?: 'primary' | 'secondary';
|
|
143
143
|
/** Disable the whole control. */
|
|
144
144
|
disabled?: boolean;
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
/** Default option-row tone in facet flyouts. An option's own `tone` wins. */
|
|
146
|
+
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
147
|
+
/** Apply the default row tone in every state, or only to selected rows. An
|
|
148
|
+
* option's own `toneScope` wins.
|
|
149
|
+
* @defaultValue 'all' */
|
|
150
|
+
toneScope?: ToneScope;
|
|
149
151
|
/** Adds a search field at the top of the root menu. It searches the options of
|
|
150
152
|
* every `single` and `multiple` facet in one list. For example, "alice" can
|
|
151
153
|
* appear under application-defined Assignee and Owner facets. `text` and
|
|
@@ -37,7 +37,8 @@ const SelectFaceted = (props) => {
|
|
|
37
37
|
size,
|
|
38
38
|
priority = "secondary",
|
|
39
39
|
disabled,
|
|
40
|
-
|
|
40
|
+
tone,
|
|
41
|
+
toneScope,
|
|
41
42
|
searchable,
|
|
42
43
|
searchPlaceholder = "Filter\u2026",
|
|
43
44
|
clearable = true,
|
|
@@ -124,8 +125,8 @@ const SelectFaceted = (props) => {
|
|
|
124
125
|
icon: opt.icon,
|
|
125
126
|
label: opt.label ?? String(opt.value),
|
|
126
127
|
hint: opt.hint,
|
|
127
|
-
tone: opt.tone,
|
|
128
|
-
|
|
128
|
+
tone: opt.tone ?? tone,
|
|
129
|
+
toneScope: opt.toneScope ?? toneScope,
|
|
129
130
|
disabled: opt.disabled,
|
|
130
131
|
className: optionClassName,
|
|
131
132
|
style: optionStyle,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { toneStyle, roundStyle, roundAttr, lengthStyle, cssLength } from "../anta_helpers";
|
|
2
|
+
import { neutralToneAttr, toneStyle, roundStyle, roundAttr, lengthStyle, cssLength } from "../anta_helpers";
|
|
3
3
|
const number = (value, fallback) => Number.isFinite(value) ? value : fallback;
|
|
4
4
|
const isStringish = (node) => typeof node === "string" || typeof node === "number";
|
|
5
5
|
const bounds = (min, max) => {
|
|
@@ -99,8 +99,8 @@ const Slider = ({
|
|
|
99
99
|
step,
|
|
100
100
|
name,
|
|
101
101
|
disabled: disabled ? "" : void 0,
|
|
102
|
-
tone: tone
|
|
103
|
-
"thumb-tone": thumbTone
|
|
102
|
+
tone: neutralToneAttr(tone),
|
|
103
|
+
"thumb-tone": neutralToneAttr(thumbTone),
|
|
104
104
|
size: size && size !== "medium" ? size : void 0,
|
|
105
105
|
"track-size": trackSizeValue,
|
|
106
106
|
"thumb-size": thumbSizeValue,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{a-steps{--steps-marker-size: 28px;--steps-icon-size: 16px;--steps-marker-border-width: 1.5px;--steps-marker-rest-border: var(--border-4);--steps-item-gap: 6px;--steps-gap: 4px;--steps-connector-color: var(--border-3);--steps-connector-width: 1px;--steps-complete-connector-color: var(--border-2);--steps-tab-padding-x: 9px;--steps-tab-padding-block: 0px;--steps-hint-leading: 16px;display:flex;flex-direction:column;width:100%;min-width:0}a-steps:has(>a-tabs[size=small]){--steps-marker-size: 24px;--steps-icon-size: 14px;--steps-tab-padding-x: 7px;--steps-hint-leading: 14px}a-steps:has(>a-tabs[size=large]){--steps-marker-size: 32px;--steps-icon-size: 18px;--steps-tab-padding-x: 13px;--steps-hint-leading: 20px}a-tabs[data-steps]{--steps-marker-active-border: var(--border-1);--steps-primary-marker-lightness: .5;--steps-primary-marker-chroma: .02;--steps-primary-marker-fg: #ffffff;--tabs-gap: 0px;align-items:center;width:fit-content;align-self:flex-start;overflow-x:auto;scrollbar-width:thin}a-tabs[data-steps][fill]{width:100%;align-self:stretch;justify-content:space-between}a-tabs[data-steps]>a-tab[tone=brand]{--steps-marker-active-border: var(--border-1-brand)}a-tabs[data-steps]>a-tab[tone=info]{--steps-marker-active-border: var(--border-1-info)}a-tabs[data-steps]>a-tab[tone=success]{--steps-marker-active-border: var(--border-1-success)}a-tabs[data-steps]>a-tab[tone=warning]{--steps-marker-active-border: var(--border-1-warning)}a-tabs[data-steps]>a-tab[tone=critical]{--steps-marker-active-border: var(--border-1-critical)}a-tabs[data-steps]>a-tab[tone=neutral]{--steps-marker-active-border: var(--border-1)}a-tabs[data-steps]>a-tab[tone]:not([tone=""],[tone=neutral]){--steps-primary-marker-chroma: .17}.dark a-tabs[data-steps]{--steps-primary-marker-lightness: .4;--steps-primary-marker-chroma: .015}.dark a-tabs[data-steps]>a-tab[tone]:not([tone=""],[tone=neutral]){--steps-primary-marker-chroma: .16}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]){--steps-marker-border-width: 2px;--steps-marker-rest-border: var(--border-3);--steps-connector-color: var(--border-3);--steps-connector-width: 2px}a-tabs[data-steps][priority=tertiary]{--steps-marker-size: calc(var(--steps-icon-size) + 4px);--steps-marker-border-width: 0px}a-steps>a-tabs[data-steps]{background:transparent;border-radius:0;box-shadow:none}a-tabs[data-steps]>a-tab{--steps-complete-connector-color: var(--tab-selected-border);--steps-primary-marker-bg: oklch( from var(--tabs-tone-source) var(--steps-primary-marker-lightness) var(--steps-primary-marker-chroma) h );--steps-primary-completed-marker-bg: color-mix( in oklch, var(--steps-primary-marker-bg) 80%, transparent );position:relative;flex:1 1 0;min-width:0;max-width:max-content;padding-block:0;justify-content:flex-start;gap:var(--steps-item-gap);transition:color var(--tab-timing),background-color var(--tab-timing),box-shadow var(--tab-timing)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=brand]){--steps-complete-connector-color: var(--border-2-brand)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=info]){--steps-complete-connector-color: var(--border-2-info)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=success]){--steps-complete-connector-color: var(--border-2-success)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=warning]){--steps-complete-connector-color: var(--border-2-warning)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=critical]){--steps-complete-connector-color: var(--border-2-critical)}a-tabs[data-steps]:not([orientation=vertical])>a-tab:first-child{padding-inline-start:0}a-steps>a-tabs[data-steps][fill]>a-tab:not(:last-child){flex:1 1 0;max-width:none}a-steps>a-tabs[data-steps][fill]>a-tab:last-child{flex:0 1 auto;max-width:max-content}a-steps>a-tabs[data-steps]>a-tab:state(selected){--tab-bg: transparent;box-shadow:none}a-steps>a-tabs[data-steps][priority=tertiary]>a-tab:after{border:0}a-step-desc{display:inline-flex;flex:0 1 auto;flex-direction:column;min-width:0;max-width:100%}a-step-desc>a-tab-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}a-step-hint{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--tab-rest-tone, var(--text-3));font-size:calc(1em - 2px);font-weight:400;line-height:var(--steps-hint-leading)}a-step-marker{display:inline-flex;flex:none;align-items:center;justify-content:center;width:var(--steps-marker-size);height:var(--steps-marker-size);box-sizing:border-box;color:var(--text-4);border:var(--steps-marker-border-width) solid var(--steps-marker-rest-border);border-radius:999px;transition:color var(--tab-timing),background-color var(--tab-timing),border-color var(--tab-timing)}a-tabs[data-steps] a-step-marker :is(a-icon,a-loader){--icon-size: var(--steps-icon-size)}a-tabs[data-steps]>a-tab[tone]{--tab-secondary-bg: oklch( from var(--tabs-tone-source) var(--_track-l) var(--_track-c) h / var(--_sec-a) )}a-tabs[data-steps]>a-tab[tone] a-step-marker{color:var(--tab-selected-text)}a-tabs[data-steps]>a-tab:is(:state(selected),[data-step-state=completed]) a-step-marker{border-color:var(--steps-marker-active-border)}a-tabs[data-steps]>a-tab[data-step-state=error]:not(:state(selected)):not([disabled]) a-step-marker{border-color:var(--border-2-critical)}a-tabs[data-steps]:is([priority=secondary],[priority=tertiary])>a-tab[tone]:not([tone=""],[tone=neutral]) a-step-marker{color:var(--tab-fg)}a-tabs[data-steps][priority=secondary] a-tab:state(selected):not([disabled]) a-step-marker{color:var(--tab-selected-text);background-color:var(--tab-secondary-bg);border-color:var(--steps-marker-active-border)}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]) a-tab:state(selected):not([disabled]) a-step-marker{color:var(--steps-primary-marker-fg);background-color:var(--steps-primary-marker-bg);border-color:var(--steps-primary-marker-bg)}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]) a-tab[data-step-state=completed]:not(:state(selected)):not([disabled]) a-step-marker{color:var(--steps-primary-marker-fg);background-color:var(--steps-primary-completed-marker-bg);border-color:transparent}a-tabs[data-steps][priority=tertiary] a-tab:state(selected):not([disabled]) a-step-marker{color:var(--tab-selected-text);background-color:transparent;border-color:transparent}a-tabs[data-steps] a-step-marker>a-loader{transition:color var(--tab-timing)}a-tabs[data-steps]:is([priority=secondary],[priority=tertiary]) a-step-marker>a-loader:not([tone=neutral]){color:inherit}a-tabs[data-steps] a-tab:state(selected):not([disabled]) a-step-marker>a-loader{color:inherit}a-tabs[data-steps]:not([orientation=vertical])>a-tab:not(:last-child):before{content:"";order:3;flex:1 1 auto;align-self:center;min-width:calc(var(--steps-marker-size) / 2);height:var(--steps-connector-width);margin-inline-start:calc(1ch - var(--steps-item-gap));margin-inline-end:calc(1ch - 2 * var(--steps-tab-padding-x));background:var(--steps-connector-color);pointer-events:none}a-tabs[data-steps]:not([orientation=vertical])>a-tab[data-step-state=completed]:not(:last-child):before{background:var(--steps-complete-connector-color)}a-tabs[data-steps] a-tab[disabled]{--tab-fg: var(--text-5);opacity:1}a-tabs[data-steps] a-tab[disabled] a-step-marker,a-tabs[data-steps] a-tab[disabled] a-step-marker>a-loader{color:var(--text-5)}a-tabs[data-steps] a-tab[disabled] a-step-hint{color:var(--text-5)}a-steps[data-orientation=vertical]{--steps-content-indent: calc( var(--steps-marker-size) + var(--steps-item-gap) );--steps-vertical-gap: calc(var(--steps-gap) + 4px);display:grid;grid-template-columns:minmax(0,1fr);row-gap:var(--steps-vertical-gap)}a-steps[data-orientation=vertical]>a-tabs[orientation=vertical]{display:contents}a-steps[data-orientation=vertical]>a-tabs[orientation=vertical]>a-tab{flex:none;min-width:0;grid-column:1;width:max-content;max-width:100%;padding-inline-start:0}a-steps[data-orientation=vertical] a-tab:not(:last-child):before{content:"";position:absolute;inset-block-start:calc(var(--steps-tab-padding-block) + var(--steps-marker-size));inset-inline-start:calc(var(--steps-marker-size) / 2 - var(--steps-connector-width) / 2);inset-inline-end:auto;width:var(--steps-connector-width);height:calc(100% - var(--steps-marker-size) + var(--steps-vertical-gap));background:var(--steps-connector-color);transform:none;pointer-events:none}a-steps[data-orientation=vertical]>a-tabpanel{grid-column:1;grid-row:var(--steps-panel-row);width:calc(100% - var(--steps-content-indent));margin-inline-start:var(--steps-content-indent)}a-steps[data-orientation=vertical]:has(>a-tabpanel):has(>a-tabs[orientation=vertical]>a-tab:state(selected):not(:last-child)):after{content:"";grid-column:1;grid-row:var(--steps-panel-row);align-self:stretch;justify-self:start;width:var(--steps-connector-width);min-height:var(--steps-marker-size);margin-inline-start:calc(var(--steps-marker-size) / 2 - var(--steps-connector-width) / 2);margin-block-end:calc(-1 * var(--steps-vertical-gap));background:var(--steps-connector-color);pointer-events:none;z-index:1}a-steps[data-orientation=vertical]>a-tabs[data-steps]>a-tab[data-step-state=completed]:not(:last-child):before{background:var(--steps-complete-connector-color)}a-steps[data-orientation=vertical]:has(>a-tabpanel):has(>a-tabs[data-steps][orientation=vertical]>a-tab[data-step-state=completed]:state(selected):not(:last-child)):after{background:var(--steps-complete-connector-color)}@media(forced-colors:active){a-tabs[data-steps][priority=secondary] a-tab:state(selected){background-color:transparent;border:0;box-shadow:none}a-step-marker{color:CanvasText;background-color:Canvas;border-color:CanvasText}a-tabs[data-steps] a-tab:state(selected):not([disabled]) a-step-marker{border-color:Highlight}}}
|
|
1
|
+
@layer anta.components{a-steps{--steps-marker-size: 28px;--steps-icon-size: 16px;--steps-marker-border-width: 1.5px;--steps-marker-rest-border: var(--border-4);--steps-item-gap: 6px;--steps-gap: 4px;--steps-connector-color: var(--border-3);--steps-connector-width: 1px;--steps-complete-connector-color: var(--border-2);--steps-tab-padding-x: 9px;--steps-tab-padding-block: 0px;--steps-hint-leading: 16px;display:flex;flex-direction:column;width:100%;min-width:0}a-steps:has(>a-tabs[size=small]){--steps-marker-size: 24px;--steps-icon-size: 14px;--steps-tab-padding-x: 7px;--steps-hint-leading: 14px}a-steps:has(>a-tabs[size=large]){--steps-marker-size: 32px;--steps-icon-size: 18px;--steps-tab-padding-x: 13px;--steps-hint-leading: 20px}a-tabs[data-steps]{--steps-marker-active-border: var(--border-1);--steps-primary-marker-fg: #ffffff;--tabs-gap: 0px;align-items:center;width:fit-content;align-self:flex-start;overflow-x:auto;scrollbar-width:thin}a-tabs[data-steps][fill]{width:100%;align-self:stretch;justify-content:space-between}a-tabs[data-steps]>a-tab[tone=brand]{--steps-marker-active-border: var(--border-1-brand)}a-tabs[data-steps]>a-tab[tone=info]{--steps-marker-active-border: var(--border-1-info)}a-tabs[data-steps]>a-tab[tone=success]{--steps-marker-active-border: var(--border-1-success)}a-tabs[data-steps]>a-tab[tone=warning]{--steps-marker-active-border: var(--border-1-warning)}a-tabs[data-steps]>a-tab[tone=critical]{--steps-marker-active-border: var(--border-1-critical)}a-tabs[data-steps]>a-tab[tone=neutral]{--steps-marker-active-border: var(--border-1)}a-tabs[data-steps]>a-tab[tone]:not([tone=""],[tone=neutral]){--steps-primary-marker-bg: light-dark( oklch(from var(--tabs-tone-source) .5 .17 h), oklch(from var(--tabs-tone-source) .4 .16 h) )}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]){--steps-marker-border-width: 2px;--steps-marker-rest-border: var(--border-3);--steps-connector-color: var(--border-3);--steps-connector-width: 2px}a-tabs[data-steps][priority=tertiary]{--steps-marker-size: calc(var(--steps-icon-size) + 4px);--steps-marker-border-width: 0px}a-steps>a-tabs[data-steps]{background:transparent;border-radius:0;box-shadow:none}a-tabs[data-steps]>a-tab{--steps-complete-connector-color: var(--tab-selected-border);--steps-primary-marker-bg: light-dark( oklch(from var(--tabs-tone-source) .5 .02 h), oklch(from var(--tabs-tone-source) .4 .015 h) );--steps-primary-completed-marker-bg: color-mix( in oklch, var(--steps-primary-marker-bg) 80%, transparent );position:relative;flex:1 1 0;min-width:0;max-width:max-content;padding-block:0;justify-content:flex-start;gap:var(--steps-item-gap);transition:color var(--tab-timing),background-color var(--tab-timing),box-shadow var(--tab-timing)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=brand]){--steps-complete-connector-color: var(--border-2-brand)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=info]){--steps-complete-connector-color: var(--border-2-info)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=success]){--steps-complete-connector-color: var(--border-2-success)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=warning]){--steps-complete-connector-color: var(--border-2-warning)}a-steps[data-orientation=vertical]:has(>a-tabs[data-steps]>a-tab:state(selected)[tone=critical]){--steps-complete-connector-color: var(--border-2-critical)}a-tabs[data-steps]:not([orientation=vertical])>a-tab:first-child{padding-inline-start:0}a-steps>a-tabs[data-steps][fill]>a-tab:not(:last-child){flex:1 1 0;max-width:none}a-steps>a-tabs[data-steps][fill]>a-tab:last-child{flex:0 1 auto;max-width:max-content}a-steps>a-tabs[data-steps]>a-tab:state(selected){--tab-bg: transparent;box-shadow:none}a-steps>a-tabs[data-steps][priority=tertiary]>a-tab:after{border:0}a-step-desc{display:inline-flex;flex:0 1 auto;flex-direction:column;min-width:0;max-width:100%}a-step-desc>a-tab-label{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}a-step-hint{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--tab-rest-tone, var(--text-3));font-size:calc(1em - 2px);font-weight:400;line-height:var(--steps-hint-leading)}a-step-marker{display:inline-flex;flex:none;align-items:center;justify-content:center;width:var(--steps-marker-size);height:var(--steps-marker-size);box-sizing:border-box;color:var(--text-4);border:var(--steps-marker-border-width) solid var(--steps-marker-rest-border);border-radius:999px;transition:color var(--tab-timing),background-color var(--tab-timing),border-color var(--tab-timing)}a-tabs[data-steps] a-step-marker :is(a-icon,a-loader){--icon-size: var(--steps-icon-size)}a-tabs[data-steps]>a-tab[tone]{--tab-secondary-bg: light-dark( oklch(from var(--tabs-tone-source) .55 .008 h / .03), oklch(from var(--tabs-tone-source) .8 .008 h / .08) )}a-tabs[data-steps]>a-tab[tone]:not([tone=""],[tone=neutral]){--tab-secondary-bg: light-dark( oklch(from var(--tabs-tone-source) .55 .14 h / .03), oklch(from var(--tabs-tone-source) .8 .12 h / .08) )}a-tabs[data-steps]>a-tab[tone] a-step-marker{color:var(--tab-selected-text)}a-tabs[data-steps]>a-tab:is(:state(selected),[data-step-state=completed]) a-step-marker{border-color:var(--steps-marker-active-border)}a-tabs[data-steps]>a-tab[data-step-state=error]:not(:state(selected)):not([disabled]) a-step-marker{border-color:var(--border-2-critical)}a-tabs[data-steps]:is([priority=secondary],[priority=tertiary])>a-tab[tone]:not([tone=""],[tone=neutral]) a-step-marker{color:var(--tab-fg)}a-tabs[data-steps][priority=secondary] a-tab:state(selected):not([disabled]) a-step-marker{color:var(--tab-selected-text);background-color:var(--tab-secondary-bg);border-color:var(--steps-marker-active-border)}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]) a-tab:state(selected):not([disabled]) a-step-marker{color:var(--steps-primary-marker-fg);background-color:var(--steps-primary-marker-bg);border-color:var(--steps-primary-marker-bg)}a-tabs[data-steps]:not([priority=secondary],[priority=tertiary]) a-tab[data-step-state=completed]:not(:state(selected)):not([disabled]) a-step-marker{color:var(--steps-primary-marker-fg);background-color:var(--steps-primary-completed-marker-bg);border-color:transparent}a-tabs[data-steps][priority=tertiary] a-tab:state(selected):not([disabled]) a-step-marker{color:var(--tab-selected-text);background-color:transparent;border-color:transparent}a-tabs[data-steps] a-step-marker>a-loader{transition:color var(--tab-timing)}a-tabs[data-steps]:is([priority=secondary],[priority=tertiary]) a-step-marker>a-loader:not([tone=neutral]){color:inherit}a-tabs[data-steps] a-tab:state(selected):not([disabled]) a-step-marker>a-loader{color:inherit}a-tabs[data-steps]:not([orientation=vertical])>a-tab:not(:last-child):before{content:"";order:3;flex:1 1 auto;align-self:center;min-width:calc(var(--steps-marker-size) / 2);height:var(--steps-connector-width);margin-inline-start:calc(1ch - var(--steps-item-gap));margin-inline-end:calc(1ch - 2 * var(--steps-tab-padding-x));background:var(--steps-connector-color);pointer-events:none}a-tabs[data-steps]:not([orientation=vertical])>a-tab[data-step-state=completed]:not(:last-child):before{background:var(--steps-complete-connector-color)}a-tabs[data-steps] a-tab[disabled]{--tab-fg: var(--text-5);opacity:1}a-tabs[data-steps] a-tab[disabled] a-step-marker,a-tabs[data-steps] a-tab[disabled] a-step-marker>a-loader{color:var(--text-5)}a-tabs[data-steps] a-tab[disabled] a-step-hint{color:var(--text-5)}a-steps[data-orientation=vertical]{--steps-content-indent: calc( var(--steps-marker-size) + var(--steps-item-gap) );--steps-vertical-gap: calc(var(--steps-gap) + 4px);display:grid;grid-template-columns:minmax(0,1fr);row-gap:var(--steps-vertical-gap)}a-steps[data-orientation=vertical]>a-tabs[orientation=vertical]{display:contents}a-steps[data-orientation=vertical]>a-tabs[orientation=vertical]>a-tab{flex:none;min-width:0;grid-column:1;width:max-content;max-width:100%;padding-inline-start:0}a-steps[data-orientation=vertical] a-tab:not(:last-child):before{content:"";position:absolute;inset-block-start:calc(var(--steps-tab-padding-block) + var(--steps-marker-size));inset-inline-start:calc(var(--steps-marker-size) / 2 - var(--steps-connector-width) / 2);inset-inline-end:auto;width:var(--steps-connector-width);height:calc(100% - var(--steps-marker-size) + var(--steps-vertical-gap));background:var(--steps-connector-color);transform:none;pointer-events:none}a-steps[data-orientation=vertical]>a-tabpanel{grid-column:1;grid-row:var(--steps-panel-row);width:calc(100% - var(--steps-content-indent));margin-inline-start:var(--steps-content-indent)}a-steps[data-orientation=vertical]:has(>a-tabpanel):has(>a-tabs[orientation=vertical]>a-tab:state(selected):not(:last-child)):after{content:"";grid-column:1;grid-row:var(--steps-panel-row);align-self:stretch;justify-self:start;width:var(--steps-connector-width);min-height:var(--steps-marker-size);margin-inline-start:calc(var(--steps-marker-size) / 2 - var(--steps-connector-width) / 2);margin-block-end:calc(-1 * var(--steps-vertical-gap));background:var(--steps-connector-color);pointer-events:none;z-index:1}a-steps[data-orientation=vertical]>a-tabs[data-steps]>a-tab[data-step-state=completed]:not(:last-child):before{background:var(--steps-complete-connector-color)}a-steps[data-orientation=vertical]:has(>a-tabpanel):has(>a-tabs[data-steps][orientation=vertical]>a-tab[data-step-state=completed]:state(selected):not(:last-child)):after{background:var(--steps-complete-connector-color)}@media(forced-colors:active){a-tabs[data-steps][priority=secondary] a-tab:state(selected){background-color:transparent;border:0;box-shadow:none}a-step-marker{color:CanvasText;background-color:Canvas;border-color:CanvasText}a-tabs[data-steps] a-tab:state(selected):not([disabled]) a-step-marker{border-color:Highlight}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from "../general_types";
|
|
1
|
+
import type { BaseProps, ToneScope } from "../general_types";
|
|
2
2
|
type SwitchState = 'checked' | 'unchecked';
|
|
3
3
|
type StateDetail = {
|
|
4
4
|
next: SwitchState;
|
|
@@ -33,14 +33,13 @@ export interface SwitchProps extends BaseProps {
|
|
|
33
33
|
* @defaultValue "on" */
|
|
34
34
|
value?: string;
|
|
35
35
|
/** Color of the track and thumb. A tinted tone also colors the unchecked
|
|
36
|
-
* track border and thumb; use `
|
|
36
|
+
* track border and thumb; use `toneScope="selected"` to color only the checked track.
|
|
37
37
|
* @defaultValue 'brand' */
|
|
38
38
|
tone?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
toneSelected?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
39
|
+
/** Apply `tone` to every state, or only while checked so the unchecked track
|
|
40
|
+
* and thumb stay neutral.
|
|
41
|
+
* @defaultValue 'all' */
|
|
42
|
+
toneScope?: ToneScope;
|
|
44
43
|
/** Size variant. small=26×16px, medium=30×18px, large=34×20px.
|
|
45
44
|
* @defaultValue 'medium' */
|
|
46
45
|
size?: 'small' | 'medium' | 'large';
|
|
@@ -64,5 +63,5 @@ export interface SwitchProps extends BaseProps {
|
|
|
64
63
|
* form-associated and can be controlled with `checked` or left uncontrolled with
|
|
65
64
|
* `defaultChecked`. Requires `@antadesign/anta/elements` on the client.
|
|
66
65
|
*/
|
|
67
|
-
export declare const Switch: ({ checked, defaultChecked, disabled, tone,
|
|
66
|
+
export declare const Switch: ({ checked, defaultChecked, disabled, tone, toneScope, size, round, labelPosition, onStateChange, onChange, onValueChange, label, hint, className, style, children, tabIndex, ...rest }: SwitchProps) => any;
|
|
68
67
|
export {};
|