@antadesign/anta 0.3.26 → 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/README.md +26 -28
- package/dist/anta_helpers.d.ts +8 -0
- package/dist/anta_helpers.js +18 -0
- package/dist/box-types.d.ts +1 -1
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +36 -42
- package/dist/capture-types.d.ts +156 -0
- package/dist/components/Banner.js +2 -2
- package/dist/components/Box.d.ts +15 -0
- package/dist/components/Box.js +3 -11
- package/dist/components/Button.js +2 -2
- package/dist/components/Capture.d.ts +39 -0
- package/dist/components/Capture.js +36 -0
- 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/components/capture-props.d.ts +30 -0
- package/dist/components/capture-props.js +44 -0
- package/dist/elements/a-avatar.css +1 -1
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-box.d.ts +1 -1
- package/dist/elements/a-box.js +11 -3
- 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-capture.css +1 -0
- package/dist/elements/a-capture.d.ts +10 -0
- package/dist/elements/a-capture.js +24 -0
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-checkbox.js +4 -4
- 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 +6 -9
- 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/elements/capture-input.d.ts +5 -0
- package/dist/elements/capture-input.js +609 -0
- package/dist/elements/index.d.ts +1 -0
- package/dist/elements/index.js +3 -0
- package/dist/general_types.d.ts +56 -23
- package/dist/index.d.ts +4 -1
- package/dist/index.js +2 -0
- package/dist/jsx-runtime.d.ts +2 -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/accessibility.md +24 -0
- package/docs/changelog.md +79 -0
- package/docs/colors.md +141 -0
- package/docs/comparison.md +463 -28
- package/docs/components/avatar.md +13 -17
- package/docs/components/banner.md +13 -27
- package/docs/components/box.md +226 -154
- package/docs/components/breadcrumbs.md +49 -12
- package/docs/components/button.md +48 -37
- package/docs/components/capture.md +345 -0
- package/docs/components/card.md +17 -38
- package/docs/components/checkbox.md +27 -50
- package/docs/components/dialog.md +14 -36
- package/docs/components/expander.md +15 -40
- package/docs/components/icon.md +111 -9
- package/docs/components/input-autocomplete.md +9 -11
- package/docs/components/input-date.md +33 -23
- package/docs/components/input-time.md +15 -23
- package/docs/components/input.md +27 -76
- package/docs/components/loader.md +7 -5
- package/docs/components/menu.md +75 -80
- package/docs/components/progress.md +10 -14
- package/docs/components/radio.md +28 -46
- package/docs/components/select-faceted.md +8 -25
- package/docs/components/select.md +33 -105
- package/docs/components/slider.md +16 -21
- package/docs/components/steps.md +38 -8
- package/docs/components/switch.md +16 -19
- package/docs/components/tabs.md +52 -40
- package/docs/components/tag.md +15 -24
- package/docs/components/text.md +10 -23
- package/docs/components/title.md +7 -8
- package/docs/components/toaster.md +6 -3
- package/docs/components/tooltip.md +13 -23
- package/docs/index.md +3 -1
- package/docs/install-config.md +42 -8
- package/docs/normalization.md +48 -3
- package/docs/packages/stickers.md +56 -0
- package/docs/theming.md +362 -14
- package/package.json +7 -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/theme-anta.css +0 -1
- /package/dist/{search-index.json → capture-types.js} +0 -0
|
@@ -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 {};
|
|
@@ -10,7 +10,7 @@ const Switch = ({
|
|
|
10
10
|
defaultChecked,
|
|
11
11
|
disabled,
|
|
12
12
|
tone,
|
|
13
|
-
|
|
13
|
+
toneScope,
|
|
14
14
|
size,
|
|
15
15
|
round,
|
|
16
16
|
labelPosition,
|
|
@@ -28,15 +28,7 @@ const Switch = ({
|
|
|
28
28
|
const computedStyle = roundStyle(
|
|
29
29
|
round,
|
|
30
30
|
"--switch-round",
|
|
31
|
-
toneStyle(
|
|
32
|
-
toneSelected,
|
|
33
|
-
"--switch-tone-source",
|
|
34
|
-
toneStyle(
|
|
35
|
-
tone,
|
|
36
|
-
"--switch-off-tone-source",
|
|
37
|
-
toneSelected == null ? toneStyle(tone, "--switch-tone-source", style) : style
|
|
38
|
-
)
|
|
39
|
-
)
|
|
31
|
+
toneStyle(tone, "--switch-tone-source", toneStyle(tone, "--switch-off-tone-source", style))
|
|
40
32
|
);
|
|
41
33
|
const explicitAriaLabel = rest["aria-label"];
|
|
42
34
|
const ariaLabel = (typeof explicitAriaLabel === "string" ? explicitAriaLabel : void 0) ?? label ?? (typeof children === "string" ? children : void 0);
|
|
@@ -66,7 +58,7 @@ const Switch = ({
|
|
|
66
58
|
"default-state": defaultStateAttr,
|
|
67
59
|
disabled: disabled ? "" : void 0,
|
|
68
60
|
tone,
|
|
69
|
-
"tone-
|
|
61
|
+
"tone-scope": toneScope && toneScope !== "all" ? toneScope : void 0,
|
|
70
62
|
size: size && size !== "medium" ? size : void 0,
|
|
71
63
|
round: roundAttr(round),
|
|
72
64
|
"label-position": labelPosition && labelPosition !== "end" ? labelPosition : void 0,
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState } from "../jsx-runtime";
|
|
3
|
-
import { nativeStateChange, optionPresentationAttrs, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
3
|
+
import { nativeStateChange, neutralToneAttr, optionPresentationAttrs, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
4
4
|
import { Tooltip } from "./Tooltip";
|
|
5
5
|
const Tabs = ({
|
|
6
6
|
children,
|
|
@@ -59,7 +59,7 @@ const Tabs = ({
|
|
|
59
59
|
state: controlled ? value : void 0,
|
|
60
60
|
"default-state": !controlled ? defaultValue : void 0,
|
|
61
61
|
priority: priority && priority !== "primary" ? priority : void 0,
|
|
62
|
-
tone: tone
|
|
62
|
+
tone: neutralToneAttr(tone),
|
|
63
63
|
size: size && size !== "medium" ? size : void 0,
|
|
64
64
|
orientation: vertical ? "vertical" : void 0,
|
|
65
65
|
fill: fill ? "" : void 0,
|
package/dist/components/Tag.d.ts
CHANGED
|
@@ -28,8 +28,7 @@ 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 all-caps instead of the default normal (mixed) case
|
|
32
|
-
* (uppercase tracks wider than the default body-text letter-spacing). */
|
|
31
|
+
/** Render in all-caps instead of the default normal (mixed) case. */
|
|
33
32
|
allcaps?: boolean;
|
|
34
33
|
/** Leading icon shape. Sits flush before the label, scaled to the pill. */
|
|
35
34
|
icon?: IconShape;
|
|
@@ -59,8 +58,8 @@ export interface TagProps extends BaseProps {
|
|
|
59
58
|
* at 20px), so text is never clipped and the padding tokens can be
|
|
60
59
|
* retuned freely. An edge icon trims ~2px off its side's padding
|
|
61
60
|
* (optical), and icons scale to `--tag-icon-size`.
|
|
62
|
-
* - Color comes from the theme-aware semantic tokens
|
|
63
|
-
*
|
|
61
|
+
* - Color comes from the theme-aware semantic tokens and `light-dark()`; the
|
|
62
|
+
* hairline border and the segment divider both
|
|
64
63
|
* derive from `--tag-text`, so every tone gets a matching edge. A lone
|
|
65
64
|
* `label` is dropped into `<a-tag-value>` by this wrapper so it keeps the
|
|
66
65
|
* default weight; `<a-tag-label>` only renders as the bold key before a
|
|
@@ -69,13 +68,12 @@ export interface TagProps extends BaseProps {
|
|
|
69
68
|
* elements) get a hairline left border per segment after the first; the
|
|
70
69
|
* flex `gap` sits left of the border and `padding-left` balances it.
|
|
71
70
|
* - Custom tones (any non-named `tone`) keep the source hue with
|
|
72
|
-
* lightness/chroma pinned via oklch relative color
|
|
73
|
-
*
|
|
71
|
+
* lightness/chroma pinned via oklch relative color. `light-dark()` selects
|
|
72
|
+
* the matching ramp from the nearest inherited color scheme. The
|
|
74
73
|
* wrapper writes `--tag-tone-source` inline; a typed `attr()` fallback
|
|
75
74
|
* picks up raw `<a-tag tone="…">` on Chrome 133+/Safari 18.2+.
|
|
76
|
-
* - `allcaps` switches on the uppercase transform
|
|
77
|
-
*
|
|
78
|
-
* figures + `ss05` stay on. Each size steps down 1px under `allcaps`
|
|
75
|
+
* - `allcaps` switches on the uppercase transform; tabular figures stay on.
|
|
76
|
+
* Each size steps down 1px under `allcaps`
|
|
79
77
|
* (uppercase reads larger than mixed case at the same px), with height
|
|
80
78
|
* unchanged.
|
|
81
79
|
*
|
package/dist/components/Tag.js
CHANGED
|
@@ -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
|
import { Icon } from "./Icon";
|
|
4
4
|
const Tag = ({
|
|
5
5
|
icon,
|
|
@@ -15,7 +15,7 @@ const Tag = ({
|
|
|
15
15
|
children,
|
|
16
16
|
...rest
|
|
17
17
|
}) => {
|
|
18
|
-
const toneAttr = tone
|
|
18
|
+
const toneAttr = neutralToneAttr(tone);
|
|
19
19
|
const computedStyle = toneStyle(toneAttr, "--tag-tone-source", style);
|
|
20
20
|
const hasValue = value != null;
|
|
21
21
|
const isIconOnly = icon != null && label == null && value == null && children == null && iconTrailing == null;
|
package/dist/components/Text.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
|
import { Tooltip } from "./Tooltip";
|
|
4
4
|
const Text = ({ priority, tone, size, inline, truncate, expandable, collapsible, className, style, children, ...rest }) => {
|
|
5
5
|
const n = typeof truncate === "number" ? truncate : truncate ? 1 : null;
|
|
6
6
|
const lineCount = n != null && n >= 1 ? n : null;
|
|
7
|
-
const toneAttr = tone
|
|
7
|
+
const toneAttr = neutralToneAttr(tone);
|
|
8
8
|
const computedStyle = toneStyle(
|
|
9
9
|
toneAttr,
|
|
10
10
|
"--text-tone-source",
|
package/dist/components/Title.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
-
import { toneStyle } from "../anta_helpers";
|
|
2
|
+
import { neutralToneAttr, toneStyle } from "../anta_helpers";
|
|
3
3
|
const Title = ({ level = 2, priority, tone, className, style, children, ...rest }) => {
|
|
4
|
-
const toneAttr = tone
|
|
4
|
+
const toneAttr = neutralToneAttr(tone);
|
|
5
5
|
return /* @__PURE__ */ jsx(
|
|
6
6
|
"a-title",
|
|
7
7
|
{
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CaptureInputDirections, CapturePan, CapturePointerCapture, CaptureWheelSettle } from '../capture-types';
|
|
2
|
+
/** The empty string enables every direction; `none` keeps an explicit empty set. */
|
|
3
|
+
export declare function directionAttribute(value: CaptureInputDirections | undefined): string | undefined;
|
|
4
|
+
export declare function wheelSettleAttributes(value: CaptureWheelSettle | undefined): {
|
|
5
|
+
'wheel-delay': number | undefined;
|
|
6
|
+
'wheel-tolerance': number | undefined;
|
|
7
|
+
'wheel-reset-on-move': "" | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
export declare function pointerCaptureAttributes(value: boolean | CapturePointerCapture | undefined): {
|
|
10
|
+
'pointer-capture': string;
|
|
11
|
+
'pointer-buttons'?: undefined;
|
|
12
|
+
'pointer-threshold'?: undefined;
|
|
13
|
+
'pointer-modifier'?: undefined;
|
|
14
|
+
'pointer-include-interactive'?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
'pointer-capture': string;
|
|
17
|
+
'pointer-buttons': string | undefined;
|
|
18
|
+
'pointer-threshold': number | undefined;
|
|
19
|
+
'pointer-modifier': import("@antadesign/anta").CaptureInputModifier | undefined;
|
|
20
|
+
'pointer-include-interactive': "" | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
export declare function panAttributes(value: boolean | CapturePan | undefined): {
|
|
23
|
+
pan: "both" | "x" | "y";
|
|
24
|
+
'pan-pointer-types': string | undefined;
|
|
25
|
+
'pan-threshold': number | undefined;
|
|
26
|
+
'pan-directions': string | undefined;
|
|
27
|
+
'pan-inertia': "" | undefined;
|
|
28
|
+
'pan-time-constant': number | undefined;
|
|
29
|
+
'pan-min-velocity': number | undefined;
|
|
30
|
+
} | undefined;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function directionAttribute(value) {
|
|
2
|
+
if (value === void 0 || value === false) return void 0;
|
|
3
|
+
if (value === true) return "";
|
|
4
|
+
return ["up", "down", "left", "right"].filter((direction) => value[direction]).join(" ") || "none";
|
|
5
|
+
}
|
|
6
|
+
function wheelSettleAttributes(value) {
|
|
7
|
+
if (!value) return void 0;
|
|
8
|
+
return {
|
|
9
|
+
"wheel-delay": value.delay,
|
|
10
|
+
"wheel-tolerance": value.tolerance,
|
|
11
|
+
"wheel-reset-on-move": value.resetOnMove ? "" : void 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function pointerCaptureAttributes(value) {
|
|
15
|
+
if (!value) return void 0;
|
|
16
|
+
if (value === true) return { "pointer-capture": "" };
|
|
17
|
+
return {
|
|
18
|
+
"pointer-capture": value.pointerTypes?.join(" ") || (value.pointerTypes ? "none" : ""),
|
|
19
|
+
"pointer-buttons": value.buttons?.join(" ") || (value.buttons ? "none" : void 0),
|
|
20
|
+
"pointer-threshold": value.threshold,
|
|
21
|
+
"pointer-modifier": value.modifier,
|
|
22
|
+
"pointer-include-interactive": value.includeInteractive ? "" : void 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function panAttributes(value) {
|
|
26
|
+
if (!value) return void 0;
|
|
27
|
+
const options = value === true ? {} : value;
|
|
28
|
+
const inertia = typeof options.inertia === "object" ? options.inertia : void 0;
|
|
29
|
+
return {
|
|
30
|
+
pan: options.axis ?? "both",
|
|
31
|
+
"pan-pointer-types": options.pointerTypes?.join(" ") || (options.pointerTypes ? "none" : void 0),
|
|
32
|
+
"pan-threshold": options.threshold,
|
|
33
|
+
"pan-directions": options.directions === false ? "none" : directionAttribute(options.directions),
|
|
34
|
+
"pan-inertia": options.inertia ? "" : void 0,
|
|
35
|
+
"pan-time-constant": inertia?.timeConstant,
|
|
36
|
+
"pan-min-velocity": inertia?.minVelocity
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
directionAttribute,
|
|
41
|
+
panAttributes,
|
|
42
|
+
pointerCaptureAttributes,
|
|
43
|
+
wheelSettleAttributes
|
|
44
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{a-avatar{--avatar-size: 44px;--avatar-radius: 22%;--avatar-placeholder-bg: var(--bg-3);--avatar-badge-ratio: .24;--avatar-badge-size: calc(var(--avatar-size) * var(--avatar-badge-ratio));--avatar-badge-inset: 0px;--avatar-badge-gap: 2px;--avatar-badge-mask: none;--avatar-badge-tone-source: var(--anta-seed-neutral);--avatar-badge-chroma: .17;--avatar-badge-color: oklch(from var(--avatar-badge-tone-source) .62 var(--avatar-badge-chroma) h);display:inline-block;inline-size:var(--avatar-size);block-size:var(--avatar-size);vertical-align:middle}a-avatar[round]{--avatar-radius: var(--avatar-round, 50%);--avatar-badge-inset: calc(var(--avatar-size) * .03);@supports (border-radius: attr(probe type(<length>),1px)){--avatar-round: attr(round type(<length>))}}a-avatar[size=small]{--avatar-size: 32px;--avatar-badge-gap: 1.5px}a-avatar[size=large]{--avatar-size: 64px;--avatar-badge-gap: 2.5px}a-avatar[badge]:not([badge=""],[badge=none]){--avatar-badge-mask: radial-gradient( circle calc(var(--avatar-badge-size) / 2 + var(--avatar-badge-gap)) at calc(100% - var(--avatar-badge-inset) - var(--avatar-badge-size) / 2) calc(100% - var(--avatar-badge-inset) - var(--avatar-badge-size) / 2), transparent 99%, #000 100% )}a-avatar:not(:defined){display:inline-block;inline-size:var(--avatar-size);block-size:var(--avatar-size);border-radius:var(--avatar-radius);background:var(--avatar-placeholder-bg);vertical-align:middle}a-avatar[badge=neutral]{--avatar-badge-chroma: .005}a-avatar[badge=brand]{--avatar-badge-tone-source: var(--anta-seed-brand)}a-avatar[badge=info]{--avatar-badge-tone-source: var(--anta-seed-info)}a-avatar[badge=success]{--avatar-badge-tone-source: var(--anta-seed-success)}a-avatar[badge=warning]{--avatar-badge-tone-source: var(--anta-seed-warning)}a-avatar[badge=critical]{--avatar-badge-tone-source: var(--anta-seed-critical)}@supports (color: attr(badge type(<color>),transparent)){a-avatar[badge]:not([badge=""],[badge=neutral],[badge=brand],[badge=info],[badge=success],[badge=warning],[badge=critical]){--avatar-badge-tone-source: attr(badge type(<color>), transparent)}}
|
|
1
|
+
@layer anta.components{a-avatar{--avatar-size: 44px;--avatar-radius: 22%;--avatar-placeholder-bg: var(--bg-3);--avatar-badge-ratio: .24;--avatar-badge-size: calc(var(--avatar-size) * var(--avatar-badge-ratio));--avatar-badge-inset: 0px;--avatar-badge-gap: 2px;--avatar-badge-mask: none;--avatar-badge-tone-source: var(--anta-seed-neutral);--avatar-badge-chroma: .17;--avatar-badge-color: light-dark( oklch(from var(--avatar-badge-tone-source) .62 var(--avatar-badge-chroma) h), oklch(from var(--avatar-badge-tone-source) .68 var(--avatar-badge-chroma) h) );display:inline-block;inline-size:var(--avatar-size);block-size:var(--avatar-size);vertical-align:middle}a-avatar[round]{--avatar-radius: var(--avatar-round, 50%);--avatar-badge-inset: calc(var(--avatar-size) * .03);@supports (border-radius: attr(probe type(<length>),1px)){--avatar-round: attr(round type(<length>))}}a-avatar[size=small]{--avatar-size: 32px;--avatar-badge-gap: 1.5px}a-avatar[size=large]{--avatar-size: 64px;--avatar-badge-gap: 2.5px}a-avatar[badge]:not([badge=""],[badge=none]){--avatar-badge-mask: radial-gradient( circle calc(var(--avatar-badge-size) / 2 + var(--avatar-badge-gap)) at calc(100% - var(--avatar-badge-inset) - var(--avatar-badge-size) / 2) calc(100% - var(--avatar-badge-inset) - var(--avatar-badge-size) / 2), transparent 99%, #000 100% )}a-avatar:not(:defined){display:inline-block;inline-size:var(--avatar-size);block-size:var(--avatar-size);border-radius:var(--avatar-radius);background:var(--avatar-placeholder-bg);vertical-align:middle}a-avatar[badge=neutral]{--avatar-badge-chroma: .005}a-avatar[badge=brand]{--avatar-badge-tone-source: var(--anta-seed-brand)}a-avatar[badge=info]{--avatar-badge-tone-source: var(--anta-seed-info)}a-avatar[badge=success]{--avatar-badge-tone-source: var(--anta-seed-success)}a-avatar[badge=warning]{--avatar-badge-tone-source: var(--anta-seed-warning)}a-avatar[badge=critical]{--avatar-badge-tone-source: var(--anta-seed-critical)}@supports (color: attr(badge type(<color>),transparent)){a-avatar[badge]:not([badge=""],[badge=neutral],[badge=brand],[badge=info],[badge=success],[badge=warning],[badge=critical]){--avatar-badge-tone-source: attr(badge type(<color>), transparent)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta.components{a-banner{--banner-bg: var(--bg-4);--banner-border: var(--border-4);--banner-text: var(--text-2);display:flex;align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:4px 1ch;position:relative;box-sizing:border-box;width:100%;min-height:40px;padding-block:6px;padding-inline:16px 48px;color:var(--banner-text);background:var(--banner-bg);border:0 solid var(--banner-border);border-radius:0;overflow:clip;overflow-clip-margin:3px;interpolate-size:allow-keywords;transition:opacity .16s ease,block-size .2s ease,padding-block .2s ease,border-block-width .2s ease,display .2s allow-discrete}a-banner[align=center]{justify-content:center;padding-inline:48px}a-banner[round]{border-radius:var(--banner-round, 999px);@supports (border-radius: attr(probe type(<length>),1px)){--banner-round: attr(round type(<length>))}}a-banner [slot=close] a-button,a-banner a-button[slot=close]{height:100%;width:40px}a-banner-message{font-size:14px;line-height:20px;font-weight:475;text-align:start}a-banner[align=center] a-banner-message{text-align:center}a-banner[tone=brand]{--banner-bg: var(--bg-4-brand);--banner-border: var(--border-4-brand);--banner-text: var(--text-2-brand)}a-banner[tone=info]{--banner-bg: var(--bg-4-info);--banner-border: var(--border-4-info);--banner-text: var(--text-2-info)}a-banner[tone=success]{--banner-bg: var(--bg-4-success);--banner-border: var(--border-4-success);--banner-text: var(--text-2-success)}a-banner[tone=warning]{--banner-bg: var(--bg-4-warning);--banner-border: var(--border-4-warning);--banner-text: var(--text-2-warning)}a-banner[tone=critical]{--banner-bg: var(--bg-4-critical);--banner-border: var(--border-4-critical);--banner-text: var(--text-2-critical)}a-banner[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--banner-tone-source: currentColor;--banner-text: oklch(from var(--banner-tone-source) .5 .125 h)
|
|
1
|
+
@layer anta.components{a-banner{--banner-bg: var(--bg-4);--banner-border: var(--border-4);--banner-text: var(--text-2);display:flex;align-items:center;justify-content:flex-start;flex-wrap:wrap;gap:4px 1ch;position:relative;box-sizing:border-box;width:100%;min-height:40px;padding-block:6px;padding-inline:16px 48px;color:var(--banner-text);background:var(--banner-bg);border:0 solid var(--banner-border);border-radius:0;overflow:clip;overflow-clip-margin:3px;interpolate-size:allow-keywords;transition:opacity .16s ease,block-size .2s ease,padding-block .2s ease,border-block-width .2s ease,display .2s allow-discrete}a-banner[align=center]{justify-content:center;padding-inline:48px}a-banner[round]{border-radius:var(--banner-round, 999px);@supports (border-radius: attr(probe type(<length>),1px)){--banner-round: attr(round type(<length>))}}a-banner [slot=close] a-button,a-banner a-button[slot=close]{height:100%;width:40px}a-banner-message{font-size:14px;line-height:20px;font-weight:475;text-align:start}a-banner[align=center] a-banner-message{text-align:center}a-banner[tone=brand]{--banner-bg: var(--bg-4-brand);--banner-border: var(--border-4-brand);--banner-text: var(--text-2-brand)}a-banner[tone=info]{--banner-bg: var(--bg-4-info);--banner-border: var(--border-4-info);--banner-text: var(--text-2-info)}a-banner[tone=success]{--banner-bg: var(--bg-4-success);--banner-border: var(--border-4-success);--banner-text: var(--text-2-success)}a-banner[tone=warning]{--banner-bg: var(--bg-4-warning);--banner-border: var(--border-4-warning);--banner-text: var(--text-2-warning)}a-banner[tone=critical]{--banner-bg: var(--bg-4-critical);--banner-border: var(--border-4-critical);--banner-text: var(--text-2-critical)}a-banner[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--banner-tone-source: currentColor;--banner-text: light-dark( oklch(from var(--banner-tone-source) .5 .125 h), oklch(from var(--banner-tone-source) .77 .11 h) );--banner-bg: light-dark( oklch(from var(--banner-tone-source) .955 .02 h), oklch(from var(--banner-tone-source) .185 .05 h) );--banner-border: light-dark( oklch(from var(--banner-tone-source) .9 .04 h), oklch(from var(--banner-tone-source) .26 .06 h) );@supports (color: attr(probe type(<color>),red)){--banner-tone-source: attr(tone type(<color>), currentColor)}}a-banner:not(:defined){opacity:0}a-banner[state=closed],a-banner[default-state=closed],a-banner:state(closed){display:none;block-size:0;min-block-size:0;padding-block:0;border-block-width:0;opacity:0}@media(forced-colors:active){a-banner{border-width:1px;border-color:CanvasText}}@media(prefers-reduced-motion:reduce){a-banner{transition:none}}}
|
package/dist/elements/a-box.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare class ABoxElement extends HTMLElementBase {
|
|
|
25
25
|
static observedAttributes: string[];
|
|
26
26
|
connectedCallback(): void;
|
|
27
27
|
disconnectedCallback(): void;
|
|
28
|
-
attributeChangedCallback(): void;
|
|
28
|
+
attributeChangedCallback(name: string): void;
|
|
29
29
|
/** A fresh measurement snapshot. For notifications, prefer `measurechange`:
|
|
30
30
|
* it batches browser observers and includes the field-level delta. */
|
|
31
31
|
get measurement(): BoxMeasurement;
|
package/dist/elements/a-box.js
CHANGED
|
@@ -119,8 +119,15 @@ class BoxWindowStore {
|
|
|
119
119
|
this.#classObserver?.disconnect();
|
|
120
120
|
this.#classObserver = void 0;
|
|
121
121
|
}
|
|
122
|
+
/* Only the store the map currently points at may remove that entry. A box
|
|
123
|
+
that was connected while its store went empty keeps a direct reference to
|
|
124
|
+
it, so an evicted store can be re-subscribed and later empty again — by
|
|
125
|
+
which time the map holds a live store with its own document observer.
|
|
126
|
+
Deleting blind would drop that live store and leave its observer running
|
|
127
|
+
while the next connect built a second one. */
|
|
122
128
|
#collect() {
|
|
123
|
-
if (this.#contextBoxes.size
|
|
129
|
+
if (this.#contextBoxes.size > 0 || this.#observedBoxes.size > 0) return;
|
|
130
|
+
if (stores.get(this.view) === this) stores.delete(this.view);
|
|
124
131
|
}
|
|
125
132
|
/* Only `dark` and `light` change what a box reports. Every other class toggle
|
|
126
133
|
on the page — a route class, a scroll lock, a theme-unrelated modifier —
|
|
@@ -292,8 +299,9 @@ class ABoxElement extends HTMLElementBase {
|
|
|
292
299
|
connectedCallback, when there is no store yet. Syncing then would flip the
|
|
293
300
|
started flags while `this.#store?.subscribeContext` silently did nothing,
|
|
294
301
|
and the later connect would see the flags already set and skip it. */
|
|
295
|
-
attributeChangedCallback() {
|
|
296
|
-
if (this.#store)
|
|
302
|
+
attributeChangedCallback(name) {
|
|
303
|
+
if (!this.#store) return;
|
|
304
|
+
if (name === "fade" || name === "observe") this.#sync();
|
|
297
305
|
}
|
|
298
306
|
/** A fresh measurement snapshot. For notifications, prefer `measurechange`:
|
|
299
307
|
* it batches browser observers and includes the field-level delta. */
|