@thibezer/ui-components-kit 1.0.0 → 2.0.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -21
- package/README.md +739 -624
- package/dist/botao.cjs +1 -1
- package/dist/botao.js +1 -1
- package/dist/camadas.cjs +38 -38
- package/dist/camadas.js +494 -494
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +33 -33
- package/dist/canvas.js +100 -100
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-botao/ui-botao.d.ts +15 -0
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +5 -0
- package/dist/components/ui-modal/modal-pilha.d.ts +3 -0
- package/dist/components/ui-modal/ui-modal.d.ts +19 -4
- package/dist/components/ui-tabela/tabela-corpo.d.ts +2 -0
- package/dist/components/ui-tabela/tabela-renderizador.d.ts +1 -0
- package/dist/components/ui-tabela/tabela-selecao.d.ts +5 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +15 -0
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +15 -0
- package/dist/core/form-submissao.d.ts +16 -0
- package/dist/core/parts.d.ts +6 -0
- package/dist/core/rotulo.d.ts +6 -0
- package/dist/core/ui-bus.d.ts +13 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/custom-elements.json +28789 -0
- package/dist/data.cjs +1 -1
- package/dist/data.js +2 -2
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +3 -3
- package/dist/form-submissao-C-SPRKgT.js +61 -0
- package/dist/form-submissao-DxKO5MHI.cjs +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -13
- package/dist/mapa.cjs +4 -4
- package/dist/mapa.js +1 -1
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/parts-CaoQiCfI.js +7 -0
- package/dist/parts-vQa2873h.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +12 -12
- package/dist/seletor-mapa-base.cjs +11 -11
- package/dist/seletor-mapa-base.js +37 -37
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +1219 -0
- package/dist/tipos-react.d.ts +113 -0
- package/dist/tipos-vue.d.ts +1190 -0
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-BxT-sDmV.cjs +28 -0
- package/dist/ui-badge-C0eKBI8E.js +183 -0
- package/dist/ui-botao-OGJV6Vfk.js +165 -0
- package/dist/ui-botao-psS1juof.cjs +12 -0
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +16 -0
- package/dist/{ui-campo-texto-B_JF6POq.js → ui-campo-texto-Uu2dJE_0.js} +81 -63
- package/dist/{ui-card-Bhm6k91e.cjs → ui-card-B86lJXTP.cjs} +7 -7
- package/dist/{ui-card-BJ8SmvVf.js → ui-card-C_o5_0cB.js} +14 -14
- package/dist/ui-kit.css +1 -1
- package/dist/ui-modal-CvGFGh1h.cjs +18 -0
- package/dist/ui-modal-DBOtSTbR.js +238 -0
- package/dist/{ui-paleta-ferramentas-Bpp4XBVg.js → ui-paleta-ferramentas-BIytXQLh.js} +1 -1
- package/dist/{ui-paleta-ferramentas-B6dJ0O6K.cjs → ui-paleta-ferramentas-DqLY51qa.cjs} +1 -1
- package/dist/ui-segmented-D6b6zxVs.cjs +19 -0
- package/dist/{ui-segmented-C8wuycjJ.js → ui-segmented-wUraId2e.js} +68 -67
- package/dist/ui-skeleton-DI4_9WOX.js +428 -0
- package/dist/ui-skeleton-elhKIh2B.cjs +33 -0
- package/dist/{ui-switch-CO9MoS8x.js → ui-switch-DWLgVVnT.js} +121 -119
- package/dist/ui-switch-yZIn3IW0.cjs +53 -0
- package/dist/ui-tabela-propriedades-BNcE6VLX.js +2180 -0
- package/dist/ui-tabela-propriedades-D3pyQvyy.cjs +145 -0
- package/dist/{ui-toast-CwUmiqyG.js → ui-toast-Bp_NlM5G.js} +51 -51
- package/dist/ui-toast-DGTZKne5.cjs +20 -0
- package/dist/zero-js-triggers-C_KrvFOQ.js +244 -0
- package/dist/zero-js-triggers-C_gtaojZ.cjs +1 -0
- package/package.json +169 -149
- package/dist/ui-badge-92yelKls.js +0 -183
- package/dist/ui-badge-B95jSECC.cjs +0 -28
- package/dist/ui-botao-BShEouvi.js +0 -124
- package/dist/ui-botao-DF1yuUUD.cjs +0 -12
- package/dist/ui-campo-texto-BCh5HyCM.cjs +0 -16
- package/dist/ui-modal-Bi4isGYh.cjs +0 -18
- package/dist/ui-modal-DV-pw2x1.js +0 -194
- package/dist/ui-segmented-NC5cBXLh.cjs +0 -19
- package/dist/ui-skeleton-B3xQyn0Z.js +0 -396
- package/dist/ui-skeleton-D42oQufF.cjs +0 -33
- package/dist/ui-switch-C6o4yZUF.cjs +0 -53
- package/dist/ui-tabela-propriedades-7yJ9g7ti.cjs +0 -145
- package/dist/ui-tabela-propriedades-D-XKNVwK.js +0 -2078
- package/dist/ui-toast-CQBqvUm3.cjs +0 -20
- package/dist/zero-js-triggers-DdESy0tk.js +0 -205
- package/dist/zero-js-triggers-QGD7FOTv.cjs +0 -1
|
@@ -3,8 +3,9 @@ var v = (s, n, t) => n in s ? g(s, n, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var u = (s, n, t) => v(s, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { d, S as h } from "./ssr-safe-5cWfJP-s.js";
|
|
5
5
|
import { L as f } from "./listener-bag-DQgv7OON.js";
|
|
6
|
-
import { F as b } from "./ui-campo-texto-
|
|
7
|
-
|
|
6
|
+
import { F as b } from "./ui-campo-texto-Uu2dJE_0.js";
|
|
7
|
+
import { a as x } from "./parts-CaoQiCfI.js";
|
|
8
|
+
const _ = ':host{display:block;box-sizing:border-box;margin:0;padding:0;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){display:inline-block}.ui-texto{margin:0;padding:0;box-sizing:border-box;font-family:inherit;color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.ui-texto--h1{font-size:var(--ui-tamanho-h1, clamp(24px, 4vw, 36px));font-weight:var(--ui-peso-negrito, 700);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.5px}.ui-texto--h2{font-size:var(--ui-tamanho-h2, clamp(20px, 3vw, 28px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.3px}.ui-texto--h3{font-size:var(--ui-tamanho-h3, clamp(18px, 2.4vw, 24px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h4{font-size:var(--ui-tamanho-h4, clamp(16px, 2vw, 20px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h5{font-size:var(--ui-tamanho-h5, clamp(14px, 1.6vw, 18px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h6{font-size:var(--ui-tamanho-h6, clamp(13px, 1.2vw, 16px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);text-transform:uppercase;letter-spacing:.5px}.ui-texto--corpo{font-size:var(--ui-tamanho-corpo, 14px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--corpo-sm{font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--caption{font-size:var(--ui-tamanho-caption, 11px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-compacta, 1.2);color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--codigo{font-family:var(--ui-fonte-codigo, monospace);font-size:var(--ui-tamanho-codigo, 12px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5);background:var(--ui-cor-fundo-elevado, #1a1a1e);padding:2px 6px;border-radius:var(--ui-raio-sm, 4px);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-texto--cor-primaria{color:var(--ui-cor-primaria, #00E08A)}.ui-texto--cor-secundaria{color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--cor-destaque{color:var(--ui-cor-destaque, #00E08A)}.ui-texto--cor-erro{color:var(--ui-cor-texto-erro, #ff5555)}.ui-texto--cor-sucesso{color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-texto--cor-alerta{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-texto--peso-normal{font-weight:var(--ui-peso-normal, 400)!important}.ui-texto--peso-medio{font-weight:var(--ui-peso-medio, 500)!important}.ui-texto--peso-seminegrito{font-weight:var(--ui-peso-seminegrito, 600)!important}.ui-texto--peso-negrito{font-weight:var(--ui-peso-negrito, 700)!important}.ui-texto--alinhamento-esquerda{text-align:left}.ui-texto--alinhamento-centro{text-align:center}.ui-texto--alinhamento-direita{text-align:right}.ui-texto--alinhamento-justificado{text-align:justify}.ui-texto--truncar{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}', y = /* @__PURE__ */ new Set([
|
|
8
9
|
"p",
|
|
9
10
|
"span",
|
|
10
11
|
"div",
|
|
@@ -24,12 +25,12 @@ const x = ':host{display:block;box-sizing:border-box;margin:0;padding:0;color:va
|
|
|
24
25
|
"b",
|
|
25
26
|
"i"
|
|
26
27
|
]);
|
|
27
|
-
class
|
|
28
|
+
class A extends h {
|
|
28
29
|
constructor() {
|
|
29
30
|
super();
|
|
30
31
|
u(this, "container");
|
|
31
32
|
u(this, "shadow");
|
|
32
|
-
typeof this.attachShadow == "function" && typeof document < "u" ? (this.shadow = this.attachShadow({ mode: "open" }), this.container = document.createElement("p"), this.container.className = "ui-texto ui-texto--corpo", this.container.appendChild(document.createElement("slot")), this.shadow.innerHTML = `<style>${
|
|
33
|
+
typeof this.attachShadow == "function" && typeof document < "u" ? (this.shadow = this.attachShadow({ mode: "open" }), this.container = document.createElement("p"), this.container.className = "ui-texto ui-texto--corpo", this.container.appendChild(document.createElement("slot")), this.shadow.innerHTML = `<style>${_}</style>`, this.shadow.appendChild(this.container)) : (this.shadow = null, this.container = null);
|
|
33
34
|
}
|
|
34
35
|
static get observedAttributes() {
|
|
35
36
|
return ["variante", "tag", "cor", "peso", "alinhamento", "truncar"];
|
|
@@ -44,7 +45,7 @@ class y extends h {
|
|
|
44
45
|
const t = this.getAttribute("tag");
|
|
45
46
|
if (t) {
|
|
46
47
|
const e = t.toLowerCase().trim();
|
|
47
|
-
if (
|
|
48
|
+
if (y.has(e))
|
|
48
49
|
return e;
|
|
49
50
|
console.warn(`[ui-texto] Tag "${t}" não permitida ou inválida. Utilizando fallback semântico.`);
|
|
50
51
|
}
|
|
@@ -68,17 +69,17 @@ class y extends h {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
render() {
|
|
71
|
-
const t = this.resolveTag(), i = this.getAttribute("variante") || "corpo", e = this.getAttribute("cor"), a = this.getAttribute("peso"),
|
|
72
|
+
const t = this.resolveTag(), i = this.getAttribute("variante") || "corpo", e = this.getAttribute("cor"), a = this.getAttribute("peso"), r = this.getAttribute("alinhamento"), o = this.hasAttribute("truncar");
|
|
72
73
|
if (this.container.tagName.toLowerCase() !== t) {
|
|
73
74
|
const c = document.createElement(t);
|
|
74
75
|
c.appendChild(document.createElement("slot")), this.shadow.replaceChild(c, this.container), this.container = c;
|
|
75
76
|
}
|
|
76
77
|
const l = ["ui-texto", `ui-texto--${i}`];
|
|
77
|
-
e && l.push(`ui-texto--cor-${e}`), a && l.push(`ui-texto--peso-${a}`),
|
|
78
|
+
e && l.push(`ui-texto--cor-${e}`), a && l.push(`ui-texto--peso-${a}`), r && l.push(`ui-texto--alinhamento-${r}`), o && l.push("ui-texto--truncar"), this.container.className = l.join(" ");
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
d("ui-texto",
|
|
81
|
-
const
|
|
81
|
+
d("ui-texto", A);
|
|
82
|
+
const E = ':host{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle;position:relative}.ui-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-tamanho-avatar, 36px);height:var(--ui-tamanho-avatar, 36px);min-width:var(--ui-tamanho-avatar, 36px);min-height:var(--ui-tamanho-avatar, 36px);border-radius:50%;background-color:var(--ui-cor-fundo-elevado, #22222a);color:var(--ui-cor-primaria, #00E08A);font-weight:600;font-size:var(--ui-avatar-font-size, 14px);-webkit-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));line-height:1}.ui-avatar__img{width:100%;height:100%;object-fit:cover;display:block}.ui-avatar--quadrado{border-radius:8px}.ui-avatar__status{position:absolute;bottom:0;right:0;width:25%;height:25%;min-width:8px;min-height:8px;max-width:14px;max-height:14px;border-radius:50%;border:2px solid var(--ui-cor-fundo-card, #121214);box-sizing:border-box}.ui-avatar__status--online{background-color:var(--ui-cor-primaria, #00E08A)}.ui-avatar__status--offline{background-color:#889}.ui-avatar__status--ausente{background-color:#ffb86c}.ui-avatar__status--ocupado{background-color:#f55}.ui-avatar--xs{--ui-tamanho-avatar: 20px;--ui-avatar-font-size: 10px}.ui-avatar--sm{--ui-tamanho-avatar: 28px;--ui-avatar-font-size: 11px}.ui-avatar--md{--ui-tamanho-avatar: 36px;--ui-avatar-font-size: 14px}.ui-avatar--lg{--ui-tamanho-avatar: 48px;--ui-avatar-font-size: 18px}.ui-avatar--xl{--ui-tamanho-avatar: 64px;--ui-avatar-font-size: 24px}';
|
|
82
83
|
class w extends h {
|
|
83
84
|
constructor() {
|
|
84
85
|
super();
|
|
@@ -86,7 +87,7 @@ class w extends h {
|
|
|
86
87
|
u(this, "statusElement");
|
|
87
88
|
const t = this.attachShadow({ mode: "open" });
|
|
88
89
|
t.innerHTML = `
|
|
89
|
-
<style>${
|
|
90
|
+
<style>${E}</style>
|
|
90
91
|
<div class="ui-avatar">
|
|
91
92
|
<span class="ui-avatar__content"></span>
|
|
92
93
|
</div>
|
|
@@ -119,24 +120,24 @@ class w extends h {
|
|
|
119
120
|
return (e + a).toUpperCase();
|
|
120
121
|
}
|
|
121
122
|
syncState() {
|
|
122
|
-
const t = this.getAttribute("src"), i = this.getAttribute("nome") || this.getAttribute("name") || "", e = this.getAttribute("tamanho") || this.getAttribute("size") || "md", a = this.getAttribute("formato") || "circulo",
|
|
123
|
+
const t = this.getAttribute("src"), i = this.getAttribute("nome") || this.getAttribute("name") || "", e = this.getAttribute("tamanho") || this.getAttribute("size") || "md", a = this.getAttribute("formato") || "circulo", r = this.getAttribute("status");
|
|
123
124
|
this.avatarElement.className = "ui-avatar", ["xs", "sm", "md", "lg", "xl"].includes(e) ? (this.avatarElement.classList.add(`ui-avatar--${e}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")) : isNaN(parseInt(e, 10)) ? this.avatarElement.style.removeProperty("--ui-tamanho-avatar") : this.avatarElement.style.setProperty("--ui-tamanho-avatar", `${parseInt(e, 10)}px`), a === "quadrado" && this.avatarElement.classList.add("ui-avatar--quadrado");
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
125
|
+
const o = this.avatarElement.querySelector(".ui-avatar__content");
|
|
126
|
+
if (o)
|
|
126
127
|
if (t) {
|
|
127
|
-
const l =
|
|
128
|
+
const l = o.querySelector("img");
|
|
128
129
|
if (l && l.getAttribute("src") === t)
|
|
129
130
|
l.alt = i || "Avatar";
|
|
130
131
|
else {
|
|
131
|
-
|
|
132
|
+
o.textContent = "";
|
|
132
133
|
const c = document.createElement("img");
|
|
133
134
|
c.className = "ui-avatar__img", c.src = t, c.alt = i || "Avatar", c.onerror = () => {
|
|
134
|
-
this.renderFallback(
|
|
135
|
-
},
|
|
135
|
+
this.renderFallback(o, i);
|
|
136
|
+
}, o.appendChild(c);
|
|
136
137
|
}
|
|
137
138
|
} else
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
o.textContent = "", this.renderFallback(o, i);
|
|
140
|
+
r && ["online", "offline", "ausente", "ocupado"].includes(r) ? (this.statusElement.className = `ui-avatar__status ui-avatar__status--${r}`, this.statusElement.style.display = "block") : this.statusElement.style.display = "none";
|
|
140
141
|
}
|
|
141
142
|
renderFallback(t, i) {
|
|
142
143
|
i ? t.textContent = this.extrairIniciais(i) : t.innerHTML = `
|
|
@@ -148,7 +149,7 @@ class w extends h {
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
d("ui-avatar", w);
|
|
151
|
-
class
|
|
152
|
+
class z {
|
|
152
153
|
constructor(n, t) {
|
|
153
154
|
u(this, "rafId", null);
|
|
154
155
|
u(this, "resizeObserver");
|
|
@@ -175,31 +176,31 @@ class E {
|
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function k(s, n, t, i) {
|
|
179
180
|
if (t) return;
|
|
180
181
|
const e = Array.from(
|
|
181
182
|
n.querySelectorAll(".ui-segmented__item:not(:disabled)")
|
|
182
183
|
);
|
|
183
184
|
if (e.length === 0) return;
|
|
184
185
|
const a = e.findIndex((l) => l.classList.contains("ui-segmented__item--ativo"));
|
|
185
|
-
let
|
|
186
|
+
let r = a;
|
|
186
187
|
if (s.key === "ArrowRight" || s.key === "ArrowDown")
|
|
187
|
-
s.preventDefault(),
|
|
188
|
+
s.preventDefault(), r = (a + 1) % e.length;
|
|
188
189
|
else if (s.key === "ArrowLeft" || s.key === "ArrowUp")
|
|
189
|
-
s.preventDefault(),
|
|
190
|
+
s.preventDefault(), r = (a - 1 + e.length) % e.length;
|
|
190
191
|
else if (s.key === "Home")
|
|
191
|
-
s.preventDefault(),
|
|
192
|
+
s.preventDefault(), r = 0;
|
|
192
193
|
else if (s.key === "End")
|
|
193
|
-
s.preventDefault(),
|
|
194
|
+
s.preventDefault(), r = e.length - 1;
|
|
194
195
|
else
|
|
195
196
|
return;
|
|
196
|
-
const
|
|
197
|
-
if (
|
|
198
|
-
const l = parseInt(
|
|
197
|
+
const o = e[r];
|
|
198
|
+
if (o && o.dataset.indice) {
|
|
199
|
+
const l = parseInt(o.dataset.indice, 10);
|
|
199
200
|
i(l);
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
|
-
const
|
|
203
|
+
const S = ':host{display:inline-block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([largura-total]),:host([full-width]){display:block;width:100%}.ui-segmented{display:inline-flex;position:relative;background-color:var(--ui-cor-fundo, #0b0b0d);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);padding:3px;box-sizing:border-box;-webkit-user-select:none;user-select:none;gap:2px;align-items:center}.ui-segmented--full{display:flex;width:100%}.ui-segmented--full .ui-segmented__item{flex:1}.ui-segmented--sm{padding:2px;height:28px}.ui-segmented--sm .ui-segmented__item{font-size:12px;padding:0 8px;height:22px}.ui-segmented--md{padding:3px;height:36px}.ui-segmented--md .ui-segmented__item{font-size:13px;padding:0 14px;height:28px}.ui-segmented--lg{padding:4px;height:42px}.ui-segmented--lg .ui-segmented__item{font-size:14px;padding:0 18px;height:32px}.ui-segmented__indicador{position:absolute;top:3px;bottom:3px;left:0;background-color:var(--ui-cor-fundo-card, #1e1e24);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:calc(var(--ui-raio-borda, 8px) - 2px);box-shadow:var(--ui-sombra-sm, 0 2px 8px rgba(0, 0, 0, .4));pointer-events:none;transition:transform .22s cubic-bezier(.16,1,.3,1),width .22s cubic-bezier(.16,1,.3,1),opacity .15s ease;z-index:1;opacity:0}.ui-segmented--sm .ui-segmented__indicador{top:2px;bottom:2px}.ui-segmented--lg .ui-segmented__indicador{top:4px;bottom:4px}.ui-segmented__item{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;gap:6px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-weight:500;cursor:pointer;border-radius:calc(var(--ui-raio-borda, 8px) - 2px);line-height:1;white-space:nowrap;transition:color .15s ease;box-sizing:border-box}.ui-segmented__item:hover:not(:disabled){color:var(--ui-cor-texto, #e1e1e6)}.ui-segmented__item--ativo{color:var(--ui-cor-texto, #ffffff)!important;font-weight:600}.ui-segmented__item:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-primaria, #00E08A)}.ui-segmented__item:disabled{opacity:.35;cursor:not-allowed}.ui-segmented__icone{display:inline-flex;align-items:center;justify-content:center;line-height:1}.ui-segmented__icone ui-icone,.ui-segmented__icone svg{shape-rendering:geometricPrecision;display:inline-flex;align-items:center;justify-content:center}', C = [
|
|
203
204
|
"valor",
|
|
204
205
|
"value",
|
|
205
206
|
"name",
|
|
@@ -212,28 +213,28 @@ const k = ':host{display:inline-block;box-sizing:border-box;font-family:var(--ui
|
|
|
212
213
|
"required",
|
|
213
214
|
"mensagem-validacao"
|
|
214
215
|
];
|
|
215
|
-
function
|
|
216
|
+
function I() {
|
|
216
217
|
return `
|
|
217
|
-
<style>${
|
|
218
|
-
<div class="ui-segmented ui-segmented--md" role="radiogroup">
|
|
219
|
-
<div class="ui-segmented__indicador"></div>
|
|
218
|
+
<style>${S}</style>
|
|
219
|
+
<div class="ui-segmented ui-segmented--md" part="base" role="radiogroup">
|
|
220
|
+
<div class="ui-segmented__indicador" part="indicador"></div>
|
|
220
221
|
<div class="ui-segmented__track" style="display: contents;"></div>
|
|
221
222
|
<slot style="display: none;"></slot>
|
|
222
223
|
</div>
|
|
223
224
|
`;
|
|
224
225
|
}
|
|
225
|
-
function
|
|
226
|
+
function q(s, n, t, i, e) {
|
|
226
227
|
const a = document.createElement("button");
|
|
227
|
-
a.type = "button", a.role = "radio", a.className = "ui-segmented__item", a.dataset.valor = s.valor, a.dataset.indice = String(n);
|
|
228
|
-
const
|
|
229
|
-
if (a.setAttribute("aria-checked", String(
|
|
228
|
+
a.type = "button", a.role = "radio", a.className = "ui-segmented__item", a.setAttribute("part", s.valor === t ? "opcao opcao-selecionada" : "opcao"), a.dataset.valor = s.valor, a.dataset.indice = String(n);
|
|
229
|
+
const r = s.valor === t;
|
|
230
|
+
if (a.setAttribute("aria-checked", String(r)), a.tabIndex = r ? 0 : -1, r && a.classList.add("ui-segmented__item--ativo"), (i || s.disabled) && (a.disabled = !0), s.icone) {
|
|
230
231
|
const l = document.createElement("span");
|
|
231
232
|
l.className = "ui-segmented__icone";
|
|
232
233
|
const c = document.createElement("ui-icone");
|
|
233
234
|
c.setAttribute("nome", s.icone), c.setAttribute("tamanho", "14"), l.appendChild(c), a.appendChild(l);
|
|
234
235
|
}
|
|
235
|
-
const
|
|
236
|
-
return
|
|
236
|
+
const o = document.createElement("span");
|
|
237
|
+
return o.className = "ui-segmented__texto", o.textContent = s.rotulo, a.appendChild(o), a.addEventListener("click", (l) => {
|
|
237
238
|
l.stopPropagation(), e();
|
|
238
239
|
}), a;
|
|
239
240
|
}
|
|
@@ -252,18 +253,18 @@ class m extends b {
|
|
|
252
253
|
this._opcoes.length === 0 && this.carregarOpcoes();
|
|
253
254
|
});
|
|
254
255
|
u(this, "handleKeyDown", (t) => {
|
|
255
|
-
|
|
256
|
+
k(t, this.trackElement, this.disabled, (i) => {
|
|
256
257
|
this.selecionarIndice(i);
|
|
257
258
|
});
|
|
258
259
|
});
|
|
259
260
|
const t = this.attachShadow({ mode: "open" });
|
|
260
|
-
t.innerHTML =
|
|
261
|
+
t.innerHTML = I(), this.rootElement = t.querySelector(".ui-segmented"), this.indicadorElement = t.querySelector(".ui-segmented__indicador"), this.trackElement = t.querySelector(".ui-segmented__track"), this.slotElement = t.querySelector("slot"), this.indicadorController = new z(
|
|
261
262
|
this.trackElement,
|
|
262
263
|
this.indicadorElement
|
|
263
264
|
);
|
|
264
265
|
}
|
|
265
266
|
static get observedAttributes() {
|
|
266
|
-
return
|
|
267
|
+
return C;
|
|
267
268
|
}
|
|
268
269
|
connectedCallback() {
|
|
269
270
|
this.listeners.cleanup(), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.slotElement, "slotchange", this.handleSlotChange), this._defaultValue || (this._defaultValue = this.getAttribute("valor") || this.getAttribute("value") || ""), this.indicadorController.iniciarObserver(this.rootElement), this.carregarOpcoes(), this.syncState();
|
|
@@ -336,10 +337,10 @@ class m extends b {
|
|
|
336
337
|
if (t.length > 0) {
|
|
337
338
|
const i = [];
|
|
338
339
|
t.forEach((e) => {
|
|
339
|
-
var a,
|
|
340
|
+
var a, r;
|
|
340
341
|
if (e instanceof HTMLElement) {
|
|
341
|
-
const
|
|
342
|
-
i.push({ valor:
|
|
342
|
+
const o = e.getAttribute("valor") || e.getAttribute("value") || e.getAttribute("data-value") || ((a = e.textContent) == null ? void 0 : a.trim()) || "", l = e.getAttribute("label") || e.getAttribute("rotulo") || ((r = e.textContent) == null ? void 0 : r.trim()) || o, c = e.getAttribute("icone") || e.getAttribute("icon") || void 0, p = e.hasAttribute("disabled");
|
|
343
|
+
i.push({ valor: o, rotulo: l, icone: c, disabled: p });
|
|
343
344
|
}
|
|
344
345
|
}), this._opcoes = i, this.renderizarOpcoes();
|
|
345
346
|
}
|
|
@@ -347,26 +348,26 @@ class m extends b {
|
|
|
347
348
|
renderizarOpcoes() {
|
|
348
349
|
this.trackElement.innerHTML = "";
|
|
349
350
|
const t = this.valor, i = this.disabled;
|
|
350
|
-
this._opcoes.forEach((a,
|
|
351
|
-
const
|
|
351
|
+
this._opcoes.forEach((a, r) => {
|
|
352
|
+
const o = q(
|
|
352
353
|
a,
|
|
353
|
-
|
|
354
|
+
r,
|
|
354
355
|
t,
|
|
355
356
|
i,
|
|
356
|
-
() => this.selecionarIndice(
|
|
357
|
+
() => this.selecionarIndice(r)
|
|
357
358
|
);
|
|
358
|
-
this.trackElement.appendChild(
|
|
359
|
+
this.trackElement.appendChild(o);
|
|
359
360
|
});
|
|
360
361
|
const e = this.required || this.hasAttribute("sem-selecao-inicial");
|
|
361
362
|
!t && this._opcoes.length > 0 && !e ? this.selecionarIndice(0, !1) : this.indicadorController.atualizar(), this.atualizarValidade();
|
|
362
363
|
}
|
|
363
364
|
selecionarIndice(t, i = !0) {
|
|
364
|
-
var
|
|
365
|
+
var r, o;
|
|
365
366
|
if (this.disabled) return;
|
|
366
367
|
const e = this._opcoes[t];
|
|
367
368
|
if (!e || e.disabled) return;
|
|
368
369
|
const a = this.valor;
|
|
369
|
-
this.setAttribute("valor", e.valor), this.internals && ((
|
|
370
|
+
this.setAttribute("valor", e.valor), this.internals && ((o = (r = this.internals).setFormValue) == null || o.call(r, e.valor)), this.atualizarSelecao(e.valor), i && a !== e.valor && (this.dispatchEvent(
|
|
370
371
|
new CustomEvent("ui-change", {
|
|
371
372
|
detail: { valor: e.valor, rotulo: e.rotulo, indice: t },
|
|
372
373
|
bubbles: !0,
|
|
@@ -382,30 +383,30 @@ class m extends b {
|
|
|
382
383
|
}
|
|
383
384
|
atualizarSelecao(t) {
|
|
384
385
|
var e, a;
|
|
385
|
-
Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((
|
|
386
|
-
const
|
|
387
|
-
|
|
386
|
+
Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((r) => {
|
|
387
|
+
const o = r.dataset.valor === t;
|
|
388
|
+
r.classList.toggle("ui-segmented__item--ativo", o), x(r, "opcao-selecionada", o), r.setAttribute("aria-checked", String(o)), r.tabIndex = o ? 0 : -1, o && r.focus();
|
|
388
389
|
}), this.internals && ((a = (e = this.internals).setFormValue) == null || a.call(e, t)), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
389
390
|
}
|
|
390
391
|
syncState() {
|
|
391
392
|
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md", i = this.hasAttribute("largura-total") || this.hasAttribute("full-width"), e = this.disabled;
|
|
392
|
-
this.rootElement.className = `ui-segmented ui-segmented--${t}`, i && this.rootElement.classList.add("ui-segmented--full"), this.rootElement.setAttribute("aria-disabled", String(e)), Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((
|
|
393
|
-
|
|
393
|
+
this.rootElement.className = `ui-segmented ui-segmented--${t}`, i && this.rootElement.classList.add("ui-segmented--full"), this.rootElement.setAttribute("aria-disabled", String(e)), Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((r) => {
|
|
394
|
+
r.disabled = e;
|
|
394
395
|
}), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
class
|
|
398
|
+
class L extends m {
|
|
398
399
|
}
|
|
399
400
|
d("ui-segmented", m);
|
|
400
|
-
d("ui-segmento",
|
|
401
|
+
d("ui-segmento", L);
|
|
401
402
|
export {
|
|
402
|
-
|
|
403
|
-
|
|
403
|
+
C as A,
|
|
404
|
+
z as S,
|
|
404
405
|
w as U,
|
|
405
406
|
m as a,
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
407
|
+
L as b,
|
|
408
|
+
A as c,
|
|
409
|
+
q as d,
|
|
410
|
+
I as e,
|
|
411
|
+
k as t
|
|
411
412
|
};
|