@tech-diefra/fluig-ui 1.0.3 → 1.0.4

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/dist/index.js ADDED
@@ -0,0 +1,904 @@
1
+ import { jsxs as v, jsx as n, Fragment as Z } from "react/jsx-runtime";
2
+ import { memo as j, useMemo as W, useCallback as B, useState as G, useRef as J, useEffect as A, forwardRef as K } from "react";
3
+ import { useFormContext as D, useController as z, useFormState as ee } from "react-hook-form";
4
+ import { IMaskInput as te } from "react-imask";
5
+ import { useSection as H, useFluigRuntime as V } from "@fluig-kit/ecm";
6
+ import ae, { registerLocale as ne } from "react-datepicker";
7
+ import { parse as re, isValid as oe, format as ie } from "date-fns";
8
+ const se = {
9
+ cpf: "000.000.000-00",
10
+ cnpj: "00.000.000/0000-00",
11
+ telefone: "(00) 00000-0000",
12
+ cep: "00000-000"
13
+ };
14
+ function de({
15
+ name: e,
16
+ label: a = "",
17
+ placeholder: t = "",
18
+ type: i = "text",
19
+ mask: r,
20
+ className: d = "",
21
+ forceReadOnly: s = !1,
22
+ forceHidden: c = !1
23
+ }) {
24
+ const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S } = V(), { field: m } = z({ name: e, control: M }), { errors: p } = ee({ name: e }), h = p == null ? void 0 : p[e], C = W(() => r ? se[r] ?? r : null, [r]), k = B((o) => {
25
+ if (!o) return "";
26
+ const w = o.replace(/\D/g, "");
27
+ return (Number(w) / 100).toLocaleString("pt-BR", {
28
+ style: "currency",
29
+ currency: "BRL"
30
+ });
31
+ }, []), x = B(
32
+ (o) => i === "monetary" ? k(o) : o,
33
+ [i, k]
34
+ );
35
+ return S ? /* @__PURE__ */ v("div", { className: "form-group", children: [
36
+ /* @__PURE__ */ n("label", { children: a }),
37
+ /* @__PURE__ */ n("span", { className: "form-control", children: m.value || "-" })
38
+ ] }) : /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
39
+ /* @__PURE__ */ n("label", { children: a }),
40
+ C ? /* @__PURE__ */ n(
41
+ te,
42
+ {
43
+ name: e,
44
+ mask: C,
45
+ value: String(m.value ?? ""),
46
+ unmask: !1,
47
+ onAccept: (o) => m.onChange(x(o)),
48
+ placeholder: t,
49
+ readOnly: g,
50
+ className: `form-control ${h ? "border-red" : ""} ${d}`,
51
+ inputRef: m.ref,
52
+ onBlur: m.onBlur
53
+ }
54
+ ) : /* @__PURE__ */ n(
55
+ "input",
56
+ {
57
+ ...m,
58
+ type: "text",
59
+ value: m.value ?? "",
60
+ onChange: (o) => m.onChange(x(o.target.value)),
61
+ placeholder: t,
62
+ readOnly: g,
63
+ className: `form-control ${h ? "border-red" : ""} ${d}`
64
+ }
65
+ ),
66
+ h && /* @__PURE__ */ n("p", { className: "text-danger", children: String(h.message) })
67
+ ] });
68
+ }
69
+ const nt = j(de);
70
+ function ce({
71
+ name: e,
72
+ label: a = "",
73
+ options: t = [],
74
+ placeholder: i = "",
75
+ labelKey: r = "label",
76
+ valueKey: d = "value",
77
+ enableSearch: s = !1,
78
+ searchPlaceholder: c = "Buscar...",
79
+ loading: P = !1,
80
+ onSearchChange: f,
81
+ debounceTime: g = 300,
82
+ onSelect: b,
83
+ forceReadOnly: M = !1,
84
+ forceHidden: S = !1
85
+ }) {
86
+ const { isReadOnly: m, isHidden: p } = H(), h = M || !!m(e), C = S || !!p(e), { control: k, clearErrors: x } = D(), { isView: o } = V(), {
87
+ field: { onChange: w, value: y, ref: $ },
88
+ fieldState: { error: l }
89
+ } = z({
90
+ name: e,
91
+ control: k
92
+ }), [N, O] = G(!1), [R, X] = G(""), L = J(null), I = J(f);
93
+ A(() => {
94
+ I.current = f;
95
+ }, [f]), A(() => {
96
+ const u = (F) => {
97
+ L.current && !L.current.contains(F.target) && O(!1);
98
+ };
99
+ return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
100
+ }, []), A(() => {
101
+ N || X("");
102
+ }, [N]), A(() => {
103
+ if (!s) return;
104
+ const u = setTimeout(() => {
105
+ I.current && I.current(R);
106
+ }, g);
107
+ return () => clearTimeout(u);
108
+ }, [R, s, g]);
109
+ const Y = W(() => s && !f && R.trim() ? t.filter(
110
+ (u) => String((u == null ? void 0 : u[r]) ?? "").toLowerCase().includes(R.toLowerCase())
111
+ ) : t ?? [], [t, s, f, R, r]), Q = W(() => {
112
+ if (y == null) return "";
113
+ if (typeof y == "object")
114
+ return String(y[d] ?? "");
115
+ const u = (t || []).find(
116
+ (F) => String(F == null ? void 0 : F[d]) === String(y)
117
+ );
118
+ return String(u ? (u == null ? void 0 : u[r]) ?? "" : y);
119
+ }, [y, t, d, r]), U = (u) => {
120
+ h || (w(u[d]), b && b(u), x(e), O(!1));
121
+ };
122
+ return /* @__PURE__ */ v(
123
+ "div",
124
+ {
125
+ className: `select-wrapper form-group ${C ? "hidden" : ""}`,
126
+ ref: L,
127
+ children: [
128
+ /* @__PURE__ */ n("label", { className: "control-label", children: a }),
129
+ o ? /* @__PURE__ */ n("span", { className: "form-control", children: Q || "-" }) : /* @__PURE__ */ v(Z, { children: [
130
+ /* @__PURE__ */ v(
131
+ "div",
132
+ {
133
+ className: `select-control ${l ? "border-red" : ""} ${h ? "readOnly" : ""}`,
134
+ onClick: () => !h && O((u) => !u),
135
+ ref: $,
136
+ children: [
137
+ /* @__PURE__ */ n("span", { className: `select-display ${h ? "readOnly" : ""}`, children: Q || i }),
138
+ /* @__PURE__ */ n("i", { className: "flaticon flaticon-chevron-down select-icon" })
139
+ ]
140
+ }
141
+ ),
142
+ N && !h && /* @__PURE__ */ v("div", { className: "select-dropdown", children: [
143
+ s && /* @__PURE__ */ n("div", { className: "select-search", children: /* @__PURE__ */ n(
144
+ "input",
145
+ {
146
+ type: "text",
147
+ className: "select-search-input",
148
+ value: R,
149
+ onChange: (u) => X(u.target.value),
150
+ placeholder: P ? "Carregando..." : c,
151
+ autoFocus: !0,
152
+ onClick: (u) => u.stopPropagation()
153
+ }
154
+ ) }),
155
+ /* @__PURE__ */ n("ul", { className: "select-options", children: P ? /* @__PURE__ */ n("li", { className: "select-option readOnly", children: "Carregando..." }) : Y.length > 0 ? Y.map((u) => /* @__PURE__ */ n(
156
+ "li",
157
+ {
158
+ onClick: () => U(u),
159
+ className: "select-option handleHover",
160
+ children: u[r]
161
+ },
162
+ u[d]
163
+ )) : /* @__PURE__ */ n("li", { className: "select-option readOnly", children: "Sem resultados" }) })
164
+ ] })
165
+ ] }),
166
+ /* @__PURE__ */ n("input", { type: "hidden", name: e, value: y || "" }),
167
+ l && /* @__PURE__ */ n("p", { className: "text-danger", children: String(l.message) })
168
+ ]
169
+ }
170
+ );
171
+ }
172
+ const rt = j(ce);
173
+ function ot({
174
+ name: e,
175
+ options: a = [],
176
+ label: t = "",
177
+ valueKey: i = "value",
178
+ labelKey: r = "label",
179
+ forceReadOnly: d = !1,
180
+ forceHidden: s = !1
181
+ }) {
182
+ var y, $;
183
+ const c = D(), { isView: P, isReadOnly: f } = V(), { isReadOnly: g, isHidden: b } = H(), M = g ? g(e) : !1, S = b ? b(e) : !1, m = d || M, p = s || S, h = m || f || P;
184
+ if (!c || !e)
185
+ return console.error("Checkbox requer contexto de formulário e nome."), null;
186
+ const C = () => !a || !c ? {} : a.reduce((l, N) => {
187
+ const O = N[i], R = c.getValues(O);
188
+ return l[O] = R === "on", l;
189
+ }, {}), k = c.watch(e), x = W(() => k && typeof k == "object" ? k : C(), [k, a, i]);
190
+ A(() => {
191
+ const l = c.getValues(e);
192
+ (!l || typeof l != "object") && c.setValue(e, x, {
193
+ shouldDirty: !1,
194
+ shouldValidate: !1
195
+ });
196
+ }, [x, e, c]);
197
+ const o = (l, N) => {
198
+ if (h) return;
199
+ const O = { ...x, [l]: N };
200
+ c.setValue(e, O, {
201
+ shouldDirty: !0,
202
+ shouldValidate: !0
203
+ }), c.setValue(l, N ? "on" : "", { shouldValidate: !1 });
204
+ }, w = ($ = (y = c.formState) == null ? void 0 : y.errors) == null ? void 0 : $[e];
205
+ return /* @__PURE__ */ v("div", { className: `form-group ${p ? "hidden" : ""}`, children: [
206
+ t && /* @__PURE__ */ n("label", { children: t }),
207
+ /* @__PURE__ */ n(
208
+ "div",
209
+ {
210
+ className: `checkbox-group-custom ${h ? "readOnly" : ""}`,
211
+ children: a.map((l) => {
212
+ const N = String(l[i]), O = x[N] === !0;
213
+ return /* @__PURE__ */ v("div", { children: [
214
+ /* @__PURE__ */ n("input", { type: "hidden", ...c.register(N) }),
215
+ /* @__PURE__ */ v(
216
+ "label",
217
+ {
218
+ className: `custom-checkbox ${O ? "checked" : ""} ${h ? "readOnly" : ""}`,
219
+ children: [
220
+ /* @__PURE__ */ n(
221
+ "input",
222
+ {
223
+ type: "checkbox",
224
+ checked: O,
225
+ disabled: h,
226
+ onChange: (R) => o(N, R.target.checked)
227
+ }
228
+ ),
229
+ /* @__PURE__ */ n("span", { className: "checkmark" }),
230
+ /* @__PURE__ */ n("span", { children: l[r] })
231
+ ]
232
+ }
233
+ )
234
+ ] }, N);
235
+ })
236
+ }
237
+ ),
238
+ w && /* @__PURE__ */ n("p", { className: "text-danger", children: String(w.message) })
239
+ ] });
240
+ }
241
+ function le({
242
+ name: e,
243
+ label: a = "",
244
+ options: t = [],
245
+ valueKey: i = "value",
246
+ labelKey: r = "label",
247
+ iconKey: d = "icon",
248
+ forceReadOnly: s = !1,
249
+ forceHidden: c = !1
250
+ }) {
251
+ const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S, isReadOnly: m } = V(), {
252
+ field: p,
253
+ fieldState: { error: h }
254
+ } = z({
255
+ name: e,
256
+ control: M
257
+ }), C = g || m || S, k = p.value ?? "", x = B(
258
+ (o) => {
259
+ C || p.onChange(o);
260
+ },
261
+ [C, p]
262
+ );
263
+ return /* @__PURE__ */ v("div", { className: `form-group column ${b ? "hidden" : ""}`, children: [
264
+ a && /* @__PURE__ */ n("label", { className: "control-label", children: a }),
265
+ /* @__PURE__ */ n(
266
+ "div",
267
+ {
268
+ className: `btn-group ${C ? "view-mode" : ""}`,
269
+ "data-field-name": e,
270
+ children: t.map((o) => {
271
+ const w = o[i], y = k === w, $ = o.color ? { "--customColor": o.color } : void 0;
272
+ return /* @__PURE__ */ v(
273
+ "label",
274
+ {
275
+ htmlFor: `${e}_${w}`,
276
+ style: $,
277
+ className: `btn fs-ellipsis ${y ? "active" : ""}`,
278
+ children: [
279
+ /* @__PURE__ */ n(
280
+ "input",
281
+ {
282
+ type: "radio",
283
+ id: `${e}_${w}`,
284
+ name: e,
285
+ value: w,
286
+ checked: y,
287
+ className: "hidden",
288
+ onChange: () => x(w),
289
+ disabled: C
290
+ }
291
+ ),
292
+ o[d] && /* @__PURE__ */ n("i", { className: `${o[d]} icon-sm` }),
293
+ " ",
294
+ o[r]
295
+ ]
296
+ },
297
+ w
298
+ );
299
+ })
300
+ }
301
+ ),
302
+ h && /* @__PURE__ */ n("p", { className: "text-danger", children: String(h.message) })
303
+ ] });
304
+ }
305
+ const it = j(le), ue = ({
306
+ name: e,
307
+ label: a = "",
308
+ placeholder: t = "",
309
+ className: i = "",
310
+ rows: r = 4,
311
+ maxLength: d,
312
+ forceReadOnly: s = !1,
313
+ forceHidden: c = !1
314
+ }) => {
315
+ const { isReadOnly: P, isHidden: f } = H(), g = s || !!P(e), b = c || !!f(e), { control: M } = D(), { isView: S } = V(), {
316
+ field: m,
317
+ fieldState: { error: p }
318
+ } = z({
319
+ name: e,
320
+ control: M
321
+ });
322
+ return S ? /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
323
+ /* @__PURE__ */ n("label", { children: a }),
324
+ /* @__PURE__ */ n("span", { className: "form-control", children: m.value || "-" })
325
+ ] }) : /* @__PURE__ */ v("div", { className: `form-group ${b ? "hidden" : ""}`, children: [
326
+ /* @__PURE__ */ n("label", { children: a }),
327
+ /* @__PURE__ */ n(
328
+ "textarea",
329
+ {
330
+ ...m,
331
+ rows: r,
332
+ maxLength: d,
333
+ value: m.value || "",
334
+ placeholder: t,
335
+ readOnly: g,
336
+ className: `form-control ${p ? "border-red" : ""} ${i}`
337
+ }
338
+ ),
339
+ p && /* @__PURE__ */ n("p", { className: "text-danger", children: String(p.message) })
340
+ ] });
341
+ }, st = j(ue);
342
+ function E(e) {
343
+ return (a = {}) => {
344
+ const t = a.width ? String(a.width) : e.defaultWidth;
345
+ return e.formats[t] || e.formats[e.defaultWidth];
346
+ };
347
+ }
348
+ function q(e) {
349
+ return (a, t) => {
350
+ const i = t != null && t.context ? String(t.context) : "standalone";
351
+ let r;
352
+ if (i === "formatting" && e.formattingValues) {
353
+ const s = e.defaultFormattingWidth || e.defaultWidth, c = t != null && t.width ? String(t.width) : s;
354
+ r = e.formattingValues[c] || e.formattingValues[s];
355
+ } else {
356
+ const s = e.defaultWidth, c = t != null && t.width ? String(t.width) : e.defaultWidth;
357
+ r = e.values[c] || e.values[s];
358
+ }
359
+ const d = e.argumentCallback ? e.argumentCallback(a) : a;
360
+ return r[d];
361
+ };
362
+ }
363
+ function T(e) {
364
+ return (a, t = {}) => {
365
+ const i = t.width, r = i && e.matchPatterns[i] || e.matchPatterns[e.defaultMatchWidth], d = a.match(r);
366
+ if (!d)
367
+ return null;
368
+ const s = d[0], c = i && e.parsePatterns[i] || e.parsePatterns[e.defaultParseWidth], P = Array.isArray(c) ? he(c, (b) => b.test(s)) : (
369
+ // [TODO] -- I challenge you to fix the type
370
+ me(c, (b) => b.test(s))
371
+ );
372
+ let f;
373
+ f = e.valueCallback ? e.valueCallback(P) : P, f = t.valueCallback ? (
374
+ // [TODO] -- I challenge you to fix the type
375
+ t.valueCallback(f)
376
+ ) : f;
377
+ const g = a.slice(s.length);
378
+ return { value: f, rest: g };
379
+ };
380
+ }
381
+ function me(e, a) {
382
+ for (const t in e)
383
+ if (Object.prototype.hasOwnProperty.call(e, t) && a(e[t]))
384
+ return t;
385
+ }
386
+ function he(e, a) {
387
+ for (let t = 0; t < e.length; t++)
388
+ if (a(e[t]))
389
+ return t;
390
+ }
391
+ function fe(e) {
392
+ return (a, t = {}) => {
393
+ const i = a.match(e.matchPattern);
394
+ if (!i) return null;
395
+ const r = i[0], d = a.match(e.parsePattern);
396
+ if (!d) return null;
397
+ let s = e.valueCallback ? e.valueCallback(d[0]) : d[0];
398
+ s = t.valueCallback ? t.valueCallback(s) : s;
399
+ const c = a.slice(r.length);
400
+ return { value: s, rest: c };
401
+ };
402
+ }
403
+ const ge = {
404
+ lessThanXSeconds: {
405
+ one: "menos de um segundo",
406
+ other: "menos de {{count}} segundos"
407
+ },
408
+ xSeconds: {
409
+ one: "1 segundo",
410
+ other: "{{count}} segundos"
411
+ },
412
+ halfAMinute: "meio minuto",
413
+ lessThanXMinutes: {
414
+ one: "menos de um minuto",
415
+ other: "menos de {{count}} minutos"
416
+ },
417
+ xMinutes: {
418
+ one: "1 minuto",
419
+ other: "{{count}} minutos"
420
+ },
421
+ aboutXHours: {
422
+ one: "cerca de 1 hora",
423
+ other: "cerca de {{count}} horas"
424
+ },
425
+ xHours: {
426
+ one: "1 hora",
427
+ other: "{{count}} horas"
428
+ },
429
+ xDays: {
430
+ one: "1 dia",
431
+ other: "{{count}} dias"
432
+ },
433
+ aboutXWeeks: {
434
+ one: "cerca de 1 semana",
435
+ other: "cerca de {{count}} semanas"
436
+ },
437
+ xWeeks: {
438
+ one: "1 semana",
439
+ other: "{{count}} semanas"
440
+ },
441
+ aboutXMonths: {
442
+ one: "cerca de 1 mês",
443
+ other: "cerca de {{count}} meses"
444
+ },
445
+ xMonths: {
446
+ one: "1 mês",
447
+ other: "{{count}} meses"
448
+ },
449
+ aboutXYears: {
450
+ one: "cerca de 1 ano",
451
+ other: "cerca de {{count}} anos"
452
+ },
453
+ xYears: {
454
+ one: "1 ano",
455
+ other: "{{count}} anos"
456
+ },
457
+ overXYears: {
458
+ one: "mais de 1 ano",
459
+ other: "mais de {{count}} anos"
460
+ },
461
+ almostXYears: {
462
+ one: "quase 1 ano",
463
+ other: "quase {{count}} anos"
464
+ }
465
+ }, be = (e, a, t) => {
466
+ let i;
467
+ const r = ge[e];
468
+ return typeof r == "string" ? i = r : a === 1 ? i = r.one : i = r.other.replace("{{count}}", String(a)), t != null && t.addSuffix ? t.comparison && t.comparison > 0 ? "em " + i : "há " + i : i;
469
+ }, pe = {
470
+ full: "EEEE, d 'de' MMMM 'de' y",
471
+ long: "d 'de' MMMM 'de' y",
472
+ medium: "d MMM y",
473
+ short: "dd/MM/yyyy"
474
+ }, ye = {
475
+ full: "HH:mm:ss zzzz",
476
+ long: "HH:mm:ss z",
477
+ medium: "HH:mm:ss",
478
+ short: "HH:mm"
479
+ }, ve = {
480
+ full: "{{date}} 'às' {{time}}",
481
+ long: "{{date}} 'às' {{time}}",
482
+ medium: "{{date}}, {{time}}",
483
+ short: "{{date}}, {{time}}"
484
+ }, we = {
485
+ date: E({
486
+ formats: pe,
487
+ defaultWidth: "full"
488
+ }),
489
+ time: E({
490
+ formats: ye,
491
+ defaultWidth: "full"
492
+ }),
493
+ dateTime: E({
494
+ formats: ve,
495
+ defaultWidth: "full"
496
+ })
497
+ }, Ne = {
498
+ lastWeek: (e) => {
499
+ const a = e.getDay();
500
+ return "'" + (a === 0 || a === 6 ? "último" : "última") + "' eeee 'às' p";
501
+ },
502
+ yesterday: "'ontem às' p",
503
+ today: "'hoje às' p",
504
+ tomorrow: "'amanhã às' p",
505
+ nextWeek: "eeee 'às' p",
506
+ other: "P"
507
+ }, Pe = (e, a, t, i) => {
508
+ const r = Ne[e];
509
+ return typeof r == "function" ? r(a) : r;
510
+ }, Ce = {
511
+ narrow: ["AC", "DC"],
512
+ abbreviated: ["AC", "DC"],
513
+ wide: ["antes de cristo", "depois de cristo"]
514
+ }, ke = {
515
+ narrow: ["1", "2", "3", "4"],
516
+ abbreviated: ["T1", "T2", "T3", "T4"],
517
+ wide: ["1º trimestre", "2º trimestre", "3º trimestre", "4º trimestre"]
518
+ }, xe = {
519
+ narrow: ["j", "f", "m", "a", "m", "j", "j", "a", "s", "o", "n", "d"],
520
+ abbreviated: [
521
+ "jan",
522
+ "fev",
523
+ "mar",
524
+ "abr",
525
+ "mai",
526
+ "jun",
527
+ "jul",
528
+ "ago",
529
+ "set",
530
+ "out",
531
+ "nov",
532
+ "dez"
533
+ ],
534
+ wide: [
535
+ "janeiro",
536
+ "fevereiro",
537
+ "março",
538
+ "abril",
539
+ "maio",
540
+ "junho",
541
+ "julho",
542
+ "agosto",
543
+ "setembro",
544
+ "outubro",
545
+ "novembro",
546
+ "dezembro"
547
+ ]
548
+ }, Me = {
549
+ narrow: ["D", "S", "T", "Q", "Q", "S", "S"],
550
+ short: ["dom", "seg", "ter", "qua", "qui", "sex", "sab"],
551
+ abbreviated: [
552
+ "domingo",
553
+ "segunda",
554
+ "terça",
555
+ "quarta",
556
+ "quinta",
557
+ "sexta",
558
+ "sábado"
559
+ ],
560
+ wide: [
561
+ "domingo",
562
+ "segunda-feira",
563
+ "terça-feira",
564
+ "quarta-feira",
565
+ "quinta-feira",
566
+ "sexta-feira",
567
+ "sábado"
568
+ ]
569
+ }, Se = {
570
+ narrow: {
571
+ am: "a",
572
+ pm: "p",
573
+ midnight: "mn",
574
+ noon: "md",
575
+ morning: "manhã",
576
+ afternoon: "tarde",
577
+ evening: "tarde",
578
+ night: "noite"
579
+ },
580
+ abbreviated: {
581
+ am: "AM",
582
+ pm: "PM",
583
+ midnight: "meia-noite",
584
+ noon: "meio-dia",
585
+ morning: "manhã",
586
+ afternoon: "tarde",
587
+ evening: "tarde",
588
+ night: "noite"
589
+ },
590
+ wide: {
591
+ am: "a.m.",
592
+ pm: "p.m.",
593
+ midnight: "meia-noite",
594
+ noon: "meio-dia",
595
+ morning: "manhã",
596
+ afternoon: "tarde",
597
+ evening: "tarde",
598
+ night: "noite"
599
+ }
600
+ }, Oe = {
601
+ narrow: {
602
+ am: "a",
603
+ pm: "p",
604
+ midnight: "mn",
605
+ noon: "md",
606
+ morning: "da manhã",
607
+ afternoon: "da tarde",
608
+ evening: "da tarde",
609
+ night: "da noite"
610
+ },
611
+ abbreviated: {
612
+ am: "AM",
613
+ pm: "PM",
614
+ midnight: "meia-noite",
615
+ noon: "meio-dia",
616
+ morning: "da manhã",
617
+ afternoon: "da tarde",
618
+ evening: "da tarde",
619
+ night: "da noite"
620
+ },
621
+ wide: {
622
+ am: "a.m.",
623
+ pm: "p.m.",
624
+ midnight: "meia-noite",
625
+ noon: "meio-dia",
626
+ morning: "da manhã",
627
+ afternoon: "da tarde",
628
+ evening: "da tarde",
629
+ night: "da noite"
630
+ }
631
+ }, Re = (e, a) => {
632
+ const t = Number(e);
633
+ return (a == null ? void 0 : a.unit) === "week" ? t + "ª" : t + "º";
634
+ }, $e = {
635
+ ordinalNumber: Re,
636
+ era: q({
637
+ values: Ce,
638
+ defaultWidth: "wide"
639
+ }),
640
+ quarter: q({
641
+ values: ke,
642
+ defaultWidth: "wide",
643
+ argumentCallback: (e) => e - 1
644
+ }),
645
+ month: q({
646
+ values: xe,
647
+ defaultWidth: "wide"
648
+ }),
649
+ day: q({
650
+ values: Me,
651
+ defaultWidth: "wide"
652
+ }),
653
+ dayPeriod: q({
654
+ values: Se,
655
+ defaultWidth: "wide",
656
+ formattingValues: Oe,
657
+ defaultFormattingWidth: "wide"
658
+ })
659
+ }, Ve = /^(\d+)[ºªo]?/i, We = /\d+/i, je = {
660
+ narrow: /^(ac|dc|a|d)/i,
661
+ abbreviated: /^(a\.?\s?c\.?|d\.?\s?c\.?)/i,
662
+ wide: /^(antes de cristo|depois de cristo)/i
663
+ }, De = {
664
+ any: [/^ac/i, /^dc/i],
665
+ wide: [/^antes de cristo/i, /^depois de cristo/i]
666
+ }, He = {
667
+ narrow: /^[1234]/i,
668
+ abbreviated: /^T[1234]/i,
669
+ wide: /^[1234](º)? trimestre/i
670
+ }, Fe = {
671
+ any: [/1/i, /2/i, /3/i, /4/i]
672
+ }, qe = {
673
+ narrow: /^[jfmajsond]/i,
674
+ abbreviated: /^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,
675
+ wide: /^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i
676
+ }, Te = {
677
+ narrow: [
678
+ /^j/i,
679
+ /^f/i,
680
+ /^m/i,
681
+ /^a/i,
682
+ /^m/i,
683
+ /^j/i,
684
+ /^j/i,
685
+ /^a/i,
686
+ /^s/i,
687
+ /^o/i,
688
+ /^n/i,
689
+ /^d/i
690
+ ],
691
+ any: [
692
+ /^ja/i,
693
+ /^fev/i,
694
+ /^mar/i,
695
+ /^abr/i,
696
+ /^mai/i,
697
+ /^jun/i,
698
+ /^jul/i,
699
+ /^ago/i,
700
+ /^set/i,
701
+ /^out/i,
702
+ /^nov/i,
703
+ /^dez/i
704
+ ]
705
+ }, Ae = {
706
+ narrow: /^(dom|[23456]ª?|s[aá]b)/i,
707
+ short: /^(dom|[23456]ª?|s[aá]b)/i,
708
+ abbreviated: /^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,
709
+ wide: /^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i
710
+ }, Be = {
711
+ short: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
712
+ narrow: [/^d/i, /^2/i, /^3/i, /^4/i, /^5/i, /^6/i, /^s[aá]/i],
713
+ any: [/^d/i, /^seg/i, /^t/i, /^qua/i, /^qui/i, /^sex/i, /^s[aá]b/i]
714
+ }, ze = {
715
+ narrow: /^(a|p|mn|md|(da) (manhã|tarde|noite))/i,
716
+ any: /^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i
717
+ }, Le = {
718
+ any: {
719
+ am: /^a/i,
720
+ pm: /^p/i,
721
+ midnight: /^mn|^meia[-\s]noite/i,
722
+ noon: /^md|^meio[-\s]dia/i,
723
+ morning: /manhã/i,
724
+ afternoon: /tarde/i,
725
+ evening: /tarde/i,
726
+ night: /noite/i
727
+ }
728
+ }, Ie = {
729
+ ordinalNumber: fe({
730
+ matchPattern: Ve,
731
+ parsePattern: We,
732
+ valueCallback: (e) => parseInt(e, 10)
733
+ }),
734
+ era: T({
735
+ matchPatterns: je,
736
+ defaultMatchWidth: "wide",
737
+ parsePatterns: De,
738
+ defaultParseWidth: "any"
739
+ }),
740
+ quarter: T({
741
+ matchPatterns: He,
742
+ defaultMatchWidth: "wide",
743
+ parsePatterns: Fe,
744
+ defaultParseWidth: "any",
745
+ valueCallback: (e) => e + 1
746
+ }),
747
+ month: T({
748
+ matchPatterns: qe,
749
+ defaultMatchWidth: "wide",
750
+ parsePatterns: Te,
751
+ defaultParseWidth: "any"
752
+ }),
753
+ day: T({
754
+ matchPatterns: Ae,
755
+ defaultMatchWidth: "wide",
756
+ parsePatterns: Be,
757
+ defaultParseWidth: "any"
758
+ }),
759
+ dayPeriod: T({
760
+ matchPatterns: ze,
761
+ defaultMatchWidth: "any",
762
+ parsePatterns: Le,
763
+ defaultParseWidth: "any"
764
+ })
765
+ }, Ee = {
766
+ code: "pt-BR",
767
+ formatDistance: be,
768
+ formatLong: we,
769
+ formatRelative: Pe,
770
+ localize: $e,
771
+ match: Ie,
772
+ options: {
773
+ weekStartsOn: 0,
774
+ firstWeekContainsDate: 1
775
+ }
776
+ };
777
+ ne("pt-BR", Ee);
778
+ const _ = "dd/MM/yyyy", _e = (e) => {
779
+ if (!e) return null;
780
+ const a = re(e, _, /* @__PURE__ */ new Date());
781
+ return oe(a) ? a : null;
782
+ }, Xe = (e) => e ? ie(e, _) : "", Ye = K(
783
+ ({ shimRef: e, className: a, name: t, ...i }, r) => /* @__PURE__ */ n(
784
+ "input",
785
+ {
786
+ name: t,
787
+ ...i,
788
+ className: a,
789
+ ref: (d) => {
790
+ typeof r == "function" ? r(d) : r && (r.current = d), e && e(d);
791
+ }
792
+ }
793
+ )
794
+ ), Qe = ({
795
+ name: e,
796
+ label: a = "",
797
+ placeholder: t = "dd/mm/aaaa",
798
+ className: i = "",
799
+ forceReadOnly: r = !1,
800
+ forceHidden: d = !1
801
+ }) => {
802
+ const { control: s } = D(), { isView: c } = V(), { isReadOnly: P, isHidden: f } = H(), g = r || !!P(e), b = d || !!f(e), {
803
+ field: { onChange: M, onBlur: S, value: m, ref: p },
804
+ fieldState: { error: h }
805
+ } = z({
806
+ name: e,
807
+ control: s
808
+ }), C = W(() => _e(m), [m]), k = B(
809
+ (o) => {
810
+ M(o ? Xe(o) : "");
811
+ },
812
+ [M]
813
+ ), x = B(
814
+ (o) => {
815
+ var w, y;
816
+ if (p(o), o && ((y = (w = s._fields) == null ? void 0 : w[e]) != null && y._f)) {
817
+ const $ = s._fields[e];
818
+ $._f.ref = {
819
+ focus: () => {
820
+ var l;
821
+ return (l = o.focus) == null ? void 0 : l.call(o);
822
+ },
823
+ select: () => {
824
+ var l;
825
+ return (l = o.select) == null ? void 0 : l.call(o);
826
+ },
827
+ setCustomValidity: (l) => {
828
+ var N;
829
+ return (N = o.setCustomValidity) == null ? void 0 : N.call(o, l);
830
+ },
831
+ reportValidity: () => {
832
+ var l;
833
+ return (l = o.reportValidity) == null ? void 0 : l.call(o);
834
+ }
835
+ };
836
+ }
837
+ },
838
+ [p, s, e]
839
+ );
840
+ return b ? null : c ? /* @__PURE__ */ v("div", { className: "form-group", children: [
841
+ /* @__PURE__ */ n("label", { children: a }),
842
+ /* @__PURE__ */ n("span", { className: "form-control", children: m || "-" })
843
+ ] }) : /* @__PURE__ */ v("div", { className: `form-group fluig-style-guide ${i}`, children: [
844
+ a && /* @__PURE__ */ n("label", { className: "control-label", htmlFor: e, children: a }),
845
+ /* @__PURE__ */ n("div", { className: `${h ? "border-red" : ""}`, children: /* @__PURE__ */ n(
846
+ ae,
847
+ {
848
+ id: e,
849
+ name: e,
850
+ selected: C,
851
+ onChange: k,
852
+ onBlur: S,
853
+ dateFormat: _,
854
+ placeholderText: t,
855
+ disabled: g,
856
+ readOnly: g,
857
+ locale: "pt-BR",
858
+ className: `form-control ${h ? "border-red" : ""}`,
859
+ wrapperClassName: "w-100",
860
+ showMonthDropdown: !0,
861
+ showYearDropdown: !0,
862
+ dropdownMode: "select",
863
+ isClearable: !g && !!m,
864
+ autoComplete: "off",
865
+ customInput: /* @__PURE__ */ n(Ye, { name: e, shimRef: x })
866
+ }
867
+ ) }),
868
+ h && /* @__PURE__ */ n("span", { className: "help-block text-danger", children: String(h.message) })
869
+ ] });
870
+ }, dt = j(Qe);
871
+ function Ge({
872
+ mapping: e = {},
873
+ defaultLabel: a = "Não reconhecido",
874
+ className: t = "",
875
+ hidden: i = !1,
876
+ label: r
877
+ }) {
878
+ const { activityId: d } = V(), s = W(() => !e || d === null || d === void 0 ? null : e[d], [d, e]);
879
+ if (!s)
880
+ return /* @__PURE__ */ v("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
881
+ r && /* @__PURE__ */ n("label", { children: r }),
882
+ /* @__PURE__ */ n("div", { className: `status-badge default ${t}`, children: a })
883
+ ] });
884
+ const c = {
885
+ "--customColor": s.color
886
+ };
887
+ return /* @__PURE__ */ v("div", { className: `form-group ${i ? "hidden" : ""}`, children: [
888
+ r && /* @__PURE__ */ n("label", { children: r }),
889
+ /* @__PURE__ */ v("div", { className: `status-badge ${t}`, style: c, children: [
890
+ s.icon && /* @__PURE__ */ n("i", { className: s.icon }),
891
+ /* @__PURE__ */ n("span", { children: s.label })
892
+ ] })
893
+ ] });
894
+ }
895
+ const ct = j(Ge);
896
+ export {
897
+ ot as Checkbox,
898
+ dt as DatePicker,
899
+ nt as Input,
900
+ it as RadioBtn,
901
+ rt as Select,
902
+ ct as StatusBadge,
903
+ st as TextArea
904
+ };