@ac-design/design-system 2.9.1 → 2.10.1

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.
@@ -0,0 +1,200 @@
1
+ import { fixedFrame as e } from "./fixedFrame.js";
2
+ import t from "./AcButton.js";
3
+ import n from "./AcBadge.js";
4
+ import { Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createSlots as ee, createTextVNode as te, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, nextTick as ne, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as re, onMounted as g, onUpdated as ie, openBlock as _, ref as v, renderSlot as y, toDisplayString as b, unref as x, useId as S, useModel as ae, useSlots as C, watch as w, withCtx as T } from "vue";
5
+ import { ChevronDown as oe } from "@lucide/vue";
6
+ //#region src/lib/components/AcPopover.vue?vue&type=script&setup=true&lang.ts
7
+ var se = {
8
+ key: 1,
9
+ class: "flex shrink-0 flex-wrap items-center gap-2 border-t border-border px-4 py-3"
10
+ }, ce = { class: "ml-auto flex items-center gap-2" }, E = "a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]", D = /*@__PURE__*/ d({
11
+ __name: "AcPopover",
12
+ props: /*@__PURE__*/ f({
13
+ label: { default: "" },
14
+ title: { default: "" },
15
+ count: { default: 0 },
16
+ align: { default: "start" },
17
+ placement: { default: "bottom" },
18
+ width: { default: "md" },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: !1
22
+ }
23
+ }, {
24
+ open: {
25
+ type: Boolean,
26
+ default: !1
27
+ },
28
+ openModifiers: {}
29
+ }),
30
+ emits: /*@__PURE__*/ f(["open", "close"], ["update:open"]),
31
+ setup(d, { expose: f, emit: D }) {
32
+ let O = d, k = ae(d, "open"), A = D, j = C(), le = {
33
+ sm: 240,
34
+ md: 288,
35
+ lg: 384
36
+ }, ue = {
37
+ "top-start": "origin-top-left",
38
+ "top-end": "origin-top-right",
39
+ "bottom-start": "origin-bottom-left",
40
+ "bottom-end": "origin-bottom-right"
41
+ }, M = S(), N = `${M}-panel`, P = `${M}-title`, F = v(null), I = v(null), L = v(null), R = v({}), z = v(!1), B = v(""), V = null, H = !0, de = a(() => ue[`${z.value ? "top" : "bottom"}-${O.align}`]), fe = a(() => O.title ? { "aria-labelledby": P } : O.label ? { "aria-label": O.label } : { "aria-labelledby": B.value || void 0 });
42
+ function U() {
43
+ V = F.value?.querySelector("button, a[href], [tabindex]") ?? null, V && (V.id || (V.id = `${M}-trigger`), B.value = V.id, V.setAttribute("aria-haspopup", "dialog"), V.setAttribute("aria-expanded", String(k.value)), k.value ? V.setAttribute("aria-controls", N) : V.removeAttribute("aria-controls"));
44
+ }
45
+ function W() {
46
+ O.disabled || (k.value = !0);
47
+ }
48
+ function G(e = !0) {
49
+ k.value &&= (H = e, !1);
50
+ }
51
+ function K() {
52
+ k.value ? G() : W();
53
+ }
54
+ function q(e) {
55
+ return [...e.querySelectorAll(E)].filter((e) => e.tabIndex >= 0 && !e.closest("[inert]") && e.getClientRects().length > 0);
56
+ }
57
+ function pe() {
58
+ if (!L.value) return;
59
+ let e = L.value.querySelector("[autofocus]");
60
+ ((e && (e.matches(E) ? e : e.querySelector(E))) ?? q(L.value)[0] ?? L.value).focus();
61
+ }
62
+ function me() {
63
+ let e = q(document).filter((e) => !I.value?.contains(e));
64
+ (e[(V ? e.indexOf(V) : -1) + 1] ?? V)?.focus();
65
+ }
66
+ function he() {
67
+ G(!1), V?.focus();
68
+ }
69
+ function ge() {
70
+ G(!1), me();
71
+ }
72
+ function J(e) {
73
+ if (F.value?.contains(e) || I.value?.contains(e)) return !0;
74
+ let t = e;
75
+ for (; t && t.parentNode !== document.body;) t = t.parentNode;
76
+ return !!(t instanceof HTMLElement && t.hasAttribute("data-ac-ds") && I.value && I.value.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING);
77
+ }
78
+ function Y(e) {
79
+ e.key === "Escape" && k.value && !e.defaultPrevented && (e.preventDefault(), G());
80
+ }
81
+ function _e(e) {
82
+ let t = e.relatedTarget;
83
+ t && !J(t) && G(!1);
84
+ }
85
+ function X(e) {
86
+ J(e.target) || G(!1);
87
+ }
88
+ function Z() {
89
+ if (!V || !I.value) return;
90
+ let t = V.getBoundingClientRect(), n = e(), r = typeof O.width == "number" ? O.width : le[O.width], i = Math.min(r, n.width - 16);
91
+ I.value.style.width = `${i}px`;
92
+ let a = I.value.offsetHeight, o = n.bottom - t.bottom - 8 - 8, s = t.top - n.top - 8 - 8, c = O.placement === "top" ? s >= a || s > o : o < a && s > o, l = (O.align === "end" ? t.right - i : t.left) - n.left;
93
+ z.value = !c, R.value = {
94
+ [c ? "bottom" : "top"]: `${c ? n.bottom - t.top + 8 : t.bottom + 8 - n.top}px`,
95
+ left: `${Math.max(8, Math.min(l, n.width - i - 8))}px`,
96
+ width: `${i}px`,
97
+ maxHeight: `${Math.max(c ? s : o, 160)}px`
98
+ };
99
+ }
100
+ function Q(e) {
101
+ e?.target instanceof Node && I.value?.contains(e.target) || Z();
102
+ }
103
+ function $(e) {
104
+ e ? (document.addEventListener("pointerdown", X, !0), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q)) : (document.removeEventListener("pointerdown", X, !0), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q));
105
+ }
106
+ return w(k, async (e) => {
107
+ if (U(), $(e), !e) {
108
+ H && I.value?.contains(document.activeElement) && V?.focus(), H = !0, A("close");
109
+ return;
110
+ }
111
+ await ne(), Z(), pe(), A("open");
112
+ }), w(() => [
113
+ O.width,
114
+ O.align,
115
+ O.placement
116
+ ], () => k.value && Z()), g(U), ie(U), re(() => $(!1)), f({
117
+ open: W,
118
+ close: () => G(),
119
+ toggle: K
120
+ }), (e, a) => (_(), c("div", {
121
+ ref_key: "root",
122
+ ref: F,
123
+ class: "inline-flex",
124
+ "data-ac-ds": "",
125
+ "data-testid": "ac-popover",
126
+ onKeydown: Y
127
+ }, [j.trigger ? y(e.$slots, "trigger", {
128
+ open: k.value,
129
+ toggle: K
130
+ }, void 0, void 0, 0) : (_(), o(t, {
131
+ key: 1,
132
+ variant: "outlined",
133
+ color: d.count > 0 ? "primary" : "neutral",
134
+ disabled: d.disabled,
135
+ class: "grow",
136
+ onClick: K
137
+ }, ee({
138
+ "icon-right": T(() => [u(x(oe), {
139
+ class: m(["transition-transform duration-200 motion-reduce:transition-none", k.value && "rotate-180"]),
140
+ "aria-hidden": "true"
141
+ }, null, 8, ["class"])]),
142
+ default: T(() => [te(" " + b(d.label) + " ", 1), d.count > 0 ? (_(), o(n, {
143
+ key: 0,
144
+ color: "primary",
145
+ label: String(d.count)
146
+ }, null, 8, ["label"])) : s("", !0)]),
147
+ _: 2
148
+ }, [j.icon ? {
149
+ name: "icon",
150
+ fn: T(() => [y(e.$slots, "icon")]),
151
+ key: "0"
152
+ } : void 0]), 1032, ["color", "disabled"])), (_(), o(r, { to: "body" }, [u(i, {
153
+ "enter-active-class": "transition-[opacity,scale] duration-150 ease-out motion-reduce:transition-none",
154
+ "enter-from-class": "opacity-0 motion-safe:scale-95",
155
+ "leave-active-class": "pointer-events-none transition-[opacity,scale] duration-100 ease-in motion-reduce:transition-none",
156
+ "leave-to-class": "opacity-0 motion-safe:scale-95"
157
+ }, {
158
+ default: T(() => [k.value ? (_(), c("div", {
159
+ key: 0,
160
+ ref_key: "layer",
161
+ ref: I,
162
+ class: m(["fixed z-[90] flex flex-col", de.value]),
163
+ style: h(R.value),
164
+ "data-ac-ds": "",
165
+ "data-testid": "ac-popover-panel",
166
+ onKeydown: Y,
167
+ onFocusout: _e
168
+ }, [
169
+ l("span", {
170
+ tabindex: "0",
171
+ class: "sr-only",
172
+ onFocus: he
173
+ }, null, 32),
174
+ l("div", p({
175
+ id: N,
176
+ ref_key: "panel",
177
+ ref: L,
178
+ role: "dialog",
179
+ tabindex: "-1"
180
+ }, fe.value, { class: "flex min-h-0 flex-col overflow-hidden rounded-14 border border-border bg-surface text-base text-body shadow-lg outline-none" }), [
181
+ d.title ? (_(), c("h2", {
182
+ key: 0,
183
+ id: P,
184
+ class: "m-0 shrink-0 px-4 pt-4 text-base leading-5 font-semibold tracking-normal text-heading"
185
+ }, b(d.title), 1)) : s("", !0),
186
+ l("div", { class: m(["ac-scrollbar min-h-0 overflow-y-auto p-4", d.title && "pt-3"]) }, [y(e.$slots, "default")], 2),
187
+ j.footer || j["footer-left"] ? (_(), c("div", se, [y(e.$slots, "footer-left"), l("div", ce, [y(e.$slots, "footer")])])) : s("", !0)
188
+ ], 16),
189
+ l("span", {
190
+ tabindex: "0",
191
+ class: "sr-only",
192
+ onFocus: ge
193
+ }, null, 32)
194
+ ], 38)) : s("", !0)]),
195
+ _: 3
196
+ })]))], 544));
197
+ }
198
+ });
199
+ //#endregion
200
+ export { D as default };
@@ -1,3 +1,4 @@
1
+ import type { HTMLAttributes } from "vue";
1
2
  import type { Tone } from "./types";
