@thibezer/ui-components-kit 2.9.0 → 2.10.1
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 +138 -0
- package/README.md +7 -4
- 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 +73 -72
- package/dist/canvas.js +3212 -2690
- 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-feicoes-edicao.d.ts +13 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +8 -2
- package/dist/components/ui-canvas-cad/cad-feicoes-teclado.d.ts +19 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +1 -1
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +12 -1
- package/dist/components/ui-canvas-cad/cad-ferramentas-barra.d.ts +8 -1
- package/dist/components/ui-canvas-cad/cad-recusas.d.ts +6 -0
- package/dist/components/ui-canvas-cad/cad-snap.d.ts +2 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +7 -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-cores/cores-utils.d.ts +2 -0
- package/dist/components/ui-cores/tipos.d.ts +9 -2
- package/dist/components/ui-cores/ui-controle-cores.d.ts +9 -4
- package/dist/components/ui-cores/ui-seletor-cor.d.ts +12 -9
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +1 -1
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +3 -3
- package/dist/components/ui-tabela-propriedades/propriedades-valor-misto.d.ts +25 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +7 -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 +11 -9
- package/dist/custom-elements.json +16677 -13587
- package/dist/data.cjs +1 -1
- package/dist/data.js +72 -64
- 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 +15 -1
- package/dist/gerencigeo-canvas/feature_desenho_controle.d.ts +6 -0
- package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +9 -0
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +64 -6
- 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 +204 -191
- package/dist/{motor-CFI84lM2.js → motor-BKT2eStP.js} +3 -3
- package/dist/motor.js +1 -1
- package/dist/opcoes-CupvWVIm.js +24 -0
- package/dist/opcoes-vdAUY5OI.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +10 -9
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +66 -58
- package/dist/tipos-elementos.d.ts +78 -0
- package/dist/tipos-react.d.ts +4 -0
- package/dist/tipos-vue.d.ts +76 -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-CohlwXJK.cjs +32 -0
- package/dist/ui-controle-cores-DMtTUtLk.js +292 -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-D9iI7yew.js +413 -0
- package/dist/ui-seletor-cor-Ft06TEUH.cjs +110 -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/dist/ui-tabela-propriedades-B8AwlpqL.cjs +141 -0
- package/dist/{ui-tabela-propriedades-DoL4SE0r.js → ui-tabela-propriedades-DuaC4sFX.js} +1295 -1195
- 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
- package/dist/ui-tabela-propriedades-CjK2gG14.cjs +0 -141
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { S as
|
|
5
|
-
import { b as
|
|
6
|
-
import {
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var g = (a, s, t) => s in a ? b(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
|
3
|
+
var i = (a, s, t) => g(a, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { S as x, d as p } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
+
import { b as f } from "./altura-controle-vxQiXG4q.js";
|
|
6
|
+
import { L as _ } from "./listener-bag-DQgv7OON.js";
|
|
7
|
+
import { i as c } from "./opcoes-CupvWVIm.js";
|
|
8
|
+
import { g as v, o as E, c as y } from "./acessibilidade-CUlSXc2X.js";
|
|
7
9
|
import { v as A, a as w } from "./form-validacao-BlQFxUVj.js";
|
|
8
10
|
import { a as S } from "./form-submissao-C-SPRKgT.js";
|
|
9
|
-
const
|
|
11
|
+
const V = ':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;vertical-align:middle}.ui-campo-texto__container{position:relative;width:100%;display:flex;flex-direction:column;justify-content:center}:host([label-flutuante]) .ui-campo-texto__container{margin-top:6px}.ui-campo-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-campo-texto__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px;font-weight:600}.ui-campo-texto__wrapper{position:relative;display:flex;align-items:center;width:100%;height:var(--ui-campo-altura, 34px);min-height:var(--ui-campo-altura, 34px);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);padding:0 8px;gap:6px;box-sizing:border-box;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.ui-campo-texto__wrapper--foco{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-campo-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-campo-texto__wrapper--disabled{opacity:.5;cursor:not-allowed;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-campo-texto__input{flex:1;width:100%;height:100%;min-height:0;background:transparent;border:none;outline:none;color:var(--ui-cor-texto, #e1e1e6);font-family:inherit;font-size:clamp(11px,.85rem,13px);line-height:1.2;padding:0;margin:0;box-sizing:border-box}.ui-campo-texto__input::placeholder{color:var(--ui-cor-texto-secundario, #888899);opacity:.65}.ui-campo-texto__input:disabled{cursor:not-allowed}.ui-campo-texto__icone{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0;font-size:14px;line-height:1;max-height:100%}.ui-campo-texto__icone svg,.ui-campo-texto__icone ::slotted(svg),.ui-campo-texto__icone ::slotted(ui-icone){shape-rendering:geometricPrecision;display:inline-flex;vertical-align:middle}.ui-campo-texto__icone--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none;transition:opacity .15s ease,transform .15s ease}.ui-campo-texto__icone--clicavel:hover{opacity:.85;transform:scale(1.1)}:host([label-flutuante]) .ui-campo-texto__label{position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:12px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;z-index:3;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);padding:0 4px;border-radius:3px;margin-bottom:0;white-space:nowrap;max-width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;transition:top .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1),color .15s ease,font-size .15s ease}:host([label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label{left:28px}:host([label-flutuante]) .ui-campo-texto__label--ativa{top:-8px;left:8px!important;transform:translateY(0) scale(.85);transform-origin:left top;font-weight:600;color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}:host([label-flutuante][erro]) .ui-campo-texto__label--ativa,:host([label-flutuante][mensagem-erro]) .ui-campo-texto__label--ativa{color:var(--ui-cor-texto-erro, #ff5555)}.ui-campo-texto__helper{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-campo-texto__helper--erro{color:var(--ui-cor-texto-erro, #ff5555);font-weight:500;display:flex;align-items:center;gap:4px}.ui-campo-texto__wrapper{touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-campo-texto__input{touch-action:manipulation}@media (max-width: 640px),(pointer: coarse) and (max-width: 1024px){.ui-campo-texto__input{font-size:16px!important}:host(:not([inline])) .ui-campo-texto__wrapper{min-height:max(var(--ui-campo-altura, 38px),38px);padding:0 10px}.ui-campo-texto__label{font-size:13px}.ui-campo-texto__icone--clicavel{min-width:32px;min-height:32px}}', k = [
|
|
10
12
|
"label",
|
|
11
13
|
"placeholder",
|
|
12
14
|
"value",
|
|
@@ -37,9 +39,9 @@ const k = ':host{display:flex;flex-direction:column;gap:4px;width:100%;box-sizin
|
|
|
37
39
|
"densidade",
|
|
38
40
|
"aria-label"
|
|
39
41
|
];
|
|
40
|
-
function
|
|
42
|
+
function C() {
|
|
41
43
|
return `
|
|
42
|
-
<style>${
|
|
44
|
+
<style>${V}</style>
|
|
43
45
|
<div class="ui-campo-texto__container">
|
|
44
46
|
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
45
47
|
<div class="ui-campo-texto__wrapper" part="campo">
|
|
@@ -52,36 +54,36 @@ function I() {
|
|
|
52
54
|
</span>
|
|
53
55
|
</div>
|
|
54
56
|
</div>
|
|
55
|
-
<div class="ui-campo-texto__helper" part="ajuda" style="display: none;"></div>
|
|
57
|
+
<div class="ui-campo-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
56
58
|
`;
|
|
57
59
|
}
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
60
|
-
const
|
|
61
|
-
|
|
60
|
+
function q(a, s, t, e) {
|
|
61
|
+
if (a.textContent = s, !t) return;
|
|
62
|
+
const r = document.createElement("span");
|
|
63
|
+
r.className = e, r.setAttribute("aria-hidden", "true"), r.textContent = "*", a.append(" ", r);
|
|
62
64
|
}
|
|
63
|
-
function
|
|
64
|
-
const { labelElement: s, inputElement: t, labelText: e, placeholderText:
|
|
65
|
+
function I(a) {
|
|
66
|
+
const { labelElement: s, inputElement: t, labelText: e, placeholderText: r, isFlutuante: o, estaFocado: n, obrigatorio: u } = a, l = t.value.trim() !== "";
|
|
65
67
|
let h = !1;
|
|
66
68
|
try {
|
|
67
69
|
h = t.matches(":-webkit-autofill");
|
|
68
70
|
} catch {
|
|
69
71
|
h = !1;
|
|
70
72
|
}
|
|
71
|
-
e ? (
|
|
73
|
+
e ? (q(s, e, !!u, "ui-campo-texto__asterisco"), s.style.display = "flex", o && (n || l || h) ? s.classList.add("ui-campo-texto__label--ativa") : s.classList.remove("ui-campo-texto__label--ativa")) : s.style.display = "none", o && !n && !l && !h ? t.placeholder = "" : t.placeholder = r;
|
|
72
74
|
}
|
|
73
|
-
function
|
|
74
|
-
s ? (
|
|
75
|
+
function L(a, s, t) {
|
|
76
|
+
s ? (a.classList.add("ui-campo-texto__icone--clicavel"), a.setAttribute("role", "button"), a.setAttribute("tabindex", "0"), a.setAttribute("aria-label", t ? "Ocultar senha" : "Exibir senha")) : (a.classList.remove("ui-campo-texto__icone--clicavel"), a.removeAttribute("role"), a.removeAttribute("tabindex"), a.removeAttribute("aria-label"));
|
|
75
77
|
}
|
|
76
|
-
function z(
|
|
77
|
-
e ? (
|
|
78
|
+
function z(a, s, t, e, r, o, n = "ui-campo-texto") {
|
|
79
|
+
e ? (a.classList.add(`${n}__wrapper--erro`), s.setAttribute("aria-invalid", "true")) : (a.classList.remove(`${n}__wrapper--erro`), s.removeAttribute("aria-invalid")), e && r ? (t.textContent = `⚠️ ${r}`, t.className = `${n}__helper ${n}__helper--erro`, t.style.display = "block") : o ? (t.textContent = o, t.className = `${n}__helper`, t.style.display = "block") : t.style.display = "none";
|
|
78
80
|
}
|
|
79
|
-
class
|
|
81
|
+
class m extends x {
|
|
80
82
|
constructor() {
|
|
81
83
|
super();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
i(this, "internals");
|
|
85
|
+
i(this, "_formDisabled", !1);
|
|
86
|
+
i(this, "_customErrorMessage", "");
|
|
85
87
|
this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : {};
|
|
86
88
|
}
|
|
87
89
|
// === Ciclo de Vida Form-Associated Custom Elements ===
|
|
@@ -129,51 +131,52 @@ class d extends f {
|
|
|
129
131
|
this._customErrorMessage = t || "", this.atualizarValidade();
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
class
|
|
134
|
+
i(m, "formAssociated", !0);
|
|
135
|
+
class d extends m {
|
|
134
136
|
constructor() {
|
|
135
137
|
super();
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
138
|
+
i(this, "labelElement");
|
|
139
|
+
i(this, "wrapperElement");
|
|
140
|
+
i(this, "inputElement");
|
|
141
|
+
i(this, "helperElement");
|
|
142
|
+
i(this, "rightIconContainer");
|
|
143
|
+
i(this, "leftSlotElement");
|
|
144
|
+
i(this, "_senhaVisivel", !1);
|
|
145
|
+
i(this, "listeners", new _());
|
|
146
|
+
i(this, "_checkTimer", null);
|
|
147
|
+
i(this, "_focado", !1);
|
|
148
|
+
i(this, "_inputId");
|
|
149
|
+
i(this, "_defaultValue", "");
|
|
150
|
+
i(this, "handleSlotChange", () => {
|
|
148
151
|
this.syncState();
|
|
149
152
|
});
|
|
150
|
-
|
|
153
|
+
i(this, "handleHostClick", (t) => {
|
|
151
154
|
y(this, t) && !this.disabled && this.inputElement.focus();
|
|
152
155
|
});
|
|
153
|
-
|
|
156
|
+
i(this, "handleRightIconClick", (t) => {
|
|
154
157
|
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
155
158
|
});
|
|
156
|
-
|
|
159
|
+
i(this, "handleRightIconKeyDown", (t) => {
|
|
157
160
|
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
158
161
|
});
|
|
159
|
-
|
|
162
|
+
i(this, "handleFocus", () => {
|
|
160
163
|
this._focado = !0, this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
161
164
|
});
|
|
162
|
-
|
|
165
|
+
i(this, "handleBlur", () => {
|
|
163
166
|
this._focado = !1, this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
164
167
|
});
|
|
165
168
|
/**
|
|
166
169
|
* Enter submete o formulário como num <input> nativo. Aguarda um tick para que
|
|
167
170
|
* ouvintes do consumidor possam cancelar com `preventDefault()` no keydown.
|
|
168
171
|
*/
|
|
169
|
-
|
|
172
|
+
i(this, "handleKeyDown", (t) => {
|
|
170
173
|
if (t.key !== "Enter" || t.isComposing || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
|
|
171
174
|
const e = this.form;
|
|
172
175
|
e && setTimeout(() => {
|
|
173
176
|
!t.defaultPrevented && this.isConnected && S(e);
|
|
174
177
|
});
|
|
175
178
|
});
|
|
176
|
-
|
|
179
|
+
i(this, "handleInput", (t) => {
|
|
177
180
|
t.stopPropagation();
|
|
178
181
|
const e = t.target.value;
|
|
179
182
|
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
@@ -189,7 +192,7 @@ class b extends d {
|
|
|
189
192
|
})
|
|
190
193
|
);
|
|
191
194
|
});
|
|
192
|
-
|
|
195
|
+
i(this, "handleChange", (t) => {
|
|
193
196
|
t.stopPropagation();
|
|
194
197
|
const e = t.target.value;
|
|
195
198
|
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
@@ -206,10 +209,10 @@ class b extends d {
|
|
|
206
209
|
);
|
|
207
210
|
});
|
|
208
211
|
const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
|
|
209
|
-
t.innerHTML =
|
|
212
|
+
t.innerHTML = C(), this.labelElement = t.querySelector(".ui-campo-texto__label"), this.wrapperElement = t.querySelector(".ui-campo-texto__wrapper"), this.inputElement = t.querySelector(".ui-campo-texto__input"), this.helperElement = t.querySelector(".ui-campo-texto__helper"), this.rightIconContainer = t.querySelector(".ui-campo-texto__icone--direita"), this.leftSlotElement = t.querySelector('slot[name="icone-esquerda"]'), this._inputId = v("ui-input"), this.inputElement.id = this._inputId, this.labelElement.htmlFor = this._inputId, this.helperElement.id = `${this._inputId}-helper`;
|
|
210
213
|
}
|
|
211
214
|
static get observedAttributes() {
|
|
212
|
-
return
|
|
215
|
+
return k;
|
|
213
216
|
}
|
|
214
217
|
focus(t) {
|
|
215
218
|
this.inputElement.focus(t);
|
|
@@ -218,13 +221,13 @@ class b extends d {
|
|
|
218
221
|
this.inputElement.blur();
|
|
219
222
|
}
|
|
220
223
|
connectedCallback() {
|
|
221
|
-
this.
|
|
224
|
+
this.listeners.cleanup(), this.listeners.add(this.inputElement, "input", this.handleInput), this.listeners.add(this.inputElement, "change", this.handleChange), this.listeners.add(this.inputElement, "focus", this.handleFocus), this.listeners.add(this.inputElement, "blur", this.handleBlur), this.listeners.add(this.inputElement, "keydown", this.handleKeyDown), this.listeners.add(this.rightIconContainer, "click", this.handleRightIconClick), this.listeners.add(this.rightIconContainer, "keydown", this.handleRightIconKeyDown), this.listeners.add(this.leftSlotElement, "slotchange", this.handleSlotChange), this.listeners.add(this, "click", this.handleHostClick), this._defaultValue = this.getAttribute("value") || "", this.hasAttribute("value") && !this.inputElement.value && (this.inputElement.value = this._defaultValue), this.syncState(), this._checkTimer && clearTimeout(this._checkTimer), this._checkTimer = setTimeout(() => this.syncState(), 100);
|
|
222
225
|
}
|
|
223
226
|
disconnectedCallback() {
|
|
224
|
-
this.
|
|
227
|
+
this.listeners.cleanup(), this._checkTimer && clearTimeout(this._checkTimer), this._checkTimer = null;
|
|
225
228
|
}
|
|
226
|
-
attributeChangedCallback(t, e,
|
|
227
|
-
t === "value" &&
|
|
229
|
+
attributeChangedCallback(t, e, r) {
|
|
230
|
+
t === "value" && r !== this.inputElement.value && !this._focado && (this.inputElement.value = r || ""), this.syncState();
|
|
228
231
|
}
|
|
229
232
|
get value() {
|
|
230
233
|
return this.inputElement ? this.inputElement.value : this.getAttribute("value") || "";
|
|
@@ -261,15 +264,13 @@ class b extends d {
|
|
|
261
264
|
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
262
265
|
}
|
|
263
266
|
get minLength() {
|
|
264
|
-
|
|
265
|
-
return t ? parseInt(t, 10) : -1;
|
|
267
|
+
return c(this.getAttribute("minlength") ?? this.getAttribute("min-length")) ?? -1;
|
|
266
268
|
}
|
|
267
269
|
set minLength(t) {
|
|
268
270
|
t >= 0 ? this.setAttribute("minlength", String(t)) : this.removeAttribute("minlength"), this.syncState();
|
|
269
271
|
}
|
|
270
272
|
get maxLength() {
|
|
271
|
-
|
|
272
|
-
return t ? parseInt(t, 10) : -1;
|
|
273
|
+
return c(this.getAttribute("maxlength") ?? this.getAttribute("max-length")) ?? -1;
|
|
273
274
|
}
|
|
274
275
|
set maxLength(t) {
|
|
275
276
|
t >= 0 ? this.setAttribute("maxlength", String(t)) : this.removeAttribute("maxlength"), this.syncState();
|
|
@@ -281,33 +282,33 @@ class b extends d {
|
|
|
281
282
|
t ? this.setAttribute("pattern", t) : this.removeAttribute("pattern"), this.syncState();
|
|
282
283
|
}
|
|
283
284
|
atualizarValidade() {
|
|
284
|
-
var
|
|
285
|
-
const t = this.getAttribute("
|
|
285
|
+
var l, h;
|
|
286
|
+
const t = this.getAttribute("min"), e = this.getAttribute("max"), r = this.inputElement ? this.inputElement.value : "", o = this.getAttribute("value") || r, n = !!((h = (l = this.inputElement) == null ? void 0 : l.validity) != null && h.badInput), u = A({
|
|
286
287
|
val: r,
|
|
287
|
-
rawVal:
|
|
288
|
-
badInput:
|
|
288
|
+
rawVal: o,
|
|
289
|
+
badInput: n,
|
|
289
290
|
disabled: this.disabled,
|
|
290
291
|
required: this.required,
|
|
291
292
|
tipo: this.type,
|
|
292
|
-
minlength:
|
|
293
|
-
maxlength:
|
|
294
|
-
min:
|
|
295
|
-
max:
|
|
293
|
+
minlength: this.minLength >= 0 ? this.minLength : null,
|
|
294
|
+
maxlength: this.maxLength >= 0 ? this.maxLength : null,
|
|
295
|
+
min: t !== null ? parseFloat(t) : null,
|
|
296
|
+
max: e !== null ? parseFloat(e) : null,
|
|
296
297
|
step: this.getAttribute("step"),
|
|
297
298
|
pattern: this.getAttribute("pattern"),
|
|
298
299
|
customError: this._customErrorMessage,
|
|
299
300
|
mensagemValidacao: this.getAttribute("mensagem-validacao")
|
|
300
301
|
});
|
|
301
|
-
w(this.internals,
|
|
302
|
+
w(this.internals, u, this.inputElement);
|
|
302
303
|
}
|
|
303
304
|
alternarVisibilidadeSenha() {
|
|
304
|
-
var
|
|
305
|
+
var r;
|
|
305
306
|
if (!(this.getAttribute("tipo") === "password" || this._senhaVisivel)) return;
|
|
306
307
|
this._senhaVisivel = !this._senhaVisivel, this.inputElement.type = this._senhaVisivel ? "text" : "password";
|
|
307
|
-
const e = (
|
|
308
|
-
e && e.assignedElements().forEach((
|
|
309
|
-
var
|
|
310
|
-
(((
|
|
308
|
+
const e = (r = this.shadowRoot) == null ? void 0 : r.querySelector('slot[name="icone-direita"]');
|
|
309
|
+
e && e.assignedElements().forEach((n) => {
|
|
310
|
+
var u, l;
|
|
311
|
+
(((u = n.textContent) == null ? void 0 : u.trim()) === "👁️" || ((l = n.textContent) == null ? void 0 : l.trim()) === "🙈") && (n.textContent = this._senhaVisivel ? "🙈" : "👁️");
|
|
311
312
|
}), this.dispatchEvent(
|
|
312
313
|
new CustomEvent("ui-toggle-senha", {
|
|
313
314
|
detail: { visivel: this._senhaVisivel },
|
|
@@ -317,7 +318,7 @@ class b extends d {
|
|
|
317
318
|
);
|
|
318
319
|
}
|
|
319
320
|
syncState() {
|
|
320
|
-
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda"),
|
|
321
|
+
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda"), f(this), I({
|
|
321
322
|
labelElement: this.labelElement,
|
|
322
323
|
inputElement: this.inputElement,
|
|
323
324
|
labelText: this.getAttribute("label"),
|
|
@@ -333,25 +334,22 @@ class b extends d {
|
|
|
333
334
|
} catch {
|
|
334
335
|
this.inputElement.type = "text";
|
|
335
336
|
}
|
|
336
|
-
|
|
337
|
-
n !== null ? this.inputElement.minLength = parseInt(n, 10) : this.inputElement.removeAttribute("minlength");
|
|
338
|
-
const o = this.getAttribute("maxlength") ?? this.getAttribute("max-length");
|
|
339
|
-
o !== null ? this.inputElement.maxLength = parseInt(o, 10) : this.inputElement.removeAttribute("maxlength");
|
|
337
|
+
this.minLength >= 0 ? this.inputElement.minLength = this.minLength : this.inputElement.removeAttribute("minlength"), this.maxLength >= 0 ? this.inputElement.maxLength = this.maxLength : this.inputElement.removeAttribute("maxlength");
|
|
340
338
|
const r = this.getAttribute("pattern");
|
|
341
339
|
r !== null ? this.inputElement.pattern = r : this.inputElement.removeAttribute("pattern"), this.internals.setFormValue(this.inputElement.value);
|
|
342
|
-
const
|
|
343
|
-
this.inputElement.disabled =
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
const
|
|
340
|
+
const o = this.hasAttribute("disabled") || this._formDisabled, n = this.hasAttribute("readonly");
|
|
341
|
+
this.inputElement.disabled = o, this.inputElement.readOnly = n, o ? this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled") : this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");
|
|
342
|
+
const u = e === "password" || this.hasAttribute("alternar-senha");
|
|
343
|
+
L(this.rightIconContainer, u, this._senhaVisivel);
|
|
344
|
+
const l = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|
|
347
345
|
z(
|
|
348
346
|
this.wrapperElement,
|
|
349
347
|
this.inputElement,
|
|
350
348
|
this.helperElement,
|
|
351
|
-
|
|
349
|
+
l,
|
|
352
350
|
this.getAttribute("mensagem-erro"),
|
|
353
351
|
this.getAttribute("helper-text")
|
|
354
|
-
), this.atualizarValidade();
|
|
352
|
+
), this.helperElement.style.display === "none" ? this.inputElement.removeAttribute("aria-describedby") : this.inputElement.setAttribute("aria-describedby", this.helperElement.id), this.required ? this.inputElement.setAttribute("aria-required", "true") : this.inputElement.removeAttribute("aria-required"), this.atualizarValidade();
|
|
355
353
|
}
|
|
356
354
|
/**
|
|
357
355
|
* Sem o atributo `label`, o input nativo herda o nome acessível de fora do Shadow DOM
|
|
@@ -362,18 +360,18 @@ class b extends d {
|
|
|
362
360
|
t ? this.inputElement.setAttribute("aria-label", t) : this.inputElement.removeAttribute("aria-label");
|
|
363
361
|
}
|
|
364
362
|
}
|
|
365
|
-
class T extends
|
|
363
|
+
class T extends d {
|
|
366
364
|
}
|
|
367
|
-
|
|
368
|
-
|
|
365
|
+
p("ui-campo-texto", d);
|
|
366
|
+
p("ui-input", T);
|
|
369
367
|
export {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
368
|
+
k as A,
|
|
369
|
+
m as F,
|
|
370
|
+
d as U,
|
|
373
371
|
T as a,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
L as b,
|
|
373
|
+
C as c,
|
|
374
|
+
I as d,
|
|
375
|
+
q as r,
|
|
378
376
|
z as s
|
|
379
377
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";var w=Object.defineProperty;var S=(a,s,t)=>s in a?w(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var i=(a,s,t)=>S(a,typeof s!="symbol"?s+"":s,t);const p=require("./ssr-safe-CiHD1adl.cjs"),V=require("./altura-controle-ukMRPckR.cjs"),C=require("./listener-bag-D5omxZ9h.cjs"),b=require("./opcoes-vdAUY5OI.cjs"),c=require("./acessibilidade-CSzX-DkG.cjs"),g=require("./form-validacao-DIeyQVH5.cjs"),k=require("./form-submissao-DxKO5MHI.cjs"),q=':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;vertical-align:middle}.ui-campo-texto__container{position:relative;width:100%;display:flex;flex-direction:column;justify-content:center}:host([label-flutuante]) .ui-campo-texto__container{margin-top:6px}.ui-campo-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-campo-texto__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px;font-weight:600}.ui-campo-texto__wrapper{position:relative;display:flex;align-items:center;width:100%;height:var(--ui-campo-altura, 34px);min-height:var(--ui-campo-altura, 34px);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);padding:0 8px;gap:6px;box-sizing:border-box;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.ui-campo-texto__wrapper--foco{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-campo-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-campo-texto__wrapper--disabled{opacity:.5;cursor:not-allowed;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-campo-texto__input{flex:1;width:100%;height:100%;min-height:0;background:transparent;border:none;outline:none;color:var(--ui-cor-texto, #e1e1e6);font-family:inherit;font-size:clamp(11px,.85rem,13px);line-height:1.2;padding:0;margin:0;box-sizing:border-box}.ui-campo-texto__input::placeholder{color:var(--ui-cor-texto-secundario, #888899);opacity:.65}.ui-campo-texto__input:disabled{cursor:not-allowed}.ui-campo-texto__icone{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0;font-size:14px;line-height:1;max-height:100%}.ui-campo-texto__icone svg,.ui-campo-texto__icone ::slotted(svg),.ui-campo-texto__icone ::slotted(ui-icone){shape-rendering:geometricPrecision;display:inline-flex;vertical-align:middle}.ui-campo-texto__icone--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none;transition:opacity .15s ease,transform .15s ease}.ui-campo-texto__icone--clicavel:hover{opacity:.85;transform:scale(1.1)}:host([label-flutuante]) .ui-campo-texto__label{position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:12px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;z-index:3;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);padding:0 4px;border-radius:3px;margin-bottom:0;white-space:nowrap;max-width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;transition:top .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1),color .15s ease,font-size .15s ease}:host([label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label{left:28px}:host([label-flutuante]) .ui-campo-texto__label--ativa{top:-8px;left:8px!important;transform:translateY(0) scale(.85);transform-origin:left top;font-weight:600;color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}:host([label-flutuante][erro]) .ui-campo-texto__label--ativa,:host([label-flutuante][mensagem-erro]) .ui-campo-texto__label--ativa{color:var(--ui-cor-texto-erro, #ff5555)}.ui-campo-texto__helper{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-campo-texto__helper--erro{color:var(--ui-cor-texto-erro, #ff5555);font-weight:500;display:flex;align-items:center;gap:4px}.ui-campo-texto__wrapper{touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-campo-texto__input{touch-action:manipulation}@media (max-width: 640px),(pointer: coarse) and (max-width: 1024px){.ui-campo-texto__input{font-size:16px!important}:host(:not([inline])) .ui-campo-texto__wrapper{min-height:max(var(--ui-campo-altura, 38px),38px);padding:0 10px}.ui-campo-texto__label{font-size:13px}.ui-campo-texto__icone--clicavel{min-width:32px;min-height:32px}}',x=["label","placeholder","value","tipo","type","obrigatorio","required","minlength","min-length","maxlength","max-length","pattern","min","max","step","mensagem-validacao","helper-text","erro","mensagem-erro","disabled","readonly","label-flutuante","alternar-senha","tamanho","size","altura","height","densidade","aria-label"];function f(){return`
|
|
2
|
+
<style>${q}</style>
|
|
3
|
+
<div class="ui-campo-texto__container">
|
|
4
|
+
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
5
|
+
<div class="ui-campo-texto__wrapper" part="campo">
|
|
6
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--esquerda" part="icone icone-esquerda">
|
|
7
|
+
<slot name="icone-esquerda"></slot>
|
|
8
|
+
</span>
|
|
9
|
+
<input class="ui-campo-texto__input" part="input" type="text" />
|
|
10
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--direita" part="icone icone-direita">
|
|
11
|
+
<slot name="icone-direita"></slot>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ui-campo-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
16
|
+
`}function _(a,s,t,e){if(a.textContent=s,!t)return;const r=document.createElement("span");r.className=e,r.setAttribute("aria-hidden","true"),r.textContent="*",a.append(" ",r)}function v(a){const{labelElement:s,inputElement:t,labelText:e,placeholderText:r,isFlutuante:o,estaFocado:n,obrigatorio:u}=a,l=t.value.trim()!=="";let h=!1;try{h=t.matches(":-webkit-autofill")}catch{h=!1}e?(_(s,e,!!u,"ui-campo-texto__asterisco"),s.style.display="flex",o&&(n||l||h)?s.classList.add("ui-campo-texto__label--ativa"):s.classList.remove("ui-campo-texto__label--ativa")):s.style.display="none",o&&!n&&!l&&!h?t.placeholder="":t.placeholder=r}function E(a,s,t){s?(a.classList.add("ui-campo-texto__icone--clicavel"),a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",t?"Ocultar senha":"Exibir senha")):(a.classList.remove("ui-campo-texto__icone--clicavel"),a.removeAttribute("role"),a.removeAttribute("tabindex"),a.removeAttribute("aria-label"))}function y(a,s,t,e,r,o,n="ui-campo-texto"){e?(a.classList.add(`${n}__wrapper--erro`),s.setAttribute("aria-invalid","true")):(a.classList.remove(`${n}__wrapper--erro`),s.removeAttribute("aria-invalid")),e&&r?(t.textContent=`⚠️ ${r}`,t.className=`${n}__helper ${n}__helper--erro`,t.style.display="block"):o?(t.textContent=o,t.className=`${n}__helper`,t.style.display="block"):t.style.display="none"}class m extends p.SafeHTMLElement{constructor(){super();i(this,"internals");i(this,"_formDisabled",!1);i(this,"_customErrorMessage","");this.internals=typeof this.attachInternals=="function"?this.attachInternals():{}}formDisabledCallback(t){this._formDisabled=t,this.syncState()}get form(){var t;return this.closest("form")??((t=this.internals)==null?void 0:t.form)??null}get required(){return this.hasAttribute("obrigatorio")||this.hasAttribute("required")}set required(t){t?this.setAttribute("obrigatorio",""):(this.removeAttribute("obrigatorio"),this.removeAttribute("required")),this.syncState()}get obrigatorio(){return this.required}set obrigatorio(t){this.required=t}get validity(){var t;return this.atualizarValidade(),(t=this.internals)==null?void 0:t.validity}get validationMessage(){var t;return this.atualizarValidade(),((t=this.internals)==null?void 0:t.validationMessage)??""}get willValidate(){var t;return((t=this.internals)==null?void 0:t.willValidate)??!1}checkValidity(){var t,e;return this.atualizarValidade(),((e=(t=this.internals)==null?void 0:t.checkValidity)==null?void 0:e.call(t))??!0}reportValidity(){var t,e;return this.atualizarValidade(),((e=(t=this.internals)==null?void 0:t.reportValidity)==null?void 0:e.call(t))??!0}setCustomValidity(t){this._customErrorMessage=t||"",this.atualizarValidade()}}i(m,"formAssociated",!0);class d extends m{constructor(){super();i(this,"labelElement");i(this,"wrapperElement");i(this,"inputElement");i(this,"helperElement");i(this,"rightIconContainer");i(this,"leftSlotElement");i(this,"_senhaVisivel",!1);i(this,"listeners",new C.ListenerBag);i(this,"_checkTimer",null);i(this,"_focado",!1);i(this,"_inputId");i(this,"_defaultValue","");i(this,"handleSlotChange",()=>{this.syncState()});i(this,"handleHostClick",t=>{c.cliqueVeioDeRotuloExterno(this,t)&&!this.disabled&&this.inputElement.focus()});i(this,"handleRightIconClick",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleRightIconKeyDown",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleFocus",()=>{this._focado=!0,this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"),this.syncState()});i(this,"handleBlur",()=>{this._focado=!1,this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"),this.syncState()});i(this,"handleKeyDown",t=>{if(t.key!=="Enter"||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;const e=this.form;e&&setTimeout(()=>{!t.defaultPrevented&&this.isConnected&&k.submeterImplicitamente(e)})});i(this,"handleInput",t=>{t.stopPropagation();const e=t.target.value;this.internals.setFormValue(e),this.syncState(),this.dispatchEvent(new CustomEvent("ui-input",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))});i(this,"handleChange",t=>{t.stopPropagation();const e=t.target.value;this.internals.setFormValue(e),this.syncState(),this.dispatchEvent(new CustomEvent("ui-change",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))});const t=this.attachShadow({mode:"open",delegatesFocus:!0});t.innerHTML=f(),this.labelElement=t.querySelector(".ui-campo-texto__label"),this.wrapperElement=t.querySelector(".ui-campo-texto__wrapper"),this.inputElement=t.querySelector(".ui-campo-texto__input"),this.helperElement=t.querySelector(".ui-campo-texto__helper"),this.rightIconContainer=t.querySelector(".ui-campo-texto__icone--direita"),this.leftSlotElement=t.querySelector('slot[name="icone-esquerda"]'),this._inputId=c.gerarIdUnico("ui-input"),this.inputElement.id=this._inputId,this.labelElement.htmlFor=this._inputId,this.helperElement.id=`${this._inputId}-helper`}static get observedAttributes(){return x}focus(t){this.inputElement.focus(t)}blur(){this.inputElement.blur()}connectedCallback(){this.listeners.cleanup(),this.listeners.add(this.inputElement,"input",this.handleInput),this.listeners.add(this.inputElement,"change",this.handleChange),this.listeners.add(this.inputElement,"focus",this.handleFocus),this.listeners.add(this.inputElement,"blur",this.handleBlur),this.listeners.add(this.inputElement,"keydown",this.handleKeyDown),this.listeners.add(this.rightIconContainer,"click",this.handleRightIconClick),this.listeners.add(this.rightIconContainer,"keydown",this.handleRightIconKeyDown),this.listeners.add(this.leftSlotElement,"slotchange",this.handleSlotChange),this.listeners.add(this,"click",this.handleHostClick),this._defaultValue=this.getAttribute("value")||"",this.hasAttribute("value")&&!this.inputElement.value&&(this.inputElement.value=this._defaultValue),this.syncState(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=setTimeout(()=>this.syncState(),100)}disconnectedCallback(){this.listeners.cleanup(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=null}attributeChangedCallback(t,e,r){t==="value"&&r!==this.inputElement.value&&!this._focado&&(this.inputElement.value=r||""),this.syncState()}get value(){return this.inputElement?this.inputElement.value:this.getAttribute("value")||""}set value(t){if(this.setAttribute("value",t),this.inputElement)try{this.inputElement.value=t}catch{}this.syncState()}formResetCallback(){var t;this.inputElement.value=this._defaultValue,(t=this.internals)==null||t.setFormValue(this._defaultValue),this.syncState()}formStateRestoreCallback(t,e){typeof t=="string"&&(this.value=t)}get name(){return this.getAttribute("name")||""}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("tipo")||this.getAttribute("type")||"text"}get disabled(){return this.hasAttribute("disabled")||this._formDisabled}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get minLength(){return b.inteiroOuNulo(this.getAttribute("minlength")??this.getAttribute("min-length"))??-1}set minLength(t){t>=0?this.setAttribute("minlength",String(t)):this.removeAttribute("minlength"),this.syncState()}get maxLength(){return b.inteiroOuNulo(this.getAttribute("maxlength")??this.getAttribute("max-length"))??-1}set maxLength(t){t>=0?this.setAttribute("maxlength",String(t)):this.removeAttribute("maxlength"),this.syncState()}get pattern(){return this.getAttribute("pattern")||""}set pattern(t){t?this.setAttribute("pattern",t):this.removeAttribute("pattern"),this.syncState()}atualizarValidade(){var l,h;const t=this.getAttribute("min"),e=this.getAttribute("max"),r=this.inputElement?this.inputElement.value:"",o=this.getAttribute("value")||r,n=!!((h=(l=this.inputElement)==null?void 0:l.validity)!=null&&h.badInput),u=g.validarRestricoesCampoTexto({val:r,rawVal:o,badInput:n,disabled:this.disabled,required:this.required,tipo:this.type,minlength:this.minLength>=0?this.minLength:null,maxlength:this.maxLength>=0?this.maxLength:null,min:t!==null?parseFloat(t):null,max:e!==null?parseFloat(e):null,step:this.getAttribute("step"),pattern:this.getAttribute("pattern"),customError:this._customErrorMessage,mensagemValidacao:this.getAttribute("mensagem-validacao")});g.aplicarValidadeInternals(this.internals,u,this.inputElement)}alternarVisibilidadeSenha(){var r;if(!(this.getAttribute("tipo")==="password"||this._senhaVisivel))return;this._senhaVisivel=!this._senhaVisivel,this.inputElement.type=this._senhaVisivel?"text":"password";const e=(r=this.shadowRoot)==null?void 0:r.querySelector('slot[name="icone-direita"]');e&&e.assignedElements().forEach(n=>{var u,l;(((u=n.textContent)==null?void 0:u.trim())==="👁️"||((l=n.textContent)==null?void 0:l.trim())==="🙈")&&(n.textContent=this._senhaVisivel?"🙈":"👁️")}),this.dispatchEvent(new CustomEvent("ui-toggle-senha",{detail:{visivel:this._senhaVisivel},bubbles:!0,composed:!0}))}syncState(){this.leftSlotElement.assignedNodes().length>0||this.querySelector('[slot="icone-esquerda"]')!==null?this.setAttribute("tem-icone-esquerda",""):this.removeAttribute("tem-icone-esquerda"),V.aplicarAlturaControle(this),v({labelElement:this.labelElement,inputElement:this.inputElement,labelText:this.getAttribute("label"),placeholderText:this.getAttribute("placeholder")||"",isFlutuante:this.hasAttribute("label-flutuante"),estaFocado:this._focado,obrigatorio:this.required}),this.sincronizarNomeAcessivel();const e=this.getAttribute("tipo")||this.getAttribute("type")||"text";if(!this._senhaVisivel)try{this.inputElement.type=e}catch{this.inputElement.type="text"}this.minLength>=0?this.inputElement.minLength=this.minLength:this.inputElement.removeAttribute("minlength"),this.maxLength>=0?this.inputElement.maxLength=this.maxLength:this.inputElement.removeAttribute("maxlength");const r=this.getAttribute("pattern");r!==null?this.inputElement.pattern=r:this.inputElement.removeAttribute("pattern"),this.internals.setFormValue(this.inputElement.value);const o=this.hasAttribute("disabled")||this._formDisabled,n=this.hasAttribute("readonly");this.inputElement.disabled=o,this.inputElement.readOnly=n,o?this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled"):this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");const u=e==="password"||this.hasAttribute("alternar-senha");E(this.rightIconContainer,u,this._senhaVisivel);const l=this.hasAttribute("erro")||this.hasAttribute("mensagem-erro");y(this.wrapperElement,this.inputElement,this.helperElement,l,this.getAttribute("mensagem-erro"),this.getAttribute("helper-text")),this.helperElement.style.display==="none"?this.inputElement.removeAttribute("aria-describedby"):this.inputElement.setAttribute("aria-describedby",this.helperElement.id),this.required?this.inputElement.setAttribute("aria-required","true"):this.inputElement.removeAttribute("aria-required"),this.atualizarValidade()}sincronizarNomeAcessivel(){const t=this.getAttribute("label")?"":c.obterRotuloExterno(this,this.internals);t?this.inputElement.setAttribute("aria-label",t):this.inputElement.removeAttribute("aria-label")}}class A extends d{}p.definirCustomElement("ui-campo-texto",d);p.definirCustomElement("ui-input",A);exports.ATRIBUTOS_OBSERVADOS_CAMPO_TEXTO=x;exports.FormAssociatedElement=m;exports.UICampoTexto=d;exports.UIInput=A;exports.criarTemplateCampoTexto=f;exports.renderizarRotulo=_;exports.sincronizarFeedbackErro=y;exports.sincronizarIconeSenha=E;exports.sincronizarLabelEPlaceholder=v;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";var E=Object.defineProperty;var A=(t,i,e)=>i in t?E(t,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[i]=e;var s=(t,i,e)=>A(t,typeof i!="symbol"?i+"":i,e);const _=require("./listener-bag-D5omxZ9h.cjs"),g=require("./ssr-safe-CiHD1adl.cjs"),f=require("./opcoes-vdAUY5OI.cjs"),w=':host{display:block;width:100%;box-sizing:border-box}:host([hidden]){display:none}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--clicavel:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-color:var(--ui-cor-primaria, #00E08A)}@media (prefers-reduced-motion: reduce){.ui-card{transition:none}.ui-card--clicavel:hover,.ui-card--clicavel:active{transform:none}}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}',k=["button","a","input","select","textarea","label","summary","ui-botao","ui-switch","ui-checkbox","ui-radio","ui-campo-texto","ui-segmented",'[contenteditable]:not([contenteditable="false"])','[role="button"]','[role="link"]','[role="checkbox"]','[role="switch"]','[role="menuitem"]'].join(", ");function C(t,i){if(typeof Element>"u"||!(t instanceof Element))return!1;const e=t.closest(k);return e!==null&&e!==i&&i.contains(e)}function S(t,i){return t.key!=="Enter"&&t.key!==" "||t.repeat||t.ctrlKey||t.altKey||t.metaKey?!1:t.target===i}function q(t,i,e){return Array.from(i.children).some(r=>e.includes(r.getAttribute("slot")??""))?!0:t?Array.from(t.querySelectorAll("slot")).filter(r=>e.includes(r.name)).some(r=>r.assignedNodes({flatten:!0}).some(o=>o.nodeType===1||o.nodeType===3&&(o.textContent??"").trim()!=="")):!1}const x=["plano","elevado","destaque"];class y extends g.SafeHTMLElement{constructor(){super();s(this,"cardElement");s(this,"listeners",new _.ListenerBag);s(this,"handleSlotChange",()=>{this.syncState()});s(this,"handleClick",e=>{this.disabled||!this.clicavel||e&&C(e.target,this)||this.emitirClique()});s(this,"handleKeyDown",e=>{!this.clicavel||this.disabled||!S(e,this.cardElement)||(e.preventDefault(),this.emitirClique())});const e=this.attachShadow({mode:"open"});e.innerHTML=`
|
|
2
|
+
<style>${w}</style>
|
|
3
|
+
<div class="ui-card" part="base">
|
|
4
|
+
<div class="ui-card__media" part="midia">
|
|
5
|
+
<slot name="midia"></slot>
|
|
6
|
+
<slot name="media"></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="ui-card__header" part="cabecalho">
|
|
9
|
+
<slot name="cabecalho"></slot>
|
|
10
|
+
<slot name="header"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="ui-card__body" part="corpo">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ui-card__footer" part="rodape">
|
|
16
|
+
<slot name="rodape"></slot>
|
|
17
|
+
<slot name="footer"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`,this.cardElement=e.querySelector(".ui-card")}static get observedAttributes(){return["elevacao","elevation","variante","variant","clicavel","clickable","compacto","compact","disabled","aria-label"]}connectedCallback(){var a;this.listeners.cleanup(),this.listeners.add(this.cardElement,"click",this.handleClick),this.listeners.add(this.cardElement,"keydown",this.handleKeyDown);const e=(a=this.shadowRoot)==null?void 0:a.querySelectorAll("slot");e==null||e.forEach(l=>this.listeners.add(l,"slotchange",this.handleSlotChange)),this.syncState()}disconnectedCallback(){this.listeners.cleanup()}attributeChangedCallback(e,a,l){this.syncState()}focus(e){this.clicavel&&!this.disabled?this.cardElement.focus(e):super.focus(e)}get clicavel(){return this.hasAttribute("clicavel")||this.hasAttribute("clickable")}set clicavel(e){e?this.setAttribute("clicavel",""):(this.removeAttribute("clicavel"),this.removeAttribute("clickable")),this.syncState()}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.syncState()}syncState(){var b,m,p,v;const e=f.escolherOpcao(this.getAttribute("elevacao")||this.getAttribute("elevation"),x,"plano"),a=f.escolherOpcaoOpcional(this.getAttribute("variante")||this.getAttribute("variant"),x),l=this.clicavel,r=this.hasAttribute("compacto")||this.hasAttribute("compact"),o=this.disabled;if(this.cardElement.className="ui-card",this.cardElement.classList.add(`ui-card--${e}`),a&&this.cardElement.classList.add(`ui-card--${a}`),l){this.cardElement.classList.add("ui-card--clicavel"),this.cardElement.setAttribute("role","button"),this.cardElement.setAttribute("tabindex",o?"-1":"0");const c=(b=this.getAttribute("aria-label"))==null?void 0:b.trim();c?this.cardElement.setAttribute("aria-label",c):this.cardElement.removeAttribute("aria-label")}else this.cardElement.removeAttribute("role"),this.cardElement.removeAttribute("tabindex"),this.cardElement.removeAttribute("aria-label");o?this.cardElement.setAttribute("aria-disabled","true"):this.cardElement.removeAttribute("aria-disabled"),r&&this.cardElement.classList.add("ui-card--compacto"),o&&this.cardElement.classList.add("ui-card--disabled");const n=(m=this.shadowRoot)==null?void 0:m.querySelector(".ui-card__header"),u=(p=this.shadowRoot)==null?void 0:p.querySelector(".ui-card__footer"),h=(v=this.shadowRoot)==null?void 0:v.querySelector(".ui-card__media"),d=c=>q(this.shadowRoot,this,c);h&&(h.style.display=d(["midia","media"])?"block":"none"),n&&(n.style.display=d(["cabecalho","header"])?"flex":"none"),u&&(u.style.display=d(["rodape","footer"])?"flex":"none")}emitirClique(){const e={id:this.id||"sem-id"};this.dispatchEvent(new CustomEvent("ui-click",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("ui-clique",{detail:{...e},bubbles:!0,composed:!0}))}}g.definirCustomElement("ui-card",y);exports.UICard=y;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var g = (t, i, e) => i in t ? x(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e;
|
|
3
|
+
var s = (t, i, e) => g(t, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { L as y } from "./listener-bag-DQgv7OON.js";
|
|
5
|
+
import { d as E, S as A } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
+
import { e as _, a as w } from "./opcoes-CupvWVIm.js";
|
|
7
|
+
const k = ':host{display:block;width:100%;box-sizing:border-box}:host([hidden]){display:none}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}@media (hover: hover){.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--clicavel:focus-visible{outline:2px solid var(--ui-cor-primaria, #00E08A);outline-offset:2px;border-color:var(--ui-cor-primaria, #00E08A)}@media (prefers-reduced-motion: reduce){.ui-card{transition:none}.ui-card--clicavel:hover,.ui-card--clicavel:active{transform:none}}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}', C = [
|
|
8
|
+
"button",
|
|
9
|
+
"a",
|
|
10
|
+
"input",
|
|
11
|
+
"select",
|
|
12
|
+
"textarea",
|
|
13
|
+
"label",
|
|
14
|
+
"summary",
|
|
15
|
+
"ui-botao",
|
|
16
|
+
"ui-switch",
|
|
17
|
+
"ui-checkbox",
|
|
18
|
+
"ui-radio",
|
|
19
|
+
"ui-campo-texto",
|
|
20
|
+
"ui-segmented",
|
|
21
|
+
'[contenteditable]:not([contenteditable="false"])',
|
|
22
|
+
'[role="button"]',
|
|
23
|
+
'[role="link"]',
|
|
24
|
+
'[role="checkbox"]',
|
|
25
|
+
'[role="switch"]',
|
|
26
|
+
'[role="menuitem"]'
|
|
27
|
+
].join(", ");
|
|
28
|
+
function S(t, i) {
|
|
29
|
+
if (typeof Element > "u" || !(t instanceof Element)) return !1;
|
|
30
|
+
const e = t.closest(C);
|
|
31
|
+
return e !== null && e !== i && i.contains(e);
|
|
32
|
+
}
|
|
33
|
+
function q(t, i) {
|
|
34
|
+
return t.key !== "Enter" && t.key !== " " || t.repeat || t.ctrlKey || t.altKey || t.metaKey ? !1 : t.target === i;
|
|
35
|
+
}
|
|
36
|
+
function L(t, i, e) {
|
|
37
|
+
return Array.from(i.children).some((r) => e.includes(r.getAttribute("slot") ?? "")) ? !0 : t ? Array.from(t.querySelectorAll("slot")).filter((r) => e.includes(r.name)).some(
|
|
38
|
+
(r) => r.assignedNodes({ flatten: !0 }).some(
|
|
39
|
+
(o) => o.nodeType === 1 || o.nodeType === 3 && (o.textContent ?? "").trim() !== ""
|
|
40
|
+
)
|
|
41
|
+
) : !1;
|
|
42
|
+
}
|
|
43
|
+
const f = ["plano", "elevado", "destaque"];
|
|
44
|
+
class O extends A {
|
|
45
|
+
constructor() {
|
|
46
|
+
super();
|
|
47
|
+
s(this, "cardElement");
|
|
48
|
+
s(this, "listeners", new y());
|
|
49
|
+
s(this, "handleSlotChange", () => {
|
|
50
|
+
this.syncState();
|
|
51
|
+
});
|
|
52
|
+
s(this, "handleClick", (e) => {
|
|
53
|
+
this.disabled || !this.clicavel || e && S(e.target, this) || this.emitirClique();
|
|
54
|
+
});
|
|
55
|
+
s(this, "handleKeyDown", (e) => {
|
|
56
|
+
!this.clicavel || this.disabled || !q(e, this.cardElement) || (e.preventDefault(), this.emitirClique());
|
|
57
|
+
});
|
|
58
|
+
const e = this.attachShadow({ mode: "open" });
|
|
59
|
+
e.innerHTML = `
|
|
60
|
+
<style>${k}</style>
|
|
61
|
+
<div class="ui-card" part="base">
|
|
62
|
+
<div class="ui-card__media" part="midia">
|
|
63
|
+
<slot name="midia"></slot>
|
|
64
|
+
<slot name="media"></slot>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="ui-card__header" part="cabecalho">
|
|
67
|
+
<slot name="cabecalho"></slot>
|
|
68
|
+
<slot name="header"></slot>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="ui-card__body" part="corpo">
|
|
71
|
+
<slot></slot>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="ui-card__footer" part="rodape">
|
|
74
|
+
<slot name="rodape"></slot>
|
|
75
|
+
<slot name="footer"></slot>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`, this.cardElement = e.querySelector(".ui-card");
|
|
79
|
+
}
|
|
80
|
+
static get observedAttributes() {
|
|
81
|
+
return [
|
|
82
|
+
"elevacao",
|
|
83
|
+
"elevation",
|
|
84
|
+
"variante",
|
|
85
|
+
"variant",
|
|
86
|
+
"clicavel",
|
|
87
|
+
"clickable",
|
|
88
|
+
"compacto",
|
|
89
|
+
"compact",
|
|
90
|
+
"disabled",
|
|
91
|
+
"aria-label"
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
connectedCallback() {
|
|
95
|
+
var a;
|
|
96
|
+
this.listeners.cleanup(), this.listeners.add(this.cardElement, "click", this.handleClick), this.listeners.add(this.cardElement, "keydown", this.handleKeyDown);
|
|
97
|
+
const e = (a = this.shadowRoot) == null ? void 0 : a.querySelectorAll("slot");
|
|
98
|
+
e == null || e.forEach((l) => this.listeners.add(l, "slotchange", this.handleSlotChange)), this.syncState();
|
|
99
|
+
}
|
|
100
|
+
disconnectedCallback() {
|
|
101
|
+
this.listeners.cleanup();
|
|
102
|
+
}
|
|
103
|
+
attributeChangedCallback(e, a, l) {
|
|
104
|
+
this.syncState();
|
|
105
|
+
}
|
|
106
|
+
/** Leva o foco ao card clicável e habilitado; nos demais casos mantém o comportamento nativo do host. */
|
|
107
|
+
focus(e) {
|
|
108
|
+
this.clicavel && !this.disabled ? this.cardElement.focus(e) : super.focus(e);
|
|
109
|
+
}
|
|
110
|
+
get clicavel() {
|
|
111
|
+
return this.hasAttribute("clicavel") || this.hasAttribute("clickable");
|
|
112
|
+
}
|
|
113
|
+
set clicavel(e) {
|
|
114
|
+
e ? this.setAttribute("clicavel", "") : (this.removeAttribute("clicavel"), this.removeAttribute("clickable")), this.syncState();
|
|
115
|
+
}
|
|
116
|
+
get disabled() {
|
|
117
|
+
return this.hasAttribute("disabled");
|
|
118
|
+
}
|
|
119
|
+
set disabled(e) {
|
|
120
|
+
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
121
|
+
}
|
|
122
|
+
syncState() {
|
|
123
|
+
var b, m, p, v;
|
|
124
|
+
const e = _(this.getAttribute("elevacao") || this.getAttribute("elevation"), f, "plano"), a = w(this.getAttribute("variante") || this.getAttribute("variant"), f), l = this.clicavel, r = this.hasAttribute("compacto") || this.hasAttribute("compact"), o = this.disabled;
|
|
125
|
+
if (this.cardElement.className = "ui-card", this.cardElement.classList.add(`ui-card--${e}`), a && this.cardElement.classList.add(`ui-card--${a}`), l) {
|
|
126
|
+
this.cardElement.classList.add("ui-card--clicavel"), this.cardElement.setAttribute("role", "button"), this.cardElement.setAttribute("tabindex", o ? "-1" : "0");
|
|
127
|
+
const c = (b = this.getAttribute("aria-label")) == null ? void 0 : b.trim();
|
|
128
|
+
c ? this.cardElement.setAttribute("aria-label", c) : this.cardElement.removeAttribute("aria-label");
|
|
129
|
+
} else
|
|
130
|
+
this.cardElement.removeAttribute("role"), this.cardElement.removeAttribute("tabindex"), this.cardElement.removeAttribute("aria-label");
|
|
131
|
+
o ? this.cardElement.setAttribute("aria-disabled", "true") : this.cardElement.removeAttribute("aria-disabled"), r && this.cardElement.classList.add("ui-card--compacto"), o && this.cardElement.classList.add("ui-card--disabled");
|
|
132
|
+
const n = (m = this.shadowRoot) == null ? void 0 : m.querySelector(".ui-card__header"), u = (p = this.shadowRoot) == null ? void 0 : p.querySelector(".ui-card__footer"), h = (v = this.shadowRoot) == null ? void 0 : v.querySelector(".ui-card__media"), d = (c) => L(this.shadowRoot, this, c);
|
|
133
|
+
h && (h.style.display = d(["midia", "media"]) ? "block" : "none"), n && (n.style.display = d(["cabecalho", "header"]) ? "flex" : "none"), u && (u.style.display = d(["rodape", "footer"]) ? "flex" : "none");
|
|
134
|
+
}
|
|
135
|
+
emitirClique() {
|
|
136
|
+
const e = { id: this.id || "sem-id" };
|
|
137
|
+
this.dispatchEvent(new CustomEvent("ui-click", { detail: e, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("ui-clique", { detail: { ...e }, bubbles: !0, composed: !0 }));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
E("ui-card", O);
|
|
141
|
+
export {
|
|
142
|
+
O as U
|
|
143
|
+
};
|