@arctura/atomics 0.0.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/hooks.cjs +1 -0
- package/dist/hooks.js +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +1980 -0
- package/dist/lib/hooks.d.ts +5 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/useBreakpoints.d.ts +48 -0
- package/dist/lib/useBreakpoints.d.ts.map +1 -0
- package/dist/lib/useControlled.d.ts +38 -0
- package/dist/lib/useControlled.d.ts.map +1 -0
- package/dist/src/badge/Badge.d.ts +116 -0
- package/dist/src/badge/Badge.d.ts.map +1 -0
- package/dist/src/badge/index.d.ts +3 -0
- package/dist/src/badge/index.d.ts.map +1 -0
- package/dist/src/buttons/Button.d.ts +126 -0
- package/dist/src/buttons/Button.d.ts.map +1 -0
- package/dist/src/buttons/Fab.d.ts +114 -0
- package/dist/src/buttons/Fab.d.ts.map +1 -0
- package/dist/src/buttons/IconButton.d.ts +105 -0
- package/dist/src/buttons/IconButton.d.ts.map +1 -0
- package/dist/src/buttons/index.d.ts +9 -0
- package/dist/src/buttons/index.d.ts.map +1 -0
- package/dist/src/card/Card.d.ts +35 -0
- package/dist/src/card/Card.d.ts.map +1 -0
- package/dist/src/card/Footer.d.ts +67 -0
- package/dist/src/card/Footer.d.ts.map +1 -0
- package/dist/src/card/Header.d.ts +56 -0
- package/dist/src/card/Header.d.ts.map +1 -0
- package/dist/src/card/Media.d.ts +65 -0
- package/dist/src/card/Media.d.ts.map +1 -0
- package/dist/src/card/index.d.ts +11 -0
- package/dist/src/card/index.d.ts.map +1 -0
- package/dist/src/carousel/Carousel.d.ts +124 -0
- package/dist/src/carousel/Carousel.d.ts.map +1 -0
- package/dist/src/carousel/Hero.d.ts +156 -0
- package/dist/src/carousel/Hero.d.ts.map +1 -0
- package/dist/src/carousel/index.d.ts +4 -0
- package/dist/src/carousel/index.d.ts.map +1 -0
- package/dist/src/drawer/Drawer.d.ts +40 -0
- package/dist/src/drawer/Drawer.d.ts.map +1 -0
- package/dist/src/drawer/index.d.ts +5 -0
- package/dist/src/drawer/index.d.ts.map +1 -0
- package/dist/src/form/Form.d.ts +168 -0
- package/dist/src/form/Form.d.ts.map +1 -0
- package/dist/src/form/TextArea.d.ts +266 -0
- package/dist/src/form/TextArea.d.ts.map +1 -0
- package/dist/src/form/TextInput.d.ts +200 -0
- package/dist/src/form/TextInput.d.ts.map +1 -0
- package/dist/src/form/index.d.ts +7 -0
- package/dist/src/form/index.d.ts.map +1 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/list/List.d.ts +122 -0
- package/dist/src/list/List.d.ts.map +1 -0
- package/dist/src/list/ListItem.d.ts +157 -0
- package/dist/src/list/ListItem.d.ts.map +1 -0
- package/dist/src/list/index.d.ts +6 -0
- package/dist/src/list/index.d.ts.map +1 -0
- package/dist/src/progress-stepper/Connector.d.ts +48 -0
- package/dist/src/progress-stepper/Connector.d.ts.map +1 -0
- package/dist/src/progress-stepper/Node.d.ts +75 -0
- package/dist/src/progress-stepper/Node.d.ts.map +1 -0
- package/dist/src/progress-stepper/ProgressStepper.d.ts +108 -0
- package/dist/src/progress-stepper/ProgressStepper.d.ts.map +1 -0
- package/dist/src/progress-stepper/Step.d.ts +93 -0
- package/dist/src/progress-stepper/Step.d.ts.map +1 -0
- package/dist/src/progress-stepper/index.d.ts +10 -0
- package/dist/src/progress-stepper/index.d.ts.map +1 -0
- package/dist/src/select/Select.d.ts +98 -0
- package/dist/src/select/Select.d.ts.map +1 -0
- package/dist/src/select/index.d.ts +5 -0
- package/dist/src/select/index.d.ts.map +1 -0
- package/dist/src/typography/Link.d.ts +86 -0
- package/dist/src/typography/Link.d.ts.map +1 -0
- package/dist/src/typography/Typography.d.ts +148 -0
- package/dist/src/typography/Typography.d.ts.map +1 -0
- package/dist/src/typography/index.d.ts +7 -0
- package/dist/src/typography/index.d.ts.map +1 -0
- package/dist/src/utils/capitalize.d.ts +3 -0
- package/dist/src/utils/capitalize.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/useBreakpoints-CXOalIdM.js +37 -0
- package/dist/useBreakpoints-nd-Blu7O.cjs +1 -0
- package/package.json +67 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1980 @@
|
|
|
1
|
+
import { t as e } from "./useBreakpoints-CXOalIdM.js";
|
|
2
|
+
import t from "classnames";
|
|
3
|
+
import { FontAwesomeIcon as n } from "@fortawesome/react-fontawesome";
|
|
4
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { twMerge as o } from "tailwind-merge";
|
|
6
|
+
import s, { Children as c, Fragment as l, cloneElement as u, isValidElement as d, useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
7
|
+
import _ from "embla-carousel-react";
|
|
8
|
+
import { faChevronDown as v, faChevronLeft as y, faChevronRight as b, faClose as x, faEye as S, faEyeSlash as C, faXmark as w } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
import T from "embla-carousel-fade";
|
|
10
|
+
//#region src/badge/Badge.tsx
|
|
11
|
+
function E({ children: e, className: r, color: o = "primary", href: s, icon: c, iconPosition: l = "end", ref: u, size: d = "md", target: f, variant: p = "filled", ...m }) {
|
|
12
|
+
let h = p === "filled" ? t("mg:border-solid mg:border-1", {
|
|
13
|
+
"mg:bg-primary mg:border-primary": o === "primary",
|
|
14
|
+
"mg:hover:bg-primary-hover": o === "primary" && s,
|
|
15
|
+
"mg:bg-secondary mg:border-secondary": o === "secondary",
|
|
16
|
+
"mg:hover:bg-secondary-hover": o === "secondary" && s,
|
|
17
|
+
"mg:bg-subtle mg:border-subtle": o === "subtle",
|
|
18
|
+
"mg:hover:bg-subtle-hover": o === "subtle" && s,
|
|
19
|
+
"mg:bg-accent mg:border-accent": o === "accent",
|
|
20
|
+
"mg:hover:bg-accent-hover": o === "accent" && s,
|
|
21
|
+
"mg:bg-success-primary mg:border-success": o === "success",
|
|
22
|
+
"mg:hover:bg-success-hover": o === "success" && s,
|
|
23
|
+
"mg:bg-danger-primary mg:border-danger": o === "danger",
|
|
24
|
+
"mg:hover:bg-danger-hover": o === "danger" && s,
|
|
25
|
+
"mg:bg-warning-primary mg:border-warning": o === "warning",
|
|
26
|
+
"mg:hover:bg-warning-hover": o === "warning" && s,
|
|
27
|
+
"mg:bg-info-primary mg:border-info": o === "info",
|
|
28
|
+
"mg:hover:bg-info-hover": o === "info" && s
|
|
29
|
+
}) : "", g = p === "ghost" ? t("mg:bg-transparent", {
|
|
30
|
+
"mg:text-primary": o === "primary",
|
|
31
|
+
"mg:hover:text-primary-hover": o === "primary" && s,
|
|
32
|
+
"mg:text-secondary": o === "secondary",
|
|
33
|
+
"mg:hover:text-secondary-hover": o === "secondary" && s,
|
|
34
|
+
"mg:text-subtle": o === "subtle",
|
|
35
|
+
"mg:hover:text-subtle-hover": o === "subtle" && s,
|
|
36
|
+
"mg:text-accent": o === "accent",
|
|
37
|
+
"mg:hover:text-accent-hover": o === "accent" && s,
|
|
38
|
+
"mg:text-success": o === "success",
|
|
39
|
+
"mg:hover:text-success-hover": o === "success" && s,
|
|
40
|
+
"mg:text-danger": o === "danger",
|
|
41
|
+
"mg:hover:text-danger-hover": o === "danger" && s,
|
|
42
|
+
"mg:text-warning": o === "warning",
|
|
43
|
+
"mg:hover:text-warning-hover": o === "warning" && s,
|
|
44
|
+
"mg:text-info": o === "info",
|
|
45
|
+
"mg:hover:text-info-hover": o === "info" && s
|
|
46
|
+
}) : "", _ = t("mg:text-xs", {
|
|
47
|
+
"mg:text-primary": o === "primary",
|
|
48
|
+
"mg:text-secondary": o === "secondary",
|
|
49
|
+
"mg:text-subtle": o === "subtle",
|
|
50
|
+
"mg:text-accent": o === "accent",
|
|
51
|
+
"mg:text-success": o === "success",
|
|
52
|
+
"mg:text-danger": o === "danger",
|
|
53
|
+
"mg:text-warning": o === "warning",
|
|
54
|
+
"mg:text-info": o === "info"
|
|
55
|
+
}), v = p === "outline" ? t("mg:bg-transparent mg:border-solid mg:border-1", {
|
|
56
|
+
"mg:border-primary ": o === "primary",
|
|
57
|
+
"mg:hover:border-primary": o === "primary" && s,
|
|
58
|
+
"mg:border-secondary": o === "secondary",
|
|
59
|
+
"mg:hover:border-secondary": o === "secondary" && s,
|
|
60
|
+
"mg:border-subtle": o === "subtle",
|
|
61
|
+
"mg:hover:border-subtle": o === "subtle" && s,
|
|
62
|
+
"mg:border-accent": o === "accent",
|
|
63
|
+
"mg:hover:border-accent": o === "accent" && s,
|
|
64
|
+
"mg:border-success": o === "success",
|
|
65
|
+
"mg:hover:border-success": o === "success" && s,
|
|
66
|
+
"mg:border-danger": o === "danger",
|
|
67
|
+
"mg:hover:border-danger": o === "danger" && s,
|
|
68
|
+
"mg:border-warning": o === "warning",
|
|
69
|
+
"mg:hover:border-warning": o === "warning" && s,
|
|
70
|
+
"mg:border-info": o === "info",
|
|
71
|
+
"mg:hover:border-info": o === "info" && s
|
|
72
|
+
}) : "", y = t("mg:flex mg:items-center mg:justify-between mg:rounded-full", {
|
|
73
|
+
"mg:px-1 mg:py-0.5 mg:text-xs": d === "xs",
|
|
74
|
+
"mg:px-2 mg:py-1 mg:text-sm": d === "sm",
|
|
75
|
+
"mg:px-3 mg:py-1.5 mg:text-base": d === "md",
|
|
76
|
+
"mg:px-4 mg:py-2 mg:text-lg": d === "lg"
|
|
77
|
+
}, h, g, v, r);
|
|
78
|
+
return s ? /* @__PURE__ */ a("a", {
|
|
79
|
+
className: y,
|
|
80
|
+
href: s,
|
|
81
|
+
target: f,
|
|
82
|
+
ref: u,
|
|
83
|
+
...m,
|
|
84
|
+
children: [
|
|
85
|
+
c && l === "start" && /* @__PURE__ */ i(n, {
|
|
86
|
+
icon: c,
|
|
87
|
+
className: _
|
|
88
|
+
}),
|
|
89
|
+
e,
|
|
90
|
+
c && l === "end" && /* @__PURE__ */ i(n, {
|
|
91
|
+
icon: c,
|
|
92
|
+
className: _
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}) : /* @__PURE__ */ a("div", {
|
|
96
|
+
className: y,
|
|
97
|
+
ref: u,
|
|
98
|
+
...m,
|
|
99
|
+
children: [
|
|
100
|
+
c && l === "start" && /* @__PURE__ */ i(n, {
|
|
101
|
+
icon: c,
|
|
102
|
+
className: _
|
|
103
|
+
}),
|
|
104
|
+
e,
|
|
105
|
+
c && l === "end" && /* @__PURE__ */ i(n, {
|
|
106
|
+
icon: c,
|
|
107
|
+
className: _
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
E.displayName = "Badge";
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/buttons/Button.tsx
|
|
115
|
+
var D = {
|
|
116
|
+
sm: "mg:px-1.5 mg:py-1 mg:rounded-sm mg:text-sm",
|
|
117
|
+
md: "mg:px-2.5 mg:py-2 mg:rounded-md mg:text-sm",
|
|
118
|
+
lg: "mg:px-3.5 mg:py-3 mg:rounded-lg mg:text-base"
|
|
119
|
+
}, O = {
|
|
120
|
+
sm: "mg:px-1.5 mg:py-1 mg:rounded-sm mg:text-sm",
|
|
121
|
+
md: "mg:px-2 mg:py-1.5 mg:rounded-md mg:text-sm mg:sm:px-2.5 mg:sm:py-2",
|
|
122
|
+
lg: "mg:px-2.5 mg:py-2 mg:rounded-md mg:text-sm mg:sm:px-3.5 mg:sm:py-3 mg:sm:rounded-lg mg:sm:text-base"
|
|
123
|
+
}, k = (e, t) => {
|
|
124
|
+
let r = o("mg:text-xs", t), a = o("mg:object-contain mg:animate-fade-in mg:duration-500", t);
|
|
125
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
126
|
+
icon: e,
|
|
127
|
+
className: r
|
|
128
|
+
}, e.iconName) : /* @__PURE__ */ i("img", {
|
|
129
|
+
alt: e.alt || "",
|
|
130
|
+
src: e.src || "",
|
|
131
|
+
width: 16,
|
|
132
|
+
height: 16,
|
|
133
|
+
className: a
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
function A({ children: e, classes: n = {}, endAdornment: r, href: i, fullWidth: s = !1, responsive: c = !0, size: l = "md", startAdornment: u, ref: d, target: f, type: p = "button", variant: m = "primary", ...h }) {
|
|
137
|
+
let g = u && "iconName" in u, _ = r && "iconName" in r, v = u && "src" in u, y = r && "src" in r, b = c ? O[l] : D[l], x = o(t("mg:inline-flex mg:items-center mg:justify-between mg:font-body mg:text-primary mg:hover:text-primary-hover mg:hover:cursor-pointer", "mg:focus-visible:outline-1 mg:focus-visible:outline-offset-4 mg:focus-visible:outline-primary", s ? c ? "mg:w-full mg:py-2 mg:rounded-lg mg:text-sm mg:sm:py-3 mg:sm:text-base" : "mg:w-full mg:py-3 mg:rounded-lg mg:text-base" : b, {
|
|
138
|
+
"mg:bg-primary mg:hover:bg-primary-hover": m === "primary",
|
|
139
|
+
"mg:bg-secondary mg:hover:bg-secondary-hover": m === "secondary",
|
|
140
|
+
"mg:bg-transparent mg:hover:border-solid mg:hover:border-1 mg:hover:border-accent": m === "text",
|
|
141
|
+
"mg:border-solid mg:border-1 mg:border-primary mg:hover:border-accent": m === "outline",
|
|
142
|
+
"mg:gap-2": (g || _) && e,
|
|
143
|
+
"mg:gap-1": (v || y) && e
|
|
144
|
+
}), n?.button);
|
|
145
|
+
return i ? /* @__PURE__ */ a("a", {
|
|
146
|
+
ref: d,
|
|
147
|
+
className: x,
|
|
148
|
+
href: i,
|
|
149
|
+
target: f,
|
|
150
|
+
...h,
|
|
151
|
+
children: [
|
|
152
|
+
u && k(u),
|
|
153
|
+
e,
|
|
154
|
+
r && k(r)
|
|
155
|
+
]
|
|
156
|
+
}) : /* @__PURE__ */ a("button", {
|
|
157
|
+
ref: d,
|
|
158
|
+
className: x,
|
|
159
|
+
type: p,
|
|
160
|
+
...h,
|
|
161
|
+
children: [
|
|
162
|
+
u && k(u),
|
|
163
|
+
e,
|
|
164
|
+
r && k(r)
|
|
165
|
+
]
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
A.displayName = "Button";
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/buttons/IconButton.tsx
|
|
171
|
+
var j = (e, t) => {
|
|
172
|
+
let r = o("mg:object-cover mg:animate-fade-in mg:duration-500", t);
|
|
173
|
+
if ("iconName" in e) return /* @__PURE__ */ i(n, {
|
|
174
|
+
className: t,
|
|
175
|
+
icon: e
|
|
176
|
+
}, e.iconName);
|
|
177
|
+
if (d(e)) {
|
|
178
|
+
let t = e.props;
|
|
179
|
+
return t.src ? u(e, {
|
|
180
|
+
src: t.src || "",
|
|
181
|
+
alt: t.alt || "",
|
|
182
|
+
width: 24,
|
|
183
|
+
height: 24,
|
|
184
|
+
className: r
|
|
185
|
+
}) : e;
|
|
186
|
+
}
|
|
187
|
+
return e;
|
|
188
|
+
};
|
|
189
|
+
function M({ children: e, classes: n = {}, color: r = "primary", href: a, size: s = "sm", onClick: c, variant: l = "outline", ...u }) {
|
|
190
|
+
let d = o(t(t("mg:flex mg:items-center mg:justify-center mg:rounded-lg mg:font-body mg:p-1 mg:min-h-2 mg:min-w-2 mg:hover:cursor-pointer", "mg:focus-visible:outline-1 mg:focus-visible:outline-offset-4 mg:focus-visible:outline-primary", {
|
|
191
|
+
"mg:text-sm": s === "sm",
|
|
192
|
+
"mg:text-base": s === "md",
|
|
193
|
+
"mg:text-lg": s === "lg"
|
|
194
|
+
}), l === "outline" ? t("mg:border-solid mg:border-1 mg:hover:border-accent mg:bg-transparent mg:text-primary", {
|
|
195
|
+
"mg:text-primary mg:border-primary": r === "primary",
|
|
196
|
+
"mg:text-secondary mg:border-secondary": r === "secondary",
|
|
197
|
+
"mg:text-accent mg:border-accent": r === "accent"
|
|
198
|
+
}) : "", l === "filled" ? t("mg:text-primary mg:hover:text-inverse", {
|
|
199
|
+
"mg:bg-primary mg:hover:bg-primary-hover": r === "primary",
|
|
200
|
+
"mg:bg-secondary mg:hover:bg-secondary-hover": r === "secondary",
|
|
201
|
+
"mg:bg-accent mg:hover:bg-accent-hover": r === "accent"
|
|
202
|
+
}) : ""), n?.iconButton);
|
|
203
|
+
return a ? /* @__PURE__ */ i("a", {
|
|
204
|
+
className: d,
|
|
205
|
+
href: a,
|
|
206
|
+
onClick: c,
|
|
207
|
+
...u,
|
|
208
|
+
children: e && j(e, n?.children)
|
|
209
|
+
}) : /* @__PURE__ */ i("button", {
|
|
210
|
+
className: d,
|
|
211
|
+
onClick: c,
|
|
212
|
+
...u,
|
|
213
|
+
children: e && j(e, n?.children)
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
M.displayName = "IconButton";
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/buttons/Fab.tsx
|
|
219
|
+
var N = (e, r) => {
|
|
220
|
+
let a = t("mg:text-xs", r), s = o("mg:object-contain mg:animate-fade-in mg:duration-500", r);
|
|
221
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
222
|
+
className: a,
|
|
223
|
+
icon: e
|
|
224
|
+
}) : /* @__PURE__ */ i("img", {
|
|
225
|
+
alt: e.alt || "",
|
|
226
|
+
className: s,
|
|
227
|
+
height: 16,
|
|
228
|
+
src: e.src || "",
|
|
229
|
+
width: 16
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
function P({ children: e, classes: n = {}, color: r = "primary", endAdornment: i, href: s, onClick: c, target: l, type: u, ref: d, size: f = "md", startAdornment: p, variant: m = "circular", ...h }) {
|
|
233
|
+
let g = m === "circular" ? t("mg:rounded-full", {
|
|
234
|
+
"mg:h-4 mg:w-4": f === "sm",
|
|
235
|
+
"mg:h-6 mg:w-6": f === "md",
|
|
236
|
+
"mg:h-8 mg:w-8": f === "lg"
|
|
237
|
+
}) : "", _ = m === "extended" ? t("mg:rounded-lg", {
|
|
238
|
+
"mg:w-4 mg:h-2": f === "sm",
|
|
239
|
+
"mg:w-5 mg:h-3": f === "md",
|
|
240
|
+
"mg:w-6 mg:h-4": f === "lg"
|
|
241
|
+
}) : "", v = o(t("mg:inline-flex mg:items-center mg:justify-center mg:border-solid mg:border-1 mg:hover:cursor-pointer", "mg:focus-visible:outline-1 mg:focus-visible:outline-offset-4 mg:focus-visible:outline-primary", {
|
|
242
|
+
"mg:border-primary mg:text-primary": r === "primary",
|
|
243
|
+
"mg:border-secondary mg:text-secondary": r === "secondary",
|
|
244
|
+
"mg:border-accent mg:hover:border-accent-hover mg:text-accent mg:hover:text-accent-hover": r === "accent",
|
|
245
|
+
"mg:border-error mg:text-danger": r === "error",
|
|
246
|
+
"mg:border-info mg:text-info": r === "info",
|
|
247
|
+
"mg:border-success mg:text-success": r === "success",
|
|
248
|
+
"mg:border-warning mg:text-warning": r === "warning",
|
|
249
|
+
"mg:hover:border-accent mg:hover:text-accent": r !== "accent"
|
|
250
|
+
}, g, _), n?.button);
|
|
251
|
+
return s ? /* @__PURE__ */ a("a", {
|
|
252
|
+
className: v,
|
|
253
|
+
href: s,
|
|
254
|
+
onClick: c,
|
|
255
|
+
target: l,
|
|
256
|
+
ref: d,
|
|
257
|
+
...h,
|
|
258
|
+
children: [
|
|
259
|
+
p && N(p, n?.adornment),
|
|
260
|
+
e,
|
|
261
|
+
i && N(i, n?.adornment)
|
|
262
|
+
]
|
|
263
|
+
}) : /* @__PURE__ */ a("button", {
|
|
264
|
+
className: v,
|
|
265
|
+
onClick: c,
|
|
266
|
+
ref: d,
|
|
267
|
+
type: u,
|
|
268
|
+
...h,
|
|
269
|
+
children: [
|
|
270
|
+
p && N(p, n?.adornment),
|
|
271
|
+
e,
|
|
272
|
+
i && N(i, n?.adornment)
|
|
273
|
+
]
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
P.displayName = "Fab";
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/typography/Typography.tsx
|
|
279
|
+
var F = {
|
|
280
|
+
1: "mg:line-clamp-1",
|
|
281
|
+
2: "mg:line-clamp-2",
|
|
282
|
+
3: "mg:line-clamp-3",
|
|
283
|
+
4: "mg:line-clamp-4",
|
|
284
|
+
5: "mg:line-clamp-5",
|
|
285
|
+
6: "mg:line-clamp-6",
|
|
286
|
+
7: "mg:line-clamp-7",
|
|
287
|
+
8: "mg:line-clamp-8",
|
|
288
|
+
9: "mg:line-clamp-9",
|
|
289
|
+
10: "mg:line-clamp-10"
|
|
290
|
+
}, I = [
|
|
291
|
+
"h1",
|
|
292
|
+
"h2",
|
|
293
|
+
"h3",
|
|
294
|
+
"h4",
|
|
295
|
+
"h5",
|
|
296
|
+
"h6"
|
|
297
|
+
], L = [
|
|
298
|
+
"base",
|
|
299
|
+
"small",
|
|
300
|
+
"large"
|
|
301
|
+
], R = {
|
|
302
|
+
base: "mg:text-base",
|
|
303
|
+
small: "mg:text-sm",
|
|
304
|
+
large: "mg:text-base mg:sm:text-lg",
|
|
305
|
+
h1: "mg:text-5xl mg:sm:text-6xl mg:lg:text-8xl",
|
|
306
|
+
h2: "mg:text-4xl mg:sm:text-5xl mg:lg:text-7xl",
|
|
307
|
+
h3: "mg:text-3xl mg:sm:text-4xl mg:lg:text-6xl",
|
|
308
|
+
h4: "mg:text-base mg:sm:text-lg",
|
|
309
|
+
h5: "mg:text-sm mg:sm:text-base",
|
|
310
|
+
h6: "mg:text-sm"
|
|
311
|
+
};
|
|
312
|
+
function z({ align: e = "left", bold: n = !1, className: r, children: a, clamp: s = 2, color: c = "primary", removePadding: l = !1, span: u = !1, truncate: d = !1, underline: f = !1, variant: p = "base", ...m }) {
|
|
313
|
+
let h = I.includes(p), g = L.includes(p), _ = h ? t({
|
|
314
|
+
"mg:font-extrabold": n,
|
|
315
|
+
"mg:font-heading": !n
|
|
316
|
+
}) : "", v = g ? t({
|
|
317
|
+
"mg:font-bold": n,
|
|
318
|
+
"mg:font-body": !n
|
|
319
|
+
}) : "", y = u ? t({
|
|
320
|
+
"mg:font-bold": n,
|
|
321
|
+
"mg:font-body": g,
|
|
322
|
+
"mg:font-heading": h
|
|
323
|
+
}) : "", b = o(t({
|
|
324
|
+
"mg:py-1": !l,
|
|
325
|
+
"mg:text-left": e === "left",
|
|
326
|
+
"mg:text-center": e === "center",
|
|
327
|
+
"mg:text-right": e === "right",
|
|
328
|
+
"mg:text-justify": e === "justify",
|
|
329
|
+
"mg:truncate": d,
|
|
330
|
+
"mg:underline": f,
|
|
331
|
+
"mg:text-active": c === "active",
|
|
332
|
+
"mg:text-black": c === "black",
|
|
333
|
+
"mg:text-primary": c === "primary",
|
|
334
|
+
"mg:text-secondary": c === "secondary",
|
|
335
|
+
"mg:text-accent": c === "accent",
|
|
336
|
+
"mg:text-subtle": c === "subtle",
|
|
337
|
+
"mg:text-inverse": c === "inverse",
|
|
338
|
+
"mg:text-white": c === "white"
|
|
339
|
+
}, _, v, y, R[p], s ? F[s] : ""), r);
|
|
340
|
+
return i(u ? "span" : h ? p : "p", {
|
|
341
|
+
className: b,
|
|
342
|
+
...m,
|
|
343
|
+
children: a
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
z.displayName = "Typography";
|
|
347
|
+
//#endregion
|
|
348
|
+
//#region src/typography/Link.tsx
|
|
349
|
+
var B = (e) => I.includes(e), V = ({ anchorProps: e = {}, anchorRef: n, children: r, classes: a = {}, color: s = "primary", href: c, onClick: l, target: u, variant: d = "base", ...f }) => {
|
|
350
|
+
let p = o(t("mg:flex mg:group"), a?.anchor), m = o(t("mg:cursor-pointer", {
|
|
351
|
+
"mg:group-hover:text-accent": s !== "accent",
|
|
352
|
+
"mg:group-hover:text-subtle-hover": s === "accent",
|
|
353
|
+
"mg:group-active:text-active mg:group-visited:text-active": s !== "active",
|
|
354
|
+
"mg:group-active:text-active-hover mg:group-visited:text-active-hover": s === "active"
|
|
355
|
+
}), a?.typography);
|
|
356
|
+
return B(d), /* @__PURE__ */ i("a", {
|
|
357
|
+
className: p,
|
|
358
|
+
href: c,
|
|
359
|
+
onClick: l,
|
|
360
|
+
ref: n,
|
|
361
|
+
target: u,
|
|
362
|
+
...e,
|
|
363
|
+
children: /* @__PURE__ */ i(z, {
|
|
364
|
+
className: m,
|
|
365
|
+
color: s,
|
|
366
|
+
variant: d,
|
|
367
|
+
...f,
|
|
368
|
+
children: r
|
|
369
|
+
})
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
V.displayName = "Link";
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/card/Header.tsx
|
|
375
|
+
var H = (e) => d(e) ? u(e, {
|
|
376
|
+
className: "mg:animate-fade-in",
|
|
377
|
+
size: "xs",
|
|
378
|
+
style: { animationDuration: "2s" }
|
|
379
|
+
}) : null, U = (e) => "src" in e ? /* @__PURE__ */ i("img", {
|
|
380
|
+
alt: e.alt || "",
|
|
381
|
+
src: e.src || "",
|
|
382
|
+
width: 40,
|
|
383
|
+
height: 40,
|
|
384
|
+
className: "mg-object-contain"
|
|
385
|
+
}) : /* @__PURE__ */ i(n, {
|
|
386
|
+
icon: e,
|
|
387
|
+
className: "mg-text-sm"
|
|
388
|
+
}), W = ({ adornment: e, badge: t, ref: n, subtitle: r, title: o, ...s }) => /* @__PURE__ */ a("div", {
|
|
389
|
+
className: "mg:flex mg:flex-col mg:gap-1 mg:px-3 mg:py-2",
|
|
390
|
+
ref: n,
|
|
391
|
+
...s,
|
|
392
|
+
children: [/* @__PURE__ */ a("div", {
|
|
393
|
+
className: "mg:flex mg:items-center mg:gap-3",
|
|
394
|
+
children: [
|
|
395
|
+
e && U(e),
|
|
396
|
+
/* @__PURE__ */ i(z, {
|
|
397
|
+
clamp: 3,
|
|
398
|
+
bold: !0,
|
|
399
|
+
className: "mg:lg:text-2xl mg:sm:text-lg mg:text-base",
|
|
400
|
+
variant: "h2",
|
|
401
|
+
children: o
|
|
402
|
+
}),
|
|
403
|
+
t && H(t)
|
|
404
|
+
]
|
|
405
|
+
}), r && /* @__PURE__ */ i(z, {
|
|
406
|
+
clamp: 10,
|
|
407
|
+
variant: "small",
|
|
408
|
+
children: r
|
|
409
|
+
})]
|
|
410
|
+
});
|
|
411
|
+
W.displayName = "Card.Header";
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/card/Media.tsx
|
|
414
|
+
var G = {
|
|
415
|
+
"1:1": "mg:aspect-square",
|
|
416
|
+
"16:9": "mg:aspect-video",
|
|
417
|
+
"4:3": "mg:aspect-[4/3]",
|
|
418
|
+
"3:2": "mg:aspect-[3/2]",
|
|
419
|
+
"21:9": "mg:aspect-[21/9]"
|
|
420
|
+
}, K = ({ alt: e = "", aspectRatio: n = "4:3", headerless: r = !1, footerless: a = !1, priority: o = "lazy", sizes: s = "(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw", src: c = "", ref: l, ...u }) => /* @__PURE__ */ i("div", {
|
|
421
|
+
className: t("mg:relative mg:w-full mg:overflow-hidden", G[n], {
|
|
422
|
+
"mg:rounded-tl-lg mg:rounded-tr-lg": r,
|
|
423
|
+
"mg:rounded-bl-lg mg:rounded-br-lg": a
|
|
424
|
+
}),
|
|
425
|
+
ref: l,
|
|
426
|
+
...u,
|
|
427
|
+
children: /* @__PURE__ */ i("img", {
|
|
428
|
+
alt: e,
|
|
429
|
+
src: c,
|
|
430
|
+
loading: o,
|
|
431
|
+
sizes: s,
|
|
432
|
+
className: "mg:absolute mg:inset-0 mg:h-full mg:w-full mg:object-cover mg:animate-fade-in"
|
|
433
|
+
})
|
|
434
|
+
});
|
|
435
|
+
K.displayName = "Card.Media";
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region src/card/Footer.tsx
|
|
438
|
+
var q = ({ actions: e, description: t, subtitle: n, title: o, ref: s, ...c }) => /* @__PURE__ */ a("div", {
|
|
439
|
+
className: "mg:flex mg:grow mg:flex-col mg:justify-between mg:items-start mg:gap-3 mg:w-full mg:px-3 mg:py-2",
|
|
440
|
+
ref: s,
|
|
441
|
+
...c,
|
|
442
|
+
children: [/* @__PURE__ */ a("div", {
|
|
443
|
+
className: "mg:flex mg:flex-col mg:justify-center mg:items-start mg:gap-1.5",
|
|
444
|
+
children: [o && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(z, {
|
|
445
|
+
className: "mg:text-base mg:sm:text-xl mg:lg:text-3xl",
|
|
446
|
+
clamp: 3,
|
|
447
|
+
bold: !0,
|
|
448
|
+
variant: "h3",
|
|
449
|
+
children: o
|
|
450
|
+
}), n && /* @__PURE__ */ i(z, {
|
|
451
|
+
clamp: 10,
|
|
452
|
+
variant: "small",
|
|
453
|
+
children: n
|
|
454
|
+
})] }), t && /* @__PURE__ */ i(z, {
|
|
455
|
+
clamp: 10,
|
|
456
|
+
variant: "base",
|
|
457
|
+
children: t
|
|
458
|
+
})]
|
|
459
|
+
}), e && /* @__PURE__ */ i("div", {
|
|
460
|
+
className: "mg:flex mg:justify-start mg:items-center mg:gap-2",
|
|
461
|
+
children: e.map((e, t) => /* @__PURE__ */ i(A, {
|
|
462
|
+
classes: { button: "mg:animate-fade-in mg:duration-500" },
|
|
463
|
+
endAdornment: e?.endAdornment,
|
|
464
|
+
href: e?.href,
|
|
465
|
+
onClick: e?.onClick,
|
|
466
|
+
size: "sm",
|
|
467
|
+
startAdornment: e?.startAdornment,
|
|
468
|
+
style: { animationDelay: `${t * .1}s` },
|
|
469
|
+
target: e?.target,
|
|
470
|
+
variant: e?.variant,
|
|
471
|
+
children: e?.label
|
|
472
|
+
}, `footer-action-${t}`))
|
|
473
|
+
})]
|
|
474
|
+
});
|
|
475
|
+
q.displayName = "Card.Footer";
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/card/Card.tsx
|
|
478
|
+
var J = ({ children: e, ref: t, ...n }) => {
|
|
479
|
+
let o = (e) => {
|
|
480
|
+
let t = {};
|
|
481
|
+
return c.forEach(e, (e) => {
|
|
482
|
+
s.isValidElement(e) && (e.type === W ? t.header = e : e.type === K ? t.media = e : e.type === q && (t.footer = e));
|
|
483
|
+
}), !t.header && t.media && (t.media = s.cloneElement(t.media, { headerless: !0 })), !t.footer && t.media && (t.media = s.cloneElement(t.media, { footerless: !0 })), /* @__PURE__ */ a(r, { children: [
|
|
484
|
+
t.header,
|
|
485
|
+
t.media,
|
|
486
|
+
t.footer
|
|
487
|
+
] });
|
|
488
|
+
};
|
|
489
|
+
return /* @__PURE__ */ i("div", {
|
|
490
|
+
className: "mg:flex mg:min-w-36 mg:max-w-52 mg:w-full mg:flex-col mg:justify-start mg:bg-primary-subtle mg:rounded-lg mg:shadow-lg mg:shadow-black/20 mg:ring-1 mg:ring-black/5 mg:transition-transform mg:duration-200 mg:hover:scale-[1.02]",
|
|
491
|
+
ref: t,
|
|
492
|
+
...n,
|
|
493
|
+
children: o(e)
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
J.displayName = "Card";
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/carousel/Hero.tsx
|
|
499
|
+
var Y = {
|
|
500
|
+
sm: "mg:h-[300px]",
|
|
501
|
+
md: "mg:h-[450px]",
|
|
502
|
+
lg: "mg:h-[600px]",
|
|
503
|
+
xl: "mg:h-[750px]",
|
|
504
|
+
full: "mg:h-full"
|
|
505
|
+
}, ee = {
|
|
506
|
+
sm: "mg:h-[260px] mg:sm:h-[300px]",
|
|
507
|
+
md: "mg:h-[340px] mg:sm:h-[450px]",
|
|
508
|
+
lg: "mg:h-[420px] mg:sm:h-[600px]",
|
|
509
|
+
xl: "mg:h-[520px] mg:sm:h-[750px]",
|
|
510
|
+
full: "mg:min-h-svh mg:h-svh"
|
|
511
|
+
}, X = {
|
|
512
|
+
"16:9": "mg:aspect-[16/9]",
|
|
513
|
+
"4:3": "mg:aspect-[4/3]",
|
|
514
|
+
"1:1": "mg:aspect-square"
|
|
515
|
+
}, Z = {
|
|
516
|
+
"16:9": "mg:aspect-[4/5] mg:sm:aspect-[16/9]",
|
|
517
|
+
"4:3": "mg:aspect-[4/5] mg:sm:aspect-[4/3]",
|
|
518
|
+
"1:1": "mg:aspect-square"
|
|
519
|
+
}, te = ({ aspectRatio: e, autoPlay: n = !1, classes: r = {}, enableSwipe: s = !0, header: c = {
|
|
520
|
+
links: [],
|
|
521
|
+
variant: "h2"
|
|
522
|
+
}, height: l = "md", images: u = [], interval: d = 3e3, lazyLoad: m = !1, loop: v = !0, objectFit: x = "cover", showControls: S = !0, pauseOnHover: C = !0, responsive: w = !0, showDots: T = !0, transition: E = "slide", transitionDuration: D = 500, ...O }) => {
|
|
523
|
+
let [k, j] = _({
|
|
524
|
+
loop: v,
|
|
525
|
+
watchDrag: s
|
|
526
|
+
}), [N, P] = g(0), [F, I] = g(() => u.map((e, t) => t)), L = h(!1), R = f(() => {
|
|
527
|
+
j && P(j.selectedScrollSnap());
|
|
528
|
+
}, [j]), B = () => {
|
|
529
|
+
C && (L.current = !0);
|
|
530
|
+
}, V = () => {
|
|
531
|
+
C && (L.current = !1);
|
|
532
|
+
}, H = () => {
|
|
533
|
+
j && j?.scrollNext();
|
|
534
|
+
}, U = () => {
|
|
535
|
+
j && j?.scrollPrev();
|
|
536
|
+
}, W = (e) => {
|
|
537
|
+
j && j?.scrollTo(e);
|
|
538
|
+
}, G = e ? w ? Z[e] : X[e] : w ? ee[l] : Y[l], K = o(t("mg:relative mg:overflow-hidden mg:isolate", w && "mg:w-full", s && "mg:cursor-grab"), r?.root), q = o(t("mg:flex", { "mg:touch-pan-y": s }), r?.viewport), J = (e) => o(t("mg:w-2 mg:h-2 mg:rounded-full mg:transition-colors mg:hover:cursor-pointer", {
|
|
539
|
+
"mg:bg-secondary": e === N,
|
|
540
|
+
"mg:bg-secondary-subtle": e !== N
|
|
541
|
+
}), r?.dot), te = o(t("mg:flex-[0_0_100%] mg:relative", G, { "mg:transition-opacity": E === "fade" }), r?.slide), ne = o(t("mg:absolute mg:z-10 mg:flex mg:flex-col", w ? "mg:inset-x-4 mg:top-1/2 mg:max-w-[calc(100%-2rem)] mg:-translate-y-1/2 mg:sm:inset-x-auto mg:sm:top-1/4 mg:sm:left-1/6 mg:sm:max-w-[min(72%,48rem)] mg:sm:translate-y-0 mg:gap-1 mg:sm:gap-2" : "mg:top-1/4 mg:left-1/6 mg:gap-2"), r?.header?.root), re = o(t("mg:flex mg:justify-start", w ? "mg:items-start mg:gap-2 mg:xs:flex-row mg:xs:flex-wrap mg:sm:items-center mg:sm:gap-4" : "mg:items-center mg:gap-4"), r?.action), ie = o(t("mg:absolute mg:left-0 mg:z-10 mg:flex mg:w-full mg:items-center mg:justify-between mg:pointer-events-none", w ? "mg:top-1/2 mg:-translate-y-1/2 mg:px-2 mg:sm:top-1/3 mg:sm:translate-y-0 mg:sm:px-6" : "mg:top-1/3 mg:px-6"), r?.controls), Q = o(t("mg:absolute mg:left-1/2 mg:z-10 mg:flex mg:-translate-x-1/2 mg:gap-2", w ? "mg:bottom-3 mg:sm:bottom-4" : "mg:bottom-4"), r?.dotsContainer);
|
|
542
|
+
return p(() => {
|
|
543
|
+
if (!j) return;
|
|
544
|
+
let e = () => I(j.scrollSnapList());
|
|
545
|
+
return j.on("reInit", e), j.on("select", R), () => {
|
|
546
|
+
j.off("reInit", e), j.off("select", R);
|
|
547
|
+
};
|
|
548
|
+
}, [j, R]), p(() => {
|
|
549
|
+
if (!n || !j) return;
|
|
550
|
+
let e = setInterval(() => {
|
|
551
|
+
L.current || j.scrollNext();
|
|
552
|
+
}, d);
|
|
553
|
+
return () => clearInterval(e);
|
|
554
|
+
}, [
|
|
555
|
+
n,
|
|
556
|
+
j,
|
|
557
|
+
d
|
|
558
|
+
]), /* @__PURE__ */ a("div", {
|
|
559
|
+
className: K,
|
|
560
|
+
ref: k,
|
|
561
|
+
onMouseEnter: B,
|
|
562
|
+
onMouseLeave: V,
|
|
563
|
+
...O,
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ i("div", {
|
|
566
|
+
className: q,
|
|
567
|
+
children: u.map((e, t) => /* @__PURE__ */ i("div", {
|
|
568
|
+
className: te,
|
|
569
|
+
style: E === "fade" ? {
|
|
570
|
+
opacity: +(t === N),
|
|
571
|
+
transitionDuration: `${D}ms`
|
|
572
|
+
} : void 0,
|
|
573
|
+
children: /* @__PURE__ */ i("img", {
|
|
574
|
+
src: e.src,
|
|
575
|
+
alt: e.alt,
|
|
576
|
+
loading: m ? "lazy" : "eager",
|
|
577
|
+
className: "mg:absolute mg:inset-0 mg:h-full mg:w-full",
|
|
578
|
+
style: { objectFit: x }
|
|
579
|
+
})
|
|
580
|
+
}, `hero-image-${t}`))
|
|
581
|
+
}),
|
|
582
|
+
/* @__PURE__ */ a("div", {
|
|
583
|
+
className: ne,
|
|
584
|
+
children: [
|
|
585
|
+
c?.title && /* @__PURE__ */ i(z, {
|
|
586
|
+
className: r?.header?.title,
|
|
587
|
+
color: "white",
|
|
588
|
+
variant: c?.variant,
|
|
589
|
+
children: c.title
|
|
590
|
+
}),
|
|
591
|
+
c?.description,
|
|
592
|
+
/* @__PURE__ */ i("div", {
|
|
593
|
+
className: re,
|
|
594
|
+
children: c?.links?.map((e, t) => /* @__PURE__ */ i(A, {
|
|
595
|
+
href: e.href,
|
|
596
|
+
variant: e.variant,
|
|
597
|
+
classes: { button: "mg:animate-fade-in mg:duration-500" },
|
|
598
|
+
style: { animationDelay: `${.2 + t * .15}s` },
|
|
599
|
+
children: e.label
|
|
600
|
+
}, `hero-link-${t}`))
|
|
601
|
+
})
|
|
602
|
+
]
|
|
603
|
+
}),
|
|
604
|
+
S && u.length > 1 && /* @__PURE__ */ a("div", {
|
|
605
|
+
className: ie,
|
|
606
|
+
children: [/* @__PURE__ */ i(M, {
|
|
607
|
+
variant: "filled",
|
|
608
|
+
color: "secondary",
|
|
609
|
+
classes: { iconButton: "mg:pointer-events-auto mg:animate-slide-in-left" },
|
|
610
|
+
onClick: U,
|
|
611
|
+
children: y
|
|
612
|
+
}), /* @__PURE__ */ i(M, {
|
|
613
|
+
variant: "filled",
|
|
614
|
+
color: "secondary",
|
|
615
|
+
classes: { iconButton: "mg:pointer-events-auto mg:animate-slide-in-right" },
|
|
616
|
+
onClick: H,
|
|
617
|
+
children: b
|
|
618
|
+
})]
|
|
619
|
+
}),
|
|
620
|
+
T && F.length > 1 && /* @__PURE__ */ i("div", {
|
|
621
|
+
className: Q,
|
|
622
|
+
children: F.map((e, t) => /* @__PURE__ */ i("button", {
|
|
623
|
+
className: J(t),
|
|
624
|
+
onClick: () => W(t)
|
|
625
|
+
}, `hero-dot-${t}`))
|
|
626
|
+
})
|
|
627
|
+
]
|
|
628
|
+
});
|
|
629
|
+
};
|
|
630
|
+
te.displayName = "Hero";
|
|
631
|
+
//#endregion
|
|
632
|
+
//#region src/carousel/Carousel.tsx
|
|
633
|
+
var ne = {
|
|
634
|
+
1: "mg:sm:basis-[90%]",
|
|
635
|
+
2: "mg:sm:basis-[45%]",
|
|
636
|
+
3: "mg:sm:basis-[45%]",
|
|
637
|
+
4: "mg:sm:basis-[45%]",
|
|
638
|
+
5: "mg:sm:basis-[45%]"
|
|
639
|
+
}, re = {
|
|
640
|
+
1: "mg:lg:basis-[90%]",
|
|
641
|
+
2: "mg:lg:basis-[45%]",
|
|
642
|
+
3: "mg:lg:basis-[30%]",
|
|
643
|
+
4: "mg:lg:basis-[22.5%]",
|
|
644
|
+
5: "mg:lg:basis-[18%]"
|
|
645
|
+
}, ie = ({ "aria-label": e, autoPlay: n = !1, children: r, controlsVariant: s = "filled", classes: l = {}, defaultIndex: u = 0, enableSwipe: d = !0, gap: m = 16, interval: v = 3e3, slidesPerView: x = 3, slidesPerGroup: S = 3, loop: C = !0, pauseOnHover: w = !0, ref: E, role: D = "region", showControls: O = !0, showDots: k = !0, transition: A = "slide", transitionDuration: j = 25, ...N }) => {
|
|
646
|
+
let P = Math.min(S, 2), [F, I] = _({
|
|
647
|
+
loop: C,
|
|
648
|
+
startIndex: u,
|
|
649
|
+
watchDrag: d,
|
|
650
|
+
slidesToScroll: S,
|
|
651
|
+
duration: Math.min(Math.max(j, 20), 60),
|
|
652
|
+
breakpoints: {
|
|
653
|
+
"(max-width: 39.999rem)": { slidesToScroll: 1 },
|
|
654
|
+
"(min-width: 40rem) and (max-width: 63.999rem)": { slidesToScroll: P }
|
|
655
|
+
}
|
|
656
|
+
}, [...A === "fade" ? [T()] : []]), [L, R] = g(u), [z, B] = g(() => I?.scrollSnapList() ?? []), V = h(!1), H = c.toArray(r).length > 1, U = () => {
|
|
657
|
+
w && (V.current = !0);
|
|
658
|
+
}, W = () => {
|
|
659
|
+
w && (V.current = !1);
|
|
660
|
+
}, G = f(() => {
|
|
661
|
+
if (!I) return;
|
|
662
|
+
let e = I.scrollSnapList().length - 1, t = I.selectedScrollSnap() === e;
|
|
663
|
+
if (C && t) {
|
|
664
|
+
I.scrollTo(0);
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
I.scrollNext();
|
|
668
|
+
}, [I, C]), K = f(() => {
|
|
669
|
+
I && R(I.selectedScrollSnap());
|
|
670
|
+
}, [I]), q = (e) => {
|
|
671
|
+
I && I?.scrollTo(e);
|
|
672
|
+
}, J = () => {
|
|
673
|
+
if (!I) return;
|
|
674
|
+
let e = I.scrollSnapList().length - 1, t = I.selectedScrollSnap() === 0;
|
|
675
|
+
if (C && t) {
|
|
676
|
+
I.scrollTo(e);
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
I.scrollPrev();
|
|
680
|
+
}, Y = o("mg:flex mg:flex-col mg:justify-center mg:items-center mg:w-full", l?.root), ee = o(t("mg:relative mg:flex mg:justify-start mg:w-full mg:pt-4 mg:px-3 mg:overflow-hidden mg:xs:px-4 mg:sm:pt-6 mg:sm:px-8", { "mg:cursor-grab": d }), l?.container), X = o("mg:absolute mg:top-1/2 mg:left-0 mg:w-full mg:flex mg:items-center mg:justify-between mg:px-1 mg:pointer-events-none mg:sm:px-2", l?.controlsContainer), Z = t("mg:pointer-events-auto", l?.controls), te = (e) => o(t("mg:w-2 mg:h-2 mg:rounded-full mg:hover:cursor-pointer", {
|
|
681
|
+
"mg:bg-secondary": e === L,
|
|
682
|
+
"mg:bg-secondary-subtle": e !== L
|
|
683
|
+
}), l?.dot), ie = o("mg:flex mg:justify-center mg:items-center mg:gap-2 mg:w-full mg:h-6", l?.dotsContainer), Q = o(t("mg:flex mg:items-stretch mg:justify-start mg:pb-3 mg:w-full", {
|
|
684
|
+
"mg:gap-1 mg:pl-1": m === 8,
|
|
685
|
+
"mg:gap-2 mg:pl-2": m === 16,
|
|
686
|
+
"mg:gap-3 mg:pl-3": m === 24,
|
|
687
|
+
"mg:gap-4 mg:pl-4": m === 32,
|
|
688
|
+
"mg:gap-5 mg:pl-5": m === 40,
|
|
689
|
+
"mg:gap-6 mg:pl-6": m === 48
|
|
690
|
+
}), l?.slidesContainer), $ = o(t("mg:h-full mg:flex mg:justify-center mg:items-stretch mg:min-w-0 mg:basis-[90%] mg:p-2 mg:shrink-0", ne[x], re[x]), l?.slide), ae = o(t("mg:flex mg:w-full", { "mg:justify-center": x > 1 }), l?.slideInner), oe = (e) => c.toArray(e).map((e, t) => /* @__PURE__ */ i("div", {
|
|
691
|
+
className: $,
|
|
692
|
+
children: /* @__PURE__ */ i("div", {
|
|
693
|
+
className: ae,
|
|
694
|
+
children: e
|
|
695
|
+
})
|
|
696
|
+
}, `slide-${t}`));
|
|
697
|
+
return p(() => {
|
|
698
|
+
if (!I) return;
|
|
699
|
+
let e = () => B(I.scrollSnapList());
|
|
700
|
+
return I.on("reInit", e), I.on("select", K), () => {
|
|
701
|
+
I.off("reInit", e), I.off("select", K);
|
|
702
|
+
};
|
|
703
|
+
}, [I, K]), p(() => {
|
|
704
|
+
I && (I.reInit(), queueMicrotask(() => {
|
|
705
|
+
B(I.scrollSnapList()), R(I.selectedScrollSnap());
|
|
706
|
+
}));
|
|
707
|
+
}, [
|
|
708
|
+
r,
|
|
709
|
+
I,
|
|
710
|
+
S,
|
|
711
|
+
x,
|
|
712
|
+
P
|
|
713
|
+
]), p(() => {
|
|
714
|
+
if (!n || !I) return;
|
|
715
|
+
let e = setInterval(() => {
|
|
716
|
+
V.current || G();
|
|
717
|
+
}, v);
|
|
718
|
+
return () => clearInterval(e);
|
|
719
|
+
}, [
|
|
720
|
+
n,
|
|
721
|
+
I,
|
|
722
|
+
G,
|
|
723
|
+
v
|
|
724
|
+
]), /* @__PURE__ */ a("div", {
|
|
725
|
+
className: Y,
|
|
726
|
+
ref: E,
|
|
727
|
+
...N,
|
|
728
|
+
children: [/* @__PURE__ */ a("div", {
|
|
729
|
+
"aria-label": e,
|
|
730
|
+
role: D,
|
|
731
|
+
className: ee,
|
|
732
|
+
ref: F,
|
|
733
|
+
onMouseEnter: U,
|
|
734
|
+
onMouseLeave: W,
|
|
735
|
+
children: [/* @__PURE__ */ i("div", {
|
|
736
|
+
className: Q,
|
|
737
|
+
children: oe(r)
|
|
738
|
+
}), O && H && /* @__PURE__ */ a("div", {
|
|
739
|
+
className: X,
|
|
740
|
+
children: [/* @__PURE__ */ i(M, {
|
|
741
|
+
variant: s,
|
|
742
|
+
color: "secondary",
|
|
743
|
+
classes: { iconButton: Z },
|
|
744
|
+
onClick: J,
|
|
745
|
+
children: y
|
|
746
|
+
}), /* @__PURE__ */ i(M, {
|
|
747
|
+
variant: s,
|
|
748
|
+
color: "secondary",
|
|
749
|
+
classes: { iconButton: Z },
|
|
750
|
+
onClick: G,
|
|
751
|
+
children: b
|
|
752
|
+
})]
|
|
753
|
+
})]
|
|
754
|
+
}), k && z.length >= 1 && /* @__PURE__ */ i("div", {
|
|
755
|
+
className: ie,
|
|
756
|
+
children: z.map((e, t) => /* @__PURE__ */ i("button", {
|
|
757
|
+
className: te(t),
|
|
758
|
+
onClick: () => q(t)
|
|
759
|
+
}, `dot-${t}`))
|
|
760
|
+
})]
|
|
761
|
+
});
|
|
762
|
+
};
|
|
763
|
+
ie.displayName = "Carousel";
|
|
764
|
+
//#endregion
|
|
765
|
+
//#region lib/useControlled.ts
|
|
766
|
+
function Q({ defaultValue: e, value: t }) {
|
|
767
|
+
let [n, r] = g(e), i = t !== void 0;
|
|
768
|
+
return [i ? t : n, (e) => {
|
|
769
|
+
i || r(e);
|
|
770
|
+
}];
|
|
771
|
+
}
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/drawer/Drawer.tsx
|
|
774
|
+
var $ = ({ anchor: e = "left", backdropProps: n, backdropRef: r, closeOnEscape: s = !0, children: c, classes: l, header: u, onBackdropClick: d, onClose: f, onKeyDown: m, open: h, ref: g, showBackdrop: _ = !0, ...v }) => {
|
|
775
|
+
let [y, b] = Q({
|
|
776
|
+
defaultValue: !1,
|
|
777
|
+
value: h
|
|
778
|
+
});
|
|
779
|
+
p(() => {
|
|
780
|
+
if (!y || !s) return;
|
|
781
|
+
let e = (e) => {
|
|
782
|
+
e.key === "Escape" && (b(!1), f());
|
|
783
|
+
};
|
|
784
|
+
return document.addEventListener("keydown", e), () => {
|
|
785
|
+
document.removeEventListener("keydown", e);
|
|
786
|
+
};
|
|
787
|
+
}, [
|
|
788
|
+
s,
|
|
789
|
+
f,
|
|
790
|
+
y,
|
|
791
|
+
b
|
|
792
|
+
]);
|
|
793
|
+
let S = o(t("mg:fixed mg:w-full mg:h-full mg:inset-0 mg:z-40 mg:flex mg:overflow-hidden mg:transition-opacity mg:duration-200 mg:ease-out", {
|
|
794
|
+
"mg:items-start mg:justify-start": e === "left",
|
|
795
|
+
"mg:items-start mg:justify-end": e === "right",
|
|
796
|
+
"mg:items-start mg:justify-stretch": e === "top",
|
|
797
|
+
"mg:items-end mg:justify-stretch": e === "bottom"
|
|
798
|
+
}), l?.backdrop), C = o(t("mg:absolute mg:inset-0 mg:bg-secondary/80 mg:backdrop-blur-sm mg:transition-opacity mg:duration-200 mg:ease-out", {
|
|
799
|
+
"mg:opacity-100": _,
|
|
800
|
+
"mg:opacity-0": !_
|
|
801
|
+
}), l?.overlay), w = o(t("mg:flex mg:justify-between mg:w-full mg:py-3 mg:px-6"), l?.header?.root), T = o(t("mg:flex mg:gap-3"), l?.header?.center), E = o(t("mg:flex mg:gap-3"), l?.header?.left), D = o(t("mg:flex mg:gap-3"), l?.header?.right), O = o(t("mg:flex mg:flex-col mg:w-full"), l?.body), k = o(t("mg:relative mg:flex mg:w-full mg:max-w-full mg:grow-0 mg:flex-col mg:pb-2 mg:z-50 mg:bg-secondary mg:opacity-100 mg:text-primary mg:shadow-xl mg:shadow-black/20 mg:transition-transform mg:duration-300 mg:ease-out", {
|
|
802
|
+
"mg:max-w-80 mg:sm:max-w-96": e === "left" || e === "right",
|
|
803
|
+
"mg:max-h-[85dvh]": e === "top" || e === "bottom",
|
|
804
|
+
"mg:translate-x-0": y && (e === "left" || e === "right"),
|
|
805
|
+
"mg:translate-y-0": y && (e === "top" || e === "bottom"),
|
|
806
|
+
"mg:-translate-x-full": !y && e === "left",
|
|
807
|
+
"mg:translate-x-full": !y && e === "right",
|
|
808
|
+
"mg:-translate-y-full": !y && e === "top",
|
|
809
|
+
"mg:translate-y-full": !y && e === "bottom"
|
|
810
|
+
}), l?.root), A = (e) => {
|
|
811
|
+
d ? d(e) : b(!1);
|
|
812
|
+
};
|
|
813
|
+
return /* @__PURE__ */ a("div", {
|
|
814
|
+
className: S,
|
|
815
|
+
ref: r,
|
|
816
|
+
tabIndex: -1,
|
|
817
|
+
...n,
|
|
818
|
+
children: [/* @__PURE__ */ i("div", {
|
|
819
|
+
className: C,
|
|
820
|
+
"aria-hidden": !0,
|
|
821
|
+
onClick: A
|
|
822
|
+
}), /* @__PURE__ */ a("div", {
|
|
823
|
+
className: k,
|
|
824
|
+
onKeyDown: m,
|
|
825
|
+
ref: g,
|
|
826
|
+
...v,
|
|
827
|
+
children: [/* @__PURE__ */ a("div", {
|
|
828
|
+
className: w,
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ a("div", {
|
|
831
|
+
className: E,
|
|
832
|
+
children: [/* @__PURE__ */ i(M, {
|
|
833
|
+
onClick: f,
|
|
834
|
+
children: x
|
|
835
|
+
}), u?.leftSlot]
|
|
836
|
+
}),
|
|
837
|
+
/* @__PURE__ */ i("div", {
|
|
838
|
+
className: T,
|
|
839
|
+
children: u?.title
|
|
840
|
+
}),
|
|
841
|
+
/* @__PURE__ */ i("div", {
|
|
842
|
+
className: D,
|
|
843
|
+
children: u?.rightSlot
|
|
844
|
+
})
|
|
845
|
+
]
|
|
846
|
+
}), /* @__PURE__ */ i("div", {
|
|
847
|
+
className: O,
|
|
848
|
+
children: c
|
|
849
|
+
})]
|
|
850
|
+
})]
|
|
851
|
+
});
|
|
852
|
+
};
|
|
853
|
+
$.displayName = "Drawer";
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region src/form/TextArea.tsx
|
|
856
|
+
var ae = (e, t, n) => typeof e == "object" && "icon" in e ? /* @__PURE__ */ i(M, {
|
|
857
|
+
classes: { iconButton: n },
|
|
858
|
+
onClick: e?.onClick,
|
|
859
|
+
children: e?.icon
|
|
860
|
+
}, `adornment-${t + 1}`) : typeof e == "object" && "src" in e ? /* @__PURE__ */ i(M, {
|
|
861
|
+
classes: { iconButton: n },
|
|
862
|
+
onClick: e?.onClick,
|
|
863
|
+
children: /* @__PURE__ */ i("img", {
|
|
864
|
+
src: e?.src || "",
|
|
865
|
+
alt: e?.alt || ""
|
|
866
|
+
})
|
|
867
|
+
}, `adornment-${t + 1}`) : /* @__PURE__ */ i(A, {
|
|
868
|
+
classes: { button: "mg:py-1 mg:px-1.5" },
|
|
869
|
+
variant: "outline",
|
|
870
|
+
onClick: e?.onClick,
|
|
871
|
+
children: e?.children
|
|
872
|
+
}, `adornment-${t + 1}`), oe = ({ "aria-describedby": e, "aria-label": n, "aria-invalid": r, adornmentColor: s = "primary", autoFocus: c = !1, classes: l = {}, clearable: u = !1, color: d = "primary", cols: f, defaultValue: p, disabled: m = !1, endAdornments: h = [], error: _ = !1, fullWidth: v = !1, id: y, label: b, maxLength: x, minLength: S, name: C, onChange: T, onClear: E, onInput: D, onBlur: O, onFocus: k, onKeyDown: A, onKeyUp: j, onMouseDown: N, placeholder: P, readonly: F = !1, required: I = !1, rows: L, size: R = "md", spellCheck: z = !0, startAdornments: B = [], status: V, value: H }) => {
|
|
873
|
+
let [U, W] = g(!1), [G, K] = Q({
|
|
874
|
+
defaultValue: p,
|
|
875
|
+
value: H
|
|
876
|
+
}), q = o(t("mg:relative mg:bg-inherit mg:flex mg:flex-col mg:p-2 mg:border-solid mg:border-1 mg:rounded-lg", {
|
|
877
|
+
"mg:border-danger": V === "error" || _,
|
|
878
|
+
"mg:border-success": V === "success",
|
|
879
|
+
"mg:border-warning": V === "warning",
|
|
880
|
+
"mg:border-primary": !V && !_,
|
|
881
|
+
"mg:w-full": v,
|
|
882
|
+
"mg:has-[textarea:focus-visible]:outline-1 mg:has-[textarea:focus-visible]:outline-primary mg:has-[textarea:focus-visible]:outline-offset-4": !U && G === ""
|
|
883
|
+
}), l?.container), J = t("mg:shrink-0", {
|
|
884
|
+
"mg:text-accent": s === "accent",
|
|
885
|
+
"mg:text-black": s === "black",
|
|
886
|
+
"mg:text-inverse": s === "inverse",
|
|
887
|
+
"mg:text-primary": s === "primary",
|
|
888
|
+
"mg:text-secondary": s === "secondary",
|
|
889
|
+
"mg:text-subtle": s === "subtle",
|
|
890
|
+
"mg:text-white": s === "white"
|
|
891
|
+
}, l?.adornment), Y = o("mg:flex mg:w-full mg:gap-2 mg:overflow-x-auto mg:scrollbar-subtle mg:p-1", l?.adornmentContainer), ee = t(Y, "mg:flex-row-reverse"), X = o(t("mg:font-body mg:text-sm", {
|
|
892
|
+
"mg:text-accent": s === "accent" && !V && !_,
|
|
893
|
+
"mg:text-black": s === "black" && !V && !_,
|
|
894
|
+
"mg:text-inverse": s === "inverse" && !V && !_,
|
|
895
|
+
"mg:text-primary": s === "primary" && !V && !_,
|
|
896
|
+
"mg:text-secondary": s === "secondary" && !V && !_,
|
|
897
|
+
"mg:text-subtle": s === "subtle" && !V && !_,
|
|
898
|
+
"mg:text-white": s === "white" && !V && !_,
|
|
899
|
+
"mg:text-success": V === "success" && !_,
|
|
900
|
+
"mg:text-warning": V === "warning" && !_,
|
|
901
|
+
"mg:text-danger": V === "error" || _
|
|
902
|
+
}), l?.label), Z = o(t("mg:focus-visible:outline-0 mg:caret-accent", {
|
|
903
|
+
"mg:text-black": d === "black",
|
|
904
|
+
"mg:text-inverse": d === "inverse",
|
|
905
|
+
"mg:text-primary": d === "primary",
|
|
906
|
+
"mg:text-white": d === "white",
|
|
907
|
+
"mg:w-12": R === "sm" && !v,
|
|
908
|
+
"mg:w-32": R === "md" && !v,
|
|
909
|
+
"mg:w-52": R === "lg" && !v,
|
|
910
|
+
"mg:w-full mg:h-24": v
|
|
911
|
+
}), l?.textarea);
|
|
912
|
+
return /* @__PURE__ */ a("div", {
|
|
913
|
+
className: q,
|
|
914
|
+
children: [
|
|
915
|
+
b && /* @__PURE__ */ i("div", {
|
|
916
|
+
className: "mg:absolute mg:bg-inherit mg:-top-1.5 mg:left-3.5 mg:animate-slide-in-top",
|
|
917
|
+
children: /* @__PURE__ */ a("p", {
|
|
918
|
+
className: X,
|
|
919
|
+
children: [b, I && /* @__PURE__ */ i("span", {
|
|
920
|
+
className: "mg:text-danger",
|
|
921
|
+
children: " *"
|
|
922
|
+
})]
|
|
923
|
+
})
|
|
924
|
+
}),
|
|
925
|
+
/* @__PURE__ */ a("div", {
|
|
926
|
+
className: "mg:flex mg:justify-between mg:gap-2 mg:pb-1",
|
|
927
|
+
children: [/* @__PURE__ */ a("div", {
|
|
928
|
+
className: Y,
|
|
929
|
+
children: [u && /* @__PURE__ */ i(M, {
|
|
930
|
+
"aria-label": "Clear input",
|
|
931
|
+
classes: { iconButton: J },
|
|
932
|
+
onClick: (e) => {
|
|
933
|
+
E ? E(e) : K("");
|
|
934
|
+
},
|
|
935
|
+
type: "button",
|
|
936
|
+
children: w
|
|
937
|
+
}), B.map((e, t) => ae(e, t, J))]
|
|
938
|
+
}), /* @__PURE__ */ i("div", {
|
|
939
|
+
className: ee,
|
|
940
|
+
children: h.map((e, t) => ae(e, t, J))
|
|
941
|
+
})]
|
|
942
|
+
}),
|
|
943
|
+
/* @__PURE__ */ i("textarea", {
|
|
944
|
+
"aria-describedby": e,
|
|
945
|
+
"aria-label": n,
|
|
946
|
+
"aria-invalid": r,
|
|
947
|
+
autoFocus: c,
|
|
948
|
+
className: Z,
|
|
949
|
+
cols: f,
|
|
950
|
+
disabled: m,
|
|
951
|
+
id: y,
|
|
952
|
+
maxLength: x,
|
|
953
|
+
minLength: S,
|
|
954
|
+
name: C,
|
|
955
|
+
onChange: (e) => {
|
|
956
|
+
T ? T(e) : K(e.target.value);
|
|
957
|
+
},
|
|
958
|
+
onInput: D,
|
|
959
|
+
onBlur: (e) => {
|
|
960
|
+
W(!1), O && O(e);
|
|
961
|
+
},
|
|
962
|
+
onFocus: k,
|
|
963
|
+
onMouseDown: (e) => {
|
|
964
|
+
W(!0), N && N(e);
|
|
965
|
+
},
|
|
966
|
+
onKeyDown: (e) => {
|
|
967
|
+
(e.key === "Escape" || e.key === "Esc" || e.code === "Escape") && (W(!1), A ? A(e) : K(""));
|
|
968
|
+
},
|
|
969
|
+
onKeyUp: j,
|
|
970
|
+
placeholder: P,
|
|
971
|
+
readOnly: F,
|
|
972
|
+
required: I,
|
|
973
|
+
rows: L,
|
|
974
|
+
spellCheck: z,
|
|
975
|
+
value: G
|
|
976
|
+
})
|
|
977
|
+
]
|
|
978
|
+
});
|
|
979
|
+
};
|
|
980
|
+
oe.displayName = "TextArea";
|
|
981
|
+
//#endregion
|
|
982
|
+
//#region src/form/TextInput.tsx
|
|
983
|
+
var se = (e, r = "white", a) => {
|
|
984
|
+
let o = t("mg:text-base", {
|
|
985
|
+
"mg:text-white": r === "white",
|
|
986
|
+
"mg:text-black": r === "black",
|
|
987
|
+
"mg:text-primary": r === "primary",
|
|
988
|
+
"mg:text-secondary": r === "secondary",
|
|
989
|
+
"mg:text-accent": r === "accent",
|
|
990
|
+
"mg:text-subtle": r === "subtle"
|
|
991
|
+
}, a), s = t("mg:object-contain mg:animate-fade-in mg:duration-500", a);
|
|
992
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
993
|
+
icon: e,
|
|
994
|
+
className: o
|
|
995
|
+
}) : /* @__PURE__ */ i("img", {
|
|
996
|
+
src: e.src || "",
|
|
997
|
+
alt: e.alt || "",
|
|
998
|
+
width: 16,
|
|
999
|
+
height: 16,
|
|
1000
|
+
className: s
|
|
1001
|
+
});
|
|
1002
|
+
}, ce = ({ "aria-describedby": e, "aria-label": n, "aria-invalid": r, autoComplete: s = !1, adornmentColor: c, autoFocus: l = !1, classes: u = {}, clearable: d = !1, color: f = "black", defaultValue: m, disabled: h = !1, endAdornment: _, error: v, fullWidth: y = !1, helperText: b, id: x, inputMode: T, label: E, maxLength: D, minLength: O, name: k, pattern: A, placeholder: j, readOnly: N = !1, ref: P, required: F = !1, showPasswordToggle: I = !0, status: L, size: R = "md", spellCheck: z = !1, startAdornment: B, type: V = "text", onChange: H, onClear: U, onError: W, onInput: G, onBlur: K, onFocus: q, onKeyDown: J, onKeyUp: Y, onMouseDown: ee, value: X, ...Z }) => {
|
|
1003
|
+
let [te, ne] = g(!1), [re, ie] = g(!1), [$, ae] = Q({
|
|
1004
|
+
defaultValue: !1,
|
|
1005
|
+
value: v
|
|
1006
|
+
}), [oe, ce] = Q({
|
|
1007
|
+
defaultValue: m,
|
|
1008
|
+
value: X
|
|
1009
|
+
}), le = o(t("mg:flex mg:flex-col mg:gap-2 mg:relative mg:bg-inherit mg:pt-0.5 mg:pb-3 mg:h-full", { "mg:w-full": y }), u?.container), ue = t({
|
|
1010
|
+
"mg:text-accent": c === "accent",
|
|
1011
|
+
"mg:text-black": c === "black",
|
|
1012
|
+
"mg:text-inverse": c === "inverse",
|
|
1013
|
+
"mg:text-primary": c === "primary",
|
|
1014
|
+
"mg:text-secondary": c === "secondary",
|
|
1015
|
+
"mg:text-subtle": c === "subtle",
|
|
1016
|
+
"mg:text-white": c === "white",
|
|
1017
|
+
"mg:shrink-0": y
|
|
1018
|
+
}, u?.clearButton), de = o(t("mg:font-body mg:text-sm", {
|
|
1019
|
+
"mg:text-accent": c === "accent" && !L && !$,
|
|
1020
|
+
"mg:text-black": c === "black" && !L && !$,
|
|
1021
|
+
"mg:text-inverse": c === "inverse" && !L && !$,
|
|
1022
|
+
"mg:text-primary": c === "primary" && !L && !$,
|
|
1023
|
+
"mg:text-secondary": c === "secondary" && !L && !$,
|
|
1024
|
+
"mg:text-subtle": c === "subtle" && !L && !$,
|
|
1025
|
+
"mg:text-white": c === "white" && !L && !$,
|
|
1026
|
+
"mg:text-success": L === "success" && !$,
|
|
1027
|
+
"mg:text-warning": L === "warning" && !$,
|
|
1028
|
+
"mg:text-danger": L === "error" || $
|
|
1029
|
+
}), u?.helper), fe = o(t("mg:focus-visible:outline-0 mg:caret-white", {
|
|
1030
|
+
"mg:text-black": f === "black",
|
|
1031
|
+
"mg:text-inverse": f === "inverse",
|
|
1032
|
+
"mg:text-primary": f === "primary",
|
|
1033
|
+
"mg:text-white": f === "white",
|
|
1034
|
+
"mg:w-12": R === "sm" && !y,
|
|
1035
|
+
"mg:w-32": R === "md" && !y,
|
|
1036
|
+
"mg:w-52": R === "lg" && !y,
|
|
1037
|
+
"mg:grow": y
|
|
1038
|
+
}), u?.input), pe = o(t("mg:flex mg:h-full mg:items-center mg:border-solid mg:gap-2 mg:border-1 mg:rounded-md mg:px-3 mg:py-2 mg:hover:border-accent", {
|
|
1039
|
+
"mg:border-danger": $ || L === "error",
|
|
1040
|
+
"mg:border-warning": L === "warning",
|
|
1041
|
+
"mg:border-success": L === "success",
|
|
1042
|
+
"mg:border-primary": !$ && !L,
|
|
1043
|
+
"mg:w-full": y,
|
|
1044
|
+
"mg:has-[input:focus]:outline-1 mg:has-[input:focus]:outline-primary mg:has-[input:focus]:outline-offset-4": !te && oe === ""
|
|
1045
|
+
}), u?.inputContainer), me = o(t("mg:font-body mg:text-sm", {
|
|
1046
|
+
"mg:text-accent": c === "accent" && !L && !$,
|
|
1047
|
+
"mg:text-black": c === "black" && !L && !$,
|
|
1048
|
+
"mg:text-inverse": c === "inverse" && !L && !$,
|
|
1049
|
+
"mg:text-primary": c === "primary" && !L && !$,
|
|
1050
|
+
"mg:text-secondary": c === "secondary" && !L && !$,
|
|
1051
|
+
"mg:text-subtle": c === "subtle" && !L && !$,
|
|
1052
|
+
"mg:text-white": c === "white" && !L && !$,
|
|
1053
|
+
"mg:text-success": L === "success" && !$,
|
|
1054
|
+
"mg:text-warning": L === "warning" && !$,
|
|
1055
|
+
"mg:text-danger": L === "error" || $
|
|
1056
|
+
}), u?.label), he = t({
|
|
1057
|
+
"mg:text-accent": c === "accent",
|
|
1058
|
+
"mg:text-black": c === "black",
|
|
1059
|
+
"mg:text-inverse": c === "inverse",
|
|
1060
|
+
"mg:text-primary": c === "primary",
|
|
1061
|
+
"mg:text-secondary": c === "secondary",
|
|
1062
|
+
"mg:text-subtle": c === "subtle",
|
|
1063
|
+
"mg:text-white": c === "white",
|
|
1064
|
+
"mg:shrink-0": y
|
|
1065
|
+
}, u?.toggleButton), ge = (e) => {
|
|
1066
|
+
ne(!1), K && K(e);
|
|
1067
|
+
}, _e = (e) => {
|
|
1068
|
+
if (A) {
|
|
1069
|
+
let t = A.test(e.target.value);
|
|
1070
|
+
W ? W(!t) : ae(!t);
|
|
1071
|
+
}
|
|
1072
|
+
H ? H(e) : ce(e.target.value);
|
|
1073
|
+
}, ve = (e) => {
|
|
1074
|
+
ce(""), U ? U(e, !1) : ae(!1);
|
|
1075
|
+
}, ye = (e) => {
|
|
1076
|
+
(e.key === "Escape" || e.key === "Esc" || e.code === "Escape") && (ne(!1), J ? J(e) : ce(""));
|
|
1077
|
+
}, be = (e) => {
|
|
1078
|
+
ne(!0), ee && ee(e);
|
|
1079
|
+
}, xe = () => {
|
|
1080
|
+
ie(!re);
|
|
1081
|
+
};
|
|
1082
|
+
p(() => {
|
|
1083
|
+
let e = L === "error" && !A;
|
|
1084
|
+
L !== "error" && A || (W ? e && W($ !== e) : e && ae($ !== e));
|
|
1085
|
+
}, [
|
|
1086
|
+
A,
|
|
1087
|
+
L,
|
|
1088
|
+
W,
|
|
1089
|
+
ae,
|
|
1090
|
+
$
|
|
1091
|
+
]);
|
|
1092
|
+
let Se = V === "password" && re ? "text" : V;
|
|
1093
|
+
return /* @__PURE__ */ a("div", {
|
|
1094
|
+
className: le,
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ i("div", {
|
|
1097
|
+
className: "mg:absolute mg:-top-0.75 mg:bg-inherit mg:left-3.5 mg:animate-slide-in-top",
|
|
1098
|
+
children: E && /* @__PURE__ */ a("p", {
|
|
1099
|
+
className: me,
|
|
1100
|
+
children: [E, F && /* @__PURE__ */ i("span", {
|
|
1101
|
+
className: "mg:text-danger",
|
|
1102
|
+
children: " *"
|
|
1103
|
+
})]
|
|
1104
|
+
})
|
|
1105
|
+
}),
|
|
1106
|
+
/* @__PURE__ */ a("div", {
|
|
1107
|
+
className: pe,
|
|
1108
|
+
children: [
|
|
1109
|
+
d && /* @__PURE__ */ i(M, {
|
|
1110
|
+
"aria-label": "Clear input",
|
|
1111
|
+
classes: { iconButton: ue },
|
|
1112
|
+
onClick: ve,
|
|
1113
|
+
type: "button",
|
|
1114
|
+
children: w
|
|
1115
|
+
}),
|
|
1116
|
+
B && se(B, c, u?.startAdornment),
|
|
1117
|
+
/* @__PURE__ */ i("input", {
|
|
1118
|
+
"aria-describedby": e,
|
|
1119
|
+
"aria-label": n,
|
|
1120
|
+
"aria-invalid": r,
|
|
1121
|
+
autoComplete: s ? "on" : "off",
|
|
1122
|
+
autoFocus: l,
|
|
1123
|
+
className: fe,
|
|
1124
|
+
disabled: h,
|
|
1125
|
+
id: x,
|
|
1126
|
+
inputMode: T,
|
|
1127
|
+
maxLength: D,
|
|
1128
|
+
minLength: O,
|
|
1129
|
+
name: k,
|
|
1130
|
+
onChange: _e,
|
|
1131
|
+
onInput: G,
|
|
1132
|
+
onBlur: ge,
|
|
1133
|
+
onFocus: q,
|
|
1134
|
+
onKeyDown: ye,
|
|
1135
|
+
onKeyUp: Y,
|
|
1136
|
+
onMouseDown: be,
|
|
1137
|
+
placeholder: j,
|
|
1138
|
+
readOnly: N,
|
|
1139
|
+
ref: P,
|
|
1140
|
+
required: F,
|
|
1141
|
+
spellCheck: z,
|
|
1142
|
+
type: Se,
|
|
1143
|
+
value: oe ?? "",
|
|
1144
|
+
...Z
|
|
1145
|
+
}),
|
|
1146
|
+
V !== "password" && _ && se(_, c, u?.endAdornment),
|
|
1147
|
+
V === "password" && I && /* @__PURE__ */ i(M, {
|
|
1148
|
+
"aria-label": "Toggle password visibility",
|
|
1149
|
+
classes: { iconButton: he },
|
|
1150
|
+
onClick: xe,
|
|
1151
|
+
type: "button",
|
|
1152
|
+
children: re ? C : S
|
|
1153
|
+
})
|
|
1154
|
+
]
|
|
1155
|
+
}),
|
|
1156
|
+
/* @__PURE__ */ i("div", {
|
|
1157
|
+
className: "mg:absolute mg:bottom-0 mg:left-3.5 mg:bg-inherit mg:animate-slide-in-bottom",
|
|
1158
|
+
children: b && /* @__PURE__ */ a("p", {
|
|
1159
|
+
className: de,
|
|
1160
|
+
children: [b, F && /* @__PURE__ */ i("span", {
|
|
1161
|
+
className: "mg:text-danger",
|
|
1162
|
+
children: " *"
|
|
1163
|
+
})]
|
|
1164
|
+
})
|
|
1165
|
+
})
|
|
1166
|
+
]
|
|
1167
|
+
});
|
|
1168
|
+
};
|
|
1169
|
+
ce.displayName = "TextInput";
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region src/form/Form.tsx
|
|
1172
|
+
var le = (e) => {
|
|
1173
|
+
let t = [], n = 0, r = (e) => {
|
|
1174
|
+
c.forEach(e, (e) => {
|
|
1175
|
+
if (d(e)) {
|
|
1176
|
+
if (d(e) && e.type === ce) {
|
|
1177
|
+
n++;
|
|
1178
|
+
let r = e.props;
|
|
1179
|
+
t.push({
|
|
1180
|
+
key: `form-text-input-${n}`,
|
|
1181
|
+
type: "TextInput",
|
|
1182
|
+
error: r.error,
|
|
1183
|
+
value: r.value || r.defaultValue || ""
|
|
1184
|
+
});
|
|
1185
|
+
} else if (d(e) && e.type === oe) {
|
|
1186
|
+
n++;
|
|
1187
|
+
let r = e.props;
|
|
1188
|
+
t.push({
|
|
1189
|
+
key: `form-text-area-${n}`,
|
|
1190
|
+
type: "TextArea",
|
|
1191
|
+
value: r.value || r.defaultValue || ""
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
d(e) && e.props?.children && r(e.props.children);
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
};
|
|
1198
|
+
return r(e), t;
|
|
1199
|
+
}, ue = (e, r) => {
|
|
1200
|
+
let a = t("mg:animate-fade-in mg:transition-transform mg:duration-500 mg:hover:scale-110", r), s = o("mg:object-contain mg:animate-fade-in mg:transition-transform mg:duration-500 mg:hover:scale-110", r);
|
|
1201
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
1202
|
+
className: a,
|
|
1203
|
+
icon: e
|
|
1204
|
+
}) : /* @__PURE__ */ i("img", {
|
|
1205
|
+
alt: e.alt || "",
|
|
1206
|
+
src: e.src || "",
|
|
1207
|
+
width: 32,
|
|
1208
|
+
height: 32,
|
|
1209
|
+
className: s
|
|
1210
|
+
});
|
|
1211
|
+
}, de = ({ "aria-label": n, "aria-labelledby": s, action: l, adornmentColor: f = "primary", children: m, classes: h = {}, color: _ = "primary", disclaimer: v, encType: y, endAdornment: b, error: x, id: S, method: C, name: w, noValidate: T, onChange: E, onReset: D, onSubmit: O, ref: k, startAdornment: j, title: M, value: N, ...P }) => {
|
|
1212
|
+
let F = le(m), [I, L] = g(F), [, R] = Q({
|
|
1213
|
+
defaultValue: F.some((e) => e?.error),
|
|
1214
|
+
value: x
|
|
1215
|
+
}), [, B] = Q({
|
|
1216
|
+
defaultValue: F,
|
|
1217
|
+
value: N
|
|
1218
|
+
}), { isBelow: V } = e(), H = V("sm"), U = t("mg:text-2xl", {
|
|
1219
|
+
"mg:text-accent": f === "accent",
|
|
1220
|
+
"mg:text-black": f === "black",
|
|
1221
|
+
"mg:text-inverse": f === "inverse",
|
|
1222
|
+
"mg:text-primary": f === "primary",
|
|
1223
|
+
"mg:text-secondary": f === "secondary",
|
|
1224
|
+
"mg:text-subtle": f === "subtle",
|
|
1225
|
+
"mg:text-white": f === "white"
|
|
1226
|
+
}, h?.adornment), W = o("mg:flex mg:flex-col mg:items-start mg:gap-3 mg:bg-inherit mg:w-full", h?.body), G = t("mg:p-1 mg:text-2xl", {
|
|
1227
|
+
"mg:text-accent": f === "accent",
|
|
1228
|
+
"mg:text-black": f === "black",
|
|
1229
|
+
"mg:text-inverse": f === "inverse",
|
|
1230
|
+
"mg:text-primary": f === "primary",
|
|
1231
|
+
"mg:text-secondary": f === "secondary",
|
|
1232
|
+
"mg:text-subtle": f === "subtle",
|
|
1233
|
+
"mg:text-white": f === "white"
|
|
1234
|
+
}, h?.disclaimer?.adornment), K = o("mg:flex mg:grow mg:gap-2", h?.disclaimer?.container), q = o("mg:flex mg:items-center mg:justify-between mg:w-full", h?.header), J = o("mg:flex mg:flex-col mg:items-start mg:gap-3 mg:sm:flex-row mg:sm:items-center mg:justify-between mg:w-full", h?.footer), Y = o(t("mg:flex mg:items-center mg:justify-between mg:w-full"), h?.footerButtonsContainer), ee = o("mg:flex mg:flex-col mg:p-6 mg:gap-4 mg:rounded-lg mg:bg-inherit", h?.form), X = t({
|
|
1235
|
+
"mg:text-accent": f === "accent",
|
|
1236
|
+
"mg:text-black": f === "black",
|
|
1237
|
+
"mg:text-inverse": f === "inverse",
|
|
1238
|
+
"mg:text-primary": f === "primary",
|
|
1239
|
+
"mg:text-secondary": f === "secondary",
|
|
1240
|
+
"mg:text-subtle": f === "subtle",
|
|
1241
|
+
"mg:text-white": f === "white"
|
|
1242
|
+
}, h?.submitButton), Z = (e, t) => {
|
|
1243
|
+
L((n) => {
|
|
1244
|
+
let r = !1, i = n.map((n) => n?.key === t ? n.value === e.target.value ? n : (r = !0, {
|
|
1245
|
+
...n,
|
|
1246
|
+
value: e.target.value
|
|
1247
|
+
}) : n);
|
|
1248
|
+
return r ? i : n;
|
|
1249
|
+
});
|
|
1250
|
+
}, te = (e) => {
|
|
1251
|
+
L((t) => t.map((t) => t?.key === e ? {
|
|
1252
|
+
...t,
|
|
1253
|
+
value: ""
|
|
1254
|
+
} : t));
|
|
1255
|
+
}, ne = (e, t) => {
|
|
1256
|
+
L((n) => {
|
|
1257
|
+
let r = !1, i = n.map((n) => n?.key === t ? n.error === e ? n : (r = !0, {
|
|
1258
|
+
...n,
|
|
1259
|
+
error: e
|
|
1260
|
+
}) : n);
|
|
1261
|
+
return r ? i : n;
|
|
1262
|
+
});
|
|
1263
|
+
}, re = (e) => {
|
|
1264
|
+
L(F), D && D(e);
|
|
1265
|
+
}, ie = (e) => {
|
|
1266
|
+
O && O(e, I, I.some((e) => e?.error));
|
|
1267
|
+
}, $ = (e) => {
|
|
1268
|
+
let t = 0, n = (e) => c.map(e, (e) => {
|
|
1269
|
+
if (!d(e)) return e;
|
|
1270
|
+
if (e.type === oe) {
|
|
1271
|
+
t++;
|
|
1272
|
+
let n = `form-text-area-${t}`, r = I.find((e) => e?.key === n), i = e.props;
|
|
1273
|
+
return u(e, {
|
|
1274
|
+
key: n,
|
|
1275
|
+
onChange: (e) => Z(e, n),
|
|
1276
|
+
onClear: i?.clearable ? () => te(n) : void 0,
|
|
1277
|
+
value: r?.value
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
if (e.type === ce) {
|
|
1281
|
+
t++;
|
|
1282
|
+
let n = `form-text-input-${t}`, r = I.find((e) => e?.key === n), i = e.props;
|
|
1283
|
+
return u(e, {
|
|
1284
|
+
key: n,
|
|
1285
|
+
error: r?.error,
|
|
1286
|
+
onClear: i?.clearable ? () => te(n) : void 0,
|
|
1287
|
+
onChange: (e) => Z(e, n),
|
|
1288
|
+
onError: (e) => ne(e, n),
|
|
1289
|
+
value: r?.value
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
return e.props?.children ? u(e, { children: n(e.props.children) }) : e;
|
|
1293
|
+
});
|
|
1294
|
+
return n(e);
|
|
1295
|
+
};
|
|
1296
|
+
return p(() => {
|
|
1297
|
+
let e = I.some((e) => e?.error);
|
|
1298
|
+
E ? E(I, e) : (B(I), R(e));
|
|
1299
|
+
}, [
|
|
1300
|
+
E,
|
|
1301
|
+
B,
|
|
1302
|
+
I,
|
|
1303
|
+
R
|
|
1304
|
+
]), /* @__PURE__ */ a("form", {
|
|
1305
|
+
action: l,
|
|
1306
|
+
"aria-label": n,
|
|
1307
|
+
"aria-labelledby": s,
|
|
1308
|
+
className: ee,
|
|
1309
|
+
encType: y,
|
|
1310
|
+
id: S,
|
|
1311
|
+
method: C,
|
|
1312
|
+
name: w,
|
|
1313
|
+
noValidate: T,
|
|
1314
|
+
onReset: re,
|
|
1315
|
+
onSubmit: ie,
|
|
1316
|
+
ref: k,
|
|
1317
|
+
...P,
|
|
1318
|
+
children: [
|
|
1319
|
+
/* @__PURE__ */ a("div", {
|
|
1320
|
+
className: q,
|
|
1321
|
+
children: [/* @__PURE__ */ a("div", {
|
|
1322
|
+
className: "mg:flex mg:items-center mg:gap-2",
|
|
1323
|
+
children: [j && ue(j, U), M && /* @__PURE__ */ i(z, {
|
|
1324
|
+
color: "white",
|
|
1325
|
+
variant: "h2",
|
|
1326
|
+
children: M
|
|
1327
|
+
})]
|
|
1328
|
+
}), b && ue(b, U)]
|
|
1329
|
+
}),
|
|
1330
|
+
/* @__PURE__ */ i("div", {
|
|
1331
|
+
className: W,
|
|
1332
|
+
children: m && $(m)
|
|
1333
|
+
}),
|
|
1334
|
+
/* @__PURE__ */ a("div", {
|
|
1335
|
+
className: J,
|
|
1336
|
+
children: [H ? /* @__PURE__ */ a("div", {
|
|
1337
|
+
className: Y,
|
|
1338
|
+
children: [/* @__PURE__ */ i(A, {
|
|
1339
|
+
classes: { button: X },
|
|
1340
|
+
type: "submit",
|
|
1341
|
+
variant: "outline",
|
|
1342
|
+
children: "SUBMIT"
|
|
1343
|
+
}), /* @__PURE__ */ i(A, {
|
|
1344
|
+
classes: { button: X },
|
|
1345
|
+
type: "reset",
|
|
1346
|
+
variant: "outline",
|
|
1347
|
+
children: "RESET"
|
|
1348
|
+
})]
|
|
1349
|
+
}) : /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(A, {
|
|
1350
|
+
classes: { button: X },
|
|
1351
|
+
type: "submit",
|
|
1352
|
+
variant: "outline",
|
|
1353
|
+
children: "SUBMIT"
|
|
1354
|
+
}), /* @__PURE__ */ i(A, {
|
|
1355
|
+
classes: { button: X },
|
|
1356
|
+
type: "reset",
|
|
1357
|
+
variant: "outline",
|
|
1358
|
+
children: "RESET"
|
|
1359
|
+
})] }), v && /* @__PURE__ */ a("div", {
|
|
1360
|
+
className: K,
|
|
1361
|
+
children: [v?.adornment && ue(v?.adornment, G), /* @__PURE__ */ i(z, {
|
|
1362
|
+
clamp: 10,
|
|
1363
|
+
className: h?.disclaimer?.text,
|
|
1364
|
+
color: _,
|
|
1365
|
+
removePadding: !0,
|
|
1366
|
+
variant: "base",
|
|
1367
|
+
children: v?.text
|
|
1368
|
+
})]
|
|
1369
|
+
})]
|
|
1370
|
+
})
|
|
1371
|
+
]
|
|
1372
|
+
});
|
|
1373
|
+
};
|
|
1374
|
+
de.displayName = "Form";
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/list/ListItem.tsx
|
|
1377
|
+
var fe = (e, t) => {
|
|
1378
|
+
let r = o("mg:object-contain mg:animate-fade-in mg:duration-500", t);
|
|
1379
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
1380
|
+
icon: e,
|
|
1381
|
+
className: t
|
|
1382
|
+
}) : /* @__PURE__ */ i("img", {
|
|
1383
|
+
src: e?.src || "",
|
|
1384
|
+
alt: e?.alt || "",
|
|
1385
|
+
width: 40,
|
|
1386
|
+
height: 40,
|
|
1387
|
+
className: r
|
|
1388
|
+
});
|
|
1389
|
+
};
|
|
1390
|
+
function pe({ as: e = "li", adornment: n, adornmentColor: r = "primary", disabled: s = !1, defaultSelected: c, divider: l = !1, classes: u = {}, color: d = "primary", firstIndex: f = !1, href: p, label: m, lastIndex: h = !1, onClick: g, ref: _, selectable: v = !0, selected: y, status: b, tabIndex: x = 0, target: S, title: C, ...w }) {
|
|
1391
|
+
let [T, E] = Q({
|
|
1392
|
+
defaultValue: c && v,
|
|
1393
|
+
value: y
|
|
1394
|
+
}), D = t("mg:text-base mg:p-1 mg:group-hover:text-accent", {
|
|
1395
|
+
"mg:text-accent": r === "accent" && !b,
|
|
1396
|
+
"mg:text-black": r === "black" && !b,
|
|
1397
|
+
"mg:text-inverse": r === "inverse" && !b,
|
|
1398
|
+
"mg:text-primary": r === "primary" && !b,
|
|
1399
|
+
"mg:text-secondary": r === "secondary" && !b,
|
|
1400
|
+
"mg:text-subtle": r === "subtle" && !b,
|
|
1401
|
+
"mg:text-white": r === "white" && !b,
|
|
1402
|
+
"mg:text-success": b === "success" || r === "success",
|
|
1403
|
+
"mg:text-danger": b === "error" || r === "danger",
|
|
1404
|
+
"mg:text-info": b === "info" || r === "info",
|
|
1405
|
+
"mg:text-warning": b === "warning" || r === "warning"
|
|
1406
|
+
}, u?.adornment), O = o(t("mg:flex mg:flex-col mg:items-center mg:w-full mg:transition-all", "mg:focus-visible:outline-1 mg:focus-visible:outline-offset-4 mg:focus-visible:outline-primary", {
|
|
1407
|
+
"mg:group mg:hover:cursor-pointer mg:duration-200": v,
|
|
1408
|
+
"mg:rounded-t-lg": f,
|
|
1409
|
+
"mg:bg-black/50": T,
|
|
1410
|
+
"mg:opacity-80": s,
|
|
1411
|
+
"mg:rounded-b-lg": h,
|
|
1412
|
+
"mg:hover:scale-105 mg:hover:px-2 mg:duration-500": !v
|
|
1413
|
+
}), u?.root), k = o(t("mg:flex mg:items-center mg:w-full"), u?.container), A = o(t("mg:flex mg:flex-col mg:grow mg:gap-2 mg:py-2 mg:pr-2"), u?.children), j = o(t("mg:group-hover:text-accent"), u?.label), M = o(t("mg:group-hover:text-accent"), u?.title), N = (e) => {
|
|
1414
|
+
g ? g(e) : E(!0);
|
|
1415
|
+
};
|
|
1416
|
+
return e === "a" || p ? /* @__PURE__ */ i("a", {
|
|
1417
|
+
className: O,
|
|
1418
|
+
href: p,
|
|
1419
|
+
onClick: N,
|
|
1420
|
+
ref: _,
|
|
1421
|
+
tabIndex: v ? x : -1,
|
|
1422
|
+
target: S,
|
|
1423
|
+
...w,
|
|
1424
|
+
children: /* @__PURE__ */ a("div", {
|
|
1425
|
+
className: k,
|
|
1426
|
+
children: [n && fe(n, D), /* @__PURE__ */ a("div", {
|
|
1427
|
+
className: A,
|
|
1428
|
+
children: [C && /* @__PURE__ */ i(z, {
|
|
1429
|
+
className: M,
|
|
1430
|
+
color: d,
|
|
1431
|
+
removePadding: !0,
|
|
1432
|
+
children: C
|
|
1433
|
+
}), m && /* @__PURE__ */ i(z, {
|
|
1434
|
+
className: j,
|
|
1435
|
+
color: d,
|
|
1436
|
+
removePadding: !0,
|
|
1437
|
+
children: m
|
|
1438
|
+
})]
|
|
1439
|
+
})]
|
|
1440
|
+
})
|
|
1441
|
+
}) : e === "div" ? /* @__PURE__ */ i("div", {
|
|
1442
|
+
className: O,
|
|
1443
|
+
tabIndex: v ? x : -1,
|
|
1444
|
+
onClick: N,
|
|
1445
|
+
ref: _,
|
|
1446
|
+
...w,
|
|
1447
|
+
children: /* @__PURE__ */ a("div", {
|
|
1448
|
+
className: k,
|
|
1449
|
+
children: [n && fe(n, D), /* @__PURE__ */ a("div", {
|
|
1450
|
+
className: A,
|
|
1451
|
+
children: [C && /* @__PURE__ */ i(z, {
|
|
1452
|
+
className: M,
|
|
1453
|
+
color: d,
|
|
1454
|
+
removePadding: !0,
|
|
1455
|
+
children: C
|
|
1456
|
+
}), m && /* @__PURE__ */ i(z, {
|
|
1457
|
+
className: j,
|
|
1458
|
+
color: d,
|
|
1459
|
+
removePadding: !0,
|
|
1460
|
+
children: m
|
|
1461
|
+
})]
|
|
1462
|
+
})]
|
|
1463
|
+
})
|
|
1464
|
+
}) : /* @__PURE__ */ a("li", {
|
|
1465
|
+
className: O,
|
|
1466
|
+
onClick: N,
|
|
1467
|
+
ref: _,
|
|
1468
|
+
tabIndex: v ? x : -1,
|
|
1469
|
+
...w,
|
|
1470
|
+
children: [/* @__PURE__ */ a("div", {
|
|
1471
|
+
className: k,
|
|
1472
|
+
children: [n && fe(n, D), /* @__PURE__ */ a("div", {
|
|
1473
|
+
className: A,
|
|
1474
|
+
children: [C && /* @__PURE__ */ i(z, {
|
|
1475
|
+
className: M,
|
|
1476
|
+
color: d,
|
|
1477
|
+
removePadding: !0,
|
|
1478
|
+
children: C
|
|
1479
|
+
}), m && /* @__PURE__ */ i(z, {
|
|
1480
|
+
className: j,
|
|
1481
|
+
color: d,
|
|
1482
|
+
removePadding: !0,
|
|
1483
|
+
children: m
|
|
1484
|
+
})]
|
|
1485
|
+
})]
|
|
1486
|
+
}), l && !h && /* @__PURE__ */ i("div", { className: "mg:w-9/10 mg:h-0 mg:border-solid mg:border-b-1 mg:border-b-primary" })]
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
pe.displayName = "List.ListItem";
|
|
1490
|
+
//#endregion
|
|
1491
|
+
//#region src/list/List.tsx
|
|
1492
|
+
function me({ as: e = "ul", adornmentColor: n, background: r = "primary", children: a, className: s, color: l, divider: f = !1, disabled: h = !1, fullWidth: _ = !1, itemsAs: v, onChange: y, ref: b, selectable: x = !0, size: S = "md", status: C, value: w, ...T }) {
|
|
1493
|
+
let E = x ? ((e) => {
|
|
1494
|
+
let t = 0, n = [], r = (e) => {
|
|
1495
|
+
c.forEach(e, (e) => {
|
|
1496
|
+
if (d(e)) {
|
|
1497
|
+
if (d(e) && e.type === pe) {
|
|
1498
|
+
t++;
|
|
1499
|
+
let r = `list-item-${t}`, i = e.props;
|
|
1500
|
+
n.push({
|
|
1501
|
+
key: r,
|
|
1502
|
+
label: i?.label || "",
|
|
1503
|
+
selected: (i?.selected || i?.defaultSelected || !1) && x,
|
|
1504
|
+
value: i?.value
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1507
|
+
d(e) && e.props?.children && r(e.props.children);
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
};
|
|
1511
|
+
return r(e), n;
|
|
1512
|
+
})(a) : [], D = E.filter((e) => e?.selected).map((e) => ({
|
|
1513
|
+
key: e?.key,
|
|
1514
|
+
label: e?.label,
|
|
1515
|
+
value: e?.value
|
|
1516
|
+
})), [O, k] = g(E), [, A] = Q({
|
|
1517
|
+
defaultValue: D,
|
|
1518
|
+
value: w
|
|
1519
|
+
}), j = m(() => O.filter((e) => e.selected).map((e) => ({
|
|
1520
|
+
key: e?.key,
|
|
1521
|
+
label: e?.label,
|
|
1522
|
+
value: e?.value
|
|
1523
|
+
})), [O]), M = o(t("mg:flex mg:flex-col mg:rounded-lg", {
|
|
1524
|
+
"mg:bg-inverse": r === "inverse",
|
|
1525
|
+
"mg:bg-primary": r === "primary",
|
|
1526
|
+
"mg:bg-secondary": r === "secondary",
|
|
1527
|
+
"mg:bg-subtle": r === "subtle",
|
|
1528
|
+
"mg:w-full": _,
|
|
1529
|
+
"mg:w-24": S === "sm" && !_,
|
|
1530
|
+
"mg:w-32": S === "md" && !_,
|
|
1531
|
+
"mg:w-40": S === "lg" && !_
|
|
1532
|
+
}), s), N = (e) => {
|
|
1533
|
+
x && k(O.map((t) => t.key === e ? {
|
|
1534
|
+
...t,
|
|
1535
|
+
selected: !t.selected
|
|
1536
|
+
} : t));
|
|
1537
|
+
}, P = (e) => {
|
|
1538
|
+
let t = 0, r = [], i = (e) => {
|
|
1539
|
+
c.toArray(e).forEach((e) => {
|
|
1540
|
+
if (d(e)) {
|
|
1541
|
+
if (d(e) && e.type === pe) {
|
|
1542
|
+
t++;
|
|
1543
|
+
let i = `list-item-${t}`;
|
|
1544
|
+
r.push(u(e, {
|
|
1545
|
+
key: i,
|
|
1546
|
+
as: v,
|
|
1547
|
+
adornmentColor: n,
|
|
1548
|
+
color: l,
|
|
1549
|
+
divider: f,
|
|
1550
|
+
disabled: h,
|
|
1551
|
+
onClick: () => N(i),
|
|
1552
|
+
selected: O.find((e) => e.key === i)?.selected,
|
|
1553
|
+
selectable: x,
|
|
1554
|
+
status: C
|
|
1555
|
+
}));
|
|
1556
|
+
}
|
|
1557
|
+
d(e) && e.props?.children && i(e.props?.children);
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
};
|
|
1561
|
+
return i(e), r.map((e, t) => u(e, {
|
|
1562
|
+
firstIndex: t === 0,
|
|
1563
|
+
lastIndex: r.length - 1 === t
|
|
1564
|
+
}));
|
|
1565
|
+
};
|
|
1566
|
+
return p(() => {
|
|
1567
|
+
x && (y ? y(j) : A(j));
|
|
1568
|
+
}, [
|
|
1569
|
+
O,
|
|
1570
|
+
A,
|
|
1571
|
+
y,
|
|
1572
|
+
j,
|
|
1573
|
+
x
|
|
1574
|
+
]), i(e === "div" ? "div" : e === "ol" ? "ol" : "ul", {
|
|
1575
|
+
className: M,
|
|
1576
|
+
ref: b,
|
|
1577
|
+
...T,
|
|
1578
|
+
children: a && P(a)
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
me.displayName = "List";
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region src/progress-stepper/Connector.tsx
|
|
1584
|
+
var he = ({ active: e = !1, classes: n = {}, completed: r = !1, lastIndex: a = !1, orientation: s = "horizontal", ref: c, ...l }) => {
|
|
1585
|
+
let u = o("mg:relative mg:flex mg:h-full mg:grow", n?.container), d = o(t("mg:relative mg:transform mg:translate-y-7", {
|
|
1586
|
+
"mg:h-2px mg:w-full": s === "horizontal",
|
|
1587
|
+
"mg:w-2px mg:h-full": s === "vertical",
|
|
1588
|
+
"mg:bg-accent": !e && !r,
|
|
1589
|
+
"mg:bg-primary": e,
|
|
1590
|
+
"mg:bg-success-primary": r
|
|
1591
|
+
}), n?.content);
|
|
1592
|
+
return a ? null : /* @__PURE__ */ i("div", {
|
|
1593
|
+
className: u,
|
|
1594
|
+
ref: c,
|
|
1595
|
+
...l,
|
|
1596
|
+
children: /* @__PURE__ */ i("div", { className: d })
|
|
1597
|
+
});
|
|
1598
|
+
}, ge = (e, t) => {
|
|
1599
|
+
let r = o("mg:text-sm", t), a = o("mg:object-contain mg:animate-fade-in mg:duration-500", t);
|
|
1600
|
+
return "iconName" in e ? /* @__PURE__ */ i(n, {
|
|
1601
|
+
className: r,
|
|
1602
|
+
icon: e
|
|
1603
|
+
}) : /* @__PURE__ */ i("img", {
|
|
1604
|
+
alt: e.alt || "",
|
|
1605
|
+
className: a,
|
|
1606
|
+
height: 16,
|
|
1607
|
+
src: e.src || "",
|
|
1608
|
+
width: 16
|
|
1609
|
+
});
|
|
1610
|
+
}, _e = ({ children: e, classes: n = {}, color: r = "primary", endAdornment: i, size: s = "md", startAdornment: c, variant: l = "circular", ref: u, ...d }) => {
|
|
1611
|
+
let f = l === "circular" ? t("mg:rounded-full", {
|
|
1612
|
+
"mg:h-4 mg:w-4": s === "sm",
|
|
1613
|
+
"mg:h-6 mg:w-6": s === "md",
|
|
1614
|
+
"mg:h-8 mg:w-8": s === "lg"
|
|
1615
|
+
}) : "", p = l === "extended" ? t("mg:rounded-lg", {
|
|
1616
|
+
"mg:w-4 mg:h-2": s === "sm",
|
|
1617
|
+
"mg:w-5 mg:h-3": s === "md",
|
|
1618
|
+
"mg:w-6 mg:h-4": s === "lg"
|
|
1619
|
+
}) : "";
|
|
1620
|
+
return /* @__PURE__ */ a("div", {
|
|
1621
|
+
className: o(t("mg:inline-flex mg:items-center mg:justify-center mg:border-solid mg:border-1 mg:text-primary", {
|
|
1622
|
+
"mg:border-primary mg:hover:border-primary-hover mg:text-primary mg:hover:text-primary-hover": r === "primary",
|
|
1623
|
+
"mg:border-secondary mg:hover:border-secondary-hover mg:text-secondary mg:hover:text-secondary-hover": r === "secondary",
|
|
1624
|
+
"mg:border-accent mg:hover:border-accent-hover mg:text-accent mg:hover:text-accent-hover": r === "accent",
|
|
1625
|
+
"mg:border-error mg:hover:border-error-hover mg:text-danger mg:hover:text-danger-hover": r === "error",
|
|
1626
|
+
"mg:border-info mg:hover:border-info-hover mg:text-info mg:hover:text-info-hover": r === "info",
|
|
1627
|
+
"mg:border-success mg:hover:border-success-hover mg:text-success mg:hover:text-success-hover": r === "success",
|
|
1628
|
+
"mg:border-warning mg:hover:border-warning-hover mg:text-warning mg:hover:text-warning-hover": r === "warning"
|
|
1629
|
+
}, f, p), n?.container),
|
|
1630
|
+
ref: u,
|
|
1631
|
+
...d,
|
|
1632
|
+
children: [
|
|
1633
|
+
c && ge(c, n?.adornment),
|
|
1634
|
+
e,
|
|
1635
|
+
i && ge(i, n?.adornment)
|
|
1636
|
+
]
|
|
1637
|
+
});
|
|
1638
|
+
};
|
|
1639
|
+
_e.displayName = "ProgressStepper.Node";
|
|
1640
|
+
//#endregion
|
|
1641
|
+
//#region src/progress-stepper/Step.tsx
|
|
1642
|
+
var ve = (e) => ((e) => c.map(e, (e) => d(e) && e.type === z ? u(e, { className: "mg:text-xs mg:sm:text-sm mg:lg:text-lg" }) : e))(e), ye = ({ active: e = !1, classes: r = {}, color: s = "primary", completed: c = !1, description: l, icon: u, index: d, label: f, linear: p = !0, onClick: m, orientation: h = "horizontal", ref: g, title: _, ...v }) => {
|
|
1643
|
+
let y = o("mg:animate-fade-in mg:transition-opacity mg:duration-300", r?.body), b = o("mg:flex mg:flex-col mg:text-primary mg:gap-1", r?.descriptionContainer), x = o(t("mg:flex mg:max-w-44 mg:p-3 mg:rounded-md", {
|
|
1644
|
+
"mg:flex-col mg:gap-1": h === "horizontal",
|
|
1645
|
+
"mg:justify-between mg:items-start": h === "vertical",
|
|
1646
|
+
"mg:relative mg:z-10 mg:min-w-32 mg:hover:bg-primary mg:transition-all mg:duration-200 mg:ease-in-out mg:hover:scale-105 mg:hover:shadow-lg": e
|
|
1647
|
+
}), r?.root), S = t("mg:text-base mg:sm:text-xl mg:lg:text-3xl", r?.title), C = o("mg:flex mg:pb-2", r?.nodeContainer), w = d === void 0 ? "–" : (d + 1).toString();
|
|
1648
|
+
return p ? /* @__PURE__ */ a("div", {
|
|
1649
|
+
className: x,
|
|
1650
|
+
ref: g,
|
|
1651
|
+
...v,
|
|
1652
|
+
children: [/* @__PURE__ */ i("div", {
|
|
1653
|
+
className: C,
|
|
1654
|
+
children: /* @__PURE__ */ i(_e, {
|
|
1655
|
+
"aria-label": f,
|
|
1656
|
+
classes: r?.node,
|
|
1657
|
+
color: c ? "success" : s,
|
|
1658
|
+
variant: "circular",
|
|
1659
|
+
children: u ? /* @__PURE__ */ i(n, { icon: u }) : w
|
|
1660
|
+
})
|
|
1661
|
+
}), e && /* @__PURE__ */ a("div", {
|
|
1662
|
+
className: y,
|
|
1663
|
+
children: [/* @__PURE__ */ i(z, {
|
|
1664
|
+
removePadding: !0,
|
|
1665
|
+
className: S,
|
|
1666
|
+
bold: !0,
|
|
1667
|
+
color: "primary",
|
|
1668
|
+
variant: "h3",
|
|
1669
|
+
children: _
|
|
1670
|
+
}), /* @__PURE__ */ i("div", {
|
|
1671
|
+
className: b,
|
|
1672
|
+
children: l && ve(l)
|
|
1673
|
+
})]
|
|
1674
|
+
})]
|
|
1675
|
+
}) : /* @__PURE__ */ a("div", {
|
|
1676
|
+
className: x,
|
|
1677
|
+
ref: g,
|
|
1678
|
+
...v,
|
|
1679
|
+
children: [/* @__PURE__ */ i("div", {
|
|
1680
|
+
className: C,
|
|
1681
|
+
children: /* @__PURE__ */ i(P, {
|
|
1682
|
+
"aria-label": f,
|
|
1683
|
+
classes: r?.node,
|
|
1684
|
+
color: c ? "success" : s,
|
|
1685
|
+
onClick: m,
|
|
1686
|
+
variant: "circular",
|
|
1687
|
+
children: u ? /* @__PURE__ */ i(n, { icon: u }) : w
|
|
1688
|
+
})
|
|
1689
|
+
}), e && /* @__PURE__ */ a("div", {
|
|
1690
|
+
className: y,
|
|
1691
|
+
children: [/* @__PURE__ */ i(z, {
|
|
1692
|
+
removePadding: !0,
|
|
1693
|
+
className: S,
|
|
1694
|
+
bold: !0,
|
|
1695
|
+
color: "primary",
|
|
1696
|
+
variant: "h3",
|
|
1697
|
+
children: _
|
|
1698
|
+
}), /* @__PURE__ */ i("div", {
|
|
1699
|
+
className: b,
|
|
1700
|
+
children: l && ve(l)
|
|
1701
|
+
})]
|
|
1702
|
+
})]
|
|
1703
|
+
});
|
|
1704
|
+
};
|
|
1705
|
+
ye.displayName = "ProgressStepper.Step";
|
|
1706
|
+
//#endregion
|
|
1707
|
+
//#region src/utils/capitalize.ts
|
|
1708
|
+
function be(e) {
|
|
1709
|
+
return e ? e.charAt(0).toUpperCase() + e.slice(1) : "";
|
|
1710
|
+
}
|
|
1711
|
+
//#endregion
|
|
1712
|
+
//#region src/progress-stepper/ProgressStepper.tsx
|
|
1713
|
+
function xe(e, t) {
|
|
1714
|
+
if (Array.isArray(e)) return c.toArray(e).map((e, n) => {
|
|
1715
|
+
if (d(e) && e.type === ye) {
|
|
1716
|
+
let r = e.props;
|
|
1717
|
+
return {
|
|
1718
|
+
key: `step-${n}`,
|
|
1719
|
+
active: n === t ? !0 : r?.active || !1,
|
|
1720
|
+
completed: r?.completed || !1,
|
|
1721
|
+
label: r?.label
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
return null;
|
|
1725
|
+
}).filter((e) => e !== null);
|
|
1726
|
+
if (d(e) && e.type === ye) {
|
|
1727
|
+
let t = e.props;
|
|
1728
|
+
return [{
|
|
1729
|
+
key: "step-0",
|
|
1730
|
+
active: t.active || !1,
|
|
1731
|
+
completed: t.completed || !1,
|
|
1732
|
+
label: t?.label
|
|
1733
|
+
}];
|
|
1734
|
+
}
|
|
1735
|
+
return [];
|
|
1736
|
+
}
|
|
1737
|
+
var Se = ({ activeStep: n, children: s, classes: f = {}, completed: m, defaultStep: h = 0, forceHorizontal: _ = !1, hideControls: v = !1, linear: y = !0, onComplete: b, onInit: x, onStepClick: S, orientation: C = "horizontal", ref: w, ...T }) => {
|
|
1738
|
+
let E = c.toArray(s).filter((e) => d(e) && e.type === ye).length, [D, O] = g(() => xe(s, h)), [k, j] = g(E);
|
|
1739
|
+
p(() => {
|
|
1740
|
+
if (x) {
|
|
1741
|
+
let e = D.find((e) => e.active) ?? D[h];
|
|
1742
|
+
e && x(e);
|
|
1743
|
+
}
|
|
1744
|
+
}), k !== E && (j(E), O(xe(s, h)));
|
|
1745
|
+
let [M, N] = Q({
|
|
1746
|
+
defaultValue: {
|
|
1747
|
+
key: `step-${h}`,
|
|
1748
|
+
active: !0,
|
|
1749
|
+
completed: !1,
|
|
1750
|
+
label: ""
|
|
1751
|
+
},
|
|
1752
|
+
value: n
|
|
1753
|
+
}), [P, F] = Q({
|
|
1754
|
+
defaultValue: !1,
|
|
1755
|
+
value: m
|
|
1756
|
+
}), { isBelow: I } = e(), L = I("sm"), R = o("mg:flex mg:gap-1 mg:items-center", f?.buttonsContainer), B = o("mg:w-full mg:flex mg:items-center mg:justify-between mg:pb-5 mg:sm:pb-6 mg:px-6", f?.controls), V = o("mg:flex mg:flex-col mg:w-full", f?.outer), H = o(t("mg:w-full mg:h-full mg:flex mg:px-6 mg:pb-2 mg:pt-0 mg:sm:pt-6 mg:overflow-x-scroll mg:scrollbar-subtle", {
|
|
1757
|
+
"mg:flex-col": C === "vertical" || L && !_,
|
|
1758
|
+
"mg:justify-between": C === "horizontal" && !L
|
|
1759
|
+
}), f?.root), U = (e, t) => {
|
|
1760
|
+
let n = D.map((e) => e.key === `step-${t}` ? e.completed ? {
|
|
1761
|
+
...e,
|
|
1762
|
+
active: !0,
|
|
1763
|
+
completed: !1
|
|
1764
|
+
} : e.active ? {
|
|
1765
|
+
...e,
|
|
1766
|
+
active: !1,
|
|
1767
|
+
completed: !0
|
|
1768
|
+
} : {
|
|
1769
|
+
...e,
|
|
1770
|
+
active: !0,
|
|
1771
|
+
completed: !1
|
|
1772
|
+
} : {
|
|
1773
|
+
...e,
|
|
1774
|
+
active: !1
|
|
1775
|
+
});
|
|
1776
|
+
n.every((e) => e?.completed) && (b ? b(!0) : F(!0)), O(n), S ? S(e, n[t]) : N(n[t]);
|
|
1777
|
+
}, W = (e) => {
|
|
1778
|
+
let t = D.findIndex((e) => e?.active), n = D[t]?.completed, r = D.map((e, r) => r === t && !n ? {
|
|
1779
|
+
...e,
|
|
1780
|
+
completed: !0
|
|
1781
|
+
} : r === t && n ? {
|
|
1782
|
+
...e,
|
|
1783
|
+
completed: !1
|
|
1784
|
+
} : e);
|
|
1785
|
+
O(r), S ? S(e, r[t]) : N(r[t]);
|
|
1786
|
+
}, G = (e) => {
|
|
1787
|
+
let t = D.findIndex((e) => e?.active), n = D.map((e, n) => t + 1 < D.length && n === t + 1 || t + 1 > D.length - 1 && n === 0 ? {
|
|
1788
|
+
...e,
|
|
1789
|
+
active: !0
|
|
1790
|
+
} : {
|
|
1791
|
+
...e,
|
|
1792
|
+
active: !1
|
|
1793
|
+
});
|
|
1794
|
+
O(n), S ? S(e, n[t + 1] || n[0]) : N(n[t + 1] || n[0]);
|
|
1795
|
+
}, K = (e) => {
|
|
1796
|
+
b ? b(!1) : F(!1), O(D.map((e, t) => t === h ? {
|
|
1797
|
+
...e,
|
|
1798
|
+
active: !0,
|
|
1799
|
+
completed: !1
|
|
1800
|
+
} : {
|
|
1801
|
+
...e,
|
|
1802
|
+
active: !1,
|
|
1803
|
+
completed: !1
|
|
1804
|
+
})), !x && S ? S(e, {
|
|
1805
|
+
key: `step-${h}`,
|
|
1806
|
+
active: !0,
|
|
1807
|
+
completed: !1,
|
|
1808
|
+
label: ""
|
|
1809
|
+
}) : !x && !S && N({
|
|
1810
|
+
key: `step-${h}`,
|
|
1811
|
+
active: !0,
|
|
1812
|
+
completed: !1,
|
|
1813
|
+
label: ""
|
|
1814
|
+
});
|
|
1815
|
+
}, q = ((e) => Array.isArray(e) ? c.toArray(e).map((t, n) => {
|
|
1816
|
+
if (d(t) && t.type === ye) {
|
|
1817
|
+
let r = n === c.count(e) - 1;
|
|
1818
|
+
return {
|
|
1819
|
+
node: u(t, {
|
|
1820
|
+
index: n,
|
|
1821
|
+
classes: f?.step,
|
|
1822
|
+
id: n === h ? `step-${n}` : void 0,
|
|
1823
|
+
active: D[n]?.active,
|
|
1824
|
+
completed: D[n]?.completed,
|
|
1825
|
+
linear: y,
|
|
1826
|
+
onClick: y ? void 0 : (e) => U(e, n)
|
|
1827
|
+
}),
|
|
1828
|
+
connector: /* @__PURE__ */ i(he, {
|
|
1829
|
+
classes: f?.connector,
|
|
1830
|
+
lastIndex: r
|
|
1831
|
+
})
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
return null;
|
|
1835
|
+
}).filter((e) => e !== null) : [])(s), J = M?.label || be(M?.key || ""), Y = M?.completed;
|
|
1836
|
+
return p(() => {
|
|
1837
|
+
y && (D.every((e) => e?.completed) ? (F(!0), b && b(!0)) : (F(!1), b && b(!1)));
|
|
1838
|
+
}, [
|
|
1839
|
+
D,
|
|
1840
|
+
F,
|
|
1841
|
+
y,
|
|
1842
|
+
b
|
|
1843
|
+
]), /* @__PURE__ */ a("div", {
|
|
1844
|
+
className: V,
|
|
1845
|
+
children: [/* @__PURE__ */ i("div", {
|
|
1846
|
+
className: H,
|
|
1847
|
+
ref: w,
|
|
1848
|
+
role: "list",
|
|
1849
|
+
...T,
|
|
1850
|
+
children: q.map(({ node: e, connector: t }, n) => /* @__PURE__ */ a(l, { children: [e, C === "horizontal" && !L && t] }, `progress-stepper-node-${n}`))
|
|
1851
|
+
}), (!v || y || P) && /* @__PURE__ */ a("div", {
|
|
1852
|
+
className: B,
|
|
1853
|
+
children: [/* @__PURE__ */ i(z, {
|
|
1854
|
+
className: f?.label,
|
|
1855
|
+
color: "primary",
|
|
1856
|
+
variant: "base",
|
|
1857
|
+
children: P ? "Completed" : J
|
|
1858
|
+
}), /* @__PURE__ */ a("div", {
|
|
1859
|
+
className: R,
|
|
1860
|
+
children: [
|
|
1861
|
+
P && !y && /* @__PURE__ */ i(A, {
|
|
1862
|
+
classes: f?.button,
|
|
1863
|
+
onClick: K,
|
|
1864
|
+
variant: "outline",
|
|
1865
|
+
children: "RESET"
|
|
1866
|
+
}),
|
|
1867
|
+
!P && y && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(A, {
|
|
1868
|
+
classes: f?.button,
|
|
1869
|
+
onClick: G,
|
|
1870
|
+
variant: "outline",
|
|
1871
|
+
children: "NEXT"
|
|
1872
|
+
}), /* @__PURE__ */ i(A, {
|
|
1873
|
+
classes: f?.button,
|
|
1874
|
+
onClick: W,
|
|
1875
|
+
variant: "outline",
|
|
1876
|
+
children: Y ? "UNDO" : "COMPLETE"
|
|
1877
|
+
})] }),
|
|
1878
|
+
P && y && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i(A, {
|
|
1879
|
+
classes: f?.button,
|
|
1880
|
+
onClick: W,
|
|
1881
|
+
variant: "outline",
|
|
1882
|
+
children: "UNDO"
|
|
1883
|
+
}), /* @__PURE__ */ i(A, {
|
|
1884
|
+
classes: f?.button,
|
|
1885
|
+
onClick: K,
|
|
1886
|
+
variant: "outline",
|
|
1887
|
+
children: "FINISH"
|
|
1888
|
+
})] })
|
|
1889
|
+
]
|
|
1890
|
+
})]
|
|
1891
|
+
})]
|
|
1892
|
+
});
|
|
1893
|
+
};
|
|
1894
|
+
Se.displayName = "ProgressStepper";
|
|
1895
|
+
//#endregion
|
|
1896
|
+
//#region src/select/Select.tsx
|
|
1897
|
+
var Ce = ({ classes: e = {}, defaultValue: r, disabled: s = !1, label: c, name: l, onChange: u, options: d = [], placeholder: m, ref: _, tabIndex: y = 0, value: b, variant: x = "outline", ...S }) => {
|
|
1898
|
+
let [C, w] = g(!1), T = h(null), [E, D] = Q({
|
|
1899
|
+
defaultValue: r ? {
|
|
1900
|
+
value: r,
|
|
1901
|
+
label: be(r)
|
|
1902
|
+
} : void 0,
|
|
1903
|
+
value: b ? {
|
|
1904
|
+
value: b,
|
|
1905
|
+
label: be(b)
|
|
1906
|
+
} : void 0
|
|
1907
|
+
}), O = o(t("mg:relative mg:flex mg:justify-start mg:items-center mg:gap-1 mg:rounded-sm mg:w-full mg:h-full", {
|
|
1908
|
+
"mg:border-1 mg:border-solid mg:border-primary mg:hover:border-hover": x === "outline",
|
|
1909
|
+
"mg:bg-primary": x === "filled",
|
|
1910
|
+
"mg:cursor-not-allowed mg:opacity-50": s,
|
|
1911
|
+
"mg:hover:cursor-pointer": !s
|
|
1912
|
+
}), e?.container), k = o("mg:text-xs mg:sm:text-sm mg:lg:text-lg", e?.label), A = o("mg:relative mg:flex mg:justify-start mg:items-center mg:gap-1 mg:p-1 mg:text-xs mg:w-full", e?.placeholder), j = o(t("mg:absolute mg:top-full mg:left-0 mg:mt-1 mg:flex mg:flex-col mg:justify-start mg:items-center mg:w-full", { "mg:border-solid mg:border-1 mg:border-primary mg:rounded-sm mg:bg-secondary": x === "outline" }), e?.optionsContainer), M = o(t("mg:flex mg:justify-between mg:items-center mg:px-1.5 mg:py-1 mg:w-full mg:text-xs", { "mg:hover:text-accent": x === "outline" }), e?.option?.root), N = o("mg:text-sm mg:sm:text-sm mg:lg:text-lg", e?.option?.icon), P = o("mg:inline-flex mg:flex-col mg:items-start mg:justify-center mg:gap-0.5 mg:min-w-12 mg:min-h-2 mg:h-full mg:font-body mg:text-inverse", e?.root), F = o(t("mg:text-sm mg:transition-transform mg:duration-200", { "mg:rotate-180": C }), e?.icon), I = o("mg:relative mg:flex mg:justify-center mg:items-center mg:p-0.5", e?.iconContainer), L = f((e) => {
|
|
1913
|
+
T.current?.contains(e.target) || w(!1);
|
|
1914
|
+
}, []), R = (e) => {
|
|
1915
|
+
if (w(!1), u) u(e);
|
|
1916
|
+
else {
|
|
1917
|
+
let t = e.currentTarget.getAttribute("data-value");
|
|
1918
|
+
D({
|
|
1919
|
+
value: t ?? "",
|
|
1920
|
+
label: be(t ?? "")
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
}, z = () => {
|
|
1924
|
+
s || w(!C);
|
|
1925
|
+
};
|
|
1926
|
+
return p(() => {
|
|
1927
|
+
if (C) return document.addEventListener("mousedown", L), () => document.removeEventListener("mousedown", L);
|
|
1928
|
+
}, [C, L]), /* @__PURE__ */ a("div", {
|
|
1929
|
+
className: P,
|
|
1930
|
+
ref: _,
|
|
1931
|
+
...S,
|
|
1932
|
+
children: [
|
|
1933
|
+
c && /* @__PURE__ */ i("label", {
|
|
1934
|
+
className: k,
|
|
1935
|
+
children: c
|
|
1936
|
+
}),
|
|
1937
|
+
/* @__PURE__ */ a("div", {
|
|
1938
|
+
"aria-disabled": s,
|
|
1939
|
+
className: O,
|
|
1940
|
+
onClick: z,
|
|
1941
|
+
ref: T,
|
|
1942
|
+
tabIndex: s ? -1 : y,
|
|
1943
|
+
children: [
|
|
1944
|
+
/* @__PURE__ */ i("div", {
|
|
1945
|
+
className: A,
|
|
1946
|
+
children: E?.label || m || "Select an option"
|
|
1947
|
+
}),
|
|
1948
|
+
/* @__PURE__ */ i("div", {
|
|
1949
|
+
className: I,
|
|
1950
|
+
children: /* @__PURE__ */ i(n, {
|
|
1951
|
+
className: F,
|
|
1952
|
+
icon: v
|
|
1953
|
+
})
|
|
1954
|
+
}),
|
|
1955
|
+
C && d.length > 0 && /* @__PURE__ */ i("ul", {
|
|
1956
|
+
className: j,
|
|
1957
|
+
children: d.map((e, t) => /* @__PURE__ */ a("li", {
|
|
1958
|
+
className: M,
|
|
1959
|
+
"data-value": e.value,
|
|
1960
|
+
onClick: R,
|
|
1961
|
+
tabIndex: s ? -1 : y + (t + 1),
|
|
1962
|
+
children: [e.icon && /* @__PURE__ */ i(n, {
|
|
1963
|
+
className: N,
|
|
1964
|
+
icon: e.icon
|
|
1965
|
+
}), e.label]
|
|
1966
|
+
}, `select-option-${t}`))
|
|
1967
|
+
})
|
|
1968
|
+
]
|
|
1969
|
+
}),
|
|
1970
|
+
l && /* @__PURE__ */ i("input", {
|
|
1971
|
+
type: "hidden",
|
|
1972
|
+
name: l,
|
|
1973
|
+
value: b ?? r ?? ""
|
|
1974
|
+
})
|
|
1975
|
+
]
|
|
1976
|
+
});
|
|
1977
|
+
};
|
|
1978
|
+
Ce.displayName = "Select";
|
|
1979
|
+
//#endregion
|
|
1980
|
+
export { E as Badge, A as Button, J as Card, q as CardFooter, W as CardHeader, K as CardMedia, ie as Carousel, he as Connector, $ as Drawer, P as Fab, de as Form, te as Hero, M as IconButton, V as Link, me as List, pe as ListItem, Se as ProgressStepper, Ce as Select, ye as Step, oe as TextArea, ce as TextInput, z as Typography };
|