2
3
  /** One coloured part of a segmented bar. */
3
4
  export interface ProgressSegment {
@@ -7,18 +8,37 @@ export interface ProgressSegment {
7
8
  color?: Tone | "pending" | "neutral";
8
9
  /** Name in the legend and the accessible summary, e.g. "Healthy". */
9
10
  label?: string;
11
+ /** `soft` fills at half strength, for parts that matter less: skipped, pending or idle time. */
12
+ variant?: "solid" | "soft";
13
+ }
14
+ /** A point drawn on the track, e.g. a hard limit or an average. */
15
+ export interface ProgressMarker {
16
+ /** Where the marker sits, in the bar's unit: from 0 to `max`. */
17
+ value: number;
18
+ /** Shown on hover and read by screen readers, e.g. "Hard limit 16 cores". */
19
+ label?: string;
20
+ /** `tick` is a short upright line, for a limit; `dot` is a round handle, for a single point such as an average. */
21
+ shape?: "tick" | "dot";
22
+ /** Marker colour. A tick is `neutral` and a dot `primary` unless you set it. */
23
+ color?: Tone | "neutral";
10
24
  }
11
25
  export interface Props {
12
26
  /** Current amount, from 0 to `max`. Ignored while `indeterminate` or when `segments` is set. */
13
27
  value?: number;
14
28
  /** The amount that fills the bar: 100 for a single value. With `segments`, the sum of the segments unless you set it. */
15
29
  max?: number;
16
- /** Splits the bar into coloured parts, e.g. healthy, warning and hard-limit quotas: `{ value, color?, label? }[]`. Replaces `value`. */
30
+ /** Splits the bar into coloured parts, e.g. healthy, warning and hard-limit quotas: `{ value, color?, label?, variant? }[]`. Replaces `value`. */
17
31
  segments?: ProgressSegment[];
18
32
  /** Segments only: where the legend goes. `auto` puts it to the `right` of the bar when any segment has a `label`; `bottom` puts it under; `false` hides it. */
19
33
  legend?: boolean | "auto" | "right" | "bottom";
34
+ /** Segments only: leaves a 2px gap between parts so neighbours with close colours stay apart. */
35
+ gap?: boolean;
36
+ /** Points drawn on the track at `value` of `max`, e.g. a hard limit or an average: `{ value, label?, shape?, color? }[]`. */
37
+ markers?: ProgressMarker[];
20
38
  /** Text above the bar, e.g. "Storage". Also the bar's accessible name. */
21
39
  label?: string;
40
+ /** Classes for the label, e.g. `sr-only` to hide it when a card title already names the bar, while screen readers still read it. */
41
+ labelClass?: HTMLAttributes["class"];
22
42
  /** Shows the value to the right of the label: the percentage, or `valueText` when set. */
23
43
  showValue?: boolean;
24
44
  /** Replaces the percentage, e.g. "7.2 GiB of 10 GiB". Also read by screen readers. */
@@ -37,10 +57,13 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
37
57
  color: Tone | "auto";
38
58
  max: number;
39
59
  size: "small" | "normal" | "large";
60
+ gap: boolean;
61
+ labelClass: string | false | Record<string, any> | import("vue").ClassValue[] | null;
40
62
  indeterminate: boolean;
41
63
  valueText: string;
42
64
  showValue: boolean;
43
65
  segments: ProgressSegment[];
66
+ markers: ProgressMarker[];
44
67
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
68
  declare const _default: typeof __VLS_export;
46
69
  export default _default;
@@ -1,24 +1,22 @@
1
- import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, openBlock as l, renderList as u, toDisplayString as d, unref as f, useId as p } from "vue";
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as ee, defineComponent as a, mergeProps as te, normalizeClass as o, normalizeStyle as s, openBlock as c, renderList as l, toDisplayString as u, unref as d, useAttrs as f, useId as p } from "vue";
2
2
  //#region src/lib/components/AcProgress.vue?vue&type=script&setup=true&lang.ts
