@formatica/react 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/components/BaseField.d.ts +17 -0
  2. package/dist/components/BaseField.d.ts.map +1 -0
  3. package/dist/components/FormBuilder.d.ts +22 -0
  4. package/dist/components/FormBuilder.d.ts.map +1 -0
  5. package/dist/components/FormaticaProvider.d.ts +15 -0
  6. package/dist/components/FormaticaProvider.d.ts.map +1 -0
  7. package/dist/components/fields/CheckboxField.d.ts +10 -0
  8. package/dist/components/fields/CheckboxField.d.ts.map +1 -0
  9. package/dist/components/fields/NumberField.d.ts +17 -0
  10. package/dist/components/fields/NumberField.d.ts.map +1 -0
  11. package/dist/components/fields/RadioField.d.ts +17 -0
  12. package/dist/components/fields/RadioField.d.ts.map +1 -0
  13. package/dist/components/fields/SelectField.d.ts +19 -0
  14. package/dist/components/fields/SelectField.d.ts.map +1 -0
  15. package/dist/components/fields/SliderField.d.ts +13 -0
  16. package/dist/components/fields/SliderField.d.ts.map +1 -0
  17. package/dist/components/fields/SwitchField.d.ts +11 -0
  18. package/dist/components/fields/SwitchField.d.ts.map +1 -0
  19. package/dist/components/fields/TextField.d.ts +15 -0
  20. package/dist/components/fields/TextField.d.ts.map +1 -0
  21. package/dist/components/fields/TextareaField.d.ts +14 -0
  22. package/dist/components/fields/TextareaField.d.ts.map +1 -0
  23. package/dist/formatica-react.es.js +498 -486
  24. package/dist/formatica-react.es.js.map +1 -1
  25. package/dist/formatica-react.umd.cjs +1 -1
  26. package/dist/formatica-react.umd.cjs.map +1 -1
  27. package/dist/hooks/useForm.d.ts +26 -0
  28. package/dist/hooks/useForm.d.ts.map +1 -0
  29. package/dist/hooks/useFormContext.d.ts +4 -0
  30. package/dist/hooks/useFormContext.d.ts.map +1 -0
  31. package/dist/index.d.ts +10 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/package.json +3 -2
@@ -1,8 +1,8 @@
1
- import { extractFields as ne, evaluateCondition as se, getRule as ae, isFieldNode as O } from "@formatica/core";
1
+ import { extractFields as oe, evaluateCondition as le, getRule as ie, isFieldNode as L } from "@formatica/core";
2
2
  export * from "@formatica/core";
