@thibezer/ui-components-kit 1.0.0 → 2.1.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/CHANGELOG.md +92 -0
- package/LICENSE +21 -21
- package/README.md +150 -14
- package/dist/botao.cjs +1 -1
- package/dist/botao.js +1 -1
- package/dist/camadas.cjs +65 -65
- package/dist/camadas.js +762 -729
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +105 -146
- package/dist/canvas.js +5132 -1199
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-botao/ui-botao.d.ts +15 -0
- package/dist/components/ui-camadas/camadas-persistencia.d.ts +4 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +10 -0
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +5 -0
- package/dist/components/ui-canvas-cad/cad-estilos-externos.d.ts +16 -0
- package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +4 -0
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +262 -0
- package/dist/components/ui-canvas-cad/cad-ferramentas-barra.d.ts +15 -0
- package/dist/components/ui-canvas-cad/cad-snap.d.ts +32 -0
- package/dist/components/ui-canvas-cad/cad-toolbar-painel.d.ts +1 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +143 -0
- package/dist/components/ui-lista-flutuante/lista-flutuante-posicionamento.d.ts +2 -0
- package/dist/components/ui-lista-flutuante/ui-lista-flutuante.d.ts +1 -0
- package/dist/components/ui-modal/modal-pilha.d.ts +3 -0
- package/dist/components/ui-modal/ui-modal.d.ts +19 -4
- package/dist/components/ui-seletor-mapa-base/ui-seletor-mapa-base.d.ts +3 -0
- package/dist/components/ui-tabela/tabela-atributos-sync.d.ts +3 -0
- package/dist/components/ui-tabela/tabela-corpo.d.ts +2 -0
- package/dist/components/ui-tabela/tabela-localizador.d.ts +8 -1
- package/dist/components/ui-tabela/tabela-orquestrador-dados.d.ts +4 -0
- package/dist/components/ui-tabela/tabela-renderizador.d.ts +1 -0
- package/dist/components/ui-tabela/tabela-selecao.d.ts +21 -6
- package/dist/components/ui-tabela/tipos.d.ts +6 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +56 -2
- package/dist/components/ui-tabela-propriedades/avaliador-expressao.d.ts +0 -5
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +17 -1
- package/dist/components/ui-tabela-propriedades/propriedades-flutuante.d.ts +2 -0
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +10 -1
- package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +3 -1
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +5 -1
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +15 -0
- package/dist/core/alvo-digitavel.d.ts +1 -0
- package/dist/core/form-submissao.d.ts +16 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/parts.d.ts +6 -0
- package/dist/core/rotulo.d.ts +6 -0
- package/dist/core/svg-seguro.d.ts +10 -0
- package/dist/core/ui-bus.d.ts +13 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +14 -12
- package/dist/custom-elements.json +32905 -0
- package/dist/data.cjs +1 -1
- package/dist/data.js +51 -46
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +3 -3
- package/dist/form-submissao-C-SPRKgT.js +61 -0
- package/dist/form-submissao-DxKO5MHI.cjs +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +2 -2
- package/dist/gerencigeo-canvas/canvas_interacao.d.ts +18 -0
- package/dist/gerencigeo-canvas/feature_adapters.d.ts +35 -0
- package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +45 -0
- package/dist/gerencigeo-canvas/feature_amostra.d.ts +4 -0
- package/dist/gerencigeo-canvas/feature_caixa.d.ts +19 -0
- package/dist/gerencigeo-canvas/feature_cluster.d.ts +61 -0
- package/dist/gerencigeo-canvas/feature_cursores.d.ts +17 -0
- package/dist/gerencigeo-canvas/feature_desenho.d.ts +53 -0
- package/dist/gerencigeo-canvas/feature_desenho_controle.d.ts +91 -0
- package/dist/gerencigeo-canvas/feature_edicao_ops.d.ts +19 -0
- package/dist/gerencigeo-canvas/feature_editor_vertices.d.ts +62 -0
- package/dist/gerencigeo-canvas/feature_formas.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_hud.d.ts +23 -0
- package/dist/gerencigeo-canvas/feature_indice.d.ts +36 -0
- package/dist/gerencigeo-canvas/feature_metricas.d.ts +16 -0
- package/dist/gerencigeo-canvas/feature_popup.d.ts +31 -0
- package/dist/gerencigeo-canvas/feature_selecao.d.ts +38 -0
- package/dist/gerencigeo-canvas/feature_simplificacao.d.ts +14 -0
- package/dist/gerencigeo-canvas/feature_snap.d.ts +25 -0
- package/dist/gerencigeo-canvas/feature_types.d.ts +86 -0
- package/dist/gerencigeo-canvas/feature_versoes.d.ts +19 -0
- package/dist/gerencigeo-canvas/index.d.ts +21 -0
- package/dist/gerencigeo-canvas/layer_hit_test.d.ts +30 -0
- package/dist/gerencigeo-canvas/layer_manager.d.ts +11 -3
- package/dist/gerencigeo-canvas/layer_pane_ops.d.ts +9 -0
- package/dist/gerencigeo-canvas/mapa_controller.d.ts +1 -0
- package/dist/gerencigeo-canvas/mapa_pontos_shapes.d.ts +24 -5
- package/dist/gerencigeo-canvas/renderers/feicoes_renderer.d.ts +89 -0
- package/dist/gerencigeo-canvas/renderers/vector_points_renderer.d.ts +1 -0
- package/dist/gerencigeo-canvas/renderers/vector_polygons_renderer.d.ts +2 -2
- package/dist/gerencigeo-canvas/types.d.ts +12 -0
- package/dist/gerencigeo-canvas/utils.d.ts +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +117 -112
- package/dist/leaflet-DcO7uRC-.cjs +1 -0
- package/dist/{leaflet-DkaFZYc5.js → leaflet-PPDKB6Dd.js} +37 -37
- package/dist/mapa.cjs +4 -4
- package/dist/mapa.js +2 -2
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/parts-CaoQiCfI.js +7 -0
- package/dist/parts-vQa2873h.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +12 -12
- package/dist/seletor-mapa-base.cjs +16 -16
- package/dist/seletor-mapa-base.js +111 -61
- package/dist/svg-seguro-BsbNQqpd.js +50 -0
- package/dist/svg-seguro-C76iLlAZ.cjs +1 -0
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +41 -36
- package/dist/tipos-elementos.d.ts +1232 -0
- package/dist/tipos-react.d.ts +113 -0
- package/dist/tipos-vue.d.ts +1201 -0
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-BxT-sDmV.cjs +28 -0
- package/dist/ui-badge-C0eKBI8E.js +183 -0
- package/dist/ui-botao-OGJV6Vfk.js +165 -0
- package/dist/ui-botao-psS1juof.cjs +12 -0
- package/dist/ui-campo-texto-Cnn2UAkS.cjs +16 -0
- package/dist/{ui-campo-texto-B_JF6POq.js → ui-campo-texto-Uu2dJE_0.js} +81 -63
- package/dist/{ui-card-Bhm6k91e.cjs → ui-card-B86lJXTP.cjs} +7 -7
- package/dist/{ui-card-BJ8SmvVf.js → ui-card-C_o5_0cB.js} +14 -14
- package/dist/ui-kit.css +1 -1
- package/dist/ui-modal-CvGFGh1h.cjs +18 -0
- package/dist/ui-modal-DBOtSTbR.js +238 -0
- package/dist/{ui-paleta-ferramentas-Bpp4XBVg.js → ui-paleta-ferramentas-CEZYcN4J.js} +18 -27
- package/dist/{ui-paleta-ferramentas-B6dJ0O6K.cjs → ui-paleta-ferramentas-Dbj1kBS9.cjs} +6 -6
- package/dist/ui-segmented-D6b6zxVs.cjs +19 -0
- package/dist/{ui-segmented-C8wuycjJ.js → ui-segmented-wUraId2e.js} +68 -67
- package/dist/ui-skeleton-DI4_9WOX.js +428 -0
- package/dist/ui-skeleton-elhKIh2B.cjs +33 -0
- package/dist/{ui-switch-CO9MoS8x.js → ui-switch-BcOqOkiV.js} +92 -62
- package/dist/ui-switch-D7iPKDj-.cjs +53 -0
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +145 -0
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +2412 -0
- package/dist/{ui-toast-CwUmiqyG.js → ui-toast-Bp_NlM5G.js} +51 -51
- package/dist/ui-toast-DGTZKne5.cjs +20 -0
- package/dist/zero-js-triggers-C_KrvFOQ.js +244 -0
- package/dist/zero-js-triggers-C_gtaojZ.cjs +1 -0
- package/package.json +27 -7
- package/dist/leaflet-Cw6tqYFh.cjs +0 -1
- package/dist/ui-badge-92yelKls.js +0 -183
- package/dist/ui-badge-B95jSECC.cjs +0 -28
- package/dist/ui-botao-BShEouvi.js +0 -124
- package/dist/ui-botao-DF1yuUUD.cjs +0 -12
- package/dist/ui-campo-texto-BCh5HyCM.cjs +0 -16
- package/dist/ui-modal-Bi4isGYh.cjs +0 -18
- package/dist/ui-modal-DV-pw2x1.js +0 -194
- package/dist/ui-segmented-NC5cBXLh.cjs +0 -19
- package/dist/ui-skeleton-B3xQyn0Z.js +0 -396
- package/dist/ui-skeleton-D42oQufF.cjs +0 -33
- package/dist/ui-switch-C6o4yZUF.cjs +0 -53
- package/dist/ui-tabela-propriedades-7yJ9g7ti.cjs +0 -145
- package/dist/ui-tabela-propriedades-D-XKNVwK.js +0 -2078
- package/dist/ui-toast-CQBqvUm3.cjs +0 -20
- package/dist/zero-js-triggers-DdESy0tk.js +0 -205
- package/dist/zero-js-triggers-QGD7FOTv.cjs +0 -1
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
var _ = Object.defineProperty;
|
|
2
|
-
var g = (l, a, t) => a in l ? _(l, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[a] = t;
|
|
3
|
-
var s = (l, a, t) => g(l, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
-
import { d as b, S as y } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
-
const x = ':host{display:block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-modal__backdrop{display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;background-color:#000000b3;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);z-index:calc(var(--ui-z-modal, 1000) - 1);opacity:0;pointer-events:none;transition:opacity .25s ease}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{display:block;opacity:1;pointer-events:auto}.ui-modal__dialog{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%) scale(.95);max-width:560px;width:90%;max-height:85vh;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .16));border-radius:var(--ui-raio-borda, 12px);box-shadow:0 12px 36px #0009;z-index:var(--ui-z-modal, 1000);display:flex;flex-direction:column;opacity:0;visibility:hidden;pointer-events:none;overflow:hidden;transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .2s ease,visibility .2s ease;box-sizing:border-box;color:var(--ui-cor-texto, #e1e1e6)}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:1;visibility:visible;pointer-events:auto;transform:translate(-50%,-50%) scale(1)}@starting-style{:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{opacity:0;transform:translate(-50%,-50%) scale(.94)}:host([aberto]) .ui-modal__backdrop,:host([open]) .ui-modal__backdrop{opacity:0}}.ui-modal__handle{display:none;width:36px;height:4px;border-radius:2px;background-color:#ffffff40;margin:6px auto 12px;flex-shrink:0}.ui-modal__header{padding:16px 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid rgba(255,255,255,.08);gap:12px}.ui-modal__titulo{font-size:18px;font-weight:600;margin:0;color:var(--ui-cor-texto, #e1e1e6)}.ui-modal__close{background:transparent;border:none;color:var(--ui-cor-texto-secundario, #888899);font-size:16px;cursor:pointer;padding:4px 8px;border-radius:4px;line-height:1;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background-color .15s ease;touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-modal__close svg,.ui-modal__close ::slotted(svg){shape-rendering:geometricPrecision}.ui-modal__close:hover{color:#fff;background-color:#ffffff1a}.ui-modal__body{padding:20px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;flex:1;box-sizing:border-box}.ui-modal__footer{padding:14px 20px;display:flex;align-items:center;justify-content:flex-end;gap:12px;border-top:1px solid rgba(255,255,255,.08);background-color:#00000026}@media (max-width: 640px){.ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:16px 16px 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}.ui-modal__close{min-width:44px;min-height:44px;font-size:18px}.ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([aberto]) .ui-modal__dialog,:host([open]) .ui-modal__dialog{transform:translateY(0)!important}.ui-modal__handle{display:block!important}}:host([bottom-sheet]) .ui-modal__dialog{top:auto!important;bottom:0!important;left:0!important;transform:translateY(100%)!important;width:100vw!important;max-width:100vw!important;border-radius:16px 16px 0 0!important;max-height:85vh!important;max-height:85dvh!important;border-bottom:none!important;box-shadow:0 -8px 32px #000000b3!important}:host([bottom-sheet]) .ui-modal__close{min-width:44px;min-height:44px;font-size:18px}:host([bottom-sheet]) .ui-modal__footer{padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))!important}:host([bottom-sheet][aberto]) .ui-modal__dialog,:host([bottom-sheet][open]) .ui-modal__dialog{transform:translateY(0)!important}:host([bottom-sheet]) .ui-modal__handle{display:block!important}';
|
|
6
|
-
function v(l) {
|
|
7
|
-
const a = /* @__PURE__ */ new Set();
|
|
8
|
-
if (typeof document > "u") return a;
|
|
9
|
-
let t = l;
|
|
10
|
-
for (; t && t !== document.body && t !== document.documentElement; ) {
|
|
11
|
-
const o = t.parentElement;
|
|
12
|
-
if (!o) break;
|
|
13
|
-
const e = Array.from(o.children);
|
|
14
|
-
for (const i of e)
|
|
15
|
-
if (i !== t && !i.contains(l) && i.tagName !== "SCRIPT" && i.tagName !== "STYLE" && !(i.hasAttribute("inert") || i.inert === !0)) {
|
|
16
|
-
i.setAttribute("inert", "");
|
|
17
|
-
try {
|
|
18
|
-
i.inert = !0;
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
a.add(i);
|
|
22
|
-
}
|
|
23
|
-
t = o;
|
|
24
|
-
}
|
|
25
|
-
if (document.body) {
|
|
26
|
-
const o = Array.from(document.body.children);
|
|
27
|
-
for (const e of o)
|
|
28
|
-
if (e !== l && !e.contains(l) && e.tagName !== "SCRIPT" && e.tagName !== "STYLE" && !(e.hasAttribute("inert") || e.inert === !0)) {
|
|
29
|
-
e.setAttribute("inert", "");
|
|
30
|
-
try {
|
|
31
|
-
e.inert = !0;
|
|
32
|
-
} catch {
|
|
33
|
-
}
|
|
34
|
-
a.add(e);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return a;
|
|
38
|
-
}
|
|
39
|
-
function m(l) {
|
|
40
|
-
l.forEach((a) => {
|
|
41
|
-
try {
|
|
42
|
-
a.removeAttribute("inert"), a.inert = !1;
|
|
43
|
-
} catch {
|
|
44
|
-
}
|
|
45
|
-
}), l.clear();
|
|
46
|
-
}
|
|
47
|
-
const n = class n extends y {
|
|
48
|
-
constructor() {
|
|
49
|
-
super();
|
|
50
|
-
s(this, "backdropElement");
|
|
51
|
-
s(this, "dialogElement");
|
|
52
|
-
s(this, "tituloElement");
|
|
53
|
-
s(this, "closeElement");
|
|
54
|
-
s(this, "_elementoGatilho", null);
|
|
55
|
-
s(this, "_focables", []);
|
|
56
|
-
s(this, "_tituloId");
|
|
57
|
-
s(this, "_elementosInertes", /* @__PURE__ */ new Set());
|
|
58
|
-
s(this, "handleSlotChange", () => {
|
|
59
|
-
this.syncState();
|
|
60
|
-
});
|
|
61
|
-
s(this, "handleBackdropClick", (t) => {
|
|
62
|
-
t.stopPropagation(), this.fechar();
|
|
63
|
-
});
|
|
64
|
-
s(this, "handleCloseClick", (t) => {
|
|
65
|
-
t.stopPropagation(), this.fechar();
|
|
66
|
-
});
|
|
67
|
-
s(this, "handleKeyDown", (t) => {
|
|
68
|
-
var o, e;
|
|
69
|
-
if (this.aberto && this._isTopMostModal()) {
|
|
70
|
-
if (t.key === "Escape")
|
|
71
|
-
this.fechar(), t.stopImmediatePropagation();
|
|
72
|
-
else if (t.key === "Tab") {
|
|
73
|
-
if (this._atualizarFocables(), this._focables.length === 0) {
|
|
74
|
-
t.preventDefault();
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const i = this._focables[0], r = this._focables[this._focables.length - 1], d = this.getRootNode().activeElement;
|
|
78
|
-
t.shiftKey ? (d === i || !this.contains(d) && !((o = this.shadowRoot) != null && o.contains(d))) && (t.preventDefault(), r.focus()) : (d === r || !this.contains(d) && !((e = this.shadowRoot) != null && e.contains(d))) && (t.preventDefault(), i.focus());
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
this._tituloId = `ui-modal-title-${Math.random().toString(36).substring(2, 9)}`;
|
|
83
|
-
const t = this.attachShadow({ mode: "open" });
|
|
84
|
-
t.innerHTML = `
|
|
85
|
-
<style>${x}</style>
|
|
86
|
-
<div class="ui-modal__backdrop"></div>
|
|
87
|
-
<div class="ui-modal__dialog" role="dialog" aria-modal="true" aria-labelledby="${this._tituloId}" tabindex="-1">
|
|
88
|
-
<div class="ui-modal__handle"></div>
|
|
89
|
-
<div class="ui-modal__header">
|
|
90
|
-
<h3 class="ui-modal__titulo" id="${this._tituloId}"></h3>
|
|
91
|
-
<button class="ui-modal__close" type="button" aria-label="Fechar modal" title="Fechar">✕</button>
|
|
92
|
-
</div>
|
|
93
|
-
<div class="ui-modal__body">
|
|
94
|
-
<slot></slot>
|
|
95
|
-
</div>
|
|
96
|
-
<div class="ui-modal__footer">
|
|
97
|
-
<slot name="rodape"></slot>
|
|
98
|
-
<slot name="footer"></slot>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
`, this.backdropElement = t.querySelector(".ui-modal__backdrop"), this.dialogElement = t.querySelector(".ui-modal__dialog"), this.tituloElement = t.querySelector(".ui-modal__titulo"), this.closeElement = t.querySelector(".ui-modal__close");
|
|
102
|
-
}
|
|
103
|
-
static get observedAttributes() {
|
|
104
|
-
return [
|
|
105
|
-
"aberto",
|
|
106
|
-
"open",
|
|
107
|
-
"titulo",
|
|
108
|
-
"title",
|
|
109
|
-
"aria-label",
|
|
110
|
-
"aria-labelledby",
|
|
111
|
-
"rotulo",
|
|
112
|
-
"bottom-sheet",
|
|
113
|
-
"bloquear-fechamento"
|
|
114
|
-
];
|
|
115
|
-
}
|
|
116
|
-
connectedCallback() {
|
|
117
|
-
this.backdropElement.addEventListener("click", this.handleBackdropClick), this.closeElement.addEventListener("click", this.handleCloseClick), window.addEventListener("keydown", this.handleKeyDown), this.shadowRoot.querySelectorAll("slot").forEach((o) => {
|
|
118
|
-
o.addEventListener("slotchange", this.handleSlotChange);
|
|
119
|
-
}), this.syncState();
|
|
120
|
-
}
|
|
121
|
-
disconnectedCallback() {
|
|
122
|
-
this.backdropElement.removeEventListener("click", this.handleBackdropClick), this.closeElement.removeEventListener("click", this.handleCloseClick), window.removeEventListener("keydown", this.handleKeyDown), this.shadowRoot.querySelectorAll("slot").forEach((o) => {
|
|
123
|
-
o.removeEventListener("slotchange", this.handleSlotChange);
|
|
124
|
-
}), m(this._elementosInertes), this.hasAttribute("data-scroll-locked") && (this.removeAttribute("data-scroll-locked"), n._openCount = Math.max(0, n._openCount - 1), n._openCount === 0 && (document.body.style.overflow = ""));
|
|
125
|
-
}
|
|
126
|
-
attributeChangedCallback(t, o, e) {
|
|
127
|
-
(t === "aberto" || t === "open") && e !== null && (document.activeElement && document.activeElement !== document.body && (this._elementoGatilho = document.activeElement), setTimeout(() => {
|
|
128
|
-
this._atualizarFocables(), this._focables.length > 0 ? this._focables[0].focus() : this.dialogElement.focus();
|
|
129
|
-
}, 0)), this.syncState();
|
|
130
|
-
}
|
|
131
|
-
get aberto() {
|
|
132
|
-
return this.hasAttribute("aberto") || this.hasAttribute("open");
|
|
133
|
-
}
|
|
134
|
-
set aberto(t) {
|
|
135
|
-
t ? this.setAttribute("aberto", "") : (this.removeAttribute("aberto"), this.removeAttribute("open")), this.syncState();
|
|
136
|
-
}
|
|
137
|
-
abrir() {
|
|
138
|
-
this.aberto || (document.activeElement && document.activeElement !== document.body && (this._elementoGatilho = document.activeElement), this.aberto = !0, this.dispatchEvent(
|
|
139
|
-
new CustomEvent("ui-abrir", {
|
|
140
|
-
bubbles: !0,
|
|
141
|
-
composed: !0
|
|
142
|
-
})
|
|
143
|
-
), setTimeout(() => {
|
|
144
|
-
this._atualizarFocables(), this._focables.length > 0 ? this._focables[0].focus() : this.dialogElement.focus();
|
|
145
|
-
}, 0));
|
|
146
|
-
}
|
|
147
|
-
fechar() {
|
|
148
|
-
this.hasAttribute("bloquear-fechamento") || this.aberto && (m(this._elementosInertes), this.aberto = !1, this.dispatchEvent(
|
|
149
|
-
new CustomEvent("ui-fechar", {
|
|
150
|
-
bubbles: !0,
|
|
151
|
-
composed: !0
|
|
152
|
-
})
|
|
153
|
-
), this._elementoGatilho && (this._elementoGatilho.focus(), this._elementoGatilho = null));
|
|
154
|
-
}
|
|
155
|
-
syncState() {
|
|
156
|
-
var d, c;
|
|
157
|
-
const t = this.aberto, o = this.getAttribute("titulo") || this.getAttribute("title") || "", e = (d = this.shadowRoot) == null ? void 0 : d.querySelector(".ui-modal__footer");
|
|
158
|
-
this.dialogElement.setAttribute("aria-hidden", String(!t));
|
|
159
|
-
const i = this.getAttribute("aria-label") || this.getAttribute("rotulo"), r = this.getAttribute("aria-labelledby");
|
|
160
|
-
if (i ? (this.dialogElement.setAttribute("aria-label", i), this.dialogElement.removeAttribute("aria-labelledby")) : r ? (this.dialogElement.setAttribute("aria-labelledby", r), this.dialogElement.removeAttribute("aria-label")) : o ? (this.tituloElement.textContent = o, this.tituloElement.style.display = "block", this.dialogElement.setAttribute("aria-labelledby", this._tituloId), this.dialogElement.removeAttribute("aria-label")) : (this.tituloElement.style.display = "none", this.dialogElement.removeAttribute("aria-labelledby"), this.dialogElement.setAttribute("aria-label", "Diálogo modal")), e) {
|
|
161
|
-
const p = Array.from(((c = this.shadowRoot) == null ? void 0 : c.querySelectorAll('slot[name="rodape"], slot[name="footer"]')) || []).some((f) => f.assignedNodes({ flatten: !0 }).some((u) => u.nodeType === Node.ELEMENT_NODE || u.textContent && u.textContent.trim() !== "")) || this.querySelector('[slot="rodape"], [slot="footer"]') !== null;
|
|
162
|
-
e.style.display = p ? "flex" : "none";
|
|
163
|
-
}
|
|
164
|
-
t ? (this._elementosInertes.size === 0 && (this._elementosInertes = v(this)), this.hasAttribute("data-scroll-locked") || (this.setAttribute("data-scroll-locked", "true"), n._openCount++, n._openCount === 1 && (document.body.style.overflow = "hidden"))) : (this._elementosInertes.size > 0 && m(this._elementosInertes), this.hasAttribute("data-scroll-locked") && (this.removeAttribute("data-scroll-locked"), n._openCount = Math.max(0, n._openCount - 1), n._openCount === 0 && (document.body.style.overflow = "")));
|
|
165
|
-
}
|
|
166
|
-
_atualizarFocables() {
|
|
167
|
-
const t = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), ui-campo-texto, ui-botao, ui-botao-primario, ui-checkbox, ui-switch, ui-lista-flutuante, ui-radio, ui-select';
|
|
168
|
-
let o = Array.from(this.shadowRoot.querySelectorAll(t));
|
|
169
|
-
o = o.filter((r) => window.getComputedStyle(r).display !== "none");
|
|
170
|
-
const e = this.shadowRoot.querySelectorAll("slot");
|
|
171
|
-
let i = [];
|
|
172
|
-
e.forEach((r) => {
|
|
173
|
-
r.assignedElements({ flatten: !0 }).forEach((c) => {
|
|
174
|
-
c instanceof HTMLElement && (c.matches(t) && i.push(c), i.push(...Array.from(c.querySelectorAll(t))));
|
|
175
|
-
});
|
|
176
|
-
}), this._focables = [...o, ...i].filter((r) => !r.hasAttribute("disabled") && r.getAttribute("aria-hidden") !== "true");
|
|
177
|
-
}
|
|
178
|
-
_isTopMostModal() {
|
|
179
|
-
const t = Array.from(document.querySelectorAll("ui-modal[aberto], ui-modal[open], ui-dialog[aberto], ui-dialog[open]"));
|
|
180
|
-
return t[t.length - 1] === this;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
s(n, "_openCount", 0);
|
|
184
|
-
let h = n;
|
|
185
|
-
class E extends h {
|
|
186
|
-
}
|
|
187
|
-
b("ui-modal", h);
|
|
188
|
-
b("ui-dialog", E);
|
|
189
|
-
export {
|
|
190
|
-
E as U,
|
|
191
|
-
h as a,
|
|
192
|
-
v as b,
|
|
193
|
-
m as r
|
|
194
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|