@thibezer/ui-components-kit 2.9.0 → 2.10.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 +87 -0
- package/README.md +6 -3
- package/dist/camadas.cjs +53 -55
- package/dist/camadas.js +254 -242
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +54 -53
- package/dist/canvas.js +2074 -1907
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-area-texto/area-texto-altura.d.ts +16 -0
- package/dist/components/ui-area-texto/area-texto-contador.d.ts +6 -0
- package/dist/components/ui-area-texto/area-texto-template.d.ts +2 -0
- package/dist/components/ui-area-texto/index.d.ts +3 -0
- package/dist/components/ui-area-texto/tipos.d.ts +19 -0
- package/dist/components/ui-area-texto/ui-area-texto.d.ts +100 -0
- package/dist/components/ui-campo-texto/campo-texto-estados.d.ts +5 -1
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +1 -0
- package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +7 -1
- package/dist/components/ui-canvas-cad/cad-recusas.d.ts +6 -0
- package/dist/components/ui-card/card-interacao.d.ts +17 -0
- package/dist/components/ui-card/card-secoes.d.ts +10 -0
- package/dist/components/ui-card/ui-card.d.ts +23 -0
- package/dist/components/ui-texto/ui-texto.d.ts +16 -0
- package/dist/core/alvo-digitavel.d.ts +5 -0
- package/dist/core/opcoes.d.ts +7 -0
- package/dist/cores.cjs +1 -1
- package/dist/cores.js +9 -8
- package/dist/custom-elements.json +18133 -15664
- package/dist/data.cjs +1 -1
- package/dist/data.js +1 -1
- package/dist/forms.cjs +1 -1
- package/dist/forms.d.ts +4 -0
- package/dist/forms.js +15 -12
- package/dist/gerencigeo-canvas/canvas_interacao.d.ts +2 -0
- package/dist/gerencigeo-canvas/feature_desenho.d.ts +13 -1
- package/dist/gerencigeo-canvas/feature_desenho_controle.d.ts +3 -0
- package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +9 -0
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +13 -2
- package/dist/gerencigeo-canvas/mapa_core.d.ts +4 -0
- package/dist/gerencigeo-canvas/popup_residual.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +195 -191
- package/dist/opcoes-CupvWVIm.js +24 -0
- package/dist/opcoes-vdAUY5OI.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +9 -8
- package/dist/tipos-elementos.d.ts +74 -0
- package/dist/tipos-react.d.ts +4 -0
- package/dist/tipos-vue.d.ts +74 -0
- package/dist/{ui-badge-BWhoGgo9.js → ui-badge-B5J_c5P5.js} +1 -1
- package/dist/{ui-badge-SIR81R9l.cjs → ui-badge-DC4y6Dik.cjs} +1 -1
- package/dist/{ui-campo-texto-B_OHVGiN.js → ui-campo-texto-19tIrmBK.js} +91 -93
- package/dist/ui-campo-texto-CH8mzX61.cjs +16 -0
- package/dist/ui-card-0wu4rjEX.cjs +20 -0
- package/dist/ui-card-DRtpOo3l.js +143 -0
- package/dist/ui-controle-cores-BEUKOq4n.js +275 -0
- package/dist/ui-controle-cores-BLhrZHMh.cjs +32 -0
- package/dist/{ui-linha-BYAX4W6x.cjs → ui-linha-C306zxWG.cjs} +6 -6
- package/dist/{ui-linha-aqLlaYi7.js → ui-linha-C_azWkcG.js} +103 -99
- package/dist/ui-seletor-cor-2yGryC_Z.cjs +86 -0
- package/dist/ui-seletor-cor-BuyhoDZz.js +345 -0
- package/dist/{ui-switch-DO1R0Ce7.js → ui-switch-BL-x_-SM.js} +460 -173
- package/dist/ui-switch-C0i_3QXu.cjs +66 -0
- package/package.json +1 -1
- package/dist/opcoes-CJYLi6kd.js +0 -12
- package/dist/opcoes-CkyDxBuQ.cjs +0 -1
- package/dist/ui-campo-texto-DauJCde3.cjs +0 -16
- package/dist/ui-card-BNYCQ7g-.js +0 -119
- package/dist/ui-card-BrjBL-yo.cjs +0 -20
- package/dist/ui-controle-cores-DgEza3wF.js +0 -612
- package/dist/ui-controle-cores-uY__TgwW.cjs +0 -117
- package/dist/ui-switch-D9a8XlVX.cjs +0 -53
|
@@ -1,17 +1,301 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var S = (o, i, t) => i in o ? w(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
|
|
3
|
+
var s = (o, i, t) => S(o, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { F as d, r as y, s as z } from "./ui-campo-texto-19tIrmBK.js";
|
|
5
|
+
import { L as b } from "./listener-bag-DQgv7OON.js";
|
|
6
6
|
import { d as h } from "./ssr-safe-5cWfJP-s.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { g as m, o as f, c as p } from "./acessibilidade-CUlSXc2X.js";
|
|
8
|
+
import { v as C, a as L } from "./form-validacao-BlQFxUVj.js";
|
|
9
|
+
import { i as c, b as I, e as q } from "./opcoes-CupvWVIm.js";
|
|
10
|
+
import { a as V } from "./parts-CaoQiCfI.js";
|
|
11
|
+
import { b as g } from "./altura-controle-vxQiXG4q.js";
|
|
12
|
+
const D = ':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-color: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-color: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-color: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}}', R = [
|
|
13
|
+
"label",
|
|
14
|
+
"placeholder",
|
|
15
|
+
"value",
|
|
16
|
+
"obrigatorio",
|
|
17
|
+
"required",
|
|
18
|
+
"minlength",
|
|
19
|
+
"min-length",
|
|
20
|
+
"maxlength",
|
|
21
|
+
"max-length",
|
|
22
|
+
"mensagem-validacao",
|
|
23
|
+
"helper-text",
|
|
24
|
+
"erro",
|
|
25
|
+
"mensagem-erro",
|
|
26
|
+
"disabled",
|
|
27
|
+
"readonly",
|
|
28
|
+
"linhas",
|
|
29
|
+
"linhas-max",
|
|
30
|
+
"auto-altura",
|
|
31
|
+
"redimensionar",
|
|
32
|
+
"contador",
|
|
33
|
+
"aria-label"
|
|
34
|
+
];
|
|
35
|
+
function M() {
|
|
36
|
+
return `
|
|
37
|
+
<style>${D}</style>
|
|
38
|
+
<div class="ui-area-texto__container">
|
|
39
|
+
<label class="ui-area-texto__label" part="rotulo" style="display: none;"></label>
|
|
40
|
+
<div class="ui-area-texto__wrapper" part="campo">
|
|
41
|
+
<textarea class="ui-area-texto__input" part="input" rows="4"></textarea>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="ui-area-texto__rodape" part="rodape">
|
|
45
|
+
<div class="ui-area-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
46
|
+
<span class="ui-area-texto__contador" part="contador" aria-hidden="true" hidden></span>
|
|
47
|
+
</div>
|
|
48
|
+
<span class="ui-area-texto__anuncio" role="status" aria-live="polite"></span>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
const F = 0.9;
|
|
52
|
+
function H(o, i) {
|
|
53
|
+
const t = Number.isFinite(o) && o > 0 ? Math.trunc(o) : 0, e = i !== null && Number.isFinite(i) && i > 0 ? Math.trunc(i) : null;
|
|
54
|
+
if (e === null) return { texto: String(t), nivel: "normal", anuncio: "" };
|
|
55
|
+
const a = `${t} / ${e}`;
|
|
56
|
+
if (t > e)
|
|
57
|
+
return { texto: a, nivel: "excedido", anuncio: `Limite de ${e} caracteres excedido em ${t - e}.` };
|
|
58
|
+
if (t >= e * F) {
|
|
59
|
+
const r = e - t;
|
|
60
|
+
return {
|
|
61
|
+
texto: a,
|
|
62
|
+
nivel: "aviso",
|
|
63
|
+
anuncio: r === 0 ? `Limite de ${e} caracteres atingido.` : `Restam ${r} caracteres.`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return { texto: a, nivel: "normal", anuncio: "" };
|
|
67
|
+
}
|
|
68
|
+
function T(o, i) {
|
|
69
|
+
return !Number.isFinite(o) || !Number.isFinite(i) || o <= 0 || o <= i ? null : Math.ceil(o);
|
|
70
|
+
}
|
|
71
|
+
function v(o, i) {
|
|
72
|
+
const t = i.offsetHeight;
|
|
73
|
+
t > 0 && (i.style.minHeight = `${t}px`), o.style.height = "auto";
|
|
74
|
+
const e = T(o.scrollHeight, o.clientHeight);
|
|
75
|
+
e !== null && (o.style.height = `${e}px`), i.style.minHeight = "";
|
|
76
|
+
}
|
|
77
|
+
function $(o, i) {
|
|
78
|
+
o.style.height = "", i.style.minHeight = "";
|
|
79
|
+
}
|
|
80
|
+
const O = ["nenhum", "vertical", "horizontal", "ambos"], P = {
|
|
81
|
+
nenhum: "none",
|
|
82
|
+
vertical: "vertical",
|
|
83
|
+
horizontal: "horizontal",
|
|
84
|
+
ambos: "both"
|
|
85
|
+
}, B = ["normal", "aviso", "excedido"], N = 4, K = 50, U = 200;
|
|
86
|
+
class A extends d {
|
|
87
|
+
constructor() {
|
|
88
|
+
super();
|
|
89
|
+
s(this, "labelElement");
|
|
90
|
+
s(this, "wrapperElement");
|
|
91
|
+
s(this, "textareaElement");
|
|
92
|
+
s(this, "helperElement");
|
|
93
|
+
s(this, "contadorElement");
|
|
94
|
+
s(this, "anuncioElement");
|
|
95
|
+
s(this, "listeners", new b());
|
|
96
|
+
s(this, "_focado", !1);
|
|
97
|
+
s(this, "_textareaId");
|
|
98
|
+
s(this, "_defaultValue", "");
|
|
99
|
+
s(this, "_nivelAnunciado", "normal");
|
|
100
|
+
s(this, "handleInput", (t) => {
|
|
101
|
+
t.stopPropagation(), this.syncState(), this.emitirEdicao("ui-input", "input", this.textareaElement.value);
|
|
102
|
+
});
|
|
103
|
+
s(this, "handleChange", (t) => {
|
|
104
|
+
t.stopPropagation(), this.syncState(), this.emitirEdicao("ui-change", "change", this.textareaElement.value);
|
|
105
|
+
});
|
|
106
|
+
s(this, "handleFocus", () => {
|
|
107
|
+
this._focado = !0;
|
|
108
|
+
});
|
|
109
|
+
s(this, "handleBlur", () => {
|
|
110
|
+
this._focado = !1, this.syncState();
|
|
111
|
+
});
|
|
112
|
+
/** Ctrl/Cmd + Enter pede o envio sem submeter o `<form>`; Enter comum continua inserindo quebra de linha. */
|
|
113
|
+
s(this, "handleKeyDown", (t) => {
|
|
114
|
+
t.key !== "Enter" || t.isComposing || t.altKey || t.shiftKey || !(t.ctrlKey || t.metaKey) || this.disabled || this.readOnly || (t.preventDefault(), this.dispatchEvent(
|
|
115
|
+
new CustomEvent("ui-enviar", {
|
|
116
|
+
detail: { value: this.textareaElement.value },
|
|
117
|
+
bubbles: !0,
|
|
118
|
+
composed: !0
|
|
119
|
+
})
|
|
120
|
+
));
|
|
121
|
+
});
|
|
122
|
+
/** Clique em `<label>` externo associado ao host foca o textarea. */
|
|
123
|
+
s(this, "handleHostClick", (t) => {
|
|
124
|
+
p(this, t) && !this.disabled && this.textareaElement.focus();
|
|
125
|
+
});
|
|
126
|
+
s(this, "handleResize", () => {
|
|
127
|
+
this.hasAttribute("auto-altura") && v(this.textareaElement, this.wrapperElement);
|
|
128
|
+
});
|
|
129
|
+
const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
|
|
130
|
+
t.innerHTML = M(), 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 = m("ui-area"), this.textareaElement.id = this._textareaId, this.labelElement.htmlFor = this._textareaId, this.helperElement.id = `${this._textareaId}-ajuda`;
|
|
131
|
+
}
|
|
132
|
+
static get observedAttributes() {
|
|
133
|
+
return R;
|
|
134
|
+
}
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
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();
|
|
137
|
+
}
|
|
138
|
+
disconnectedCallback() {
|
|
139
|
+
this.listeners.cleanup();
|
|
140
|
+
}
|
|
141
|
+
attributeChangedCallback(t, e, a) {
|
|
142
|
+
t === "value" && a !== this.textareaElement.value && !this._focado && (this.textareaElement.value = a ?? ""), this.syncState();
|
|
143
|
+
}
|
|
144
|
+
// === API pública ===
|
|
145
|
+
focus(t) {
|
|
146
|
+
this.textareaElement.focus(t);
|
|
147
|
+
}
|
|
148
|
+
blur() {
|
|
149
|
+
this.textareaElement.blur();
|
|
150
|
+
}
|
|
151
|
+
/** Seleciona todo o texto. */
|
|
152
|
+
select() {
|
|
153
|
+
this.textareaElement.select();
|
|
154
|
+
}
|
|
155
|
+
/** Define a seleção; índices inválidos são ignorados pelo navegador, nunca lançam. */
|
|
156
|
+
setSelectionRange(t, e, a) {
|
|
157
|
+
try {
|
|
158
|
+
this.textareaElement.setSelectionRange(t, e, a);
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** Apaga o texto programaticamente (sem disparar eventos de edição). */
|
|
163
|
+
limpar() {
|
|
164
|
+
this.value = "";
|
|
165
|
+
}
|
|
166
|
+
get value() {
|
|
167
|
+
return this.textareaElement ? this.textareaElement.value : this.getAttribute("value") ?? "";
|
|
168
|
+
}
|
|
169
|
+
set value(t) {
|
|
170
|
+
const e = t == null ? "" : String(t);
|
|
171
|
+
this.setAttribute("value", e);
|
|
172
|
+
try {
|
|
173
|
+
this.textareaElement.value = e;
|
|
174
|
+
} catch {
|
|
175
|
+
}
|
|
176
|
+
this.syncState();
|
|
177
|
+
}
|
|
178
|
+
get name() {
|
|
179
|
+
return this.getAttribute("name") || "";
|
|
180
|
+
}
|
|
181
|
+
set name(t) {
|
|
182
|
+
this.setAttribute("name", t);
|
|
183
|
+
}
|
|
184
|
+
get type() {
|
|
185
|
+
return "textarea";
|
|
186
|
+
}
|
|
187
|
+
get disabled() {
|
|
188
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
189
|
+
}
|
|
190
|
+
set disabled(t) {
|
|
191
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
192
|
+
}
|
|
193
|
+
get readOnly() {
|
|
194
|
+
return this.hasAttribute("readonly");
|
|
195
|
+
}
|
|
196
|
+
set readOnly(t) {
|
|
197
|
+
t ? this.setAttribute("readonly", "") : this.removeAttribute("readonly");
|
|
198
|
+
}
|
|
199
|
+
get minLength() {
|
|
200
|
+
return c(this.getAttribute("minlength") ?? this.getAttribute("min-length")) ?? -1;
|
|
201
|
+
}
|
|
202
|
+
set minLength(t) {
|
|
203
|
+
t >= 0 ? this.setAttribute("minlength", String(t)) : this.removeAttribute("minlength");
|
|
204
|
+
}
|
|
205
|
+
get maxLength() {
|
|
206
|
+
return c(this.getAttribute("maxlength") ?? this.getAttribute("max-length")) ?? -1;
|
|
207
|
+
}
|
|
208
|
+
set maxLength(t) {
|
|
209
|
+
t >= 0 ? this.setAttribute("maxlength", String(t)) : this.removeAttribute("maxlength");
|
|
210
|
+
}
|
|
211
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
212
|
+
formResetCallback() {
|
|
213
|
+
this.textareaElement.value = this._defaultValue, this.syncState();
|
|
214
|
+
}
|
|
215
|
+
formStateRestoreCallback(t, e) {
|
|
216
|
+
typeof t == "string" && (this.value = t);
|
|
217
|
+
}
|
|
218
|
+
atualizarValidade() {
|
|
219
|
+
const t = this.textareaElement ? this.textareaElement.value : "", e = C({
|
|
220
|
+
val: t,
|
|
221
|
+
rawVal: t,
|
|
222
|
+
disabled: this.disabled,
|
|
223
|
+
required: this.required,
|
|
224
|
+
tipo: "text",
|
|
225
|
+
minlength: c(this.getAttribute("minlength") ?? this.getAttribute("min-length")),
|
|
226
|
+
maxlength: c(this.getAttribute("maxlength") ?? this.getAttribute("max-length")),
|
|
227
|
+
customError: this._customErrorMessage,
|
|
228
|
+
mensagemValidacao: this.getAttribute("mensagem-validacao")
|
|
229
|
+
});
|
|
230
|
+
L(this.internals, e, this.textareaElement);
|
|
231
|
+
}
|
|
232
|
+
syncState() {
|
|
233
|
+
var a, r;
|
|
234
|
+
const t = this.textareaElement, e = this.hasAttribute("auto-altura");
|
|
235
|
+
t.setAttribute("rows", String(I(this.getAttribute("linhas"), 1, K, N))), 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();
|
|
236
|
+
}
|
|
237
|
+
sincronizarRotulo() {
|
|
238
|
+
const t = this.getAttribute("label");
|
|
239
|
+
if (t) {
|
|
240
|
+
y(this.labelElement, t, this.required, "ui-area-texto__asterisco"), this.labelElement.style.display = "flex", this.textareaElement.removeAttribute("aria-label");
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.labelElement.style.display = "none";
|
|
244
|
+
const e = f(this, this.internals);
|
|
245
|
+
e ? this.textareaElement.setAttribute("aria-label", e) : this.textareaElement.removeAttribute("aria-label");
|
|
246
|
+
}
|
|
247
|
+
sincronizarLimites() {
|
|
248
|
+
const t = this.textareaElement, e = c(this.getAttribute("minlength") ?? this.getAttribute("min-length")), a = c(this.getAttribute("maxlength") ?? this.getAttribute("max-length"));
|
|
249
|
+
e !== null ? t.minLength = e : t.removeAttribute("minlength"), a !== null ? t.maxLength = a : t.removeAttribute("maxlength");
|
|
250
|
+
}
|
|
251
|
+
sincronizarEstadoInterativo() {
|
|
252
|
+
const t = this.textareaElement, e = this.disabled;
|
|
253
|
+
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");
|
|
254
|
+
}
|
|
255
|
+
sincronizarFeedback() {
|
|
256
|
+
const t = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|
|
257
|
+
z(
|
|
258
|
+
this.wrapperElement,
|
|
259
|
+
this.textareaElement,
|
|
260
|
+
this.helperElement,
|
|
261
|
+
t,
|
|
262
|
+
this.getAttribute("mensagem-erro"),
|
|
263
|
+
this.getAttribute("helper-text"),
|
|
264
|
+
"ui-area-texto"
|
|
265
|
+
), this.helperElement.style.display === "none" ? this.textareaElement.removeAttribute("aria-describedby") : this.textareaElement.setAttribute("aria-describedby", this.helperElement.id);
|
|
266
|
+
}
|
|
267
|
+
sincronizarContador() {
|
|
268
|
+
if (!this.hasAttribute("contador")) {
|
|
269
|
+
this.contadorElement.hidden = !0, this.anuncioElement.textContent = "", this._nivelAnunciado = "normal";
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const t = c(this.getAttribute("maxlength") ?? this.getAttribute("max-length"), 1), e = H(this.textareaElement.value.length, t);
|
|
273
|
+
this.contadorElement.hidden = !1, this.contadorElement.textContent = e.texto;
|
|
274
|
+
for (const a of B)
|
|
275
|
+
this.contadorElement.classList.toggle(`ui-area-texto__contador--${a}`, a === e.nivel);
|
|
276
|
+
e.nivel !== this._nivelAnunciado && (this._nivelAnunciado = e.nivel, this.anuncioElement.textContent = e.anuncio);
|
|
277
|
+
}
|
|
278
|
+
sincronizarAltura(t) {
|
|
279
|
+
const e = this.textareaElement, a = t ? "nenhum" : q(this.getAttribute("redimensionar"), O, "vertical");
|
|
280
|
+
e.style.resize = P[a];
|
|
281
|
+
const r = t ? c(this.getAttribute("linhas-max"), 1) : null;
|
|
282
|
+
r !== null ? this.style.setProperty("--ui-area-linhas-max", String(Math.min(r, U))) : this.style.removeProperty("--ui-area-linhas-max"), t ? v(e, this.wrapperElement) : $(e, this.wrapperElement);
|
|
283
|
+
}
|
|
284
|
+
emitirEdicao(t, e, a) {
|
|
285
|
+
this.dispatchEvent(
|
|
286
|
+
new CustomEvent(t, { detail: { value: a }, bubbles: !0, composed: !0 })
|
|
287
|
+
), this.dispatchEvent(new Event(e, { bubbles: !0, composed: !0 }));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
class j extends A {
|
|
291
|
+
}
|
|
292
|
+
h("ui-area-texto", A);
|
|
293
|
+
h("ui-textarea", j);
|
|
294
|
+
class G {
|
|
11
295
|
constructor(i, t, e) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
296
|
+
s(this, "scrollHandler");
|
|
297
|
+
s(this, "resizeHandler");
|
|
298
|
+
s(this, "posicionar", () => {
|
|
15
299
|
if (this.isMobileOrBottomSheet()) {
|
|
16
300
|
this.content.style.top = "", this.content.style.left = "", this.content.style.minWidth = "";
|
|
17
301
|
return;
|
|
@@ -28,8 +312,8 @@ class E {
|
|
|
28
312
|
ajustarAoViewport(i) {
|
|
29
313
|
const t = this.content.offsetHeight, e = this.content.offsetWidth;
|
|
30
314
|
if (t <= 0 || typeof window > "u") return;
|
|
31
|
-
const
|
|
32
|
-
i.bottom + 2 + t > window.innerHeight -
|
|
315
|
+
const a = 8;
|
|
316
|
+
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`);
|
|
33
317
|
}
|
|
34
318
|
ativarAcompanhamento(i) {
|
|
35
319
|
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")
|
|
@@ -47,9 +331,9 @@ class E {
|
|
|
47
331
|
}
|
|
48
332
|
}
|
|
49
333
|
}
|
|
50
|
-
class
|
|
334
|
+
class W {
|
|
51
335
|
constructor(i) {
|
|
52
|
-
|
|
336
|
+
s(this, "focusedIndex", -1);
|
|
53
337
|
this.listElement = i;
|
|
54
338
|
}
|
|
55
339
|
focarPrimeiroItem() {
|
|
@@ -66,7 +350,7 @@ class C {
|
|
|
66
350
|
const t = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
67
351
|
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());
|
|
68
352
|
}
|
|
69
|
-
tratarKeydownLista(i, t, e,
|
|
353
|
+
tratarKeydownLista(i, t, e, a, r) {
|
|
70
354
|
if (i.key === "ArrowDown")
|
|
71
355
|
i.preventDefault(), this.moverFoco(1);
|
|
72
356
|
else if (i.key === "ArrowUp")
|
|
@@ -75,10 +359,10 @@ class C {
|
|
|
75
359
|
i.preventDefault();
|
|
76
360
|
const n = i.key === "End";
|
|
77
361
|
this.focusedIndex = n ? -1 : 0, n ? this.moverFoco(-1) : this.moverFoco(0);
|
|
78
|
-
} else i.key === "Tab" ?
|
|
362
|
+
} 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());
|
|
79
363
|
}
|
|
80
364
|
}
|
|
81
|
-
const
|
|
365
|
+
const X = ':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-color: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-color: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: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: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-color:var(--ui-cor-hover-menu, rgba(255, 255, 255, .08))}.ui-lista-flutuante__item--selecionado{background-color: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)}}', Y = [
|
|
82
366
|
"aberta",
|
|
83
367
|
"texto-padrao",
|
|
84
368
|
"value",
|
|
@@ -99,9 +383,9 @@ const S = ':host{display:inline-block;position:relative;width:100%;box-sizing:bo
|
|
|
99
383
|
"mensagem-validacao",
|
|
100
384
|
"aria-label"
|
|
101
385
|
];
|
|
102
|
-
function
|
|
386
|
+
function Z() {
|
|
103
387
|
return `
|
|
104
|
-
<style>${
|
|
388
|
+
<style>${X}</style>
|
|
105
389
|
<div class="ui-lista-flutuante__container">
|
|
106
390
|
<label class="ui-lista-flutuante__label" part="rotulo" style="display: none;"></label>
|
|
107
391
|
<div class="ui-lista-flutuante__backdrop"></div>
|
|
@@ -122,42 +406,42 @@ function z() {
|
|
|
122
406
|
</div>
|
|
123
407
|
`;
|
|
124
408
|
}
|
|
125
|
-
function
|
|
409
|
+
function _(o, i, t) {
|
|
126
410
|
o.innerHTML = "", i.forEach((e) => {
|
|
127
|
-
const
|
|
128
|
-
|
|
411
|
+
const a = document.createElement("li"), r = String(e.id) === String(t);
|
|
412
|
+
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);
|
|
129
413
|
});
|
|
130
414
|
}
|
|
131
|
-
function
|
|
415
|
+
function J(o, i) {
|
|
132
416
|
o.querySelectorAll(".ui-lista-flutuante__item").forEach((e) => {
|
|
133
|
-
const
|
|
134
|
-
|
|
417
|
+
const a = e.getAttribute("data-id");
|
|
418
|
+
V(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"));
|
|
135
419
|
});
|
|
136
420
|
}
|
|
137
|
-
class
|
|
421
|
+
class E extends d {
|
|
138
422
|
constructor() {
|
|
139
423
|
super();
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
424
|
+
s(this, "labelElement");
|
|
425
|
+
s(this, "button");
|
|
426
|
+
s(this, "content");
|
|
427
|
+
s(this, "listElement");
|
|
428
|
+
s(this, "textoElement");
|
|
429
|
+
s(this, "backdropElement");
|
|
430
|
+
s(this, "sheetTituloElement");
|
|
431
|
+
s(this, "sheetCloseButton");
|
|
432
|
+
s(this, "idsAcessibilidade");
|
|
433
|
+
s(this, "listeners", new b());
|
|
434
|
+
s(this, "_itens", []);
|
|
435
|
+
s(this, "_value", "");
|
|
436
|
+
s(this, "_defaultValue", "");
|
|
437
|
+
s(this, "_defaultCapturado", !1);
|
|
438
|
+
s(this, "observer");
|
|
439
|
+
s(this, "posicionamento");
|
|
440
|
+
s(this, "teclado");
|
|
441
|
+
s(this, "toggleLista", (t) => {
|
|
158
442
|
t.stopPropagation(), !this.disabled && (this.hasAttribute("aberta") ? this.fechar() : this.abrir());
|
|
159
443
|
});
|
|
160
|
-
|
|
444
|
+
s(this, "handleKeyDown", (t) => {
|
|
161
445
|
if (!this.disabled) {
|
|
162
446
|
if (t.key === "Escape" && this.hasAttribute("aberta")) {
|
|
163
447
|
t.preventDefault(), this.fechar();
|
|
@@ -166,7 +450,7 @@ class v extends d {
|
|
|
166
450
|
(t.key === "Enter" || t.key === " " || t.key === "ArrowDown" || t.key === "ArrowUp") && (t.preventDefault(), this.hasAttribute("aberta") ? this.teclado.focarPrimeiroItem() : this.abrir());
|
|
167
451
|
}
|
|
168
452
|
});
|
|
169
|
-
|
|
453
|
+
s(this, "handleListKeyDown", (t) => {
|
|
170
454
|
this.hasAttribute("aberta") && this.teclado.tratarKeydownLista(
|
|
171
455
|
t,
|
|
172
456
|
this._itens,
|
|
@@ -175,41 +459,41 @@ class v extends d {
|
|
|
175
459
|
this.button
|
|
176
460
|
);
|
|
177
461
|
});
|
|
178
|
-
|
|
462
|
+
s(this, "fechar", () => {
|
|
179
463
|
this.hasAttribute("aberta") && (this.removeAttribute("aberta"), this.posicionamento.desativarAcompanhamento(), this.teclado.resetarFoco());
|
|
180
464
|
});
|
|
181
|
-
|
|
465
|
+
s(this, "handleClickFora", (t) => {
|
|
182
466
|
if (!this.hasAttribute("aberta")) return;
|
|
183
467
|
const e = t.composedPath();
|
|
184
468
|
!e.includes(this) && !e.includes(this.content) && this.fechar();
|
|
185
469
|
});
|
|
186
470
|
/** Clicar no rótulo foca o controle (comportamento do <select> nativo), sem abrir a lista. */
|
|
187
|
-
|
|
471
|
+
s(this, "focarGatilho", () => {
|
|
188
472
|
this.disabled || this.button.focus();
|
|
189
473
|
});
|
|
190
|
-
|
|
191
|
-
|
|
474
|
+
s(this, "handleHostClick", (t) => {
|
|
475
|
+
p(this, t) && this.focarGatilho();
|
|
192
476
|
});
|
|
193
|
-
|
|
477
|
+
s(this, "handleListClick", (t) => {
|
|
194
478
|
var n;
|
|
195
479
|
t.stopPropagation();
|
|
196
480
|
const e = (n = t.target) == null ? void 0 : n.closest("li[data-id]");
|
|
197
481
|
if (!e) return;
|
|
198
|
-
const
|
|
482
|
+
const a = e.getAttribute("data-id"), r = this._itens.find((u) => String(u.id) === String(a));
|
|
199
483
|
r && this.selecionarItem(r);
|
|
200
484
|
});
|
|
201
485
|
const t = this.attachShadow({ mode: "open" });
|
|
202
|
-
t.innerHTML =
|
|
203
|
-
const e =
|
|
486
|
+
t.innerHTML = Z(), 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");
|
|
487
|
+
const e = m("ui-select");
|
|
204
488
|
this.idsAcessibilidade = {
|
|
205
489
|
label: `${e}-label`,
|
|
206
490
|
gatilho: `${e}-gatilho`,
|
|
207
491
|
texto: `${e}-texto`,
|
|
208
492
|
lista: `${e}-lista`
|
|
209
|
-
}, 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
|
|
493
|
+
}, 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 G(this, this.button, this.content), this.teclado = new W(this.listElement);
|
|
210
494
|
}
|
|
211
495
|
static get observedAttributes() {
|
|
212
|
-
return
|
|
496
|
+
return Y;
|
|
213
497
|
}
|
|
214
498
|
connectedCallback() {
|
|
215
499
|
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) => {
|
|
@@ -218,26 +502,26 @@ class v extends d {
|
|
|
218
502
|
}
|
|
219
503
|
carregarItensFilhos() {
|
|
220
504
|
const t = Array.from(this.querySelectorAll('option, ui-opcao, [role="option"], [data-opcao], [data-value]:not(input):not(select)'));
|
|
221
|
-
t.length > 0 && (this._itens = t.map((e,
|
|
505
|
+
t.length > 0 && (this._itens = t.map((e, a) => {
|
|
222
506
|
var n;
|
|
223
|
-
const r = e.getAttribute("value") || e.getAttribute("data-value") || String(
|
|
507
|
+
const r = e.getAttribute("value") || e.getAttribute("data-value") || String(a + 1);
|
|
224
508
|
return {
|
|
225
509
|
id: r,
|
|
226
|
-
label: ((n = e.textContent) == null ? void 0 : n.trim()) || r || `Opção ${
|
|
510
|
+
label: ((n = e.textContent) == null ? void 0 : n.trim()) || r || `Opção ${a + 1}`
|
|
227
511
|
};
|
|
228
|
-
}),
|
|
512
|
+
}), _(this.listElement, this._itens, this._value), this.syncLabel());
|
|
229
513
|
}
|
|
230
514
|
disconnectedCallback() {
|
|
231
515
|
this.listeners.cleanup(), this.observer && this.observer.disconnect(), this.fechar();
|
|
232
516
|
}
|
|
233
|
-
attributeChangedCallback(t, e,
|
|
234
|
-
t === "aberta" && this.button.setAttribute("aria-expanded", String(
|
|
517
|
+
attributeChangedCallback(t, e, a) {
|
|
518
|
+
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") && g(this);
|
|
235
519
|
}
|
|
236
520
|
get value() {
|
|
237
521
|
return this._value;
|
|
238
522
|
}
|
|
239
523
|
set value(t) {
|
|
240
|
-
this._value = t, this.setAttribute("value", t), this.internals.setFormValue(t), this.syncLabel(),
|
|
524
|
+
this._value = t, this.setAttribute("value", t), this.internals.setFormValue(t), this.syncLabel(), J(this.listElement, this._value), this.atualizarValidade();
|
|
241
525
|
}
|
|
242
526
|
get label() {
|
|
243
527
|
return this.getAttribute("label") || this.getAttribute("rotulo") || "";
|
|
@@ -291,7 +575,7 @@ class v extends d {
|
|
|
291
575
|
return this._itens;
|
|
292
576
|
}
|
|
293
577
|
set itens(t) {
|
|
294
|
-
this._itens = t || [],
|
|
578
|
+
this._itens = t || [], _(this.listElement, this._itens, this._value), this.syncLabel();
|
|
295
579
|
}
|
|
296
580
|
abrir() {
|
|
297
581
|
this.disabled || this.hasAttribute("aberta") || (this.setAttribute("aberta", ""), this.posicionamento.posicionar(), this.posicionamento.ativarAcompanhamento(this.fechar));
|
|
@@ -299,33 +583,33 @@ class v extends d {
|
|
|
299
583
|
syncLabel() {
|
|
300
584
|
const t = this.getAttribute("label") || this.getAttribute("rotulo");
|
|
301
585
|
if (t)
|
|
302
|
-
|
|
586
|
+
y(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");
|
|
303
587
|
else {
|
|
304
588
|
this.labelElement.style.display = "none", this.sincronizarRotuloExterno();
|
|
305
|
-
const
|
|
306
|
-
this.sheetTituloElement.textContent =
|
|
589
|
+
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
590
|
+
this.sheetTituloElement.textContent = a;
|
|
307
591
|
}
|
|
308
|
-
const e = this._itens.find((
|
|
592
|
+
const e = this._itens.find((a) => String(a.id) === String(this._value));
|
|
309
593
|
if (e)
|
|
310
594
|
this.textoElement.textContent = e.label;
|
|
311
595
|
else {
|
|
312
|
-
const
|
|
313
|
-
this.textoElement.textContent =
|
|
596
|
+
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
597
|
+
this.textoElement.textContent = a;
|
|
314
598
|
}
|
|
315
599
|
}
|
|
316
600
|
/** Sem o atributo `label`, usa o rótulo de fora do Shadow DOM (aria-label, <label for>, <label> envolvente). */
|
|
317
601
|
sincronizarRotuloExterno() {
|
|
318
602
|
this.button.removeAttribute("aria-labelledby"), this.content.removeAttribute("aria-labelledby");
|
|
319
|
-
const t =
|
|
603
|
+
const t = f(this, this.internals);
|
|
320
604
|
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"));
|
|
321
605
|
}
|
|
322
606
|
syncState() {
|
|
323
|
-
|
|
607
|
+
g(this), this.hasAttribute("value") && (this._value = this.getAttribute("value") || "", this.internals.setFormValue(this._value)), this.syncLabel(), this.atualizarValidade();
|
|
324
608
|
}
|
|
325
609
|
selecionarItem(t) {
|
|
326
610
|
var r;
|
|
327
|
-
const e = (r = this.shadowRoot) == null ? void 0 : r.activeElement,
|
|
328
|
-
this.value = t.id, this.fechar(),
|
|
611
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.activeElement, a = !!e && this.content.contains(e);
|
|
612
|
+
this.value = t.id, this.fechar(), a && this.button.focus(), this.dispatchEvent(
|
|
329
613
|
new CustomEvent("ui-selecionar", {
|
|
330
614
|
detail: t,
|
|
331
615
|
bubbles: !0,
|
|
@@ -344,54 +628,54 @@ class v extends d {
|
|
|
344
628
|
);
|
|
345
629
|
}
|
|
346
630
|
}
|
|
347
|
-
class
|
|
631
|
+
class Q extends E {
|
|
348
632
|
}
|
|
349
|
-
h("ui-lista-flutuante",
|
|
350
|
-
h("ui-select",
|
|
351
|
-
const
|
|
352
|
-
function
|
|
353
|
-
if (
|
|
354
|
-
e.textContent =
|
|
633
|
+
h("ui-lista-flutuante", E);
|
|
634
|
+
h("ui-select", Q);
|
|
635
|
+
const tt = ':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-color: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-color: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}}';
|
|
636
|
+
function x({ host: o, internals: i, controle: t, rotulo: e, texto: a }) {
|
|
637
|
+
if (a) {
|
|
638
|
+
e.textContent = a, e.style.display = "inline", t.setAttribute("aria-labelledby", e.id), t.removeAttribute("aria-label");
|
|
355
639
|
return;
|
|
356
640
|
}
|
|
357
641
|
e.style.display = "none", t.removeAttribute("aria-labelledby");
|
|
358
|
-
const r =
|
|
642
|
+
const r = f(o, i);
|
|
359
643
|
r ? t.setAttribute("aria-label", r) : t.removeAttribute("aria-label");
|
|
360
644
|
}
|
|
361
|
-
class
|
|
645
|
+
class et extends d {
|
|
362
646
|
constructor() {
|
|
363
647
|
super();
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
648
|
+
s(this, "containerElement");
|
|
649
|
+
s(this, "markElement");
|
|
650
|
+
s(this, "labelElement");
|
|
651
|
+
s(this, "listeners", new b());
|
|
652
|
+
s(this, "_defaultChecked", !1);
|
|
653
|
+
s(this, "_defaultIndeterminate", !1);
|
|
654
|
+
s(this, "handleClick", (t) => {
|
|
371
655
|
t.preventDefault(), this.alternar();
|
|
372
656
|
});
|
|
373
|
-
|
|
374
|
-
|
|
657
|
+
s(this, "handleHostClick", (t) => {
|
|
658
|
+
p(this, t) && (this.alternar(), this.containerElement.focus());
|
|
375
659
|
});
|
|
376
|
-
|
|
660
|
+
s(this, "handleKeyDown", (t) => {
|
|
377
661
|
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
378
662
|
});
|
|
379
|
-
|
|
663
|
+
s(this, "handleFocus", () => {
|
|
380
664
|
this.containerElement.classList.add("ui-checkbox--foco");
|
|
381
665
|
});
|
|
382
|
-
|
|
666
|
+
s(this, "handleBlur", () => {
|
|
383
667
|
this.containerElement.classList.remove("ui-checkbox--foco");
|
|
384
668
|
});
|
|
385
669
|
const t = this.attachShadow({ mode: "open" });
|
|
386
670
|
t.innerHTML = `
|
|
387
|
-
<style>${
|
|
671
|
+
<style>${tt}</style>
|
|
388
672
|
<div class="ui-checkbox" part="base" tabindex="0" role="checkbox" aria-checked="false">
|
|
389
673
|
<span class="ui-checkbox__box" part="controle">
|
|
390
674
|
<span class="ui-checkbox__mark" part="indicador"></span>
|
|
391
675
|
</span>
|
|
392
676
|
<span class="ui-checkbox__label" part="rotulo" style="display: none;"></span>
|
|
393
677
|
</div>
|
|
394
|
-
`, this.containerElement = t.querySelector(".ui-checkbox"), this.markElement = t.querySelector(".ui-checkbox__mark"), this.labelElement = t.querySelector(".ui-checkbox__label"), this.labelElement.id =
|
|
678
|
+
`, this.containerElement = t.querySelector(".ui-checkbox"), this.markElement = t.querySelector(".ui-checkbox__mark"), this.labelElement = t.querySelector(".ui-checkbox__label"), this.labelElement.id = m("ui-checkbox-label");
|
|
395
679
|
}
|
|
396
680
|
static get observedAttributes() {
|
|
397
681
|
return [
|
|
@@ -415,7 +699,7 @@ class V extends d {
|
|
|
415
699
|
disconnectedCallback() {
|
|
416
700
|
this.listeners.cleanup();
|
|
417
701
|
}
|
|
418
|
-
attributeChangedCallback(t, e,
|
|
702
|
+
attributeChangedCallback(t, e, a) {
|
|
419
703
|
this.syncState();
|
|
420
704
|
}
|
|
421
705
|
get marcado() {
|
|
@@ -497,11 +781,11 @@ class V extends d {
|
|
|
497
781
|
));
|
|
498
782
|
}
|
|
499
783
|
syncState() {
|
|
500
|
-
const t = this.marcado, e = this.indeterminado,
|
|
784
|
+
const t = this.marcado, e = this.indeterminado, a = this.disabled, r = this.getAttribute("label"), n = this.getAttribute("posicao-label") || "direita";
|
|
501
785
|
this.containerElement.setAttribute(
|
|
502
786
|
"aria-checked",
|
|
503
787
|
e ? "mixed" : String(t)
|
|
504
|
-
),
|
|
788
|
+
), 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 = `
|
|
505
789
|
<svg viewBox="0 0 24 24">
|
|
506
790
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
507
791
|
</svg>
|
|
@@ -509,7 +793,7 @@ class V extends d {
|
|
|
509
793
|
<svg viewBox="0 0 24 24">
|
|
510
794
|
<polyline points="20 6 9 17 4 12"></polyline>
|
|
511
795
|
</svg>
|
|
512
|
-
` : this.markElement.innerHTML = "",
|
|
796
|
+
` : this.markElement.innerHTML = "", x({
|
|
513
797
|
host: this,
|
|
514
798
|
internals: this.internals,
|
|
515
799
|
controle: this.containerElement,
|
|
@@ -525,8 +809,8 @@ class V extends d {
|
|
|
525
809
|
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
526
810
|
}
|
|
527
811
|
}
|
|
528
|
-
h("ui-checkbox",
|
|
529
|
-
const
|
|
812
|
+
h("ui-checkbox", et);
|
|
813
|
+
const it = ':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-color: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-color: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}';
|
|
530
814
|
class l {
|
|
531
815
|
static getScopeNode(i) {
|
|
532
816
|
return i.closest("form") || i.getRootNode() || document;
|
|
@@ -537,24 +821,24 @@ class l {
|
|
|
537
821
|
const t = i.name;
|
|
538
822
|
if (!t) return;
|
|
539
823
|
const e = this.getScopeNode(i);
|
|
540
|
-
let
|
|
541
|
-
|
|
542
|
-
let r =
|
|
543
|
-
r || (r = /* @__PURE__ */ new Set(),
|
|
824
|
+
let a = this.registry.get(e);
|
|
825
|
+
a || (a = /* @__PURE__ */ new Map(), this.registry.set(e, a));
|
|
826
|
+
let r = a.get(t);
|
|
827
|
+
r || (r = /* @__PURE__ */ new Set(), a.set(t, r)), r.add(i), this.registros.set(i, { scope: e, nome: t });
|
|
544
828
|
}
|
|
545
829
|
static desregistrar(i) {
|
|
546
830
|
const t = this.registros.get(i);
|
|
547
831
|
if (!t) return;
|
|
548
832
|
this.registros.delete(i);
|
|
549
|
-
const e = this.registry.get(t.scope),
|
|
550
|
-
!e || !
|
|
833
|
+
const e = this.registry.get(t.scope), a = e == null ? void 0 : e.get(t.nome);
|
|
834
|
+
!e || !a || (a.delete(i), a.size === 0 && e.delete(t.nome), e.size === 0 && this.registry.delete(t.scope));
|
|
551
835
|
}
|
|
552
836
|
/** Radios do mesmo grupo que `radio`, usando o registro (não o nome atual, que pode ainda não ter sido registrado). */
|
|
553
837
|
static obterRadiosDoGrupo(i) {
|
|
554
|
-
var
|
|
838
|
+
var a;
|
|
555
839
|
const t = this.registros.get(i);
|
|
556
840
|
if (!t) return [];
|
|
557
|
-
const e = (
|
|
841
|
+
const e = (a = this.registry.get(t.scope)) == null ? void 0 : a.get(t.nome);
|
|
558
842
|
return e ? Array.from(e) : [];
|
|
559
843
|
}
|
|
560
844
|
static desmarcarOutros(i) {
|
|
@@ -569,48 +853,48 @@ class l {
|
|
|
569
853
|
static tratarNavegacaoTeclado(i, t) {
|
|
570
854
|
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(i.key)) return;
|
|
571
855
|
i.preventDefault();
|
|
572
|
-
const e = this.obterRadiosDoGrupo(t).filter((
|
|
856
|
+
const e = this.obterRadiosDoGrupo(t).filter((u) => !u.disabled && u.isConnected);
|
|
573
857
|
if (e.length <= 1) return;
|
|
574
|
-
const
|
|
575
|
-
if (n !==
|
|
576
|
-
const
|
|
577
|
-
|
|
858
|
+
const a = e.indexOf(t), r = i.key === "ArrowDown" || i.key === "ArrowRight", n = (a + (r ? 1 : -1) + e.length) % e.length;
|
|
859
|
+
if (n !== a) {
|
|
860
|
+
const u = e[n];
|
|
861
|
+
u.selecionar(), u.focus();
|
|
578
862
|
}
|
|
579
863
|
}
|
|
580
864
|
}
|
|
581
|
-
|
|
582
|
-
class
|
|
865
|
+
s(l, "registry", /* @__PURE__ */ new WeakMap()), s(l, "registros", /* @__PURE__ */ new WeakMap());
|
|
866
|
+
class at extends d {
|
|
583
867
|
constructor() {
|
|
584
868
|
super();
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
869
|
+
s(this, "containerElement");
|
|
870
|
+
s(this, "labelElement");
|
|
871
|
+
s(this, "listeners", new b());
|
|
872
|
+
s(this, "_defaultChecked", !1);
|
|
873
|
+
s(this, "handleClick", (t) => {
|
|
590
874
|
t.preventDefault(), this.selecionar(), this.containerElement.focus();
|
|
591
875
|
});
|
|
592
|
-
|
|
593
|
-
|
|
876
|
+
s(this, "handleHostClick", (t) => {
|
|
877
|
+
p(this, t) && (this.selecionar(), this.containerElement.focus());
|
|
594
878
|
});
|
|
595
|
-
|
|
879
|
+
s(this, "handleKeyDown", (t) => {
|
|
596
880
|
t.key === " " || t.key === "Enter" ? (t.preventDefault(), this.selecionar()) : l.tratarNavegacaoTeclado(t, this);
|
|
597
881
|
});
|
|
598
|
-
|
|
882
|
+
s(this, "handleFocus", () => {
|
|
599
883
|
this.containerElement.classList.add("ui-radio--foco");
|
|
600
884
|
});
|
|
601
|
-
|
|
885
|
+
s(this, "handleBlur", () => {
|
|
602
886
|
this.containerElement.classList.remove("ui-radio--foco");
|
|
603
887
|
});
|
|
604
888
|
const t = this.attachShadow({ mode: "open" });
|
|
605
889
|
t.innerHTML = `
|
|
606
|
-
<style>${
|
|
890
|
+
<style>${it}</style>
|
|
607
891
|
<div class="ui-radio" part="base" tabindex="0" role="radio" aria-checked="false">
|
|
608
892
|
<span class="ui-radio__circle" part="controle">
|
|
609
893
|
<span class="ui-radio__dot" part="indicador"></span>
|
|
610
894
|
</span>
|
|
611
895
|
<span class="ui-radio__label" part="rotulo" style="display: none;"></span>
|
|
612
896
|
</div>
|
|
613
|
-
`, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label"), this.labelElement.id =
|
|
897
|
+
`, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label"), this.labelElement.id = m("ui-radio-label");
|
|
614
898
|
}
|
|
615
899
|
static get observedAttributes() {
|
|
616
900
|
return [
|
|
@@ -635,7 +919,7 @@ class M extends d {
|
|
|
635
919
|
const t = l.obterRadiosDoGrupo(this).filter((e) => e !== this && e.isConnected);
|
|
636
920
|
l.desregistrar(this), l.atualizarGrupo(t);
|
|
637
921
|
}
|
|
638
|
-
attributeChangedCallback(t, e,
|
|
922
|
+
attributeChangedCallback(t, e, a) {
|
|
639
923
|
if ((t === "name" || t === "nome") && this.isConnected) {
|
|
640
924
|
const r = l.obterRadiosDoGrupo(this).filter((n) => n !== this);
|
|
641
925
|
l.registrar(this), this.syncState(), l.atualizarGrupo([...r, ...l.obterRadiosDoGrupo(this).filter((n) => n !== this)]);
|
|
@@ -675,7 +959,7 @@ class M extends d {
|
|
|
675
959
|
return;
|
|
676
960
|
}
|
|
677
961
|
const t = l.obterRadiosDoGrupo(this);
|
|
678
|
-
if ((this.required || t.length > 0 && t.some((
|
|
962
|
+
if ((this.required || t.length > 0 && t.some((a) => a.required)) && !(this.marcado || t.length > 0 && t.some((r) => r.marcado))) {
|
|
679
963
|
const r = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
680
964
|
this.internals.setValidity({ valueMissing: !0 }, r, this.containerElement);
|
|
681
965
|
return;
|
|
@@ -720,18 +1004,18 @@ class M extends d {
|
|
|
720
1004
|
if (t.some((e) => e.marcado))
|
|
721
1005
|
this.containerElement.setAttribute("tabindex", this.marcado ? "0" : "-1");
|
|
722
1006
|
else {
|
|
723
|
-
const e = t.find((
|
|
1007
|
+
const e = t.find((a) => !a.disabled);
|
|
724
1008
|
this.containerElement.setAttribute("tabindex", e === this ? "0" : "-1");
|
|
725
1009
|
}
|
|
726
1010
|
}
|
|
727
1011
|
syncState() {
|
|
728
|
-
const t = this.marcado, e = this.disabled,
|
|
729
|
-
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"),
|
|
1012
|
+
const t = this.marcado, e = this.disabled, a = this.getAttribute("label"), r = this.getAttribute("posicao-label") || "direita";
|
|
1013
|
+
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"), x({
|
|
730
1014
|
host: this,
|
|
731
1015
|
internals: this.internals,
|
|
732
1016
|
controle: this.containerElement,
|
|
733
1017
|
rotulo: this.labelElement,
|
|
734
|
-
texto:
|
|
1018
|
+
texto: a
|
|
735
1019
|
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
736
1020
|
}
|
|
737
1021
|
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
@@ -742,41 +1026,41 @@ class M extends d {
|
|
|
742
1026
|
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
743
1027
|
}
|
|
744
1028
|
}
|
|
745
|
-
h("ui-radio",
|
|
746
|
-
const
|
|
747
|
-
class
|
|
1029
|
+
h("ui-radio", at);
|
|
1030
|
+
const st = ':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-color: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-color:var(--ui-cor-primaria, #00E08A);border-color:var(--ui-cor-primaria, #00E08A)}.ui-switch__thumb{display:block;width:16px;height:16px;background-color:#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-color: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}}';
|
|
1031
|
+
class k extends d {
|
|
748
1032
|
constructor() {
|
|
749
1033
|
super();
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1034
|
+
s(this, "containerElement");
|
|
1035
|
+
s(this, "labelElement");
|
|
1036
|
+
s(this, "labelId");
|
|
1037
|
+
s(this, "listeners", new b());
|
|
1038
|
+
s(this, "_defaultChecked", !1);
|
|
1039
|
+
s(this, "handleClick", (t) => {
|
|
756
1040
|
t.preventDefault(), this.alternar();
|
|
757
1041
|
});
|
|
758
|
-
|
|
759
|
-
|
|
1042
|
+
s(this, "handleHostClick", (t) => {
|
|
1043
|
+
p(this, t) && (this.alternar(), this.containerElement.focus());
|
|
760
1044
|
});
|
|
761
|
-
|
|
1045
|
+
s(this, "handleKeyDown", (t) => {
|
|
762
1046
|
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
763
1047
|
});
|
|
764
|
-
|
|
1048
|
+
s(this, "handleFocus", () => {
|
|
765
1049
|
this.containerElement.classList.add("ui-switch--foco");
|
|
766
1050
|
});
|
|
767
|
-
|
|
1051
|
+
s(this, "handleBlur", () => {
|
|
768
1052
|
this.containerElement.classList.remove("ui-switch--foco");
|
|
769
1053
|
});
|
|
770
1054
|
const t = this.attachShadow({ mode: "open" });
|
|
771
1055
|
t.innerHTML = `
|
|
772
|
-
<style>${
|
|
1056
|
+
<style>${st}</style>
|
|
773
1057
|
<div class="ui-switch" part="base" tabindex="0" role="switch" aria-checked="false">
|
|
774
1058
|
<span class="ui-switch__track" part="controle">
|
|
775
1059
|
<span class="ui-switch__thumb" part="indicador"></span>
|
|
776
1060
|
</span>
|
|
777
1061
|
<span class="ui-switch__label" part="rotulo" style="display: none;"></span>
|
|
778
1062
|
</div>
|
|
779
|
-
`, this.containerElement = t.querySelector(".ui-switch"), this.labelElement = t.querySelector(".ui-switch__label"), this.labelId =
|
|
1063
|
+
`, this.containerElement = t.querySelector(".ui-switch"), this.labelElement = t.querySelector(".ui-switch__label"), this.labelId = m("ui-switch-label"), this.labelElement.id = this.labelId;
|
|
780
1064
|
}
|
|
781
1065
|
static get observedAttributes() {
|
|
782
1066
|
return [
|
|
@@ -802,7 +1086,7 @@ class _ extends d {
|
|
|
802
1086
|
disconnectedCallback() {
|
|
803
1087
|
this.listeners.cleanup();
|
|
804
1088
|
}
|
|
805
|
-
attributeChangedCallback(t, e,
|
|
1089
|
+
attributeChangedCallback(t, e, a) {
|
|
806
1090
|
this.syncState();
|
|
807
1091
|
}
|
|
808
1092
|
get ativo() {
|
|
@@ -877,8 +1161,8 @@ class _ extends d {
|
|
|
877
1161
|
));
|
|
878
1162
|
}
|
|
879
1163
|
syncState() {
|
|
880
|
-
const t = this.ativo, e = this.disabled,
|
|
881
|
-
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(
|
|
1164
|
+
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";
|
|
1165
|
+
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"), x({
|
|
882
1166
|
host: this,
|
|
883
1167
|
internals: this.internals,
|
|
884
1168
|
controle: this.containerElement,
|
|
@@ -894,22 +1178,25 @@ class _ extends d {
|
|
|
894
1178
|
typeof t == "string" ? this.ativo = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.ativo = t), this.syncState();
|
|
895
1179
|
}
|
|
896
1180
|
}
|
|
897
|
-
class
|
|
1181
|
+
class rt extends k {
|
|
898
1182
|
}
|
|
899
|
-
h("ui-switch",
|
|
900
|
-
h("ui-toggle",
|
|
1183
|
+
h("ui-switch", k);
|
|
1184
|
+
h("ui-toggle", rt);
|
|
901
1185
|
export {
|
|
902
|
-
|
|
903
|
-
|
|
1186
|
+
Y as A,
|
|
1187
|
+
G as L,
|
|
904
1188
|
l as R,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1189
|
+
A as U,
|
|
1190
|
+
W as a,
|
|
1191
|
+
et as b,
|
|
1192
|
+
E as c,
|
|
1193
|
+
at as d,
|
|
1194
|
+
Q as e,
|
|
1195
|
+
k as f,
|
|
1196
|
+
j as g,
|
|
1197
|
+
rt as h,
|
|
1198
|
+
J as i,
|
|
1199
|
+
H as j,
|
|
1200
|
+
Z as k,
|
|
1201
|
+
_ as r
|
|
915
1202
|
};
|