@thibezer/ui-components-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +624 -0
- package/dist/botao.cjs +1 -0
- package/dist/botao.d.ts +8 -0
- package/dist/botao.js +6 -0
- package/dist/camadas.cjs +296 -0
- package/dist/camadas.d.ts +14 -0
- package/dist/camadas.js +1857 -0
- package/dist/campo-texto.cjs +1 -0
- package/dist/campo-texto.d.ts +8 -0
- package/dist/campo-texto.js +11 -0
- package/dist/canvas.cjs +254 -0
- package/dist/canvas.d.ts +8 -0
- package/dist/canvas.js +3082 -0
- package/dist/card.cjs +1 -0
- package/dist/card.d.ts +7 -0
- package/dist/card.js +5 -0
- package/dist/components/ui-alerta/index.d.ts +2 -0
- package/dist/components/ui-alerta/ui-alerta-base.d.ts +23 -0
- package/dist/components/ui-alerta/ui-alerta.d.ts +2 -0
- package/dist/components/ui-alerta/ui-toast.d.ts +34 -0
- package/dist/components/ui-avatar/index.d.ts +1 -0
- package/dist/components/ui-avatar/ui-avatar.d.ts +12 -0
- package/dist/components/ui-badge/index.d.ts +1 -0
- package/dist/components/ui-badge/ui-badge.d.ts +20 -0
- package/dist/components/ui-barra-ferramentas/ferramentas-comum.d.ts +22 -0
- package/dist/components/ui-barra-ferramentas/ferramentas-icones.d.ts +24 -0
- package/dist/components/ui-barra-ferramentas/index.d.ts +4 -0
- package/dist/components/ui-barra-ferramentas/tipos.d.ts +55 -0
- package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +54 -0
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +52 -0
- package/dist/components/ui-botao/index.d.ts +1 -0
- package/dist/components/ui-botao/ui-botao.d.ts +26 -0
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +18 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +18 -0
- package/dist/components/ui-camadas/camadas-eventos-arvore.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-eventos-camadas.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-eventos-rodape.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-host.d.ts +23 -0
- package/dist/components/ui-camadas/camadas-icones.d.ts +23 -0
- package/dist/components/ui-camadas/camadas-mapas-base.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-metricas.d.ts +17 -0
- package/dist/components/ui-camadas/camadas-persistencia.d.ts +65 -0
- package/dist/components/ui-camadas/camadas-resizer.d.ts +16 -0
- package/dist/components/ui-camadas/camadas-rodape.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-selecao.d.ts +24 -0
- package/dist/components/ui-camadas/camadas-sincronizacao-dom.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-teclado.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-utils.d.ts +26 -0
- package/dist/components/ui-camadas/index.d.ts +11 -0
- package/dist/components/ui-camadas/tipos.d.ts +116 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +112 -0
- package/dist/components/ui-campo-texto/campo-texto-estados.d.ts +12 -0
- package/dist/components/ui-campo-texto/campo-texto-template.d.ts +2 -0
- package/dist/components/ui-campo-texto/index.d.ts +1 -0
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +57 -0
- package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +13 -0
- package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +19 -0
- package/dist/components/ui-canvas-cad/cad-colecoes-dados.d.ts +46 -0
- package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +26 -0
- package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +19 -0
- package/dist/components/ui-canvas-cad/cad-painel-camadas.d.ts +9 -0
- package/dist/components/ui-canvas-cad/cad-tamanho-observer.d.ts +7 -0
- package/dist/components/ui-canvas-cad/cad-template.d.ts +1 -0
- package/dist/components/ui-canvas-cad/cad-toolbar-painel.d.ts +29 -0
- package/dist/components/ui-canvas-cad/index.d.ts +8 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +91 -0
- package/dist/components/ui-card/index.d.ts +1 -0
- package/dist/components/ui-card/ui-card.d.ts +18 -0
- package/dist/components/ui-checkbox/index.d.ts +1 -0
- package/dist/components/ui-checkbox/ui-checkbox.d.ts +36 -0
- package/dist/components/ui-drawer/drawer-acessibilidade.d.ts +16 -0
- package/dist/components/ui-drawer/index.d.ts +1 -0
- package/dist/components/ui-drawer/ui-drawer.d.ts +37 -0
- package/dist/components/ui-icone/index.d.ts +1 -0
- package/dist/components/ui-icone/ui-icone.d.ts +15 -0
- package/dist/components/ui-lista-flutuante/index.d.ts +1 -0
- package/dist/components/ui-lista-flutuante/lista-flutuante-posicionamento.d.ts +15 -0
- package/dist/components/ui-lista-flutuante/lista-flutuante-render.d.ts +9 -0
- package/dist/components/ui-lista-flutuante/lista-flutuante-teclado.d.ts +13 -0
- package/dist/components/ui-lista-flutuante/lista-flutuante-template.d.ts +2 -0
- package/dist/components/ui-lista-flutuante/tipos.d.ts +4 -0
- package/dist/components/ui-lista-flutuante/ui-lista-flutuante.d.ts +63 -0
- package/dist/components/ui-mapa/index.d.ts +3 -0
- package/dist/components/ui-mapa/ui-mapa-linha.d.ts +12 -0
- package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +15 -0
- package/dist/components/ui-mapa/ui-mapa.d.ts +16 -0
- package/dist/components/ui-modal/index.d.ts +2 -0
- package/dist/components/ui-modal/modal-acessibilidade.d.ts +12 -0
- package/dist/components/ui-modal/ui-modal.d.ts +30 -0
- package/dist/components/ui-radio/index.d.ts +1 -0
- package/dist/components/ui-radio/radio-grupo-registry.d.ts +10 -0
- package/dist/components/ui-radio/ui-radio.d.ts +29 -0
- package/dist/components/ui-segmented/index.d.ts +1 -0
- package/dist/components/ui-segmented/segmented-indicador.d.ts +13 -0
- package/dist/components/ui-segmented/segmented-teclado.d.ts +4 -0
- package/dist/components/ui-segmented/segmented-template.d.ts +4 -0
- package/dist/components/ui-segmented/ui-segmented.d.ts +48 -0
- package/dist/components/ui-seletor-mapa-base/index.d.ts +2 -0
- package/dist/components/ui-seletor-mapa-base/tipos.d.ts +22 -0
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +43 -0
- package/dist/components/ui-skeleton/index.d.ts +1 -0
- package/dist/components/ui-skeleton/ui-skeleton.d.ts +19 -0
- package/dist/components/ui-stat/index.d.ts +1 -0
- package/dist/components/ui-stat/ui-stat.d.ts +30 -0
- package/dist/components/ui-switch/index.d.ts +1 -0
- package/dist/components/ui-switch/ui-switch.d.ts +36 -0
- package/dist/components/ui-tabela/index.d.ts +7 -0
- package/dist/components/ui-tabela/tabela-atributos-sync.d.ts +14 -0
- package/dist/components/ui-tabela/tabela-corpo.d.ts +18 -0
- package/dist/components/ui-tabela/tabela-dom.d.ts +15 -0
- package/dist/components/ui-tabela/tabela-header.d.ts +18 -0
- package/dist/components/ui-tabela/tabela-interacao.d.ts +9 -0
- package/dist/components/ui-tabela/tabela-localizador.d.ts +4 -0
- package/dist/components/ui-tabela/tabela-ordenacao.d.ts +12 -0
- package/dist/components/ui-tabela/tabela-orquestrador-dados.d.ts +18 -0
- package/dist/components/ui-tabela/tabela-redimensionamento.d.ts +28 -0
- package/dist/components/ui-tabela/tabela-remota.d.ts +15 -0
- package/dist/components/ui-tabela/tabela-renderizador.d.ts +29 -0
- package/dist/components/ui-tabela/tabela-selecao.d.ts +24 -0
- package/dist/components/ui-tabela/tipos.d.ts +27 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +83 -0
- package/dist/components/ui-tabela-propriedades/avaliador-expressao.d.ts +6 -0
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +7 -0
- package/dist/components/ui-tabela-propriedades/editores-cad.d.ts +17 -0
- package/dist/components/ui-tabela-propriedades/index.d.ts +6 -0
- package/dist/components/ui-tabela-propriedades/propriedades-densidade.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +6 -0
- package/dist/components/ui-tabela-propriedades/propriedades-editores.d.ts +5 -0
- package/dist/components/ui-tabela-propriedades/propriedades-flutuante.d.ts +7 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +26 -0
- package/dist/components/ui-tabela-propriedades/propriedades-painel-controles.d.ts +15 -0
- package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +24 -0
- package/dist/components/ui-tabela-propriedades/propriedades-seletor-tipo.d.ts +13 -0
- package/dist/components/ui-tabela-propriedades/propriedades-splitter.d.ts +13 -0
- package/dist/components/ui-tabela-propriedades/propriedades-template.d.ts +1 -0
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +48 -0
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +66 -0
- package/dist/components/ui-texto/index.d.ts +1 -0
- package/dist/components/ui-texto/ui-texto.d.ts +15 -0
- package/dist/components/ui-tooltip/index.d.ts +1 -0
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +25 -0
- package/dist/core/acessibilidade.d.ts +21 -0
- package/dist/core/form-associated-element.d.ts +33 -0
- package/dist/core/form-validacao.d.ts +34 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/leaflet-loader.d.ts +7 -0
- package/dist/core/leaflet-style.d.ts +7 -0
- package/dist/core/listener-bag.d.ts +21 -0
- package/dist/core/ssr-safe.d.ts +20 -0
- package/dist/core/ui-bus.d.ts +85 -0
- package/dist/core/zero-js-triggers.d.ts +1 -0
- package/dist/core.cjs +1 -0
- package/dist/core.js +22 -0
- package/dist/data.cjs +1 -0
- package/dist/data.d.ts +22 -0
- package/dist/data.js +63 -0
- package/dist/feedback.cjs +1 -0
- package/dist/feedback.d.ts +26 -0
- package/dist/feedback.js +25 -0
- package/dist/form-validacao-BIOXxt-1.js +140 -0
- package/dist/form-validacao-ytRYSF3E.cjs +1 -0
- package/dist/forms.cjs +1 -0
- package/dist/forms.d.ts +22 -0
- package/dist/forms.js +25 -0
- package/dist/gerencigeo-canvas/canvas_destaque.d.ts +13 -0
- package/dist/gerencigeo-canvas/canvas_destaque_marcadores.d.ts +8 -0
- package/dist/gerencigeo-canvas/canvas_interacao.d.ts +56 -0
- package/dist/gerencigeo-canvas/canvas_selecao_box.d.ts +23 -0
- package/dist/gerencigeo-canvas/controller_dados_ops.d.ts +15 -0
- package/dist/gerencigeo-canvas/index.d.ts +17 -0
- package/dist/gerencigeo-canvas/layer_defaults.d.ts +3 -0
- package/dist/gerencigeo-canvas/layer_instance_ops.d.ts +6 -0
- package/dist/gerencigeo-canvas/layer_manager.d.ts +37 -0
- package/dist/gerencigeo-canvas/layer_pane_ops.d.ts +8 -0
- package/dist/gerencigeo-canvas/layer_renderer_factory.d.ts +14 -0
- package/dist/gerencigeo-canvas/layer_state_ops.d.ts +6 -0
- package/dist/gerencigeo-canvas/mapa_config.d.ts +11 -0
- package/dist/gerencigeo-canvas/mapa_controller.d.ts +53 -0
- package/dist/gerencigeo-canvas/mapa_core.d.ts +30 -0
- package/dist/gerencigeo-canvas/mapa_linhas.d.ts +14 -0
- package/dist/gerencigeo-canvas/mapa_marcadores.d.ts +18 -0
- package/dist/gerencigeo-canvas/mapa_pontos_shapes.d.ts +8 -0
- package/dist/gerencigeo-canvas/renderers/grid_renderer.d.ts +9 -0
- package/dist/gerencigeo-canvas/renderers/tile_renderer.d.ts +8 -0
- package/dist/gerencigeo-canvas/renderers/vector_lines_builder.d.ts +4 -0
- package/dist/gerencigeo-canvas/renderers/vector_lines_renderer.d.ts +9 -0
- package/dist/gerencigeo-canvas/renderers/vector_points_renderer.d.ts +11 -0
- package/dist/gerencigeo-canvas/renderers/vector_polygons_renderer.d.ts +9 -0
- package/dist/gerencigeo-canvas/renderers/wms_renderer.d.ts +8 -0
- package/dist/gerencigeo-canvas/sigef_consultor.d.ts +9 -0
- package/dist/gerencigeo-canvas/tile_preloader.d.ts +2 -0
- package/dist/gerencigeo-canvas/types.d.ts +169 -0
- package/dist/gerencigeo-canvas/utils.d.ts +46 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +186 -0
- package/dist/leaflet-Cw6tqYFh.cjs +1 -0
- package/dist/leaflet-DkaFZYc5.js +69 -0
- package/dist/leaflet-loader-94z5VsdY.cjs +2 -0
- package/dist/leaflet-loader-Cjcdgj5R.js +21 -0
- package/dist/listener-bag-D5omxZ9h.cjs +1 -0
- package/dist/listener-bag-DQgv7OON.js +34 -0
- package/dist/mapa.cjs +19 -0
- package/dist/mapa.d.ts +11 -0
- package/dist/mapa.js +264 -0
- package/dist/modal.cjs +1 -0
- package/dist/modal.d.ts +8 -0
- package/dist/modal.js +8 -0
- package/dist/register.cjs +1 -0
- package/dist/register.d.ts +7 -0
- package/dist/register.js +21 -0
- package/dist/seletor-mapa-base.cjs +53 -0
- package/dist/seletor-mapa-base.d.ts +8 -0
- package/dist/seletor-mapa-base.js +275 -0
- package/dist/ssr-safe-5cWfJP-s.js +10 -0
- package/dist/ssr-safe-CiHD1adl.cjs +1 -0
- package/dist/tabela.cjs +1 -0
- package/dist/tabela.d.ts +12 -0
- package/dist/tabela.js +56 -0
- package/dist/tools.cjs +1 -0
- package/dist/tools.d.ts +8 -0
- package/dist/tools.js +30 -0
- package/dist/ui-badge-92yelKls.js +183 -0
- package/dist/ui-badge-B95jSECC.cjs +28 -0
- package/dist/ui-botao-BShEouvi.js +124 -0
- package/dist/ui-botao-DF1yuUUD.cjs +12 -0
- package/dist/ui-campo-texto-BCh5HyCM.cjs +16 -0
- package/dist/ui-campo-texto-B_JF6POq.js +361 -0
- package/dist/ui-card-BJ8SmvVf.js +111 -0
- package/dist/ui-card-Bhm6k91e.cjs +20 -0
- package/dist/ui-kit.css +1 -0
- package/dist/ui-modal-Bi4isGYh.cjs +18 -0
- package/dist/ui-modal-DV-pw2x1.js +194 -0
- package/dist/ui-paleta-ferramentas-B6dJ0O6K.cjs +18 -0
- package/dist/ui-paleta-ferramentas-Bpp4XBVg.js +633 -0
- package/dist/ui-segmented-C8wuycjJ.js +411 -0
- package/dist/ui-segmented-NC5cBXLh.cjs +19 -0
- package/dist/ui-skeleton-B3xQyn0Z.js +396 -0
- package/dist/ui-skeleton-D42oQufF.cjs +33 -0
- package/dist/ui-switch-C6o4yZUF.cjs +53 -0
- package/dist/ui-switch-CO9MoS8x.js +826 -0
- package/dist/ui-tabela-propriedades-7yJ9g7ti.cjs +145 -0
- package/dist/ui-tabela-propriedades-D-XKNVwK.js +2078 -0
- package/dist/ui-toast-CQBqvUm3.cjs +20 -0
- package/dist/ui-toast-CwUmiqyG.js +156 -0
- package/dist/zero-js-triggers-DdESy0tk.js +205 -0
- package/dist/zero-js-triggers-QGD7FOTv.cjs +1 -0
- package/package.json +149 -0
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var k = (n, i, t) => i in n ? _(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t;
|
|
3
|
+
var a = (n, i, t) => k(n, typeof i != "symbol" ? i + "" : i, t);
|
|
4
|
+
import { L as d } from "./listener-bag-DQgv7OON.js";
|
|
5
|
+
import { d as h } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
+
import { F as u } from "./ui-campo-texto-B_JF6POq.js";
|
|
7
|
+
import { g as m, o as p, c as f } from "./form-validacao-BIOXxt-1.js";
|
|
8
|
+
class y {
|
|
9
|
+
constructor(i, t, e) {
|
|
10
|
+
a(this, "scrollHandler");
|
|
11
|
+
a(this, "resizeHandler");
|
|
12
|
+
a(this, "posicionar", () => {
|
|
13
|
+
if (this.isMobileOrBottomSheet()) {
|
|
14
|
+
this.content.style.top = "", this.content.style.left = "", this.content.style.minWidth = "";
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const i = this.button.getBoundingClientRect();
|
|
18
|
+
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`;
|
|
19
|
+
});
|
|
20
|
+
this.host = i, this.button = t, this.content = e;
|
|
21
|
+
}
|
|
22
|
+
isMobileOrBottomSheet() {
|
|
23
|
+
return typeof window > "u" ? !1 : window.innerWidth <= 640 || this.host.hasAttribute("bottom-sheet") || this.host.hasAttribute("modo-mobile");
|
|
24
|
+
}
|
|
25
|
+
ativarAcompanhamento(i) {
|
|
26
|
+
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")
|
|
27
|
+
try {
|
|
28
|
+
this.content.showPopover();
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
desativarAcompanhamento() {
|
|
33
|
+
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")
|
|
34
|
+
try {
|
|
35
|
+
this.content.hidePopover();
|
|
36
|
+
} catch {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class w {
|
|
41
|
+
constructor(i) {
|
|
42
|
+
a(this, "focusedIndex", -1);
|
|
43
|
+
this.listElement = i;
|
|
44
|
+
}
|
|
45
|
+
focarPrimeiroItem() {
|
|
46
|
+
const i = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
47
|
+
i.length > 0 && (this.focusedIndex = 0, i[0].focus());
|
|
48
|
+
}
|
|
49
|
+
resetarFoco() {
|
|
50
|
+
this.focusedIndex = -1;
|
|
51
|
+
}
|
|
52
|
+
moverFoco(i) {
|
|
53
|
+
const t = Array.from(this.listElement.querySelectorAll(".ui-lista-flutuante__item"));
|
|
54
|
+
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());
|
|
55
|
+
}
|
|
56
|
+
tratarKeydownLista(i, t, e, s, r) {
|
|
57
|
+
i.key === "ArrowDown" ? (i.preventDefault(), this.moverFoco(1)) : i.key === "ArrowUp" ? (i.preventDefault(), this.moverFoco(-1)) : i.key === "Enter" || i.key === " " ? (i.preventDefault(), this.focusedIndex >= 0 && this.focusedIndex < t.length && e(t[this.focusedIndex])) : i.key === "Escape" && (i.preventDefault(), s(), r.focus());
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const A = ':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}.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__gatilho{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%;height:var(--ui-campo-altura, 100%);min-height:var(--ui-campo-altura, var(--ui-altura-minima, 15px));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:0 8px 28px #0000008c;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:#ffffff40;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: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:#ffffff14}.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: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:#00e08a26;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:16px 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:16px 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)}}', E = [
|
|
61
|
+
"aberta",
|
|
62
|
+
"texto-padrao",
|
|
63
|
+
"value",
|
|
64
|
+
"disabled",
|
|
65
|
+
"bottom-sheet",
|
|
66
|
+
"modo-mobile",
|
|
67
|
+
"label",
|
|
68
|
+
"rotulo",
|
|
69
|
+
"placeholder",
|
|
70
|
+
"tamanho",
|
|
71
|
+
"size",
|
|
72
|
+
"altura",
|
|
73
|
+
"height",
|
|
74
|
+
"densidade",
|
|
75
|
+
"name",
|
|
76
|
+
"obrigatorio",
|
|
77
|
+
"required",
|
|
78
|
+
"mensagem-validacao",
|
|
79
|
+
"aria-label"
|
|
80
|
+
];
|
|
81
|
+
function S() {
|
|
82
|
+
return `
|
|
83
|
+
<style>${A}</style>
|
|
84
|
+
<div class="ui-lista-flutuante__container">
|
|
85
|
+
<label class="ui-lista-flutuante__label" style="display: none;"></label>
|
|
86
|
+
<div class="ui-lista-flutuante__backdrop"></div>
|
|
87
|
+
<button class="ui-lista-flutuante__gatilho" aria-haspopup="listbox" aria-expanded="false" type="button">
|
|
88
|
+
<span class="ui-lista-flutuante__texto"></span>
|
|
89
|
+
<span class="ui-lista-flutuante__seta">▼</span>
|
|
90
|
+
</button>
|
|
91
|
+
<div class="ui-lista-flutuante__conteudo" role="listbox" popover="manual">
|
|
92
|
+
<div class="ui-lista-flutuante__sheet-header">
|
|
93
|
+
<div class="ui-lista-flutuante__handle"></div>
|
|
94
|
+
<div class="ui-lista-flutuante__sheet-title-bar">
|
|
95
|
+
<span class="ui-lista-flutuante__sheet-titulo">Selecione uma opção</span>
|
|
96
|
+
<button class="ui-lista-flutuante__sheet-close" type="button" aria-label="Fechar">✕</button>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<ul class="ui-lista-flutuante__lista" style="margin: 0; padding: 0; list-style: none;"></ul>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
function b(n, i, t) {
|
|
105
|
+
n.innerHTML = "", i.forEach((e) => {
|
|
106
|
+
const s = document.createElement("li"), r = String(e.id) === String(t);
|
|
107
|
+
s.className = `ui-lista-flutuante__item ${r ? "ui-lista-flutuante__item--selecionado" : ""}`, s.setAttribute("data-id", e.id), s.textContent = e.label, s.role = "option", s.tabIndex = -1, r && s.setAttribute("aria-selected", "true"), n.appendChild(s);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function L(n, i) {
|
|
111
|
+
n.querySelectorAll(".ui-lista-flutuante__item").forEach((e) => {
|
|
112
|
+
e.getAttribute("data-id") === 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"));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
class g extends u {
|
|
116
|
+
constructor() {
|
|
117
|
+
super();
|
|
118
|
+
a(this, "labelElement");
|
|
119
|
+
a(this, "button");
|
|
120
|
+
a(this, "content");
|
|
121
|
+
a(this, "listElement");
|
|
122
|
+
a(this, "textoElement");
|
|
123
|
+
a(this, "backdropElement");
|
|
124
|
+
a(this, "sheetTituloElement");
|
|
125
|
+
a(this, "sheetCloseButton");
|
|
126
|
+
a(this, "idsAcessibilidade");
|
|
127
|
+
a(this, "listeners", new d());
|
|
128
|
+
a(this, "_itens", []);
|
|
129
|
+
a(this, "_value", "");
|
|
130
|
+
a(this, "_defaultValue", "");
|
|
131
|
+
a(this, "observer");
|
|
132
|
+
a(this, "posicionamento");
|
|
133
|
+
a(this, "teclado");
|
|
134
|
+
a(this, "toggleLista", (t) => {
|
|
135
|
+
t.stopPropagation(), !this.disabled && (this.hasAttribute("aberta") ? this.fechar() : this.abrir());
|
|
136
|
+
});
|
|
137
|
+
a(this, "handleKeyDown", (t) => {
|
|
138
|
+
this.disabled || (t.key === "Enter" || t.key === " " || t.key === "ArrowDown") && (t.preventDefault(), this.hasAttribute("aberta") ? this.teclado.focarPrimeiroItem() : this.abrir());
|
|
139
|
+
});
|
|
140
|
+
a(this, "handleListKeyDown", (t) => {
|
|
141
|
+
this.hasAttribute("aberta") && this.teclado.tratarKeydownLista(
|
|
142
|
+
t,
|
|
143
|
+
this._itens,
|
|
144
|
+
(e) => this.selecionarItem(e),
|
|
145
|
+
this.fechar,
|
|
146
|
+
this.button
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
a(this, "fechar", () => {
|
|
150
|
+
this.hasAttribute("aberta") && (this.removeAttribute("aberta"), this.posicionamento.desativarAcompanhamento(), this.teclado.resetarFoco());
|
|
151
|
+
});
|
|
152
|
+
a(this, "handleClickFora", (t) => {
|
|
153
|
+
if (!this.hasAttribute("aberta")) return;
|
|
154
|
+
const e = t.composedPath();
|
|
155
|
+
!e.includes(this) && !e.includes(this.content) && this.fechar();
|
|
156
|
+
});
|
|
157
|
+
/** Clicar no rótulo foca o controle (comportamento do <select> nativo), sem abrir a lista. */
|
|
158
|
+
a(this, "focarGatilho", () => {
|
|
159
|
+
this.disabled || this.button.focus();
|
|
160
|
+
});
|
|
161
|
+
a(this, "handleHostClick", (t) => {
|
|
162
|
+
f(this, t) && this.focarGatilho();
|
|
163
|
+
});
|
|
164
|
+
a(this, "handleListClick", (t) => {
|
|
165
|
+
var o;
|
|
166
|
+
t.stopPropagation();
|
|
167
|
+
const e = (o = t.target) == null ? void 0 : o.closest("li[data-id]");
|
|
168
|
+
if (!e) return;
|
|
169
|
+
const s = e.getAttribute("data-id"), r = this._itens.find((l) => String(l.id) === String(s));
|
|
170
|
+
r && this.selecionarItem(r);
|
|
171
|
+
});
|
|
172
|
+
const t = this.attachShadow({ mode: "open" });
|
|
173
|
+
t.innerHTML = S(), 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");
|
|
174
|
+
const e = m("ui-select");
|
|
175
|
+
this.idsAcessibilidade = {
|
|
176
|
+
label: `${e}-label`,
|
|
177
|
+
gatilho: `${e}-gatilho`,
|
|
178
|
+
texto: `${e}-texto`,
|
|
179
|
+
lista: `${e}-lista`
|
|
180
|
+
}, this.labelElement.id = this.idsAcessibilidade.label, this.button.id = this.idsAcessibilidade.gatilho, this.textoElement.id = this.idsAcessibilidade.texto, this.content.id = this.idsAcessibilidade.lista, this.button.setAttribute("aria-controls", this.idsAcessibilidade.lista), this.posicionamento = new y(this, this.button, this.content), this.teclado = new w(this.listElement);
|
|
181
|
+
}
|
|
182
|
+
static get observedAttributes() {
|
|
183
|
+
return E;
|
|
184
|
+
}
|
|
185
|
+
connectedCallback() {
|
|
186
|
+
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) => {
|
|
187
|
+
t.stopPropagation(), this.fechar();
|
|
188
|
+
}), this.listeners.add(document, "click", this.handleClickFora), this.listeners.add(this.labelElement, "click", this.focarGatilho), this.listeners.add(this, "click", this.handleHostClick), this._defaultValue = this.getAttribute("value") || "", this.carregarItensFilhos(), this.syncState(), this.observer = new MutationObserver(() => this.carregarItensFilhos()), this.observer.observe(this, { childList: !0, subtree: !0 });
|
|
189
|
+
}
|
|
190
|
+
carregarItensFilhos() {
|
|
191
|
+
const t = Array.from(this.querySelectorAll('option, ui-opcao, [role="option"], [data-opcao], [data-value]:not(input):not(select)'));
|
|
192
|
+
t.length > 0 && (this._itens = t.map((e, s) => {
|
|
193
|
+
var o;
|
|
194
|
+
const r = e.getAttribute("value") || e.getAttribute("data-value") || String(s + 1);
|
|
195
|
+
return {
|
|
196
|
+
id: r,
|
|
197
|
+
label: ((o = e.textContent) == null ? void 0 : o.trim()) || r || `Opção ${s + 1}`
|
|
198
|
+
};
|
|
199
|
+
}), b(this.listElement, this._itens, this._value), this.syncLabel());
|
|
200
|
+
}
|
|
201
|
+
disconnectedCallback() {
|
|
202
|
+
this.listeners.cleanup(), this.observer && this.observer.disconnect(), this.fechar();
|
|
203
|
+
}
|
|
204
|
+
attributeChangedCallback(t, e, s) {
|
|
205
|
+
t === "aberta" && this.button.setAttribute("aria-expanded", String(s !== null)), (t === "texto-padrao" || t === "placeholder" || t === "label" || t === "rotulo" || t === "aria-label") && this.syncLabel(), t === "value" && s !== this._value && (this.value = s || ""), t === "disabled" && (this.button.disabled = this.disabled), (t === "altura" || t === "height") && (s ? this.style.setProperty("--ui-campo-altura", isNaN(Number(s)) ? s : `${s}px`) : this.style.removeProperty("--ui-campo-altura"));
|
|
206
|
+
}
|
|
207
|
+
get value() {
|
|
208
|
+
return this._value;
|
|
209
|
+
}
|
|
210
|
+
set value(t) {
|
|
211
|
+
this._value = t, this.setAttribute("value", t), this.internals.setFormValue(t), this.syncLabel(), L(this.listElement, this._value), this.atualizarValidade();
|
|
212
|
+
}
|
|
213
|
+
get label() {
|
|
214
|
+
return this.getAttribute("label") || this.getAttribute("rotulo") || "";
|
|
215
|
+
}
|
|
216
|
+
set label(t) {
|
|
217
|
+
t ? this.setAttribute("label", t) : (this.removeAttribute("label"), this.removeAttribute("rotulo")), this.syncLabel();
|
|
218
|
+
}
|
|
219
|
+
get disabled() {
|
|
220
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
221
|
+
}
|
|
222
|
+
set disabled(t) {
|
|
223
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.button.disabled = this.disabled;
|
|
224
|
+
}
|
|
225
|
+
get name() {
|
|
226
|
+
return this.getAttribute("name") || "";
|
|
227
|
+
}
|
|
228
|
+
set name(t) {
|
|
229
|
+
this.setAttribute("name", t);
|
|
230
|
+
}
|
|
231
|
+
get type() {
|
|
232
|
+
return "select-one";
|
|
233
|
+
}
|
|
234
|
+
atualizarValidade() {
|
|
235
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
236
|
+
if (this.disabled) {
|
|
237
|
+
this.internals.setValidity({});
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (this._customErrorMessage) {
|
|
241
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.button);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this._value || this._value.trim() === "")) {
|
|
245
|
+
const e = this.getAttribute("mensagem-validacao") || "Selecione um item da lista.";
|
|
246
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.button);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
this.internals.setValidity({});
|
|
250
|
+
}
|
|
251
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
252
|
+
formDisabledCallback(t) {
|
|
253
|
+
this._formDisabled = t, this.button.disabled = this.disabled, this.disabled && this.fechar();
|
|
254
|
+
}
|
|
255
|
+
formResetCallback() {
|
|
256
|
+
this.value = this._defaultValue;
|
|
257
|
+
}
|
|
258
|
+
formStateRestoreCallback(t, e) {
|
|
259
|
+
typeof t == "string" && (this.value = t);
|
|
260
|
+
}
|
|
261
|
+
get itens() {
|
|
262
|
+
return this._itens;
|
|
263
|
+
}
|
|
264
|
+
set itens(t) {
|
|
265
|
+
this._itens = t || [], b(this.listElement, this._itens, this._value), this.syncLabel();
|
|
266
|
+
}
|
|
267
|
+
abrir() {
|
|
268
|
+
this.disabled || this.hasAttribute("aberta") || (this.setAttribute("aberta", ""), this.posicionamento.posicionar(), this.posicionamento.ativarAcompanhamento(this.fechar));
|
|
269
|
+
}
|
|
270
|
+
syncLabel() {
|
|
271
|
+
const t = this.getAttribute("label") || this.getAttribute("rotulo");
|
|
272
|
+
if (t)
|
|
273
|
+
this.required ? this.labelElement.innerHTML = `${t} <span class="ui-lista-flutuante__asterisco" style="color: var(--ui-cor-texto-erro, #ff5555); margin-left: 2px;">*</span>` : this.labelElement.textContent = t, 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");
|
|
274
|
+
else {
|
|
275
|
+
this.labelElement.style.display = "none", this.sincronizarRotuloExterno();
|
|
276
|
+
const s = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
277
|
+
this.sheetTituloElement.textContent = s;
|
|
278
|
+
}
|
|
279
|
+
const e = this._itens.find((s) => String(s.id) === String(this._value));
|
|
280
|
+
if (e)
|
|
281
|
+
this.textoElement.textContent = e.label;
|
|
282
|
+
else {
|
|
283
|
+
const s = this.getAttribute("texto-padrao") || this.getAttribute("placeholder") || "Opções";
|
|
284
|
+
this.textoElement.textContent = s;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/** Sem o atributo `label`, usa o rótulo de fora do Shadow DOM (aria-label, <label for>, <label> envolvente). */
|
|
288
|
+
sincronizarRotuloExterno() {
|
|
289
|
+
this.button.removeAttribute("aria-labelledby"), this.content.removeAttribute("aria-labelledby");
|
|
290
|
+
const t = p(this, this.internals);
|
|
291
|
+
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"));
|
|
292
|
+
}
|
|
293
|
+
syncState() {
|
|
294
|
+
const t = this.getAttribute("altura") || this.getAttribute("height");
|
|
295
|
+
t && this.style.setProperty("--ui-campo-altura", isNaN(Number(t)) ? t : `${t}px`), this.hasAttribute("value") && (this._value = this.getAttribute("value") || "", this.internals.setFormValue(this._value)), this.syncLabel(), this.atualizarValidade();
|
|
296
|
+
}
|
|
297
|
+
selecionarItem(t) {
|
|
298
|
+
this.value = t.id, this.fechar(), this.dispatchEvent(
|
|
299
|
+
new CustomEvent("ui-selecionar", {
|
|
300
|
+
detail: t,
|
|
301
|
+
bubbles: !0,
|
|
302
|
+
composed: !0
|
|
303
|
+
})
|
|
304
|
+
), this.dispatchEvent(
|
|
305
|
+
new Event("change", {
|
|
306
|
+
bubbles: !0,
|
|
307
|
+
composed: !0
|
|
308
|
+
})
|
|
309
|
+
), this.dispatchEvent(
|
|
310
|
+
new Event("input", {
|
|
311
|
+
bubbles: !0,
|
|
312
|
+
composed: !0
|
|
313
|
+
})
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
class C extends g {
|
|
318
|
+
}
|
|
319
|
+
h("ui-lista-flutuante", g);
|
|
320
|
+
h("ui-select", C);
|
|
321
|
+
const z = ':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: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 #00e08a40}.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}}';
|
|
322
|
+
class q extends u {
|
|
323
|
+
constructor() {
|
|
324
|
+
super();
|
|
325
|
+
a(this, "containerElement");
|
|
326
|
+
a(this, "markElement");
|
|
327
|
+
a(this, "labelElement");
|
|
328
|
+
a(this, "listeners", new d());
|
|
329
|
+
a(this, "_defaultChecked", !1);
|
|
330
|
+
a(this, "_defaultIndeterminate", !1);
|
|
331
|
+
a(this, "handleClick", (t) => {
|
|
332
|
+
t.preventDefault(), this.alternar();
|
|
333
|
+
});
|
|
334
|
+
a(this, "handleKeyDown", (t) => {
|
|
335
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
336
|
+
});
|
|
337
|
+
a(this, "handleFocus", () => {
|
|
338
|
+
this.containerElement.classList.add("ui-checkbox--foco");
|
|
339
|
+
});
|
|
340
|
+
a(this, "handleBlur", () => {
|
|
341
|
+
this.containerElement.classList.remove("ui-checkbox--foco");
|
|
342
|
+
});
|
|
343
|
+
const t = this.attachShadow({ mode: "open" });
|
|
344
|
+
t.innerHTML = `
|
|
345
|
+
<style>${z}</style>
|
|
346
|
+
<div class="ui-checkbox" tabindex="0" role="checkbox" aria-checked="false">
|
|
347
|
+
<span class="ui-checkbox__box">
|
|
348
|
+
<span class="ui-checkbox__mark"></span>
|
|
349
|
+
</span>
|
|
350
|
+
<span class="ui-checkbox__label" style="display: none;"></span>
|
|
351
|
+
</div>
|
|
352
|
+
`, this.containerElement = t.querySelector(".ui-checkbox"), this.markElement = t.querySelector(".ui-checkbox__mark"), this.labelElement = t.querySelector(".ui-checkbox__label");
|
|
353
|
+
}
|
|
354
|
+
static get observedAttributes() {
|
|
355
|
+
return [
|
|
356
|
+
"marcado",
|
|
357
|
+
"checked",
|
|
358
|
+
"indeterminado",
|
|
359
|
+
"indeterminate",
|
|
360
|
+
"disabled",
|
|
361
|
+
"value",
|
|
362
|
+
"label",
|
|
363
|
+
"posicao-label",
|
|
364
|
+
"name",
|
|
365
|
+
"obrigatorio",
|
|
366
|
+
"required",
|
|
367
|
+
"mensagem-validacao"
|
|
368
|
+
];
|
|
369
|
+
}
|
|
370
|
+
connectedCallback() {
|
|
371
|
+
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._defaultChecked = this.hasAttribute("marcado") || this.hasAttribute("checked"), this._defaultIndeterminate = this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate"), this.syncState();
|
|
372
|
+
}
|
|
373
|
+
disconnectedCallback() {
|
|
374
|
+
this.listeners.cleanup();
|
|
375
|
+
}
|
|
376
|
+
attributeChangedCallback(t, e, s) {
|
|
377
|
+
this.syncState();
|
|
378
|
+
}
|
|
379
|
+
get marcado() {
|
|
380
|
+
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
381
|
+
}
|
|
382
|
+
set marcado(t) {
|
|
383
|
+
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked")), this.syncState();
|
|
384
|
+
}
|
|
385
|
+
get checked() {
|
|
386
|
+
return this.marcado;
|
|
387
|
+
}
|
|
388
|
+
set checked(t) {
|
|
389
|
+
this.marcado = t;
|
|
390
|
+
}
|
|
391
|
+
get value() {
|
|
392
|
+
return this.getAttribute("value") || "on";
|
|
393
|
+
}
|
|
394
|
+
set value(t) {
|
|
395
|
+
this.setAttribute("value", t), this.syncState();
|
|
396
|
+
}
|
|
397
|
+
get name() {
|
|
398
|
+
return this.getAttribute("name") || "";
|
|
399
|
+
}
|
|
400
|
+
set name(t) {
|
|
401
|
+
this.setAttribute("name", t), this.syncState();
|
|
402
|
+
}
|
|
403
|
+
get indeterminado() {
|
|
404
|
+
return this.hasAttribute("indeterminado") || this.hasAttribute("indeterminate");
|
|
405
|
+
}
|
|
406
|
+
set indeterminado(t) {
|
|
407
|
+
t ? this.setAttribute("indeterminado", "") : (this.removeAttribute("indeterminado"), this.removeAttribute("indeterminate")), this.syncState();
|
|
408
|
+
}
|
|
409
|
+
get disabled() {
|
|
410
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
411
|
+
}
|
|
412
|
+
set disabled(t) {
|
|
413
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
414
|
+
}
|
|
415
|
+
get type() {
|
|
416
|
+
return "checkbox";
|
|
417
|
+
}
|
|
418
|
+
atualizarValidade() {
|
|
419
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
420
|
+
if (this.disabled) {
|
|
421
|
+
this.internals.setValidity({});
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (this._customErrorMessage) {
|
|
425
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.marcado) {
|
|
429
|
+
const e = this.getAttribute("mensagem-validacao") || "Marque esta caixa para continuar.";
|
|
430
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
this.internals.setValidity({});
|
|
434
|
+
}
|
|
435
|
+
alternar() {
|
|
436
|
+
this.disabled || (this.indeterminado ? (this.indeterminado = !1, this.marcado = !0) : this.marcado = !this.marcado, this.dispatchEvent(
|
|
437
|
+
new CustomEvent("ui-change", {
|
|
438
|
+
detail: {
|
|
439
|
+
marcado: this.marcado,
|
|
440
|
+
indeterminado: this.indeterminado,
|
|
441
|
+
value: this.getAttribute("value") || ""
|
|
442
|
+
},
|
|
443
|
+
bubbles: !0,
|
|
444
|
+
composed: !0
|
|
445
|
+
})
|
|
446
|
+
), this.dispatchEvent(
|
|
447
|
+
new Event("change", {
|
|
448
|
+
bubbles: !0,
|
|
449
|
+
composed: !0
|
|
450
|
+
})
|
|
451
|
+
));
|
|
452
|
+
}
|
|
453
|
+
syncState() {
|
|
454
|
+
const t = this.marcado, e = this.indeterminado, s = this.disabled, r = this.getAttribute("label"), o = this.getAttribute("posicao-label") || "direita";
|
|
455
|
+
this.containerElement.setAttribute(
|
|
456
|
+
"aria-checked",
|
|
457
|
+
e ? "mixed" : String(t)
|
|
458
|
+
), s ? (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"), o === "esquerda" ? this.containerElement.classList.add("ui-checkbox--label-esquerda") : this.containerElement.classList.remove("ui-checkbox--label-esquerda"), e ? this.markElement.innerHTML = `
|
|
459
|
+
<svg viewBox="0 0 24 24">
|
|
460
|
+
<line x1="5" y1="12" x2="19" y2="12"></line>
|
|
461
|
+
</svg>
|
|
462
|
+
` : t ? this.markElement.innerHTML = `
|
|
463
|
+
<svg viewBox="0 0 24 24">
|
|
464
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
|
465
|
+
</svg>
|
|
466
|
+
` : this.markElement.innerHTML = "", r ? (this.labelElement.textContent = r, this.labelElement.style.display = "inline") : this.labelElement.style.display = "none", t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
467
|
+
}
|
|
468
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
469
|
+
formResetCallback() {
|
|
470
|
+
this.marcado = this._defaultChecked, this.indeterminado = this._defaultIndeterminate, this.syncState();
|
|
471
|
+
}
|
|
472
|
+
formStateRestoreCallback(t, e) {
|
|
473
|
+
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
h("ui-checkbox", q);
|
|
477
|
+
const I = ':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 #00e08a40}.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}';
|
|
478
|
+
class c {
|
|
479
|
+
static getScopeNode(i) {
|
|
480
|
+
return i.closest("form") || i.getRootNode() || document;
|
|
481
|
+
}
|
|
482
|
+
static registrar(i) {
|
|
483
|
+
const t = i.name;
|
|
484
|
+
if (t) {
|
|
485
|
+
const e = this.getScopeNode(i);
|
|
486
|
+
this.registry.has(e) || this.registry.set(e, /* @__PURE__ */ new Map());
|
|
487
|
+
const s = this.registry.get(e);
|
|
488
|
+
s.has(t) || s.set(t, /* @__PURE__ */ new Set()), s.get(t).add(i);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
static desregistrar(i) {
|
|
492
|
+
const t = i.name;
|
|
493
|
+
if (t) {
|
|
494
|
+
const e = this.getScopeNode(i), s = this.registry.get(e);
|
|
495
|
+
if (s && s.has(t)) {
|
|
496
|
+
const r = s.get(t);
|
|
497
|
+
r.delete(i), r.size === 0 && s.delete(t), s.size === 0 && this.registry.delete(e);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
static obterRadiosDoGrupo(i) {
|
|
502
|
+
const t = i.name;
|
|
503
|
+
if (!t) return [];
|
|
504
|
+
const e = this.getScopeNode(i), s = this.registry.get(e);
|
|
505
|
+
return !s || !s.has(t) ? [] : Array.from(s.get(t));
|
|
506
|
+
}
|
|
507
|
+
static desmarcarOutros(i) {
|
|
508
|
+
this.obterRadiosDoGrupo(i).forEach((e) => {
|
|
509
|
+
e !== i && (e.removeAttribute("marcado"), e.removeAttribute("checked"), e.syncState());
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
static tratarNavegacaoTeclado(i, t) {
|
|
513
|
+
if (["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft"].includes(i.key)) {
|
|
514
|
+
i.preventDefault();
|
|
515
|
+
const s = this.obterRadiosDoGrupo(t).filter((l) => !l.disabled);
|
|
516
|
+
if (s.length <= 1) return;
|
|
517
|
+
const r = s.indexOf(t);
|
|
518
|
+
let o = r;
|
|
519
|
+
if (i.key === "ArrowDown" || i.key === "ArrowRight" ? o = (r + 1) % s.length : (i.key === "ArrowUp" || i.key === "ArrowLeft") && (o = (r - 1 + s.length) % s.length), o !== r && o >= 0 && o < s.length) {
|
|
520
|
+
const l = s[o];
|
|
521
|
+
l.selecionar(), l.focus();
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
a(c, "registry", /* @__PURE__ */ new WeakMap());
|
|
527
|
+
class V extends u {
|
|
528
|
+
constructor() {
|
|
529
|
+
super();
|
|
530
|
+
a(this, "containerElement");
|
|
531
|
+
a(this, "labelElement");
|
|
532
|
+
a(this, "_defaultChecked", !1);
|
|
533
|
+
a(this, "handleClick", (t) => {
|
|
534
|
+
t.preventDefault(), this.selecionar(), this.containerElement.focus();
|
|
535
|
+
});
|
|
536
|
+
a(this, "handleKeyDown", (t) => {
|
|
537
|
+
t.key === " " || t.key === "Enter" ? (t.preventDefault(), this.selecionar()) : c.tratarNavegacaoTeclado(t, this);
|
|
538
|
+
});
|
|
539
|
+
a(this, "handleFocus", () => {
|
|
540
|
+
this.containerElement.classList.add("ui-radio--foco");
|
|
541
|
+
});
|
|
542
|
+
a(this, "handleBlur", () => {
|
|
543
|
+
this.containerElement.classList.remove("ui-radio--foco");
|
|
544
|
+
});
|
|
545
|
+
const t = this.attachShadow({ mode: "open" });
|
|
546
|
+
t.innerHTML = `
|
|
547
|
+
<style>${I}</style>
|
|
548
|
+
<div class="ui-radio" tabindex="0" role="radio" aria-checked="false">
|
|
549
|
+
<span class="ui-radio__circle">
|
|
550
|
+
<span class="ui-radio__dot"></span>
|
|
551
|
+
</span>
|
|
552
|
+
<span class="ui-radio__label" style="display: none;"></span>
|
|
553
|
+
</div>
|
|
554
|
+
`, this.containerElement = t.querySelector(".ui-radio"), this.labelElement = t.querySelector(".ui-radio__label");
|
|
555
|
+
}
|
|
556
|
+
static get observedAttributes() {
|
|
557
|
+
return [
|
|
558
|
+
"marcado",
|
|
559
|
+
"checked",
|
|
560
|
+
"name",
|
|
561
|
+
"nome",
|
|
562
|
+
"disabled",
|
|
563
|
+
"value",
|
|
564
|
+
"label",
|
|
565
|
+
"posicao-label",
|
|
566
|
+
"obrigatorio",
|
|
567
|
+
"required",
|
|
568
|
+
"mensagem-validacao"
|
|
569
|
+
];
|
|
570
|
+
}
|
|
571
|
+
connectedCallback() {
|
|
572
|
+
this.containerElement.addEventListener("click", this.handleClick), this.containerElement.addEventListener("keydown", this.handleKeyDown), this.containerElement.addEventListener("focus", this.handleFocus), this.containerElement.addEventListener("blur", this.handleBlur), this._defaultChecked = this.hasAttribute("marcado") || this.hasAttribute("checked"), c.registrar(this), this.syncState();
|
|
573
|
+
}
|
|
574
|
+
disconnectedCallback() {
|
|
575
|
+
this.containerElement.removeEventListener("click", this.handleClick), this.containerElement.removeEventListener("keydown", this.handleKeyDown), this.containerElement.removeEventListener("focus", this.handleFocus), this.containerElement.removeEventListener("blur", this.handleBlur), c.desregistrar(this);
|
|
576
|
+
}
|
|
577
|
+
attributeChangedCallback(t, e, s) {
|
|
578
|
+
this.syncState();
|
|
579
|
+
}
|
|
580
|
+
get marcado() {
|
|
581
|
+
return this.hasAttribute("marcado") || this.hasAttribute("checked");
|
|
582
|
+
}
|
|
583
|
+
set marcado(t) {
|
|
584
|
+
t ? this.setAttribute("marcado", "") : (this.removeAttribute("marcado"), this.removeAttribute("checked"));
|
|
585
|
+
}
|
|
586
|
+
get name() {
|
|
587
|
+
return this.getAttribute("name") || this.getAttribute("nome") || "";
|
|
588
|
+
}
|
|
589
|
+
set name(t) {
|
|
590
|
+
c.desregistrar(this), this.setAttribute("name", t), c.registrar(this), this.syncState();
|
|
591
|
+
}
|
|
592
|
+
get disabled() {
|
|
593
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
594
|
+
}
|
|
595
|
+
set disabled(t) {
|
|
596
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
597
|
+
}
|
|
598
|
+
get type() {
|
|
599
|
+
return "radio";
|
|
600
|
+
}
|
|
601
|
+
atualizarValidade() {
|
|
602
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
603
|
+
if (this.disabled) {
|
|
604
|
+
this.internals.setValidity({});
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
if (this._customErrorMessage) {
|
|
608
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const t = c.obterRadiosDoGrupo(this);
|
|
612
|
+
if ((this.required || t.length > 0 && t.some((s) => s.required)) && !(this.marcado || t.length > 0 && t.some((r) => r.marcado))) {
|
|
613
|
+
const r = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
614
|
+
this.internals.setValidity({ valueMissing: !0 }, r, this.containerElement);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
this.internals.setValidity({});
|
|
618
|
+
}
|
|
619
|
+
focus(t) {
|
|
620
|
+
this.containerElement.focus(t);
|
|
621
|
+
}
|
|
622
|
+
selecionar() {
|
|
623
|
+
this.disabled || this.marcado || (c.desmarcarOutros(this), this.marcado = !0, this.dispatchEvent(
|
|
624
|
+
new CustomEvent("ui-change", {
|
|
625
|
+
detail: {
|
|
626
|
+
marcado: !0,
|
|
627
|
+
name: this.name,
|
|
628
|
+
value: this.getAttribute("value") || ""
|
|
629
|
+
},
|
|
630
|
+
bubbles: !0,
|
|
631
|
+
composed: !0
|
|
632
|
+
})
|
|
633
|
+
), this.dispatchEvent(
|
|
634
|
+
new Event("change", {
|
|
635
|
+
bubbles: !0,
|
|
636
|
+
composed: !0
|
|
637
|
+
})
|
|
638
|
+
), c.obterRadiosDoGrupo(this).forEach((t) => t.atualizarValidade()));
|
|
639
|
+
}
|
|
640
|
+
syncState() {
|
|
641
|
+
const t = this.marcado, e = this.disabled, s = this.getAttribute("label"), r = this.getAttribute("posicao-label") || "direita";
|
|
642
|
+
if (this.containerElement.setAttribute("aria-checked", String(t)), e)
|
|
643
|
+
this.containerElement.classList.add("ui-radio--disabled"), this.containerElement.setAttribute("tabindex", "-1"), this.containerElement.setAttribute("aria-disabled", "true");
|
|
644
|
+
else {
|
|
645
|
+
this.containerElement.classList.remove("ui-radio--disabled"), this.containerElement.removeAttribute("aria-disabled");
|
|
646
|
+
const o = c.obterRadiosDoGrupo(this);
|
|
647
|
+
o.length > 0 ? o.some((v) => v.marcado) ? this.containerElement.setAttribute("tabindex", t ? "0" : "-1") : this.containerElement.setAttribute("tabindex", o[0] === this ? "0" : "-1") : this.containerElement.setAttribute("tabindex", "0");
|
|
648
|
+
}
|
|
649
|
+
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"), s ? (this.labelElement.textContent = s, this.labelElement.style.display = "inline") : this.labelElement.style.display = "none", t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
650
|
+
}
|
|
651
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
652
|
+
formResetCallback() {
|
|
653
|
+
this.marcado = this._defaultChecked, this._defaultChecked ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
654
|
+
}
|
|
655
|
+
formStateRestoreCallback(t, e) {
|
|
656
|
+
typeof t == "string" ? this.marcado = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.marcado = t), this.syncState();
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
h("ui-radio", V);
|
|
660
|
+
const D = ':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: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 #00e08a40}.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:0 1px 3px #0000004d;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}}';
|
|
661
|
+
class x extends u {
|
|
662
|
+
constructor() {
|
|
663
|
+
super();
|
|
664
|
+
a(this, "containerElement");
|
|
665
|
+
a(this, "labelElement");
|
|
666
|
+
a(this, "labelId");
|
|
667
|
+
a(this, "listeners", new d());
|
|
668
|
+
a(this, "_defaultChecked", !1);
|
|
669
|
+
a(this, "handleClick", (t) => {
|
|
670
|
+
t.preventDefault(), this.alternar();
|
|
671
|
+
});
|
|
672
|
+
a(this, "handleHostClick", (t) => {
|
|
673
|
+
f(this, t) && (this.alternar(), this.containerElement.focus());
|
|
674
|
+
});
|
|
675
|
+
a(this, "handleKeyDown", (t) => {
|
|
676
|
+
(t.key === " " || t.key === "Enter") && (t.preventDefault(), this.alternar());
|
|
677
|
+
});
|
|
678
|
+
a(this, "handleFocus", () => {
|
|
679
|
+
this.containerElement.classList.add("ui-switch--foco");
|
|
680
|
+
});
|
|
681
|
+
a(this, "handleBlur", () => {
|
|
682
|
+
this.containerElement.classList.remove("ui-switch--foco");
|
|
683
|
+
});
|
|
684
|
+
const t = this.attachShadow({ mode: "open" });
|
|
685
|
+
t.innerHTML = `
|
|
686
|
+
<style>${D}</style>
|
|
687
|
+
<div class="ui-switch" tabindex="0" role="switch" aria-checked="false">
|
|
688
|
+
<span class="ui-switch__track">
|
|
689
|
+
<span class="ui-switch__thumb"></span>
|
|
690
|
+
</span>
|
|
691
|
+
<span class="ui-switch__label" style="display: none;"></span>
|
|
692
|
+
</div>
|
|
693
|
+
`, this.containerElement = t.querySelector(".ui-switch"), this.labelElement = t.querySelector(".ui-switch__label"), this.labelId = m("ui-switch-label"), this.labelElement.id = this.labelId;
|
|
694
|
+
}
|
|
695
|
+
static get observedAttributes() {
|
|
696
|
+
return [
|
|
697
|
+
"ativo",
|
|
698
|
+
"ligado",
|
|
699
|
+
"checked",
|
|
700
|
+
"disabled",
|
|
701
|
+
"tamanho",
|
|
702
|
+
"size",
|
|
703
|
+
"label",
|
|
704
|
+
"posicao-label",
|
|
705
|
+
"value",
|
|
706
|
+
"name",
|
|
707
|
+
"obrigatorio",
|
|
708
|
+
"required",
|
|
709
|
+
"mensagem-validacao",
|
|
710
|
+
"aria-label"
|
|
711
|
+
];
|
|
712
|
+
}
|
|
713
|
+
connectedCallback() {
|
|
714
|
+
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();
|
|
715
|
+
}
|
|
716
|
+
disconnectedCallback() {
|
|
717
|
+
this.listeners.cleanup();
|
|
718
|
+
}
|
|
719
|
+
attributeChangedCallback(t, e, s) {
|
|
720
|
+
this.syncState();
|
|
721
|
+
}
|
|
722
|
+
get ativo() {
|
|
723
|
+
return this.hasAttribute("ativo") || this.hasAttribute("ligado") || this.hasAttribute("checked");
|
|
724
|
+
}
|
|
725
|
+
set ativo(t) {
|
|
726
|
+
t ? this.setAttribute("ativo", "") : (this.removeAttribute("ativo"), this.removeAttribute("ligado"), this.removeAttribute("checked")), this.syncState();
|
|
727
|
+
}
|
|
728
|
+
get checked() {
|
|
729
|
+
return this.ativo;
|
|
730
|
+
}
|
|
731
|
+
set checked(t) {
|
|
732
|
+
this.ativo = t;
|
|
733
|
+
}
|
|
734
|
+
get value() {
|
|
735
|
+
return this.getAttribute("value") || "on";
|
|
736
|
+
}
|
|
737
|
+
set value(t) {
|
|
738
|
+
this.setAttribute("value", t), this.syncState();
|
|
739
|
+
}
|
|
740
|
+
get name() {
|
|
741
|
+
return this.getAttribute("name") || "";
|
|
742
|
+
}
|
|
743
|
+
set name(t) {
|
|
744
|
+
this.setAttribute("name", t), this.syncState();
|
|
745
|
+
}
|
|
746
|
+
get disabled() {
|
|
747
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
748
|
+
}
|
|
749
|
+
set disabled(t) {
|
|
750
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
751
|
+
}
|
|
752
|
+
get type() {
|
|
753
|
+
return "checkbox";
|
|
754
|
+
}
|
|
755
|
+
atualizarValidade() {
|
|
756
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
757
|
+
if (this.disabled) {
|
|
758
|
+
this.internals.setValidity({});
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (this._customErrorMessage) {
|
|
762
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.containerElement);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && !this.ativo) {
|
|
766
|
+
const e = this.getAttribute("mensagem-validacao") || "Ative este interruptor para continuar.";
|
|
767
|
+
this.internals.setValidity({ valueMissing: !0 }, e, this.containerElement);
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
this.internals.setValidity({});
|
|
771
|
+
}
|
|
772
|
+
alternar() {
|
|
773
|
+
this.disabled || (this.ativo = !this.ativo, this.dispatchEvent(
|
|
774
|
+
new CustomEvent("ui-change", {
|
|
775
|
+
detail: {
|
|
776
|
+
ativo: this.ativo,
|
|
777
|
+
value: this.getAttribute("value") || ""
|
|
778
|
+
},
|
|
779
|
+
bubbles: !0,
|
|
780
|
+
composed: !0
|
|
781
|
+
})
|
|
782
|
+
), this.dispatchEvent(
|
|
783
|
+
new Event("change", {
|
|
784
|
+
bubbles: !0,
|
|
785
|
+
composed: !0
|
|
786
|
+
})
|
|
787
|
+
));
|
|
788
|
+
}
|
|
789
|
+
syncState() {
|
|
790
|
+
const t = this.ativo, e = this.disabled, s = this.getAttribute("tamanho") || this.getAttribute("size") || "md", r = this.getAttribute("label"), o = this.getAttribute("posicao-label") || "direita";
|
|
791
|
+
if (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(s) ? this.containerElement.classList.add(`ui-switch--${s}`) : this.containerElement.classList.add("ui-switch--md"), o === "esquerda" ? this.containerElement.classList.add("ui-switch--label-esquerda") : this.containerElement.classList.remove("ui-switch--label-esquerda"), r)
|
|
792
|
+
this.labelElement.textContent = r, this.labelElement.style.display = "inline", this.containerElement.setAttribute("aria-labelledby", this.labelId), this.containerElement.removeAttribute("aria-label");
|
|
793
|
+
else {
|
|
794
|
+
this.labelElement.style.display = "none", this.containerElement.removeAttribute("aria-labelledby");
|
|
795
|
+
const l = p(this, this.internals);
|
|
796
|
+
l ? this.containerElement.setAttribute("aria-label", l) : this.containerElement.removeAttribute("aria-label");
|
|
797
|
+
}
|
|
798
|
+
t ? this.internals.setFormValue(this.getAttribute("value") || "on") : this.internals.setFormValue(null), this.atualizarValidade();
|
|
799
|
+
}
|
|
800
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
801
|
+
formResetCallback() {
|
|
802
|
+
this.ativo = this._defaultChecked, this.syncState();
|
|
803
|
+
}
|
|
804
|
+
formStateRestoreCallback(t, e) {
|
|
805
|
+
typeof t == "string" ? this.ativo = t === (this.getAttribute("value") || "on") : typeof t == "boolean" && (this.ativo = t), this.syncState();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
class M extends x {
|
|
809
|
+
}
|
|
810
|
+
h("ui-switch", x);
|
|
811
|
+
h("ui-toggle", M);
|
|
812
|
+
export {
|
|
813
|
+
E as A,
|
|
814
|
+
y as L,
|
|
815
|
+
c as R,
|
|
816
|
+
q as U,
|
|
817
|
+
w as a,
|
|
818
|
+
g as b,
|
|
819
|
+
V as c,
|
|
820
|
+
C as d,
|
|
821
|
+
x as e,
|
|
822
|
+
M as f,
|
|
823
|
+
L as g,
|
|
824
|
+
S as h,
|
|
825
|
+
b as r
|
|
826
|
+
};
|