@antadesign/anta 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anta_helpers.d.ts +10 -0
- package/dist/anta_helpers.js +8 -0
- package/dist/components/Calendar.d.ts +3 -2
- package/dist/components/Calendar.js +18 -7
- package/dist/components/Dialog.d.ts +92 -0
- package/dist/components/Dialog.js +71 -0
- package/dist/components/Input.d.ts +3 -0
- package/dist/components/InputAutocomplete.d.ts +69 -0
- package/dist/components/InputAutocomplete.js +95 -0
- package/dist/components/InputDate.d.ts +3 -2
- package/dist/components/InputDate.js +36 -91
- package/dist/components/InputDate.module.css +1 -1
- package/dist/components/InputTime.d.ts +105 -0
- package/dist/components/InputTime.js +110 -0
- package/dist/components/Menu.d.ts +9 -1
- package/dist/components/Menu.js +4 -1
- package/dist/components/MenuItem.d.ts +9 -1
- package/dist/components/MenuItem.js +2 -1
- package/dist/components/Select.d.ts +29 -8
- package/dist/components/Select.js +23 -30
- package/dist/components/Select.module.css +1 -1
- package/dist/components/SelectFaceted.d.ts +190 -0
- package/dist/components/SelectFaceted.js +332 -0
- package/dist/components/SelectFaceted.module.css +1 -0
- package/dist/components/Tabs.d.ts +6 -0
- package/dist/components/Tabs.js +3 -1
- package/dist/components/select-options.d.ts +14 -0
- package/dist/components/select-options.js +31 -0
- package/dist/elements/a-button.css +1 -1
- package/dist/elements/a-calendar.css +1 -1
- package/dist/elements/a-dialog.css +1 -0
- package/dist/elements/a-dialog.d.ts +26 -0
- package/dist/elements/a-dialog.js +386 -0
- package/dist/elements/a-expander.js +2 -2
- package/dist/elements/a-input-time.css +1 -0
- package/dist/elements/a-input-time.d.ts +27 -0
- package/dist/elements/a-input-time.js +857 -0
- package/dist/elements/a-input.css +1 -1
- package/dist/elements/a-input.js +7 -1
- package/dist/elements/a-menu-item.css +1 -1
- package/dist/elements/a-menu.d.ts +5 -2
- package/dist/elements/a-menu.js +42 -7
- package/dist/elements/a-tab.css +1 -1
- package/dist/elements/a-tabs.css +1 -1
- package/dist/elements/a-tooltip.d.ts +17 -0
- package/dist/elements/a-tooltip.js +29 -1
- package/dist/elements/index.d.ts +2 -0
- package/dist/elements/index.js +6 -0
- package/dist/general_types.d.ts +97 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/jsx-runtime.d.ts +3 -1
- package/dist/reset.css +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,12 @@ export interface TabOption {
|
|
|
41
41
|
/** Disable just this tab — skipped by keyboard nav and dropped from the tab order
|
|
42
42
|
* (a disabled-but-selected tab stays reachable, per the ARIA pattern). */
|
|
43
43
|
disabled?: boolean;
|
|
44
|
+
/** Tooltip for this tab — a string or any node — shown **only when the tab's label
|
|
45
|
+
* is truncated** (tabs ellipsize when the strip overflows), so a clipped tab reveals
|
|
46
|
+
* its full text on hover while a tab that fits shows nothing. Rendered as a
|
|
47
|
+
* `truncatedOnly` `<Tooltip>` anchored to the tab. For an always-visible tooltip or
|
|
48
|
+
* other custom trigger content, use `children` with your own `<Tooltip>` instead. */
|
|
49
|
+
tooltip?: React.ReactNode;
|
|
44
50
|
}
|
|
45
51
|
/** Public props for `<Tabs>`. */
|
|
46
52
|
export interface TabsProps extends Omit<BaseProps, "onChange"> {
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "@antadesign/anta/jsx-runtime";
|
|
2
2
|
import { useState } from "../jsx-runtime";
|
|
3
3
|
import { nativeStateChange, toneStyle, roundStyle, wrapLabel } from "../anta_helpers";
|
|
4
|
+
import { Tooltip } from "./Tooltip";
|
|
4
5
|
const Tabs = ({
|
|
5
6
|
children,
|
|
6
7
|
options,
|
|
@@ -88,7 +89,8 @@ const Tabs = ({
|
|
|
88
89
|
children: [
|
|
89
90
|
p.icon && /* @__PURE__ */ jsx("a-icon", { shape: p.icon, "aria-hidden": "true" }),
|
|
90
91
|
wrapLabel(p.label != null ? p.label : p.children, "a-tab-label"),
|
|
91
|
-
p.iconTrailing && /* @__PURE__ */ jsx("a-icon", { shape: p.iconTrailing, "aria-hidden": "true" })
|
|
92
|
+
p.iconTrailing && /* @__PURE__ */ jsx("a-icon", { shape: p.iconTrailing, "aria-hidden": "true" }),
|
|
93
|
+
p.tooltip != null && p.tooltip !== "" ? /* @__PURE__ */ jsx(Tooltip, { truncatedOnly: true, children: p.tooltip }) : null
|
|
92
94
|
]
|
|
93
95
|
},
|
|
94
96
|
p.value
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SelectOption } from './Select';
|
|
2
|
+
/** Coerce a bare string option to `{ value, label }`; pass an object through. */
|
|
3
|
+
export declare const normalizeOpt: (o: string | SelectOption) => SelectOption;
|
|
4
|
+
/** The built-in filter regex: case-insensitive, with each run of whitespace in the
|
|
5
|
+
* query matching any gap (`\s+`). Returns null for an empty query — the signal to
|
|
6
|
+
* match everything and to skip match-highlighting. */
|
|
7
|
+
export declare function matchQueryRegex(query: string): RegExp | null;
|
|
8
|
+
/** Whether an option matches the built-in query regex, testing value / label /
|
|
9
|
+
* hint. A null regex (empty query) matches everything. */
|
|
10
|
+
export declare const matchesQuery: (o: SelectOption, queryRe: RegExp | null) => boolean;
|
|
11
|
+
/** Bold the matched substring(s) of `text` for display (built-in matcher only).
|
|
12
|
+
* A null regex returns the text unchanged. The regex is re-created global so
|
|
13
|
+
* `exec` walks every match; the zero-width guard stops an empty match looping. */
|
|
14
|
+
export declare const highlight: (text: string, queryRe: RegExp | null) => React.ReactNode;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx } from "@antadesign/anta/jsx-runtime";
|
|
2
|
+
const normalizeOpt = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
3
|
+
function matchQueryRegex(query) {
|
|
4
|
+
const q = query.trim();
|
|
5
|
+
if (!q) return null;
|
|
6
|
+
const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
return new RegExp(q.split(/\s+/).map(escape).join("\\s+"), "i");
|
|
8
|
+
}
|
|
9
|
+
const matchesQuery = (o, queryRe) => !queryRe || [o.value, o.label ?? "", o.hint ?? ""].some((s) => queryRe.test(s));
|
|
10
|
+
const highlight = (text, queryRe) => {
|
|
11
|
+
if (!queryRe) return text;
|
|
12
|
+
const re = new RegExp(queryRe.source, "gi");
|
|
13
|
+
const out = [];
|
|
14
|
+
let last = 0;
|
|
15
|
+
let m;
|
|
16
|
+
while ((m = re.exec(text)) !== null) {
|
|
17
|
+
if (m.index > last) out.push(text.slice(last, m.index));
|
|
18
|
+
out.push(/* @__PURE__ */ jsx("b", { children: m[0] }, out.length));
|
|
19
|
+
last = m.index + m[0].length;
|
|
20
|
+
if (m[0].length === 0) re.lastIndex++;
|
|
21
|
+
}
|
|
22
|
+
if (out.length === 0) return text;
|
|
23
|
+
if (last < text.length) out.push(text.slice(last));
|
|
24
|
+
return out;
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
highlight,
|
|
28
|
+
matchQueryRegex,
|
|
29
|
+
matchesQuery,
|
|
30
|
+
normalizeOpt
|
|
31
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer anta{a-button,a[role=button][data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-max-width: 100%;--button-max-height: 100%;--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}a-button,a[role=button][data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:var(--button-max-width);max-height:var(--button-max-height);padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active,&[selected]{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-active)}&[priority=primary]{--button-fg: var(--button-fg-primary-rest);--button-bg: var(--button-bg-primary-rest);box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-bg: var(--button-bg-primary-hover)}}&:active,&[selected]{--button-bg: var(--button-bg-primary-active)}}&[priority=tertiary]{--button-fg: var(--button-fg-tertiary-rest);--button-bg: transparent;box-shadow:none;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-hover)}}&:active,&[selected]{--button-fg: var(--button-fg-tertiary-hover);--button-bg: var(--button-bg-tertiary-active)}}&[priority=quaternary]{--button-fg: var(--button-fg-quaternary-rest);--button-bg: transparent;box-shadow:none;font-weight:400;letter-spacing:.06ch;@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-quaternary-hover)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 1px currentColor}&[disabled]{background-color:var(--bg-secondary-disabled);color:var(--fg-disabled);&[priority=primary]{background-color:var(--bg-primary-disabled);color:var(--fg-disabled-primary)}&[priority=tertiary],&[priority=quaternary]{background-color:transparent;color:var(--fg-disabled)}}}}@keyframes btn-loading-slide{to{transform:translate(var(--button-loading-x-period))}}
|
|
1
|
+
@layer anta{a-button,a[role=button][data-anta]{--button-primary-fg: #ffffff;--bg-primary-disabled: #ece9ec;--bg-secondary-disabled: #f6f4f6;--fg-disabled-primary: #afa9b1;--fg-disabled: #afa9b1;--button-loading-stripe: 14px;--button-loading-stripe-gap: 16px;--button-loading-period: 30px;--button-loading-angle: 125deg;--button-loading-x-period: calc( var(--button-loading-period) / cos(var(--button-loading-angle) - 90deg) );--button-loading-opacity: .15;--button-loading-blur: 2.5px;--button-bg-primary-rest: #635b65;--button-bg-primary-hover: #534c57;--button-bg-primary-active: #49424c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #45374c12;--button-bg-secondary-hover: #44374b1a;--button-bg-secondary-active: #44374b26;--button-fg-secondary-rest: #534c57;--button-fg-secondary-hover: #49424c;--button-fg-secondary-l-shift: .05;--button-fg-tertiary-rest: #635b65;--button-fg-tertiary-hover: #534c57;--button-bg-tertiary-hover: #44374b0d;--button-bg-tertiary-active: #44374b1a;--button-fg-quaternary-rest: #635b65;--button-fg-quaternary-hover: #49424c;--_fs: 15px;--_lh: 20px;--_pb: 1px;--button-padding-x: 9px;--button-padding-y: calc((8px - var(--_pb)) / 2);--button-max-width: 100%;--button-max-height: 100%;--button-timing-in: 75ms ease-in;--button-timing-active: 50ms linear;--button-timing-out: .15s ease-out;--button-loading-duration: .5s}a-button[round],a[role=button][data-anta][round]{--button-round: attr(round type(<length>), 999px);border-radius:var(--button-round, 999px)}a-button[tone=brand],a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #5f4bc3;--button-bg-primary-hover: #503cb4;--button-bg-primary-active: #483493;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #7460d71a;--button-bg-secondary-hover: #7460d726;--button-bg-secondary-active: #7460d733;--button-fg-secondary-rest: #5f4bc3;--button-fg-secondary-hover: #503cb4;--button-fg-tertiary-rest: #5f4bc3;--button-fg-tertiary-hover: #503cb4;--button-bg-tertiary-hover: #7460d71a;--button-bg-tertiary-active: #7460d726;--button-fg-quaternary-rest: #5f4bc3;--button-fg-quaternary-hover: #483493}a-button[tone=critical],a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #c9302c;--button-bg-primary-hover: #b02120;--button-bg-primary-active: #a01c1c;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #de45451a;--button-bg-secondary-hover: #de454526;--button-bg-secondary-active: #de454533;--button-fg-secondary-rest: #c9302c;--button-fg-secondary-hover: #b02120;--button-fg-tertiary-rest: #c9302c;--button-fg-tertiary-hover: #b02120;--button-bg-tertiary-hover: #de45451a;--button-bg-tertiary-active: #de454533;--button-fg-quaternary-rest: #c9302c;--button-fg-quaternary-hover: #a01c1c}a-button[tone=info],a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1f6eb2;--button-bg-primary-hover: #1a5b93;--button-bg-primary-active: #175082;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #2686d91a;--button-bg-secondary-hover: #2686d926;--button-bg-secondary-active: #2686d933;--button-fg-secondary-rest: #1f6eb2;--button-fg-secondary-hover: #1a5b93;--button-fg-tertiary-rest: #1f6eb2;--button-fg-tertiary-hover: #1a5b93;--button-bg-tertiary-hover: #2686d91a;--button-bg-tertiary-active: #2686d926;--button-fg-quaternary-rest: #1f6eb2;--button-fg-quaternary-hover: #175082}a-button[tone=success],a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #2a7e43;--button-bg-primary-hover: #226737;--button-bg-primary-active: #1f5c31;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #3295501a;--button-bg-secondary-hover: #32955026;--button-bg-secondary-active: #32955033;--button-fg-secondary-rest: #2a7e43;--button-fg-secondary-hover: #226737;--button-fg-tertiary-rest: #2a7e43;--button-fg-tertiary-hover: #226737;--button-bg-tertiary-hover: #3295501a;--button-bg-tertiary-active: #32955026;--button-fg-quaternary-rest: #2a7e43;--button-fg-quaternary-hover: #1f5c31}a-button[tone=warning],a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #c37416;--button-bg-primary-hover: #ae6613;--button-bg-primary-active: #995200;--button-fg-primary-rest: var(--button-primary-fg);--button-bg-secondary-rest: #c374161a;--button-bg-secondary-hover: #c3741626;--button-bg-secondary-active: #c3741633;--button-fg-secondary-rest: #c37416;--button-fg-secondary-hover: #ae6613;--button-fg-tertiary-rest: #c37416;--button-fg-tertiary-hover: #ae6613;--button-bg-tertiary-hover: #c374161a;--button-bg-tertiary-active: #c3741633;--button-fg-quaternary-rest: #c37416;--button-fg-quaternary-hover: #995200}.dark a-button,.dark a[role=button][data-anta]{--bg-primary-disabled: #272329;--bg-secondary-disabled: #1d1a1e;--fg-disabled-primary: #776e77;--fg-disabled: #635b65;--button-bg-primary-rest: #534c57;--button-bg-primary-hover: #635b65;--button-bg-primary-active: #938d96;--button-bg-secondary-rest: #e4d1ef1c;--button-bg-secondary-hover: #e4d1ef24;--button-bg-secondary-active: #e4d1ef2e;--button-fg-secondary-rest: #c1b9c1;--button-fg-secondary-hover: #d4ced4;--button-fg-secondary-l-shift: 0;--button-fg-tertiary-rest: #afa9b1;--button-fg-tertiary-hover: #afa9b1;--button-bg-tertiary-hover: #e4d1ef14;--button-bg-tertiary-active: #e4d1ef21;--button-fg-quaternary-rest: #afa9b1;--button-fg-quaternary-hover: #cac4ca}.dark a-button[tone=brand],.dark a[role=button][data-anta][tone=brand]{--button-bg-primary-rest: #503cb4;--button-bg-primary-hover: #5f4bc3;--button-bg-primary-active: #7460d7;--button-bg-secondary-rest: #7460d73b;--button-bg-secondary-hover: #7460d747;--button-bg-secondary-active: #7460d754;--button-fg-secondary-rest: #c5baff;--button-fg-secondary-hover: #d2cbf6;--button-fg-tertiary-rest: #ada0ee;--button-fg-tertiary-hover: #bcb1f1;--button-bg-tertiary-hover: #7460d73b;--button-bg-tertiary-active: #7460d747;--button-fg-quaternary-rest: #ada0ee;--button-fg-quaternary-hover: #c7bef4}.dark a-button[tone=critical],.dark a[role=button][data-anta][tone=critical]{--button-bg-primary-rest: #b02120;--button-bg-primary-hover: #c9302c;--button-bg-primary-active: #de4545;--button-bg-secondary-rest: #de45453b;--button-bg-secondary-hover: #de454547;--button-bg-secondary-active: #de454554;--button-fg-secondary-rest: #ffabac;--button-fg-secondary-hover: #f4c2c2;--button-fg-tertiary-rest: #e78e90;--button-fg-tertiary-hover: #efa4a4;--button-bg-tertiary-hover: #de45453b;--button-bg-tertiary-active: #de454547;--button-fg-quaternary-rest: #e78e90;--button-fg-quaternary-hover: #ffabac}.dark a-button[tone=info],.dark a[role=button][data-anta][tone=info]{--button-bg-primary-rest: #1a5b93;--button-bg-primary-hover: #1f6eb2;--button-bg-primary-active: #2686d9;--button-bg-secondary-rest: #2686d93b;--button-bg-secondary-hover: #2686d947;--button-bg-secondary-active: #2686d954;--button-fg-secondary-rest: #9ed2ff;--button-fg-secondary-hover: #bad6f3;--button-fg-tertiary-rest: #7db6e8;--button-fg-tertiary-hover: #93c5ec;--button-bg-tertiary-hover: #2686d93b;--button-bg-tertiary-active: #2686d947;--button-fg-quaternary-rest: #7db6e8;--button-fg-quaternary-hover: #a6cdef}.dark a-button[tone=success],.dark a[role=button][data-anta][tone=success]{--button-bg-primary-rest: #226737;--button-bg-primary-hover: #2a7e43;--button-bg-primary-active: #329550;--button-bg-secondary-rest: #3295503b;--button-bg-secondary-hover: #32955047;--button-bg-secondary-active: #32955054;--button-fg-secondary-rest: #8ceca9;--button-fg-secondary-hover: #b3e5c2;--button-fg-tertiary-rest: #74cd8e;--button-fg-tertiary-hover: #88d7a0;--button-bg-tertiary-hover: #3295503b;--button-bg-tertiary-active: #32955047;--button-fg-quaternary-rest: #74cd8e;--button-fg-quaternary-hover: #9ddeb1}.dark a-button[tone=warning],.dark a[role=button][data-anta][tone=warning]{--button-bg-primary-rest: #7f410b;--button-bg-primary-hover: #995200;--button-bg-primary-active: #ae6613;--button-bg-secondary-rest: #c374163b;--button-bg-secondary-hover: #c3741647;--button-bg-secondary-active: #c3741654;--button-fg-secondary-rest: #f7c06e;--button-fg-secondary-hover: #f3cc91;--button-fg-tertiary-rest: #e1a452;--button-fg-tertiary-hover: #edb25a;--button-bg-tertiary-hover: #c374163b;--button-bg-tertiary-active: #c3741647;--button-fg-quaternary-rest: #e1a452;--button-fg-quaternary-hover: #f0bf75}a-button,a[role=button][data-anta]{user-select:none;display:inline-flex;align-items:center;gap:.5ch;overflow:hidden;cursor:pointer;flex-shrink:0;color:var(--button-fg);background-color:var(--button-bg);border-radius:4px;text-decoration:none;box-shadow:inset 0 0 1px color-mix(in oklch,currentColor,transparent 90%);font-size:var(--_fs);font-family:var(--sans-serif);font-weight:450;font-variation-settings:"wdth" 88,"slnt" 0,"ital" 0;font-feature-settings:"ss02","ss05","tnum";line-height:var(--_lh);letter-spacing:.05ch;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;max-width:var(--button-max-width);max-height:var(--button-max-height);padding-inline:var(--button-padding-x);padding-block:var(--button-padding-y);min-height:28px;>a-button-label{display:inline-block;text-overflow:ellipsis;text-wrap:nowrap;white-space:nowrap;overflow:hidden;min-width:0;line-height:var(--_lh);padding-bottom:var(--_pb);&:has(>*){display:inline-flex;gap:.25ch}}>*{pointer-events:none}& a-icon{transition:color var(--button-timing-out)}transition:color var(--button-timing-out),background-color var(--button-timing-out);&:hover,&:focus-visible{transition:color var(--button-timing-in),background-color var(--button-timing-in);& a-icon{transition:color var(--button-timing-in)}}&:active,&[selected]{transition:color var(--button-timing-active),background-color var(--button-timing-active);& a-icon{transition:color var(--button-timing-active)}}&[disabled]{pointer-events:none;cursor:not-allowed;transition:none;& a-icon{transition:none}}&:focus-visible{outline:1px solid var(--focus-ring);outline-offset:1px}&[priority=quaternary]{--button-timing-in: 0s;--button-timing-active: 0s;--button-timing-out: 0s}&[size=small]{--button-padding-x: 7px;--_fs: 13px;--_lh: 16px;--_pb: .5px;min-height:24px;& a-icon{--icon-size: 14px}}&[size=large]{--button-padding-x: 13px;--_fs: 17px;--_lh: 24px;--_pb: 1.5px;min-height:32px;& a-icon{--icon-size: 18px}}&[priority=tertiary],&[priority=quaternary]{&[underline=solid]{text-decoration:underline solid}&[underline=dashed]{text-decoration:underline dashed}&[underline=dotted]{text-decoration:underline dotted}&[underline]{text-decoration-color:color-mix(in srgb,currentColor 75%,transparent);text-decoration-thickness:1px;text-underline-offset:3px;&[selected]{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}@media(hover:hover)and (pointer:fine){&:hover{text-decoration-color:var(--button-fg);text-decoration-thickness:1px}}}}&[priority=quaternary][paddingless]{--button-padding-x: 0;--button-padding-y: 0;min-height:0}&:has(>a-icon):not(:has(>a-icon~a-icon)):not(:has(>:not(a-icon):not(a-tooltip))){--button-padding-y: 5px;--button-padding-x: 5px;min-width:28px;justify-content:center;&[size=small]{--button-padding-y: 3px;--button-padding-x: 3px;min-width:24px}&[size=large]{--button-padding-y: 7px;--button-padding-x: 7px;min-width:32px}}&:is(:has(>a-icon:first-child),:has(>a-tooltip:first-child+a-icon)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-start:max(0px,var(--button-padding-x) - 2px)}&:is(:has(>a-icon:last-child),:has(>a-icon+a-tooltip:last-child)):is(:has(>a-icon~a-icon),:has(>:not(a-icon):not(a-tooltip))){padding-inline-end:max(0px,var(--button-padding-x) - 2px)}&[loading]{position:relative;pointer-events:none;cursor:wait;&:before{content:"";position:absolute;top:0;bottom:0;left:calc(0px - var(--button-loading-x-period));right:0;pointer-events:none;background:repeating-linear-gradient(var(--button-loading-angle),transparent 0,transparent var(--button-loading-stripe-gap),currentColor var(--button-loading-stripe-gap),currentColor calc(var(--button-loading-stripe-gap) + var(--button-loading-stripe)));opacity:var(--button-loading-opacity);filter:blur(var(--button-loading-blur));will-change:transform;animation:btn-loading-slide var(--button-loading-duration) linear infinite;animation-delay:-9999s}}&[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--button-tone-source: attr(tone type(<color>), transparent);--_tone-fg-l: .46;--_tone-fg-strong-l: .4;--_tone-fg-c: .17;--_tone-bg-l: .54;--_tone-bg-c: .16;--_tone-bg-a-rest: .1;--_tone-bg-a-hover: .15;--_tone-bg-a-active: .2;--_tone-primary-l-rest: .5;--_tone-primary-l-hover: .45;--_tone-primary-l-active: .4;--button-bg-primary-rest: oklch(from var(--button-tone-source) var(--_tone-primary-l-rest) c h);--button-bg-primary-hover: oklch(from var(--button-tone-source) var(--_tone-primary-l-hover) c h);--button-bg-primary-active: oklch(from var(--button-tone-source) var(--_tone-primary-l-active) c h);--button-fg-primary-rest: var(--button-primary-fg);--button-fg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-tertiary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-fg-quaternary-rest: oklch(from var(--button-tone-source) var(--_tone-fg-l) var(--_tone-fg-c) h);--button-fg-quaternary-hover: oklch(from var(--button-tone-source) var(--_tone-fg-strong-l) var(--_tone-fg-c) h);--button-bg-secondary-rest: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-secondary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover));--button-bg-secondary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-active));--button-bg-tertiary-hover: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-rest));--button-bg-tertiary-active: oklch(from var(--button-tone-source) var(--_tone-bg-l) var(--_tone-bg-c) h / var(--_tone-bg-a-hover))}.dark &[tone]:not([tone=""],[tone=brand],[tone=neutral],[tone=critical],[tone=info],[tone=success],[tone=warning]){--_tone-fg-l: .78;--_tone-fg-strong-l: .85;--_tone-fg-c: .11;--_tone-bg-l: .58;--_tone-bg-a-rest: .23;--_tone-bg-a-hover: .28;--_tone-bg-a-active: .33;--_tone-primary-l-rest: .45;--_tone-primary-l-hover: .5;--_tone-primary-l-active: .57}--button-fg: oklch(from var(--button-fg-secondary-rest) calc(l - var(--button-fg-secondary-l-shift)) c h);--button-bg: var(--button-bg-secondary-rest);@media(hover:hover)and (pointer:fine){&:hover{--button-fg: var(--button-fg-secondary-hover);--button-bg: var(--button-bg-secondary-hover)}}&:active{--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)}}&[selected]{--button-fg: var(--button-fg-quaternary-hover)}&:active{--button-fg: oklch(from var(--button-fg-quaternary-rest) calc(l + .05) c h)}.dark &:active{--button-fg: var(--button-fg-quaternary-rest)}}&[selected]{box-shadow:inset 0 0 0 .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 +1 @@
|
|
|
1
|
-
@layer anta{.anta-calendar{--calendar-cell-width: 32px;--calendar-cell-height: 28px;display:inline-flex;flex-direction:column;gap:6px}.anta-calendar [data-part=header]{display:flex;align-items:center;gap:0}.anta-calendar [data-part=heading]{flex:1 1 auto;justify-content:center;white-space:nowrap}.anta-calendar .
|
|
1
|
+
@layer anta{.anta-calendar{--calendar-cell-width: 32px;--calendar-cell-height: 28px;display:inline-flex;flex-direction:column;gap:6px}.anta-calendar [data-part=header]{display:flex;align-items:center;gap:0}.anta-calendar [data-part=heading]{flex:1 1 auto;justify-content:center;white-space:nowrap}.anta-calendar .jump-dot{flex:none;inline-size:6px;block-size:6px;border-radius:999px;background:currentColor}.anta-calendar[data-size=small]{--calendar-cell-width: 28px;--calendar-cell-height: 24px}.anta-calendar[data-size=large]{--calendar-cell-width: 36px;--calendar-cell-height: 32px}.anta-calendar[data-size=small] [data-part=weekday]{font-size:13px;line-height:16px}.anta-calendar[data-size=large] [data-part=weekday]{font-size:17px;line-height:24px}a-calendar{display:inline-grid;grid-template-columns:repeat(7,var(--calendar-cell-width, 32px));gap:1px;font-family:var(--sans-serif)}a-calendar [data-part=weekday]{display:flex;align-items:center;justify-content:center;height:24px;font-size:15px;line-height:20px;font-weight:400;color:var(--text-4);user-select:none}a-calendar [data-part=weekday][data-weekend]{color:var(--text-5)}a-calendar a-button[data-part=day-cell]{padding-inline:0;min-width:var(--calendar-cell-width, 32px);min-height:var(--calendar-cell-height, 28px);justify-content:center}a-calendar a-button[data-part=day-cell] a-button-label{padding-bottom:0}a-calendar a-button[data-part=day-cell]:focus-visible{outline-offset:0}a-calendar a-button[data-part=day-cell][data-today]:not([selected]){font-weight:600}a-calendar a-button[data-part=day-cell][data-outside]:not([selected]){opacity:.5}}
|
|
@@ -0,0 +1 @@
|
|
|
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)}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-dialog.css';
|
|
3
|
+
export declare class ADialogElement extends HTMLElementBase {
|
|
4
|
+
#private;
|
|
5
|
+
static observedAttributes: string[];
|
|
6
|
+
private dialog;
|
|
7
|
+
private headerSlot;
|
|
8
|
+
private footerSlot;
|
|
9
|
+
private closeSlot;
|
|
10
|
+
constructor();
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
attributeChangedCallback(name: string): void;
|
|
14
|
+
/** Public imperative API — mirrors `<dialog>`. `show()` requests open,
|
|
15
|
+
* `close()` requests close; both honor the state contract. */
|
|
16
|
+
show(): void;
|
|
17
|
+
close(): void;
|
|
18
|
+
get open(): boolean;
|
|
19
|
+
/** Announce a requested OPEN (cancelable, before applying), then — uncontrolled
|
|
20
|
+
* and un-vetoed — apply it. Controlled: never self-apply. */
|
|
21
|
+
requestOpen(): void;
|
|
22
|
+
/** Announce a requested CLOSE (cancelable, before applying), then — uncontrolled
|
|
23
|
+
* and un-vetoed — apply it. Controlled: never self-apply. */
|
|
24
|
+
requestClose(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function register_a_dialog(): void;
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { HTMLElementBase, parseOpenState } from "../anta_helpers";
|
|
2
|
+
import "./a-dialog.css";
|
|
3
|
+
const CLOSE_TRIGGER = "closerequest";
|
|
4
|
+
const ANIM_MS = 200;
|
|
5
|
+
const SHADOW_STYLE = `
|
|
6
|
+
:host { display: contents; }
|
|
7
|
+
|
|
8
|
+
dialog {
|
|
9
|
+
--_dur: ${ANIM_MS}ms;
|
|
10
|
+
--_r: var(--dialog-round, var(--dialog-radius, 10px));
|
|
11
|
+
|
|
12
|
+
position: fixed;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
padding: 0;
|
|
15
|
+
border: none;
|
|
16
|
+
max-width: calc(100vw - 2 * var(--dialog-margin, 32px));
|
|
17
|
+
max-height: calc(100dvh - 2 * var(--dialog-margin, 32px));
|
|
18
|
+
width: var(--dialog-width, 480px);
|
|
19
|
+
height: var(--dialog-height, fit-content);
|
|
20
|
+
overflow: visible;
|
|
21
|
+
color: var(--dialog-text, inherit);
|
|
22
|
+
background: var(--dialog-bg, #fff);
|
|
23
|
+
border-radius: var(--_r);
|
|
24
|
+
box-shadow: var(--dialog-shadow, inset 0 0 0 1px color-mix(in oklch, black 8%, transparent), 0 10px 38px color-mix(in oklch, black 28%, transparent));
|
|
25
|
+
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
dialog[open] {
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
dialog:focus, dialog:focus-visible { outline: none; }
|
|
34
|
+
|
|
35
|
+
dialog::backdrop {
|
|
36
|
+
background: var(--dialog-overlay, color-mix(in oklch, black 40%, transparent));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host { --_enter-from: scale(0.97); }
|
|
40
|
+
:host([position="left"]) { --_enter-from: translateX(-100%); }
|
|
41
|
+
:host([position="right"]) { --_enter-from: translateX(100%); }
|
|
42
|
+
:host([position="top"]) { --_enter-from: translateY(-100%); }
|
|
43
|
+
:host([position="bottom"]) { --_enter-from: translateY(100%); }
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
46
|
+
dialog {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: var(--_enter-from);
|
|
49
|
+
transition:
|
|
50
|
+
opacity var(--_dur) ease,
|
|
51
|
+
transform var(--_dur) ease,
|
|
52
|
+
overlay var(--_dur) ease allow-discrete,
|
|
53
|
+
display var(--_dur) ease allow-discrete;
|
|
54
|
+
}
|
|
55
|
+
dialog[open] {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transform: none;
|
|
58
|
+
}
|
|
59
|
+
@starting-style {
|
|
60
|
+
dialog[open] { opacity: 0; transform: var(--_enter-from); }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
dialog::backdrop {
|
|
64
|
+
background: transparent;
|
|
65
|
+
transition:
|
|
66
|
+
background var(--_dur) ease,
|
|
67
|
+
overlay var(--_dur) ease allow-discrete,
|
|
68
|
+
display var(--_dur) ease allow-discrete;
|
|
69
|
+
}
|
|
70
|
+
dialog[open]::backdrop { background: var(--dialog-overlay, color-mix(in oklch, black 40%, transparent)); }
|
|
71
|
+
@starting-style {
|
|
72
|
+
dialog[open]::backdrop { background: transparent; }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:host([position="left"]) dialog,
|
|
77
|
+
:host([position="right"]) dialog {
|
|
78
|
+
width: var(--dialog-width, 380px);
|
|
79
|
+
max-width: calc(100vw - var(--dialog-margin, 32px));
|
|
80
|
+
height: 100dvh;
|
|
81
|
+
max-height: 100dvh;
|
|
82
|
+
border-radius: 0;
|
|
83
|
+
}
|
|
84
|
+
:host([position="left"]) dialog { margin: 0 auto 0 0; }
|
|
85
|
+
:host([position="right"]) dialog { margin: 0 0 0 auto; }
|
|
86
|
+
|
|
87
|
+
:host([position="top"]) dialog,
|
|
88
|
+
:host([position="bottom"]) dialog {
|
|
89
|
+
width: 100vw;
|
|
90
|
+
max-width: 100vw;
|
|
91
|
+
height: var(--dialog-height, fit-content);
|
|
92
|
+
max-height: calc(100dvh - var(--dialog-margin, 32px));
|
|
93
|
+
border-radius: 0;
|
|
94
|
+
}
|
|
95
|
+
:host([position="top"]) dialog { margin: 0 auto auto auto; }
|
|
96
|
+
:host([position="bottom"]) dialog { margin: auto auto 0 auto; }
|
|
97
|
+
|
|
98
|
+
:host([position="fullscreen"]) dialog {
|
|
99
|
+
width: 100vw;
|
|
100
|
+
max-width: 100vw;
|
|
101
|
+
height: 100dvh;
|
|
102
|
+
max-height: 100dvh;
|
|
103
|
+
margin: 0;
|
|
104
|
+
border-radius: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([round]) dialog { border-radius: var(--_r); }
|
|
108
|
+
:host([round="top"]) dialog { border-radius: var(--_r) var(--_r) 0 0; }
|
|
109
|
+
:host([round="bottom"]) dialog { border-radius: 0 0 var(--_r) var(--_r); }
|
|
110
|
+
:host([round="left"]) dialog { border-radius: var(--_r) 0 0 var(--_r); }
|
|
111
|
+
:host([round="right"]) dialog { border-radius: 0 var(--_r) var(--_r) 0; }
|
|
112
|
+
|
|
113
|
+
slot[name="header"] {
|
|
114
|
+
display: none;
|
|
115
|
+
flex: 0 0 auto;
|
|
116
|
+
padding: var(--dialog-header-padding, 18px 20px 8px);
|
|
117
|
+
font-size: 17px;
|
|
118
|
+
font-weight: 560;
|
|
119
|
+
line-height: 24px;
|
|
120
|
+
}
|
|
121
|
+
slot[name="header"].has-content { display: block; }
|
|
122
|
+
dialog.has-close slot[name="header"] { padding-inline-end: 52px; }
|
|
123
|
+
|
|
124
|
+
slot[part="body"] {
|
|
125
|
+
display: block;
|
|
126
|
+
flex: 1 1 auto;
|
|
127
|
+
min-height: 0;
|
|
128
|
+
overflow: auto;
|
|
129
|
+
padding: var(--dialog-body-padding, 8px 20px 12px);
|
|
130
|
+
}
|
|
131
|
+
/* With a close button but no header, the body is the top zone, so it takes the
|
|
132
|
+
\u2715 clearance instead of the header (which is display:none when empty). */
|
|
133
|
+
dialog.has-close slot[name="header"]:not(.has-content) ~ slot[part="body"] {
|
|
134
|
+
padding-inline-end: 52px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
slot[name="footer"] {
|
|
138
|
+
display: none;
|
|
139
|
+
flex: 0 0 auto;
|
|
140
|
+
padding: var(--dialog-footer-padding, 8px 20px 18px);
|
|
141
|
+
}
|
|
142
|
+
slot[name="footer"].has-content {
|
|
143
|
+
display: flex;
|
|
144
|
+
gap: 8px;
|
|
145
|
+
justify-content: flex-end;
|
|
146
|
+
align-items: center;
|
|
147
|
+
flex-wrap: wrap;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
slot[name="close"] { display: none; }
|
|
151
|
+
slot[name="close"].has-content {
|
|
152
|
+
display: block;
|
|
153
|
+
position: absolute;
|
|
154
|
+
inset-block-start: 10px;
|
|
155
|
+
inset-inline-end: 10px;
|
|
156
|
+
z-index: 1;
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
class ADialogElement extends HTMLElementBase {
|
|
160
|
+
static observedAttributes = ["state", "name"];
|
|
161
|
+
dialog;
|
|
162
|
+
headerSlot;
|
|
163
|
+
footerSlot;
|
|
164
|
+
closeSlot;
|
|
165
|
+
// Counts `dialog.close()` calls WE initiate whose async `close` event is still
|
|
166
|
+
// pending, and is decremented as each arrives. The native `close` event fires
|
|
167
|
+
// from a queued task, so a synchronous guard can't span it, and a boolean
|
|
168
|
+
// can't span a BURST (two re-parents in one tick queue two closes; the first
|
|
169
|
+
// event would clear the flag and the second would be misread as out-of-band).
|
|
170
|
+
// The counter lets the `close` handler tell our own closes (ignore) from an
|
|
171
|
+
// out-of-band one (`<form method="dialog">`, a consumer calling the shadow
|
|
172
|
+
// dialog's close(), bfcache), which it must reconcile.
|
|
173
|
+
#programmaticCloses = 0;
|
|
174
|
+
// The intended (uncontrolled) open state, held in JS so it survives a
|
|
175
|
+
// disconnect → reconnect (a DOM move / re-parent). disconnectedCallback
|
|
176
|
+
// force-closes the native dialog to free the top layer, but must not lose
|
|
177
|
+
// whether the user had it open — otherwise a re-parented open dialog would
|
|
178
|
+
// vanish (trigger-opened) or a re-parented closed one would pop back (a stale
|
|
179
|
+
// `default-state="open"` re-seeding). Only ever reflects genuine open/close
|
|
180
|
+
// intent, never the disconnect teardown.
|
|
181
|
+
#wantOpen = false;
|
|
182
|
+
// default-state is read ONCE (the first connect), never again — re-seeding on
|
|
183
|
+
// every connect would reopen a dialog the user has since closed.
|
|
184
|
+
#seeded = false;
|
|
185
|
+
// Whether the current pointer press began on the backdrop (the dialog element
|
|
186
|
+
// itself), so a press-inside → release-on-backdrop drag (text selection) is
|
|
187
|
+
// NOT read as a backdrop dismiss.
|
|
188
|
+
#pressedBackdrop = false;
|
|
189
|
+
// The document click listener wired for the `name`-trigger convenience, kept so
|
|
190
|
+
// it can be torn down (and re-wired when `name` / controlled-ness changes).
|
|
191
|
+
#triggerListener;
|
|
192
|
+
constructor() {
|
|
193
|
+
super();
|
|
194
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
195
|
+
const style = document.createElement("style");
|
|
196
|
+
style.textContent = SHADOW_STYLE;
|
|
197
|
+
this.dialog = document.createElement("dialog");
|
|
198
|
+
this.dialog.setAttribute("part", "dialog");
|
|
199
|
+
this.dialog.tabIndex = -1;
|
|
200
|
+
this.closeSlot = document.createElement("slot");
|
|
201
|
+
this.closeSlot.name = "close";
|
|
202
|
+
this.closeSlot.setAttribute("part", "close");
|
|
203
|
+
this.headerSlot = document.createElement("slot");
|
|
204
|
+
this.headerSlot.name = "header";
|
|
205
|
+
this.headerSlot.setAttribute("part", "header");
|
|
206
|
+
const bodySlot = document.createElement("slot");
|
|
207
|
+
bodySlot.setAttribute("part", "body");
|
|
208
|
+
this.footerSlot = document.createElement("slot");
|
|
209
|
+
this.footerSlot.name = "footer";
|
|
210
|
+
this.footerSlot.setAttribute("part", "footer");
|
|
211
|
+
for (const slot of [this.headerSlot, this.footerSlot, this.closeSlot]) {
|
|
212
|
+
slot.addEventListener("slotchange", () => {
|
|
213
|
+
const has = slot.assignedNodes().length > 0;
|
|
214
|
+
slot.classList.toggle("has-content", has);
|
|
215
|
+
if (slot === this.closeSlot) this.dialog.classList.toggle("has-close", has);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
this.headerSlot.addEventListener("slotchange", () => this.#syncAccessibleName());
|
|
219
|
+
this.dialog.append(this.headerSlot, bodySlot, this.footerSlot, this.closeSlot);
|
|
220
|
+
shadow.append(style, this.dialog);
|
|
221
|
+
this.dialog.addEventListener("cancel", (e) => {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
if (!this.#persistent) this.requestClose();
|
|
224
|
+
});
|
|
225
|
+
this.dialog.addEventListener("pointerdown", (e) => {
|
|
226
|
+
this.#pressedBackdrop = e.target === this.dialog;
|
|
227
|
+
});
|
|
228
|
+
this.dialog.addEventListener("click", (e) => {
|
|
229
|
+
if (this.#persistent) return;
|
|
230
|
+
if (this.#pressedBackdrop && e.target === this.dialog) this.requestClose();
|
|
231
|
+
});
|
|
232
|
+
this.dialog.addEventListener("close", () => {
|
|
233
|
+
if (this.#programmaticCloses > 0) {
|
|
234
|
+
this.#programmaticCloses--;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (this.#controlled) this.#reflect(parseOpenState(this.getAttribute("state")));
|
|
238
|
+
else this.#wantOpen = false;
|
|
239
|
+
});
|
|
240
|
+
this.addEventListener(CLOSE_TRIGGER, () => this.requestClose());
|
|
241
|
+
}
|
|
242
|
+
connectedCallback() {
|
|
243
|
+
if (this.#controlled) {
|
|
244
|
+
this.#reflect(parseOpenState(this.getAttribute("state")));
|
|
245
|
+
} else {
|
|
246
|
+
if (!this.#seeded) {
|
|
247
|
+
if (parseOpenState(this.getAttribute("default-state")) === "open") this.#wantOpen = true;
|
|
248
|
+
this.#seeded = true;
|
|
249
|
+
}
|
|
250
|
+
if (this.#wantOpen) this.#open();
|
|
251
|
+
}
|
|
252
|
+
this.#syncTriggerListener();
|
|
253
|
+
this.#syncAccessibleName();
|
|
254
|
+
}
|
|
255
|
+
disconnectedCallback() {
|
|
256
|
+
this.#teardownTriggerListener();
|
|
257
|
+
if (this.dialog.open) {
|
|
258
|
+
this.#programmaticCloses++;
|
|
259
|
+
this.dialog.close();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
attributeChangedCallback(name) {
|
|
263
|
+
if (name === "state") {
|
|
264
|
+
if (this.#controlled) this.#reflect(parseOpenState(this.getAttribute("state")));
|
|
265
|
+
this.#syncTriggerListener();
|
|
266
|
+
} else if (name === "name") {
|
|
267
|
+
this.#syncTriggerListener();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/** Controlled mode: the `state` attribute is present and owns the open state. */
|
|
271
|
+
get #controlled() {
|
|
272
|
+
return this.hasAttribute("state");
|
|
273
|
+
}
|
|
274
|
+
/** Light-dismiss (Esc + backdrop) disabled — the dialog closes only via
|
|
275
|
+
* explicit controls (close button / programmatic). */
|
|
276
|
+
get #persistent() {
|
|
277
|
+
return this.hasAttribute("persistent");
|
|
278
|
+
}
|
|
279
|
+
/** The currently *applied* open state (read from the native dialog — the
|
|
280
|
+
* source of truth for what's painted). */
|
|
281
|
+
get #current() {
|
|
282
|
+
return this.dialog.open ? "open" : "closed";
|
|
283
|
+
}
|
|
284
|
+
/** Public imperative API — mirrors `<dialog>`. `show()` requests open,
|
|
285
|
+
* `close()` requests close; both honor the state contract. */
|
|
286
|
+
show() {
|
|
287
|
+
this.requestOpen();
|
|
288
|
+
}
|
|
289
|
+
close() {
|
|
290
|
+
this.requestClose();
|
|
291
|
+
}
|
|
292
|
+
get open() {
|
|
293
|
+
return this.dialog.open;
|
|
294
|
+
}
|
|
295
|
+
/** Announce a requested OPEN (cancelable, before applying), then — uncontrolled
|
|
296
|
+
* and un-vetoed — apply it. Controlled: never self-apply. */
|
|
297
|
+
requestOpen() {
|
|
298
|
+
if (this.#current === "open") return;
|
|
299
|
+
const ok = this.#announce("open");
|
|
300
|
+
if (this.#controlled) return;
|
|
301
|
+
if (ok) this.#open();
|
|
302
|
+
}
|
|
303
|
+
/** Announce a requested CLOSE (cancelable, before applying), then — uncontrolled
|
|
304
|
+
* and un-vetoed — apply it. Controlled: never self-apply. */
|
|
305
|
+
requestClose() {
|
|
306
|
+
if (this.#current === "closed") return;
|
|
307
|
+
const ok = this.#announce("closed");
|
|
308
|
+
if (this.#controlled) return;
|
|
309
|
+
if (ok) this.#close();
|
|
310
|
+
}
|
|
311
|
+
/** Dispatch the cancelable `statechange` for a requested transition. Returns
|
|
312
|
+
* false if a handler vetoed it. */
|
|
313
|
+
#announce(next) {
|
|
314
|
+
return this.dispatchEvent(
|
|
315
|
+
new CustomEvent("statechange", {
|
|
316
|
+
cancelable: true,
|
|
317
|
+
detail: { next, prev: this.#current }
|
|
318
|
+
})
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
/** Reflect a controlled `state` onto the native dialog (idempotent). No
|
|
322
|
+
* `statechange` — this is the consumer's own command, not a user gesture. */
|
|
323
|
+
#reflect(state) {
|
|
324
|
+
if (state === "open") this.#open();
|
|
325
|
+
else this.#close();
|
|
326
|
+
}
|
|
327
|
+
/** Raw open: show the modal dialog. Records the open intent (survives a
|
|
328
|
+
* disconnect). Guarded against a not-connected / already-open native element
|
|
329
|
+
* (both throw / no-op). */
|
|
330
|
+
#open() {
|
|
331
|
+
this.#wantOpen = true;
|
|
332
|
+
if (this.dialog.open || !this.isConnected) return;
|
|
333
|
+
this.dialog.showModal();
|
|
334
|
+
if (!this.querySelector("[autofocus]")) this.dialog.focus();
|
|
335
|
+
}
|
|
336
|
+
/** Raw close. Records the closed intent and counts the pending `close` event as
|
|
337
|
+
* ours so the listener doesn't reconcile it. (The disconnect teardown closes
|
|
338
|
+
* the native dialog directly, NOT through here, to preserve `#wantOpen`.) */
|
|
339
|
+
#close() {
|
|
340
|
+
this.#wantOpen = false;
|
|
341
|
+
if (!this.dialog.open) return;
|
|
342
|
+
this.#programmaticCloses++;
|
|
343
|
+
this.dialog.close();
|
|
344
|
+
}
|
|
345
|
+
/** Publish the header text as the shadow dialog's accessible name (a-input's
|
|
346
|
+
* label-mirror pattern). Shadow-internal — not a host / light-DOM write. */
|
|
347
|
+
#syncAccessibleName() {
|
|
348
|
+
const text = this.headerSlot.assignedNodes().map((n) => n.textContent ?? "").join(" ").trim();
|
|
349
|
+
if (text) this.dialog.setAttribute("aria-label", text);
|
|
350
|
+
else this.dialog.removeAttribute("aria-label");
|
|
351
|
+
}
|
|
352
|
+
// --- `name`-trigger convenience (uncontrolled only) ---
|
|
353
|
+
#syncTriggerListener() {
|
|
354
|
+
const wanted = !this.#controlled && !!this.getAttribute("name");
|
|
355
|
+
if (wanted && !this.#triggerListener) this.#wireTriggerListener();
|
|
356
|
+
else if (!wanted && this.#triggerListener) this.#teardownTriggerListener();
|
|
357
|
+
}
|
|
358
|
+
#wireTriggerListener() {
|
|
359
|
+
this.#triggerListener = (e) => {
|
|
360
|
+
const name = this.getAttribute("name");
|
|
361
|
+
if (!name) return;
|
|
362
|
+
const t = e.target;
|
|
363
|
+
if (!(t instanceof Element)) return;
|
|
364
|
+
if (t.closest(`[data-dialog-open="${CSS.escape(name)}"]`)) this.requestOpen();
|
|
365
|
+
else if (t.closest(`[data-dialog-close="${CSS.escape(name)}"]`)) this.requestClose();
|
|
366
|
+
};
|
|
367
|
+
this.doc.addEventListener("click", this.#triggerListener);
|
|
368
|
+
}
|
|
369
|
+
#teardownTriggerListener() {
|
|
370
|
+
if (this.#triggerListener) {
|
|
371
|
+
this.doc.removeEventListener("click", this.#triggerListener);
|
|
372
|
+
this.#triggerListener = void 0;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function register_a_dialog() {
|
|
377
|
+
if (typeof customElements === "undefined") return;
|
|
378
|
+
if (!customElements.get("a-dialog")) {
|
|
379
|
+
customElements.define("a-dialog", ADialogElement);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
register_a_dialog();
|
|
383
|
+
export {
|
|
384
|
+
ADialogElement,
|
|
385
|
+
register_a_dialog
|
|
386
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLElementBase } from "../anta_helpers";
|
|
1
|
+
import { HTMLElementBase, parseOpenState } from "../anta_helpers";
|
|
2
2
|
import "./a-expander.css";
|
|
3
3
|
const ANIM_MS = 200;
|
|
4
4
|
const SUMMARY_TYPE_SCALE = {
|
|
@@ -139,7 +139,7 @@ const SHADOW_STYLE = `
|
|
|
139
139
|
transition-behavior: allow-discrete;
|
|
140
140
|
}
|
|
141
141
|
`;
|
|
142
|
-
const parseState =
|
|
142
|
+
const parseState = parseOpenState;
|
|
143
143
|
class AExpanderElement extends HTMLElementBase {
|
|
144
144
|
static observedAttributes = ["state", "disabled", "round"];
|
|
145
145
|
summary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer anta{a-input-time:not(:defined){display:grid;grid-template-columns:minmax(0,1fr);row-gap:4px}a-input-time:not(:defined)>[slot=leading],a-input-time:not(:defined)>[slot=trailing],a-input-time:not(:defined)>[slot=clear],a-input-time:not(:defined)>[slot=hint]{display:none!important}a-input-time:not(:defined)>[slot=label]{display:block;color:var(--input-time-label);font-family:var(--sans-serif);font-size:15px;line-height:20px;font-weight:500}a-input-time[size=small]:not(:defined)>[slot=label]{font-size:13px;line-height:16px}a-input-time[size=large]:not(:defined)>[slot=label]{font-size:17px;line-height:22px}a-input-time:not(:defined):after{content:"\2013\2013:\2013\2013";display:block;min-height:28px;line-height:28px;padding-inline:8px;border-radius:4px;box-shadow:inset 0 0 0 .5px var(--input-time-border);color:var(--input-time-placeholder);font-family:var(--sans-serif);font-size:15px;font-weight:400;font-feature-settings:"ss02","ss05","tnum";font-variation-settings:"wdth" 100,"slnt" 0,"ital" 0;white-space:nowrap}a-input-time[size=small]:not(:defined):after{min-height:24px;line-height:24px;font-size:13px}a-input-time[size=large]:not(:defined):after{min-height:32px;line-height:32px;font-size:17px}a-input-time[round]:not(:defined):after{border-radius:var(--input-time-round, 999px)}a-input-time{transition:opacity .28s ease-out 40ms}a-input-time:not(:defined){opacity:.5}@media(prefers-reduced-motion:reduce){a-input-time{transition:none}}a-input-time{--input-time-bg: var(--bg-1);--input-time-border: var(--border-2);--input-time-border-hover: var(--border-1);--input-time-text: var(--text-1);--input-time-label: var(--text-3);--input-time-placeholder: var(--text-3);--input-time-adornment: var(--text-3);--input-time-hint: var(--text-3);--input-time-seg-focus-bg: color-mix(in oklch, var(--focus-ring) 20%, transparent);--input-time-seg-focus-text: var(--text-1);width:fit-content;max-width:100%}a-input-time[round]{--input-time-round: attr(round type(<length>), 999px)}a-input-time[size=small] a-icon{--icon-size: 14px}a-input-time[size=large] a-icon{--icon-size: 18px}a-input-time[tone]:not([tone=""]){--input-time-tone-source: attr(tone type(<color>), var(--border-2));--input-time-border: oklch(from var(--input-time-tone-source) .7 calc(c*.8) h);--input-time-border-hover: oklch(from var(--input-time-tone-source) .6 c h);.dark &{--input-time-border: oklch(from var(--input-time-tone-source) .5 calc(c*.8) h);--input-time-border-hover: oklch(from var(--input-time-tone-source) .6 c h)}}a-input-time[status=critical]{--input-time-bg: #fefbfb;--input-time-border: #de4545;--input-time-border-hover: #de4545;--input-time-hint: #c9302c}a-input-time[status=warning]{--input-time-bg: #fefbf6;--input-time-border: #ae6613;--input-time-border-hover: #ae6613;--input-time-hint: #995200}a-input-time[status=success]{--input-time-bg: #f7fcf9;--input-time-border: #329550;--input-time-border-hover: #329550;--input-time-hint: #2a7e43}a-input-time[status=info]{--input-time-bg: #fbfcfe;--input-time-border: #2686d9;--input-time-border-hover: #2686d9;--input-time-hint: #175082}a-input-time[status=brand]{--input-time-bg: #fcfcfe;--input-time-border: #7460d7;--input-time-border-hover: #7460d7;--input-time-hint: #5f4bc3}.dark a-input-time[status=critical]{--input-time-bg: #1f0506;--input-time-border: #c9302c;--input-time-border-hover: #c9302c;--input-time-hint: #e25858}.dark a-input-time[status=warning]{--input-time-bg: #120a03;--input-time-border: #995200;--input-time-border-hover: #995200;--input-time-hint: #c37416}.dark a-input-time[status=success]{--input-time-bg: #041008;--input-time-border: var(--border-1-success);--input-time-border-hover: var(--border-1-success);--input-time-hint: #3aab5c}.dark a-input-time[status=info]{--input-time-bg: #040d18;--input-time-border: #1f6eb2;--input-time-border-hover: #1f6eb2;--input-time-hint: #3e93dd}.dark a-input-time[status=brand]{--input-time-bg: #0b0916;--input-time-border: #5f4bc3;--input-time-border-hover: #5f4bc3;--input-time-hint: #8270db}a-input-time:disabled{--input-time-bg: #44374b12;--input-time-border: #44374b26;--input-time-border-hover: #44374b26;--input-time-text: var(--text-4);--input-time-label: var(--text-4);--input-time-hint: var(--text-5);cursor:not-allowed}.dark a-input-time:disabled{--input-time-bg: #e4d1ef0d;--input-time-border: #e4d1ef1f;--input-time-border-hover: #e4d1ef1f}.dark a-input-time:not([status]){--input-time-border: #49424c;--input-time-border-hover: #635b65}.dark a-input-time{--input-time-seg-focus-bg: color-mix(in oklch, var(--focus-ring) 30%, transparent)}}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTMLElementBase } from '../anta_helpers';
|
|
2
|
+
import './a-input-time.css';
|
|
3
|
+
export declare class AInputTimeElement extends HTMLElementBase {
|
|
4
|
+
#private;
|
|
5
|
+
static formAssociated: boolean;
|
|
6
|
+
static observedAttributes: string[];
|
|
7
|
+
constructor();
|
|
8
|
+
getAnchorRect(): DOMRect;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
11
|
+
/** The current time as 24-hour `"HH:mm"`, or `''` when incomplete. */
|
|
12
|
+
get value(): string;
|
|
13
|
+
set value(v: string);
|
|
14
|
+
/** Empty the field, refocus the first segment, and fire input + change. */
|
|
15
|
+
clear(): void;
|
|
16
|
+
get name(): string;
|
|
17
|
+
set name(v: string);
|
|
18
|
+
get validity(): ValidityState | undefined;
|
|
19
|
+
get validationMessage(): string;
|
|
20
|
+
get willValidate(): boolean;
|
|
21
|
+
checkValidity(): boolean;
|
|
22
|
+
reportValidity(): boolean;
|
|
23
|
+
formResetCallback(): void;
|
|
24
|
+
formDisabledCallback(disabled: boolean): void;
|
|
25
|
+
formStateRestoreCallback(state: string): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function register_a_input_time(): void;
|