@antadesign/anta 0.3.14 → 0.3.16
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 +69 -40
- package/dist/anta_helpers.d.ts +11 -1
- package/dist/anta_helpers.js +9 -0
- package/dist/components/Banner.js +1 -0
- package/dist/components/Card.js +1 -15
- package/dist/components/InputAutocomplete.js +1 -1
- package/dist/components/Select.module.css +1 -1
- package/dist/components/Switch.d.ts +68 -0
- package/dist/components/Switch.js +90 -0
- package/dist/elements/a-banner.css +1 -1
- package/dist/elements/a-banner.js +2 -7
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-card.css +1 -1
- package/dist/elements/a-checkbox.css +1 -1
- package/dist/elements/a-copy.js +45 -5
- package/dist/elements/a-dialog.css +1 -1
- package/dist/elements/a-dialog.js +1 -1
- package/dist/elements/a-expander.css +1 -1
- package/dist/elements/a-icon.css +1 -1
- package/dist/elements/a-icon.shapes.css +1 -1
- package/dist/elements/a-icon.shapes.d.ts +3 -1
- package/dist/elements/a-icon.shapes.js +4 -0
- package/dist/elements/a-input-time.css +1 -1
- package/dist/elements/a-input-time.js +1 -0
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +4 -1
- package/dist/elements/a-progress.css +1 -1
- package/dist/elements/a-progress.js +2 -0
- package/dist/elements/a-radio.css +1 -1
- package/dist/elements/a-switch.css +1 -0
- package/dist/elements/a-switch.d.ts +31 -0
- package/dist/elements/a-switch.js +109 -0
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tag.css +1 -1
- package/dist/elements/a-tooltip.css +1 -1
- package/dist/elements/index.d.ts +3 -0
- package/dist/elements/index.js +9 -0
- package/dist/general_types.d.ts +80 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/jsx-runtime.d.ts +10 -1
- package/dist/jsx-runtime.js +7 -1
- package/dist/theme-anta.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,45 +10,51 @@ One constraint shapes the architecture. Antithesis runs most of its UI in a Work
|
|
|
10
10
|
npm install @antadesign/anta # or pnpm / bun
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Pin an exact version in
|
|
13
|
+
Pin an exact version in `package.json` (`"@antadesign/anta": "0.3.16"`) instead
|
|
14
|
+
of a floating tag such as `"latest"`.
|
|
14
15
|
|
|
15
16
|
### Usage
|
|
16
17
|
|
|
17
18
|
```tsx
|
|
18
|
-
import '@antadesign/anta/tokens.css' // CSS custom properties
|
|
19
|
-
import '@antadesign/anta/reset.css' //
|
|
20
|
-
import '@antadesign/anta/elements' // registers <a
|
|
19
|
+
import '@antadesign/anta/tokens.css' // CSS custom properties
|
|
20
|
+
import '@antadesign/anta/reset.css' // reset and typography defaults
|
|
21
|
+
import '@antadesign/anta/elements' // registers <a-*> elements
|
|
21
22
|
import { Progress } from '@antadesign/anta'
|
|
22
23
|
|
|
23
|
-
<Progress value={42} label="
|
|
24
|
+
<Progress value={42} label="Uploaded" hint="3 of 7" />
|
|
24
25
|
```
|
|
25
26
|
|
|
26
27
|
### What you import (and why)
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
Tokens, elements, and the JSX layer render a styled component. The reset is
|
|
30
|
+
recommended; the reference theme is optional.
|
|
29
31
|
|
|
30
32
|
| Import | Provides | Skip if… |
|
|
31
33
|
|---|---|---|
|
|
32
|
-
| `@antadesign/anta/tokens.css` |
|
|
33
|
-
| `@antadesign/anta/reset.css` |
|
|
34
|
-
| `@antadesign/anta/elements` |
|
|
35
|
-
| `@antadesign/anta` |
|
|
36
|
-
| `@antadesign/anta/theme-anta.css` *(optional)* |
|
|
34
|
+
| `@antadesign/anta/tokens.css` | Six seed tokens, derived role scales (`--bg-1…5`, `--text-1…5`, `--border-1…5`), `.dark`, the 15px root size, and layer order. Override a seed to reskin its tone. | You provide those variables. |
|
|
35
|
+
| `@antadesign/anta/reset.css` | A small reset plus Anta's heading, list, and link typography in `@layer anta`. | You use another reset and typography. |
|
|
36
|
+
| `@antadesign/anta/elements` | Registers every `<a-*>` element and its CSS. Per-element entries register one; see [Registering elements](#registering-elements). | You render only on the server or register elements individually. |
|
|
37
|
+
| `@antadesign/anta` | Typed React/Preact wrappers such as `Progress`, `Text`, and `Icon`. | You write `<a-*>` elements directly. |
|
|
38
|
+
| `@antadesign/anta/theme-anta.css` *(optional)* | The hand-tuned reference palette. Import last to replace the seed-derived default. | You want the seed-derived or your own palette. |
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
Load `tokens.css` before element CSS. Elements read its variables; without it,
|
|
41
|
+
they render unstyled.
|
|
39
42
|
|
|
40
43
|
### Cascade layers
|
|
41
44
|
|
|
42
|
-
Anta's reset and element CSS live in `@layer anta`. `tokens.css`
|
|
45
|
+
Anta's reset and element CSS live in `@layer anta`. `tokens.css` declares
|
|
46
|
+
`@layer base, anta, components, utilities`, placing Anta above preflight resets
|
|
47
|
+
and below your component and utility layers.
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
To change that order, declare it in CSS loaded **before** `tokens.css`. The
|
|
50
|
+
first declaration fixes a layer's position:
|
|
45
51
|
|
|
46
52
|
```css
|
|
47
53
|
/* your global.css, loaded before anta */
|
|
48
54
|
@layer reset, anta, my-components, utilities;
|
|
49
55
|
```
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
Token custom properties stay unlayered so they apply everywhere.
|
|
52
58
|
|
|
53
59
|
> **Gotcha: an unlayered hard reset defeats Anta's element rules.**
|
|
54
60
|
>
|
|
@@ -57,26 +63,32 @@ CSS custom properties (the `:root { --… }` declarations in `tokens.css`) stay
|
|
|
57
63
|
> * { margin: 0; }
|
|
58
64
|
> ```
|
|
59
65
|
>
|
|
60
|
-
> Unlayered styles beat layered ones regardless of specificity
|
|
66
|
+
> Unlayered styles beat layered ones regardless of specificity. This reset
|
|
67
|
+
> overrides Anta's element defaults. Delete the duplicate, or put your reset in
|
|
68
|
+
> `@layer base { … }`; `reset.css` already applies the same universal reset in
|
|
69
|
+
> `@layer anta`.
|
|
61
70
|
|
|
62
71
|
## Registering elements
|
|
63
72
|
|
|
64
|
-
|
|
73
|
+
JSX wrappers render `<a-*>` tags. Register their classes before those tags reach
|
|
74
|
+
the DOM. Registration needs `HTMLElement`, so the import is a no-op in Node.js
|
|
75
|
+
and Worker threads.
|
|
65
76
|
|
|
66
77
|
```ts
|
|
67
78
|
import '@antadesign/anta/elements' // auto-registers all elements
|
|
68
79
|
```
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
`/elements` registers everything. Per-element entries register one element and
|
|
82
|
+
load only its CSS:
|
|
71
83
|
|
|
72
84
|
```ts
|
|
73
85
|
import '@antadesign/anta/elements/a-tooltip' // only <a-tooltip> + its CSS
|
|
74
86
|
import '@antadesign/anta/elements/a-button' // only <a-button> + its CSS
|
|
75
87
|
```
|
|
76
88
|
|
|
77
|
-
Both
|
|
89
|
+
Both are idempotent, side-effect imports and safe during SSR.
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
Use a static import in your app entry, outside components and hooks:
|
|
80
92
|
|
|
81
93
|
```ts
|
|
82
94
|
// src/main.tsx (or wherever your root render lives)
|
|
@@ -86,18 +98,22 @@ import App from './App'
|
|
|
86
98
|
createRoot(document.getElementById('root')!).render(<App />)
|
|
87
99
|
```
|
|
88
100
|
|
|
89
|
-
|
|
101
|
+
Module initialisation registers the classes before the first render, avoiding a
|
|
102
|
+
flash of un-upgraded elements.
|
|
90
103
|
|
|
91
104
|
> **Why not `useEffect(() => import('@antadesign/anta/elements'), [])`?**
|
|
92
|
-
> `useEffect`
|
|
105
|
+
> `useEffect` runs after paint and the import resolves later. The browser can
|
|
106
|
+
> paint unregistered elements first. `useLayoutEffect` is still asynchronous and
|
|
107
|
+
> warns during SSR hydration.
|
|
93
108
|
|
|
94
|
-
|
|
109
|
+
Choose the entry point for your runtime:
|
|
95
110
|
|
|
96
|
-
**Plain HTML
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
**
|
|
111
|
+
- **Plain HTML or static sites:** a `<script type="module">` in the document head.
|
|
112
|
+
- **Astro or Next.js:** a client-only script. In Astro, use
|
|
113
|
+
`<script>import '@antadesign/anta/elements'</script>`; in Next.js, import it
|
|
114
|
+
from a `'use client'` file.
|
|
115
|
+
- **Worker-rendered UI:** the UI-thread bootstrap that owns the DOM. A Worker
|
|
116
|
+
has no `HTMLElement`.
|
|
101
117
|
|
|
102
118
|
## Framework setup
|
|
103
119
|
|
|
@@ -107,7 +123,7 @@ Works out of the box.
|
|
|
107
123
|
|
|
108
124
|
### Preact with compat
|
|
109
125
|
|
|
110
|
-
If your bundler aliases `react`
|
|
126
|
+
If your bundler aliases `react` to `preact/compat`, Anta works without setup.
|
|
111
127
|
|
|
112
128
|
### Preact without compat
|
|
113
129
|
|
|
@@ -121,17 +137,21 @@ configure(h, Fragment)
|
|
|
121
137
|
|
|
122
138
|
### TypeScript: typing raw `<a-*>` tags in JSX
|
|
123
139
|
|
|
124
|
-
|
|
140
|
+
JSX wrappers such as `<Button>` and `<Progress>` need no extra typing. Configure
|
|
141
|
+
JSX only when you write raw `<a-*>` tags.
|
|
125
142
|
|
|
126
|
-
**Option A (preferred)** — point
|
|
143
|
+
**Option A (preferred)** — point JSX types at Anta in `tsconfig.json`:
|
|
127
144
|
|
|
128
145
|
```jsonc
|
|
129
146
|
{ "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "@antadesign/anta" } }
|
|
130
147
|
```
|
|
131
148
|
|
|
132
|
-
Every `a-*` tag type-checks,
|
|
149
|
+
Every `a-*` tag type-checks, standard HTML tags keep working, and importing
|
|
150
|
+
`@antadesign/stickers` adds its tags automatically.
|
|
133
151
|
|
|
134
|
-
**Option B** — if
|
|
152
|
+
**Option B** — if `jsxImportSource` cannot change, merge Anta's tag map into
|
|
153
|
+
your JSX namespace with `AntaIntrinsicElements` (and `StickerIntrinsicElements`
|
|
154
|
+
when needed):
|
|
135
155
|
|
|
136
156
|
```ts
|
|
137
157
|
import type { AntaIntrinsicElements } from '@antadesign/anta'
|
|
@@ -144,7 +164,8 @@ declare global {
|
|
|
144
164
|
}
|
|
145
165
|
```
|
|
146
166
|
|
|
147
|
-
|
|
167
|
+
With `@types/react` 18+ and `jsx: "react-jsx"`, JSX is module-scoped. Extend
|
|
168
|
+
the `react` module instead:
|
|
148
169
|
|
|
149
170
|
```ts
|
|
150
171
|
import type { AntaIntrinsicElements } from '@antadesign/anta'
|
|
@@ -156,11 +177,13 @@ declare module 'react' {
|
|
|
156
177
|
}
|
|
157
178
|
```
|
|
158
179
|
|
|
159
|
-
|
|
180
|
+
Both options reject unknown tags and invalid props. New tags arrive with Anta
|
|
181
|
+
upgrades; there is no per-tag list to maintain.
|
|
160
182
|
|
|
161
183
|
### Raw web components (no JSX)
|
|
162
184
|
|
|
163
|
-
|
|
185
|
+
Elements also work in plain HTML. Registration loads their CSS; resolve the bare
|
|
186
|
+
specifier with a bundler or import map.
|
|
164
187
|
|
|
165
188
|
```html
|
|
166
189
|
<script type="module">
|
|
@@ -182,7 +205,7 @@ Add the `dark` class to any ancestor element:
|
|
|
182
205
|
|
|
183
206
|
## Fonts
|
|
184
207
|
|
|
185
|
-
Anta is designed for a customized <a href="https://typetype.org/fonts/tt-interphases-pro" target="_blank" rel="noopener noreferrer">TT Interphases Pro</a
|
|
208
|
+
Anta is designed for a customized <a href="https://typetype.org/fonts/tt-interphases-pro" target="_blank" rel="noopener noreferrer">TT Interphases Pro</a>, but ships no font binaries. Components use `--sans-serif` and `--monospace` with system fallbacks. `tokens.css` sets a 15px root size (`1rem = 15px`).
|
|
186
209
|
|
|
187
210
|
To use the Antithesis fonts, register your own `@font-face` declarations and override the variables:
|
|
188
211
|
|
|
@@ -201,7 +224,7 @@ To use the Antithesis fonts, register your own `@font-face` declarations and ove
|
|
|
201
224
|
|
|
202
225
|
## Browser support
|
|
203
226
|
|
|
204
|
-
Anta targets evergreen browsers and ships **no polyfills
|
|
227
|
+
Anta targets evergreen browsers and ships **no baseline polyfills or feature detection**. Its floor is the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API), used by `<a-menu>` and `<a-tooltip>`:
|
|
205
228
|
|
|
206
229
|
| Browser | Minimum version |
|
|
207
230
|
| --- | --- |
|
|
@@ -209,6 +232,12 @@ Anta targets evergreen browsers and ships **no polyfills and no feature detectio
|
|
|
209
232
|
| Safari | 17 (Sep 2023) |
|
|
210
233
|
| Firefox | 125 (Apr 2024) |
|
|
211
234
|
|
|
212
|
-
This
|
|
235
|
+
This is roughly [Baseline 2024](https://web.dev/baseline). Anta also relies on
|
|
236
|
+
relative OKLCH, `:has()`, `dvh`, cascade layers, and constructable shadow DOM.
|
|
237
|
+
Older browsers can fail hard, including `showPopover()` throwing. Gate Anta on
|
|
238
|
+
your own support matrix when you support older browsers.
|
|
213
239
|
|
|
214
|
-
Two features
|
|
240
|
+
Two features progressively enhance with fallbacks: `checkVisibility()` falls
|
|
241
|
+
back to `getClientRects()`, and typed CSS `attr()` supports raw
|
|
242
|
+
`<a-icon size>` in Chrome 133+ and Safari 18.2+. Elsewhere use `<Icon size>`
|
|
243
|
+
or `--icon-size`.
|
package/dist/anta_helpers.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function wrapLabel(kids: React.ReactNode, tag: string): React.Rea
|
|
|
34
34
|
* `CustomEvent` in a synthetic event (`.nativeEvent`); Preact passes it directly. `D`
|
|
35
35
|
* is the per-component `detail` vocabulary. Pair with `nativeStateChange` to unwrap.
|
|
36
36
|
* Exported so the stateful wrappers (`Banner`, and future ones) don't each re-declare
|
|
37
|
-
* this union — the
|
|
37
|
+
* this union — the AGENTS.md "reuse shared wrapper helpers" rule.
|
|
38
38
|
*/
|
|
39
39
|
export type StateChangeEvent<D> = CustomEvent<D> | {
|
|
40
40
|
nativeEvent: CustomEvent<D>;
|
|
@@ -54,6 +54,16 @@ export declare const ISOLATE_HINT: string;
|
|
|
54
54
|
* `'open'` is `'closed'`, so an absent / malformed attribute reads closed. Kept
|
|
55
55
|
* here so the two elements can't drift on how the token is parsed. */
|
|
56
56
|
export declare function parseOpenState(v: string | null): 'open' | 'closed';
|
|
57
|
+
/** Install a delegated "dismiss from an action" click handler: any element inside
|
|
58
|
+
* `host` carrying `[attr]` runs `onDismiss` on click, scoped to the nearest host
|
|
59
|
+
* of `host`'s own tag (so a control inside a nested same-tag element doesn't also
|
|
60
|
+
* dismiss the outer one). A read-only light-DOM walk — no host / tree mutation —
|
|
61
|
+
* that catches any activated control (native `<button>`, `<a>`, `<a-button>`,
|
|
62
|
+
* `<a-menu-item>`) with keyboard activation for free. Shared by `a-toast`
|
|
63
|
+
* (`data-toast-dismiss`) and `a-banner` (`data-banner-dismiss`), mirroring
|
|
64
|
+
* `a-dialog`'s `data-dialog-close` family; keep the one copy here so a future fix
|
|
65
|
+
* (e.g. skipping `[disabled]` triggers) lands for every element at once. */
|
|
66
|
+
export declare function installDismissTrigger(host: HTMLElement, attr: string, onDismiss: () => void): void;
|
|
57
67
|
/** The six named tones every toned component shares. Anything else is a literal
|
|
58
68
|
* CSS colour the element resolves through its `--{component}-tone-source` var. */
|
|
59
69
|
export declare const NAMED_TONES: Set<string>;
|
package/dist/anta_helpers.js
CHANGED
|
@@ -21,6 +21,14 @@ const ISOLATE_HINT = IS_MAC ? "\u2325+Click to select only this" : "Alt+Click to
|
|
|
21
21
|
function parseOpenState(v) {
|
|
22
22
|
return v === "open" ? "open" : "closed";
|
|
23
23
|
}
|
|
24
|
+
function installDismissTrigger(host, attr, onDismiss) {
|
|
25
|
+
host.addEventListener("click", (e) => {
|
|
26
|
+
const target = e.target;
|
|
27
|
+
if (!(target instanceof Element)) return;
|
|
28
|
+
const trigger = target.closest(`[${attr}]`);
|
|
29
|
+
if (trigger && trigger.closest(host.localName) === host) onDismiss();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
24
32
|
const NAMED_TONES = /* @__PURE__ */ new Set([
|
|
25
33
|
"brand",
|
|
26
34
|
"neutral",
|
|
@@ -138,6 +146,7 @@ export {
|
|
|
138
146
|
SelectableChildElement,
|
|
139
147
|
anchorRect,
|
|
140
148
|
hasChildren,
|
|
149
|
+
installDismissTrigger,
|
|
141
150
|
isInsideOpenMenu,
|
|
142
151
|
isMenuOpen,
|
|
143
152
|
nativeStateChange,
|
package/dist/components/Card.js
CHANGED
|
@@ -57,21 +57,7 @@ const Card = ({
|
|
|
57
57
|
(typeof icon === "string" ? (
|
|
58
58
|
// A shape string → the icon centered in a circular chip, sized per the
|
|
59
59
|
// card via --card-icon-size (32 / 40 / 44 for small / medium / large).
|
|
60
|
-
/* @__PURE__ */ jsx(
|
|
61
|
-
"div",
|
|
62
|
-
{
|
|
63
|
-
slot: "icon",
|
|
64
|
-
style: {
|
|
65
|
-
width: "var(--card-icon-size, 40px)",
|
|
66
|
-
height: "var(--card-icon-size, 40px)",
|
|
67
|
-
borderRadius: "50%",
|
|
68
|
-
background: "var(--card-icon-bg)",
|
|
69
|
-
display: "grid",
|
|
70
|
-
placeItems: "center"
|
|
71
|
-
},
|
|
72
|
-
children: /* @__PURE__ */ jsx(Icon, { shape: icon })
|
|
73
|
-
}
|
|
74
|
-
)
|
|
60
|
+
/* @__PURE__ */ jsx("a-card-icon-chip", { slot: "icon", children: /* @__PURE__ */ jsx(Icon, { shape: icon }) })
|
|
75
61
|
) : (
|
|
76
62
|
// Any node → used as-is (no chip).
|
|
77
63
|
/* @__PURE__ */ jsx("div", { slot: "icon", children: icon })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.chevron{
|
|
1
|
+
.chevron{transition:transform .15s ease}.chevron.open{transform:rotate(180deg)}.filter{padding:4px 4px 0}.footer{padding:var(--menu-padding, 4px);border-top:1px solid var(--border-4)}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { BaseProps } from "../general_types";
|
|
2
|
+
type SwitchState = 'checked' | 'unchecked';
|
|
3
|
+
type StateDetail = {
|
|
4
|
+
next: SwitchState;
|
|
5
|
+
prev: SwitchState;
|
|
6
|
+
};
|
|
7
|
+
type StateChangeEvent = CustomEvent<StateDetail>;
|
|
8
|
+
/** Snapshot passed to `onValueChange` after the switch's value changes. */
|
|
9
|
+
export interface SwitchChangeAttrs {
|
|
10
|
+
checked: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SwitchProps extends BaseProps {
|
|
15
|
+
/** Visible, stable label for the setting. Use `children` for richer label content. */
|
|
16
|
+
label?: string;
|
|
17
|
+
/** Secondary text rendered under the label. It does not become part of the
|
|
18
|
+
* accessible name. */
|
|
19
|
+
hint?: React.ReactNode;
|
|
20
|
+
/** Controlled checked value. In controlled mode, update this in `onStateChange`. */
|
|
21
|
+
checked?: boolean;
|
|
22
|
+
/** Initial checked value for an uncontrolled switch.
|
|
23
|
+
* @defaultValue false */
|
|
24
|
+
defaultChecked?: boolean;
|
|
25
|
+
/** Disables interaction and removes the switch from the tab order. */
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/** Fully round the thumb and track. Pass a `number` (px) or CSS length string
|
|
28
|
+
* for a custom track radius; the thumb radius is 3px smaller. */
|
|
29
|
+
round?: boolean | number | string;
|
|
30
|
+
/** Form field name. A checked switch submits `value` under this name. */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Value submitted while checked.
|
|
33
|
+
* @defaultValue "on" */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Colour of the track and thumb. A tinted tone also colours the unchecked
|
|
36
|
+
* track border and thumb; use `toneSelected` to colour only the checked track.
|
|
37
|
+
* @defaultValue 'brand' */
|
|
38
|
+
tone?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
39
|
+
/** Like `tone`, but applies only while the switch is checked. The unchecked
|
|
40
|
+
* track and thumb stay neutral. If both are set, `tone` colours the unchecked
|
|
41
|
+
* state and `toneSelected` colours the checked track.
|
|
42
|
+
* @defaultValue 'brand' */
|
|
43
|
+
toneSelected?: 'brand' | 'neutral' | 'info' | 'success' | 'warning' | 'critical' | (string & {});
|
|
44
|
+
/** Size variant. small=26×16px, medium=30×18px, large=34×20px.
|
|
45
|
+
* @defaultValue 'medium' */
|
|
46
|
+
size?: 'small' | 'medium' | 'large';
|
|
47
|
+
/** Put the visible label before or after the control. Grid layout changes only
|
|
48
|
+
* the visual order, preserving DOM/source order for assistive technologies.
|
|
49
|
+
* @defaultValue 'end' */
|
|
50
|
+
labelPosition?: 'start' | 'end';
|
|
51
|
+
/** Fired before a user toggle applies. Call `event.preventDefault()` to veto an
|
|
52
|
+
* uncontrolled change; controlled consumers accept by updating `checked`. */
|
|
53
|
+
onStateChange?: (event: StateChangeEvent, detail: {
|
|
54
|
+
next: boolean;
|
|
55
|
+
prev: boolean;
|
|
56
|
+
}) => void;
|
|
57
|
+
/** Native post-apply `change` event. */
|
|
58
|
+
onChange?: (event: Event) => void;
|
|
59
|
+
/** Post-apply callback with the new form-relevant value snapshot. */
|
|
60
|
+
onValueChange?: (event: Event, attrs: SwitchChangeAttrs) => void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Switch — a binary control for a setting that takes effect immediately. It is
|
|
64
|
+
* form-associated and can be controlled with `checked` or left uncontrolled with
|
|
65
|
+
* `defaultChecked`. Requires `@antadesign/anta/elements` on the client.
|
|
66
|
+
*/
|
|
67
|
+
export declare const Switch: ({ checked, defaultChecked, disabled, tone, toneSelected, size, round, labelPosition, onStateChange, onChange, onValueChange, label, hint, className, style, children, tabIndex, ...rest }: SwitchProps) => any;
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
import { nativeStateChange, toneStyle, roundStyle, roundAttr } from "../anta_helpers";
|
|
3
|
+
const switchAttrsOf = (element) => ({
|
|
4
|
+
checked: !!element?.checked,
|
|
5
|
+
name: element?.getAttribute?.("name") ?? void 0,
|
|
6
|
+
value: element?.getAttribute?.("value") ?? "on"
|
|
7
|
+
});
|
|
8
|
+
const Switch = ({
|
|
9
|
+
checked,
|
|
10
|
+
defaultChecked,
|
|
11
|
+
disabled,
|
|
12
|
+
tone,
|
|
13
|
+
toneSelected,
|
|
14
|
+
size,
|
|
15
|
+
round,
|
|
16
|
+
labelPosition,
|
|
17
|
+
onStateChange,
|
|
18
|
+
onChange,
|
|
19
|
+
onValueChange,
|
|
20
|
+
label,
|
|
21
|
+
hint,
|
|
22
|
+
className,
|
|
23
|
+
style,
|
|
24
|
+
children,
|
|
25
|
+
tabIndex,
|
|
26
|
+
...rest
|
|
27
|
+
}) => {
|
|
28
|
+
const computedStyle = roundStyle(
|
|
29
|
+
round,
|
|
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
|
+
)
|
|
40
|
+
);
|
|
41
|
+
const explicitAriaLabel = rest["aria-label"];
|
|
42
|
+
const ariaLabel = (typeof explicitAriaLabel === "string" ? explicitAriaLabel : void 0) ?? label ?? (typeof children === "string" ? children : void 0);
|
|
43
|
+
const onstatechange = onStateChange ? (event) => {
|
|
44
|
+
const { event: nativeEvent, detail } = nativeStateChange(event);
|
|
45
|
+
if (!detail) return;
|
|
46
|
+
onStateChange(nativeEvent, {
|
|
47
|
+
next: detail.next === "checked",
|
|
48
|
+
prev: detail.prev === "checked"
|
|
49
|
+
});
|
|
50
|
+
} : void 0;
|
|
51
|
+
const onchange = onChange || onValueChange ? (event) => {
|
|
52
|
+
onChange?.(event);
|
|
53
|
+
onValueChange?.(event, switchAttrsOf(event.currentTarget));
|
|
54
|
+
} : void 0;
|
|
55
|
+
const stateAttr = checked === void 0 ? void 0 : checked ? "checked" : "unchecked";
|
|
56
|
+
const defaultStateAttr = checked === void 0 && defaultChecked !== void 0 ? defaultChecked ? "checked" : "unchecked" : void 0;
|
|
57
|
+
const hasLabel = label != null || children != null;
|
|
58
|
+
return /* @__PURE__ */ jsxs(
|
|
59
|
+
"a-switch",
|
|
60
|
+
{
|
|
61
|
+
role: "switch",
|
|
62
|
+
"aria-disabled": disabled ? "true" : void 0,
|
|
63
|
+
"aria-label": ariaLabel,
|
|
64
|
+
...rest,
|
|
65
|
+
state: stateAttr,
|
|
66
|
+
"default-state": defaultStateAttr,
|
|
67
|
+
disabled: disabled ? "" : void 0,
|
|
68
|
+
tone,
|
|
69
|
+
"tone-selected": toneSelected,
|
|
70
|
+
size: size && size !== "medium" ? size : void 0,
|
|
71
|
+
round: roundAttr(round),
|
|
72
|
+
"label-position": labelPosition && labelPosition !== "end" ? labelPosition : void 0,
|
|
73
|
+
tabIndex: disabled ? -1 : tabIndex ?? 0,
|
|
74
|
+
onstatechange,
|
|
75
|
+
onchange,
|
|
76
|
+
class: className,
|
|
77
|
+
style: computedStyle,
|
|
78
|
+
children: [
|
|
79
|
+
hasLabel && /* @__PURE__ */ jsxs("a-switch-label", { children: [
|
|
80
|
+
label,
|
|
81
|
+
children
|
|
82
|
+
] }),
|
|
83
|
+
hint != null && /* @__PURE__ */ jsx("a-switch-hint", { children: hint })
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
export {
|
|
89
|
+
Switch
|
|
90
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-banner{--banner-bg: var(--bg-4);--banner-border: var(--border-4);--banner-text: var(--text-2);display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px 1ch;position:relative;box-sizing:border-box;width:100%;min-height:40px;padding:6px 52px;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[round]{--banner-round: attr(round type(<length>));border-radius:var(--banner-round, 999px)}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: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: attr(tone type(<color>), currentColor);--banner-text: oklch(from var(--banner-tone-source) .5 .125 h);--banner-bg: oklch(from var(--banner-tone-source) .955 .02 h);--banner-border: oklch(from var(--banner-tone-source) .9 .04 h);.dark &{--banner-text: oklch(from var(--banner-tone-source) .77 .11 h);--banner-bg: oklch(from var(--banner-tone-source) .185 .05 h);--banner-border: oklch(from var(--banner-tone-source) .26 .06 h)}}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(prefers-reduced-motion:reduce){a-banner{transition:none}}}
|
|
1
|
+
@layer anta{a-banner{--banner-bg: var(--bg-4);--banner-border: var(--border-4);--banner-text: var(--text-2);display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:4px 1ch;position:relative;box-sizing:border-box;width:100%;min-height:40px;padding:6px 52px;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[round]{--banner-round: attr(round type(<length>));border-radius:var(--banner-round, 999px)}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: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: attr(tone type(<color>), currentColor);--banner-text: oklch(from var(--banner-tone-source) .5 .125 h);--banner-bg: oklch(from var(--banner-tone-source) .955 .02 h);--banner-border: oklch(from var(--banner-tone-source) .9 .04 h);.dark &{--banner-text: oklch(from var(--banner-tone-source) .77 .11 h);--banner-bg: oklch(from var(--banner-tone-source) .185 .05 h);--banner-border: oklch(from var(--banner-tone-source) .26 .06 h)}}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}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLElementBase, parseOpenState } from "../anta_helpers";
|
|
1
|
+
import { HTMLElementBase, installDismissTrigger, parseOpenState } from "../anta_helpers";
|
|
2
2
|
import "./a-banner.css";
|
|
3
3
|
const DISMISS_TRIGGER = "dismissrequest";
|
|
4
4
|
const DISMISS_ATTR = "data-banner-dismiss";
|
|
@@ -65,12 +65,7 @@ class ABannerElement extends HTMLElementBase {
|
|
|
65
65
|
e.stopPropagation();
|
|
66
66
|
this.#requestDismiss();
|
|
67
67
|
});
|
|
68
|
-
this
|
|
69
|
-
const target = e.target;
|
|
70
|
-
if (!(target instanceof Element)) return;
|
|
71
|
-
const trigger = target.closest(`[${DISMISS_ATTR}]`);
|
|
72
|
-
if (trigger && trigger.closest("a-banner") === this) this.#requestDismiss();
|
|
73
|
-
});
|
|
68
|
+
installDismissTrigger(this, DISMISS_ATTR, () => this.#requestDismiss());
|
|
74
69
|
}
|
|
75
70
|
/** Controlled mode: the `state` attribute is present and owns visibility. */
|
|
76
71
|
get #controlled() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-button,a[role=button][data-anta],button[data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--_src: var(--anta-seed-neutral);--_tone-pl-rest: .5;--_tone-pl-hover: .45;--_tone-pl-active: .4;--_tone-pl-c: .02;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .008;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .03;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85;--button-bg-primary-rest: oklch(from var(--_src) var(--_tone-pl-rest) var(--_tone-pl-c) h);--button-bg-primary-hover: oklch(from var(--_src) var(--_tone-pl-hover) var(--_tone-pl-c) h);--button-bg-primary-active: oklch(from var(--_src) var(--_tone-pl-active) var(--_tone-pl-c) h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-secondary-l-shift: var(--_tone-fg-shift);--button-fg-tertiary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-tertiary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-tertiary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-fg-quaternary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h / var(--_tone-quat-rest-a));--button-fg-quaternary-hover: oklch(from var(--_src) var(--_tone-quat-hover-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-secondary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-bg-secondary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-active));--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone]:not([tone=""],[tone=neutral]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),button[data-anta][tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .51;--_tone-pl-hover: .46;--_tone-pl-active: .41;--_tone-pl-c: .17;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .17;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand]{--_src: var(--anta-seed-brand)}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info]{--_src: var(--anta-seed-info)}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success]{--_src: var(--anta-seed-success)}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning]{--_src: var(--anta-seed-warning)}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical]{--_src: var(--anta-seed-critical)}a-button[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),button[data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_src: var(--button-tone-source, attr(tone type(<color>), transparent))}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .015;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .015;--_tone-fg-shift: 0;--_tone-bg-l: .44;--_tone-bg-c: .01;--_tone-a-rest: .24;--_tone-a-hover: .34;--_tone-a-active: .44;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}.dark a-button[tone]:not([tone=""],[tone=neutral]),.dark a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),.dark button[data-anta][tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .16;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .13;--_tone-fg-shift: 0;--_tone-bg-l: .58;--_tone-bg-c: .16;--_tone-a-rest: .215;--_tone-a-hover: .29;--_tone-a-active: .34;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}button[data-anta]{box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;&:has(>a-copy):not(:has(>a-icon)){cursor:copy}flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip):not(a-copy))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&:active{--button-fg: var(--button-fg-quaternary-rest)}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
|
|
1
|
+
@layer anta{a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--_src: var(--anta-seed-neutral);--_tone-pl-rest: .5;--_tone-pl-hover: .45;--_tone-pl-active: .4;--_tone-pl-c: .02;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .008;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .03;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85;--button-bg-primary-rest: oklch(from var(--_src) var(--_tone-pl-rest) var(--_tone-pl-c) h);--button-bg-primary-hover: oklch(from var(--_src) var(--_tone-pl-hover) var(--_tone-pl-c) h);--button-bg-primary-active: oklch(from var(--_src) var(--_tone-pl-active) var(--_tone-pl-c) h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-secondary-l-shift: var(--_tone-fg-shift);--button-fg-tertiary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--_src) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-tertiary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-tertiary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-fg-quaternary-rest: oklch(from var(--_src) var(--_tone-fg-l) var(--_tone-fg-c) h / var(--_tone-quat-rest-a));--button-fg-quaternary-hover: oklch(from var(--_src) var(--_tone-quat-hover-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-rest));--button-bg-secondary-hover: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-hover));--button-bg-secondary-active: oklch(from var(--_src) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-a-active));--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round],button[data-anta][round],input[data-anta]:is([type=reset],[type=submit])[round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone]:not([tone=""],[tone=neutral]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),button[data-anta][tone]:not([tone=""],[tone=neutral]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .51;--_tone-pl-hover: .46;--_tone-pl-active: .41;--_tone-pl-c: .17;--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-fg-shift: .05;--_tone-bg-l: .54;--_tone-bg-c: .17;--_tone-a-rest: .1;--_tone-a-hover: .15;--_tone-a-active: .2;--_tone-quat-hover-l: .38;--_tone-quat-rest-a: .85}a-button[tone=brand],a[role=button][data-anta][tone=brand],button[data-anta][tone=brand],input[data-anta]:is([type=reset],[type=submit])[tone=brand]{--_src: var(--anta-seed-brand)}a-button[tone=info],a[role=button][data-anta][tone=info],button[data-anta][tone=info],input[data-anta]:is([type=reset],[type=submit])[tone=info]{--_src: var(--anta-seed-info)}a-button[tone=success],a[role=button][data-anta][tone=success],button[data-anta][tone=success],input[data-anta]:is([type=reset],[type=submit])[tone=success]{--_src: var(--anta-seed-success)}a-button[tone=warning],a[role=button][data-anta][tone=warning],button[data-anta][tone=warning],input[data-anta]:is([type=reset],[type=submit])[tone=warning]{--_src: var(--anta-seed-warning)}a-button[tone=critical],a[role=button][data-anta][tone=critical],button[data-anta][tone=critical],input[data-anta]:is([type=reset],[type=submit])[tone=critical]{--_src: var(--anta-seed-critical)}a-button[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),a[role=button][data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),button[data-anta][tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]),input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--_src: var(--button-tone-source, attr(tone type(<color>), transparent))}.dark a-button,.dark a[role=button][data-anta],.dark button[data-anta],.dark input[data-anta]:is([type=reset],[type=submit]){--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .015;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .015;--_tone-fg-shift: 0;--_tone-bg-l: .44;--_tone-bg-c: .01;--_tone-a-rest: .24;--_tone-a-hover: .34;--_tone-a-active: .44;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}.dark a-button[tone]:not([tone=""],[tone=neutral]),.dark a[role=button][data-anta][tone]:not([tone=""],[tone=neutral]),.dark button[data-anta][tone]:not([tone=""],[tone=neutral]),.dark input[data-anta]:is([type=reset],[type=submit])[tone]:not([tone=""],[tone=neutral]){--_tone-pl-rest: .4;--_tone-pl-hover: .44;--_tone-pl-active: .48;--_tone-pl-c: .16;--_tone-fg-l: .86;--_tone-fg-strong-l: .86;--_tone-fg-c: .13;--_tone-fg-shift: 0;--_tone-bg-l: .58;--_tone-bg-c: .16;--_tone-a-rest: .215;--_tone-a-hover: .29;--_tone-a-active: .34;--_tone-quat-hover-l: .9;--_tone-quat-rest-a: .85}button[data-anta],input[data-anta]:is([type=reset],[type=submit]){box-sizing:border-box;margin:0;appearance:none;-webkit-appearance:none;border:none}a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]){user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;&:has(>a-copy):not(:has(>a-icon)){cursor:copy}flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:100%;padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip):not(a-copy))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip):not(a-copy))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active{--button-bg: var(--button-bg-primary-active)}&[selected]{--button-bg: var(--button-bg-primary-hover)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&:active{--button-fg: var(--button-fg-quaternary-rest)}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{box-shadow:inset 0 0 0 .5px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}@media(forced-colors:active){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit])){--anta-forced-foreground: ButtonText;color:ButtonText;background-color:ButtonFace;border:1px solid ButtonText;box-shadow:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=primary]{--anta-forced-foreground: ButtonFace;color:ButtonFace;background-color:ButtonText;border-color:ButtonText}a-button:is([priority=primary],[selected]){forced-color-adjust:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]{--anta-forced-foreground: CanvasText;color:CanvasText;background-color:Canvas;border:0}@media(hover:hover)and (pointer:fine){:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=tertiary]:hover:not(:focus-visible){outline:1px solid ButtonText;outline-offset:0}}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[priority=quaternary]{--anta-forced-foreground: LinkText;color:LinkText;background-color:ButtonFace;border:0;text-decoration:none}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[selected]{--anta-forced-foreground: HighlightText;color:HighlightText;background-color:Highlight;border-color:Highlight}:is(a-button,a[role=button][data-anta],button[data-anta],input[data-anta]:is([type=reset],[type=submit]))[disabled]{--anta-forced-foreground: GrayText;color:GrayText;background-color:Canvas;border-color:GrayText;text-decoration-color:GrayText}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
|
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:is(:has(>[slot=header]),:has(>[slot=icon]))::part(body){padding-block-start:0}a-card:has(>[slot=footer])::part(body){padding-block-end:0}a-card :is(h1,h2,h3,h4,h5,h6),a-card a-title[level]{margin-block-start:0}a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header],a-card>a-title[slot=header]{margin-block-end:0}a-card>a-title[slot=header]+a-text[slot=header],a-card>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:1px}a-card[size=large]>a-title[slot=header]+a-text[slot=header],a-card[size=large]>:is(h1,h2,h3,h4,h5,h6)[slot=header]+a-text[slot=header]{margin-block-start:2px}a-card[tone=brand]{--card-text: var(--text-2-brand);--card-bg-secondary: var(--bg-4-brand);--card-bg-primary: var(--bg-2-brand);--card-border: var(--border-4-brand);--card-border-hover: var(--border-3-brand);--card-icon-bg: var(--bg-5-brand);--card-selected-ring: var(--border-1-brand)}a-card[tone=info]{--card-text: var(--text-2-info);--card-bg-secondary: var(--bg-4-info);--card-bg-primary: var(--bg-2-info);--card-border: var(--border-4-info);--card-border-hover: var(--border-3-info);--card-icon-bg: var(--bg-5-info);--card-selected-ring: var(--border-1-info)}a-card[tone=success]{--card-text: var(--text-2-success);--card-bg-secondary: var(--bg-4-success);--card-bg-primary: var(--bg-2-success);--card-border: var(--border-4-success);--card-border-hover: var(--border-3-success);--card-icon-bg: var(--bg-5-success);--card-selected-ring: var(--border-1-success)}a-card[tone=warning]{--card-text: var(--text-2-warning);--card-bg-secondary: var(--bg-4-warning);--card-bg-primary: var(--bg-2-warning);--card-border: var(--border-4-warning);--card-border-hover: var(--border-3-warning);--card-icon-bg: var(--bg-5-warning);--card-selected-ring: var(--border-1-warning)}a-card[tone=critical]{--card-text: var(--text-2-critical);--card-bg-secondary: var(--bg-4-critical);--card-bg-primary: var(--bg-2-critical);--card-border: var(--border-4-critical);--card-border-hover: var(--border-3-critical);--card-icon-bg: var(--bg-5-critical);--card-selected-ring: var(--border-1-critical)}.dark a-card[tone=brand]{--card-bg-primary: var(--bg-4-brand);--card-bg-secondary: var(--bg-2-brand)}.dark a-card[tone=info]{--card-bg-primary: var(--bg-4-info);--card-bg-secondary: var(--bg-2-info)}.dark a-card[tone=success]{--card-bg-primary: var(--bg-4-success);--card-bg-secondary: var(--bg-2-success)}.dark a-card[tone=warning]{--card-bg-primary: var(--bg-4-warning);--card-bg-secondary: var(--bg-2-warning)}.dark a-card[tone=critical]{--card-bg-primary: var(--bg-4-critical);--card-bg-secondary: var(--bg-2-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-tone-source: attr(tone type(<color>), currentColor);--card-text: oklch(from var(--card-tone-source) .41 .15 h);--card-bg-secondary: oklch(from var(--card-tone-source) .955 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .99 .006 h);--card-icon-bg: oklch(from var(--card-tone-source) .925 .03 h);--card-border: oklch(from var(--card-tone-source) .895 .045 h);--card-border-hover: oklch(from var(--card-tone-source) .85 .06 h);--card-selected-ring: oklch(from var(--card-tone-source) .6 .15 h)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical]){--card-text: oklch(from var(--card-tone-source) .75 .11 h);--card-bg-secondary: oklch(from var(--card-tone-source) .13 .02 h);--card-bg-primary: oklch(from var(--card-tone-source) .19 .04 h);--card-icon-bg: oklch(from var(--card-tone-source) .22 .05 h);--card-border: oklch(from var(--card-tone-source) .26 .07 h);--card-border-hover: oklch(from var(--card-tone-source) .32 .09 h);--card-selected-ring: oklch(from var(--card-tone-source) .7 .13 h)}a-card[priority=tertiary]{--card-icon-bg: var(--bg-3)}a-card[tone=brand][priority=tertiary]{--card-icon-bg: var(--bg-3-brand)}a-card[tone=info][priority=tertiary]{--card-icon-bg: var(--bg-3-info)}a-card[tone=success][priority=tertiary]{--card-icon-bg: var(--bg-3-success)}a-card[tone=warning][priority=tertiary]{--card-icon-bg: var(--bg-3-warning)}a-card[tone=critical][priority=tertiary]{--card-icon-bg: var(--bg-3-critical)}a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: oklch(from var(--card-tone-source) .97 .014 h)}.dark a-card[tone=brand][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-brand), white 10%)}.dark a-card[tone=info][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-info), white 10%)}.dark a-card[tone=success][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-success), white 10%)}.dark a-card[tone=warning][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-warning), white 10%)}.dark a-card[tone=critical][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5-critical), white 10%)}.dark a-card:not([tone])[priority=tertiary],.dark a-card[tone=neutral][priority=tertiary]{--card-icon-bg: color-mix(in oklch, var(--bg-5), white 10%)}.dark a-card[tone]:not([tone=neutral],[tone=brand],[tone=info],[tone=success],[tone=warning],[tone=critical])[priority=tertiary]{--card-icon-bg: color-mix(in oklch, oklch(from var(--card-tone-source) .22 .05 h), white 10%)}a-card[size=small]{--card-padding: 8px;--card-header-nudge: 1px;--card-icon-size: 32px;--card-content-fs: 13px;--card-content-lh: 16px}a-card[size=large]{--card-padding: 16px;--card-header-nudge: 4px;--card-icon-size: 44px;--card-content-fs: 17px;--card-content-lh: 24px}}
|
|
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}}
|