@arcadeai/design-system 3.38.0 → 3.38.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.
- package/dist/assets/index.css +1 -1
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/variables.css +1 -1
- package/dist/components/index.js +287 -284
- package/dist/components/ui/atoms/index.d.ts +1 -0
- package/dist/components/ui/atoms/index.d.ts.map +1 -1
- package/dist/components/ui/atoms/index.js +184 -181
- package/dist/components/ui/atoms/sparkle-burst.d.ts +21 -0
- package/dist/components/ui/atoms/sparkle-burst.d.ts.map +1 -0
- package/dist/components/ui/atoms/sparkle-burst.js +29 -0
- package/dist/components/ui/index.js +287 -284
- package/dist/components/ui/molecules/steps-progress.d.ts +14 -1
- package/dist/components/ui/molecules/steps-progress.d.ts.map +1 -1
- package/dist/components/ui/molecules/steps-progress.js +137 -91
- package/dist/main.js +230 -227
- package/package.json +1 -1
|
@@ -9,10 +9,23 @@ export type Step = {
|
|
|
9
9
|
export type StepsProgressProps = {
|
|
10
10
|
steps: Step[];
|
|
11
11
|
onDismiss?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* When true, `StepsProgress` watches for any step whose status transitions
|
|
14
|
+
* into `complete` and renders a one-shot `SparkleBurst` overlay on that step
|
|
15
|
+
* to celebrate. The overlay is `aria-hidden` + `pointer-events-none`, so the
|
|
16
|
+
* underlying step (including its click handler) remains fully interactive.
|
|
17
|
+
*
|
|
18
|
+
* Nothing animates on initial mount — only on subsequent status changes —
|
|
19
|
+
* so already-complete steps won't sparkle on first render. The sparkle lasts
|
|
20
|
+
* for `DS_SPARKLE_DURATION_MS` (see `sparkle-burst.tsx`) and then clears.
|
|
21
|
+
*
|
|
22
|
+
* Respects `prefers-reduced-motion` via token CSS.
|
|
23
|
+
*/
|
|
24
|
+
animateStepTransitions?: boolean;
|
|
12
25
|
} & React.ComponentProps<"section">;
|
|
13
26
|
export declare function getMobileIndexForSteps(steps: Step[], options?: {
|
|
14
27
|
currentIndex?: number;
|
|
15
28
|
isDismissible?: boolean;
|
|
16
29
|
}): number;
|
|
17
|
-
export declare function StepsProgress({ steps, onDismiss, className, ...props }: StepsProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function StepsProgress({ steps, onDismiss, animateStepTransitions, className, ...props }: StepsProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
18
31
|
//# sourceMappingURL=steps-progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps-progress.d.ts","sourceRoot":"","sources":["../../../../lib/components/ui/molecules/steps-progress.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"steps-progress.d.ts","sourceRoot":"","sources":["../../../../lib/components/ui/molecules/steps-progress.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAUpC,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9D,MAAM,MAAM,IAAI,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;;;;;;;;;;OAWG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;AAsDpC,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,IAAI,EAAE,EACb,OAAO,CAAC,EAAE;IACR,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,UAwBF;AAuBD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,SAAS,EACT,sBAA8B,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAuMpB"}
|
|
@@ -1,151 +1,197 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ChevronLeft as
|
|
3
|
-
import { useState as C, useLayoutEffect as
|
|
4
|
-
import { Button as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsxs as f, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft as B, X as S, ChevronRight as D } from "lucide-react";
|
|
3
|
+
import { useState as C, useLayoutEffect as E, useRef as x, useEffect as M } from "react";
|
|
4
|
+
import { Button as j } from "../atoms/button.js";
|
|
5
|
+
import { DS_SPARKLE_DURATION_MS as P, SparkleBurst as _ } from "../atoms/sparkle-burst.js";
|
|
6
|
+
import { StepIndicator as G } from "../atoms/step-indicator.js";
|
|
7
|
+
import { cn as u } from "../../../lib/utils.js";
|
|
8
|
+
function K({ step: e, stepNumber: t, isAttention: r }) {
|
|
9
|
+
const o = /* @__PURE__ */ n(
|
|
10
|
+
G,
|
|
10
11
|
{
|
|
11
12
|
className: "min-w-0",
|
|
12
13
|
label: e.label,
|
|
13
14
|
status: e.status,
|
|
14
15
|
stepNumber: t
|
|
15
16
|
}
|
|
17
|
+
), c = u(
|
|
18
|
+
"flex min-w-0 flex-1 items-center justify-center",
|
|
19
|
+
r && "step-attention-target"
|
|
16
20
|
);
|
|
17
21
|
return e.onClick ? /* @__PURE__ */ n(
|
|
18
22
|
"button",
|
|
19
23
|
{
|
|
20
|
-
className: "
|
|
24
|
+
className: u(c, "cursor-pointer"),
|
|
21
25
|
onClick: e.onClick,
|
|
22
26
|
type: "button",
|
|
23
|
-
children:
|
|
27
|
+
children: o
|
|
24
28
|
}
|
|
25
|
-
) : /* @__PURE__ */ n("span", { className:
|
|
29
|
+
) : /* @__PURE__ */ n("span", { className: c, children: o });
|
|
26
30
|
}
|
|
27
|
-
function
|
|
31
|
+
function R(e) {
|
|
28
32
|
return e.length - 1;
|
|
29
33
|
}
|
|
30
|
-
function
|
|
34
|
+
function F(e) {
|
|
31
35
|
return e.findIndex((t) => t.status === "active");
|
|
32
36
|
}
|
|
33
|
-
function
|
|
34
|
-
return e.length === 0 ? t ? 0 : -1 : t ? e.length :
|
|
37
|
+
function L(e, t) {
|
|
38
|
+
return e.length === 0 ? t ? 0 : -1 : t ? e.length : R(e);
|
|
35
39
|
}
|
|
36
|
-
function
|
|
37
|
-
const { currentIndex: r, isDismissible:
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
40
|
+
function p(e, t) {
|
|
41
|
+
const { currentIndex: r, isDismissible: o = !1 } = t ?? {}, c = F(e);
|
|
42
|
+
if (c >= 0)
|
|
43
|
+
return c;
|
|
40
44
|
if (e.length === 0)
|
|
41
|
-
return
|
|
42
|
-
const
|
|
43
|
-
return r !== void 0 && r >= 0 && r <=
|
|
45
|
+
return o ? 0 : -1;
|
|
46
|
+
const a = L(e, o);
|
|
47
|
+
return r !== void 0 && r >= 0 && r <= a ? r : R(e);
|
|
44
48
|
}
|
|
45
|
-
function
|
|
46
|
-
const
|
|
47
|
-
return t >= 0 && t <=
|
|
49
|
+
function O(e, t, r) {
|
|
50
|
+
const o = L(e, r);
|
|
51
|
+
return t >= 0 && t <= o ? t : p(e, {
|
|
48
52
|
currentIndex: t,
|
|
49
53
|
isDismissible: r
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
|
-
function
|
|
56
|
+
function U(e) {
|
|
53
57
|
return `calc(${(e - 1) / e} * (100% - 4.25rem) + 0.75rem)`;
|
|
54
58
|
}
|
|
55
|
-
function
|
|
59
|
+
function W({
|
|
56
60
|
steps: e,
|
|
57
61
|
onDismiss: t,
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
animateStepTransitions: r = !1,
|
|
63
|
+
className: o,
|
|
64
|
+
...c
|
|
60
65
|
}) {
|
|
61
|
-
const
|
|
62
|
-
() =>
|
|
66
|
+
const a = !!t, [T, h] = C(
|
|
67
|
+
() => p(e, { isDismissible: a })
|
|
63
68
|
);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
currentIndex:
|
|
68
|
-
isDismissible:
|
|
69
|
+
E(() => {
|
|
70
|
+
h(
|
|
71
|
+
(i) => p(e, {
|
|
72
|
+
currentIndex: i,
|
|
73
|
+
isDismissible: a
|
|
69
74
|
})
|
|
70
75
|
);
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
76
|
+
}, [a, e]);
|
|
77
|
+
const [g, v] = C(void 0), b = x(null), d = x(null), N = x(0);
|
|
78
|
+
M(() => {
|
|
79
|
+
const i = b.current, m = new Map(e.map((l) => [l.id, l.status]));
|
|
80
|
+
if (i === null) {
|
|
81
|
+
b.current = m;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (r) {
|
|
85
|
+
const l = e.find(
|
|
86
|
+
(y) => y.status === "complete" && i.get(y.id) !== "complete"
|
|
87
|
+
);
|
|
88
|
+
l && (d.current !== null && window.clearTimeout(d.current), N.current += 1, v({ stepId: l.id, key: N.current }), d.current = window.setTimeout(() => {
|
|
89
|
+
v(void 0), d.current = null;
|
|
90
|
+
}, P));
|
|
91
|
+
}
|
|
92
|
+
b.current = m;
|
|
93
|
+
}, [r, e]), M(
|
|
94
|
+
() => () => {
|
|
95
|
+
d.current !== null && window.clearTimeout(d.current);
|
|
96
|
+
},
|
|
97
|
+
[]
|
|
98
|
+
);
|
|
99
|
+
const s = O(
|
|
73
100
|
e,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
),
|
|
77
|
-
return /* @__PURE__ */
|
|
101
|
+
T,
|
|
102
|
+
a
|
|
103
|
+
), z = e[s], k = e.length, w = s > 0, I = a ? s < k : s < e.length - 1, A = a && e.at(-1)?.status === "active";
|
|
104
|
+
return /* @__PURE__ */ f(
|
|
78
105
|
"section",
|
|
79
106
|
{
|
|
80
107
|
"aria-label": "Steps progress",
|
|
81
|
-
className:
|
|
108
|
+
className: u(
|
|
82
109
|
"relative h-14 overflow-hidden border border-border bg-card text-foreground",
|
|
83
|
-
|
|
110
|
+
o
|
|
84
111
|
),
|
|
85
|
-
...
|
|
112
|
+
...c,
|
|
86
113
|
children: [
|
|
87
|
-
|
|
114
|
+
A && /* @__PURE__ */ n(
|
|
88
115
|
"span",
|
|
89
116
|
{
|
|
90
117
|
"aria-hidden": "true",
|
|
91
118
|
className: "pointer-events-none absolute top-0 right-0 z-10 hidden h-0.5 bg-foreground sm:block",
|
|
92
|
-
style: { left:
|
|
119
|
+
style: { left: U(e.length) }
|
|
93
120
|
}
|
|
94
121
|
),
|
|
95
|
-
|
|
122
|
+
z?.status === "active" && /* @__PURE__ */ n(
|
|
96
123
|
"span",
|
|
97
124
|
{
|
|
98
125
|
"aria-hidden": "true",
|
|
99
126
|
className: "pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 bg-foreground sm:hidden"
|
|
100
127
|
}
|
|
101
128
|
),
|
|
102
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ f("div", { className: "relative z-10 flex h-full items-center sm:gap-3 sm:px-3", children: [
|
|
103
130
|
/* @__PURE__ */ n(
|
|
104
131
|
"button",
|
|
105
132
|
{
|
|
106
133
|
"aria-label": "Go to previous step",
|
|
107
|
-
className:
|
|
134
|
+
className: u(
|
|
108
135
|
"flex h-full shrink-0 items-center px-2 text-muted-foreground sm:hidden",
|
|
109
|
-
!
|
|
136
|
+
!w && "pointer-events-none invisible"
|
|
110
137
|
),
|
|
111
|
-
onClick: () =>
|
|
112
|
-
tabIndex:
|
|
138
|
+
onClick: () => h(s - 1),
|
|
139
|
+
tabIndex: w ? 0 : -1,
|
|
113
140
|
type: "button",
|
|
114
|
-
children: /* @__PURE__ */ n(
|
|
141
|
+
children: /* @__PURE__ */ n(B, { className: "h-4 w-4" })
|
|
115
142
|
}
|
|
116
143
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
e.map((
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
children: [
|
|
128
|
-
m > 0 && /* @__PURE__ */ n(
|
|
129
|
-
"span",
|
|
130
|
-
{
|
|
131
|
-
"aria-hidden": "true",
|
|
132
|
-
className: "absolute left-0 hidden h-full w-px bg-border sm:block"
|
|
133
|
-
}
|
|
144
|
+
/* @__PURE__ */ f("ol", { className: "flex h-full min-w-0 flex-1 items-center gap-0", children: [
|
|
145
|
+
e.map((i, m) => {
|
|
146
|
+
const l = g?.stepId === i.id;
|
|
147
|
+
return /* @__PURE__ */ f(
|
|
148
|
+
"li",
|
|
149
|
+
{
|
|
150
|
+
"aria-current": i.status === "active" ? "step" : void 0,
|
|
151
|
+
className: u(
|
|
152
|
+
"relative isolate flex h-full min-w-0 flex-1 items-center justify-center px-2 py-4 sm:px-3",
|
|
153
|
+
m !== s && "hidden sm:flex"
|
|
134
154
|
),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
155
|
+
"data-attention": l ? "true" : void 0,
|
|
156
|
+
"data-status": i.status,
|
|
157
|
+
children: [
|
|
158
|
+
m > 0 && /* @__PURE__ */ n(
|
|
159
|
+
"span",
|
|
160
|
+
{
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
className: "absolute left-0 hidden h-full w-px bg-border sm:block"
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ n(
|
|
166
|
+
K,
|
|
167
|
+
{
|
|
168
|
+
isAttention: l,
|
|
169
|
+
step: i,
|
|
170
|
+
stepNumber: m + 1
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
l ? /* @__PURE__ */ n(
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
"aria-hidden": !0,
|
|
177
|
+
className: "pointer-events-none absolute inset-0 z-30 flex items-center justify-center",
|
|
178
|
+
children: /* @__PURE__ */ n(_, {}, g.key)
|
|
179
|
+
}
|
|
180
|
+
) : null
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
i.id
|
|
184
|
+
);
|
|
185
|
+
}),
|
|
140
186
|
t && /* @__PURE__ */ n(
|
|
141
187
|
"li",
|
|
142
188
|
{
|
|
143
|
-
className:
|
|
189
|
+
className: u(
|
|
144
190
|
"relative isolate flex h-full flex-1 items-center justify-center sm:hidden",
|
|
145
|
-
|
|
191
|
+
s !== k && "hidden"
|
|
146
192
|
),
|
|
147
|
-
children: /* @__PURE__ */
|
|
148
|
-
|
|
193
|
+
children: /* @__PURE__ */ f(
|
|
194
|
+
j,
|
|
149
195
|
{
|
|
150
196
|
"aria-label": "Dismiss steps progress",
|
|
151
197
|
className: "h-8 gap-1.5 border border-border px-3 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
@@ -153,7 +199,7 @@ function F({
|
|
|
153
199
|
type: "button",
|
|
154
200
|
variant: "ghost",
|
|
155
201
|
children: [
|
|
156
|
-
/* @__PURE__ */ n(
|
|
202
|
+
/* @__PURE__ */ n(S, { className: "h-4 w-4" }),
|
|
157
203
|
/* @__PURE__ */ n("span", { className: "text-sm", children: "Dismiss" })
|
|
158
204
|
]
|
|
159
205
|
}
|
|
@@ -165,18 +211,18 @@ function F({
|
|
|
165
211
|
"button",
|
|
166
212
|
{
|
|
167
213
|
"aria-label": "Go to next step",
|
|
168
|
-
className:
|
|
214
|
+
className: u(
|
|
169
215
|
"flex h-full shrink-0 items-center px-2 text-muted-foreground sm:hidden",
|
|
170
|
-
!
|
|
216
|
+
!I && "pointer-events-none invisible"
|
|
171
217
|
),
|
|
172
|
-
onClick: () =>
|
|
173
|
-
tabIndex:
|
|
218
|
+
onClick: () => h(s + 1),
|
|
219
|
+
tabIndex: I ? 0 : -1,
|
|
174
220
|
type: "button",
|
|
175
|
-
children: /* @__PURE__ */ n(
|
|
221
|
+
children: /* @__PURE__ */ n(D, { className: "h-4 w-4" })
|
|
176
222
|
}
|
|
177
223
|
),
|
|
178
224
|
t && /* @__PURE__ */ n(
|
|
179
|
-
|
|
225
|
+
j,
|
|
180
226
|
{
|
|
181
227
|
"aria-label": "Dismiss steps progress",
|
|
182
228
|
className: "hidden h-8 w-8 shrink-0 border border-border text-muted-foreground hover:bg-muted hover:text-foreground sm:flex",
|
|
@@ -184,7 +230,7 @@ function F({
|
|
|
184
230
|
size: "icon",
|
|
185
231
|
type: "button",
|
|
186
232
|
variant: "ghost",
|
|
187
|
-
children: /* @__PURE__ */ n(
|
|
233
|
+
children: /* @__PURE__ */ n(S, { className: "h-4 w-4" })
|
|
188
234
|
}
|
|
189
235
|
)
|
|
190
236
|
] })
|
|
@@ -193,6 +239,6 @@ function F({
|
|
|
193
239
|
);
|
|
194
240
|
}
|
|
195
241
|
export {
|
|
196
|
-
|
|
197
|
-
|
|
242
|
+
W as StepsProgress,
|
|
243
|
+
p as getMobileIndexForSteps
|
|
198
244
|
};
|