zabi-components 3.0.2 → 4.0.0

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,259 +0,0 @@
1
- import { y as W, l as C, p as s, z as f, A, i as T, f as B, a as q, s as X, c as V, d as E, g as R, x as y, k as t, m as o, h as k, o as i, b as F, e as G, j as H, t as J, v as K, u as L, B as O, n as Q } from "./props-B4BdFk2B.js";
2
- function se(a, e) {
3
- W(() => {
4
- var r = a.getRootNode(), d = (
5
- /** @type {ShadowRoot} */
6
- r.host ? (
7
- /** @type {ShadowRoot} */
8
- r
9
- ) : (
10
- /** @type {Document} */
11
- r.head ?? /** @type {Document} */
12
- r.ownerDocument.head
13
- )
14
- );
15
- if (!d.querySelector("#" + e.hash)) {
16
- const n = document.createElement("style");
17
- n.id = e.hash, n.textContent = e.code, d.appendChild(n);
18
- }
19
- });
20
- }
21
- var Y = B("<button><!></button>");
22
- function re(a, e) {
23
- const r = C(e, ["children", "$$slots", "$$events", "$$legacy"]), d = C(r, ["variant", "size", "disabled", "type", "className"]);
24
- R(e, !1);
25
- const n = o(), u = o(), b = o();
26
- let v = s(e, "variant", 8, "primary"), p = s(e, "size", 8, "md"), h = s(e, "disabled", 8, !1), w = s(e, "type", 8, "button"), _ = s(e, "className", 8, "");
27
- f(() => {
28
- }, () => {
29
- i(n, {
30
- sm: "px-3 py-1.5 text-sm font-medium",
31
- md: "px-4 py-2 text-sm font-medium",
32
- lg: "px-6 py-3 text-base font-semibold"
33
- });
34
- }), f(() => {
35
- }, () => {
36
- i(u, {
37
- primary: "bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:bg-blue-400",
38
- secondary: "bg-gray-600 text-white hover:bg-gray-700 active:bg-gray-800 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:bg-gray-400",
39
- danger: "bg-red-600 text-white hover:bg-red-700 active:bg-red-800 focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:bg-red-400",
40
- success: "bg-green-600 text-white hover:bg-green-700 active:bg-green-800 focus:ring-2 focus:ring-green-500 focus:ring-offset-2 disabled:bg-green-400",
41
- ghost: "bg-transparent text-gray-700 hover:bg-gray-100 active:bg-gray-200 focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 disabled:text-gray-400",
42
- brand: "bg-purple-600 text-white hover:bg-purple-700 active:bg-purple-800 focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 disabled:bg-purple-400"
43
- });
44
- }), f(
45
- () => (t(n), y(p()), t(u), y(v()), y(_())),
46
- () => {
47
- i(b, [
48
- "inline-flex items-center justify-center rounded-md transition-all duration-200",
49
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:pointer-events-none",
50
- "focus:outline-none focus:ring-2 focus:ring-offset-2",
51
- "active:scale-95 transform-gpu",
52
- "shadow-sm hover:shadow-md",
53
- t(n)[p()],
54
- t(u)[v()],
55
- _()
56
- ].filter(Boolean).join(" "));
57
- }
58
- ), A(), T();
59
- var m = Y();
60
- q(m, () => ({
61
- type: w(),
62
- class: t(b),
63
- disabled: h(),
64
- ...d
65
- }));
66
- var x = k(m);
67
- X(x, e, "default", {}), V(a, m), E();
68
- }
69
- function U(a) {
70
- const e = {
71
- default: "input-variant-default",
72
- success: "input-variant-success",
73
- warning: "input-variant-warning",
74
- error: "input-variant-error",
75
- info: "input-variant-info"
76
- };
77
- return e[a] || e.default;
78
- }
79
- function ne(a) {
80
- const e = {
81
- default: "card-variant-default",
82
- success: "card-variant-success",
83
- warning: "card-variant-warning",
84
- error: "card-variant-error",
85
- info: "card-variant-info"
86
- };
87
- return e[a] || e.default;
88
- }
89
- function S(a, e) {
90
- const r = {
91
- default: `variant-${e}-default`,
92
- success: `variant-${e}-success`,
93
- warning: `variant-${e}-warning`,
94
- error: `variant-${e}-error`,
95
- info: `variant-${e}-info`
96
- };
97
- return r[a] || r.default;
98
- }
99
- function ie(a) {
100
- return {
101
- border: S(a, "border"),
102
- text: S(a, "text"),
103
- bg: S(a, "bg")
104
- };
105
- }
106
- function le(a, e) {
107
- return a.reduce((r, d) => (r[d] = `${e}-${d}`, r), {});
108
- }
109
- var Z = B("<label> </label>"), $ = B("<div><!> <input/></div>");
110
- function oe(a, e) {
111
- const r = C(e, ["children", "$$slots", "$$events", "$$legacy"]), d = C(r, [
112
- "value",
113
- "type",
114
- "label",
115
- "placeholder",
116
- "disabled",
117
- "size",
118
- "variant"
119
- ]);
120
- R(e, !1);
121
- const n = o(), u = o(), b = o(), v = o();
122
- let p = s(e, "value", 12, ""), h = s(e, "type", 8, "text"), w = s(e, "label", 8, ""), _ = s(e, "placeholder", 8, ""), m = s(e, "disabled", 8, !1), x = s(e, "size", 8, "md"), z = s(e, "variant", 8, "default"), g = o();
123
- typeof window < "u" ? i(g, `input-${Math.random().toString(36).substr(2, 9)}`) : i(g, `input-ssr-${Date.now()}`);
124
- function N(c) {
125
- const l = c.target;
126
- p(l.value);
127
- }
128
- f(() => {
129
- }, () => {
130
- i(n, {
131
- sm: "px-3 py-1.5 text-sm",
132
- md: "px-4 py-2 text-sm",
133
- lg: "px-5 py-3 text-base"
134
- });
135
- }), f(() => y(z()), () => {
136
- i(u, U(z()));
137
- }), f(
138
- () => (t(n), y(x()), t(u)),
139
- () => {
140
- i(b, [
141
- "w-full rounded-md transition-colors duration-200",
142
- "focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
143
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
144
- t(n)[x()],
145
- t(u)
146
- ].join(" "));
147
- }
148
- ), f(() => {
149
- }, () => {
150
- i(v, "block text-sm font-medium text-primary mb-1");
151
- }), A(), T();
152
- var I = $(), M = k(I);
153
- {
154
- var D = (c) => {
155
- var l = Z(), P = k(l);
156
- J(() => {
157
- K(l, "for", t(g)), L(l, 1, O(t(v))), Q(P, w());
158
- }), V(c, l);
159
- };
160
- F(M, (c) => {
161
- w() && c(D);
162
- });
163
- }
164
- var j = H(M, 2);
165
- q(
166
- j,
167
- () => ({
168
- id: t(g),
169
- type: h(),
170
- value: p(),
171
- placeholder: _(),
172
- disabled: m(),
173
- class: t(b),
174
- ...d
175
- }),
176
- void 0,
177
- void 0,
178
- void 0,
179
- !0
180
- ), G("input", j, N), V(a, I), E();
181
- }
182
- var ee = B("<label> </label>"), te = B("<div><!> <textarea></textarea></div>");
183
- function de(a, e) {
184
- const r = C(e, ["children", "$$slots", "$$events", "$$legacy"]), d = C(r, [
185
- "value",
186
- "label",
187
- "placeholder",
188
- "disabled",
189
- "rows",
190
- "size",
191
- "variant"
192
- ]);
193
- R(e, !1);
194
- const n = o(), u = o(), b = o(), v = o();
195
- let p = s(e, "value", 12, ""), h = s(e, "label", 8, ""), w = s(e, "placeholder", 8, ""), _ = s(e, "disabled", 8, !1), m = s(e, "rows", 8, 4), x = s(e, "size", 8, "md"), z = s(e, "variant", 8, "default"), g = o();
196
- typeof window < "u" ? i(g, `textarea-${Math.random().toString(36).substr(2, 9)}`) : i(g, `textarea-ssr-${Date.now()}`);
197
- function N(c) {
198
- const l = c.target;
199
- p(l.value);
200
- }
201
- f(() => {
202
- }, () => {
203
- i(n, {
204
- sm: "px-3 py-1.5 text-sm",
205
- md: "px-4 py-2 text-sm",
206
- lg: "px-5 py-3 text-base"
207
- });
208
- }), f(() => y(z()), () => {
209
- i(u, U(z()));
210
- }), f(
211
- () => (t(n), y(x()), t(u)),
212
- () => {
213
- i(b, [
214
- "w-full rounded-md transition-colors duration-200",
215
- "focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface",
216
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-surface-disabled",
217
- "resize-y",
218
- t(n)[x()],
219
- t(u)
220
- ].join(" "));
221
- }
222
- ), f(() => {
223
- }, () => {
224
- i(v, "block text-sm font-medium text-primary mb-1");
225
- }), A(), T();
226
- var I = te(), M = k(I);
227
- {
228
- var D = (c) => {
229
- var l = ee(), P = k(l);
230
- J(() => {
231
- K(l, "for", t(g)), L(l, 1, O(t(v))), Q(P, h());
232
- }), V(c, l);
233
- };
234
- F(M, (c) => {
235
- h() && c(D);
236
- });
237
- }
238
- var j = H(M, 2);
239
- q(j, () => ({
240
- id: t(g),
241
- value: p(),
242
- placeholder: w(),
243
- disabled: _(),
244
- rows: m(),
245
- class: t(b),
246
- ...d
247
- })), G("input", j, N), V(a, I), E();
248
- }
249
- export {
250
- re as B,
251
- oe as I,
252
- de as T,
253
- ne as a,
254
- S as b,
255
- ie as c,
256
- le as d,
257
- se as e,
258
- U as g
259
- };
@@ -1,42 +0,0 @@
1
- import { l as c, p as h, i as v, f as n, a as b, b as k, e as _, c as r, d as y, g as T, h as w } from "./props-B4BdFk2B.js";
2
- import { onMount as x } from "svelte";
3
- var D = n('<span class="text-lg">☀️</span>'), S = n('<span class="text-lg">🌙</span>'), $ = n("<button><!></button>");
4
- function L(i, o) {
5
- const d = c(o, ["children", "$$slots", "$$events", "$$legacy"]), m = c(d, ["isDark"]);
6
- T(o, !1);
7
- let t = h(o, "isDark", 12, !1);
8
- x(() => {
9
- const e = localStorage.getItem("theme"), a = window.matchMedia("(prefers-color-scheme: dark)").matches;
10
- t(e === "dark" || !e && a), l();
11
- });
12
- function g(e) {
13
- t(!t()), l(), localStorage.setItem("theme", t() ? "dark" : "light");
14
- }
15
- function l() {
16
- t() ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark");
17
- }
18
- v();
19
- var s = $();
20
- b(s, () => ({
21
- class: "w-10 h-10 bg-gray-100 hover:bg-gray-200 border border-gray-300 rounded-lg flex items-center justify-center text-gray-700 focus:outline-none focus:ring-2 focus:ring-blue-500",
22
- "aria-label": t() ? "Switch to light mode" : "Switch to dark mode",
23
- ...m
24
- }));
25
- var f = w(s);
26
- {
27
- var p = (e) => {
28
- var a = D();
29
- r(e, a);
30
- }, u = (e) => {
31
- var a = S();
32
- r(e, a);
33
- };
34
- k(f, (e) => {
35
- t() ? e(p) : e(u, !1);
36
- });
37
- }
38
- _("click", s, g), r(i, s), y();
39
- }
40
- export {
41
- L as T
42
- };