@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,411 @@
|
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var v = (s, n, t) => n in s ? g(s, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[n] = t;
|
|
3
|
+
var u = (s, n, t) => v(s, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { d, S as h } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
+
import { L as f } from "./listener-bag-DQgv7OON.js";
|
|
6
|
+
import { F as b } from "./ui-campo-texto-B_JF6POq.js";
|
|
7
|
+
const x = ':host{display:block;box-sizing:border-box;margin:0;padding:0;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){display:inline-block}.ui-texto{margin:0;padding:0;box-sizing:border-box;font-family:inherit;color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.ui-texto--h1{font-size:var(--ui-tamanho-h1, clamp(24px, 4vw, 36px));font-weight:var(--ui-peso-negrito, 700);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.5px}.ui-texto--h2{font-size:var(--ui-tamanho-h2, clamp(20px, 3vw, 28px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.3px}.ui-texto--h3{font-size:var(--ui-tamanho-h3, clamp(18px, 2.4vw, 24px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h4{font-size:var(--ui-tamanho-h4, clamp(16px, 2vw, 20px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h5{font-size:var(--ui-tamanho-h5, clamp(14px, 1.6vw, 18px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h6{font-size:var(--ui-tamanho-h6, clamp(13px, 1.2vw, 16px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);text-transform:uppercase;letter-spacing:.5px}.ui-texto--corpo{font-size:var(--ui-tamanho-corpo, 14px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--corpo-sm{font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--caption{font-size:var(--ui-tamanho-caption, 11px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-compacta, 1.2);color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--codigo{font-family:var(--ui-fonte-codigo, monospace);font-size:var(--ui-tamanho-codigo, 12px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5);background:var(--ui-cor-fundo-elevado, #1a1a1e);padding:2px 6px;border-radius:4px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-texto--cor-primaria{color:var(--ui-cor-primaria, #00E08A)}.ui-texto--cor-secundaria{color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--cor-destaque{color:var(--ui-cor-destaque, #00E08A)}.ui-texto--cor-erro{color:var(--ui-cor-texto-erro, #ff5555)}.ui-texto--cor-sucesso{color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-texto--cor-alerta{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-texto--peso-normal{font-weight:var(--ui-peso-normal, 400)!important}.ui-texto--peso-medio{font-weight:var(--ui-peso-medio, 500)!important}.ui-texto--peso-seminegrito{font-weight:var(--ui-peso-seminegrito, 600)!important}.ui-texto--peso-negrito{font-weight:var(--ui-peso-negrito, 700)!important}.ui-texto--alinhamento-esquerda{text-align:left}.ui-texto--alinhamento-centro{text-align:center}.ui-texto--alinhamento-direita{text-align:right}.ui-texto--alinhamento-justificado{text-align:justify}.ui-texto--truncar{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}', _ = /* @__PURE__ */ new Set([
|
|
8
|
+
"p",
|
|
9
|
+
"span",
|
|
10
|
+
"div",
|
|
11
|
+
"h1",
|
|
12
|
+
"h2",
|
|
13
|
+
"h3",
|
|
14
|
+
"h4",
|
|
15
|
+
"h5",
|
|
16
|
+
"h6",
|
|
17
|
+
"small",
|
|
18
|
+
"code",
|
|
19
|
+
"strong",
|
|
20
|
+
"em",
|
|
21
|
+
"label",
|
|
22
|
+
"blockquote",
|
|
23
|
+
"pre",
|
|
24
|
+
"b",
|
|
25
|
+
"i"
|
|
26
|
+
]);
|
|
27
|
+
class y extends h {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
u(this, "container");
|
|
31
|
+
u(this, "shadow");
|
|
32
|
+
typeof this.attachShadow == "function" && typeof document < "u" ? (this.shadow = this.attachShadow({ mode: "open" }), this.container = document.createElement("p"), this.container.className = "ui-texto ui-texto--corpo", this.container.appendChild(document.createElement("slot")), this.shadow.innerHTML = `<style>${x}</style>`, this.shadow.appendChild(this.container)) : (this.shadow = null, this.container = null);
|
|
33
|
+
}
|
|
34
|
+
static get observedAttributes() {
|
|
35
|
+
return ["variante", "tag", "cor", "peso", "alinhamento", "truncar"];
|
|
36
|
+
}
|
|
37
|
+
connectedCallback() {
|
|
38
|
+
this.render();
|
|
39
|
+
}
|
|
40
|
+
attributeChangedCallback(t, i, e) {
|
|
41
|
+
this.render();
|
|
42
|
+
}
|
|
43
|
+
resolveTag() {
|
|
44
|
+
const t = this.getAttribute("tag");
|
|
45
|
+
if (t) {
|
|
46
|
+
const e = t.toLowerCase().trim();
|
|
47
|
+
if (_.has(e))
|
|
48
|
+
return e;
|
|
49
|
+
console.warn(`[ui-texto] Tag "${t}" não permitida ou inválida. Utilizando fallback semântico.`);
|
|
50
|
+
}
|
|
51
|
+
const i = (this.getAttribute("variante") || "corpo").toLowerCase();
|
|
52
|
+
switch (i) {
|
|
53
|
+
case "h1":
|
|
54
|
+
case "h2":
|
|
55
|
+
case "h3":
|
|
56
|
+
case "h4":
|
|
57
|
+
case "h5":
|
|
58
|
+
case "h6":
|
|
59
|
+
return i;
|
|
60
|
+
case "caption":
|
|
61
|
+
return "small";
|
|
62
|
+
case "codigo":
|
|
63
|
+
return "code";
|
|
64
|
+
case "corpo-sm":
|
|
65
|
+
case "corpo":
|
|
66
|
+
default:
|
|
67
|
+
return "p";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
const t = this.resolveTag(), i = this.getAttribute("variante") || "corpo", e = this.getAttribute("cor"), a = this.getAttribute("peso"), o = this.getAttribute("alinhamento"), r = this.hasAttribute("truncar");
|
|
72
|
+
if (this.container.tagName.toLowerCase() !== t) {
|
|
73
|
+
const c = document.createElement(t);
|
|
74
|
+
c.appendChild(document.createElement("slot")), this.shadow.replaceChild(c, this.container), this.container = c;
|
|
75
|
+
}
|
|
76
|
+
const l = ["ui-texto", `ui-texto--${i}`];
|
|
77
|
+
e && l.push(`ui-texto--cor-${e}`), a && l.push(`ui-texto--peso-${a}`), o && l.push(`ui-texto--alinhamento-${o}`), r && l.push("ui-texto--truncar"), this.container.className = l.join(" ");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
d("ui-texto", y);
|
|
81
|
+
const A = ':host{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle;position:relative}.ui-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-tamanho-avatar, 36px);height:var(--ui-tamanho-avatar, 36px);min-width:var(--ui-tamanho-avatar, 36px);min-height:var(--ui-tamanho-avatar, 36px);border-radius:50%;background-color:var(--ui-cor-fundo-elevado, #22222a);color:var(--ui-cor-primaria, #00E08A);font-weight:600;font-size:var(--ui-avatar-font-size, 14px);-webkit-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));line-height:1}.ui-avatar__img{width:100%;height:100%;object-fit:cover;display:block}.ui-avatar--quadrado{border-radius:8px}.ui-avatar__status{position:absolute;bottom:0;right:0;width:25%;height:25%;min-width:8px;min-height:8px;max-width:14px;max-height:14px;border-radius:50%;border:2px solid var(--ui-cor-fundo-card, #121214);box-sizing:border-box}.ui-avatar__status--online{background-color:var(--ui-cor-primaria, #00E08A)}.ui-avatar__status--offline{background-color:#889}.ui-avatar__status--ausente{background-color:#ffb86c}.ui-avatar__status--ocupado{background-color:#f55}.ui-avatar--xs{--ui-tamanho-avatar: 20px;--ui-avatar-font-size: 10px}.ui-avatar--sm{--ui-tamanho-avatar: 28px;--ui-avatar-font-size: 11px}.ui-avatar--md{--ui-tamanho-avatar: 36px;--ui-avatar-font-size: 14px}.ui-avatar--lg{--ui-tamanho-avatar: 48px;--ui-avatar-font-size: 18px}.ui-avatar--xl{--ui-tamanho-avatar: 64px;--ui-avatar-font-size: 24px}';
|
|
82
|
+
class w extends h {
|
|
83
|
+
constructor() {
|
|
84
|
+
super();
|
|
85
|
+
u(this, "avatarElement");
|
|
86
|
+
u(this, "statusElement");
|
|
87
|
+
const t = this.attachShadow({ mode: "open" });
|
|
88
|
+
t.innerHTML = `
|
|
89
|
+
<style>${A}</style>
|
|
90
|
+
<div class="ui-avatar">
|
|
91
|
+
<span class="ui-avatar__content"></span>
|
|
92
|
+
</div>
|
|
93
|
+
<span class="ui-avatar__status" style="display: none;"></span>
|
|
94
|
+
`, this.avatarElement = t.querySelector(".ui-avatar"), this.statusElement = t.querySelector(".ui-avatar__status");
|
|
95
|
+
}
|
|
96
|
+
static get observedAttributes() {
|
|
97
|
+
return [
|
|
98
|
+
"src",
|
|
99
|
+
"nome",
|
|
100
|
+
"name",
|
|
101
|
+
"tamanho",
|
|
102
|
+
"size",
|
|
103
|
+
"formato",
|
|
104
|
+
"status"
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
connectedCallback() {
|
|
108
|
+
this.syncState();
|
|
109
|
+
}
|
|
110
|
+
attributeChangedCallback(t, i, e) {
|
|
111
|
+
this.syncState();
|
|
112
|
+
}
|
|
113
|
+
extrairIniciais(t) {
|
|
114
|
+
const i = t.trim().split(/\s+/).filter(Boolean);
|
|
115
|
+
if (i.length === 0) return "?";
|
|
116
|
+
if (i.length === 1)
|
|
117
|
+
return i[0].substring(0, 2).toUpperCase();
|
|
118
|
+
const e = i[0][0], a = i[i.length - 1][0];
|
|
119
|
+
return (e + a).toUpperCase();
|
|
120
|
+
}
|
|
121
|
+
syncState() {
|
|
122
|
+
const t = this.getAttribute("src"), i = this.getAttribute("nome") || this.getAttribute("name") || "", e = this.getAttribute("tamanho") || this.getAttribute("size") || "md", a = this.getAttribute("formato") || "circulo", o = this.getAttribute("status");
|
|
123
|
+
this.avatarElement.className = "ui-avatar", ["xs", "sm", "md", "lg", "xl"].includes(e) ? (this.avatarElement.classList.add(`ui-avatar--${e}`), this.avatarElement.style.removeProperty("--ui-tamanho-avatar")) : isNaN(parseInt(e, 10)) ? this.avatarElement.style.removeProperty("--ui-tamanho-avatar") : this.avatarElement.style.setProperty("--ui-tamanho-avatar", `${parseInt(e, 10)}px`), a === "quadrado" && this.avatarElement.classList.add("ui-avatar--quadrado");
|
|
124
|
+
const r = this.avatarElement.querySelector(".ui-avatar__content");
|
|
125
|
+
if (r)
|
|
126
|
+
if (t) {
|
|
127
|
+
const l = r.querySelector("img");
|
|
128
|
+
if (l && l.getAttribute("src") === t)
|
|
129
|
+
l.alt = i || "Avatar";
|
|
130
|
+
else {
|
|
131
|
+
r.textContent = "";
|
|
132
|
+
const c = document.createElement("img");
|
|
133
|
+
c.className = "ui-avatar__img", c.src = t, c.alt = i || "Avatar", c.onerror = () => {
|
|
134
|
+
this.renderFallback(r, i);
|
|
135
|
+
}, r.appendChild(c);
|
|
136
|
+
}
|
|
137
|
+
} else
|
|
138
|
+
r.textContent = "", this.renderFallback(r, i);
|
|
139
|
+
o && ["online", "offline", "ausente", "ocupado"].includes(o) ? (this.statusElement.className = `ui-avatar__status ui-avatar__status--${o}`, this.statusElement.style.display = "block") : this.statusElement.style.display = "none";
|
|
140
|
+
}
|
|
141
|
+
renderFallback(t, i) {
|
|
142
|
+
i ? t.textContent = this.extrairIniciais(i) : t.innerHTML = `
|
|
143
|
+
<svg viewBox="0 0 24 24" width="60%" height="60%" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
144
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
145
|
+
<circle cx="12" cy="7" r="4"></circle>
|
|
146
|
+
</svg>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
d("ui-avatar", w);
|
|
151
|
+
class E {
|
|
152
|
+
constructor(n, t) {
|
|
153
|
+
u(this, "rafId", null);
|
|
154
|
+
u(this, "resizeObserver");
|
|
155
|
+
this.trackElement = n, this.indicadorElement = t;
|
|
156
|
+
}
|
|
157
|
+
iniciarObserver(n, t) {
|
|
158
|
+
typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(() => {
|
|
159
|
+
this.atualizar(), t && t();
|
|
160
|
+
}), this.resizeObserver.observe(n));
|
|
161
|
+
}
|
|
162
|
+
destruir() {
|
|
163
|
+
this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null);
|
|
164
|
+
}
|
|
165
|
+
atualizar() {
|
|
166
|
+
this.rafId !== null && cancelAnimationFrame(this.rafId), this.rafId = requestAnimationFrame(() => {
|
|
167
|
+
this.rafId = null;
|
|
168
|
+
const n = this.trackElement.querySelector(".ui-segmented__item--ativo");
|
|
169
|
+
if (!n) {
|
|
170
|
+
this.indicadorElement.style.opacity = "0";
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const t = Math.round(n.offsetLeft), i = Math.round(n.offsetWidth);
|
|
174
|
+
this.indicadorElement.style.transform = `translateX(${t}px)`, this.indicadorElement.style.width = `${i}px`, this.indicadorElement.style.opacity = "1";
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function z(s, n, t, i) {
|
|
179
|
+
if (t) return;
|
|
180
|
+
const e = Array.from(
|
|
181
|
+
n.querySelectorAll(".ui-segmented__item:not(:disabled)")
|
|
182
|
+
);
|
|
183
|
+
if (e.length === 0) return;
|
|
184
|
+
const a = e.findIndex((l) => l.classList.contains("ui-segmented__item--ativo"));
|
|
185
|
+
let o = a;
|
|
186
|
+
if (s.key === "ArrowRight" || s.key === "ArrowDown")
|
|
187
|
+
s.preventDefault(), o = (a + 1) % e.length;
|
|
188
|
+
else if (s.key === "ArrowLeft" || s.key === "ArrowUp")
|
|
189
|
+
s.preventDefault(), o = (a - 1 + e.length) % e.length;
|
|
190
|
+
else if (s.key === "Home")
|
|
191
|
+
s.preventDefault(), o = 0;
|
|
192
|
+
else if (s.key === "End")
|
|
193
|
+
s.preventDefault(), o = e.length - 1;
|
|
194
|
+
else
|
|
195
|
+
return;
|
|
196
|
+
const r = e[o];
|
|
197
|
+
if (r && r.dataset.indice) {
|
|
198
|
+
const l = parseInt(r.dataset.indice, 10);
|
|
199
|
+
i(l);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const k = ':host{display:inline-block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([largura-total]),:host([full-width]){display:block;width:100%}.ui-segmented{display:inline-flex;position:relative;background-color:var(--ui-cor-fundo, #0b0b0d);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);padding:3px;box-sizing:border-box;-webkit-user-select:none;user-select:none;gap:2px;align-items:center}:root[data-tema=claro] .ui-segmented,[data-tema=claro] .ui-segmented{background-color:var(--ui-cor-fundo-elevado, #f1f3f5);border-color:#00000014}.ui-segmented--full{display:flex;width:100%}.ui-segmented--full .ui-segmented__item{flex:1}.ui-segmented--sm{padding:2px;height:28px}.ui-segmented--sm .ui-segmented__item{font-size:12px;padding:0 8px;height:22px}.ui-segmented--md{padding:3px;height:36px}.ui-segmented--md .ui-segmented__item{font-size:13px;padding:0 14px;height:28px}.ui-segmented--lg{padding:4px;height:42px}.ui-segmented--lg .ui-segmented__item{font-size:14px;padding:0 18px;height:32px}.ui-segmented__indicador{position:absolute;top:3px;bottom:3px;left:0;background-color:var(--ui-cor-fundo-elevado, #1e1e24);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:calc(var(--ui-raio-borda, 8px) - 2px);box-shadow:0 2px 8px #0006;pointer-events:none;transition:transform .22s cubic-bezier(.16,1,.3,1),width .22s cubic-bezier(.16,1,.3,1),opacity .15s ease;z-index:1;opacity:0}:root[data-tema=claro] .ui-segmented__indicador,[data-tema=claro] .ui-segmented__indicador{background-color:#fff;border-color:#0000001a;box-shadow:0 2px 6px #00000014}.ui-segmented--sm .ui-segmented__indicador{top:2px;bottom:2px}.ui-segmented--lg .ui-segmented__indicador{top:4px;bottom:4px}.ui-segmented__item{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;gap:6px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-weight:500;cursor:pointer;border-radius:calc(var(--ui-raio-borda, 8px) - 2px);line-height:1;white-space:nowrap;transition:color .15s ease;box-sizing:border-box}:root[data-tema=claro] .ui-segmented__item,[data-tema=claro] .ui-segmented__item{color:#6c757d}.ui-segmented__item:hover:not(:disabled){color:var(--ui-cor-texto, #e1e1e6)}:root[data-tema=claro] .ui-segmented__item:hover:not(:disabled){color:#1a1a1e}.ui-segmented__item--ativo{color:var(--ui-cor-texto, #ffffff)!important;font-weight:600}:root[data-tema=claro] .ui-segmented__item--ativo{color:#1a1a1e!important}.ui-segmented__item:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-primaria, #00E08A)}.ui-segmented__item:disabled{opacity:.35;cursor:not-allowed}.ui-segmented__icone{display:inline-flex;align-items:center;justify-content:center;line-height:1}.ui-segmented__icone ui-icone,.ui-segmented__icone svg{shape-rendering:geometricPrecision;display:inline-flex;align-items:center;justify-content:center}', S = [
|
|
203
|
+
"valor",
|
|
204
|
+
"value",
|
|
205
|
+
"name",
|
|
206
|
+
"disabled",
|
|
207
|
+
"tamanho",
|
|
208
|
+
"size",
|
|
209
|
+
"largura-total",
|
|
210
|
+
"full-width",
|
|
211
|
+
"obrigatorio",
|
|
212
|
+
"required",
|
|
213
|
+
"mensagem-validacao"
|
|
214
|
+
];
|
|
215
|
+
function C() {
|
|
216
|
+
return `
|
|
217
|
+
<style>${k}</style>
|
|
218
|
+
<div class="ui-segmented ui-segmented--md" role="radiogroup">
|
|
219
|
+
<div class="ui-segmented__indicador"></div>
|
|
220
|
+
<div class="ui-segmented__track" style="display: contents;"></div>
|
|
221
|
+
<slot style="display: none;"></slot>
|
|
222
|
+
</div>
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
function I(s, n, t, i, e) {
|
|
226
|
+
const a = document.createElement("button");
|
|
227
|
+
a.type = "button", a.role = "radio", a.className = "ui-segmented__item", a.dataset.valor = s.valor, a.dataset.indice = String(n);
|
|
228
|
+
const o = s.valor === t;
|
|
229
|
+
if (a.setAttribute("aria-checked", String(o)), a.tabIndex = o ? 0 : -1, o && a.classList.add("ui-segmented__item--ativo"), (i || s.disabled) && (a.disabled = !0), s.icone) {
|
|
230
|
+
const l = document.createElement("span");
|
|
231
|
+
l.className = "ui-segmented__icone";
|
|
232
|
+
const c = document.createElement("ui-icone");
|
|
233
|
+
c.setAttribute("nome", s.icone), c.setAttribute("tamanho", "14"), l.appendChild(c), a.appendChild(l);
|
|
234
|
+
}
|
|
235
|
+
const r = document.createElement("span");
|
|
236
|
+
return r.className = "ui-segmented__texto", r.textContent = s.rotulo, a.appendChild(r), a.addEventListener("click", (l) => {
|
|
237
|
+
l.stopPropagation(), e();
|
|
238
|
+
}), a;
|
|
239
|
+
}
|
|
240
|
+
class m extends b {
|
|
241
|
+
constructor() {
|
|
242
|
+
super();
|
|
243
|
+
u(this, "rootElement");
|
|
244
|
+
u(this, "trackElement");
|
|
245
|
+
u(this, "indicadorElement");
|
|
246
|
+
u(this, "slotElement");
|
|
247
|
+
u(this, "_opcoes", []);
|
|
248
|
+
u(this, "_defaultValue", "");
|
|
249
|
+
u(this, "listeners", new f());
|
|
250
|
+
u(this, "indicadorController");
|
|
251
|
+
u(this, "handleSlotChange", () => {
|
|
252
|
+
this._opcoes.length === 0 && this.carregarOpcoes();
|
|
253
|
+
});
|
|
254
|
+
u(this, "handleKeyDown", (t) => {
|
|
255
|
+
z(t, this.trackElement, this.disabled, (i) => {
|
|
256
|
+
this.selecionarIndice(i);
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
const t = this.attachShadow({ mode: "open" });
|
|
260
|
+
t.innerHTML = C(), this.rootElement = t.querySelector(".ui-segmented"), this.indicadorElement = t.querySelector(".ui-segmented__indicador"), this.trackElement = t.querySelector(".ui-segmented__track"), this.slotElement = t.querySelector("slot"), this.indicadorController = new E(
|
|
261
|
+
this.trackElement,
|
|
262
|
+
this.indicadorElement
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
static get observedAttributes() {
|
|
266
|
+
return S;
|
|
267
|
+
}
|
|
268
|
+
connectedCallback() {
|
|
269
|
+
this.listeners.cleanup(), this.listeners.add(this.rootElement, "keydown", this.handleKeyDown), this.listeners.add(this.slotElement, "slotchange", this.handleSlotChange), this._defaultValue || (this._defaultValue = this.getAttribute("valor") || this.getAttribute("value") || ""), this.indicadorController.iniciarObserver(this.rootElement), this.carregarOpcoes(), this.syncState();
|
|
270
|
+
}
|
|
271
|
+
disconnectedCallback() {
|
|
272
|
+
this.listeners.cleanup(), this.indicadorController.destruir();
|
|
273
|
+
}
|
|
274
|
+
attributeChangedCallback(t, i, e) {
|
|
275
|
+
i !== e && (t === "valor" || t === "value" ? this.atualizarSelecao(e || "") : this.syncState());
|
|
276
|
+
}
|
|
277
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
278
|
+
formResetCallback() {
|
|
279
|
+
this.valor = this._defaultValue, this.syncState();
|
|
280
|
+
}
|
|
281
|
+
formStateRestoreCallback(t, i) {
|
|
282
|
+
typeof t == "string" && (this.valor = t), this.syncState();
|
|
283
|
+
}
|
|
284
|
+
get type() {
|
|
285
|
+
return "select-one";
|
|
286
|
+
}
|
|
287
|
+
atualizarValidade() {
|
|
288
|
+
if (!this.internals || typeof this.internals.setValidity != "function") return;
|
|
289
|
+
if (this.disabled) {
|
|
290
|
+
this.internals.setValidity({});
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (this._customErrorMessage) {
|
|
294
|
+
this.internals.setValidity({ customError: !0 }, this._customErrorMessage, this.rootElement);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if ((this.hasAttribute("obrigatorio") || this.hasAttribute("required")) && (!this.valor || this.valor.trim() === "")) {
|
|
298
|
+
const i = this.getAttribute("mensagem-validacao") || "Selecione uma opção.";
|
|
299
|
+
this.internals.setValidity({ valueMissing: !0 }, i, this.rootElement);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
this.internals.setValidity({});
|
|
303
|
+
}
|
|
304
|
+
get valor() {
|
|
305
|
+
return this.getAttribute("valor") || this.getAttribute("value") || "";
|
|
306
|
+
}
|
|
307
|
+
set valor(t) {
|
|
308
|
+
this.setAttribute("valor", t), this.atualizarSelecao(t);
|
|
309
|
+
}
|
|
310
|
+
get value() {
|
|
311
|
+
return this.valor;
|
|
312
|
+
}
|
|
313
|
+
set value(t) {
|
|
314
|
+
this.valor = t;
|
|
315
|
+
}
|
|
316
|
+
get name() {
|
|
317
|
+
return this.getAttribute("name") || "";
|
|
318
|
+
}
|
|
319
|
+
set name(t) {
|
|
320
|
+
this.setAttribute("name", t);
|
|
321
|
+
}
|
|
322
|
+
get disabled() {
|
|
323
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
324
|
+
}
|
|
325
|
+
set disabled(t) {
|
|
326
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
327
|
+
}
|
|
328
|
+
get opcoes() {
|
|
329
|
+
return this._opcoes;
|
|
330
|
+
}
|
|
331
|
+
set opcoes(t) {
|
|
332
|
+
this._opcoes = Array.isArray(t) ? t : [], this.renderizarOpcoes();
|
|
333
|
+
}
|
|
334
|
+
carregarOpcoes() {
|
|
335
|
+
const t = this.slotElement.assignedElements();
|
|
336
|
+
if (t.length > 0) {
|
|
337
|
+
const i = [];
|
|
338
|
+
t.forEach((e) => {
|
|
339
|
+
var a, o;
|
|
340
|
+
if (e instanceof HTMLElement) {
|
|
341
|
+
const r = e.getAttribute("valor") || e.getAttribute("value") || e.getAttribute("data-value") || ((a = e.textContent) == null ? void 0 : a.trim()) || "", l = e.getAttribute("label") || e.getAttribute("rotulo") || ((o = e.textContent) == null ? void 0 : o.trim()) || r, c = e.getAttribute("icone") || e.getAttribute("icon") || void 0, p = e.hasAttribute("disabled");
|
|
342
|
+
i.push({ valor: r, rotulo: l, icone: c, disabled: p });
|
|
343
|
+
}
|
|
344
|
+
}), this._opcoes = i, this.renderizarOpcoes();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
renderizarOpcoes() {
|
|
348
|
+
this.trackElement.innerHTML = "";
|
|
349
|
+
const t = this.valor, i = this.disabled;
|
|
350
|
+
this._opcoes.forEach((a, o) => {
|
|
351
|
+
const r = I(
|
|
352
|
+
a,
|
|
353
|
+
o,
|
|
354
|
+
t,
|
|
355
|
+
i,
|
|
356
|
+
() => this.selecionarIndice(o)
|
|
357
|
+
);
|
|
358
|
+
this.trackElement.appendChild(r);
|
|
359
|
+
});
|
|
360
|
+
const e = this.required || this.hasAttribute("sem-selecao-inicial");
|
|
361
|
+
!t && this._opcoes.length > 0 && !e ? this.selecionarIndice(0, !1) : this.indicadorController.atualizar(), this.atualizarValidade();
|
|
362
|
+
}
|
|
363
|
+
selecionarIndice(t, i = !0) {
|
|
364
|
+
var o, r;
|
|
365
|
+
if (this.disabled) return;
|
|
366
|
+
const e = this._opcoes[t];
|
|
367
|
+
if (!e || e.disabled) return;
|
|
368
|
+
const a = this.valor;
|
|
369
|
+
this.setAttribute("valor", e.valor), this.internals && ((r = (o = this.internals).setFormValue) == null || r.call(o, e.valor)), this.atualizarSelecao(e.valor), i && a !== e.valor && (this.dispatchEvent(
|
|
370
|
+
new CustomEvent("ui-change", {
|
|
371
|
+
detail: { valor: e.valor, rotulo: e.rotulo, indice: t },
|
|
372
|
+
bubbles: !0,
|
|
373
|
+
composed: !0
|
|
374
|
+
})
|
|
375
|
+
), this.dispatchEvent(
|
|
376
|
+
new CustomEvent("ui-selecionar", {
|
|
377
|
+
detail: { valor: e.valor, rotulo: e.rotulo, indice: t },
|
|
378
|
+
bubbles: !0,
|
|
379
|
+
composed: !0
|
|
380
|
+
})
|
|
381
|
+
));
|
|
382
|
+
}
|
|
383
|
+
atualizarSelecao(t) {
|
|
384
|
+
var e, a;
|
|
385
|
+
Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((o) => {
|
|
386
|
+
const r = o.dataset.valor === t;
|
|
387
|
+
o.classList.toggle("ui-segmented__item--ativo", r), o.setAttribute("aria-checked", String(r)), o.tabIndex = r ? 0 : -1, r && o.focus();
|
|
388
|
+
}), this.internals && ((a = (e = this.internals).setFormValue) == null || a.call(e, t)), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
389
|
+
}
|
|
390
|
+
syncState() {
|
|
391
|
+
const t = this.getAttribute("tamanho") || this.getAttribute("size") || "md", i = this.hasAttribute("largura-total") || this.hasAttribute("full-width"), e = this.disabled;
|
|
392
|
+
this.rootElement.className = `ui-segmented ui-segmented--${t}`, i && this.rootElement.classList.add("ui-segmented--full"), this.rootElement.setAttribute("aria-disabled", String(e)), Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach((o) => {
|
|
393
|
+
o.disabled = e;
|
|
394
|
+
}), this.indicadorController.atualizar(), this.atualizarValidade();
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
class q extends m {
|
|
398
|
+
}
|
|
399
|
+
d("ui-segmented", m);
|
|
400
|
+
d("ui-segmento", q);
|
|
401
|
+
export {
|
|
402
|
+
S as A,
|
|
403
|
+
E as S,
|
|
404
|
+
w as U,
|
|
405
|
+
m as a,
|
|
406
|
+
q as b,
|
|
407
|
+
y as c,
|
|
408
|
+
I as d,
|
|
409
|
+
C as e,
|
|
410
|
+
z as t
|
|
411
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";var E=Object.defineProperty;var A=(s,n,t)=>n in s?E(s,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[n]=t;var u=(s,n,t)=>A(s,typeof n!="symbol"?n+"":n,t);const d=require("./ssr-safe-CiHD1adl.cjs"),w=require("./listener-bag-D5omxZ9h.cjs"),S=require("./ui-campo-texto-BCh5HyCM.cjs"),z=':host{display:block;box-sizing:border-box;margin:0;padding:0;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){display:inline-block}.ui-texto{margin:0;padding:0;box-sizing:border-box;font-family:inherit;color:inherit;font-size:inherit;font-weight:inherit;line-height:inherit}.ui-texto--h1{font-size:var(--ui-tamanho-h1, clamp(24px, 4vw, 36px));font-weight:var(--ui-peso-negrito, 700);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.5px}.ui-texto--h2{font-size:var(--ui-tamanho-h2, clamp(20px, 3vw, 28px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);letter-spacing:-.3px}.ui-texto--h3{font-size:var(--ui-tamanho-h3, clamp(18px, 2.4vw, 24px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h4{font-size:var(--ui-tamanho-h4, clamp(16px, 2vw, 20px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h5{font-size:var(--ui-tamanho-h5, clamp(14px, 1.6vw, 18px));font-weight:var(--ui-peso-medio, 500);line-height:var(--ui-altura-linha-titulo, 1.25)}.ui-texto--h6{font-size:var(--ui-tamanho-h6, clamp(13px, 1.2vw, 16px));font-weight:var(--ui-peso-seminegrito, 600);line-height:var(--ui-altura-linha-titulo, 1.25);text-transform:uppercase;letter-spacing:.5px}.ui-texto--corpo{font-size:var(--ui-tamanho-corpo, 14px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--corpo-sm{font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5)}.ui-texto--caption{font-size:var(--ui-tamanho-caption, 11px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-compacta, 1.2);color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--codigo{font-family:var(--ui-fonte-codigo, monospace);font-size:var(--ui-tamanho-codigo, 12px);font-weight:var(--ui-peso-normal, 400);line-height:var(--ui-altura-linha-corpo, 1.5);background:var(--ui-cor-fundo-elevado, #1a1a1e);padding:2px 6px;border-radius:4px;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12))}.ui-texto--cor-primaria{color:var(--ui-cor-primaria, #00E08A)}.ui-texto--cor-secundaria{color:var(--ui-cor-texto-secundario, #888899)}.ui-texto--cor-destaque{color:var(--ui-cor-destaque, #00E08A)}.ui-texto--cor-erro{color:var(--ui-cor-texto-erro, #ff5555)}.ui-texto--cor-sucesso{color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-texto--cor-alerta{color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-texto--peso-normal{font-weight:var(--ui-peso-normal, 400)!important}.ui-texto--peso-medio{font-weight:var(--ui-peso-medio, 500)!important}.ui-texto--peso-seminegrito{font-weight:var(--ui-peso-seminegrito, 600)!important}.ui-texto--peso-negrito{font-weight:var(--ui-peso-negrito, 700)!important}.ui-texto--alinhamento-esquerda{text-align:left}.ui-texto--alinhamento-centro{text-align:center}.ui-texto--alinhamento-direita{text-align:right}.ui-texto--alinhamento-justificado{text-align:justify}.ui-texto--truncar{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block}',k=new Set(["p","span","div","h1","h2","h3","h4","h5","h6","small","code","strong","em","label","blockquote","pre","b","i"]);class m extends d.SafeHTMLElement{constructor(){super();u(this,"container");u(this,"shadow");typeof this.attachShadow=="function"&&typeof document<"u"?(this.shadow=this.attachShadow({mode:"open"}),this.container=document.createElement("p"),this.container.className="ui-texto ui-texto--corpo",this.container.appendChild(document.createElement("slot")),this.shadow.innerHTML=`<style>${z}</style>`,this.shadow.appendChild(this.container)):(this.shadow=null,this.container=null)}static get observedAttributes(){return["variante","tag","cor","peso","alinhamento","truncar"]}connectedCallback(){this.render()}attributeChangedCallback(t,i,e){this.render()}resolveTag(){const t=this.getAttribute("tag");if(t){const e=t.toLowerCase().trim();if(k.has(e))return e;console.warn(`[ui-texto] Tag "${t}" não permitida ou inválida. Utilizando fallback semântico.`)}const i=(this.getAttribute("variante")||"corpo").toLowerCase();switch(i){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return i;case"caption":return"small";case"codigo":return"code";case"corpo-sm":case"corpo":default:return"p"}}render(){const t=this.resolveTag(),i=this.getAttribute("variante")||"corpo",e=this.getAttribute("cor"),a=this.getAttribute("peso"),o=this.getAttribute("alinhamento"),r=this.hasAttribute("truncar");if(this.container.tagName.toLowerCase()!==t){const c=document.createElement(t);c.appendChild(document.createElement("slot")),this.shadow.replaceChild(c,this.container),this.container=c}const l=["ui-texto",`ui-texto--${i}`];e&&l.push(`ui-texto--cor-${e}`),a&&l.push(`ui-texto--peso-${a}`),o&&l.push(`ui-texto--alinhamento-${o}`),r&&l.push("ui-texto--truncar"),this.container.className=l.join(" ")}}d.definirCustomElement("ui-texto",m);const C=':host{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif);vertical-align:middle;position:relative}.ui-avatar{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--ui-tamanho-avatar, 36px);height:var(--ui-tamanho-avatar, 36px);min-width:var(--ui-tamanho-avatar, 36px);min-height:var(--ui-tamanho-avatar, 36px);border-radius:50%;background-color:var(--ui-cor-fundo-elevado, #22222a);color:var(--ui-cor-primaria, #00E08A);font-weight:600;font-size:var(--ui-avatar-font-size, 14px);-webkit-user-select:none;user-select:none;box-sizing:border-box;overflow:hidden;border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));line-height:1}.ui-avatar__img{width:100%;height:100%;object-fit:cover;display:block}.ui-avatar--quadrado{border-radius:8px}.ui-avatar__status{position:absolute;bottom:0;right:0;width:25%;height:25%;min-width:8px;min-height:8px;max-width:14px;max-height:14px;border-radius:50%;border:2px solid var(--ui-cor-fundo-card, #121214);box-sizing:border-box}.ui-avatar__status--online{background-color:var(--ui-cor-primaria, #00E08A)}.ui-avatar__status--offline{background-color:#889}.ui-avatar__status--ausente{background-color:#ffb86c}.ui-avatar__status--ocupado{background-color:#f55}.ui-avatar--xs{--ui-tamanho-avatar: 20px;--ui-avatar-font-size: 10px}.ui-avatar--sm{--ui-tamanho-avatar: 28px;--ui-avatar-font-size: 11px}.ui-avatar--md{--ui-tamanho-avatar: 36px;--ui-avatar-font-size: 14px}.ui-avatar--lg{--ui-tamanho-avatar: 48px;--ui-avatar-font-size: 18px}.ui-avatar--xl{--ui-tamanho-avatar: 64px;--ui-avatar-font-size: 24px}';class p extends d.SafeHTMLElement{constructor(){super();u(this,"avatarElement");u(this,"statusElement");const t=this.attachShadow({mode:"open"});t.innerHTML=`
|
|
2
|
+
<style>${C}</style>
|
|
3
|
+
<div class="ui-avatar">
|
|
4
|
+
<span class="ui-avatar__content"></span>
|
|
5
|
+
</div>
|
|
6
|
+
<span class="ui-avatar__status" style="display: none;"></span>
|
|
7
|
+
`,this.avatarElement=t.querySelector(".ui-avatar"),this.statusElement=t.querySelector(".ui-avatar__status")}static get observedAttributes(){return["src","nome","name","tamanho","size","formato","status"]}connectedCallback(){this.syncState()}attributeChangedCallback(t,i,e){this.syncState()}extrairIniciais(t){const i=t.trim().split(/\s+/).filter(Boolean);if(i.length===0)return"?";if(i.length===1)return i[0].substring(0,2).toUpperCase();const e=i[0][0],a=i[i.length-1][0];return(e+a).toUpperCase()}syncState(){const t=this.getAttribute("src"),i=this.getAttribute("nome")||this.getAttribute("name")||"",e=this.getAttribute("tamanho")||this.getAttribute("size")||"md",a=this.getAttribute("formato")||"circulo",o=this.getAttribute("status");this.avatarElement.className="ui-avatar",["xs","sm","md","lg","xl"].includes(e)?(this.avatarElement.classList.add(`ui-avatar--${e}`),this.avatarElement.style.removeProperty("--ui-tamanho-avatar")):isNaN(parseInt(e,10))?this.avatarElement.style.removeProperty("--ui-tamanho-avatar"):this.avatarElement.style.setProperty("--ui-tamanho-avatar",`${parseInt(e,10)}px`),a==="quadrado"&&this.avatarElement.classList.add("ui-avatar--quadrado");const r=this.avatarElement.querySelector(".ui-avatar__content");if(r)if(t){const l=r.querySelector("img");if(l&&l.getAttribute("src")===t)l.alt=i||"Avatar";else{r.textContent="";const c=document.createElement("img");c.className="ui-avatar__img",c.src=t,c.alt=i||"Avatar",c.onerror=()=>{this.renderFallback(r,i)},r.appendChild(c)}}else r.textContent="",this.renderFallback(r,i);o&&["online","offline","ausente","ocupado"].includes(o)?(this.statusElement.className=`ui-avatar__status ui-avatar__status--${o}`,this.statusElement.style.display="block"):this.statusElement.style.display="none"}renderFallback(t,i){i?t.textContent=this.extrairIniciais(i):t.innerHTML=`
|
|
8
|
+
<svg viewBox="0 0 24 24" width="60%" height="60%" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
9
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
10
|
+
<circle cx="12" cy="7" r="4"></circle>
|
|
11
|
+
</svg>
|
|
12
|
+
`}}d.definirCustomElement("ui-avatar",p);class g{constructor(n,t){u(this,"rafId",null);u(this,"resizeObserver");this.trackElement=n,this.indicadorElement=t}iniciarObserver(n,t){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>{this.atualizar(),t&&t()}),this.resizeObserver.observe(n))}destruir(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=void 0),this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}atualizar(){this.rafId!==null&&cancelAnimationFrame(this.rafId),this.rafId=requestAnimationFrame(()=>{this.rafId=null;const n=this.trackElement.querySelector(".ui-segmented__item--ativo");if(!n){this.indicadorElement.style.opacity="0";return}const t=Math.round(n.offsetLeft),i=Math.round(n.offsetWidth);this.indicadorElement.style.transform=`translateX(${t}px)`,this.indicadorElement.style.width=`${i}px`,this.indicadorElement.style.opacity="1"})}}function v(s,n,t,i){if(t)return;const e=Array.from(n.querySelectorAll(".ui-segmented__item:not(:disabled)"));if(e.length===0)return;const a=e.findIndex(l=>l.classList.contains("ui-segmented__item--ativo"));let o=a;if(s.key==="ArrowRight"||s.key==="ArrowDown")s.preventDefault(),o=(a+1)%e.length;else if(s.key==="ArrowLeft"||s.key==="ArrowUp")s.preventDefault(),o=(a-1+e.length)%e.length;else if(s.key==="Home")s.preventDefault(),o=0;else if(s.key==="End")s.preventDefault(),o=e.length-1;else return;const r=e[o];if(r&&r.dataset.indice){const l=parseInt(r.dataset.indice,10);i(l)}}const I=':host{display:inline-block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([largura-total]),:host([full-width]){display:block;width:100%}.ui-segmented{display:inline-flex;position:relative;background-color:var(--ui-cor-fundo, #0b0b0d);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);padding:3px;box-sizing:border-box;-webkit-user-select:none;user-select:none;gap:2px;align-items:center}:root[data-tema=claro] .ui-segmented,[data-tema=claro] .ui-segmented{background-color:var(--ui-cor-fundo-elevado, #f1f3f5);border-color:#00000014}.ui-segmented--full{display:flex;width:100%}.ui-segmented--full .ui-segmented__item{flex:1}.ui-segmented--sm{padding:2px;height:28px}.ui-segmented--sm .ui-segmented__item{font-size:12px;padding:0 8px;height:22px}.ui-segmented--md{padding:3px;height:36px}.ui-segmented--md .ui-segmented__item{font-size:13px;padding:0 14px;height:28px}.ui-segmented--lg{padding:4px;height:42px}.ui-segmented--lg .ui-segmented__item{font-size:14px;padding:0 18px;height:32px}.ui-segmented__indicador{position:absolute;top:3px;bottom:3px;left:0;background-color:var(--ui-cor-fundo-elevado, #1e1e24);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:calc(var(--ui-raio-borda, 8px) - 2px);box-shadow:0 2px 8px #0006;pointer-events:none;transition:transform .22s cubic-bezier(.16,1,.3,1),width .22s cubic-bezier(.16,1,.3,1),opacity .15s ease;z-index:1;opacity:0}:root[data-tema=claro] .ui-segmented__indicador,[data-tema=claro] .ui-segmented__indicador{background-color:#fff;border-color:#0000001a;box-shadow:0 2px 6px #00000014}.ui-segmented--sm .ui-segmented__indicador{top:2px;bottom:2px}.ui-segmented--lg .ui-segmented__indicador{top:4px;bottom:4px}.ui-segmented__item{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;gap:6px;background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-family:inherit;font-weight:500;cursor:pointer;border-radius:calc(var(--ui-raio-borda, 8px) - 2px);line-height:1;white-space:nowrap;transition:color .15s ease;box-sizing:border-box}:root[data-tema=claro] .ui-segmented__item,[data-tema=claro] .ui-segmented__item{color:#6c757d}.ui-segmented__item:hover:not(:disabled){color:var(--ui-cor-texto, #e1e1e6)}:root[data-tema=claro] .ui-segmented__item:hover:not(:disabled){color:#1a1a1e}.ui-segmented__item--ativo{color:var(--ui-cor-texto, #ffffff)!important;font-weight:600}:root[data-tema=claro] .ui-segmented__item--ativo{color:#1a1a1e!important}.ui-segmented__item:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-primaria, #00E08A)}.ui-segmented__item:disabled{opacity:.35;cursor:not-allowed}.ui-segmented__icone{display:inline-flex;align-items:center;justify-content:center;line-height:1}.ui-segmented__icone ui-icone,.ui-segmented__icone svg{shape-rendering:geometricPrecision;display:inline-flex;align-items:center;justify-content:center}',f=["valor","value","name","disabled","tamanho","size","largura-total","full-width","obrigatorio","required","mensagem-validacao"];function b(){return`
|
|
13
|
+
<style>${I}</style>
|
|
14
|
+
<div class="ui-segmented ui-segmented--md" role="radiogroup">
|
|
15
|
+
<div class="ui-segmented__indicador"></div>
|
|
16
|
+
<div class="ui-segmented__track" style="display: contents;"></div>
|
|
17
|
+
<slot style="display: none;"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
`}function x(s,n,t,i,e){const a=document.createElement("button");a.type="button",a.role="radio",a.className="ui-segmented__item",a.dataset.valor=s.valor,a.dataset.indice=String(n);const o=s.valor===t;if(a.setAttribute("aria-checked",String(o)),a.tabIndex=o?0:-1,o&&a.classList.add("ui-segmented__item--ativo"),(i||s.disabled)&&(a.disabled=!0),s.icone){const l=document.createElement("span");l.className="ui-segmented__icone";const c=document.createElement("ui-icone");c.setAttribute("nome",s.icone),c.setAttribute("tamanho","14"),l.appendChild(c),a.appendChild(l)}const r=document.createElement("span");return r.className="ui-segmented__texto",r.textContent=s.rotulo,a.appendChild(r),a.addEventListener("click",l=>{l.stopPropagation(),e()}),a}class h extends S.FormAssociatedElement{constructor(){super();u(this,"rootElement");u(this,"trackElement");u(this,"indicadorElement");u(this,"slotElement");u(this,"_opcoes",[]);u(this,"_defaultValue","");u(this,"listeners",new w.ListenerBag);u(this,"indicadorController");u(this,"handleSlotChange",()=>{this._opcoes.length===0&&this.carregarOpcoes()});u(this,"handleKeyDown",t=>{v(t,this.trackElement,this.disabled,i=>{this.selecionarIndice(i)})});const t=this.attachShadow({mode:"open"});t.innerHTML=b(),this.rootElement=t.querySelector(".ui-segmented"),this.indicadorElement=t.querySelector(".ui-segmented__indicador"),this.trackElement=t.querySelector(".ui-segmented__track"),this.slotElement=t.querySelector("slot"),this.indicadorController=new g(this.trackElement,this.indicadorElement)}static get observedAttributes(){return f}connectedCallback(){this.listeners.cleanup(),this.listeners.add(this.rootElement,"keydown",this.handleKeyDown),this.listeners.add(this.slotElement,"slotchange",this.handleSlotChange),this._defaultValue||(this._defaultValue=this.getAttribute("valor")||this.getAttribute("value")||""),this.indicadorController.iniciarObserver(this.rootElement),this.carregarOpcoes(),this.syncState()}disconnectedCallback(){this.listeners.cleanup(),this.indicadorController.destruir()}attributeChangedCallback(t,i,e){i!==e&&(t==="valor"||t==="value"?this.atualizarSelecao(e||""):this.syncState())}formResetCallback(){this.valor=this._defaultValue,this.syncState()}formStateRestoreCallback(t,i){typeof t=="string"&&(this.valor=t),this.syncState()}get type(){return"select-one"}atualizarValidade(){if(!this.internals||typeof this.internals.setValidity!="function")return;if(this.disabled){this.internals.setValidity({});return}if(this._customErrorMessage){this.internals.setValidity({customError:!0},this._customErrorMessage,this.rootElement);return}if((this.hasAttribute("obrigatorio")||this.hasAttribute("required"))&&(!this.valor||this.valor.trim()==="")){const i=this.getAttribute("mensagem-validacao")||"Selecione uma opção.";this.internals.setValidity({valueMissing:!0},i,this.rootElement);return}this.internals.setValidity({})}get valor(){return this.getAttribute("valor")||this.getAttribute("value")||""}set valor(t){this.setAttribute("valor",t),this.atualizarSelecao(t)}get value(){return this.valor}set value(t){this.valor=t}get name(){return this.getAttribute("name")||""}set name(t){this.setAttribute("name",t)}get disabled(){return this.hasAttribute("disabled")||this._formDisabled}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get opcoes(){return this._opcoes}set opcoes(t){this._opcoes=Array.isArray(t)?t:[],this.renderizarOpcoes()}carregarOpcoes(){const t=this.slotElement.assignedElements();if(t.length>0){const i=[];t.forEach(e=>{var a,o;if(e instanceof HTMLElement){const r=e.getAttribute("valor")||e.getAttribute("value")||e.getAttribute("data-value")||((a=e.textContent)==null?void 0:a.trim())||"",l=e.getAttribute("label")||e.getAttribute("rotulo")||((o=e.textContent)==null?void 0:o.trim())||r,c=e.getAttribute("icone")||e.getAttribute("icon")||void 0,y=e.hasAttribute("disabled");i.push({valor:r,rotulo:l,icone:c,disabled:y})}}),this._opcoes=i,this.renderizarOpcoes()}}renderizarOpcoes(){this.trackElement.innerHTML="";const t=this.valor,i=this.disabled;this._opcoes.forEach((a,o)=>{const r=x(a,o,t,i,()=>this.selecionarIndice(o));this.trackElement.appendChild(r)});const e=this.required||this.hasAttribute("sem-selecao-inicial");!t&&this._opcoes.length>0&&!e?this.selecionarIndice(0,!1):this.indicadorController.atualizar(),this.atualizarValidade()}selecionarIndice(t,i=!0){var o,r;if(this.disabled)return;const e=this._opcoes[t];if(!e||e.disabled)return;const a=this.valor;this.setAttribute("valor",e.valor),this.internals&&((r=(o=this.internals).setFormValue)==null||r.call(o,e.valor)),this.atualizarSelecao(e.valor),i&&a!==e.valor&&(this.dispatchEvent(new CustomEvent("ui-change",{detail:{valor:e.valor,rotulo:e.rotulo,indice:t},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("ui-selecionar",{detail:{valor:e.valor,rotulo:e.rotulo,indice:t},bubbles:!0,composed:!0})))}atualizarSelecao(t){var e,a;Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach(o=>{const r=o.dataset.valor===t;o.classList.toggle("ui-segmented__item--ativo",r),o.setAttribute("aria-checked",String(r)),o.tabIndex=r?0:-1,r&&o.focus()}),this.internals&&((a=(e=this.internals).setFormValue)==null||a.call(e,t)),this.indicadorController.atualizar(),this.atualizarValidade()}syncState(){const t=this.getAttribute("tamanho")||this.getAttribute("size")||"md",i=this.hasAttribute("largura-total")||this.hasAttribute("full-width"),e=this.disabled;this.rootElement.className=`ui-segmented ui-segmented--${t}`,i&&this.rootElement.classList.add("ui-segmented--full"),this.rootElement.setAttribute("aria-disabled",String(e)),Array.from(this.trackElement.querySelectorAll(".ui-segmented__item")).forEach(o=>{o.disabled=e}),this.indicadorController.atualizar(),this.atualizarValidade()}}class _ extends h{}d.definirCustomElement("ui-segmented",h);d.definirCustomElement("ui-segmento",_);exports.ATRIBUTOS_OBSERVADOS_SEGMENTED=f;exports.SegmentedIndicadorController=g;exports.UIAvatar=p;exports.UISegmented=h;exports.UISegmento=_;exports.UITexto=m;exports.criarBotaoOpcao=x;exports.criarTemplateSegmented=b;exports.tratarTecladoSegmented=v;
|