@thibezer/ui-components-kit 2.17.0 → 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.
Files changed (127) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/camadas.cjs +85 -86
  3. package/dist/camadas.js +1380 -1331
  4. package/dist/components/ui-camadas/camadas-colecao.d.ts +3 -0
  5. package/dist/components/ui-camadas/camadas-drag-drop.d.ts +3 -1
  6. package/dist/components/ui-camadas/camadas-selecao-api.d.ts +1 -0
  7. package/dist/cores.cjs +1 -1
  8. package/dist/cores.js +2 -2
  9. package/dist/custom-elements.json +19922 -19922
  10. package/dist/index.cjs +1 -1
  11. package/dist/index.js +2 -2
  12. package/dist/register.cjs +1 -1
  13. package/dist/register.js +2 -2
  14. package/dist/{ui-controle-cores-Bq_XUrIQ.cjs → ui-controle-cores-B1w_Yl69.cjs} +1 -1
  15. package/dist/{ui-controle-cores-BtA6yzu3.js → ui-controle-cores-BRjMvmMn.js} +1 -1
  16. package/dist/ui-seletor-cor-CMuuW-Ym.cjs +83 -0
  17. package/dist/ui-seletor-cor-DFIQ1sin.js +405 -0
  18. package/package.json +1 -1
  19. package/dist/form-validacao-BIOXxt-1.js +0 -140
  20. package/dist/form-validacao-ytRYSF3E.cjs +0 -1
  21. package/dist/gerencigeo-canvas/layer_defaults.d.ts +0 -3
  22. package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +0 -6
  23. package/dist/gerencigeo-canvas/layer_state_ops.d.ts +0 -6
  24. package/dist/leaflet-DcO7uRC-.cjs +0 -1
  25. package/dist/leaflet-PPDKB6Dd.js +0 -69
  26. package/dist/motor-BCWqlv3e.cjs +0 -1
  27. package/dist/motor-CXjQjVba.js +0 -1386
  28. package/dist/svg-seguro-BsbNQqpd.js +0 -50
  29. package/dist/svg-seguro-C76iLlAZ.cjs +0 -1
  30. package/dist/ui-badge-1UU8vT-b.js +0 -198
  31. package/dist/ui-badge-B5J_c5P5.js +0 -197
  32. package/dist/ui-badge-BxT-sDmV.cjs +0 -28
  33. package/dist/ui-badge-C0eKBI8E.js +0 -183
  34. package/dist/ui-badge-CKKKPdt8.cjs +0 -28
  35. package/dist/ui-badge-DC4y6Dik.cjs +0 -28
  36. package/dist/ui-botao-BOOnP8ds.cjs +0 -12
  37. package/dist/ui-botao-D24oXySA.cjs +0 -12
  38. package/dist/ui-botao-DfqSivHl.js +0 -165
  39. package/dist/ui-botao-Dsj08jjw.js +0 -165
  40. package/dist/ui-botao-OGJV6Vfk.js +0 -165
  41. package/dist/ui-botao-bU_bf6SU.js +0 -166
  42. package/dist/ui-botao-psS1juof.cjs +0 -12
  43. package/dist/ui-botao-xTbH5mpH.cjs +0 -12
  44. package/dist/ui-campo-texto-19tIrmBK.js +0 -377
  45. package/dist/ui-campo-texto-CH8mzX61.cjs +0 -16
  46. package/dist/ui-campo-texto-Cnn2UAkS.cjs +0 -16
  47. package/dist/ui-campo-texto-DVU_sWV1.cjs +0 -16
  48. package/dist/ui-campo-texto-Uu2dJE_0.js +0 -379
  49. package/dist/ui-campo-texto-W5M0gNE4.js +0 -377
  50. package/dist/ui-card-0wu4rjEX.cjs +0 -20
  51. package/dist/ui-card-B86lJXTP.cjs +0 -20
  52. package/dist/ui-card-BYyYxxY1.cjs +0 -20
  53. package/dist/ui-card-C_o5_0cB.js +0 -111
  54. package/dist/ui-card-CojoGXaT.js +0 -144
  55. package/dist/ui-card-DRtpOo3l.js +0 -143
  56. package/dist/ui-controle-cores-B4R6ct4I.js +0 -291
  57. package/dist/ui-controle-cores-BS0WYPdi.js +0 -572
  58. package/dist/ui-controle-cores-C8um-If9.cjs +0 -32
  59. package/dist/ui-controle-cores-CHMKGemo.cjs +0 -141
  60. package/dist/ui-controle-cores-C_cVXxCn.js +0 -291
  61. package/dist/ui-controle-cores-CuDFS8Y8.cjs +0 -32
  62. package/dist/ui-controle-cores-Dog7ERYv.js +0 -697
  63. package/dist/ui-controle-cores-Er6ZcQ7U.cjs +0 -111
  64. package/dist/ui-linha-BxhEBn27.js +0 -749
  65. package/dist/ui-linha-C306zxWG.cjs +0 -19
  66. package/dist/ui-linha-C_azWkcG.js +0 -517
  67. package/dist/ui-linha-CcalUBDw.cjs +0 -38
  68. package/dist/ui-linha-DAz6DBcl.cjs +0 -38
  69. package/dist/ui-linha-DkxwMhD-.js +0 -749
  70. package/dist/ui-modal-4nU-tXjO.cjs +0 -18
  71. package/dist/ui-modal-BkYvNP0G.js +0 -214
  72. package/dist/ui-modal-BwB9fksp.js +0 -214
  73. package/dist/ui-modal-CUNbpbZ1.cjs +0 -18
  74. package/dist/ui-modal-CvGFGh1h.cjs +0 -18
  75. package/dist/ui-modal-DBOtSTbR.js +0 -238
  76. package/dist/ui-paleta-ferramentas-BXXrI1Y7.js +0 -1233
  77. package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
  78. package/dist/ui-paleta-ferramentas-CU4icLl0.js +0 -1171
  79. package/dist/ui-paleta-ferramentas-Ccmo-rB5.cjs +0 -21
  80. package/dist/ui-paleta-ferramentas-CsPMTY0G.cjs +0 -21
  81. package/dist/ui-paleta-ferramentas-DLwZHIDv.cjs +0 -21
  82. package/dist/ui-paleta-ferramentas-DNN5i6nL.js +0 -860
  83. package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
  84. package/dist/ui-paleta-ferramentas-DbwdWVtT.js +0 -1173
  85. package/dist/ui-paleta-ferramentas-bvqxj1Yd.cjs +0 -21
  86. package/dist/ui-segmented-D6b6zxVs.cjs +0 -19
  87. package/dist/ui-segmented-DyF5YLsV.js +0 -418
  88. package/dist/ui-segmented-rn9RxRGM.cjs +0 -19
  89. package/dist/ui-segmented-wUraId2e.js +0 -412
  90. package/dist/ui-seletor-cor-C4U2eqxY.cjs +0 -82
  91. package/dist/ui-seletor-cor-D2_C6Aor.js +0 -391
  92. package/dist/ui-seletor-cor-DPKqf5wb.cjs +0 -82
  93. package/dist/ui-seletor-cor-FYtRccnK.js +0 -396
  94. package/dist/ui-skeleton-B2Rgrv8o.js +0 -648
  95. package/dist/ui-skeleton-DEHwpDqa.js +0 -648
  96. package/dist/ui-skeleton-DI4_9WOX.js +0 -428
  97. package/dist/ui-skeleton-DiOxTBZK.cjs +0 -52
  98. package/dist/ui-skeleton-SPYqku8P.cjs +0 -52
  99. package/dist/ui-skeleton-W9uwIceA.js +0 -585
  100. package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
  101. package/dist/ui-skeleton-sIphhOSx.cjs +0 -52
  102. package/dist/ui-switch-BL-x_-SM.js +0 -1202
  103. package/dist/ui-switch-BcOqOkiV.js +0 -856
  104. package/dist/ui-switch-C0i_3QXu.cjs +0 -66
  105. package/dist/ui-switch-D7iPKDj-.cjs +0 -53
  106. package/dist/ui-switch-DAIgOhqr.cjs +0 -66
  107. package/dist/ui-switch-_F8yubdX.js +0 -1203
  108. package/dist/ui-tabela-propriedades-2bq2nX-b.js +0 -3202
  109. package/dist/ui-tabela-propriedades-8IAYmk3P.cjs +0 -142
  110. package/dist/ui-tabela-propriedades-B8AwlpqL.cjs +0 -141
  111. package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
  112. package/dist/ui-tabela-propriedades-BecPqC-e.cjs +0 -141
  113. package/dist/ui-tabela-propriedades-BoYXzP5Z.js +0 -3191
  114. package/dist/ui-tabela-propriedades-BokvDD3b.js +0 -2648
  115. package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
  116. package/dist/ui-tabela-propriedades-C-PeuW1i.cjs +0 -141
  117. package/dist/ui-tabela-propriedades-C5YYnod1.js +0 -3053
  118. package/dist/ui-tabela-propriedades-CnfW9DZG.cjs +0 -142
  119. package/dist/ui-tabela-propriedades-CyPyKXtB.js +0 -3013
  120. package/dist/ui-tabela-propriedades-DWOKznMN.cjs +0 -142
  121. package/dist/ui-tabela-propriedades-Df9ajC6M.js +0 -2648
  122. package/dist/ui-tabela-propriedades-DqvPilK_.cjs +0 -142
  123. package/dist/ui-tabela-propriedades-DuaC4sFX.js +0 -2767
  124. package/dist/ui-toast-Bp_NlM5G.js +0 -156
  125. package/dist/ui-toast-DGTZKne5.cjs +0 -20
  126. package/dist/zero-js-triggers-C_KrvFOQ.js +0 -244
  127. package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
