zabi-components 1.0.2 → 1.0.3

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.
@@ -1,889 +0,0 @@
1
- import { t as P, Q as ze, R as Ce, S as Me, T as je, U as ue, p as U, C as ne, D as _e, i as ie, f as y, c as j, s as fe, g as i, h as ve, j as de, r as k, o as C, n as o, u as r, l as e, m as Q, q as ae, v as W, k as w, e as ee, B as Z, E as ge, w as re, b as X, V as xe, W as Te, d as ye, Y as le, P as Ue, Z as he, a as qe, G as Be, x as De, F as Le, y as Ee, A as Pe } from "./x-DaAXsWcz.js";
2
- import { createEventDispatcher as pe, onMount as Ae, onDestroy as Ie } from "svelte";
3
- import { B as oe, T as Se, S as Fe, C as Re, c as Oe, a as Ve, b as He, I as Ke } from "./Toggle-L79m_T4s.js";
4
- function We(Y, d, s = !1, u = !1, M = !1) {
5
- var g = Y, F = "";
6
- P(() => {
7
- var p = (
8
- /** @type {Effect} */
9
- ze
10
- );
11
- if (F !== (F = d() ?? "") && (p.nodes_start !== null && (Ce(
12
- p.nodes_start,
13
- /** @type {TemplateNode} */
14
- p.nodes_end
15
- ), p.nodes_start = p.nodes_end = null), F !== "")) {
16
- var t = F + "";
17
- s ? t = `<svg>${t}</svg>` : u && (t = `<math>${t}</math>`);
18
- var b = Me(t);
19
- if ((s || u) && (b = /** @type {Element} */
20
- ue(b)), je(
21
- /** @type {TemplateNode} */
22
- ue(b),
23
- /** @type {TemplateNode} */
24
- b.lastChild
25
- ), s || u)
26
- for (; ue(b); )
27
- g.before(
28
- /** @type {Node} */
29
- ue(b)
30
- );
31
- else
32
- g.before(b);
33
- }
34
- });
35
- }
36
- var Ne = y('<button class="absolute top-sm right-sm z-10 w-6 h-6 flex items-center justify-center rounded-full text-secondary hover:text-primary transition-colors duration-200 motion-reduce:transition-none group focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2" aria-label="Dismiss alert" type="button"><svg class="w-4 h-4 text-current group-hover:scale-110 transition-transform duration-200 motion-reduce:transition-none" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button>'), Ge = y('<h4 class="font-semibold text-sm mb-1"> </h4>'), Qe = y('<p class="text-sm leading-relaxed"> </p>'), Ye = y('<a class="text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 rounded-sm"> </a>'), Ze = y('<button class="text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 rounded-sm" type="button"> </button>'), Je = y('<div class="mt-3 flex flex-wrap gap-2"></div>'), Xe = y('<div aria-atomic="true"><!> <div><div class="flex-shrink-0 mt-0.5"><!></div> <div class="flex-1 min-w-0"><!> <!> <!></div></div> <!></div>');
37
- function Mt(Y, d) {
38
- de(d, !1);
39
- const s = Q(), u = Q(), M = Q();
40
- let g = U(d, "variant", 8, "info"), F = U(d, "title", 8, ""), p = U(d, "message", 8, ""), t = U(d, "dismissible", 8, !1), b = U(d, "onDismiss", 8, null), $ = U(d, "actions", 24, () => []);
41
- function O() {
42
- b() && b()();
43
- }
44
- function A(f) {
45
- f.onClick && f.onClick();
46
- }
47
- ne(() => {
48
- }, () => {
49
- w(s, {
50
- success: "bg-success-light text-success-dark border border-success",
51
- warning: "bg-warning-light text-warning-dark border border-warning",
52
- danger: "bg-error-light text-error-dark border border-error",
53
- info: "bg-info-light text-info-dark border border-info"
54
- });
55
- }), ne(() => k(g()), () => {
56
- w(u, g() === "success" || g() === "info" ? "status" : "alert");
57
- }), ne(() => {
58
- }, () => {
59
- w(M, {
60
- success: `<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
61
- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
62
- </svg>`,
63
- warning: `<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
64
- <path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
65
- </svg>`,
66
- danger: `<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
67
- <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
68
- </svg>`,
69
- info: `<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
70
- <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
71
- </svg>`
72
- });
73
- }), _e(), ie();
74
- var B = Xe(), V = o(B);
75
- {
76
- var G = (f) => {
77
- var l = Ne();
78
- ee("click", l, O), i(f, l);
79
- };
80
- j(V, (f) => {
81
- t() && f(G);
82
- });
83
- }
84
- var x = C(V, 2), q = o(x), D = o(q);
85
- We(D, () => (e(M), k(g()), r(() => e(M)[g()])));
86
- var I = C(q, 2), T = o(I);
87
- {
88
- var J = (f) => {
89
- var l = Ge(), c = o(l);
90
- P(() => Z(c, F())), i(f, l);
91
- };
92
- j(T, (f) => {
93
- F() && f(J);
94
- });
95
- }
96
- var m = C(T, 2);
97
- {
98
- var a = (f) => {
99
- var l = Qe(), c = o(l);
100
- P(() => Z(c, p())), i(f, l);
101
- };
102
- j(m, (f) => {
103
- p() && f(a);
104
- });
105
- }
106
- var n = C(m, 2);
107
- {
108
- var v = (f) => {
109
- var l = Je();
110
- ge(l, 5, $, xe, (c, h) => {
111
- var L = re(), R = X(L);
112
- {
113
- var H = (S) => {
114
- var K = Ye(), se = o(K);
115
- P(() => {
116
- W(K, "href", (e(h), r(() => e(h).href))), Z(se, (e(h), r(() => e(h).label)));
117
- }), i(S, K);
118
- }, _ = (S) => {
119
- var K = Ze(), se = o(K);
120
- P(() => Z(se, (e(h), r(() => e(h).label)))), ee("click", K, () => A(e(h))), i(S, K);
121
- };
122
- j(R, (S) => {
123
- e(h), r(() => e(h).href) ? S(H) : S(_, !1);
124
- });
125
- }
126
- i(c, L);
127
- }), i(f, l);
128
- };
129
- j(n, (f) => {
130
- k($()), r(() => $().length > 0) && f(v);
131
- });
132
- }
133
- var z = C(x, 2);
134
- fe(z, d, "default", {}, null), P(() => {
135
- ae(B, 1, `relative rounded-md p-md border ${e(s), k(g()), r(() => e(s)[g()]) ?? ""} transition-all duration-200 motion-reduce:transition-none`), W(B, "role", e(u)), W(B, "aria-live", g() === "success" || g() === "info" ? "polite" : "assertive"), ae(x, 1, `flex items-start gap-sm ${t() ? "pr-8" : ""}`);
136
- }), i(Y, B), ve();
137
- }
138
- var et = y('<button type="button" class="text-tertiary hover:text-primary focus:outline-none focus:ring-2 focus:ring-primary rounded-lg p-1 transition-colors" aria-label="Close dialog"><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button>'), tt = y('<div class="flex items-center justify-end gap-3 p-6 border-t border-primary bg-surface-secondary"><!></div>'), at = y('<div class="fixed inset-0 bg-black/60 backdrop-blur-sm z-modal-backdrop flex items-center justify-center p-4" role="presentation" tabindex="-1"><div class="bg-surface-elevated rounded-xl shadow-adaptive-xl max-w-md w-full max-h-[90vh] overflow-y-auto border border-primary focus:outline-none" role="dialog" aria-modal="true" aria-labelledby="dialog-title" tabindex="-1"><div class="flex items-center justify-between p-6 border-b border-primary"><h2 id="dialog-title" class="text-xl font-semibold text-primary"> </h2> <!></div> <div class="p-6 text-primary"><!></div> <!></div></div>');
139
- function rt(Y, d) {
140
- const s = Te(d);
141
- de(d, !1);
142
- let u = U(d, "isOpen", 12, !1), M = U(d, "title", 8, ""), g = U(d, "showCloseButton", 8, !0);
143
- const F = pe();
144
- let p = Q(), t = Q(null);
145
- function b() {
146
- u(!1), F("close");
147
- }
148
- function $(x) {
149
- x.target === x.currentTarget && b();
150
- }
151
- function O(x) {
152
- x.key === "Escape" && b();
153
- }
154
- function A(x) {
155
- var T;
156
- if (!u()) return;
157
- const q = (T = e(p)) == null ? void 0 : T.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
158
- if (!q.length) return;
159
- const D = q[0], I = q[q.length - 1];
160
- x.key === "Tab" && (x.shiftKey ? document.activeElement === D && (x.preventDefault(), I.focus()) : document.activeElement === I && (x.preventDefault(), D.focus()));
161
- }
162
- Ae(() => () => {
163
- e(t) && e(t).focus();
164
- }), ne(() => (k(u()), e(p)), () => {
165
- u() && (w(t, document.activeElement), setTimeout(
166
- () => {
167
- var q;
168
- const x = (q = e(p)) == null ? void 0 : q.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
169
- x == null || x.focus();
170
- },
171
- 0
172
- ));
173
- }), _e(), ie();
174
- var B = re(), V = X(B);
175
- {
176
- var G = (x) => {
177
- var q = at(), D = o(q), I = o(D), T = o(I), J = o(T), m = C(T, 2);
178
- {
179
- var a = (l) => {
180
- var c = et();
181
- ee("click", c, b), i(l, c);
182
- };
183
- j(m, (l) => {
184
- g() && l(a);
185
- });
186
- }
187
- var n = C(I, 2), v = o(n);
188
- fe(v, d, "default", {}, null);
189
- var z = C(n, 2);
190
- {
191
- var f = (l) => {
192
- var c = tt(), h = o(c);
193
- fe(h, d, "footer", {}, null), i(l, c);
194
- };
195
- j(z, (l) => {
196
- r(() => s.footer) && l(f);
197
- });
198
- }
199
- ye(D, (l) => w(p, l), () => e(p)), P(() => Z(J, M())), ee("keydown", D, A), ee("click", q, $), ee("keydown", q, O), i(x, q);
200
- };
201
- j(V, (x) => {
202
- u() && x(G);
203
- });
204
- }
205
- i(Y, B), ve();
206
- }
207
- var st = y('<div class="relative group"><img alt="" class="w-full h-32 object-cover rounded-lg border border-stone-600"/> <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center"><div class="flex gap-2"><!> <!></div></div></div>'), nt = y('<div class="border-2 border-dashed border-stone-600 rounded-lg p-6 text-center hover:border-stone-500 transition-colors"><div class="space-y-3"><div class="w-12 h-12 mx-auto bg-stone-700 rounded-lg flex items-center justify-center"><svg class="w-6 h-6 text-stone-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg></div> <div><p class="text-stone-300 font-medium"> </p> <p class="text-stone-500 text-sm">Choose a file to upload</p></div> <div class="flex gap-2 justify-center"><!></div></div></div>'), lt = y('<div class="space-y-3"><div class="text-sm font-medium text-stone-300">Choose File</div> <input type="file" class="block w-full text-sm text-stone-300 file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-medium file:bg-blue-900/30 file:text-blue-300 hover:file:bg-blue-900/50"/> <p class="text-xs text-stone-500"> </p></div>'), ot = y('<img alt="Preview" class="w-full h-48 object-cover rounded-lg border border-stone-600"/>'), it = y('<div class="w-full h-48 bg-stone-700 rounded-lg border border-stone-600 flex items-center justify-center"><div class="text-center"><svg class="w-12 h-12 text-stone-400 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path></svg> <p class="text-stone-300 text-sm"> </p></div></div>'), vt = y('<div class="absolute inset-0 bg-black/50 flex items-center justify-center rounded-lg"><div class="text-center"><div class="w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-2"></div> <p class="text-white text-sm">Uploading...</p></div></div>'), dt = y('<div class="space-y-2"><div class="flex justify-between text-sm text-stone-400"><span>Uploading...</span> <span> </span></div> <div class="w-full bg-stone-700 rounded-full h-2"><div class="bg-blue-500 h-2 rounded-full transition-all duration-300"></div></div></div>'), ct = y('<div class="space-y-4"><div class="relative"><!> <!></div> <!></div>'), ut = y('<div class="space-y-4"><!></div>'), ft = y("<!> <!>", 1), gt = y('<div class="space-y-3"><!> <!></div>');
208
- function jt(Y, d) {
209
- de(d, !1);
210
- let s = U(d, "value", 12, null), u = U(d, "disabled", 8, !1), M = U(d, "accept", 8, "image/*"), g = U(
211
- d,
212
- "maxSize",
213
- 8,
214
- 5 * 1024 * 1024
215
- // 5MB default
216
- ), F = U(d, "placeholder", 8, "No image selected");
217
- const p = pe();
218
- let t = Q(!1), b = Q(null), $ = Q(null), O = Q(!1), A = Q(0);
219
- function B(a) {
220
- const n = a.target;
221
- if (!n.files || n.files.length === 0) return;
222
- const v = n.files[0];
223
- if (v.size > g()) {
224
- p("error", {
225
- message: `File size must be less than ${Math.round(g() / 1024 / 1024)}MB`
226
- });
227
- return;
228
- }
229
- if (M() !== "*" && !v.type.match(M().replace("*", ".*"))) {
230
- p("error", { message: "Please select a valid file type" });
231
- return;
232
- }
233
- w(b, v), w($, URL.createObjectURL(v));
234
- }
235
- async function V() {
236
- if (!(!e(b) || !e($))) {
237
- w(O, !0), w(A, 0);
238
- try {
239
- const a = setInterval(
240
- () => {
241
- e(A) < 90 && (w(A, e(A) + Math.random() * 10), p("upload", { progress: e(A) }));
242
- },
243
- 200
244
- );
245
- await new Promise((n) => setTimeout(n, 1e3)), clearInterval(a), w(A, 100), s(e($)), p("change", { value: e($) }), w(t, !1), x(), p("upload", { progress: 100 });
246
- } catch (a) {
247
- p("error", { message: `Upload failed: ${a}` });
248
- } finally {
249
- w(O, !1), w(A, 0);
250
- }
251
- }
252
- }
253
- function G() {
254
- s(null), p("change", { value: null });
255
- }
256
- function x() {
257
- w(b, null), e($) && (URL.revokeObjectURL(e($)), w($, null)), w(A, 0);
258
- }
259
- function q() {
260
- e($) && (URL.revokeObjectURL(e($)), w($, null));
261
- }
262
- Ie(() => {
263
- q();
264
- }), ie();
265
- var D = gt(), I = o(D);
266
- {
267
- var T = (a) => {
268
- var n = st(), v = o(n), z = C(v, 2), f = o(z), l = o(f);
269
- oe(l, {
270
- variant: "secondary",
271
- size: "sm",
272
- get disabled() {
273
- return u();
274
- },
275
- $$events: { click: () => w(t, !0) },
276
- children: (h, L) => {
277
- var R = le("Change");
278
- i(h, R);
279
- },
280
- $$slots: { default: !0 }
281
- });
282
- var c = C(l, 2);
283
- oe(c, {
284
- variant: "danger",
285
- size: "sm",
286
- get disabled() {
287
- return u();
288
- },
289
- $$events: { click: G },
290
- children: (h, L) => {
291
- var R = le("Remove");
292
- i(h, R);
293
- },
294
- $$slots: { default: !0 }
295
- }), P(() => W(v, "src", s())), i(a, n);
296
- }, J = (a) => {
297
- var n = nt(), v = o(n), z = C(o(v), 2), f = o(z), l = o(f), c = C(z, 2), h = o(c);
298
- oe(h, {
299
- variant: "primary",
300
- size: "sm",
301
- get disabled() {
302
- return u();
303
- },
304
- $$events: { click: () => w(t, !0) },
305
- children: (L, R) => {
306
- var H = le("Upload File");
307
- i(L, H);
308
- },
309
- $$slots: { default: !0 }
310
- }), P(() => Z(l, F())), i(a, n);
311
- };
312
- j(I, (a) => {
313
- s() ? a(T) : a(J, !1);
314
- });
315
- }
316
- var m = C(I, 2);
317
- rt(m, {
318
- title: "Upload File",
319
- get isOpen() {
320
- return e(t);
321
- },
322
- set isOpen(a) {
323
- w(t, a);
324
- },
325
- $$events: {
326
- close: () => {
327
- w(t, !1), x();
328
- }
329
- },
330
- children: (a, n) => {
331
- var v = ut(), z = o(v);
332
- {
333
- var f = (c) => {
334
- var h = lt(), L = C(o(h), 2), R = C(L, 2), H = o(R);
335
- P(
336
- (_) => {
337
- W(L, "accept", M()), Z(H, `Max size: ${_ ?? ""}MB`);
338
- },
339
- [
340
- () => (k(g()), r(() => Math.round(g() / 1024 / 1024)))
341
- ]
342
- ), ee("change", L, B), i(c, h);
343
- }, l = (c) => {
344
- var h = ct(), L = o(h), R = o(L);
345
- {
346
- var H = (E) => {
347
- var N = ot();
348
- P(() => W(N, "src", e($))), i(E, N);
349
- }, _ = (E) => {
350
- var N = it(), ce = o(N), me = C(o(ce), 2), be = o(me);
351
- P(() => Z(be, (e(b), r(() => e(b).name)))), i(E, N);
352
- };
353
- j(R, (E) => {
354
- e(b), r(() => e(b).type.startsWith("image/")) ? E(H) : E(_, !1);
355
- });
356
- }
357
- var S = C(R, 2);
358
- {
359
- var K = (E) => {
360
- var N = vt();
361
- i(E, N);
362
- };
363
- j(S, (E) => {
364
- e(O) && E(K);
365
- });
366
- }
367
- var se = C(L, 2);
368
- {
369
- var te = (E) => {
370
- var N = dt(), ce = o(N), me = C(o(ce), 2), be = o(me), ke = C(ce, 2), we = o(ke);
371
- P(
372
- ($e) => {
373
- Z(be, `${$e ?? ""}%`), Ue(we, `width: ${e(A) ?? ""}%`);
374
- },
375
- [
376
- () => (e(A), r(() => Math.round(e(A))))
377
- ]
378
- ), i(E, N);
379
- };
380
- j(se, (E) => {
381
- e(O) && E(te);
382
- });
383
- }
384
- i(c, h);
385
- };
386
- j(z, (c) => {
387
- e(b) ? c(l, !1) : c(f);
388
- });
389
- }
390
- i(a, v);
391
- },
392
- $$slots: {
393
- default: !0,
394
- footer: (a, n) => {
395
- var v = ft(), z = X(v);
396
- oe(z, {
397
- variant: "secondary",
398
- $$events: {
399
- click: () => {
400
- w(t, !1), x();
401
- }
402
- },
403
- children: (c, h) => {
404
- var L = le("Cancel");
405
- i(c, L);
406
- },
407
- $$slots: { default: !0 }
408
- });
409
- var f = C(z, 2);
410
- {
411
- var l = (c) => {
412
- oe(c, {
413
- variant: "primary",
414
- get disabled() {
415
- return e(O);
416
- },
417
- get loading() {
418
- return e(O);
419
- },
420
- $$events: { click: V },
421
- children: (h, L) => {
422
- var R = le();
423
- P(() => Z(R, e(O) ? "Uploading..." : "Upload File")), i(h, R);
424
- },
425
- $$slots: { default: !0 }
426
- });
427
- };
428
- j(f, (c) => {
429
- e(b) && c(l);
430
- });
431
- }
432
- i(a, v);
433
- }
434
- },
435
- $$legacy: !0
436
- }), i(Y, D), ve();
437
- }
438
- var pt = y("<div><!></div>"), mt = y('<div class="flex flex-wrap gap-4"></div>');
439
- function Tt(Y, d) {
440
- de(d, !1);
441
- let s = U(d, "values", 28, () => ({})), u = U(d, "fields", 24, () => []);
442
- const M = pe();
443
- function g(p, t) {
444
- s({ ...s(), [p]: t }), M("input", { [p]: t }), M("change", { values: s() });
445
- }
446
- ie();
447
- var F = mt();
448
- ge(F, 5, u, (p) => p.key, (p, t) => {
449
- var b = pt(), $ = o(b);
450
- {
451
- var O = (B) => {
452
- {
453
- let V = he(() => (e(t), r(() => e(t).rows || 3)));
454
- Se(B, {
455
- get label() {
456
- return e(t), r(() => e(t).label);
457
- },
458
- get placeholder() {
459
- return e(t), r(() => e(t).placeholder);
460
- },
461
- get rows() {
462
- return e(V);
463
- },
464
- get required() {
465
- return e(t), r(() => e(t).required);
466
- },
467
- size: "sm",
468
- variant: "outlined",
469
- get value() {
470
- return s()[e(t).key];
471
- },
472
- set value(G) {
473
- s(s()[e(t).key] = G, !0);
474
- },
475
- $$events: { input: (G) => g(e(t).key, G.detail.value) },
476
- $$legacy: !0
477
- });
478
- }
479
- }, A = (B) => {
480
- var V = re(), G = X(V);
481
- {
482
- var x = (D) => {
483
- {
484
- let I = he(() => (e(t), r(() => e(t).options || [])));
485
- Fe(D, {
486
- get options() {
487
- return e(I);
488
- },
489
- get label() {
490
- return e(t), r(() => e(t).label);
491
- },
492
- get placeholder() {
493
- return e(t), r(() => e(t).placeholder);
494
- },
495
- get required() {
496
- return e(t), r(() => e(t).required);
497
- },
498
- size: "sm",
499
- variant: "outlined",
500
- get value() {
501
- return s()[e(t).key];
502
- },
503
- set value(T) {
504
- s(s()[e(t).key] = T, !0);
505
- },
506
- $$events: { change: (T) => g(e(t).key, T.detail.value) },
507
- $$legacy: !0
508
- });
509
- }
510
- }, q = (D) => {
511
- var I = re(), T = X(I);
512
- {
513
- var J = (a) => {
514
- Re(a, {
515
- get label() {
516
- return e(t), r(() => e(t).label);
517
- },
518
- get required() {
519
- return e(t), r(() => e(t).required);
520
- },
521
- size: "sm",
522
- variant: "outlined",
523
- get checked() {
524
- return s()[e(t).key];
525
- },
526
- set checked(n) {
527
- s(s()[e(t).key] = n, !0);
528
- },
529
- $$events: {
530
- change: (n) => g(e(t).key, n.detail.checked)
531
- },
532
- $$legacy: !0
533
- });
534
- }, m = (a) => {
535
- var n = re(), v = X(n);
536
- {
537
- var z = (l) => {
538
- Oe(l, {
539
- get label() {
540
- return e(t), r(() => e(t).label);
541
- },
542
- get checked() {
543
- return s()[e(t).key];
544
- },
545
- set checked(c) {
546
- s(s()[e(t).key] = c, !0);
547
- },
548
- $$events: { change: (c) => g(e(t).key, c.detail) },
549
- $$legacy: !0
550
- });
551
- }, f = (l) => {
552
- var c = re(), h = X(c);
553
- {
554
- var L = (H) => {
555
- Ve(H, {
556
- get label() {
557
- return e(t), r(() => e(t).label);
558
- },
559
- get required() {
560
- return e(t), r(() => e(t).required);
561
- },
562
- size: "sm",
563
- variant: "outlined",
564
- get value() {
565
- return s()[e(t).key];
566
- },
567
- set value(_) {
568
- s(s()[e(t).key] = _, !0);
569
- },
570
- $$events: { change: (_) => g(e(t).key, _.detail.value) },
571
- $$legacy: !0
572
- });
573
- }, R = (H) => {
574
- var _ = re(), S = X(_);
575
- {
576
- var K = (te) => {
577
- He(te, {
578
- get label() {
579
- return e(t), r(() => e(t).label);
580
- },
581
- get required() {
582
- return e(t), r(() => e(t).required);
583
- },
584
- size: "sm",
585
- get value() {
586
- return s()[e(t).key];
587
- },
588
- set value(E) {
589
- s(s()[e(t).key] = E, !0);
590
- },
591
- $$events: { change: (E) => g(e(t).key, E.detail.value) },
592
- $$legacy: !0
593
- });
594
- }, se = (te) => {
595
- {
596
- let E = he(() => (e(t), r(() => e(t).type || "text")));
597
- Ke(te, {
598
- get type() {
599
- return e(E);
600
- },
601
- get label() {
602
- return e(t), r(() => e(t).label);
603
- },
604
- get placeholder() {
605
- return e(t), r(() => e(t).placeholder);
606
- },
607
- get required() {
608
- return e(t), r(() => e(t).required);
609
- },
610
- size: "sm",
611
- variant: "outlined",
612
- get value() {
613
- return s()[e(t).key];
614
- },
615
- set value(N) {
616
- s(s()[e(t).key] = N, !0);
617
- },
618
- $$events: { input: (N) => g(e(t).key, N.detail.value) },
619
- $$legacy: !0
620
- });
621
- }
622
- };
623
- j(
624
- S,
625
- (te) => {
626
- e(t), r(() => e(t).type === "textalignment") ? te(K) : te(se, !1);
627
- },
628
- !0
629
- );
630
- }
631
- i(H, _);
632
- };
633
- j(
634
- h,
635
- (H) => {
636
- e(t), r(() => e(t).type === "colorpicker") ? H(L) : H(R, !1);
637
- },
638
- !0
639
- );
640
- }
641
- i(l, c);
642
- };
643
- j(
644
- v,
645
- (l) => {
646
- e(t), r(() => e(t).type === "toggle") ? l(z) : l(f, !1);
647
- },
648
- !0
649
- );
650
- }
651
- i(a, n);
652
- };
653
- j(
654
- T,
655
- (a) => {
656
- e(t), r(() => e(t).type === "checkbox") ? a(J) : a(m, !1);
657
- },
658
- !0
659
- );
660
- }
661
- i(D, I);
662
- };
663
- j(
664
- G,
665
- (D) => {
666
- e(t), r(() => e(t).type === "select") ? D(x) : D(q, !1);
667
- },
668
- !0
669
- );
670
- }
671
- i(B, V);
672
- };
673
- j($, (B) => {
674
- e(t), r(() => e(t).type === "textarea") ? B(O) : B(A, !1);
675
- });
676
- }
677
- P(() => ae(b, 1, `flex-${e(t), r(() => e(t).flex === "full" ? "none" : e(t).flex || "1") ?? ""} ${e(t), r(() => e(t).type === "textarea" || e(t).key === "title" || e(t).key === "subtitle" || e(t).flex === "full" ? "w-full" : "w-full sm:w-auto sm:flex-1") ?? ""} min-w-0 ${e(t), r(() => e(t).type === "toggle" ? "flex items-center justify-center" : "") ?? ""}`)), i(p, b);
678
- }), i(Y, F), ve();
679
- }
680
- var bt = De('<svg fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" clip-rule="evenodd" class="svelte-fn6h9a"></path></svg>'), ht = y(`<span class="
681
- ml-1 px-1.5 py-0.5 text-xs font-medium
682
- bg-primary-100 text-primary-800 rounded-full
683
- dark:bg-primary-900 dark:text-primary-200
684
- svelte-fn6h9a"> </span>`), xt = y('<div class="absolute bottom-0 left-0 right-0 h-0.5 bg-primary-500 rounded-full svelte-fn6h9a"></div>'), yt = y('<button type="button" role="tab"><!> <span class="svelte-fn6h9a"> </span> <!></button> <!>', 1), _t = y('<div role="tabpanel"><!></div>'), kt = y('<div><div role="tablist" tabindex="0"></div> <div class="tab-panels svelte-fn6h9a"></div></div>');
685
- const wt = {
686
- hash: "svelte-fn6h9a",
687
- code: `
688
- /* Focus styles for better accessibility */[role="tab"].svelte-fn6h9a:focus {outline:2px solid var(--color-primary-500);outline-offset:2px;}
689
-
690
- /* Smooth transitions */[role="tab"].svelte-fn6h9a {transition:all 0.2s cubic-bezier(0.4, 0, 0.2, 1);}
691
-
692
- /* Underline animation */.underline-indicator.svelte-fn6h9a {transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);}
693
-
694
- /* Badge animation */.tab-badge.svelte-fn6h9a {
695
- animation: svelte-fn6h9a-badge-pulse 2s infinite;}
696
-
697
- @keyframes svelte-fn6h9a-badge-pulse {
698
- 0%,
699
- 100% {
700
- opacity: 1;
701
- }
702
- 50% {
703
- opacity: 0.7;
704
- }
705
- }
706
-
707
- /* Vertical tabs specific styles */.tabs-container.vertical.svelte-fn6h9a {align-items:flex-start;}.tabs-container.vertical.svelte-fn6h9a [role="tablist"]:where(.svelte-fn6h9a) {min-width:200px;}.tabs-container.vertical.svelte-fn6h9a [role="tab"]:where(.svelte-fn6h9a) {justify-content:flex-start;text-align:left;}`
708
- };
709
- function Ut(Y, d) {
710
- de(d, !1), qe(Y, wt);
711
- let s = U(d, "tabs", 24, () => []), u = U(d, "activeTab", 12, ""), M = U(d, "variant", 8, "default"), g = U(d, "size", 8, "md"), F = U(d, "orientation", 8, "horizontal"), p = U(d, "fullWidth", 8, !1), t = U(d, "className", 8, "");
712
- const b = pe();
713
- let $ = Q(), O = Q(), A = Q(0);
714
- const B = {
715
- sm: { tab: "px-3 py-1.5 text-sm", panel: "p-3", icon: "w-4 h-4" },
716
- md: { tab: "px-4 py-2 text-base", panel: "p-4", icon: "w-5 h-5" },
717
- lg: { tab: "px-6 py-3 text-lg", panel: "p-6", icon: "w-6 h-6" }
718
- }, V = {
719
- default: {
720
- container: "border-b border-primary",
721
- tab: "border-b-2 border-transparent text-secondary hover:text-primary hover:border-primary-hover transition-colors",
722
- activeTab: "border-primary text-primary",
723
- panel: "mt-4"
724
- },
725
- pills: {
726
- container: "bg-surface-secondary p-1 rounded-lg",
727
- tab: "rounded-md text-secondary hover:text-primary hover:bg-surface-tertiary transition-colors",
728
- activeTab: "bg-surface text-primary shadow-adaptive-sm",
729
- panel: "mt-4"
730
- },
731
- underline: {
732
- container: "border-b border-primary",
733
- tab: "relative text-secondary hover:text-primary transition-colors",
734
- activeTab: "text-primary",
735
- panel: "mt-4"
736
- },
737
- cards: {
738
- container: "space-y-2",
739
- tab: "border border-primary rounded-lg text-secondary hover:text-primary hover:bg-surface-secondary transition-colors",
740
- activeTab: "bg-surface text-primary shadow-adaptive-sm border-primary",
741
- panel: "mt-4"
742
- }
743
- };
744
- function G(m, a) {
745
- if (m.disabled) {
746
- a.preventDefault();
747
- return;
748
- }
749
- u(m.id), b("change", { activeTab: u(), tab: m }), b("tabClick", { tab: m, event: a });
750
- }
751
- function x(m) {
752
- if (!e($)) return;
753
- const a = Array.from(e($).querySelectorAll('[role="tab"]')), n = a.findIndex((z) => z === document.activeElement);
754
- let v = n;
755
- switch (m.key) {
756
- case "ArrowRight":
757
- case "ArrowDown":
758
- m.preventDefault(), v = (n + 1) % a.length;
759
- break;
760
- case "ArrowLeft":
761
- case "ArrowUp":
762
- m.preventDefault(), v = n === 0 ? a.length - 1 : n - 1;
763
- break;
764
- case "Home":
765
- m.preventDefault(), v = 0;
766
- break;
767
- case "End":
768
- m.preventDefault(), v = a.length - 1;
769
- break;
770
- case "Enter":
771
- case " ":
772
- m.preventDefault();
773
- const z = a[n];
774
- z && z.click();
775
- return;
776
- }
777
- v !== n && a[v] && a[v].focus();
778
- }
779
- function q(m) {
780
- var n;
781
- const a = (n = e($)) == null ? void 0 : n.querySelector(`[data-tab-id="${m}"]`);
782
- a == null || a.focus();
783
- }
784
- ne(() => (k(s()), k(u())), () => {
785
- s().length > 0 && !u() && u(s()[0].id);
786
- }), ne(() => (k(s()), k(u())), () => {
787
- w(A, s().findIndex((m) => m.id === u()));
788
- }), _e();
789
- var D = { focusTab: q };
790
- ie();
791
- var I = kt(), T = o(I);
792
- ge(T, 5, s, xe, (m, a) => {
793
- var n = yt(), v = X(n), z = o(v);
794
- {
795
- var f = (_) => {
796
- var S = bt(), K = o(S);
797
- P(() => {
798
- ae(
799
- S,
800
- 0,
801
- Le((k(g()), r(() => B[g()].icon))),
802
- "svelte-fn6h9a"
803
- ), W(K, "d", (e(a), r(() => e(a).icon)));
804
- }), i(_, S);
805
- };
806
- j(z, (_) => {
807
- e(a), r(() => e(a).icon) && _(f);
808
- });
809
- }
810
- var l = C(z, 2), c = o(l), h = C(l, 2);
811
- {
812
- var L = (_) => {
813
- var S = ht(), K = o(S);
814
- P(() => Z(K, (e(a), r(() => e(a).badge)))), i(_, S);
815
- };
816
- j(h, (_) => {
817
- e(a), r(() => e(a).badge) && _(L);
818
- });
819
- }
820
- var R = C(v, 2);
821
- {
822
- var H = (_) => {
823
- var S = xt();
824
- i(_, S);
825
- };
826
- j(R, (_) => {
827
- k(M()), e(a), k(u()), r(() => M() === "underline" && e(a).id === u()) && _(H);
828
- });
829
- }
830
- P(() => {
831
- W(v, "data-tab-id", (e(a), r(() => e(a).id))), ae(
832
- v,
833
- 1,
834
- `
835
- ${k(g()), r(() => B[g()].tab) ?? ""}
836
- ${k(M()), r(() => V[M()].tab) ?? ""}
837
- ${e(a), k(u()), k(M()), r(() => e(a).id === u() ? V[M()].activeTab : "") ?? ""}
838
- ${e(a), r(() => e(a).disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer") ?? ""}
839
- ${p() ? "flex-1" : ""}
840
- flex items-center justify-center gap-2
841
- `,
842
- "svelte-fn6h9a"
843
- ), W(v, "aria-selected", (e(a), k(u()), r(() => e(a).id === u()))), W(v, "aria-controls", `tabpanel-${e(a), r(() => e(a).id) ?? ""}`), W(v, "aria-disabled", (e(a), r(() => e(a).disabled))), W(v, "tabindex", (e(a), k(u()), r(() => e(a).id === u() ? 0 : -1))), Z(c, (e(a), r(() => e(a).label)));
844
- }), ee("click", v, (_) => G(e(a), _)), i(m, n);
845
- }), ye(T, (m) => w($, m), () => e($));
846
- var J = C(T, 2);
847
- return ge(J, 5, s, xe, (m, a) => {
848
- var n = _t(), v = o(n);
849
- {
850
- var z = (f) => {
851
- var l = re(), c = X(l);
852
- fe(c, d, "content", {}, null), i(f, l);
853
- };
854
- j(v, (f) => {
855
- e(a), k(u()), r(() => e(a).id === u()) && f(z);
856
- });
857
- }
858
- P(() => {
859
- W(n, "id", `tabpanel-${e(a), r(() => e(a).id) ?? ""}`), W(n, "aria-labelledby", `tab-${e(a), r(() => e(a).id) ?? ""}`), ae(
860
- n,
861
- 1,
862
- `
863
- ${k(g()), r(() => B[g()].panel) ?? ""}
864
- ${k(M()), r(() => V[M()].panel) ?? ""}
865
- ${e(a), k(u()), r(() => e(a).id === u() ? "block" : "hidden") ?? ""}
866
- `,
867
- "svelte-fn6h9a"
868
- );
869
- }), Ee(3, n, () => Pe, () => ({ duration: 200 })), i(m, n);
870
- }), ye(J, (m) => w(O, m), () => e(O)), P(() => {
871
- ae(I, 1, `tabs-container ${F() === "vertical" ? "flex" : ""} ${t() ?? ""}`, "svelte-fn6h9a"), ae(
872
- T,
873
- 1,
874
- `
875
- ${k(M()), r(() => V[M()].container) ?? ""}
876
- ${F() === "vertical" ? "flex-col space-y-1 mr-4" : ""}
877
- ${k(p()), k(s()), r(() => p() ? "grid grid-cols-" + s().length : "flex") ?? ""}
878
- `,
879
- "svelte-fn6h9a"
880
- ), W(T, "aria-orientation", F());
881
- }), ee("keydown", T, x), i(Y, I), Be(d, "focusTab", q), ve(D);
882
- }
883
- export {
884
- Mt as A,
885
- jt as I,
886
- Tt as K,
887
- rt as M,
888
- Ut as T
889
- };