3
3
  var m = {
4
- class: "w-full",
5
- "data-ac-ds": "",
6
- "data-testid": "ac-progress"
7
- }, h = {
8
4
  key: 0,
9
- class: "mb-2 flex items-baseline justify-between gap-3 text-base"
10
- }, g = ["id"], _ = ["aria-label"], v = {
11
- key: 0,
12
- class: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1",
13
- "aria-hidden": "true"
14
- }, y = { class: "tabular-nums" }, b = [
5
+ class: "flex items-baseline justify-between gap-3 text-base"
6
+ }, h = ["id"], g = ["id"], _ = ["aria-label", "aria-describedby"], v = [
15
7
  "aria-labelledby",
16
8
  "aria-label",
9
+ "aria-describedby",
17
10
  "aria-valuemax",
18
11
  "aria-valuenow",
19
12
  "aria-valuetext",
20
13
  "aria-busy"
21
- ], x = /*@__PURE__*/ o({
14
+ ], y = ["title"], b = {
15
+ key: 0,
16
+ class: "flex shrink-0 flex-wrap items-center gap-x-3 gap-y-1",
17
+ "aria-hidden": "true"
18
+ }, x = { class: "tabular-nums" }, S = /*@__PURE__*/ a({
19
+ inheritAttrs: !1,
22
20
  __name: "AcProgress",
23
21
  props: {
24
22
  value: { default: 0 },
@@ -28,7 +26,22 @@ var m = {
28
26
  type: [Boolean, String],
29
27
  default: "auto"
30
28
  },
29
+ gap: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ markers: { default: () => [] },
31
34
  label: { default: "" },
35
+ labelClass: {
36
+ type: [
37
+ Boolean,
38
+ null,
39
+ String,
40
+ Object,
41
+ Array
42
+ ],
43
+ default: void 0
44
+ },
32
45
  showValue: {
33
46
  type: Boolean,
34
47
  default: !1
@@ -41,18 +54,26 @@ var m = {
41
54
  },
42
55
  size: { default: "normal" }
43
56
  },
44
- setup(o) {
45
- let x = o, S = {
57
+ setup(a) {
58
+ let S = a, C = {
46
59
  primary: "bg-primary",
47
60
  info: "bg-info",
48
61
  success: "bg-success",
49
62
  warning: "bg-warning",
50
63
  danger: "bg-danger"
51
- }, C = {
52
- ...S,
64
+ }, w = {
65
+ ...C,
53
66
  pending: "bg-pending",
54
67
  neutral: "bg-chart-8"
55
- }, w = [
68
+ }, T = {
69
+ primary: "bg-primary/50",
70
+ info: "bg-info/50",
71
+ success: "bg-success/50",
72
+ warning: "bg-warning/50",
73
+ danger: "bg-danger/50",
74
+ pending: "bg-pending/50",
75
+ neutral: "bg-muted/40"
76
+ }, E = [
56
77
  "bg-chart-1",
57
78
  "bg-chart-2",
58
79
  "bg-chart-3",
@@ -61,70 +82,131 @@ var m = {
61
82
  "bg-chart-6",
62
83
  "bg-chart-7",
63
84
  "bg-chart-8"
64
- ], T = {
85
+ ], D = [
86
+ "bg-chart-1/50",
87
+ "bg-chart-2/50",
88
+ "bg-chart-3/50",
89
+ "bg-chart-4/50",
90
+ "bg-chart-5/50",
91
+ "bg-chart-6/50",
92
+ "bg-chart-7/50",
93
+ "bg-muted/40"
94
+ ], O = {
95
+ ...C,
96
+ neutral: "bg-muted"
97
+ }, k = {
65
98
  small: "h-1",
66
99
  normal: "h-1.5",
67
100
  large: "h-2.5"
68
- }, E = p(), D = t(() => !!x.segments?.length), O = t(() => (x.segments ?? []).reduce((e, t) => e + Math.max(0, t.value), 0)), k = t(() => x.max ?? (D.value ? O.value : 100)), A = t(() => {
69
- if (k.value <= 0) return 0;
70
- let e = D.value ? O.value : x.value;
71
- return Math.min(100, Math.max(0, e / k.value * 100));
72
- }), j = t(() => (x.segments ?? []).map((e, t) => ({
73
- key: `${t}-${e.label ?? ""}`,
74
- label: e.label ?? "",
75
- value: e.value,
76
- fill: e.color ? C[e.color] : w[t % w.length],
77
- width: k.value > 0 ? Math.max(0, e.value) / k.value * 100 : 0
78
- }))), M = t(() => !D.value || x.legend === !1 ? null : x.legend === "bottom" ? "bottom" : x.legend === "auto" ? j.value.some((e) => e.label) ? "right" : null : "right"), N = t(() => {
79
- let e = j.value.map((e, t) => `${e.label || `Part ${t + 1}`} ${e.value}`).join(", ");
80
- return x.label ? `${x.label}: ${e}` : e;
81
- }), P = t(() => x.color === "auto" ? A.value >= 95 ? "danger" : A.value >= 80 ? "warning" : "primary" : x.color), F = t(() => x.valueText || `${Math.round(A.value)}%`), I = t(() => x.indeterminate && !D.value), L = t(() => !!x.label || x.showValue && !I.value);
82
- return (t, p) => (l(), r("div", m, [L.value ? (l(), r("div", h, [o.label ? (l(), r("span", {
83
- key: 0,
84
- id: `${f(E)}-label`,
85
- class: "min-w-0 truncate font-medium text-heading"
86
- }, d(o.label), 9, g)) : n("", !0), o.showValue && !I.value ? (l(), r("span", {
87
- key: 1,
88
- class: s(["ml-auto shrink-0 text-xs tabular-nums", o.color === "auto" && P.value !== "primary" ? P.value === "danger" ? "font-medium text-danger-strong" : "font-medium text-warning-strong" : "text-muted"]),
89
- "aria-hidden": "true"
90
- }, d(F.value), 3)) : n("", !0)])) : n("", !0), D.value ? (l(), r("div", {
91
- key: 1,
92
- class: s(["flex", M.value === "bottom" ? "flex-col gap-2" : "flex-wrap items-center gap-x-4 gap-y-2"])
93
- }, [i("div", {
94
- role: "img",
95
- "aria-label": N.value,
96
- class: s(["flex min-w-[120px] flex-1 overflow-hidden rounded-full bg-surface-sunken", T[o.size]])
97
- }, [(l(!0), r(e, null, u(j.value, (t) => (l(), r(e, { key: t.key }, [t.width > 0 ? (l(), r("div", {
98
- key: 0,
99
- class: s(["h-full shrink-0 transition-[width] duration-300 ease-out motion-reduce:transition-none", t.fill]),
100
- style: c({ width: `${t.width}%` })
101
- }, null, 6)) : n("", !0)], 64))), 128))], 10, _), M.value ? (l(), r("ul", v, [(l(!0), r(e, null, u(j.value, (e) => (l(), r("li", {
102
- key: e.key,
103
- class: "flex items-center gap-1.5 text-xs leading-4 text-muted"
104
- }, [
105
- i("span", { class: s(["size-1.5 shrink-0 rounded-full", e.fill]) }, null, 2),
106
- a(" " + d(e.label) + " ", 1),
107
- i("span", y, d(e.value), 1)
108
- ]))), 128))])) : n("", !0)], 2)) : (l(), r("div", {
109
- key: 2,
110
- role: "progressbar",
111
- "aria-labelledby": o.label ? `${f(E)}-label` : void 0,
112
- "aria-label": o.label ? void 0 : "Progress",
113
- "aria-valuemin": "0",
114
- "aria-valuemax": o.indeterminate ? void 0 : k.value,
115
- "aria-valuenow": o.indeterminate ? void 0 : Math.min(k.value, Math.max(0, o.value)),
116
- "aria-valuetext": o.indeterminate ? void 0 : F.value,
117
- "aria-busy": o.indeterminate || void 0,
118
- class: s(["relative w-full overflow-hidden rounded-full bg-surface-sunken", T[o.size]])
119
- }, [o.indeterminate ? (l(), r("div", {
120
- key: 0,
121
- class: s(["ac-progress-indeterminate absolute inset-y-0 left-0 w-2/5 rounded-full motion-reduce:w-full motion-reduce:opacity-40", S[P.value]])
122
- }, null, 2)) : (l(), r("div", {
123
- key: 1,
124
- class: s(["h-full rounded-full transition-[width,background-color] duration-300 ease-out motion-reduce:transition-none", S[P.value]]),
125
- style: c({ width: `${A.value}%` })
126
- }, null, 6))], 10, b))]));
101
+ }, A = {
102
+ small: "h-2.5",
103
+ normal: "h-3",
104
+ large: "h-4"
105
+ }, j = {
106
+ small: "size-2.5",
107
+ normal: "size-3",
108
+ large: "size-4"
109
+ }, M = f(), N = p(), P = t(() => {
110
+ let { "aria-label": e, "aria-labelledby": t, "aria-describedby": n, ...r } = M;
111
+ return r;
112
+ }), F = t(() => typeof M["aria-label"] == "string" ? M["aria-label"] : ""), I = t(() => typeof M["aria-labelledby"] == "string" ? M["aria-labelledby"] : ""), L = t(() => !!S.segments?.length), R = t(() => (S.segments ?? []).reduce((e, t) => e + Math.max(0, t.value), 0)), z = t(() => S.max ?? (L.value ? R.value : 100)), B = t(() => z.value <= 0 ? 0 : $(L.value ? R.value : S.value)), V = t(() => (S.segments ?? []).map((e, t) => {
113
+ let n = e.variant === "soft", r = e.color ? (n ? T : w)[e.color] : (n ? D : E)[t % E.length];
114
+ return {
115
+ key: `${t}-${e.label ?? ""}`,
116
+ label: e.label ?? "",
117
+ value: e.value,
118
+ fill: r,
119
+ grow: Math.max(0, e.value)
120
+ };
121
+ })), H = t(() => Math.max(0, z.value - R.value)), U = t(() => !L.value || S.legend === !1 ? null : S.legend === "bottom" ? "bottom" : S.legend === "auto" ? V.value.some((e) => e.label) ? "right" : null : "right"), W = t(() => F.value || S.label), G = t(() => {
122
+ let e = V.value.map((e, t) => `${e.label || `Part ${t + 1}`} ${e.value}`).join(", ");
123
+ return W.value ? `${W.value}: ${e}` : e;
124
+ }), K = t(() => S.color === "auto" ? B.value >= 95 ? "danger" : B.value >= 80 ? "warning" : "primary" : S.color), q = t(() => S.valueText || `${Math.round(B.value)}%`), J = t(() => S.indeterminate && !L.value), ne = t(() => !!S.label || S.showValue && !J.value), Y = t(() => J.value ? [] : S.markers.map((e, t) => {
125
+ let n = e.shape ?? "tick", r = $(e.value);
126
+ return {
127
+ key: `${t}-${e.label ?? ""}`,
128
+ shape: n,
129
+ position: r,
130
+ text: e.label || `Marker at ${Math.round(r)}%`,
131
+ fill: O[e.color ?? (n === "dot" ? "primary" : "neutral")]
132
+ };
133
+ })), X = t(() => Y.value.map((e) => e.text).join(", ")), Z = t(() => {
134
+ if (!F.value) return I.value ? I.value : S.label ? `${N}-label` : void 0;
135
+ }), Q = t(() => {
136
+ let e = [M["aria-describedby"], X.value ? `${N}-markers` : ""].filter(Boolean);
137
+ return e.length ? e.join(" ") : void 0;
138
+ });
139
+ function $(e) {
140
+ return z.value <= 0 ? 0 : Math.min(100, Math.max(0, e / z.value * 100));
141
+ }
142
+ return (t, f) => (c(), r("div", te({
143
+ class: "w-full",
144
+ "data-ac-ds": "",
145
+ "data-testid": "ac-progress"
146
+ }, P.value), [
147
+ ne.value ? (c(), r("div", m, [a.label ? (c(), r("span", {
148
+ key: 0,
149
+ id: `${d(N)}-label`,
150
+ class: o(["mb-2 min-w-0 truncate font-medium text-heading", a.labelClass])
151
+ }, u(a.label), 11, h)) : n("", !0), a.showValue && !J.value ? (c(), r("span", {
152
+ key: 1,
153
+ class: o(["mb-2 ml-auto shrink-0 text-xs tabular-nums", a.color === "auto" && K.value !== "primary" ? K.value === "danger" ? "font-medium text-danger-strong" : "font-medium text-warning-strong" : "text-muted"]),
154
+ "aria-hidden": "true"
155
+ }, u(q.value), 3)) : n("", !0)])) : n("", !0),
156
+ X.value ? (c(), r("span", {
157
+ key: 1,
158
+ id: `${d(N)}-markers`,
159
+ hidden: ""
160
+ }, u(X.value), 9, g)) : n("", !0),
161
+ i("div", { class: o(L.value && (U.value === "bottom" ? "flex flex-col gap-2" : "flex flex-wrap items-center gap-x-4 gap-y-2")) }, [i("div", { class: o(["relative", [L.value && "min-w-[120px] flex-1", Y.value.length && "py-[3px]"]]) }, [L.value ? (c(), r("div", {
162
+ key: 0,
163
+ role: "img",
164
+ "aria-label": G.value,
165
+ "aria-describedby": Q.value,
166
+ class: o(["flex w-full overflow-hidden rounded-full bg-surface-sunken", [k[a.size], a.gap && "gap-0.5"]])
167
+ }, [(c(!0), r(e, null, l(V.value, (t) => (c(), r(e, { key: t.key }, [t.grow > 0 ? (c(), r("div", {
168
+ key: 0,
169
+ class: o(["h-full min-w-1 basis-0 transition-[flex-grow] duration-300 ease-out motion-reduce:transition-none", t.fill]),
170
+ style: s({ flexGrow: t.grow })
171
+ }, null, 6)) : n("", !0)], 64))), 128)), H.value > 0 ? (c(), r("div", {
172
+ key: 0,
173
+ class: "h-full basis-0",
174
+ style: s({ flexGrow: H.value })
175
+ }, null, 4)) : n("", !0)], 10, _)) : (c(), r("div", {
176
+ key: 1,
177
+ role: "progressbar",
178
+ "aria-labelledby": Z.value,
179
+ "aria-label": F.value || (Z.value ? void 0 : "Progress"),
180
+ "aria-describedby": Q.value,
181
+ "aria-valuemin": "0",
182
+ "aria-valuemax": a.indeterminate ? void 0 : z.value,
183
+ "aria-valuenow": a.indeterminate ? void 0 : Math.min(z.value, Math.max(0, a.value)),
184
+ "aria-valuetext": a.indeterminate ? void 0 : q.value,
185
+ "aria-busy": a.indeterminate || void 0,
186
+ class: o(["relative w-full overflow-hidden rounded-full bg-surface-sunken", k[a.size]])
187
+ }, [a.indeterminate ? (c(), r("div", {
188
+ key: 0,
189
+ class: o(["ac-progress-indeterminate absolute inset-y-0 left-0 w-2/5 rounded-full motion-reduce:w-full motion-reduce:opacity-40", C[K.value]])
190
+ }, null, 2)) : (c(), r("div", {
191
+ key: 1,
192
+ class: o(["h-full rounded-full transition-[width,background-color] duration-300 ease-out motion-reduce:transition-none", C[K.value]]),
193
+ style: s({ width: `${B.value}%` })
194
+ }, null, 6))], 10, v)), (c(!0), r(e, null, l(Y.value, (e) => (c(), r("span", {
195
+ key: e.key,
196
+ class: o(["absolute top-1/2 flex -translate-x-1/2 -translate-y-1/2 justify-center", e.shape === "tick" ? ["w-2", A[a.size]] : j[a.size]]),
197
+ style: s({ left: `${e.position}%` }),
198
+ title: e.text,
199
+ "aria-hidden": "true"
200
+ }, [i("span", { class: o(["rounded-full", [e.fill, e.shape === "tick" ? "h-full w-0.5" : "size-full border-2 border-surface shadow-sm"]]) }, null, 2)], 14, y))), 128))], 2), U.value ? (c(), r("ul", b, [(c(!0), r(e, null, l(V.value, (e) => (c(), r("li", {
201
+ key: e.key,
202
+ class: "flex items-center gap-1.5 text-xs leading-4 text-muted"
203
+ }, [
204
+ i("span", { class: o(["size-1.5 shrink-0 rounded-full", e.fill]) }, null, 2),
205
+ ee(" " + u(e.label) + " ", 1),
206
+ i("span", x, u(e.value), 1)
207
+ ]))), 128))])) : n("", !0)], 2)
208
+ ], 16));
127
209
  }
128
210
  });
129
211
  //#endregion
130
- export { x as default };
212
+ export { S as default };