@thibezer/ui-components-kit 2.6.1 → 2.7.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 +49 -0
- package/dist/acessibilidade-CSzX-DkG.cjs +1 -0
- package/dist/acessibilidade-CUlSXc2X.js +38 -0
- package/dist/camadas.cjs +94 -94
- package/dist/camadas.js +1218 -1124
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +66 -65
- package/dist/canvas.js +3769 -3389
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-alerta/ui-toast.d.ts +4 -15
- package/dist/components/ui-avatar/ui-avatar.d.ts +11 -0
- package/dist/components/ui-badge/ui-badge.d.ts +2 -0
- package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +16 -0
- package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +24 -0
- package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +14 -0
- package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +17 -0
- package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +1 -7
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +0 -1
- package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +4 -11
- package/dist/components/ui-camadas/camadas-colecao.d.ts +27 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +13 -1
- package/dist/components/ui-camadas/camadas-drop-ops.d.ts +31 -0
- package/dist/components/ui-camadas/camadas-hierarquia.d.ts +10 -0
- package/dist/components/ui-camadas/camadas-lembranca.d.ts +34 -0
- package/dist/components/ui-camadas/camadas-render.d.ts +14 -0
- package/dist/components/ui-camadas/camadas-renomear.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +17 -0
- package/dist/components/ui-camadas/camadas-thumb.d.ts +1 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +3 -5
- package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +15 -0
- package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +2 -1
- package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
- package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +3 -8
- package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +26 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +21 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +39 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +68 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +37 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +48 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +24 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +53 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +33 -0
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +26 -106
- package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +3 -1
- package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +5 -0
- package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +5 -0
- package/dist/components/ui-canvas-cad/tipos.d.ts +37 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +4 -1
- package/dist/components/ui-checkbox/ui-checkbox.d.ts +4 -1
- package/dist/components/ui-mapa/mapa-atributos.d.ts +14 -0
- package/dist/components/ui-mapa/mapa-basemaps.d.ts +7 -0
- package/dist/components/ui-mapa/mapa-icones.d.ts +4 -0
- package/dist/components/ui-mapa/mapa-leaflet.d.ts +5 -0
- package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +22 -0
- package/dist/components/ui-mapa/tipos.d.ts +13 -0
- package/dist/components/ui-mapa/ui-mapa-linha.d.ts +12 -5
- package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +15 -6
- package/dist/components/ui-mapa/ui-mapa.d.ts +14 -1
- package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
- package/dist/components/ui-modal/modal-foco.d.ts +28 -0
- package/dist/components/ui-modal/ui-modal.d.ts +1 -11
- package/dist/components/ui-radio/radio-grupo-registry.d.ts +10 -0
- package/dist/components/ui-radio/ui-radio.d.ts +9 -2
- package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
- package/dist/components/ui-switch/ui-switch.d.ts +3 -1
- package/dist/components/ui-tabela/tabela-estados.d.ts +16 -0
- package/dist/components/ui-tabela/tabela-rolagem.d.ts +44 -0
- package/dist/components/ui-tabela/tabela-teclado.d.ts +16 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +1 -19
- package/dist/components/ui-tooltip/tooltip-popover.d.ts +7 -0
- package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +29 -0
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +24 -1
- package/dist/core/opcoes.d.ts +9 -0
- package/dist/core/rotulo-controle.d.ts +13 -0
- package/dist/core/tipos-toast.d.ts +16 -0
- package/dist/core/ui-bus.d.ts +9 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +12 -11
- package/dist/custom-elements.json +19484 -14657
- package/dist/data.cjs +1 -1
- package/dist/data.js +2 -2
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +21 -21
- package/dist/form-validacao-BlQFxUVj.js +104 -0
- package/dist/form-validacao-DIeyQVH5.cjs +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +46 -46
- package/dist/mapa.cjs +11 -16
- package/dist/mapa.js +242 -170
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/opcoes-CJYLi6kd.js +12 -0
- package/dist/opcoes-CkyDxBuQ.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +12 -13
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +8 -3
- package/dist/tipos-vue.d.ts +8 -3
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-ChiiiO1r.js +197 -0
- package/dist/ui-badge-DUCxyAG6.cjs +28 -0
- package/dist/{zero-js-triggers-C_KrvFOQ.js → ui-bus-CUd99VJi.js} +36 -103
- package/dist/ui-bus-XqBLlTYQ.cjs +1 -0
- package/dist/ui-campo-texto-CHTfMO-H.cjs +16 -0
- package/dist/ui-campo-texto-gum_jDdI.js +380 -0
- package/dist/ui-card-BNYCQ7g-.js +119 -0
- package/dist/ui-card-BrjBL-yo.cjs +20 -0
- package/dist/ui-controle-cores-BS0WYPdi.js +572 -0
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +111 -0
- package/dist/ui-modal-BkYvNP0G.js +214 -0
- package/dist/ui-modal-CUNbpbZ1.cjs +18 -0
- package/dist/ui-paleta-ferramentas-Ksh6gMW3.js +890 -0
- package/dist/ui-paleta-ferramentas-bDLPbiGA.cjs +21 -0
- package/dist/ui-segmented-BOaGRQw4.cjs +19 -0
- package/dist/ui-segmented-kbO1BLVs.js +439 -0
- package/dist/ui-skeleton-B2Rgrv8o.js +648 -0
- package/dist/ui-skeleton-BilwGdOm.js +634 -0
- package/dist/ui-skeleton-DiOxTBZK.cjs +52 -0
- package/dist/ui-skeleton-SPYqku8P.cjs +52 -0
- package/dist/ui-skeleton-W9uwIceA.js +585 -0
- package/dist/ui-skeleton-gZrJipCC.cjs +52 -0
- package/dist/ui-switch-BX6U5Ykm.cjs +53 -0
- package/dist/ui-switch-DO5jR0hy.js +915 -0
- package/dist/ui-tabela-propriedades-D9Echt2X.js +2667 -0
- package/dist/ui-tabela-propriedades-DzZlyNZ_.cjs +141 -0
- package/dist/zero-js-triggers-CJT988bR.js +83 -0
- package/dist/zero-js-triggers-CgM9IIQB.cjs +1 -0
- package/package.json +10 -3
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var A = (r, n, t) => n in r ? _(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var u = (r, n, t) => A(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { d as p, S as b } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
+
import { e as g, a as m } from "./opcoes-CJYLi6kd.js";
|
|
6
|
+
import { L as y } from "./listener-bag-DQgv7OON.js";
|
|
7
|
+
import { F as E } from "./ui-campo-texto-gum_jDdI.js";
|
|
8
|
+
import { a as w } from "./parts-CaoQiCfI.js";
|
|
9
|
+
const z = ':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}', v = ["h1", "h2", "h3", "h4", "h5", "h6", "corpo", "corpo-sm", "caption", "codigo"], S = ["primaria", "secundaria", "destaque", "erro", "sucesso", "alerta"], k = ["normal", "medio", "seminegrito", "negrito"], C = ["esquerda", "centro", "direita", "justificado"], I = /* @__PURE__ */ new Set([
|
|
10
|
+
"p",
|
|
11
|
+
"span",
|
|
12
|
+
"div",
|
|
13
|
+
"h1",
|
|
14
|
+
"h2",
|
|
15
|
+
"h3",
|
|
16
|
+
"h4",
|
|
17
|
+
"h5",
|
|
18
|
+
"h6",
|
|
19
|
+
"small",
|
|
20
|
+
"code",
|
|
21
|
+
"strong",
|
|
22
|
+
"em",
|
|
23
|
+
"label",
|
|
24
|
+
"blockquote",
|
|
25
|
+
"pre",
|
|
26
|
+
"b",
|
|
27
|
+
"i"
|
|
28
|
+
]);
|
|
29
|
+
class O extends b {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
u(this, "container");
|
|
33
|
+
u(this, "shadow");
|
|
34
|
+
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>${z}</style>`, this.shadow.appendChild(this.container)) : (this.shadow = null, this.container = null);
|
|
35
|
+
}
|
|
36
|
+
static get observedAttributes() {
|
|
37
|
+
return ["variante", "tag", "cor", "peso", "alinhamento", "truncar"];
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
this.render();
|
|
41
|
+
}
|
|
42
|
+
attributeChangedCallback(t, i, e) {
|
|
43
|
+
this.render();
|
|
44
|
+
}
|
|
45
|
+
resolveTag() {
|
|
46
|
+
const t = this.getAttribute("tag");
|
|
47
|
+
if (t) {
|
|
48
|
+
const e = t.toLowerCase().trim();
|
|
49
|
+
if (I.has(e))
|
|
50
|
+
return e;
|
|
51
|
+
console.warn(`[ui-texto] Tag "${t}" não permitida ou inválida. Utilizando fallback semântico.`);
|
|
52
|
+
}
|
|
53
|
+
const i = g(this.getAttribute("variante"), v, "corpo");
|
|
54
|
+
switch (i) {
|
|
55
|
+
case "h1":
|
|
56
|
+
case "h2":
|
|
57
|
+
case "h3":
|
|
58
|
+
case "h4":
|
|
59
|
+
case "h5":
|
|
60
|
+
case "h6":
|
|
61
|
+
return i;
|
|
62
|
+
case "caption":
|
|
63
|
+
return "small";
|
|
64
|
+
case "codigo":
|
|
65
|
+
return "code";
|
|
66
|
+
case "corpo-sm":
|
|
67
|
+
case "corpo":
|
|
68
|
+
default:
|
|
69
|
+
return "p";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
const t = this.resolveTag(), i = g(this.getAttribute("variante"), v, "corpo"), e = m(this.getAttribute("cor"), S), a = m(this.getAttribute("peso"), k), o = m(this.getAttribute("alinhamento"), C), s = this.hasAttribute("truncar");
|
|
74
|
+
if (this.container.tagName.toLowerCase() !== t) {
|
|
75
|
+
const c = document.createElement(t);
|
|
76
|
+
c.appendChild(document.createElement("slot")), this.shadow.replaceChild(c, this.container), this.container = c;
|
|
77
|
+
}
|
|
78
|
+
const l = ["ui-texto", `ui-texto--${i}`];
|
|
79
|
+
e && l.push(`ui-texto--cor-${e}`), a && l.push(`ui-texto--peso-${a}`), o && l.push(`ui-texto--alinhamento-${o}`), s && l.push("ui-texto--truncar"), this.container.className = l.join(" ");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
p("ui-texto", O);
|
|
83
|
+
const q = ':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}', f = ["xs", "sm", "md", "lg", "xl"], T = ["online", "offline", "ausente", "ocupado"], L = 8, N = 512;
|
|
84
|
+
class M extends b {
|
|
85
|
+
constructor() {
|
|
86
|
+
super();
|
|
87
|
+
u(this, "avatarElement");
|
|
88
|
+
u(this, "statusElement");
|
|
89
|
+
/** O que este componente escreveu em aria-label / aria-hidden (para distinguir do que o consumidor definiu). */
|
|
90
|
+
u(this, "_rotuloAuto", null);
|
|
91
|
+
u(this, "_ocultoAuto", !1);
|
|
92
|
+
u(this, "_sincronizando", !1);
|
|
93
|
+
const t = this.attachShadow({ mode: "open" });
|
|
94
|
+
t.innerHTML = `
|
|
95
|
+
<style>${q}</style>
|
|
96
|
+
<div class="ui-avatar">
|
|
97
|
+
<span class="ui-avatar__content"></span>
|
|
98
|
+
</div>
|
|
99
|
+
<span class="ui-avatar__status" style="display: none;"></span>
|
|
100
|
+
`, this.avatarElement = t.querySelector(".ui-avatar"), this.statusElement = t.querySelector(".ui-avatar__status");
|
|
101
|
+
}
|
|
102
|
+
static get observedAttributes() {
|
|
103
|
+
return [
|
|
104
|
+
"src",
|
|
105
|
+
"nome",
|
|
106
|
+
"name",
|
|
107
|
+
"tamanho",
|
|
108
|
+
"size",
|
|
109
|
+
"formato",
|
|
110
|
+
"status",
|
|
111
|
+
"aria-label"
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
connectedCallback() {
|
|
115
|
+
this.syncState();
|
|
116
|
+
}
|
|
117
|
+
attributeChangedCallback(t, i, e) {
|
|
118
|
+
this._sincronizando || this.syncState();
|
|
119
|
+
}
|
|
120
|
+
/** Iniciais por ponto de código (emoji e caracteres fora do BMP não são cortados ao meio). */
|
|
121
|
+
extrairIniciais(t) {
|
|
122
|
+
const i = t.trim().split(/\s+/).filter(Boolean);
|
|
123
|
+
if (i.length === 0) return "?";
|
|
124
|
+
if (i.length === 1)
|
|
125
|
+
return Array.from(i[0]).slice(0, 2).join("").toUpperCase();
|
|
126
|
+
const e = Array.from(i[0])[0], a = Array.from(i[i.length - 1])[0];
|
|
127
|
+
return (e + a).toUpperCase();
|
|
128
|
+
}
|
|
129
|
+
lerNome() {
|
|
130
|
+
return this.getAttribute("nome") || this.getAttribute("name") || "";
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Nome acessível: com nome, o host é uma imagem nomeada ("Ana, online"); sem nome, é decorativo.
|
|
134
|
+
* Um `aria-label`/`aria-hidden` definido pelo consumidor nunca é sobrescrito.
|
|
135
|
+
*/
|
|
136
|
+
sincronizarAcessibilidade(t, i) {
|
|
137
|
+
const e = this.getAttribute("aria-label"), a = e !== null && e !== this._rotuloAuto, o = this.hasAttribute("aria-hidden") && !this._ocultoAuto;
|
|
138
|
+
if (!(a || o)) {
|
|
139
|
+
if (this._sincronizando = !0, t) {
|
|
140
|
+
const s = i ? `${t}, ${i}` : t;
|
|
141
|
+
this.setAttribute("role", "img"), this.setAttribute("aria-label", s), this._rotuloAuto = s, this.removeAttribute("aria-hidden"), this._ocultoAuto = !1;
|
|
142
|
+
} else
|
|
143
|
+
this._rotuloAuto !== null && this.removeAttribute("aria-label"), this._rotuloAuto = null, this.removeAttribute("role"), this.setAttribute("aria-hidden", "true"), this._ocultoAuto = !0;
|
|
144
|
+
this._sincronizando = !1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
syncState() {
|
|
148
|
+
const t = this.getAttribute("src"), i = this.lerNome(), e = (this.getAttribute("tamanho") || this.getAttribute("size") || "md").trim().toLowerCase(), a = this.getAttribute("formato"), o = m(this.getAttribute("status"), T);
|
|
149
|
+
this.avatarElement.className = "ui-avatar";
|
|
150
|
+
const s = m(e, f), l = parseInt(e, 10);
|
|
151
|
+
s ? (this.avatarElement.classList.add(`ui-avatar--${s}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")) : Number.isFinite(l) && l >= L && l <= N ? this.avatarElement.style.setProperty("--ui-tamanho-avatar", `${l}px`) : (this.avatarElement.classList.add(`ui-avatar--${g(null, f, "md")}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")), a === "quadrado" && this.avatarElement.classList.add("ui-avatar--quadrado");
|
|
152
|
+
const c = this.avatarElement.querySelector(".ui-avatar__content");
|
|
153
|
+
if (c)
|
|
154
|
+
if (t) {
|
|
155
|
+
const d = c.querySelector("img");
|
|
156
|
+
if (d && d.getAttribute("src") === t)
|
|
157
|
+
d.alt = "";
|
|
158
|
+
else {
|
|
159
|
+
c.textContent = "";
|
|
160
|
+
const h = document.createElement("img");
|
|
161
|
+
h.className = "ui-avatar__img", h.src = t, h.alt = "", h.onerror = () => {
|
|
162
|
+
this.renderFallback(c, this.lerNome());
|
|
163
|
+
}, c.appendChild(h);
|
|
164
|
+
}
|
|
165
|
+
} else
|
|
166
|
+
c.textContent = "", this.renderFallback(c, i);
|
|
167
|
+
this.sincronizarAcessibilidade(i, o), o ? (this.statusElement.className = `ui-avatar__status ui-avatar__status--${o}`, this.statusElement.style.display = "block", this.statusElement.setAttribute("aria-hidden", "true")) : this.statusElement.style.display = "none";
|
|
168
|
+
}
|
|
169
|
+
renderFallback(t, i) {
|
|
170
|
+
i ? t.textContent = this.extrairIniciais(i) : t.innerHTML = `
|
|
171
|
+
<svg viewBox="0 0 24 24" width="60%" height="60%" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
172
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
173
|
+
<circle cx="12" cy="7" r="4"></circle>
|
|
174
|
+
</svg>
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
p("ui-avatar", M);
|
|
179
|
+
class $ {
|
|
180
|
+
constructor(n, t) {
|
|
181
|
+
u(this, "rafId", null);
|
|
182
|
+
u(this, "resizeObserver");
|
|
183
|
+
this.trackElement = n, this.indicadorElement = t;
|
|
184
|
+
}
|
|
185
|
+
iniciarObserver(n, t) {
|
|
186
|
+
typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => {
|
|
187
|
+
this.atualizar(), t && t();
|
|
188
|
+
}), this.resizeObserver.observe(n));
|
|
189
|
+
}
|
|
190
|
+
destruir() {
|
|
191
|
+
this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
|
|
192
|
+
}
|
|
193
|
+
atualizar() {
|
|
194
|
+
this.rafId !== null && cancelAnimationFrame(this.rafId), this.rafId = requestAnimationFrame(() => {
|
|
195
|
+
this.rafId = null;
|
|
196
|
+
const n = this.trackElement.querySelector(".ui-segmented__item--ativo");
|
|
197
|
+
if (!n) {
|
|
198
|
+
this.indicadorElement.style.opacity = "0";
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const t = Math.round(n.offsetLeft), i = Math.round(n.offsetWidth);
|
|
202
|
+
this.indicadorElement.style.transform = `translateX(${t}px)`, this.indicadorElement.style.width = `${i}px`, this.indicadorElement.style.opacity = "1";
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function V(r, n, t, i) {
|
|
207
|
+
if (t) return;
|
|
208
|
+
const e = Array.from(
|
|
209
|
+
n.querySelectorAll(".ui-segmented__item:not(:disabled)")
|
|
210
|
+
);
|
|
211
|
+
if (e.length === 0) return;
|
|
212
|
+
const a = e.findIndex((l) => l.classList.contains("ui-segmented__item--ativo"));
|
|
213
|
+
let o = a;
|
|
214
|
+
if (r.key === "ArrowRight" || r.key === "ArrowDown")
|
|
215
|
+
r.preventDefault(), o = (a + 1) % e.length;
|
|
216
|
+
else if (r.key === "ArrowLeft" || r.key === "ArrowUp")
|
|
217
|
+
r.preventDefault(), o = (a - 1 + e.length) % e.length;
|
|
218
|
+
else if (r.key === "Home")
|
|
219
|
+
r.preventDefault(), o = 0;
|
|
220
|
+
else if (r.key === "End")
|
|
221
|
+
r.preventDefault(), o = e.length - 1;
|
|
222
|
+
else
|
|
223
|
+
return;
|
|
224
|
+
const s = e[o];
|
|
225
|
+
if (s && s.dataset.indice) {
|
|
226
|
+
const l = parseInt(s.dataset.indice, 10);
|
|
227
|
+
i(l);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const D = ':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}', H = [
|
|
231
|
+
"valor",
|
|
232
|
+
"value",
|
|
233
|
+
"name",
|
|
234
|
+
"disabled",
|
|
235
|
+
"tamanho",
|
|
236
|
+
"size",
|
|
237
|
+
"largura-total",
|
|
238
|
+
"full-width",
|
|
239
|
+
"obrigatorio",
|
|
240
|
+
"required",
|
|
241
|
+
"mensagem-validacao"
|
|
242
|
+
];
|
|
243
|
+
function j() {
|
|
244
|
+
return `
|
|
245
|
+
<style>${D}</style>
|
|
246
|
+
<div class="ui-segmented ui-segmented--md" part="base" role="radiogroup">
|
|
247
|
+
<div class="ui-segmented__indicador" part="indicador"></div>
|
|
248
|
+
<div class="ui-segmented__track" style="display: contents;"></div>
|
|
249
|
+
<slot style="display: none;"></slot>
|
|
250
|
+
</div>
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
function F(r, n, t, i, e) {
|
|
254
|
+
const a = document.createElement("button");
|
|
255
|
+
a.type = "button", a.role = "radio", a.className = "ui-segmented__item", a.setAttribute("part", r.valor === t ? "opcao opcao-selecionada" : "opcao"), a.dataset.valor = r.valor, a.dataset.indice = String(n);
|
|
256
|
+
const o = r.valor === t;
|
|
257
|
+
if (a.setAttribute("aria-checked", String(o)), a.tabIndex = o ? 0 : -1, o && a.classList.add("ui-segmented__item--ativo"), (i || r.disabled) && (a.disabled = !0), r.icone) {
|
|
258
|
+
const l = document.createElement("span");
|
|
259
|
+
l.className = "ui-segmented__icone";
|
|
260
|
+
const c = document.createElement("ui-icone");
|
|
261
|
+
c.setAttribute("nome", r.icone), c.setAttribute("tamanho", "14"), l.appendChild(c), a.appendChild(l);
|
|
262
|
+
}
|
|
263
|
+
const s = document.createElement("span");
|
|
264
|
+
return s.className = "ui-segmented__texto", s.textContent = r.rotulo, a.appendChild(s), a.addEventListener("click", (l) => {
|
|
265
|
+
l.stopPropagation(), e();
|
|
266
|
+
}), a;
|
|
267
|
+
}
|
|
268
|
+
class x extends E {
|
|
269
|
+
constructor() {
|
|
270
|
+
super();
|
|
271
|
+
u(this, "rootElement");
|
|
272
|
+
u(this, "trackElement");
|
|
273
|
+
u(this, "indicadorElement");
|
|
274
|
+
u(this, "slotElement");
|
|
275
|
+
u(this, "_opcoes", []);
|
|
276
|
+
u(this, "_defaultValue", "");
|
|
277
|
+
u(this, "listeners", new y());
|
|
278
|
+
u(this, "indicadorController");
|
|
279
|
+
u(this, "handleSlotChange", () => {
|
|
280
|
+
this._opcoes.length === 0 && this.carregarOpcoes();
|
|
281
|
+
});
|
|
282
|
+
u(this, "handleKeyDown", (t) => {
|
|
283
|
+
V(t, this.trackElement, this.disabled, (i) => {
|
|
284
|
+
this.selecionarIndice(i);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
const t = this.attachShadow({ mode: "open" });
|
|
288
|
+
t.innerHTML = j(), 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 $(
|
|
289
|
+
this.trackElement,
|
|
290
|
+
this.indicadorElement
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
static get observedAttributes() {
|
|
294
|
+
return H;
|
|
295
|
+
}
|
|
296
|
+
connectedCallback() {
|
|
297
|
+
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();
|
|
298
|
+
}
|
|
299
|
+
disconnectedCallback() {
|
|
300
|
+
this.listeners.cleanup(), this.indicadorController.destruir();
|
|
301
|
+
}
|
|
302
|
+
attributeChangedCallback(t, i, e) {
|
|
303
|
+
i !== e && (t === "valor" || t === "value" ? this.atualizarSelecao(e || "") : this.syncState());
|
|
304
|
+
}
|
|
305
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
306
|
+
formResetCallback() {
|
|
307
|
+
this.valor = this._defaultValue, this.syncState();
|
|
308
|
+
}
|
|
309
|
+
formStateRestoreCallback(t, i) {
|
|
310
|
+
typeof t == "string" && (this.valor = t), this.syncState();
|
|
311
|
+
}
|
|
312
|
+
get type() {
|
|
313
|
+
return "select-one";
|
|
314
|
+
}
|
|
315
|
+
atualizarValidade() {
|
|
316
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
317
|
+
if (this.disabled) {
|
|
318
|
+
this.internals.setValidity({});
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (this._customErrorMessage) {
|
|
322
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.rootElement);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this.valor || this.valor.trim() === "")) {
|
|
326
|
+
const i = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
327
|
+
this.internals.setValidity({ valueMissing: !0 }, i, this.rootElement);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
this.internals.setValidity({});
|
|
331
|
+
}
|
|
332
|
+
get valor() {
|
|
333
|
+
return this.getAttribute("valor") || this.getAttribute("value") || "";
|
|
334
|
+
}
|
|
335
|
+
set valor(t) {
|
|
336
|
+
this.setAttribute("valor", t), this.atualizarSelecao(t);
|
|
337
|
+
}
|
|
338
|
+
get value() {
|
|
339
|
+
return this.valor;
|
|
340
|
+
}
|
|
341
|
+
set value(t) {
|
|
342
|
+
this.valor = t;
|
|
343
|
+
}
|
|
344
|
+
get name() {
|
|
345
|
+
return this.getAttribute("name") || "";
|
|
346
|
+
}
|
|
347
|
+
set name(t) {
|
|
348
|
+
this.setAttribute("name", t);
|
|
349
|
+
}
|
|
350
|
+
get disabled() {
|
|
351
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
352
|
+
}
|
|
353
|
+
set disabled(t) {
|
|
354
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
355
|
+
}
|
|
356
|
+
get opcoes() {
|
|
357
|
+
return this._opcoes;
|
|
358
|
+
}
|
|
359
|
+
set opcoes(t) {
|
|
360
|
+
this._opcoes = Array.isArray(t) ? t : [], this.renderizarOpcoes();
|
|
361
|
+
}
|
|
362
|
+
carregarOpcoes() {
|
|
363
|
+
const t = this.slotElement.assignedElements();
|
|
364
|
+
if (t.length > 0) {
|
|
365
|
+
const i = [];
|
|
366
|
+
t.forEach((e) => {
|
|
367
|
+
var a, o;
|
|
368
|
+
if (e instanceof HTMLElement) {
|
|
369
|
+
const s = 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") || ((o = e.textContent) == null ? void 0 : o.trim()) || s, c = e.getAttribute("icone") || e.getAttribute("icon") || void 0, d = e.hasAttribute("disabled");
|
|
370
|
+
i.push({ valor: s, rotulo: l, icone: c, disabled: d });
|
|
371
|
+
}
|
|
372
|
+
}), this._opcoes = i, this.renderizarOpcoes();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
renderizarOpcoes() {
|
|
376
|
+
this.trackElement.innerHTML = "";
|
|
377
|
+
const t = this.valor, i = this.disabled;
|
|
378
|
+
this._opcoes.forEach((a, o) => {
|
|
379
|
+
const s = F(
|
|
380
|
+
a,
|
|
381
|
+
o,
|
|
382
|
+
t,
|
|
383
|
+
i,
|
|
384
|
+
() => this.selecionarIndice(o)
|
|
385
|
+
);
|
|
386
|
+
this.trackElement.appendChild(s);
|
|
387
|
+
});
|
|
388
|
+
const e = this.required || this.hasAttribute("sem-selecao-inicial");
|
|
389
|
+
!t && this._opcoes.length > 0 && !e ? this.selecionarIndice(0, !1) : this.indicadorController.atualizar(), this.atualizarValidade();
|
|
390
|
+
}
|
|
391
|
+
selecionarIndice(t, i = !0) {
|
|
392
|
+
var o, s;
|
|
393
|
+
if (this.disabled) return;
|
|
394
|
+
const e = this._opcoes[t];
|
|
395
|
+
if (!e || e.disabled) return;
|
|
396
|
+
const a = this.valor;
|
|
397
|
+
this.setAttribute("valor", e.valor), this.internals && ((s = (o = this.internals).setFormValue) == null || s.call(o, e.valor)), this.atualizarSelecao(e.valor), i && a !== e.valor && (this.dispatchEvent(
|
|
398
|
+
new CustomEvent("ui-change", {
|
|
399
|
+
detail: { valor: e.valor, rotulo: e.rotulo, indice: t },
|
|
400
|
+
bubbles: !0,
|
|
401
|
+
composed: !0
|
|
402
|
+
})
|
|
403
|
+
), this.dispatchEvent(
|
|
404
|
+
new CustomEvent("ui-selecionar", {
|
|
405
|
+
detail: { valor: e.valor, rotulo: e.rotulo, indice: t },
|
|
406
|
+
bubbles: !0,
|
|
407
|
+
composed: !0
|
|
408
|
+
})
|
|
409
|
+
));
|
|
410
|
+
}
|
|
411
|
+
atualizarSelecao(t) {
|
|
412
|
+
var e, a;
|
|
413
|
+
Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((o) => {
|
|
414
|
+
const s = o.dataset.valor === t;
|
|
415
|
+
o.classList.toggle("ui-segmented__item--ativo", s), w(o, "opcao-selecionada", s), o.setAttribute("aria-checked", String(s)), o.tabIndex = s ? 0 : -1, s && o.focus();
|
|
416
|
+
}), this.internals && ((a = (e = this.internals).setFormValue) == null || a.call(e, t)), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
417
|
+
}
|
|
418
|
+
syncState() {
|
|
419
|
+
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md", i = this.hasAttribute("largura-total") || this.hasAttribute("full-width"), e = this.disabled;
|
|
420
|
+
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((o) => {
|
|
421
|
+
o.disabled = e;
|
|
422
|
+
}), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
class R extends x {
|
|
426
|
+
}
|
|
427
|
+
p("ui-segmented", x);
|
|
428
|
+
p("ui-segmento", R);
|
|
429
|
+
export {
|
|
430
|
+
H as A,
|
|
431
|
+
$ as S,
|
|
432
|
+
M as U,
|
|
433
|
+
x as a,
|
|
434
|
+
R as b,
|
|
435
|
+
O as c,
|
|
436
|
+
F as d,
|
|
437
|
+
j as e,
|
|
438
|
+
V as t
|
|
439
|
+
};
|