@antadesign/anta 0.3.19 → 0.3.21
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 +1 -1
- package/dist/anta_helpers.d.ts +11 -2
- package/dist/anta_helpers.js +9 -0
- package/dist/components/Banner.d.ts +3 -3
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Calendar.d.ts +11 -12
- package/dist/components/Card.d.ts +1 -1
- package/dist/components/Card.js +1 -1
- package/dist/components/Checkbox.d.ts +8 -9
- package/dist/components/Dialog.d.ts +1 -1
- package/dist/components/Expander.d.ts +5 -6
- package/dist/components/Input.d.ts +2 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/InputAutocomplete.d.ts +8 -8
- package/dist/components/InputAutocomplete.js +24 -18
- package/dist/components/InputTime.d.ts +3 -3
- package/dist/components/InputTime.js +1 -1
- package/dist/components/Menu.d.ts +2 -2
- package/dist/components/MenuItem.d.ts +1 -1
- package/dist/components/MenuItem.js +1 -1
- package/dist/components/Progress.d.ts +1 -1
- package/dist/components/RadioGroup.d.ts +14 -15
- package/dist/components/RadioGroup.js +5 -2
- package/dist/components/Select.d.ts +33 -40
- package/dist/components/Select.js +6 -2
- package/dist/components/SelectFaceted.d.ts +27 -33
- package/dist/components/SelectFaceted.js +5 -1
- package/dist/components/Slider.d.ts +5 -5
- package/dist/components/Switch.d.ts +4 -4
- package/dist/components/TabPanel.d.ts +1 -2
- package/dist/components/TabPanel.js +0 -1
- package/dist/components/Tabs.d.ts +9 -9
- package/dist/components/Tabs.js +5 -2
- package/dist/components/Text.d.ts +5 -3
- package/dist/components/Text.js +7 -3
- package/dist/components/Title.d.ts +1 -1
- package/dist/components/Toaster.d.ts +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-expander.d.ts +1 -0
- package/dist/elements/a-expander.js +12 -2
- package/dist/elements/a-menu.d.ts +1 -8
- package/dist/elements/a-menu.js +1 -40
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-text.d.ts +4 -0
- package/dist/elements/a-text.js +10 -3
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/a-tooltip.d.ts +8 -1
- package/dist/elements/a-tooltip.js +88 -15
- package/dist/elements/index.d.ts +1 -1
- package/dist/general_types.d.ts +33 -22
- package/dist/index.d.ts +3 -3
- package/dist/theme-anta.css +1 -1
- package/docs/accessibility.md +4 -4
- package/docs/changelog.md +40 -13
- package/docs/comparison.md +1 -1
- package/docs/components/banner.md +17 -17
- package/docs/components/button.md +6 -6
- package/docs/components/card.md +5 -6
- package/docs/components/checkbox.md +17 -18
- package/docs/components/dialog.md +2 -2
- package/docs/components/expander.md +27 -30
- package/docs/components/icon.md +1 -1
- package/docs/components/input-autocomplete.md +15 -16
- package/docs/components/input-date.md +54 -59
- package/docs/components/input-time.md +7 -7
- package/docs/components/input.md +14 -14
- package/docs/components/menu.md +72 -8
- package/docs/components/progress.md +2 -2
- package/docs/components/radio.md +28 -25
- package/docs/components/select-faceted.md +95 -100
- package/docs/components/select.md +113 -115
- package/docs/components/slider.md +15 -10
- package/docs/components/switch.md +13 -13
- package/docs/components/tabs.md +23 -23
- package/docs/components/tag.md +5 -5
- package/docs/components/text.md +31 -7
- package/docs/components/title.md +1 -1
- package/docs/components/toaster.md +4 -4
- package/docs/components/tooltip.md +2 -2
- package/docs/credits.md +0 -4
- package/docs/index.md +1 -1
- package/docs/install-config.md +12 -7
- package/docs/normalization.md +6 -9
- package/docs/overview.md +1 -1
- package/docs/packages/stickers.md +1 -1
- package/docs/theming.md +15 -0
- package/package.json +3 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from '../general_types';
|
|
1
|
+
import type { BaseProps, OptionPresentationProps } 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';
|
|
@@ -14,7 +14,7 @@ export type OptionValue = string | number | boolean;
|
|
|
14
14
|
*
|
|
15
15
|
* Generic in the value type `V` (defaults to `string`): `Select` infers `V` from your
|
|
16
16
|
* `options`, so `{ value: 365 }` round-trips as `number` through `onValueChange`. */
|
|
17
|
-
export interface SelectOption<V extends OptionValue = string> {
|
|
17
|
+
export interface SelectOption<V extends OptionValue = string> extends OptionPresentationProps {
|
|
18
18
|
/** The option's value (`V`) — its identity, what `value` / `defaultValue` name, and
|
|
19
19
|
* what `onValueChange` reports. Unique across the whole `options` tree (selection is
|
|
20
20
|
* value-keyed and global across groups / submenus). */
|
|
@@ -35,7 +35,7 @@ export interface SelectOption<V extends OptionValue = string> {
|
|
|
35
35
|
* hint for the Alt/Option-click "select only this" accelerator; set `tooltip`
|
|
36
36
|
* to override that, or `''` to suppress it. */
|
|
37
37
|
tooltip?: React.ReactNode;
|
|
38
|
-
/**
|
|
38
|
+
/** Additional application data. Read it in `renderOption`. */
|
|
39
39
|
[key: string]: unknown;
|
|
40
40
|
}
|
|
41
41
|
/** A titled group of options rendered **inline** under a heading (like `MenuGroup`).
|
|
@@ -164,10 +164,9 @@ export interface SelectCommonProps<V extends OptionValue = string> extends Omit<
|
|
|
164
164
|
* `leading` slot). With a custom `renderTrigger`, it's passed through as
|
|
165
165
|
* `state.icon` instead — the consumer places it. */
|
|
166
166
|
icon?: IconShape;
|
|
167
|
-
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* one alongside. Ignored with a custom `renderTrigger`. */
|
|
167
|
+
/** Content for the default trigger's `leading` slot, such as a key prefix
|
|
168
|
+
* before the value. It replaces the icon derived from `icon`. Include an
|
|
169
|
+
* `<Icon>` in this content when both are needed. Ignored by `renderTrigger`. */
|
|
171
170
|
leading?: React.ReactNode;
|
|
172
171
|
/** Field label, above the trigger (Input's `label`). */
|
|
173
172
|
label?: string;
|
|
@@ -197,11 +196,10 @@ export interface SelectCommonProps<V extends OptionValue = string> extends Omit<
|
|
|
197
196
|
* option's **value / label / hint**. Pass a **function** `(option, query) =>
|
|
198
197
|
* boolean` for custom matching (called per option; return `true` to keep it). */
|
|
199
198
|
filter?: boolean | ((option: SelectOption<V>, query: string) => boolean);
|
|
200
|
-
/** `multiple` only: a "Select all" row
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* isolate accelerator it gates).
|
|
199
|
+
/** `multiple` only: shows a "Select all" row that toggles every enabled option,
|
|
200
|
+
* or only the visible options when a filter query is active. Its checkbox is
|
|
201
|
+
* mixed when some options are selected. It is on by default. Set it to `false`
|
|
202
|
+
* to remove the row and the Alt/Option-click shortcut that selects only one row.
|
|
205
203
|
* @defaultValue true */
|
|
206
204
|
selectAll?: boolean;
|
|
207
205
|
/** Label for the `selectAll` row.
|
|
@@ -214,13 +212,12 @@ export interface SelectCommonProps<V extends OptionValue = string> extends Omit<
|
|
|
214
212
|
/** Label for the `clearable` footer row.
|
|
215
213
|
* @defaultValue Clear */
|
|
216
214
|
clearLabel?: string;
|
|
217
|
-
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* matches the
|
|
223
|
-
* skipped — your content owns its own display. */
|
|
215
|
+
/** Replaces the built-in `label`, `hint`, and `icon` layout for each option row.
|
|
216
|
+
* Select still supplies the row container, click handling, ARIA attributes, and
|
|
217
|
+
* selection indicator. Read extra option fields through `SelectOption`'s index
|
|
218
|
+
* signature. `state` contains `value`, `selected`, and `disabled`. Filtering
|
|
219
|
+
* still matches the option's `value`, `label`, and `hint`, but Select cannot
|
|
220
|
+
* highlight matches within the returned content. */
|
|
224
221
|
renderOption?: (option: SelectOption<V>, state: OptionState<V>) => React.ReactNode;
|
|
225
222
|
/** Replace each row's selection **mark** with your own node, drawn at the
|
|
226
223
|
* leading edge. The row stays the control (`role` + `aria-checked` from
|
|
@@ -246,16 +243,15 @@ export interface SelectCommonProps<V extends OptionValue = string> extends Omit<
|
|
|
246
243
|
* the single-label case built-in). For rich content (chips, multiple nodes)
|
|
247
244
|
* use `renderTrigger`, which replaces the whole field. */
|
|
248
245
|
renderSummary?: (selected: SelectOption<V>[]) => string | undefined;
|
|
249
|
-
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
* only — put your own on the element you return. */
|
|
246
|
+
/** Replaces the default field with a trigger returned from this function.
|
|
247
|
+
* Receives `open`, `value`, `selected`, `disabled`, and `icon`. Return exactly
|
|
248
|
+
* one focusable element, such as an Anta `Button`. The menu is positioned
|
|
249
|
+
* relative to that element and opens when it is clicked. Do not return a
|
|
250
|
+
* fragment, multiple siblings, or a non-focusable wrapper. Add
|
|
251
|
+
* `aria-haspopup="menu"` and `aria-expanded={state.open}` to the element.
|
|
252
|
+
* Field props (`label`, `hint`, `size`, `status`, `placeholder`, and `round`) and
|
|
253
|
+
* `className` / `style` apply only to the default field. Add styling and
|
|
254
|
+
* attributes to the returned element instead. */
|
|
259
255
|
renderTrigger?: (state: TriggerState<V>) => React.ReactNode;
|
|
260
256
|
/** Render content in the menu body when the (filtered) option list is empty —
|
|
261
257
|
* a "no results" message, a loading indicator (gated on your own external
|
|
@@ -276,13 +272,10 @@ export type SelectProps<V extends OptionValue = string> = SelectCommonProps<V> &
|
|
|
276
272
|
* array value.
|
|
277
273
|
* @defaultValue single */
|
|
278
274
|
selection?: 'single';
|
|
279
|
-
/** Controlled value
|
|
280
|
-
*
|
|
281
|
-
* *requests* a change via `onValueChange` (reject by not updating). Leave
|
|
282
|
-
* undefined for uncontrolled. */
|
|
275
|
+
/** Controlled value: the selected option's `value`. Update it through
|
|
276
|
+
* `onValueChange`. Leave it undefined for uncontrolled use. */
|
|
283
277
|
value?: V;
|
|
284
|
-
/** Initial
|
|
285
|
-
* wrapper then owns it. */
|
|
278
|
+
/** Initial selected option value for uncontrolled use. */
|
|
286
279
|
defaultValue?: V;
|
|
287
280
|
/** Fires after the selection changes, with the new value and a
|
|
288
281
|
* `{ value, option }` snapshot. Select has no discrete element state, so
|
|
@@ -352,17 +345,17 @@ export type SelectedItem<V extends OptionValue = string> = SelectedOption<V> | S
|
|
|
352
345
|
*/
|
|
353
346
|
export declare function optionsWithSelection<V extends OptionValue = string>(options: SelectItem<V>[], values: V | V[] | undefined): SelectedItem<V>[];
|
|
354
347
|
/**
|
|
355
|
-
* `<Select>`
|
|
356
|
-
* read-only trigger
|
|
348
|
+
* `<Select>` lets people choose one or more options from a dropdown. It uses an
|
|
349
|
+
* `<Input>` as its read-only trigger and a `<Menu>` for its options. `selection` sets behavior:
|
|
357
350
|
* `'single'` (default; `value` is a string, menu closes on pick) or `'multiple'`
|
|
358
351
|
* (checkboxes, `value` is a string array, menu stays open while toggling, the
|
|
359
352
|
* field shows an "N selected" count). For single-select, `indicator` picks the
|
|
360
353
|
* per-row mark: `'none'` (tint only, default), `'check'` (trailing checkmark), or
|
|
361
354
|
* `'radio'` (leading radio).
|
|
362
355
|
*
|
|
363
|
-
*
|
|
364
|
-
* is no `a-select` element
|
|
365
|
-
*
|
|
356
|
+
* Use `value` with `onValueChange` to control the selection, or use
|
|
357
|
+
* `defaultValue` for uncontrolled use. There is no `a-select` element. See the
|
|
358
|
+
* docs for the equivalent markup without React or Preact.
|
|
366
359
|
*
|
|
367
360
|
* Requires `@antadesign/anta/elements` (client-side only).
|
|
368
361
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState, useId } from "../jsx-runtime";
|
|
3
|
-
import { ISOLATE_HINT } from "../anta_helpers";
|
|
3
|
+
import { ISOLATE_HINT, optionPresentationAttrs } from "../anta_helpers";
|
|
4
4
|
import { normalizeOpt, matchQueryRegex, matchesQuery, highlight } from "./select-options";
|
|
5
5
|
import { Input } from "./Input";
|
|
6
6
|
import { Icon } from "./Icon";
|
|
@@ -164,6 +164,7 @@ const Select = (props) => {
|
|
|
164
164
|
emit?.(next, { all: true, selected: false });
|
|
165
165
|
};
|
|
166
166
|
const renderOptionRow = (o, disabled2) => {
|
|
167
|
+
const { className: optionClassName, style: optionStyle, ...optionAttrs } = optionPresentationAttrs(o, true);
|
|
167
168
|
const optState = { value: o.value, selected: isSelected(o.value), disabled: disabled2 };
|
|
168
169
|
const custom = renderOption?.(o, optState);
|
|
169
170
|
const customMark = renderIndicator?.(optState);
|
|
@@ -174,6 +175,7 @@ const Select = (props) => {
|
|
|
174
175
|
return /* @__PURE__ */ jsxs(
|
|
175
176
|
MenuItem,
|
|
176
177
|
{
|
|
178
|
+
...optionAttrs,
|
|
177
179
|
id: `${uid}-opt-${o.value}`,
|
|
178
180
|
selectionIndicator: menuItemIndicator,
|
|
179
181
|
...ariaSelectable,
|
|
@@ -187,6 +189,8 @@ const Select = (props) => {
|
|
|
187
189
|
disabled: disabled2 || void 0,
|
|
188
190
|
"data-menu-open": multiple ? "" : void 0,
|
|
189
191
|
onSelect: (e) => choose(o, e),
|
|
192
|
+
className: optionClassName,
|
|
193
|
+
style: optionStyle,
|
|
190
194
|
children: [
|
|
191
195
|
custom,
|
|
192
196
|
tip && /* @__PURE__ */ jsx(Tooltip, { follow: true, ...hintOnly ? { delay: 700 } : {}, children: tip })
|
|
@@ -269,7 +273,7 @@ const Select = (props) => {
|
|
|
269
273
|
"aria-haspopup": "menu",
|
|
270
274
|
"aria-expanded": open ? "true" : "false",
|
|
271
275
|
trailing: (
|
|
272
|
-
// The named tag
|
|
276
|
+
// The named tag applies the Select-specific rotation while the icon remains
|
|
273
277
|
// a normal currentColor glyph.
|
|
274
278
|
/* @__PURE__ */ jsx("a-select-chevron", { open: open ? "" : void 0, style: statusColor ? { color: statusColor } : void 0, children: /* @__PURE__ */ jsx(Icon, { shape: "chevron-down" }) })
|
|
275
279
|
),
|
|
@@ -4,9 +4,8 @@ import type { OptionValue, SelectItem, SelectOption } from './Select';
|
|
|
4
4
|
import { type MenuProps } from './Menu';
|
|
5
5
|
import './select-parts.css';
|
|
6
6
|
interface FacetBase {
|
|
7
|
-
/** The facet's
|
|
8
|
-
*
|
|
9
|
-
* `facets`. */
|
|
7
|
+
/** The key for this facet's value in the record. `onValueChange` reports it as
|
|
8
|
+
* `attrs.facet`. It must be unique across `facets`. */
|
|
10
9
|
key: string;
|
|
11
10
|
/** The facet's row label in the menu. */
|
|
12
11
|
label: string;
|
|
@@ -63,9 +62,8 @@ export interface SelectFacetCustomContext<V> {
|
|
|
63
62
|
/** Close the whole filter menu (e.g. after applying from a custom editor). */
|
|
64
63
|
close: () => void;
|
|
65
64
|
}
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* numeric comparator, …). */
|
|
65
|
+
/** A custom editor and value type for values the built-in kinds do not cover,
|
|
66
|
+
* including objects such as date ranges and numeric comparisons. */
|
|
69
67
|
export interface SelectFacetCustom<V = unknown> extends FacetBase {
|
|
70
68
|
kind: 'custom';
|
|
71
69
|
/** Render the facet's editor inside its flyout. The returned node stays
|
|
@@ -75,11 +73,11 @@ export interface SelectFacetCustom<V = unknown> extends FacetBase {
|
|
|
75
73
|
* string or any node). Called only when the value is set. */
|
|
76
74
|
summary: (value: V) => React.ReactNode;
|
|
77
75
|
}
|
|
78
|
-
/** One
|
|
76
|
+
/** One filter category, discriminated by `kind`. */
|
|
79
77
|
export type SelectFacet = SelectFacetSingle | SelectFacetMultiple | SelectFacetText | SelectFacetCustom;
|
|
80
78
|
/** The filter value: a facet key → that facet's value. Per kind: an option value
|
|
81
79
|
* (`string` / `number` / `boolean`) for `single`, a `string` for `text`, an array for
|
|
82
|
-
* `multiple`, or
|
|
80
|
+
* `multiple`, or a `V` value for `custom`. Values are stored and reported unchanged.
|
|
83
81
|
* Typed loosely as `unknown` since facets in one control can hold different value
|
|
84
82
|
* types; narrow per facet when you read it. A cleared facet is absent from the record. */
|
|
85
83
|
export type SelectFacetedValue = Record<string, unknown>;
|
|
@@ -111,7 +109,7 @@ export interface SelectFacetedTriggerState {
|
|
|
111
109
|
disabled: boolean;
|
|
112
110
|
}
|
|
113
111
|
export interface SelectFacetedProps extends Omit<BaseProps, 'children'> {
|
|
114
|
-
/**
|
|
112
|
+
/** Categories to filter by. Each facet has a `kind` that determines its editor. */
|
|
115
113
|
facets: SelectFacet[];
|
|
116
114
|
/** Preferred placement of the root filter menu relative to its trigger. The
|
|
117
115
|
* menu auto-flips vertically and clamps horizontally when needed.
|
|
@@ -120,11 +118,10 @@ export interface SelectFacetedProps extends Omit<BaseProps, 'children'> {
|
|
|
120
118
|
/** Gap in pixels between the trigger and the filter menu.
|
|
121
119
|
* @defaultValue 4 */
|
|
122
120
|
offset?: number;
|
|
123
|
-
/** Controlled value
|
|
124
|
-
*
|
|
125
|
-
* not updating). Leave undefined for uncontrolled. */
|
|
121
|
+
/** Controlled value record, keyed by facet. When provided, update it through
|
|
122
|
+
* `onValueChange`. Leave it undefined for uncontrolled use. */
|
|
126
123
|
value?: SelectFacetedValue;
|
|
127
|
-
/** Initial value for
|
|
124
|
+
/** Initial value for uncontrolled use. */
|
|
128
125
|
defaultValue?: SelectFacetedValue;
|
|
129
126
|
/** Fires after any facet changes. `value` is the whole new record (a facet key →
|
|
130
127
|
* that facet's value; a cleared facet is absent). `attrs` says what changed:
|
|
@@ -147,14 +144,13 @@ export interface SelectFacetedProps extends Omit<BaseProps, 'children'> {
|
|
|
147
144
|
disabled?: boolean;
|
|
148
145
|
/** Tone applied to a selected option row in the facet flyouts (label, selected
|
|
149
146
|
* tint, and the check / checkbox indicator). A named tone or a custom CSS
|
|
150
|
-
*
|
|
147
|
+
* color, matching `Select`'s `toneSelected`. Defaults to a neutral selection. */
|
|
151
148
|
toneSelected?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
152
|
-
/**
|
|
153
|
-
* `single`
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* built-in substring match. */
|
|
149
|
+
/** Adds a search field at the top of the root menu. It searches the options of
|
|
150
|
+
* every `single` and `multiple` facet in one list. For example, "alice" can
|
|
151
|
+
* appear under application-defined Assignee and Owner facets. `text` and
|
|
152
|
+
* `custom` facets remain available when the search is empty. Each facet uses
|
|
153
|
+
* its `filter` function when supplied, or the built-in substring match. */
|
|
158
154
|
searchable?: boolean;
|
|
159
155
|
/** Placeholder for the global search field.
|
|
160
156
|
* @defaultValue Filter… */
|
|
@@ -165,22 +161,20 @@ export interface SelectFacetedProps extends Omit<BaseProps, 'children'> {
|
|
|
165
161
|
/** Label for the "Clear all" row.
|
|
166
162
|
* @defaultValue Clear all */
|
|
167
163
|
clearAllLabel?: string;
|
|
168
|
-
/**
|
|
169
|
-
* `SelectFacetedTriggerState
|
|
170
|
-
* menu
|
|
171
|
-
* `aria-haspopup="menu"`
|
|
172
|
-
*
|
|
173
|
-
*
|
|
164
|
+
/** Replaces the default `Button` with a trigger returned from this function.
|
|
165
|
+
* Receives a `SelectFacetedTriggerState`. Return exactly one focusable element:
|
|
166
|
+
* the menu is positioned relative to that element and opens when it is clicked.
|
|
167
|
+
* Add `aria-haspopup="menu"` and `aria-expanded={state.open}` to the returned
|
|
168
|
+
* element. `className`, `style`, and other trigger props apply only to the
|
|
169
|
+
* default Button, so add styling and attributes to the returned element. */
|
|
174
170
|
renderTrigger?: (state: SelectFacetedTriggerState) => React.ReactNode;
|
|
175
171
|
}
|
|
176
172
|
/**
|
|
177
|
-
* `<SelectFaceted>`
|
|
178
|
-
*
|
|
179
|
-
* `'single'
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* `Record<facetKey, value>`, so the same option value under two facets stays
|
|
183
|
-
* distinct.
|
|
173
|
+
* `<SelectFaceted>` filters a result set by categories called facets. Its
|
|
174
|
+
* trigger opens a facet menu, and each facet opens a control for its value.
|
|
175
|
+
* The available kinds are `'single'`, `'multiple'`, `'text'`, and `'custom'`.
|
|
176
|
+
* The value is a `Record<facetKey, value>`, so values under different facet
|
|
177
|
+
* keys stay distinct.
|
|
184
178
|
*
|
|
185
179
|
* Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
|
|
186
180
|
* There is no `a-select-faceted` element — this wrapper is the coordinator.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState, useMemo } from "../jsx-runtime";
|
|
3
|
-
import { nativeStateChange, ISOLATE_HINT } from "../anta_helpers";
|
|
3
|
+
import { nativeStateChange, ISOLATE_HINT, optionPresentationAttrs } from "../anta_helpers";
|
|
4
4
|
import { normalizeOpt, matchQueryRegex, matchesQuery } from "./select-options";
|
|
5
5
|
import { Button } from "./Button";
|
|
6
6
|
import { Menu } from "./Menu";
|
|
@@ -118,13 +118,17 @@ const SelectFaceted = (props) => {
|
|
|
118
118
|
}
|
|
119
119
|
) }) : null;
|
|
120
120
|
const optionRow = (facet, opt, keyPrefix = "") => {
|
|
121
|
+
const { className: optionClassName, style: optionStyle, ...optionAttrs } = optionPresentationAttrs(opt, true);
|
|
121
122
|
const shared = {
|
|
123
|
+
...optionAttrs,
|
|
122
124
|
icon: opt.icon,
|
|
123
125
|
label: opt.label ?? String(opt.value),
|
|
124
126
|
hint: opt.hint,
|
|
125
127
|
tone: opt.tone,
|
|
126
128
|
toneSelected,
|
|
127
129
|
disabled: opt.disabled,
|
|
130
|
+
className: optionClassName,
|
|
131
|
+
style: optionStyle,
|
|
128
132
|
"data-menu-open": ""
|
|
129
133
|
};
|
|
130
134
|
if (facet.kind === "single") {
|
|
@@ -35,11 +35,11 @@ export interface SliderProps extends BaseProps, DOMEventHandlers {
|
|
|
35
35
|
name?: string;
|
|
36
36
|
/** Disables pointer and keyboard interaction. */
|
|
37
37
|
disabled?: boolean;
|
|
38
|
-
/**
|
|
38
|
+
/** Color of the filled rail. Pass a named tone or a literal CSS color for a
|
|
39
39
|
* one-off custom tone. The unfilled rail stays neutral.
|
|
40
40
|
* @defaultValue 'neutral' */
|
|
41
41
|
tone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
42
|
-
/**
|
|
42
|
+
/** Color of the thumb stroke. Pass a named tone or a literal CSS color for a
|
|
43
43
|
* one-off custom tone. Omit it to keep the thumb neutral.
|
|
44
44
|
* @defaultValue 'neutral' */
|
|
45
45
|
thumbTone?: 'neutral' | 'brand' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
@@ -54,7 +54,7 @@ export interface SliderProps extends BaseProps, DOMEventHandlers {
|
|
|
54
54
|
* it at least as large as `trackSize`.
|
|
55
55
|
* @defaultValue 18 */
|
|
56
56
|
thumbSize?: number | string;
|
|
57
|
-
/** Fill the thumb with its resolved border
|
|
57
|
+
/** Fill the thumb with its resolved border color. This follows `thumbTone`
|
|
58
58
|
* and interactive states.
|
|
59
59
|
* @defaultValue false */
|
|
60
60
|
thumbFill?: boolean;
|
|
@@ -72,8 +72,8 @@ export interface SliderProps extends BaseProps, DOMEventHandlers {
|
|
|
72
72
|
/** Compact text labels positioned below the rail. They do not add dots or
|
|
73
73
|
* ticks to the rail. */
|
|
74
74
|
markers?: SliderMarker[];
|
|
75
|
-
/**
|
|
76
|
-
* value
|
|
75
|
+
/** Controls what happens when the rail is pressed. `drag-only` starts dragging
|
|
76
|
+
* from the current value. `jump` first moves to the pressed position.
|
|
77
77
|
* @defaultValue 'drag-only' */
|
|
78
78
|
trackClick?: 'drag-only' | 'jump';
|
|
79
79
|
/** Fires on every keyboard or pointer value change. */
|
|
@@ -32,13 +32,13 @@ export interface SwitchProps extends BaseProps {
|
|
|
32
32
|
/** Value submitted while checked.
|
|
33
33
|
* @defaultValue "on" */
|
|
34
34
|
value?: string;
|
|
35
|
-
/**
|
|
36
|
-
* track border and thumb; use `toneSelected` to
|
|
35
|
+
/** Color of the track and thumb. A tinted tone also colors the unchecked
|
|
36
|
+
* track border and thumb; use `toneSelected` to color only the checked track.
|
|
37
37
|
* @defaultValue 'brand' */
|
|
38
38
|
tone?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
39
39
|
/** Like `tone`, but applies only while the switch is checked. The unchecked
|
|
40
|
-
* track and thumb stay neutral. If both are set, `tone`
|
|
41
|
-
* state and `toneSelected`
|
|
40
|
+
* track and thumb stay neutral. If both are set, `tone` colors the unchecked
|
|
41
|
+
* state and `toneSelected` colors the checked track.
|
|
42
42
|
* @defaultValue 'brand' */
|
|
43
43
|
toneSelected?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
44
44
|
/** Size variant. small=26×16px, medium=30×18px, large=34×20px.
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* finds its `<a-tabs>` (its flat sibling under the same parent — `Tabs` renders the
|
|
4
4
|
* strip and panels with no wrapper), matches by `value`, and shows/hides itself
|
|
5
5
|
* off-DOM. This wrapper is a pure projection: it sets the static ARIA (`role`,
|
|
6
|
-
* `
|
|
7
|
-
* or toggles it.
|
|
6
|
+
* `value`) and passes `children` straight through; `Tabs` never reads or toggles it.
|
|
8
7
|
*
|
|
9
8
|
* Use it as a direct child of `<Tabs>`, paired to an `options` entry by `value`.
|
|
10
9
|
* For a strip and panels in different layout regions (no shared parent), or to
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseProps } from "../general_types";
|
|
1
|
+
import type { BaseProps, OptionPresentationProps } from "../general_types";
|
|
2
2
|
import type { IconShape } from "../elements/a-icon.shapes";
|
|
3
3
|
/** The element's `statechange` payload — `next`/`prev` are tab values (`null` = none). */
|
|
4
4
|
type StateDetail = {
|
|
@@ -14,7 +14,7 @@ export interface TabsChangeAttrs {
|
|
|
14
14
|
* renders its strip from (like `RadioGroup`'s `options`). `Tabs` reads these fields to
|
|
15
15
|
* render the underlying `<a-tab>` (`tabindex`, `role`, and selection are all `Tabs`'
|
|
16
16
|
* job, published off-DOM by the element). */
|
|
17
|
-
export interface TabOption {
|
|
17
|
+
export interface TabOption extends OptionPresentationProps {
|
|
18
18
|
/** This tab's identity — pairs it with the `<TabPanel value="…">` of the same
|
|
19
19
|
* value, and the value reported by `onStateChange` / `onChange`. Unique per strip. */
|
|
20
20
|
value: string;
|
|
@@ -30,12 +30,12 @@ export interface TabOption {
|
|
|
30
30
|
/** Fully-round just this tab's box. `<Tabs round>` rounds the whole strip
|
|
31
31
|
* (tabs + sliding indicator) instead. */
|
|
32
32
|
round?: boolean;
|
|
33
|
-
/** Per-tab tone override, same vocabulary as `<Tabs tone>` —
|
|
34
|
-
* label + icons (all priorities/modes, named or custom
|
|
35
|
-
* active tab, its indicator. For a **custom literal
|
|
36
|
-
* adopt it (the shared moving element can't read a descendant's
|
|
37
|
-
*
|
|
38
|
-
* tones
|
|
33
|
+
/** Per-tab tone override, same vocabulary as `<Tabs tone>` — colors this one tab's
|
|
34
|
+
* label + icons (all priorities/modes, named or custom color) and, when it's the
|
|
35
|
+
* active tab, its indicator. For a **custom literal color** the sliding indicator can't
|
|
36
|
+
* adopt it (the shared moving element can't read a descendant's color), so a custom tone
|
|
37
|
+
* colors the label everywhere and the indicator only in `noslide`; the six **named**
|
|
38
|
+
* tones color both in every mode. Overrides the strip's `tone` for this tab.
|
|
39
39
|
* @defaultValue inherits the strip's `tone` */
|
|
40
40
|
tone?: "neutral" | "brand" | "info" | "success" | "warning" | "critical" | (string & {});
|
|
41
41
|
/** Disable just this tab — skipped by keyboard nav and dropped from the tab order
|
|
@@ -87,7 +87,7 @@ export interface TabsProps extends Omit<BaseProps, "onChange"> {
|
|
|
87
87
|
/** Visual priority. `primary` is the raised pill on a recessed track (the
|
|
88
88
|
* segmented-control look); `secondary` keeps that sizing but drops the track, marking
|
|
89
89
|
* the selected tab with a subtle active background fill; `tertiary` is a bottom-underline
|
|
90
|
-
* indicator under the selected tab (no track, no rest line). `tone`
|
|
90
|
+
* indicator under the selected tab (no track, no rest line). `tone` colors `secondary` +
|
|
91
91
|
* `tertiary`; `primary` stays neutral.
|
|
92
92
|
* @defaultValue 'primary' */
|
|
93
93
|
priority?: "primary" | "secondary" | "tertiary";
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState } from "../jsx-runtime";
|
|
3
|
-
import { nativeStateChange, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
3
|
+
import { nativeStateChange, optionPresentationAttrs, toneStyle, roundStyle, roundAttr, wrapLabel } from "../anta_helpers";
|
|
4
4
|
import { Tooltip } from "./Tooltip";
|
|
5
5
|
const Tabs = ({
|
|
6
6
|
children,
|
|
@@ -75,17 +75,20 @@ const Tabs = ({
|
|
|
75
75
|
children: tabs.map((p) => {
|
|
76
76
|
const tabDisabled = disabled || p.disabled;
|
|
77
77
|
const isSelected = p.value === currentValue;
|
|
78
|
+
const { className: optionClassName, style: optionStyle, ...optionAttrs } = optionPresentationAttrs(p);
|
|
78
79
|
return /* @__PURE__ */ jsxs(
|
|
79
80
|
"a-tab",
|
|
80
81
|
{
|
|
82
|
+
...optionAttrs,
|
|
81
83
|
role: "tab",
|
|
82
84
|
value: p.value,
|
|
83
85
|
tone: p.tone && p.tone !== "neutral" ? p.tone : void 0,
|
|
84
|
-
style: toneStyle(p.tone, "--tabs-tone-source", void 0),
|
|
85
86
|
"aria-disabled": tabDisabled ? "true" : void 0,
|
|
86
87
|
tabIndex: tabDisabled && !isSelected ? -1 : 0,
|
|
87
88
|
disabled: tabDisabled ? "" : void 0,
|
|
88
89
|
round: roundAttr(round) ?? roundAttr(p.round),
|
|
90
|
+
class: optionClassName,
|
|
91
|
+
style: toneStyle(p.tone, "--tabs-tone-source", optionStyle),
|
|
89
92
|
children: [
|
|
90
93
|
p.icon && /* @__PURE__ */ jsx("a-icon", { shape: p.icon, "aria-hidden": "true" }),
|
|
91
94
|
wrapLabel(p.label != null ? p.label : p.children, "a-tab-label"),
|
|
@@ -36,9 +36,11 @@ export type TextProps = BaseProps & {
|
|
|
36
36
|
inline?: boolean;
|
|
37
37
|
/** Truncate with a trailing ellipsis. `true` (or `1`) clamps to a
|
|
38
38
|
* single line; any integer ≥ 2 clamps to that many lines; `0` or a
|
|
39
|
-
* negative value means no truncation.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* negative value means no truncation. A clipped, non-expandable JSX
|
|
40
|
+
* `Text` shows its text content in a tooltip by default. Nest a
|
|
41
|
+
* `<Tooltip>` to provide your own tooltip instead. Uses the
|
|
42
|
+
* `-webkit-line-clamp` technique, supported in all major browsers
|
|
43
|
+
* (Firefox 68+, Chrome, Safari, Edge). */
|
|
42
44
|
truncate?: boolean | number;
|
|
43
45
|
} & ExpandMode;
|
|
44
46
|
/**
|
package/dist/components/Text.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { toneStyle } from "../anta_helpers";
|
|
3
|
+
import { Tooltip } from "./Tooltip";
|
|
3
4
|
const Text = ({ priority, tone, size, inline, truncate, expandable, collapsible, className, style, children, ...rest }) => {
|
|
4
5
|
const n = typeof truncate === "number" ? truncate : truncate ? 1 : null;
|
|
5
6
|
const lineCount = n != null && n >= 1 ? n : null;
|
|
@@ -10,7 +11,7 @@ const Text = ({ priority, tone, size, inline, truncate, expandable, collapsible,
|
|
|
10
11
|
lineCount != null ? { ...style, ["--line-clamp"]: lineCount } : style
|
|
11
12
|
);
|
|
12
13
|
const canExpand = expandable && lineCount != null;
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
14
15
|
"a-text",
|
|
15
16
|
{
|
|
16
17
|
priority,
|
|
@@ -23,7 +24,10 @@ const Text = ({ priority, tone, size, inline, truncate, expandable, collapsible,
|
|
|
23
24
|
class: className,
|
|
24
25
|
style: computedStyle,
|
|
25
26
|
...rest,
|
|
26
|
-
children
|
|
27
|
+
children: [
|
|
28
|
+
children,
|
|
29
|
+
lineCount != null && !canExpand && /* @__PURE__ */ jsx(Tooltip, { truncatedOnly: true, "data-anta-text-tooltip": "" })
|
|
30
|
+
]
|
|
27
31
|
}
|
|
28
32
|
);
|
|
29
33
|
};
|
|
@@ -21,7 +21,7 @@ export interface TitleProps extends BaseProps {
|
|
|
21
21
|
* Renders an `<a-title>` styled tag (no JS, no shadow DOM) with
|
|
22
22
|
* `role="heading"` and `aria-level={level}` set by this wrapper for
|
|
23
23
|
* accessibility. Children can be anything — text, icons, badges, links
|
|
24
|
-
* — so there are no `icon` / `iconTrailing` props;
|
|
24
|
+
* — so there are no `icon` / `iconTrailing` props; compose
|
|
25
25
|
* inside.
|
|
26
26
|
*
|
|
27
27
|
* `<Title>` carries no vertical margins: it's a spacing-neutral atom
|
|
@@ -13,7 +13,7 @@ export interface ToasterProps extends BaseProps {
|
|
|
13
13
|
* your app (a portal is fine); toasts are added imperatively through the store
|
|
14
14
|
* (`Toaster.manager`, or a `createToaster()` you pass as `toaster`). It
|
|
15
15
|
* subscribes to the store and renders each toast through the reconciler, so
|
|
16
|
-
* React
|
|
16
|
+
* React or Preact renders the toast nodes.
|
|
17
17
|
*
|
|
18
18
|
* Announcement is opt-in **per toast** (`add(render, { politeness })`), not a
|
|
19
19
|
* blanket live region on the whole toaster.
|
|
@@ -16,7 +16,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
16
16
|
round?: boolean | number | string;
|
|
17
17
|
/** Follow the cursor instead of pinning under the anchor. The bubble is
|
|
18
18
|
* pinned (anchored beneath the target) by default; pass `follow` for the
|
|
19
|
-
* cursor-tracking
|
|
19
|
+
* cursor-tracking behavior, which fades by distance as the cursor leaves. */
|
|
20
20
|
follow?: boolean;
|
|
21
21
|
/** Make the bubble hoverable and clickable — enables pointer events and
|
|
22
22
|
* keeps it open while the cursor is over it, so its content (links,
|
package/dist/elements/a-card.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-card{--card-text: var(--text-2);--card-bg-secondary: var(--bg-2);--card-bg-primary: var(--bg-1);--card-bg: var(--card-bg-primary);--card-border: var(--border-4);--card-border-hover: var(--border-3);--card-selected-ring: var(--border-1);--card-bg-hover-lift: .01;--card-radius: 8px;--card-padding: 12px;--card-content-fs: 15px;--card-content-lh: 20px;--card-icon-size: 40px;--card-icon-bg: var(--bg-4);--card-header-nudge: 2px;display:block;box-sizing:border-box;position:relative;width:100%;container-type:inline-size;container-name:card;color:var(--card-text);background:var(--card-bg);box-shadow:0 0 0 1px var(--card-border);border-radius:var(--card-radius);overflow:clip;transition:background-color .15s ease,box-shadow .15s ease,opacity .18s ease}a-card[priority=secondary]{--card-bg: var(--card-bg-secondary);--card-icon-blend: multiply}.dark a-card:not([priority=tertiary]){--card-icon-blend: exclusion}a-card[round]{--card-round: attr(round type(<length>));--card-radius: var(--card-round, 999px)}a-card[priority=tertiary]{--card-bg: color-mix(in oklch, var(--card-bg-primary) 1%, transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.dark a-card:not([tone]),.dark a-card[tone=neutral]{--card-bg-primary: var(--bg-4);--card-icon-bg: var(--bg-5)}@media(hover:hover)and (pointer:fine){a-card[href]:not([loading]):hover{background:oklch(from var(--card-bg) calc(l + var(--card-bg-hover-lift)) c h)}a-card:not([loading]):hover{box-shadow:0 0 0 1px var(--card-border-hover)}}a-card[href]:not([loading]):active{box-shadow:0 0 0 1px var(--card-border)}@media(prefers-reduced-motion:reduce){a-card{transition:none}}a-card:not(:defined){padding:var(--card-padding);opacity:0}a-card:not(:has(>[slot=media]))::part(media),a-card:not(:has(>[slot=header])):not(:has(>[slot=icon]))::part(header),a-card:not(:has(>[slot=icon]))::part(icon),a-card:not(:has(>[slot=footer]))::part(footer),a-card:not(:has(>:not([slot])))::part(body){display:none}a-card>a-card-icon-chip[slot=icon]{display:grid;place-items:center;width:var(--card-icon-size);height:var(--card-icon-size);border-radius:50%;background:var(--card-icon-bg)}a-card:is(:has(>[slot=header]),:has(>[slot=icon]))::part(body){padding-block-start:0}a-card:has(>[slot=footer])::part(body){padding-block-end:0}a-card :is(h1,h2,h3,h4,h5,h6),a-card a-title[level]{margin-block-start:0}a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header],a-card>a-title[slot=header]{margin-block-end:0}a-card>a-title[slot=header]+a-text[slot=header],a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:1px}a-card[size=large]>a-title[slot=header]+a-text[slot=header],a-card[size=large]>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:2px}a-card[tone=brand]{--card-text: var(--text-2-brand);--card-bg-secondary: var(--bg-4-brand);--card-bg-primary: var(--bg-2-brand);--card-border: var(--border-4-brand);--card-border-hover: var(--border-3-brand);--card-icon-bg: var(--bg-5-brand);--card-selected-ring: var(--border-1-brand)}a-card[tone=info]{--card-text: var(--text-2-info);--card-bg-secondary: var(--bg-4-info);--card-bg-primary: var(--bg-2-info);--card-border: var(--border-4-info);--card-border-hover: var(--border-3-info);--card-icon-bg: var(--bg-5-info);--card-selected-ring: var(--border-1-info)}a-card[tone=success]{--card-text: var(--text-2-success);--card-bg-secondary: var(--bg-4-success);--card-bg-primary: var(--bg-2-success);--card-border: var(--border-4-success);--card-border-hover: var(--border-3-success);--card-icon-bg: var(--bg-5-success);--card-selected-ring: var(--border-1-success)}a-card[tone=warning]{--card-text: var(--text-2-warning);--card-bg-secondary: var(--bg-4-warning);--card-bg-primary: var(--bg-2-warning);--card-border: var(--border-4-warning);--card-border-hover: var(--border-3-warning);--card-icon-bg: var(--bg-5-warning);--card-selected-ring: var(--border-1-warning)}a-card[tone=critical]{--card-text: var(--text-2-critical);--card-bg-secondary: var(--bg-4-critical);--card-bg-primary: var(--bg-2-critical);--card-border: var(--border-4-critical);--card-border-hover: var(--border-3-critical);--card-icon-bg: var(--bg-5-critical);--card-selected-ring: var(--border-1-critical)}.dark a-card[tone=brand]{--card-bg-primary: var(--bg-4-brand);--card-bg-secondary: var(--bg-2-brand)}.dark a-card[tone=info]{--card-bg-primary: var(--bg-4-info);--card-bg-secondary: var(--bg-2-info)}.dark a-card[tone=success]{--card-bg-primary: var(--bg-4-success);--card-bg-secondary: var(--bg-2-success)}.dark a-card[tone=warning]{--card-bg-primary: var(--bg-4-warning);--card-bg-secondary: var(--bg-2-warning)}.dark a-card[tone=critical]{--card-bg-primary: var(--bg-4-critical);--card-bg-secondary: var(--bg-2-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-tone-source: attr(tone type(<color>), currentColor);--card-text: oklch(from var(--card-tone-source) .41 .15 h);--card-bg-secondary: oklch(from var(--card-tone-source) .955 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .99 .006 h);--card-icon-bg: oklch(from var(--card-tone-source) .925 .03 h);--card-border: oklch(from var(--card-tone-source) .895 .045 h);--card-border-hover: oklch(from var(--card-tone-source) .85 .06 h);--card-selected-ring: oklch(from var(--card-tone-source) .6 .15 h)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-text: oklch(from var(--card-tone-source) .75 .11 h);--card-bg-secondary: oklch(from var(--card-tone-source) .13 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .19 .04 h);--card-icon-bg: oklch(from var(--card-tone-source) .22 .05 h);--card-border: oklch(from var(--card-tone-source) .26 .07 h);--card-border-hover: oklch(from var(--card-tone-source) .32 .09 h);--card-selected-ring: oklch(from var(--card-tone-source) .7 .13 h)}a-card[priority=tertiary]{--card-icon-bg: var(--bg-3)}a-card[tone=brand][priority=tertiary]{--card-icon-bg: var(--bg-3-brand)}a-card[tone=info][priority=tertiary]{--card-icon-bg: var(--bg-3-info)}a-card[tone=success][priority=tertiary]{--card-icon-bg: var(--bg-3-success)}a-card[tone=warning][priority=tertiary]{--card-icon-bg: var(--bg-3-warning)}a-card[tone=critical][priority=tertiary]{--card-icon-bg: var(--bg-3-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: oklch(from var(--card-tone-source) .97 .014 h)}.dark a-card[tone=brand][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-brand), white 10%)}.dark a-card[tone=info][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-info), white 10%)}.dark a-card[tone=success][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-success), white 10%)}.dark a-card[tone=warning][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-warning), white 10%)}.dark a-card[tone=critical][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-critical), white 10%)}.dark a-card:not([tone])[priority=tertiary],.dark a-card[tone=neutral][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5), white 10%)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: color-mix(in oklch, oklch(from var(--card-tone-source) .22 .05 h), white 10%)}@media(forced-colors:active){a-card{border:1px solid CanvasText;box-shadow:none}a-card[href]{border-color:LinkText}a-card>a-card-icon-chip[slot=icon]{box-sizing:border-box;border:1px dotted CanvasText}}a-card[size=small]{--card-padding: 8px;--card-header-nudge: 1px;--card-icon-size: 32px;--card-content-fs: 13px;--card-content-lh: 16px}a-card[size=large]{--card-padding: 16px;--card-header-nudge: 4px;--card-icon-size: 44px;--card-content-fs: 17px;--card-content-lh: 24px}}
|
|
1
|
+
@layer anta{a-card{--card-text: var(--text-2);--card-bg-secondary: var(--bg-2);--card-bg-primary: var(--bg-1);--card-bg: var(--card-bg-primary);--card-border: var(--border-4);--card-border-hover: var(--border-3);--card-selected-ring: var(--border-1);--card-bg-hover-lift: .01;--card-radius: 8px;--card-padding: 12px;--card-content-fs: 15px;--card-content-lh: 20px;--card-icon-size: 40px;--card-icon-bg: var(--bg-4);--card-header-nudge: 2px;display:block;box-sizing:border-box;position:relative;width:100%;container-type:inline-size;container-name:card;color:var(--card-text);background:var(--card-bg);box-shadow:0 0 0 1px var(--card-border);border-radius:var(--card-radius);overflow:clip;transition:background-color .15s ease,box-shadow .15s ease,opacity .18s ease}a-card[priority=secondary]{--card-bg: var(--card-bg-secondary);--card-icon-blend: multiply}.dark a-card:not([priority=tertiary]){--card-icon-blend: exclusion}a-card[round]{--card-round: attr(round type(<length>));--card-radius: var(--card-round, 999px)}a-card[priority=tertiary]{--card-bg: color-mix(in oklch, var(--card-bg-primary) 1%, transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}.dark a-card:not([tone]),.dark a-card[tone=neutral]{--card-bg-primary: var(--bg-4);--card-icon-bg: var(--bg-5)}@media(hover:hover)and (pointer:fine){a-card[href]:not([loading]):hover{background:oklch(from var(--card-bg) calc(l + var(--card-bg-hover-lift)) c h)}a-card:not([loading]):hover{box-shadow:0 0 0 1px var(--card-border-hover)}}a-card[href]:not([loading]):active{box-shadow:0 0 0 1px var(--card-border)}@media(prefers-reduced-motion:reduce){a-card{transition:none}}a-card:not(:defined){padding:var(--card-padding);opacity:0}a-card:not(:has(>[slot=media]))::part(media),a-card:not(:has(>[slot=header])):not(:has(>[slot=icon]))::part(header),a-card:not(:has(>[slot=icon]))::part(icon),a-card:not(:has(>[slot=footer]))::part(footer),a-card:not(:has(>:not([slot])))::part(body){display:none}a-card>a-card-icon-chip[slot=icon]{display:grid;place-items:center;width:var(--card-icon-size);height:var(--card-icon-size);border-radius:50%;background:var(--card-icon-bg)}a-card:is(:has(>[slot=header]),:has(>[slot=icon]))::part(body){padding-block-start:0}a-card:has(>[slot=footer])::part(body){padding-block-end:0}a-card :is(h1,h2,h3,h4,h5,h6),a-card a-title[level]{margin-block-start:0}a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header],a-card>a-title[slot=header]{margin-block-end:0}a-card>a-title[slot=header]+a-text[slot=header],a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:1px}a-card[size=large]>a-title[slot=header]+a-text[slot=header],a-card[size=large]>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:2px}a-card[tone=brand]{--card-text: var(--text-2-brand);--card-bg-secondary: var(--bg-4-brand);--card-bg-primary: var(--bg-2-brand);--card-border: var(--border-4-brand);--card-border-hover: var(--border-3-brand);--card-icon-bg: var(--bg-5-brand);--card-selected-ring: var(--border-1-brand)}a-card[tone=info]{--card-text: var(--text-2-info);--card-bg-secondary: var(--bg-4-info);--card-bg-primary: var(--bg-2-info);--card-border: var(--border-4-info);--card-border-hover: var(--border-3-info);--card-icon-bg: var(--bg-5-info);--card-selected-ring: var(--border-1-info)}a-card[tone=success]{--card-text: var(--text-2-success);--card-bg-secondary: var(--bg-4-success);--card-bg-primary: var(--bg-2-success);--card-border: var(--border-4-success);--card-border-hover: var(--border-3-success);--card-icon-bg: var(--bg-5-success);--card-selected-ring: var(--border-1-success)}a-card[tone=warning]{--card-text: var(--text-2-warning);--card-bg-secondary: var(--bg-4-warning);--card-bg-primary: var(--bg-2-warning);--card-border: var(--border-4-warning);--card-border-hover: var(--border-3-warning);--card-icon-bg: var(--bg-5-warning);--card-selected-ring: var(--border-1-warning)}a-card[tone=critical]{--card-text: var(--text-2-critical);--card-bg-secondary: var(--bg-4-critical);--card-bg-primary: var(--bg-2-critical);--card-border: var(--border-4-critical);--card-border-hover: var(--border-3-critical);--card-icon-bg: var(--bg-5-critical);--card-selected-ring: var(--border-1-critical)}.dark a-card[tone=brand]{--card-bg-primary: var(--bg-4-brand);--card-bg-secondary: var(--bg-2-brand)}.dark a-card[tone=info]{--card-bg-primary: var(--bg-4-info);--card-bg-secondary: var(--bg-2-info)}.dark a-card[tone=success]{--card-bg-primary: var(--bg-4-success);--card-bg-secondary: var(--bg-2-success)}.dark a-card[tone=warning]{--card-bg-primary: var(--bg-4-warning);--card-bg-secondary: var(--bg-2-warning)}.dark a-card[tone=critical]{--card-bg-primary: var(--bg-4-critical);--card-bg-secondary: var(--bg-2-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-tone-source: attr(tone type(<color>), currentColor);--card-text: oklch(from var(--card-tone-source) .41 .15 h);--card-bg-secondary: oklch(from var(--card-tone-source) .955 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .99 .006 h);--card-icon-bg: oklch(from var(--card-tone-source) .925 .03 h);--card-border: oklch(from var(--card-tone-source) .895 .045 h);--card-border-hover: oklch(from var(--card-tone-source) .85 .06 h);--card-selected-ring: oklch(from var(--card-tone-source) .6 .15 h)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-text: oklch(from var(--card-tone-source) .75 .11 h);--card-bg-secondary: oklch(from var(--card-tone-source) .13 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .19 .04 h);--card-icon-bg: oklch(from var(--card-tone-source) .22 .05 h);--card-border: oklch(from var(--card-tone-source) .26 .07 h);--card-border-hover: oklch(from var(--card-tone-source) .32 .09 h);--card-selected-ring: oklch(from var(--card-tone-source) .7 .13 h)}a-card[priority=tertiary]{--card-icon-bg: var(--bg-3)}a-card[tone=brand][priority=tertiary]{--card-icon-bg: var(--bg-3-brand)}a-card[tone=info][priority=tertiary]{--card-icon-bg: var(--bg-3-info)}a-card[tone=success][priority=tertiary]{--card-icon-bg: var(--bg-3-success)}a-card[tone=warning][priority=tertiary]{--card-icon-bg: var(--bg-3-warning)}a-card[tone=critical][priority=tertiary]{--card-icon-bg: var(--bg-3-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: oklch(from var(--card-tone-source) .97 .014 h)}.dark a-card[tone=brand][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-brand), white 10%)}.dark a-card[tone=info][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-info), white 10%)}.dark a-card[tone=success][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-success), white 10%)}.dark a-card[tone=warning][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-warning), white 10%)}.dark a-card[tone=critical][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-critical), white 10%)}.dark a-card:not([tone])[priority=tertiary],.dark a-card[tone=neutral][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5), white 10%)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: color-mix(in oklch, oklch(from var(--card-tone-source) .22 .05 h), white 10%)}@media(forced-colors:active){a-card{border:1px solid CanvasText;box-shadow:none}a-card[href]{border-color:LinkText}a-card>a-card-icon-chip[slot=icon]{box-sizing:border-box;border:1px dotted CanvasText}}a-card[size=small]{--card-padding: 8px;--card-header-nudge: 1px;--card-icon-size: 32px;--card-content-fs: 13px;--card-content-lh: 16px}a-card[size=large]{--card-padding: 16px;--card-header-nudge: 4px;--card-icon-size: 44px;--card-content-fs: 17px;--card-content-lh: 24px}}a-card>p:last-child,a-card>:not([slot])>p:last-child{margin-block-end:0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-dialog{--dialog-bg: var(--bg-1);--dialog-text: var(--text-2);--dialog-border: color-mix(in oklch, black 9%, transparent);--dialog-radius: 10px;--dialog-shadow: inset 0 0 0 1px var(--dialog-border), 0 1px 3px color-mix(in oklch, black 10%, transparent), 0 12px 32px color-mix(in oklch, black 22%, transparent), 0 28px 64px color-mix(in oklch, black 14%, transparent);--dialog-overlay: color-mix(in oklch, black 42%, transparent);display:contents}a-dialog[round]{--dialog-round: attr(round type(<length>), var(--dialog-radius, 10px))}a-dialog:not(:defined){display:none}.dark a-dialog{--dialog-border: color-mix(in oklch, white 14%, transparent);--dialog-shadow: inset 0 0 0 1px var(--dialog-border), 0 1px 3px color-mix(in oklch, black 40%, transparent), 0 12px 32px color-mix(in oklch, black 55%, transparent), 0 28px 64px color-mix(in oklch, black 40%, transparent);--dialog-overlay: color-mix(in oklch, black 62%, transparent)}@media(forced-colors:active){a-dialog{--dialog-outline: 1px solid CanvasText;--dialog-shadow: none}}}
|
|
1
|
+
@layer anta{a-dialog{--dialog-bg: var(--bg-1);--dialog-text: var(--text-2);--dialog-border: color-mix(in oklch, black 9%, transparent);--dialog-radius: 10px;--dialog-shadow: inset 0 0 0 1px var(--dialog-border), 0 1px 3px color-mix(in oklch, black 10%, transparent), 0 12px 32px color-mix(in oklch, black 22%, transparent), 0 28px 64px color-mix(in oklch, black 14%, transparent);--dialog-overlay: color-mix(in oklch, black 42%, transparent);display:contents}a-dialog[round]{--dialog-round: attr(round type(<length>), var(--dialog-radius, 10px))}a-dialog:not(:defined){display:none}.dark a-dialog{--dialog-border: color-mix(in oklch, white 14%, transparent);--dialog-shadow: inset 0 0 0 1px var(--dialog-border), 0 1px 3px color-mix(in oklch, black 40%, transparent), 0 12px 32px color-mix(in oklch, black 55%, transparent), 0 28px 64px color-mix(in oklch, black 40%, transparent);--dialog-overlay: color-mix(in oklch, black 62%, transparent)}@media(forced-colors:active){a-dialog{--dialog-outline: 1px solid CanvasText;--dialog-shadow: none}}}a-dialog>p:last-child,a-dialog>:not([slot])>p:last-child{margin-block-end:0}
|