fiboui 2.0.0 → 2.2.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,74 +1,79 @@
1
1
  "use client";
2
- var O = Object.defineProperty;
3
- var P = (o, i, e) => i in o ? O(o, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[i] = e;
4
- var r = (o, i, e) => P(o, typeof i != "symbol" ? i + "" : i, e);
5
- import t, { useState as T, useEffect as F, useRef as M } from "react";
6
- import { h as $, F as D, S as q } from "./builder-DjLYXkXu.js";
7
- import { t as B } from "./bundle-mjs-wppB-TKB.js";
8
- const V = t.memo((o) => {
2
+ var H = Object.defineProperty;
3
+ var O = (c, l, e) => l in c ? H(c, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[l] = e;
4
+ var r = (c, l, e) => O(c, typeof l != "symbol" ? l + "" : l, e);
5
+ import t, { useState as F, useEffect as M, useRef as j } from "react";
6
+ import { v as $, F as D, S as P } from "./builder-KLTu7nAI.js";
7
+ import { t as L } from "./bundle-mjs-wppB-TKB.js";
8
+ const q = t.memo((c) => {
9
9
  const {
10
- text: i,
10
+ text: l,
11
11
  variant: e,
12
- size: l,
12
+ size: o,
13
13
  onPress: a,
14
- disabled: s,
15
- icon: d,
16
- shape: u,
17
- shadow: y,
18
- tone: w,
14
+ onHover: s,
15
+ disabled: d,
16
+ icon: h,
17
+ shape: p,
18
+ shadow: k,
19
+ tone: v,
19
20
  motion: x,
20
- expand: f,
21
- className: k,
22
- style: v,
23
- ...g
24
- } = o, _ = {
21
+ expand: E,
22
+ className: _,
23
+ style: y,
24
+ ...f
25
+ } = c, g = {
25
26
  xs: "px-[21px] py-[8px] text-[10px] gap-[6px] h-auto tracking-[0.12em] font-normal",
26
27
  sm: "px-[14px] py-[6px] text-[13px] gap-[6px] h-[32px]",
27
28
  md: "px-[22px] py-[10px] text-[15px] gap-[8px] h-[44px]",
28
29
  lg: "px-[32px] py-[16px] text-[17px] gap-[10px] h-[56px]"
29
30
  };
30
- let m = "rounded-[14px]";
31
- u === "pill" ? m = "rounded-full" : u === "square" ? m = "rounded-[12px]" : u === "rect" ? m = "rounded-[2px]" : u === "rounded" ? m = "rounded-[8px]" : u === "sharp" && (m = "rounded-none");
32
- const I = w === "inverse";
33
- let p = "";
34
- e === "ghost" ? p = I ? "bg-transparent text-white shadow-none border border-transparent" : "bg-transparent text-gray-600 shadow-none border border-transparent hover:bg-gray-100" : e === "text" ? p = I ? "bg-transparent text-white shadow-none border-none px-2" : "bg-transparent text-gray-600 shadow-none border-none px-2 hover:bg-gray-100" : e === "soft" ? p = "bg-indigo-50 text-indigo-600 shadow-none border-none hover:bg-indigo-100" : e === "outline" || e === "outlined" ? p = I ? "bg-black text-white shadow-none border border-[#3b3b3b]" : "bg-transparent border-[1.5px] border-gray-200 text-gray-700 shadow-none hover:bg-gray-50" : e === "solid" ? p = I ? "bg-[#f2f2f2] text-black shadow-none border border-[#f2f2f2]" : "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-none border-none hover:opacity-90" : e === "filled" || e === "primary" ? p = "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-sm border-none hover:opacity-90 active:opacity-100" : e === "elevated" ? p = "bg-[var(--fibo-surface)] text-[var(--fibo-primary)] shadow-md border-none hover:shadow-lg" : e === "tonal" ? p = "bg-[var(--fibo-secondary-container)] text-[var(--fibo-on-secondary-container)] shadow-sm border-none" : e === "raw" && (p = "bg-transparent border-none shadow-none p-0 h-auto gap-0 text-inherit font-inherit hover:bg-transparent", m = ""), y === "soft" && e !== "raw" && (p += " shadow-[0_8px_20px_-6px_rgba(59,130,246,0.4)]");
35
- const b = v || {}, L = b.padding !== void 0 || b.paddingTop !== void 0 || b.paddingBottom !== void 0 || b.paddingLeft !== void 0 || b.paddingRight !== void 0 || b.fontSize !== void 0 || b.height !== void 0, N = b.borderRadius !== void 0, E = b.fontWeight !== void 0 || l === "xs" || I, z = e === "raw" || x === "none" || I || l === "xs", n = B(
31
+ let S = "rounded-[14px]";
32
+ p === "pill" ? S = "rounded-full" : p === "square" ? S = "rounded-[12px]" : p === "rect" ? S = "rounded-[2px]" : p === "rounded" ? S = "rounded-[8px]" : p === "sharp" && (S = "rounded-none");
33
+ const m = v === "inverse";
34
+ let b = "";
35
+ e === "ghost" ? b = m ? "bg-transparent text-white shadow-none border border-transparent" : "bg-transparent text-gray-600 shadow-none border border-transparent hover:bg-gray-100" : e === "text" ? b = m ? "bg-transparent text-white shadow-none border-none px-2" : "bg-transparent text-gray-600 shadow-none border-none px-2 hover:bg-gray-100" : e === "soft" ? b = "bg-indigo-50 text-indigo-600 shadow-none border-none hover:bg-indigo-100" : e === "outline" || e === "outlined" ? b = m ? "bg-black text-white shadow-none border border-[#3b3b3b]" : "bg-transparent border-[1.5px] border-gray-200 text-gray-700 shadow-none hover:bg-gray-50" : e === "solid" ? b = m ? "bg-[#f2f2f2] text-black shadow-none border border-[#f2f2f2]" : "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-none border-none hover:opacity-90" : e === "filled" || e === "primary" ? b = "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-sm border-none hover:opacity-90 active:opacity-100" : e === "elevated" ? b = "bg-[var(--fibo-surface)] text-[var(--fibo-primary)] shadow-md border-none hover:shadow-lg" : e === "tonal" ? b = "bg-[var(--fibo-secondary-container)] text-[var(--fibo-on-secondary-container)] shadow-sm border-none" : e === "raw" && (b = "bg-transparent border-none shadow-none p-0 h-auto gap-0 text-inherit font-inherit hover:bg-transparent", S = ""), k === "soft" && e !== "raw" && (b += " shadow-[0_8px_20px_-6px_rgba(59,130,246,0.4)]");
36
+ const w = y || {}, I = w.padding !== void 0 || w.paddingTop !== void 0 || w.paddingBottom !== void 0 || w.paddingLeft !== void 0 || w.paddingRight !== void 0 || w.fontSize !== void 0 || w.height !== void 0, C = w.borderRadius !== void 0, z = w.fontWeight !== void 0 || o === "xs" || m, n = e === "raw" || x === "none" || m || o === "xs", u = L(
36
37
  "fibo-button",
37
38
  "inline-flex items-center justify-center whitespace-nowrap",
38
- E ? "" : "font-semibold",
39
- z ? "" : "active:scale-[0.96] transform transition-all duration-200 ease-out",
40
- s ? "cursor-not-allowed opacity-60" : "cursor-pointer",
41
- e === "raw" || L ? "" : _[l],
42
- e === "raw" || N ? "" : m,
43
- f ? "flex-1 w-full" : "",
39
+ z ? "" : "font-semibold",
40
+ n ? "" : "active:scale-[0.96] transform transition-all duration-200 ease-out",
41
+ d ? "cursor-not-allowed opacity-60" : "cursor-pointer",
42
+ e === "raw" || I ? "" : g[o],
43
+ e === "raw" || C ? "" : S,
44
+ E ? "flex-1 w-full" : "",
44
45
  `fibo-button-${e}`,
45
- p,
46
- k
47
- ), h = [];
48
- return d && h.push(d), i && h.push(i), o.children && (Array.isArray(o.children) ? h.push(...o.children) : h.push(o.children)), t.createElement(
46
+ b,
47
+ _
48
+ ), A = [];
49
+ return h && A.push(h), l && A.push(l), c.children && (Array.isArray(c.children) ? A.push(...c.children) : A.push(c.children)), t.createElement(
49
50
  "button",
50
51
  {
51
- className: n,
52
- onClick: (S) => {
53
- s || (!z && document.documentElement.classList.contains("fibo-theme-material") && e !== "raw" && import("./effects-CnevV566.js").then(({ createRipple: j }) => {
54
- j(S, S.currentTarget);
52
+ className: u,
53
+ onMouseEnter: s ? () => {
54
+ d || s();
55
+ } : f.onMouseEnter,
56
+ onClick: (T) => {
57
+ d || (!n && document.documentElement.classList.contains("fibo-theme-material") && e !== "raw" && import("./effects-CnevV566.js").then(({ createRipple: i }) => {
58
+ i(T, T.currentTarget);
55
59
  }), a == null || a());
56
60
  },
57
- disabled: s,
58
- ...g,
59
- type: g.type ?? "button",
60
- style: b
61
+ disabled: d,
62
+ ...f,
63
+ type: f.type ?? "button",
64
+ style: w
61
65
  },
62
- ...h
66
+ ...A
63
67
  );
64
68
  });
65
- class W extends D {
69
+ class V extends D {
66
70
  constructor(e = "") {
67
71
  super();
68
72
  r(this, "_text", "");
69
73
  r(this, "_variant", "elevated");
70
74
  r(this, "_size", "md");
71
75
  r(this, "_onPress");
76
+ r(this, "_onHover");
72
77
  r(this, "_disabled", !1);
73
78
  r(this, "_icon");
74
79
  r(this, "_shape", "default");
@@ -93,6 +98,9 @@ class W extends D {
93
98
  onPress(e) {
94
99
  return this._onPress = e, this;
95
100
  }
101
+ onHover(e) {
102
+ return this._onHover = e, this;
103
+ }
96
104
  disabled(e = !0) {
97
105
  return this._disabled = e, this;
98
106
  }
@@ -120,6 +128,7 @@ class W extends D {
120
128
  variant: this._variant,
121
129
  size: this._size,
122
130
  onPress: this._onPress,
131
+ onHover: this._onHover,
123
132
  disabled: this._disabled,
124
133
  icon: this._icon,
125
134
  shape: this._shape,
@@ -132,85 +141,85 @@ class W extends D {
132
141
  children: this.processChildren(),
133
142
  ...this._props
134
143
  };
135
- return t.createElement(V, a);
144
+ return t.createElement(q, a);
136
145
  }
137
146
  }
138
- const de = $(W), H = (o, i) => {
147
+ const de = $(V), W = (c, l) => {
139
148
  let e = 0;
140
- const l = o.replace(/\D/g, "").split("");
149
+ const o = c.replace(/\D/g, "").split("");
141
150
  let a = "";
142
- for (let s = 0; s < i.length && !(e >= l.length); s++)
143
- i[s] === "9" ? a += l[e++] : a += i[s];
151
+ for (let s = 0; s < l.length && !(e >= o.length); s++)
152
+ l[s] === "9" ? a += o[e++] : a += l[s];
144
153
  return a;
145
- }, K = t.memo((o) => {
146
- const i = t.useId(), e = o.id || i, [l, a] = t.useState(!1), {
154
+ }, K = t.memo((c) => {
155
+ const l = t.useId(), e = c.id || l, [o, a] = t.useState(!1), {
147
156
  containerClass: s,
148
157
  containerStyle: d,
149
- label: u,
150
- error: y,
151
- mask: w,
152
- type: x,
153
- value: f,
154
- onChange: k,
155
- leadingIcon: v,
156
- trailingIcon: g,
157
- ..._
158
- } = o, m = f instanceof q, [I, p] = T(m ? f.value : f);
159
- F(() => {
160
- if (m)
161
- return f.subscribe((h) => {
162
- p(h);
158
+ label: h,
159
+ error: p,
160
+ mask: k,
161
+ type: v,
162
+ value: x,
163
+ onChange: E,
164
+ leadingIcon: _,
165
+ trailingIcon: y,
166
+ ...f
167
+ } = c, g = x instanceof P, [S, m] = F(g ? x.value : x);
168
+ M(() => {
169
+ if (g)
170
+ return x.subscribe((u) => {
171
+ m(u);
163
172
  });
164
- p(f);
165
- }, [f, m]);
166
- const b = x === "password", L = b && l ? "text" : x, N = (n) => {
167
- let h = n.target.value;
168
- if (w) {
169
- h = H(h, w);
170
- const S = {
173
+ m(x);
174
+ }, [x, g]);
175
+ const b = v === "password", w = b && o ? "text" : v, I = (n) => {
176
+ let u = n.target.value;
177
+ if (k) {
178
+ u = W(u, k);
179
+ const A = {
171
180
  ...n,
172
181
  target: {
173
182
  ...n.target,
174
- value: h
183
+ value: u
175
184
  }
176
185
  };
177
- m && (f.value = h), k == null || k(S);
186
+ g && (x.value = u), E == null || E(A);
178
187
  } else
179
- m && (f.value = h), k == null || k(n);
180
- }, E = v ? "2.75rem" : "1rem", z = g || b ? "2.75rem" : "1rem";
188
+ g && (x.value = u), E == null || E(n);
189
+ }, C = _ ? "2.75rem" : "1rem", z = y || b ? "2.75rem" : "1rem";
181
190
  return t.createElement(
182
191
  "div",
183
192
  { className: s, style: d },
184
193
  t.createElement("div", { className: "relative w-full h-full flex items-center" }, [
185
- v && t.createElement(
194
+ _ && t.createElement(
186
195
  "div",
187
196
  {
188
197
  key: "leading-icon",
189
198
  className: "absolute left-3 top-1/2 transform -translate-y-1/2 flex items-center justify-center pointer-events-none z-10"
190
199
  },
191
- v
200
+ _
192
201
  ),
193
202
  t.createElement("input", {
194
203
  key: "input",
195
204
  id: e,
196
205
  className: "fibo-textfield-input w-full h-full bg-transparent outline-none py-2.5 text-sm",
197
- style: { paddingLeft: E, paddingRight: z },
198
- type: L,
199
- onChange: N,
200
- value: I,
201
- ..._
206
+ style: { paddingLeft: C, paddingRight: z },
207
+ type: w,
208
+ onChange: I,
209
+ value: S,
210
+ ...f
202
211
  }),
203
- u && t.createElement(
212
+ h && t.createElement(
204
213
  "label",
205
214
  {
206
215
  key: "label",
207
216
  htmlFor: e,
208
217
  className: "fibo-textfield-label",
209
- style: { left: v ? "2.75rem" : "1rem" }
218
+ style: { left: _ ? "2.75rem" : "1rem" }
210
219
  },
211
- u
220
+ h
212
221
  ),
213
- (g || b) && t.createElement(
222
+ (y || b) && t.createElement(
214
223
  "div",
215
224
  {
216
225
  key: "trailing-icon",
@@ -221,10 +230,10 @@ const de = $(W), H = (o, i) => {
221
230
  {
222
231
  type: "button",
223
232
  className: "text-gray-400 hover:text-gray-600 focus:outline-none",
224
- onClick: () => a(!l),
233
+ onClick: () => a(!o),
225
234
  tabIndex: -1
226
235
  },
227
- l ? t.createElement(
236
+ o ? t.createElement(
228
237
  "svg",
229
238
  { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" },
230
239
  t.createElement("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
@@ -235,13 +244,13 @@ const de = $(W), H = (o, i) => {
235
244
  t.createElement("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
236
245
  t.createElement("circle", { cx: 12, cy: 12, r: 3 })
237
246
  )
238
- ) : g
247
+ ) : y
239
248
  )
240
249
  ]),
241
- y && t.createElement(
250
+ p && t.createElement(
242
251
  "span",
243
252
  { className: "text-[var(--fibo-error)] text-xs mt-1 ml-1" },
244
- y
253
+ p
245
254
  )
246
255
  );
247
256
  });
@@ -298,7 +307,7 @@ class G extends D {
298
307
  let e = "fibo-textfield-container w-full h-14 relative";
299
308
  this._variant === "outlined" ? e += " border border-[var(--fibo-outline)] rounded-[4px] bg-transparent" : e += " bg-[var(--fibo-surface-variant)] rounded-t-[4px] border-b border-[var(--fibo-outline)]";
300
309
  const a = {
301
- containerClass: B(e, ...this._classNames),
310
+ containerClass: L(e, ...this._classNames),
302
311
  containerStyle: this.getStyle(),
303
312
  label: this._label,
304
313
  error: this._error,
@@ -318,50 +327,50 @@ class G extends D {
318
327
  return t.createElement(K, a);
319
328
  }
320
329
  }
321
- const he = $(G), U = t.memo((o) => {
330
+ const he = $(G), U = t.memo((c) => {
322
331
  const {
323
- checked: i,
332
+ checked: l,
324
333
  onChange: e,
325
- label: l,
334
+ label: o,
326
335
  disabled: a,
327
336
  className: s,
328
337
  style: d,
329
- id: u
330
- } = o, y = B(
338
+ id: h
339
+ } = c, p = L(
331
340
  "fibo-switch-track w-[44px] h-[24px] rounded-full relative transition-colors duration-200 ease-in-out",
332
341
  a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
333
- i ? "bg-[var(--fibo-primary,#3B82F6)]" : "bg-gray-200"
334
- ), w = B(
342
+ l ? "bg-[var(--fibo-primary,#3B82F6)]" : "bg-gray-200"
343
+ ), k = L(
335
344
  "absolute w-5 h-5 rounded-full bg-white top-[2px] left-[2px] transition-transform duration-200 ease-in-out shadow-sm",
336
- i ? "translate-x-[20px]" : "translate-x-0"
345
+ l ? "translate-x-[20px]" : "translate-x-0"
337
346
  );
338
347
  return t.createElement(
339
348
  "label",
340
349
  {
341
- className: B("fibo-switch flex items-center gap-3", s)
350
+ className: L("fibo-switch flex items-center gap-3", s)
342
351
  },
343
352
  t.createElement(
344
353
  "div",
345
354
  {
346
- className: y,
355
+ className: p,
347
356
  style: d,
348
357
  "aria-hidden": !0
349
358
  },
350
- t.createElement("div", { className: w })
359
+ t.createElement("div", { className: k })
351
360
  ),
352
- l && t.createElement(
361
+ o && t.createElement(
353
362
  "span",
354
363
  { className: "text-sm font-medium text-gray-700 select-none" },
355
- l
364
+ o
356
365
  ),
357
366
  t.createElement("input", {
358
- id: u,
367
+ id: h,
359
368
  type: "checkbox",
360
369
  role: "switch",
361
- checked: !!i,
370
+ checked: !!l,
362
371
  disabled: a,
363
372
  className: "sr-only",
364
- onChange: (x) => !a && (e == null ? void 0 : e(x.target.checked))
373
+ onChange: (v) => !a && (e == null ? void 0 : e(v.target.checked))
365
374
  })
366
375
  );
367
376
  });
@@ -398,22 +407,22 @@ class J extends D {
398
407
  return t.createElement(U, e);
399
408
  }
400
409
  }
401
- const ue = $(J), Q = t.memo((o) => {
410
+ const ue = $(J), Q = t.memo((c) => {
402
411
  const {
403
- checked: i,
412
+ checked: l,
404
413
  onChange: e,
405
- label: l,
414
+ label: o,
406
415
  disabled: a,
407
416
  indeterminate: s,
408
417
  className: d,
409
- style: u,
410
- id: y
411
- } = o, w = M(null), x = i || s;
412
- F(() => {
413
- w.current && (w.current.indeterminate = !!s);
418
+ style: h,
419
+ id: p
420
+ } = c, k = j(null), v = l || s;
421
+ M(() => {
422
+ k.current && (k.current.indeterminate = !!s);
414
423
  }, [s]);
415
- let f = null;
416
- return s ? f = t.createElement("div", { className: "w-[10px] h-[2px] bg-white rounded-[1px]" }) : i && (f = t.createElement(
424
+ let x = null;
425
+ return s ? x = t.createElement("div", { className: "w-[10px] h-[2px] bg-white rounded-[1px]" }) : l && (x = t.createElement(
417
426
  "svg",
418
427
  {
419
428
  width: "12",
@@ -433,34 +442,34 @@ const ue = $(J), Q = t.memo((o) => {
433
442
  )), t.createElement(
434
443
  "label",
435
444
  {
436
- className: B("fibo-checkbox flex items-center gap-2", d)
445
+ className: L("fibo-checkbox flex items-center gap-2", d)
437
446
  },
438
447
  t.createElement(
439
448
  "div",
440
449
  {
441
- className: B(
450
+ className: L(
442
451
  "fibo-checkbox-box w-5 h-5 rounded-[6px] border-2 flex items-center justify-center transition-all duration-200",
443
452
  a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
444
- x ? "border-transparent bg-[var(--fibo-primary,#3B82F6)]" : "border-gray-300 bg-transparent"
453
+ v ? "border-transparent bg-[var(--fibo-primary,#3B82F6)]" : "border-gray-300 bg-transparent"
445
454
  ),
446
- style: u,
455
+ style: h,
447
456
  "aria-hidden": !0
448
457
  },
449
- f
458
+ x
450
459
  ),
451
- l && t.createElement(
460
+ o && t.createElement(
452
461
  "span",
453
462
  { className: "text-sm text-gray-700 select-none" },
454
- l
463
+ o
455
464
  ),
456
465
  t.createElement("input", {
457
- ref: w,
458
- id: y,
466
+ ref: k,
467
+ id: p,
459
468
  type: "checkbox",
460
- checked: !!i,
469
+ checked: !!l,
461
470
  disabled: a,
462
471
  className: "sr-only",
463
- onChange: (k) => !a && (e == null ? void 0 : e(k.target.checked))
472
+ onChange: (E) => !a && (e == null ? void 0 : e(E.target.checked))
464
473
  })
465
474
  );
466
475
  });
@@ -502,54 +511,54 @@ class X extends D {
502
511
  return t.createElement(Q, e);
503
512
  }
504
513
  }
505
- const pe = $(X), Y = t.memo((o) => {
514
+ const pe = $(X), Y = t.memo((c) => {
506
515
  const {
507
- value: i,
516
+ value: l,
508
517
  options: e = [],
509
- onChange: l,
518
+ onChange: o,
510
519
  name: a,
511
520
  direction: s,
512
521
  className: d,
513
- style: u
514
- } = o, y = t.useId(), w = a || y;
522
+ style: h
523
+ } = c, p = t.useId(), k = a || p;
515
524
  return t.createElement(
516
525
  "div",
517
526
  {
518
527
  role: "radiogroup",
519
- className: B(`fibo-radio-group flex ${s === "vertical" ? "flex-col gap-2" : "flex-row gap-4"}`, d),
520
- style: u
528
+ className: L(`fibo-radio-group flex ${s === "vertical" ? "flex-col gap-2" : "flex-row gap-4"}`, d),
529
+ style: h
521
530
  },
522
- e.map((x) => {
523
- const f = i === x.value, k = x.disabled, v = B(
531
+ e.map((v) => {
532
+ const x = l === v.value, E = v.disabled, _ = L(
524
533
  "relative flex items-center justify-center w-[18px] h-[18px] rounded-full transition-all duration-200",
525
- f ? "border-[5px] border-[var(--fibo-primary,#3B82F6)]" : "border-2 border-gray-300"
534
+ x ? "border-[5px] border-[var(--fibo-primary,#3B82F6)]" : "border-2 border-gray-300"
526
535
  );
527
536
  return t.createElement(
528
537
  "label",
529
538
  {
530
- key: x.value,
531
- className: `flex items-center gap-2 cursor-pointer ${k ? "opacity-50 cursor-not-allowed" : ""}`
539
+ key: v.value,
540
+ className: `flex items-center gap-2 cursor-pointer ${E ? "opacity-50 cursor-not-allowed" : ""}`
532
541
  },
533
542
  t.createElement(
534
543
  "div",
535
544
  {
536
- className: v,
545
+ className: _,
537
546
  "aria-hidden": !0
538
547
  },
539
548
  t.createElement("input", {
540
549
  type: "radio",
541
- name: w,
542
- value: x.value,
543
- checked: f,
544
- disabled: k,
550
+ name: k,
551
+ value: v.value,
552
+ checked: x,
553
+ disabled: E,
545
554
  className: "sr-only",
546
- onChange: () => !k && (l == null ? void 0 : l(x.value))
555
+ onChange: () => !E && (o == null ? void 0 : o(v.value))
547
556
  })
548
557
  ),
549
558
  t.createElement(
550
559
  "span",
551
560
  { className: "text-sm text-gray-700" },
552
- x.label
561
+ v.label
553
562
  )
554
563
  );
555
564
  })
@@ -592,21 +601,21 @@ class Z extends D {
592
601
  return t.createElement(Y, e);
593
602
  }
594
603
  }
595
- const me = $(Z), ee = t.memo((o) => {
596
- const i = t.useId(), e = o.id || i, {
597
- containerClass: l,
604
+ const me = $(Z), ee = t.memo((c) => {
605
+ const l = t.useId(), e = c.id || l, {
606
+ containerClass: o,
598
607
  containerStyle: a,
599
608
  label: s,
600
609
  error: d,
601
- ...u
602
- } = o;
610
+ ...h
611
+ } = c;
603
612
  return t.createElement(
604
613
  "div",
605
- { className: l, style: a },
614
+ { className: o, style: a },
606
615
  t.createElement("textarea", {
607
616
  id: e,
608
617
  className: "fibo-textarea-input w-full p-4 text-base bg-transparent outline-none relative z-10",
609
- ...u
618
+ ...h
610
619
  }),
611
620
  s && t.createElement(
612
621
  "label",
@@ -660,8 +669,8 @@ class te extends D {
660
669
  return this._onChange = e, this;
661
670
  }
662
671
  build() {
663
- const l = {
664
- containerClass: B("fibo-textarea-container w-full", ...this._classNames),
672
+ const o = {
673
+ containerClass: L("fibo-textarea-container w-full", ...this._classNames),
665
674
  containerStyle: this.getStyle(),
666
675
  label: this._label,
667
676
  error: this._error,
@@ -676,63 +685,63 @@ class te extends D {
676
685
  },
677
686
  ...this._props
678
687
  };
679
- return t.createElement(ee, l);
688
+ return t.createElement(ee, o);
680
689
  }
681
690
  }
682
- const be = $(te), re = t.memo((o) => {
683
- const i = t.useId(), e = o.id || i, l = `${e}-listbox`, [a, s] = T(!1), [d, u] = T(0), y = M(null), {
684
- containerClass: w,
685
- containerStyle: x,
686
- label: f,
687
- error: k,
688
- value: v,
689
- options: g = [],
690
- placeholder: _,
691
- onChange: m,
692
- disabled: I,
693
- multiple: p
694
- } = o;
695
- F(() => {
696
- const n = (h) => {
697
- y.current && !y.current.contains(h.target) && s(!1);
691
+ const be = $(te), re = t.memo((c) => {
692
+ const l = t.useId(), e = c.id || l, o = `${e}-listbox`, [a, s] = F(!1), [d, h] = F(0), p = j(null), {
693
+ containerClass: k,
694
+ containerStyle: v,
695
+ label: x,
696
+ error: E,
697
+ value: _,
698
+ options: y = [],
699
+ placeholder: f,
700
+ onChange: g,
701
+ disabled: S,
702
+ multiple: m
703
+ } = c;
704
+ M(() => {
705
+ const n = (u) => {
706
+ p.current && !p.current.contains(u.target) && s(!1);
698
707
  };
699
708
  return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
700
709
  }, []);
701
- const b = (n) => p ? Array.isArray(v) && v.includes(n) : v === n;
702
- let L = "";
703
- if (p)
704
- Array.isArray(v) && v.length > 0 && (L = g.filter((n) => v.includes(n.value)).map((n) => n.label).join(", "));
710
+ const b = (n) => m ? Array.isArray(_) && _.includes(n) : _ === n;
711
+ let w = "";
712
+ if (m)
713
+ Array.isArray(_) && _.length > 0 && (w = y.filter((n) => _.includes(n.value)).map((n) => n.label).join(", "));
705
714
  else {
706
- const n = g.find((h) => h.value === v);
707
- L = n ? n.label : "";
708
- }
709
- const N = (n) => {
710
- if (!I)
711
- if (p) {
712
- const h = Array.isArray(v) ? [...v] : [], S = h.indexOf(n);
713
- S > -1 ? h.splice(S, 1) : h.push(n), m == null || m(h);
715
+ const n = y.find((u) => u.value === _);
716
+ w = n ? n.label : "";
717
+ }
718
+ const I = (n) => {
719
+ if (!S)
720
+ if (m) {
721
+ const u = Array.isArray(_) ? [..._] : [], A = u.indexOf(n);
722
+ A > -1 ? u.splice(A, 1) : u.push(n), g == null || g(u);
714
723
  } else
715
- m == null || m(n), s(!1);
716
- }, E = (n) => {
717
- g.length !== 0 && u((h) => (h + n + g.length) % g.length);
724
+ g == null || g(n), s(!1);
725
+ }, C = (n) => {
726
+ y.length !== 0 && h((u) => (u + n + y.length) % y.length);
718
727
  }, z = (n) => {
719
- if (!I)
728
+ if (!S)
720
729
  switch (n.key) {
721
730
  case "ArrowDown":
722
- n.preventDefault(), a ? E(1) : s(!0);
731
+ n.preventDefault(), a ? C(1) : s(!0);
723
732
  break;
724
733
  case "ArrowUp":
725
- n.preventDefault(), a ? E(-1) : s(!0);
734
+ n.preventDefault(), a ? C(-1) : s(!0);
726
735
  break;
727
736
  case "Home":
728
- n.preventDefault(), u(0);
737
+ n.preventDefault(), h(0);
729
738
  break;
730
739
  case "End":
731
- n.preventDefault(), u(Math.max(0, g.length - 1));
740
+ n.preventDefault(), h(Math.max(0, y.length - 1));
732
741
  break;
733
742
  case "Enter":
734
743
  case " ":
735
- n.preventDefault(), a ? g[d] && N(g[d].value) : s(!0);
744
+ n.preventDefault(), a ? y[d] && I(y[d].value) : s(!0);
736
745
  break;
737
746
  case "Escape":
738
747
  n.preventDefault(), s(!1);
@@ -742,9 +751,9 @@ const be = $(te), re = t.memo((o) => {
742
751
  return t.createElement(
743
752
  "div",
744
753
  {
745
- ref: y,
746
- className: w,
747
- style: x
754
+ ref: p,
755
+ className: k,
756
+ style: v
748
757
  },
749
758
  t.createElement("div", { className: "relative w-full h-full" }, [
750
759
  t.createElement("button", {
@@ -754,14 +763,14 @@ const be = $(te), re = t.memo((o) => {
754
763
  role: "combobox",
755
764
  "aria-expanded": a,
756
765
  "aria-haspopup": "listbox",
757
- "aria-controls": l,
758
- "aria-activedescendant": a && g[d] ? `${l}-opt-${g[d].value}` : void 0,
759
- disabled: I,
760
- className: `fibo-textfield-input text-left w-full flex items-center justify-between ${L ? "" : "text-gray-400"}`,
761
- onClick: () => !I && s(!a),
766
+ "aria-controls": o,
767
+ "aria-activedescendant": a && y[d] ? `${o}-opt-${y[d].value}` : void 0,
768
+ disabled: S,
769
+ className: `fibo-textfield-input text-left w-full flex items-center justify-between ${w ? "" : "text-gray-400"}`,
770
+ onClick: () => !S && s(!a),
762
771
  onKeyDown: z
763
772
  }, [
764
- t.createElement("span", { key: "text", className: "truncate" }, L || _ || " "),
773
+ t.createElement("span", { key: "text", className: "truncate" }, w || f || " "),
765
774
  t.createElement("svg", {
766
775
  key: "icon",
767
776
  className: `w-4 h-4 transition-transform ${a ? "rotate-180" : ""}`,
@@ -771,34 +780,34 @@ const be = $(te), re = t.memo((o) => {
771
780
  "aria-hidden": !0
772
781
  }, t.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }))
773
782
  ]),
774
- f && t.createElement(
783
+ x && t.createElement(
775
784
  "label",
776
785
  {
777
786
  key: "label",
778
787
  htmlFor: e,
779
788
  className: "fibo-textfield-label"
780
789
  },
781
- f
790
+ x
782
791
  ),
783
792
  a && t.createElement("div", {
784
793
  key: "dropdown",
785
- id: l,
794
+ id: o,
786
795
  role: "listbox",
787
- "aria-multiselectable": p || void 0,
796
+ "aria-multiselectable": m || void 0,
788
797
  className: "absolute z-50 w-full mt-1 bg-[var(--fibo-surface)] border border-[var(--fibo-outline)] rounded-md shadow-lg max-h-60 overflow-auto focus:outline-none"
789
- }, g.map((n, h) => {
790
- const S = b(n.value), j = h === d;
798
+ }, y.map((n, u) => {
799
+ const A = b(n.value), T = u === d;
791
800
  return t.createElement("div", {
792
801
  key: n.value,
793
- id: `${l}-opt-${n.value}`,
802
+ id: `${o}-opt-${n.value}`,
794
803
  role: "option",
795
- "aria-selected": S,
796
- className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] flex items-center justify-between ${S || j ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"}`,
797
- onClick: () => N(n.value),
798
- onMouseEnter: () => u(h)
804
+ "aria-selected": A,
805
+ className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] flex items-center justify-between ${A || T ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"}`,
806
+ onClick: () => I(n.value),
807
+ onMouseEnter: () => h(u)
799
808
  }, [
800
809
  t.createElement("span", { key: "label" }, n.label),
801
- S && t.createElement("svg", {
810
+ A && t.createElement("svg", {
802
811
  key: "check",
803
812
  className: "w-4 h-4 text-[var(--fibo-primary)]",
804
813
  viewBox: "0 0 20 20",
@@ -808,10 +817,10 @@ const be = $(te), re = t.memo((o) => {
808
817
  ]);
809
818
  }))
810
819
  ]),
811
- k && t.createElement(
820
+ E && t.createElement(
812
821
  "span",
813
822
  { className: "text-[var(--fibo-error)] text-xs mt-1 ml-1", role: "alert" },
814
- k
823
+ E
815
824
  )
816
825
  );
817
826
  });
@@ -852,8 +861,8 @@ class ae extends D {
852
861
  return this._onChange = e, this;
853
862
  }
854
863
  build() {
855
- const l = {
856
- containerClass: B("fibo-textfield-container relative", ...this._classNames),
864
+ const o = {
865
+ containerClass: L("fibo-textfield-container relative", ...this._classNames),
857
866
  containerStyle: this.getStyle(),
858
867
  label: this._label,
859
868
  error: this._error,
@@ -865,82 +874,82 @@ class ae extends D {
865
874
  onChange: this._onChange,
866
875
  ...this._props
867
876
  };
868
- return t.createElement(re, l);
877
+ return t.createElement(re, o);
869
878
  }
870
879
  }
871
- const fe = $(ae), se = t.memo((o) => {
872
- const i = t.useId(), e = o.id || i, l = `${e}-listbox`, [a, s] = T(!1), [d, u] = T(""), [y, w] = T(0), x = M(null), {
873
- containerClass: f,
874
- containerStyle: k,
875
- label: v,
876
- error: g,
877
- value: _,
878
- options: m = [],
879
- placeholder: I,
880
- onChange: p,
880
+ const fe = $(ae), se = t.memo((c) => {
881
+ const l = t.useId(), e = c.id || l, o = `${e}-listbox`, [a, s] = F(!1), [d, h] = F(""), [p, k] = F(0), v = j(null), {
882
+ containerClass: x,
883
+ containerStyle: E,
884
+ label: _,
885
+ error: y,
886
+ value: f,
887
+ options: g = [],
888
+ placeholder: S,
889
+ onChange: m,
881
890
  onAdd: b,
882
- disabled: L,
883
- multiple: N
884
- } = o;
885
- F(() => {
886
- if (!N) {
887
- const c = m.find((C) => C.value === _);
888
- c && !a && d !== c.label && u(c.label);
891
+ disabled: w,
892
+ multiple: I
893
+ } = c;
894
+ M(() => {
895
+ if (!I) {
896
+ const i = g.find((N) => N.value === f);
897
+ i && !a && d !== i.label && h(i.label);
889
898
  }
890
- }, [_, m, a, N]);
891
- const E = m.filter(
892
- (c) => c.label.toLowerCase().includes(d.toLowerCase())
899
+ }, [f, g, a, I]);
900
+ const C = g.filter(
901
+ (i) => i.label.toLowerCase().includes(d.toLowerCase())
893
902
  );
894
- F(() => {
895
- w(0);
896
- }, [d, a]), F(() => {
897
- const c = (C) => {
898
- if (x.current && !x.current.contains(C.target))
899
- if (s(!1), N)
900
- u("");
903
+ M(() => {
904
+ k(0);
905
+ }, [d, a]), M(() => {
906
+ const i = (N) => {
907
+ if (v.current && !v.current.contains(N.target))
908
+ if (s(!1), I)
909
+ h("");
901
910
  else {
902
- const A = m.find((R) => R.value === _);
903
- u(A ? A.label : "");
911
+ const B = g.find((R) => R.value === f);
912
+ h(B ? B.label : "");
904
913
  }
905
914
  };
906
- return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
907
- }, [_, m, N]);
908
- const z = (c) => {
909
- if (N) {
910
- const C = Array.isArray(_) ? [..._] : [];
911
- C.includes(c.value) || (C.push(c.value), p == null || p(C)), u("");
915
+ return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
916
+ }, [f, g, I]);
917
+ const z = (i) => {
918
+ if (I) {
919
+ const N = Array.isArray(f) ? [...f] : [];
920
+ N.includes(i.value) || (N.push(i.value), m == null || m(N)), h("");
912
921
  } else
913
- u(c.label), p == null || p(c.value), s(!1);
914
- }, n = (c) => {
915
- if (N && Array.isArray(_)) {
916
- const C = _.filter((A) => A !== c);
917
- p == null || p(C);
922
+ h(i.label), m == null || m(i.value), s(!1);
923
+ }, n = (i) => {
924
+ if (I && Array.isArray(f)) {
925
+ const N = f.filter((B) => B !== i);
926
+ m == null || m(N);
918
927
  }
919
- }, h = () => {
920
- b == null || b(d), N ? u("") : s(!1);
921
- }, S = (c) => N ? Array.isArray(_) && _.includes(c) : _ === c, j = (c) => {
922
- if (!L)
923
- switch (c.key) {
928
+ }, u = () => {
929
+ b == null || b(d), I ? h("") : s(!1);
930
+ }, A = (i) => I ? Array.isArray(f) && f.includes(i) : f === i, T = (i) => {
931
+ if (!w)
932
+ switch (i.key) {
924
933
  case "ArrowDown":
925
- c.preventDefault(), a ? E.length && w((C) => (C + 1) % E.length) : s(!0);
934
+ i.preventDefault(), a ? C.length && k((N) => (N + 1) % C.length) : s(!0);
926
935
  break;
927
936
  case "ArrowUp":
928
- c.preventDefault(), a ? E.length && w((C) => (C - 1 + E.length) % E.length) : s(!0);
937
+ i.preventDefault(), a ? C.length && k((N) => (N - 1 + C.length) % C.length) : s(!0);
929
938
  break;
930
939
  case "Enter":
931
- c.preventDefault(), E[y] ? z(E[y]) : d && b && h();
940
+ i.preventDefault(), C[p] ? z(C[p]) : d && b && u();
932
941
  break;
933
942
  case "Escape":
934
- c.preventDefault(), s(!1);
943
+ i.preventDefault(), s(!1);
935
944
  break;
936
945
  }
937
946
  };
938
947
  return t.createElement(
939
948
  "div",
940
949
  {
941
- ref: x,
942
- className: f,
943
- style: k
950
+ ref: v,
951
+ className: x,
952
+ style: E
944
953
  },
945
954
  t.createElement("div", { className: "relative w-full h-full" }, [
946
955
  t.createElement("div", {
@@ -948,19 +957,19 @@ const fe = $(ae), se = t.memo((o) => {
948
957
  className: `fibo-textfield-input flex flex-wrap items-center gap-1 ${a ? "ring-2 ring-[var(--fibo-primary-container)] border-[var(--fibo-primary)]" : ""}`,
949
958
  style: { minHeight: "42px", padding: "4px 8px" }
950
959
  }, [
951
- N && Array.isArray(_) && _.map((c) => {
952
- const C = m.find((R) => R.value === c), A = C ? C.label : c;
960
+ I && Array.isArray(f) && f.map((i) => {
961
+ const N = g.find((R) => R.value === i), B = N ? N.label : i;
953
962
  return t.createElement("span", {
954
- key: c,
963
+ key: i,
955
964
  className: "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] text-xs font-medium px-2 py-1 rounded-md flex items-center"
956
965
  }, [
957
- A,
966
+ B,
958
967
  t.createElement("button", {
959
968
  type: "button",
960
969
  className: "ml-1 hover:text-[var(--fibo-primary)] focus:outline-none",
961
- "aria-label": `Remove ${A}`,
970
+ "aria-label": `Remove ${B}`,
962
971
  onClick: (R) => {
963
- R.stopPropagation(), n(c);
972
+ R.stopPropagation(), n(i);
964
973
  }
965
974
  }, "×")
966
975
  ]);
@@ -970,64 +979,64 @@ const fe = $(ae), se = t.memo((o) => {
970
979
  id: e,
971
980
  role: "combobox",
972
981
  "aria-expanded": a,
973
- "aria-controls": l,
982
+ "aria-controls": o,
974
983
  "aria-autocomplete": "list",
975
- "aria-activedescendant": a && E[y] ? `${l}-opt-${E[y].value}` : void 0,
984
+ "aria-activedescendant": a && C[p] ? `${o}-opt-${C[p].value}` : void 0,
976
985
  className: "bg-transparent outline-none flex-1 min-w-[60px] text-sm h-8",
977
986
  value: d,
978
- placeholder: N && Array.isArray(_) && _.length > 0 ? "" : I || " ",
979
- disabled: L,
980
- onChange: (c) => {
981
- u(c.target.value), a || s(!0);
987
+ placeholder: I && Array.isArray(f) && f.length > 0 ? "" : S || " ",
988
+ disabled: w,
989
+ onChange: (i) => {
990
+ h(i.target.value), a || s(!0);
982
991
  },
983
992
  onFocus: () => s(!0),
984
- onKeyDown: j
993
+ onKeyDown: T
985
994
  })
986
995
  ]),
987
- v && t.createElement(
996
+ _ && t.createElement(
988
997
  "label",
989
998
  {
990
999
  key: "label",
991
1000
  htmlFor: e,
992
1001
  className: "fibo-textfield-label"
993
1002
  },
994
- v
1003
+ _
995
1004
  ),
996
1005
  a && t.createElement("div", {
997
1006
  key: "dropdown",
998
- id: l,
1007
+ id: o,
999
1008
  role: "listbox",
1000
- "aria-multiselectable": N || void 0,
1009
+ "aria-multiselectable": I || void 0,
1001
1010
  className: "absolute z-50 w-full mt-1 bg-[var(--fibo-surface)] border border-[var(--fibo-outline)] rounded-md shadow-lg max-h-60 overflow-auto focus:outline-none left-0"
1002
1011
  }, [
1003
- ...E.length > 0 ? E.map((c, C) => {
1004
- const A = S(c.value), R = C === y;
1012
+ ...C.length > 0 ? C.map((i, N) => {
1013
+ const B = A(i.value), R = N === p;
1005
1014
  return t.createElement("div", {
1006
- key: c.value,
1007
- id: `${l}-opt-${c.value}`,
1015
+ key: i.value,
1016
+ id: `${o}-opt-${i.value}`,
1008
1017
  role: "option",
1009
- "aria-selected": A,
1010
- className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] ${A || R ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"} ${A ? "opacity-50" : ""}`,
1011
- onClick: () => !A && z(c),
1012
- onMouseEnter: () => w(C)
1013
- }, c.label);
1018
+ "aria-selected": B,
1019
+ className: `px-4 py-2 cursor-pointer text-sm hover:bg-[var(--fibo-primary-container)] hover:text-[var(--fibo-on-primary-container)] ${B || R ? "bg-[var(--fibo-primary-container)] text-[var(--fibo-on-primary-container)] font-medium" : "text-[var(--fibo-on-surface)]"} ${B ? "opacity-50" : ""}`,
1020
+ onClick: () => !B && z(i),
1021
+ onMouseEnter: () => k(N)
1022
+ }, i.label);
1014
1023
  }) : [t.createElement("div", { key: "empty", className: "px-4 py-2 text-sm text-gray-500" }, "No results found.")],
1015
- d && !E.some((c) => c.label.toLowerCase() === d.toLowerCase()) && b ? t.createElement("div", {
1024
+ d && !C.some((i) => i.label.toLowerCase() === d.toLowerCase()) && b ? t.createElement("div", {
1016
1025
  key: "add-new",
1017
1026
  role: "option",
1018
1027
  "aria-selected": !1,
1019
1028
  className: "border-t border-[var(--fibo-outline)] px-4 py-2 cursor-pointer text-sm text-[var(--fibo-primary)] hover:bg-[var(--fibo-primary-container)] font-medium flex items-center",
1020
- onClick: h
1029
+ onClick: u
1021
1030
  }, [
1022
1031
  t.createElement("span", { key: "plus", className: "mr-1" }, "+"),
1023
1032
  `Add "${d}"`
1024
1033
  ]) : null
1025
1034
  ])
1026
1035
  ]),
1027
- g && t.createElement(
1036
+ y && t.createElement(
1028
1037
  "span",
1029
1038
  { className: "text-[var(--fibo-error)] text-xs mt-1 ml-1", role: "alert" },
1030
- g
1039
+ y
1031
1040
  )
1032
1041
  );
1033
1042
  });
@@ -1072,8 +1081,8 @@ class ne extends D {
1072
1081
  return this._onAdd = e, this;
1073
1082
  }
1074
1083
  build() {
1075
- const l = {
1076
- containerClass: B("fibo-textfield-container relative", ...this._classNames),
1084
+ const o = {
1085
+ containerClass: L("fibo-textfield-container relative", ...this._classNames),
1077
1086
  containerStyle: this.getStyle(),
1078
1087
  label: this._label,
1079
1088
  error: this._error,
@@ -1086,7 +1095,7 @@ class ne extends D {
1086
1095
  onAdd: this._onAdd,
1087
1096
  ...this._props
1088
1097
  };
1089
- return t.createElement(se, l);
1098
+ return t.createElement(se, o);
1090
1099
  }
1091
1100
  }
1092
1101
  const xe = $(ne);