laif-ds 0.2.19 → 0.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/app-stepper.js +212 -0
- package/dist/components/ui/file-preview.js +215 -138
- package/dist/components/ui/file-previewer.js +1 -1
- package/dist/components/ui/file-uploader.js +109 -96
- package/dist/components/ui/stepper.js +387 -0
- package/dist/index.d.ts +52 -1
- package/dist/index.js +30 -28
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +70 -69
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +24 -25
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +22 -23
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +28 -29
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +1 -2
- package/dist/node_modules/@radix-ui/react-context-menu/dist/index.js +49 -50
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +22 -23
- package/dist/node_modules/@radix-ui/react-hover-card/dist/index.js +6 -7
- package/dist/node_modules/@radix-ui/react-menubar/dist/index.js +31 -32
- package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.js +56 -57
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +6 -7
- package/dist/node_modules/@radix-ui/react-progress/dist/index.js +20 -21
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +12 -13
- package/dist/node_modules/@radix-ui/react-scroll-area/dist/index.js +5 -6
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +17 -18
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +39 -40
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +12 -13
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +13 -14
- package/dist/node_modules/@radix-ui/react-toggle-group/dist/index.js +20 -21
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +8 -9
- package/dist/node_modules/cmdk/dist/index.js +2 -2
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/node_modules/vaul/dist/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +3 -2
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dialog/dist/index.js +0 -255
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -128
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -137
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-portal/dist/index.js +0 -16
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.js +0 -37
- package/dist/node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.js +0 -50
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-dialog/dist/index.js +0 -258
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -128
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -137
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-portal/dist/index.js +0 -16
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-primitive/dist/index.js +0 -37
- package/dist/node_modules/vaul/node_modules/@radix-ui/react-slot/dist/index.js +0 -50
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as v, jsx as r, Fragment as L } from "react/jsx-runtime";
|
|
3
3
|
import c from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { Card as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import { Button as A } from "./button.js";
|
|
5
|
+
import { Card as B, CardHeader as S, CardTitle as P, CardContent as _ } from "./card.js";
|
|
6
|
+
import { FilePreview as M } from "./file-preview.js";
|
|
7
|
+
import { Icon as W } from "./icon.js";
|
|
8
|
+
import { Input as H } from "./input.js";
|
|
9
|
+
const K = {
|
|
9
10
|
pdf: "application/pdf",
|
|
10
11
|
doc: ".doc",
|
|
11
12
|
docx: ".docx",
|
|
@@ -22,141 +23,153 @@ const H = {
|
|
|
22
23
|
image: "image/*",
|
|
23
24
|
video: "video/*",
|
|
24
25
|
audio: "audio/*"
|
|
25
|
-
}, $ = (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
maxFiles:
|
|
26
|
+
}, $ = (g) => Math.ceil(g / (1024 * 1024)), X = ({
|
|
27
|
+
extensions: g = ["pdf", "image", "video", "audio"],
|
|
28
|
+
multiple: f = !1,
|
|
29
|
+
onUpload: b,
|
|
30
|
+
description: y = "Trascina un file o clicca per selezionare",
|
|
31
|
+
formatDescription: w = "Formato accettato: PDF, Immagini, Video, Audio",
|
|
32
|
+
selectedLabel: N = "File selezionati",
|
|
33
|
+
maxTotalSize: l,
|
|
34
|
+
removeAllLabel: a = "rimuovi tutto",
|
|
35
|
+
maxFiles: x
|
|
35
36
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
(
|
|
37
|
+
const u = g.map((e) => K[e]).join(","), [n, p] = c.useState([]), [D, I] = c.useState(""), i = (e) => {
|
|
38
|
+
const s = Array.from(e).filter(
|
|
39
|
+
(o) => u.split(",").some((t) => (t = t.trim(), o.type.startsWith(t.replace("/*", "")) || o.name.toLowerCase().endsWith(t.replace("*", ""))))
|
|
39
40
|
);
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
44
|
-
if (typeof
|
|
45
|
-
const t = Math.max(
|
|
46
|
-
t <
|
|
41
|
+
let d = [];
|
|
42
|
+
const m = [];
|
|
43
|
+
if (f) {
|
|
44
|
+
let o = s;
|
|
45
|
+
if (typeof x == "number") {
|
|
46
|
+
const t = Math.max(x - n.length, 0);
|
|
47
|
+
t < s.length && (o = s.slice(0, t), m.push(`Max ${x} file`));
|
|
47
48
|
}
|
|
48
|
-
if (typeof
|
|
49
|
-
const t =
|
|
50
|
-
let
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
for (const h of
|
|
54
|
-
|
|
55
|
-
|
|
49
|
+
if (typeof l == "number") {
|
|
50
|
+
const t = l;
|
|
51
|
+
let z = n.reduce((h, E) => h + (E.size || 0), 0);
|
|
52
|
+
const C = [];
|
|
53
|
+
let F = !1;
|
|
54
|
+
for (const h of o)
|
|
55
|
+
z + (h.size || 0) <= t ? (C.push(h), z += h.size || 0) : F || (m.push(`Max ${$(t)} MB`), F = !0);
|
|
56
|
+
o = C;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
d = [...n, ...o];
|
|
58
59
|
} else {
|
|
59
|
-
const
|
|
60
|
-
if (typeof
|
|
61
|
-
const t =
|
|
62
|
-
(
|
|
60
|
+
const o = s[0] ? [s[0]] : [];
|
|
61
|
+
if (typeof l == "number" && o[0]) {
|
|
62
|
+
const t = l;
|
|
63
|
+
(o[0].size || 0) > t ? (m.push(`Max ${$(t)} MB`), d = n) : d = o;
|
|
63
64
|
} else
|
|
64
|
-
|
|
65
|
+
d = o;
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
}, R = (e) => {
|
|
68
|
-
e.target.files && a(e.target.files), e.target.value = "";
|
|
67
|
+
p(d), I(m.join(" • ")), b?.(d);
|
|
69
68
|
}, k = (e) => {
|
|
70
|
-
e.
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
e.target.files && i(e.target.files), e.target.value = "";
|
|
70
|
+
}, R = (e) => {
|
|
71
|
+
e.preventDefault(), i(e.dataTransfer.files);
|
|
72
|
+
}, j = (e) => {
|
|
73
|
+
const s = n.filter((d, m) => m !== e);
|
|
74
|
+
p(s), I(""), b?.(s);
|
|
74
75
|
};
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
(
|
|
77
|
-
|
|
76
|
+
return /* @__PURE__ */ v("div", { className: "mx-auto w-full space-y-4", children: [
|
|
77
|
+
(f || n.length === 0) && /* @__PURE__ */ r(
|
|
78
|
+
O,
|
|
78
79
|
{
|
|
79
|
-
accept:
|
|
80
|
-
multiple:
|
|
81
|
-
onDrop:
|
|
82
|
-
onChange:
|
|
83
|
-
description:
|
|
84
|
-
formatDescription:
|
|
85
|
-
errorCaption:
|
|
80
|
+
accept: u,
|
|
81
|
+
multiple: f,
|
|
82
|
+
onDrop: R,
|
|
83
|
+
onChange: k,
|
|
84
|
+
description: y,
|
|
85
|
+
formatDescription: w,
|
|
86
|
+
errorCaption: D
|
|
86
87
|
}
|
|
87
88
|
),
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
n.length > 0 && /* @__PURE__ */ r(L, { children: /* @__PURE__ */ v(B, { size: "sm", className: "shadow-none", children: [
|
|
90
|
+
/* @__PURE__ */ v(S, { className: "flex justify-between", children: [
|
|
91
|
+
/* @__PURE__ */ r(P, { children: N }),
|
|
92
|
+
/* @__PURE__ */ r(
|
|
93
|
+
A,
|
|
94
|
+
{
|
|
95
|
+
size: "sm",
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
className: "text-xs",
|
|
98
|
+
onClick: () => p([]),
|
|
99
|
+
children: a
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ r(_, { children: f ? /* @__PURE__ */ r("div", { className: "flex flex-nowrap gap-2 overflow-x-auto py-2", children: n.map((e, s) => /* @__PURE__ */ r(
|
|
104
|
+
M,
|
|
92
105
|
{
|
|
93
106
|
file: e,
|
|
94
|
-
onRemove: () =>
|
|
107
|
+
onRemove: () => j(s)
|
|
95
108
|
},
|
|
96
|
-
e.name +
|
|
97
|
-
)) }) : /* @__PURE__ */ r(
|
|
109
|
+
e.name + s
|
|
110
|
+
)) }) : /* @__PURE__ */ r(M, { file: n[0], onRemove: () => j(0) }) })
|
|
98
111
|
] }) })
|
|
99
112
|
] });
|
|
100
|
-
},
|
|
101
|
-
accept:
|
|
102
|
-
multiple:
|
|
103
|
-
onDrop:
|
|
104
|
-
onChange:
|
|
105
|
-
description:
|
|
113
|
+
}, O = ({
|
|
114
|
+
accept: g,
|
|
115
|
+
multiple: f,
|
|
116
|
+
onDrop: b,
|
|
117
|
+
onChange: y,
|
|
118
|
+
description: w,
|
|
106
119
|
formatDescription: N,
|
|
107
|
-
errorCaption:
|
|
120
|
+
errorCaption: l
|
|
108
121
|
}) => {
|
|
109
|
-
const
|
|
110
|
-
return /* @__PURE__ */
|
|
122
|
+
const a = c.useRef(null), [x, u] = c.useState(!1), n = c.useId(), p = c.useId(), D = c.useId(), I = c.useId();
|
|
123
|
+
return /* @__PURE__ */ v(
|
|
111
124
|
"div",
|
|
112
125
|
{
|
|
113
126
|
role: "button",
|
|
114
127
|
tabIndex: 0,
|
|
115
|
-
"aria-label":
|
|
116
|
-
"aria-describedby": `${
|
|
117
|
-
onKeyDown: (
|
|
118
|
-
(
|
|
128
|
+
"aria-label": w || "Seleziona file",
|
|
129
|
+
"aria-describedby": `${n} ${p}${l ? ` ${D}` : ""}`,
|
|
130
|
+
onKeyDown: (i) => {
|
|
131
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), a.current && (a.current.value = "", a.current.click()));
|
|
119
132
|
},
|
|
120
133
|
onClick: () => {
|
|
121
|
-
|
|
134
|
+
a.current && (a.current.value = "", a.current.click());
|
|
122
135
|
},
|
|
123
|
-
onDragEnter: () =>
|
|
124
|
-
onDragOver: (
|
|
125
|
-
onDragLeave: () =>
|
|
126
|
-
onDrop: (
|
|
127
|
-
|
|
136
|
+
onDragEnter: () => u(!0),
|
|
137
|
+
onDragOver: (i) => i.preventDefault(),
|
|
138
|
+
onDragLeave: () => u(!1),
|
|
139
|
+
onDrop: (i) => {
|
|
140
|
+
u(!1), b(i);
|
|
128
141
|
},
|
|
129
|
-
className: `border-d-border flex w-full cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed px-4 py-8 ${
|
|
142
|
+
className: `border-d-border flex w-full cursor-pointer flex-col items-center gap-3 rounded-lg border-2 border-dashed px-4 py-8 ${x ? "bg-muted/40" : ""}`,
|
|
130
143
|
children: [
|
|
131
144
|
/* @__PURE__ */ r(
|
|
132
|
-
|
|
145
|
+
W,
|
|
133
146
|
{
|
|
134
147
|
name: "ArrowUpFromLine",
|
|
135
148
|
className: "text-d-muted-foreground h-10 w-10"
|
|
136
149
|
}
|
|
137
150
|
),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */ r("p", { id:
|
|
151
|
+
/* @__PURE__ */ v("div", { className: "max-w-xs text-center", children: [
|
|
152
|
+
/* @__PURE__ */ r("p", { id: n, className: "text-d-muted-foreground text-sm font-medium", children: w }),
|
|
140
153
|
/* @__PURE__ */ r(
|
|
141
154
|
"p",
|
|
142
155
|
{
|
|
143
|
-
id:
|
|
156
|
+
id: p,
|
|
144
157
|
className: "text-d-muted-foreground text-muted-foreground mt-1 text-xs",
|
|
145
158
|
children: N
|
|
146
159
|
}
|
|
147
160
|
),
|
|
148
|
-
|
|
161
|
+
l ? /* @__PURE__ */ r("p", { id: D, className: "mt-2 text-xs font-medium text-red-600", children: l }) : null
|
|
149
162
|
] }),
|
|
150
163
|
/* @__PURE__ */ r(
|
|
151
|
-
|
|
164
|
+
H,
|
|
152
165
|
{
|
|
153
|
-
ref:
|
|
154
|
-
id:
|
|
166
|
+
ref: a,
|
|
167
|
+
id: I,
|
|
155
168
|
type: "file",
|
|
156
169
|
className: "hidden",
|
|
157
|
-
accept:
|
|
158
|
-
multiple:
|
|
159
|
-
onChange:
|
|
170
|
+
accept: g,
|
|
171
|
+
multiple: f,
|
|
172
|
+
onChange: y
|
|
160
173
|
}
|
|
161
174
|
)
|
|
162
175
|
]
|
|
@@ -164,5 +177,5 @@ const H = {
|
|
|
164
177
|
);
|
|
165
178
|
};
|
|
166
179
|
export {
|
|
167
|
-
|
|
180
|
+
X as FileUploader
|
|
168
181
|
};
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { cn as d } from "../../lib/utils.js";
|
|
4
|
+
import { cva as g } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import * as p from "react";
|
|
6
|
+
import { createContext as T, useContext as P } from "react";
|
|
7
|
+
const E = T(
|
|
8
|
+
void 0
|
|
9
|
+
), L = T(
|
|
10
|
+
void 0
|
|
11
|
+
), R = g("w-full max-w-6xl", {
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
horizontal: "flex flex-row items-center",
|
|
15
|
+
vertical: "flex flex-col items-start"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
orientation: "horizontal"
|
|
20
|
+
}
|
|
21
|
+
}), O = g("group/step relative", {
|
|
22
|
+
variants: {
|
|
23
|
+
orientation: {
|
|
24
|
+
horizontal: "flex flex-row items-center justify-center not-last:flex-1",
|
|
25
|
+
vertical: "flex flex-col items-start justify-start"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
orientation: "horizontal"
|
|
30
|
+
}
|
|
31
|
+
}), F = g(
|
|
32
|
+
"focus-visible:ring-ring/50 focus-visible:border-d-ring inline-flex cursor-pointer items-center gap-3 rounded-full outline-none focus-visible:z-10 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-60",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
size: {
|
|
36
|
+
sm: "gap-2",
|
|
37
|
+
default: "gap-3",
|
|
38
|
+
lg: "gap-4"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
defaultVariants: {
|
|
42
|
+
size: "default"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
), K = g(
|
|
46
|
+
"border-secondary bg-secondary text-bodyPrimary data-[state=active]:bg-d-primary data-[state=completed]:bg-d-primary data-[state=active]:text-bodyPrimary data-[state=completed]:text-onAccent relative flex shrink-0 items-center justify-center overflow-hidden rounded-full",
|
|
47
|
+
{
|
|
48
|
+
variants: {
|
|
49
|
+
size: {
|
|
50
|
+
sm: "size-5 text-xs",
|
|
51
|
+
default: "size-6 text-xs",
|
|
52
|
+
lg: "size-8 text-sm"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: "default"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
), $ = g("bg-secondary m-0.5 rounded-full", {
|
|
60
|
+
variants: {
|
|
61
|
+
orientation: {
|
|
62
|
+
horizontal: "h-0.5 flex-1",
|
|
63
|
+
vertical: "h-12 w-0.5"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: {
|
|
67
|
+
orientation: "horizontal"
|
|
68
|
+
}
|
|
69
|
+
}), H = g("text-sm leading-none font-medium", {
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
sm: "text-xs",
|
|
73
|
+
default: "text-sm",
|
|
74
|
+
lg: "text-base"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
size: "default"
|
|
79
|
+
}
|
|
80
|
+
}), U = g("inline-flex", {
|
|
81
|
+
variants: {
|
|
82
|
+
orientation: {
|
|
83
|
+
horizontal: "w-full flex-row",
|
|
84
|
+
vertical: "flex-col"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
orientation: "horizontal"
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
function x() {
|
|
92
|
+
const t = P(E);
|
|
93
|
+
if (!t) throw new Error("useStepper must be used within a Stepper");
|
|
94
|
+
return t;
|
|
95
|
+
}
|
|
96
|
+
function I() {
|
|
97
|
+
const t = P(L);
|
|
98
|
+
if (!t) throw new Error("useStepItem must be used within a StepperItem");
|
|
99
|
+
return t;
|
|
100
|
+
}
|
|
101
|
+
function M({
|
|
102
|
+
defaultValue: t = 1,
|
|
103
|
+
value: a,
|
|
104
|
+
onValueChange: n,
|
|
105
|
+
orientation: e = "horizontal",
|
|
106
|
+
className: i,
|
|
107
|
+
children: r,
|
|
108
|
+
indicators: S = {},
|
|
109
|
+
...y
|
|
110
|
+
}) {
|
|
111
|
+
const [f, b] = p.useState(t), [o, h] = p.useState(
|
|
112
|
+
[]
|
|
113
|
+
), z = p.useCallback(
|
|
114
|
+
(s) => {
|
|
115
|
+
h((l) => s && !l.includes(s) ? [...l, s] : !s && l.includes(s) ? l.filter((w) => w !== s) : l);
|
|
116
|
+
},
|
|
117
|
+
[]
|
|
118
|
+
), N = p.useCallback(
|
|
119
|
+
(s) => {
|
|
120
|
+
a === void 0 && b(s), n?.(s);
|
|
121
|
+
},
|
|
122
|
+
[a, n]
|
|
123
|
+
), V = a ?? f, m = (s) => {
|
|
124
|
+
o[s] && o[s].focus();
|
|
125
|
+
}, A = (s) => m((s + 1) % o.length), v = (s) => m((s - 1 + o.length) % o.length), C = () => m(0), k = () => m(o.length - 1), D = p.useMemo(
|
|
126
|
+
() => ({
|
|
127
|
+
activeStep: V,
|
|
128
|
+
setActiveStep: N,
|
|
129
|
+
stepsCount: p.Children.toArray(r).filter(
|
|
130
|
+
(s) => p.isValidElement(s) && s.type.displayName === "StepperItem"
|
|
131
|
+
).length,
|
|
132
|
+
orientation: e,
|
|
133
|
+
registerTrigger: z,
|
|
134
|
+
focusNext: A,
|
|
135
|
+
focusPrev: v,
|
|
136
|
+
focusFirst: C,
|
|
137
|
+
focusLast: k,
|
|
138
|
+
triggerNodes: o,
|
|
139
|
+
indicators: S
|
|
140
|
+
}),
|
|
141
|
+
[
|
|
142
|
+
V,
|
|
143
|
+
N,
|
|
144
|
+
r,
|
|
145
|
+
e,
|
|
146
|
+
z,
|
|
147
|
+
o
|
|
148
|
+
]
|
|
149
|
+
);
|
|
150
|
+
return /* @__PURE__ */ c(E.Provider, { value: D, children: /* @__PURE__ */ c(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
role: "tablist",
|
|
154
|
+
"aria-orientation": e,
|
|
155
|
+
"data-slot": "stepper",
|
|
156
|
+
className: d(R({ orientation: e }), i),
|
|
157
|
+
"data-orientation": e,
|
|
158
|
+
...y,
|
|
159
|
+
children: r
|
|
160
|
+
}
|
|
161
|
+
) });
|
|
162
|
+
}
|
|
163
|
+
function Q({
|
|
164
|
+
step: t,
|
|
165
|
+
completed: a = !1,
|
|
166
|
+
disabled: n = !1,
|
|
167
|
+
loading: e = !1,
|
|
168
|
+
orientation: i,
|
|
169
|
+
className: r,
|
|
170
|
+
children: S,
|
|
171
|
+
...y
|
|
172
|
+
}) {
|
|
173
|
+
const { activeStep: f, orientation: b } = x(), o = a || t < f ? "completed" : f === t ? "active" : "inactive", h = e && t === f;
|
|
174
|
+
return /* @__PURE__ */ c(
|
|
175
|
+
L.Provider,
|
|
176
|
+
{
|
|
177
|
+
value: { step: t, state: o, isDisabled: n, isLoading: h },
|
|
178
|
+
children: /* @__PURE__ */ c(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
"data-slot": "stepper-item",
|
|
182
|
+
className: d(
|
|
183
|
+
O({
|
|
184
|
+
orientation: i || b
|
|
185
|
+
}),
|
|
186
|
+
r
|
|
187
|
+
),
|
|
188
|
+
"data-state": o,
|
|
189
|
+
...h ? { "data-loading": !0 } : {},
|
|
190
|
+
...y,
|
|
191
|
+
children: S
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
function W({
|
|
198
|
+
asChild: t = !1,
|
|
199
|
+
size: a,
|
|
200
|
+
className: n,
|
|
201
|
+
children: e,
|
|
202
|
+
tabIndex: i,
|
|
203
|
+
...r
|
|
204
|
+
}) {
|
|
205
|
+
const { state: S, isLoading: y } = I(), f = x(), {
|
|
206
|
+
setActiveStep: b,
|
|
207
|
+
activeStep: o,
|
|
208
|
+
registerTrigger: h,
|
|
209
|
+
triggerNodes: z,
|
|
210
|
+
focusNext: N,
|
|
211
|
+
focusPrev: V,
|
|
212
|
+
focusFirst: m,
|
|
213
|
+
focusLast: A
|
|
214
|
+
} = f, { step: v, isDisabled: C } = I(), k = o === v, D = `stepper-tab-${v}`, s = `stepper-panel-${v}`, l = p.useRef(null);
|
|
215
|
+
p.useEffect(() => {
|
|
216
|
+
l.current && h(l.current);
|
|
217
|
+
}, [l.current]);
|
|
218
|
+
const w = p.useMemo(
|
|
219
|
+
() => z.findIndex((u) => u === l.current),
|
|
220
|
+
[z, l.current]
|
|
221
|
+
), j = (u) => {
|
|
222
|
+
switch (u.key) {
|
|
223
|
+
case "ArrowRight":
|
|
224
|
+
case "ArrowDown":
|
|
225
|
+
u.preventDefault(), w !== -1 && N && N(w);
|
|
226
|
+
break;
|
|
227
|
+
case "ArrowLeft":
|
|
228
|
+
case "ArrowUp":
|
|
229
|
+
u.preventDefault(), w !== -1 && V && V(w);
|
|
230
|
+
break;
|
|
231
|
+
case "Home":
|
|
232
|
+
u.preventDefault(), m && m();
|
|
233
|
+
break;
|
|
234
|
+
case "End":
|
|
235
|
+
u.preventDefault(), A && A();
|
|
236
|
+
break;
|
|
237
|
+
case "Enter":
|
|
238
|
+
case " ":
|
|
239
|
+
u.preventDefault(), b(v);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return t ? /* @__PURE__ */ c(
|
|
244
|
+
"span",
|
|
245
|
+
{
|
|
246
|
+
"data-slot": "stepper-trigger",
|
|
247
|
+
"data-state": S,
|
|
248
|
+
className: n,
|
|
249
|
+
children: e
|
|
250
|
+
}
|
|
251
|
+
) : /* @__PURE__ */ c(
|
|
252
|
+
"button",
|
|
253
|
+
{
|
|
254
|
+
ref: l,
|
|
255
|
+
role: "tab",
|
|
256
|
+
id: D,
|
|
257
|
+
"aria-selected": k,
|
|
258
|
+
"aria-controls": s,
|
|
259
|
+
tabIndex: typeof i == "number" ? i : k ? 0 : -1,
|
|
260
|
+
"data-slot": "stepper-trigger",
|
|
261
|
+
"data-state": S,
|
|
262
|
+
"data-loading": y,
|
|
263
|
+
className: d(F({ size: a }), n),
|
|
264
|
+
onClick: () => b(v),
|
|
265
|
+
onKeyDown: j,
|
|
266
|
+
disabled: C,
|
|
267
|
+
...r,
|
|
268
|
+
children: e
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function X({
|
|
273
|
+
children: t,
|
|
274
|
+
size: a,
|
|
275
|
+
className: n
|
|
276
|
+
}) {
|
|
277
|
+
const { state: e, isLoading: i } = I(), { indicators: r } = x();
|
|
278
|
+
return /* @__PURE__ */ c(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
"data-slot": "stepper-indicator",
|
|
282
|
+
"data-state": e,
|
|
283
|
+
className: d(K({ size: a }), n),
|
|
284
|
+
children: /* @__PURE__ */ c("div", { className: "absolute", children: r && (i && r.loading || e === "completed" && r.completed || e === "active" && r.active || e === "inactive" && r.inactive) ? i && r.loading || e === "completed" && r.completed || e === "active" && r.active || e === "inactive" && r.inactive : t })
|
|
285
|
+
}
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
function Y({
|
|
289
|
+
orientation: t,
|
|
290
|
+
className: a
|
|
291
|
+
}) {
|
|
292
|
+
const { state: n } = I(), { orientation: e } = x();
|
|
293
|
+
return /* @__PURE__ */ c(
|
|
294
|
+
"div",
|
|
295
|
+
{
|
|
296
|
+
"data-slot": "stepper-separator",
|
|
297
|
+
"data-state": n,
|
|
298
|
+
className: d(
|
|
299
|
+
$({
|
|
300
|
+
orientation: t || e
|
|
301
|
+
}),
|
|
302
|
+
a
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
function Z({
|
|
308
|
+
children: t,
|
|
309
|
+
size: a,
|
|
310
|
+
className: n
|
|
311
|
+
}) {
|
|
312
|
+
const { state: e } = I();
|
|
313
|
+
return /* @__PURE__ */ c(
|
|
314
|
+
"h3",
|
|
315
|
+
{
|
|
316
|
+
"data-slot": "stepper-title",
|
|
317
|
+
"data-state": e,
|
|
318
|
+
className: d(H({ size: a }), n),
|
|
319
|
+
children: t
|
|
320
|
+
}
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
function _({
|
|
324
|
+
children: t,
|
|
325
|
+
orientation: a,
|
|
326
|
+
className: n
|
|
327
|
+
}) {
|
|
328
|
+
const { activeStep: e, orientation: i } = x();
|
|
329
|
+
return /* @__PURE__ */ c(
|
|
330
|
+
"nav",
|
|
331
|
+
{
|
|
332
|
+
"data-slot": "stepper-nav",
|
|
333
|
+
"data-state": e,
|
|
334
|
+
"data-orientation": a || i,
|
|
335
|
+
className: d(
|
|
336
|
+
U({
|
|
337
|
+
orientation: a || i
|
|
338
|
+
}),
|
|
339
|
+
n
|
|
340
|
+
),
|
|
341
|
+
children: t
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
function tt({ children: t, className: a }) {
|
|
346
|
+
const { activeStep: n } = x();
|
|
347
|
+
return /* @__PURE__ */ c(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
"data-slot": "stepper-panel",
|
|
351
|
+
"data-state": n,
|
|
352
|
+
className: d("w-full", a),
|
|
353
|
+
children: t
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
function et({
|
|
358
|
+
value: t,
|
|
359
|
+
forceMount: a,
|
|
360
|
+
children: n,
|
|
361
|
+
className: e
|
|
362
|
+
}) {
|
|
363
|
+
const { activeStep: i } = x(), r = t === i;
|
|
364
|
+
return !a && !r ? null : /* @__PURE__ */ c(
|
|
365
|
+
"div",
|
|
366
|
+
{
|
|
367
|
+
"data-slot": "stepper-content",
|
|
368
|
+
"data-state": i,
|
|
369
|
+
className: d("w-full", e, !r && a && "hidden"),
|
|
370
|
+
hidden: !r && a,
|
|
371
|
+
children: n
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
M as Stepper,
|
|
377
|
+
et as StepperContent,
|
|
378
|
+
X as StepperIndicator,
|
|
379
|
+
Q as StepperItem,
|
|
380
|
+
_ as StepperNav,
|
|
381
|
+
tt as StepperPanel,
|
|
382
|
+
Y as StepperSeparator,
|
|
383
|
+
Z as StepperTitle,
|
|
384
|
+
W as StepperTrigger,
|
|
385
|
+
I as useStepItem,
|
|
386
|
+
x as useStepper
|
|
387
|
+
};
|