@schema-forms-data/renderer 4.0.0 → 4.0.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.
- package/README.md +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +290 -283
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as m, jsx as t, Fragment as
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as he } from "react/jsx-runtime";
|
|
2
2
|
import { createContext as qe, useContext as be, useState as j, useRef as K, useEffect as z, useCallback as re, useMemo as _ } from "react";
|
|
3
3
|
import { useTemplate as Ye, getTemplateConfig as ht, TemplateProvider as _e } from "@schema-forms-data/templates";
|
|
4
|
-
import { useController as L, useFormContext as
|
|
4
|
+
import { useController as L, useFormContext as De, useFieldArray as Ze, useFormState as gt, useWatch as de, useForm as bt, FormProvider as vt } from "react-hook-form";
|
|
5
5
|
import * as Ee from "lucide-react";
|
|
6
|
-
import { Loader2 as Te, Check as pe, AlertCircle as Fe, Trash2 as Je, Plus as Qe, CalendarCheck2 as
|
|
7
|
-
import { cn as S, Input as se, Textarea as
|
|
6
|
+
import { Loader2 as Te, Check as pe, AlertCircle as Fe, Trash2 as Je, Plus as Qe, CalendarCheck2 as xt, Users as yt, CalendarDays as Nt, Info as et, Smartphone as Ae, Banknote as tt, CreditCard as rt, ScrollText as Me, ExternalLink as Ct, CheckCircle2 as wt, X as st, EyeOff as Dt, Eye as Et, ChevronDown as $t, Star as At, ChevronLeft as It, ChevronRight as Tt, CircleDot as Ce } from "lucide-react";
|
|
7
|
+
import { cn as S, Input as se, Textarea as Ft, Select as Rt, SelectTrigger as St, SelectValue as kt, SelectContent as Ot, SelectItem as Pt, Checkbox as Re, RadioGroup as Vt, RadioGroupItem as Lt, Button as fe, Switch as _t, Slider as Mt, Label as Be } from "@schema-forms-data/ui";
|
|
8
8
|
import { FieldType as g } from "@schema-forms-data/core";
|
|
9
9
|
const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
10
10
|
if (!e) return !0;
|
|
@@ -59,7 +59,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
59
59
|
default:
|
|
60
60
|
return !0;
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, Bt = /^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/, jt = /^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/, Ut = /^\d{5}-?\d{3}$/, Ht = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, Xt = (e) => {
|
|
63
63
|
const s = e.replace(/\D/g, "");
|
|
64
64
|
if (s.length !== 11 || /^(\d)\1{10}$/.test(s)) return !1;
|
|
65
65
|
const o = (r) => {
|
|
@@ -69,15 +69,15 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
69
69
|
return a >= 10 ? 0 : a;
|
|
70
70
|
};
|
|
71
71
|
return o(9) === parseInt(s[9]) && o(10) === parseInt(s[10]);
|
|
72
|
-
},
|
|
73
|
-
if (
|
|
72
|
+
}, xe = /* @__PURE__ */ new Map(), zt = (e) => {
|
|
73
|
+
if (xe.has(e)) return xe.get(e);
|
|
74
74
|
try {
|
|
75
|
-
const s = new RegExp(
|
|
76
|
-
return
|
|
75
|
+
const s = e.startsWith("/") ? e.replace(/\/g(?=[^\/]*$)/, "/") : e, o = new RegExp(s);
|
|
76
|
+
return xe.set(e, o), o;
|
|
77
77
|
} catch {
|
|
78
|
-
return
|
|
78
|
+
return xe.set(e, null), null;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, ye = (e, s, o = {}) => {
|
|
81
81
|
const r = e.validacao;
|
|
82
82
|
if (e.tipo === g.CHECKBOX || e.tipo === g.SWITCH)
|
|
83
83
|
return e.obrigatorio && !s ? "Campo obrigatório" : void 0;
|
|
@@ -120,11 +120,11 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
120
120
|
const i = s != null ? String(s) : "";
|
|
121
121
|
if (e.obrigatorio && !i.trim()) return "Campo obrigatório";
|
|
122
122
|
if (i) {
|
|
123
|
-
if (e.tipo === g.EMAIL && !
|
|
124
|
-
if (e.tipo === g.CPF && (!
|
|
123
|
+
if (e.tipo === g.EMAIL && !Ht.test(i)) return "E-mail inválido";
|
|
124
|
+
if (e.tipo === g.CPF && (!Bt.test(i) || !Xt(i)))
|
|
125
125
|
return "CPF inválido";
|
|
126
|
-
if (e.tipo === g.TELEFONE && !
|
|
127
|
-
if (e.tipo === g.CEP && !
|
|
126
|
+
if (e.tipo === g.TELEFONE && !jt.test(i)) return "Telefone inválido";
|
|
127
|
+
if (e.tipo === g.CEP && !Ut.test(i)) return "CEP inválido";
|
|
128
128
|
if (r != null && r.minLength && i.length < r.minLength) return `Mínimo ${r.minLength} caracteres`;
|
|
129
129
|
if (r != null && r.maxLength && i.length > r.maxLength) return `Máximo ${r.maxLength} caracteres`;
|
|
130
130
|
if ((e.tipo === g.DATE || e.tipo === g.DATETIME) && i) {
|
|
@@ -141,7 +141,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
141
141
|
return `Idade máxima: ${r.maxAge} ano${r.maxAge !== 1 ? "s" : ""}`;
|
|
142
142
|
}
|
|
143
143
|
if (r != null && r.regex) {
|
|
144
|
-
const a =
|
|
144
|
+
const a = zt(r.regex);
|
|
145
145
|
if (a && !a.test(i)) return r.regexMessage || "Formato inválido";
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -160,30 +160,30 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
160
160
|
const d = await l(o, r, n, i);
|
|
161
161
|
if (d) return n.message ?? d;
|
|
162
162
|
}
|
|
163
|
-
},
|
|
163
|
+
}, Kt = (e, s = {}, o = {}) => async (r) => {
|
|
164
164
|
var l, d, c, u, p;
|
|
165
165
|
const i = {}, a = [...e.containers].sort((b, w) => b.ordem - w.ordem);
|
|
166
166
|
for (const b of a) {
|
|
167
167
|
if (b.repeatable || b.condicional && !H(b.condicional, r, s)) continue;
|
|
168
|
-
const w = [...b.campos].sort((
|
|
169
|
-
for (const
|
|
170
|
-
if (!H(
|
|
171
|
-
if (
|
|
172
|
-
const A = Array.isArray(r[
|
|
173
|
-
|
|
168
|
+
const w = [...b.campos].sort((f, T) => f.ordem - T.ordem);
|
|
169
|
+
for (const f of w) {
|
|
170
|
+
if (!H(f.condicional, r, s) || f.tipo === g.HIDDEN || f.isDisabled || f.isReadOnly) continue;
|
|
171
|
+
if (f.tipo === g.FIELD_ARRAY) {
|
|
172
|
+
const A = Array.isArray(r[f.nome]) ? r[f.nome] : [];
|
|
173
|
+
f.obrigatorio && A.length === 0 ? i[f.nome] = { type: "custom", message: "Adicione pelo menos um item" } : f.minItems && A.length < f.minItems ? i[f.nome] = {
|
|
174
174
|
type: "custom",
|
|
175
|
-
message: `Mínimo de ${
|
|
176
|
-
} :
|
|
175
|
+
message: `Mínimo de ${f.minItems} item${f.minItems !== 1 ? "s" : ""}`
|
|
176
|
+
} : f.maxItems && A.length > f.maxItems && (i[f.nome] = {
|
|
177
177
|
type: "custom",
|
|
178
|
-
message: `Máximo de ${
|
|
178
|
+
message: `Máximo de ${f.maxItems} item${f.maxItems !== 1 ? "s" : ""}`
|
|
179
179
|
});
|
|
180
180
|
for (let v = 0; v < A.length; v++) {
|
|
181
|
-
const
|
|
182
|
-
for (const E of
|
|
183
|
-
if (E.isDisabled || E.isReadOnly || !H(E.condicional,
|
|
184
|
-
const y =
|
|
181
|
+
const h = A[v];
|
|
182
|
+
for (const E of f.subFields ?? []) {
|
|
183
|
+
if (E.isDisabled || E.isReadOnly || !H(E.condicional, h, s)) continue;
|
|
184
|
+
const y = ye(E, h[E.nome], s);
|
|
185
185
|
if (y) {
|
|
186
|
-
me(i, `${
|
|
186
|
+
me(i, `${f.nome}.${v}.${E.nome}`, {
|
|
187
187
|
type: "custom",
|
|
188
188
|
message: y
|
|
189
189
|
});
|
|
@@ -193,12 +193,12 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
193
193
|
const C = await ue(
|
|
194
194
|
E.validate,
|
|
195
195
|
E.nome,
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
h[E.nome],
|
|
197
|
+
h,
|
|
198
198
|
s,
|
|
199
199
|
o
|
|
200
200
|
);
|
|
201
|
-
C && me(i, `${
|
|
201
|
+
C && me(i, `${f.nome}.${v}.${E.nome}`, {
|
|
202
202
|
type: "custom",
|
|
203
203
|
message: C
|
|
204
204
|
});
|
|
@@ -207,14 +207,14 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
207
207
|
}
|
|
208
208
|
continue;
|
|
209
209
|
}
|
|
210
|
-
if (
|
|
211
|
-
const A = r[
|
|
212
|
-
|
|
213
|
-
for (const v of ((d =
|
|
210
|
+
if (f.tipo === g.SUB_FORM) {
|
|
211
|
+
const A = r[f.nome] ?? {};
|
|
212
|
+
f.obrigatorio && Object.keys(A).length === 0 && (i[f.nome] = { type: "custom", message: "Campo obrigatório" });
|
|
213
|
+
for (const v of ((d = f.subSchema) == null ? void 0 : d.fields) ?? []) {
|
|
214
214
|
if (v.isDisabled || v.isReadOnly) continue;
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
me(i, `${
|
|
215
|
+
const h = ye(v, A[v.nome], s);
|
|
216
|
+
if (h) {
|
|
217
|
+
me(i, `${f.nome}.${v.nome}`, { type: "custom", message: h });
|
|
218
218
|
continue;
|
|
219
219
|
}
|
|
220
220
|
if ((c = v.validate) != null && c.length) {
|
|
@@ -226,22 +226,22 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
226
226
|
s,
|
|
227
227
|
o
|
|
228
228
|
);
|
|
229
|
-
E && me(i, `${
|
|
229
|
+
E && me(i, `${f.nome}.${v.nome}`, { type: "custom", message: E });
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
continue;
|
|
233
233
|
}
|
|
234
|
-
const N =
|
|
235
|
-
if (N && (i[
|
|
234
|
+
const N = ye(f, r[f.nome], s);
|
|
235
|
+
if (N && (i[f.nome] = { type: "custom", message: N }), !i[f.nome] && ((u = f.validate) != null && u.length)) {
|
|
236
236
|
const A = await ue(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
r[
|
|
237
|
+
f.validate,
|
|
238
|
+
f.nome,
|
|
239
|
+
r[f.nome],
|
|
240
240
|
r,
|
|
241
241
|
s,
|
|
242
242
|
o
|
|
243
243
|
);
|
|
244
|
-
A && (i[
|
|
244
|
+
A && (i[f.nome] = { type: "custom", message: A });
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -255,20 +255,20 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
255
255
|
type: "custom",
|
|
256
256
|
message: `Máximo de ${b.maxItems} ${b.itemLabel ?? "item"}${b.maxItems !== 1 ? "s" : ""}`
|
|
257
257
|
});
|
|
258
|
-
for (let
|
|
259
|
-
const T = w[
|
|
258
|
+
for (let f = 0; f < w.length; f++) {
|
|
259
|
+
const T = w[f];
|
|
260
260
|
for (const N of b.campos) {
|
|
261
261
|
if (!H(N.condicional, T, s) || N.tipo === g.HIDDEN || N.isDisabled || N.isReadOnly) continue;
|
|
262
|
-
const v =
|
|
262
|
+
const v = ye(N, T[N.nome], s);
|
|
263
263
|
if (v) {
|
|
264
|
-
me(i, `${b.nome}.${
|
|
264
|
+
me(i, `${b.nome}.${f}.${N.nome}`, {
|
|
265
265
|
type: "custom",
|
|
266
266
|
message: v
|
|
267
267
|
});
|
|
268
268
|
continue;
|
|
269
269
|
}
|
|
270
270
|
if ((p = N.validate) != null && p.length) {
|
|
271
|
-
const
|
|
271
|
+
const h = await ue(
|
|
272
272
|
N.validate,
|
|
273
273
|
N.nome,
|
|
274
274
|
T[N.nome],
|
|
@@ -276,16 +276,16 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
276
276
|
s,
|
|
277
277
|
o
|
|
278
278
|
);
|
|
279
|
-
|
|
279
|
+
h && me(i, `${b.nome}.${f}.${N.nome}`, {
|
|
280
280
|
type: "custom",
|
|
281
|
-
message:
|
|
281
|
+
message: h
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
return Object.keys(i).length > 0 ? { values: {}, errors: i } : { values: r, errors: {} };
|
|
288
|
-
},
|
|
288
|
+
}, Wt = (e, s = {}, o = {}) => async (r) => {
|
|
289
289
|
var n, l;
|
|
290
290
|
const i = {}, a = [...e.containers].sort((d, c) => d.ordem - c.ordem);
|
|
291
291
|
for (const d of a)
|
|
@@ -294,9 +294,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
294
294
|
const c = Array.isArray(r[d.nome]) ? r[d.nome] : [];
|
|
295
295
|
for (let u = 0; u < c.length; u++) {
|
|
296
296
|
const p = c[u];
|
|
297
|
-
for (const b of [...d.campos].sort((w,
|
|
297
|
+
for (const b of [...d.campos].sort((w, f) => w.ordem - f.ordem)) {
|
|
298
298
|
if (!((n = b.warn) != null && n.length) || !H(b.condicional, p, s)) continue;
|
|
299
|
-
const
|
|
299
|
+
const f = await ue(
|
|
300
300
|
b.warn,
|
|
301
301
|
b.nome,
|
|
302
302
|
p[b.nome],
|
|
@@ -304,7 +304,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
304
304
|
s,
|
|
305
305
|
o
|
|
306
306
|
);
|
|
307
|
-
|
|
307
|
+
f && (i[`${d.nome}.${u}.${b.nome}`] = f);
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
continue;
|
|
@@ -323,10 +323,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
return i;
|
|
326
|
-
},
|
|
326
|
+
}, Gt = /\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g, W = (e, s) => e ? e.replace(Gt, (o, r) => s[`evento.${r}`] ?? s[r] ?? o) : e ?? "", qt = (e, s) => ({
|
|
327
327
|
...e,
|
|
328
328
|
label: W(e.label, s)
|
|
329
|
-
}),
|
|
329
|
+
}), Yt = (e, s) => {
|
|
330
330
|
var o;
|
|
331
331
|
return {
|
|
332
332
|
...e,
|
|
@@ -334,14 +334,14 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
334
334
|
placeholder: W(e.placeholder, s),
|
|
335
335
|
hint: W(e.hint, s),
|
|
336
336
|
defaultValue: typeof e.defaultValue == "string" ? W(e.defaultValue, s) : e.defaultValue,
|
|
337
|
-
opcoes: (o = e.opcoes) == null ? void 0 : o.map((r) =>
|
|
337
|
+
opcoes: (o = e.opcoes) == null ? void 0 : o.map((r) => qt(r, s))
|
|
338
338
|
};
|
|
339
339
|
}, Se = (e, s) => ({
|
|
340
340
|
...e,
|
|
341
341
|
titulo: W(e.titulo, s),
|
|
342
342
|
descricao: W(e.descricao, s),
|
|
343
|
-
campos: e.campos.map((o) =>
|
|
344
|
-
}),
|
|
343
|
+
campos: e.campos.map((o) => Yt(o, s))
|
|
344
|
+
}), Zt = (e, s) => ({
|
|
345
345
|
...e,
|
|
346
346
|
titulo: W(e.titulo, s),
|
|
347
347
|
descricao: W(e.descricao, s),
|
|
@@ -401,7 +401,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
401
401
|
const { field: a, fieldState: n } = L({ name: e, control: s });
|
|
402
402
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
403
403
|
/* @__PURE__ */ t(
|
|
404
|
-
|
|
404
|
+
Ft,
|
|
405
405
|
{
|
|
406
406
|
...a,
|
|
407
407
|
value: a.value ?? "",
|
|
@@ -428,21 +428,21 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
428
428
|
const { field: n, fieldState: l } = L({ name: e, control: s });
|
|
429
429
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
430
430
|
/* @__PURE__ */ m(
|
|
431
|
-
|
|
431
|
+
Rt,
|
|
432
432
|
{
|
|
433
433
|
value: n.value ?? "",
|
|
434
434
|
onValueChange: (c) => !a && n.onChange(c),
|
|
435
435
|
disabled: i || a,
|
|
436
436
|
children: [
|
|
437
437
|
/* @__PURE__ */ t(
|
|
438
|
-
|
|
438
|
+
St,
|
|
439
439
|
{
|
|
440
440
|
className: S(l.error && "border-destructive focus:ring-destructive"),
|
|
441
441
|
onBlur: n.onBlur,
|
|
442
|
-
children: /* @__PURE__ */ t(
|
|
442
|
+
children: /* @__PURE__ */ t(kt, { placeholder: o ?? "Selecione..." })
|
|
443
443
|
}
|
|
444
444
|
),
|
|
445
|
-
/* @__PURE__ */ t(
|
|
445
|
+
/* @__PURE__ */ t(Ot, { children: r.map((c) => /* @__PURE__ */ t(Pt, { value: c.valor, disabled: c.disabled, children: c.label }, c.valor)) })
|
|
446
446
|
]
|
|
447
447
|
}
|
|
448
448
|
),
|
|
@@ -516,7 +516,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
516
516
|
const { field: a, fieldState: n } = L({ name: e, control: s }), l = r === "card";
|
|
517
517
|
return /* @__PURE__ */ m("div", { className: "space-y-1", onBlur: a.onBlur, children: [
|
|
518
518
|
/* @__PURE__ */ t(
|
|
519
|
-
|
|
519
|
+
Vt,
|
|
520
520
|
{
|
|
521
521
|
value: a.value ?? "",
|
|
522
522
|
onValueChange: a.onChange,
|
|
@@ -534,7 +534,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
534
534
|
"data-selected": a.value === c.valor ? "true" : void 0,
|
|
535
535
|
children: [
|
|
536
536
|
/* @__PURE__ */ t(
|
|
537
|
-
|
|
537
|
+
Lt,
|
|
538
538
|
{
|
|
539
539
|
value: c.valor,
|
|
540
540
|
disabled: i || c.disabled
|
|
@@ -552,10 +552,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
552
552
|
}, it = (e) => {
|
|
553
553
|
const s = e.getFullYear(), o = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0");
|
|
554
554
|
return `${s}-${o}-${r}`;
|
|
555
|
-
},
|
|
555
|
+
}, Jt = (e) => {
|
|
556
556
|
const s = /* @__PURE__ */ new Date();
|
|
557
557
|
return s.setFullYear(s.getFullYear() - e), it(s);
|
|
558
|
-
},
|
|
558
|
+
}, Qt = (e) => {
|
|
559
559
|
const s = /* @__PURE__ */ new Date();
|
|
560
560
|
return s.setFullYear(s.getFullYear() - e), it(s);
|
|
561
561
|
}, ge = ({
|
|
@@ -567,7 +567,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
567
567
|
validacao: a
|
|
568
568
|
}) => {
|
|
569
569
|
var b;
|
|
570
|
-
const { field: n, fieldState: l } = L({ name: e, control: s }), d = o ? "datetime-local" : "date", c = (w) => o ? w + "T00:00" : w, u = (a == null ? void 0 : a.minAge) != null ? c(
|
|
570
|
+
const { field: n, fieldState: l } = L({ name: e, control: s }), d = o ? "datetime-local" : "date", c = (w) => o ? w + "T00:00" : w, u = (a == null ? void 0 : a.minAge) != null ? c(Jt(a.minAge)) : (a == null ? void 0 : a.maxDate) != null ? c(a.maxDate) : void 0, p = (a == null ? void 0 : a.maxAge) != null ? c(Qt(a.maxAge)) : (a == null ? void 0 : a.minDate) != null ? c(a.minDate) : void 0;
|
|
571
571
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
572
572
|
/* @__PURE__ */ t(
|
|
573
573
|
se,
|
|
@@ -599,10 +599,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
599
599
|
var F;
|
|
600
600
|
const { field: n, fieldState: l } = L({ name: e, control: s }), { uploadFile: d } = ie(), [c, u] = j({
|
|
601
601
|
status: "idle"
|
|
602
|
-
}), p = K(null), [b, w] = j(!1),
|
|
602
|
+
}), p = K(null), [b, w] = j(!1), f = K(!0);
|
|
603
603
|
z(
|
|
604
604
|
() => () => {
|
|
605
|
-
|
|
605
|
+
f.current = !1;
|
|
606
606
|
},
|
|
607
607
|
[]
|
|
608
608
|
);
|
|
@@ -639,11 +639,11 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
639
639
|
u({ status: "uploading", fileName: y.name, progress: 0 });
|
|
640
640
|
try {
|
|
641
641
|
const x = await d(y, r ?? e, ($) => {
|
|
642
|
-
|
|
642
|
+
f.current && u(
|
|
643
643
|
(D) => D.status === "uploading" ? { ...D, progress: Math.min(100, $) } : D
|
|
644
644
|
);
|
|
645
645
|
});
|
|
646
|
-
if (!
|
|
646
|
+
if (!f.current) return;
|
|
647
647
|
n.onChange(x), u({
|
|
648
648
|
status: "done",
|
|
649
649
|
uploadId: x,
|
|
@@ -651,7 +651,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
651
651
|
size: y.size
|
|
652
652
|
});
|
|
653
653
|
} catch {
|
|
654
|
-
if (!
|
|
654
|
+
if (!f.current) return;
|
|
655
655
|
u({
|
|
656
656
|
status: "error",
|
|
657
657
|
message: "Falha no upload. Tente novamente."
|
|
@@ -767,7 +767,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
767
767
|
] }),
|
|
768
768
|
!E && ((F = l.error) == null ? void 0 : F.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: l.error.message })
|
|
769
769
|
] });
|
|
770
|
-
},
|
|
770
|
+
}, er = {
|
|
771
771
|
cpf: (e) => e.replace(/\D/g, "").slice(0, 11).replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d)/, "$1.$2").replace(/(\d{3})(\d{1,2})$/, "$1-$2"),
|
|
772
772
|
telefone: (e) => {
|
|
773
773
|
const s = e.replace(/\D/g, "").slice(0, 11);
|
|
@@ -783,7 +783,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
783
783
|
readOnly: a
|
|
784
784
|
}) => {
|
|
785
785
|
var u;
|
|
786
|
-
const { field: n, fieldState: l } = L({ name: e, control: s }), d =
|
|
786
|
+
const { field: n, fieldState: l } = L({ name: e, control: s }), d = er[r || ""], c = re(
|
|
787
787
|
(p) => {
|
|
788
788
|
n.onChange(d ? d(p.target.value) : p.target.value);
|
|
789
789
|
},
|
|
@@ -810,10 +810,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
810
810
|
}, Ve = ({ name: e, control: s }) => {
|
|
811
811
|
const { field: o } = L({ name: e, control: s });
|
|
812
812
|
return /* @__PURE__ */ t("input", { type: "hidden", ...o, value: o.value ?? "" });
|
|
813
|
-
}, ct = (e) => e.replace(/\D/g, ""),
|
|
813
|
+
}, ct = (e) => e.replace(/\D/g, ""), tr = (e) => {
|
|
814
814
|
const s = ct(e).slice(0, 8);
|
|
815
815
|
return s.length <= 5 ? s : `${s.slice(0, 5)}-${s.slice(5)}`;
|
|
816
|
-
},
|
|
816
|
+
}, rr = async (e, s) => {
|
|
817
817
|
const o = await fetch(`https://viacep.com.br/ws/${e}/json/`, { signal: s });
|
|
818
818
|
if (!o.ok) throw new Error("Falha ao consultar CEP");
|
|
819
819
|
return o.json();
|
|
@@ -825,12 +825,12 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
825
825
|
readOnly: i,
|
|
826
826
|
cepFillMap: a
|
|
827
827
|
}) => {
|
|
828
|
-
var v,
|
|
829
|
-
const { field: n, fieldState: l } = L({ name: e, control: s }), { setValue: d } =
|
|
828
|
+
var v, h;
|
|
829
|
+
const { field: n, fieldState: l } = L({ name: e, control: s }), { setValue: d } = De(), { cepLookup: c } = ie(), [u, p] = j("idle"), [b, w] = j(null), f = K(null), T = K(!0);
|
|
830
830
|
z(
|
|
831
831
|
() => () => {
|
|
832
832
|
var E;
|
|
833
|
-
T.current = !1, (E =
|
|
833
|
+
T.current = !1, (E = f.current) == null || E.abort();
|
|
834
834
|
},
|
|
835
835
|
[]
|
|
836
836
|
);
|
|
@@ -839,14 +839,14 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
839
839
|
n.onBlur();
|
|
840
840
|
const E = ct(n.value ?? "");
|
|
841
841
|
if (E.length === 8) {
|
|
842
|
-
(F =
|
|
842
|
+
(F = f.current) == null || F.abort(), f.current = new AbortController(), p("loading"), w(null);
|
|
843
843
|
try {
|
|
844
844
|
let y;
|
|
845
845
|
if (c) {
|
|
846
|
-
const $ =
|
|
846
|
+
const $ = f.current;
|
|
847
847
|
if (y = await c(E, $.signal), $.signal.aborted || !T.current) return;
|
|
848
848
|
} else {
|
|
849
|
-
const $ = await
|
|
849
|
+
const $ = await rr(E, f.current.signal);
|
|
850
850
|
if (!T.current) return;
|
|
851
851
|
if ($.erro) {
|
|
852
852
|
p("error"), w("CEP não encontrado");
|
|
@@ -877,7 +877,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
877
877
|
}
|
|
878
878
|
}, [n, c, d, e, a]), A = re(
|
|
879
879
|
(E) => {
|
|
880
|
-
n.onChange(
|
|
880
|
+
n.onChange(tr(E.target.value));
|
|
881
881
|
},
|
|
882
882
|
[n]
|
|
883
883
|
);
|
|
@@ -905,9 +905,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
905
905
|
u === "error" && /* @__PURE__ */ t(Fe, { className: "h-4 w-4 text-destructive" })
|
|
906
906
|
] })
|
|
907
907
|
] }),
|
|
908
|
-
(((v = l.error) == null ? void 0 : v.message) || b) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: ((
|
|
908
|
+
(((v = l.error) == null ? void 0 : v.message) || b) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: ((h = l.error) == null ? void 0 : h.message) || b })
|
|
909
909
|
] });
|
|
910
|
-
},
|
|
910
|
+
}, sr = ({
|
|
911
911
|
field: e,
|
|
912
912
|
control: s,
|
|
913
913
|
nameOverride: o
|
|
@@ -960,7 +960,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
960
960
|
`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`
|
|
961
961
|
), /* @__PURE__ */ t(J, { ...r, type: "text" });
|
|
962
962
|
}
|
|
963
|
-
},
|
|
963
|
+
}, ar = ({
|
|
964
964
|
name: e,
|
|
965
965
|
control: s,
|
|
966
966
|
subFields: o = [],
|
|
@@ -973,7 +973,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
973
973
|
const { fields: l, append: d, remove: c } = Ze({
|
|
974
974
|
control: s,
|
|
975
975
|
name: e
|
|
976
|
-
}), { errors: u } =
|
|
976
|
+
}), { errors: u } = gt({ control: s }), p = (N = u[e]) == null ? void 0 : N.message, b = re(() => {
|
|
977
977
|
const A = {};
|
|
978
978
|
for (const v of o)
|
|
979
979
|
v.initialValue !== void 0 ? A[v.nome] = v.initialValue : v.defaultValue !== void 0 && (A[v.nome] = v.defaultValue);
|
|
@@ -984,7 +984,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
984
984
|
for (let A = l.length; A < r; A++)
|
|
985
985
|
d(b());
|
|
986
986
|
}, [r]);
|
|
987
|
-
const w = [...o].sort((A, v) => A.ordem - v.ordem),
|
|
987
|
+
const w = [...o].sort((A, v) => A.ordem - v.ordem), f = !i || l.length < i, T = n ?? `Adicionar ${a.toLowerCase()}`;
|
|
988
988
|
return /* @__PURE__ */ m("div", { className: "space-y-3", children: [
|
|
989
989
|
l.map((A, v) => /* @__PURE__ */ m("div", { className: "rounded-lg border border-input p-4", children: [
|
|
990
990
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between mb-4", children: [
|
|
@@ -997,7 +997,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
997
997
|
] })
|
|
998
998
|
] }),
|
|
999
999
|
l.length > r && /* @__PURE__ */ t(
|
|
1000
|
-
|
|
1000
|
+
fe,
|
|
1001
1001
|
{
|
|
1002
1002
|
type: "button",
|
|
1003
1003
|
variant: "ghost",
|
|
@@ -1009,23 +1009,23 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
)
|
|
1011
1011
|
] }),
|
|
1012
|
-
/* @__PURE__ */ t("div", { className: "grid grid-cols-12 gap-4", children: w.map((
|
|
1013
|
-
const E = `${e}.${v}.${
|
|
1014
|
-
|
|
1012
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-12 gap-4", children: w.map((h) => {
|
|
1013
|
+
const E = `${e}.${v}.${h.nome}`, y = `span ${h.tamanho ?? 12}`, C = /* @__PURE__ */ t(
|
|
1014
|
+
sr,
|
|
1015
1015
|
{
|
|
1016
|
-
field:
|
|
1016
|
+
field: h,
|
|
1017
1017
|
control: s,
|
|
1018
1018
|
nameOverride: E
|
|
1019
1019
|
}
|
|
1020
1020
|
);
|
|
1021
|
-
return
|
|
1021
|
+
return h.tipo === g.CHECKBOX || h.tipo === g.HIDDEN ? /* @__PURE__ */ t(
|
|
1022
1022
|
"div",
|
|
1023
1023
|
{
|
|
1024
1024
|
className: "max-sm:!col-span-12",
|
|
1025
1025
|
style: { gridColumn: y },
|
|
1026
1026
|
children: C
|
|
1027
1027
|
},
|
|
1028
|
-
|
|
1028
|
+
h.id
|
|
1029
1029
|
) : /* @__PURE__ */ m(
|
|
1030
1030
|
"div",
|
|
1031
1031
|
{
|
|
@@ -1033,19 +1033,19 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1033
1033
|
style: { gridColumn: y },
|
|
1034
1034
|
children: [
|
|
1035
1035
|
/* @__PURE__ */ m("label", { className: "font-medium flex items-center gap-1 text-sm text-foreground", children: [
|
|
1036
|
-
|
|
1037
|
-
|
|
1036
|
+
h.label,
|
|
1037
|
+
h.obrigatorio && /* @__PURE__ */ t("span", { className: "text-destructive", children: "*" })
|
|
1038
1038
|
] }),
|
|
1039
1039
|
C,
|
|
1040
|
-
|
|
1040
|
+
h.hint && /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: h.hint })
|
|
1041
1041
|
]
|
|
1042
1042
|
},
|
|
1043
|
-
|
|
1043
|
+
h.id
|
|
1044
1044
|
);
|
|
1045
1045
|
}) })
|
|
1046
1046
|
] }, A.id)),
|
|
1047
|
-
|
|
1048
|
-
|
|
1047
|
+
f && /* @__PURE__ */ m(
|
|
1048
|
+
fe,
|
|
1049
1049
|
{
|
|
1050
1050
|
type: "button",
|
|
1051
1051
|
variant: "outline",
|
|
@@ -1069,30 +1069,30 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1069
1069
|
p
|
|
1070
1070
|
] })
|
|
1071
1071
|
] });
|
|
1072
|
-
}, Ue = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`,
|
|
1072
|
+
}, Ue = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, nr = (e, s) => {
|
|
1073
1073
|
const o = /* @__PURE__ */ new Date(e.slice(0, 10) + "T00:00:00Z"), r = /* @__PURE__ */ new Date(s.slice(0, 10) + "T00:00:00Z");
|
|
1074
1074
|
return Math.round((r.getTime() - o.getTime()) / 864e5) + 1;
|
|
1075
|
-
},
|
|
1075
|
+
}, or = (e, s) => {
|
|
1076
1076
|
const o = [], r = /* @__PURE__ */ new Date(e.slice(0, 10) + "T00:00:00Z"), i = /* @__PURE__ */ new Date(s.slice(0, 10) + "T00:00:00Z");
|
|
1077
1077
|
let a = 0;
|
|
1078
1078
|
for (; r <= i && a < 60; )
|
|
1079
1079
|
o.push(r.toISOString().slice(0, 10)), r.setUTCDate(r.getUTCDate() + 1), a++;
|
|
1080
1080
|
return o;
|
|
1081
|
-
},
|
|
1081
|
+
}, ir = (e) => {
|
|
1082
1082
|
const [s, o, r] = e.split("-").map(Number), i = new Date(Date.UTC(s, o - 1, r)), a = String(r).padStart(2, "0"), n = String(o).padStart(2, "0"), l = new Intl.DateTimeFormat("pt-BR", {
|
|
1083
1083
|
weekday: "long",
|
|
1084
1084
|
timeZone: "UTC"
|
|
1085
1085
|
}).format(i), d = l.charAt(0).toUpperCase() + l.slice(1);
|
|
1086
1086
|
return `${a}/${n} - ${d}`;
|
|
1087
|
-
},
|
|
1087
|
+
}, lr = (e, s) => {
|
|
1088
1088
|
const o = (r) => {
|
|
1089
1089
|
const [i, a, n] = r.slice(0, 10).split("-");
|
|
1090
1090
|
return `${n}/${a}/${i}`;
|
|
1091
1091
|
};
|
|
1092
1092
|
return `${o(e)} a ${o(s)}`;
|
|
1093
|
-
},
|
|
1093
|
+
}, cr = ({ name: e, control: s }) => {
|
|
1094
1094
|
var G;
|
|
1095
|
-
const { field: o, fieldState: r } = L({ name: e, control: s }), { externalData: i = {} } = ie(), a = o.value ?? null, n = (G = r.error) == null ? void 0 : G.message, l = (R) => i[`evento.${R}`] ?? i[R], d = l("dataInicioEvento") ?? "", c = l("dataFimEvento") ?? "", u = Number(l("valor") ?? 0), p = Number(l("valorPorDia") ?? 0), b = l("vagasTotal"), w = l("vagasPorDia"),
|
|
1095
|
+
const { field: o, fieldState: r } = L({ name: e, control: s }), { externalData: i = {} } = ie(), a = o.value ?? null, n = (G = r.error) == null ? void 0 : G.message, l = (R) => i[`evento.${R}`] ?? i[R], d = l("dataInicioEvento") ?? "", c = l("dataFimEvento") ?? "", u = Number(l("valor") ?? 0), p = Number(l("valorPorDia") ?? 0), b = l("vagasTotal"), w = l("vagasPorDia"), f = l("vagasMasculinas"), T = l("vagasFemininas"), N = b != null ? Number(b) : null, A = w != null ? Number(w) : null, v = f != null ? Number(f) : null, h = T != null ? Number(T) : null, E = d && c ? or(d, c) : [], y = (d && c ? nr(d, c) : 0) > 1, C = v != null && v > 0 && h != null && h > 0, x = v != null && h == null ? "masculino" : h != null && v == null ? "feminino" : null, $ = (a == null ? void 0 : a.tipo) ?? null, D = (a == null ? void 0 : a.data) ?? null, P = (a == null ? void 0 : a.genero) ?? null, M = K(a);
|
|
1096
1096
|
M.current = a;
|
|
1097
1097
|
const q = K(o.onChange);
|
|
1098
1098
|
q.current = o.onChange, z(() => {
|
|
@@ -1146,12 +1146,12 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1146
1146
|
"mt-0.5 p-2 rounded-lg shrink-0 transition-colors",
|
|
1147
1147
|
X("todos_os_dias") ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
1148
1148
|
),
|
|
1149
|
-
children: /* @__PURE__ */ t(
|
|
1149
|
+
children: /* @__PURE__ */ t(xt, { className: "w-4 h-4" })
|
|
1150
1150
|
}
|
|
1151
1151
|
),
|
|
1152
1152
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
1153
1153
|
/* @__PURE__ */ t("p", { className: "font-semibold text-sm", children: "Participar todos os dias" }),
|
|
1154
|
-
d && c ? /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children:
|
|
1154
|
+
d && c ? /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: lr(d, c) }) : /* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground italic", children: "Datas do evento" })
|
|
1155
1155
|
] }),
|
|
1156
1156
|
/* @__PURE__ */ m("div", { className: "text-right shrink-0", children: [
|
|
1157
1157
|
u > 0 && /* @__PURE__ */ t(
|
|
@@ -1165,7 +1165,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
),
|
|
1167
1167
|
N != null && N > 0 && /* @__PURE__ */ m("p", { className: "text-xs flex items-center justify-end gap-1 text-muted-foreground", children: [
|
|
1168
|
-
/* @__PURE__ */ t(
|
|
1168
|
+
/* @__PURE__ */ t(yt, { className: "w-3 h-3" }),
|
|
1169
1169
|
N,
|
|
1170
1170
|
" vagas disponíveis"
|
|
1171
1171
|
] })
|
|
@@ -1190,7 +1190,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1190
1190
|
"mt-0.5 p-2 rounded-lg shrink-0 transition-colors",
|
|
1191
1191
|
X("por_dia") ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
|
|
1192
1192
|
),
|
|
1193
|
-
children: /* @__PURE__ */ t(
|
|
1193
|
+
children: /* @__PURE__ */ t(Nt, { className: "w-4 h-4" })
|
|
1194
1194
|
}
|
|
1195
1195
|
),
|
|
1196
1196
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
@@ -1239,7 +1239,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1239
1239
|
children: D === R && /* @__PURE__ */ t("span", { className: "w-2 h-2 rounded-full bg-white" })
|
|
1240
1240
|
}
|
|
1241
1241
|
),
|
|
1242
|
-
/* @__PURE__ */ t("span", { className: "text-sm", children:
|
|
1242
|
+
/* @__PURE__ */ t("span", { className: "text-sm", children: ir(R) })
|
|
1243
1243
|
] }),
|
|
1244
1244
|
A != null && /* @__PURE__ */ m("span", { className: "text-xs text-muted-foreground", children: [
|
|
1245
1245
|
A,
|
|
@@ -1252,7 +1252,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1252
1252
|
] }),
|
|
1253
1253
|
n && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: n })
|
|
1254
1254
|
] });
|
|
1255
|
-
}, He = 0.0315, Xe = 0.124, ze = 7, Ke = 12,
|
|
1255
|
+
}, He = 0.0315, Xe = 0.124, ze = 7, Ke = 12, dr = [
|
|
1256
1256
|
{
|
|
1257
1257
|
id: "pix",
|
|
1258
1258
|
label: "PIX",
|
|
@@ -1275,7 +1275,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1275
1275
|
taxa: He,
|
|
1276
1276
|
taxaLabel: `Taxa: ${(He * 100).toFixed(2).replace(".", ",")}%`
|
|
1277
1277
|
}
|
|
1278
|
-
],
|
|
1278
|
+
], mr = [
|
|
1279
1279
|
{
|
|
1280
1280
|
id: "pix",
|
|
1281
1281
|
label: "PIX à Vista",
|
|
@@ -1307,24 +1307,24 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1307
1307
|
Icon: tt,
|
|
1308
1308
|
taxa: 0
|
|
1309
1309
|
}
|
|
1310
|
-
],
|
|
1310
|
+
], Ne = (e) => `R$ ${(e / 100).toFixed(2).replace(".", ",")}`, We = (e, s) => Math.round(e * (1 + s) * 100) / 100, ur = (e, s) => Math.round(e / s * 100) / 100, pr = ({
|
|
1311
1311
|
name: e,
|
|
1312
1312
|
control: s,
|
|
1313
1313
|
relatedFieldName: o = "tipo_participacao"
|
|
1314
1314
|
}) => {
|
|
1315
1315
|
var v;
|
|
1316
|
-
const { field: r, fieldState: i } = L({ name: e, control: s }), { externalData: a = {}, paymentMethodOptions: n } = ie(), l = r.value ?? null, d = (v = i.error) == null ? void 0 : v.message, c = de({ control: s, name: o }), u = (c == null ? void 0 : c.tipo) ?? null, p = (
|
|
1316
|
+
const { field: r, fieldState: i } = L({ name: e, control: s }), { externalData: a = {}, paymentMethodOptions: n } = ie(), l = r.value ?? null, d = (v = i.error) == null ? void 0 : v.message, c = de({ control: s, name: o }), u = (c == null ? void 0 : c.tipo) ?? null, p = (h) => a[`evento.${h}`] ?? a[h], b = Number(p("valor") ?? 0), w = Number(p("valorPorDia") ?? 0), f = u === "por_dia" && w > 0 ? w : b, T = u === "por_dia" ? (n == null ? void 0 : n.porDia) ?? dr : (n == null ? void 0 : n.todosOsDias) ?? mr, N = u === "por_dia" ? (() => {
|
|
1317
1317
|
if (!(c != null && c.data)) return "Um dia";
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1320
|
-
const [E, F, y] =
|
|
1318
|
+
const h = c.data.split("-");
|
|
1319
|
+
if (h.length === 3) {
|
|
1320
|
+
const [E, F, y] = h;
|
|
1321
1321
|
return `${y}/${F}/${E}`;
|
|
1322
1322
|
}
|
|
1323
1323
|
return c.data;
|
|
1324
|
-
})() : "Todos os dias", A = (
|
|
1325
|
-
if (
|
|
1326
|
-
const E = We(
|
|
1327
|
-
|
|
1324
|
+
})() : "Todos os dias", A = (h) => {
|
|
1325
|
+
if (h.disabled) return;
|
|
1326
|
+
const E = We(f, h.taxa), F = { metodo: h.id, valorTotal: E };
|
|
1327
|
+
h.parcelas && (F.parcelas = h.parcelas), r.onChange(F);
|
|
1328
1328
|
};
|
|
1329
1329
|
return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
1330
1330
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between rounded-xl border border-input px-4 py-3", children: [
|
|
@@ -1334,7 +1334,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1334
1334
|
] }),
|
|
1335
1335
|
/* @__PURE__ */ m("div", { className: "text-right", children: [
|
|
1336
1336
|
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Valor base" }),
|
|
1337
|
-
/* @__PURE__ */ t("p", { className: "text-lg font-bold text-primary", children:
|
|
1337
|
+
/* @__PURE__ */ t("p", { className: "text-lg font-bold text-primary", children: Ne(f) })
|
|
1338
1338
|
] })
|
|
1339
1339
|
] }),
|
|
1340
1340
|
/* @__PURE__ */ m("div", { className: "flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5", children: [
|
|
@@ -1345,18 +1345,18 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1345
1345
|
] })
|
|
1346
1346
|
] }),
|
|
1347
1347
|
/* @__PURE__ */ t("p", { className: "text-sm font-semibold text-primary", children: "Selecione a forma de pagamento:" }),
|
|
1348
|
-
/* @__PURE__ */ t("div", { className: "space-y-3", children: T.map((
|
|
1349
|
-
const { Icon: E } =
|
|
1348
|
+
/* @__PURE__ */ t("div", { className: "space-y-3", children: T.map((h) => {
|
|
1349
|
+
const { Icon: E } = h, F = (l == null ? void 0 : l.metodo) === h.id, y = We(f, h.taxa), C = !!h.parcelas && h.parcelas > 1, x = C ? ur(y, h.parcelas) : null;
|
|
1350
1350
|
return /* @__PURE__ */ m(
|
|
1351
1351
|
"button",
|
|
1352
1352
|
{
|
|
1353
1353
|
type: "button",
|
|
1354
|
-
disabled:
|
|
1355
|
-
onClick: () => A(
|
|
1354
|
+
disabled: h.disabled,
|
|
1355
|
+
onClick: () => A(h),
|
|
1356
1356
|
className: S(
|
|
1357
1357
|
"w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",
|
|
1358
1358
|
F ? "border-primary bg-primary/5" : "border-input hover:border-primary/50",
|
|
1359
|
-
|
|
1359
|
+
h.disabled && "opacity-50 cursor-not-allowed"
|
|
1360
1360
|
),
|
|
1361
1361
|
children: [
|
|
1362
1362
|
/* @__PURE__ */ t(
|
|
@@ -1370,32 +1370,32 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1370
1370
|
}
|
|
1371
1371
|
),
|
|
1372
1372
|
/* @__PURE__ */ m("div", { className: "flex-1 min-w-0", children: [
|
|
1373
|
-
/* @__PURE__ */ t("p", { className: "font-semibold text-sm leading-tight", children:
|
|
1374
|
-
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children:
|
|
1375
|
-
|
|
1373
|
+
/* @__PURE__ */ t("p", { className: "font-semibold text-sm leading-tight", children: h.label }),
|
|
1374
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: h.description }),
|
|
1375
|
+
h.taxaLabel && /* @__PURE__ */ m("p", { className: "text-xs text-muted-foreground mt-0.5", children: [
|
|
1376
1376
|
"* ",
|
|
1377
|
-
|
|
1377
|
+
h.taxaLabel
|
|
1378
1378
|
] }),
|
|
1379
|
-
|
|
1379
|
+
h.taxa > 0 && /* @__PURE__ */ m("p", { className: "text-xs text-muted-foreground", children: [
|
|
1380
1380
|
"Total com taxa: ",
|
|
1381
|
-
|
|
1381
|
+
Ne(y)
|
|
1382
1382
|
] })
|
|
1383
1383
|
] }),
|
|
1384
|
-
/* @__PURE__ */ t("div", { className: "text-right shrink-0", children: C ? /* @__PURE__ */ m(
|
|
1384
|
+
/* @__PURE__ */ t("div", { className: "text-right shrink-0", children: C ? /* @__PURE__ */ m(he, { children: [
|
|
1385
1385
|
/* @__PURE__ */ m("p", { className: "text-xs text-muted-foreground", children: [
|
|
1386
|
-
|
|
1386
|
+
h.parcelas,
|
|
1387
1387
|
"x de"
|
|
1388
1388
|
] }),
|
|
1389
|
-
/* @__PURE__ */ t("p", { className: "text-base font-bold text-primary", children:
|
|
1390
|
-
] }) : /* @__PURE__ */ t("p", { className: "text-base font-bold text-primary", children:
|
|
1389
|
+
/* @__PURE__ */ t("p", { className: "text-base font-bold text-primary", children: Ne(x) })
|
|
1390
|
+
] }) : /* @__PURE__ */ t("p", { className: "text-base font-bold text-primary", children: Ne(y) }) })
|
|
1391
1391
|
]
|
|
1392
1392
|
},
|
|
1393
|
-
|
|
1393
|
+
h.id
|
|
1394
1394
|
);
|
|
1395
1395
|
}) }),
|
|
1396
1396
|
d && /* @__PURE__ */ t("p", { className: "text-xs text-destructive", children: d })
|
|
1397
1397
|
] });
|
|
1398
|
-
},
|
|
1398
|
+
}, fr = ({
|
|
1399
1399
|
name: e,
|
|
1400
1400
|
control: s,
|
|
1401
1401
|
label: o,
|
|
@@ -1404,7 +1404,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1404
1404
|
termoPdfUploadId: a
|
|
1405
1405
|
}) => {
|
|
1406
1406
|
var y;
|
|
1407
|
-
const { field: n, fieldState: l } = L({ name: e, control: s }), { resolveTermsUploadUrl: d } = ie(), c = !!l.error, u = (y = l.error) == null ? void 0 : y.message, [p, b] = j(null), [w,
|
|
1407
|
+
const { field: n, fieldState: l } = L({ name: e, control: s }), { resolveTermsUploadUrl: d } = ie(), c = !!l.error, u = (y = l.error) == null ? void 0 : y.message, [p, b] = j(null), [w, f] = j(!1), [T, N] = j(!1), A = K(null);
|
|
1408
1408
|
z(() => {
|
|
1409
1409
|
var C;
|
|
1410
1410
|
T && ((C = A.current) == null || C.focus());
|
|
@@ -1414,17 +1414,17 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1414
1414
|
return;
|
|
1415
1415
|
}
|
|
1416
1416
|
let C = !1;
|
|
1417
|
-
return
|
|
1417
|
+
return f(!0), d(a).then((x) => {
|
|
1418
1418
|
C || b(x);
|
|
1419
1419
|
}).catch(() => {
|
|
1420
1420
|
C || b(null);
|
|
1421
1421
|
}).finally(() => {
|
|
1422
|
-
C ||
|
|
1422
|
+
C || f(!1);
|
|
1423
1423
|
}), () => {
|
|
1424
1424
|
C = !0;
|
|
1425
1425
|
};
|
|
1426
1426
|
}, [a, d]);
|
|
1427
|
-
const v = n.value === "accepted",
|
|
1427
|
+
const v = n.value === "accepted", h = p || i || null, E = !!(r || h || a), F = !!h;
|
|
1428
1428
|
return /* @__PURE__ */ m("div", { className: "space-y-2", children: [
|
|
1429
1429
|
/* @__PURE__ */ m(
|
|
1430
1430
|
"div",
|
|
@@ -1440,7 +1440,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1440
1440
|
/* @__PURE__ */ t("span", { className: "text-sm font-medium", children: o || "Termos e condições" })
|
|
1441
1441
|
] }),
|
|
1442
1442
|
E ? /* @__PURE__ */ m(
|
|
1443
|
-
|
|
1443
|
+
fe,
|
|
1444
1444
|
{
|
|
1445
1445
|
type: "button",
|
|
1446
1446
|
variant: "outline",
|
|
@@ -1449,7 +1449,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1449
1449
|
disabled: w,
|
|
1450
1450
|
onClick: () => N(!0),
|
|
1451
1451
|
children: [
|
|
1452
|
-
w ? /* @__PURE__ */ t(Te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(
|
|
1452
|
+
w ? /* @__PURE__ */ t(Te, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(Ct, { className: "h-3 w-3" }),
|
|
1453
1453
|
"Ler termos"
|
|
1454
1454
|
]
|
|
1455
1455
|
}
|
|
@@ -1468,7 +1468,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1468
1468
|
"Li e aceito ",
|
|
1469
1469
|
o ? `"${o}"` : "os termos e condições"
|
|
1470
1470
|
] }),
|
|
1471
|
-
v && /* @__PURE__ */ t(
|
|
1471
|
+
v && /* @__PURE__ */ t(wt, { className: "h-4 w-4 text-green-500 shrink-0 mt-0.5" })
|
|
1472
1472
|
] })
|
|
1473
1473
|
]
|
|
1474
1474
|
}
|
|
@@ -1502,7 +1502,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1502
1502
|
/* @__PURE__ */ t("span", { className: "font-semibold", children: "Termos e condições" })
|
|
1503
1503
|
] }),
|
|
1504
1504
|
/* @__PURE__ */ t(
|
|
1505
|
-
|
|
1505
|
+
fe,
|
|
1506
1506
|
{
|
|
1507
1507
|
type: "button",
|
|
1508
1508
|
variant: "ghost",
|
|
@@ -1515,7 +1515,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1515
1515
|
/* @__PURE__ */ t("div", { className: "flex-1 overflow-auto p-4", children: F ? /* @__PURE__ */ t(
|
|
1516
1516
|
"iframe",
|
|
1517
1517
|
{
|
|
1518
|
-
src:
|
|
1518
|
+
src: h,
|
|
1519
1519
|
className: "w-full rounded border",
|
|
1520
1520
|
style: { height: "62vh" },
|
|
1521
1521
|
title: "Termos e condições",
|
|
@@ -1562,7 +1562,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1562
1562
|
onClick: () => d((p) => !p),
|
|
1563
1563
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
1564
1564
|
"aria-label": l ? "Ocultar senha" : "Mostrar senha",
|
|
1565
|
-
children: l ? /* @__PURE__ */ t(
|
|
1565
|
+
children: l ? /* @__PURE__ */ t(Dt, { size: 16 }) : /* @__PURE__ */ t(Et, { size: 16 })
|
|
1566
1566
|
}
|
|
1567
1567
|
)
|
|
1568
1568
|
] }),
|
|
@@ -1580,7 +1580,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1580
1580
|
return /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
1581
1581
|
/* @__PURE__ */ m("label", { className: "flex items-center gap-3 cursor-pointer select-none", children: [
|
|
1582
1582
|
/* @__PURE__ */ t(
|
|
1583
|
-
|
|
1583
|
+
_t,
|
|
1584
1584
|
{
|
|
1585
1585
|
checked: l,
|
|
1586
1586
|
onCheckedChange: (c) => !i && a.onChange(c),
|
|
@@ -1592,7 +1592,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1592
1592
|
] }),
|
|
1593
1593
|
((d = n.error) == null ? void 0 : d.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: n.error.message })
|
|
1594
1594
|
] });
|
|
1595
|
-
},
|
|
1595
|
+
}, gr = ({
|
|
1596
1596
|
name: e,
|
|
1597
1597
|
control: s,
|
|
1598
1598
|
minValue: o = 0,
|
|
@@ -1608,7 +1608,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1608
1608
|
}, []), /* @__PURE__ */ m("div", { className: "space-y-1", children: [
|
|
1609
1609
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
1610
1610
|
/* @__PURE__ */ t(
|
|
1611
|
-
|
|
1611
|
+
Mt,
|
|
1612
1612
|
{
|
|
1613
1613
|
min: o,
|
|
1614
1614
|
max: r,
|
|
@@ -1627,7 +1627,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1627
1627
|
] }),
|
|
1628
1628
|
((u = d.error) == null ? void 0 : u.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: d.error.message })
|
|
1629
1629
|
] });
|
|
1630
|
-
}, $e = (e) => /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),
|
|
1630
|
+
}, $e = (e) => /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e), br = ({
|
|
1631
1631
|
name: e,
|
|
1632
1632
|
control: s,
|
|
1633
1633
|
disabled: o,
|
|
@@ -1674,7 +1674,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1674
1674
|
] }),
|
|
1675
1675
|
((c = a.error) == null ? void 0 : c.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: a.error.message })
|
|
1676
1676
|
] });
|
|
1677
|
-
},
|
|
1677
|
+
}, vr = ({
|
|
1678
1678
|
name: e,
|
|
1679
1679
|
control: s,
|
|
1680
1680
|
options: o,
|
|
@@ -1683,16 +1683,16 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1683
1683
|
readOnly: a
|
|
1684
1684
|
}) => {
|
|
1685
1685
|
var x, $;
|
|
1686
|
-
const { field: n, fieldState: l } = L({ name: e, control: s }), [d, c] = j(""), [u, p] = j(!1), [b, w] = j(-1),
|
|
1686
|
+
const { field: n, fieldState: l } = L({ name: e, control: s }), [d, c] = j(""), [u, p] = j(!1), [b, w] = j(-1), f = K(null), T = K(null), N = `autocomplete-${e}-listbox`, A = ((x = o.find((D) => D.valor === n.value)) == null ? void 0 : x.label) ?? "", v = d.length > 0 ? o.filter(
|
|
1687
1687
|
(D) => D.label.toLowerCase().includes(d.toLowerCase())
|
|
1688
1688
|
) : o;
|
|
1689
1689
|
z(() => {
|
|
1690
1690
|
const D = (P) => {
|
|
1691
|
-
|
|
1691
|
+
f.current && !f.current.contains(P.target) && (p(!1), c(""), w(-1));
|
|
1692
1692
|
};
|
|
1693
1693
|
return document.addEventListener("mousedown", D), () => document.removeEventListener("mousedown", D);
|
|
1694
1694
|
}, []);
|
|
1695
|
-
const
|
|
1695
|
+
const h = () => {
|
|
1696
1696
|
p(!1), c(""), w(-1);
|
|
1697
1697
|
};
|
|
1698
1698
|
z(() => {
|
|
@@ -1703,7 +1703,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1703
1703
|
D == null || D.scrollIntoView({ block: "nearest" });
|
|
1704
1704
|
}, [b, N]);
|
|
1705
1705
|
const E = (D) => {
|
|
1706
|
-
D.disabled || (n.onChange(D.valor),
|
|
1706
|
+
D.disabled || (n.onChange(D.valor), h());
|
|
1707
1707
|
}, F = () => {
|
|
1708
1708
|
n.onChange(""), c(""), w(-1);
|
|
1709
1709
|
}, y = (D) => {
|
|
@@ -1724,14 +1724,14 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1724
1724
|
D.preventDefault(), b >= 0 && v[b] && !v[b].disabled && E(v[b]);
|
|
1725
1725
|
break;
|
|
1726
1726
|
case "Escape":
|
|
1727
|
-
D.preventDefault(),
|
|
1727
|
+
D.preventDefault(), h();
|
|
1728
1728
|
break;
|
|
1729
1729
|
case "Tab":
|
|
1730
|
-
|
|
1730
|
+
h();
|
|
1731
1731
|
break;
|
|
1732
1732
|
}
|
|
1733
1733
|
}, C = u && b >= 0 ? `${N}-option-${b}` : void 0;
|
|
1734
|
-
return /* @__PURE__ */ m("div", { className: "space-y-1", ref:
|
|
1734
|
+
return /* @__PURE__ */ m("div", { className: "space-y-1", ref: f, children: [
|
|
1735
1735
|
/* @__PURE__ */ m("div", { className: "relative", children: [
|
|
1736
1736
|
/* @__PURE__ */ t(
|
|
1737
1737
|
se,
|
|
@@ -1770,7 +1770,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1770
1770
|
children: /* @__PURE__ */ t(st, { size: 14 })
|
|
1771
1771
|
}
|
|
1772
1772
|
) : /* @__PURE__ */ t(
|
|
1773
|
-
|
|
1773
|
+
$t,
|
|
1774
1774
|
{
|
|
1775
1775
|
size: 16,
|
|
1776
1776
|
className: "text-muted-foreground pointer-events-none",
|
|
@@ -1841,7 +1841,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1841
1841
|
),
|
|
1842
1842
|
((d = n.error) == null ? void 0 : d.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: n.error.message })
|
|
1843
1843
|
] });
|
|
1844
|
-
},
|
|
1844
|
+
}, xr = ({
|
|
1845
1845
|
name: e,
|
|
1846
1846
|
control: s,
|
|
1847
1847
|
startLabel: o = "Data inicial",
|
|
@@ -1888,7 +1888,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1888
1888
|
] }),
|
|
1889
1889
|
((p = l.error) == null ? void 0 : p.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: l.error.message })
|
|
1890
1890
|
] });
|
|
1891
|
-
},
|
|
1891
|
+
}, yr = ({
|
|
1892
1892
|
name: e,
|
|
1893
1893
|
control: s,
|
|
1894
1894
|
maxRating: o = 5,
|
|
@@ -1908,7 +1908,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1908
1908
|
className: "transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded",
|
|
1909
1909
|
"aria-label": `${u} estrela${u > 1 ? "s" : ""}`,
|
|
1910
1910
|
children: /* @__PURE__ */ t(
|
|
1911
|
-
|
|
1911
|
+
At,
|
|
1912
1912
|
{
|
|
1913
1913
|
size: 24,
|
|
1914
1914
|
className: "transition-colors",
|
|
@@ -1927,7 +1927,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
1927
1927
|
] }),
|
|
1928
1928
|
((c = n.error) == null ? void 0 : c.message) && /* @__PURE__ */ t("p", { className: "text-sm text-destructive", children: n.error.message })
|
|
1929
1929
|
] });
|
|
1930
|
-
},
|
|
1930
|
+
}, Nr = ({
|
|
1931
1931
|
field: e,
|
|
1932
1932
|
name: s,
|
|
1933
1933
|
control: o,
|
|
@@ -2088,7 +2088,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
);
|
|
2090
2090
|
}
|
|
2091
|
-
},
|
|
2091
|
+
}, Cr = ({
|
|
2092
2092
|
name: e,
|
|
2093
2093
|
control: s,
|
|
2094
2094
|
subSchema: o,
|
|
@@ -2107,7 +2107,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2107
2107
|
n.obrigatorio && /* @__PURE__ */ t("span", { className: "text-destructive", children: " *" })
|
|
2108
2108
|
] }),
|
|
2109
2109
|
/* @__PURE__ */ t(
|
|
2110
|
-
|
|
2110
|
+
Nr,
|
|
2111
2111
|
{
|
|
2112
2112
|
field: n,
|
|
2113
2113
|
name: l,
|
|
@@ -2145,7 +2145,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2145
2145
|
case g.SELECT:
|
|
2146
2146
|
return /* @__PURE__ */ t(Oe, { ...n, options: e.opcoes ?? [] });
|
|
2147
2147
|
case g.AUTOCOMPLETE:
|
|
2148
|
-
return /* @__PURE__ */ t(
|
|
2148
|
+
return /* @__PURE__ */ t(vr, { ...n, options: e.opcoes ?? [] });
|
|
2149
2149
|
case g.SWITCH:
|
|
2150
2150
|
return /* @__PURE__ */ t(
|
|
2151
2151
|
mt,
|
|
@@ -2159,7 +2159,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2159
2159
|
);
|
|
2160
2160
|
case g.SLIDER:
|
|
2161
2161
|
return /* @__PURE__ */ t(
|
|
2162
|
-
|
|
2162
|
+
gr,
|
|
2163
2163
|
{
|
|
2164
2164
|
name: r,
|
|
2165
2165
|
control: s,
|
|
@@ -2172,7 +2172,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2172
2172
|
);
|
|
2173
2173
|
case g.RATING:
|
|
2174
2174
|
return /* @__PURE__ */ t(
|
|
2175
|
-
|
|
2175
|
+
yr,
|
|
2176
2176
|
{
|
|
2177
2177
|
name: r,
|
|
2178
2178
|
control: s,
|
|
@@ -2183,7 +2183,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2183
2183
|
);
|
|
2184
2184
|
case g.COLOR:
|
|
2185
2185
|
return /* @__PURE__ */ t(
|
|
2186
|
-
|
|
2186
|
+
br,
|
|
2187
2187
|
{
|
|
2188
2188
|
name: r,
|
|
2189
2189
|
control: s,
|
|
@@ -2195,7 +2195,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2195
2195
|
return /* @__PURE__ */ t(ut, { ...n });
|
|
2196
2196
|
case g.DATE_RANGE:
|
|
2197
2197
|
return /* @__PURE__ */ t(
|
|
2198
|
-
|
|
2198
|
+
xr,
|
|
2199
2199
|
{
|
|
2200
2200
|
name: r,
|
|
2201
2201
|
control: s,
|
|
@@ -2273,10 +2273,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2273
2273
|
case g.HIDDEN:
|
|
2274
2274
|
return /* @__PURE__ */ t(Ve, { name: r, control: s });
|
|
2275
2275
|
case g.PARTICIPATION_TYPE:
|
|
2276
|
-
return /* @__PURE__ */ t(
|
|
2276
|
+
return /* @__PURE__ */ t(cr, { name: r, control: s });
|
|
2277
2277
|
case g.PAYMENT_METHOD:
|
|
2278
2278
|
return /* @__PURE__ */ t(
|
|
2279
|
-
|
|
2279
|
+
pr,
|
|
2280
2280
|
{
|
|
2281
2281
|
name: r,
|
|
2282
2282
|
control: s,
|
|
@@ -2285,7 +2285,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2285
2285
|
);
|
|
2286
2286
|
case g.TERMS:
|
|
2287
2287
|
return /* @__PURE__ */ t(
|
|
2288
|
-
|
|
2288
|
+
fr,
|
|
2289
2289
|
{
|
|
2290
2290
|
name: r,
|
|
2291
2291
|
control: s,
|
|
@@ -2297,7 +2297,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2297
2297
|
);
|
|
2298
2298
|
case g.FIELD_ARRAY:
|
|
2299
2299
|
return /* @__PURE__ */ t(
|
|
2300
|
-
|
|
2300
|
+
ar,
|
|
2301
2301
|
{
|
|
2302
2302
|
name: r,
|
|
2303
2303
|
control: s,
|
|
@@ -2310,7 +2310,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2310
2310
|
);
|
|
2311
2311
|
case g.SUB_FORM:
|
|
2312
2312
|
return /* @__PURE__ */ t(
|
|
2313
|
-
|
|
2313
|
+
Cr,
|
|
2314
2314
|
{
|
|
2315
2315
|
name: r,
|
|
2316
2316
|
control: s,
|
|
@@ -2322,7 +2322,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2322
2322
|
default:
|
|
2323
2323
|
return /* @__PURE__ */ t(J, { ...n, type: "text" });
|
|
2324
2324
|
}
|
|
2325
|
-
},
|
|
2325
|
+
}, wr = ({
|
|
2326
2326
|
container: e,
|
|
2327
2327
|
control: s
|
|
2328
2328
|
}) => {
|
|
@@ -2334,7 +2334,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2334
2334
|
), l = _(
|
|
2335
2335
|
() => [...n.campos].sort((N, A) => N.ordem - A.ordem),
|
|
2336
2336
|
[n.campos]
|
|
2337
|
-
), d = de({ control: s }), { wrapperClass: c, wrapperStyle: u, headerClass: p, headerStyle: b, tmpl: w } = at(),
|
|
2337
|
+
), d = de({ control: s }), { wrapperClass: c, wrapperStyle: u, headerClass: p, headerStyle: b, tmpl: w } = at(), f = (N) => {
|
|
2338
2338
|
if (!H(
|
|
2339
2339
|
N.condicional,
|
|
2340
2340
|
d,
|
|
@@ -2356,7 +2356,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2356
2356
|
opcoes: C.map((x) => typeof x == "string" ? { valor: x, label: x } : x && typeof x == "object" && "valor" in x && "label" in x ? x : { valor: String(x), label: String(x) })
|
|
2357
2357
|
});
|
|
2358
2358
|
}
|
|
2359
|
-
const
|
|
2359
|
+
const h = v.tamanho ?? 12, E = v.inicioColuna, F = E ? `${E} / span ${h}` : `span ${h}`, y = /* @__PURE__ */ t(pt, { field: v, control: s });
|
|
2360
2360
|
return v.tipo === g.CHECKBOX || v.tipo === g.HIDDEN || v.tipo === g.SWITCH ? /* @__PURE__ */ t(
|
|
2361
2361
|
"div",
|
|
2362
2362
|
{
|
|
@@ -2419,9 +2419,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2419
2419
|
n.descricao && /* @__PURE__ */ t("p", { className: "text-sm", style: { color: "var(--t-text-muted)" }, children: n.descricao })
|
|
2420
2420
|
] })
|
|
2421
2421
|
] }) }),
|
|
2422
|
-
/* @__PURE__ */ t("div", { className: "p-6 grid grid-cols-12 gap-4", children: l.map(
|
|
2422
|
+
/* @__PURE__ */ t("div", { className: "p-6 grid grid-cols-12 gap-4", children: l.map(f) })
|
|
2423
2423
|
] });
|
|
2424
|
-
},
|
|
2424
|
+
}, Dr = ({
|
|
2425
2425
|
container: e,
|
|
2426
2426
|
control: s
|
|
2427
2427
|
}) => {
|
|
@@ -2438,7 +2438,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2438
2438
|
for (const $ of u)
|
|
2439
2439
|
$.initialValue !== void 0 ? x[$.nome] = typeof $.initialValue == "string" ? W($.initialValue, d) : $.initialValue : $.defaultValue !== void 0 && (x[$.nome] = $.defaultValue);
|
|
2440
2440
|
return x;
|
|
2441
|
-
}, [u, d]), { fields: b, append: w, remove:
|
|
2441
|
+
}, [u, d]), { fields: b, append: w, remove: f } = Ze({
|
|
2442
2442
|
control: s,
|
|
2443
2443
|
name: r
|
|
2444
2444
|
});
|
|
@@ -2450,7 +2450,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2450
2450
|
const T = de({ control: s }), N = _(() => {
|
|
2451
2451
|
const x = T[r];
|
|
2452
2452
|
return Array.isArray(x) ? x : [];
|
|
2453
|
-
}, [T, r]), { wrapperClass: A, wrapperStyle: v, headerClass:
|
|
2453
|
+
}, [T, r]), { wrapperClass: A, wrapperStyle: v, headerClass: h, headerStyle: E, tmpl: F } = at();
|
|
2454
2454
|
if (!e.nome)
|
|
2455
2455
|
return console.error(
|
|
2456
2456
|
"[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",
|
|
@@ -2504,7 +2504,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2504
2504
|
);
|
|
2505
2505
|
};
|
|
2506
2506
|
return /* @__PURE__ */ m("div", { className: A, style: v, children: [
|
|
2507
|
-
(c.titulo || l) && /* @__PURE__ */ t("div", { className:
|
|
2507
|
+
(c.titulo || l) && /* @__PURE__ */ t("div", { className: h, style: E, children: /* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
2508
2508
|
l && /* @__PURE__ */ t(
|
|
2509
2509
|
"div",
|
|
2510
2510
|
{
|
|
@@ -2552,7 +2552,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2552
2552
|
"button",
|
|
2553
2553
|
{
|
|
2554
2554
|
type: "button",
|
|
2555
|
-
onClick: () =>
|
|
2555
|
+
onClick: () => f($),
|
|
2556
2556
|
className: "inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors",
|
|
2557
2557
|
"aria-label": "Remover item",
|
|
2558
2558
|
children: /* @__PURE__ */ t(Je, { className: "w-4 h-4" })
|
|
@@ -2586,7 +2586,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2586
2586
|
] })
|
|
2587
2587
|
] })
|
|
2588
2588
|
] });
|
|
2589
|
-
},
|
|
2589
|
+
}, Er = (e) => e.container.repeatable && e.container.nome ? /* @__PURE__ */ t(Dr, { ...e }) : /* @__PURE__ */ t(wr, { ...e }), $r = ({
|
|
2590
2590
|
step: e,
|
|
2591
2591
|
control: s,
|
|
2592
2592
|
externalData: o = {}
|
|
@@ -2608,18 +2608,18 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2608
2608
|
{
|
|
2609
2609
|
className: "max-sm:!col-span-12",
|
|
2610
2610
|
style: { gridColumn: d },
|
|
2611
|
-
children: /* @__PURE__ */ t(
|
|
2611
|
+
children: /* @__PURE__ */ t(Er, { container: a, control: s })
|
|
2612
2612
|
},
|
|
2613
2613
|
a.id
|
|
2614
2614
|
);
|
|
2615
2615
|
}) });
|
|
2616
|
-
},
|
|
2616
|
+
}, ve = qe({
|
|
2617
2617
|
submitting: !1,
|
|
2618
2618
|
warnings: {},
|
|
2619
2619
|
requestSubmit: () => {
|
|
2620
2620
|
}
|
|
2621
|
-
}),
|
|
2622
|
-
const e =
|
|
2621
|
+
}), Ar = ve.Provider, Ur = () => {
|
|
2622
|
+
const e = ft("useFormApi"), s = be(ve);
|
|
2623
2623
|
return {
|
|
2624
2624
|
change: (o, r) => e.setValue(o, r, {
|
|
2625
2625
|
shouldValidate: !0,
|
|
@@ -2644,8 +2644,8 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2644
2644
|
};
|
|
2645
2645
|
}
|
|
2646
2646
|
};
|
|
2647
|
-
},
|
|
2648
|
-
const e =
|
|
2647
|
+
}, Ir = () => {
|
|
2648
|
+
const e = ft("useFormState"), s = be(ve), o = de({ control: e.control }), { errors: r, isDirty: i, isValid: a } = e.formState;
|
|
2649
2649
|
return {
|
|
2650
2650
|
values: o,
|
|
2651
2651
|
errors: Object.fromEntries(
|
|
@@ -2659,9 +2659,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2659
2659
|
valid: a,
|
|
2660
2660
|
submitting: s.submitting
|
|
2661
2661
|
};
|
|
2662
|
-
},
|
|
2662
|
+
}, Hr = (e) => {
|
|
2663
2663
|
var a;
|
|
2664
|
-
const s =
|
|
2664
|
+
const s = De(), { warnings: o } = be(ve), r = de({ control: s.control, name: e }), i = s.getFieldState(e, s.formState);
|
|
2665
2665
|
return {
|
|
2666
2666
|
value: r,
|
|
2667
2667
|
error: (a = i.error) == null ? void 0 : a.message,
|
|
@@ -2670,9 +2670,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2670
2670
|
touched: i.isTouched,
|
|
2671
2671
|
valid: !i.error
|
|
2672
2672
|
};
|
|
2673
|
-
},
|
|
2673
|
+
}, Xr = (e) => {
|
|
2674
2674
|
var a;
|
|
2675
|
-
const { control: s } =
|
|
2675
|
+
const { control: s } = De(), { warnings: o } = be(ve), { field: r, fieldState: i } = L({ name: e, control: s });
|
|
2676
2676
|
return {
|
|
2677
2677
|
input: {
|
|
2678
2678
|
name: r.name,
|
|
@@ -2689,6 +2689,13 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2689
2689
|
valid: !i.error
|
|
2690
2690
|
}
|
|
2691
2691
|
};
|
|
2692
|
+
}, ft = (e) => {
|
|
2693
|
+
const s = De();
|
|
2694
|
+
if (!s)
|
|
2695
|
+
throw new Error(
|
|
2696
|
+
`[SchemaForms] O hook '${e}' foi chamado fora de um <FormRenderer />. Certifique-se de que o componente está dentro da árvore de renderização do formulário.`
|
|
2697
|
+
);
|
|
2698
|
+
return s;
|
|
2692
2699
|
}, Ge = ({
|
|
2693
2700
|
stepIndex: e,
|
|
2694
2701
|
totalSteps: s,
|
|
@@ -2704,26 +2711,26 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2704
2711
|
onSubmit: p,
|
|
2705
2712
|
onBack: b
|
|
2706
2713
|
}) => {
|
|
2707
|
-
const w = e === s - 1,
|
|
2714
|
+
const w = e === s - 1, f = _(
|
|
2708
2715
|
() => JSON.stringify(i),
|
|
2709
2716
|
[i]
|
|
2710
2717
|
), T = _(
|
|
2711
|
-
() =>
|
|
2718
|
+
() => Kt(o, i, d),
|
|
2712
2719
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2713
|
-
[o.id,
|
|
2720
|
+
[o.id, f]
|
|
2714
2721
|
), N = _(
|
|
2715
|
-
() =>
|
|
2722
|
+
() => Wt(o, i, d),
|
|
2716
2723
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2717
|
-
[o.id,
|
|
2724
|
+
[o.id, f]
|
|
2718
2725
|
), [A, v] = j(
|
|
2719
2726
|
{}
|
|
2720
|
-
),
|
|
2721
|
-
|
|
2727
|
+
), h = K(c);
|
|
2728
|
+
h.current = c;
|
|
2722
2729
|
const E = i, F = _(
|
|
2723
|
-
() =>
|
|
2730
|
+
() => Zt(o, E),
|
|
2724
2731
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2725
|
-
[o,
|
|
2726
|
-
), y =
|
|
2732
|
+
[o, f]
|
|
2733
|
+
), y = bt({
|
|
2727
2734
|
resolver: T,
|
|
2728
2735
|
defaultValues: r,
|
|
2729
2736
|
mode: "onTouched"
|
|
@@ -2759,7 +2766,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2759
2766
|
let I = !1;
|
|
2760
2767
|
return N(G).then((te) => {
|
|
2761
2768
|
var k;
|
|
2762
|
-
I || (v(te), (k =
|
|
2769
|
+
I || (v(te), (k = h.current) == null || k.call(h, te));
|
|
2763
2770
|
}).catch((te) => {
|
|
2764
2771
|
I || console.error("[StepForm] warnComputer error:", te);
|
|
2765
2772
|
}), () => {
|
|
@@ -2855,8 +2862,8 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2855
2862
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2856
2863
|
[p]
|
|
2857
2864
|
);
|
|
2858
|
-
return /* @__PURE__ */ t(
|
|
2859
|
-
|
|
2865
|
+
return /* @__PURE__ */ t(vt, { ...y, children: /* @__PURE__ */ t(
|
|
2866
|
+
Ar,
|
|
2860
2867
|
{
|
|
2861
2868
|
value: {
|
|
2862
2869
|
submitting: n,
|
|
@@ -2900,7 +2907,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2900
2907
|
F.descricao && /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: F.descricao })
|
|
2901
2908
|
] }),
|
|
2902
2909
|
/* @__PURE__ */ t(
|
|
2903
|
-
|
|
2910
|
+
$r,
|
|
2904
2911
|
{
|
|
2905
2912
|
step: F,
|
|
2906
2913
|
control: C,
|
|
@@ -2909,7 +2916,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2909
2916
|
),
|
|
2910
2917
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between gap-4 pt-6 pb-2", children: [
|
|
2911
2918
|
/* @__PURE__ */ m(
|
|
2912
|
-
|
|
2919
|
+
fe,
|
|
2913
2920
|
{
|
|
2914
2921
|
type: "button",
|
|
2915
2922
|
variant: "outline",
|
|
@@ -2919,7 +2926,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2919
2926
|
e > 0 && "border-primary/40 text-primary hover:bg-primary/5"
|
|
2920
2927
|
),
|
|
2921
2928
|
children: [
|
|
2922
|
-
/* @__PURE__ */ t(
|
|
2929
|
+
/* @__PURE__ */ t(It, { className: "w-4 h-4" }),
|
|
2923
2930
|
/* @__PURE__ */ t("span", { className: "hidden sm:inline", children: "Anterior" })
|
|
2924
2931
|
]
|
|
2925
2932
|
}
|
|
@@ -2929,8 +2936,8 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2929
2936
|
"/",
|
|
2930
2937
|
s
|
|
2931
2938
|
] }),
|
|
2932
|
-
/* @__PURE__ */ m(
|
|
2933
|
-
n ? /* @__PURE__ */ t(Te, { className: "w-4 h-4 animate-spin" }) : w ? /* @__PURE__ */ t(pe, { className: "w-4 h-4" }) : /* @__PURE__ */ t(
|
|
2939
|
+
/* @__PURE__ */ m(fe, { type: "submit", disabled: n, children: [
|
|
2940
|
+
n ? /* @__PURE__ */ t(Te, { className: "w-4 h-4 animate-spin" }) : w ? /* @__PURE__ */ t(pe, { className: "w-4 h-4" }) : /* @__PURE__ */ t(Tt, { className: "w-4 h-4" }),
|
|
2934
2941
|
/* @__PURE__ */ t("span", { className: "hidden sm:inline", children: w ? "Finalizar" : "Próximo" })
|
|
2935
2942
|
] })
|
|
2936
2943
|
] }),
|
|
@@ -2940,10 +2947,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2940
2947
|
)
|
|
2941
2948
|
}
|
|
2942
2949
|
) });
|
|
2943
|
-
},
|
|
2950
|
+
}, we = (e) => {
|
|
2944
2951
|
if (e)
|
|
2945
2952
|
return Ee[e];
|
|
2946
|
-
},
|
|
2953
|
+
}, Tr = ({
|
|
2947
2954
|
steps: e,
|
|
2948
2955
|
currentStep: s,
|
|
2949
2956
|
onStepClick: o
|
|
@@ -2972,12 +2979,12 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
2972
2979
|
children: i < s ? /* @__PURE__ */ t(pe, { className: "w-4 h-4" }) : i + 1
|
|
2973
2980
|
},
|
|
2974
2981
|
r.id
|
|
2975
|
-
)) }),
|
|
2982
|
+
)) }), Fr = ({
|
|
2976
2983
|
steps: e,
|
|
2977
2984
|
currentStep: s,
|
|
2978
2985
|
onStepClick: o
|
|
2979
2986
|
}) => /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-2 flex-wrap", children: e.map((r, i) => {
|
|
2980
|
-
const a =
|
|
2987
|
+
const a = we(r.icone) ?? Ce;
|
|
2981
2988
|
return /* @__PURE__ */ t(
|
|
2982
2989
|
"div",
|
|
2983
2990
|
{
|
|
@@ -3004,14 +3011,14 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3004
3011
|
},
|
|
3005
3012
|
r.id
|
|
3006
3013
|
);
|
|
3007
|
-
}) }),
|
|
3014
|
+
}) }), Rr = ({
|
|
3008
3015
|
steps: e,
|
|
3009
3016
|
currentStep: s,
|
|
3010
3017
|
position: o,
|
|
3011
3018
|
orientation: r = "horizontal",
|
|
3012
3019
|
onStepClick: i
|
|
3013
3020
|
}) => r === "vertical" ? /* @__PURE__ */ t("div", { className: "flex flex-col gap-0", children: e.map((a, n) => {
|
|
3014
|
-
const l =
|
|
3021
|
+
const l = we(a.icone) ?? Ce, d = n === s, c = n < s, u = n === e.length - 1;
|
|
3015
3022
|
return /* @__PURE__ */ m("div", { className: "flex items-start gap-3", children: [
|
|
3016
3023
|
/* @__PURE__ */ m("div", { className: "flex flex-col items-center", children: [
|
|
3017
3024
|
/* @__PURE__ */ t(
|
|
@@ -3056,7 +3063,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3056
3063
|
)
|
|
3057
3064
|
] }, a.id);
|
|
3058
3065
|
}) }) : /* @__PURE__ */ t("div", { className: "w-full flex items-start", children: e.map((a, n) => {
|
|
3059
|
-
const l =
|
|
3066
|
+
const l = we(a.icone) ?? Ce, d = n === s, c = n < s, u = n === e.length - 1;
|
|
3060
3067
|
return /* @__PURE__ */ m(
|
|
3061
3068
|
"div",
|
|
3062
3069
|
{
|
|
@@ -3109,7 +3116,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3109
3116
|
},
|
|
3110
3117
|
a.id
|
|
3111
3118
|
);
|
|
3112
|
-
}) }),
|
|
3119
|
+
}) }), Sr = ({
|
|
3113
3120
|
steps: e,
|
|
3114
3121
|
currentStep: s,
|
|
3115
3122
|
onStepClick: o,
|
|
@@ -3119,7 +3126,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3119
3126
|
const a = Ye(), { layout: n } = a;
|
|
3120
3127
|
if (!n.showStepIndicators || e.length <= 1 && !i)
|
|
3121
3128
|
return null;
|
|
3122
|
-
const l = n.stepIndicatorVariant ?? "numbers", d = n.stepIndicatorPosition ?? "top-center", c = n.stepIndicatorOrientation ?? "horizontal", u = (s + 1) / e.length * 100, p = e[s], b =
|
|
3129
|
+
const l = n.stepIndicatorVariant ?? "numbers", d = n.stepIndicatorPosition ?? "top-center", c = n.stepIndicatorOrientation ?? "horizontal", u = (s + 1) / e.length * 100, p = e[s], b = we(p == null ? void 0 : p.icone) ?? Ce, w = /* @__PURE__ */ t(
|
|
3123
3130
|
"div",
|
|
3124
3131
|
{
|
|
3125
3132
|
className: "h-1 rounded-full overflow-hidden",
|
|
@@ -3137,7 +3144,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3137
3144
|
}
|
|
3138
3145
|
)
|
|
3139
3146
|
}
|
|
3140
|
-
),
|
|
3147
|
+
), f = /* @__PURE__ */ m("div", { className: "block sm:hidden space-y-2", children: [
|
|
3141
3148
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-3", children: [
|
|
3142
3149
|
/* @__PURE__ */ t(
|
|
3143
3150
|
"div",
|
|
@@ -3174,7 +3181,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3174
3181
|
w
|
|
3175
3182
|
] }), T = /* @__PURE__ */ m("div", { className: "hidden sm:block", children: [
|
|
3176
3183
|
l === "numbers" && /* @__PURE__ */ t(
|
|
3177
|
-
|
|
3184
|
+
Tr,
|
|
3178
3185
|
{
|
|
3179
3186
|
steps: e,
|
|
3180
3187
|
currentStep: s,
|
|
@@ -3182,7 +3189,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3182
3189
|
}
|
|
3183
3190
|
),
|
|
3184
3191
|
l === "icons" && /* @__PURE__ */ t(
|
|
3185
|
-
|
|
3192
|
+
Fr,
|
|
3186
3193
|
{
|
|
3187
3194
|
steps: e,
|
|
3188
3195
|
currentStep: s,
|
|
@@ -3190,7 +3197,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3190
3197
|
}
|
|
3191
3198
|
),
|
|
3192
3199
|
l === "icons-labeled" && /* @__PURE__ */ t(
|
|
3193
|
-
|
|
3200
|
+
Rr,
|
|
3194
3201
|
{
|
|
3195
3202
|
steps: e,
|
|
3196
3203
|
currentStep: s,
|
|
@@ -3201,19 +3208,19 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3201
3208
|
)
|
|
3202
3209
|
] }), N = n.showProgressBar ? /* @__PURE__ */ t("div", { className: "hidden sm:block", children: w }) : null;
|
|
3203
3210
|
return c === "vertical" ? /* @__PURE__ */ m("div", { className: S("flex gap-6 items-start", r), children: [
|
|
3204
|
-
|
|
3211
|
+
f,
|
|
3205
3212
|
/* @__PURE__ */ m("div", { className: "hidden sm:flex gap-6 items-start shrink-0", children: [
|
|
3206
3213
|
T,
|
|
3207
3214
|
N && /* @__PURE__ */ t("div", { className: "flex-1 pt-4", children: N })
|
|
3208
3215
|
] })
|
|
3209
3216
|
] }) : /* @__PURE__ */ m("div", { className: S("space-y-3", r), children: [
|
|
3210
|
-
|
|
3217
|
+
f,
|
|
3211
3218
|
/* @__PURE__ */ m("div", { className: "hidden sm:block space-y-3", children: [
|
|
3212
3219
|
T,
|
|
3213
3220
|
N
|
|
3214
3221
|
] })
|
|
3215
3222
|
] });
|
|
3216
|
-
},
|
|
3223
|
+
}, kr = (e, s, o) => {
|
|
3217
3224
|
var a;
|
|
3218
3225
|
const r = { ...s }, i = o;
|
|
3219
3226
|
for (const n of e.containers) {
|
|
@@ -3238,7 +3245,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3238
3245
|
}
|
|
3239
3246
|
}
|
|
3240
3247
|
return r;
|
|
3241
|
-
},
|
|
3248
|
+
}, zr = ({
|
|
3242
3249
|
schema: e,
|
|
3243
3250
|
initialValues: s = {},
|
|
3244
3251
|
initialStep: o = 0,
|
|
@@ -3253,13 +3260,13 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3253
3260
|
resolveTermsUploadUrl: p,
|
|
3254
3261
|
fieldResolvers: b,
|
|
3255
3262
|
validatorMapper: w,
|
|
3256
|
-
componentMapper:
|
|
3263
|
+
componentMapper: f,
|
|
3257
3264
|
paymentMethodOptions: T,
|
|
3258
3265
|
onValuesChange: N,
|
|
3259
3266
|
className: A,
|
|
3260
|
-
StepIndicator: v =
|
|
3267
|
+
StepIndicator: v = Sr
|
|
3261
3268
|
}) => {
|
|
3262
|
-
const [
|
|
3269
|
+
const [h, E] = j(() => o), [F, y] = j({
|
|
3263
3270
|
...s
|
|
3264
3271
|
}), [C, x] = j(() => o), [$, D] = j(!1), [P, M] = j(null), [q, Y] = j(
|
|
3265
3272
|
{}
|
|
@@ -3275,8 +3282,8 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3275
3282
|
}, [a, ae]), G = _(
|
|
3276
3283
|
() => [...e.steps].sort((O, B) => O.ordem - B.ordem),
|
|
3277
3284
|
[e.steps]
|
|
3278
|
-
), R = G.length, U = R > 0 ? G[Math.min(
|
|
3279
|
-
() => U ?
|
|
3285
|
+
), R = G.length, U = R > 0 ? G[Math.min(h, R - 1)] : null, le = _(
|
|
3286
|
+
() => U ? kr(U, F, l) : {},
|
|
3280
3287
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3281
3288
|
[U, F, Q]
|
|
3282
3289
|
), I = _(
|
|
@@ -3288,7 +3295,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3288
3295
|
fieldResolvers: b,
|
|
3289
3296
|
validatorMapper: w,
|
|
3290
3297
|
fieldWarnings: q,
|
|
3291
|
-
componentMapper:
|
|
3298
|
+
componentMapper: f,
|
|
3292
3299
|
paymentMethodOptions: T
|
|
3293
3300
|
}),
|
|
3294
3301
|
[
|
|
@@ -3298,7 +3305,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3298
3305
|
b,
|
|
3299
3306
|
w,
|
|
3300
3307
|
q,
|
|
3301
|
-
|
|
3308
|
+
f,
|
|
3302
3309
|
T,
|
|
3303
3310
|
Q
|
|
3304
3311
|
]
|
|
@@ -3308,10 +3315,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3308
3315
|
D(!0), M(null);
|
|
3309
3316
|
try {
|
|
3310
3317
|
const B = { ...F, ...O };
|
|
3311
|
-
if (y(B), r && await r(
|
|
3318
|
+
if (y(B), r && await r(h, O), h === R - 1)
|
|
3312
3319
|
i && await i(B);
|
|
3313
3320
|
else {
|
|
3314
|
-
const ee =
|
|
3321
|
+
const ee = h + 1;
|
|
3315
3322
|
E(ee), x((oe) => Math.max(oe, ee));
|
|
3316
3323
|
}
|
|
3317
3324
|
} catch (B) {
|
|
@@ -3323,10 +3330,10 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3323
3330
|
}
|
|
3324
3331
|
}
|
|
3325
3332
|
},
|
|
3326
|
-
[
|
|
3333
|
+
[h, F, $, R, r, i]
|
|
3327
3334
|
), te = re(() => {
|
|
3328
|
-
|
|
3329
|
-
}, [
|
|
3335
|
+
h > 0 && E((O) => O - 1);
|
|
3336
|
+
}, [h]);
|
|
3330
3337
|
if (!U)
|
|
3331
3338
|
return /* @__PURE__ */ t(Ie.Provider, { value: I, children: /* @__PURE__ */ t(
|
|
3332
3339
|
_e,
|
|
@@ -3345,9 +3352,9 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3345
3352
|
label: O.titulo,
|
|
3346
3353
|
icone: O.icone
|
|
3347
3354
|
})),
|
|
3348
|
-
currentStep:
|
|
3355
|
+
currentStep: h,
|
|
3349
3356
|
onStepClick: (O) => {
|
|
3350
|
-
O !==
|
|
3357
|
+
O !== h && O <= C && E(O);
|
|
3351
3358
|
}
|
|
3352
3359
|
}
|
|
3353
3360
|
) : null;
|
|
@@ -3393,7 +3400,7 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3393
3400
|
/* @__PURE__ */ t(
|
|
3394
3401
|
Ge,
|
|
3395
3402
|
{
|
|
3396
|
-
stepIndex:
|
|
3403
|
+
stepIndex: h,
|
|
3397
3404
|
totalSteps: R,
|
|
3398
3405
|
step: U,
|
|
3399
3406
|
defaultValues: le,
|
|
@@ -3407,18 +3414,18 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3407
3414
|
onSubmit: Z,
|
|
3408
3415
|
onBack: te
|
|
3409
3416
|
},
|
|
3410
|
-
|
|
3417
|
+
h
|
|
3411
3418
|
)
|
|
3412
3419
|
] })
|
|
3413
3420
|
] })
|
|
3414
3421
|
) : (
|
|
3415
3422
|
/* Default top layout */
|
|
3416
|
-
/* @__PURE__ */ m(
|
|
3423
|
+
/* @__PURE__ */ m(he, { children: [
|
|
3417
3424
|
V && /* @__PURE__ */ t("div", { className: "mb-8", children: V }),
|
|
3418
3425
|
/* @__PURE__ */ t(
|
|
3419
3426
|
Ge,
|
|
3420
3427
|
{
|
|
3421
|
-
stepIndex:
|
|
3428
|
+
stepIndex: h,
|
|
3422
3429
|
totalSteps: R,
|
|
3423
3430
|
step: U,
|
|
3424
3431
|
defaultValues: le,
|
|
@@ -3432,19 +3439,19 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3432
3439
|
onSubmit: Z,
|
|
3433
3440
|
onBack: te
|
|
3434
3441
|
},
|
|
3435
|
-
|
|
3442
|
+
h
|
|
3436
3443
|
)
|
|
3437
3444
|
] })
|
|
3438
3445
|
)
|
|
3439
3446
|
] })
|
|
3440
3447
|
}
|
|
3441
3448
|
) });
|
|
3442
|
-
},
|
|
3449
|
+
}, Kr = ({
|
|
3443
3450
|
children: e,
|
|
3444
3451
|
render: s,
|
|
3445
3452
|
onChange: o
|
|
3446
3453
|
}) => {
|
|
3447
|
-
const r =
|
|
3454
|
+
const r = Ir(), i = K(o);
|
|
3448
3455
|
return i.current = o, z(() => {
|
|
3449
3456
|
var a;
|
|
3450
3457
|
(a = i.current) == null || a.call(i, r);
|
|
@@ -3458,42 +3465,42 @@ const Ie = qe({}), ie = () => be(Ie), H = (e, s, o = {}) => {
|
|
|
3458
3465
|
r.errors,
|
|
3459
3466
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3460
3467
|
r.warnings
|
|
3461
|
-
]), s ? /* @__PURE__ */ t(
|
|
3468
|
+
]), s ? /* @__PURE__ */ t(he, { children: s(r) }) : typeof e == "function" ? /* @__PURE__ */ t(he, { children: e(r) }) : e !== void 0 ? /* @__PURE__ */ t(he, { children: e }) : null;
|
|
3462
3469
|
};
|
|
3463
3470
|
export {
|
|
3464
|
-
|
|
3471
|
+
Er as ContainerRenderer,
|
|
3465
3472
|
dt as DFCepField,
|
|
3466
3473
|
Pe as DFCheckbox,
|
|
3467
3474
|
nt as DFCheckboxGroup,
|
|
3468
3475
|
ge as DFDateField,
|
|
3469
|
-
|
|
3476
|
+
ar as DFFieldArray,
|
|
3470
3477
|
lt as DFFileUpload,
|
|
3471
3478
|
Ve as DFHidden,
|
|
3472
3479
|
ce as DFMaskedInput,
|
|
3473
|
-
|
|
3474
|
-
|
|
3480
|
+
cr as DFParticipationType,
|
|
3481
|
+
pr as DFPaymentMethod,
|
|
3475
3482
|
ot as DFRadioGroup,
|
|
3476
3483
|
Oe as DFSelect,
|
|
3477
|
-
|
|
3484
|
+
fr as DFTerms,
|
|
3478
3485
|
J as DFTextField,
|
|
3479
3486
|
ke as DFTextarea,
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3487
|
+
Sr as DefaultStepIndicator,
|
|
3488
|
+
zr as FormRenderer,
|
|
3489
|
+
Kr as FormSpy,
|
|
3490
|
+
dr as OPCOES_POR_DIA,
|
|
3491
|
+
mr as OPCOES_TODOS_OS_DIAS,
|
|
3485
3492
|
Ie as RendererContext,
|
|
3486
|
-
|
|
3493
|
+
$r as StepRenderer,
|
|
3487
3494
|
H as evaluateFieldCondition,
|
|
3488
3495
|
W as interpolate,
|
|
3489
3496
|
Se as interpolateContainer,
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3497
|
+
Yt as interpolateField,
|
|
3498
|
+
Zt as interpolateStep,
|
|
3499
|
+
Kt as makeStepResolver,
|
|
3500
|
+
Wt as makeStepWarnComputer,
|
|
3501
|
+
Hr as useField,
|
|
3502
|
+
Xr as useFieldApi,
|
|
3503
|
+
Ur as useFormApi,
|
|
3504
|
+
Ir as useFormState,
|
|
3498
3505
|
ie as useRendererContext
|
|
3499
3506
|
};
|