@thibezer/ui-components-kit 2.17.1 → 2.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/camadas.cjs +51 -52
- package/dist/camadas.js +136 -135
- package/dist/custom-elements.json +4090 -4090
- package/package.json +1 -1
- package/dist/form-validacao-BIOXxt-1.js +0 -140
- package/dist/form-validacao-ytRYSF3E.cjs +0 -1
- package/dist/gerencigeo-canvas/layer_defaults.d.ts +0 -3
- package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +0 -6
- package/dist/gerencigeo-canvas/layer_state_ops.d.ts +0 -6
- package/dist/leaflet-DcO7uRC-.cjs +0 -1
- package/dist/leaflet-PPDKB6Dd.js +0 -69
- package/dist/motor-BCWqlv3e.cjs +0 -1
- package/dist/motor-CXjQjVba.js +0 -1386
- package/dist/svg-seguro-BsbNQqpd.js +0 -50
- package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
- package/dist/ui-badge-1UU8vT-b.js +0 -198
- package/dist/ui-badge-B5J_c5P5.js +0 -197
- package/dist/ui-badge-BxT-sDmV.cjs +0 -28
- package/dist/ui-badge-C0eKBI8E.js +0 -183
- package/dist/ui-badge-CKKKPdt8.cjs +0 -28
- package/dist/ui-badge-DC4y6Dik.cjs +0 -28
- package/dist/ui-botao-BOOnP8ds.cjs +0 -12
- package/dist/ui-botao-D24oXySA.cjs +0 -12
- package/dist/ui-botao-DfqSivHl.js +0 -165
- package/dist/ui-botao-Dsj08jjw.js +0 -165
- package/dist/ui-botao-OGJV6Vfk.js +0 -165
- package/dist/ui-botao-bU_bf6SU.js +0 -166
- package/dist/ui-botao-psS1juof.cjs +0 -12
- package/dist/ui-botao-xTbH5mpH.cjs +0 -12
- package/dist/ui-campo-texto-19tIrmBK.js +0 -377
- package/dist/ui-campo-texto-CH8mzX61.cjs +0 -16
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
- package/dist/ui-campo-texto-DVU_sWV1.cjs +0 -16
- package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
- package/dist/ui-campo-texto-W5M0gNE4.js +0 -377
- package/dist/ui-card-0wu4rjEX.cjs +0 -20
- package/dist/ui-card-B86lJXTP.cjs +0 -20
- package/dist/ui-card-BYyYxxY1.cjs +0 -20
- package/dist/ui-card-C_o5_0cB.js +0 -111
- package/dist/ui-card-CojoGXaT.js +0 -144
- package/dist/ui-card-DRtpOo3l.js +0 -143
- package/dist/ui-controle-cores-B4R6ct4I.js +0 -291
- package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
- package/dist/ui-controle-cores-Bq_XUrIQ.cjs +0 -32
- package/dist/ui-controle-cores-BtA6yzu3.js +0 -291
- package/dist/ui-controle-cores-C8um-If9.cjs +0 -32
- package/dist/ui-controle-cores-CHMKGemo.cjs +0 -141
- package/dist/ui-controle-cores-C_cVXxCn.js +0 -291
- package/dist/ui-controle-cores-CuDFS8Y8.cjs +0 -32
- package/dist/ui-controle-cores-Dog7ERYv.js +0 -697
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
- package/dist/ui-linha-BxhEBn27.js +0 -749
- package/dist/ui-linha-C306zxWG.cjs +0 -19
- package/dist/ui-linha-C_azWkcG.js +0 -517
- package/dist/ui-linha-CcalUBDw.cjs +0 -38
- package/dist/ui-linha-DAz6DBcl.cjs +0 -38
- package/dist/ui-linha-DkxwMhD-.js +0 -749
- package/dist/ui-modal-4nU-tXjO.cjs +0 -18
- package/dist/ui-modal-BkYvNP0G.js +0 -214
- package/dist/ui-modal-BwB9fksp.js +0 -214
- package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
- package/dist/ui-modal-CvGFGh1h.cjs +0 -18
- package/dist/ui-modal-DBOtSTbR.js +0 -238
- package/dist/ui-paleta-ferramentas-BXXrI1Y7.js +0 -1233
- package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
- package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
- package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
- package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
- package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
- package/dist/ui-paleta-ferramentas-DbwdWVtT.js +0 -1173
- package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
- package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
- package/dist/ui-segmented-DyF5YLsV.js +0 -418
- package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
- package/dist/ui-segmented-wUraId2e.js +0 -412
- package/dist/ui-seletor-cor-C4U2eqxY.cjs +0 -82
- package/dist/ui-seletor-cor-D2_C6Aor.js +0 -391
- package/dist/ui-seletor-cor-DPKqf5wb.cjs +0 -82
- package/dist/ui-seletor-cor-FYtRccnK.js +0 -396
- package/dist/ui-skeleton-B2Rgrv8o.js +0 -648
- package/dist/ui-skeleton-DEHwpDqa.js +0 -648
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-DiOxTBZK.cjs +0 -52
- package/dist/ui-skeleton-SPYqku8P.cjs +0 -52
- package/dist/ui-skeleton-W9uwIceA.js +0 -585
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-skeleton-sIphhOSx.cjs +0 -52
- package/dist/ui-switch-BL-x_-SM.js +0 -1202
- package/dist/ui-switch-BcOqOkiV.js +0 -856
- package/dist/ui-switch-C0i_3QXu.cjs +0 -66
- package/dist/ui-switch-D7iPKDj-.cjs +0 -53
- package/dist/ui-switch-DAIgOhqr.cjs +0 -66
- package/dist/ui-switch-_F8yubdX.js +0 -1203
- package/dist/ui-tabela-propriedades-2bq2nX-b.js +0 -3202
- package/dist/ui-tabela-propriedades-8IAYmk3P.cjs +0 -142
- package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +0 -141
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
- package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
- package/dist/ui-tabela-propriedades-BoYXzP5Z.js +0 -3191
- package/dist/ui-tabela-propriedades-BokvDD3b.js +0 -2648
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
- package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +0 -141
- package/dist/ui-tabela-propriedades-C5YYnod1.js +0 -3053
- package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +0 -142
- package/dist/ui-tabela-propriedades-CyPyKXtB.js +0 -3013
- package/dist/ui-tabela-propriedades-DWOKznMN.cjs +0 -142
- package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
- package/dist/ui-tabela-propriedades-DqvPilK_.cjs +0 -142
- package/dist/ui-tabela-propriedades-DuaC4sFX.js +0 -2767
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
|
@@ -1,1202 +0,0 @@
|
|
|
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
|
-
import { d as h } from "./ssr-safe-5cWfJP-s.js";
|
|
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 {
|
|
295
|
-
constructor(i, t, e) {
|
|
296
|
-
s(this, "scrollHandler");
|
|
297
|
-
s(this, "resizeHandler");
|
|
298
|
-
s(this, "posicionar", () => {
|
|
299
|
-
if (this.isMobileOrBottomSheet()) {
|
|
300
|
-
this.content.style.top = "", this.content.style.left = "", this.content.style.minWidth = "";
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
const i = this.button.getBoundingClientRect();
|
|
304
|
-
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);
|
|
305
|
-
});
|
|
306
|
-
this.host = i, this.button = t, this.content = e;
|
|
307
|
-
}
|
|
308
|
-
isMobileOrBottomSheet() {
|
|
309
|
-
return typeof window > "u" ? !1 : window.innerWidth <= 640 || this.host.hasAttribute("bottom-sheet") || this.host.hasAttribute("modo-mobile");
|
|
310
|
-
}
|
|
311
|
-
/** Com a lista já visível (medida real): abre para cima se faltar espaço embaixo e não deixa sair pela lateral. */
|
|
312
|
-
ajustarAoViewport(i) {
|
|
313
|
-
const t = this.content.offsetHeight, e = this.content.offsetWidth;
|
|
314
|
-
if (t <= 0 || typeof window > "u") return;
|
|
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`);
|
|
317
|
-
}
|
|
318
|
-
ativarAcompanhamento(i) {
|
|
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")
|
|
320
|
-
try {
|
|
321
|
-
this.content.showPopover();
|
|
322
|
-
} catch {
|
|
323
|
-
}
|
|
324
|
-
this.posicionar();
|
|
325
|
-
}
|
|
326
|
-
desativarAcompanhamento() {
|
|
327
|
-
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")
|
|
328
|
-
try {
|
|
329
|
-
this.content.hidePopover();
|
|
330
|
-
} catch {
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
class W {
|
|
335
|
-
constructor(i) {
|
|
336
|
-
s(this, "focusedIndex", -1);
|
|
337
|
-
this.listElement = i;
|
|
338
|
-
}
|
|
339
|
-
focarPrimeiroItem() {
|
|
340
|
-
const i = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
341
|
-
if (i.length > 0) {
|
|
342
|
-
const t = i.findIndex((e) => e.classList.contains("ui-lista-flutuante__item--selecionado"));
|
|
343
|
-
this.focusedIndex = Math.max(0, t), i[this.focusedIndex].focus();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
resetarFoco() {
|
|
347
|
-
this.focusedIndex = -1;
|
|
348
|
-
}
|
|
349
|
-
moverFoco(i) {
|
|
350
|
-
const t = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
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());
|
|
352
|
-
}
|
|
353
|
-
tratarKeydownLista(i, t, e, a, r) {
|
|
354
|
-
if (i.key === "ArrowDown")
|
|
355
|
-
i.preventDefault(), this.moverFoco(1);
|
|
356
|
-
else if (i.key === "ArrowUp")
|
|
357
|
-
i.preventDefault(), this.moverFoco(-1);
|
|
358
|
-
else if (i.key === "Home" || i.key === "End") {
|
|
359
|
-
i.preventDefault();
|
|
360
|
-
const n = i.key === "End";
|
|
361
|
-
this.focusedIndex = n ? -1 : 0, n ? this.moverFoco(-1) : this.moverFoco(0);
|
|
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());
|
|
363
|
-
}
|
|
364
|
-
}
|
|
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 = [
|
|
366
|
-
"aberta",
|
|
367
|
-
"texto-padrao",
|
|
368
|
-
"value",
|
|
369
|
-
"disabled",
|
|
370
|
-
"bottom-sheet",
|
|
371
|
-
"modo-mobile",
|
|
372
|
-
"label",
|
|
373
|
-
"rotulo",
|
|
374
|
-
"placeholder",
|
|
375
|
-
"tamanho",
|
|
376
|
-
"size",
|
|
377
|
-
"altura",
|
|
378
|
-
"height",
|
|
379
|
-
"densidade",
|
|
380
|
-
"name",
|
|
381
|
-
"obrigatorio",
|
|
382
|
-
"required",
|
|
383
|
-
"mensagem-validacao",
|
|
384
|
-
"aria-label"
|
|
385
|
-
];
|
|
386
|
-
function Z() {
|
|
387
|
-
return `
|
|
388
|
-
<style>${X}</style>
|
|
389
|
-
<div class="ui-lista-flutuante__container">
|
|
390
|
-
<label class="ui-lista-flutuante__label" part="rotulo" style="display: none;"></label>
|
|
391
|
-
<div class="ui-lista-flutuante__backdrop"></div>
|
|
392
|
-
<button class="ui-lista-flutuante__gatilho" part="campo" aria-haspopup="listbox" aria-expanded="false" type="button">
|
|
393
|
-
<span class="ui-lista-flutuante__texto" part="valor"></span>
|
|
394
|
-
<span class="ui-lista-flutuante__seta" part="seta">▼</span>
|
|
395
|
-
</button>
|
|
396
|
-
<div class="ui-lista-flutuante__conteudo" part="lista" role="listbox" popover="manual">
|
|
397
|
-
<div class="ui-lista-flutuante__sheet-header">
|
|
398
|
-
<div class="ui-lista-flutuante__handle"></div>
|
|
399
|
-
<div class="ui-lista-flutuante__sheet-title-bar">
|
|
400
|
-
<span class="ui-lista-flutuante__sheet-titulo">Selecione uma opção</span>
|
|
401
|
-
<button class="ui-lista-flutuante__sheet-close" type="button" aria-label="Fechar">✕</button>
|
|
402
|
-
</div>
|
|
403
|
-
</div>
|
|
404
|
-
<ul class="ui-lista-flutuante__lista" style="margin: 0; padding: 0; list-style: none;"></ul>
|
|
405
|
-
</div>
|
|
406
|
-
</div>
|
|
407
|
-
`;
|
|
408
|
-
}
|
|
409
|
-
function _(o, i, t) {
|
|
410
|
-
o.innerHTML = "", i.forEach((e) => {
|
|
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);
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
function J(o, i) {
|
|
416
|
-
o.querySelectorAll(".ui-lista-flutuante__item").forEach((e) => {
|
|
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"));
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
class E extends d {
|
|
422
|
-
constructor() {
|
|
423
|
-
super();
|
|
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) => {
|
|
442
|
-
t.stopPropagation(), !this.disabled && (this.hasAttribute("aberta") ? this.fechar() : this.abrir());
|
|
443
|
-
});
|
|
444
|
-
s(this, "handleKeyDown", (t) => {
|
|
445
|
-
if (!this.disabled) {
|
|
446
|
-
if (t.key === "Escape" && this.hasAttribute("aberta")) {
|
|
447
|
-
t.preventDefault(), this.fechar();
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
(t.key === "Enter" || t.key === " " || t.key === "ArrowDown" || t.key === "ArrowUp") && (t.preventDefault(), this.hasAttribute("aberta") ? this.teclado.focarPrimeiroItem() : this.abrir());
|
|
451
|
-
}
|
|
452
|
-
});
|
|
453
|
-
s(this, "handleListKeyDown", (t) => {
|
|
454
|
-
this.hasAttribute("aberta") && this.teclado.tratarKeydownLista(
|
|
455
|
-
t,
|
|
456
|
-
this._itens,
|
|
457
|
-
(e) => this.selecionarItem(e),
|
|
458
|
-
this.fechar,
|
|
459
|
-
this.button
|
|
460
|
-
);
|
|
461
|
-
});
|
|
462
|
-
s(this, "fechar", () => {
|
|
463
|
-
this.hasAttribute("aberta") && (this.removeAttribute("aberta"), this.posicionamento.desativarAcompanhamento(), this.teclado.resetarFoco());
|
|
464
|
-
});
|
|
465
|
-
s(this, "handleClickFora", (t) => {
|
|
466
|
-
if (!this.hasAttribute("aberta")) return;
|
|
467
|
-
const e = t.composedPath();
|
|
468
|
-
!e.includes(this) && !e.includes(this.content) && this.fechar();
|
|
469
|
-
});
|
|
470
|
-
/** Clicar no rótulo foca o controle (comportamento do <select> nativo), sem abrir a lista. */
|
|
471
|
-
s(this, "focarGatilho", () => {
|
|
472
|
-
this.disabled || this.button.focus();
|
|
473
|
-
});
|
|
474
|
-
s(this, "handleHostClick", (t) => {
|
|
475
|
-
p(this, t) && this.focarGatilho();
|
|
476
|
-
});
|
|
477
|
-
s(this, "handleListClick", (t) => {
|
|
478
|
-
var n;
|
|
479
|
-
t.stopPropagation();
|
|
480
|
-
const e = (n = t.target) == null ? void 0 : n.closest("li[data-id]");
|
|
481
|
-
if (!e) return;
|
|
482
|
-
const a = e.getAttribute("data-id"), r = this._itens.find((u) => String(u.id) === String(a));
|
|
483
|
-
r && this.selecionarItem(r);
|
|
484
|
-
});
|
|
485
|
-
const t = this.attachShadow({ mode: "open" });
|
|
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");
|
|
488
|
-
this.idsAcessibilidade = {
|
|
489
|
-
label: `${e}-label`,
|
|
490
|
-
gatilho: `${e}-gatilho`,
|
|
491
|
-
texto: `${e}-texto`,
|
|
492
|
-
lista: `${e}-lista`
|
|
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);
|
|
494
|
-
}
|
|
495
|
-
static get observedAttributes() {
|
|
496
|
-
return Y;
|
|
497
|
-
}
|
|
498
|
-
connectedCallback() {
|
|
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) => {
|
|
500
|
-
t.stopPropagation(), this.fechar();
|
|
501
|
-
}), 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 });
|
|
502
|
-
}
|
|
503
|
-
carregarItensFilhos() {
|
|
504
|
-
const t = Array.from(this.querySelectorAll('option, ui-opcao, [role="option"], [data-opcao], [data-value]:not(input):not(select)'));
|
|
505
|
-
t.length > 0 && (this._itens = t.map((e, a) => {
|
|
506
|
-
var n;
|
|
507
|
-
const r = e.getAttribute("value") || e.getAttribute("data-value") || String(a + 1);
|
|
508
|
-
return {
|
|
509
|
-
id: r,
|
|
510
|
-
label: ((n = e.textContent) == null ? void 0 : n.trim()) || r || `Opção ${a + 1}`
|
|
511
|
-
};
|
|
512
|
-
}), _(this.listElement, this._itens, this._value), this.syncLabel());
|
|
513
|
-
}
|
|
514
|
-
disconnectedCallback() {
|
|
515
|
-
this.listeners.cleanup(), this.observer && this.observer.disconnect(), this.fechar();
|
|
516
|
-
}
|
|
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);
|
|
519
|
-
}
|
|
520
|
-
get value() {
|
|
521
|
-
return this._value;
|
|
522
|
-
}
|
|
523
|
-
set value(t) {
|
|
524
|
-
this._value = t, this.setAttribute("value", t), this.internals.setFormValue(t), this.syncLabel(), J(this.listElement, this._value), this.atualizarValidade();
|
|
525
|
-
}
|
|
526
|
-
get label() {
|
|
527
|
-
return this.getAttribute("label") || this.getAttribute("rotulo") || "";
|
|
528
|
-
}
|
|
529
|
-
set label(t) {
|
|
530
|
-
t ? this.setAttribute("label", t) : (this.removeAttribute("label"), this.removeAttribute("rotulo")), this.syncLabel();
|
|
531
|
-
}
|
|
532
|
-
get disabled() {
|
|
533
|
-
return this.hasAttribute("disabled") || this._formDisabled;
|
|
534
|
-
}
|
|
535
|
-
set disabled(t) {
|
|
536
|
-
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.button.disabled = this.disabled;
|
|
537
|
-
}
|
|
538
|
-
get name() {
|
|
539
|
-
return this.getAttribute("name") || "";
|
|
540
|
-
}
|
|
541
|
-
set name(t) {
|
|
542
|
-
this.setAttribute("name", t);
|
|
543
|
-
}
|
|
544
|
-
get type() {
|
|
545
|
-
return "select-one";
|
|
546
|
-
}
|
|
547
|
-
atualizarValidade() {
|
|
548
|
-
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
549
|
-
if (this.disabled) {
|
|
550
|
-
this.internals.setValidity({});
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
if (this._customErrorMessage) {
|
|
554
|
-
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.button);
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this._value || this._value.trim() === "")) {
|
|
558
|
-
const e = this.getAttribute("mensagem-validacao") || "Selecione um item da lista.";
|
|
559
|
-
this.internals.setValidity({ valueMissing: !0 }, e, this.button);
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
this.internals.setValidity({});
|
|
563
|
-
}
|
|
564
|
-
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
565
|
-
formDisabledCallback(t) {
|
|
566
|
-
this._formDisabled = t, this.button.disabled = this.disabled, this.disabled && this.fechar();
|
|
567
|
-
}
|
|
568
|
-
formResetCallback() {
|
|
569
|
-
this.value = this._defaultValue;
|
|
570
|
-
}
|
|
571
|
-
formStateRestoreCallback(t, e) {
|
|
572
|
-
typeof t == "string" && (this.value = t);
|
|
573
|
-
}
|
|
574
|
-
get itens() {
|
|
575
|
-
return this._itens;
|
|
576
|
-
}
|
|
577
|
-
set itens(t) {
|
|
578
|
-
this._itens = t || [], _(this.listElement, this._itens, this._value), this.syncLabel();
|
|
579
|
-
}
|
|
580
|
-
abrir() {
|
|
581
|
-
this.disabled || this.hasAttribute("aberta") || (this.setAttribute("aberta", ""), this.posicionamento.posicionar(), this.posicionamento.ativarAcompanhamento(this.fechar));
|
|
582
|
-
}
|
|
583
|
-
syncLabel() {
|
|
584
|
-
const t = this.getAttribute("label") || this.getAttribute("rotulo");
|
|
585
|
-
if (t)
|
|
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");
|
|
587
|
-
else {
|
|
588
|
-
this.labelElement.style.display = "none", this.sincronizarRotuloExterno();
|
|
589
|
-
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
590
|
-
this.sheetTituloElement.textContent = a;
|
|
591
|
-
}
|
|
592
|
-
const e = this._itens.find((a) => String(a.id) === String(this._value));
|
|
593
|
-
if (e)
|
|
594
|
-
this.textoElement.textContent = e.label;
|
|
595
|
-
else {
|
|
596
|
-
const a = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
597
|
-
this.textoElement.textContent = a;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
/** Sem o atributo `label`, usa o rótulo de fora do Shadow DOM (aria-label, <label for>, <label> envolvente). */
|
|
601
|
-
sincronizarRotuloExterno() {
|
|
602
|
-
this.button.removeAttribute("aria-labelledby"), this.content.removeAttribute("aria-labelledby");
|
|
603
|
-
const t = f(this, this.internals);
|
|
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"));
|
|
605
|
-
}
|
|
606
|
-
syncState() {
|
|
607
|
-
g(this), this.hasAttribute("value") && (this._value = this.getAttribute("value") || "", this.internals.setFormValue(this._value)), this.syncLabel(), this.atualizarValidade();
|
|
608
|
-
}
|
|
609
|
-
selecionarItem(t) {
|
|
610
|
-
var r;
|
|
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(
|
|
613
|
-
new CustomEvent("ui-selecionar", {
|
|
614
|
-
detail: t,
|
|
615
|
-
bubbles: !0,
|
|
616
|
-
composed: !0
|
|
617
|
-
})
|
|
618
|
-
), this.dispatchEvent(
|
|
619
|
-
new Event("input", {
|
|
620
|
-
bubbles: !0,
|
|
621
|
-
composed: !0
|
|
622
|
-
})
|
|
623
|
-
), this.dispatchEvent(
|
|
624
|
-
new Event("change", {
|
|
625
|
-
bubbles: !0,
|
|
626
|
-
composed: !0
|
|
627
|
-
})
|
|
628
|
-
);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
class Q extends E {
|
|
632
|
-
}
|
|
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");
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
e.style.display = "none", t.removeAttribute("aria-labelledby");
|
|
642
|
-
const r = f(o, i);
|
|
643
|
-
r ? t.setAttribute("aria-label", r) : t.removeAttribute("aria-label");
|
|
644
|
-
}
|
|
645
|
-
class et extends d {
|
|
646
|
-
constructor() {
|
|
647
|
-
super();
|
|
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) => {
|
|
655
|
-
t.preventDefault(), this.alternar();
|
|
656
|
-
});
|
|
657
|
-
s(this, "handleHostClick", (t) => {
|
|
658
|
-
p(this, t) && (this.alternar(), this.containerElement.focus());
|
|
659
|
-
});
|
|
660
|
-
s(this, "handleKeyDown", (t) => {
|
|
661
|
-
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
662
|
-
});
|
|
663
|
-
s(this, "handleFocus", () => {
|
|
664
|
-
this.containerElement.classList.add("ui-checkbox--foco");
|
|
665
|
-
});
|
|
666
|
-
s(this, "handleBlur", () => {
|
|
667
|
-
this.containerElement.classList.remove("ui-checkbox--foco");
|
|
668
|
-
});
|
|
669
|
-
const t = this.attachShadow({ mode: "open" });
|
|
670
|
-
t.innerHTML = `
|
|
671
|
-
<style>${tt}</style>
|
|
672
|
-
<div class="ui-checkbox" part="base" tabindex="0" role="checkbox" aria-checked="false">
|
|
673
|
-
<span class="ui-checkbox__box" part="controle">
|
|
674
|
-
<span class="ui-checkbox__mark" part="indicador"></span>
|
|
675
|
-
</span>
|
|
676
|
-
<span class="ui-checkbox__label" part="rotulo" style="display: none;"></span>
|
|
677
|
-
</div>
|
|
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");
|
|
679
|
-
}
|
|
680
|
-
static get observedAttributes() {
|
|
681
|
-
return [
|
|
682
|
-
"marcado",
|
|
683
|
-
"checked",
|
|
684
|
-
"indeterminado",
|
|
685
|
-
"indeterminate",
|
|
686
|
-
"disabled",
|
|
687
|
-
"value",
|
|
688
|
-
"label",
|
|
689
|
-
"posicao-label",
|
|
690
|
-
"name",
|
|
691
|
-
"obrigatorio",
|
|
692
|
-
"required",
|
|
693
|
-
"mensagem-validacao"
|
|
694
|
-
];
|
|
695
|
-
}
|
|
696
|
-
connectedCallback() {
|
|
697
|
-
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();
|
|
698
|
-
}
|
|
699
|
-
disconnectedCallback() {
|
|
700
|
-
this.listeners.cleanup();
|
|
701
|
-
}
|
|
702
|
-
attributeChangedCallback(t, e, a) {
|
|
703
|
-
this.syncState();
|
|
704
|
-
}
|
|
705
|
-
get marcado() {
|
|
706
|
-
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
707
|
-
}
|
|
708
|
-
set marcado(t) {
|
|
709
|
-
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked")), this.syncState();
|
|
710
|
-
}
|
|
711
|
-
get checked() {
|
|
712
|
-
return this.marcado;
|
|
713
|
-
}
|
|
714
|
-
set checked(t) {
|
|
715
|
-
this.marcado = t;
|
|
716
|
-
}
|
|
717
|
-
get value() {
|
|
718
|
-
return this.getAttribute("value") || "on";
|
|
719
|
-
}
|
|
720
|
-
set value(t) {
|
|
721
|
-
this.setAttribute("value", t), this.syncState();
|
|
722
|
-
}
|
|
723
|
-
get name() {
|
|
724
|
-
return this.getAttribute("name") || "";
|
|
725
|
-
}
|
|
726
|
-
set name(t) {
|
|
727
|
-
this.setAttribute("name", t), this.syncState();
|
|
728
|
-
}
|
|
729
|
-
get indeterminado() {
|
|
730
|
-
return this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate");
|
|
731
|
-
}
|
|
732
|
-
set indeterminado(t) {
|
|
733
|
-
t ? this.setAttribute("indeterminado", "") : (this.removeAttribute("indeterminado"), this.removeAttribute("indeterminate")), this.syncState();
|
|
734
|
-
}
|
|
735
|
-
get disabled() {
|
|
736
|
-
return this.hasAttribute("disabled") || this._formDisabled;
|
|
737
|
-
}
|
|
738
|
-
set disabled(t) {
|
|
739
|
-
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
740
|
-
}
|
|
741
|
-
get type() {
|
|
742
|
-
return "checkbox";
|
|
743
|
-
}
|
|
744
|
-
atualizarValidade() {
|
|
745
|
-
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
746
|
-
if (this.disabled) {
|
|
747
|
-
this.internals.setValidity({});
|
|
748
|
-
return;
|
|
749
|
-
}
|
|
750
|
-
if (this._customErrorMessage) {
|
|
751
|
-
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.marcado) {
|
|
755
|
-
const e = this.getAttribute("mensagem-validacao") || "Marque esta caixa para continuar.";
|
|
756
|
-
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
this.internals.setValidity({});
|
|
760
|
-
}
|
|
761
|
-
/** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
|
|
762
|
-
focus(t) {
|
|
763
|
-
this.containerElement.focus(t);
|
|
764
|
-
}
|
|
765
|
-
alternar() {
|
|
766
|
-
this.disabled || (this.indeterminado ? (this.indeterminado = !1, this.marcado = !0) : this.marcado = !this.marcado, this.dispatchEvent(
|
|
767
|
-
new CustomEvent("ui-change", {
|
|
768
|
-
detail: {
|
|
769
|
-
marcado: this.marcado,
|
|
770
|
-
indeterminado: this.indeterminado,
|
|
771
|
-
value: this.getAttribute("value") || ""
|
|
772
|
-
},
|
|
773
|
-
bubbles: !0,
|
|
774
|
-
composed: !0
|
|
775
|
-
})
|
|
776
|
-
), this.dispatchEvent(
|
|
777
|
-
new Event("change", {
|
|
778
|
-
bubbles: !0,
|
|
779
|
-
composed: !0
|
|
780
|
-
})
|
|
781
|
-
));
|
|
782
|
-
}
|
|
783
|
-
syncState() {
|
|
784
|
-
const t = this.marcado, e = this.indeterminado, a = this.disabled, r = this.getAttribute("label"), n = this.getAttribute("posicao-label") || "direita";
|
|
785
|
-
this.containerElement.setAttribute(
|
|
786
|
-
"aria-checked",
|
|
787
|
-
e ? "mixed" : String(t)
|
|
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 = `
|
|
789
|
-
<svg viewBox="0 0 24 24">
|
|
790
|
-
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
791
|
-
</svg>
|
|
792
|
-
` : t ? this.markElement.innerHTML = `
|
|
793
|
-
<svg viewBox="0 0 24 24">
|
|
794
|
-
<polyline points="20 6 9 17 4 12"></polyline>
|
|
795
|
-
</svg>
|
|
796
|
-
` : this.markElement.innerHTML = "", x({
|
|
797
|
-
host: this,
|
|
798
|
-
internals: this.internals,
|
|
799
|
-
controle: this.containerElement,
|
|
800
|
-
rotulo: this.labelElement,
|
|
801
|
-
texto: r
|
|
802
|
-
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
803
|
-
}
|
|
804
|
-
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
805
|
-
formResetCallback() {
|
|
806
|
-
this.marcado = this._defaultChecked, this.indeterminado = this._defaultIndeterminate, this.syncState();
|
|
807
|
-
}
|
|
808
|
-
formStateRestoreCallback(t, e) {
|
|
809
|
-
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
810
|
-
}
|
|
811
|
-
}
|
|
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}';
|
|
814
|
-
class l {
|
|
815
|
-
static getScopeNode(i) {
|
|
816
|
-
return i.closest("form") || i.getRootNode() || document;
|
|
817
|
-
}
|
|
818
|
-
/** Registra (ou re-registra, se o nome ou o escopo mudaram) o radio no grupo do seu nome atual. */
|
|
819
|
-
static registrar(i) {
|
|
820
|
-
this.desregistrar(i);
|
|
821
|
-
const t = i.name;
|
|
822
|
-
if (!t) return;
|
|
823
|
-
const e = this.getScopeNode(i);
|
|
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 });
|
|
828
|
-
}
|
|
829
|
-
static desregistrar(i) {
|
|
830
|
-
const t = this.registros.get(i);
|
|
831
|
-
if (!t) return;
|
|
832
|
-
this.registros.delete(i);
|
|
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));
|
|
835
|
-
}
|
|
836
|
-
/** Radios do mesmo grupo que `radio`, usando o registro (não o nome atual, que pode ainda não ter sido registrado). */
|
|
837
|
-
static obterRadiosDoGrupo(i) {
|
|
838
|
-
var a;
|
|
839
|
-
const t = this.registros.get(i);
|
|
840
|
-
if (!t) return [];
|
|
841
|
-
const e = (a = this.registry.get(t.scope)) == null ? void 0 : a.get(t.nome);
|
|
842
|
-
return e ? Array.from(e) : [];
|
|
843
|
-
}
|
|
844
|
-
static desmarcarOutros(i) {
|
|
845
|
-
this.obterRadiosDoGrupo(i).forEach((t) => {
|
|
846
|
-
t !== i && (t.removeAttribute("marcado"), t.removeAttribute("checked"), t.syncState());
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
|
-
/** Reavalia o tabindex (roving) dos radios; use depois de entrar, sair ou mudar de grupo. */
|
|
850
|
-
static atualizarGrupo(i) {
|
|
851
|
-
i.forEach((t) => t.atualizarTabindex());
|
|
852
|
-
}
|
|
853
|
-
static tratarNavegacaoTeclado(i, t) {
|
|
854
|
-
if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(i.key)) return;
|
|
855
|
-
i.preventDefault();
|
|
856
|
-
const e = this.obterRadiosDoGrupo(t).filter((u) => !u.disabled && u.isConnected);
|
|
857
|
-
if (e.length <= 1) return;
|
|
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();
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
s(l, "registry", /* @__PURE__ */ new WeakMap()), s(l, "registros", /* @__PURE__ */ new WeakMap());
|
|
866
|
-
class at extends d {
|
|
867
|
-
constructor() {
|
|
868
|
-
super();
|
|
869
|
-
s(this, "containerElement");
|
|
870
|
-
s(this, "labelElement");
|
|
871
|
-
s(this, "listeners", new b());
|
|
872
|
-
s(this, "_defaultChecked", !1);
|
|
873
|
-
s(this, "handleClick", (t) => {
|
|
874
|
-
t.preventDefault(), this.selecionar(), this.containerElement.focus();
|
|
875
|
-
});
|
|
876
|
-
s(this, "handleHostClick", (t) => {
|
|
877
|
-
p(this, t) && (this.selecionar(), this.containerElement.focus());
|
|
878
|
-
});
|
|
879
|
-
s(this, "handleKeyDown", (t) => {
|
|
880
|
-
t.key === " " || t.key === "Enter" ? (t.preventDefault(), this.selecionar()) : l.tratarNavegacaoTeclado(t, this);
|
|
881
|
-
});
|
|
882
|
-
s(this, "handleFocus", () => {
|
|
883
|
-
this.containerElement.classList.add("ui-radio--foco");
|
|
884
|
-
});
|
|
885
|
-
s(this, "handleBlur", () => {
|
|
886
|
-
this.containerElement.classList.remove("ui-radio--foco");
|
|
887
|
-
});
|
|
888
|
-
const t = this.attachShadow({ mode: "open" });
|
|
889
|
-
t.innerHTML = `
|
|
890
|
-
<style>${it}</style>
|
|
891
|
-
<div class="ui-radio" part="base" tabindex="0" role="radio" aria-checked="false">
|
|
892
|
-
<span class="ui-radio__circle" part="controle">
|
|
893
|
-
<span class="ui-radio__dot" part="indicador"></span>
|
|
894
|
-
</span>
|
|
895
|
-
<span class="ui-radio__label" part="rotulo" style="display: none;"></span>
|
|
896
|
-
</div>
|
|
897
|
-
`, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label"), this.labelElement.id = m("ui-radio-label");
|
|
898
|
-
}
|
|
899
|
-
static get observedAttributes() {
|
|
900
|
-
return [
|
|
901
|
-
"marcado",
|
|
902
|
-
"checked",
|
|
903
|
-
"name",
|
|
904
|
-
"nome",
|
|
905
|
-
"disabled",
|
|
906
|
-
"value",
|
|
907
|
-
"label",
|
|
908
|
-
"posicao-label",
|
|
909
|
-
"obrigatorio",
|
|
910
|
-
"required",
|
|
911
|
-
"mensagem-validacao"
|
|
912
|
-
];
|
|
913
|
-
}
|
|
914
|
-
connectedCallback() {
|
|
915
|
-
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));
|
|
916
|
-
}
|
|
917
|
-
disconnectedCallback() {
|
|
918
|
-
this.listeners.cleanup();
|
|
919
|
-
const t = l.obterRadiosDoGrupo(this).filter((e) => e !== this && e.isConnected);
|
|
920
|
-
l.desregistrar(this), l.atualizarGrupo(t);
|
|
921
|
-
}
|
|
922
|
-
attributeChangedCallback(t, e, a) {
|
|
923
|
-
if ((t === "name" || t === "nome") && this.isConnected) {
|
|
924
|
-
const r = l.obterRadiosDoGrupo(this).filter((n) => n !== this);
|
|
925
|
-
l.registrar(this), this.syncState(), l.atualizarGrupo([...r, ...l.obterRadiosDoGrupo(this).filter((n) => n !== this)]);
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
this.syncState();
|
|
929
|
-
}
|
|
930
|
-
get marcado() {
|
|
931
|
-
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
932
|
-
}
|
|
933
|
-
set marcado(t) {
|
|
934
|
-
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked"));
|
|
935
|
-
}
|
|
936
|
-
get name() {
|
|
937
|
-
return this.getAttribute("name") || this.getAttribute("nome") || "";
|
|
938
|
-
}
|
|
939
|
-
set name(t) {
|
|
940
|
-
this.setAttribute("name", t);
|
|
941
|
-
}
|
|
942
|
-
get disabled() {
|
|
943
|
-
return this.hasAttribute("disabled") || this._formDisabled;
|
|
944
|
-
}
|
|
945
|
-
set disabled(t) {
|
|
946
|
-
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
947
|
-
}
|
|
948
|
-
get type() {
|
|
949
|
-
return "radio";
|
|
950
|
-
}
|
|
951
|
-
atualizarValidade() {
|
|
952
|
-
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
953
|
-
if (this.disabled) {
|
|
954
|
-
this.internals.setValidity({});
|
|
955
|
-
return;
|
|
956
|
-
}
|
|
957
|
-
if (this._customErrorMessage) {
|
|
958
|
-
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
959
|
-
return;
|
|
960
|
-
}
|
|
961
|
-
const t = l.obterRadiosDoGrupo(this);
|
|
962
|
-
if ((this.required || t.length > 0 && t.some((a) => a.required)) && !(this.marcado || t.length > 0 && t.some((r) => r.marcado))) {
|
|
963
|
-
const r = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
964
|
-
this.internals.setValidity({ valueMissing: !0 }, r, this.containerElement);
|
|
965
|
-
return;
|
|
966
|
-
}
|
|
967
|
-
this.internals.setValidity({});
|
|
968
|
-
}
|
|
969
|
-
focus(t) {
|
|
970
|
-
this.containerElement.focus(t);
|
|
971
|
-
}
|
|
972
|
-
selecionar() {
|
|
973
|
-
this.disabled || this.marcado || (this.marcado = !0, l.desmarcarOutros(this), this.dispatchEvent(
|
|
974
|
-
new CustomEvent("ui-change", {
|
|
975
|
-
detail: {
|
|
976
|
-
marcado: !0,
|
|
977
|
-
name: this.name,
|
|
978
|
-
value: this.getAttribute("value") || ""
|
|
979
|
-
},
|
|
980
|
-
bubbles: !0,
|
|
981
|
-
composed: !0
|
|
982
|
-
})
|
|
983
|
-
), this.dispatchEvent(
|
|
984
|
-
new Event("change", {
|
|
985
|
-
bubbles: !0,
|
|
986
|
-
composed: !0
|
|
987
|
-
})
|
|
988
|
-
), l.obterRadiosDoGrupo(this).forEach((t) => t.atualizarValidade()));
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Roving tabindex: só um radio do grupo entra na ordem de Tab (o marcado; sem marcado, o primeiro habilitado).
|
|
992
|
-
* Isolado de `syncState` para reavaliar os vizinhos sem mexer no valor/validade do formulário.
|
|
993
|
-
*/
|
|
994
|
-
atualizarTabindex() {
|
|
995
|
-
if (this.disabled) {
|
|
996
|
-
this.containerElement.setAttribute("tabindex", "-1");
|
|
997
|
-
return;
|
|
998
|
-
}
|
|
999
|
-
const t = l.obterRadiosDoGrupo(this).filter((e) => e.isConnected || e === this);
|
|
1000
|
-
if (t.length === 0) {
|
|
1001
|
-
this.containerElement.setAttribute("tabindex", "0");
|
|
1002
|
-
return;
|
|
1003
|
-
}
|
|
1004
|
-
if (t.some((e) => e.marcado))
|
|
1005
|
-
this.containerElement.setAttribute("tabindex", this.marcado ? "0" : "-1");
|
|
1006
|
-
else {
|
|
1007
|
-
const e = t.find((a) => !a.disabled);
|
|
1008
|
-
this.containerElement.setAttribute("tabindex", e === this ? "0" : "-1");
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
syncState() {
|
|
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({
|
|
1014
|
-
host: this,
|
|
1015
|
-
internals: this.internals,
|
|
1016
|
-
controle: this.containerElement,
|
|
1017
|
-
rotulo: this.labelElement,
|
|
1018
|
-
texto: a
|
|
1019
|
-
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1020
|
-
}
|
|
1021
|
-
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
1022
|
-
formResetCallback() {
|
|
1023
|
-
this.marcado = this._defaultChecked, this._defaultChecked ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1024
|
-
}
|
|
1025
|
-
formStateRestoreCallback(t, e) {
|
|
1026
|
-
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
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 {
|
|
1032
|
-
constructor() {
|
|
1033
|
-
super();
|
|
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) => {
|
|
1040
|
-
t.preventDefault(), this.alternar();
|
|
1041
|
-
});
|
|
1042
|
-
s(this, "handleHostClick", (t) => {
|
|
1043
|
-
p(this, t) && (this.alternar(), this.containerElement.focus());
|
|
1044
|
-
});
|
|
1045
|
-
s(this, "handleKeyDown", (t) => {
|
|
1046
|
-
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
1047
|
-
});
|
|
1048
|
-
s(this, "handleFocus", () => {
|
|
1049
|
-
this.containerElement.classList.add("ui-switch--foco");
|
|
1050
|
-
});
|
|
1051
|
-
s(this, "handleBlur", () => {
|
|
1052
|
-
this.containerElement.classList.remove("ui-switch--foco");
|
|
1053
|
-
});
|
|
1054
|
-
const t = this.attachShadow({ mode: "open" });
|
|
1055
|
-
t.innerHTML = `
|
|
1056
|
-
<style>${st}</style>
|
|
1057
|
-
<div class="ui-switch" part="base" tabindex="0" role="switch" aria-checked="false">
|
|
1058
|
-
<span class="ui-switch__track" part="controle">
|
|
1059
|
-
<span class="ui-switch__thumb" part="indicador"></span>
|
|
1060
|
-
</span>
|
|
1061
|
-
<span class="ui-switch__label" part="rotulo" style="display: none;"></span>
|
|
1062
|
-
</div>
|
|
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;
|
|
1064
|
-
}
|
|
1065
|
-
static get observedAttributes() {
|
|
1066
|
-
return [
|
|
1067
|
-
"ativo",
|
|
1068
|
-
"ligado",
|
|
1069
|
-
"checked",
|
|
1070
|
-
"disabled",
|
|
1071
|
-
"tamanho",
|
|
1072
|
-
"size",
|
|
1073
|
-
"label",
|
|
1074
|
-
"posicao-label",
|
|
1075
|
-
"value",
|
|
1076
|
-
"name",
|
|
1077
|
-
"obrigatorio",
|
|
1078
|
-
"required",
|
|
1079
|
-
"mensagem-validacao",
|
|
1080
|
-
"aria-label"
|
|
1081
|
-
];
|
|
1082
|
-
}
|
|
1083
|
-
connectedCallback() {
|
|
1084
|
-
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();
|
|
1085
|
-
}
|
|
1086
|
-
disconnectedCallback() {
|
|
1087
|
-
this.listeners.cleanup();
|
|
1088
|
-
}
|
|
1089
|
-
attributeChangedCallback(t, e, a) {
|
|
1090
|
-
this.syncState();
|
|
1091
|
-
}
|
|
1092
|
-
get ativo() {
|
|
1093
|
-
return this.hasAttribute("ativo") || this.hasAttribute("ligado") || this.hasAttribute("checked");
|
|
1094
|
-
}
|
|
1095
|
-
set ativo(t) {
|
|
1096
|
-
t ? this.setAttribute("ativo", "") : (this.removeAttribute("ativo"), this.removeAttribute("ligado"), this.removeAttribute("checked")), this.syncState();
|
|
1097
|
-
}
|
|
1098
|
-
get checked() {
|
|
1099
|
-
return this.ativo;
|
|
1100
|
-
}
|
|
1101
|
-
set checked(t) {
|
|
1102
|
-
this.ativo = t;
|
|
1103
|
-
}
|
|
1104
|
-
get value() {
|
|
1105
|
-
return this.getAttribute("value") || "on";
|
|
1106
|
-
}
|
|
1107
|
-
set value(t) {
|
|
1108
|
-
this.setAttribute("value", t), this.syncState();
|
|
1109
|
-
}
|
|
1110
|
-
get name() {
|
|
1111
|
-
return this.getAttribute("name") || "";
|
|
1112
|
-
}
|
|
1113
|
-
set name(t) {
|
|
1114
|
-
this.setAttribute("name", t), this.syncState();
|
|
1115
|
-
}
|
|
1116
|
-
get disabled() {
|
|
1117
|
-
return this.hasAttribute("disabled") || this._formDisabled;
|
|
1118
|
-
}
|
|
1119
|
-
set disabled(t) {
|
|
1120
|
-
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
1121
|
-
}
|
|
1122
|
-
get type() {
|
|
1123
|
-
return "checkbox";
|
|
1124
|
-
}
|
|
1125
|
-
atualizarValidade() {
|
|
1126
|
-
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
1127
|
-
if (this.disabled) {
|
|
1128
|
-
this.internals.setValidity({});
|
|
1129
|
-
return;
|
|
1130
|
-
}
|
|
1131
|
-
if (this._customErrorMessage) {
|
|
1132
|
-
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.ativo) {
|
|
1136
|
-
const e = this.getAttribute("mensagem-validacao") || "Ative este interruptor para continuar.";
|
|
1137
|
-
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
1138
|
-
return;
|
|
1139
|
-
}
|
|
1140
|
-
this.internals.setValidity({});
|
|
1141
|
-
}
|
|
1142
|
-
/** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
|
|
1143
|
-
focus(t) {
|
|
1144
|
-
this.containerElement.focus(t);
|
|
1145
|
-
}
|
|
1146
|
-
alternar() {
|
|
1147
|
-
this.disabled || (this.ativo = !this.ativo, this.dispatchEvent(
|
|
1148
|
-
new CustomEvent("ui-change", {
|
|
1149
|
-
detail: {
|
|
1150
|
-
ativo: this.ativo,
|
|
1151
|
-
value: this.getAttribute("value") || ""
|
|
1152
|
-
},
|
|
1153
|
-
bubbles: !0,
|
|
1154
|
-
composed: !0
|
|
1155
|
-
})
|
|
1156
|
-
), this.dispatchEvent(
|
|
1157
|
-
new Event("change", {
|
|
1158
|
-
bubbles: !0,
|
|
1159
|
-
composed: !0
|
|
1160
|
-
})
|
|
1161
|
-
));
|
|
1162
|
-
}
|
|
1163
|
-
syncState() {
|
|
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({
|
|
1166
|
-
host: this,
|
|
1167
|
-
internals: this.internals,
|
|
1168
|
-
controle: this.containerElement,
|
|
1169
|
-
rotulo: this.labelElement,
|
|
1170
|
-
texto: r
|
|
1171
|
-
}), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
1172
|
-
}
|
|
1173
|
-
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
1174
|
-
formResetCallback() {
|
|
1175
|
-
this.ativo = this._defaultChecked, this.syncState();
|
|
1176
|
-
}
|
|
1177
|
-
formStateRestoreCallback(t, e) {
|
|
1178
|
-
typeof t == "string" ? this.ativo = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.ativo = t), this.syncState();
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
class rt extends k {
|
|
1182
|
-
}
|
|
1183
|
-
h("ui-switch", k);
|
|
1184
|
-
h("ui-toggle", rt);
|
|
1185
|
-
export {
|
|
1186
|
-
Y as A,
|
|
1187
|
-
G as L,
|
|
1188
|
-
l as R,
|
|
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
|
|
1202
|
-
};
|