@@ -1,1203 +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-W5M0gNE4.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 q, e as I } 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}}:host(.squarecircle) .ui-area-texto__wrapper,:host(.squarecircles) .ui-area-texto__wrapper,:host(.ui-squarecircle) .ui-area-texto__wrapper,:host(.ui-squarecircles) .ui-area-texto__wrapper,:host([formato="squarecircle"]) .ui-area-texto__wrapper,:host([formato="squarecircles"]) .ui-area-texto__wrapper,:host([formato="squircle"]) .ui-area-texto__wrapper{border-radius:var(--ui-raio-lg, 10px)}', 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(q(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" : I(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}}:host(.squarecircle) .ui-checkbox__box,:host(.squarecircles) .ui-checkbox__box,:host(.ui-squarecircle) .ui-checkbox__box,:host(.ui-squarecircles) .ui-checkbox__box,:host([formato="squarecircle"]) .ui-checkbox__box,:host([formato="squarecircles"]) .ui-checkbox__box,:host([formato="squircle"]) .ui-checkbox__box{border-radius:var(--ui-raio-squircle, 24%)}';
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
- "formato",
688
- "value",
689
- "label",
690
- "posicao-label",
691
- "name",
692
- "obrigatorio",
693
- "required",
694
- "mensagem-validacao"
695
- ];
696
- }
697
- connectedCallback() {
698
- 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();
699
- }
700
- disconnectedCallback() {
701
- this.listeners.cleanup();
702
- }
703
- attributeChangedCallback(t, e, a) {
704
- this.syncState();
705
- }
706
- get marcado() {
707
- return this.hasAttribute("marcado") || this.hasAttribute("checked");
708
- }
709
- set marcado(t) {
710
- t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked")), this.syncState();
711
- }
712
- get checked() {
713
- return this.marcado;
714
- }
715
- set checked(t) {
716
- this.marcado = t;
717
- }
718
- get value() {
719
- return this.getAttribute("value") || "on";
720
- }
721
- set value(t) {
722
- this.setAttribute("value", t), this.syncState();
723
- }
724
- get name() {
725
- return this.getAttribute("name") || "";
726
- }
727
- set name(t) {
728
- this.setAttribute("name", t), this.syncState();
729
- }
730
- get indeterminado() {
731
- return this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate");
732
- }
733
- set indeterminado(t) {
734
- t ? this.setAttribute("indeterminado", "") : (this.removeAttribute("indeterminado"), this.removeAttribute("indeterminate")), this.syncState();
735
- }
736
- get disabled() {
737
- return this.hasAttribute("disabled") || this._formDisabled;
738
- }
739
- set disabled(t) {
740
- t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
741
- }
742
- get type() {
743
- return "checkbox";
744
- }
745
- atualizarValidade() {
746
- if (!this.internals || typeof this.internals.setValidity != "function") return;
747
- if (this.disabled) {
748
- this.internals.setValidity({});
749
- return;
750
- }
751
- if (this._customErrorMessage) {
752
- this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
753
- return;
754
- }
755
- if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.marcado) {
756
- const e = this.getAttribute("mensagem-validacao") || "Marque esta caixa para continuar.";
757
- this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
758
- return;
759
- }
760
- this.internals.setValidity({});
761
- }
762
- /** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
763
- focus(t) {
764
- this.containerElement.focus(t);
765
- }
766
- alternar() {
767
- this.disabled || (this.indeterminado ? (this.indeterminado = !1, this.marcado = !0) : this.marcado = !this.marcado, this.dispatchEvent(
768
- new CustomEvent("ui-change", {
769
- detail: {
770
- marcado: this.marcado,
771
- indeterminado: this.indeterminado,
772
- value: this.getAttribute("value") || ""
773
- },
774
- bubbles: !0,
775
- composed: !0
776
- })
777
- ), this.dispatchEvent(
778
- new Event("change", {
779
- bubbles: !0,
780
- composed: !0
781
- })
782
- ));
783
- }
784
- syncState() {
785
- const t = this.marcado, e = this.indeterminado, a = this.disabled, r = this.getAttribute("label"), n = this.getAttribute("posicao-label") || "direita";
786
- this.containerElement.setAttribute(
787
- "aria-checked",
788
- e ? "mixed" : String(t)
789
- ), 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 = `
790
- <svg viewBox="0 0 24 24">
791
- <line x1="5" y1="12" x2="19" y2="12"></line>
792
- </svg>
793
- ` : t ? this.markElement.innerHTML = `
794
- <svg viewBox="0 0 24 24">
795
- <polyline points="20 6 9 17 4 12"></polyline>
796
- </svg>
797
- ` : this.markElement.innerHTML = "", x({
798
- host: this,
799
- internals: this.internals,
800
- controle: this.containerElement,
801
- rotulo: this.labelElement,
802
- texto: r
803
- }), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
804
- }
805
- // === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
806
- formResetCallback() {
807
- this.marcado = this._defaultChecked, this.indeterminado = this._defaultIndeterminate, this.syncState();
808
- }
809
- formStateRestoreCallback(t, e) {
810
- typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
811
- }
812
- }
813
- h("ui-checkbox", et);
814
- 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}';
815
- class l {
816
- static getScopeNode(i) {
817
- return i.closest("form") || i.getRootNode() || document;
818
- }
819
- /** Registra (ou re-registra, se o nome ou o escopo mudaram) o radio no grupo do seu nome atual. */
820
- static registrar(i) {
821
- this.desregistrar(i);
822
- const t = i.name;
823
- if (!t) return;
824
- const e = this.getScopeNode(i);
825
- let a = this.registry.get(e);
826
- a || (a = /* @__PURE__ */ new Map(), this.registry.set(e, a));
827
- let r = a.get(t);
828
- r || (r = /* @__PURE__ */ new Set(), a.set(t, r)), r.add(i), this.registros.set(i, { scope: e, nome: t });
829
- }
830
- static desregistrar(i) {
831
- const t = this.registros.get(i);
832
- if (!t) return;
833
- this.registros.delete(i);
834
- const e = this.registry.get(t.scope), a = e == null ? void 0 : e.get(t.nome);
835
- !e || !a || (a.delete(i), a.size === 0 && e.delete(t.nome), e.size === 0 && this.registry.delete(t.scope));
836
- }
837
- /** Radios do mesmo grupo que `radio`, usando o registro (não o nome atual, que pode ainda não ter sido registrado). */
838
- static obterRadiosDoGrupo(i) {
839
- var a;
840
- const t = this.registros.get(i);
841
- if (!t) return [];
842
- const e = (a = this.registry.get(t.scope)) == null ? void 0 : a.get(t.nome);
843
- return e ? Array.from(e) : [];
844
- }
845
- static desmarcarOutros(i) {
846
- this.obterRadiosDoGrupo(i).forEach((t) => {
847
- t !== i && (t.removeAttribute("marcado"), t.removeAttribute("checked"), t.syncState());
848
- });
849
- }
850
- /** Reavalia o tabindex (roving) dos radios; use depois de entrar, sair ou mudar de grupo. */
851
- static atualizarGrupo(i) {
852
- i.forEach((t) => t.atualizarTabindex());
853
- }
854
- static tratarNavegacaoTeclado(i, t) {
855
- if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(i.key)) return;
856
- i.preventDefault();
857
- const e = this.obterRadiosDoGrupo(t).filter((u) => !u.disabled && u.isConnected);
858
- if (e.length <= 1) return;
859
- const a = e.indexOf(t), r = i.key === "ArrowDown" || i.key === "ArrowRight", n = (a + (r ? 1 : -1) + e.length) % e.length;
860
- if (n !== a) {
861
- const u = e[n];
862
- u.selecionar(), u.focus();
863
- }
864
- }
865
- }
866
- s(l, "registry", /* @__PURE__ */ new WeakMap()), s(l, "registros", /* @__PURE__ */ new WeakMap());
867
- class at extends d {
868
- constructor() {
869
- super();
870
- s(this, "containerElement");
871
- s(this, "labelElement");
872
- s(this, "listeners", new b());
873
- s(this, "_defaultChecked", !1);
874
- s(this, "handleClick", (t) => {
875
- t.preventDefault(), this.selecionar(), this.containerElement.focus();
876
- });
877
- s(this, "handleHostClick", (t) => {
878
- p(this, t) && (this.selecionar(), this.containerElement.focus());
879
- });
880
- s(this, "handleKeyDown", (t) => {
881
- t.key === " " || t.key === "Enter" ? (t.preventDefault(), this.selecionar()) : l.tratarNavegacaoTeclado(t, this);
882
- });
883
- s(this, "handleFocus", () => {
884
- this.containerElement.classList.add("ui-radio--foco");
885
- });
886
- s(this, "handleBlur", () => {
887
- this.containerElement.classList.remove("ui-radio--foco");
888
- });
889
- const t = this.attachShadow({ mode: "open" });
890
- t.innerHTML = `
891
- <style>${it}</style>
892
- <div class="ui-radio" part="base" tabindex="0" role="radio" aria-checked="false">
893
- <span class="ui-radio__circle" part="controle">
894
- <span class="ui-radio__dot" part="indicador"></span>
895
- </span>
896
- <span class="ui-radio__label" part="rotulo" style="display: none;"></span>
897
- </div>
898
- `, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label"), this.labelElement.id = m("ui-radio-label");
899
- }
900
- static get observedAttributes() {
901
- return [
902
- "marcado",
903
- "checked",
904
- "name",
905
- "nome",
906
- "disabled",
907
- "value",
908
- "label",
909
- "posicao-label",
910
- "obrigatorio",
911
- "required",
912
- "mensagem-validacao"
913
- ];
914
- }
915
- connectedCallback() {
916
- 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));
917
- }
918
- disconnectedCallback() {
919
- this.listeners.cleanup();
920
- const t = l.obterRadiosDoGrupo(this).filter((e) => e !== this && e.isConnected);
921
- l.desregistrar(this), l.atualizarGrupo(t);
922
- }
923
- attributeChangedCallback(t, e, a) {
924
- if ((t === "name" || t === "nome") && this.isConnected) {
925
- const r = l.obterRadiosDoGrupo(this).filter((n) => n !== this);
926
- l.registrar(this), this.syncState(), l.atualizarGrupo([...r, ...l.obterRadiosDoGrupo(this).filter((n) => n !== this)]);
927
- return;
928
- }
929
- this.syncState();
930
- }
931
- get marcado() {
932
- return this.hasAttribute("marcado") || this.hasAttribute("checked");
933
- }
934
- set marcado(t) {
935
- t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked"));
936
- }
937
- get name() {
938
- return this.getAttribute("name") || this.getAttribute("nome") || "";
939
- }
940
- set name(t) {
941
- this.setAttribute("name", t);
942
- }
943
- get disabled() {
944
- return this.hasAttribute("disabled") || this._formDisabled;
945
- }
946
- set disabled(t) {
947
- t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
948
- }
949
- get type() {
950
- return "radio";
951
- }
952
- atualizarValidade() {
953
- if (!this.internals || typeof this.internals.setValidity != "function") return;
954
- if (this.disabled) {
955
- this.internals.setValidity({});
956
- return;
957
- }
958
- if (this._customErrorMessage) {
959
- this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
960
- return;
961
- }
962
- const t = l.obterRadiosDoGrupo(this);
963
- if ((this.required || t.length > 0 && t.some((a) => a.required)) && !(this.marcado || t.length > 0 && t.some((r) => r.marcado))) {
964
- const r = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
965
- this.internals.setValidity({ valueMissing: !0 }, r, this.containerElement);
966
- return;
967
- }
968
- this.internals.setValidity({});
969
- }
970
- focus(t) {
971
- this.containerElement.focus(t);
972
- }
973
- selecionar() {
974
- this.disabled || this.marcado || (this.marcado = !0, l.desmarcarOutros(this), this.dispatchEvent(
975
- new CustomEvent("ui-change", {
976
- detail: {
977
- marcado: !0,
978
- name: this.name,
979
- value: this.getAttribute("value") || ""
980
- },
981
- bubbles: !0,
982
- composed: !0
983
- })
984
- ), this.dispatchEvent(
985
- new Event("change", {
986
- bubbles: !0,
987
- composed: !0
988
- })
989
- ), l.obterRadiosDoGrupo(this).forEach((t) => t.atualizarValidade()));
990
- }
991
- /**
992
- * Roving tabindex: só um radio do grupo entra na ordem de Tab (o marcado; sem marcado, o primeiro habilitado).
993
- * Isolado de `syncState` para reavaliar os vizinhos sem mexer no valor/validade do formulário.
994
- */
995
- atualizarTabindex() {
996
- if (this.disabled) {
997
- this.containerElement.setAttribute("tabindex", "-1");
998
- return;
999
- }
1000
- const t = l.obterRadiosDoGrupo(this).filter((e) => e.isConnected || e === this);
1001
- if (t.length === 0) {
1002
- this.containerElement.setAttribute("tabindex", "0");
1003
- return;
1004
- }
1005
- if (t.some((e) => e.marcado))
1006
- this.containerElement.setAttribute("tabindex", this.marcado ? "0" : "-1");
1007
- else {
1008
- const e = t.find((a) => !a.disabled);
1009
- this.containerElement.setAttribute("tabindex", e === this ? "0" : "-1");
1010
- }
1011
- }
1012
- syncState() {
1013
- const t = this.marcado, e = this.disabled, a = this.getAttribute("label"), r = this.getAttribute("posicao-label") || "direita";
1014
- 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({
1015
- host: this,
1016
- internals: this.internals,
1017
- controle: this.containerElement,
1018
- rotulo: this.labelElement,
1019
- texto: a
1020
- }), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
1021
- }
1022
- // === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
1023
- formResetCallback() {
1024
- this.marcado = this._defaultChecked, this._defaultChecked ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
1025
- }
1026
- formStateRestoreCallback(t, e) {
1027
- typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
1028
- }
1029
- }
1030
- h("ui-radio", at);
1031
- 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}}';
1032
- class k extends d {
1033
- constructor() {
1034
- super();
1035
- s(this, "containerElement");
1036
- s(this, "labelElement");
1037
- s(this, "labelId");
1038
- s(this, "listeners", new b());
1039
- s(this, "_defaultChecked", !1);
1040
- s(this, "handleClick", (t) => {
1041
- t.preventDefault(), this.alternar();
1042
- });
1043
- s(this, "handleHostClick", (t) => {
1044
- p(this, t) && (this.alternar(), this.containerElement.focus());
1045
- });
1046
- s(this, "handleKeyDown", (t) => {
1047
- (t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
1048
- });
1049
- s(this, "handleFocus", () => {
1050
- this.containerElement.classList.add("ui-switch--foco");
1051
- });
1052
- s(this, "handleBlur", () => {
1053
- this.containerElement.classList.remove("ui-switch--foco");
1054
- });
1055
- const t = this.attachShadow({ mode: "open" });
1056
- t.innerHTML = `
1057
- <style>${st}</style>
1058
- <div class="ui-switch" part="base" tabindex="0" role="switch" aria-checked="false">
1059
- <span class="ui-switch__track" part="controle">
1060
- <span class="ui-switch__thumb" part="indicador"></span>
1061
- </span>
1062
- <span class="ui-switch__label" part="rotulo" style="display: none;"></span>
1063
- </div>
1064
- `, this.containerElement = t.querySelector(".ui-switch"), this.labelElement = t.querySelector(".ui-switch__label"), this.labelId = m("ui-switch-label"), this.labelElement.id = this.labelId;
1065
- }
1066
- static get observedAttributes() {
1067
- return [
1068
- "ativo",
1069
- "ligado",
1070
- "checked",
1071
- "disabled",
1072
- "tamanho",
1073
- "size",
1074
- "label",
1075
- "posicao-label",
1076
- "value",
1077
- "name",
1078
- "obrigatorio",
1079
- "required",
1080
- "mensagem-validacao",
1081
- "aria-label"
1082
- ];
1083
- }
1084
- connectedCallback() {
1085
- 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();
1086
- }
1087
- disconnectedCallback() {
1088
- this.listeners.cleanup();
1089
- }
1090
- attributeChangedCallback(t, e, a) {
1091
- this.syncState();
1092
- }
1093
- get ativo() {
1094
- return this.hasAttribute("ativo") || this.hasAttribute("ligado") || this.hasAttribute("checked");
1095
- }
1096
- set ativo(t) {
1097
- t ? this.setAttribute("ativo", "") : (this.removeAttribute("ativo"), this.removeAttribute("ligado"), this.removeAttribute("checked")), this.syncState();
1098
- }
1099
- get checked() {
1100
- return this.ativo;
1101
- }
1102
- set checked(t) {
1103
- this.ativo = t;
1104
- }
1105
- get value() {
1106
- return this.getAttribute("value") || "on";
1107
- }
1108
- set value(t) {
1109
- this.setAttribute("value", t), this.syncState();
1110
- }
1111
- get name() {
1112
- return this.getAttribute("name") || "";
1113
- }
1114
- set name(t) {
1115
- this.setAttribute("name", t), this.syncState();
1116
- }
1117
- get disabled() {
1118
- return this.hasAttribute("disabled") || this._formDisabled;
1119
- }
1120
- set disabled(t) {
1121
- t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
1122
- }
1123
- get type() {
1124
- return "checkbox";
1125
- }
1126
- atualizarValidade() {
1127
- if (!this.internals || typeof this.internals.setValidity != "function") return;
1128
- if (this.disabled) {
1129
- this.internals.setValidity({});
1130
- return;
1131
- }
1132
- if (this._customErrorMessage) {
1133
- this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
1134
- return;
1135
- }
1136
- if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.ativo) {
1137
- const e = this.getAttribute("mensagem-validacao") || "Ative este interruptor para continuar.";
1138
- this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
1139
- return;
1140
- }
1141
- this.internals.setValidity({});
1142
- }
1143
- /** `focus()` no host leva o foco ao controle interno (necessário para o foco de validação do formulário). */
1144
- focus(t) {
1145
- this.containerElement.focus(t);
1146
- }
1147
- alternar() {
1148
- this.disabled || (this.ativo = !this.ativo, this.dispatchEvent(
1149
- new CustomEvent("ui-change", {
1150
- detail: {
1151
- ativo: this.ativo,
1152
- value: this.getAttribute("value") || ""
1153
- },
1154
- bubbles: !0,
1155
- composed: !0
1156
- })
1157
- ), this.dispatchEvent(
1158
- new Event("change", {
1159
- bubbles: !0,
1160
- composed: !0
1161
- })
1162
- ));
1163
- }
1164
- syncState() {
1165
- 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";
1166
- 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({
1167
- host: this,
1168
- internals: this.internals,
1169
- controle: this.containerElement,
1170
- rotulo: this.labelElement,
1171
- texto: r
1172
- }), t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
1173
- }
1174
- // === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
1175
- formResetCallback() {
1176
- this.ativo = this._defaultChecked, this.syncState();
1177
- }
1178
- formStateRestoreCallback(t, e) {
1179
- typeof t == "string" ? this.ativo = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.ativo = t), this.syncState();
1180
- }
1181
- }
1182
- class rt extends k {
1183
- }
1184
- h("ui-switch", k);
1185
- h("ui-toggle", rt);
1186
- export {
1187
- Y as A,
1188
- G as L,
1189
- l as R,
1190
- A as U,
1191
- W as a,
1192
- et as b,
1193
- E as c,
1194
- at as d,
1195
- Q as e,
1196
- k as f,
1197
- j as g,
1198
- rt as h,
1199
- J as i,
1200
- H as j,
1201
- Z as k,
1202
- _ as r
1203
- };