@treeal/ds 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/style.css +1 -1
- package/dist/components/Select/Select.d.ts +24 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/index.d.ts.map +1 -0
- package/dist/components/Tab/Tab.d.ts +22 -0
- package/dist/components/Tab/Tab.d.ts.map +1 -0
- package/dist/components/Tab/index.d.ts +3 -0
- package/dist/components/Tab/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs10.js +1 -1
- package/dist/index.cjs10.js.map +1 -1
- package/dist/index.cjs11.js +1 -1
- package/dist/index.cjs11.js.map +1 -1
- package/dist/index.cjs12.js +1 -1
- package/dist/index.cjs12.js.map +1 -1
- package/dist/index.cjs13.js +1 -1
- package/dist/index.cjs13.js.map +1 -1
- package/dist/index.cjs14.js +1 -1
- package/dist/index.cjs14.js.map +1 -1
- package/dist/index.cjs15.js +1 -1
- package/dist/index.cjs15.js.map +1 -1
- package/dist/index.cjs16.js +1 -1
- package/dist/index.cjs16.js.map +1 -1
- package/dist/index.cjs17.js +1 -1
- package/dist/index.cjs18.js +1 -1
- package/dist/index.cjs19.js +1 -1
- package/dist/index.cjs20.js +1 -1
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs23.js +1 -1
- package/dist/index.cjs24.js +2 -0
- package/dist/index.cjs24.js.map +1 -0
- package/dist/index.cjs25.js +2 -0
- package/dist/index.cjs25.js.map +1 -0
- package/dist/index.cjs26.js +2 -0
- package/dist/index.cjs26.js.map +1 -0
- package/dist/index.cjs27.js +2 -0
- package/dist/index.cjs27.js.map +1 -0
- package/dist/index.cjs28.js +2 -0
- package/dist/index.cjs28.js.map +1 -0
- package/dist/index.cjs3.js +1 -1
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +1 -1
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +1 -1
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +1 -1
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +1 -1
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +1 -1
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.cjs9.js +1 -1
- package/dist/index.cjs9.js.map +1 -1
- package/dist/index.esm.js +29 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm10.js +66 -226
- package/dist/index.esm10.js.map +1 -1
- package/dist/index.esm11.js +221 -160
- package/dist/index.esm11.js.map +1 -1
- package/dist/index.esm12.js +157 -73
- package/dist/index.esm12.js.map +1 -1
- package/dist/index.esm13.js +54 -209
- package/dist/index.esm13.js.map +1 -1
- package/dist/index.esm14.js +90 -23
- package/dist/index.esm14.js.map +1 -1
- package/dist/index.esm15.js +35 -31
- package/dist/index.esm15.js.map +1 -1
- package/dist/index.esm16.js +219 -61
- package/dist/index.esm16.js.map +1 -1
- package/dist/index.esm17.js +38 -60
- package/dist/index.esm17.js.map +1 -1
- package/dist/index.esm18.js +22 -38
- package/dist/index.esm18.js.map +1 -1
- package/dist/index.esm19.js +102 -22
- package/dist/index.esm19.js.map +1 -1
- package/dist/index.esm20.js +22 -20
- package/dist/index.esm20.js.map +1 -1
- package/dist/index.esm21.js +20 -48
- package/dist/index.esm21.js.map +1 -1
- package/dist/index.esm22.js +59 -21
- package/dist/index.esm22.js.map +1 -1
- package/dist/index.esm23.js +60 -102
- package/dist/index.esm23.js.map +1 -1
- package/dist/index.esm24.js +26 -0
- package/dist/index.esm24.js.map +1 -0
- package/dist/index.esm25.js +52 -0
- package/dist/index.esm25.js.map +1 -0
- package/dist/index.esm26.js +34 -0
- package/dist/index.esm26.js.map +1 -0
- package/dist/index.esm27.js +26 -0
- package/dist/index.esm27.js.map +1 -0
- package/dist/index.esm28.js +16 -0
- package/dist/index.esm28.js.map +1 -0
- package/dist/index.esm3.js +89 -53
- package/dist/index.esm3.js.map +1 -1
- package/dist/index.esm4.js +58 -111
- package/dist/index.esm4.js.map +1 -1
- package/dist/index.esm5.js +106 -60
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.esm6.js +60 -28
- package/dist/index.esm6.js.map +1 -1
- package/dist/index.esm7.js +26 -171
- package/dist/index.esm7.js.map +1 -1
- package/dist/index.esm8.js +167 -54
- package/dist/index.esm8.js.map +1 -1
- package/dist/index.esm9.js +62 -71
- package/dist/index.esm9.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.cjs2.js +0 -2
- package/dist/index.cjs2.js.map +0 -1
- package/dist/index.esm2.js +0 -98
- package/dist/index.esm2.js.map +0 -1
package/dist/index.esm4.js
CHANGED
|
@@ -1,115 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const a = {
|
|
2
|
+
fontFamily: {
|
|
3
|
+
/** Clash Grotesk Variable — buttons, inputs, labels */
|
|
4
|
+
base: "'Clash Grotesk Variable', sans-serif",
|
|
5
|
+
/** Inter — FileUpload text (Paragraph/SM and Paragraph/XS) */
|
|
6
|
+
inter: "'Inter', sans-serif",
|
|
7
|
+
/** Roboto — Pagination numbers and controls */
|
|
8
|
+
roboto: "'Roboto', sans-serif",
|
|
9
|
+
/** Clash Display Variable — Steps step number (Headings/H4 · 21px) */
|
|
10
|
+
clashDisplay: "'Clash Display Variable', sans-serif",
|
|
11
|
+
/** @deprecated use fontFamily.base */
|
|
12
|
+
button: "'Clash Grotesk Variable', sans-serif"
|
|
13
|
+
},
|
|
14
|
+
fontWeight: {
|
|
15
|
+
regular: 400,
|
|
16
|
+
semibold: 600
|
|
17
|
+
},
|
|
18
|
+
fontSize: {
|
|
19
|
+
/** 16px — Body Texts/Button & Body Texts/Text */
|
|
20
|
+
md: "1rem",
|
|
21
|
+
/** 14px — Body Texts/Label & Body Texts/Text Small */
|
|
22
|
+
sm: "0.875rem",
|
|
23
|
+
/** 12px — Paragraph/SM/Regular (Inter · FileUpload) */
|
|
24
|
+
bodySm: "0.75rem",
|
|
25
|
+
/** 10px — Paragraph/XS/Regular (Inter · FileUpload) */
|
|
26
|
+
bodyXs: "0.625rem",
|
|
27
|
+
/** 12px — Text/xs (Roboto · Pagination xs) */
|
|
28
|
+
paginationXs: "0.75rem",
|
|
29
|
+
/** 16px — Text/md (Roboto · Pagination md) */
|
|
30
|
+
paginationMd: "1rem",
|
|
31
|
+
/** 18px — Text/lg (Roboto · Pagination lg) */
|
|
32
|
+
paginationLg: "1.125rem",
|
|
33
|
+
/** @deprecated use fontSize.md */
|
|
34
|
+
button: "1rem"
|
|
35
|
+
},
|
|
36
|
+
lineHeight: {
|
|
37
|
+
/** 1.5 — Body Texts/Button */
|
|
38
|
+
button: 1.5,
|
|
39
|
+
/** 1.43 — Body Texts/Label (Semibold 14px) */
|
|
40
|
+
label: 1.43,
|
|
41
|
+
/** 1.30 — Body Texts/Text & Body Texts/Text Small */
|
|
42
|
+
text: 1.3,
|
|
43
|
+
/** 1.60 — Paragraph/SM/Regular & Paragraph/XS/Regular (Inter · FileUpload) */
|
|
44
|
+
body: 1.6,
|
|
45
|
+
/** 14px — Text/xs (Roboto · Pagination xs) */
|
|
46
|
+
paginationXs: "14px",
|
|
47
|
+
/** 18px — Text/md (Roboto · Pagination md) */
|
|
48
|
+
paginationMd: "18px",
|
|
49
|
+
/** 20px — Text/lg (Roboto · Pagination lg) */
|
|
50
|
+
paginationLg: "20px"
|
|
51
|
+
},
|
|
52
|
+
letterSpacing: {
|
|
53
|
+
/** 0 — all tokens */
|
|
54
|
+
none: 0,
|
|
55
|
+
/** @deprecated use letterSpacing.none */
|
|
56
|
+
button: 0
|
|
57
|
+
}
|
|
9
58
|
};
|
|
10
|
-
function k({ color: e }) {
|
|
11
|
-
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
12
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
13
|
-
/* @__PURE__ */ r("path", { d: "M10 9v5", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" }),
|
|
14
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "6.5", r: "1", fill: "#fff" })
|
|
15
|
-
] });
|
|
16
|
-
}
|
|
17
|
-
function v({ color: e }) {
|
|
18
|
-
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
19
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
20
|
-
/* @__PURE__ */ r("path", { d: "M6 10.5l3 3 5-5.5", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
21
|
-
] });
|
|
22
|
-
}
|
|
23
|
-
function x({ color: e }) {
|
|
24
|
-
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
25
|
-
/* @__PURE__ */ r("path", { d: "M10 2.5L18 17H2L10 2.5Z", fill: e }),
|
|
26
|
-
/* @__PURE__ */ r("path", { d: "M10 8v4", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" }),
|
|
27
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "14.5", r: "1", fill: "#fff" })
|
|
28
|
-
] });
|
|
29
|
-
}
|
|
30
|
-
function W({ color: e }) {
|
|
31
|
-
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
32
|
-
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
33
|
-
/* @__PURE__ */ r("path", { d: "M7 7l6 6M13 7l-6 6", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" })
|
|
34
|
-
] });
|
|
35
|
-
}
|
|
36
|
-
function m() {
|
|
37
|
-
return /* @__PURE__ */ r("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) });
|
|
38
|
-
}
|
|
39
|
-
function S({ type: e }) {
|
|
40
|
-
const n = p[e];
|
|
41
|
-
return e === "Success" ? /* @__PURE__ */ r(v, { color: n }) : e === "Warning" ? /* @__PURE__ */ r(x, { color: n }) : e === "Error" ? /* @__PURE__ */ r(W, { color: n }) : /* @__PURE__ */ r(k, { color: n });
|
|
42
|
-
}
|
|
43
|
-
const I = {
|
|
44
|
-
Default: t.typeDefault,
|
|
45
|
-
Info: t.typeInfo,
|
|
46
|
-
Success: t.typeSuccess,
|
|
47
|
-
Warning: t.typeWarning,
|
|
48
|
-
Error: t.typeError
|
|
49
|
-
}, M = {
|
|
50
|
-
Default: t.titleDefault,
|
|
51
|
-
Info: t.titleInfo,
|
|
52
|
-
Success: t.titleSuccess,
|
|
53
|
-
Warning: t.titleWarning,
|
|
54
|
-
Error: t.titleError
|
|
55
|
-
}, w = {
|
|
56
|
-
Default: "status",
|
|
57
|
-
Info: "status",
|
|
58
|
-
Success: "status",
|
|
59
|
-
Warning: "alert",
|
|
60
|
-
Error: "alert"
|
|
61
|
-
};
|
|
62
|
-
function B({
|
|
63
|
-
type: e = "Default",
|
|
64
|
-
title: n,
|
|
65
|
-
message: c,
|
|
66
|
-
addonLeft: s = !0,
|
|
67
|
-
closeIcon: o = !0,
|
|
68
|
-
actions: l = !1,
|
|
69
|
-
actionLabel: a = "Ação",
|
|
70
|
-
onClose: f,
|
|
71
|
-
onAction: u,
|
|
72
|
-
className: d
|
|
73
|
-
}) {
|
|
74
|
-
const h = [t.alert, I[e], d].filter(Boolean).join(" "), g = l || o;
|
|
75
|
-
return /* @__PURE__ */ i(
|
|
76
|
-
"div",
|
|
77
|
-
{
|
|
78
|
-
className: h,
|
|
79
|
-
role: w[e],
|
|
80
|
-
"aria-live": e === "Warning" || e === "Error" ? "assertive" : "polite",
|
|
81
|
-
children: [
|
|
82
|
-
s && /* @__PURE__ */ r("span", { className: t.iconSlot, children: /* @__PURE__ */ r(S, { type: e }) }),
|
|
83
|
-
/* @__PURE__ */ i("div", { className: t.textContent, children: [
|
|
84
|
-
n && /* @__PURE__ */ r("p", { className: [t.title, M[e]].join(" "), children: n }),
|
|
85
|
-
/* @__PURE__ */ r("p", { className: t.message, children: c })
|
|
86
|
-
] }),
|
|
87
|
-
g && /* @__PURE__ */ i("div", { className: t.rightSlot, children: [
|
|
88
|
-
l && /* @__PURE__ */ r(
|
|
89
|
-
"button",
|
|
90
|
-
{
|
|
91
|
-
type: "button",
|
|
92
|
-
className: t.actionBtn,
|
|
93
|
-
onClick: u,
|
|
94
|
-
children: a
|
|
95
|
-
}
|
|
96
|
-
),
|
|
97
|
-
o && /* @__PURE__ */ r(
|
|
98
|
-
"button",
|
|
99
|
-
{
|
|
100
|
-
type: "button",
|
|
101
|
-
className: t.closeBtn,
|
|
102
|
-
onClick: f,
|
|
103
|
-
"aria-label": "Fechar alerta",
|
|
104
|
-
children: /* @__PURE__ */ r(m, {})
|
|
105
|
-
}
|
|
106
|
-
)
|
|
107
|
-
] })
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
59
|
export {
|
|
113
|
-
|
|
60
|
+
a as typography
|
|
114
61
|
};
|
|
115
62
|
//# sourceMappingURL=index.esm4.js.map
|
package/dist/index.esm4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm4.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index.esm4.js","sources":["../tokens/typography.ts"],"sourcesContent":["/**\n * Typography tokens — extracted directly from Figma (VekfomfsZU4q2iaY1j4VXP)\n * Tokens: Body Texts/Button, Body Texts/Label, Body Texts/Text, Body Texts/Text Small,\n * Paragraph/SM/Regular, Paragraph/XS/Regular (FileUpload 3210:3538),\n * Text/xs, Text/md, Text/lg (Pagination 3203:662)\n */\n\nexport const typography = {\n fontFamily: {\n /** Clash Grotesk Variable — buttons, inputs, labels */\n base: \"'Clash Grotesk Variable', sans-serif\",\n /** Inter — FileUpload text (Paragraph/SM and Paragraph/XS) */\n inter: \"'Inter', sans-serif\",\n /** Roboto — Pagination numbers and controls */\n roboto: \"'Roboto', sans-serif\",\n /** Clash Display Variable — Steps step number (Headings/H4 · 21px) */\n clashDisplay: \"'Clash Display Variable', sans-serif\",\n /** @deprecated use fontFamily.base */\n button: \"'Clash Grotesk Variable', sans-serif\",\n },\n fontWeight: {\n regular: 400,\n semibold: 600,\n },\n fontSize: {\n /** 16px — Body Texts/Button & Body Texts/Text */\n md: '1rem',\n /** 14px — Body Texts/Label & Body Texts/Text Small */\n sm: '0.875rem',\n /** 12px — Paragraph/SM/Regular (Inter · FileUpload) */\n bodySm: '0.75rem',\n /** 10px — Paragraph/XS/Regular (Inter · FileUpload) */\n bodyXs: '0.625rem',\n /** 12px — Text/xs (Roboto · Pagination xs) */\n paginationXs: '0.75rem',\n /** 16px — Text/md (Roboto · Pagination md) */\n paginationMd: '1rem',\n /** 18px — Text/lg (Roboto · Pagination lg) */\n paginationLg: '1.125rem',\n /** @deprecated use fontSize.md */\n button: '1rem',\n },\n lineHeight: {\n /** 1.5 — Body Texts/Button */\n button: 1.5,\n /** 1.43 — Body Texts/Label (Semibold 14px) */\n label: 1.43,\n /** 1.30 — Body Texts/Text & Body Texts/Text Small */\n text: 1.3,\n /** 1.60 — Paragraph/SM/Regular & Paragraph/XS/Regular (Inter · FileUpload) */\n body: 1.6,\n /** 14px — Text/xs (Roboto · Pagination xs) */\n paginationXs: '14px',\n /** 18px — Text/md (Roboto · Pagination md) */\n paginationMd: '18px',\n /** 20px — Text/lg (Roboto · Pagination lg) */\n paginationLg: '20px',\n },\n letterSpacing: {\n /** 0 — all tokens */\n none: 0,\n /** @deprecated use letterSpacing.none */\n button: 0,\n },\n} as const;\n\nexport type Typography = typeof typography;\n"],"names":["typography"],"mappings":"AAOO,MAAMA,IAAa;AAAA,EACxB,YAAY;AAAA;AAAA,IAEV,MAAM;AAAA;AAAA,IAEN,OAAO;AAAA;AAAA,IAEP,QAAQ;AAAA;AAAA,IAER,cAAc;AAAA;AAAA,IAEd,QAAQ;AAAA,EAAA;AAAA,EAEV,YAAY;AAAA,IACV,SAAS;AAAA,IACT,UAAU;AAAA,EAAA;AAAA,EAEZ,UAAU;AAAA;AAAA,IAER,IAAI;AAAA;AAAA,IAEJ,IAAI;AAAA;AAAA,IAEJ,QAAQ;AAAA;AAAA,IAER,QAAQ;AAAA;AAAA,IAER,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA;AAAA,IAEd,QAAQ;AAAA,EAAA;AAAA,EAEV,YAAY;AAAA;AAAA,IAEV,QAAQ;AAAA;AAAA,IAER,OAAO;AAAA;AAAA,IAEP,MAAM;AAAA;AAAA,IAEN,MAAM;AAAA;AAAA,IAEN,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA,EAAA;AAAA,EAEhB,eAAe;AAAA;AAAA,IAEb,MAAM;AAAA;AAAA,IAEN,QAAQ;AAAA,EAAA;AAEZ;"}
|
package/dist/index.esm5.js
CHANGED
|
@@ -1,69 +1,115 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import t from "./index.esm17.js";
|
|
3
|
+
const p = {
|
|
4
|
+
Default: "#9490AC",
|
|
5
|
+
Info: "#2472BA",
|
|
6
|
+
Success: "#2C7D56",
|
|
7
|
+
Warning: "#A36A00",
|
|
8
|
+
Error: "#DE0000"
|
|
9
|
+
};
|
|
10
|
+
function k({ color: e }) {
|
|
11
|
+
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
12
|
+
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
13
|
+
/* @__PURE__ */ r("path", { d: "M10 9v5", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" }),
|
|
14
|
+
/* @__PURE__ */ r("circle", { cx: "10", cy: "6.5", r: "1", fill: "#fff" })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
function v({ color: e }) {
|
|
18
|
+
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
19
|
+
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
20
|
+
/* @__PURE__ */ r("path", { d: "M6 10.5l3 3 5-5.5", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function x({ color: e }) {
|
|
24
|
+
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
25
|
+
/* @__PURE__ */ r("path", { d: "M10 2.5L18 17H2L10 2.5Z", fill: e }),
|
|
26
|
+
/* @__PURE__ */ r("path", { d: "M10 8v4", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" }),
|
|
27
|
+
/* @__PURE__ */ r("circle", { cx: "10", cy: "14.5", r: "1", fill: "#fff" })
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
function W({ color: e }) {
|
|
31
|
+
return /* @__PURE__ */ i("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
32
|
+
/* @__PURE__ */ r("circle", { cx: "10", cy: "10", r: "9", fill: e }),
|
|
33
|
+
/* @__PURE__ */ r("path", { d: "M7 7l6 6M13 7l-6 6", stroke: "#fff", strokeWidth: "1.75", strokeLinecap: "round" })
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
function m() {
|
|
37
|
+
return /* @__PURE__ */ r("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M15 5L5 15M5 5l10 10", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) });
|
|
38
|
+
}
|
|
39
|
+
function S({ type: e }) {
|
|
40
|
+
const n = p[e];
|
|
41
|
+
return e === "Success" ? /* @__PURE__ */ r(v, { color: n }) : e === "Warning" ? /* @__PURE__ */ r(x, { color: n }) : e === "Error" ? /* @__PURE__ */ r(W, { color: n }) : /* @__PURE__ */ r(k, { color: n });
|
|
42
|
+
}
|
|
43
|
+
const I = {
|
|
44
|
+
Default: t.typeDefault,
|
|
45
|
+
Info: t.typeInfo,
|
|
46
|
+
Success: t.typeSuccess,
|
|
47
|
+
Warning: t.typeWarning,
|
|
48
|
+
Error: t.typeError
|
|
49
|
+
}, M = {
|
|
50
|
+
Default: t.titleDefault,
|
|
51
|
+
Info: t.titleInfo,
|
|
52
|
+
Success: t.titleSuccess,
|
|
53
|
+
Warning: t.titleWarning,
|
|
54
|
+
Error: t.titleError
|
|
55
|
+
}, w = {
|
|
56
|
+
Default: "status",
|
|
57
|
+
Info: "status",
|
|
58
|
+
Success: "status",
|
|
59
|
+
Warning: "alert",
|
|
60
|
+
Error: "alert"
|
|
61
|
+
};
|
|
62
|
+
function B({
|
|
63
|
+
type: e = "Default",
|
|
64
|
+
title: n,
|
|
65
|
+
message: c,
|
|
66
|
+
addonLeft: s = !0,
|
|
67
|
+
closeIcon: o = !0,
|
|
68
|
+
actions: l = !1,
|
|
69
|
+
actionLabel: a = "Ação",
|
|
70
|
+
onClose: f,
|
|
71
|
+
onAction: u,
|
|
72
|
+
className: d
|
|
10
73
|
}) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
if (n === "Toggle")
|
|
15
|
-
return /* @__PURE__ */ c(
|
|
16
|
-
"div",
|
|
17
|
-
{
|
|
18
|
-
role: "switch",
|
|
19
|
-
"aria-checked": a,
|
|
20
|
-
"aria-label": o,
|
|
21
|
-
"aria-labelledby": d,
|
|
22
|
-
tabIndex: 0,
|
|
23
|
-
onClick: t,
|
|
24
|
-
onKeyDown: s,
|
|
25
|
-
className: [
|
|
26
|
-
e.toggleWrapper,
|
|
27
|
-
a ? e.toggleChecked : "",
|
|
28
|
-
r
|
|
29
|
-
].filter(Boolean).join(" "),
|
|
30
|
-
children: /* @__PURE__ */ c("div", { className: e.toggleTrack })
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
if (n === "Radio") {
|
|
34
|
-
const i = a ? e.radioChecked : e.radioDefault;
|
|
35
|
-
return /* @__PURE__ */ c(
|
|
36
|
-
"div",
|
|
37
|
-
{
|
|
38
|
-
role: "radio",
|
|
39
|
-
"aria-checked": a,
|
|
40
|
-
"aria-label": o,
|
|
41
|
-
"aria-labelledby": d,
|
|
42
|
-
tabIndex: 0,
|
|
43
|
-
onClick: t,
|
|
44
|
-
onKeyDown: s,
|
|
45
|
-
className: [e.base, i, r].filter(Boolean).join(" "),
|
|
46
|
-
children: a && /* @__PURE__ */ c("span", { className: e.radioIcon, "aria-hidden": "true" })
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
const f = a ? e.checkChecked : e.checkDefault;
|
|
51
|
-
return /* @__PURE__ */ c(
|
|
74
|
+
const h = [t.alert, I[e], d].filter(Boolean).join(" "), g = l || o;
|
|
75
|
+
return /* @__PURE__ */ i(
|
|
52
76
|
"div",
|
|
53
77
|
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"aria-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
className: h,
|
|
79
|
+
role: w[e],
|
|
80
|
+
"aria-live": e === "Warning" || e === "Error" ? "assertive" : "polite",
|
|
81
|
+
children: [
|
|
82
|
+
s && /* @__PURE__ */ r("span", { className: t.iconSlot, children: /* @__PURE__ */ r(S, { type: e }) }),
|
|
83
|
+
/* @__PURE__ */ i("div", { className: t.textContent, children: [
|
|
84
|
+
n && /* @__PURE__ */ r("p", { className: [t.title, M[e]].join(" "), children: n }),
|
|
85
|
+
/* @__PURE__ */ r("p", { className: t.message, children: c })
|
|
86
|
+
] }),
|
|
87
|
+
g && /* @__PURE__ */ i("div", { className: t.rightSlot, children: [
|
|
88
|
+
l && /* @__PURE__ */ r(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
type: "button",
|
|
92
|
+
className: t.actionBtn,
|
|
93
|
+
onClick: u,
|
|
94
|
+
children: a
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
o && /* @__PURE__ */ r(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
className: t.closeBtn,
|
|
102
|
+
onClick: f,
|
|
103
|
+
"aria-label": "Fechar alerta",
|
|
104
|
+
children: /* @__PURE__ */ r(m, {})
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] })
|
|
108
|
+
]
|
|
63
109
|
}
|
|
64
110
|
);
|
|
65
111
|
}
|
|
66
112
|
export {
|
|
67
|
-
|
|
113
|
+
B as Alert
|
|
68
114
|
};
|
|
69
115
|
//# sourceMappingURL=index.esm5.js.map
|
package/dist/index.esm5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm5.js","sources":["../components/
|
|
1
|
+
{"version":3,"file":"index.esm5.js","sources":["../components/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './Alert.module.css';\n\n// ─── Types ────────────────────────────────────────────────────────────────────\n\nexport type AlertType = 'Default' | 'Info' | 'Success' | 'Warning' | 'Error';\n\nexport interface AlertProps {\n type?: AlertType;\n title?: string;\n message: string;\n /** Show icon on the left */\n addonLeft?: boolean;\n /** Show close (×) button on the right */\n closeIcon?: boolean;\n /** Show action button */\n actions?: boolean;\n /** Label for the action button (defaults to \"Ação\") */\n actionLabel?: string;\n onClose?: () => void;\n onAction?: () => void;\n className?: string;\n}\n\n// ─── Inline SVG icons ─────────────────────────────────────────────────────────\n\nconst iconColor: Record<AlertType, string> = {\n Default: '#9490AC',\n Info: '#2472BA',\n Success: '#2C7D56',\n Warning: '#A36A00',\n Error: '#DE0000',\n};\n\n/** Info-circle icon — Default & Info */\nfunction IconInfo({ color }: { color: string }) {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"10\" cy=\"10\" r=\"9\" fill={color} />\n <path d=\"M10 9v5\" stroke=\"#fff\" strokeWidth=\"1.75\" strokeLinecap=\"round\" />\n <circle cx=\"10\" cy=\"6.5\" r=\"1\" fill=\"#fff\" />\n </svg>\n );\n}\n\n/** Check-circle icon — Success */\nfunction IconSuccess({ color }: { color: string }) {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"10\" cy=\"10\" r=\"9\" fill={color} />\n <path d=\"M6 10.5l3 3 5-5.5\" stroke=\"#fff\" strokeWidth=\"1.75\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n );\n}\n\n/** Warning-triangle icon — Warning */\nfunction IconWarning({ color }: { color: string }) {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M10 2.5L18 17H2L10 2.5Z\" fill={color} />\n <path d=\"M10 8v4\" stroke=\"#fff\" strokeWidth=\"1.75\" strokeLinecap=\"round\" />\n <circle cx=\"10\" cy=\"14.5\" r=\"1\" fill=\"#fff\" />\n </svg>\n );\n}\n\n/** X-circle icon — Error */\nfunction IconError({ color }: { color: string }) {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <circle cx=\"10\" cy=\"10\" r=\"9\" fill={color} />\n <path d=\"M7 7l6 6M13 7l-6 6\" stroke=\"#fff\" strokeWidth=\"1.75\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n\n/** Close × icon */\nfunction IconClose() {\n return (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n <path d=\"M15 5L5 15M5 5l10 10\" stroke=\"currentColor\" strokeWidth=\"1.75\" strokeLinecap=\"round\" />\n </svg>\n );\n}\n\nfunction TypeIcon({ type }: { type: AlertType }) {\n const color = iconColor[type];\n if (type === 'Success') return <IconSuccess color={color} />;\n if (type === 'Warning') return <IconWarning color={color} />;\n if (type === 'Error') return <IconError color={color} />;\n return <IconInfo color={color} />;\n}\n\n// ─── Component ────────────────────────────────────────────────────────────────\n\nconst typeStyleMap: Record<AlertType, string> = {\n Default: styles.typeDefault,\n Info: styles.typeInfo,\n Success: styles.typeSuccess,\n Warning: styles.typeWarning,\n Error: styles.typeError,\n};\n\nconst titleStyleMap: Record<AlertType, string> = {\n Default: styles.titleDefault,\n Info: styles.titleInfo,\n Success: styles.titleSuccess,\n Warning: styles.titleWarning,\n Error: styles.titleError,\n};\n\nconst ariaRoleMap: Record<AlertType, string> = {\n Default: 'status',\n Info: 'status',\n Success: 'status',\n Warning: 'alert',\n Error: 'alert',\n};\n\nexport function Alert({\n type = 'Default',\n title,\n message,\n addonLeft = true,\n closeIcon = true,\n actions = false,\n actionLabel = 'Ação',\n onClose,\n onAction,\n className,\n}: AlertProps) {\n const rootClass = [styles.alert, typeStyleMap[type], className]\n .filter(Boolean)\n .join(' ');\n\n const hasRightSlot = actions || closeIcon;\n\n return (\n <div\n className={rootClass}\n role={ariaRoleMap[type]}\n aria-live={type === 'Warning' || type === 'Error' ? 'assertive' : 'polite'}\n >\n {/* Left icon */}\n {addonLeft && (\n <span className={styles.iconSlot}>\n <TypeIcon type={type} />\n </span>\n )}\n\n {/* Text */}\n <div className={styles.textContent}>\n {title && (\n <p className={[styles.title, titleStyleMap[type]].join(' ')}>\n {title}\n </p>\n )}\n <p className={styles.message}>{message}</p>\n </div>\n\n {/* Right: action + close */}\n {hasRightSlot && (\n <div className={styles.rightSlot}>\n {actions && (\n <button\n type=\"button\"\n className={styles.actionBtn}\n onClick={onAction}\n >\n {actionLabel}\n </button>\n )}\n {closeIcon && (\n <button\n type=\"button\"\n className={styles.closeBtn}\n onClick={onClose}\n aria-label=\"Fechar alerta\"\n >\n <IconClose />\n </button>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"names":["iconColor","IconInfo","color","jsxs","jsx","IconSuccess","IconWarning","IconError","IconClose","TypeIcon","type","typeStyleMap","styles","titleStyleMap","ariaRoleMap","Alert","title","message","addonLeft","closeIcon","actions","actionLabel","onClose","onAction","className","rootClass","hasRightSlot"],"mappings":";;AA0BA,MAAMA,IAAuC;AAAA,EAC3C,SAAS;AAAA,EACT,MAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAS;AACX;AAGA,SAASC,EAAS,EAAE,OAAAC,KAA4B;AAC9C,SACE,gBAAAC,EAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,eAAY,QACtE,UAAA;AAAA,IAAA,gBAAAC,EAAC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KAAI,MAAMF,EAAA,CAAO;AAAA,IAC3C,gBAAAE,EAAC,UAAK,GAAE,WAAU,QAAO,QAAO,aAAY,QAAO,eAAc,QAAA,CAAQ;AAAA,IACzE,gBAAAA,EAAC,YAAO,IAAG,MAAK,IAAG,OAAM,GAAE,KAAI,MAAK,OAAA,CAAO;AAAA,EA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-runtime";
|
|
2
|
+
import e from "./index.esm20.js";
|
|
3
|
+
function u({
|
|
4
|
+
type: n = "Check",
|
|
5
|
+
status: k = "Default",
|
|
6
|
+
onChange: l,
|
|
9
7
|
className: r,
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
"aria-label": o,
|
|
9
|
+
"aria-labelledby": d
|
|
12
10
|
}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
const a = k === "Checked", t = () => l == null ? void 0 : l(!a), s = (i) => {
|
|
12
|
+
(i.key === " " || i.key === "Enter") && (i.preventDefault(), l == null || l(!a));
|
|
13
|
+
};
|
|
14
|
+
if (n === "Toggle")
|
|
15
|
+
return /* @__PURE__ */ c(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
role: "switch",
|
|
19
|
+
"aria-checked": a,
|
|
20
|
+
"aria-label": o,
|
|
21
|
+
"aria-labelledby": d,
|
|
22
|
+
tabIndex: 0,
|
|
23
|
+
onClick: t,
|
|
24
|
+
onKeyDown: s,
|
|
25
|
+
className: [
|
|
26
|
+
e.toggleWrapper,
|
|
27
|
+
a ? e.toggleChecked : "",
|
|
28
|
+
r
|
|
29
|
+
].filter(Boolean).join(" "),
|
|
30
|
+
children: /* @__PURE__ */ c("div", { className: e.toggleTrack })
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
if (n === "Radio") {
|
|
34
|
+
const i = a ? e.radioChecked : e.radioDefault;
|
|
35
|
+
return /* @__PURE__ */ c(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
role: "radio",
|
|
39
|
+
"aria-checked": a,
|
|
40
|
+
"aria-label": o,
|
|
41
|
+
"aria-labelledby": d,
|
|
42
|
+
tabIndex: 0,
|
|
43
|
+
onClick: t,
|
|
44
|
+
onKeyDown: s,
|
|
45
|
+
className: [e.base, i, r].filter(Boolean).join(" "),
|
|
46
|
+
children: a && /* @__PURE__ */ c("span", { className: e.radioIcon, "aria-hidden": "true" })
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
const f = a ? e.checkChecked : e.checkDefault;
|
|
51
|
+
return /* @__PURE__ */ c(
|
|
52
|
+
"div",
|
|
21
53
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"aria-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
54
|
+
role: "checkbox",
|
|
55
|
+
"aria-checked": a,
|
|
56
|
+
"aria-label": o,
|
|
57
|
+
"aria-labelledby": d,
|
|
58
|
+
tabIndex: 0,
|
|
59
|
+
onClick: t,
|
|
60
|
+
onKeyDown: s,
|
|
61
|
+
className: [e.base, f, r].filter(Boolean).join(" "),
|
|
62
|
+
children: a && /* @__PURE__ */ c("span", { className: e.checkIcon, "aria-hidden": "true" })
|
|
31
63
|
}
|
|
32
64
|
);
|
|
33
65
|
}
|
|
34
66
|
export {
|
|
35
|
-
|
|
67
|
+
u as BaseCheckRadio
|
|
36
68
|
};
|
|
37
69
|
//# sourceMappingURL=index.esm6.js.map
|
package/dist/index.esm6.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm6.js","sources":["../components/
|
|
1
|
+
{"version":3,"file":"index.esm6.js","sources":["../components/BaseCheckRadio/BaseCheckRadio.tsx"],"sourcesContent":["import React from 'react';\nimport styles from './BaseCheckRadio.module.css';\n\nexport type CheckRadioType = 'Check' | 'Radio' | 'Toggle';\nexport type CheckRadioStatus = 'Default' | 'Checked';\n\nexport interface BaseCheckRadioProps {\n type?: CheckRadioType;\n status?: CheckRadioStatus;\n /** Accessible label for the control. */\n 'aria-label'?: string;\n /** Associates the control with a visible label element. */\n 'aria-labelledby'?: string;\n onChange?: (checked: boolean) => void;\n className?: string;\n}\n\nexport function BaseCheckRadio({\n type = 'Check',\n status = 'Default',\n onChange,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n}: BaseCheckRadioProps) {\n const isChecked = status === 'Checked';\n\n const handleClick = () => onChange?.(!isChecked);\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === ' ' || e.key === 'Enter') {\n e.preventDefault();\n onChange?.(!isChecked);\n }\n };\n\n if (type === 'Toggle') {\n return (\n <div\n role=\"switch\"\n aria-checked={isChecked}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n tabIndex={0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n className={[\n styles.toggleWrapper,\n isChecked ? styles.toggleChecked : '',\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={styles.toggleTrack} />\n </div>\n );\n }\n\n if (type === 'Radio') {\n const trackClass = isChecked ? styles.radioChecked : styles.radioDefault;\n return (\n <div\n role=\"radio\"\n aria-checked={isChecked}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n tabIndex={0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n className={[styles.base, trackClass, className].filter(Boolean).join(' ')}\n >\n {isChecked && <span className={styles.radioIcon} aria-hidden=\"true\" />}\n </div>\n );\n }\n\n // Check (default)\n const trackClass = isChecked ? styles.checkChecked : styles.checkDefault;\n return (\n <div\n role=\"checkbox\"\n aria-checked={isChecked}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n tabIndex={0}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n className={[styles.base, trackClass, className].filter(Boolean).join(' ')}\n >\n {isChecked && <span className={styles.checkIcon} aria-hidden=\"true\" />}\n </div>\n );\n}\n"],"names":["BaseCheckRadio","type","status","onChange","className","ariaLabel","ariaLabelledby","isChecked","handleClick","handleKeyDown","e","jsx","styles","trackClass"],"mappings":";;AAiBO,SAASA,EAAe;AAAA,EAC7B,MAAAC,IAAO;AAAA,EACP,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,WAAAC;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