@thibezer/ui-components-kit 2.15.0 → 2.17.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 +42 -0
- package/README.md +1 -1
- package/dist/botao.cjs +1 -1
- package/dist/botao.js +1 -1
- package/dist/camadas.cjs +50 -50
- package/dist/camadas.js +381 -373
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +24 -24
- package/dist/canvas.js +757 -751
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-avatar/ui-avatar.d.ts +7 -0
- package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +2 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +7 -0
- package/dist/components/ui-mapa/ui-mapa.d.ts +1 -0
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +6 -0
- package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
- package/dist/components/ui-stat/ui-stat.d.ts +12 -0
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +2 -1
- package/dist/components/ui-tabela-propriedades/propriedades-persistencia.d.ts +63 -0
- package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +1 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +16 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +40 -1
- package/dist/core/degrade.d.ts +34 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +33 -24
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +1 -1
- package/dist/custom-elements.json +20565 -19020
- package/dist/data.cjs +1 -1
- package/dist/data.js +89 -79
- package/dist/degrade-CIxvOTUv.cjs +1 -0
- package/dist/degrade-gDa5sW__.js +119 -0
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +2 -2
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +215 -196
- package/dist/mapa.cjs +1 -1
- package/dist/mapa.js +1 -1
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/register.cjs +1 -1
- package/dist/register.js +11 -11
- package/dist/seletor-mapa-base.cjs +10 -10
- package/dist/seletor-mapa-base.js +34 -28
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +83 -73
- package/dist/tipos-elementos.d.ts +33 -3
- package/dist/tipos-vue.d.ts +30 -3
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-1UU8vT-b.js +198 -0
- package/dist/ui-badge-CKKKPdt8.cjs +28 -0
- package/dist/ui-badge-DE58YSBY.cjs +28 -0
- package/dist/ui-badge-KgmI3jOD.js +201 -0
- package/dist/ui-botao-Dz8YvmiA.cjs +12 -0
- package/dist/ui-botao-bU_bf6SU.js +166 -0
- package/dist/ui-botao-xTbH5mpH.cjs +12 -0
- package/dist/ui-botao-zLkcMMyP.js +168 -0
- package/dist/ui-campo-texto-DVU_sWV1.cjs +16 -0
- package/dist/ui-campo-texto-Dliyt9qr.cjs +16 -0
- package/dist/ui-campo-texto-W5M0gNE4.js +377 -0
- package/dist/ui-campo-texto-btevggO3.js +379 -0
- package/dist/ui-card-BYyYxxY1.cjs +20 -0
- package/dist/ui-card-CojoGXaT.js +144 -0
- package/dist/ui-card-DFnRp9bl.js +146 -0
- package/dist/ui-card-DrWVJQKw.cjs +20 -0
- package/dist/ui-controle-cores-Bq_XUrIQ.cjs +32 -0
- package/dist/ui-controle-cores-BtA6yzu3.js +291 -0
- package/dist/ui-kit.css +1 -1
- package/dist/ui-linha-2kY7TNUJ.cjs +38 -0
- package/dist/ui-linha-DAz6DBcl.cjs +38 -0
- package/dist/ui-linha-DkxwMhD-.js +749 -0
- package/dist/ui-linha-KFF86FW5.js +752 -0
- package/dist/ui-modal-4nU-tXjO.cjs +18 -0
- package/dist/ui-modal-BrXzVZ65.js +216 -0
- package/dist/ui-modal-BwB9fksp.js +214 -0
- package/dist/ui-modal-lARKzEVZ.cjs +18 -0
- package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +1245 -0
- package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +21 -0
- package/dist/ui-skeleton-BLEV6h3k.js +653 -0
- package/dist/ui-skeleton-B_XTaGrX.cjs +52 -0
- package/dist/ui-skeleton-DEHwpDqa.js +648 -0
- package/dist/ui-skeleton-sIphhOSx.cjs +52 -0
- package/dist/ui-switch-BXIDwC-Y.cjs +66 -0
- package/dist/ui-switch-Ctxk-jKS.js +1212 -0
- package/dist/ui-switch-DAIgOhqr.cjs +66 -0
- package/dist/ui-switch-_F8yubdX.js +1203 -0
- package/dist/ui-tabela-propriedades-2bq2nX-b.js +3202 -0
- package/dist/ui-tabela-propriedades-CJyo568n.js +3517 -0
- package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +142 -0
- package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +142 -0
- package/package.json +187 -187
|
@@ -0,0 +1,1212 @@
|
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var C = (o, i, t) => i in o ? z(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
|
|
3
|
+
var s = (o, i, t) => C(o, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { A as b, a as d, e as L } from "./degrade-gDa5sW__.js";
|
|
5
|
+
import { F as m, r as E, s as q } from "./ui-campo-texto-btevggO3.js";
|
|
6
|
+
import { L as p } from "./listener-bag-DQgv7OON.js";
|
|
7
|
+
import { d as h } from "./ssr-safe-5cWfJP-s.js";
|
|
8
|
+
import { g as f, o as x, c as g } from "./acessibilidade-CUlSXc2X.js";
|
|
9
|
+
import { v as I, a as D } from "./form-validacao-BlQFxUVj.js";
|
|
10
|
+
import { i as u, b as V, e as R } from "./opcoes-CupvWVIm.js";
|
|
11
|
+
import { a as M } from "./parts-CaoQiCfI.js";
|
|
12
|
+
import { b as _ } from "./altura-controle-vxQiXG4q.js";
|
|
13
|
+
const F = ':host{display:flex;flex-direction:column;gap:4px;width:100%;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){width:auto;display:inline-flex}.ui-area-texto__container{position:relative;width:100%;display:flex;flex-direction:column}.ui-area-texto__label{display:flex;align-items:center;justify-content:space-between;font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-medio, 500);color:var(--ui-cor-texto, #e1e1e6);-webkit-user-select:none;user-select:none;margin-bottom:4px;flex-shrink:0}.ui-area-texto__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px;font-weight:600}.ui-area-texto__wrapper{position:relative;display:flex;width:100%;background:var(--ui-degrade-interno, var(--ui-area-texto-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);box-sizing:border-box;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.ui-area-texto__wrapper:focus-within{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);background:var(--ui-degrade-interno, var(--ui-area-texto-fundo, var(--ui-fundo-card, var(--ui-cor-fundo-menu, #18181c))))}.ui-area-texto__wrapper--erro{border-color:var(--ui-cor-texto-erro, #ff5555)!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 18%,transparent)!important}.ui-area-texto__wrapper--disabled{opacity:.5;cursor:not-allowed;background:var(--ui-area-texto-desabilitado-fundo, color-mix(in srgb, var(--ui-cor-texto, #e1e1e6) 3%, transparent))}.ui-area-texto__input{display:block;flex:1;width:100%;min-width:0;max-height:calc(var(--ui-area-linhas-max) * 1.5em + 12px);background:transparent;border:none;outline:none;color:var(--ui-cor-texto, #e1e1e6);font-family:inherit;font-size:var(--ui-tamanho-corpo-sm, 13px);line-height:1.5;padding:6px 8px;margin:0;box-sizing:border-box;resize:vertical;overflow-wrap:anywhere;touch-action:manipulation}.ui-area-texto__input::placeholder{color:var(--ui-cor-texto-secundario, #888899);opacity:.65}.ui-area-texto__input:disabled{cursor:not-allowed;resize:none}.ui-area-texto__rodape{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.ui-area-texto__helper{flex:1;min-width:0;font-size:var(--ui-tamanho-caption, 11px);color:var(--ui-cor-texto-secundario, #888899);line-height:var(--ui-altura-linha-compacta, 1.2);margin-top:2px}.ui-area-texto__helper--erro{color:var(--ui-cor-texto-erro, #ff5555);font-weight:500}.ui-area-texto__contador{margin-left:auto;flex-shrink:0;font-size:var(--ui-tamanho-caption, 11px);line-height:var(--ui-altura-linha-compacta, 1.2);margin-top:2px;color:var(--ui-cor-texto-secundario, #888899);font-variant-numeric:tabular-nums}.ui-area-texto__contador[hidden]{display:none}.ui-area-texto__contador--aviso{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-area-texto__contador--excedido{color:var(--ui-cor-texto-erro, #ff5555);font-weight:600}.ui-area-texto__anuncio{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@media (max-width: 640px),(pointer: coarse) and (max-width: 1024px){.ui-area-texto__input{font-size:16px}.ui-area-texto__label{font-size:13px}}@media (prefers-reduced-motion: reduce){.ui-area-texto__wrapper{transition:none}}:host(.squarecircle) .ui-area-texto__wrapper,:host(.squarecircles) .ui-area-texto__wrapper,:host(.ui-squarecircle) .ui-area-texto__wrapper,:host(.ui-squarecircles) .ui-area-texto__wrapper,:host([formato="squarecircle"]) .ui-area-texto__wrapper,:host([formato="squarecircles"]) .ui-area-texto__wrapper,:host([formato="squircle"]) .ui-area-texto__wrapper{border-radius:var(--ui-raio-lg, 10px)}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-card: var(--ui-gradiente-card)}', T = [
|
|
14
|
+
"label",
|
|
15
|
+
"placeholder",
|
|
16
|
+
"value",
|
|
17
|
+
"obrigatorio",
|
|
18
|
+
"required",
|
|
19
|
+
"minlength",
|
|
20
|
+
"min-length",
|
|
21
|
+
"maxlength",
|
|
22
|
+
"max-length",
|
|
23
|
+
"mensagem-validacao",
|
|
24
|
+
"helper-text",
|
|
25
|
+
"erro",
|
|
26
|
+
"mensagem-erro",
|
|
27
|
+
"disabled",
|
|
28
|
+
"readonly",
|
|
29
|
+
"linhas",
|
|
30
|
+
"linhas-max",
|
|
31
|
+
"auto-altura",
|
|
32
|
+
"redimensionar",
|
|
33
|
+
"contador",
|
|
34
|
+
"aria-label",
|
|
35
|
+
...b
|
|
36
|
+
];
|
|
37
|
+
function H() {
|
|
38
|
+
return `
|
|
39
|
+
<style>${F}</style>
|
|
40
|
+
<div class="ui-area-texto__container">
|
|
41
|
+
<label class="ui-area-texto__label" part="rotulo" style="display: none;"></label>
|
|
42
|
+
<div class="ui-area-texto__wrapper" part="campo">
|
|
43
|
+
<textarea class="ui-area-texto__input" part="input" rows="4"></textarea>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="ui-area-texto__rodape" part="rodape">
|
|
47
|
+
<div class="ui-area-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
48
|
+
<span class="ui-area-texto__contador" part="contador" aria-hidden="true" hidden></span>
|
|
49
|
+
</div>
|
|
50
|
+
<span class="ui-area-texto__anuncio" role="status" aria-live="polite"></span>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
const $ = 0.9;
|
|
54
|
+
function O(o, i) {
|
|
55
|
+
const t = Number.isFinite(o) && o > 0 ? Math.trunc(o) : 0, e = i !== null && Number.isFinite(i) && i > 0 ? Math.trunc(i) : null;
|
|
56
|
+
if (e === null) return { texto: String(t), nivel: "normal", anuncio: "" };
|
|
57
|
+
const a = `${t} / ${e}`;
|
|
58
|
+
if (t > e)
|
|
59
|
+
return { texto: a, nivel: "excedido", anuncio: `Limite de ${e} caracteres excedido em ${t - e}.` };
|
|
60
|
+
if (t >= e * $) {
|
|
61
|
+
const r = e - t;
|
|
62
|
+
return {
|
|
63
|
+
texto: a,
|
|
64
|
+
nivel: "aviso",
|
|
65
|
+
anuncio: r === 0 ? `Limite de ${e} caracteres atingido.` : `Restam ${r} caracteres.`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return { texto: a, nivel: "normal", anuncio: "" };
|
|
69
|
+
}
|
|
70
|
+
function B(o, i) {
|
|
71
|
+
return !Number.isFinite(o) || !Number.isFinite(i) || o <= 0 || o <= i ? null : Math.ceil(o);
|
|
72
|
+
}
|
|
73
|
+
function y(o, i) {
|
|
74
|
+
const t = i.offsetHeight;
|
|
75
|
+
t > 0 && (i.style.minHeight = `${t}px`), o.style.height = "auto";
|
|
76
|
+
const e = B(o.scrollHeight, o.clientHeight);
|
|
77
|
+
e !== null && (o.style.height = `${e}px`), i.style.minHeight = "";
|
|
78
|
+
}
|
|
79
|
+
function N(o, i) {
|
|
80
|
+
o.style.height = "", i.style.minHeight = "";
|
|
81
|
+
}
|
|
82
|
+
const P = ["nenhum", "vertical", "horizontal", "ambos"], U = {
|
|
83
|
+
nenhum: "none",
|
|
84
|
+
vertical: "vertical",
|
|
85
|
+
horizontal: "horizontal",
|
|
86
|
+
ambos: "both"
|
|
87
|
+
}, K = ["normal", "aviso", "excedido"], j = 4, G = 50, W = 200;
|
|
88
|
+
class k extends m {
|
|
89
|
+
constructor() {
|
|
90
|
+
super();
|
|
91
|
+
s(this, "labelElement");
|
|
92
|
+
s(this, "wrapperElement");
|
|
93
|
+
s(this, "textareaElement");
|
|
94
|
+
s(this, "helperElement");
|
|
95
|
+
s(this, "contadorElement");
|
|
96
|
+
s(this, "anuncioElement");
|
|
97
|
+
s(this, "listeners", new p());
|
|
98
|
+
s(this, "_focado", !1);
|
|
99
|
+
s(this, "_textareaId");
|
|
100
|
+
s(this, "_defaultValue", "");
|
|
101
|
+
s(this, "_nivelAnunciado", "normal");
|
|
102
|
+
s(this, "handleInput", (t) => {
|
|
103
|
+
t.stopPropagation(), this.syncState(), this.emitirEdicao("ui-input", "input", this.textareaElement.value);
|
|
104
|
+
});
|
|
105
|
+
s(this, "handleChange", (t) => {
|
|
106
|
+
t.stopPropagation(), this.syncState(), this.emitirEdicao("ui-change", "change", this.textareaElement.value);
|
|
107
|
+
});
|
|
108
|
+
s(this, "handleFocus", () => {
|
|
109
|
+
this._focado = !0;
|
|
110
|
+
});
|
|
111
|
+
s(this, "handleBlur", () => {
|
|
112
|
+
this._focado = !1, this.syncState();
|
|
113
|
+
});
|
|
114
|
+
/** Ctrl/Cmd + Enter pede o envio sem submeter o `<form>`; Enter comum continua inserindo quebra de linha. */
|
|
115
|
+
s(this, "handleKeyDown", (t) => {
|
|
116
|
+
t.key !== "Enter" || t.isComposing || t.altKey || t.shiftKey || !(t.ctrlKey || t.metaKey) || this.disabled || this.readOnly || (t.preventDefault(), this.dispatchEvent(
|
|
117
|
+
new CustomEvent("ui-enviar", {
|
|
118
|
+
detail: { value: this.textareaElement.value },
|
|
119
|
+
bubbles: !0,
|
|
120
|
+
composed: !0
|
|
121
|
+
})
|
|
122
|
+
));
|
|
123
|
+
});
|
|
124
|
+
/** Clique em `<label>` externo associado ao host foca o textarea. */
|
|
125
|
+
s(this, "handleHostClick", (t) => {
|
|
126
|
+
g(this, t) && !this.disabled && this.textareaElement.focus();
|
|
127
|
+
});
|
|
128
|
+
s(this, "handleResize", () => {
|
|
129
|
+
this.hasAttribute("auto-altura") && y(this.textareaElement, this.wrapperElement);
|
|
130
|
+
});
|
|
131
|
+
const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
|
|
132
|
+
t.innerHTML = H(), this.labelElement = t.querySelector(".ui-area-texto__label"), this.wrapperElement = t.querySelector(".ui-area-texto__wrapper"), this.textareaElement = t.querySelector(".ui-area-texto__input"), this.helperElement = t.querySelector(".ui-area-texto__helper"), this.contadorElement = t.querySelector(".ui-area-texto__contador"), this.anuncioElement = t.querySelector(".ui-area-texto__anuncio"), this._textareaId = f("ui-area"), this.textareaElement.id = this._textareaId, this.labelElement.htmlFor = this._textareaId, this.helperElement.id = `${this._textareaId}-ajuda`;
|
|
133
|
+
}
|
|
134
|
+
static get observedAttributes() {
|
|
135
|
+
return T;
|
|
136
|
+
}
|
|
137
|
+
connectedCallback() {
|
|
138
|
+
this.listeners.cleanup(), this.listeners.add(this.textareaElement, "input", this.handleInput), this.listeners.add(this.textareaElement, "change", this.handleChange), this.listeners.add(this.textareaElement, "focus", this.handleFocus), this.listeners.add(this.textareaElement, "blur", this.handleBlur), this.listeners.add(this.textareaElement, "keydown", this.handleKeyDown), this.listeners.add(this, "click", this.handleHostClick), this.listeners.add(typeof window < "u" ? window : null, "resize", this.handleResize), this._defaultValue = this.getAttribute("value") ?? "", this.hasAttribute("value") && !this.textareaElement.value && (this.textareaElement.value = this._defaultValue), this.syncState();
|
|
139
|
+
}
|
|
140
|
+
disconnectedCallback() {
|
|
141
|
+
this.listeners.cleanup();
|
|
142
|
+
}
|
|
143
|
+
attributeChangedCallback(t, e, a) {
|
|
144
|
+
t === "value" && a !== this.textareaElement.value && !this._focado && (this.textareaElement.value = a ?? ""), this.syncState();
|
|
145
|
+
}
|
|
146
|
+
// === API pública ===
|
|
147
|
+
focus(t) {
|
|
148
|
+
this.textareaElement.focus(t);
|
|
149
|
+
}
|
|
150
|
+
blur() {
|
|
151
|
+
this.textareaElement.blur();
|
|
152
|
+
}
|
|
153
|
+
/** Seleciona todo o texto. */
|
|
154
|
+
select() {
|
|
155
|
+
this.textareaElement.select();
|
|
156
|
+
}
|
|
157
|
+
/** Define a seleção; índices inválidos são ignorados pelo navegador, nunca lançam. */
|
|
158
|
+
setSelectionRange(t, e, a) {
|
|
159
|
+
try {
|
|
160
|
+
this.textareaElement.setSelectionRange(t, e, a);
|
|
161
|
+
} catch {
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/** Apaga o texto programaticamente (sem disparar eventos de edição). */
|
|
165
|
+
limpar() {
|
|
166
|
+
this.value = "";
|
|
167
|
+
}
|
|
168
|
+
get value() {
|
|
169
|
+
return this.textareaElement ? this.textareaElement.value : this.getAttribute("value") ?? "";
|
|
170
|
+
}
|
|
171
|
+
set value(t) {
|
|
172
|
+
const e = t == null ? "" : String(t);
|
|
173
|
+
this.setAttribute("value", e);
|
|
174
|
+
try {
|
|
175
|
+
this.textareaElement.value = e;
|
|
176
|
+
} catch {
|
|
177
|
+
}
|
|
178
|
+
this.syncState();
|
|
179
|
+
}
|
|
180
|
+
get name() {
|
|
181
|
+
return this.getAttribute("name") || "";
|
|
182
|
+
}
|
|
183
|
+
set name(t) {
|
|
184
|
+
this.setAttribute("name", t);
|
|
185
|
+
}
|
|
186
|
+
get type() {
|
|
187
|
+
return "textarea";
|
|
188
|
+
}
|
|
189
|
+
get disabled() {
|
|
190
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
191
|
+
}
|
|
192
|
+
set disabled(t) {
|
|
193
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
194
|
+
}
|
|
195
|
+
get readOnly() {
|
|
196
|
+
return this.hasAttribute("readonly");
|
|
197
|
+
}
|
|
198
|
+
set readOnly(t) {
|
|
199
|
+
t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly");
|
|
200
|
+
}
|
|
201
|
+
get minLength() {
|
|
202
|
+
return u(this.getAttribute("minlength") ?? this.getAttribute("min-length")) ?? -1;
|
|
203
|
+
}
|
|
204
|
+
set minLength(t) {
|
|
205
|
+
t >= 0 ? this.setAttribute("minlength", String(t)) : this.removeAttribute("minlength");
|
|
206
|
+
}
|
|
207
|
+
get maxLength() {
|
|
208
|
+
return u(this.getAttribute("maxlength") ?? this.getAttribute("max-length")) ?? -1;
|
|
209
|
+
}
|
|
210
|
+
set maxLength(t) {
|
|
211
|
+
t >= 0 ? this.setAttribute("maxlength", String(t)) : this.removeAttribute("maxlength");
|
|
212
|
+
}
|
|
213
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
214
|
+
formResetCallback() {
|
|
215
|
+
this.textareaElement.value = this._defaultValue, this.syncState();
|
|
216
|
+
}
|
|
217
|
+
formStateRestoreCallback(t, e) {
|
|
218
|
+
typeof t == "string" && (this.value = t);
|
|
219
|
+
}
|
|
220
|
+
atualizarValidade() {
|
|
221
|
+
const t = this.textareaElement ? this.textareaElement.value : "", e = I({
|
|
222
|
+
val: t,
|
|
223
|
+
rawVal: t,
|
|
224
|
+
disabled: this.disabled,
|
|
225
|
+
required: this.required,
|
|
226
|
+
tipo: "text",
|
|
227
|
+
minlength: u(this.getAttribute("minlength") ?? this.getAttribute("min-length")),
|
|
228
|
+
maxlength: u(this.getAttribute("maxlength") ?? this.getAttribute("max-length")),
|
|
229
|
+
customError: this._customErrorMessage,
|
|
230
|
+
mensagemValidacao: this.getAttribute("mensagem-validacao")
|
|
231
|
+
});
|
|
232
|
+
D(this.internals, e, this.textareaElement);
|
|
233
|
+
}
|
|
234
|
+
syncState() {
|
|
235
|
+
var a, r;
|
|
236
|
+
d(this, this.wrapperElement);
|
|
237
|
+
const t = this.textareaElement, e = this.hasAttribute("auto-altura");
|
|
238
|
+
t.setAttribute("rows", String(V(this.getAttribute("linhas"), 1, G, j))), t.placeholder = this.getAttribute("placeholder") ?? "", this.sincronizarRotulo(), this.sincronizarLimites(), this.sincronizarEstadoInterativo(), this.sincronizarFeedback(), this.sincronizarContador(), this.sincronizarAltura(e), (r = (a = this.internals) == null ? void 0 : a.setFormValue) == null || r.call(a, t.value), this.atualizarValidade();
|
|
239
|
+
}
|
|
240
|
+
sincronizarRotulo() {
|
|
241
|
+
const t = this.getAttribute("label");
|
|
242
|
+
if (t) {
|
|
243
|
+
E(this.labelElement, t, this.required, "ui-area-texto__asterisco"), this.labelElement.style.display = "flex", this.textareaElement.removeAttribute("aria-label");
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
this.labelElement.style.display = "none";
|
|
247
|
+
const e = x(this, this.internals);
|
|
248
|
+
e ? this.textareaElement.setAttribute("aria-label", e) : this.textareaElement.removeAttribute("aria-label");
|
|
249
|
+
}
|
|
250
|
+
sincronizarLimites() {
|
|
251
|
+
const t = this.textareaElement, e = u(this.getAttribute("minlength") ?? this.getAttribute("min-length")), a = u(this.getAttribute("maxlength") ?? this.getAttribute("max-length"));
|
|
252
|
+
e !== null ? t.minLength = e : t.removeAttribute("minlength"), a !== null ? t.maxLength = a : t.removeAttribute("maxlength");
|
|
253
|
+
}
|
|
254
|
+
sincronizarEstadoInterativo() {
|
|
255
|
+
const t = this.textareaElement, e = this.disabled;
|
|
256
|
+
t.disabled = e, t.readOnly = this.readOnly, this.wrapperElement.classList.toggle("ui-area-texto__wrapper--disabled", e), this.required ? t.setAttribute("aria-required", "true") : t.removeAttribute("aria-required");
|
|
257
|
+
}
|
|
258
|
+
sincronizarFeedback() {
|
|
259
|
+
const t = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|
|
260
|
+
q(
|
|
261
|
+
this.wrapperElement,
|
|
262
|
+
this.textareaElement,
|
|
263
|
+
this.helperElement,
|
|
264
|
+
t,
|
|
265
|
+
this.getAttribute("mensagem-erro"),
|
|
266
|
+
this.getAttribute("helper-text"),
|
|
267
|
+
"ui-area-texto"
|
|
268
|
+
), this.helperElement.style.display === "none" ? this.textareaElement.removeAttribute("aria-describedby") : this.textareaElement.setAttribute("aria-describedby", this.helperElement.id);
|
|
269
|
+
}
|
|
270
|
+
sincronizarContador() {
|
|
271
|
+
if (!this.hasAttribute("contador")) {
|
|
272
|
+
this.contadorElement.hidden = !0, this.anuncioElement.textContent = "", this._nivelAnunciado = "normal";
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
const t = u(this.getAttribute("maxlength") ?? this.getAttribute("max-length"), 1), e = O(this.textareaElement.value.length, t);
|
|
276
|
+
this.contadorElement.hidden = !1, this.contadorElement.textContent = e.texto;
|
|
277
|
+
for (const a of K)
|
|
278
|
+
this.contadorElement.classList.toggle(`ui-area-texto__contador--${a}`, a === e.nivel);
|
|
279
|
+
e.nivel !== this._nivelAnunciado && (this._nivelAnunciado = e.nivel, this.anuncioElement.textContent = e.anuncio);
|
|
280
|
+
}
|
|
281
|
+
sincronizarAltura(t) {
|
|
282
|
+
const e = this.textareaElement, a = t ? "nenhum" : R(this.getAttribute("redimensionar"), P, "vertical");
|
|
283
|
+
e.style.resize = U[a];
|
|
284
|
+
const r = t ? u(this.getAttribute("linhas-max"), 1) : null;
|
|
285
|
+
r !== null ? this.style.setProperty("--ui-area-linhas-max", String(Math.min(r, W))) : this.style.removeProperty("--ui-area-linhas-max"), t ? y(e, this.wrapperElement) : N(e, this.wrapperElement);
|
|
286
|
+
}
|
|
287
|
+
emitirEdicao(t, e, a) {
|
|
288
|
+
this.dispatchEvent(
|
|
289
|
+
new CustomEvent(t, { detail: { value: a }, bubbles: !0, composed: !0 })
|
|
290
|
+
), this.dispatchEvent(new Event(e, { bubbles: !0, composed: !0 }));
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
class X extends k {
|
|
294
|
+
}
|
|
295
|
+
h("ui-area-texto", k);
|
|
296
|
+
h("ui-textarea", X);
|
|
297
|
+
class Y {
|
|
298
|
+
constructor(i, t, e) {
|
|
299
|
+
s(this, "scrollHandler");
|
|
300
|
+
s(this, "resizeHandler");
|
|
301
|
+
s(this, "posicionar", () => {
|
|
302
|
+
if (this.isMobileOrBottomSheet()) {
|
|
303
|
+
this.content.style.top = "", this.content.style.left = "", this.content.style.minWidth = "";
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const i = this.button.getBoundingClientRect();
|
|
307
|
+
this.content.style.top = `${Math.round(i.bottom + 2)}px`, this.content.style.left = `${Math.round(i.left)}px`, this.content.style.minWidth = `${Math.round(Math.max(i.width, 120))}px`, this.ajustarAoViewport(i);
|
|
308
|
+
});
|
|
309
|
+
this.host = i, this.button = t, this.content = e;
|
|
310
|
+
}
|
|
311
|
+
isMobileOrBottomSheet() {
|
|
312
|
+
return typeof window > "u" ? !1 : window.innerWidth <= 640 || this.host.hasAttribute("bottom-sheet") || this.host.hasAttribute("modo-mobile");
|
|
313
|
+
}
|
|
314
|
+
/** Com a lista já visível (medida real): abre para cima se faltar espaço embaixo e não deixa sair pela lateral. */
|
|
315
|
+
ajustarAoViewport(i) {
|
|
316
|
+
const t = this.content.offsetHeight, e = this.content.offsetWidth;
|
|
317
|
+
if (t <= 0 || typeof window > "u") return;
|
|
318
|
+
const a = 8;
|
|
319
|
+
i.bottom + 2 + t > window.innerHeight - a && i.top - 2 - t >= a && (this.content.style.top = `${Math.round(i.top - 2 - t)}px`), i.left + e > window.innerWidth - a && (this.content.style.left = `${Math.max(a, Math.round(window.innerWidth - a - e))}px`);
|
|
320
|
+
}
|
|
321
|
+
ativarAcompanhamento(i) {
|
|
322
|
+
if (this.scrollHandler = i, this.resizeHandler = this.posicionar, window.addEventListener("scroll", this.scrollHandler, { capture: !0, passive: !0 }), window.addEventListener("resize", this.resizeHandler, { passive: !0 }), typeof this.content.showPopover == "function")
|
|
323
|
+
try {
|
|
324
|
+
this.content.showPopover();
|
|
325
|
+
} catch {
|
|
326
|
+
}
|
|
327
|
+
this.posicionar();
|
|
328
|
+
}
|
|
329
|
+
desativarAcompanhamento() {
|
|
330
|
+
if (this.scrollHandler && (window.removeEventListener("scroll", this.scrollHandler, { capture: !0 }), this.scrollHandler = void 0), this.resizeHandler && (window.removeEventListener("resize", this.resizeHandler), this.resizeHandler = void 0), typeof this.content.hidePopover == "function")
|
|
331
|
+
try {
|
|
332
|
+
this.content.hidePopover();
|
|
333
|
+
} catch {
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
class Z {
|
|
338
|
+
constructor(i) {
|
|
339
|
+
s(this, "focusedIndex", -1);
|
|
340
|
+
this.listElement = i;
|
|
341
|
+
}
|
|
342
|
+
focarPrimeiroItem() {
|
|
343
|
+
const i = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
344
|
+
if (i.length > 0) {
|
|
345
|
+
const t = i.findIndex((e) => e.classList.contains("ui-lista-flutuante__item--selecionado"));
|
|
346
|
+
this.focusedIndex = Math.max(0, t), i[this.focusedIndex].focus();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
resetarFoco() {
|
|
350
|
+
this.focusedIndex = -1;
|
|
351
|
+
}
|
|
352
|
+
moverFoco(i) {
|
|
353
|
+
const t = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
354
|
+
t.length !== 0 && (this.focusedIndex += i, this.focusedIndex < 0 && (this.focusedIndex = t.length - 1), this.focusedIndex >= t.length && (this.focusedIndex = 0), t[this.focusedIndex].focus());
|
|
355
|
+
}
|
|
356
|
+
tratarKeydownLista(i, t, e, a, r) {
|
|
357
|
+
if (i.key === "ArrowDown")
|
|
358
|
+
i.preventDefault(), this.moverFoco(1);
|
|
359
|
+
else if (i.key === "ArrowUp")
|
|
360
|
+
i.preventDefault(), this.moverFoco(-1);
|
|
361
|
+
else if (i.key === "Home" || i.key === "End") {
|
|
362
|
+
i.preventDefault();
|
|
363
|
+
const n = i.key === "End";
|
|
364
|
+
this.focusedIndex = n ? -1 : 0, n ? this.moverFoco(-1) : this.moverFoco(0);
|
|
365
|
+
} else i.key === "Tab" ? a() : i.key === "Enter" || i.key === " " ? (i.preventDefault(), this.focusedIndex >= 0 && this.focusedIndex < t.length && e(t[this.focusedIndex])) : i.key === "Escape" && (i.preventDefault(), a(), r.focus());
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
const J = ':host{display:inline-block;position:relative;width:100%;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){width:auto;vertical-align:middle}.ui-lista-flutuante__container{display:flex;flex-direction:column;width:100%;position:relative}.ui-lista-flutuante__label{font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-medio, 500);color:var(--ui-cor-texto, #e1e1e6);margin-bottom:4px;-webkit-user-select:none;user-select:none;flex-shrink:0}.ui-lista-flutuante__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px}.ui-lista-flutuante__gatilho{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;height:var(--ui-campo-altura, 34px);min-height:var(--ui-campo-altura, 34px);padding:0 8px;background:var(--ui-degrade-interno, var(--ui-lista-flutuante-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e))));color:var(--ui-cor-texto, #e1e1e6);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:clamp(11px,.85rem,13px);line-height:1;cursor:pointer;box-sizing:border-box;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:border-color .15s ease,background-color .15s ease}.ui-lista-flutuante__gatilho:hover:not(:disabled){border-color:var(--ui-cor-primaria, #00E08A)}.ui-lista-flutuante__gatilho:disabled{opacity:.5;cursor:not-allowed}.ui-lista-flutuante__texto{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;text-align:left}.ui-lista-flutuante__seta{font-size:10px;line-height:1;display:inline-flex;align-items:center;justify-content:center;transition:transform .2s ease;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0;shape-rendering:geometricPrecision}:host([aberta]) .ui-lista-flutuante__seta{transform:rotate(180deg)}.ui-lista-flutuante__backdrop{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background:transparent;-webkit-backdrop-filter:none;backdrop-filter:none;z-index:calc(var(--ui-z-popover, 1050) - 1)}:host([aberta]) .ui-lista-flutuante__backdrop{display:block}:host(:not([aberta])) .ui-lista-flutuante__conteudo{display:none!important}:host([aberta]) .ui-lista-flutuante__conteudo{display:block}.ui-lista-flutuante__conteudo{position:fixed;margin:0;padding:4px;list-style:none;background:var(--ui-degrade-interno, var(--ui-lista-flutuante-menu-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-menu, #18181c))));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .14));border-radius:var(--ui-raio-borda, 6px);box-shadow:var(--ui-sombra-lg, 0 8px 28px rgba(0, 0, 0, .55));max-height:220px;overflow-y:auto;z-index:var(--ui-z-popover, 1050);box-sizing:border-box;inset:auto}.ui-lista-flutuante__sheet-header{display:none;width:100%;margin-bottom:8px}.ui-lista-flutuante__handle{width:36px;height:4px;border-radius:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 25%,transparent);margin:2px auto 8px}.ui-lista-flutuante__sheet-title-bar{display:flex;align-items:center;justify-content:space-between;width:100%;padding:4px 6px 8px;border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .08));margin-bottom:6px}.ui-lista-flutuante__sheet-titulo{font-size:13px;font-weight:600;color:var(--ui-cor-primaria, #00E08A);letter-spacing:.3px;text-transform:uppercase}.ui-lista-flutuante__sheet-close{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-size:14px;cursor:pointer;padding:4px 8px;border-radius:var(--ui-raio-sm, 4px);display:flex;align-items:center;justify-content:center;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:color .15s,background-color .15s}.ui-lista-flutuante__sheet-close:hover{color:#fff;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-lista-flutuante__item{padding:6px 10px;font-family:var(--ui-fonte-base, "Inter", sans-serif);font-size:12px;line-height:1.2;color:var(--ui-cor-texto, #e1e1e6);border-radius:var(--ui-raio-sm, 4px);cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;transition:background-color .12s ease,color .12s ease;-webkit-user-select:none;user-select:none}.ui-lista-flutuante__item:hover{background:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-lista-flutuante__item--selecionado{background:color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent);color:var(--ui-cor-primaria, #00E08A);font-weight:600}.ui-lista-flutuante__item--selecionado:after{content:"✓";font-size:11px;color:var(--ui-cor-primaria, #00E08A)}@media (max-width: 640px){.ui-lista-flutuante__gatilho{min-height:max(var(--ui-campo-altura, 38px),38px);font-size:15px}:host([aberta]) .ui-lista-flutuante__backdrop{background-color:#00000059;-webkit-backdrop-filter:none;backdrop-filter:none}.ui-lista-flutuante__conteudo{position:fixed!important;bottom:0!important;top:auto!important;left:0!important;width:100vw!important;max-width:100vw!important;min-width:100vw!important;max-height:70vh!important;max-height:70dvh!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;border-bottom:none!important;padding:10px 16px calc(24px + env(safe-area-inset-bottom,0px)) 16px!important;box-shadow:0 -8px 32px #000000b3!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;animation:ui-bottom-sheet-slide .22s cubic-bezier(.4,0,.2,1)}.ui-lista-flutuante__sheet-header{display:flex!important;flex-direction:column!important}.ui-lista-flutuante__sheet-close{min-width:44px;min-height:44px;font-size:18px}.ui-lista-flutuante__item{padding:12px 14px!important;font-size:15px!important;margin-bottom:3px}}:host([bottom-sheet][aberta]) .ui-lista-flutuante__backdrop,:host([modo-mobile][aberta]) .ui-lista-flutuante__backdrop{background-color:#00000059;-webkit-backdrop-filter:none;backdrop-filter:none}:host([bottom-sheet]) .ui-lista-flutuante__conteudo,:host([modo-mobile]) .ui-lista-flutuante__conteudo{position:fixed!important;bottom:0!important;top:auto!important;left:0!important;width:100vw!important;max-width:100vw!important;min-width:100vw!important;max-height:70vh!important;max-height:70dvh!important;border-radius:var(--ui-raio-xl, 16px) var(--ui-raio-xl, 16px) 0 0!important;border-bottom:none!important;padding:10px 16px calc(24px + env(safe-area-inset-bottom,0px)) 16px!important;box-shadow:0 -8px 32px #000000b3!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;animation:ui-bottom-sheet-slide .22s cubic-bezier(.4,0,.2,1)}:host([bottom-sheet]) .ui-lista-flutuante__sheet-header,:host([modo-mobile]) .ui-lista-flutuante__sheet-header{display:flex!important;flex-direction:column!important}:host([bottom-sheet]) .ui-lista-flutuante__sheet-close,:host([modo-mobile]) .ui-lista-flutuante__sheet-close{min-width:44px;min-height:44px;font-size:18px}:host([bottom-sheet]) .ui-lista-flutuante__item,:host([modo-mobile]) .ui-lista-flutuante__item{padding:12px 14px!important;font-size:15px!important;margin-bottom:3px}@keyframes ui-bottom-sheet-slide{0%{transform:translateY(100%)}to{transform:translateY(0)}}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado)}', Q = [
|
|
369
|
+
"aberta",
|
|
370
|
+
"texto-padrao",
|
|
371
|
+
"value",
|
|
372
|
+
"disabled",
|
|
373
|
+
"bottom-sheet",
|
|
374
|
+
"modo-mobile",
|
|
375
|
+
"label",
|
|
376
|
+
"rotulo",
|
|
377
|
+
"placeholder",
|
|
378
|
+
"tamanho",
|
|
379
|
+
"size",
|
|
380
|
+
"altura",
|
|
381
|
+
"height",
|
|
382
|
+
"densidade",
|
|
383
|
+
"name",
|
|
384
|
+
"obrigatorio",
|
|
385
|
+
"required",
|
|
386
|
+
"mensagem-validacao",
|
|
387
|
+
"aria-label",
|
|
388
|
+
...b
|
|
389
|
+
];
|
|
390
|
+
function tt() {
|
|
391
|
+
return `
|
|
392
|
+
<style>${J}</style>
|
|
393
|
+
<div class="ui-lista-flutuante__container">
|
|
394
|
+
<label class="ui-lista-flutuante__label" part="rotulo" style="display: none;"></label>
|
|
395
|
+
<div class="ui-lista-flutuante__backdrop"></div>
|
|
396
|
+
<button class="ui-lista-flutuante__gatilho" part="campo" aria-haspopup="listbox" aria-expanded="false" type="button">
|
|
397
|
+
<span class="ui-lista-flutuante__texto" part="valor"></span>
|
|
398
|
+
<span class="ui-lista-flutuante__seta" part="seta">▼</span>
|
|
399
|
+
</button>
|
|
400
|
+
<div class="ui-lista-flutuante__conteudo" part="lista" role="listbox" popover="manual">
|
|
401
|
+
<div class="ui-lista-flutuante__sheet-header">
|
|
402
|
+
<div class="ui-lista-flutuante__handle"></div>
|
|
403
|
+
<div class="ui-lista-flutuante__sheet-title-bar">
|
|
404
|
+
<span class="ui-lista-flutuante__sheet-titulo">Selecione uma opção</span>
|
|
405
|
+
<button class="ui-lista-flutuante__sheet-close" type="button" aria-label="Fechar">✕</button>
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
<ul class="ui-lista-flutuante__lista" style="margin: 0; padding: 0; list-style: none;"></ul>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
`;
|
|
412
|
+
}
|
|
413
|
+
function A(o, i, t) {
|
|
414
|
+
o.innerHTML = "", i.forEach((e) => {
|
|
415
|
+
const a = document.createElement("li"), r = String(e.id) === String(t);
|
|
416
|
+
a.className = `ui-lista-flutuante__item ${r ? "ui-lista-flutuante__item--selecionado" : ""}`, a.setAttribute("data-id", e.id), a.textContent = e.label, a.role = "option", a.tabIndex = -1, a.setAttribute("part", r ? "opcao opcao-selecionada" : "opcao"), r && a.setAttribute("aria-selected", "true"), o.appendChild(a);
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function et(o, i) {
|
|
420
|
+
o.querySelectorAll(".ui-lista-flutuante__item").forEach((e) => {
|
|
421
|
+
const a = e.getAttribute("data-id");
|
|
422
|
+
M(e, "opcao-selecionada", a === String(i)), a === String(i) ? (e.classList.add("ui-lista-flutuante__item--selecionado"), e.setAttribute("aria-selected", "true")) : (e.classList.remove("ui-lista-flutuante__item--selecionado"), e.removeAttribute("aria-selected"));
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
class w extends m {
|
|
426
|
+
constructor() {
|
|
427
|
+
super();
|
|
428
|
+
s(this, "labelElement");
|
|
429
|
+
s(this, "button");
|
|
430
|
+
s(this, "content");
|
|
431
|
+
s(this, "listElement");
|
|
432
|
+
s(this, "textoElement");
|
|
433
|
+
s(this, "backdropElement");
|
|
434
|
+
s(this, "sheetTituloElement");
|
|
435
|
+
s(this, "sheetCloseButton");
|
|
436
|
+
s(this, "idsAcessibilidade");
|
|
437
|
+
s(this, "listeners", new p());
|
|
438
|
+
s(this, "_itens", []);
|
|
439
|
+
s(this, "_value", "");
|
|
440
|
+
s(this, "_defaultValue", "");
|
|
441
|
+
s(this, "_defaultCapturado", !1);
|
|
442
|
+
s(this, "observer");
|
|
443
|
+
s(this, "posicionamento");
|
|
444
|
+
s(this, "teclado");
|
|
445
|
+
s(this, "toggleLista", (t) => {
|
|
446
|
+
t.stopPropagation(), !this.disabled && (this.hasAttribute("aberta") ? this.fechar() : this.abrir());
|
|
447
|
+
});
|
|
448
|
+
s(this, "handleKeyDown", (t) => {
|
|
449
|
+
if (!this.disabled) {
|
|
450
|
+
if (t.key === "Escape" && this.hasAttribute("aberta")) {
|
|
451
|
+
t.preventDefault(), this.fechar();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
(t.key === "Enter" || t.key === " " || t.key === "ArrowDown" || t.key === "ArrowUp") && (t.preventDefault(), this.hasAttribute("aberta") ? this.teclado.focarPrimeiroItem() : this.abrir());
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
s(this, "handleListKeyDown", (t) => {
|
|
458
|
+
this.hasAttribute("aberta") && this.teclado.tratarKeydownLista(
|
|
459
|
+
t,
|
|
460
|
+
this._itens,
|
|
461
|
+
(e) => this.selecionarItem(e),
|
|
462
|
+
this.fechar,
|
|
463
|
+
this.button
|
|
464
|
+
);
|
|
465
|
+
});
|
|
466
|
+
s(this, "fechar", () => {
|
|
467
|
+
this.hasAttribute("aberta") && (this.removeAttribute("aberta"), this.posicionamento.desativarAcompanhamento(), this.teclado.resetarFoco());
|
|
468
|
+
});
|
|
469
|
+
s(this, "handleClickFora", (t) => {
|
|
470
|
+
if (!this.hasAttribute("aberta")) return;
|
|
471
|
+
const e = t.composedPath();
|
|
472
|
+
!e.includes(this) && !e.includes(this.content) && this.fechar();
|
|
473
|
+
});
|
|
474
|
+
/** Clicar no rótulo foca o controle (comportamento do <select> nativo), sem abrir a lista. */
|
|
475
|
+
s(this, "focarGatilho", () => {
|
|
476
|
+
this.disabled || this.button.focus();
|
|
477
|
+
});
|
|
478
|
+
s(this, "handleHostClick", (t) => {
|
|
479
|
+
g(this, t) && this.focarGatilho();
|
|
480
|
+
});
|
|
481
|
+
s(this, "handleListClick", (t) => {
|
|
482
|
+
var n;
|
|
483
|
+
t.stopPropagation();
|
|
484
|
+
const e = (n = t.target) == null ? void 0 : n.closest("li[data-id]");
|
|
485
|
+
if (!e) return;
|
|
486
|
+
const a = e.getAttribute("data-id"), r = this._itens.find((c) => String(c.id) === String(a));
|
|
487
|
+
r && this.selecionarItem(r);
|
|
488
|
+
});
|
|
489
|
+
const t = this.attachShadow({ mode: "open" });
|
|
490
|
+
t.innerHTML = tt(), this.labelElement = t.querySelector(".ui-lista-flutuante__label"), this.button = t.querySelector(".ui-lista-flutuante__gatilho"), this.content = t.querySelector(".ui-lista-flutuante__conteudo"), this.listElement = t.querySelector(".ui-lista-flutuante__lista"), this.textoElement = t.querySelector(".ui-lista-flutuante__texto"), this.backdropElement = t.querySelector(".ui-lista-flutuante__backdrop"), this.sheetTituloElement = t.querySelector(".ui-lista-flutuante__sheet-titulo"), this.sheetCloseButton = t.querySelector(".ui-lista-flutuante__sheet-close");
|
|
491
|
+
const e = f("ui-select");
|
|
492
|
+
this.idsAcessibilidade = {
|
|
493
|
+
label: `${e}-label`,
|
|
494
|
+
gatilho: `${e}-gatilho`,
|
|
495
|
+
texto: `${e}-texto`,
|
|
496
|
+
lista: `${e}-lista`
|
|
497
|
+
}, this.labelElement.id = this.idsAcessibilidade.label, this.button.id = this.idsAcessibilidade.gatilho, this.textoElement.id = this.idsAcessibilidade.texto, this.content.id = this.idsAcessibilidade.lista, this.button.setAttribute("aria-controls", this.idsAcessibilidade.lista), this.posicionamento = new Y(this, this.button, this.content), this.teclado = new Z(this.listElement);
|
|
498
|
+
}
|
|
499
|
+
static get observedAttributes() {
|
|
500
|
+
return Q;
|
|
501
|
+
}
|
|
502
|
+
connectedCallback() {
|
|
503
|
+
this.listeners.cleanup(), this.listeners.add(this.button, "click", this.toggleLista), this.listeners.add(this.button, "keydown", this.handleKeyDown), this.listeners.add(this.content, "keydown", this.handleListKeyDown), this.listeners.add(this.backdropElement, "click", this.fechar), this.listeners.add(this.listElement, "click", this.handleListClick), this.listeners.add(this.sheetCloseButton, "click", (t) => {
|
|
504
|
+
t.stopPropagation(), this.fechar();
|
|
505
|
+
}), this.listeners.add(document, "click", this.handleClickFora), this.listeners.add(this.labelElement, "click", this.focarGatilho), this.listeners.add(this, "click", this.handleHostClick), this._defaultCapturado || (this._defaultValue = this.getAttribute("value") || "", this._defaultCapturado = !0), this.carregarItensFilhos(), this.syncState(), this.observer = new MutationObserver(() => this.carregarItensFilhos()), this.observer.observe(this, { childList: !0, subtree: !0 });
|
|
506
|
+
}
|
|
507
|
+
carregarItensFilhos() {
|
|
508
|
+
const t = Array.from(this.querySelectorAll('option, ui-opcao, [role="option"], [data-opcao], [data-value]:not(input):not(select)'));
|
|
509
|
+
t.length > 0 && (this._itens = t.map((e, a) => {
|
|
510
|
+
var n;
|
|
511
|
+
const r = e.getAttribute("value") || e.getAttribute("data-value") || String(a + 1);
|
|
512
|
+
return {
|
|
513
|
+
id: r,
|
|
514
|
+
label: ((n = e.textContent) == null ? void 0 : n.trim()) || r || `Opção ${a + 1}`
|
|
515
|
+
};
|
|
516
|
+
}), A(this.listElement, this._itens, this._value), this.syncLabel());
|
|
517
|
+
}
|
|
518
|
+
disconnectedCallback() {
|
|
519
|
+
this.listeners.cleanup(), this.observer && this.observer.disconnect(), this.fechar();
|
|
520
|
+
}
|
|
521
|
+
attributeChangedCallback(t, e, a) {
|
|
522
|
+
t === "aberta" && this.button.setAttribute("aria-expanded", String(a !== null)), (t === "texto-padrao" || t === "placeholder" || t === "label" || t === "rotulo" || t === "aria-label") && this.syncLabel(), t === "value" && a !== this._value && (this.value = a || ""), t === "disabled" && (this.button.disabled = this.disabled), (t === "altura" || t === "height" || t === "tamanho" || t === "size" || t === "densidade") && _(this), L(t) && (d(this, this.button), d(this, this.content));
|
|
523
|
+
}
|
|
524
|
+
get value() {
|
|
525
|
+
return this._value;
|
|
526
|
+
}
|
|
527
|
+
set value(t) {
|
|
528
|
+
this._value = t, this.setAttribute("value", t), this.internals.setFormValue(t), this.syncLabel(), et(this.listElement, this._value), this.atualizarValidade();
|
|
529
|
+
}
|
|
530
|
+
get label() {
|
|
531
|
+
return this.getAttribute("label") || this.getAttribute("rotulo") || "";
|
|
532
|
+
}
|
|
533
|
+
set label(t) {
|
|
534
|
+
t ? this.setAttribute("label", t) : (this.removeAttribute("label"), this.removeAttribute("rotulo")), this.syncLabel();
|
|
535
|
+
}
|
|
536
|
+
get disabled() {
|
|
537
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
538
|
+
}
|
|
539
|
+
set disabled(t) {
|
|
540
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.button.disabled = this.disabled;
|
|
541
|
+
}
|
|
542
|
+
get name() {
|
|
543
|
+
return this.getAttribute("name") || "";
|
|
544
|
+
}
|
|
545
|
+
set name(t) {
|
|
546
|
+
this.setAttribute("name", t);
|
|
547
|
+
}
|
|
548
|
+
get type() {
|
|
549
|
+
return "select-one";
|
|
550
|
+
}
|
|
551
|
+
atualizarValidade() {
|
|
552
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
553
|
+
if (this.disabled) {
|
|
554
|
+
this.internals.setValidity({});
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (this._customErrorMessage) {
|
|
558
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.button);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this._value || this._value.trim() === "")) {
|
|
562
|
+
const e = this.getAttribute("mensagem-validacao") || "Selecione um item da lista.";
|
|
563
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.button);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
this.internals.setValidity({});
|
|
567
|
+
}
|
|
568
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
569
|
+
formDisabledCallback(t) {
|
|
570
|
+
this._formDisabled = t, this.button.disabled = this.disabled, this.disabled && this.fechar();
|
|
571
|
+
}
|
|
572
|
+
formResetCallback() {
|
|
573
|
+
this.value = this._defaultValue;
|
|
574
|
+
}
|
|
575
|
+
formStateRestoreCallback(t, e) {
|
|
576
|
+
typeof t == "string" && (this.value = t);
|
|
577
|
+
}
|
|
578
|
+
get itens() {
|
|
579
|
+
return this._itens;
|
|
580
|
+
}
|
|
581
|
+
set itens(t) {
|
|
582
|
+
this._itens = t || [], A(this.listElement, this._itens, this._value), this.syncLabel();
|
|
583
|
+
}
|
|
584
|
+
abrir() {
|
|
585
|
+
this.disabled || this.hasAttribute("aberta") || (this.setAttribute("aberta", ""), this.posicionamento.posicionar(), this.posicionamento.ativarAcompanhamento(this.fechar));
|
|
586
|
+
}
|
|
587
|
+
syncLabel() {
|
|
588
|
+
const t = this.getAttribute("label") || this.getAttribute("rotulo");
|
|
589
|
+
if (t)
|
|
590
|
+
E(this.labelElement, t, this.required, "ui-lista-flutuante__asterisco"), this.labelElement.style.display = "block", this.sheetTituloElement.textContent = t, this.button.setAttribute("aria-labelledby", `${this.idsAcessibilidade.label} ${this.idsAcessibilidade.texto}`), this.content.setAttribute("aria-labelledby", this.idsAcessibilidade.label), this.button.removeAttribute("aria-label"), this.content.removeAttribute("aria-label");
|
|
591
|
+
else {
|
|
592
|
+
this.labelElement.style.display = "none", this.sincronizarRotuloExterno();
|
|
593
|
+
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
594
|
+
this.sheetTituloElement.textContent = a;
|
|
595
|
+
}
|
|
596
|
+
const e = this._itens.find((a) => String(a.id) === String(this._value));
|
|
597
|
+
if (e)
|
|
598
|
+
this.textoElement.textContent = e.label;
|
|
599
|
+
else {
|
|
600
|
+
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
601
|
+
this.textoElement.textContent = a;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
/** Sem o atributo `label`, usa o rótulo de fora do Shadow DOM (aria-label, <label for>, <label> envolvente). */
|
|
605
|
+
sincronizarRotuloExterno() {
|
|
606
|
+
this.button.removeAttribute("aria-labelledby"), this.content.removeAttribute("aria-labelledby");
|
|
607
|
+
const t = x(this, this.internals);
|
|
608
|
+
t ? (this.button.setAttribute("aria-labelledby", `${this.idsAcessibilidade.gatilho} ${this.idsAcessibilidade.texto}`), this.button.setAttribute("aria-label", t), this.content.setAttribute("aria-label", t)) : (this.button.removeAttribute("aria-label"), this.content.removeAttribute("aria-label"));
|
|
609
|
+
}
|
|
610
|
+
syncState() {
|
|
611
|
+
_(this), d(this, this.button), d(this, this.content), this.hasAttribute("value") && (this._value = this.getAttribute("value") || "", this.internals.setFormValue(this._value)), this.syncLabel(), this.atualizarValidade();
|
|
612
|
+
}
|
|
613
|
+
selecionarItem(t) {
|
|
614
|
+
var r;
|
|
615
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.activeElement, a = !!e && this.content.contains(e);
|
|
616
|
+
this.value = t.id, this.fechar(), a && this.button.focus(), this.dispatchEvent(
|
|
617
|
+
new CustomEvent("ui-selecionar", {
|
|
618
|
+
detail: t,
|
|
619
|
+
bubbles: !0,
|
|
620
|
+
composed: !0
|
|
621
|
+
})
|
|
622
|
+
), this.dispatchEvent(
|
|
623
|
+
new Event("input", {
|
|
624
|
+
bubbles: !0,
|
|
625
|
+
composed: !0
|
|
626
|
+
})
|
|
627
|
+
), this.dispatchEvent(
|
|
628
|
+
new Event("change", {
|
|
629
|
+
bubbles: !0,
|
|
630
|
+
composed: !0
|
|
631
|
+
})
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
class it extends w {
|
|
636
|
+
}
|
|
637
|
+
h("ui-lista-flutuante", w);
|
|
638
|
+
h("ui-select", it);
|
|
639
|
+
const at = ':host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle}.ui-checkbox{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;line-height:1;outline:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-checkbox--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-checkbox__box{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;min-width:16px;min-height:16px;background:var(--ui-checkbox-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:var(--ui-raio-sm, 4px);box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease;flex-shrink:0}.ui-checkbox:focus-visible .ui-checkbox__box,.ui-checkbox--foco .ui-checkbox__box{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-checkbox--checked .ui-checkbox__box,.ui-checkbox--indeterminate .ui-checkbox__box{background:var(--ui-degrade-interno, var(--ui-checkbox-ativo-fundo, var(--ui-fundo-primario, var(--ui-cor-primaria, #00E08A))));border-color:var(--ui-cor-primaria, #00E08A);color:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-checkbox__mark{width:12px;height:12px;display:flex;align-items:center;justify-content:center;transition:transform .15s cubic-bezier(.4,0,.2,1),opacity .15s ease;transform:scale(0);opacity:0}.ui-checkbox--checked .ui-checkbox__mark,.ui-checkbox--indeterminate .ui-checkbox__mark{transform:scale(1);opacity:1}.ui-checkbox__mark svg{width:100%;height:100%;fill:none;stroke:currentColor;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;shape-rendering:geometricPrecision}.ui-checkbox__label{display:inline-flex;align-items:center;font-size:clamp(11px,.85rem,14px);color:var(--ui-cor-texto, #e1e1e6);line-height:1}.ui-checkbox--label-esquerda{flex-direction:row-reverse}@media (max-width: 640px){.ui-checkbox{min-height:40px;padding:4px 0}.ui-checkbox__box{width:20px;height:20px;min-width:20px;min-height:20px}.ui-checkbox__mark{width:14px;height:14px}.ui-checkbox__label{font-size:14px}}:host(.squarecircle) .ui-checkbox__box,:host(.squarecircles) .ui-checkbox__box,:host(.ui-squarecircle) .ui-checkbox__box,:host(.ui-squarecircles) .ui-checkbox__box,:host([formato="squarecircle"]) .ui-checkbox__box,:host([formato="squarecircles"]) .ui-checkbox__box,:host([formato="squircle"]) .ui-checkbox__box{border-radius:var(--ui-raio-squircle, 24%)}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-primario: var(--ui-gradiente-primario)}';
|
|
640
|
+
function v({ host: o, internals: i, controle: t, rotulo: e, texto: a }) {
|
|
641
|
+
if (a) {
|
|
642
|
+
e.textContent = a, e.style.display = "inline", t.setAttribute("aria-labelledby", e.id), t.removeAttribute("aria-label");
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
e.style.display = "none", t.removeAttribute("aria-labelledby");
|
|
646
|
+
const r = x(o, i);
|
|
647
|
+
r ? t.setAttribute("aria-label", r) : t.removeAttribute("aria-label");
|
|
648
|
+
}
|
|
649
|
+
class st extends m {
|
|
650
|
+
constructor() {
|
|
651
|
+
super();
|
|
652
|
+
s(this, "containerElement");
|
|
653
|
+
s(this, "markElement");
|
|
654
|
+
s(this, "labelElement");
|
|
655
|
+
s(this, "listeners", new p());
|
|
656
|
+
s(this, "_defaultChecked", !1);
|
|
657
|
+
s(this, "_defaultIndeterminate", !1);
|
|
658
|
+
s(this, "handleClick", (t) => {
|
|
659
|
+
t.preventDefault(), this.alternar();
|
|
660
|
+
});
|
|
661
|
+
s(this, "handleHostClick", (t) => {
|
|
662
|
+
g(this, t) && (this.alternar(), this.containerElement.focus());
|
|
663
|
+
});
|
|
664
|
+
s(this, "handleKeyDown", (t) => {
|
|
665
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
666
|
+
});
|
|
667
|
+
s(this, "handleFocus", () => {
|
|
668
|
+
this.containerElement.classList.add("ui-checkbox--foco");
|
|
669
|
+
});
|
|
670
|
+
s(this, "handleBlur", () => {
|
|
671
|
+
this.containerElement.classList.remove("ui-checkbox--foco");
|
|
672
|
+
});
|
|
673
|
+
const t = this.attachShadow({ mode: "open" });
|
|
674
|
+
t.innerHTML = `
|
|
675
|
+
<style>${at}</style>
|
|
676
|
+
<div class="ui-checkbox" part="base" tabindex="0" role="checkbox" aria-checked="false">
|
|
677
|
+
<span class="ui-checkbox__box" part="controle">
|
|
678
|
+
<span class="ui-checkbox__mark" part="indicador"></span>
|
|
679
|
+
</span>
|
|
680
|
+
<span class="ui-checkbox__label" part="rotulo" style="display: none;"></span>
|
|
681
|
+
</div>
|
|
682
|
+
`, this.containerElement = t.querySelector(".ui-checkbox"), this.markElement = t.querySelector(".ui-checkbox__mark"), this.labelElement = t.querySelector(".ui-checkbox__label"), this.labelElement.id = f("ui-checkbox-label");
|
|
683
|
+
}
|
|
684
|
+
static get observedAttributes() {
|
|
685
|
+
return [
|
|
686
|
+
"marcado",
|
|
687
|
+
"checked",
|
|
688
|
+
"indeterminado",
|
|
689
|
+
"indeterminate",
|
|
690
|
+
"disabled",
|
|
691
|
+
"formato",
|
|
692
|
+
"value",
|
|
693
|
+
"label",
|
|
694
|
+
"posicao-label",
|
|
695
|
+
"name",
|
|
696
|
+
"obrigatorio",
|
|
697
|
+
"required",
|
|
698
|
+
"mensagem-validacao",
|
|
699
|
+
...b
|
|
700
|
+
];
|
|
701
|
+
}
|
|
702
|
+
connectedCallback() {
|
|
703
|
+
this.listeners.cleanup(), this.listeners.add(this.containerElement, "click", this.handleClick), this.listeners.add(this.containerElement, "keydown", this.handleKeyDown), this.listeners.add(this.containerElement, "focus", this.handleFocus), this.listeners.add(this.containerElement, "blur", this.handleBlur), this.listeners.add(this, "click", this.handleHostClick), this._defaultChecked = this.hasAttribute("marcado") || this.hasAttribute("checked"), this._defaultIndeterminate = this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate"), this.syncState();
|
|
704
|
+
}
|
|
705
|
+
disconnectedCallback() {
|
|
706
|
+
this.listeners.cleanup();
|
|
707
|
+
}
|
|
708
|
+
attributeChangedCallback(t, e, a) {
|
|
709
|
+
this.syncState();
|
|
710
|
+
}
|
|
711
|
+
get marcado() {
|
|
712
|
+
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
713
|
+
}
|
|
714
|
+
set marcado(t) {
|
|
715
|
+
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked")), this.syncState();
|
|
716
|
+
}
|
|
717
|
+
get checked() {
|
|
718
|
+
return this.marcado;
|
|
719
|
+
}
|
|
720
|
+
set checked(t) {
|
|
721
|
+
this.marcado = t;
|
|
722
|
+
}
|
|
723
|
+
get value() {
|
|
724
|
+
return this.getAttribute("value") || "on";
|
|
725
|
+
}
|
|
726
|
+
set value(t) {
|
|
727
|
+
this.setAttribute("value", t), this.syncState();
|
|
728
|
+
}
|
|
729
|
+
get name() {
|
|
730
|
+
return this.getAttribute("name") || "";
|
|
731
|
+
}
|
|
732
|
+
set name(t) {
|
|
733
|
+
this.setAttribute("name", t), this.syncState();
|
|
734
|
+
}
|
|
735
|
+
get indeterminado() {
|
|
736
|
+
return this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate");
|
|
737
|
+
}
|
|
738
|
+
set indeterminado(t) {
|
|
739
|
+
t ? this.setAttribute("indeterminado", "") : (this.removeAttribute("indeterminado"), this.removeAttribute("indeterminate")), this.syncState();
|
|
740
|
+
}
|
|
741
|
+
get disabled() {
|
|
742
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
743
|
+
}
|
|
744
|
+
set disabled(t) {
|
|
745
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
746
|
+
}
|
|
747
|
+
get type() {
|
|
748
|
+
return "checkbox";
|
|
749
|
+
}
|
|
750
|
+
atualizarValidade() {
|
|
751
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
752
|
+
if (this.disabled) {
|
|
753
|
+
this.internals.setValidity({});
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (this._customErrorMessage) {
|
|
757
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.marcado) {
|
|
761
|
+
const e = this.getAttribute("mensagem-validacao") || "Marque esta caixa para continuar.";
|
|
762
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
this.internals.setValidity({});
|
|
766
|
+
}
|
|
767
|
+
/** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
|
|
768
|
+
focus(t) {
|
|
769
|
+
this.containerElement.focus(t);
|
|
770
|
+
}
|
|
771
|
+
alternar() {
|
|
772
|
+
this.disabled || (this.indeterminado ? (this.indeterminado = !1, this.marcado = !0) : this.marcado = !this.marcado, this.dispatchEvent(
|
|
773
|
+
new CustomEvent("ui-change", {
|
|
774
|
+
detail: {
|
|
775
|
+
marcado: this.marcado,
|
|
776
|
+
indeterminado: this.indeterminado,
|
|
777
|
+
value: this.getAttribute("value") || ""
|
|
778
|
+
},
|
|
779
|
+
bubbles: !0,
|
|
780
|
+
composed: !0
|
|
781
|
+
})
|
|
782
|
+
), this.dispatchEvent(
|
|
783
|
+
new Event("change", {
|
|
784
|
+
bubbles: !0,
|
|
785
|
+
composed: !0
|
|
786
|
+
})
|
|
787
|
+
));
|
|
788
|
+
}
|
|
789
|
+
syncState() {
|
|
790
|
+
d(this, this.containerElement);
|
|
791
|
+
const t = this.marcado, e = this.indeterminado, a = this.disabled, r = this.getAttribute("label"), n = this.getAttribute("posicao-label") || "direita";
|
|
792
|
+
this.containerElement.setAttribute(
|
|
793
|
+
"aria-checked",
|
|
794
|
+
e ? "mixed" : String(t)
|
|
795
|
+
), a ? (this.containerElement.classList.add("ui-checkbox--disabled"), this.containerElement.setAttribute("tabindex", "-1"), this.containerElement.setAttribute("aria-disabled", "true")) : (this.containerElement.classList.remove("ui-checkbox--disabled"), this.containerElement.setAttribute("tabindex", "0"), this.containerElement.removeAttribute("aria-disabled")), t ? this.containerElement.classList.add("ui-checkbox--checked") : this.containerElement.classList.remove("ui-checkbox--checked"), e ? this.containerElement.classList.add("ui-checkbox--indeterminate") : this.containerElement.classList.remove("ui-checkbox--indeterminate"), n === "esquerda" ? this.containerElement.classList.add("ui-checkbox--label-esquerda") : this.containerElement.classList.remove("ui-checkbox--label-esquerda"), e ? this.markElement.innerHTML = `
|
|
796
|
+
<svg viewBox="0 0 24 24">
|
|
797
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
798
|
+
</svg>
|
|
799
|
+
` : t ? this.markElement.innerHTML = `
|
|
800
|
+
<svg viewBox="0 0 24 24">
|
|
801
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
802
|
+
</svg>
|
|
803
|
+
` : this.markElement.innerHTML = "", v({
|
|
804
|
+
host: this,
|
|
805
|
+
internals: this.internals,
|
|
806
|
+
controle: this.containerElement,
|
|
807
|
+
rotulo: this.labelElement,
|
|
808
|
+
texto: r
|
|
809
|
+
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
810
|
+
}
|
|
811
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
812
|
+
formResetCallback() {
|
|
813
|
+
this.marcado = this._defaultChecked, this.indeterminado = this._defaultIndeterminate, this.syncState();
|
|
814
|
+
}
|
|
815
|
+
formStateRestoreCallback(t, e) {
|
|
816
|
+
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
h("ui-checkbox", st);
|
|
820
|
+
const rt = ':host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle}.ui-radio{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;line-height:1;outline:none}.ui-radio--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-radio__circle{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;min-width:16px;min-height:16px;background:var(--ui-radio-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:50%;box-sizing:border-box;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease;flex-shrink:0}.ui-radio:focus-visible .ui-radio__circle,.ui-radio--foco .ui-radio__circle{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-radio--checked .ui-radio__circle{border-color:var(--ui-cor-primaria, #00E08A)}.ui-radio__dot{width:8px;height:8px;border-radius:50%;background:var(--ui-degrade-interno, var(--ui-radio-ativo-fundo, var(--ui-fundo-primario, var(--ui-cor-primaria, #00E08A))));transition:transform .15s cubic-bezier(.4,0,.2,1),opacity .15s ease;transform:scale(0);opacity:0}.ui-radio--checked .ui-radio__dot{transform:scale(1);opacity:1}.ui-radio__label{display:inline-flex;align-items:center;font-size:clamp(11px,.85rem,14px);color:var(--ui-cor-texto, #e1e1e6);line-height:1}.ui-radio--label-esquerda{flex-direction:row-reverse}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-primario: var(--ui-gradiente-primario)}';
|
|
821
|
+
class l {
|
|
822
|
+
static getScopeNode(i) {
|
|
823
|
+
return i.closest("form") || i.getRootNode() || document;
|
|
824
|
+
}
|
|
825
|
+
/** Registra (ou re-registra, se o nome ou o escopo mudaram) o radio no grupo do seu nome atual. */
|
|
826
|
+
static registrar(i) {
|
|
827
|
+
this.desregistrar(i);
|
|
828
|
+
const t = i.name;
|
|
829
|
+
if (!t) return;
|
|
830
|
+
const e = this.getScopeNode(i);
|
|
831
|
+
let a = this.registry.get(e);
|
|
832
|
+
a || (a = /* @__PURE__ */ new Map(), this.registry.set(e, a));
|
|
833
|
+
let r = a.get(t);
|
|
834
|
+
r || (r = /* @__PURE__ */ new Set(), a.set(t, r)), r.add(i), this.registros.set(i, { scope: e, nome: t });
|
|
835
|
+
}
|
|
836
|
+
static desregistrar(i) {
|
|
837
|
+
const t = this.registros.get(i);
|
|
838
|
+
if (!t) return;
|
|
839
|
+
this.registros.delete(i);
|
|
840
|
+
const e = this.registry.get(t.scope), a = e == null ? void 0 : e.get(t.nome);
|
|
841
|
+
!e || !a || (a.delete(i), a.size === 0 && e.delete(t.nome), e.size === 0 && this.registry.delete(t.scope));
|
|
842
|
+
}
|
|
843
|
+
/** Radios do mesmo grupo que `radio`, usando o registro (não o nome atual, que pode ainda não ter sido registrado). */
|
|
844
|
+
static obterRadiosDoGrupo(i) {
|
|
845
|
+
var a;
|
|
846
|
+
const t = this.registros.get(i);
|
|
847
|
+
if (!t) return [];
|
|
848
|
+
const e = (a = this.registry.get(t.scope)) == null ? void 0 : a.get(t.nome);
|
|
849
|
+
return e ? Array.from(e) : [];
|
|
850
|
+
}
|
|
851
|
+
static desmarcarOutros(i) {
|
|
852
|
+
this.obterRadiosDoGrupo(i).forEach((t) => {
|
|
853
|
+
t !== i && (t.removeAttribute("marcado"), t.removeAttribute("checked"), t.syncState());
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
/** Reavalia o tabindex (roving) dos radios; use depois de entrar, sair ou mudar de grupo. */
|
|
857
|
+
static atualizarGrupo(i) {
|
|
858
|
+
i.forEach((t) => t.atualizarTabindex());
|
|
859
|
+
}
|
|
860
|
+
static tratarNavegacaoTeclado(i, t) {
|
|
861
|
+
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(i.key)) return;
|
|
862
|
+
i.preventDefault();
|
|
863
|
+
const e = this.obterRadiosDoGrupo(t).filter((c) => !c.disabled && c.isConnected);
|
|
864
|
+
if (e.length <= 1) return;
|
|
865
|
+
const a = e.indexOf(t), r = i.key === "ArrowDown" || i.key === "ArrowRight", n = (a + (r ? 1 : -1) + e.length) % e.length;
|
|
866
|
+
if (n !== a) {
|
|
867
|
+
const c = e[n];
|
|
868
|
+
c.selecionar(), c.focus();
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
s(l, "registry", /* @__PURE__ */ new WeakMap()), s(l, "registros", /* @__PURE__ */ new WeakMap());
|
|
873
|
+
class ot extends m {
|
|
874
|
+
constructor() {
|
|
875
|
+
super();
|
|
876
|
+
s(this, "containerElement");
|
|
877
|
+
s(this, "labelElement");
|
|
878
|
+
s(this, "listeners", new p());
|
|
879
|
+
s(this, "_defaultChecked", !1);
|
|
880
|
+
s(this, "handleClick", (t) => {
|
|
881
|
+
t.preventDefault(), this.selecionar(), this.containerElement.focus();
|
|
882
|
+
});
|
|
883
|
+
s(this, "handleHostClick", (t) => {
|
|
884
|
+
g(this, t) && (this.selecionar(), this.containerElement.focus());
|
|
885
|
+
});
|
|
886
|
+
s(this, "handleKeyDown", (t) => {
|
|
887
|
+
t.key === " " || t.key === "Enter" ? (t.preventDefault(), this.selecionar()) : l.tratarNavegacaoTeclado(t, this);
|
|
888
|
+
});
|
|
889
|
+
s(this, "handleFocus", () => {
|
|
890
|
+
this.containerElement.classList.add("ui-radio--foco");
|
|
891
|
+
});
|
|
892
|
+
s(this, "handleBlur", () => {
|
|
893
|
+
this.containerElement.classList.remove("ui-radio--foco");
|
|
894
|
+
});
|
|
895
|
+
const t = this.attachShadow({ mode: "open" });
|
|
896
|
+
t.innerHTML = `
|
|
897
|
+
<style>${rt}</style>
|
|
898
|
+
<div class="ui-radio" part="base" tabindex="0" role="radio" aria-checked="false">
|
|
899
|
+
<span class="ui-radio__circle" part="controle">
|
|
900
|
+
<span class="ui-radio__dot" part="indicador"></span>
|
|
901
|
+
</span>
|
|
902
|
+
<span class="ui-radio__label" part="rotulo" style="display: none;"></span>
|
|
903
|
+
</div>
|
|
904
|
+
`, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label"), this.labelElement.id = f("ui-radio-label");
|
|
905
|
+
}
|
|
906
|
+
static get observedAttributes() {
|
|
907
|
+
return [
|
|
908
|
+
"marcado",
|
|
909
|
+
"checked",
|
|
910
|
+
"name",
|
|
911
|
+
"nome",
|
|
912
|
+
"disabled",
|
|
913
|
+
"value",
|
|
914
|
+
"label",
|
|
915
|
+
"posicao-label",
|
|
916
|
+
"obrigatorio",
|
|
917
|
+
"required",
|
|
918
|
+
"mensagem-validacao",
|
|
919
|
+
...b
|
|
920
|
+
];
|
|
921
|
+
}
|
|
922
|
+
connectedCallback() {
|
|
923
|
+
this.listeners.cleanup(), this.listeners.add(this.containerElement, "click", this.handleClick), this.listeners.add(this.containerElement, "keydown", this.handleKeyDown), this.listeners.add(this.containerElement, "focus", this.handleFocus), this.listeners.add(this.containerElement, "blur", this.handleBlur), this.listeners.add(this, "click", this.handleHostClick), this._defaultChecked = this.hasAttribute("marcado") || this.hasAttribute("checked"), l.registrar(this), this.syncState(), l.atualizarGrupo(l.obterRadiosDoGrupo(this).filter((t) => t !== this));
|
|
924
|
+
}
|
|
925
|
+
disconnectedCallback() {
|
|
926
|
+
this.listeners.cleanup();
|
|
927
|
+
const t = l.obterRadiosDoGrupo(this).filter((e) => e !== this && e.isConnected);
|
|
928
|
+
l.desregistrar(this), l.atualizarGrupo(t);
|
|
929
|
+
}
|
|
930
|
+
attributeChangedCallback(t, e, a) {
|
|
931
|
+
if ((t === "name" || t === "nome") && this.isConnected) {
|
|
932
|
+
const r = l.obterRadiosDoGrupo(this).filter((n) => n !== this);
|
|
933
|
+
l.registrar(this), this.syncState(), l.atualizarGrupo([...r, ...l.obterRadiosDoGrupo(this).filter((n) => n !== this)]);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
this.syncState();
|
|
937
|
+
}
|
|
938
|
+
get marcado() {
|
|
939
|
+
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
940
|
+
}
|
|
941
|
+
set marcado(t) {
|
|
942
|
+
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked"));
|
|
943
|
+
}
|
|
944
|
+
get name() {
|
|
945
|
+
return this.getAttribute("name") || this.getAttribute("nome") || "";
|
|
946
|
+
}
|
|
947
|
+
set name(t) {
|
|
948
|
+
this.setAttribute("name", t);
|
|
949
|
+
}
|
|
950
|
+
get disabled() {
|
|
951
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
952
|
+
}
|
|
953
|
+
set disabled(t) {
|
|
954
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
955
|
+
}
|
|
956
|
+
get type() {
|
|
957
|
+
return "radio";
|
|
958
|
+
}
|
|
959
|
+
atualizarValidade() {
|
|
960
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
961
|
+
if (this.disabled) {
|
|
962
|
+
this.internals.setValidity({});
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
if (this._customErrorMessage) {
|
|
966
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const t = l.obterRadiosDoGrupo(this);
|
|
970
|
+
if ((this.required || t.length > 0 && t.some((a) => a.required)) && !(this.marcado || t.length > 0 && t.some((r) => r.marcado))) {
|
|
971
|
+
const r = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
972
|
+
this.internals.setValidity({ valueMissing: !0 }, r, this.containerElement);
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
this.internals.setValidity({});
|
|
976
|
+
}
|
|
977
|
+
focus(t) {
|
|
978
|
+
this.containerElement.focus(t);
|
|
979
|
+
}
|
|
980
|
+
selecionar() {
|
|
981
|
+
this.disabled || this.marcado || (this.marcado = !0, l.desmarcarOutros(this), this.dispatchEvent(
|
|
982
|
+
new CustomEvent("ui-change", {
|
|
983
|
+
detail: {
|
|
984
|
+
marcado: !0,
|
|
985
|
+
name: this.name,
|
|
986
|
+
value: this.getAttribute("value") || ""
|
|
987
|
+
},
|
|
988
|
+
bubbles: !0,
|
|
989
|
+
composed: !0
|
|
990
|
+
})
|
|
991
|
+
), this.dispatchEvent(
|
|
992
|
+
new Event("change", {
|
|
993
|
+
bubbles: !0,
|
|
994
|
+
composed: !0
|
|
995
|
+
})
|
|
996
|
+
), l.obterRadiosDoGrupo(this).forEach((t) => t.atualizarValidade()));
|
|
997
|
+
}
|
|
998
|
+
/**
|
|
999
|
+
* Roving tabindex: só um radio do grupo entra na ordem de Tab (o marcado; sem marcado, o primeiro habilitado).
|
|
1000
|
+
* Isolado de `syncState` para reavaliar os vizinhos sem mexer no valor/validade do formulário.
|
|
1001
|
+
*/
|
|
1002
|
+
atualizarTabindex() {
|
|
1003
|
+
if (this.disabled) {
|
|
1004
|
+
this.containerElement.setAttribute("tabindex", "-1");
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const t = l.obterRadiosDoGrupo(this).filter((e) => e.isConnected || e === this);
|
|
1008
|
+
if (t.length === 0) {
|
|
1009
|
+
this.containerElement.setAttribute("tabindex", "0");
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (t.some((e) => e.marcado))
|
|
1013
|
+
this.containerElement.setAttribute("tabindex", this.marcado ? "0" : "-1");
|
|
1014
|
+
else {
|
|
1015
|
+
const e = t.find((a) => !a.disabled);
|
|
1016
|
+
this.containerElement.setAttribute("tabindex", e === this ? "0" : "-1");
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
syncState() {
|
|
1020
|
+
d(this, this.containerElement);
|
|
1021
|
+
const t = this.marcado, e = this.disabled, a = this.getAttribute("label"), r = this.getAttribute("posicao-label") || "direita";
|
|
1022
|
+
this.containerElement.setAttribute("aria-checked", String(t)), this.atualizarTabindex(), e ? (this.containerElement.classList.add("ui-radio--disabled"), this.containerElement.setAttribute("aria-disabled", "true")) : (this.containerElement.classList.remove("ui-radio--disabled"), this.containerElement.removeAttribute("aria-disabled")), t ? this.containerElement.classList.add("ui-radio--checked") : this.containerElement.classList.remove("ui-radio--checked"), r === "esquerda" ? this.containerElement.classList.add("ui-radio--label-esquerda") : this.containerElement.classList.remove("ui-radio--label-esquerda"), v({
|
|
1023
|
+
host: this,
|
|
1024
|
+
internals: this.internals,
|
|
1025
|
+
controle: this.containerElement,
|
|
1026
|
+
rotulo: this.labelElement,
|
|
1027
|
+
texto: a
|
|
1028
|
+
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1029
|
+
}
|
|
1030
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
1031
|
+
formResetCallback() {
|
|
1032
|
+
this.marcado = this._defaultChecked, this._defaultChecked ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1033
|
+
}
|
|
1034
|
+
formStateRestoreCallback(t, e) {
|
|
1035
|
+
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
h("ui-radio", ot);
|
|
1039
|
+
const nt = ':host{display:inline-flex;align-items:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle}.ui-switch{display:inline-flex;align-items:center;gap:8px;cursor:pointer;-webkit-user-select:none;user-select:none;line-height:1;outline:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-switch--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-switch__track{display:inline-flex;align-items:center;position:relative;width:36px;height:20px;background:var(--ui-switch-fundo, var(--ui-fundo-elevado, var(--ui-cor-fundo-elevado, #1a1a1e)));border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:var(--ui-raio-pill, 999px);box-sizing:border-box;padding:1px;transition:background-color .2s ease,border-color .2s ease,box-shadow .2s ease;flex-shrink:0}.ui-switch:focus-visible .ui-switch__track,.ui-switch--foco .ui-switch__track{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-switch--checked .ui-switch__track{background:var(--ui-degrade-interno, var(--ui-switch-ativo-fundo, var(--ui-fundo-primario, var(--ui-cor-primaria, #00E08A))));border-color:var(--ui-cor-primaria, #00E08A)}.ui-switch__thumb{display:block;width:16px;height:16px;background:#fff;border-radius:50%;box-shadow:var(--ui-sombra-sm, 0 1px 3px rgba(0, 0, 0, .3));transition:transform .2s cubic-bezier(.4,0,.2,1),background-color .2s ease;transform:translate(0)}.ui-switch--checked .ui-switch__thumb{transform:translate(16px);background:var(--ui-cor-texto-sobre-primaria, #000000)}.ui-switch--sm .ui-switch__track{width:28px;height:16px;padding:1px}.ui-switch--sm .ui-switch__thumb{width:12px;height:12px}.ui-switch--sm.ui-switch--checked .ui-switch__thumb{transform:translate(12px)}.ui-switch--lg .ui-switch__track{width:44px;height:24px;padding:1px}.ui-switch--lg .ui-switch__thumb{width:20px;height:20px}.ui-switch--lg.ui-switch--checked .ui-switch__thumb{transform:translate(20px)}.ui-switch__label{display:inline-flex;align-items:center;font-size:clamp(11px,.85rem,14px);color:var(--ui-cor-texto, #e1e1e6);line-height:1}.ui-switch--label-esquerda{flex-direction:row-reverse}@media (max-width: 640px){.ui-switch{min-height:40px;padding:4px 0}.ui-switch__label{font-size:14px}}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-primario: var(--ui-gradiente-primario)}';
|
|
1040
|
+
class S extends m {
|
|
1041
|
+
constructor() {
|
|
1042
|
+
super();
|
|
1043
|
+
s(this, "containerElement");
|
|
1044
|
+
s(this, "labelElement");
|
|
1045
|
+
s(this, "labelId");
|
|
1046
|
+
s(this, "listeners", new p());
|
|
1047
|
+
s(this, "_defaultChecked", !1);
|
|
1048
|
+
s(this, "handleClick", (t) => {
|
|
1049
|
+
t.preventDefault(), this.alternar();
|
|
1050
|
+
});
|
|
1051
|
+
s(this, "handleHostClick", (t) => {
|
|
1052
|
+
g(this, t) && (this.alternar(), this.containerElement.focus());
|
|
1053
|
+
});
|
|
1054
|
+
s(this, "handleKeyDown", (t) => {
|
|
1055
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
1056
|
+
});
|
|
1057
|
+
s(this, "handleFocus", () => {
|
|
1058
|
+
this.containerElement.classList.add("ui-switch--foco");
|
|
1059
|
+
});
|
|
1060
|
+
s(this, "handleBlur", () => {
|
|
1061
|
+
this.containerElement.classList.remove("ui-switch--foco");
|
|
1062
|
+
});
|
|
1063
|
+
const t = this.attachShadow({ mode: "open" });
|
|
1064
|
+
t.innerHTML = `
|
|
1065
|
+
<style>${nt}</style>
|
|
1066
|
+
<div class="ui-switch" part="base" tabindex="0" role="switch" aria-checked="false">
|
|
1067
|
+
<span class="ui-switch__track" part="controle">
|
|
1068
|
+
<span class="ui-switch__thumb" part="indicador"></span>
|
|
1069
|
+
</span>
|
|
1070
|
+
<span class="ui-switch__label" part="rotulo" style="display: none;"></span>
|
|
1071
|
+
</div>
|
|
1072
|
+
`, this.containerElement = t.querySelector(".ui-switch"), this.labelElement = t.querySelector(".ui-switch__label"), this.labelId = f("ui-switch-label"), this.labelElement.id = this.labelId;
|
|
1073
|
+
}
|
|
1074
|
+
static get observedAttributes() {
|
|
1075
|
+
return [
|
|
1076
|
+
"ativo",
|
|
1077
|
+
"ligado",
|
|
1078
|
+
"checked",
|
|
1079
|
+
"disabled",
|
|
1080
|
+
"tamanho",
|
|
1081
|
+
"size",
|
|
1082
|
+
"label",
|
|
1083
|
+
"posicao-label",
|
|
1084
|
+
"value",
|
|
1085
|
+
"name",
|
|
1086
|
+
"obrigatorio",
|
|
1087
|
+
"required",
|
|
1088
|
+
"mensagem-validacao",
|
|
1089
|
+
"aria-label",
|
|
1090
|
+
...b
|
|
1091
|
+
];
|
|
1092
|
+
}
|
|
1093
|
+
connectedCallback() {
|
|
1094
|
+
this.listeners.cleanup(), this.listeners.add(this.containerElement, "click", this.handleClick), this.listeners.add(this.containerElement, "keydown", this.handleKeyDown), this.listeners.add(this.containerElement, "focus", this.handleFocus), this.listeners.add(this.containerElement, "blur", this.handleBlur), this.listeners.add(this, "click", this.handleHostClick), this._defaultChecked = this.hasAttribute("ativo") || this.hasAttribute("ligado") || this.hasAttribute("checked"), this.syncState();
|
|
1095
|
+
}
|
|
1096
|
+
disconnectedCallback() {
|
|
1097
|
+
this.listeners.cleanup();
|
|
1098
|
+
}
|
|
1099
|
+
attributeChangedCallback(t, e, a) {
|
|
1100
|
+
this.syncState();
|
|
1101
|
+
}
|
|
1102
|
+
get ativo() {
|
|
1103
|
+
return this.hasAttribute("ativo") || this.hasAttribute("ligado") || this.hasAttribute("checked");
|
|
1104
|
+
}
|
|
1105
|
+
set ativo(t) {
|
|
1106
|
+
t ? this.setAttribute("ativo", "") : (this.removeAttribute("ativo"), this.removeAttribute("ligado"), this.removeAttribute("checked")), this.syncState();
|
|
1107
|
+
}
|
|
1108
|
+
get checked() {
|
|
1109
|
+
return this.ativo;
|
|
1110
|
+
}
|
|
1111
|
+
set checked(t) {
|
|
1112
|
+
this.ativo = t;
|
|
1113
|
+
}
|
|
1114
|
+
get value() {
|
|
1115
|
+
return this.getAttribute("value") || "on";
|
|
1116
|
+
}
|
|
1117
|
+
set value(t) {
|
|
1118
|
+
this.setAttribute("value", t), this.syncState();
|
|
1119
|
+
}
|
|
1120
|
+
get name() {
|
|
1121
|
+
return this.getAttribute("name") || "";
|
|
1122
|
+
}
|
|
1123
|
+
set name(t) {
|
|
1124
|
+
this.setAttribute("name", t), this.syncState();
|
|
1125
|
+
}
|
|
1126
|
+
get disabled() {
|
|
1127
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
1128
|
+
}
|
|
1129
|
+
set disabled(t) {
|
|
1130
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
1131
|
+
}
|
|
1132
|
+
get type() {
|
|
1133
|
+
return "checkbox";
|
|
1134
|
+
}
|
|
1135
|
+
atualizarValidade() {
|
|
1136
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
1137
|
+
if (this.disabled) {
|
|
1138
|
+
this.internals.setValidity({});
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
if (this._customErrorMessage) {
|
|
1142
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
1143
|
+
return;
|
|
1144
|
+
}
|
|
1145
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.ativo) {
|
|
1146
|
+
const e = this.getAttribute("mensagem-validacao") || "Ative este interruptor para continuar.";
|
|
1147
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
this.internals.setValidity({});
|
|
1151
|
+
}
|
|
1152
|
+
/** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
|
|
1153
|
+
focus(t) {
|
|
1154
|
+
this.containerElement.focus(t);
|
|
1155
|
+
}
|
|
1156
|
+
alternar() {
|
|
1157
|
+
this.disabled || (this.ativo = !this.ativo, this.dispatchEvent(
|
|
1158
|
+
new CustomEvent("ui-change", {
|
|
1159
|
+
detail: {
|
|
1160
|
+
ativo: this.ativo,
|
|
1161
|
+
value: this.getAttribute("value") || ""
|
|
1162
|
+
},
|
|
1163
|
+
bubbles: !0,
|
|
1164
|
+
composed: !0
|
|
1165
|
+
})
|
|
1166
|
+
), this.dispatchEvent(
|
|
1167
|
+
new Event("change", {
|
|
1168
|
+
bubbles: !0,
|
|
1169
|
+
composed: !0
|
|
1170
|
+
})
|
|
1171
|
+
));
|
|
1172
|
+
}
|
|
1173
|
+
syncState() {
|
|
1174
|
+
const t = this.ativo, e = this.disabled, a = this.getAttribute("tamanho") || this.getAttribute("size") || "md", r = this.getAttribute("label"), n = this.getAttribute("posicao-label") || "direita";
|
|
1175
|
+
d(this, this.containerElement), this.containerElement.setAttribute("aria-checked", String(t)), e ? (this.containerElement.classList.add("ui-switch--disabled"), this.containerElement.setAttribute("tabindex", "-1"), this.containerElement.setAttribute("aria-disabled", "true")) : (this.containerElement.classList.remove("ui-switch--disabled"), this.containerElement.setAttribute("tabindex", "0"), this.containerElement.removeAttribute("aria-disabled")), t ? this.containerElement.classList.add("ui-switch--checked") : this.containerElement.classList.remove("ui-switch--checked"), this.containerElement.classList.remove("ui-switch--sm", "ui-switch--md", "ui-switch--lg"), ["sm", "md", "lg"].includes(a) ? this.containerElement.classList.add(`ui-switch--${a}`) : this.containerElement.classList.add("ui-switch--md"), n === "esquerda" ? this.containerElement.classList.add("ui-switch--label-esquerda") : this.containerElement.classList.remove("ui-switch--label-esquerda"), v({
|
|
1176
|
+
host: this,
|
|
1177
|
+
internals: this.internals,
|
|
1178
|
+
controle: this.containerElement,
|
|
1179
|
+
rotulo: this.labelElement,
|
|
1180
|
+
texto: r
|
|
1181
|
+
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1182
|
+
}
|
|
1183
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
1184
|
+
formResetCallback() {
|
|
1185
|
+
this.ativo = this._defaultChecked, this.syncState();
|
|
1186
|
+
}
|
|
1187
|
+
formStateRestoreCallback(t, e) {
|
|
1188
|
+
typeof t == "string" ? this.ativo = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.ativo = t), this.syncState();
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
class lt extends S {
|
|
1192
|
+
}
|
|
1193
|
+
h("ui-switch", S);
|
|
1194
|
+
h("ui-toggle", lt);
|
|
1195
|
+
export {
|
|
1196
|
+
Q as A,
|
|
1197
|
+
Y as L,
|
|
1198
|
+
l as R,
|
|
1199
|
+
k as U,
|
|
1200
|
+
Z as a,
|
|
1201
|
+
st as b,
|
|
1202
|
+
w as c,
|
|
1203
|
+
ot as d,
|
|
1204
|
+
it as e,
|
|
1205
|
+
S as f,
|
|
1206
|
+
X as g,
|
|
1207
|
+
lt as h,
|
|
1208
|
+
et as i,
|
|
1209
|
+
O as j,
|
|
1210
|
+
tt as k,
|
|
1211
|
+
A as r
|
|
1212
|
+
};
|