suus-component-library 0.1.7 → 0.1.10
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/components/form/button/Button.d.ts +1 -1
- package/dist/components/form/button/Button.d.ts.map +1 -1
- package/dist/components/form/chip/Chip.d.ts +11 -3
- package/dist/components/form/chip/Chip.d.ts.map +1 -1
- package/dist/components/form/password/Password.d.ts +1 -3
- package/dist/components/form/password/Password.d.ts.map +1 -1
- package/dist/components/form/postal-code/PostalCode.d.ts.map +1 -1
- package/dist/components/form/radiobutton/RadioButton.d.ts.map +1 -1
- package/dist/components/form/switch/Switch.d.ts +0 -16
- package/dist/components/form/switch/Switch.d.ts.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/suus-component-library.css +1 -1
- package/dist/suus-component-library.js +913 -24
- package/dist/suus-component-library.umd.cjs +1 -1
- package/package.json +3 -2
- package/dist/components/form/button/Button.stories.d.ts +0 -33
- package/dist/components/form/button/Button.stories.d.ts.map +0 -1
- package/dist/components/form/checkbox/Checkbox.stories.d.ts +0 -25
- package/dist/components/form/checkbox/Checkbox.stories.d.ts.map +0 -1
- package/dist/components/form/chip/Chip.stories.d.ts +0 -37
- package/dist/components/form/chip/Chip.stories.d.ts.map +0 -1
- package/dist/components/form/date-picker/DatePicker.stories.d.ts +0 -389
- package/dist/components/form/date-picker/DatePicker.stories.d.ts.map +0 -1
- package/dist/components/form/dropdown/Dropdown.stories.d.ts +0 -370
- package/dist/components/form/dropdown/Dropdown.stories.d.ts.map +0 -1
- package/dist/components/form/link/Link.stories.d.ts +0 -56
- package/dist/components/form/link/Link.stories.d.ts.map +0 -1
- package/dist/components/form/password/Password.stories.d.ts +0 -73
- package/dist/components/form/password/Password.stories.d.ts.map +0 -1
- package/dist/components/form/postal-code/PostalCode.stories.d.ts +0 -384
- package/dist/components/form/postal-code/PostalCode.stories.d.ts.map +0 -1
- package/dist/components/form/radiobutton/RadioButton.stories.d.ts +0 -74
- package/dist/components/form/radiobutton/RadioButton.stories.d.ts.map +0 -1
- package/dist/components/form/switch/Switch.stories.d.ts +0 -62
- package/dist/components/form/switch/Switch.stories.d.ts.map +0 -1
- package/dist/components/form/textfield/TextField.stories.d.ts +0 -59
- package/dist/components/form/textfield/TextField.stories.d.ts.map +0 -1
- package/dist/components/form/upload/Upload.stories.d.ts +0 -389
- package/dist/components/form/upload/Upload.stories.d.ts.map +0 -1
|
@@ -1,41 +1,930 @@
|
|
|
1
1
|
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
3
|
+
var c = {
|
|
4
|
+
suusButton: "_suusButton_1ucmz_1",
|
|
5
|
+
icon: "_icon_1ucmz_45",
|
|
6
|
+
label: "_label_1ucmz_62",
|
|
7
|
+
primary: "_primary_1ucmz_69",
|
|
8
|
+
secondary: "_secondary_1ucmz_113",
|
|
9
|
+
loading: "_loading_1ucmz_169",
|
|
10
|
+
loader: "_loader_1ucmz_173",
|
|
11
|
+
"btn-spin": "_btn-spin_1ucmz_1",
|
|
12
|
+
loaderSecondary: "_loaderSecondary_1ucmz_182"
|
|
12
13
|
};
|
|
13
14
|
//#endregion
|
|
14
15
|
//#region src/components/form/button/Button.tsx
|
|
15
|
-
function
|
|
16
|
+
function l({ label: r, onClick: i, type: a = "button", disabled: o = !1, loading: s = !1, variant: l = "primary", colorToken: u = "--color-juice-sugarcane", icon: d, ...f }) {
|
|
16
17
|
return /* @__PURE__ */ t("button", {
|
|
17
|
-
type:
|
|
18
|
-
onClick:
|
|
19
|
-
disabled:
|
|
18
|
+
type: a,
|
|
19
|
+
onClick: i,
|
|
20
|
+
disabled: o || s,
|
|
20
21
|
style: { "--button-background-color": `var(${u})` },
|
|
21
22
|
className: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
c.suusButton,
|
|
24
|
+
c[l],
|
|
25
|
+
s ? c.loading : ""
|
|
25
26
|
].filter(Boolean).join(" "),
|
|
26
|
-
"aria-busy":
|
|
27
|
+
"aria-busy": s,
|
|
27
28
|
...f,
|
|
28
|
-
children:
|
|
29
|
-
className: `${
|
|
29
|
+
children: s ? /* @__PURE__ */ t("span", {
|
|
30
|
+
className: `${c.loader} ${l === "primary" ? "" : c.loaderSecondary}`,
|
|
30
31
|
"aria-hidden": "true"
|
|
31
32
|
}) : /* @__PURE__ */ n(e, { children: [d ? /* @__PURE__ */ t("span", {
|
|
32
|
-
className:
|
|
33
|
+
className: c.icon,
|
|
33
34
|
children: d
|
|
34
35
|
}) : null, /* @__PURE__ */ t("span", {
|
|
35
|
-
className:
|
|
36
|
-
children:
|
|
36
|
+
className: c.label,
|
|
37
|
+
children: r
|
|
37
38
|
})] })
|
|
38
39
|
});
|
|
39
40
|
}
|
|
41
|
+
var u = {
|
|
42
|
+
checkboxWrapper: "_checkboxWrapper_6w8h4_1",
|
|
43
|
+
checkboxInput: "_checkboxInput_6w8h4_15",
|
|
44
|
+
checkboxLabel: "_checkboxLabel_6w8h4_24",
|
|
45
|
+
customCheckbox: "_customCheckbox_6w8h4_34",
|
|
46
|
+
checkIcon: "_checkIcon_6w8h4_57",
|
|
47
|
+
checkboxText: "_checkboxText_6w8h4_76",
|
|
48
|
+
checkboxWrapperDisabled: "_checkboxWrapperDisabled_6w8h4_107",
|
|
49
|
+
checkboxWrapperError: "_checkboxWrapperError_6w8h4_133",
|
|
50
|
+
errorMessage: "_errorMessage_6w8h4_147",
|
|
51
|
+
checkboxWrapperGlassy: "_checkboxWrapperGlassy_6w8h4_154"
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/components/form/checkbox/Checkbox.tsx
|
|
55
|
+
function d({ label: e, name: r, id: i, error: a, variant: o = "default", className: s, disabled: c, ...l }) {
|
|
56
|
+
let d = i ?? `${r}-checkbox`;
|
|
57
|
+
return /* @__PURE__ */ n("div", {
|
|
58
|
+
className: [
|
|
59
|
+
u.checkboxWrapper,
|
|
60
|
+
o === "glassy" ? u.checkboxWrapperGlassy : "",
|
|
61
|
+
a ? u.checkboxWrapperError : "",
|
|
62
|
+
c ? u.checkboxWrapperDisabled : "",
|
|
63
|
+
s ?? ""
|
|
64
|
+
].filter(Boolean).join(" "),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ t("input", {
|
|
67
|
+
type: "checkbox",
|
|
68
|
+
id: d,
|
|
69
|
+
name: r,
|
|
70
|
+
disabled: c,
|
|
71
|
+
className: u.checkboxInput,
|
|
72
|
+
"aria-invalid": !!a,
|
|
73
|
+
"aria-describedby": a ? `${r}-error` : void 0,
|
|
74
|
+
...l
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ n("label", {
|
|
77
|
+
htmlFor: d,
|
|
78
|
+
className: u.checkboxLabel,
|
|
79
|
+
children: [/* @__PURE__ */ t("span", {
|
|
80
|
+
className: u.customCheckbox,
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
children: /* @__PURE__ */ t("svg", {
|
|
83
|
+
className: u.checkIcon,
|
|
84
|
+
viewBox: "0 0 24 24",
|
|
85
|
+
focusable: "false",
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
children: /* @__PURE__ */ t("path", { d: "M20 6L9 17L4 12" })
|
|
88
|
+
})
|
|
89
|
+
}), /* @__PURE__ */ t("span", {
|
|
90
|
+
className: u.checkboxText,
|
|
91
|
+
children: e
|
|
92
|
+
})]
|
|
93
|
+
}),
|
|
94
|
+
a && /* @__PURE__ */ t("span", {
|
|
95
|
+
id: `${r}-error`,
|
|
96
|
+
className: u.errorMessage,
|
|
97
|
+
children: a
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
var f = {
|
|
103
|
+
chip: "_chip_1kgh7_1",
|
|
104
|
+
chipDefault: "_chipDefault_1kgh7_21",
|
|
105
|
+
chipGlassy: "_chipGlassy_1kgh7_36",
|
|
106
|
+
chipChecked: "_chipChecked_1kgh7_49",
|
|
107
|
+
chipDisabled: "_chipDisabled_1kgh7_56"
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/components/form/chip/Chip.tsx
|
|
111
|
+
function p({ children: e, variant: n = "default", clickable: r = !0, checked: i, defaultChecked: a = !1, onCheckedChange: o, className: c, ...l }) {
|
|
112
|
+
let [u, d] = s(a), p = typeof i == "boolean", m = p ? i : u;
|
|
113
|
+
function h(e) {
|
|
114
|
+
if (!r) return;
|
|
115
|
+
let t = !m;
|
|
116
|
+
p || d(t), o?.(t), l.onClick?.(e);
|
|
117
|
+
}
|
|
118
|
+
let g = n === "glassy" ? f.chipGlassy : f.chipDefault, _ = m ? f.chipChecked : "", v = r ? "" : f.chipDisabled;
|
|
119
|
+
return r ? /* @__PURE__ */ t("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
"aria-pressed": m,
|
|
122
|
+
className: [
|
|
123
|
+
f.chip,
|
|
124
|
+
g,
|
|
125
|
+
_,
|
|
126
|
+
c ?? ""
|
|
127
|
+
].filter(Boolean).join(" "),
|
|
128
|
+
onClick: h,
|
|
129
|
+
...l,
|
|
130
|
+
children: e
|
|
131
|
+
}) : /* @__PURE__ */ t("span", {
|
|
132
|
+
className: [
|
|
133
|
+
f.chip,
|
|
134
|
+
g,
|
|
135
|
+
_,
|
|
136
|
+
v,
|
|
137
|
+
c ?? ""
|
|
138
|
+
].filter(Boolean).join(" "),
|
|
139
|
+
children: e
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
var m = {
|
|
143
|
+
inputBlockVertical: "_inputBlockVertical_1vqyb_1",
|
|
144
|
+
inputLabel: "_inputLabel_1vqyb_7",
|
|
145
|
+
inputLabelGlassy: "_inputLabelGlassy_1vqyb_13",
|
|
146
|
+
dateInputWrapper: "_dateInputWrapper_1vqyb_17",
|
|
147
|
+
inputDateField: "_inputDateField_1vqyb_22",
|
|
148
|
+
inputDateFieldGlassy: "_inputDateFieldGlassy_1vqyb_54",
|
|
149
|
+
inputError: "_inputError_1vqyb_72",
|
|
150
|
+
calendarIconButton: "_calendarIconButton_1vqyb_76",
|
|
151
|
+
icon: "_icon_1vqyb_104",
|
|
152
|
+
errorMessage: "_errorMessage_1vqyb_113"
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/components/form/date-picker/DatePicker.tsx
|
|
156
|
+
function h({ label: e, name: r, id: i, value: a = null, maxDate: s, minDate: c, error: l, variant: u = "default", className: d, ref: f, onDateChange: p, onBlur: h, disabled: y, ...b }) {
|
|
157
|
+
let x = i ?? r, S = o(null), C = s ?? /* @__PURE__ */ new Date();
|
|
158
|
+
function w(e) {
|
|
159
|
+
S.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
|
|
160
|
+
}
|
|
161
|
+
function T(e) {
|
|
162
|
+
let t = e.target.value;
|
|
163
|
+
if (!t) {
|
|
164
|
+
p?.(null);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
p?.(_(t));
|
|
168
|
+
}
|
|
169
|
+
function E() {
|
|
170
|
+
y || (S.current?.showPicker?.(), S.current?.focus());
|
|
171
|
+
}
|
|
172
|
+
return /* @__PURE__ */ n("div", {
|
|
173
|
+
className: m.inputBlockVertical,
|
|
174
|
+
children: [
|
|
175
|
+
/* @__PURE__ */ t("label", {
|
|
176
|
+
htmlFor: x,
|
|
177
|
+
className: [m.inputLabel, u === "glassy" ? m.inputLabelGlassy : ""].filter(Boolean).join(" "),
|
|
178
|
+
children: e
|
|
179
|
+
}),
|
|
180
|
+
/* @__PURE__ */ n("div", {
|
|
181
|
+
className: m.dateInputWrapper,
|
|
182
|
+
children: [/* @__PURE__ */ t("input", {
|
|
183
|
+
id: x,
|
|
184
|
+
name: r,
|
|
185
|
+
ref: w,
|
|
186
|
+
type: "date",
|
|
187
|
+
value: g(a),
|
|
188
|
+
max: g(C),
|
|
189
|
+
min: c ? g(c) : void 0,
|
|
190
|
+
disabled: y,
|
|
191
|
+
onChange: T,
|
|
192
|
+
onBlur: h,
|
|
193
|
+
className: [
|
|
194
|
+
m.inputDateField,
|
|
195
|
+
u === "glassy" ? m.inputDateFieldGlassy : "",
|
|
196
|
+
l ? m.inputError : "",
|
|
197
|
+
d ?? ""
|
|
198
|
+
].filter(Boolean).join(" "),
|
|
199
|
+
"aria-invalid": !!l,
|
|
200
|
+
"aria-describedby": l ? `${r}-error` : void 0,
|
|
201
|
+
...b
|
|
202
|
+
}), /* @__PURE__ */ t("button", {
|
|
203
|
+
type: "button",
|
|
204
|
+
className: m.calendarIconButton,
|
|
205
|
+
onClick: E,
|
|
206
|
+
disabled: y,
|
|
207
|
+
"aria-label": "Datum auswählen",
|
|
208
|
+
tabIndex: -1,
|
|
209
|
+
children: /* @__PURE__ */ t(v, {})
|
|
210
|
+
})]
|
|
211
|
+
}),
|
|
212
|
+
l && /* @__PURE__ */ t("span", {
|
|
213
|
+
id: `${r}-error`,
|
|
214
|
+
className: m.errorMessage,
|
|
215
|
+
children: l
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function g(e) {
|
|
221
|
+
return e ? `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}` : "";
|
|
222
|
+
}
|
|
223
|
+
function _(e) {
|
|
224
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
225
|
+
return new Date(t, n - 1, r);
|
|
226
|
+
}
|
|
227
|
+
function v() {
|
|
228
|
+
return /* @__PURE__ */ n("svg", {
|
|
229
|
+
className: m.icon,
|
|
230
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
231
|
+
viewBox: "0 0 24 24",
|
|
232
|
+
fill: "none",
|
|
233
|
+
"aria-hidden": "true",
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ t("path", { d: "M8 2V5" }),
|
|
236
|
+
/* @__PURE__ */ t("path", { d: "M16 2V5" }),
|
|
237
|
+
/* @__PURE__ */ t("path", { d: "M3.5 9.09H20.5" }),
|
|
238
|
+
/* @__PURE__ */ t("path", { d: "M21 8.5V17.5C21 20 19.75 21.5 16.75 21.5H7.25C4.25 21.5 3 20 3 17.5V8.5C3 6 4.25 4.5 7.25 4.5H16.75C19.75 4.5 21 6 21 8.5Z" })
|
|
239
|
+
]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
var y = {
|
|
243
|
+
inputBlockVertical: "_inputBlockVertical_1yqyz_1",
|
|
244
|
+
inputLabel: "_inputLabel_1yqyz_7",
|
|
245
|
+
inputLabelGlassy: "_inputLabelGlassy_1yqyz_13",
|
|
246
|
+
inputSelectField: "_inputSelectField_1yqyz_17",
|
|
247
|
+
inputSelectFieldGlassy: "_inputSelectFieldGlassy_1yqyz_27",
|
|
248
|
+
inputError: "_inputError_1yqyz_40",
|
|
249
|
+
errorMessage: "_errorMessage_1yqyz_44"
|
|
250
|
+
};
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/components/form/dropdown/Dropdown.tsx
|
|
253
|
+
function b({ label: e, name: r, options: i, placeholder: a, error: o, variant: s = "default", className: c, disabled: l, ...u }) {
|
|
254
|
+
return /* @__PURE__ */ n("div", {
|
|
255
|
+
className: y.inputBlockVertical,
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ t("label", {
|
|
258
|
+
htmlFor: r,
|
|
259
|
+
className: [y.inputLabel, s === "glassy" ? y.inputLabelGlassy : ""].filter(Boolean).join(" "),
|
|
260
|
+
children: e
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ n("select", {
|
|
263
|
+
id: r,
|
|
264
|
+
name: r,
|
|
265
|
+
disabled: l,
|
|
266
|
+
className: [
|
|
267
|
+
y.inputSelectField,
|
|
268
|
+
s === "glassy" ? y.inputSelectFieldGlassy : "",
|
|
269
|
+
o ? y.inputError : "",
|
|
270
|
+
c ?? ""
|
|
271
|
+
].filter(Boolean).join(" "),
|
|
272
|
+
"aria-invalid": !!o,
|
|
273
|
+
"aria-describedby": o ? `${r}-error` : void 0,
|
|
274
|
+
...u,
|
|
275
|
+
children: [a && /* @__PURE__ */ t("option", {
|
|
276
|
+
value: "",
|
|
277
|
+
disabled: !0,
|
|
278
|
+
children: a
|
|
279
|
+
}), i.map((e) => /* @__PURE__ */ t("option", {
|
|
280
|
+
value: e.value,
|
|
281
|
+
children: e.label
|
|
282
|
+
}, e.value))]
|
|
283
|
+
}),
|
|
284
|
+
o && /* @__PURE__ */ t("span", {
|
|
285
|
+
id: `${r}-error`,
|
|
286
|
+
className: y.errorMessage,
|
|
287
|
+
children: o
|
|
288
|
+
})
|
|
289
|
+
]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
var x = {
|
|
293
|
+
appLink: "_appLink_b53rv_1",
|
|
294
|
+
appLinkDefault: "_appLinkDefault_b53rv_19",
|
|
295
|
+
appLinkGlassy: "_appLinkGlassy_b53rv_30",
|
|
296
|
+
label: "_label_b53rv_38",
|
|
297
|
+
icon: "_icon_b53rv_43",
|
|
298
|
+
arrowIcon: "_arrowIcon_b53rv_54"
|
|
299
|
+
};
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/components/form/link/Link.tsx
|
|
302
|
+
function S({ children: e, href: r, onClick: i, newTab: a = !1, showArrow: o = !0, variant: s = "default", className: c, ...l }) {
|
|
303
|
+
function u(e) {
|
|
304
|
+
r || e.preventDefault(), i?.(e);
|
|
305
|
+
}
|
|
306
|
+
return /* @__PURE__ */ n("a", {
|
|
307
|
+
href: r ?? "#",
|
|
308
|
+
onClick: u,
|
|
309
|
+
target: r && a ? "_blank" : void 0,
|
|
310
|
+
rel: r && a ? "noopener noreferrer" : void 0,
|
|
311
|
+
className: [
|
|
312
|
+
x.appLink,
|
|
313
|
+
s === "glassy" ? x.appLinkGlassy : x.appLinkDefault,
|
|
314
|
+
c ?? ""
|
|
315
|
+
].filter(Boolean).join(" "),
|
|
316
|
+
...l,
|
|
317
|
+
children: [/* @__PURE__ */ t("span", {
|
|
318
|
+
className: x.label,
|
|
319
|
+
children: e
|
|
320
|
+
}), o && /* @__PURE__ */ t("span", {
|
|
321
|
+
className: x.icon,
|
|
322
|
+
"aria-hidden": "true",
|
|
323
|
+
children: /* @__PURE__ */ t(C, {})
|
|
324
|
+
})]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function C() {
|
|
328
|
+
return /* @__PURE__ */ n("svg", {
|
|
329
|
+
className: x.arrowIcon,
|
|
330
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
331
|
+
viewBox: "0 0 24 24",
|
|
332
|
+
fill: "none",
|
|
333
|
+
"aria-hidden": "true",
|
|
334
|
+
children: [/* @__PURE__ */ t("path", { d: "M5 12H19" }), /* @__PURE__ */ t("path", { d: "M13 6L19 12L13 18" })]
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
var w = {
|
|
338
|
+
inputBlockVertical: "_inputBlockVertical_u3s35_1",
|
|
339
|
+
inputLabel: "_inputLabel_u3s35_7",
|
|
340
|
+
inputLabelGlassy: "_inputLabelGlassy_u3s35_13",
|
|
341
|
+
passwordInputWrapper: "_passwordInputWrapper_u3s35_17",
|
|
342
|
+
inputTextField: "_inputTextField_u3s35_22",
|
|
343
|
+
inputTextFieldGlassy: "_inputTextFieldGlassy_u3s35_34",
|
|
344
|
+
inputError: "_inputError_u3s35_56",
|
|
345
|
+
togglePasswordButton: "_togglePasswordButton_u3s35_60",
|
|
346
|
+
icon: "_icon_u3s35_92",
|
|
347
|
+
errorMessage: "_errorMessage_u3s35_101"
|
|
348
|
+
};
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/components/form/password/Password.tsx
|
|
351
|
+
function T({ label: e, name: r, id: i, error: a, variant: o = "default", className: c, disabled: l, ref: u, autoComplete: d = "current-password", ...f }) {
|
|
352
|
+
let [p, m] = s(!1), h = i ?? r;
|
|
353
|
+
function g() {
|
|
354
|
+
m((e) => !e);
|
|
355
|
+
}
|
|
356
|
+
return /* @__PURE__ */ n("div", {
|
|
357
|
+
className: w.inputBlockVertical,
|
|
358
|
+
children: [
|
|
359
|
+
e && /* @__PURE__ */ t("label", {
|
|
360
|
+
htmlFor: h,
|
|
361
|
+
className: [w.inputLabel, o === "glassy" ? w.inputLabelGlassy : ""].filter(Boolean).join(" "),
|
|
362
|
+
children: e
|
|
363
|
+
}),
|
|
364
|
+
/* @__PURE__ */ n("div", {
|
|
365
|
+
className: w.passwordInputWrapper,
|
|
366
|
+
children: [/* @__PURE__ */ t("input", {
|
|
367
|
+
id: h,
|
|
368
|
+
name: r,
|
|
369
|
+
ref: u,
|
|
370
|
+
type: p ? "text" : "password",
|
|
371
|
+
disabled: l,
|
|
372
|
+
autoComplete: d,
|
|
373
|
+
className: [
|
|
374
|
+
w.inputTextField,
|
|
375
|
+
o === "glassy" ? w.inputTextFieldGlassy : "",
|
|
376
|
+
a ? w.inputError : "",
|
|
377
|
+
c ?? ""
|
|
378
|
+
].filter(Boolean).join(" "),
|
|
379
|
+
"aria-invalid": !!a,
|
|
380
|
+
"aria-describedby": a ? `${r}-error` : void 0,
|
|
381
|
+
...f
|
|
382
|
+
}), /* @__PURE__ */ t("button", {
|
|
383
|
+
type: "button",
|
|
384
|
+
className: w.togglePasswordButton,
|
|
385
|
+
onClick: g,
|
|
386
|
+
disabled: l,
|
|
387
|
+
"aria-label": p ? "Passwort ausblenden" : "Passwort anzeigen",
|
|
388
|
+
"aria-pressed": p,
|
|
389
|
+
children: t(p ? D : E, {})
|
|
390
|
+
})]
|
|
391
|
+
}),
|
|
392
|
+
a && /* @__PURE__ */ t("span", {
|
|
393
|
+
id: `${r}-error`,
|
|
394
|
+
className: w.errorMessage,
|
|
395
|
+
children: a
|
|
396
|
+
})
|
|
397
|
+
]
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
function E() {
|
|
401
|
+
return /* @__PURE__ */ n("svg", {
|
|
402
|
+
className: w.icon,
|
|
403
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
404
|
+
viewBox: "0 0 24 24",
|
|
405
|
+
fill: "none",
|
|
406
|
+
"aria-hidden": "true",
|
|
407
|
+
children: [/* @__PURE__ */ t("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ t("circle", {
|
|
408
|
+
cx: "12",
|
|
409
|
+
cy: "12",
|
|
410
|
+
r: "3"
|
|
411
|
+
})]
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function D() {
|
|
415
|
+
return /* @__PURE__ */ t("svg", {
|
|
416
|
+
className: w.icon,
|
|
417
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
418
|
+
viewBox: "0 0 24 24",
|
|
419
|
+
fill: "none",
|
|
420
|
+
"aria-hidden": "true",
|
|
421
|
+
children: /* @__PURE__ */ t("path", { d: "M17.94 17.94A10.94 10.94 0 0 1 12 20C7 20 2.73 16.11 1 12c.74-1.64 1.82-3.06 3.11-4.24m3.52-2.42A10.94 10.94 0 0 1 12 4c5 0 9.27 3.89 11 8-1.1 2.42-2.91 4.5-5.06 5.94M1 1l22 22" })
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
var O = {
|
|
425
|
+
inputBlockVertical: "_inputBlockVertical_1xe0h_1",
|
|
426
|
+
inputLabel: "_inputLabel_1xe0h_7",
|
|
427
|
+
inputLabelGlassy: "_inputLabelGlassy_1xe0h_13",
|
|
428
|
+
inputWrapper: "_inputWrapper_1xe0h_17",
|
|
429
|
+
inputTextField: "_inputTextField_1xe0h_22",
|
|
430
|
+
inputTextFieldGlassy: "_inputTextFieldGlassy_1xe0h_34",
|
|
431
|
+
inputError: "_inputError_1xe0h_64",
|
|
432
|
+
loading: "_loading_1xe0h_68",
|
|
433
|
+
suggestionList: "_suggestionList_1xe0h_77",
|
|
434
|
+
suggestionItem: "_suggestionItem_1xe0h_94",
|
|
435
|
+
locality: "_locality_1xe0h_114",
|
|
436
|
+
emptyState: "_emptyState_1xe0h_118",
|
|
437
|
+
successMessage: "_successMessage_1xe0h_129",
|
|
438
|
+
errorMessage: "_errorMessage_1xe0h_135"
|
|
439
|
+
};
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/components/form/postal-code/PostalCode.tsx
|
|
442
|
+
function k({ label: e, name: a, id: c, error: l, variant: u = "default", className: d, disabled: f, placeholder: p = "z.B. 8001 oder Zürich", ref: m, onChange: h, onBlur: g, onValueChange: _, onSuggestionSelect: v, ...y }) {
|
|
443
|
+
let b = i(), x = c ?? `${a}-${b}`, S = o(null), C = o(!1), [w, T] = s(""), [E, D] = s([]), [k, A] = s(!1), [j, M] = s(!1), N = w.trim().match(/^(\d+)\s+(.+)$/), P = !!N, F = N?.[1], I = N?.[2], L = P && E.some((e) => e.postalCode === F && e.locality === I), R = /^\d+$/.test(w.trim()), z = w.trim().length >= 4 && R && !k, B = z && E.some((e) => e.postalCode === w.trim()), V = z && !B;
|
|
444
|
+
j && w.trim().length >= 4 && E.length, r(() => {
|
|
445
|
+
let e = w.trim();
|
|
446
|
+
if (e.length < 2) {
|
|
447
|
+
D([]), M(!1);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (C.current) {
|
|
451
|
+
C.current = !1;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
let t = new AbortController();
|
|
455
|
+
async function n() {
|
|
456
|
+
A(!0);
|
|
457
|
+
try {
|
|
458
|
+
let n = e.match(/^(\d+)\s/), r = n ? n[1] : e, i = /^\d+$/.test(r) ? `https://openplzapi.org/ch/Localities?postalCode=${r}` : `https://openplzapi.org/ch/Localities?locality=${encodeURIComponent(r)}`, a = await fetch(i, { signal: t.signal });
|
|
459
|
+
if (!a.ok) throw Error("Postal-Code-Suche fehlgeschlagen");
|
|
460
|
+
let o = await a.json();
|
|
461
|
+
D(Array.from(new Map(o.map((e) => {
|
|
462
|
+
let t = `${e.postalCode} ${e.name}`;
|
|
463
|
+
return [t, {
|
|
464
|
+
label: t,
|
|
465
|
+
postalCode: e.postalCode,
|
|
466
|
+
locality: e.name
|
|
467
|
+
}];
|
|
468
|
+
})).values()).slice(0, 10)), M(!0);
|
|
469
|
+
} catch (e) {
|
|
470
|
+
if (t.signal.aborted) return;
|
|
471
|
+
console.error(e), D([]), M(!0);
|
|
472
|
+
} finally {
|
|
473
|
+
t.signal.aborted || A(!1);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
let r = window.setTimeout(n, 300);
|
|
477
|
+
return () => {
|
|
478
|
+
window.clearTimeout(r), t.abort();
|
|
479
|
+
};
|
|
480
|
+
}, [w]);
|
|
481
|
+
function H(e) {
|
|
482
|
+
S.current = e, typeof m == "function" ? m(e) : m && (m.current = e);
|
|
483
|
+
}
|
|
484
|
+
function U(e) {
|
|
485
|
+
let t = e.target.value;
|
|
486
|
+
T(t), _?.(t), h?.(e);
|
|
487
|
+
}
|
|
488
|
+
function W(e) {
|
|
489
|
+
C.current = !0, T(e.label), D([]), M(!1), _?.(e.label), v?.(e), S.current && (S.current.value = e.label, S.current.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
490
|
+
}
|
|
491
|
+
return /* @__PURE__ */ n("div", {
|
|
492
|
+
className: O.inputBlockVertical,
|
|
493
|
+
children: [
|
|
494
|
+
/* @__PURE__ */ t("label", {
|
|
495
|
+
htmlFor: x,
|
|
496
|
+
className: [O.inputLabel, u === "glassy" ? O.inputLabelGlassy : ""].filter(Boolean).join(" "),
|
|
497
|
+
children: e
|
|
498
|
+
}),
|
|
499
|
+
/* @__PURE__ */ n("div", {
|
|
500
|
+
className: O.inputWrapper,
|
|
501
|
+
children: [
|
|
502
|
+
/* @__PURE__ */ t("input", {
|
|
503
|
+
id: x,
|
|
504
|
+
name: a,
|
|
505
|
+
ref: H,
|
|
506
|
+
type: "text",
|
|
507
|
+
inputMode: "search",
|
|
508
|
+
autoComplete: "postal-code",
|
|
509
|
+
disabled: f,
|
|
510
|
+
placeholder: p,
|
|
511
|
+
value: w,
|
|
512
|
+
onChange: U,
|
|
513
|
+
onBlur: g,
|
|
514
|
+
className: [
|
|
515
|
+
O.inputTextField,
|
|
516
|
+
u === "glassy" ? O.inputTextFieldGlassy : "",
|
|
517
|
+
B || L ? O.inputValid : "",
|
|
518
|
+
V || l ? O.inputError : "",
|
|
519
|
+
d ?? ""
|
|
520
|
+
].filter(Boolean).join(" "),
|
|
521
|
+
"aria-invalid": !!l || V,
|
|
522
|
+
"aria-describedby": l ? `${a}-error` : void 0,
|
|
523
|
+
...y
|
|
524
|
+
}),
|
|
525
|
+
k && /* @__PURE__ */ t("span", {
|
|
526
|
+
className: O.loading,
|
|
527
|
+
children: "Lädt…"
|
|
528
|
+
}),
|
|
529
|
+
E.length > 0 && /* @__PURE__ */ t("ul", {
|
|
530
|
+
className: O.suggestionList,
|
|
531
|
+
children: E.map((e) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n("button", {
|
|
532
|
+
type: "button",
|
|
533
|
+
className: O.suggestionItem,
|
|
534
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
535
|
+
onClick: () => W(e),
|
|
536
|
+
children: [/* @__PURE__ */ t("span", { children: e.postalCode }), /* @__PURE__ */ t("span", {
|
|
537
|
+
className: O.locality,
|
|
538
|
+
children: e.locality
|
|
539
|
+
})]
|
|
540
|
+
}) }, e.label))
|
|
541
|
+
}),
|
|
542
|
+
j && w.trim().length >= 2 && E.length === 0 && !k && !L && !V && /* @__PURE__ */ t("div", {
|
|
543
|
+
className: O.emptyState,
|
|
544
|
+
children: "Keine Schweizer PLZ oder Ortschaft gefunden."
|
|
545
|
+
})
|
|
546
|
+
]
|
|
547
|
+
}),
|
|
548
|
+
B && /* @__PURE__ */ t("span", {
|
|
549
|
+
className: O.successMessage,
|
|
550
|
+
children: "Gültige Schweizer Postleitzahl"
|
|
551
|
+
}),
|
|
552
|
+
L && /* @__PURE__ */ t("span", {
|
|
553
|
+
className: O.successMessage,
|
|
554
|
+
children: "Gültige Schweizer Postleitzahl"
|
|
555
|
+
}),
|
|
556
|
+
V && /* @__PURE__ */ t("span", {
|
|
557
|
+
className: O.errorMessage,
|
|
558
|
+
children: "Diese Schweizer Postleitzahl wurde nicht gefunden."
|
|
559
|
+
}),
|
|
560
|
+
l && /* @__PURE__ */ t("span", {
|
|
561
|
+
id: `${a}-error`,
|
|
562
|
+
className: O.errorMessage,
|
|
563
|
+
children: l
|
|
564
|
+
})
|
|
565
|
+
]
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
var A = {
|
|
569
|
+
radioGroup: "_radioGroup_cqfjf_1",
|
|
570
|
+
radioGroupGlassy: "_radioGroupGlassy_cqfjf_11",
|
|
571
|
+
radioLabel: "_radioLabel_cqfjf_15",
|
|
572
|
+
radioLabelGlassy: "_radioLabelGlassy_cqfjf_20",
|
|
573
|
+
optionGroup: "_optionGroup_cqfjf_24",
|
|
574
|
+
optionWrapper: "_optionWrapper_cqfjf_31",
|
|
575
|
+
optionWrapperDisabled: "_optionWrapperDisabled_cqfjf_37",
|
|
576
|
+
radioInput: "_radioInput_cqfjf_41",
|
|
577
|
+
optionButton: "_optionButton_cqfjf_58",
|
|
578
|
+
optionTitle: "_optionTitle_cqfjf_81",
|
|
579
|
+
optionDescription: "_optionDescription_cqfjf_87",
|
|
580
|
+
optionButtonDefault: "_optionButtonDefault_cqfjf_95",
|
|
581
|
+
optionButtonGlassy: "_optionButtonGlassy_cqfjf_120",
|
|
582
|
+
optionButtonError: "_optionButtonError_cqfjf_165",
|
|
583
|
+
errorMessage: "_errorMessage_cqfjf_169"
|
|
584
|
+
};
|
|
585
|
+
//#endregion
|
|
586
|
+
//#region src/components/form/radiobutton/RadioButton.tsx
|
|
587
|
+
function j({ label: e, name: r, options: i, error: a, variant: o = "default", className: s, disabled: c, value: l, defaultValue: u, onChange: d, ...f }) {
|
|
588
|
+
let p = l !== void 0;
|
|
589
|
+
return /* @__PURE__ */ n("fieldset", {
|
|
590
|
+
className: [
|
|
591
|
+
A.radioGroup,
|
|
592
|
+
o === "glassy" ? A.radioGroupGlassy : "",
|
|
593
|
+
s ?? ""
|
|
594
|
+
].filter(Boolean).join(" "),
|
|
595
|
+
"aria-invalid": !!a,
|
|
596
|
+
"aria-describedby": a ? `${r}-error` : void 0,
|
|
597
|
+
children: [
|
|
598
|
+
e && /* @__PURE__ */ t("legend", {
|
|
599
|
+
className: [A.radioLabel, o === "glassy" ? A.radioLabelGlassy : ""].filter(Boolean).join(" "),
|
|
600
|
+
children: e
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ t("div", {
|
|
603
|
+
className: A.optionGroup,
|
|
604
|
+
children: i.map((e) => {
|
|
605
|
+
let i = p ? { checked: l === e.value } : { defaultChecked: u === e.value };
|
|
606
|
+
return /* @__PURE__ */ n("label", {
|
|
607
|
+
className: [A.optionWrapper, c ? A.optionWrapperDisabled : ""].filter(Boolean).join(" "),
|
|
608
|
+
children: [/* @__PURE__ */ t("input", {
|
|
609
|
+
type: "radio",
|
|
610
|
+
name: r,
|
|
611
|
+
value: e.value,
|
|
612
|
+
disabled: c,
|
|
613
|
+
className: A.radioInput,
|
|
614
|
+
onChange: d,
|
|
615
|
+
...i,
|
|
616
|
+
...f
|
|
617
|
+
}), /* @__PURE__ */ n("span", {
|
|
618
|
+
className: [
|
|
619
|
+
A.optionButton,
|
|
620
|
+
o === "glassy" ? A.optionButtonGlassy : A.optionButtonDefault,
|
|
621
|
+
a ? A.optionButtonError : ""
|
|
622
|
+
].filter(Boolean).join(" "),
|
|
623
|
+
children: [/* @__PURE__ */ t("span", {
|
|
624
|
+
className: A.optionTitle,
|
|
625
|
+
children: e.label
|
|
626
|
+
}), e.description && /* @__PURE__ */ t("span", {
|
|
627
|
+
className: A.optionDescription,
|
|
628
|
+
children: e.description
|
|
629
|
+
})]
|
|
630
|
+
})]
|
|
631
|
+
}, e.value);
|
|
632
|
+
})
|
|
633
|
+
}),
|
|
634
|
+
a && /* @__PURE__ */ t("span", {
|
|
635
|
+
id: `${r}-error`,
|
|
636
|
+
className: A.errorMessage,
|
|
637
|
+
children: a
|
|
638
|
+
})
|
|
639
|
+
]
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
var M = {
|
|
643
|
+
switchWrapper: "_switchWrapper_14rch_1",
|
|
644
|
+
switchCheckbox: "_switchCheckbox_14rch_7",
|
|
645
|
+
switchLabel: "_switchLabel_14rch_15",
|
|
646
|
+
switchLabelDefault: "_switchLabelDefault_14rch_24",
|
|
647
|
+
switchLabelGlassy: "_switchLabelGlassy_14rch_28",
|
|
648
|
+
switchBackground: "_switchBackground_14rch_37",
|
|
649
|
+
switchBackgroundDefault: "_switchBackgroundDefault_14rch_56",
|
|
650
|
+
switchBackgroundGlassy: "_switchBackgroundGlassy_14rch_66",
|
|
651
|
+
switchButton: "_switchButton_14rch_77",
|
|
652
|
+
iconChecked: "_iconChecked_14rch_163",
|
|
653
|
+
iconUnchecked: "_iconUnchecked_14rch_164",
|
|
654
|
+
switchText: "_switchText_14rch_200",
|
|
655
|
+
errorMessage: "_errorMessage_14rch_206"
|
|
656
|
+
};
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/components/form/switch/Switch.tsx
|
|
659
|
+
function N({ name: e, id: r, label: i, error: a, variant: o = "default", className: s, disabled: c, ...l }) {
|
|
660
|
+
let u = r ?? `${e}-switch`;
|
|
661
|
+
return /* @__PURE__ */ n("div", {
|
|
662
|
+
className: [M.switchWrapper, s ?? ""].filter(Boolean).join(" "),
|
|
663
|
+
children: [
|
|
664
|
+
/* @__PURE__ */ t("input", {
|
|
665
|
+
id: u,
|
|
666
|
+
name: e,
|
|
667
|
+
type: "checkbox",
|
|
668
|
+
disabled: c,
|
|
669
|
+
className: M.switchCheckbox,
|
|
670
|
+
"aria-invalid": !!a,
|
|
671
|
+
"aria-describedby": a ? `${e}-error` : void 0,
|
|
672
|
+
...l
|
|
673
|
+
}),
|
|
674
|
+
/* @__PURE__ */ n("label", {
|
|
675
|
+
htmlFor: u,
|
|
676
|
+
className: [M.switchLabel, o === "glassy" ? M.switchLabelGlassy : M.switchLabelDefault].filter(Boolean).join(" "),
|
|
677
|
+
children: [/* @__PURE__ */ t("span", {
|
|
678
|
+
className: [M.switchBackground, o === "glassy" ? M.switchBackgroundGlassy : M.switchBackgroundDefault].filter(Boolean).join(" "),
|
|
679
|
+
children: /* @__PURE__ */ n("span", {
|
|
680
|
+
className: M.switchButton,
|
|
681
|
+
"aria-hidden": "true",
|
|
682
|
+
children: [/* @__PURE__ */ t("span", {
|
|
683
|
+
className: M.iconChecked,
|
|
684
|
+
children: /* @__PURE__ */ t(P, {})
|
|
685
|
+
}), /* @__PURE__ */ t("span", {
|
|
686
|
+
className: M.iconUnchecked,
|
|
687
|
+
children: /* @__PURE__ */ t(F, {})
|
|
688
|
+
})]
|
|
689
|
+
})
|
|
690
|
+
}), i && /* @__PURE__ */ t("span", {
|
|
691
|
+
className: M.switchText,
|
|
692
|
+
children: i
|
|
693
|
+
})]
|
|
694
|
+
}),
|
|
695
|
+
a && /* @__PURE__ */ t("span", {
|
|
696
|
+
id: `${e}-error`,
|
|
697
|
+
className: M.errorMessage,
|
|
698
|
+
children: a
|
|
699
|
+
})
|
|
700
|
+
]
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
function P() {
|
|
704
|
+
return /* @__PURE__ */ t("svg", {
|
|
705
|
+
width: "16",
|
|
706
|
+
height: "16",
|
|
707
|
+
viewBox: "0 0 12 12",
|
|
708
|
+
fill: "none",
|
|
709
|
+
"aria-hidden": "true",
|
|
710
|
+
children: /* @__PURE__ */ t("path", {
|
|
711
|
+
d: "M3 6.5L5.5 9L9 3",
|
|
712
|
+
stroke: "currentColor",
|
|
713
|
+
strokeWidth: "2",
|
|
714
|
+
strokeLinecap: "round",
|
|
715
|
+
strokeLinejoin: "round"
|
|
716
|
+
})
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
function F() {
|
|
720
|
+
return /* @__PURE__ */ t("svg", {
|
|
721
|
+
width: "16",
|
|
722
|
+
height: "16",
|
|
723
|
+
viewBox: "0 0 12 12",
|
|
724
|
+
fill: "none",
|
|
725
|
+
"aria-hidden": "true",
|
|
726
|
+
children: /* @__PURE__ */ t("path", {
|
|
727
|
+
d: "M3 3L9 9M9 3L3 9",
|
|
728
|
+
stroke: "currentColor",
|
|
729
|
+
strokeWidth: "2",
|
|
730
|
+
strokeLinecap: "round"
|
|
731
|
+
})
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
var I = {
|
|
735
|
+
inputBlockVertical: "_inputBlockVertical_1khad_1",
|
|
736
|
+
inputLabel: "_inputLabel_1khad_8",
|
|
737
|
+
inputLabelGlassy: "_inputLabelGlassy_1khad_14",
|
|
738
|
+
inputTextField: "_inputTextField_1khad_20",
|
|
739
|
+
inputTextFieldGlassy: "_inputTextFieldGlassy_1khad_37",
|
|
740
|
+
inputError: "_inputError_1khad_59",
|
|
741
|
+
errorMessage: "_errorMessage_1khad_63"
|
|
742
|
+
};
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/components/form/textfield/TextField.tsx
|
|
745
|
+
function L({ label: e, name: r, error: i, placeholder: a, variant: o = "default", className: s, ref: c, ...l }) {
|
|
746
|
+
return /* @__PURE__ */ n("div", {
|
|
747
|
+
className: I.inputBlockVertical,
|
|
748
|
+
children: [
|
|
749
|
+
/* @__PURE__ */ t("label", {
|
|
750
|
+
htmlFor: r,
|
|
751
|
+
className: [I.inputLabel, o === "glassy" ? I.inputLabelGlassy : ""].filter(Boolean).join(" "),
|
|
752
|
+
children: e
|
|
753
|
+
}),
|
|
754
|
+
/* @__PURE__ */ t("input", {
|
|
755
|
+
id: r,
|
|
756
|
+
name: r,
|
|
757
|
+
ref: c,
|
|
758
|
+
placeholder: a,
|
|
759
|
+
className: [
|
|
760
|
+
I.inputTextField,
|
|
761
|
+
o === "glassy" ? I.inputTextFieldGlassy : "",
|
|
762
|
+
i ? I.inputError : "",
|
|
763
|
+
s ?? ""
|
|
764
|
+
].filter(Boolean).join(" "),
|
|
765
|
+
"aria-invalid": !!i,
|
|
766
|
+
"aria-describedby": i ? `${r}-error` : void 0,
|
|
767
|
+
...l
|
|
768
|
+
}),
|
|
769
|
+
i && /* @__PURE__ */ t("span", {
|
|
770
|
+
id: `${r}-error`,
|
|
771
|
+
className: I.errorMessage,
|
|
772
|
+
children: i
|
|
773
|
+
})
|
|
774
|
+
]
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
var R = {
|
|
778
|
+
wrapper: "_wrapper_1jqlw_1",
|
|
779
|
+
label: "_label_1jqlw_7",
|
|
780
|
+
labelGlassy: "_labelGlassy_1jqlw_13",
|
|
781
|
+
dropzone: "_dropzone_1jqlw_17",
|
|
782
|
+
dropzoneGlassy: "_dropzoneGlassy_1jqlw_32",
|
|
783
|
+
dragOver: "_dragOver_1jqlw_39",
|
|
784
|
+
errorState: "_errorState_1jqlw_48",
|
|
785
|
+
disabled: "_disabled_1jqlw_52",
|
|
786
|
+
hiddenInput: "_hiddenInput_1jqlw_57",
|
|
787
|
+
dropzoneContent: "_dropzoneContent_1jqlw_65",
|
|
788
|
+
placeholder: "_placeholder_1jqlw_74",
|
|
789
|
+
big: "_big_1jqlw_80",
|
|
790
|
+
small: "_small_1jqlw_86",
|
|
791
|
+
hint: "_hint_1jqlw_91",
|
|
792
|
+
selected: "_selected_1jqlw_111",
|
|
793
|
+
preview: "_preview_1jqlw_118",
|
|
794
|
+
fileMeta: "_fileMeta_1jqlw_127",
|
|
795
|
+
fileName: "_fileName_1jqlw_134",
|
|
796
|
+
fileSize: "_fileSize_1jqlw_142",
|
|
797
|
+
remove: "_remove_1jqlw_156",
|
|
798
|
+
errorMessage: "_errorMessage_1jqlw_198"
|
|
799
|
+
};
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region src/components/form/upload/Upload.tsx
|
|
802
|
+
function z({ label: e, name: o, id: c, file: l, error: u, variant: d = "default", accept: f = "image/*", maxSizeBytes: p = 5 * 1024 * 1024, disabled: m, className: h, onChange: g, onFileChange: _, ...v }) {
|
|
803
|
+
let y = i(), b = c ?? `${o}-${y}`, [x, S] = s(!1), [C, w] = s(l ?? null), T = l !== void 0, E = T ? l : C, D = a(() => !E || !E.type.startsWith("image/") ? null : URL.createObjectURL(E), [E]);
|
|
804
|
+
r(() => {
|
|
805
|
+
T && w(l ?? null);
|
|
806
|
+
}, [l, T]), r(() => () => {
|
|
807
|
+
D && URL.revokeObjectURL(D);
|
|
808
|
+
}, [D]);
|
|
809
|
+
function O(e) {
|
|
810
|
+
return !e || (f === "image/*" || f.startsWith("image/")) && !e.type.startsWith("image/") || p && e.size > p ? null : e;
|
|
811
|
+
}
|
|
812
|
+
function k(e) {
|
|
813
|
+
let t = O(e);
|
|
814
|
+
T || w(t), _?.(t);
|
|
815
|
+
}
|
|
816
|
+
function A(e) {
|
|
817
|
+
k(e.target.files?.[0] ?? null), g?.(e);
|
|
818
|
+
}
|
|
819
|
+
function j(e) {
|
|
820
|
+
e.preventDefault(), e.stopPropagation(), m || S(!0);
|
|
821
|
+
}
|
|
822
|
+
function M(e) {
|
|
823
|
+
e.preventDefault(), e.stopPropagation(), !e.currentTarget.contains(e.relatedTarget) && S(!1);
|
|
824
|
+
}
|
|
825
|
+
function N(e) {
|
|
826
|
+
e.preventDefault(), e.stopPropagation(), S(!1), !m && k(e.dataTransfer.files?.[0] ?? null);
|
|
827
|
+
}
|
|
828
|
+
function P() {
|
|
829
|
+
T || w(null), _?.(null);
|
|
830
|
+
}
|
|
831
|
+
let F = Math.round(p / (1024 * 1024));
|
|
832
|
+
return /* @__PURE__ */ n("div", {
|
|
833
|
+
className: [R.wrapper, h ?? ""].filter(Boolean).join(" "),
|
|
834
|
+
children: [
|
|
835
|
+
/* @__PURE__ */ t("label", {
|
|
836
|
+
className: [R.label, d === "glassy" ? R.labelGlassy : ""].filter(Boolean).join(" "),
|
|
837
|
+
htmlFor: b,
|
|
838
|
+
children: e
|
|
839
|
+
}),
|
|
840
|
+
/* @__PURE__ */ n("div", {
|
|
841
|
+
className: [
|
|
842
|
+
R.dropzone,
|
|
843
|
+
d === "glassy" ? R.dropzoneGlassy : "",
|
|
844
|
+
x ? R.dragOver : "",
|
|
845
|
+
u ? R.errorState : "",
|
|
846
|
+
m ? R.disabled : ""
|
|
847
|
+
].filter(Boolean).join(" "),
|
|
848
|
+
onDragOver: j,
|
|
849
|
+
onDragLeave: M,
|
|
850
|
+
onDrop: N,
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ t("input", {
|
|
853
|
+
id: b,
|
|
854
|
+
name: o,
|
|
855
|
+
className: R.hiddenInput,
|
|
856
|
+
type: "file",
|
|
857
|
+
accept: f,
|
|
858
|
+
disabled: m,
|
|
859
|
+
onChange: A,
|
|
860
|
+
"aria-invalid": !!u,
|
|
861
|
+
"aria-describedby": u ? `${o}-error` : void 0,
|
|
862
|
+
...v
|
|
863
|
+
}),
|
|
864
|
+
/* @__PURE__ */ t("label", {
|
|
865
|
+
htmlFor: b,
|
|
866
|
+
className: R.dropzoneContent,
|
|
867
|
+
children: E ? /* @__PURE__ */ n("span", {
|
|
868
|
+
className: R.selected,
|
|
869
|
+
children: [D && /* @__PURE__ */ t("img", {
|
|
870
|
+
className: R.preview,
|
|
871
|
+
src: D,
|
|
872
|
+
alt: `Vorschau von ${E.name}`
|
|
873
|
+
}), /* @__PURE__ */ n("span", {
|
|
874
|
+
className: R.fileMeta,
|
|
875
|
+
children: [/* @__PURE__ */ t("span", {
|
|
876
|
+
className: R.fileName,
|
|
877
|
+
children: E.name
|
|
878
|
+
}), /* @__PURE__ */ n("span", {
|
|
879
|
+
className: R.fileSize,
|
|
880
|
+
children: [
|
|
881
|
+
(E.size / 1024).toFixed(0),
|
|
882
|
+
" KB ·",
|
|
883
|
+
" ",
|
|
884
|
+
E.type || "unknown"
|
|
885
|
+
]
|
|
886
|
+
})]
|
|
887
|
+
})]
|
|
888
|
+
}) : /* @__PURE__ */ n("span", {
|
|
889
|
+
className: R.placeholder,
|
|
890
|
+
children: [
|
|
891
|
+
/* @__PURE__ */ t("span", {
|
|
892
|
+
className: R.big,
|
|
893
|
+
children: "Datei hier reinziehen"
|
|
894
|
+
}),
|
|
895
|
+
/* @__PURE__ */ t("span", {
|
|
896
|
+
className: R.small,
|
|
897
|
+
children: "…oder klicken, um auszuwählen"
|
|
898
|
+
}),
|
|
899
|
+
/* @__PURE__ */ n("span", {
|
|
900
|
+
className: R.hint,
|
|
901
|
+
children: [
|
|
902
|
+
"Erlaubt: ",
|
|
903
|
+
f,
|
|
904
|
+
" · max. ",
|
|
905
|
+
F,
|
|
906
|
+
" MB"
|
|
907
|
+
]
|
|
908
|
+
})
|
|
909
|
+
]
|
|
910
|
+
})
|
|
911
|
+
}),
|
|
912
|
+
E && /* @__PURE__ */ t("button", {
|
|
913
|
+
type: "button",
|
|
914
|
+
className: R.remove,
|
|
915
|
+
onClick: P,
|
|
916
|
+
disabled: m,
|
|
917
|
+
children: "Entfernen"
|
|
918
|
+
})
|
|
919
|
+
]
|
|
920
|
+
}),
|
|
921
|
+
u && /* @__PURE__ */ t("span", {
|
|
922
|
+
id: `${o}-error`,
|
|
923
|
+
className: R.errorMessage,
|
|
924
|
+
children: u
|
|
925
|
+
})
|
|
926
|
+
]
|
|
927
|
+
});
|
|
928
|
+
}
|
|
40
929
|
//#endregion
|
|
41
|
-
export {
|
|
930
|
+
export { l as Button, d as Checkbox, p as Chip, h as DatePicker, b as Dropdown, S as Link, T as Password, k as PostalCode, j as RadioButton, N as Switch, L as TextField, z as Upload };
|