fiboui 2.6.3 → 2.7.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.
- package/README.md +16 -6
- package/dist/cli/bin.js +3 -4
- package/dist/cli/commands/generate/component.js +21 -33
- package/dist/cli/commands/generate/index.js +3 -3
- package/dist/cli/commands/generate/module.js +21 -24
- package/dist/cli/commands/generate/plugin.js +18 -34
- package/dist/cli/commands/init.js +5 -25
- package/dist/cli/config.js +118 -0
- package/dist/cli/names.js +35 -0
- package/dist/cli/templates.js +76 -0
- package/dist/client-CGjHCx8F.js +17621 -0
- package/dist/content.d.ts +1 -0
- package/dist/content.js +14 -14
- package/dist/core.d.ts +2 -0
- package/dist/core.js +65 -59
- package/dist/effects-BxvduC-G.js +14 -0
- package/dist/icons-GEqYd2M9.js +383 -0
- package/dist/index-7bieEGAP.js +944 -0
- package/dist/index-C4qvvr03.js +1474 -0
- package/dist/index-D-ljLuf8.js +839 -0
- package/dist/index-DVApKYWt.js +217 -0
- package/dist/index-Db8lVjta.js +150 -0
- package/dist/index.d.ts +73156 -505
- package/dist/index.js +4419 -2237
- package/dist/interactive.d.ts +2 -0
- package/dist/interactive.js +22 -9
- package/dist/layout.d.ts +1 -0
- package/dist/layout.js +14 -13
- package/dist/metadata-3YYH1uiS.js +147 -0
- package/dist/navigation.d.ts +1 -0
- package/dist/navigation.js +15 -9
- package/dist/page-CYqQOLXe.js +266 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +5001 -1777
- package/dist/structure.d.ts +1 -0
- package/dist/structure.js +13 -9
- package/dist/style.css +1 -1
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +8 -8
- package/package.json +9 -2
- package/dist/Link-l2KUUUg4.js +0 -50
- package/dist/PluginManager-BRjgOLVa.js +0 -110
- package/dist/client-BtHxgLa_.js +0 -10602
- package/dist/effects-D16XdB_d.js +0 -10
- package/dist/index-Bhq7-OrE.js +0 -602
- package/dist/index-CZJqskaC.js +0 -1028
- package/dist/index-D50CTdE9.js +0 -455
- package/dist/index-D5Ru-8kF.js +0 -608
- package/dist/index-DjwLjHe1.js +0 -119
- package/dist/mount-yYCj33dL.js +0 -135
package/dist/index-D5Ru-8kF.js
DELETED
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
var A = Object.defineProperty;
|
|
2
|
-
var D = (a, n, e) => n in a ? A(a, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[n] = e;
|
|
3
|
-
var t = (a, n, e) => D(a, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
-
import s, { useRef as R, useState as I, useEffect as L } from "react";
|
|
5
|
-
import { at as F, au as q, ay as T, S as G } from "./client-BtHxgLa_.js";
|
|
6
|
-
const M = s.memo((a) => {
|
|
7
|
-
const {
|
|
8
|
-
text: n,
|
|
9
|
-
variant: e,
|
|
10
|
-
size: d,
|
|
11
|
-
onPress: p,
|
|
12
|
-
onHover: E,
|
|
13
|
-
disabled: N,
|
|
14
|
-
icon: S,
|
|
15
|
-
shape: b,
|
|
16
|
-
shadow: h,
|
|
17
|
-
tone: v,
|
|
18
|
-
motion: B,
|
|
19
|
-
expand: k,
|
|
20
|
-
className: w,
|
|
21
|
-
style: g,
|
|
22
|
-
type: _ = "button",
|
|
23
|
-
...o
|
|
24
|
-
} = a, x = {
|
|
25
|
-
xs: "px-[21px] py-[8px] text-[10px] gap-[6px] h-auto tracking-[0.12em] font-normal",
|
|
26
|
-
sm: "px-[14px] py-[6px] text-[13px] gap-[6px] h-[32px]",
|
|
27
|
-
md: "px-[22px] py-[10px] text-[15px] gap-[8px] h-[44px]",
|
|
28
|
-
lg: "px-[32px] py-[16px] text-[17px] gap-[10px] h-[56px]"
|
|
29
|
-
};
|
|
30
|
-
let c = "rounded-[14px]";
|
|
31
|
-
b === "pill" ? c = "rounded-full" : b === "square" ? c = "rounded-[12px]" : b === "rect" ? c = "rounded-[2px]" : b === "rounded" ? c = "rounded-[8px]" : b === "sharp" && (c = "rounded-none");
|
|
32
|
-
const u = v === "inverse";
|
|
33
|
-
let i = "";
|
|
34
|
-
e === "ghost" ? i = u ? "bg-transparent text-white shadow-none border border-transparent" : "bg-transparent text-[var(--fibo-on-surface)] shadow-none border border-transparent hover:bg-[color-mix(in_srgb,var(--fibo-on-surface)_8%,transparent)]" : e === "text" ? i = u ? "bg-transparent text-white shadow-none border-none px-2" : "bg-transparent text-[var(--fibo-on-surface)] shadow-none border-none px-2 hover:bg-[color-mix(in_srgb,var(--fibo-on-surface)_8%,transparent)]" : e === "soft" ? i = "bg-[color-mix(in_srgb,var(--fibo-primary)_12%,transparent)] text-[var(--fibo-primary)] shadow-none border-none hover:bg-[color-mix(in_srgb,var(--fibo-primary)_18%,transparent)]" : e === "outline" || e === "outlined" ? i = u ? "bg-black text-white shadow-none border border-[#3b3b3b]" : "bg-transparent border-[1.5px] border-[var(--fibo-outline,rgba(0,0,0,0.12))] text-[var(--fibo-on-surface)] shadow-none hover:bg-[color-mix(in_srgb,var(--fibo-on-surface)_6%,transparent)]" : e === "solid" ? i = u ? "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" ? i = "bg-[var(--fibo-primary)] text-[var(--fibo-on-primary)] shadow-sm border-none hover:opacity-90 active:opacity-100" : e === "elevated" ? i = "bg-[var(--fibo-surface)] text-[var(--fibo-primary)] shadow-md border-none hover:shadow-lg" : e === "tonal" ? i = "bg-[var(--fibo-secondary-container)] text-[var(--fibo-on-secondary-container)] shadow-sm border-none" : e === "raw" && (i = "bg-transparent border-none shadow-none p-0 h-auto gap-0 text-inherit font-inherit hover:bg-transparent", c = ""), h === "soft" && e !== "raw" && (i += " shadow-[0_8px_20px_-6px_rgba(59,130,246,0.4)]");
|
|
35
|
-
const f = g || {}, m = f.padding !== void 0 || f.paddingTop !== void 0 || f.paddingBottom !== void 0 || f.paddingLeft !== void 0 || f.paddingRight !== void 0 || f.fontSize !== void 0 || f.height !== void 0, r = f.borderRadius !== void 0, l = f.fontWeight !== void 0 || d === "xs" || u, y = e === "raw" || B === "none" || u || d === "xs", C = T(
|
|
36
|
-
"fibo-button",
|
|
37
|
-
"inline-flex items-center justify-center whitespace-nowrap",
|
|
38
|
-
l ? "" : "font-semibold",
|
|
39
|
-
// Resting scale(1) so active:scale eases instead of snapping from none.
|
|
40
|
-
y ? "" : "scale-100 active:scale-[0.96] transform transition-transform duration-200 ease-out",
|
|
41
|
-
N ? "cursor-not-allowed opacity-60" : "cursor-pointer",
|
|
42
|
-
e === "raw" || m ? "" : x[d],
|
|
43
|
-
e === "raw" || r ? "" : c,
|
|
44
|
-
k ? "flex-1 w-full" : "",
|
|
45
|
-
`fibo-button-${e}`,
|
|
46
|
-
i,
|
|
47
|
-
w
|
|
48
|
-
), z = [];
|
|
49
|
-
return S && z.push(S), n && z.push(n), a.children && (Array.isArray(a.children) ? z.push(...a.children) : z.push(a.children)), s.createElement(
|
|
50
|
-
"button",
|
|
51
|
-
{
|
|
52
|
-
className: C,
|
|
53
|
-
onMouseEnter: E ? () => {
|
|
54
|
-
N || E();
|
|
55
|
-
} : o.onMouseEnter,
|
|
56
|
-
onClick: (P) => {
|
|
57
|
-
if (!N) {
|
|
58
|
-
if (!y && document.documentElement.classList.contains("fibo-theme-material") && e !== "raw") {
|
|
59
|
-
const V = P.currentTarget;
|
|
60
|
-
import("./effects-D16XdB_d.js").then(({ createRipple: H }) => {
|
|
61
|
-
H(P, V);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
p == null || p();
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
disabled: N,
|
|
68
|
-
...o,
|
|
69
|
-
type: _,
|
|
70
|
-
style: f
|
|
71
|
-
},
|
|
72
|
-
...z
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
class $ extends q {
|
|
76
|
-
constructor(e = "") {
|
|
77
|
-
super();
|
|
78
|
-
t(this, "_text", "");
|
|
79
|
-
t(this, "_variant", "elevated");
|
|
80
|
-
t(this, "_size", "md");
|
|
81
|
-
t(this, "_onPress");
|
|
82
|
-
t(this, "_onHover");
|
|
83
|
-
t(this, "_disabled", !1);
|
|
84
|
-
t(this, "_icon");
|
|
85
|
-
t(this, "_shape", "default");
|
|
86
|
-
t(this, "_shadow", "none");
|
|
87
|
-
t(this, "_tone", "default");
|
|
88
|
-
t(this, "_motion", "default");
|
|
89
|
-
t(this, "_expand", !1);
|
|
90
|
-
t(this, "_htmlType", "button");
|
|
91
|
-
this.text(e);
|
|
92
|
-
}
|
|
93
|
-
text(e) {
|
|
94
|
-
return this._text = e, typeof e == "function" && this.observer(), this;
|
|
95
|
-
}
|
|
96
|
-
variant(e) {
|
|
97
|
-
return this._variant = e, this;
|
|
98
|
-
}
|
|
99
|
-
clean() {
|
|
100
|
-
return this._variant = "raw", this;
|
|
101
|
-
}
|
|
102
|
-
size(e) {
|
|
103
|
-
return this._size = e, this;
|
|
104
|
-
}
|
|
105
|
-
onPress(e) {
|
|
106
|
-
return this._onPress = e, this;
|
|
107
|
-
}
|
|
108
|
-
onHover(e) {
|
|
109
|
-
return this._onHover = e, this;
|
|
110
|
-
}
|
|
111
|
-
disabled(e = !0) {
|
|
112
|
-
return this._disabled = e, this;
|
|
113
|
-
}
|
|
114
|
-
icon(e) {
|
|
115
|
-
return this._icon = e, this;
|
|
116
|
-
}
|
|
117
|
-
shape(e) {
|
|
118
|
-
return this._shape = e, this;
|
|
119
|
-
}
|
|
120
|
-
shadow(e) {
|
|
121
|
-
return this._shadow = e, this;
|
|
122
|
-
}
|
|
123
|
-
tone(e) {
|
|
124
|
-
return this._tone = e, this;
|
|
125
|
-
}
|
|
126
|
-
motion(e) {
|
|
127
|
-
return this._motion = e, this;
|
|
128
|
-
}
|
|
129
|
-
expand(e = !0) {
|
|
130
|
-
return this._expand = e, this;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* HTML button type. `.type('submit')` is what people write inside a Form.
|
|
134
|
-
* React still reads `element.type` as the component: a string sets this,
|
|
135
|
-
* a props object renders the button.
|
|
136
|
-
*/
|
|
137
|
-
type(e) {
|
|
138
|
-
return this._htmlType = e, this;
|
|
139
|
-
}
|
|
140
|
-
htmlType(e) {
|
|
141
|
-
return this._htmlType = e, this;
|
|
142
|
-
}
|
|
143
|
-
/** Shortcut for `.htmlType('submit')` inside a `Form`. */
|
|
144
|
-
submit() {
|
|
145
|
-
return this._htmlType = "submit", this;
|
|
146
|
-
}
|
|
147
|
-
/** Shortcut for `.htmlType('reset')`. */
|
|
148
|
-
reset() {
|
|
149
|
-
return this._htmlType = "reset", this;
|
|
150
|
-
}
|
|
151
|
-
build() {
|
|
152
|
-
const e = this.getClassName(), p = {
|
|
153
|
-
text: typeof this._text == "function" ? this._text() : this._text,
|
|
154
|
-
variant: this._variant,
|
|
155
|
-
size: this._size,
|
|
156
|
-
onPress: this._onPress,
|
|
157
|
-
onHover: this._onHover,
|
|
158
|
-
disabled: this._disabled,
|
|
159
|
-
icon: this._icon,
|
|
160
|
-
shape: this._shape,
|
|
161
|
-
shadow: this._shadow,
|
|
162
|
-
tone: this._tone,
|
|
163
|
-
motion: this._motion,
|
|
164
|
-
expand: this._expand,
|
|
165
|
-
className: e,
|
|
166
|
-
style: this.getStyle(),
|
|
167
|
-
children: this.processChildren(),
|
|
168
|
-
...this._props,
|
|
169
|
-
type: this._htmlType
|
|
170
|
-
};
|
|
171
|
-
return s.createElement(M, p);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
const Z = F($), j = s.memo((a) => {
|
|
175
|
-
const {
|
|
176
|
-
checked: n = !1,
|
|
177
|
-
controlled: e = !1,
|
|
178
|
-
onChange: d,
|
|
179
|
-
label: p,
|
|
180
|
-
disabled: E,
|
|
181
|
-
name: N,
|
|
182
|
-
value: S = "on",
|
|
183
|
-
rules: b,
|
|
184
|
-
error: h,
|
|
185
|
-
className: v,
|
|
186
|
-
style: B,
|
|
187
|
-
id: k
|
|
188
|
-
} = a, w = R(null), g = R(null), _ = n, [o, x] = I(_), c = e ? !!n : o;
|
|
189
|
-
L(() => {
|
|
190
|
-
if (e) return;
|
|
191
|
-
const r = w.current;
|
|
192
|
-
if (!r) return;
|
|
193
|
-
const l = () => x(r.checked), y = () => {
|
|
194
|
-
requestAnimationFrame(l);
|
|
195
|
-
};
|
|
196
|
-
r.addEventListener("fibo-sync", l);
|
|
197
|
-
const C = r.closest("form");
|
|
198
|
-
return C == null || C.addEventListener("reset", y), () => {
|
|
199
|
-
r.removeEventListener("fibo-sync", l), C == null || C.removeEventListener("reset", y);
|
|
200
|
-
};
|
|
201
|
-
}, [e]), L(() => {
|
|
202
|
-
const r = w.current, l = g.current;
|
|
203
|
-
if (!r) return;
|
|
204
|
-
b && (r.__fiboRules = b);
|
|
205
|
-
const y = l == null ? void 0 : l.querySelector(".fibo-field-error");
|
|
206
|
-
l && (l.__fiboShowError = (C) => {
|
|
207
|
-
y && (y.textContent = C ?? "", y.style.display = C ? "" : "none");
|
|
208
|
-
});
|
|
209
|
-
}, [b]);
|
|
210
|
-
const u = (r) => {
|
|
211
|
-
if (E) return;
|
|
212
|
-
const l = r.target.checked;
|
|
213
|
-
e || x(l), d == null || d(l);
|
|
214
|
-
}, i = T(
|
|
215
|
-
"fibo-switch-track w-[44px] h-[24px] rounded-full relative transition-colors duration-200 ease-in-out",
|
|
216
|
-
E ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
217
|
-
c ? "bg-[var(--fibo-primary,#3B82F6)]" : "bg-gray-200"
|
|
218
|
-
), f = T(
|
|
219
|
-
"absolute w-5 h-5 rounded-full bg-white top-[2px] left-[2px] transition-transform duration-200 ease-in-out shadow-sm",
|
|
220
|
-
c ? "translate-x-[20px]" : "translate-x-0"
|
|
221
|
-
), m = {
|
|
222
|
-
ref: w,
|
|
223
|
-
id: k,
|
|
224
|
-
type: "checkbox",
|
|
225
|
-
role: "switch",
|
|
226
|
-
name: N,
|
|
227
|
-
value: S,
|
|
228
|
-
disabled: E,
|
|
229
|
-
className: "sr-only",
|
|
230
|
-
onChange: u
|
|
231
|
-
};
|
|
232
|
-
return e ? m.checked = !!n : m.defaultChecked = _, s.createElement(
|
|
233
|
-
"div",
|
|
234
|
-
{
|
|
235
|
-
ref: g,
|
|
236
|
-
className: T("fibo-switch-container", v)
|
|
237
|
-
},
|
|
238
|
-
s.createElement(
|
|
239
|
-
"label",
|
|
240
|
-
{
|
|
241
|
-
className: "fibo-switch flex items-center gap-3"
|
|
242
|
-
},
|
|
243
|
-
s.createElement(
|
|
244
|
-
"div",
|
|
245
|
-
{
|
|
246
|
-
className: i,
|
|
247
|
-
style: B,
|
|
248
|
-
"aria-hidden": !0
|
|
249
|
-
},
|
|
250
|
-
s.createElement("div", { className: f })
|
|
251
|
-
),
|
|
252
|
-
p && s.createElement(
|
|
253
|
-
"span",
|
|
254
|
-
{ className: "text-sm font-medium text-gray-700 select-none" },
|
|
255
|
-
p
|
|
256
|
-
),
|
|
257
|
-
s.createElement("input", m)
|
|
258
|
-
),
|
|
259
|
-
s.createElement(
|
|
260
|
-
"span",
|
|
261
|
-
{
|
|
262
|
-
className: "fibo-field-error text-[var(--fibo-error,#b91c1c)] text-xs mt-1 ml-1",
|
|
263
|
-
style: { display: h ? "" : "none" }
|
|
264
|
-
},
|
|
265
|
-
h || ""
|
|
266
|
-
)
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
class W extends q {
|
|
270
|
-
constructor() {
|
|
271
|
-
super(...arguments);
|
|
272
|
-
t(this, "_checked", !1);
|
|
273
|
-
t(this, "_controlled", !1);
|
|
274
|
-
t(this, "_onChange");
|
|
275
|
-
t(this, "_label");
|
|
276
|
-
t(this, "_disabled", !1);
|
|
277
|
-
t(this, "_name");
|
|
278
|
-
t(this, "_value", "on");
|
|
279
|
-
t(this, "_rules");
|
|
280
|
-
t(this, "_error");
|
|
281
|
-
}
|
|
282
|
-
checked(e) {
|
|
283
|
-
return this._checked = e, this;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Force controlled React `checked` (parent must setState). Default is uncontrolled.
|
|
287
|
-
*/
|
|
288
|
-
controlled(e = !0) {
|
|
289
|
-
return this._controlled = e, this;
|
|
290
|
-
}
|
|
291
|
-
/** HTML `name` — required for `Form` FormData collection. */
|
|
292
|
-
name(e) {
|
|
293
|
-
return this._name = e, this;
|
|
294
|
-
}
|
|
295
|
-
/** Submit value when checked (HTML checkbox `value`, default `'on'`). */
|
|
296
|
-
value(e) {
|
|
297
|
-
return this._value = e, this;
|
|
298
|
-
}
|
|
299
|
-
onChange(e) {
|
|
300
|
-
return this._onChange = e, this;
|
|
301
|
-
}
|
|
302
|
-
label(e) {
|
|
303
|
-
return this._label = e, this;
|
|
304
|
-
}
|
|
305
|
-
disabled(e = !0) {
|
|
306
|
-
return this._disabled = e, this;
|
|
307
|
-
}
|
|
308
|
-
error(e) {
|
|
309
|
-
return this._error = e, this;
|
|
310
|
-
}
|
|
311
|
-
/** Rules collected by `Form` on submit (this field's own checks). */
|
|
312
|
-
rules(...e) {
|
|
313
|
-
return this._rules = e, this;
|
|
314
|
-
}
|
|
315
|
-
build() {
|
|
316
|
-
const e = {
|
|
317
|
-
checked: this._checked,
|
|
318
|
-
controlled: this._controlled,
|
|
319
|
-
onChange: this._onChange,
|
|
320
|
-
label: this._label,
|
|
321
|
-
disabled: this._disabled,
|
|
322
|
-
name: this._name,
|
|
323
|
-
value: this._value,
|
|
324
|
-
rules: this._rules,
|
|
325
|
-
error: this._error,
|
|
326
|
-
className: this.getClassName(),
|
|
327
|
-
style: this.getStyle(),
|
|
328
|
-
...this._props
|
|
329
|
-
};
|
|
330
|
-
return s.createElement(j, e);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
const ee = F(W), J = s.memo((a) => {
|
|
334
|
-
const {
|
|
335
|
-
value: n = "",
|
|
336
|
-
controlled: e = !1,
|
|
337
|
-
options: d = [],
|
|
338
|
-
onChange: p,
|
|
339
|
-
name: E,
|
|
340
|
-
direction: N,
|
|
341
|
-
className: S,
|
|
342
|
-
style: b
|
|
343
|
-
} = a, h = R(null), v = s.useId(), B = E || v, k = n, [w, g] = I(k), _ = e ? n : w;
|
|
344
|
-
return L(() => {
|
|
345
|
-
if (e) return;
|
|
346
|
-
const o = h.current;
|
|
347
|
-
if (!o) return;
|
|
348
|
-
const x = () => {
|
|
349
|
-
const i = o.querySelector('input[type="radio"]:checked');
|
|
350
|
-
g((i == null ? void 0 : i.value) ?? "");
|
|
351
|
-
}, c = () => {
|
|
352
|
-
requestAnimationFrame(x);
|
|
353
|
-
};
|
|
354
|
-
o.addEventListener("fibo-sync", x);
|
|
355
|
-
const u = o.closest("form");
|
|
356
|
-
return u == null || u.addEventListener("reset", c), () => {
|
|
357
|
-
o.removeEventListener("fibo-sync", x), u == null || u.removeEventListener("reset", c);
|
|
358
|
-
};
|
|
359
|
-
}, [e]), s.createElement(
|
|
360
|
-
"div",
|
|
361
|
-
{
|
|
362
|
-
ref: h,
|
|
363
|
-
role: "radiogroup",
|
|
364
|
-
className: T(
|
|
365
|
-
`fibo-radio-group flex ${N === "vertical" ? "flex-col gap-2" : "flex-row gap-4"}`,
|
|
366
|
-
S
|
|
367
|
-
),
|
|
368
|
-
style: b
|
|
369
|
-
},
|
|
370
|
-
d.map((o) => {
|
|
371
|
-
const x = _ === o.value, c = o.disabled, u = T(
|
|
372
|
-
"relative flex items-center justify-center w-[18px] h-[18px] rounded-full transition-all duration-200",
|
|
373
|
-
x ? "border-[5px] border-[var(--fibo-primary,#3B82F6)]" : "border-2 border-gray-300"
|
|
374
|
-
), i = {
|
|
375
|
-
type: "radio",
|
|
376
|
-
name: B,
|
|
377
|
-
value: o.value,
|
|
378
|
-
disabled: c,
|
|
379
|
-
className: "sr-only",
|
|
380
|
-
onChange: () => {
|
|
381
|
-
c || (e || g(o.value), p == null || p(o.value));
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
return e ? i.checked = x : i.defaultChecked = k === o.value, s.createElement(
|
|
385
|
-
"label",
|
|
386
|
-
{
|
|
387
|
-
key: o.value,
|
|
388
|
-
className: `flex items-center gap-2 cursor-pointer ${c ? "opacity-50 cursor-not-allowed" : ""}`
|
|
389
|
-
},
|
|
390
|
-
s.createElement(
|
|
391
|
-
"div",
|
|
392
|
-
{
|
|
393
|
-
className: u,
|
|
394
|
-
"aria-hidden": !0
|
|
395
|
-
},
|
|
396
|
-
s.createElement("input", i)
|
|
397
|
-
),
|
|
398
|
-
s.createElement("span", { className: "text-sm text-gray-700" }, o.label)
|
|
399
|
-
);
|
|
400
|
-
})
|
|
401
|
-
);
|
|
402
|
-
});
|
|
403
|
-
class K extends q {
|
|
404
|
-
constructor() {
|
|
405
|
-
super(...arguments);
|
|
406
|
-
t(this, "_value", "");
|
|
407
|
-
t(this, "_controlled", !1);
|
|
408
|
-
t(this, "_options", []);
|
|
409
|
-
t(this, "_onChange");
|
|
410
|
-
t(this, "_name");
|
|
411
|
-
t(this, "_direction", "vertical");
|
|
412
|
-
}
|
|
413
|
-
value(e) {
|
|
414
|
-
return this._value = e, this;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Force controlled React selection (parent must setState). Default is uncontrolled.
|
|
418
|
-
*/
|
|
419
|
-
controlled(e = !0) {
|
|
420
|
-
return this._controlled = e, this;
|
|
421
|
-
}
|
|
422
|
-
options(e) {
|
|
423
|
-
return this._options = e, this;
|
|
424
|
-
}
|
|
425
|
-
onChange(e) {
|
|
426
|
-
return this._onChange = e, this;
|
|
427
|
-
}
|
|
428
|
-
direction(e) {
|
|
429
|
-
return this._direction = e, this;
|
|
430
|
-
}
|
|
431
|
-
name(e) {
|
|
432
|
-
return this._name = e, this;
|
|
433
|
-
}
|
|
434
|
-
build() {
|
|
435
|
-
const e = {
|
|
436
|
-
value: this._value,
|
|
437
|
-
controlled: this._controlled,
|
|
438
|
-
options: this._options,
|
|
439
|
-
onChange: this._onChange,
|
|
440
|
-
name: this._name,
|
|
441
|
-
direction: this._direction,
|
|
442
|
-
className: this.getClassName(),
|
|
443
|
-
style: this.getStyle()
|
|
444
|
-
};
|
|
445
|
-
return s.createElement(J, e);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
const te = F(K), O = s.memo((a) => {
|
|
449
|
-
const n = s.useId(), e = a.id || n, d = R(null), p = R(!1), {
|
|
450
|
-
containerClass: E,
|
|
451
|
-
containerStyle: N,
|
|
452
|
-
label: S,
|
|
453
|
-
error: b,
|
|
454
|
-
value: h,
|
|
455
|
-
controlled: v,
|
|
456
|
-
rules: B,
|
|
457
|
-
onChange: k,
|
|
458
|
-
onCommit: w,
|
|
459
|
-
...g
|
|
460
|
-
} = a, _ = h instanceof G, o = typeof h == "string" ? h : _ ? h.value : "", [x, c] = I(o);
|
|
461
|
-
L(() => {
|
|
462
|
-
if (v) {
|
|
463
|
-
if (_)
|
|
464
|
-
return h.subscribe(c);
|
|
465
|
-
c(typeof h == "string" ? h : "");
|
|
466
|
-
}
|
|
467
|
-
}, [v, h, _]), L(() => v || !_ ? void 0 : h.subscribe((r) => {
|
|
468
|
-
if (p.current) return;
|
|
469
|
-
const l = d.current;
|
|
470
|
-
l && l.value !== r && (l.value = r);
|
|
471
|
-
}), [h, _, v]), s.useEffect(() => {
|
|
472
|
-
const m = d.current;
|
|
473
|
-
if (!m) return;
|
|
474
|
-
B && (m.__fiboRules = B);
|
|
475
|
-
const r = m.closest(".fibo-textarea-container"), l = r == null ? void 0 : r.querySelector(".fibo-field-error");
|
|
476
|
-
r && (r.__fiboShowError = (y) => {
|
|
477
|
-
l && (l.textContent = y ?? "", l.style.display = y ? "" : "none");
|
|
478
|
-
});
|
|
479
|
-
}, [B]);
|
|
480
|
-
const f = {
|
|
481
|
-
key: "textarea",
|
|
482
|
-
ref: d,
|
|
483
|
-
id: e,
|
|
484
|
-
className: "fibo-textarea-input w-full p-4 text-base bg-transparent outline-none relative z-10",
|
|
485
|
-
onChange: (m) => {
|
|
486
|
-
const r = m.target.value;
|
|
487
|
-
v && c(r), _ && (p.current = !0, h.value = r, p.current = !1), k == null || k(r);
|
|
488
|
-
},
|
|
489
|
-
onBlur: (m) => {
|
|
490
|
-
var r;
|
|
491
|
-
w == null || w(m.target.value), (r = g.onBlur) == null || r.call(g, m);
|
|
492
|
-
},
|
|
493
|
-
...g
|
|
494
|
-
};
|
|
495
|
-
return v ? f.value = x : f.defaultValue = o, s.createElement(
|
|
496
|
-
"div",
|
|
497
|
-
{ className: E, style: N },
|
|
498
|
-
s.createElement("textarea", f),
|
|
499
|
-
S && s.createElement(
|
|
500
|
-
"label",
|
|
501
|
-
{
|
|
502
|
-
key: "label",
|
|
503
|
-
htmlFor: e,
|
|
504
|
-
className: "fibo-textarea-label"
|
|
505
|
-
},
|
|
506
|
-
S
|
|
507
|
-
),
|
|
508
|
-
s.createElement(
|
|
509
|
-
"span",
|
|
510
|
-
{
|
|
511
|
-
className: "fibo-field-error text-[var(--fibo-error,#b91c1c)] text-xs mt-1 ml-1",
|
|
512
|
-
role: "alert",
|
|
513
|
-
style: { display: b ? "" : "none" }
|
|
514
|
-
},
|
|
515
|
-
b || ""
|
|
516
|
-
)
|
|
517
|
-
);
|
|
518
|
-
});
|
|
519
|
-
class Q extends q {
|
|
520
|
-
constructor(e = "") {
|
|
521
|
-
super();
|
|
522
|
-
t(this, "_value", "");
|
|
523
|
-
t(this, "_label", "");
|
|
524
|
-
t(this, "_placeholder", "");
|
|
525
|
-
t(this, "_name");
|
|
526
|
-
t(this, "_disabled", !1);
|
|
527
|
-
t(this, "_rows", 4);
|
|
528
|
-
t(this, "_error");
|
|
529
|
-
t(this, "_rules");
|
|
530
|
-
t(this, "_controlled", !1);
|
|
531
|
-
t(this, "_resize", "vertical");
|
|
532
|
-
t(this, "_onChange");
|
|
533
|
-
/** Fires on blur — prefer this over onChange to avoid work per keystroke. */
|
|
534
|
-
t(this, "_onCommit");
|
|
535
|
-
this._value = e;
|
|
536
|
-
}
|
|
537
|
-
value(e) {
|
|
538
|
-
return this._value = e, this;
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Force controlled React `value` (re-renders every key). Default is uncontrolled.
|
|
542
|
-
* Prefer `.value(signal)` + read signal when needed, or `.onCommit`.
|
|
543
|
-
*/
|
|
544
|
-
controlled(e = !0) {
|
|
545
|
-
return this._controlled = e, this;
|
|
546
|
-
}
|
|
547
|
-
label(e) {
|
|
548
|
-
return this._label = e, this;
|
|
549
|
-
}
|
|
550
|
-
placeholder(e) {
|
|
551
|
-
return this._placeholder = e, this;
|
|
552
|
-
}
|
|
553
|
-
/** HTML `name` — required for `Form().onSubmit` FormData collection. */
|
|
554
|
-
name(e) {
|
|
555
|
-
return this._name = e, this;
|
|
556
|
-
}
|
|
557
|
-
disabled(e = !0) {
|
|
558
|
-
return this._disabled = e, this;
|
|
559
|
-
}
|
|
560
|
-
rows(e) {
|
|
561
|
-
return this._rows = e, this;
|
|
562
|
-
}
|
|
563
|
-
resize(e) {
|
|
564
|
-
return this._resize = e, this;
|
|
565
|
-
}
|
|
566
|
-
error(e) {
|
|
567
|
-
return this._error = e, this;
|
|
568
|
-
}
|
|
569
|
-
/** Rules collected by `Form` on submit (this field's own checks). */
|
|
570
|
-
rules(...e) {
|
|
571
|
-
return this._rules = e, this;
|
|
572
|
-
}
|
|
573
|
-
/** Per-keystroke callback — does not re-render the field by itself. */
|
|
574
|
-
onChange(e) {
|
|
575
|
-
return this._onChange = e, this;
|
|
576
|
-
}
|
|
577
|
-
/** Fires when the field loses focus — use for validation / form sync. */
|
|
578
|
-
onCommit(e) {
|
|
579
|
-
return this._onCommit = e, this;
|
|
580
|
-
}
|
|
581
|
-
build() {
|
|
582
|
-
const d = {
|
|
583
|
-
containerClass: T("fibo-textarea-container w-full", ...this._classNames),
|
|
584
|
-
containerStyle: this.getStyle(),
|
|
585
|
-
label: this._label,
|
|
586
|
-
error: this._error,
|
|
587
|
-
rows: this._rows,
|
|
588
|
-
value: this._value,
|
|
589
|
-
controlled: this._controlled,
|
|
590
|
-
name: this._name,
|
|
591
|
-
placeholder: this._placeholder || " ",
|
|
592
|
-
disabled: this._disabled,
|
|
593
|
-
rules: this._rules,
|
|
594
|
-
style: { resize: this._resize },
|
|
595
|
-
onChange: this._onChange,
|
|
596
|
-
onCommit: this._onCommit,
|
|
597
|
-
...this._props
|
|
598
|
-
};
|
|
599
|
-
return s.createElement(O, d);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
const re = F(Q);
|
|
603
|
-
export {
|
|
604
|
-
Z as B,
|
|
605
|
-
te as R,
|
|
606
|
-
ee as S,
|
|
607
|
-
re as T
|
|
608
|
-
};
|