@aspprev/versi-ds 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +463 -0
- package/dist/DocumentItem-BU0J2QGP.d.ts +21 -0
- package/dist/charts.d.ts +82 -0
- package/dist/charts.js +31 -0
- package/dist/charts.js.map +1 -0
- package/dist/chunk-2ACDV5D5.js +560 -0
- package/dist/chunk-2ACDV5D5.js.map +1 -0
- package/dist/chunk-2NMEKWO5.js +38 -0
- package/dist/chunk-2NMEKWO5.js.map +1 -0
- package/dist/chunk-6MXHE5MD.js +769 -0
- package/dist/chunk-6MXHE5MD.js.map +1 -0
- package/dist/chunk-A3PA5H7L.js +3099 -0
- package/dist/chunk-A3PA5H7L.js.map +1 -0
- package/dist/chunk-BY4HJZFJ.js +3308 -0
- package/dist/chunk-BY4HJZFJ.js.map +1 -0
- package/dist/chunk-CWIPMGCA.js +314 -0
- package/dist/chunk-CWIPMGCA.js.map +1 -0
- package/dist/chunk-OPUUOVCL.js +3226 -0
- package/dist/chunk-OPUUOVCL.js.map +1 -0
- package/dist/chunk-OWXG2A4N.js +77 -0
- package/dist/chunk-OWXG2A4N.js.map +1 -0
- package/dist/chunk-XGWGBD7X.js +45 -0
- package/dist/chunk-XGWGBD7X.js.map +1 -0
- package/dist/core.d.ts +471 -0
- package/dist/core.js +86 -0
- package/dist/core.js.map +1 -0
- package/dist/countries.d.ts +52 -0
- package/dist/countries.js +18 -0
- package/dist/countries.js.map +1 -0
- package/dist/documents.d.ts +9 -0
- package/dist/documents.js +13 -0
- package/dist/documents.js.map +1 -0
- package/dist/flags/ad.svg +1 -0
- package/dist/flags/ae.svg +1 -0
- package/dist/flags/af.svg +5 -0
- package/dist/flags/ag.svg +1 -0
- package/dist/flags/ai.svg +1 -0
- package/dist/flags/al.svg +1 -0
- package/dist/flags/am.svg +1 -0
- package/dist/flags/ao.svg +1 -0
- package/dist/flags/aq.svg +1 -0
- package/dist/flags/ar.svg +1 -0
- package/dist/flags/as.svg +1 -0
- package/dist/flags/at.svg +1 -0
- package/dist/flags/au.svg +1 -0
- package/dist/flags/aw.svg +1 -0
- package/dist/flags/ax.svg +1 -0
- package/dist/flags/az.svg +1 -0
- package/dist/flags/ba.svg +1 -0
- package/dist/flags/bb.svg +1 -0
- package/dist/flags/bd.svg +1 -0
- package/dist/flags/be.svg +1 -0
- package/dist/flags/bf.svg +1 -0
- package/dist/flags/bg.svg +1 -0
- package/dist/flags/bh.svg +1 -0
- package/dist/flags/bi.svg +1 -0
- package/dist/flags/bj.svg +1 -0
- package/dist/flags/bl.svg +1 -0
- package/dist/flags/bm.svg +1 -0
- package/dist/flags/bn.svg +1 -0
- package/dist/flags/bo.svg +1 -0
- package/dist/flags/bq.svg +1 -0
- package/dist/flags/br.svg +1 -0
- package/dist/flags/bs.svg +1 -0
- package/dist/flags/bt.svg +1 -0
- package/dist/flags/bv.svg +1 -0
- package/dist/flags/bw.svg +1 -0
- package/dist/flags/by.svg +1 -0
- package/dist/flags/bz.svg +1 -0
- package/dist/flags/ca.svg +1 -0
- package/dist/flags/cc.svg +1 -0
- package/dist/flags/cd.svg +1 -0
- package/dist/flags/cf.svg +1 -0
- package/dist/flags/cg.svg +1 -0
- package/dist/flags/ch.svg +1 -0
- package/dist/flags/ci.svg +1 -0
- package/dist/flags/ck.svg +1 -0
- package/dist/flags/cl.svg +1 -0
- package/dist/flags/cm.svg +1 -0
- package/dist/flags/cn.svg +1 -0
- package/dist/flags/co.svg +1 -0
- package/dist/flags/cr.svg +1 -0
- package/dist/flags/cu.svg +1 -0
- package/dist/flags/cv.svg +1 -0
- package/dist/flags/cw.svg +1 -0
- package/dist/flags/cx.svg +1 -0
- package/dist/flags/cy.svg +1 -0
- package/dist/flags/cz.svg +1 -0
- package/dist/flags/de.svg +1 -0
- package/dist/flags/dj.svg +1 -0
- package/dist/flags/dk.svg +1 -0
- package/dist/flags/dm.svg +1 -0
- package/dist/flags/do.svg +1 -0
- package/dist/flags/dz.svg +1 -0
- package/dist/flags/ec.svg +1 -0
- package/dist/flags/ee.svg +1 -0
- package/dist/flags/eg.svg +1 -0
- package/dist/flags/eh.svg +1 -0
- package/dist/flags/er.svg +1 -0
- package/dist/flags/es.svg +1 -0
- package/dist/flags/et.svg +1 -0
- package/dist/flags/fi.svg +1 -0
- package/dist/flags/fj.svg +1 -0
- package/dist/flags/fk.svg +1 -0
- package/dist/flags/fm.svg +1 -0
- package/dist/flags/fo.svg +1 -0
- package/dist/flags/fr.svg +1 -0
- package/dist/flags/ga.svg +1 -0
- package/dist/flags/gb.svg +1 -0
- package/dist/flags/gd.svg +1 -0
- package/dist/flags/ge.svg +1 -0
- package/dist/flags/gf.svg +1 -0
- package/dist/flags/gg.svg +1 -0
- package/dist/flags/gh.svg +1 -0
- package/dist/flags/gi.svg +1 -0
- package/dist/flags/gl.svg +1 -0
- package/dist/flags/gm.svg +1 -0
- package/dist/flags/gn.svg +1 -0
- package/dist/flags/gp.svg +1 -0
- package/dist/flags/gq.svg +1 -0
- package/dist/flags/gr.svg +1 -0
- package/dist/flags/gs.svg +1 -0
- package/dist/flags/gt.svg +1 -0
- package/dist/flags/gu.svg +1 -0
- package/dist/flags/gw.svg +1 -0
- package/dist/flags/gy.svg +1 -0
- package/dist/flags/hk.svg +1 -0
- package/dist/flags/hm.svg +1 -0
- package/dist/flags/hn.svg +1 -0
- package/dist/flags/hr.svg +1 -0
- package/dist/flags/ht.svg +1 -0
- package/dist/flags/hu.svg +1 -0
- package/dist/flags/id.svg +1 -0
- package/dist/flags/ie.svg +1 -0
- package/dist/flags/il.svg +1 -0
- package/dist/flags/im.svg +1 -0
- package/dist/flags/in.svg +1 -0
- package/dist/flags/io.svg +1 -0
- package/dist/flags/iq.svg +1 -0
- package/dist/flags/ir.svg +1 -0
- package/dist/flags/is.svg +1 -0
- package/dist/flags/it.svg +1 -0
- package/dist/flags/je.svg +1 -0
- package/dist/flags/jm.svg +1 -0
- package/dist/flags/jo.svg +1 -0
- package/dist/flags/jp.svg +1 -0
- package/dist/flags/ke.svg +1 -0
- package/dist/flags/kg.svg +1 -0
- package/dist/flags/kh.svg +1 -0
- package/dist/flags/ki.svg +1 -0
- package/dist/flags/km.svg +1 -0
- package/dist/flags/kn.svg +1 -0
- package/dist/flags/kp.svg +1 -0
- package/dist/flags/kr.svg +1 -0
- package/dist/flags/kw.svg +1 -0
- package/dist/flags/ky.svg +1 -0
- package/dist/flags/kz.svg +1 -0
- package/dist/flags/la.svg +1 -0
- package/dist/flags/lb.svg +1 -0
- package/dist/flags/lc.svg +1 -0
- package/dist/flags/li.svg +1 -0
- package/dist/flags/lk.svg +1 -0
- package/dist/flags/lr.svg +1 -0
- package/dist/flags/ls.svg +1 -0
- package/dist/flags/lt.svg +1 -0
- package/dist/flags/lu.svg +1 -0
- package/dist/flags/lv.svg +1 -0
- package/dist/flags/ly.svg +1 -0
- package/dist/flags/ma.svg +1 -0
- package/dist/flags/mc.svg +1 -0
- package/dist/flags/md.svg +1 -0
- package/dist/flags/me.svg +1 -0
- package/dist/flags/mf.svg +1 -0
- package/dist/flags/mg.svg +1 -0
- package/dist/flags/mh.svg +1 -0
- package/dist/flags/mk.svg +1 -0
- package/dist/flags/ml.svg +1 -0
- package/dist/flags/mm.svg +1 -0
- package/dist/flags/mn.svg +1 -0
- package/dist/flags/mo.svg +1 -0
- package/dist/flags/mp.svg +1 -0
- package/dist/flags/mq.svg +1 -0
- package/dist/flags/mr.svg +1 -0
- package/dist/flags/ms.svg +1 -0
- package/dist/flags/mt.svg +1 -0
- package/dist/flags/mu.svg +1 -0
- package/dist/flags/mv.svg +1 -0
- package/dist/flags/mw.svg +1 -0
- package/dist/flags/mx.svg +1 -0
- package/dist/flags/my.svg +1 -0
- package/dist/flags/mz.svg +1 -0
- package/dist/flags/na.svg +1 -0
- package/dist/flags/nc.svg +1 -0
- package/dist/flags/ne.svg +1 -0
- package/dist/flags/nf.svg +1 -0
- package/dist/flags/ng.svg +1 -0
- package/dist/flags/ni.svg +1 -0
- package/dist/flags/nl.svg +1 -0
- package/dist/flags/no.svg +1 -0
- package/dist/flags/np.svg +1 -0
- package/dist/flags/nr.svg +1 -0
- package/dist/flags/nu.svg +1 -0
- package/dist/flags/nz.svg +1 -0
- package/dist/flags/om.svg +1 -0
- package/dist/flags/pa.svg +1 -0
- package/dist/flags/pe.svg +1 -0
- package/dist/flags/pf.svg +1 -0
- package/dist/flags/pg.svg +1 -0
- package/dist/flags/ph.svg +1 -0
- package/dist/flags/pk.svg +1 -0
- package/dist/flags/pl.svg +1 -0
- package/dist/flags/pm.svg +1 -0
- package/dist/flags/pn.svg +1 -0
- package/dist/flags/pr.svg +1 -0
- package/dist/flags/ps.svg +1 -0
- package/dist/flags/pt.svg +1 -0
- package/dist/flags/pw.svg +1 -0
- package/dist/flags/py.svg +1 -0
- package/dist/flags/qa.svg +1 -0
- package/dist/flags/re.svg +1 -0
- package/dist/flags/ro.svg +1 -0
- package/dist/flags/rs.svg +1 -0
- package/dist/flags/ru.svg +1 -0
- package/dist/flags/rw.svg +1 -0
- package/dist/flags/sa.svg +1 -0
- package/dist/flags/sb.svg +1 -0
- package/dist/flags/sc.svg +1 -0
- package/dist/flags/sd.svg +1 -0
- package/dist/flags/se.svg +1 -0
- package/dist/flags/sg.svg +1 -0
- package/dist/flags/sh.svg +1 -0
- package/dist/flags/si.svg +1 -0
- package/dist/flags/sj.svg +1 -0
- package/dist/flags/sk.svg +1 -0
- package/dist/flags/sl.svg +1 -0
- package/dist/flags/sm.svg +1 -0
- package/dist/flags/sn.svg +1 -0
- package/dist/flags/so.svg +1 -0
- package/dist/flags/sr.svg +1 -0
- package/dist/flags/ss.svg +1 -0
- package/dist/flags/st.svg +1 -0
- package/dist/flags/sv.svg +1 -0
- package/dist/flags/sx.svg +1 -0
- package/dist/flags/sy.svg +1 -0
- package/dist/flags/sz.svg +1 -0
- package/dist/flags/tc.svg +1 -0
- package/dist/flags/td.svg +1 -0
- package/dist/flags/tf.svg +1 -0
- package/dist/flags/tg.svg +1 -0
- package/dist/flags/th.svg +1 -0
- package/dist/flags/tj.svg +1 -0
- package/dist/flags/tk.svg +1 -0
- package/dist/flags/tl.svg +1 -0
- package/dist/flags/tm.svg +1 -0
- package/dist/flags/tn.svg +1 -0
- package/dist/flags/to.svg +1 -0
- package/dist/flags/tr.svg +1 -0
- package/dist/flags/tt.svg +1 -0
- package/dist/flags/tv.svg +1 -0
- package/dist/flags/tw.svg +1 -0
- package/dist/flags/tz.svg +1 -0
- package/dist/flags/ua.svg +1 -0
- package/dist/flags/ug.svg +1 -0
- package/dist/flags/um.svg +1 -0
- package/dist/flags/us.svg +1 -0
- package/dist/flags/uy.svg +1 -0
- package/dist/flags/uz.svg +1 -0
- package/dist/flags/va.svg +1 -0
- package/dist/flags/vc.svg +1 -0
- package/dist/flags/ve.svg +1 -0
- package/dist/flags/vg.svg +1 -0
- package/dist/flags/vi.svg +1 -0
- package/dist/flags/vn.svg +1 -0
- package/dist/flags/vu.svg +1 -0
- package/dist/flags/wf.svg +1 -0
- package/dist/flags/ws.svg +1 -0
- package/dist/flags/xk.svg +1 -0
- package/dist/flags/ye.svg +1 -0
- package/dist/flags/yt.svg +1 -0
- package/dist/flags/za.svg +1 -0
- package/dist/flags/zm.svg +1 -0
- package/dist/flags/zw.svg +1 -0
- package/dist/forms.d.ts +242 -0
- package/dist/forms.js +41 -0
- package/dist/forms.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +33 -0
- package/dist/overlays.d.ts +75 -0
- package/dist/overlays.js +17 -0
- package/dist/overlays.js.map +1 -0
- package/dist/styles.css +3 -0
- package/dist/themes.css +125 -0
- package/package.json +156 -0
|
@@ -0,0 +1,3226 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useBreakpoint
|
|
3
|
+
} from "./chunk-CWIPMGCA.js";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues
|
|
8
|
+
} from "./chunk-2NMEKWO5.js";
|
|
9
|
+
|
|
10
|
+
// src/components/loadingDots/LoadingDotsView.tsx
|
|
11
|
+
import { cva } from "class-variance-authority";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var colorVariant = cva(`w-[14px] h-[14px] rounded-full`, {
|
|
14
|
+
variants: {
|
|
15
|
+
color: {
|
|
16
|
+
white: "bg-content-inverse",
|
|
17
|
+
primary: "bg-content-link",
|
|
18
|
+
secondary: "bg-content-brand-secondary",
|
|
19
|
+
tertiary: "bg-content-primary",
|
|
20
|
+
danger: "bg-feedback-danger-content",
|
|
21
|
+
warning: "bg-feedback-warning-content",
|
|
22
|
+
success: "bg-feedback-success-content",
|
|
23
|
+
actionPrimary: "bg-action-primary-content",
|
|
24
|
+
actionWarning: "bg-action-warning-content"
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
color: "white"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var LoadingDots = (_a) => {
|
|
32
|
+
var _b = _a, {
|
|
33
|
+
color = "white",
|
|
34
|
+
fullContainer = false,
|
|
35
|
+
announce = true,
|
|
36
|
+
ariaLabel,
|
|
37
|
+
className,
|
|
38
|
+
"aria-label": ariaLabelAttribute
|
|
39
|
+
} = _b, rest = __objRest(_b, [
|
|
40
|
+
"color",
|
|
41
|
+
"fullContainer",
|
|
42
|
+
"announce",
|
|
43
|
+
"ariaLabel",
|
|
44
|
+
"className",
|
|
45
|
+
"aria-label"
|
|
46
|
+
]);
|
|
47
|
+
var _a2;
|
|
48
|
+
const accessibleLabel = (_a2 = ariaLabel != null ? ariaLabel : ariaLabelAttribute) != null ? _a2 : "Carregando";
|
|
49
|
+
return /* @__PURE__ */ jsxs(
|
|
50
|
+
"div",
|
|
51
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
52
|
+
className: `flex items-center justify-center gap-[10px]${fullContainer ? " w-full h-full min-h-[400px]" : ""}${className ? ` ${className}` : ""}`,
|
|
53
|
+
role: announce ? "status" : void 0,
|
|
54
|
+
"aria-live": announce ? "polite" : void 0,
|
|
55
|
+
"aria-atomic": announce || void 0,
|
|
56
|
+
"aria-hidden": !announce || void 0,
|
|
57
|
+
children: [
|
|
58
|
+
announce && /* @__PURE__ */ jsx("span", { className: "sr-only", children: accessibleLabel }),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
"span",
|
|
61
|
+
{
|
|
62
|
+
className: `animate-[1s_pulse_0s_ease-in-out_infinite] ${colorVariant({
|
|
63
|
+
color
|
|
64
|
+
})}`
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"span",
|
|
69
|
+
{
|
|
70
|
+
className: `animate-[1s_pulse_0.3s_ease-in-out_infinite] ${colorVariant(
|
|
71
|
+
{ color }
|
|
72
|
+
)}`
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
"span",
|
|
77
|
+
{
|
|
78
|
+
className: `animate-[1s_pulse_0.6s_ease-in-out_infinite] ${colorVariant(
|
|
79
|
+
{ color }
|
|
80
|
+
)}`
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
var LoadingDotsView_default = LoadingDots;
|
|
88
|
+
|
|
89
|
+
// src/components/button/Button.tsx
|
|
90
|
+
import React from "react";
|
|
91
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
92
|
+
function getTextContent(node) {
|
|
93
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
94
|
+
return String(node);
|
|
95
|
+
}
|
|
96
|
+
if (Array.isArray(node)) {
|
|
97
|
+
return node.map(getTextContent).filter(Boolean).join(" ");
|
|
98
|
+
}
|
|
99
|
+
if (React.isValidElement(node)) {
|
|
100
|
+
return getTextContent(node.props.children);
|
|
101
|
+
}
|
|
102
|
+
return "";
|
|
103
|
+
}
|
|
104
|
+
var VARIANT_STYLES = {
|
|
105
|
+
flat: {
|
|
106
|
+
disabled: `cursor-not-allowed border-disabled bg-surface-disabled text-content-disabled`,
|
|
107
|
+
default: {
|
|
108
|
+
primary: `bg-action-primary text-action-primary-content hover:bg-action-primary-hover active:bg-action-primary-active`,
|
|
109
|
+
secondary: `bg-action-secondary text-action-secondary-content hover:bg-action-secondary-hover active:bg-action-secondary-active`,
|
|
110
|
+
tertiary: `bg-action-tertiary text-action-tertiary-content opacity-100 hover:bg-action-tertiary-hover active:bg-action-tertiary-active`,
|
|
111
|
+
danger: `bg-action-danger text-action-danger-content hover:bg-action-danger-hover active:bg-action-danger-active`,
|
|
112
|
+
warning: `bg-action-warning text-action-warning-content hover:bg-action-warning-hover active:bg-action-warning-active`
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
outline: {
|
|
116
|
+
disabled: `cursor-not-allowed border-disabled bg-surface-disabled text-content-disabled`,
|
|
117
|
+
default: {
|
|
118
|
+
primary: `border-content-link text-content-link hover:border-action-primary-hover hover:text-content-link active:bg-selection-background active:border-action-primary-active active:text-content-on-brand`,
|
|
119
|
+
secondary: `border-content-brand-secondary text-content-brand-secondary hover:border-action-secondary-hover hover:text-content-brand-secondary active:bg-action-secondary active:border-action-secondary-active active:text-action-secondary-content`,
|
|
120
|
+
tertiary: `border-border-strong text-content-primary hover:text-content-secondary active:bg-surface-muted active:text-content-muted`,
|
|
121
|
+
danger: `border-feedback-danger-border text-feedback-danger-content hover:border-action-danger-hover hover:text-feedback-danger-content active:bg-feedback-danger-soft active:border-action-danger-active active:text-feedback-danger-content`,
|
|
122
|
+
warning: `border-feedback-warning-border text-feedback-warning-content hover:text-feedback-warning-content active:bg-feedback-warning-soft active:border-feedback-warning-content active:text-feedback-warning-content`
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
plain: {
|
|
126
|
+
disabled: `cursor-not-allowed border-none text-content-disabled`,
|
|
127
|
+
default: {
|
|
128
|
+
primary: `border-transparent text-content-link hover:bg-action-primary-ghost hover:text-content-link active:border-content-link`,
|
|
129
|
+
secondary: `border-transparent text-content-brand-secondary hover:bg-action-secondary-ghost hover:text-content-brand-secondary active:border-content-brand-secondary`,
|
|
130
|
+
tertiary: `border-transparent text-content-primary hover:bg-surface-muted hover:text-content-muted active:border-border-default`,
|
|
131
|
+
danger: `border-transparent text-feedback-danger-content hover:bg-feedback-danger-soft hover:text-feedback-danger-content active:border-feedback-danger-content`,
|
|
132
|
+
warning: `border-transparent text-feedback-warning-content hover:bg-feedback-warning-soft hover:text-feedback-warning-content active:border-feedback-warning-content`
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
function getVariant(color, variant, disabled) {
|
|
137
|
+
const variantStyles = VARIANT_STYLES[variant === void 0 ? "flat" : variant];
|
|
138
|
+
return disabled ? variantStyles.disabled : variantStyles.default[color === void 0 ? "primary" : color];
|
|
139
|
+
}
|
|
140
|
+
function getSize(size) {
|
|
141
|
+
switch (size) {
|
|
142
|
+
case "small":
|
|
143
|
+
return `h-control-sm`;
|
|
144
|
+
case "medium":
|
|
145
|
+
return `h-control-md`;
|
|
146
|
+
case "large":
|
|
147
|
+
return `h-control-lg`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
var WIDTH_STYLES = {
|
|
151
|
+
auto: "w-auto",
|
|
152
|
+
full: "w-full"
|
|
153
|
+
};
|
|
154
|
+
var Button = (_a) => {
|
|
155
|
+
var _b = _a, {
|
|
156
|
+
variant = "flat",
|
|
157
|
+
children,
|
|
158
|
+
className,
|
|
159
|
+
disabled = false,
|
|
160
|
+
size = "medium",
|
|
161
|
+
width = "auto",
|
|
162
|
+
color = "primary",
|
|
163
|
+
leadIcon: LeadIcon,
|
|
164
|
+
endIcon: EndIcon,
|
|
165
|
+
loading = false,
|
|
166
|
+
loadingLabel
|
|
167
|
+
} = _b, rest = __objRest(_b, [
|
|
168
|
+
"variant",
|
|
169
|
+
"children",
|
|
170
|
+
"className",
|
|
171
|
+
"disabled",
|
|
172
|
+
"size",
|
|
173
|
+
"width",
|
|
174
|
+
"color",
|
|
175
|
+
"leadIcon",
|
|
176
|
+
"endIcon",
|
|
177
|
+
"loading",
|
|
178
|
+
"loadingLabel"
|
|
179
|
+
]);
|
|
180
|
+
var _a2;
|
|
181
|
+
const actionName = (_a2 = rest["aria-label"]) != null ? _a2 : getTextContent(children).replace(/\s+/g, " ").trim();
|
|
182
|
+
const loadingAnnouncement = loadingLabel != null ? loadingLabel : actionName ? `Carregando: ${actionName}` : "Carregando a\xE7\xE3o solicitada";
|
|
183
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
184
|
+
/* @__PURE__ */ jsxs2(
|
|
185
|
+
"button",
|
|
186
|
+
__spreadProps(__spreadValues({
|
|
187
|
+
className: `
|
|
188
|
+
flex items-center justify-center rounded-sm px-xs border-[1px] gap-4xs leading-none
|
|
189
|
+
focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring
|
|
190
|
+
${getVariant(color, variant, disabled)}
|
|
191
|
+
${className}
|
|
192
|
+
${getSize(size)}
|
|
193
|
+
${WIDTH_STYLES[width]}
|
|
194
|
+
`,
|
|
195
|
+
disabled: disabled || loading,
|
|
196
|
+
"aria-busy": loading || void 0
|
|
197
|
+
}, rest), {
|
|
198
|
+
children: [
|
|
199
|
+
LeadIcon && !loading && /* @__PURE__ */ jsx2(LeadIcon, { "aria-hidden": "true", focusable: "false", className: "h-3 w-3" }),
|
|
200
|
+
loading && /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx2(
|
|
201
|
+
LoadingDotsView_default,
|
|
202
|
+
{
|
|
203
|
+
color: variant !== "flat" ? color : color === "primary" ? "actionPrimary" : color === "warning" ? "actionWarning" : "white",
|
|
204
|
+
announce: false
|
|
205
|
+
}
|
|
206
|
+
) }),
|
|
207
|
+
loading && /* @__PURE__ */ jsx2("span", { className: "sr-only", children: actionName || "A\xE7\xE3o" }),
|
|
208
|
+
!loading && children,
|
|
209
|
+
EndIcon && !loading && /* @__PURE__ */ jsx2(EndIcon, { "aria-hidden": "true", focusable: "false", className: "h-3 w-3" })
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsx2(
|
|
214
|
+
"span",
|
|
215
|
+
{
|
|
216
|
+
className: "sr-only",
|
|
217
|
+
role: "status",
|
|
218
|
+
"aria-live": "polite",
|
|
219
|
+
"aria-atomic": "true",
|
|
220
|
+
children: loading ? loadingAnnouncement : ""
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] });
|
|
224
|
+
};
|
|
225
|
+
var Button_default = Button;
|
|
226
|
+
|
|
227
|
+
// src/components/typography/typography.tsx
|
|
228
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
229
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
230
|
+
var textVariants = cva2("font-nunito", {
|
|
231
|
+
variants: {
|
|
232
|
+
variant: {
|
|
233
|
+
primary: "text-content-primary",
|
|
234
|
+
secondary: "text-content-secondary",
|
|
235
|
+
tertiary: "text-content-muted",
|
|
236
|
+
disabled: "text-content-disabled",
|
|
237
|
+
link: "text-content-link"
|
|
238
|
+
},
|
|
239
|
+
size: {
|
|
240
|
+
xs: "text-xs",
|
|
241
|
+
sm: "text-sm",
|
|
242
|
+
md: "text-md",
|
|
243
|
+
lg: "text-lg",
|
|
244
|
+
xl: "text-xl",
|
|
245
|
+
"2xl": "text-2xl",
|
|
246
|
+
title1: "text-titlexl",
|
|
247
|
+
title2: "text-titlelg",
|
|
248
|
+
title3: "text-titlemd"
|
|
249
|
+
},
|
|
250
|
+
weight: {
|
|
251
|
+
thin: "font-thin",
|
|
252
|
+
extralight: "font-extralight",
|
|
253
|
+
light: "font-light",
|
|
254
|
+
normal: "font-normal",
|
|
255
|
+
medium: "font-medium",
|
|
256
|
+
semibold: "font-semibold",
|
|
257
|
+
bold: "font-bold",
|
|
258
|
+
extrabold: "font-extrabold",
|
|
259
|
+
black: "font-black"
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
defaultVariants: {
|
|
263
|
+
variant: "primary",
|
|
264
|
+
size: "md",
|
|
265
|
+
weight: "normal"
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
var semanticRoleDefaults = {
|
|
269
|
+
"page-title": { size: "2xl", weight: "extrabold", variant: "primary" },
|
|
270
|
+
"section-title": { size: "xl", weight: "extrabold", variant: "primary" },
|
|
271
|
+
body: { size: "md", weight: "normal", variant: "primary" },
|
|
272
|
+
label: { size: "md", weight: "normal", variant: "primary" },
|
|
273
|
+
caption: { size: "sm", weight: "normal", variant: "secondary" },
|
|
274
|
+
helper: { size: "sm", weight: "normal", variant: "tertiary" }
|
|
275
|
+
};
|
|
276
|
+
function Typography(_a) {
|
|
277
|
+
var _b = _a, {
|
|
278
|
+
children,
|
|
279
|
+
element = "p",
|
|
280
|
+
semanticRole,
|
|
281
|
+
className,
|
|
282
|
+
variant,
|
|
283
|
+
size,
|
|
284
|
+
weight
|
|
285
|
+
} = _b, rest = __objRest(_b, [
|
|
286
|
+
"children",
|
|
287
|
+
"element",
|
|
288
|
+
"semanticRole",
|
|
289
|
+
"className",
|
|
290
|
+
"variant",
|
|
291
|
+
"size",
|
|
292
|
+
"weight"
|
|
293
|
+
]);
|
|
294
|
+
const Component = element;
|
|
295
|
+
const semanticDefaults = semanticRole ? semanticRoleDefaults[semanticRole] : void 0;
|
|
296
|
+
return /* @__PURE__ */ jsx3(
|
|
297
|
+
Component,
|
|
298
|
+
__spreadProps(__spreadValues({
|
|
299
|
+
className: textVariants({
|
|
300
|
+
variant: variant != null ? variant : semanticDefaults == null ? void 0 : semanticDefaults.variant,
|
|
301
|
+
size: size != null ? size : semanticDefaults == null ? void 0 : semanticDefaults.size,
|
|
302
|
+
weight: weight != null ? weight : semanticDefaults == null ? void 0 : semanticDefaults.weight,
|
|
303
|
+
className
|
|
304
|
+
})
|
|
305
|
+
}, rest), {
|
|
306
|
+
children
|
|
307
|
+
})
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
var typography_default = Typography;
|
|
311
|
+
|
|
312
|
+
// src/components/divider/Divider.tsx
|
|
313
|
+
import classNames from "classnames";
|
|
314
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
315
|
+
var colorClassMap = {
|
|
316
|
+
light: "bg-border-subtle",
|
|
317
|
+
dark: "bg-border-strong",
|
|
318
|
+
black: "bg-content-primary"
|
|
319
|
+
};
|
|
320
|
+
var Divider = (_a) => {
|
|
321
|
+
var _b = _a, {
|
|
322
|
+
width,
|
|
323
|
+
height = "h-[1px]",
|
|
324
|
+
children,
|
|
325
|
+
bgColor = "black"
|
|
326
|
+
} = _b, rest = __objRest(_b, [
|
|
327
|
+
"width",
|
|
328
|
+
"height",
|
|
329
|
+
"children",
|
|
330
|
+
"bgColor"
|
|
331
|
+
]);
|
|
332
|
+
const colorClass = colorClassMap[bgColor];
|
|
333
|
+
const barClass = classNames(children ? "w-1/3" : "w-1/2", height, colorClass);
|
|
334
|
+
return /* @__PURE__ */ jsxs3("div", { className: classNames(width, "flex items-center justify-center"), children: [
|
|
335
|
+
/* @__PURE__ */ jsx4("div", { className: barClass }),
|
|
336
|
+
children && /* @__PURE__ */ jsxs3("div", { className: "px-3", children: [
|
|
337
|
+
children,
|
|
338
|
+
" "
|
|
339
|
+
] }),
|
|
340
|
+
/* @__PURE__ */ jsx4("div", { className: barClass })
|
|
341
|
+
] });
|
|
342
|
+
};
|
|
343
|
+
var Divider_default = Divider;
|
|
344
|
+
|
|
345
|
+
// src/components/surface/Surface.tsx
|
|
346
|
+
import classNames2 from "classnames";
|
|
347
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
348
|
+
var ELEVATION_STYLES = {
|
|
349
|
+
none: "shadow-none",
|
|
350
|
+
sm: "shadow-sm",
|
|
351
|
+
md: "shadow-md"
|
|
352
|
+
};
|
|
353
|
+
var PADDING_STYLES = {
|
|
354
|
+
none: "p-0",
|
|
355
|
+
compact: "p-2",
|
|
356
|
+
default: "p-3 desktop:p-5"
|
|
357
|
+
};
|
|
358
|
+
var RADIUS_STYLES = {
|
|
359
|
+
none: "rounded-none",
|
|
360
|
+
sm: "rounded-sm",
|
|
361
|
+
md: "rounded-md"
|
|
362
|
+
};
|
|
363
|
+
var TONE_STYLES = {
|
|
364
|
+
card: "bg-surface-card",
|
|
365
|
+
subtle: "bg-surface-subtle",
|
|
366
|
+
muted: "bg-surface-muted",
|
|
367
|
+
disabled: "bg-surface-disabled",
|
|
368
|
+
info: "bg-feedback-info-soft text-feedback-info-content",
|
|
369
|
+
success: "bg-feedback-success-soft text-feedback-success-content",
|
|
370
|
+
warning: "bg-feedback-warning-soft text-feedback-warning-content",
|
|
371
|
+
danger: "bg-feedback-danger-soft text-feedback-danger-content",
|
|
372
|
+
transparent: "bg-transparent"
|
|
373
|
+
};
|
|
374
|
+
function Surface(_a) {
|
|
375
|
+
var _b = _a, {
|
|
376
|
+
children,
|
|
377
|
+
className,
|
|
378
|
+
elevation = "sm",
|
|
379
|
+
padding = "default",
|
|
380
|
+
radius = "md",
|
|
381
|
+
tone = "card"
|
|
382
|
+
} = _b, rest = __objRest(_b, [
|
|
383
|
+
"children",
|
|
384
|
+
"className",
|
|
385
|
+
"elevation",
|
|
386
|
+
"padding",
|
|
387
|
+
"radius",
|
|
388
|
+
"tone"
|
|
389
|
+
]);
|
|
390
|
+
return /* @__PURE__ */ jsx5(
|
|
391
|
+
"div",
|
|
392
|
+
__spreadProps(__spreadValues({
|
|
393
|
+
className: classNames2(
|
|
394
|
+
"w-full",
|
|
395
|
+
ELEVATION_STYLES[elevation],
|
|
396
|
+
PADDING_STYLES[padding],
|
|
397
|
+
RADIUS_STYLES[radius],
|
|
398
|
+
TONE_STYLES[tone],
|
|
399
|
+
className
|
|
400
|
+
)
|
|
401
|
+
}, rest), {
|
|
402
|
+
children
|
|
403
|
+
})
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// src/components/modalCard/ModalCardView.tsx
|
|
408
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
409
|
+
function ModalCardView(props) {
|
|
410
|
+
const _a = props, { children, className } = _a, rest = __objRest(_a, ["children", "className"]);
|
|
411
|
+
return /* @__PURE__ */ jsx6(
|
|
412
|
+
Surface,
|
|
413
|
+
__spreadProps(__spreadValues({
|
|
414
|
+
className: `gap-2 ${className != null ? className : ""}`
|
|
415
|
+
}, rest), {
|
|
416
|
+
children
|
|
417
|
+
})
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
var ModalCardView_default = ModalCardView;
|
|
421
|
+
|
|
422
|
+
// src/components/notice/NoticeView.tsx
|
|
423
|
+
import classNames3 from "classnames";
|
|
424
|
+
import { MdClose, MdHelpOutline } from "react-icons/md";
|
|
425
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
426
|
+
var boxClassMap = {
|
|
427
|
+
info: "bg-feedback-info-soft",
|
|
428
|
+
primary: "border border-selection-border bg-selection-background",
|
|
429
|
+
secondary: "bg-action-secondary",
|
|
430
|
+
tertiary: "bg-action-tertiary",
|
|
431
|
+
gray: "bg-surface-muted",
|
|
432
|
+
success: "bg-feedback-success-soft",
|
|
433
|
+
warning: "bg-feedback-warning-soft",
|
|
434
|
+
danger: "bg-feedback-danger-soft"
|
|
435
|
+
};
|
|
436
|
+
var colorTextClassMap = {
|
|
437
|
+
info: "text-feedback-info-content",
|
|
438
|
+
primary: "text-selection-content",
|
|
439
|
+
secondary: "text-action-secondary-content",
|
|
440
|
+
tertiary: "text-action-tertiary-content",
|
|
441
|
+
gray: "text-content-link",
|
|
442
|
+
success: "text-feedback-success-content",
|
|
443
|
+
warning: "text-feedback-warning-content",
|
|
444
|
+
danger: "text-feedback-danger-content"
|
|
445
|
+
};
|
|
446
|
+
var defaultTextClassMap = {
|
|
447
|
+
info: "text-content-primary",
|
|
448
|
+
primary: "text-selection-content",
|
|
449
|
+
secondary: "text-action-secondary-content",
|
|
450
|
+
tertiary: "text-action-tertiary-content",
|
|
451
|
+
gray: "text-content-primary",
|
|
452
|
+
success: "text-content-primary",
|
|
453
|
+
warning: "text-content-primary",
|
|
454
|
+
danger: "text-content-primary"
|
|
455
|
+
};
|
|
456
|
+
var NoticeView = (_a) => {
|
|
457
|
+
var _b = _a, {
|
|
458
|
+
rounded = false,
|
|
459
|
+
type = "info",
|
|
460
|
+
children,
|
|
461
|
+
className,
|
|
462
|
+
onDismiss,
|
|
463
|
+
onTriggerHelp,
|
|
464
|
+
icon: Icon,
|
|
465
|
+
textColor = "default"
|
|
466
|
+
} = _b, rest = __objRest(_b, [
|
|
467
|
+
"rounded",
|
|
468
|
+
"type",
|
|
469
|
+
"children",
|
|
470
|
+
"className",
|
|
471
|
+
"onDismiss",
|
|
472
|
+
"onTriggerHelp",
|
|
473
|
+
"icon",
|
|
474
|
+
"textColor"
|
|
475
|
+
]);
|
|
476
|
+
const classes = classNames3(boxClassMap[type], {
|
|
477
|
+
"rounded-md": rounded
|
|
478
|
+
});
|
|
479
|
+
return /* @__PURE__ */ jsx7("div", __spreadProps(__spreadValues({ className: classes }, rest), { children: /* @__PURE__ */ jsxs4("div", { className: `flex p-3 gap-3 ${className}`, children: [
|
|
480
|
+
Icon && /* @__PURE__ */ jsx7("div", { className: "flex gap-2", children: /* @__PURE__ */ jsx7(
|
|
481
|
+
Icon,
|
|
482
|
+
{
|
|
483
|
+
"aria-hidden": "true",
|
|
484
|
+
focusable: "false",
|
|
485
|
+
className: `h-5 w-5 ${colorTextClassMap[type]}`
|
|
486
|
+
}
|
|
487
|
+
) }),
|
|
488
|
+
/* @__PURE__ */ jsx7(
|
|
489
|
+
"div",
|
|
490
|
+
{
|
|
491
|
+
className: textColor === "color" ? colorTextClassMap[type] : defaultTextClassMap[type],
|
|
492
|
+
children
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2 ml-auto", children: [
|
|
496
|
+
onTriggerHelp && /* @__PURE__ */ jsx7(
|
|
497
|
+
"button",
|
|
498
|
+
{
|
|
499
|
+
type: "button",
|
|
500
|
+
"aria-label": "Obter ajuda sobre este aviso",
|
|
501
|
+
className: `inline-flex h-6 w-6 items-center justify-center rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current ${colorTextClassMap[type]}`,
|
|
502
|
+
onClick: onTriggerHelp,
|
|
503
|
+
children: /* @__PURE__ */ jsx7(
|
|
504
|
+
MdHelpOutline,
|
|
505
|
+
{
|
|
506
|
+
"aria-hidden": "true",
|
|
507
|
+
focusable: "false",
|
|
508
|
+
className: "h-5 w-5"
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
}
|
|
512
|
+
),
|
|
513
|
+
onDismiss && /* @__PURE__ */ jsx7(
|
|
514
|
+
"button",
|
|
515
|
+
{
|
|
516
|
+
type: "button",
|
|
517
|
+
"aria-label": "Fechar aviso",
|
|
518
|
+
className: `inline-flex h-6 w-6 items-center justify-center rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current ${colorTextClassMap[type]}`,
|
|
519
|
+
onClick: onDismiss,
|
|
520
|
+
children: /* @__PURE__ */ jsx7(
|
|
521
|
+
MdClose,
|
|
522
|
+
{
|
|
523
|
+
"aria-hidden": "true",
|
|
524
|
+
focusable: "false",
|
|
525
|
+
className: "h-5 w-5"
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
] })
|
|
531
|
+
] }) }));
|
|
532
|
+
};
|
|
533
|
+
var NoticeView_default = NoticeView;
|
|
534
|
+
|
|
535
|
+
// src/components/pageState/PageState.tsx
|
|
536
|
+
import classNames4 from "classnames";
|
|
537
|
+
import { useEffect, useId, useRef } from "react";
|
|
538
|
+
import {
|
|
539
|
+
MdErrorOutline,
|
|
540
|
+
MdInfoOutline,
|
|
541
|
+
MdRefresh,
|
|
542
|
+
MdSearchOff
|
|
543
|
+
} from "react-icons/md";
|
|
544
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
545
|
+
var icons = {
|
|
546
|
+
error: MdErrorOutline,
|
|
547
|
+
empty: MdSearchOff,
|
|
548
|
+
unavailable: MdInfoOutline,
|
|
549
|
+
"not-found": MdSearchOff
|
|
550
|
+
};
|
|
551
|
+
function PageState({
|
|
552
|
+
variant,
|
|
553
|
+
title,
|
|
554
|
+
description,
|
|
555
|
+
illustration,
|
|
556
|
+
actions,
|
|
557
|
+
onRetry,
|
|
558
|
+
retryLabel = "Tentar novamente",
|
|
559
|
+
compact = false,
|
|
560
|
+
focusOnMount = false,
|
|
561
|
+
headingLevel = 1,
|
|
562
|
+
className,
|
|
563
|
+
titleClassName,
|
|
564
|
+
children
|
|
565
|
+
}) {
|
|
566
|
+
const titleId = useId();
|
|
567
|
+
const stateRef = useRef(null);
|
|
568
|
+
const Icon = icons[variant];
|
|
569
|
+
const TitleTag = headingLevel === 2 ? "h2" : "h1";
|
|
570
|
+
useEffect(() => {
|
|
571
|
+
var _a;
|
|
572
|
+
if (focusOnMount) {
|
|
573
|
+
(_a = stateRef.current) == null ? void 0 : _a.focus();
|
|
574
|
+
}
|
|
575
|
+
}, [focusOnMount]);
|
|
576
|
+
return /* @__PURE__ */ jsxs5(
|
|
577
|
+
"section",
|
|
578
|
+
{
|
|
579
|
+
ref: stateRef,
|
|
580
|
+
role: variant === "error" ? "alert" : "status",
|
|
581
|
+
"aria-labelledby": titleId,
|
|
582
|
+
tabIndex: focusOnMount ? -1 : void 0,
|
|
583
|
+
className: classNames4(
|
|
584
|
+
"grid w-full items-center gap-6 rounded-md bg-surface-card",
|
|
585
|
+
compact ? "min-h-40 p-4" : "p-4 mobile:p-6 tablet:p-10 desktop:grid-cols-[minmax(0,1fr)_minmax(240px,420px)]",
|
|
586
|
+
className
|
|
587
|
+
),
|
|
588
|
+
children: [
|
|
589
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0 space-y-5", children: [
|
|
590
|
+
/* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
591
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2", children: [
|
|
592
|
+
!illustration && /* @__PURE__ */ jsx8(
|
|
593
|
+
Icon,
|
|
594
|
+
{
|
|
595
|
+
"aria-hidden": "true",
|
|
596
|
+
className: "mt-0.5 h-5 w-5 shrink-0 text-content-link"
|
|
597
|
+
}
|
|
598
|
+
),
|
|
599
|
+
/* @__PURE__ */ jsx8(
|
|
600
|
+
TitleTag,
|
|
601
|
+
{
|
|
602
|
+
id: titleId,
|
|
603
|
+
className: classNames4(
|
|
604
|
+
"font-extrabold text-content-primary",
|
|
605
|
+
compact ? "text-lg" : "text-xl tablet:text-2xl",
|
|
606
|
+
titleClassName
|
|
607
|
+
),
|
|
608
|
+
children: title
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] }),
|
|
612
|
+
description && /* @__PURE__ */ jsx8("div", { className: "text-md text-content-primary", children: description })
|
|
613
|
+
] }),
|
|
614
|
+
children,
|
|
615
|
+
(onRetry || actions) && /* @__PURE__ */ jsxs5("div", { className: "flex w-full flex-col gap-2 mobile:flex-row mobile:flex-wrap", children: [
|
|
616
|
+
onRetry && /* @__PURE__ */ jsx8(
|
|
617
|
+
Button_default,
|
|
618
|
+
{
|
|
619
|
+
type: "button",
|
|
620
|
+
variant: "outline",
|
|
621
|
+
leadIcon: MdRefresh,
|
|
622
|
+
onClick: onRetry,
|
|
623
|
+
className: "w-full mobile:w-auto",
|
|
624
|
+
children: retryLabel
|
|
625
|
+
}
|
|
626
|
+
),
|
|
627
|
+
actions
|
|
628
|
+
] })
|
|
629
|
+
] }),
|
|
630
|
+
illustration && /* @__PURE__ */ jsx8(
|
|
631
|
+
"div",
|
|
632
|
+
{
|
|
633
|
+
"aria-hidden": "true",
|
|
634
|
+
className: "flex min-w-0 justify-center desktop:justify-end",
|
|
635
|
+
children: illustration
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// src/components/avatar/Avatar.tsx
|
|
644
|
+
import classNames5 from "classnames";
|
|
645
|
+
|
|
646
|
+
// src/components/avatar/AvatarIcon.tsx
|
|
647
|
+
import { MdOutlinePersonOutline } from "react-icons/md";
|
|
648
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
649
|
+
var AvatarIcon = () => {
|
|
650
|
+
return /* @__PURE__ */ jsx9(MdOutlinePersonOutline, { className: "absolute w-1/2 h-1/2" });
|
|
651
|
+
};
|
|
652
|
+
var AvatarIcon_default = AvatarIcon;
|
|
653
|
+
|
|
654
|
+
// src/components/avatar/AvatarImage.tsx
|
|
655
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
656
|
+
var AvatarImage = ({ src, altDescription }) => {
|
|
657
|
+
return /* @__PURE__ */ jsx10(
|
|
658
|
+
"img",
|
|
659
|
+
{
|
|
660
|
+
src,
|
|
661
|
+
alt: altDescription,
|
|
662
|
+
className: "rounded-full object-cover"
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
};
|
|
666
|
+
var AvatarImage_default = AvatarImage;
|
|
667
|
+
|
|
668
|
+
// src/components/avatar/Avatar.tsx
|
|
669
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
670
|
+
var avatarSizeMap = {
|
|
671
|
+
xs: "w-5 h-5 text-2xs",
|
|
672
|
+
sm: "w-6 h-6 text-sm",
|
|
673
|
+
md: "w-8 h-8 text-xl",
|
|
674
|
+
lg: "w-9 h-9 text-2xl"
|
|
675
|
+
};
|
|
676
|
+
function Inicials(name) {
|
|
677
|
+
const nome = name;
|
|
678
|
+
if (!!nome) {
|
|
679
|
+
const array = nome.split(" ");
|
|
680
|
+
const primeiraLetra = nome.charAt(0);
|
|
681
|
+
const posicaoUltimoEspaco = nome.lastIndexOf(" ");
|
|
682
|
+
const primeiraLetraUltimoNome = nome.substring(
|
|
683
|
+
posicaoUltimoEspaco + 1,
|
|
684
|
+
posicaoUltimoEspaco + 2
|
|
685
|
+
);
|
|
686
|
+
if (array.length > 1) {
|
|
687
|
+
return `${(primeiraLetra + primeiraLetraUltimoNome).toUpperCase()}`;
|
|
688
|
+
} else {
|
|
689
|
+
return `${primeiraLetra.toUpperCase()}`;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
var Avatar = (_a) => {
|
|
694
|
+
var _b = _a, {
|
|
695
|
+
name = "",
|
|
696
|
+
size = "xs",
|
|
697
|
+
className,
|
|
698
|
+
image,
|
|
699
|
+
description = ""
|
|
700
|
+
} = _b, rest = __objRest(_b, [
|
|
701
|
+
"name",
|
|
702
|
+
"size",
|
|
703
|
+
"className",
|
|
704
|
+
"image",
|
|
705
|
+
"description"
|
|
706
|
+
]);
|
|
707
|
+
const avatarSizeClass = avatarSizeMap[size];
|
|
708
|
+
const avatarComponent = image ? /* @__PURE__ */ jsx11(AvatarImage_default, { src: image, altDescription: description }) : !!name ? /* @__PURE__ */ jsx11(
|
|
709
|
+
"span",
|
|
710
|
+
{
|
|
711
|
+
className: classNames5(
|
|
712
|
+
`flex items-center justify-center`,
|
|
713
|
+
avatarSizeClass
|
|
714
|
+
),
|
|
715
|
+
children: Inicials(name)
|
|
716
|
+
}
|
|
717
|
+
) : /* @__PURE__ */ jsx11(AvatarIcon_default, {});
|
|
718
|
+
return /* @__PURE__ */ jsx11(
|
|
719
|
+
"div",
|
|
720
|
+
__spreadProps(__spreadValues({
|
|
721
|
+
className: classNames5(
|
|
722
|
+
`relative rounded-full bg-surface-muted flex items-center justify-center text-content-muted`,
|
|
723
|
+
avatarSizeClass,
|
|
724
|
+
className
|
|
725
|
+
)
|
|
726
|
+
}, rest), {
|
|
727
|
+
children: avatarComponent
|
|
728
|
+
})
|
|
729
|
+
);
|
|
730
|
+
};
|
|
731
|
+
var Avatar_default = Avatar;
|
|
732
|
+
|
|
733
|
+
// src/types/themed-image.ts
|
|
734
|
+
function normalizeThemedImageSource(source) {
|
|
735
|
+
if (typeof source === "string") {
|
|
736
|
+
return { light: source, dark: void 0 };
|
|
737
|
+
}
|
|
738
|
+
return source;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// src/components/themed-image/ThemedImage.tsx
|
|
742
|
+
import classNames6 from "classnames";
|
|
743
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
744
|
+
var DEFAULT_LOGOS_BASE_PATH = "/logos";
|
|
745
|
+
function resolvePath(source, basePath = DEFAULT_LOGOS_BASE_PATH) {
|
|
746
|
+
if (!basePath || source.startsWith("/") || source.includes(":")) {
|
|
747
|
+
return source;
|
|
748
|
+
}
|
|
749
|
+
return `${basePath.replace(/\/?$/, "/")}${source.replace(/^\/+/, "")}`;
|
|
750
|
+
}
|
|
751
|
+
function isSvgSource(source) {
|
|
752
|
+
return source.split(/[?#]/, 1)[0].toLowerCase().endsWith(".svg");
|
|
753
|
+
}
|
|
754
|
+
function ThemedImage(_a) {
|
|
755
|
+
var _b = _a, {
|
|
756
|
+
source,
|
|
757
|
+
basePath,
|
|
758
|
+
svgClassName,
|
|
759
|
+
className,
|
|
760
|
+
alt
|
|
761
|
+
} = _b, props = __objRest(_b, [
|
|
762
|
+
"source",
|
|
763
|
+
"basePath",
|
|
764
|
+
"svgClassName",
|
|
765
|
+
"className",
|
|
766
|
+
"alt"
|
|
767
|
+
]);
|
|
768
|
+
const sources = normalizeThemedImageSource(source);
|
|
769
|
+
const lightSource = resolvePath(sources.light, basePath);
|
|
770
|
+
const darkSource = sources.dark ? resolvePath(sources.dark, basePath) : void 0;
|
|
771
|
+
return /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
772
|
+
/* @__PURE__ */ jsx12(
|
|
773
|
+
"img",
|
|
774
|
+
__spreadProps(__spreadValues({}, props), {
|
|
775
|
+
src: lightSource,
|
|
776
|
+
alt,
|
|
777
|
+
"data-color-scheme-logo": "light",
|
|
778
|
+
className: classNames6(
|
|
779
|
+
className,
|
|
780
|
+
isSvgSource(lightSource) && svgClassName,
|
|
781
|
+
"themed-image-light",
|
|
782
|
+
{
|
|
783
|
+
"themed-image-has-dark": Boolean(darkSource)
|
|
784
|
+
}
|
|
785
|
+
)
|
|
786
|
+
})
|
|
787
|
+
),
|
|
788
|
+
darkSource && /* @__PURE__ */ jsx12(
|
|
789
|
+
"img",
|
|
790
|
+
__spreadProps(__spreadValues({}, props), {
|
|
791
|
+
src: darkSource,
|
|
792
|
+
alt,
|
|
793
|
+
"data-color-scheme-logo": "dark",
|
|
794
|
+
className: classNames6(
|
|
795
|
+
className,
|
|
796
|
+
isSvgSource(darkSource) && svgClassName,
|
|
797
|
+
"themed-image-dark"
|
|
798
|
+
)
|
|
799
|
+
})
|
|
800
|
+
)
|
|
801
|
+
] });
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// src/components/icon-provider/PortalIconProvider.tsx
|
|
805
|
+
import { IconContext } from "react-icons";
|
|
806
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
807
|
+
var PORTAL_ICON_CONTEXT = {
|
|
808
|
+
className: "shrink-0"
|
|
809
|
+
};
|
|
810
|
+
function IconProvider({ children }) {
|
|
811
|
+
return /* @__PURE__ */ jsx13(IconContext.Provider, { value: PORTAL_ICON_CONTEXT, children });
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/components/circularLoading/CircularLoading.tsx
|
|
815
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
816
|
+
var colorMap = {
|
|
817
|
+
white: "rgb(var(--white))",
|
|
818
|
+
primary: "rgb(var(--loading-circular-indicator))",
|
|
819
|
+
secondary: "rgb(var(--secondary-1))",
|
|
820
|
+
tertiary: "rgb(var(--tertiary-1))",
|
|
821
|
+
danger: "rgb(var(--feedback-danger-strong))",
|
|
822
|
+
warning: "rgb(var(--feedback-warning-strong))",
|
|
823
|
+
success: "rgb(var(--feedback-success-strong))"
|
|
824
|
+
};
|
|
825
|
+
function CircularLoading(_a) {
|
|
826
|
+
var _b = _a, {
|
|
827
|
+
size = 48,
|
|
828
|
+
thickness = 6,
|
|
829
|
+
trackColor = "rgb(var(--loading-circular-track))",
|
|
830
|
+
indicatorColor,
|
|
831
|
+
withTrack = true,
|
|
832
|
+
color = "primary",
|
|
833
|
+
message,
|
|
834
|
+
className,
|
|
835
|
+
ariaLabel = "Carregando"
|
|
836
|
+
} = _b, rest = __objRest(_b, [
|
|
837
|
+
"size",
|
|
838
|
+
"thickness",
|
|
839
|
+
"trackColor",
|
|
840
|
+
"indicatorColor",
|
|
841
|
+
"withTrack",
|
|
842
|
+
"color",
|
|
843
|
+
"message",
|
|
844
|
+
"className",
|
|
845
|
+
"ariaLabel"
|
|
846
|
+
]);
|
|
847
|
+
const breakpoint = useBreakpoint();
|
|
848
|
+
const finalSize = breakpoint === "mobile" ? Math.min(size, 100) : size;
|
|
849
|
+
const finalThickness = breakpoint === "mobile" ? Math.min(thickness, 16) : thickness;
|
|
850
|
+
const radius = (finalSize - finalThickness) / 2;
|
|
851
|
+
const circumference = 2 * Math.PI * radius;
|
|
852
|
+
const center = finalSize / 2;
|
|
853
|
+
const finalIndicatorColor = indicatorColor != null ? indicatorColor : colorMap[color];
|
|
854
|
+
return /* @__PURE__ */ jsxs7(
|
|
855
|
+
"div",
|
|
856
|
+
__spreadProps(__spreadValues({
|
|
857
|
+
role: "status",
|
|
858
|
+
"aria-label": ariaLabel,
|
|
859
|
+
className: `inline-flex flex-col items-center justify-center gap-4 leading-none ${className != null ? className : ""}`.trim()
|
|
860
|
+
}, rest), {
|
|
861
|
+
children: [
|
|
862
|
+
/* @__PURE__ */ jsxs7(
|
|
863
|
+
"svg",
|
|
864
|
+
{
|
|
865
|
+
className: "shrink-0",
|
|
866
|
+
width: finalSize,
|
|
867
|
+
height: finalSize,
|
|
868
|
+
viewBox: `0 0 ${finalSize} ${finalSize}`,
|
|
869
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
870
|
+
"aria-hidden": "true",
|
|
871
|
+
children: [
|
|
872
|
+
withTrack && /* @__PURE__ */ jsx14(
|
|
873
|
+
"circle",
|
|
874
|
+
{
|
|
875
|
+
className: "circular-loading-track",
|
|
876
|
+
cx: finalSize / 2,
|
|
877
|
+
cy: finalSize / 2,
|
|
878
|
+
r: radius,
|
|
879
|
+
stroke: trackColor,
|
|
880
|
+
strokeWidth: finalThickness,
|
|
881
|
+
fill: "none"
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
/* @__PURE__ */ jsx14(
|
|
885
|
+
"circle",
|
|
886
|
+
{
|
|
887
|
+
className: "circular-loading-indicator",
|
|
888
|
+
cx: finalSize / 2,
|
|
889
|
+
cy: finalSize / 2,
|
|
890
|
+
r: radius,
|
|
891
|
+
stroke: finalIndicatorColor,
|
|
892
|
+
strokeWidth: finalThickness,
|
|
893
|
+
strokeLinecap: "round",
|
|
894
|
+
fill: "none",
|
|
895
|
+
strokeDasharray: circumference,
|
|
896
|
+
strokeDashoffset: circumference * 0.75,
|
|
897
|
+
children: /* @__PURE__ */ jsx14(
|
|
898
|
+
"animateTransform",
|
|
899
|
+
{
|
|
900
|
+
attributeName: "transform",
|
|
901
|
+
type: "rotate",
|
|
902
|
+
from: `0 ${center} ${center}`,
|
|
903
|
+
to: `360 ${center} ${center}`,
|
|
904
|
+
dur: "1.4s",
|
|
905
|
+
repeatCount: "indefinite"
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
]
|
|
911
|
+
}
|
|
912
|
+
),
|
|
913
|
+
message && /* @__PURE__ */ jsx14("p", { className: "text-center text-sm font-medium text-content-secondary", children: message })
|
|
914
|
+
]
|
|
915
|
+
})
|
|
916
|
+
);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// src/components/text-group/TextGroup.tsx
|
|
920
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
921
|
+
function TextGroup(_a) {
|
|
922
|
+
var _b = _a, {
|
|
923
|
+
title,
|
|
924
|
+
text = "-",
|
|
925
|
+
className
|
|
926
|
+
} = _b, rest = __objRest(_b, [
|
|
927
|
+
"title",
|
|
928
|
+
"text",
|
|
929
|
+
"className"
|
|
930
|
+
]);
|
|
931
|
+
return /* @__PURE__ */ jsxs8("div", __spreadProps(__spreadValues({ className }, rest), { children: [
|
|
932
|
+
/* @__PURE__ */ jsx15(typography_default, { size: "sm", className: "text-content-primary", children: title }),
|
|
933
|
+
/* @__PURE__ */ jsx15(typography_default, { size: "md", className: "break-words font-semibold text-content-primary", children: text || "-" })
|
|
934
|
+
] }));
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// src/components/pagination/PaginationView.tsx
|
|
938
|
+
import { MdChevronLeft, MdChevronRight } from "react-icons/md";
|
|
939
|
+
import cs2 from "classnames";
|
|
940
|
+
|
|
941
|
+
// src/components/pagination/components/PageButtons.tsx
|
|
942
|
+
import cs from "classnames";
|
|
943
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
944
|
+
function PageButtons(props) {
|
|
945
|
+
const { currentPage, totalResults, perPage, onClick } = props;
|
|
946
|
+
const pages = totalResults > 10 ? Math.ceil(totalResults / perPage) : 1;
|
|
947
|
+
let pagesAfter = pages - currentPage > 2 ? 2 : pages - currentPage;
|
|
948
|
+
let pagesBefore = currentPage > 2 ? 2 : currentPage === 2 ? 1 : 0;
|
|
949
|
+
let buttonsBefore = [];
|
|
950
|
+
let buttonsAfter = [];
|
|
951
|
+
for (let i = 1; i <= pagesBefore; i++) {
|
|
952
|
+
const page = currentPage - i;
|
|
953
|
+
buttonsBefore = [
|
|
954
|
+
/* @__PURE__ */ jsx16(
|
|
955
|
+
"button",
|
|
956
|
+
{
|
|
957
|
+
type: "button",
|
|
958
|
+
"aria-label": `P\xE1gina ${page}`,
|
|
959
|
+
className: cs(
|
|
960
|
+
"flex h-7 w-8 items-center justify-center rounded border border-border-default",
|
|
961
|
+
"cursor-pointer bg-surface-card text-sm text-content-primary hover:bg-surface-muted",
|
|
962
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
|
|
963
|
+
),
|
|
964
|
+
onClick: () => onClick(page),
|
|
965
|
+
children: page
|
|
966
|
+
},
|
|
967
|
+
`page-${page}`
|
|
968
|
+
),
|
|
969
|
+
...buttonsBefore
|
|
970
|
+
];
|
|
971
|
+
}
|
|
972
|
+
for (let i = 1; i <= pagesAfter; i++) {
|
|
973
|
+
const page = currentPage + i;
|
|
974
|
+
buttonsAfter.push(
|
|
975
|
+
/* @__PURE__ */ jsx16(
|
|
976
|
+
"button",
|
|
977
|
+
{
|
|
978
|
+
type: "button",
|
|
979
|
+
"aria-label": `P\xE1gina ${page}`,
|
|
980
|
+
className: cs(
|
|
981
|
+
"flex h-7 w-8 items-center justify-center rounded border border-border-default",
|
|
982
|
+
"cursor-pointer bg-surface-card text-sm text-content-primary hover:bg-surface-muted",
|
|
983
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
|
|
984
|
+
),
|
|
985
|
+
onClick: () => onClick(page),
|
|
986
|
+
children: page
|
|
987
|
+
},
|
|
988
|
+
`page-${page}`
|
|
989
|
+
)
|
|
990
|
+
);
|
|
991
|
+
}
|
|
992
|
+
return [
|
|
993
|
+
...buttonsBefore,
|
|
994
|
+
/* @__PURE__ */ jsx16(
|
|
995
|
+
"button",
|
|
996
|
+
{
|
|
997
|
+
type: "button",
|
|
998
|
+
"aria-label": `P\xE1gina ${currentPage}, atual`,
|
|
999
|
+
"aria-current": "page",
|
|
1000
|
+
disabled: true,
|
|
1001
|
+
className: cs(
|
|
1002
|
+
"flex h-7 w-8 items-center justify-center rounded border border-selection-border",
|
|
1003
|
+
"cursor-default bg-selection-background text-sm text-selection-content"
|
|
1004
|
+
),
|
|
1005
|
+
children: currentPage
|
|
1006
|
+
},
|
|
1007
|
+
`page-${currentPage}`
|
|
1008
|
+
),
|
|
1009
|
+
...buttonsAfter
|
|
1010
|
+
];
|
|
1011
|
+
}
|
|
1012
|
+
var PageButtons_default = PageButtons;
|
|
1013
|
+
|
|
1014
|
+
// src/components/pagination/PaginationView.tsx
|
|
1015
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1016
|
+
function PaginationView(props) {
|
|
1017
|
+
const { currentPage, totalResults, perPage, onClick } = props;
|
|
1018
|
+
return /* @__PURE__ */ jsxs9(
|
|
1019
|
+
"nav",
|
|
1020
|
+
{
|
|
1021
|
+
"aria-label": "Pagina\xE7\xE3o",
|
|
1022
|
+
className: "flex flex-wrap justify-between mt-auto mb-5",
|
|
1023
|
+
children: [
|
|
1024
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-sm text-content-primary", children: [
|
|
1025
|
+
"Visualizando de ",
|
|
1026
|
+
currentPage * perPage - (perPage - 1),
|
|
1027
|
+
" ",
|
|
1028
|
+
"at\xE9 ",
|
|
1029
|
+
totalResults > currentPage * perPage ? currentPage * perPage : totalResults,
|
|
1030
|
+
" ",
|
|
1031
|
+
"de ",
|
|
1032
|
+
totalResults,
|
|
1033
|
+
" resultados"
|
|
1034
|
+
] }),
|
|
1035
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-stretch gap-1.5", children: [
|
|
1036
|
+
currentPage > 1 && /* @__PURE__ */ jsxs9(
|
|
1037
|
+
"button",
|
|
1038
|
+
{
|
|
1039
|
+
type: "button",
|
|
1040
|
+
className: cs2(
|
|
1041
|
+
"h-7 w-24 rounded-sm border border-border-default",
|
|
1042
|
+
"flex items-center justify-center gap-1 text-content-primary text-sm",
|
|
1043
|
+
"cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
|
|
1044
|
+
),
|
|
1045
|
+
onClick: () => onClick(currentPage - 1),
|
|
1046
|
+
children: [
|
|
1047
|
+
/* @__PURE__ */ jsx17(MdChevronLeft, { size: 10, "aria-hidden": "true", focusable: "false" }),
|
|
1048
|
+
"Anterior"
|
|
1049
|
+
]
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ jsx17(
|
|
1053
|
+
PageButtons_default,
|
|
1054
|
+
{
|
|
1055
|
+
currentPage,
|
|
1056
|
+
totalResults,
|
|
1057
|
+
perPage,
|
|
1058
|
+
onClick
|
|
1059
|
+
}
|
|
1060
|
+
),
|
|
1061
|
+
currentPage < Math.ceil(totalResults / 10) && /* @__PURE__ */ jsxs9(
|
|
1062
|
+
"button",
|
|
1063
|
+
{
|
|
1064
|
+
type: "button",
|
|
1065
|
+
className: cs2(
|
|
1066
|
+
"h-7 w-24 rounded-sm border border-border-default",
|
|
1067
|
+
"flex items-center justify-center gap-1 text-content-primary text-sm",
|
|
1068
|
+
"cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring"
|
|
1069
|
+
),
|
|
1070
|
+
onClick: () => onClick(currentPage + 1),
|
|
1071
|
+
children: [
|
|
1072
|
+
"Pr\xF3xima",
|
|
1073
|
+
/* @__PURE__ */ jsx17(MdChevronRight, { size: 10, "aria-hidden": "true", focusable: "false" })
|
|
1074
|
+
]
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] })
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
var PaginationView_default = PaginationView;
|
|
1083
|
+
|
|
1084
|
+
// src/components/checkbox/checkbox.tsx
|
|
1085
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1086
|
+
function Checkbox(_a) {
|
|
1087
|
+
var _b = _a, {
|
|
1088
|
+
options,
|
|
1089
|
+
value,
|
|
1090
|
+
onChange,
|
|
1091
|
+
layout = "row"
|
|
1092
|
+
} = _b, props = __objRest(_b, [
|
|
1093
|
+
"options",
|
|
1094
|
+
"value",
|
|
1095
|
+
"onChange",
|
|
1096
|
+
"layout"
|
|
1097
|
+
]);
|
|
1098
|
+
let containerClass = "";
|
|
1099
|
+
if (layout === "col") {
|
|
1100
|
+
containerClass = "flex flex-col gap-y-3 mt-3";
|
|
1101
|
+
} else if (layout === "grid-2") {
|
|
1102
|
+
containerClass = "grid grid-cols-2 gap-y-2 mt-3";
|
|
1103
|
+
} else {
|
|
1104
|
+
containerClass = "flex flex-row mt-3";
|
|
1105
|
+
}
|
|
1106
|
+
return /* @__PURE__ */ jsx18("div", { className: containerClass, children: options.map((option) => /* @__PURE__ */ jsxs10(
|
|
1107
|
+
"label",
|
|
1108
|
+
{
|
|
1109
|
+
className: "mr-6 flex min-h-7 cursor-pointer items-center gap-2",
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ jsx18(
|
|
1112
|
+
"input",
|
|
1113
|
+
__spreadValues({
|
|
1114
|
+
type: "checkbox",
|
|
1115
|
+
className: "checkbox-control",
|
|
1116
|
+
value: option.value,
|
|
1117
|
+
checked: value === option.value,
|
|
1118
|
+
onChange
|
|
1119
|
+
}, props)
|
|
1120
|
+
),
|
|
1121
|
+
/* @__PURE__ */ jsx18("span", { className: "text-content-secondary", children: option.label })
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
option.value
|
|
1125
|
+
)) });
|
|
1126
|
+
}
|
|
1127
|
+
var CheckBox = Checkbox;
|
|
1128
|
+
|
|
1129
|
+
// src/components/slider/Slider.tsx
|
|
1130
|
+
import {
|
|
1131
|
+
useCallback,
|
|
1132
|
+
useEffect as useEffect2,
|
|
1133
|
+
useMemo,
|
|
1134
|
+
useRef as useRef2,
|
|
1135
|
+
useState
|
|
1136
|
+
} from "react";
|
|
1137
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1138
|
+
var Slider = ({
|
|
1139
|
+
min,
|
|
1140
|
+
max,
|
|
1141
|
+
step,
|
|
1142
|
+
initialValue = min,
|
|
1143
|
+
value,
|
|
1144
|
+
onChange,
|
|
1145
|
+
onDragOver,
|
|
1146
|
+
disabled = false,
|
|
1147
|
+
marks,
|
|
1148
|
+
ariaLabel,
|
|
1149
|
+
getAriaValueText
|
|
1150
|
+
}) => {
|
|
1151
|
+
const [internalValue, setInternalValue] = useState(initialValue);
|
|
1152
|
+
const sliderRef = useRef2(null);
|
|
1153
|
+
const thumbRef = useRef2(null);
|
|
1154
|
+
const tooltipRef = useRef2(null);
|
|
1155
|
+
const progressRef = useRef2(null);
|
|
1156
|
+
const tickRefs = useRef2([]);
|
|
1157
|
+
const markRefs = useRef2([]);
|
|
1158
|
+
const isDraggingRef = useRef2(false);
|
|
1159
|
+
const [tooltipOffset, setTooltipOffset] = useState(0);
|
|
1160
|
+
const currentValue = value !== void 0 ? value : internalValue;
|
|
1161
|
+
useEffect2(() => {
|
|
1162
|
+
if (value === void 0) {
|
|
1163
|
+
setInternalValue(initialValue);
|
|
1164
|
+
}
|
|
1165
|
+
}, [initialValue, value]);
|
|
1166
|
+
const roundToStep = (val) => {
|
|
1167
|
+
const precision = Math.max(0, Math.ceil(-Math.log10(step)));
|
|
1168
|
+
return parseFloat((Math.round(val / step) * step).toFixed(precision));
|
|
1169
|
+
};
|
|
1170
|
+
const updateValueFromPosition = (clientX) => {
|
|
1171
|
+
if (!sliderRef.current) return void 0;
|
|
1172
|
+
const sliderRect = sliderRef.current.getBoundingClientRect();
|
|
1173
|
+
const newLeft = Math.min(
|
|
1174
|
+
Math.max(clientX - sliderRect.left, 0),
|
|
1175
|
+
sliderRect.width
|
|
1176
|
+
);
|
|
1177
|
+
const rawValue = min + (max - min) * newLeft / sliderRect.width;
|
|
1178
|
+
return roundToStep(rawValue);
|
|
1179
|
+
};
|
|
1180
|
+
const handleMouseMove = (event) => {
|
|
1181
|
+
if (disabled || !isDraggingRef.current) return;
|
|
1182
|
+
const roundedValue = updateValueFromPosition(event.clientX);
|
|
1183
|
+
if (roundedValue === void 0) return;
|
|
1184
|
+
if (value === void 0) setInternalValue(roundedValue);
|
|
1185
|
+
if (onChange) onChange(roundedValue);
|
|
1186
|
+
};
|
|
1187
|
+
const handleMouseUp = (event) => {
|
|
1188
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
1189
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
1190
|
+
if (isDraggingRef.current) {
|
|
1191
|
+
const finalValue = updateValueFromPosition(event.clientX);
|
|
1192
|
+
if (finalValue !== void 0) {
|
|
1193
|
+
if (value === void 0) setInternalValue(finalValue);
|
|
1194
|
+
if (onChange) onChange(finalValue);
|
|
1195
|
+
if (onDragOver) onDragOver(finalValue);
|
|
1196
|
+
} else {
|
|
1197
|
+
if (onDragOver) onDragOver(currentValue);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
isDraggingRef.current = false;
|
|
1201
|
+
};
|
|
1202
|
+
const handleMouseDown = (event) => {
|
|
1203
|
+
if (disabled || !sliderRef.current) return;
|
|
1204
|
+
isDraggingRef.current = true;
|
|
1205
|
+
const roundedValue = updateValueFromPosition(event.clientX);
|
|
1206
|
+
if (roundedValue !== void 0) {
|
|
1207
|
+
if (value === void 0) setInternalValue(roundedValue);
|
|
1208
|
+
if (onChange) onChange(roundedValue);
|
|
1209
|
+
}
|
|
1210
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
1211
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
1212
|
+
};
|
|
1213
|
+
const handleTouchMove = (event) => {
|
|
1214
|
+
if (disabled || !isDraggingRef.current) return;
|
|
1215
|
+
const touch = event.touches[0];
|
|
1216
|
+
const roundedValue = updateValueFromPosition(touch.clientX);
|
|
1217
|
+
if (roundedValue === void 0) return;
|
|
1218
|
+
if (value === void 0) setInternalValue(roundedValue);
|
|
1219
|
+
if (onChange) onChange(roundedValue);
|
|
1220
|
+
};
|
|
1221
|
+
const handleTouchEnd = (event) => {
|
|
1222
|
+
document.removeEventListener("touchmove", handleTouchMove);
|
|
1223
|
+
document.removeEventListener("touchend", handleTouchEnd);
|
|
1224
|
+
if (isDraggingRef.current) {
|
|
1225
|
+
const touch = event.changedTouches[0];
|
|
1226
|
+
const finalValue = updateValueFromPosition(touch.clientX);
|
|
1227
|
+
if (finalValue !== void 0) {
|
|
1228
|
+
if (value === void 0) setInternalValue(finalValue);
|
|
1229
|
+
if (onChange) onChange(finalValue);
|
|
1230
|
+
if (onDragOver) onDragOver(finalValue);
|
|
1231
|
+
} else {
|
|
1232
|
+
if (onDragOver) onDragOver(currentValue);
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
isDraggingRef.current = false;
|
|
1236
|
+
};
|
|
1237
|
+
const handleTouchStart = (event) => {
|
|
1238
|
+
if (disabled || !sliderRef.current) return;
|
|
1239
|
+
isDraggingRef.current = true;
|
|
1240
|
+
const touch = event.touches[0];
|
|
1241
|
+
const roundedValue = updateValueFromPosition(touch.clientX);
|
|
1242
|
+
if (roundedValue !== void 0) {
|
|
1243
|
+
if (value === void 0) setInternalValue(roundedValue);
|
|
1244
|
+
if (onChange) onChange(roundedValue);
|
|
1245
|
+
}
|
|
1246
|
+
document.addEventListener("touchmove", handleTouchMove);
|
|
1247
|
+
document.addEventListener("touchend", handleTouchEnd);
|
|
1248
|
+
};
|
|
1249
|
+
const updateThumbPosition = useCallback(() => {
|
|
1250
|
+
var _a, _b;
|
|
1251
|
+
if (thumbRef.current && sliderRef.current && progressRef.current) {
|
|
1252
|
+
const sliderRect = sliderRef.current.getBoundingClientRect();
|
|
1253
|
+
if (max <= min || sliderRect.width <= 0) {
|
|
1254
|
+
thumbRef.current.style.left = "0px";
|
|
1255
|
+
progressRef.current.style.width = "0px";
|
|
1256
|
+
setTooltipOffset(0);
|
|
1257
|
+
return;
|
|
1258
|
+
}
|
|
1259
|
+
const clampedValue = Math.max(min, Math.min(max, currentValue));
|
|
1260
|
+
const left = (clampedValue - min) / (max - min) * sliderRect.width;
|
|
1261
|
+
const tooltipWidth = (_b = (_a = tooltipRef.current) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 48;
|
|
1262
|
+
const tooltipHalfWidth = tooltipWidth / 2;
|
|
1263
|
+
const thumbHalfWidth = thumbRef.current.getBoundingClientRect().width / 2;
|
|
1264
|
+
const clampedTooltipCenter = Math.min(
|
|
1265
|
+
Math.max(left, tooltipHalfWidth - thumbHalfWidth),
|
|
1266
|
+
sliderRect.width - (tooltipHalfWidth - thumbHalfWidth)
|
|
1267
|
+
);
|
|
1268
|
+
thumbRef.current.style.left = `${left}px`;
|
|
1269
|
+
progressRef.current.style.width = `${left}px`;
|
|
1270
|
+
setTooltipOffset(clampedTooltipCenter - left);
|
|
1271
|
+
}
|
|
1272
|
+
}, [currentValue, max, min]);
|
|
1273
|
+
useEffect2(() => {
|
|
1274
|
+
updateThumbPosition();
|
|
1275
|
+
if (typeof ResizeObserver === "undefined") {
|
|
1276
|
+
window.addEventListener("resize", updateThumbPosition);
|
|
1277
|
+
return () => window.removeEventListener("resize", updateThumbPosition);
|
|
1278
|
+
}
|
|
1279
|
+
const resizeObserver = new ResizeObserver(updateThumbPosition);
|
|
1280
|
+
if (sliderRef.current) resizeObserver.observe(sliderRef.current);
|
|
1281
|
+
return () => resizeObserver.disconnect();
|
|
1282
|
+
}, [currentValue, max, min, updateThumbPosition]);
|
|
1283
|
+
const effectiveMarks = useMemo(
|
|
1284
|
+
() => marks && marks.length > 0 ? marks : [min, max],
|
|
1285
|
+
[marks, max, min]
|
|
1286
|
+
);
|
|
1287
|
+
const ticks = useMemo(() => {
|
|
1288
|
+
if (max <= min || step <= 0) return [min];
|
|
1289
|
+
const maxTicks = 50;
|
|
1290
|
+
const interval = (max - min) / Math.min(maxTicks, (max - min) / step);
|
|
1291
|
+
const calculatedTicks = [];
|
|
1292
|
+
for (let tick = min; tick <= max; tick += interval) {
|
|
1293
|
+
calculatedTicks.push(tick);
|
|
1294
|
+
}
|
|
1295
|
+
return calculatedTicks;
|
|
1296
|
+
}, [max, min, step]);
|
|
1297
|
+
useEffect2(() => {
|
|
1298
|
+
ticks.forEach((tick, idx) => {
|
|
1299
|
+
const element = tickRefs.current[idx];
|
|
1300
|
+
if (!element) return;
|
|
1301
|
+
const percent = (tick - min) / (max - min) * 100;
|
|
1302
|
+
const isMain = effectiveMarks.includes(Math.round(tick * 100) / 100);
|
|
1303
|
+
element.style.left = `${percent}%`;
|
|
1304
|
+
element.style.height = `${isMain ? 10 : 6}px`;
|
|
1305
|
+
});
|
|
1306
|
+
effectiveMarks.forEach((mark, idx) => {
|
|
1307
|
+
const element = markRefs.current[idx];
|
|
1308
|
+
if (!element) return;
|
|
1309
|
+
const percent = (mark - min) / (max - min) * 100;
|
|
1310
|
+
element.style.left = `${percent}%`;
|
|
1311
|
+
});
|
|
1312
|
+
}, [effectiveMarks, max, min, ticks]);
|
|
1313
|
+
return /* @__PURE__ */ jsxs11("div", { className: "block relative w-full h-12", children: [
|
|
1314
|
+
/* @__PURE__ */ jsxs11(
|
|
1315
|
+
"div",
|
|
1316
|
+
{
|
|
1317
|
+
className: `relative w-full ${disabled ? "cursor-not-allowed" : "cursor-pointer"} mt-10`,
|
|
1318
|
+
ref: sliderRef,
|
|
1319
|
+
onMouseDown: handleMouseDown,
|
|
1320
|
+
onTouchStart: handleTouchStart,
|
|
1321
|
+
tabIndex: disabled ? -1 : 0,
|
|
1322
|
+
onKeyDown: (event) => {
|
|
1323
|
+
if (disabled) return;
|
|
1324
|
+
const setValue = (val) => {
|
|
1325
|
+
const clamped = Math.max(min, Math.min(max, roundToStep(val)));
|
|
1326
|
+
if (value === void 0) setInternalValue(clamped);
|
|
1327
|
+
if (onChange) onChange(clamped);
|
|
1328
|
+
if (onDragOver) onDragOver(clamped);
|
|
1329
|
+
};
|
|
1330
|
+
switch (event.key) {
|
|
1331
|
+
case "ArrowLeft":
|
|
1332
|
+
case "ArrowDown":
|
|
1333
|
+
setValue(currentValue - step);
|
|
1334
|
+
event.preventDefault();
|
|
1335
|
+
break;
|
|
1336
|
+
case "ArrowRight":
|
|
1337
|
+
case "ArrowUp":
|
|
1338
|
+
setValue(currentValue + step);
|
|
1339
|
+
event.preventDefault();
|
|
1340
|
+
break;
|
|
1341
|
+
case "Home":
|
|
1342
|
+
setValue(min);
|
|
1343
|
+
event.preventDefault();
|
|
1344
|
+
break;
|
|
1345
|
+
case "End":
|
|
1346
|
+
setValue(max);
|
|
1347
|
+
event.preventDefault();
|
|
1348
|
+
break;
|
|
1349
|
+
default:
|
|
1350
|
+
break;
|
|
1351
|
+
}
|
|
1352
|
+
},
|
|
1353
|
+
role: "slider",
|
|
1354
|
+
"aria-valuemin": min,
|
|
1355
|
+
"aria-valuemax": max,
|
|
1356
|
+
"aria-valuenow": currentValue,
|
|
1357
|
+
"aria-valuetext": getAriaValueText(currentValue),
|
|
1358
|
+
"aria-label": ariaLabel,
|
|
1359
|
+
"aria-disabled": disabled,
|
|
1360
|
+
children: [
|
|
1361
|
+
/* @__PURE__ */ jsx19("div", { className: "absolute left-0 top-1/2 h-[4px] w-full -translate-y-1/2 transform rounded bg-border-default" }),
|
|
1362
|
+
/* @__PURE__ */ jsx19(
|
|
1363
|
+
"div",
|
|
1364
|
+
{
|
|
1365
|
+
className: `absolute top-1/2 left-0 h-[4px] rounded ${disabled ? "bg-surface-disabled" : "bg-action-primary"} transform -translate-y-1/2`,
|
|
1366
|
+
ref: progressRef
|
|
1367
|
+
}
|
|
1368
|
+
),
|
|
1369
|
+
/* @__PURE__ */ jsx19(
|
|
1370
|
+
"div",
|
|
1371
|
+
{
|
|
1372
|
+
className: "absolute top-1/2 w-4 h-4 bg-surface-card border border-border-default rounded-full transform -translate-x-1/2 -translate-y-1/2 select-none",
|
|
1373
|
+
ref: thumbRef,
|
|
1374
|
+
children: !disabled && /* @__PURE__ */ jsx19(
|
|
1375
|
+
"div",
|
|
1376
|
+
{
|
|
1377
|
+
ref: tooltipRef,
|
|
1378
|
+
className: "absolute left-1/2 bottom-full transform -translate-x-1/2 mb-1 font-semibold rounded px-1 py-[2px] text-center text-content-inverse bg-surface-tooltip text-sm ",
|
|
1379
|
+
style: { marginLeft: `${tooltipOffset}px` },
|
|
1380
|
+
children: currentValue
|
|
1381
|
+
}
|
|
1382
|
+
)
|
|
1383
|
+
}
|
|
1384
|
+
)
|
|
1385
|
+
]
|
|
1386
|
+
}
|
|
1387
|
+
),
|
|
1388
|
+
ticks.map((tick, idx) => {
|
|
1389
|
+
return /* @__PURE__ */ jsx19(
|
|
1390
|
+
"div",
|
|
1391
|
+
{
|
|
1392
|
+
ref: (element) => {
|
|
1393
|
+
tickRefs.current[idx] = element;
|
|
1394
|
+
},
|
|
1395
|
+
className: "absolute top-2 w-px -translate-x-1/2 bg-border-strong"
|
|
1396
|
+
},
|
|
1397
|
+
idx
|
|
1398
|
+
);
|
|
1399
|
+
}),
|
|
1400
|
+
effectiveMarks.map((mark, idx) => {
|
|
1401
|
+
return /* @__PURE__ */ jsx19(
|
|
1402
|
+
"span",
|
|
1403
|
+
{
|
|
1404
|
+
ref: (element) => {
|
|
1405
|
+
markRefs.current[idx] = element;
|
|
1406
|
+
},
|
|
1407
|
+
className: "absolute top-5 -translate-x-1/2 text-xs text-content-primary",
|
|
1408
|
+
children: mark
|
|
1409
|
+
},
|
|
1410
|
+
idx
|
|
1411
|
+
);
|
|
1412
|
+
})
|
|
1413
|
+
] });
|
|
1414
|
+
};
|
|
1415
|
+
var Slider_default = Slider;
|
|
1416
|
+
|
|
1417
|
+
// src/components/inputSlider/InputSliderView.tsx
|
|
1418
|
+
import { useCallback as useCallback2, useState as useState2, useEffect as useEffect3 } from "react";
|
|
1419
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1420
|
+
var InputSlider = (_a) => {
|
|
1421
|
+
var _b = _a, {
|
|
1422
|
+
name,
|
|
1423
|
+
start,
|
|
1424
|
+
step = 1,
|
|
1425
|
+
end,
|
|
1426
|
+
functionChange,
|
|
1427
|
+
initialValue,
|
|
1428
|
+
prefix,
|
|
1429
|
+
sufix,
|
|
1430
|
+
marks,
|
|
1431
|
+
valueLabelDisplay = "auto",
|
|
1432
|
+
showLabel = false,
|
|
1433
|
+
disabled = false,
|
|
1434
|
+
inputDisabled = false,
|
|
1435
|
+
valueFormmated,
|
|
1436
|
+
showInput = false,
|
|
1437
|
+
ariaLabel
|
|
1438
|
+
} = _b, rest = __objRest(_b, [
|
|
1439
|
+
"name",
|
|
1440
|
+
"start",
|
|
1441
|
+
"step",
|
|
1442
|
+
"end",
|
|
1443
|
+
"functionChange",
|
|
1444
|
+
"initialValue",
|
|
1445
|
+
"prefix",
|
|
1446
|
+
"sufix",
|
|
1447
|
+
"marks",
|
|
1448
|
+
"valueLabelDisplay",
|
|
1449
|
+
"showLabel",
|
|
1450
|
+
"disabled",
|
|
1451
|
+
"inputDisabled",
|
|
1452
|
+
"valueFormmated",
|
|
1453
|
+
"showInput",
|
|
1454
|
+
"ariaLabel"
|
|
1455
|
+
]);
|
|
1456
|
+
const [value, setValue] = useState2(initialValue);
|
|
1457
|
+
const controlLabel = ariaLabel || name;
|
|
1458
|
+
const valueInputId = `${name}-value`;
|
|
1459
|
+
const handleSliderChange = useCallback2(
|
|
1460
|
+
(newValue) => {
|
|
1461
|
+
const parsedValue = Number(newValue);
|
|
1462
|
+
setValue(parsedValue);
|
|
1463
|
+
},
|
|
1464
|
+
[functionChange]
|
|
1465
|
+
);
|
|
1466
|
+
const handleInputChange = useCallback2(
|
|
1467
|
+
(event) => {
|
|
1468
|
+
if (event.target.value === "") {
|
|
1469
|
+
setValue(start);
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
const nextValue = Number(event.target.value);
|
|
1473
|
+
if (Number.isFinite(nextValue)) setValue(nextValue);
|
|
1474
|
+
},
|
|
1475
|
+
[start]
|
|
1476
|
+
);
|
|
1477
|
+
const handleBlur = useCallback2(() => {
|
|
1478
|
+
if (value < start) {
|
|
1479
|
+
setValue(start);
|
|
1480
|
+
} else if (value > end) {
|
|
1481
|
+
setValue(end);
|
|
1482
|
+
}
|
|
1483
|
+
}, [end, start, value]);
|
|
1484
|
+
useEffect3(() => {
|
|
1485
|
+
functionChange(value);
|
|
1486
|
+
}, [functionChange, value]);
|
|
1487
|
+
return /* @__PURE__ */ jsxs12("div", { className: "w-full flex flex-row gap-2", children: [
|
|
1488
|
+
/* @__PURE__ */ jsx20(
|
|
1489
|
+
"input",
|
|
1490
|
+
{
|
|
1491
|
+
className: "w-full range pr-6 accent-primary-1",
|
|
1492
|
+
type: "range",
|
|
1493
|
+
name,
|
|
1494
|
+
id: name,
|
|
1495
|
+
min: start,
|
|
1496
|
+
max: end,
|
|
1497
|
+
step: step != null ? step : 1,
|
|
1498
|
+
disabled,
|
|
1499
|
+
value,
|
|
1500
|
+
"aria-label": controlLabel,
|
|
1501
|
+
onChange: (e) => handleSliderChange(e.target.value)
|
|
1502
|
+
}
|
|
1503
|
+
),
|
|
1504
|
+
showInput && /* @__PURE__ */ jsx20(
|
|
1505
|
+
"input",
|
|
1506
|
+
{
|
|
1507
|
+
id: valueInputId,
|
|
1508
|
+
className: "min-w-0",
|
|
1509
|
+
value: inputDisabled ? "-" : value,
|
|
1510
|
+
onChange: handleInputChange,
|
|
1511
|
+
onBlur: handleBlur,
|
|
1512
|
+
type: "number",
|
|
1513
|
+
step: step != null ? step : 1,
|
|
1514
|
+
min: start,
|
|
1515
|
+
max: end,
|
|
1516
|
+
"aria-label": `${controlLabel} valor`,
|
|
1517
|
+
disabled: disabled || inputDisabled
|
|
1518
|
+
}
|
|
1519
|
+
)
|
|
1520
|
+
] });
|
|
1521
|
+
};
|
|
1522
|
+
var InputSliderView_default = InputSlider;
|
|
1523
|
+
|
|
1524
|
+
// src/components/form-layout/FormActions.tsx
|
|
1525
|
+
import classNames7 from "classnames";
|
|
1526
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1527
|
+
var ALIGN_STYLES = {
|
|
1528
|
+
start: "tablet:justify-start",
|
|
1529
|
+
center: "tablet:justify-center",
|
|
1530
|
+
end: "tablet:justify-end",
|
|
1531
|
+
between: "tablet:justify-between"
|
|
1532
|
+
};
|
|
1533
|
+
function FormActions(_a) {
|
|
1534
|
+
var _b = _a, {
|
|
1535
|
+
align = "end",
|
|
1536
|
+
fullWidthOnMobile = true,
|
|
1537
|
+
className
|
|
1538
|
+
} = _b, rest = __objRest(_b, [
|
|
1539
|
+
"align",
|
|
1540
|
+
"fullWidthOnMobile",
|
|
1541
|
+
"className"
|
|
1542
|
+
]);
|
|
1543
|
+
return /* @__PURE__ */ jsx21(
|
|
1544
|
+
"div",
|
|
1545
|
+
__spreadValues({
|
|
1546
|
+
className: classNames7(
|
|
1547
|
+
"flex w-full flex-col gap-3 tablet:flex-row tablet:items-end",
|
|
1548
|
+
ALIGN_STYLES[align],
|
|
1549
|
+
fullWidthOnMobile && "[&>*]:w-full tablet:[&>*]:w-auto",
|
|
1550
|
+
className
|
|
1551
|
+
)
|
|
1552
|
+
}, rest)
|
|
1553
|
+
);
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// src/components/form-layout/FormGrid.tsx
|
|
1557
|
+
import classNames8 from "classnames";
|
|
1558
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1559
|
+
var COLUMN_STYLES = {
|
|
1560
|
+
1: "grid-cols-1",
|
|
1561
|
+
2: "grid-cols-1 tablet:grid-cols-2",
|
|
1562
|
+
3: "grid-cols-1 tablet:grid-cols-3",
|
|
1563
|
+
4: "grid-cols-1 tablet:grid-cols-4",
|
|
1564
|
+
5: "grid-cols-1 tablet:grid-cols-5",
|
|
1565
|
+
6: "grid-cols-1 tablet:grid-cols-6",
|
|
1566
|
+
7: "grid-cols-1 tablet:grid-cols-7",
|
|
1567
|
+
8: "grid-cols-1 tablet:grid-cols-8",
|
|
1568
|
+
10: "grid-cols-1 tablet:grid-cols-10",
|
|
1569
|
+
12: "grid-cols-1 tablet:grid-cols-12"
|
|
1570
|
+
};
|
|
1571
|
+
function FormGrid(_a) {
|
|
1572
|
+
var _b = _a, { columns = 2, className } = _b, rest = __objRest(_b, ["columns", "className"]);
|
|
1573
|
+
return /* @__PURE__ */ jsx22(
|
|
1574
|
+
"div",
|
|
1575
|
+
__spreadValues({
|
|
1576
|
+
className: classNames8(
|
|
1577
|
+
"field-alignment-grid grid w-full gap-x-4 gap-y-5",
|
|
1578
|
+
COLUMN_STYLES[columns],
|
|
1579
|
+
className
|
|
1580
|
+
)
|
|
1581
|
+
}, rest)
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
// src/components/page-heading/PageHeading.tsx
|
|
1586
|
+
import classNames9 from "classnames";
|
|
1587
|
+
import { MdArrowBack } from "react-icons/md";
|
|
1588
|
+
import { Fragment as Fragment3, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1589
|
+
function BackContent({ label }) {
|
|
1590
|
+
return /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
1591
|
+
/* @__PURE__ */ jsx23(MdArrowBack, { "aria-hidden": "true", className: "h-5 w-5 shrink-0" }),
|
|
1592
|
+
/* @__PURE__ */ jsx23("span", { children: label })
|
|
1593
|
+
] });
|
|
1594
|
+
}
|
|
1595
|
+
function PageHeading({
|
|
1596
|
+
title,
|
|
1597
|
+
subtitle,
|
|
1598
|
+
back,
|
|
1599
|
+
actions,
|
|
1600
|
+
className,
|
|
1601
|
+
contentClassName,
|
|
1602
|
+
spacing = "default"
|
|
1603
|
+
}) {
|
|
1604
|
+
const backClassName = "mb-2 inline-flex w-fit items-center gap-1 text-sm font-semibold text-content-link hover:underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring";
|
|
1605
|
+
return /* @__PURE__ */ jsxs13(
|
|
1606
|
+
"header",
|
|
1607
|
+
{
|
|
1608
|
+
className: classNames9(
|
|
1609
|
+
"flex flex-col gap-3 tablet:flex-row tablet:items-start tablet:justify-between",
|
|
1610
|
+
{ "mb-sm": spacing === "default" },
|
|
1611
|
+
className
|
|
1612
|
+
),
|
|
1613
|
+
children: [
|
|
1614
|
+
/* @__PURE__ */ jsxs13("div", { className: classNames9("min-w-0", contentClassName), children: [
|
|
1615
|
+
(back == null ? void 0 : back.href) ? /* @__PURE__ */ jsx23("a", { className: backClassName, href: back.href, children: /* @__PURE__ */ jsx23(BackContent, { label: back.label }) }) : back ? /* @__PURE__ */ jsx23(
|
|
1616
|
+
"button",
|
|
1617
|
+
{
|
|
1618
|
+
type: "button",
|
|
1619
|
+
className: backClassName,
|
|
1620
|
+
onClick: back.onClick,
|
|
1621
|
+
children: /* @__PURE__ */ jsx23(BackContent, { label: back.label })
|
|
1622
|
+
}
|
|
1623
|
+
) : null,
|
|
1624
|
+
/* @__PURE__ */ jsx23(typography_default, { element: "h1", semanticRole: "page-title", children: title }),
|
|
1625
|
+
subtitle !== void 0 && subtitle !== null && /* @__PURE__ */ jsx23(
|
|
1626
|
+
typography_default,
|
|
1627
|
+
{
|
|
1628
|
+
element: "p",
|
|
1629
|
+
semanticRole: "section-title",
|
|
1630
|
+
className: "mt-2 font-normal",
|
|
1631
|
+
children: subtitle
|
|
1632
|
+
}
|
|
1633
|
+
)
|
|
1634
|
+
] }),
|
|
1635
|
+
actions && /* @__PURE__ */ jsx23("div", { className: "flex w-full flex-wrap items-center gap-2 tablet:w-auto tablet:justify-end", children: actions })
|
|
1636
|
+
]
|
|
1637
|
+
}
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// src/components/page-tabs/PageTabsHeader.tsx
|
|
1642
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1643
|
+
function PageTabsHeader({
|
|
1644
|
+
title,
|
|
1645
|
+
tabs,
|
|
1646
|
+
activeTab,
|
|
1647
|
+
onTabChange,
|
|
1648
|
+
className = "",
|
|
1649
|
+
size = "default"
|
|
1650
|
+
}) {
|
|
1651
|
+
return /* @__PURE__ */ jsxs14(
|
|
1652
|
+
"div",
|
|
1653
|
+
{
|
|
1654
|
+
className: `flex flex-col gap-4 tablet:flex-row tablet:items-end tablet:justify-between ${className}`,
|
|
1655
|
+
children: [
|
|
1656
|
+
/* @__PURE__ */ jsx24(PageHeading, { title, spacing: "none" }),
|
|
1657
|
+
tabs.length > 1 && /* @__PURE__ */ jsx24(
|
|
1658
|
+
"nav",
|
|
1659
|
+
{
|
|
1660
|
+
"aria-label": title,
|
|
1661
|
+
className: "flex w-full max-w-full flex-row flex-nowrap items-end gap-3 overflow-x-auto tablet:w-fit tablet:justify-end tablet:overflow-visible",
|
|
1662
|
+
children: /* @__PURE__ */ jsx24("div", { role: "tablist", className: "flex flex-nowrap items-end gap-3", children: tabs.map((tab) => {
|
|
1663
|
+
const Icon = tab.icon;
|
|
1664
|
+
const isActive = activeTab === tab.id;
|
|
1665
|
+
return /* @__PURE__ */ jsxs14(
|
|
1666
|
+
"button",
|
|
1667
|
+
{
|
|
1668
|
+
type: "button",
|
|
1669
|
+
role: "tab",
|
|
1670
|
+
"aria-selected": isActive,
|
|
1671
|
+
"aria-current": isActive ? "page" : void 0,
|
|
1672
|
+
disabled: tab.disabled,
|
|
1673
|
+
onClick: () => onTabChange(tab.id),
|
|
1674
|
+
className: `inline-flex items-center gap-1 whitespace-nowrap border-b-[3px] transition-colors duration-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-1 disabled:cursor-not-allowed disabled:opacity-50 tablet:px-1 ${size === "small" ? "px-0.5 py-0 text-sm" : "p-0.5 text-base"} ${isActive ? "border-primary-1 font-semibold text-primary-1" : "border-transparent text-content-secondary hover:text-content-muted"}`,
|
|
1675
|
+
children: [
|
|
1676
|
+
Icon && /* @__PURE__ */ jsx24(Icon, { "aria-hidden": "true", className: "h-4 w-4 shrink-0" }),
|
|
1677
|
+
/* @__PURE__ */ jsx24("span", { children: tab.label }),
|
|
1678
|
+
tab.notification !== void 0 && tab.notification !== null && /* @__PURE__ */ jsx24("span", { className: "inline-flex min-h-4 min-w-4 items-center justify-center rounded-full bg-feedback-danger-strong px-1 text-2xs font-bold text-feedback-danger-on-strong", children: tab.notification })
|
|
1679
|
+
]
|
|
1680
|
+
},
|
|
1681
|
+
tab.id
|
|
1682
|
+
);
|
|
1683
|
+
}) })
|
|
1684
|
+
}
|
|
1685
|
+
)
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// src/components/info-grid/InfoGrid.tsx
|
|
1692
|
+
import classNames10 from "classnames";
|
|
1693
|
+
|
|
1694
|
+
// src/utils/optional-value.ts
|
|
1695
|
+
var hasOptionalValue = (value) => {
|
|
1696
|
+
if (value === null || value === void 0) return false;
|
|
1697
|
+
if (typeof value !== "string") return true;
|
|
1698
|
+
const normalized = value.trim().toUpperCase();
|
|
1699
|
+
return normalized !== "" && normalized !== "N/A";
|
|
1700
|
+
};
|
|
1701
|
+
function resolveOptionalValue(value, options = {}) {
|
|
1702
|
+
var _a;
|
|
1703
|
+
if (hasOptionalValue(value)) return value;
|
|
1704
|
+
if (options.policy === "hide") return null;
|
|
1705
|
+
return (_a = options.placeholder) != null ? _a : "-";
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
// src/components/info-grid/InfoGrid.tsx
|
|
1709
|
+
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1710
|
+
var COLUMN_STYLES2 = {
|
|
1711
|
+
1: "grid-cols-1",
|
|
1712
|
+
2: "grid-cols-1 mobile:grid-cols-2",
|
|
1713
|
+
3: "grid-cols-1 mobile:grid-cols-2 tablet:grid-cols-3",
|
|
1714
|
+
4: "grid-cols-1 mobile:grid-cols-2 desktop:grid-cols-4",
|
|
1715
|
+
6: "grid-cols-1 mobile:grid-cols-2 tablet:grid-cols-3 desktop:grid-cols-6"
|
|
1716
|
+
};
|
|
1717
|
+
function InfoGrid(_a) {
|
|
1718
|
+
var _b = _a, { columns = 3, className } = _b, rest = __objRest(_b, ["columns", "className"]);
|
|
1719
|
+
return /* @__PURE__ */ jsx25(
|
|
1720
|
+
"dl",
|
|
1721
|
+
__spreadValues({
|
|
1722
|
+
className: classNames10(
|
|
1723
|
+
"grid gap-x-8 gap-y-5",
|
|
1724
|
+
COLUMN_STYLES2[columns],
|
|
1725
|
+
className
|
|
1726
|
+
)
|
|
1727
|
+
}, rest)
|
|
1728
|
+
);
|
|
1729
|
+
}
|
|
1730
|
+
function InfoItem(_a) {
|
|
1731
|
+
var _b = _a, {
|
|
1732
|
+
label,
|
|
1733
|
+
value,
|
|
1734
|
+
optional = "placeholder",
|
|
1735
|
+
placeholder = "-",
|
|
1736
|
+
numeric = false,
|
|
1737
|
+
variant = "default",
|
|
1738
|
+
className,
|
|
1739
|
+
valueClassName,
|
|
1740
|
+
children
|
|
1741
|
+
} = _b, rest = __objRest(_b, [
|
|
1742
|
+
"label",
|
|
1743
|
+
"value",
|
|
1744
|
+
"optional",
|
|
1745
|
+
"placeholder",
|
|
1746
|
+
"numeric",
|
|
1747
|
+
"variant",
|
|
1748
|
+
"className",
|
|
1749
|
+
"valueClassName",
|
|
1750
|
+
"children"
|
|
1751
|
+
]);
|
|
1752
|
+
const resolved = resolveOptionalValue(value, { policy: optional, placeholder });
|
|
1753
|
+
if (resolved === null) return null;
|
|
1754
|
+
return /* @__PURE__ */ jsxs15("div", __spreadProps(__spreadValues({ className: classNames10("min-w-0", className) }, rest), { children: [
|
|
1755
|
+
/* @__PURE__ */ jsx25("dt", { className: "break-words text-sm text-content-secondary", children: label }),
|
|
1756
|
+
/* @__PURE__ */ jsx25(
|
|
1757
|
+
"dd",
|
|
1758
|
+
{
|
|
1759
|
+
className: classNames10(
|
|
1760
|
+
"mt-1 break-words",
|
|
1761
|
+
variant === "metric" ? "text-md font-bold" : "text-md font-semibold",
|
|
1762
|
+
numeric && "tabular-nums",
|
|
1763
|
+
valueClassName
|
|
1764
|
+
),
|
|
1765
|
+
children: children != null ? children : resolved
|
|
1766
|
+
}
|
|
1767
|
+
)
|
|
1768
|
+
] }));
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
// src/components/filter-bar/FilterBar.tsx
|
|
1772
|
+
import classNames11 from "classnames";
|
|
1773
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1774
|
+
function FilterBar(_a) {
|
|
1775
|
+
var _b = _a, {
|
|
1776
|
+
filters,
|
|
1777
|
+
actions,
|
|
1778
|
+
columns = 3,
|
|
1779
|
+
className,
|
|
1780
|
+
actionClassName
|
|
1781
|
+
} = _b, rest = __objRest(_b, [
|
|
1782
|
+
"filters",
|
|
1783
|
+
"actions",
|
|
1784
|
+
"columns",
|
|
1785
|
+
"className",
|
|
1786
|
+
"actionClassName"
|
|
1787
|
+
]);
|
|
1788
|
+
return /* @__PURE__ */ jsxs16(
|
|
1789
|
+
"div",
|
|
1790
|
+
__spreadProps(__spreadValues({
|
|
1791
|
+
className: classNames11(
|
|
1792
|
+
"flex w-full flex-col gap-5 desktop:flex-row desktop:items-end",
|
|
1793
|
+
className
|
|
1794
|
+
)
|
|
1795
|
+
}, rest), {
|
|
1796
|
+
children: [
|
|
1797
|
+
/* @__PURE__ */ jsx26(FormGrid, { columns, className: "min-w-0 flex-1", children: filters }),
|
|
1798
|
+
actions ? /* @__PURE__ */ jsx26(FormActions, { className: classNames11("desktop:w-auto", actionClassName), children: actions }) : null
|
|
1799
|
+
]
|
|
1800
|
+
})
|
|
1801
|
+
);
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// src/components/status-badge/StatusBadge.tsx
|
|
1805
|
+
import classNames12 from "classnames";
|
|
1806
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1807
|
+
var TONE_STYLES2 = {
|
|
1808
|
+
info: {
|
|
1809
|
+
outline: "border-feedback-info-border text-feedback-info-content",
|
|
1810
|
+
soft: "border-feedback-info-border bg-feedback-info-soft text-feedback-info-content",
|
|
1811
|
+
solid: "border-feedback-info-strong bg-feedback-info-strong text-surface-subtle"
|
|
1812
|
+
},
|
|
1813
|
+
warning: {
|
|
1814
|
+
outline: "border-feedback-warning-border text-feedback-warning-content",
|
|
1815
|
+
soft: "border-feedback-warning-border bg-feedback-warning-soft text-feedback-warning-content",
|
|
1816
|
+
solid: "border-feedback-warning-strong bg-feedback-warning-strong text-surface-subtle"
|
|
1817
|
+
},
|
|
1818
|
+
success: {
|
|
1819
|
+
outline: "border-feedback-success-border text-feedback-success-content",
|
|
1820
|
+
soft: "border-feedback-success-border bg-feedback-success-soft text-feedback-success-content",
|
|
1821
|
+
solid: "border-feedback-success-strong bg-feedback-success-strong text-surface-subtle"
|
|
1822
|
+
},
|
|
1823
|
+
danger: {
|
|
1824
|
+
outline: "border-feedback-danger-border text-feedback-danger-content",
|
|
1825
|
+
soft: "border-feedback-danger-border bg-feedback-danger-soft text-feedback-danger-content",
|
|
1826
|
+
solid: "border-feedback-danger-strong bg-feedback-danger-strong text-surface-subtle"
|
|
1827
|
+
},
|
|
1828
|
+
neutral: {
|
|
1829
|
+
outline: "border-border-strong text-content-secondary",
|
|
1830
|
+
soft: "border-border-default bg-surface-subtle text-content-secondary",
|
|
1831
|
+
solid: "border-surface-action-neutral bg-surface-action-neutral text-surface-subtle"
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
var SIZE_STYLES = {
|
|
1835
|
+
sm: "min-h-5 px-1 py-0.5 text-xs",
|
|
1836
|
+
md: "min-h-6 px-2 py-0.5 text-sm"
|
|
1837
|
+
};
|
|
1838
|
+
function StatusBadge(_a) {
|
|
1839
|
+
var _b = _a, {
|
|
1840
|
+
children,
|
|
1841
|
+
tone = "neutral",
|
|
1842
|
+
appearance = "outline",
|
|
1843
|
+
size = "md",
|
|
1844
|
+
overflow = "wrap",
|
|
1845
|
+
className,
|
|
1846
|
+
title
|
|
1847
|
+
} = _b, rest = __objRest(_b, [
|
|
1848
|
+
"children",
|
|
1849
|
+
"tone",
|
|
1850
|
+
"appearance",
|
|
1851
|
+
"size",
|
|
1852
|
+
"overflow",
|
|
1853
|
+
"className",
|
|
1854
|
+
"title"
|
|
1855
|
+
]);
|
|
1856
|
+
return /* @__PURE__ */ jsx27(
|
|
1857
|
+
"span",
|
|
1858
|
+
__spreadProps(__spreadValues({
|
|
1859
|
+
className: classNames12(
|
|
1860
|
+
"inline-flex w-fit max-w-full items-center justify-center rounded-sm border-2 text-center font-bold uppercase tracking-wide",
|
|
1861
|
+
SIZE_STYLES[size],
|
|
1862
|
+
TONE_STYLES2[tone][appearance],
|
|
1863
|
+
overflow === "truncate" ? "overflow-hidden text-ellipsis whitespace-nowrap" : "whitespace-normal break-words",
|
|
1864
|
+
className
|
|
1865
|
+
),
|
|
1866
|
+
title: title != null ? title : typeof children === "string" ? children : void 0
|
|
1867
|
+
}, rest), {
|
|
1868
|
+
children
|
|
1869
|
+
})
|
|
1870
|
+
);
|
|
1871
|
+
}
|
|
1872
|
+
var getStatusBadgeClassName = (tone, appearance) => TONE_STYLES2[tone][appearance];
|
|
1873
|
+
|
|
1874
|
+
// src/utils/resolve-status-appearance.ts
|
|
1875
|
+
var NORMALIZED_STATUS = {
|
|
1876
|
+
infoOutline: /* @__PURE__ */ new Set(["ABERTO", "PAGO", "EM PAGAMENTO"]),
|
|
1877
|
+
infoSolid: /* @__PURE__ */ new Set([
|
|
1878
|
+
"EM ANDAMENTO",
|
|
1879
|
+
"SOLICITADO",
|
|
1880
|
+
"NAO ASSINADO",
|
|
1881
|
+
"AGUARDANDO ASSINATURA"
|
|
1882
|
+
]),
|
|
1883
|
+
warning: /* @__PURE__ */ new Set([
|
|
1884
|
+
"EM ANALISE",
|
|
1885
|
+
"PENDENTE",
|
|
1886
|
+
"SUSPENSO",
|
|
1887
|
+
"AGUARDANDO PARTICIPANTE"
|
|
1888
|
+
]),
|
|
1889
|
+
success: /* @__PURE__ */ new Set([
|
|
1890
|
+
"DEFERIDO",
|
|
1891
|
+
"QUITADO",
|
|
1892
|
+
"LIBERADO",
|
|
1893
|
+
"ATIVO",
|
|
1894
|
+
"VIGENTE",
|
|
1895
|
+
"RESPONDIDO",
|
|
1896
|
+
"ASSINADO"
|
|
1897
|
+
]),
|
|
1898
|
+
danger: /* @__PURE__ */ new Set(["INDEFERIDO", "VENCIDO", "CANCELADO", "ERRO"]),
|
|
1899
|
+
neutral: /* @__PURE__ */ new Set([
|
|
1900
|
+
"CONCLUIDO",
|
|
1901
|
+
"ENCERRADO",
|
|
1902
|
+
"FINALIZADO",
|
|
1903
|
+
"RENEGOCIADO",
|
|
1904
|
+
"INATIVO"
|
|
1905
|
+
])
|
|
1906
|
+
};
|
|
1907
|
+
var normalizeStatus = (status) => String(status != null ? status : "").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/\s+/g, " ").trim().toUpperCase();
|
|
1908
|
+
var resolveGenericStatus = (status) => {
|
|
1909
|
+
if (NORMALIZED_STATUS.infoOutline.has(status)) {
|
|
1910
|
+
return { tone: "info", appearance: "outline" };
|
|
1911
|
+
}
|
|
1912
|
+
if (NORMALIZED_STATUS.infoSolid.has(status)) {
|
|
1913
|
+
return { tone: "info", appearance: "solid" };
|
|
1914
|
+
}
|
|
1915
|
+
if (NORMALIZED_STATUS.warning.has(status)) {
|
|
1916
|
+
return { tone: "warning", appearance: "soft" };
|
|
1917
|
+
}
|
|
1918
|
+
if (NORMALIZED_STATUS.success.has(status)) {
|
|
1919
|
+
return { tone: "success", appearance: "solid" };
|
|
1920
|
+
}
|
|
1921
|
+
if (NORMALIZED_STATUS.danger.has(status)) {
|
|
1922
|
+
return { tone: "danger", appearance: "solid" };
|
|
1923
|
+
}
|
|
1924
|
+
if (NORMALIZED_STATUS.neutral.has(status)) {
|
|
1925
|
+
return { tone: "neutral", appearance: "solid" };
|
|
1926
|
+
}
|
|
1927
|
+
return { tone: "neutral", appearance: "outline" };
|
|
1928
|
+
};
|
|
1929
|
+
var resolveStatusAppearance = (status, domain = "generic") => {
|
|
1930
|
+
const normalized = normalizeStatus(status);
|
|
1931
|
+
if (!normalized) return { tone: "neutral", appearance: "outline" };
|
|
1932
|
+
if (domain === "beneficiary") {
|
|
1933
|
+
if (normalized === "VIGENTE") return { tone: "success", appearance: "solid" };
|
|
1934
|
+
if (normalized === "ENCERRADO") return { tone: "neutral", appearance: "solid" };
|
|
1935
|
+
}
|
|
1936
|
+
if (domain === "document") {
|
|
1937
|
+
if (["ANEXADO", "ASSINADO", "CONCLUIDO"].includes(normalized)) {
|
|
1938
|
+
return { tone: "success", appearance: "solid" };
|
|
1939
|
+
}
|
|
1940
|
+
if (normalized.includes("AGUARDANDO") || normalized === "PENDENTE") {
|
|
1941
|
+
return { tone: "warning", appearance: "soft" };
|
|
1942
|
+
}
|
|
1943
|
+
if (normalized === "BLOQUEADO") return { tone: "neutral", appearance: "solid" };
|
|
1944
|
+
}
|
|
1945
|
+
if (domain === "signature") {
|
|
1946
|
+
if (normalized === "ASSINADO") return { tone: "success", appearance: "solid" };
|
|
1947
|
+
if (normalized.includes("AGUARDANDO")) return { tone: "warning", appearance: "soft" };
|
|
1948
|
+
if (normalized === "NAO ASSINADO") return { tone: "info", appearance: "solid" };
|
|
1949
|
+
}
|
|
1950
|
+
if (domain === "benefit") {
|
|
1951
|
+
if (normalized === "EM PAGAMENTO") return { tone: "info", appearance: "outline" };
|
|
1952
|
+
if (normalized === "SUSPENSO") return { tone: "warning", appearance: "soft" };
|
|
1953
|
+
}
|
|
1954
|
+
if (domain === "participation") {
|
|
1955
|
+
return { tone: "neutral", appearance: "solid" };
|
|
1956
|
+
}
|
|
1957
|
+
return resolveGenericStatus(normalized);
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1960
|
+
// src/components/status-badge/DomainStatusBadge.tsx
|
|
1961
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1962
|
+
function DomainStatusBadge(_a) {
|
|
1963
|
+
var _b = _a, {
|
|
1964
|
+
status,
|
|
1965
|
+
domain = "generic",
|
|
1966
|
+
empty = "hide",
|
|
1967
|
+
placeholder = "-"
|
|
1968
|
+
} = _b, rest = __objRest(_b, [
|
|
1969
|
+
"status",
|
|
1970
|
+
"domain",
|
|
1971
|
+
"empty",
|
|
1972
|
+
"placeholder"
|
|
1973
|
+
]);
|
|
1974
|
+
const label = status == null ? void 0 : status.trim();
|
|
1975
|
+
if (!label && empty === "hide") return null;
|
|
1976
|
+
const resolved = resolveStatusAppearance(label, domain);
|
|
1977
|
+
return /* @__PURE__ */ jsx28(
|
|
1978
|
+
StatusBadge,
|
|
1979
|
+
__spreadProps(__spreadValues({
|
|
1980
|
+
tone: resolved.tone,
|
|
1981
|
+
appearance: resolved.appearance
|
|
1982
|
+
}, rest), {
|
|
1983
|
+
children: label || placeholder
|
|
1984
|
+
})
|
|
1985
|
+
);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
// src/components/skipLink/SkipLink.tsx
|
|
1989
|
+
import classNames13 from "classnames";
|
|
1990
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1991
|
+
function SkipLink({
|
|
1992
|
+
targetId = "main-content",
|
|
1993
|
+
label = "Pular para o conte\xFAdo",
|
|
1994
|
+
className
|
|
1995
|
+
}) {
|
|
1996
|
+
return /* @__PURE__ */ jsx29(
|
|
1997
|
+
"a",
|
|
1998
|
+
{
|
|
1999
|
+
href: `#${targetId}`,
|
|
2000
|
+
className: classNames13(
|
|
2001
|
+
"fixed left-2 top-0 z-drawer -translate-y-[calc(100%+0.5rem)] whitespace-nowrap rounded-sm border border-border-default bg-surface-card px-3 py-2 font-bold text-content-primary shadow-md transition-transform focus:translate-y-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus-ring motion-reduce:transition-none",
|
|
2002
|
+
className
|
|
2003
|
+
),
|
|
2004
|
+
children: label
|
|
2005
|
+
}
|
|
2006
|
+
);
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
// src/components/focus-navigation/FocusNavigationMode.tsx
|
|
2010
|
+
import { useEffect as useEffect4 } from "react";
|
|
2011
|
+
var FOCUS_NAVIGATION_ATTRIBUTE = "data-focus-navigation";
|
|
2012
|
+
function FocusNavigationMode() {
|
|
2013
|
+
useEffect4(() => {
|
|
2014
|
+
const root = document.documentElement;
|
|
2015
|
+
const handleKeyDown = (event) => {
|
|
2016
|
+
if (event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
|
2017
|
+
root.setAttribute(FOCUS_NAVIGATION_ATTRIBUTE, "keyboard");
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
const handlePointerDown = () => {
|
|
2021
|
+
root.setAttribute(FOCUS_NAVIGATION_ATTRIBUTE, "pointer");
|
|
2022
|
+
};
|
|
2023
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
2024
|
+
document.addEventListener("pointerdown", handlePointerDown, true);
|
|
2025
|
+
return () => {
|
|
2026
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
2027
|
+
document.removeEventListener("pointerdown", handlePointerDown, true);
|
|
2028
|
+
};
|
|
2029
|
+
}, []);
|
|
2030
|
+
return null;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// src/components/form-error-navigation/FormErrorNavigation.tsx
|
|
2034
|
+
import { useEffect as useEffect5 } from "react";
|
|
2035
|
+
function shouldReduceMotion() {
|
|
2036
|
+
var _a, _b;
|
|
2037
|
+
return (_b = (_a = window.matchMedia) == null ? void 0 : _a.call(window, "(prefers-reduced-motion: reduce)").matches) != null ? _b : false;
|
|
2038
|
+
}
|
|
2039
|
+
var INVALID_FIELD_SELECTOR = [
|
|
2040
|
+
'[aria-invalid="true"]',
|
|
2041
|
+
"input:invalid",
|
|
2042
|
+
"select:invalid",
|
|
2043
|
+
"textarea:invalid"
|
|
2044
|
+
].join(",");
|
|
2045
|
+
var RETRY_DELAYS = [50, 150, 300, 600, 1e3];
|
|
2046
|
+
function isVisible(element) {
|
|
2047
|
+
const styles = window.getComputedStyle(element);
|
|
2048
|
+
const bounds = element.getBoundingClientRect();
|
|
2049
|
+
return styles.display !== "none" && styles.visibility !== "hidden" && bounds.width > 0 && bounds.height > 0;
|
|
2050
|
+
}
|
|
2051
|
+
function getFocusTarget(field) {
|
|
2052
|
+
if (field.matches(
|
|
2053
|
+
"input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex='-1'])"
|
|
2054
|
+
)) {
|
|
2055
|
+
return field;
|
|
2056
|
+
}
|
|
2057
|
+
return field.querySelector(
|
|
2058
|
+
"input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex='-1'])"
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
function findFirstInvalidField(form) {
|
|
2062
|
+
return [...form.querySelectorAll(INVALID_FIELD_SELECTOR)].filter(isVisible).sort((first, second) => {
|
|
2063
|
+
const firstBounds = first.getBoundingClientRect();
|
|
2064
|
+
const secondBounds = second.getBoundingClientRect();
|
|
2065
|
+
if (firstBounds.top !== secondBounds.top) {
|
|
2066
|
+
return firstBounds.top - secondBounds.top;
|
|
2067
|
+
}
|
|
2068
|
+
return firstBounds.left - secondBounds.left;
|
|
2069
|
+
})[0];
|
|
2070
|
+
}
|
|
2071
|
+
function navigateToInvalidField(field) {
|
|
2072
|
+
const focusTarget = getFocusTarget(field);
|
|
2073
|
+
const behavior = shouldReduceMotion() ? "auto" : "smooth";
|
|
2074
|
+
focusTarget == null ? void 0 : focusTarget.focus({ preventScroll: true });
|
|
2075
|
+
field.scrollIntoView({ behavior, block: "center", inline: "nearest" });
|
|
2076
|
+
}
|
|
2077
|
+
function FormErrorNavigation() {
|
|
2078
|
+
useEffect5(() => {
|
|
2079
|
+
let cleanupPendingNavigation;
|
|
2080
|
+
const handleSubmit = (event) => {
|
|
2081
|
+
if (!(event.target instanceof HTMLFormElement)) return;
|
|
2082
|
+
cleanupPendingNavigation == null ? void 0 : cleanupPendingNavigation();
|
|
2083
|
+
const form = event.target;
|
|
2084
|
+
let handled = false;
|
|
2085
|
+
let observer;
|
|
2086
|
+
const timers = [];
|
|
2087
|
+
const cleanup = () => {
|
|
2088
|
+
observer == null ? void 0 : observer.disconnect();
|
|
2089
|
+
timers.forEach(window.clearTimeout);
|
|
2090
|
+
};
|
|
2091
|
+
const tryNavigate = () => {
|
|
2092
|
+
if (handled || !form.isConnected) return;
|
|
2093
|
+
const field = findFirstInvalidField(form);
|
|
2094
|
+
if (!field) return;
|
|
2095
|
+
handled = true;
|
|
2096
|
+
cleanup();
|
|
2097
|
+
navigateToInvalidField(field);
|
|
2098
|
+
};
|
|
2099
|
+
observer = new MutationObserver(tryNavigate);
|
|
2100
|
+
observer.observe(form, {
|
|
2101
|
+
attributeFilter: ["aria-invalid"],
|
|
2102
|
+
attributes: true,
|
|
2103
|
+
subtree: true
|
|
2104
|
+
});
|
|
2105
|
+
RETRY_DELAYS.forEach((delay) => {
|
|
2106
|
+
timers.push(window.setTimeout(tryNavigate, delay));
|
|
2107
|
+
});
|
|
2108
|
+
cleanupPendingNavigation = cleanup;
|
|
2109
|
+
};
|
|
2110
|
+
document.addEventListener("submit", handleSubmit, true);
|
|
2111
|
+
return () => {
|
|
2112
|
+
cleanupPendingNavigation == null ? void 0 : cleanupPendingNavigation();
|
|
2113
|
+
document.removeEventListener("submit", handleSubmit, true);
|
|
2114
|
+
};
|
|
2115
|
+
}, []);
|
|
2116
|
+
return null;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// src/components/table/Table.tsx
|
|
2120
|
+
import React4, { useEffect as useEffect8, useId as useId2, useMemo as useMemo2, useState as useState4 } from "react";
|
|
2121
|
+
|
|
2122
|
+
// src/components/table/TableView.tsx
|
|
2123
|
+
import {
|
|
2124
|
+
useEffect as useEffect7,
|
|
2125
|
+
useRef as useRef4,
|
|
2126
|
+
useState as useState3
|
|
2127
|
+
} from "react";
|
|
2128
|
+
import {
|
|
2129
|
+
MdArrowDownward,
|
|
2130
|
+
MdArrowUpward,
|
|
2131
|
+
MdFilterList,
|
|
2132
|
+
MdKeyboardArrowLeft,
|
|
2133
|
+
MdKeyboardArrowRight,
|
|
2134
|
+
MdOutlineFilterAlt
|
|
2135
|
+
} from "react-icons/md";
|
|
2136
|
+
|
|
2137
|
+
// src/components/table/components/filter/FilterView.tsx
|
|
2138
|
+
import cs3 from "classnames";
|
|
2139
|
+
import { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
2140
|
+
import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2141
|
+
function FilterView({
|
|
2142
|
+
optionList,
|
|
2143
|
+
optionChecked,
|
|
2144
|
+
onChange,
|
|
2145
|
+
controls,
|
|
2146
|
+
onControlChange,
|
|
2147
|
+
maxHeight
|
|
2148
|
+
}) {
|
|
2149
|
+
const handleChangeCheckbox = (event) => {
|
|
2150
|
+
if (onChange) {
|
|
2151
|
+
onChange(event.target.value);
|
|
2152
|
+
}
|
|
2153
|
+
};
|
|
2154
|
+
const handleControlChange = (control, event) => {
|
|
2155
|
+
onControlChange == null ? void 0 : onControlChange(control, event.target.value);
|
|
2156
|
+
};
|
|
2157
|
+
const containerRef = useRef3(null);
|
|
2158
|
+
useEffect6(() => {
|
|
2159
|
+
if (!containerRef.current) return;
|
|
2160
|
+
containerRef.current.style.maxHeight = maxHeight ? `${maxHeight}px` : "";
|
|
2161
|
+
}, [maxHeight]);
|
|
2162
|
+
if (controls == null ? void 0 : controls.length) {
|
|
2163
|
+
return /* @__PURE__ */ jsx30(
|
|
2164
|
+
"div",
|
|
2165
|
+
{
|
|
2166
|
+
ref: containerRef,
|
|
2167
|
+
className: "bg-surface-card rounded shadow-sm p-3 font-normal w-[calc(100vw-16px)] max-w-[320px] overflow-y-auto text-sm",
|
|
2168
|
+
children: /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-3", children: controls.map((control) => {
|
|
2169
|
+
var _a, _b, _c;
|
|
2170
|
+
return /* @__PURE__ */ jsxs17(
|
|
2171
|
+
"div",
|
|
2172
|
+
{
|
|
2173
|
+
className: "flex flex-col gap-2 border-b border-border-default pb-3 last:border-b-0 last:pb-0",
|
|
2174
|
+
children: [
|
|
2175
|
+
control.label && /* @__PURE__ */ jsx30("span", { className: "text-xs font-bold uppercase tracking-wide text-content-muted", children: control.label }),
|
|
2176
|
+
control.type === "search" ? /* @__PURE__ */ jsx30(
|
|
2177
|
+
"input",
|
|
2178
|
+
{
|
|
2179
|
+
type: "text",
|
|
2180
|
+
value: (_a = control.value) != null ? _a : "",
|
|
2181
|
+
placeholder: (_b = control.placeholder) != null ? _b : "Buscar",
|
|
2182
|
+
onChange: (event) => handleControlChange(control, event),
|
|
2183
|
+
className: "field-keyboard-focus-ring h-10 rounded border border-field-border-default bg-field-surface px-3 text-sm text-field-content outline-none placeholder:text-field-placeholder focus:border-field-border-active"
|
|
2184
|
+
}
|
|
2185
|
+
) : /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-1", children: (_c = control.optionList) == null ? void 0 : _c.map((option, index) => /* @__PURE__ */ jsxs17(
|
|
2186
|
+
"label",
|
|
2187
|
+
{
|
|
2188
|
+
className: cs3(
|
|
2189
|
+
"min-h-6 flex items-start gap-2 px-3 py-0.5 cursor-pointer rounded",
|
|
2190
|
+
control.value === option.value ? "bg-primary-5 text-primary-1" : "text-content-primary"
|
|
2191
|
+
),
|
|
2192
|
+
children: [
|
|
2193
|
+
/* @__PURE__ */ jsx30(
|
|
2194
|
+
"input",
|
|
2195
|
+
{
|
|
2196
|
+
type: "radio",
|
|
2197
|
+
className: "peer sr-only",
|
|
2198
|
+
value: option.value,
|
|
2199
|
+
checked: control.value === option.value,
|
|
2200
|
+
name: `table-filter-${control.id}`,
|
|
2201
|
+
onChange: (event) => handleControlChange(control, event)
|
|
2202
|
+
}
|
|
2203
|
+
),
|
|
2204
|
+
/* @__PURE__ */ jsx30(
|
|
2205
|
+
"span",
|
|
2206
|
+
{
|
|
2207
|
+
"aria-hidden": "true",
|
|
2208
|
+
className: "radio-control-proxy mt-1"
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
/* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1 mt-[4px]", children: option.label })
|
|
2212
|
+
]
|
|
2213
|
+
},
|
|
2214
|
+
`${control.id}-${index}`
|
|
2215
|
+
)) })
|
|
2216
|
+
]
|
|
2217
|
+
},
|
|
2218
|
+
control.id
|
|
2219
|
+
);
|
|
2220
|
+
}) })
|
|
2221
|
+
}
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
return /* @__PURE__ */ jsx30(
|
|
2225
|
+
"div",
|
|
2226
|
+
{
|
|
2227
|
+
ref: containerRef,
|
|
2228
|
+
className: "bg-surface-card rounded shadow-sm p-2 font-normal w-[calc(100vw-16px)] max-w-[320px] overflow-y-auto",
|
|
2229
|
+
children: optionList && optionList.map((option, index) => /* @__PURE__ */ jsxs17(
|
|
2230
|
+
"label",
|
|
2231
|
+
{
|
|
2232
|
+
className: cs3(
|
|
2233
|
+
"min-h-10 flex items-start gap-2 px-3 py-1 cursor-pointer rounded",
|
|
2234
|
+
optionChecked === option.value ? "bg-primary-5 text-primary-1" : "text-content-primary"
|
|
2235
|
+
),
|
|
2236
|
+
children: [
|
|
2237
|
+
/* @__PURE__ */ jsx30(
|
|
2238
|
+
"input",
|
|
2239
|
+
{
|
|
2240
|
+
type: "radio",
|
|
2241
|
+
className: "peer sr-only",
|
|
2242
|
+
value: option.value,
|
|
2243
|
+
checked: optionChecked === option.value,
|
|
2244
|
+
name: "table-filter",
|
|
2245
|
+
onChange: handleChangeCheckbox
|
|
2246
|
+
}
|
|
2247
|
+
),
|
|
2248
|
+
/* @__PURE__ */ jsx30(
|
|
2249
|
+
"span",
|
|
2250
|
+
{
|
|
2251
|
+
"aria-hidden": "true",
|
|
2252
|
+
className: "radio-control-proxy mt-1"
|
|
2253
|
+
}
|
|
2254
|
+
),
|
|
2255
|
+
/* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1", children: option.label })
|
|
2256
|
+
]
|
|
2257
|
+
},
|
|
2258
|
+
index
|
|
2259
|
+
))
|
|
2260
|
+
}
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
var FilterView_default = FilterView;
|
|
2264
|
+
|
|
2265
|
+
// src/components/table/components/filter/Filter.tsx
|
|
2266
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2267
|
+
function Filter(props) {
|
|
2268
|
+
const {
|
|
2269
|
+
optionList,
|
|
2270
|
+
optionChecked,
|
|
2271
|
+
onChange,
|
|
2272
|
+
controls,
|
|
2273
|
+
onControlChange,
|
|
2274
|
+
maxHeight
|
|
2275
|
+
} = props;
|
|
2276
|
+
return /* @__PURE__ */ jsx31(
|
|
2277
|
+
FilterView_default,
|
|
2278
|
+
{
|
|
2279
|
+
optionList,
|
|
2280
|
+
optionChecked,
|
|
2281
|
+
onChange,
|
|
2282
|
+
controls,
|
|
2283
|
+
onControlChange,
|
|
2284
|
+
maxHeight
|
|
2285
|
+
}
|
|
2286
|
+
);
|
|
2287
|
+
}
|
|
2288
|
+
var Filter_default = Filter;
|
|
2289
|
+
|
|
2290
|
+
// src/components/table/components/notFound/NotFoundView.tsx
|
|
2291
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
2292
|
+
function NotFoundView() {
|
|
2293
|
+
return /* @__PURE__ */ jsx32("div", { className: "flex-1 flex flex-col items-center justify-center my-14 tablet:my-20", children: /* @__PURE__ */ jsx32("p", { className: "mt-6 text-center text-base font-bold text-content-secondary", children: "Nenhum resultado encontrado." }) });
|
|
2294
|
+
}
|
|
2295
|
+
var NotFoundView_default = NotFoundView;
|
|
2296
|
+
|
|
2297
|
+
// src/components/table/TableView.tsx
|
|
2298
|
+
import { jsx as jsx33, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2299
|
+
var HEADER_VARIANT_CLASSES = {
|
|
2300
|
+
default: "bg-surface-card text-content-muted",
|
|
2301
|
+
brand: "bg-action-primary text-action-primary-content",
|
|
2302
|
+
dark: "bg-surface-action-neutral text-content-inverse",
|
|
2303
|
+
neutral: "bg-surface-muted text-content-primary"
|
|
2304
|
+
};
|
|
2305
|
+
var HEADER_DENSITY_CLASSES = {
|
|
2306
|
+
comfortable: { row: "h-10", cell: "px-2" },
|
|
2307
|
+
compact: { row: "h-8", cell: "px-2 py-1" }
|
|
2308
|
+
};
|
|
2309
|
+
function TableView({
|
|
2310
|
+
children,
|
|
2311
|
+
header,
|
|
2312
|
+
accessibleName,
|
|
2313
|
+
caption,
|
|
2314
|
+
className,
|
|
2315
|
+
onFilterChange,
|
|
2316
|
+
showPagination,
|
|
2317
|
+
pagination,
|
|
2318
|
+
totalWidthUnits,
|
|
2319
|
+
overflowMode = "scroll",
|
|
2320
|
+
adaptiveBreakpoint = 440,
|
|
2321
|
+
stickyHeader = false,
|
|
2322
|
+
scrollAreaMaxHeight,
|
|
2323
|
+
rowVariant = "plain",
|
|
2324
|
+
headerVariant = "default",
|
|
2325
|
+
density = "comfortable"
|
|
2326
|
+
}) {
|
|
2327
|
+
var _a, _b;
|
|
2328
|
+
const breakpoint = useBreakpoint();
|
|
2329
|
+
const isMobile = breakpoint === "mobile";
|
|
2330
|
+
const [openFilter, setOpenFilter] = useState3(null);
|
|
2331
|
+
const [filterMaxHeight, setFilterMaxHeight] = useState3();
|
|
2332
|
+
const [filterCoords, setFilterCoords] = useState3(null);
|
|
2333
|
+
const [tableWidth, setTableWidth] = useState3();
|
|
2334
|
+
const scrollContainerRef = useRef4(null);
|
|
2335
|
+
const tableWrapperRef = useRef4(null);
|
|
2336
|
+
const headerCellRefs = useRef4([]);
|
|
2337
|
+
const filterRef = useRef4(null);
|
|
2338
|
+
useEffect7(() => {
|
|
2339
|
+
const wrapper = tableWrapperRef.current;
|
|
2340
|
+
if (!wrapper) return;
|
|
2341
|
+
const updateWidth = () => setTableWidth(wrapper.clientWidth);
|
|
2342
|
+
if (typeof ResizeObserver === "undefined") {
|
|
2343
|
+
updateWidth();
|
|
2344
|
+
window.addEventListener("resize", updateWidth);
|
|
2345
|
+
return () => window.removeEventListener("resize", updateWidth);
|
|
2346
|
+
}
|
|
2347
|
+
const observer = new ResizeObserver(updateWidth);
|
|
2348
|
+
observer.observe(wrapper);
|
|
2349
|
+
updateWidth();
|
|
2350
|
+
return () => observer.disconnect();
|
|
2351
|
+
}, []);
|
|
2352
|
+
useEffect7(() => {
|
|
2353
|
+
const updateFilterMaxHeight = () => {
|
|
2354
|
+
var _a2;
|
|
2355
|
+
const nextHeight = (_a2 = scrollContainerRef.current) == null ? void 0 : _a2.clientHeight;
|
|
2356
|
+
if (!nextHeight) return;
|
|
2357
|
+
setFilterMaxHeight(Math.max(nextHeight - 24, 160));
|
|
2358
|
+
};
|
|
2359
|
+
updateFilterMaxHeight();
|
|
2360
|
+
window.addEventListener("resize", updateFilterMaxHeight);
|
|
2361
|
+
return () => {
|
|
2362
|
+
window.removeEventListener("resize", updateFilterMaxHeight);
|
|
2363
|
+
};
|
|
2364
|
+
}, []);
|
|
2365
|
+
useEffect7(() => {
|
|
2366
|
+
const handleClickOutside = (event) => {
|
|
2367
|
+
if (tableWrapperRef.current && !tableWrapperRef.current.contains(event.target)) {
|
|
2368
|
+
setOpenFilter(null);
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2372
|
+
return () => {
|
|
2373
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2374
|
+
};
|
|
2375
|
+
}, []);
|
|
2376
|
+
useEffect7(() => {
|
|
2377
|
+
if (!filterRef.current || !filterCoords) return;
|
|
2378
|
+
filterRef.current.style.top = `${filterCoords.top}px`;
|
|
2379
|
+
filterRef.current.style.left = typeof filterCoords.left === "number" ? `${filterCoords.left}px` : "";
|
|
2380
|
+
}, [filterCoords]);
|
|
2381
|
+
const handleOpenFilter = (index) => {
|
|
2382
|
+
var _a2, _b2;
|
|
2383
|
+
const next = openFilter === index ? null : index;
|
|
2384
|
+
setOpenFilter(next);
|
|
2385
|
+
if (next !== null) {
|
|
2386
|
+
const wrapperRect = (_a2 = tableWrapperRef.current) == null ? void 0 : _a2.getBoundingClientRect();
|
|
2387
|
+
const cellRect = (_b2 = headerCellRefs.current[next]) == null ? void 0 : _b2.getBoundingClientRect();
|
|
2388
|
+
if (wrapperRect && cellRect) {
|
|
2389
|
+
const top = cellRect.bottom - wrapperRect.top + 8;
|
|
2390
|
+
const dropdownWidth = Math.min(
|
|
2391
|
+
320,
|
|
2392
|
+
Math.max(wrapperRect.width - 16, 0)
|
|
2393
|
+
);
|
|
2394
|
+
const desiredLeft = cellRect.left - wrapperRect.left;
|
|
2395
|
+
const minLeft = 8;
|
|
2396
|
+
const maxLeft = Math.max(
|
|
2397
|
+
minLeft,
|
|
2398
|
+
wrapperRect.width - dropdownWidth - 8
|
|
2399
|
+
);
|
|
2400
|
+
const left = Math.min(Math.max(desiredLeft, minLeft), maxLeft);
|
|
2401
|
+
setFilterCoords({ top, left });
|
|
2402
|
+
}
|
|
2403
|
+
} else {
|
|
2404
|
+
setFilterCoords(null);
|
|
2405
|
+
}
|
|
2406
|
+
};
|
|
2407
|
+
const hasFilterEnabled = (item) => {
|
|
2408
|
+
var _a2, _b2, _c, _d;
|
|
2409
|
+
return Boolean(((_b2 = (_a2 = item.filters) == null ? void 0 : _a2.optionList) == null ? void 0 : _b2.length) || ((_d = (_c = item.filters) == null ? void 0 : _c.controls) == null ? void 0 : _d.length));
|
|
2410
|
+
};
|
|
2411
|
+
const getHeaderIcon = (item) => {
|
|
2412
|
+
var _a2, _b2, _c;
|
|
2413
|
+
if (!hasFilterEnabled(item)) {
|
|
2414
|
+
return null;
|
|
2415
|
+
}
|
|
2416
|
+
const controls = (_b2 = (_a2 = item.filters) == null ? void 0 : _a2.controls) != null ? _b2 : [];
|
|
2417
|
+
const hasActiveSearchOrOptionFilter = controls.some((control) => {
|
|
2418
|
+
var _a3;
|
|
2419
|
+
if (control.type === "search") {
|
|
2420
|
+
return Boolean((_a3 = control.value) == null ? void 0 : _a3.trim());
|
|
2421
|
+
}
|
|
2422
|
+
if (control.type === "options") {
|
|
2423
|
+
return Boolean(control.value && control.value !== "__all__");
|
|
2424
|
+
}
|
|
2425
|
+
return false;
|
|
2426
|
+
});
|
|
2427
|
+
if (hasActiveSearchOrOptionFilter) {
|
|
2428
|
+
return /* @__PURE__ */ jsx33(MdFilterList, { className: "h-3.5 w-3.5" });
|
|
2429
|
+
}
|
|
2430
|
+
const activeSort = controls.find(
|
|
2431
|
+
(control) => control.type === "sort" && control.value && control.value !== "__all__" && control.value !== "default"
|
|
2432
|
+
);
|
|
2433
|
+
if ((activeSort == null ? void 0 : activeSort.value) === "asc") {
|
|
2434
|
+
return /* @__PURE__ */ jsx33(MdArrowUpward, { className: "h-3.5 w-3.5" });
|
|
2435
|
+
}
|
|
2436
|
+
if ((activeSort == null ? void 0 : activeSort.value) === "desc") {
|
|
2437
|
+
return /* @__PURE__ */ jsx33(MdArrowDownward, { className: "h-3.5 w-3.5" });
|
|
2438
|
+
}
|
|
2439
|
+
const legacyOptionActive = ((_c = item.filters) == null ? void 0 : _c.optionChecked) && item.filters.optionChecked !== "__all__" && item.filters.optionChecked !== "default";
|
|
2440
|
+
if (legacyOptionActive) {
|
|
2441
|
+
return /* @__PURE__ */ jsx33(MdFilterList, { className: "h-3.5 w-3.5" });
|
|
2442
|
+
}
|
|
2443
|
+
return /* @__PURE__ */ jsx33(MdOutlineFilterAlt, { className: "h-3.5 w-3.5" });
|
|
2444
|
+
};
|
|
2445
|
+
const getSortDirection = (item) => {
|
|
2446
|
+
var _a2, _b2;
|
|
2447
|
+
const sortControl = (_b2 = (_a2 = item.filters) == null ? void 0 : _a2.controls) == null ? void 0 : _b2.find(
|
|
2448
|
+
(control) => control.type === "sort"
|
|
2449
|
+
);
|
|
2450
|
+
if (!sortControl) return void 0;
|
|
2451
|
+
if (sortControl.value === "asc") return "ascending";
|
|
2452
|
+
if (sortControl.value === "desc") return "descending";
|
|
2453
|
+
return "none";
|
|
2454
|
+
};
|
|
2455
|
+
const handleHeaderAction = (item, index) => {
|
|
2456
|
+
if (hasFilterEnabled(item)) {
|
|
2457
|
+
handleOpenFilter(index);
|
|
2458
|
+
return;
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
const handleFilterChange = (item, value, control) => {
|
|
2462
|
+
var _a2, _b2, _c, _d;
|
|
2463
|
+
if ((control == null ? void 0 : control.type) !== "search") {
|
|
2464
|
+
setOpenFilter(null);
|
|
2465
|
+
}
|
|
2466
|
+
if (control) {
|
|
2467
|
+
(_b2 = (_a2 = item.filters) == null ? void 0 : _a2.onControlChange) == null ? void 0 : _b2.call(_a2, control, value);
|
|
2468
|
+
} else {
|
|
2469
|
+
(_d = (_c = item.filters) == null ? void 0 : _c.onChange) == null ? void 0 : _d.call(_c, value);
|
|
2470
|
+
}
|
|
2471
|
+
if (onFilterChange) {
|
|
2472
|
+
onFilterChange(value);
|
|
2473
|
+
}
|
|
2474
|
+
};
|
|
2475
|
+
const resolvedTotalWidthUnits = totalWidthUnits != null ? totalWidthUnits : header.reduce((sum, item) => {
|
|
2476
|
+
var _a2;
|
|
2477
|
+
return sum + ((_a2 = item.widthUnits) != null ? _a2 : 0);
|
|
2478
|
+
}, 0) || void 0;
|
|
2479
|
+
const getColumnWidth = (widthUnits) => {
|
|
2480
|
+
if (!resolvedTotalWidthUnits || !widthUnits) {
|
|
2481
|
+
return void 0;
|
|
2482
|
+
}
|
|
2483
|
+
return `${widthUnits / resolvedTotalWidthUnits * 100}%`;
|
|
2484
|
+
};
|
|
2485
|
+
const paginationVariant = isMobile ? "arrows" : (_a = pagination == null ? void 0 : pagination.variant) != null ? _a : "default";
|
|
2486
|
+
const isAdaptiveCompact = overflowMode === "adaptive" && tableWidth !== void 0 && tableWidth < adaptiveBreakpoint;
|
|
2487
|
+
const overflowClass = overflowMode === "scroll" ? "overflow-x-auto" : "overflow-x-hidden";
|
|
2488
|
+
const resolvedScrollAreaMaxHeight = stickyHeader ? scrollAreaMaxHeight != null ? scrollAreaMaxHeight : "calc(100dvh - 240px)" : scrollAreaMaxHeight;
|
|
2489
|
+
const headerFocusClass = headerVariant === "brand" || headerVariant === "dark" ? "focus-visible:outline-current" : "focus-visible:outline-focus-ring";
|
|
2490
|
+
return /* @__PURE__ */ jsxs18(
|
|
2491
|
+
"div",
|
|
2492
|
+
{
|
|
2493
|
+
ref: tableWrapperRef,
|
|
2494
|
+
className: `relative flex h-full min-h-0 min-w-0 flex-col ${isAdaptiveCompact ? "table-adaptive-compact" : ""}`,
|
|
2495
|
+
children: [
|
|
2496
|
+
/* @__PURE__ */ jsx33(
|
|
2497
|
+
"div",
|
|
2498
|
+
{
|
|
2499
|
+
ref: scrollContainerRef,
|
|
2500
|
+
"data-sticky-header": stickyHeader,
|
|
2501
|
+
"data-row-variant": rowVariant,
|
|
2502
|
+
"data-header-variant": headerVariant,
|
|
2503
|
+
"data-table-density": density,
|
|
2504
|
+
style: { maxHeight: resolvedScrollAreaMaxHeight },
|
|
2505
|
+
className: `min-h-0 min-w-0 flex-1 overflow-y-auto ${overflowClass}`,
|
|
2506
|
+
children: /* @__PURE__ */ jsxs18(
|
|
2507
|
+
"table",
|
|
2508
|
+
{
|
|
2509
|
+
"aria-label": caption ? void 0 : accessibleName != null ? accessibleName : `Tabela: ${header.map((item) => item.title).join(", ")}`,
|
|
2510
|
+
className: `w-full max-w-full ${resolvedTotalWidthUnits && !isAdaptiveCompact ? "table-fixed" : ""} ${className != null ? className : ""}`,
|
|
2511
|
+
children: [
|
|
2512
|
+
caption && /* @__PURE__ */ jsx33("caption", { className: "sr-only", children: caption }),
|
|
2513
|
+
resolvedTotalWidthUnits && !isAdaptiveCompact && /* @__PURE__ */ jsx33("colgroup", { children: header.map((item, index) => /* @__PURE__ */ jsx33("col", { width: getColumnWidth(item.widthUnits) }, index)) }),
|
|
2514
|
+
/* @__PURE__ */ jsx33("thead", { className: "border-b border-border-default", children: /* @__PURE__ */ jsx33("tr", { className: HEADER_DENSITY_CLASSES[density].row, children: header.map((item, index) => {
|
|
2515
|
+
var _a2, _b2, _c;
|
|
2516
|
+
const canOpenFilter = hasFilterEnabled(item);
|
|
2517
|
+
const headerIcon = getHeaderIcon(item);
|
|
2518
|
+
return /* @__PURE__ */ jsx33(
|
|
2519
|
+
"th",
|
|
2520
|
+
{
|
|
2521
|
+
scope: "col",
|
|
2522
|
+
"aria-sort": getSortDirection(item),
|
|
2523
|
+
ref: (element) => {
|
|
2524
|
+
headerCellRefs.current[index] = element;
|
|
2525
|
+
},
|
|
2526
|
+
className: `${stickyHeader ? "sticky top-0 z-[1]" : "relative"} ${HEADER_VARIANT_CLASSES[headerVariant]} ${HEADER_DENSITY_CLASSES[density].cell} text-left text-md font-bold ${(_a2 = item.className) != null ? _a2 : ""}`,
|
|
2527
|
+
"data-has-filter": canOpenFilter,
|
|
2528
|
+
children: canOpenFilter ? /* @__PURE__ */ jsxs18(
|
|
2529
|
+
"button",
|
|
2530
|
+
{
|
|
2531
|
+
type: "button",
|
|
2532
|
+
"aria-expanded": openFilter === index,
|
|
2533
|
+
"aria-label": `Filtrar ou ordenar por ${item.title}`,
|
|
2534
|
+
className: `flex w-full items-center gap-1.5 rounded-sm text-left focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${headerFocusClass} ${((_b2 = item.className) == null ? void 0 : _b2.includes("text-right")) ? "justify-end" : ""}`,
|
|
2535
|
+
onClick: () => handleHeaderAction(item, index),
|
|
2536
|
+
children: [
|
|
2537
|
+
/* @__PURE__ */ jsx33("span", { className: "min-w-0 truncate", children: item.title }),
|
|
2538
|
+
headerIcon && /* @__PURE__ */ jsx33("span", { className: "flex-shrink-0", "aria-hidden": "true", children: headerIcon })
|
|
2539
|
+
]
|
|
2540
|
+
}
|
|
2541
|
+
) : /* @__PURE__ */ jsx33(
|
|
2542
|
+
"span",
|
|
2543
|
+
{
|
|
2544
|
+
className: `flex items-center gap-1.5 ${((_c = item.className) == null ? void 0 : _c.includes("text-right")) ? "justify-end" : ""}`,
|
|
2545
|
+
children: /* @__PURE__ */ jsx33("span", { className: "min-w-0 truncate", children: item.title })
|
|
2546
|
+
}
|
|
2547
|
+
)
|
|
2548
|
+
},
|
|
2549
|
+
index
|
|
2550
|
+
);
|
|
2551
|
+
}) }) }),
|
|
2552
|
+
children ? children : /* @__PURE__ */ jsx33("tbody", { children: /* @__PURE__ */ jsx33("tr", { children: /* @__PURE__ */ jsx33("td", { colSpan: header.length, children: /* @__PURE__ */ jsx33(NotFoundView_default, {}) }) }) })
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
)
|
|
2556
|
+
}
|
|
2557
|
+
),
|
|
2558
|
+
openFilter !== null && filterCoords && ((_b = header[openFilter]) == null ? void 0 : _b.filters) && /* @__PURE__ */ jsx33("div", { ref: filterRef, className: "absolute z-popover", children: /* @__PURE__ */ jsx33(
|
|
2559
|
+
Filter_default,
|
|
2560
|
+
{
|
|
2561
|
+
optionChecked: header[openFilter].filters.optionChecked,
|
|
2562
|
+
optionList: header[openFilter].filters.optionList,
|
|
2563
|
+
controls: header[openFilter].filters.controls,
|
|
2564
|
+
onChange: (value) => handleFilterChange(header[openFilter], value),
|
|
2565
|
+
onControlChange: (control, value) => handleFilterChange(header[openFilter], value, control),
|
|
2566
|
+
maxHeight: filterMaxHeight
|
|
2567
|
+
}
|
|
2568
|
+
) }),
|
|
2569
|
+
showPagination && pagination && /* @__PURE__ */ jsxs18("div", { className: "flex flex-col tablet:flex-row items-end tablet:items-center justify-between mt-6 gap-2 tablet:gap-4", children: [
|
|
2570
|
+
/* @__PURE__ */ jsxs18(
|
|
2571
|
+
"p",
|
|
2572
|
+
{
|
|
2573
|
+
role: "status",
|
|
2574
|
+
"aria-live": "polite",
|
|
2575
|
+
"aria-atomic": "true",
|
|
2576
|
+
className: "text-sm text-content-primary",
|
|
2577
|
+
children: [
|
|
2578
|
+
"Visualizando de ",
|
|
2579
|
+
pagination.startItem,
|
|
2580
|
+
" at\xE9 ",
|
|
2581
|
+
pagination.endItem,
|
|
2582
|
+
" de",
|
|
2583
|
+
" ",
|
|
2584
|
+
pagination.totalItems,
|
|
2585
|
+
" resultados"
|
|
2586
|
+
]
|
|
2587
|
+
}
|
|
2588
|
+
),
|
|
2589
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
|
|
2590
|
+
/* @__PURE__ */ jsxs18(
|
|
2591
|
+
"button",
|
|
2592
|
+
{
|
|
2593
|
+
type: "button",
|
|
2594
|
+
onClick: pagination.onPrevious,
|
|
2595
|
+
disabled: pagination.currentPage === 1,
|
|
2596
|
+
"aria-label": "Ir para a p\xE1gina anterior",
|
|
2597
|
+
className: `inline-flex h-6 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 tablet:h-7 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
|
|
2598
|
+
children: [
|
|
2599
|
+
/* @__PURE__ */ jsx33(MdKeyboardArrowLeft, { className: "h-3 w-3 text-content-muted" }),
|
|
2600
|
+
paginationVariant !== "arrows" && "Anterior"
|
|
2601
|
+
]
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ jsx33(
|
|
2605
|
+
"div",
|
|
2606
|
+
{
|
|
2607
|
+
"aria-live": "polite",
|
|
2608
|
+
"aria-atomic": "true",
|
|
2609
|
+
className: "inline-flex h-6 min-w-6 items-center justify-center rounded border border-selection-border bg-selection-background px-1.5 text-sm font-bold leading-none text-selection-content tablet:h-7 tablet:min-w-7",
|
|
2610
|
+
children: pagination.currentPage
|
|
2611
|
+
}
|
|
2612
|
+
),
|
|
2613
|
+
/* @__PURE__ */ jsxs18(
|
|
2614
|
+
"button",
|
|
2615
|
+
{
|
|
2616
|
+
type: "button",
|
|
2617
|
+
onClick: pagination.onNext,
|
|
2618
|
+
disabled: pagination.currentPage === pagination.totalPages,
|
|
2619
|
+
"aria-label": "Ir para a pr\xF3xima p\xE1gina",
|
|
2620
|
+
className: `inline-flex h-6 items-center justify-center gap-1 rounded border border-border-default px-2 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:border-border-default disabled:opacity-50 tablet:h-7 ${paginationVariant === "arrows" ? "min-w-6 tablet:min-w-7" : ""}`,
|
|
2621
|
+
children: [
|
|
2622
|
+
paginationVariant !== "arrows" && "Pr\xF3xima",
|
|
2623
|
+
/* @__PURE__ */ jsx33(MdKeyboardArrowRight, { className: "h-3 w-3 text-content-muted" })
|
|
2624
|
+
]
|
|
2625
|
+
}
|
|
2626
|
+
)
|
|
2627
|
+
] })
|
|
2628
|
+
] })
|
|
2629
|
+
]
|
|
2630
|
+
}
|
|
2631
|
+
);
|
|
2632
|
+
}
|
|
2633
|
+
var TableView_default = TableView;
|
|
2634
|
+
|
|
2635
|
+
// src/components/table/Table.tsx
|
|
2636
|
+
import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2637
|
+
function Table(props) {
|
|
2638
|
+
var _a;
|
|
2639
|
+
const {
|
|
2640
|
+
children,
|
|
2641
|
+
header,
|
|
2642
|
+
accessibleName,
|
|
2643
|
+
caption,
|
|
2644
|
+
className,
|
|
2645
|
+
onFilterChange,
|
|
2646
|
+
showPagination = false,
|
|
2647
|
+
pagination,
|
|
2648
|
+
data,
|
|
2649
|
+
itemsPerPage = 10,
|
|
2650
|
+
emptyMessage = "Nenhum item encontrado",
|
|
2651
|
+
totalWidthUnits,
|
|
2652
|
+
showRowDivider = false,
|
|
2653
|
+
enableRowHover = false,
|
|
2654
|
+
paginationVariant = "default",
|
|
2655
|
+
expandable,
|
|
2656
|
+
overflowMode,
|
|
2657
|
+
adaptiveBreakpoint,
|
|
2658
|
+
stickyHeader = false,
|
|
2659
|
+
scrollAreaMaxHeight,
|
|
2660
|
+
rowVariant = "plain",
|
|
2661
|
+
headerVariant = "default",
|
|
2662
|
+
density = "comfortable"
|
|
2663
|
+
} = props;
|
|
2664
|
+
const breakpoint = useBreakpoint();
|
|
2665
|
+
const tableId = useId2();
|
|
2666
|
+
const isMobile = breakpoint === "mobile";
|
|
2667
|
+
const resolvedOverflowMode = overflowMode != null ? overflowMode : data ? "adaptive" : "scroll";
|
|
2668
|
+
const resolvedAdaptiveBreakpoint = adaptiveBreakpoint != null ? adaptiveBreakpoint : Math.min(920, 320 + Math.max(header.length - 2, 0) * 120);
|
|
2669
|
+
const [currentPage, setCurrentPage] = useState4(1);
|
|
2670
|
+
const [filterValues, setFilterValues] = useState4({});
|
|
2671
|
+
const [visibleExpandedRowId, setVisibleExpandedRowId] = useState4(
|
|
2672
|
+
() => (expandable == null ? void 0 : expandable.expandedRowId) !== null && (expandable == null ? void 0 : expandable.expandedRowId) !== void 0 ? String(expandable.expandedRowId) : null
|
|
2673
|
+
);
|
|
2674
|
+
const [closingExpandedRowId, setClosingExpandedRowId] = useState4(null);
|
|
2675
|
+
const normalizedHeader = useMemo2(() => {
|
|
2676
|
+
return header.map((item) => {
|
|
2677
|
+
const typedItem = item;
|
|
2678
|
+
return __spreadProps(__spreadValues({}, typedItem), {
|
|
2679
|
+
title: typedItem.title
|
|
2680
|
+
});
|
|
2681
|
+
});
|
|
2682
|
+
}, [header]);
|
|
2683
|
+
const controlledHeader = useMemo2(() => {
|
|
2684
|
+
if (!data) {
|
|
2685
|
+
return normalizedHeader;
|
|
2686
|
+
}
|
|
2687
|
+
return normalizedHeader.map((item, columnIndex) => {
|
|
2688
|
+
var _a2, _b;
|
|
2689
|
+
const controls = (_b = (_a2 = item.filters) == null ? void 0 : _a2.controls) == null ? void 0 : _b.map((control) => {
|
|
2690
|
+
var _a3, _b2;
|
|
2691
|
+
return __spreadProps(__spreadValues({}, control), {
|
|
2692
|
+
value: (_b2 = (_a3 = filterValues[`${item.key}-${control.id}`]) != null ? _a3 : control.value) != null ? _b2 : control.type === "search" ? "" : "__all__"
|
|
2693
|
+
});
|
|
2694
|
+
});
|
|
2695
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
2696
|
+
filters: (controls == null ? void 0 : controls.length) ? {
|
|
2697
|
+
controls
|
|
2698
|
+
} : void 0
|
|
2699
|
+
});
|
|
2700
|
+
});
|
|
2701
|
+
}, [data, filterValues, normalizedHeader]);
|
|
2702
|
+
const filteredAndSortedData = useMemo2(() => {
|
|
2703
|
+
if (!data) return [];
|
|
2704
|
+
let result = [...data];
|
|
2705
|
+
const sorters = [];
|
|
2706
|
+
normalizedHeader.forEach((column) => {
|
|
2707
|
+
var _a2, _b;
|
|
2708
|
+
const controls = (_b = (_a2 = column.filters) == null ? void 0 : _a2.controls) != null ? _b : [];
|
|
2709
|
+
controls.forEach((control) => {
|
|
2710
|
+
var _a3, _b2;
|
|
2711
|
+
const stateKey = `${column.key}-${control.id}`;
|
|
2712
|
+
const value = (_b2 = (_a3 = filterValues[stateKey]) != null ? _a3 : control.value) != null ? _b2 : control.type === "search" ? "" : "__all__";
|
|
2713
|
+
if (!value || value === "__all__") {
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
if (control.type === "options") {
|
|
2717
|
+
result = result.filter((item) => {
|
|
2718
|
+
var _a4, _b3, _c, _d;
|
|
2719
|
+
if ((_a4 = column.filters) == null ? void 0 : _a4.matchOption) {
|
|
2720
|
+
return column.filters.matchOption(item, value, control);
|
|
2721
|
+
}
|
|
2722
|
+
const resolvedValue = (_d = (_b3 = column.filterAccessor) == null ? void 0 : _b3.call(column, item)) != null ? _d : (_c = column.accessor) == null ? void 0 : _c.call(column, item);
|
|
2723
|
+
return String(resolvedValue != null ? resolvedValue : "") === value;
|
|
2724
|
+
});
|
|
2725
|
+
return;
|
|
2726
|
+
}
|
|
2727
|
+
if (control.type === "search") {
|
|
2728
|
+
const normalizedSearch = value.toLowerCase().trim();
|
|
2729
|
+
result = result.filter((item) => {
|
|
2730
|
+
var _a4, _b3, _c, _d, _e, _f, _g;
|
|
2731
|
+
if ((_a4 = column.filters) == null ? void 0 : _a4.matchSearch) {
|
|
2732
|
+
return column.filters.matchSearch(item, value, control);
|
|
2733
|
+
}
|
|
2734
|
+
const searchableValue = (_g = (_b3 = column.searchAccessor) == null ? void 0 : _b3.call(column, item)) != null ? _g : String(
|
|
2735
|
+
(_f = (_e = (_c = column.filterAccessor) == null ? void 0 : _c.call(column, item)) != null ? _e : (_d = column.accessor) == null ? void 0 : _d.call(column, item)) != null ? _f : ""
|
|
2736
|
+
);
|
|
2737
|
+
return searchableValue.toLowerCase().includes(normalizedSearch);
|
|
2738
|
+
});
|
|
2739
|
+
return;
|
|
2740
|
+
}
|
|
2741
|
+
if (control.type === "sort") {
|
|
2742
|
+
sorters.push((a, b) => {
|
|
2743
|
+
var _a4, _b3, _c, _d, _e, _f, _g;
|
|
2744
|
+
if ((_a4 = column.filters) == null ? void 0 : _a4.compare) {
|
|
2745
|
+
return column.filters.compare(a, b, value, control);
|
|
2746
|
+
}
|
|
2747
|
+
const valueA = (_d = (_b3 = column.sortAccessor) == null ? void 0 : _b3.call(column, a)) != null ? _d : (_c = column.accessor) == null ? void 0 : _c.call(column, a);
|
|
2748
|
+
const valueB = (_g = (_e = column.sortAccessor) == null ? void 0 : _e.call(column, b)) != null ? _g : (_f = column.accessor) == null ? void 0 : _f.call(column, b);
|
|
2749
|
+
if (typeof valueA === "number" && typeof valueB === "number") {
|
|
2750
|
+
return value === "desc" ? valueB - valueA : valueA - valueB;
|
|
2751
|
+
}
|
|
2752
|
+
const stringA = String(valueA != null ? valueA : "");
|
|
2753
|
+
const stringB = String(valueB != null ? valueB : "");
|
|
2754
|
+
return value === "desc" ? stringB.localeCompare(stringA) : stringA.localeCompare(stringB);
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
});
|
|
2758
|
+
});
|
|
2759
|
+
if (!sorters.length) {
|
|
2760
|
+
return result;
|
|
2761
|
+
}
|
|
2762
|
+
return [...result].sort((a, b) => {
|
|
2763
|
+
for (const sorter of sorters) {
|
|
2764
|
+
const comparison = sorter(a, b);
|
|
2765
|
+
if (comparison !== 0) {
|
|
2766
|
+
return comparison;
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
return 0;
|
|
2770
|
+
});
|
|
2771
|
+
}, [data, filterValues, normalizedHeader]);
|
|
2772
|
+
useEffect8(() => {
|
|
2773
|
+
setCurrentPage(1);
|
|
2774
|
+
}, [filterValues]);
|
|
2775
|
+
useEffect8(() => {
|
|
2776
|
+
if (!expandable) {
|
|
2777
|
+
setVisibleExpandedRowId(null);
|
|
2778
|
+
setClosingExpandedRowId(null);
|
|
2779
|
+
return;
|
|
2780
|
+
}
|
|
2781
|
+
const nextExpandedRowId = expandable.expandedRowId !== null && expandable.expandedRowId !== void 0 ? String(expandable.expandedRowId) : null;
|
|
2782
|
+
if (nextExpandedRowId) {
|
|
2783
|
+
setVisibleExpandedRowId(nextExpandedRowId);
|
|
2784
|
+
setClosingExpandedRowId(null);
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
if (!visibleExpandedRowId) {
|
|
2788
|
+
return;
|
|
2789
|
+
}
|
|
2790
|
+
setClosingExpandedRowId(visibleExpandedRowId);
|
|
2791
|
+
const timeoutId = window.setTimeout(() => {
|
|
2792
|
+
setVisibleExpandedRowId(null);
|
|
2793
|
+
setClosingExpandedRowId(null);
|
|
2794
|
+
}, 220);
|
|
2795
|
+
return () => window.clearTimeout(timeoutId);
|
|
2796
|
+
}, [expandable, visibleExpandedRowId]);
|
|
2797
|
+
const internalPagination = useMemo2(() => {
|
|
2798
|
+
if (!data) return null;
|
|
2799
|
+
const totalItems = filteredAndSortedData.length;
|
|
2800
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / itemsPerPage));
|
|
2801
|
+
const safeCurrentPage = Math.min(currentPage, totalPages);
|
|
2802
|
+
const startIndex = (safeCurrentPage - 1) * itemsPerPage;
|
|
2803
|
+
const endIndex = startIndex + itemsPerPage;
|
|
2804
|
+
return {
|
|
2805
|
+
currentPage: safeCurrentPage,
|
|
2806
|
+
totalPages,
|
|
2807
|
+
totalItems,
|
|
2808
|
+
startItem: totalItems === 0 ? 0 : startIndex + 1,
|
|
2809
|
+
endItem: Math.min(endIndex, totalItems),
|
|
2810
|
+
pageData: filteredAndSortedData.slice(startIndex, endIndex)
|
|
2811
|
+
};
|
|
2812
|
+
}, [currentPage, data, filteredAndSortedData, itemsPerPage]);
|
|
2813
|
+
const managedCellClassName = density === "compact" ? "px-3 py-1.5 text-sm text-content-primary" : "px-4 py-2 text-sm text-content-primary";
|
|
2814
|
+
const expandedContentClassName = density === "compact" ? "bg-surface-card px-3 py-3" : "bg-surface-card px-4 py-4";
|
|
2815
|
+
const emptyCellClassName = density === "compact" ? "px-3 py-4 text-center text-sm text-content-muted" : "px-4 py-6 text-center text-sm text-content-muted";
|
|
2816
|
+
const renderedChildren = useMemo2(() => {
|
|
2817
|
+
if (!data || !internalPagination) {
|
|
2818
|
+
return children;
|
|
2819
|
+
}
|
|
2820
|
+
return /* @__PURE__ */ jsxs19("tbody", { "data-managed-rows": "true", children: [
|
|
2821
|
+
internalPagination.pageData.map(
|
|
2822
|
+
(item, index) => (() => {
|
|
2823
|
+
var _a2, _b, _c;
|
|
2824
|
+
const rowId = expandable == null ? void 0 : expandable.getRowId(item, index);
|
|
2825
|
+
const normalizedRowId = rowId !== void 0 ? String(rowId) : void 0;
|
|
2826
|
+
const isExpanded = normalizedRowId !== void 0 && (expandable == null ? void 0 : expandable.expandedRowId) !== null && (expandable == null ? void 0 : expandable.expandedRowId) !== void 0 && String(expandable.expandedRowId) === normalizedRowId;
|
|
2827
|
+
const isVisibleExpandedRow = normalizedRowId !== void 0 && visibleExpandedRowId === normalizedRowId;
|
|
2828
|
+
const isClosingExpandedRow = normalizedRowId !== void 0 && closingExpandedRowId === normalizedRowId;
|
|
2829
|
+
const rowNumber = internalPagination.startItem + index;
|
|
2830
|
+
const rowContentIds = normalizedHeader.map(
|
|
2831
|
+
(_, columnIndex) => `${tableId}-row-${rowNumber}-cell-${columnIndex + 1}`
|
|
2832
|
+
);
|
|
2833
|
+
const expandedContentId = `${tableId}-row-${rowNumber}-details-content`;
|
|
2834
|
+
return /* @__PURE__ */ jsxs19(
|
|
2835
|
+
React4.Fragment,
|
|
2836
|
+
{
|
|
2837
|
+
children: [
|
|
2838
|
+
/* @__PURE__ */ jsx34(
|
|
2839
|
+
"tr",
|
|
2840
|
+
{
|
|
2841
|
+
tabIndex: 0,
|
|
2842
|
+
"aria-label": `Linha ${rowNumber} de ${internalPagination.totalItems}`,
|
|
2843
|
+
"aria-describedby": rowContentIds.join(" "),
|
|
2844
|
+
"data-table-row-stripe": rowVariant === "striped" && index % 2 === 1 && !isExpanded ? "true" : void 0,
|
|
2845
|
+
className: [
|
|
2846
|
+
"focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-focus-ring",
|
|
2847
|
+
showRowDivider ? "border-b border-border-default" : "",
|
|
2848
|
+
enableRowHover ? "hover:bg-primary-5" : "",
|
|
2849
|
+
(_b = (_a2 = expandable == null ? void 0 : expandable.rowClassName) == null ? void 0 : _a2.call(expandable, item, Boolean(isExpanded))) != null ? _b : ""
|
|
2850
|
+
].filter(Boolean).join(" "),
|
|
2851
|
+
children: normalizedHeader.map((column, columnIndex) => {
|
|
2852
|
+
var _a3, _b2, _c2;
|
|
2853
|
+
return /* @__PURE__ */ jsx34(
|
|
2854
|
+
"td",
|
|
2855
|
+
{
|
|
2856
|
+
id: rowContentIds[columnIndex],
|
|
2857
|
+
"data-label": column.title,
|
|
2858
|
+
className: (_a3 = column.cellClassName) != null ? _a3 : managedCellClassName,
|
|
2859
|
+
children: column.renderCell ? column.renderCell(item, index) : String((_c2 = (_b2 = column.accessor) == null ? void 0 : _b2.call(column, item)) != null ? _c2 : "-")
|
|
2860
|
+
},
|
|
2861
|
+
column.key
|
|
2862
|
+
);
|
|
2863
|
+
})
|
|
2864
|
+
}
|
|
2865
|
+
),
|
|
2866
|
+
isVisibleExpandedRow && expandable && /* @__PURE__ */ jsx34("tr", { className: expandable == null ? void 0 : expandable.expandedRowClassName, children: /* @__PURE__ */ jsx34(
|
|
2867
|
+
"td",
|
|
2868
|
+
{
|
|
2869
|
+
colSpan: normalizedHeader.length,
|
|
2870
|
+
className: (_c = expandable == null ? void 0 : expandable.expandedContentClassName) != null ? _c : expandedContentClassName,
|
|
2871
|
+
children: /* @__PURE__ */ jsx34(
|
|
2872
|
+
"div",
|
|
2873
|
+
{
|
|
2874
|
+
role: "region",
|
|
2875
|
+
tabIndex: isExpanded && !isClosingExpandedRow ? 0 : -1,
|
|
2876
|
+
"aria-label": `Detalhes da linha ${rowNumber}`,
|
|
2877
|
+
"aria-describedby": expandedContentId,
|
|
2878
|
+
"aria-hidden": !isExpanded || isClosingExpandedRow || void 0,
|
|
2879
|
+
className: `overflow-hidden transition-all duration-200 ease-out ${isExpanded && !isClosingExpandedRow ? "max-h-[1200px] opacity-100" : "max-h-0 opacity-0"}`,
|
|
2880
|
+
children: /* @__PURE__ */ jsx34("div", { id: expandedContentId, children: expandable.renderExpandedRow(item, index) })
|
|
2881
|
+
}
|
|
2882
|
+
)
|
|
2883
|
+
}
|
|
2884
|
+
) })
|
|
2885
|
+
]
|
|
2886
|
+
},
|
|
2887
|
+
`row-group-${normalizedRowId != null ? normalizedRowId : `${index}-${JSON.stringify(item)}`}`
|
|
2888
|
+
);
|
|
2889
|
+
})()
|
|
2890
|
+
),
|
|
2891
|
+
internalPagination.pageData.length === 0 && /* @__PURE__ */ jsx34("tr", { children: /* @__PURE__ */ jsx34(
|
|
2892
|
+
"td",
|
|
2893
|
+
{
|
|
2894
|
+
colSpan: normalizedHeader.length,
|
|
2895
|
+
className: emptyCellClassName,
|
|
2896
|
+
children: emptyMessage
|
|
2897
|
+
}
|
|
2898
|
+
) })
|
|
2899
|
+
] });
|
|
2900
|
+
}, [
|
|
2901
|
+
children,
|
|
2902
|
+
data,
|
|
2903
|
+
emptyMessage,
|
|
2904
|
+
emptyCellClassName,
|
|
2905
|
+
enableRowHover,
|
|
2906
|
+
expandable,
|
|
2907
|
+
expandedContentClassName,
|
|
2908
|
+
internalPagination,
|
|
2909
|
+
managedCellClassName,
|
|
2910
|
+
normalizedHeader,
|
|
2911
|
+
rowVariant,
|
|
2912
|
+
showRowDivider,
|
|
2913
|
+
tableId,
|
|
2914
|
+
visibleExpandedRowId,
|
|
2915
|
+
closingExpandedRowId
|
|
2916
|
+
]);
|
|
2917
|
+
const resolvedPagination = data ? internalPagination && {
|
|
2918
|
+
currentPage: internalPagination.currentPage,
|
|
2919
|
+
totalPages: internalPagination.totalPages,
|
|
2920
|
+
totalItems: internalPagination.totalItems,
|
|
2921
|
+
startItem: internalPagination.startItem,
|
|
2922
|
+
endItem: internalPagination.endItem,
|
|
2923
|
+
variant: isMobile ? "arrows" : paginationVariant,
|
|
2924
|
+
onPrevious: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
|
|
2925
|
+
onNext: () => setCurrentPage(
|
|
2926
|
+
(prev) => Math.min(prev + 1, internalPagination.totalPages)
|
|
2927
|
+
)
|
|
2928
|
+
} : pagination ? __spreadProps(__spreadValues({}, pagination), {
|
|
2929
|
+
variant: isMobile ? "arrows" : (_a = pagination.variant) != null ? _a : "default"
|
|
2930
|
+
}) : pagination;
|
|
2931
|
+
const resolvedShowPagination = data ? Boolean(
|
|
2932
|
+
internalPagination && internalPagination.totalItems > itemsPerPage
|
|
2933
|
+
) : showPagination;
|
|
2934
|
+
const handleInternalFilterChange = (columnKey, controlId, value) => {
|
|
2935
|
+
setFilterValues((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2936
|
+
[`${columnKey}-${controlId}`]: value
|
|
2937
|
+
}));
|
|
2938
|
+
};
|
|
2939
|
+
const resolvedHeader = data ? controlledHeader.map((item) => {
|
|
2940
|
+
var _a2, _b;
|
|
2941
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
2942
|
+
filters: ((_b = (_a2 = item.filters) == null ? void 0 : _a2.controls) == null ? void 0 : _b.length) ? {
|
|
2943
|
+
controls: item.filters.controls,
|
|
2944
|
+
onControlChange: (control, value) => {
|
|
2945
|
+
var _a3;
|
|
2946
|
+
return handleInternalFilterChange(
|
|
2947
|
+
(_a3 = item.key) != null ? _a3 : item.title,
|
|
2948
|
+
control.id,
|
|
2949
|
+
value
|
|
2950
|
+
);
|
|
2951
|
+
}
|
|
2952
|
+
} : void 0
|
|
2953
|
+
});
|
|
2954
|
+
}) : controlledHeader;
|
|
2955
|
+
return /* @__PURE__ */ jsx34(
|
|
2956
|
+
TableView_default,
|
|
2957
|
+
{
|
|
2958
|
+
header: resolvedHeader,
|
|
2959
|
+
accessibleName,
|
|
2960
|
+
caption,
|
|
2961
|
+
onFilterChange,
|
|
2962
|
+
className,
|
|
2963
|
+
showPagination: resolvedShowPagination,
|
|
2964
|
+
pagination: resolvedPagination != null ? resolvedPagination : void 0,
|
|
2965
|
+
totalWidthUnits,
|
|
2966
|
+
overflowMode: resolvedOverflowMode,
|
|
2967
|
+
adaptiveBreakpoint: resolvedAdaptiveBreakpoint,
|
|
2968
|
+
stickyHeader,
|
|
2969
|
+
scrollAreaMaxHeight,
|
|
2970
|
+
rowVariant,
|
|
2971
|
+
headerVariant,
|
|
2972
|
+
density,
|
|
2973
|
+
children: renderedChildren
|
|
2974
|
+
}
|
|
2975
|
+
);
|
|
2976
|
+
}
|
|
2977
|
+
var Table_default = Table;
|
|
2978
|
+
|
|
2979
|
+
// src/components/table/MobileCardTable.tsx
|
|
2980
|
+
import { useEffect as useEffect9, useId as useId3, useMemo as useMemo3, useState as useState5 } from "react";
|
|
2981
|
+
import { MdKeyboardArrowLeft as MdKeyboardArrowLeft2, MdKeyboardArrowRight as MdKeyboardArrowRight2 } from "react-icons/md";
|
|
2982
|
+
import { Fragment as Fragment4, jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2983
|
+
function MobileCardTable({
|
|
2984
|
+
headers,
|
|
2985
|
+
accessibleName,
|
|
2986
|
+
data,
|
|
2987
|
+
renderCard,
|
|
2988
|
+
keyExtractor,
|
|
2989
|
+
itemsPerPage = 10,
|
|
2990
|
+
emptyMessage = "Nenhum item encontrado.",
|
|
2991
|
+
wrapperClassName = "",
|
|
2992
|
+
headerClassName = "",
|
|
2993
|
+
emptyClassName = "",
|
|
2994
|
+
showPagination = true,
|
|
2995
|
+
expandable
|
|
2996
|
+
}) {
|
|
2997
|
+
const listId = useId3();
|
|
2998
|
+
const [currentPage, setCurrentPage] = useState5(1);
|
|
2999
|
+
const [visibleExpandedRowId, setVisibleExpandedRowId] = useState5(
|
|
3000
|
+
() => (expandable == null ? void 0 : expandable.expandedRowId) !== null && (expandable == null ? void 0 : expandable.expandedRowId) !== void 0 ? String(expandable.expandedRowId) : null
|
|
3001
|
+
);
|
|
3002
|
+
const [closingExpandedRowId, setClosingExpandedRowId] = useState5(
|
|
3003
|
+
null
|
|
3004
|
+
);
|
|
3005
|
+
const normalizedData = useMemo3(
|
|
3006
|
+
() => Array.isArray(data) ? data : [],
|
|
3007
|
+
[data]
|
|
3008
|
+
);
|
|
3009
|
+
const pagination = useMemo3(() => {
|
|
3010
|
+
const totalItems = normalizedData.length;
|
|
3011
|
+
const totalPages = Math.max(1, Math.ceil(totalItems / itemsPerPage));
|
|
3012
|
+
const safeCurrentPage = Math.min(currentPage, totalPages);
|
|
3013
|
+
const startIndex = (safeCurrentPage - 1) * itemsPerPage;
|
|
3014
|
+
const endIndex = startIndex + itemsPerPage;
|
|
3015
|
+
return {
|
|
3016
|
+
currentPage: safeCurrentPage,
|
|
3017
|
+
totalPages,
|
|
3018
|
+
totalItems,
|
|
3019
|
+
startItem: totalItems === 0 ? 0 : startIndex + 1,
|
|
3020
|
+
endItem: Math.min(endIndex, totalItems),
|
|
3021
|
+
pageData: normalizedData.slice(startIndex, endIndex)
|
|
3022
|
+
};
|
|
3023
|
+
}, [currentPage, normalizedData, itemsPerPage]);
|
|
3024
|
+
useEffect9(() => {
|
|
3025
|
+
setCurrentPage(1);
|
|
3026
|
+
}, [normalizedData]);
|
|
3027
|
+
useEffect9(() => {
|
|
3028
|
+
if (!expandable) {
|
|
3029
|
+
setVisibleExpandedRowId(null);
|
|
3030
|
+
setClosingExpandedRowId(null);
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
const nextExpandedRowId = expandable.expandedRowId !== null && expandable.expandedRowId !== void 0 ? String(expandable.expandedRowId) : null;
|
|
3034
|
+
if (nextExpandedRowId) {
|
|
3035
|
+
setVisibleExpandedRowId(nextExpandedRowId);
|
|
3036
|
+
setClosingExpandedRowId(null);
|
|
3037
|
+
return;
|
|
3038
|
+
}
|
|
3039
|
+
if (!visibleExpandedRowId) {
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
setClosingExpandedRowId(visibleExpandedRowId);
|
|
3043
|
+
const timeoutId = window.setTimeout(() => {
|
|
3044
|
+
setVisibleExpandedRowId(null);
|
|
3045
|
+
setClosingExpandedRowId(null);
|
|
3046
|
+
}, 220);
|
|
3047
|
+
return () => window.clearTimeout(timeoutId);
|
|
3048
|
+
}, [expandable, visibleExpandedRowId]);
|
|
3049
|
+
return /* @__PURE__ */ jsxs20(Fragment4, { children: [
|
|
3050
|
+
/* @__PURE__ */ jsxs20(
|
|
3051
|
+
"div",
|
|
3052
|
+
{
|
|
3053
|
+
role: "region",
|
|
3054
|
+
"aria-label": accessibleName != null ? accessibleName : `Lista: ${headers.map((header) => header.label).join(", ")}`,
|
|
3055
|
+
className: `overflow-hidden rounded-sm border border-border-default bg-surface-card ${wrapperClassName}`.trim(),
|
|
3056
|
+
children: [
|
|
3057
|
+
/* @__PURE__ */ jsx35(
|
|
3058
|
+
"div",
|
|
3059
|
+
{
|
|
3060
|
+
className: `border-b border-border-default bg-surface-card px-3 py-2 text-left text-xs font-bold tracking-wider text-content-secondary ${headerClassName}`.trim(),
|
|
3061
|
+
children: headers.map((header) => /* @__PURE__ */ jsx35("span", { className: header.className, children: header.label }, header.label))
|
|
3062
|
+
}
|
|
3063
|
+
),
|
|
3064
|
+
pagination.totalItems > 0 ? /* @__PURE__ */ jsx35("div", { role: "list", "aria-label": "Itens da lista", children: pagination.pageData.map((item, index) => (() => {
|
|
3065
|
+
var _a, _b;
|
|
3066
|
+
const rowId = expandable == null ? void 0 : expandable.getRowId(item, index);
|
|
3067
|
+
const normalizedRowId = rowId !== void 0 ? String(rowId) : void 0;
|
|
3068
|
+
const isExpanded = normalizedRowId !== void 0 && (expandable == null ? void 0 : expandable.expandedRowId) !== null && (expandable == null ? void 0 : expandable.expandedRowId) !== void 0 && String(expandable.expandedRowId) === normalizedRowId;
|
|
3069
|
+
const isVisibleExpandedRow = normalizedRowId !== void 0 && visibleExpandedRowId === normalizedRowId;
|
|
3070
|
+
const isClosingExpandedRow = normalizedRowId !== void 0 && closingExpandedRowId === normalizedRowId;
|
|
3071
|
+
const itemNumber = pagination.startItem + index;
|
|
3072
|
+
const cardContentId = `${listId}-item-${itemNumber}-content`;
|
|
3073
|
+
const expandedContentId = `${listId}-item-${itemNumber}-details-content`;
|
|
3074
|
+
return /* @__PURE__ */ jsxs20(
|
|
3075
|
+
"div",
|
|
3076
|
+
{
|
|
3077
|
+
role: "listitem",
|
|
3078
|
+
tabIndex: 0,
|
|
3079
|
+
"aria-label": `Item ${itemNumber} de ${pagination.totalItems}`,
|
|
3080
|
+
"aria-describedby": cardContentId,
|
|
3081
|
+
className: "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-focus-ring",
|
|
3082
|
+
children: [
|
|
3083
|
+
/* @__PURE__ */ jsx35(
|
|
3084
|
+
"div",
|
|
3085
|
+
{
|
|
3086
|
+
id: cardContentId,
|
|
3087
|
+
className: (_a = expandable == null ? void 0 : expandable.rowClassName) == null ? void 0 : _a.call(expandable, item, Boolean(isExpanded)),
|
|
3088
|
+
children: renderCard(item, index)
|
|
3089
|
+
}
|
|
3090
|
+
),
|
|
3091
|
+
expandable && isVisibleExpandedRow && /* @__PURE__ */ jsx35(
|
|
3092
|
+
"div",
|
|
3093
|
+
{
|
|
3094
|
+
className: (_b = expandable.expandedContentClassName) != null ? _b : "border-b border-border-default bg-surface-card px-3 py-4",
|
|
3095
|
+
children: /* @__PURE__ */ jsx35(
|
|
3096
|
+
"div",
|
|
3097
|
+
{
|
|
3098
|
+
role: "region",
|
|
3099
|
+
tabIndex: isExpanded && !isClosingExpandedRow ? 0 : -1,
|
|
3100
|
+
"aria-label": `Detalhes do item ${itemNumber}`,
|
|
3101
|
+
"aria-describedby": expandedContentId,
|
|
3102
|
+
"aria-hidden": !isExpanded || isClosingExpandedRow || void 0,
|
|
3103
|
+
className: `overflow-hidden transition-all duration-200 ease-out ${isExpanded && !isClosingExpandedRow ? "max-h-[1200px] opacity-100" : "max-h-0 opacity-0"}`,
|
|
3104
|
+
children: /* @__PURE__ */ jsx35("div", { id: expandedContentId, children: expandable.renderExpandedRow(item, index) })
|
|
3105
|
+
}
|
|
3106
|
+
)
|
|
3107
|
+
}
|
|
3108
|
+
)
|
|
3109
|
+
]
|
|
3110
|
+
},
|
|
3111
|
+
keyExtractor(item, index)
|
|
3112
|
+
);
|
|
3113
|
+
})()) }) : /* @__PURE__ */ jsx35(
|
|
3114
|
+
"div",
|
|
3115
|
+
{
|
|
3116
|
+
className: `px-3 py-4 text-center text-md text-content-secondary ${emptyClassName}`.trim(),
|
|
3117
|
+
children: emptyMessage
|
|
3118
|
+
}
|
|
3119
|
+
)
|
|
3120
|
+
]
|
|
3121
|
+
}
|
|
3122
|
+
),
|
|
3123
|
+
showPagination && pagination.totalItems > itemsPerPage && /* @__PURE__ */ jsxs20("div", { className: "mt-4 flex flex-col items-center justify-center gap-3 text-center", children: [
|
|
3124
|
+
/* @__PURE__ */ jsxs20(
|
|
3125
|
+
"p",
|
|
3126
|
+
{
|
|
3127
|
+
role: "status",
|
|
3128
|
+
"aria-live": "polite",
|
|
3129
|
+
"aria-atomic": "true",
|
|
3130
|
+
className: "text-sm text-content-primary",
|
|
3131
|
+
children: [
|
|
3132
|
+
"Visualizando de ",
|
|
3133
|
+
pagination.startItem,
|
|
3134
|
+
" at\xE9 ",
|
|
3135
|
+
pagination.endItem,
|
|
3136
|
+
" de",
|
|
3137
|
+
" ",
|
|
3138
|
+
pagination.totalItems,
|
|
3139
|
+
" resultados"
|
|
3140
|
+
]
|
|
3141
|
+
}
|
|
3142
|
+
),
|
|
3143
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center justify-center gap-2", children: [
|
|
3144
|
+
/* @__PURE__ */ jsxs20(
|
|
3145
|
+
"button",
|
|
3146
|
+
{
|
|
3147
|
+
type: "button",
|
|
3148
|
+
onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
|
|
3149
|
+
disabled: pagination.currentPage === 1,
|
|
3150
|
+
"aria-label": "Ir para a p\xE1gina anterior",
|
|
3151
|
+
className: "inline-flex h-7 items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50",
|
|
3152
|
+
children: [
|
|
3153
|
+
/* @__PURE__ */ jsx35(MdKeyboardArrowLeft2, { className: "h-3 w-3 text-content-muted" }),
|
|
3154
|
+
"Anterior"
|
|
3155
|
+
]
|
|
3156
|
+
}
|
|
3157
|
+
),
|
|
3158
|
+
/* @__PURE__ */ jsx35(
|
|
3159
|
+
"div",
|
|
3160
|
+
{
|
|
3161
|
+
"aria-live": "polite",
|
|
3162
|
+
"aria-atomic": "true",
|
|
3163
|
+
className: "inline-flex h-7 min-w-7 items-center justify-center rounded border border-selection-border bg-selection-background px-2 text-sm font-bold leading-none text-selection-content",
|
|
3164
|
+
children: pagination.currentPage
|
|
3165
|
+
}
|
|
3166
|
+
),
|
|
3167
|
+
/* @__PURE__ */ jsxs20(
|
|
3168
|
+
"button",
|
|
3169
|
+
{
|
|
3170
|
+
type: "button",
|
|
3171
|
+
onClick: () => setCurrentPage(
|
|
3172
|
+
(prev) => Math.min(prev + 1, pagination.totalPages)
|
|
3173
|
+
),
|
|
3174
|
+
disabled: pagination.currentPage === pagination.totalPages,
|
|
3175
|
+
"aria-label": "Ir para a pr\xF3xima p\xE1gina",
|
|
3176
|
+
className: "inline-flex h-7 items-center justify-center gap-1 rounded border border-border-default px-3 text-sm leading-none text-content-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-50",
|
|
3177
|
+
children: [
|
|
3178
|
+
"Pr\xF3ximo",
|
|
3179
|
+
/* @__PURE__ */ jsx35(MdKeyboardArrowRight2, { className: "h-3 w-3 text-content-muted" })
|
|
3180
|
+
]
|
|
3181
|
+
}
|
|
3182
|
+
)
|
|
3183
|
+
] })
|
|
3184
|
+
] })
|
|
3185
|
+
] });
|
|
3186
|
+
}
|
|
3187
|
+
var MobileCardTable_default = MobileCardTable;
|
|
3188
|
+
|
|
3189
|
+
export {
|
|
3190
|
+
LoadingDotsView_default,
|
|
3191
|
+
Button_default,
|
|
3192
|
+
Typography,
|
|
3193
|
+
typography_default,
|
|
3194
|
+
Divider_default,
|
|
3195
|
+
Surface,
|
|
3196
|
+
ModalCardView_default,
|
|
3197
|
+
NoticeView_default,
|
|
3198
|
+
PageState,
|
|
3199
|
+
Avatar_default,
|
|
3200
|
+
ThemedImage,
|
|
3201
|
+
IconProvider,
|
|
3202
|
+
CircularLoading,
|
|
3203
|
+
TextGroup,
|
|
3204
|
+
PaginationView_default,
|
|
3205
|
+
Checkbox,
|
|
3206
|
+
CheckBox,
|
|
3207
|
+
Slider_default,
|
|
3208
|
+
InputSliderView_default,
|
|
3209
|
+
FormActions,
|
|
3210
|
+
FormGrid,
|
|
3211
|
+
PageHeading,
|
|
3212
|
+
PageTabsHeader,
|
|
3213
|
+
InfoGrid,
|
|
3214
|
+
InfoItem,
|
|
3215
|
+
FilterBar,
|
|
3216
|
+
StatusBadge,
|
|
3217
|
+
getStatusBadgeClassName,
|
|
3218
|
+
DomainStatusBadge,
|
|
3219
|
+
SkipLink,
|
|
3220
|
+
FocusNavigationMode,
|
|
3221
|
+
findFirstInvalidField,
|
|
3222
|
+
FormErrorNavigation,
|
|
3223
|
+
Table_default,
|
|
3224
|
+
MobileCardTable_default
|
|
3225
|
+
};
|
|
3226
|
+
//# sourceMappingURL=chunk-OPUUOVCL.js.map
|