suus-component-library 0.1.5 → 0.1.9

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