3
- import { useRef as L, useState as S, useCallback as D, createContext as oe, useContext as le, useEffect as B } from "react";
4
- import { jsxs as g, jsx as t } from "react/jsx-runtime";
5
- function ie(e) {
3
+ import { useRef as A, useState as F, useCallback as D, createContext as B, useContext as ee, useEffect as re } from "react";
4
+ import { jsx as t, jsxs as y } from "react/jsx-runtime";
5
+ function ce(e) {
6
6
  switch (e.type) {
7
7
  case "tags":
8
8
  case "checkbox-group":
@@ -18,171 +18,181 @@ function ie(e) {
18
18
  return "";
19
19
  }
20
20
  }
21
- function ce(e) {
21
+ function ue(e) {
22
22
  const n = {};
23
- for (const s of e)
24
- n[s.name] = s.defaultValue ?? ie(s);
23
+ for (const a of e)
24
+ n[a.name] = a.defaultValue ?? ce(a);
25
25
  return n;
26
26
  }
27
- function ue(e) {
28
- return e ? typeof e == "string" ? e.split("|").map(Z) : Array.isArray(e) ? e.map(Z) : Object.entries(e).filter(([, n]) => n !== !1 && n !== void 0).map(([n, s]) => ({
27
+ function de(e) {
28
+ return e ? typeof e == "string" ? e.split("|").map(Z) : Array.isArray(e) ? e.map(Z) : Object.entries(e).filter(([, n]) => n !== !1 && n !== void 0).map(([n, a]) => ({
29
29
  name: n,
30
- params: typeof s == "object" && s !== null ? s : { [n]: s }
30
+ params: typeof a == "object" && a !== null ? a : { [n]: a }
31
31
  })) : [];
32
32
  }
33
33
  function Z(e) {
34
- const [n = "", ...s] = e.split(":"), r = s.join(":"), a = {};
34
+ const [n = "", ...a] = e.split(":"), r = a.join(":"), s = {};
35
35
  if (r) {
36
36
  const o = r.split(",");
37
37
  if (n === "between" && o.length === 2)
38
- a.min = Number(o[0]), a.max = Number(o[1]);
38
+ s.min = Number(o[0]), s.max = Number(o[1]);
39
39
  else if (n === "pattern")
40
- a.pattern = r;
41
- else if (a[n] = o.length === 1 ? o[0] : o, o.length === 1) {
42
- const i = Number(o[0]);
43
- Number.isNaN(i) || (a[n] = i, n === "minLength" && (a.min = i), n === "maxLength" && (a.max = i));
40
+ s.pattern = r;
41
+ else if (s[n] = o.length === 1 ? o[0] : o, o.length === 1) {
42
+ const l = Number(o[0]);
43
+ Number.isNaN(l) || (s[n] = l, n === "minLength" && (s.min = l), n === "maxLength" && (s.max = l));
44
44
  }
45
45
  }
46
- return { name: n, params: a };
46
+ return { name: n, params: s };
47
47
  }
48
- function de(e, n) {
49
- const s = ne(e.fields), r = L(ce(s)), a = L(s), [o, i] = S(() => ({
48
+ function fe(e, n) {
49
+ const a = oe(e.fields), r = A(ue(a)), s = A(a), [o, l] = F(() => ({
50
50
  ...r.current
51
- })), [u, l] = S({}), [m, d] = S({}), [h, f] = S({}), [C, v] = S(!1), [p, b] = S(0), k = L(o);
52
- k.current = o;
53
- const x = L(u);
54
- x.current = u;
55
- const F = Object.values(u).every((y) => y.length === 0), R = Object.values(h).some(Boolean), j = D((y, $) => {
56
- i((N) => ({ ...N, [y]: $ })), f((N) => ({ ...N, [y]: !0 }));
57
- }, []), H = D((y) => k.current[y], []), T = D(
58
- async (y, $) => {
59
- const N = a.current.find((E) => E.name === y);
51
+ })), [u, i] = F({}), [f, d] = F({}), [g, m] = F({}), [h, v] = F(!1), [b, p] = F(0), S = A(o);
52
+ S.current = o;
53
+ const $ = A(u);
54
+ $.current = u;
55
+ const j = Object.values(u).every((x) => x.length === 0), E = Object.values(g).some(Boolean), R = D((x, C) => {
56
+ l((N) => ({ ...N, [x]: C })), m((N) => ({ ...N, [x]: !0 }));
57
+ }, []), M = D((x) => S.current[x], []), k = D(
58
+ async (x, C) => {
59
+ const N = s.current.find((O) => O.name === x);
60
60
  if (!N) return [];
61
- if (N.condition && !se(N.condition, $))
61
+ if (N.condition && !le(N.condition, C))
62
62
  return [];
63
- const I = ue(N.rules);
64
- N.required && !I.some((E) => E.name === "required") && I.unshift({ name: "required", params: {} });
65
- const z = [], te = {
66
- values: $,
67
- getFieldValue: (E) => $[E]
63
+ const T = de(N.rules);
64
+ N.required && !T.some((O) => O.name === "required") && T.unshift({ name: "required", params: {} });
65
+ const K = [], se = {
66
+ values: C,
67
+ getFieldValue: (O) => C[O]
68
68
  };
69
- for (const E of I) {
70
- const G = ae(E.name);
69
+ for (const O of T) {
70
+ const G = ie(O.name);
71
71
  if (!G) continue;
72
- const W = await G($[y], E.params, te);
73
- typeof W == "string" && z.push(W);
72
+ const W = await G(C[x], O.params, se);
73
+ typeof W == "string" && K.push(W);
74
74
  }
75
- return z;
75
+ return K;
76
76
  },
77
77
  []
78
- ), A = D(
79
- async (y) => {
80
- const $ = await T(y, k.current);
81
- return l((N) => ({ ...N, [y]: $ })), d((N) => ({ ...N, [y]: !0 })), $.length === 0;
78
+ ), I = D(
79
+ async (x) => {
80
+ const C = await k(x, S.current);
81
+ return i((N) => ({ ...N, [x]: C })), d((N) => ({ ...N, [x]: !0 })), C.length === 0;
82
82
  },
83
- [T]
84
- ), V = D(async () => {
85
- const y = k.current, $ = {};
83
+ [k]
84
+ ), z = D(async () => {
85
+ const x = S.current, C = {};
86
86
  let N = !0;
87
- for (const I of a.current) {
88
- const z = await T(I.name, y);
89
- $[I.name] = z, z.length > 0 && (N = !1);
87
+ for (const T of s.current) {
88
+ const K = await k(T.name, x);
89
+ C[T.name] = K, K.length > 0 && (N = !1);
90
90
  }
91
- return l($), N;
92
- }, [T]), P = D(
93
- async (y) => {
94
- v(!0), b((N) => N + 1);
95
- const $ = {};
96
- for (const N of a.current)
97
- $[N.name] = !0;
98
- d($);
91
+ return i(C), N;
92
+ }, [k]), q = D(
93
+ async (x) => {
94
+ v(!0), p((N) => N + 1);
95
+ const C = {};
96
+ for (const N of s.current)
97
+ C[N.name] = !0;
98
+ d(C);
99
99
  try {
100
- if (!await V()) return;
101
- await y({ ...k.current });
100
+ if (!await z()) return;
101
+ await x({ ...S.current });
102
102
  } finally {
103
103
  v(!1);
104
104
  }
105
105
  },
106
- [V]
106
+ [z]
107
107
  ), _ = D(() => {
108
- i({ ...r.current }), l({}), d({}), f({});
108
+ l({ ...r.current }), i({}), d({}), m({});
109
109
  }, []), U = D(() => {
110
- const y = {};
111
- for (const $ of a.current)
112
- y[$.name] = null;
113
- i(y), l({});
114
- }, []), q = D((y, $) => {
115
- const N = Array.isArray($) ? $ : [$];
116
- l((I) => ({ ...I, [y]: N }));
117
- }, []), c = D((y) => {
118
- l(($) => {
119
- const N = { ...$ };
120
- return delete N[y], N;
110
+ const x = {};
111
+ for (const C of s.current)
112
+ x[C.name] = null;
113
+ l(x), i({});
114
+ }, []), H = D((x, C) => {
115
+ const N = Array.isArray(C) ? C : [C];
116
+ i((T) => ({ ...T, [x]: N }));
117
+ }, []), c = D((x) => {
118
+ i((C) => {
119
+ const N = { ...C };
120
+ return delete N[x], N;
121
121
  });
122
122
  }, []), w = D(() => {
123
- l({});
123
+ i({});
124
124
  }, []);
125
125
  return {
126
126
  values: o,
127
127
  errors: u,
128
- touched: m,
129
- dirty: h,
130
- isValid: F,
131
- isDirty: R,
132
- isSubmitting: C,
133
- submitCount: p,
134
- setFieldValue: j,
135
- validate: V,
136
- validateField: A,
137
- submit: P,
128
+ touched: f,
129
+ dirty: g,
130
+ isValid: j,
131
+ isDirty: E,
132
+ isSubmitting: h,
133
+ submitCount: b,
134
+ setFieldValue: R,
135
+ validate: z,
136
+ validateField: I,
137
+ submit: q,
138
138
  reset: _,
139
139
  clear: U,
140
- setError: q,
140
+ setError: H,
141
141
  clearError: c,
142
142
  clearErrors: w,
143
- getFieldValue: H
143
+ getFieldValue: M
144
144
  };
145
145
  }
146
- const ee = oe(null);
147
- function Te() {
148
- const e = le(ee);
146
+ const te = B(null);
147
+ function Ae() {
148
+ const e = ee(te);
149
149
  if (!e) throw new Error("useFormContext must be used within a FormProvider");
150
150
  return e;
151
151
  }
152
- function fe({
152
+ const ne = B({});
153
+ function Me({
154
+ config: e,
155
+ children: n
156
+ }) {
157
+ return /* @__PURE__ */ t(ne.Provider, { value: e, children: n });
158
+ }
159
+ function me() {
160
+ return ee(ne);
161
+ }
162
+ function be({
153
163
  label: e,
154
164
  required: n,
155
- errors: s,
165
+ errors: a,
156
166
  touched: r = !0,
157
- helpText: a,
167
+ helpText: s,
158
168
  tooltip: o,
159
- disabled: i,
169
+ disabled: l,
160
170
  readOnly: u,
161
- fieldName: l,
162
- children: m,
171
+ fieldName: i,
172
+ children: f,
163
173
  className: d,
164
- style: h
174
+ style: g
165
175
  }) {
166
- const [f, C] = S(!1), v = r && s !== void 0 && s.length > 0, p = l ? `fc-field-${l}` : void 0, b = l ? `fc-error-${l}` : void 0;
167
- return /* @__PURE__ */ g(
176
+ const [m, h] = F(!1), v = r && a !== void 0 && a.length > 0, b = i ? `fc-field-${i}` : void 0, p = i ? `fc-error-${i}` : void 0;
177
+ return /* @__PURE__ */ y(
168
178
  "div",
169
179
  {
170
- className: `relative mb-4 ${i ? "opacity-50 cursor-not-allowed" : ""} ${u ? "fc-readonly" : ""} ${d ?? ""}`,
171
- style: h,
180
+ className: `relative mb-4 ${l ? "opacity-50 cursor-not-allowed" : ""} ${u ? "fc-readonly" : ""} ${d ?? ""}`,
181
+ style: g,
172
182
  children: [
173
- e && /* @__PURE__ */ g("div", { className: "mb-1.5 flex items-center gap-1", children: [
174
- /* @__PURE__ */ g("label", { htmlFor: p, className: "block text-sm font-medium text-gray-700", children: [
183
+ e && /* @__PURE__ */ y("div", { className: "mb-1.5 flex items-center gap-1", children: [
184
+ /* @__PURE__ */ y("label", { htmlFor: b, className: "block text-sm font-medium text-gray-700", children: [
175
185
  e,
176
186
  n && /* @__PURE__ */ t("span", { className: "text-red-500 ml-0.5", "aria-hidden": "true", children: "*" })
177
187
  ] }),
178
- o && /* @__PURE__ */ g(
188
+ o && /* @__PURE__ */ y(
179
189
  "span",
180
190
  {
181
191
  className: "relative inline-flex",
182
- onMouseEnter: () => C(!0),
183
- onMouseLeave: () => C(!1),
184
- onFocus: () => C(!0),
185
- onBlur: () => C(!1),
192
+ onMouseEnter: () => h(!0),
193
+ onMouseLeave: () => h(!1),
194
+ onFocus: () => h(!0),
195
+ onBlur: () => h(!1),
186
196
  children: [
187
197
  /* @__PURE__ */ t(
188
198
  "button",
@@ -194,7 +204,7 @@ function fe({
194
204
  children: "i"
195
205
  }
196
206
  ),
197
- f && /* @__PURE__ */ g(
207
+ m && /* @__PURE__ */ y(
198
208
  "div",
199
209
  {
200
210
  role: "tooltip",
@@ -209,249 +219,249 @@ function fe({
209
219
  }
210
220
  )
211
221
  ] }),
212
- /* @__PURE__ */ t("div", { id: p, children: m }),
213
- v && /* @__PURE__ */ t("div", { children: s.map((k, x) => /* @__PURE__ */ t(
222
+ /* @__PURE__ */ t("div", { id: b, children: f }),
223
+ v && /* @__PURE__ */ t("div", { children: a.map((S, $) => /* @__PURE__ */ t(
214
224
  "p",
215
225
  {
216
- id: x === 0 ? b : void 0,
226
+ id: $ === 0 ? p : void 0,
217
227
  className: "mt-1 text-xs text-red-500",
218
228
  role: "alert",
219
- children: k
229
+ children: S
220
230
  },
221
- `${k}-${x}`
231
+ `${S}-${$}`
222
232
  )) }),
223
- a && !v && /* @__PURE__ */ t("p", { className: "mt-1 text-xs text-gray-400", children: a })
233
+ s && !v && /* @__PURE__ */ t("p", { className: "mt-1 text-xs text-gray-400", children: s })
224
234
  ]
225
235
  }
226
236
  );
227
237
  }
228
- const me = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-text-input";
238
+ const pe = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-text-input";
229
239
  function J({
230
240
  value: e,
231
241
  onChange: n,
232
- onBlur: s,
242
+ onBlur: a,
233
243
  disabled: r,
234
- placeholder: a,
244
+ placeholder: s,
235
245
  inputType: o = "text",
236
- readOnly: i,
246
+ readOnly: l,
237
247
  prefix: u,
238
- suffix: l,
239
- maxLength: m,
248
+ suffix: i,
249
+ maxLength: f,
240
250
  className: d
241
251
  }) {
242
- const v = `${me} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${u ? "rounded-l-none" : ""} ${l ? "rounded-r-none" : ""} ${d ?? ""}`.trim(), p = /* @__PURE__ */ t(
252
+ const v = `${pe} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${u ? "rounded-l-none" : ""} ${i ? "rounded-r-none" : ""} ${d ?? ""}`.trim(), b = /* @__PURE__ */ t(
243
253
  "input",
244
254
  {
245
255
  type: o,
246
256
  className: v,
247
257
  style: { borderColor: void 0 },
248
258
  value: e ?? "",
249
- onChange: (b) => n(b.target.value),
250
- onFocus: (b) => {
251
- b.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
259
+ onChange: (p) => n(p.target.value),
260
+ onFocus: (p) => {
261
+ p.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
252
262
  },
253
- onBlur: (b) => {
254
- b.target.style.borderColor = "", s == null || s();
263
+ onBlur: (p) => {
264
+ p.target.style.borderColor = "", a == null || a();
255
265
  },
256
266
  disabled: r,
257
- placeholder: a,
258
- readOnly: i,
259
- maxLength: m,
267
+ placeholder: s,
268
+ readOnly: l,
269
+ maxLength: f,
260
270
  "aria-disabled": r || void 0,
261
- "aria-readonly": i || void 0
271
+ "aria-readonly": l || void 0
262
272
  }
263
273
  );
264
- return u || l ? /* @__PURE__ */ g("div", { className: "flex items-stretch", children: [
274
+ return u || i ? /* @__PURE__ */ y("div", { className: "flex items-stretch", children: [
265
275
  u && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: u }),
266
- p,
267
- l && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: l })
268
- ] }) : p;
276
+ b,
277
+ i && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: i })
278
+ ] }) : b;
269
279
  }
270
- const pe = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-number-input";
271
- function be({
280
+ const ge = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-number-input";
281
+ function ye({
272
282
  value: e,
273
283
  onChange: n,
274
- onBlur: s,
284
+ onBlur: a,
275
285
  disabled: r,
276
- placeholder: a,
286
+ placeholder: s,
277
287
  min: o,
278
- max: i,
288
+ max: l,
279
289
  step: u = 1,
280
- precision: l,
281
- readOnly: m,
290
+ precision: i,
291
+ readOnly: f,
282
292
  prefix: d,
283
- suffix: h,
284
- className: f
293
+ suffix: g,
294
+ className: m
285
295
  }) {
286
- const b = `${pe} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${d ? "rounded-l-none" : ""} ${h ? "rounded-r-none" : ""} ${f ?? ""}`.trim();
287
- function k(F) {
288
- const R = F.target.value;
289
- if (R === "") {
296
+ const p = `${ge} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${d ? "rounded-l-none" : ""} ${g ? "rounded-r-none" : ""} ${m ?? ""}`.trim();
297
+ function S(j) {
298
+ const E = j.target.value;
299
+ if (E === "") {
290
300
  n(null);
291
301
  return;
292
302
  }
293
- let j = Number.parseFloat(R);
294
- Number.isNaN(j) || (l !== void 0 && (j = Number.parseFloat(j.toFixed(l))), n(j));
303
+ let R = Number.parseFloat(E);
304
+ Number.isNaN(R) || (i !== void 0 && (R = Number.parseFloat(R.toFixed(i))), n(R));
295
305
  }
296
- const x = /* @__PURE__ */ t(
306
+ const $ = /* @__PURE__ */ t(
297
307
  "input",
298
308
  {
299
309
  type: "number",
300
- className: b,
310
+ className: p,
301
311
  value: e ?? "",
302
- onChange: k,
303
- onFocus: (F) => {
304
- F.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
312
+ onChange: S,
313
+ onFocus: (j) => {
314
+ j.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
305
315
  },
306
- onBlur: (F) => {
307
- F.target.style.borderColor = "", s == null || s();
316
+ onBlur: (j) => {
317
+ j.target.style.borderColor = "", a == null || a();
308
318
  },
309
319
  disabled: r,
310
- placeholder: a,
320
+ placeholder: s,
311
321
  min: o,
312
- max: i,
322
+ max: l,
313
323
  step: u,
314
- readOnly: m,
324
+ readOnly: f,
315
325
  "aria-disabled": r || void 0,
316
- "aria-readonly": m || void 0
326
+ "aria-readonly": f || void 0
317
327
  }
318
328
  );
319
- return d || h ? /* @__PURE__ */ g("div", { className: "flex items-stretch", children: [
329
+ return d || g ? /* @__PURE__ */ y("div", { className: "flex items-stretch", children: [
320
330
  d && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: d }),
321
- x,
322
- h && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: h })
323
- ] }) : x;
331
+ $,
332
+ g && /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-gray-300 bg-gray-50 px-3 text-sm text-gray-500", children: g })
333
+ ] }) : $;
324
334
  }
325
- const ge = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 resize-y focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-textarea-input";
326
- function ye({
335
+ const he = "w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm placeholder:text-gray-400 resize-y focus:outline-none focus:ring-2 focus:ring-blue-500/20 transition-colors duration-200 fc-textarea-input";
336
+ function xe({
327
337
  value: e,
328
338
  onChange: n,
329
- onBlur: s,
339
+ onBlur: a,
330
340
  disabled: r,
331
- placeholder: a,
341
+ placeholder: s,
332
342
  rows: o = 3,
333
- readOnly: i,
343
+ readOnly: l,
334
344
  autoResize: u,
335
- maxLength: l,
336
- className: m
345
+ maxLength: i,
346
+ className: f
337
347
  }) {
338
- const d = L(null), h = D(() => {
348
+ const d = A(null), g = D(() => {
339
349
  if (!u || !d.current) return;
340
- const p = d.current;
341
- p.style.height = "auto", p.style.height = `${p.scrollHeight}px`;
350
+ const b = d.current;
351
+ b.style.height = "auto", b.style.height = `${b.scrollHeight}px`;
342
352
  }, [u]);
343
- B(() => {
344
- h();
345
- }, [e, h]);
346
- const v = `${ge} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${u ? "resize-none overflow-hidden" : ""} ${m ?? ""}`.trim();
353
+ re(() => {
354
+ g();
355
+ }, [e, g]);
356
+ const v = `${he} ${r ? "opacity-50 cursor-not-allowed bg-gray-100" : ""} ${u ? "resize-none overflow-hidden" : ""} ${f ?? ""}`.trim();
347
357
  return /* @__PURE__ */ t(
348
358
  "textarea",
349
359
  {
350
360
  ref: d,
351
361
  className: v,
352
362
  value: e ?? "",
353
- onChange: (p) => {
354
- n(p.target.value);
363
+ onChange: (b) => {
364
+ n(b.target.value);
355
365
  },
356
- onFocus: (p) => {
357
- p.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
366
+ onFocus: (b) => {
367
+ b.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
358
368
  },
359
- onBlur: (p) => {
360
- p.target.style.borderColor = "", s == null || s();
369
+ onBlur: (b) => {
370
+ b.target.style.borderColor = "", a == null || a();
361
371
  },
362
372
  disabled: r,
363
- placeholder: a,
373
+ placeholder: s,
364
374
  rows: o,
365
- readOnly: i,
366
- maxLength: l,
375
+ readOnly: l,
376
+ maxLength: i,
367
377
  "aria-disabled": r || void 0,
368
- "aria-readonly": i || void 0
378
+ "aria-readonly": l || void 0
369
379
  }
370
380
  );
371
381
  }
372
- function he({
382
+ function ve({
373
383
  value: e,
374
384
  onChange: n,
375
- onBlur: s,
385
+ onBlur: a,
376
386
  disabled: r,
377
- placeholder: a = "Select...",
387
+ placeholder: s = "Select...",
378
388
  options: o,
379
- multiple: i = !1,
389
+ multiple: l = !1,
380
390
  searchable: u = !1,
381
- clearable: l = !1,
382
- className: m
391
+ clearable: i = !1,
392
+ className: f
383
393
  }) {
384
- const [d, h] = S(!1), [f, C] = S(""), [v, p] = S(-1), b = L(null), k = L(null), x = e == null ? [] : Array.isArray(e) ? e : [e], F = (() => {
385
- if (x.length === 0 || i) return "";
386
- const c = o.find((w) => w.value === x[0]);
387
- return (c == null ? void 0 : c.label) ?? String(x[0]);
388
- })(), R = f ? o.filter((c) => c.label.toLowerCase().includes(f.toLowerCase())) : o;
389
- function j(c) {
390
- return x.includes(c);
394
+ const [d, g] = F(!1), [m, h] = F(""), [v, b] = F(-1), p = A(null), S = A(null), $ = e == null ? [] : Array.isArray(e) ? e : [e], j = (() => {
395
+ if ($.length === 0 || l) return "";
396
+ const c = o.find((w) => w.value === $[0]);
397
+ return (c == null ? void 0 : c.label) ?? String($[0]);
398
+ })(), E = m ? o.filter((c) => c.label.toLowerCase().includes(m.toLowerCase())) : o;
399
+ function R(c) {
400
+ return $.includes(c);
391
401
  }
392
- function H(c) {
393
- const w = o.find((y) => y.value === c);
402
+ function M(c) {
403
+ const w = o.find((x) => x.value === c);
394
404
  return (w == null ? void 0 : w.label) ?? String(c);
395
405
  }
396
- const T = D(() => {
397
- h(!0), p(-1), C(""), setTimeout(() => {
406
+ const k = D(() => {
407
+ g(!0), b(-1), h(""), setTimeout(() => {
398
408
  var c;
399
- return (c = k.current) == null ? void 0 : c.focus();
409
+ return (c = S.current) == null ? void 0 : c.focus();
400
410
  }, 0);
401
- }, []), A = D(() => {
402
- h(!1), C(""), s == null || s();
403
- }, [s]);
404
- function V() {
405
- r || (d ? A() : T());
411
+ }, []), I = D(() => {
412
+ g(!1), h(""), a == null || a();
413
+ }, [a]);
414
+ function z() {
415
+ r || (d ? I() : k());
406
416
  }
407
- function P(c) {
417
+ function q(c) {
408
418
  if (!c.disabled)
409
- if (i) {
410
- const w = [...x], y = w.indexOf(c.value);
411
- y >= 0 ? w.splice(y, 1) : w.push(c.value), n(w);
419
+ if (l) {
420
+ const w = [...$], x = w.indexOf(c.value);
421
+ x >= 0 ? w.splice(x, 1) : w.push(c.value), n(w);
412
422
  } else
413
- n(c.value), A();
423
+ n(c.value), I();
414
424
  }
415
425
  function _(c) {
416
426
  if (r) return;
417
- const w = x.filter((y) => y !== c);
418
- n(w.length ? w : i ? [] : null);
427
+ const w = $.filter((x) => x !== c);
428
+ n(w.length ? w : l ? [] : null);
419
429
  }
420
430
  function U(c) {
421
- c.stopPropagation(), n(i ? [] : null);
431
+ c.stopPropagation(), n(l ? [] : null);
422
432
  }
423
- function q(c) {
433
+ function H(c) {
424
434
  if (!d) {
425
- (c.key === "Enter" || c.key === " " || c.key === "ArrowDown") && (c.preventDefault(), T());
435
+ (c.key === "Enter" || c.key === " " || c.key === "ArrowDown") && (c.preventDefault(), k());
426
436
  return;
427
437
  }
428
438
  switch (c.key) {
429
439
  case "ArrowDown":
430
- c.preventDefault(), p((w) => Math.min(w + 1, R.length - 1));
440
+ c.preventDefault(), b((w) => Math.min(w + 1, E.length - 1));
431
441
  break;
432
442
  case "ArrowUp":
433
- c.preventDefault(), p((w) => Math.max(w - 1, 0));
443
+ c.preventDefault(), b((w) => Math.max(w - 1, 0));
434
444
  break;
435
445
  case "Enter":
436
- c.preventDefault(), v >= 0 && R[v] && P(R[v]);
446
+ c.preventDefault(), v >= 0 && E[v] && q(E[v]);
437
447
  break;
438
448
  case "Escape":
439
- c.preventDefault(), A();
449
+ c.preventDefault(), I();
440
450
  break;
441
451
  }
442
452
  }
443
- return B(() => {
453
+ return re(() => {
444
454
  function c(w) {
445
- b.current && !b.current.contains(w.target) && A();
455
+ p.current && !p.current.contains(w.target) && I();
446
456
  }
447
457
  return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
448
- }, [A]), /* @__PURE__ */ g(
458
+ }, [I]), /* @__PURE__ */ y(
449
459
  "div",
450
460
  {
451
- ref: b,
452
- className: `relative w-full ${r ? "opacity-50 cursor-not-allowed" : ""} ${m ?? ""}`,
461
+ ref: p,
462
+ className: `relative w-full ${r ? "opacity-50 cursor-not-allowed" : ""} ${f ?? ""}`,
453
463
  children: [
454
- /* @__PURE__ */ g(
464
+ /* @__PURE__ */ y(
455
465
  "div",
456
466
  {
457
467
  role: "combobox",
@@ -460,11 +470,11 @@ function he({
460
470
  tabIndex: 0,
461
471
  className: `flex min-h-[38px] w-full cursor-pointer items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm transition-colors duration-200 ${d ? "ring-2 ring-blue-500/20" : ""} ${r ? "pointer-events-none bg-gray-100" : ""}`,
462
472
  style: d ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {},
463
- onClick: V,
464
- onKeyDown: q,
473
+ onClick: z,
474
+ onKeyDown: H,
465
475
  children: [
466
- /* @__PURE__ */ g("div", { className: "flex flex-1 flex-wrap items-center gap-1", children: [
467
- i && x.map((c) => /* @__PURE__ */ g(
476
+ /* @__PURE__ */ y("div", { className: "flex flex-1 flex-wrap items-center gap-1", children: [
477
+ l && $.map((c) => /* @__PURE__ */ y(
468
478
  "span",
469
479
  {
470
480
  className: "inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs",
@@ -473,7 +483,7 @@ function he({
473
483
  color: "var(--fc-color-primary, #3b82f6)"
474
484
  },
475
485
  children: [
476
- H(c),
486
+ M(c),
477
487
  /* @__PURE__ */ t(
478
488
  "button",
479
489
  {
@@ -491,11 +501,11 @@ function he({
491
501
  },
492
502
  String(c)
493
503
  )),
494
- !i && F && /* @__PURE__ */ t("span", { className: "truncate", children: F }),
495
- x.length === 0 && !i && /* @__PURE__ */ t("span", { className: "text-gray-400", children: a }),
496
- i && x.length === 0 && /* @__PURE__ */ t("span", { className: "text-gray-400", children: a })
504
+ !l && j && /* @__PURE__ */ t("span", { className: "truncate", children: j }),
505
+ $.length === 0 && !l && /* @__PURE__ */ t("span", { className: "text-gray-400", children: s }),
506
+ l && $.length === 0 && /* @__PURE__ */ t("span", { className: "text-gray-400", children: s })
497
507
  ] }),
498
- l && x.length > 0 && !r && /* @__PURE__ */ t(
508
+ i && $.length > 0 && !r && /* @__PURE__ */ t(
499
509
  "button",
500
510
  {
501
511
  type: "button",
@@ -525,17 +535,17 @@ function he({
525
535
  ]
526
536
  }
527
537
  ),
528
- d && /* @__PURE__ */ g("div", { className: "absolute z-50 mt-1 w-full rounded-md border border-gray-200 bg-white shadow-lg", children: [
538
+ d && /* @__PURE__ */ y("div", { className: "absolute z-50 mt-1 w-full rounded-md border border-gray-200 bg-white shadow-lg", children: [
529
539
  u && /* @__PURE__ */ t("div", { className: "border-b border-gray-200 p-2", children: /* @__PURE__ */ t(
530
540
  "input",
531
541
  {
532
- ref: k,
542
+ ref: S,
533
543
  type: "text",
534
544
  className: "w-full rounded border border-gray-300 px-2 py-1 text-sm focus:outline-none fc-select-search",
535
545
  placeholder: "Search...",
536
- value: f,
537
- onChange: (c) => C(c.target.value),
538
- onKeyDown: q,
546
+ value: m,
547
+ onChange: (c) => h(c.target.value),
548
+ onKeyDown: H,
539
549
  onFocus: (c) => {
540
550
  c.target.style.borderColor = "var(--fc-color-primary, #3b82f6)";
541
551
  },
@@ -544,45 +554,45 @@ function he({
544
554
  }
545
555
  }
546
556
  ) }),
547
- /* @__PURE__ */ g("ul", { role: "listbox", className: "max-h-60 overflow-auto py-1", children: [
548
- R.map((c, w) => /* @__PURE__ */ t(
557
+ /* @__PURE__ */ y("ul", { role: "listbox", className: "max-h-60 overflow-auto py-1", children: [
558
+ E.map((c, w) => /* @__PURE__ */ t(
549
559
  "li",
550
560
  {
551
561
  role: "option",
552
- "aria-selected": j(c.value),
553
- className: `cursor-pointer px-3 py-2 text-sm transition-colors duration-200 ${j(c.value) ? "" : "text-gray-900"} ${v === w ? "bg-gray-100" : ""} ${c.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-gray-50"}`,
554
- style: j(c.value) ? {
562
+ "aria-selected": R(c.value),
563
+ className: `cursor-pointer px-3 py-2 text-sm transition-colors duration-200 ${R(c.value) ? "" : "text-gray-900"} ${v === w ? "bg-gray-100" : ""} ${c.disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-gray-50"}`,
564
+ style: R(c.value) ? {
555
565
  backgroundColor: "color-mix(in srgb, var(--fc-color-primary, #3b82f6) 8%, white)",
556
566
  color: "var(--fc-color-primary, #3b82f6)"
557
567
  } : {},
558
- onClick: () => P(c),
559
- onMouseEnter: () => p(w),
568
+ onClick: () => q(c),
569
+ onMouseEnter: () => b(w),
560
570
  children: c.label
561
571
  },
562
572
  String(c.value)
563
573
  )),
564
- R.length === 0 && /* @__PURE__ */ t("li", { className: "px-3 py-2 text-sm text-gray-400", children: "No options found" })
574
+ E.length === 0 && /* @__PURE__ */ t("li", { className: "px-3 py-2 text-sm text-gray-400", children: "No options found" })
565
575
  ] })
566
576
  ] })
567
577
  ]
568
578
  }
569
579
  );
570
580
  }
571
- function xe({
581
+ function we({
572
582
  value: e,
573
583
  onChange: n,
574
- onBlur: s,
584
+ onBlur: a,
575
585
  disabled: r,
576
- label: a,
586
+ label: s,
577
587
  className: o
578
588
  }) {
579
- function i() {
589
+ function l() {
580
590
  r || n(!e);
581
591
  }
582
- function u(l) {
583
- (l.key === " " || l.key === "Enter") && (l.preventDefault(), i());
592
+ function u(i) {
593
+ (i.key === " " || i.key === "Enter") && (i.preventDefault(), l());
584
594
  }
585
- return /* @__PURE__ */ g(
595
+ return /* @__PURE__ */ y(
586
596
  "label",
587
597
  {
588
598
  className: `inline-flex items-center gap-2 select-none ${r ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${o ?? ""}`,
@@ -594,7 +604,7 @@ function xe({
594
604
  checked: e ?? !1,
595
605
  onChange: () => {
596
606
  },
597
- onBlur: s,
607
+ onBlur: a,
598
608
  disabled: r,
599
609
  className: "sr-only"
600
610
  }
@@ -611,8 +621,8 @@ function xe({
611
621
  borderColor: "var(--fc-color-primary, #3b82f6)",
612
622
  backgroundColor: "var(--fc-color-primary, #3b82f6)"
613
623
  } : {},
614
- onClick: (l) => {
615
- l.preventDefault(), i();
624
+ onClick: (i) => {
625
+ i.preventDefault(), l();
616
626
  },
617
627
  onKeyDown: u,
618
628
  children: e && /* @__PURE__ */ t(
@@ -629,52 +639,52 @@ function xe({
629
639
  )
630
640
  }
631
641
  ),
632
- a && /* @__PURE__ */ t("span", { className: "text-sm text-gray-700", children: a })
642
+ s && /* @__PURE__ */ t("span", { className: "text-sm text-gray-700", children: s })
633
643
  ]
634
644
  }
635
645
  );
636
646
  }
637
- function ve({
647
+ function Ne({
638
648
  name: e,
639
649
  value: n,
640
- onChange: s,
650
+ onChange: a,
641
651
  onBlur: r,
642
- disabled: a,
652
+ disabled: s,
643
653
  options: o,
644
- inline: i = !1,
654
+ inline: l = !1,
645
655
  className: u
646
656
  }) {
647
- function l(f) {
648
- return n === f;
657
+ function i(m) {
658
+ return n === m;
649
659
  }
650
- function m(f) {
651
- return a === !0 || !!f.disabled;
660
+ function f(m) {
661
+ return s === !0 || !!m.disabled;
652
662
  }
653
- function d(f) {
654
- m(f) || s(f.value);
663
+ function d(m) {
664
+ f(m) || a(m.value);
655
665
  }
656
- function h(f, C) {
657
- (f.key === " " || f.key === "Enter") && (f.preventDefault(), d(C));
666
+ function g(m, h) {
667
+ (m.key === " " || m.key === "Enter") && (m.preventDefault(), d(h));
658
668
  }
659
669
  return /* @__PURE__ */ t(
660
670
  "div",
661
671
  {
662
672
  role: "radiogroup",
663
- className: `${i ? "flex flex-wrap gap-4" : "flex flex-col gap-2"} ${u ?? ""}`,
664
- children: o.map((f) => /* @__PURE__ */ g(
673
+ className: `${l ? "flex flex-wrap gap-4" : "flex flex-col gap-2"} ${u ?? ""}`,
674
+ children: o.map((m) => /* @__PURE__ */ y(
665
675
  "label",
666
676
  {
667
- className: `inline-flex items-center gap-2 select-none ${m(f) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
677
+ className: `inline-flex items-center gap-2 select-none ${f(m) ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}`,
668
678
  children: [
669
679
  /* @__PURE__ */ t(
670
680
  "input",
671
681
  {
672
682
  type: "radio",
673
- checked: l(f.value),
674
- disabled: m(f),
683
+ checked: i(m.value),
684
+ disabled: f(m),
675
685
  className: "sr-only",
676
686
  name: e,
677
- onChange: () => d(f),
687
+ onChange: () => d(m),
678
688
  onBlur: r
679
689
  }
680
690
  ),
@@ -682,14 +692,14 @@ function ve({
682
692
  "div",
683
693
  {
684
694
  role: "radio",
685
- "aria-checked": l(f.value),
686
- "aria-disabled": m(f) || void 0,
695
+ "aria-checked": i(m.value),
696
+ "aria-disabled": f(m) || void 0,
687
697
  tabIndex: 0,
688
- className: `flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200 ${l(f.value) ? "" : "border-gray-300"}`,
689
- style: l(f.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {},
690
- onClick: () => d(f),
691
- onKeyDown: (C) => h(C, f),
692
- children: l(f.value) && /* @__PURE__ */ t(
698
+ className: `flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-200 ${i(m.value) ? "" : "border-gray-300"}`,
699
+ style: i(m.value) ? { borderColor: "var(--fc-color-primary, #3b82f6)" } : {},
700
+ onClick: () => d(m),
701
+ onKeyDown: (h) => g(h, m),
702
+ children: i(m.value) && /* @__PURE__ */ t(
693
703
  "div",
694
704
  {
695
705
  className: "h-2.5 w-2.5 rounded-full",
@@ -700,33 +710,33 @@ function ve({
700
710
  )
701
711
  }
702
712
  ),
703
- /* @__PURE__ */ t("span", { className: "text-sm text-gray-700", children: f.label })
713
+ /* @__PURE__ */ t("span", { className: "text-sm text-gray-700", children: m.label })
704
714
  ]
705
715
  },
706
- String(f.value)
716
+ String(m.value)
707
717
  ))
708
718
  }
709
719
  );
710
720
  }
711
- function we({
721
+ function Ce({
712
722
  value: e,
713
723
  onChange: n,
714
- onBlur: s,
724
+ onBlur: a,
715
725
  disabled: r,
716
- activeLabel: a,
726
+ activeLabel: s,
717
727
  inactiveLabel: o,
718
- className: i
728
+ className: l
719
729
  }) {
720
730
  function u() {
721
731
  r || n(!e);
722
732
  }
723
- function l(m) {
724
- (m.key === " " || m.key === "Enter") && (m.preventDefault(), u());
733
+ function i(f) {
734
+ (f.key === " " || f.key === "Enter") && (f.preventDefault(), u());
725
735
  }
726
- return /* @__PURE__ */ g(
736
+ return /* @__PURE__ */ y(
727
737
  "label",
728
738
  {
729
- className: `inline-flex items-center gap-2 select-none ${r ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${i ?? ""}`,
739
+ className: `inline-flex items-center gap-2 select-none ${r ? "opacity-50 cursor-not-allowed" : "cursor-pointer"} ${l ?? ""}`,
730
740
  children: [
731
741
  o && /* @__PURE__ */ t("span", { className: "text-sm text-gray-600", children: o }),
732
742
  /* @__PURE__ */ t(
@@ -735,7 +745,7 @@ function we({
735
745
  type: "checkbox",
736
746
  checked: e ?? !1,
737
747
  onChange: u,
738
- onBlur: s,
748
+ onBlur: a,
739
749
  disabled: r,
740
750
  className: "sr-only"
741
751
  }
@@ -751,7 +761,7 @@ function we({
751
761
  className: `relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)] ${e ? "" : "bg-gray-300"} ${r ? "pointer-events-none" : "focus:outline-none focus:ring-2 focus:ring-blue-500/20"}`,
752
762
  style: e ? { backgroundColor: "var(--fc-color-primary, #3b82f6)" } : {},
753
763
  onClick: u,
754
- onKeyDown: l,
764
+ onKeyDown: i,
755
765
  children: /* @__PURE__ */ t(
756
766
  "span",
757
767
  {
@@ -761,41 +771,41 @@ function we({
761
771
  )
762
772
  }
763
773
  ),
764
- a && /* @__PURE__ */ t("span", { className: "text-sm text-gray-600", children: a })
774
+ s && /* @__PURE__ */ t("span", { className: "text-sm text-gray-600", children: s })
765
775
  ]
766
776
  }
767
777
  );
768
778
  }
769
- function Ne({
779
+ function $e({
770
780
  value: e,
771
781
  onChange: n,
772
- onBlur: s,
782
+ onBlur: a,
773
783
  disabled: r,
774
- min: a = 0,
784
+ min: s = 0,
775
785
  max: o = 100,
776
- step: i = 1,
786
+ step: l = 1,
777
787
  showTooltip: u = !0,
778
- className: l
788
+ className: i
779
789
  }) {
780
- const [m, d] = S(!1), h = e ?? a, f = o - a, C = f === 0 ? 0 : (h - a) / f * 100;
781
- return /* @__PURE__ */ g(
790
+ const [f, d] = F(!1), g = e ?? s, m = o - s, h = m === 0 ? 0 : (g - s) / m * 100;
791
+ return /* @__PURE__ */ y(
782
792
  "div",
783
793
  {
784
- className: `relative w-full py-2 ${r ? "opacity-50 cursor-not-allowed" : ""} ${l ?? ""}`,
794
+ className: `relative w-full py-2 ${r ? "opacity-50 cursor-not-allowed" : ""} ${i ?? ""}`,
785
795
  children: [
786
- u && m && /* @__PURE__ */ t(
796
+ u && f && /* @__PURE__ */ t(
787
797
  "div",
788
798
  {
789
799
  className: "absolute -top-8 rounded bg-gray-800 px-2 py-1 text-xs text-white shadow-sm transition-opacity duration-200",
790
- style: { left: `calc(${C}% - 16px)` },
791
- children: h
800
+ style: { left: `calc(${h}% - 16px)` },
801
+ children: g
792
802
  }
793
803
  ),
794
804
  /* @__PURE__ */ t(
795
805
  "input",
796
806
  {
797
807
  type: "range",
798
- value: h,
808
+ value: g,
799
809
  onChange: (v) => n(Number.parseFloat(v.target.value)),
800
810
  onMouseDown: () => d(!0),
801
811
  onMouseUp: () => d(!1),
@@ -803,84 +813,84 @@ function Ne({
803
813
  onTouchEnd: () => d(!1),
804
814
  onFocus: () => d(!0),
805
815
  onBlur: (v) => {
806
- d(!1), s == null || s();
816
+ d(!1), a == null || a();
807
817
  },
808
818
  disabled: r,
809
- min: a,
819
+ min: s,
810
820
  max: o,
811
- step: i,
812
- "aria-valuenow": h,
813
- "aria-valuemin": a,
821
+ step: l,
822
+ "aria-valuenow": g,
823
+ "aria-valuemin": s,
814
824
  "aria-valuemax": o,
815
825
  "aria-disabled": r || void 0,
816
826
  className: "h-2 w-full cursor-pointer appearance-none rounded-full bg-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500/20 disabled:pointer-events-none",
817
827
  style: { accentColor: "var(--fc-color-primary, #3b82f6)" }
818
828
  }
819
829
  ),
820
- /* @__PURE__ */ g("div", { className: "mt-1 flex justify-between text-xs text-gray-400", children: [
821
- /* @__PURE__ */ t("span", { children: a }),
830
+ /* @__PURE__ */ y("div", { className: "mt-1 flex justify-between text-xs text-gray-400", children: [
831
+ /* @__PURE__ */ t("span", { children: s }),
822
832
  /* @__PURE__ */ t("span", { children: o })
823
833
  ] })
824
834
  ]
825
835
  }
826
836
  );
827
837
  }
828
- function M(e) {
838
+ function V(e) {
829
839
  return e.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`);
830
840
  }
831
- function Ce(e) {
841
+ function ke(e) {
832
842
  if (!e) return {};
833
843
  const n = {};
834
844
  if (e.colors)
835
- for (const [s, r] of Object.entries(e.colors))
836
- r && (n[`--fc-color-${M(s)}`] = r);
845
+ for (const [a, r] of Object.entries(e.colors))
846
+ r && (n[`--fc-color-${V(a)}`] = r);
837
847
  if (e.typography)
838
- for (const [s, r] of Object.entries(e.typography))
839
- r && (n[`--fc-${M(s)}`] = r);
848
+ for (const [a, r] of Object.entries(e.typography))
849
+ r && (n[`--fc-${V(a)}`] = r);
840
850
  if (e.spacing)
841
- for (const [s, r] of Object.entries(e.spacing))
842
- r && (n[`--fc-${M(s)}`] = r);
851
+ for (const [a, r] of Object.entries(e.spacing))
852
+ r && (n[`--fc-${V(a)}`] = r);
843
853
  if (e.borders)
844
- for (const [s, r] of Object.entries(e.borders))
845
- r && (n[`--fc-border-${M(s)}`] = r);
854
+ for (const [a, r] of Object.entries(e.borders))
855
+ r && (n[`--fc-border-${V(a)}`] = r);
846
856
  if (e.shadows)
847
- for (const [s, r] of Object.entries(e.shadows))
848
- r && (n[`--fc-shadow-${M(s)}`] = r);
857
+ for (const [a, r] of Object.entries(e.shadows))
858
+ r && (n[`--fc-shadow-${V(a)}`] = r);
849
859
  if (e.transitions)
850
- for (const [s, r] of Object.entries(e.transitions))
851
- r && (n[`--fc-transition-${M(s)}`] = r);
860
+ for (const [a, r] of Object.entries(e.transitions))
861
+ r && (n[`--fc-transition-${V(a)}`] = r);
852
862
  return e.cssVars && Object.assign(n, e.cssVars), n;
853
863
  }
854
- function Q(e, n, s, r, a) {
855
- var l, m;
864
+ function Q(e, n, a, r, s) {
865
+ var i, f;
856
866
  const o = e.translations;
857
- if (!o) return a;
858
- const i = o[s];
859
- if ((l = i == null ? void 0 : i.messages) != null && l[n]) return i.messages[n];
867
+ if (!o) return s;
868
+ const l = o[a];
869
+ if ((i = l == null ? void 0 : l.messages) != null && i[n]) return l.messages[n];
860
870
  const u = o[r];
861
- return ((m = u == null ? void 0 : u.messages) == null ? void 0 : m[n]) ?? a;
871
+ return ((f = u == null ? void 0 : u.messages) == null ? void 0 : f[n]) ?? s;
862
872
  }
863
- function X(e, n, s, r, a) {
873
+ function X(e, n, a, r, s) {
864
874
  const o = e.translations;
865
- if (!o) return a;
866
- const i = o[s];
867
- if (i != null && i[n]) return i[n];
875
+ if (!o) return s;
876
+ const l = o[a];
877
+ if (l != null && l[n]) return l[n];
868
878
  const u = o[r];
869
- return (u == null ? void 0 : u[n]) ?? a;
879
+ return (u == null ? void 0 : u[n]) ?? s;
870
880
  }
871
881
  function Y(e) {
872
882
  return Array.isArray(e) ? e : [];
873
883
  }
874
- function $e({ field: e, value: n, onChange: s, onBlur: r, disabled: a }) {
884
+ function Se({ field: e, value: n, onChange: a, onBlur: r, disabled: s }) {
875
885
  switch (e.type) {
876
886
  case "text":
877
887
  return /* @__PURE__ */ t(
878
888
  J,
879
889
  {
880
890
  value: String(n ?? ""),
881
- onChange: s,
891
+ onChange: a,
882
892
  onBlur: r,
883
- disabled: a,
893
+ disabled: s,
884
894
  placeholder: e.placeholder,
885
895
  inputType: e.inputType,
886
896
  readOnly: e.readOnly
@@ -888,12 +898,12 @@ function $e({ field: e, value: n, onChange: s, onBlur: r, disabled: a }) {
888
898
  );
889
899
  case "number":
890
900
  return /* @__PURE__ */ t(
891
- be,
901
+ ye,
892
902
  {
893
903
  value: n,
894
- onChange: s,
904
+ onChange: a,
895
905
  onBlur: r,
896
- disabled: a,
906
+ disabled: s,
897
907
  placeholder: e.placeholder,
898
908
  min: e.min,
899
909
  max: e.max,
@@ -903,12 +913,12 @@ function $e({ field: e, value: n, onChange: s, onBlur: r, disabled: a }) {
903
913
  );
904
914
  case "textarea":
905
915
  return /* @__PURE__ */ t(
906
- ye,
916
+ xe,
907
917
  {
908
918
  value: String(n ?? ""),
909
- onChange: s,
919
+ onChange: a,
910
920
  onBlur: r,
911
- disabled: a,
921
+ disabled: s,
912
922
  placeholder: e.placeholder,
913
923
  rows: e.rows,
914
924
  readOnly: e.readOnly
@@ -916,56 +926,56 @@ function $e({ field: e, value: n, onChange: s, onBlur: r, disabled: a }) {
916
926
  );
917
927
  case "select":
918
928
  return /* @__PURE__ */ t(
919
- he,
929
+ ve,
920
930
  {
921
931
  value: n,
922
- onChange: s,
932
+ onChange: a,
923
933
  onBlur: r,
924
- disabled: a,
934
+ disabled: s,
925
935
  placeholder: e.placeholder,
926
936
  options: Y(e.options)
927
937
  }
928
938
  );
929
939
  case "checkbox":
930
940
  return /* @__PURE__ */ t(
931
- xe,
941
+ we,
932
942
  {
933
943
  value: !!n,
934
- onChange: s,
944
+ onChange: a,
935
945
  onBlur: r,
936
- disabled: a
946
+ disabled: s
937
947
  }
938
948
  );
939
949
  case "radio":
940
950
  return /* @__PURE__ */ t(
941
- ve,
951
+ Ne,
942
952
  {
943
953
  name: e.name,
944
954
  value: n,
945
- onChange: s,
955
+ onChange: a,
946
956
  onBlur: r,
947
- disabled: a,
957
+ disabled: s,
948
958
  options: Y(e.options)
949
959
  }
950
960
  );
951
961
  case "switch":
952
962
  return /* @__PURE__ */ t(
953
- we,
963
+ Ce,
954
964
  {
955
965
  value: !!n,
956
- onChange: s,
966
+ onChange: a,
957
967
  onBlur: r,
958
- disabled: a
968
+ disabled: s
959
969
  }
960
970
  );
961
971
  case "slider":
962
972
  return /* @__PURE__ */ t(
963
- Ne,
973
+ $e,
964
974
  {
965
975
  value: n,
966
- onChange: s,
976
+ onChange: a,
967
977
  onBlur: r,
968
- disabled: a,
978
+ disabled: s,
969
979
  min: e.min,
970
980
  max: e.max,
971
981
  step: e.step
@@ -976,28 +986,28 @@ function $e({ field: e, value: n, onChange: s, onBlur: r, disabled: a }) {
976
986
  J,
977
987
  {
978
988
  value: String(n ?? ""),
979
- onChange: s,
989
+ onChange: a,
980
990
  onBlur: r,
981
- disabled: a,
991
+ disabled: s,
982
992
  placeholder: e.placeholder
983
993
  }
984
994
  );
985
995
  }
986
996
  }
987
- function re(e) {
997
+ function ae(e) {
988
998
  return e === "full" ? { gridColumn: "1 / -1" } : e === "auto" ? { gridColumn: "auto" } : typeof e == "number" ? { gridColumn: `span ${e} / span ${e}` } : { gridColumn: "span 12 / span 12" };
989
999
  }
990
- function ke(e, n, s) {
991
- const r = n.errors[e.name] ?? [], a = e.disabled === !0 || !1, o = {
1000
+ function Fe(e, n, a) {
1001
+ const r = n.errors[e.name] ?? [], s = e.disabled === !0 || !1, o = {
992
1002
  field: e,
993
1003
  value: n.values[e.name],
994
- onChange: (l) => n.setFieldValue(e.name, l),
1004
+ onChange: (i) => n.setFieldValue(e.name, i),
995
1005
  onBlur: () => n.validateField(e.name),
996
1006
  errors: r,
997
- disabled: a
998
- }, u = (s == null ? void 0 : s[e.type]) ?? $e;
1007
+ disabled: s
1008
+ }, u = (a == null ? void 0 : a[e.type]) ?? Se;
999
1009
  return /* @__PURE__ */ t(
1000
- fe,
1010
+ be,
1001
1011
  {
1002
1012
  label: e.label,
1003
1013
  required: e.required,
@@ -1015,8 +1025,8 @@ function ke(e, n, s) {
1015
1025
  e.name
1016
1026
  );
1017
1027
  }
1018
- function Se(e, n, s) {
1019
- const a = {
1028
+ function De(e, n, a) {
1029
+ const s = {
1020
1030
  start: "items-start",
1021
1031
  center: "items-center",
1022
1032
  end: "items-end",
@@ -1025,46 +1035,46 @@ function Se(e, n, s) {
1025
1035
  return /* @__PURE__ */ t(
1026
1036
  "div",
1027
1037
  {
1028
- className: `grid grid-cols-12 ${a} ${e.className ?? ""}`,
1038
+ className: `grid grid-cols-12 ${s} ${e.className ?? ""}`,
1029
1039
  style: { gap: o },
1030
1040
  role: "group",
1031
- children: e.children.map((i, u) => /* @__PURE__ */ t(
1041
+ children: e.children.map((l, u) => /* @__PURE__ */ t(
1032
1042
  "div",
1033
1043
  {
1034
- style: re(O(i) ? i.span : void 0),
1035
- children: K(i, n, s)
1044
+ style: ae(L(l) ? l.span : void 0),
1045
+ children: P(l, n, a)
1036
1046
  },
1037
- O(i) ? i.name : `row-child-${u}`
1047
+ L(l) ? l.name : `row-child-${u}`
1038
1048
  ))
1039
1049
  }
1040
1050
  );
1041
1051
  }
1042
- function Fe({
1052
+ function Re({
1043
1053
  node: e,
1044
1054
  form: n,
1045
- components: s
1055
+ components: a
1046
1056
  }) {
1047
- const [r, a] = S(e.collapsed ?? !1), o = e.title ? `fc-group-${e.title.toLowerCase().replace(/\s+/g, "-")}` : void 0;
1048
- function i() {
1049
- e.collapsible && a(!r);
1057
+ const [r, s] = F(e.collapsed ?? !1), o = e.title ? `fc-group-${e.title.toLowerCase().replace(/\s+/g, "-")}` : void 0;
1058
+ function l() {
1059
+ e.collapsible && s(!r);
1050
1060
  }
1051
1061
  const u = e.collapsible ? "button" : "div";
1052
- return /* @__PURE__ */ g(
1062
+ return /* @__PURE__ */ y(
1053
1063
  "fieldset",
1054
1064
  {
1055
1065
  className: `rounded-lg border border-gray-200 bg-white ${e.className ?? ""}`,
1056
1066
  "aria-labelledby": o,
1057
1067
  children: [
1058
- (e.title || e.description) && /* @__PURE__ */ t("div", { className: "border-b border-gray-100 px-4 py-3", children: /* @__PURE__ */ g(
1068
+ (e.title || e.description) && /* @__PURE__ */ t("div", { className: "border-b border-gray-100 px-4 py-3", children: /* @__PURE__ */ y(
1059
1069
  u,
1060
1070
  {
1061
1071
  type: e.collapsible ? "button" : void 0,
1062
1072
  className: `flex w-full items-center justify-between text-left ${e.collapsible ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500/40 rounded" : ""}`,
1063
1073
  "aria-expanded": e.collapsible ? !r : void 0,
1064
1074
  "aria-controls": e.collapsible ? `fc-group-body-${o}` : void 0,
1065
- onClick: i,
1075
+ onClick: l,
1066
1076
  children: [
1067
- /* @__PURE__ */ g("div", { children: [
1077
+ /* @__PURE__ */ y("div", { children: [
1068
1078
  e.title && /* @__PURE__ */ t(
1069
1079
  "legend",
1070
1080
  {
@@ -1101,48 +1111,48 @@ function Fe({
1101
1111
  {
1102
1112
  id: e.collapsible ? `fc-group-body-${o}` : void 0,
1103
1113
  className: "p-4",
1104
- children: e.children.map((l, m) => /* @__PURE__ */ t("div", { children: K(l, n, s) }, O(l) ? l.name : `group-child-${m}`))
1114
+ children: e.children.map((i, f) => /* @__PURE__ */ t("div", { children: P(i, n, a) }, L(i) ? i.name : `group-child-${f}`))
1105
1115
  }
1106
1116
  )
1107
1117
  ]
1108
1118
  }
1109
1119
  );
1110
1120
  }
1111
- function De({
1121
+ function je({
1112
1122
  node: e,
1113
1123
  form: n,
1114
- components: s
1124
+ components: a
1115
1125
  }) {
1116
- const [r, a] = S(0), [o, i] = S(/* @__PURE__ */ new Set()), u = e.steps, l = u.length, m = r === 0, d = r === l - 1;
1117
- function h() {
1118
- d || (i((p) => {
1119
- const b = new Set(p);
1120
- return b.add(r), b;
1121
- }), a((p) => p + 1));
1126
+ const [r, s] = F(0), [o, l] = F(/* @__PURE__ */ new Set()), u = e.steps, i = u.length, f = r === 0, d = r === i - 1;
1127
+ function g() {
1128
+ d || (l((b) => {
1129
+ const p = new Set(b);
1130
+ return p.add(r), p;
1131
+ }), s((b) => b + 1));
1122
1132
  }
1123
- function f() {
1124
- m || a((p) => p - 1);
1133
+ function m() {
1134
+ f || s((b) => b - 1);
1125
1135
  }
1126
- function C(p) {
1127
- e.linear && p > r || a(p);
1136
+ function h(b) {
1137
+ e.linear && b > r || s(b);
1128
1138
  }
1129
1139
  const v = u[r];
1130
- return /* @__PURE__ */ g("div", { className: `space-y-6 ${e.className ?? ""}`, children: [
1131
- /* @__PURE__ */ t("nav", { "aria-label": "Form steps", className: "flex items-center justify-center", children: /* @__PURE__ */ t("ol", { className: "flex items-center gap-0", children: u.map((p, b) => /* @__PURE__ */ g("li", { className: "flex items-center", children: [
1140
+ return /* @__PURE__ */ y("div", { className: `space-y-6 ${e.className ?? ""}`, children: [
1141
+ /* @__PURE__ */ t("nav", { "aria-label": "Form steps", className: "flex items-center justify-center", children: /* @__PURE__ */ t("ol", { className: "flex items-center gap-0", children: u.map((b, p) => /* @__PURE__ */ y("li", { className: "flex items-center", children: [
1132
1142
  /* @__PURE__ */ t(
1133
1143
  "button",
1134
1144
  {
1135
1145
  type: "button",
1136
- disabled: e.linear === !0 && b > r,
1137
- "aria-current": b === r ? "step" : void 0,
1138
- "aria-label": `Step ${b + 1}: ${p.title}`,
1139
- className: `relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-xs font-semibold transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500/40 ${o.has(b) && b !== r ? "border-green-500 bg-green-500 text-white" : b !== r ? "border-gray-300 bg-white text-gray-500" : "text-white"} ${e.linear === !0 && b > r ? "cursor-not-allowed" : "cursor-pointer hover:shadow-md"}`,
1140
- style: b === r ? {
1146
+ disabled: e.linear === !0 && p > r,
1147
+ "aria-current": p === r ? "step" : void 0,
1148
+ "aria-label": `Step ${p + 1}: ${b.title}`,
1149
+ className: `relative flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 text-xs font-semibold transition-all duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500/40 ${o.has(p) && p !== r ? "border-green-500 bg-green-500 text-white" : p !== r ? "border-gray-300 bg-white text-gray-500" : "text-white"} ${e.linear === !0 && p > r ? "cursor-not-allowed" : "cursor-pointer hover:shadow-md"}`,
1150
+ style: p === r ? {
1141
1151
  borderColor: "var(--fc-color-primary, #3b82f6)",
1142
1152
  backgroundColor: "var(--fc-color-primary, #3b82f6)"
1143
1153
  } : {},
1144
- onClick: () => C(b),
1145
- children: o.has(b) && b !== r ? /* @__PURE__ */ t(
1154
+ onClick: () => h(p),
1155
+ children: o.has(p) && p !== r ? /* @__PURE__ */ t(
1146
1156
  "svg",
1147
1157
  {
1148
1158
  className: "h-4 w-4 transition-transform duration-200",
@@ -1159,36 +1169,36 @@ function De({
1159
1169
  }
1160
1170
  )
1161
1171
  }
1162
- ) : /* @__PURE__ */ t("span", { children: b + 1 })
1172
+ ) : /* @__PURE__ */ t("span", { children: p + 1 })
1163
1173
  }
1164
1174
  ),
1165
- b < u.length - 1 && /* @__PURE__ */ t(
1175
+ p < u.length - 1 && /* @__PURE__ */ t(
1166
1176
  "div",
1167
1177
  {
1168
- className: `mx-1 h-0.5 w-8 transition-colors duration-300 sm:w-12 ${o.has(b) ? "bg-green-500" : "bg-gray-200"}`
1178
+ className: `mx-1 h-0.5 w-8 transition-colors duration-300 sm:w-12 ${o.has(p) ? "bg-green-500" : "bg-gray-200"}`
1169
1179
  }
1170
1180
  )
1171
- ] }, p.title)) }) }),
1172
- v && /* @__PURE__ */ g("div", { className: "text-center", children: [
1181
+ ] }, b.title)) }) }),
1182
+ v && /* @__PURE__ */ y("div", { className: "text-center", children: [
1173
1183
  /* @__PURE__ */ t("h3", { className: "text-base font-semibold text-gray-800", children: v.title }),
1174
1184
  v.description && /* @__PURE__ */ t("p", { className: "mt-1 text-sm text-gray-500", children: v.description })
1175
1185
  ] }),
1176
- v && /* @__PURE__ */ t("div", { children: v.children.map((p, b) => /* @__PURE__ */ t("div", { children: K(p, n, s) }, O(p) ? p.name : `step-child-${b}`)) }),
1177
- /* @__PURE__ */ g("div", { className: "flex items-center justify-between border-t border-gray-100 pt-4", children: [
1186
+ v && /* @__PURE__ */ t("div", { children: v.children.map((b, p) => /* @__PURE__ */ t("div", { children: P(b, n, a) }, L(b) ? b.name : `step-child-${p}`)) }),
1187
+ /* @__PURE__ */ y("div", { className: "flex items-center justify-between border-t border-gray-100 pt-4", children: [
1178
1188
  /* @__PURE__ */ t(
1179
1189
  "button",
1180
1190
  {
1181
1191
  type: "button",
1182
- disabled: m,
1192
+ disabled: f,
1183
1193
  className: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50",
1184
- onClick: f,
1194
+ onClick: m,
1185
1195
  children: "Previous"
1186
1196
  }
1187
1197
  ),
1188
- /* @__PURE__ */ g("span", { className: "text-xs text-gray-400", children: [
1198
+ /* @__PURE__ */ y("span", { className: "text-xs text-gray-400", children: [
1189
1199
  r + 1,
1190
1200
  " / ",
1191
- l
1201
+ i
1192
1202
  ] }),
1193
1203
  d ? /* @__PURE__ */ t("div", { className: "w-[72px]" }) : /* @__PURE__ */ t(
1194
1204
  "button",
@@ -1198,30 +1208,30 @@ function De({
1198
1208
  style: {
1199
1209
  backgroundColor: "var(--fc-color-primary, #3b82f6)"
1200
1210
  },
1201
- onClick: h,
1211
+ onClick: g,
1202
1212
  children: "Next"
1203
1213
  }
1204
1214
  )
1205
1215
  ] })
1206
1216
  ] });
1207
1217
  }
1208
- function Re({
1218
+ function Ee({
1209
1219
  node: e,
1210
1220
  form: n,
1211
- components: s
1221
+ components: a
1212
1222
  }) {
1213
- const [r, a] = S(0), o = e.tabs, i = o[r], u = `fc-tabpanel-${r}`;
1214
- function l(m) {
1215
- a(m);
1223
+ const [r, s] = F(0), o = e.tabs, l = o[r], u = `fc-tabpanel-${r}`;
1224
+ function i(f) {
1225
+ s(f);
1216
1226
  }
1217
- return /* @__PURE__ */ g("div", { className: e.className ?? "", children: [
1227
+ return /* @__PURE__ */ y("div", { className: e.className ?? "", children: [
1218
1228
  /* @__PURE__ */ t(
1219
1229
  "div",
1220
1230
  {
1221
1231
  className: "relative flex border-b border-gray-200",
1222
1232
  role: "tablist",
1223
1233
  "aria-orientation": "horizontal",
1224
- children: o.map((m, d) => /* @__PURE__ */ g(
1234
+ children: o.map((f, d) => /* @__PURE__ */ y(
1225
1235
  "button",
1226
1236
  {
1227
1237
  id: `fc-tab-${d}`,
@@ -1232,9 +1242,9 @@ function Re({
1232
1242
  tabIndex: d === r ? 0 : -1,
1233
1243
  className: `relative px-4 py-2.5 text-sm font-medium transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-blue-500/40 ${d !== r ? "text-gray-500 hover:text-gray-700" : ""}`,
1234
1244
  style: d === r ? { color: "var(--fc-color-primary, #3b82f6)" } : {},
1235
- onClick: () => l(d),
1245
+ onClick: () => i(d),
1236
1246
  children: [
1237
- m.title,
1247
+ f.title,
1238
1248
  d === r && /* @__PURE__ */ t(
1239
1249
  "span",
1240
1250
  {
@@ -1246,11 +1256,11 @@ function Re({
1246
1256
  )
1247
1257
  ]
1248
1258
  },
1249
- m.title
1259
+ f.title
1250
1260
  ))
1251
1261
  }
1252
1262
  ),
1253
- i && /* @__PURE__ */ t(
1263
+ l && /* @__PURE__ */ t(
1254
1264
  "div",
1255
1265
  {
1256
1266
  id: u,
@@ -1258,31 +1268,31 @@ function Re({
1258
1268
  "aria-labelledby": `fc-tab-${r}`,
1259
1269
  tabIndex: 0,
1260
1270
  className: "pt-4",
1261
- children: i.children.map((m, d) => /* @__PURE__ */ t("div", { children: K(m, n, s) }, O(m) ? m.name : `tab-child-${d}`))
1271
+ children: l.children.map((f, d) => /* @__PURE__ */ t("div", { children: P(f, n, a) }, L(f) ? f.name : `tab-child-${d}`))
1262
1272
  }
1263
1273
  )
1264
1274
  ] });
1265
1275
  }
1266
- function je(e) {
1267
- return e.label ? /* @__PURE__ */ g("div", { className: `relative my-4 ${e.className ?? ""}`, children: [
1276
+ function Ie(e) {
1277
+ return e.label ? /* @__PURE__ */ y("div", { className: `relative my-4 ${e.className ?? ""}`, children: [
1268
1278
  /* @__PURE__ */ t("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("div", { className: "w-full border-t border-gray-200" }) }),
1269
1279
  /* @__PURE__ */ t("div", { className: "relative flex justify-center", children: /* @__PURE__ */ t("span", { className: "bg-white px-3 text-sm text-gray-500", children: e.label }) })
1270
1280
  ] }) : /* @__PURE__ */ t("hr", { className: `my-4 border-gray-200 ${e.className ?? ""}` });
1271
1281
  }
1272
- function K(e, n, s) {
1273
- if (O(e))
1274
- return ke(e, n, s);
1282
+ function P(e, n, a) {
1283
+ if (L(e))
1284
+ return Fe(e, n, a);
1275
1285
  switch (e.type) {
1276
1286
  case "row":
1277
- return Se(e, n, s);
1287
+ return De(e, n, a);
1278
1288
  case "group":
1279
- return /* @__PURE__ */ t(Fe, { node: e, form: n, components: s });
1289
+ return /* @__PURE__ */ t(Re, { node: e, form: n, components: a });
1280
1290
  case "steps":
1281
- return /* @__PURE__ */ t(De, { node: e, form: n, components: s });
1291
+ return /* @__PURE__ */ t(je, { node: e, form: n, components: a });
1282
1292
  case "tabs":
1283
- return /* @__PURE__ */ t(Re, { node: e, form: n, components: s });
1293
+ return /* @__PURE__ */ t(Ee, { node: e, form: n, components: a });
1284
1294
  case "divider":
1285
- return je(e);
1295
+ return Ie(e);
1286
1296
  case "html":
1287
1297
  return /* @__PURE__ */ t(
1288
1298
  "div",
@@ -1295,64 +1305,64 @@ function K(e, n, s) {
1295
1305
  return null;
1296
1306
  }
1297
1307
  }
1298
- function Ae({
1308
+ function Ve({
1299
1309
  schema: e,
1300
1310
  onSubmit: n,
1301
- onError: s,
1302
- locale: r = "en",
1303
- fallbackLocale: a = "en",
1311
+ onError: a,
1312
+ locale: r,
1313
+ fallbackLocale: s,
1304
1314
  theme: o,
1305
- components: i,
1315
+ components: l,
1306
1316
  className: u
1307
1317
  }) {
1308
- var b, k;
1309
- const l = de(e), m = Ce(o), d = Q(e, "title", r, a, ""), h = Q(e, "description", r, a, ""), f = X(e, "submit", r, a, "Submit"), C = X(e, "reset", r, a, "Reset"), v = async (x) => {
1310
- x.preventDefault(), n ? await l.submit(async (F) => {
1311
- await n(F);
1312
- }) : await l.validate(), !l.isValid && s && s(l.errors);
1313
- }, p = (x) => {
1314
- x.preventDefault(), l.reset();
1318
+ var R, M;
1319
+ const i = me(), f = r ?? i.locale ?? "en", d = s ?? i.fallbackLocale ?? "en", g = o ?? i.theme, m = l ?? i.components, h = fe(e), v = ke(g), b = Q(e, "title", f, d, ""), p = Q(e, "description", f, d, ""), S = X(e, "submit", f, d, "Submit"), $ = X(e, "reset", f, d, "Reset"), j = async (k) => {
1320
+ k.preventDefault(), n ? await h.submit(async (I) => {
1321
+ await n(I);
1322
+ }) : await h.validate(), !h.isValid && a && a(h.errors);
1323
+ }, E = (k) => {
1324
+ k.preventDefault(), h.reset();
1315
1325
  };
1316
- return /* @__PURE__ */ t(ee.Provider, { value: l, children: /* @__PURE__ */ g(
1326
+ return /* @__PURE__ */ t(te.Provider, { value: h, children: /* @__PURE__ */ y(
1317
1327
  "form",
1318
1328
  {
1319
- className: `fc-form-builder ${((b = o == null ? void 0 : o.components) == null ? void 0 : b.form) ?? ""} ${u ?? ""}`.trim(),
1320
- style: m,
1321
- onSubmit: v,
1322
- onReset: p,
1329
+ className: `fc-form-builder ${((R = g == null ? void 0 : g.components) == null ? void 0 : R.form) ?? ""} ${u ?? ""}`.trim(),
1330
+ style: v,
1331
+ onSubmit: j,
1332
+ onReset: E,
1323
1333
  noValidate: !0,
1324
1334
  children: [
1325
- (d || h) && /* @__PURE__ */ g("div", { className: "mb-6", children: [
1326
- d && /* @__PURE__ */ t("h2", { className: "text-lg font-semibold text-gray-900", children: d }),
1327
- h && /* @__PURE__ */ t("p", { className: "mt-1 text-sm text-gray-500", children: h })
1335
+ (b || p) && /* @__PURE__ */ y("div", { className: "mb-6", children: [
1336
+ b && /* @__PURE__ */ t("h2", { className: "text-lg font-semibold text-gray-900", children: b }),
1337
+ p && /* @__PURE__ */ t("p", { className: "mt-1 text-sm text-gray-500", children: p })
1328
1338
  ] }),
1329
- e.fields.map((x, F) => /* @__PURE__ */ t(
1339
+ e.fields.map((k, I) => /* @__PURE__ */ t(
1330
1340
  "div",
1331
1341
  {
1332
- style: O(x) ? re(x.span) : void 0,
1333
- children: K(x, l, i)
1342
+ style: L(k) ? ae(k.span) : void 0,
1343
+ children: P(k, h, m)
1334
1344
  },
1335
- O(x) ? x.name : `node-${F}`
1345
+ L(k) ? k.name : `node-${I}`
1336
1346
  )),
1337
- /* @__PURE__ */ g("div", { className: "mt-6 flex items-center gap-3", children: [
1338
- /* @__PURE__ */ g(
1347
+ /* @__PURE__ */ y("div", { className: "mt-6 flex items-center gap-3", children: [
1348
+ /* @__PURE__ */ y(
1339
1349
  "button",
1340
1350
  {
1341
1351
  type: "submit",
1342
- disabled: l.isSubmitting,
1343
- className: `fc-submit-btn rounded-md px-4 py-2 text-sm font-medium text-white transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50 ${((k = o == null ? void 0 : o.components) == null ? void 0 : k.button) ?? ""}`,
1352
+ disabled: h.isSubmitting,
1353
+ className: `fc-submit-btn rounded-md px-4 py-2 text-sm font-medium text-white transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50 ${((M = g == null ? void 0 : g.components) == null ? void 0 : M.button) ?? ""}`,
1344
1354
  style: {
1345
1355
  backgroundColor: "var(--fc-color-primary, #3b82f6)"
1346
1356
  },
1347
1357
  children: [
1348
- l.isSubmitting && /* @__PURE__ */ t(
1358
+ h.isSubmitting && /* @__PURE__ */ t(
1349
1359
  "span",
1350
1360
  {
1351
1361
  className: "mr-2 inline-block h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent",
1352
1362
  "aria-hidden": "true"
1353
1363
  }
1354
1364
  ),
1355
- f
1365
+ S
1356
1366
  ]
1357
1367
  }
1358
1368
  ),
@@ -1360,9 +1370,9 @@ function Ae({
1360
1370
  "button",
1361
1371
  {
1362
1372
  type: "reset",
1363
- disabled: l.isSubmitting,
1373
+ disabled: h.isSubmitting,
1364
1374
  className: "rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-50",
1365
- children: C
1375
+ children: $
1366
1376
  }
1367
1377
  )
1368
1378
  ] })
@@ -1371,9 +1381,11 @@ function Ae({
1371
1381
  ) });
1372
1382
  }
1373
1383
  export {
1374
- Ae as FormBuilder,
1375
- ee as FormContext,
1376
- de as useForm,
1377
- Te as useFormContext
1384
+ Ve as FormBuilder,
1385
+ te as FormContext,
1386
+ Me as FormaticaProvider,
1387
+ fe as useForm,
1388
+ Ae as useFormContext,
1389
+ me as useFormaticaConfig
1378
1390
  };
1379
1391
  //# sourceMappingURL=formatica-react.es.js.map