@thibezer/ui-components-kit 2.6.1 → 2.7.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 +49 -0
- package/dist/acessibilidade-CSzX-DkG.cjs +1 -0
- package/dist/acessibilidade-CUlSXc2X.js +38 -0
- package/dist/camadas.cjs +94 -94
- package/dist/camadas.js +1218 -1124
- package/dist/campo-texto.cjs +1 -1
- package/dist/campo-texto.js +1 -1
- package/dist/canvas.cjs +66 -65
- package/dist/canvas.js +3769 -3389
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/components/ui-alerta/ui-toast.d.ts +4 -15
- package/dist/components/ui-avatar/ui-avatar.d.ts +11 -0
- package/dist/components/ui-badge/ui-badge.d.ts +2 -0
- package/dist/components/ui-barra-ferramentas/paleta-atalhos.d.ts +16 -0
- package/dist/components/ui-barra-ferramentas/paleta-pressao-longa.d.ts +24 -0
- package/dist/components/ui-barra-ferramentas/ribbon-render.d.ts +14 -0
- package/dist/components/ui-barra-ferramentas/ribbon-teclado.d.ts +17 -0
- package/dist/components/ui-barra-ferramentas/ui-paleta-ferramentas.d.ts +1 -7
- package/dist/components/ui-barra-ferramentas/ui-ribbon.d.ts +0 -1
- package/dist/components/ui-camadas/camadas-arraste-controles.d.ts +2 -0
- package/dist/components/ui-camadas/camadas-arvore-renderer.d.ts +4 -11
- package/dist/components/ui-camadas/camadas-colecao.d.ts +27 -0
- package/dist/components/ui-camadas/camadas-drag-drop.d.ts +13 -1
- package/dist/components/ui-camadas/camadas-drop-ops.d.ts +31 -0
- package/dist/components/ui-camadas/camadas-hierarquia.d.ts +10 -0
- package/dist/components/ui-camadas/camadas-lembranca.d.ts +34 -0
- package/dist/components/ui-camadas/camadas-render.d.ts +14 -0
- package/dist/components/ui-camadas/camadas-renomear.d.ts +12 -0
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +17 -0
- package/dist/components/ui-camadas/camadas-thumb.d.ts +1 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +3 -5
- package/dist/components/ui-canvas-cad/cad-acessibilidade.d.ts +15 -0
- package/dist/components/ui-canvas-cad/cad-atributos-sync.d.ts +2 -1
- package/dist/components/ui-canvas-cad/cad-broadcast.d.ts +1 -1
- package/dist/components/ui-canvas-cad/cad-evento-coordenadas.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-eventos-canvas.d.ts +3 -8
- package/dist/components/ui-canvas-cad/cad-feicoes-camera.d.ts +26 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-consulta.d.ts +21 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-dados.d.ts +39 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-desenho.d.ts +68 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-edicao.d.ts +37 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-operacoes.d.ts +48 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-ponteiro.d.ts +24 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-selecao-regiao.d.ts +22 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-tipos.d.ts +53 -0
- package/dist/components/ui-canvas-cad/cad-feicoes-versoes.d.ts +33 -0
- package/dist/components/ui-canvas-cad/cad-feicoes.d.ts +26 -106
- package/dist/components/ui-canvas-cad/cad-inicializador.d.ts +3 -1
- package/dist/components/ui-canvas-cad/cad-leaflet-adaptador.d.ts +5 -0
- package/dist/components/ui-canvas-cad/cad-selecao-pontos.d.ts +5 -0
- package/dist/components/ui-canvas-cad/tipos.d.ts +37 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +4 -1
- package/dist/components/ui-checkbox/ui-checkbox.d.ts +4 -1
- package/dist/components/ui-mapa/mapa-atributos.d.ts +14 -0
- package/dist/components/ui-mapa/mapa-basemaps.d.ts +7 -0
- package/dist/components/ui-mapa/mapa-icones.d.ts +4 -0
- package/dist/components/ui-mapa/mapa-leaflet.d.ts +5 -0
- package/dist/components/ui-mapa/mapa-vinculo-pai.d.ts +22 -0
- package/dist/components/ui-mapa/tipos.d.ts +13 -0
- package/dist/components/ui-mapa/ui-mapa-linha.d.ts +12 -5
- package/dist/components/ui-mapa/ui-mapa-marcador.d.ts +15 -6
- package/dist/components/ui-mapa/ui-mapa.d.ts +14 -1
- package/dist/components/ui-modal/modal-acessibilidade.d.ts +5 -5
- package/dist/components/ui-modal/modal-foco.d.ts +28 -0
- package/dist/components/ui-modal/ui-modal.d.ts +1 -11
- package/dist/components/ui-radio/radio-grupo-registry.d.ts +10 -0
- package/dist/components/ui-radio/ui-radio.d.ts +9 -2
- package/dist/components/ui-skeleton/ui-skeleton.d.ts +9 -0
- package/dist/components/ui-switch/ui-switch.d.ts +3 -1
- package/dist/components/ui-tabela/tabela-estados.d.ts +16 -0
- package/dist/components/ui-tabela/tabela-rolagem.d.ts +44 -0
- package/dist/components/ui-tabela/tabela-teclado.d.ts +16 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +1 -19
- package/dist/components/ui-tooltip/tooltip-popover.d.ts +7 -0
- package/dist/components/ui-tooltip/tooltip-posicionamento.d.ts +29 -0
- package/dist/components/ui-tooltip/ui-tooltip.d.ts +24 -1
- package/dist/core/opcoes.d.ts +9 -0
- package/dist/core/rotulo-controle.d.ts +13 -0
- package/dist/core/tipos-toast.d.ts +16 -0
- package/dist/core/ui-bus.d.ts +9 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +12 -11
- package/dist/custom-elements.json +19484 -14657
- package/dist/data.cjs +1 -1
- package/dist/data.js +2 -2
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +21 -21
- package/dist/form-validacao-BlQFxUVj.js +104 -0
- package/dist/form-validacao-DIeyQVH5.cjs +1 -0
- package/dist/forms.cjs +1 -1
- package/dist/forms.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +46 -46
- package/dist/mapa.cjs +11 -16
- package/dist/mapa.js +242 -170
- package/dist/modal.cjs +1 -1
- package/dist/modal.js +1 -1
- package/dist/opcoes-CJYLi6kd.js +12 -0
- package/dist/opcoes-CkyDxBuQ.cjs +1 -0
- package/dist/register.cjs +1 -1
- package/dist/register.js +12 -13
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +8 -3
- package/dist/tipos-vue.d.ts +8 -3
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/dist/ui-badge-ChiiiO1r.js +197 -0
- package/dist/ui-badge-DUCxyAG6.cjs +28 -0
- package/dist/{zero-js-triggers-C_KrvFOQ.js → ui-bus-CUd99VJi.js} +36 -103
- package/dist/ui-bus-XqBLlTYQ.cjs +1 -0
- package/dist/ui-campo-texto-CHTfMO-H.cjs +16 -0
- package/dist/ui-campo-texto-gum_jDdI.js +380 -0
- package/dist/ui-card-BNYCQ7g-.js +119 -0
- package/dist/ui-card-BrjBL-yo.cjs +20 -0
- package/dist/ui-controle-cores-BS0WYPdi.js +572 -0
- package/dist/ui-controle-cores-Er6ZcQ7U.cjs +111 -0
- package/dist/ui-modal-BkYvNP0G.js +214 -0
- package/dist/ui-modal-CUNbpbZ1.cjs +18 -0
- package/dist/ui-paleta-ferramentas-Ksh6gMW3.js +890 -0
- package/dist/ui-paleta-ferramentas-bDLPbiGA.cjs +21 -0
- package/dist/ui-segmented-BOaGRQw4.cjs +19 -0
- package/dist/ui-segmented-kbO1BLVs.js +439 -0
- package/dist/ui-skeleton-B2Rgrv8o.js +648 -0
- package/dist/ui-skeleton-BilwGdOm.js +634 -0
- package/dist/ui-skeleton-DiOxTBZK.cjs +52 -0
- package/dist/ui-skeleton-SPYqku8P.cjs +52 -0
- package/dist/ui-skeleton-W9uwIceA.js +585 -0
- package/dist/ui-skeleton-gZrJipCC.cjs +52 -0
- package/dist/ui-switch-BX6U5Ykm.cjs +53 -0
- package/dist/ui-switch-DO5jR0hy.js +915 -0
- package/dist/ui-tabela-propriedades-D9Echt2X.js +2667 -0
- package/dist/ui-tabela-propriedades-DzZlyNZ_.cjs +141 -0
- package/dist/zero-js-triggers-CJT988bR.js +83 -0
- package/dist/zero-js-triggers-CgM9IIQB.cjs +1 -0
- package/package.json +10 -3
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-toast-Bp_NlM5G.js +0 -156
- package/dist/ui-toast-DGTZKne5.cjs +0 -20
- package/dist/zero-js-triggers-C_gtaojZ.cjs +0 -1
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
var d = Object.defineProperty;
|
|
2
|
-
var p = (i, a, t) => a in i ? d(i, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[a] = t;
|
|
3
|
-
var r = (i, a, t) => p(i, typeof a != "symbol" ? a + "" : a, t);
|
|
4
|
-
import { L as h } from "./listener-bag-DQgv7OON.js";
|
|
5
|
-
import { d as c, S as b } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
-
const f = ':host{display:block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-alerta{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-radius:var(--ui-raio-borda, 8px);border:1px solid transparent;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto, #e1e1e6);box-sizing:border-box;position:relative;transition:opacity .2s ease,transform .2s ease;line-height:1.4}.ui-alerta__icone{display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:2px;line-height:1}.ui-alerta__icone svg,.ui-alerta__icone ::slotted(svg),.ui-alerta__icone ::slotted(ui-icone){shape-rendering:geometricPrecision}.ui-alerta__conteudo{flex:1}.ui-alerta__titulo{font-size:14px;font-weight:600;margin:0 0 2px;line-height:1.2}.ui-alerta__mensagem{font-size:13px;margin:0;opacity:.9}.ui-alerta__close{background:transparent;border:none;color:currentColor;opacity:.7;font-size:14px;cursor:pointer;padding:2px 6px;border-radius:var(--ui-raio-sm, 4px);line-height:1;flex-shrink:0;margin-top:-2px;margin-right:-4px;transition:opacity .15s ease,background-color .15s ease}.ui-alerta__close:hover{opacity:1;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent)}.ui-alerta--sucesso{background-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 30%,transparent);color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-alerta--sucesso .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--erro{background-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 30%,transparent);color:var(--ui-cor-texto-erro, #ff5555)}.ui-alerta--erro .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--alerta{background-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 30%,transparent);color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-alerta--alerta .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--info{background-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 30%,transparent);color:var(--ui-cor-texto-info, #33b5ff)}.ui-alerta--info .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta__acoes{display:flex;align-items:center;flex-shrink:0;margin-left:4px}.ui-alerta__botao-acao{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent);color:inherit;font-family:inherit;font-size:12px;font-weight:600;padding:4px 10px;border-radius:5px;cursor:pointer;line-height:1;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;transition:background-color .15s ease,border-color .15s ease,transform .1s ease}.ui-alerta__botao-acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent)}.ui-alerta__botao-acao:active{transform:scale(.96)}.ui-alerta__botao-acao:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-alerta__botao-acao--primario{background:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 15%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 35%,transparent);color:var(--ui-cor-primaria, #00E08A)}.ui-alerta__botao-acao--primario:hover{background:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 25%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 50%,transparent)}.ui-alerta__botao-acao--destrutivo{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 15%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 35%,transparent);color:var(--ui-cor-texto-erro, #ff5555)}.ui-alerta__botao-acao--destrutivo:hover{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 25%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 50%,transparent)}:host(ui-toast){display:block;width:100%;box-sizing:border-box;pointer-events:auto;transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .25s ease}.ui-toast__banner{box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .3)),0 0 0 1px var(--ui-cor-borda, rgba(255, 255, 255, .1));animation:ui-toast-slide .3s cubic-bezier(.16,1,.3,1);position:relative;overflow:hidden;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}.ui-toast__banner.ui-alerta--sucesso{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-sucesso, #00E08A) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 40%,transparent)}.ui-toast__banner.ui-alerta--erro{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-erro, #ff5555) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 40%,transparent)}.ui-toast__banner.ui-alerta--alerta{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-alerta, #ffb86c) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 40%,transparent)}.ui-toast__banner.ui-alerta--info{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-info, #33b5ff) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 40%,transparent)}.ui-toast__progresso{position:absolute;bottom:0;left:0;right:0;height:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);overflow:hidden}.ui-toast__progresso-barra{width:100%;height:100%;background:currentColor;opacity:.7;transform-origin:left;animation:ui-toast-timer linear forwards}:host(ui-toast:hover) .ui-toast__progresso-barra,:host(ui-toast:focus-within) .ui-toast__progresso-barra{animation-play-state:paused}@keyframes ui-toast-timer{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes ui-toast-slide{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@starting-style{:host(ui-toast){opacity:0;transform:translateY(12px) scale(.96)}}', l = {
|
|
7
|
-
sucesso: '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>',
|
|
8
|
-
erro: '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',
|
|
9
|
-
alerta: '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',
|
|
10
|
-
info: '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>'
|
|
11
|
-
};
|
|
12
|
-
class u extends b {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
r(this, "alertaElement");
|
|
16
|
-
r(this, "iconeElement");
|
|
17
|
-
r(this, "tituloElement");
|
|
18
|
-
r(this, "mensagemElement");
|
|
19
|
-
r(this, "mensagemTextoElement");
|
|
20
|
-
r(this, "closeElement");
|
|
21
|
-
r(this, "acoesElement");
|
|
22
|
-
r(this, "botaoAcaoElement");
|
|
23
|
-
r(this, "progressoContainer");
|
|
24
|
-
r(this, "progressoBarra");
|
|
25
|
-
r(this, "listeners", new h());
|
|
26
|
-
const t = this.attachShadow({ mode: "open" });
|
|
27
|
-
t.innerHTML = `
|
|
28
|
-
<style>${f}</style>
|
|
29
|
-
<div class="ui-alerta" part="base" role="alert">
|
|
30
|
-
<span class="ui-alerta__icone" part="icone"></span>
|
|
31
|
-
<div class="ui-alerta__conteudo" part="conteudo">
|
|
32
|
-
<h4 class="ui-alerta__titulo" part="titulo" style="display: none;"></h4>
|
|
33
|
-
<p class="ui-alerta__mensagem" part="mensagem">
|
|
34
|
-
<span class="ui-alerta__mensagem-texto" style="display: none;"></span>
|
|
35
|
-
<slot></slot>
|
|
36
|
-
</p>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="ui-alerta__acoes" style="display: none;">
|
|
39
|
-
<button type="button" class="ui-alerta__botao-acao" part="acao"></button>
|
|
40
|
-
</div>
|
|
41
|
-
<button class="ui-alerta__close" part="fechar" type="button" aria-label="Fechar alerta" style="display: none;" title="Fechar">✕</button>
|
|
42
|
-
<div class="ui-toast__progresso" part="progresso" style="display: none;">
|
|
43
|
-
<div class="ui-toast__progresso-barra"></div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
`, this.alertaElement = t.querySelector(".ui-alerta"), this.iconeElement = t.querySelector(".ui-alerta__icone"), this.tituloElement = t.querySelector(".ui-alerta__titulo"), this.mensagemElement = t.querySelector(".ui-alerta__mensagem"), this.mensagemTextoElement = t.querySelector(".ui-alerta__mensagem-texto"), this.closeElement = t.querySelector(".ui-alerta__close"), this.acoesElement = t.querySelector(".ui-alerta__acoes"), this.botaoAcaoElement = t.querySelector(".ui-alerta__botao-acao"), this.progressoContainer = t.querySelector(".ui-toast__progresso"), this.progressoBarra = t.querySelector(".ui-toast__progresso-barra");
|
|
47
|
-
}
|
|
48
|
-
static get observedAttributes() {
|
|
49
|
-
return [
|
|
50
|
-
"tipo",
|
|
51
|
-
"variante",
|
|
52
|
-
"variant",
|
|
53
|
-
"titulo",
|
|
54
|
-
"title",
|
|
55
|
-
"mensagem",
|
|
56
|
-
"fechavel",
|
|
57
|
-
"dismissible"
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
connectedCallback() {
|
|
61
|
-
this.listeners.cleanup(), this.listeners.add(this.closeElement, "click", () => this.fechar()), this.syncState();
|
|
62
|
-
}
|
|
63
|
-
disconnectedCallback() {
|
|
64
|
-
this.listeners.cleanup();
|
|
65
|
-
}
|
|
66
|
-
attributeChangedCallback(t, o, e) {
|
|
67
|
-
this.syncState();
|
|
68
|
-
}
|
|
69
|
-
fechar() {
|
|
70
|
-
this.dispatchEvent(
|
|
71
|
-
new CustomEvent("ui-fechar", {
|
|
72
|
-
bubbles: !0,
|
|
73
|
-
composed: !0
|
|
74
|
-
})
|
|
75
|
-
), this.remove();
|
|
76
|
-
}
|
|
77
|
-
syncState() {
|
|
78
|
-
const t = this.getAttribute("tipo") || this.getAttribute("variante") || this.getAttribute("variant") || "info", o = this.getAttribute("titulo") || this.getAttribute("title"), e = this.getAttribute("mensagem"), s = this.hasAttribute("fechavel") || this.hasAttribute("dismissible");
|
|
79
|
-
this.alertaElement.className = `ui-alerta ui-alerta--${t}`;
|
|
80
|
-
const m = l[t] || l.info;
|
|
81
|
-
this.iconeElement.innerHTML = m, o ? (this.tituloElement.textContent = o, this.tituloElement.style.display = "block") : (this.tituloElement.style.display = "none", this.tituloElement.textContent = ""), e ? (this.mensagemTextoElement.textContent = e, this.mensagemTextoElement.style.display = "inline") : (this.mensagemTextoElement.style.display = "none", this.mensagemTextoElement.textContent = ""), s ? this.closeElement.style.display = "block" : this.closeElement.style.display = "none";
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
c("ui-alerta", u);
|
|
85
|
-
class n extends u {
|
|
86
|
-
constructor() {
|
|
87
|
-
super(...arguments);
|
|
88
|
-
r(this, "timerId", null);
|
|
89
|
-
r(this, "tempoRestante", 4e3);
|
|
90
|
-
r(this, "inicioTimestamp", 0);
|
|
91
|
-
r(this, "isPausado", !1);
|
|
92
|
-
r(this, "acaoConfig");
|
|
93
|
-
r(this, "containerRef", null);
|
|
94
|
-
r(this, "handleAcaoClick", (t) => {
|
|
95
|
-
var o, e, s;
|
|
96
|
-
t.stopPropagation(), (o = this.acaoConfig) != null && o.onClick && this.acaoConfig.onClick(t), this.dispatchEvent(
|
|
97
|
-
new CustomEvent("ui-toast-acao", {
|
|
98
|
-
detail: {
|
|
99
|
-
rotulo: (e = this.acaoConfig) == null ? void 0 : e.rotulo,
|
|
100
|
-
tipo: (s = this.acaoConfig) == null ? void 0 : s.tipo
|
|
101
|
-
},
|
|
102
|
-
bubbles: !0,
|
|
103
|
-
composed: !0
|
|
104
|
-
})
|
|
105
|
-
), this.fechar();
|
|
106
|
-
});
|
|
107
|
-
r(this, "pausarTimer", () => {
|
|
108
|
-
if (this.isPausado || this.tempoRestante <= 0) return;
|
|
109
|
-
this.isPausado = !0, this.timerId && (clearTimeout(this.timerId), this.timerId = null);
|
|
110
|
-
const t = Date.now() - this.inicioTimestamp;
|
|
111
|
-
this.tempoRestante = Math.max(0, this.tempoRestante - t), this.progressoBarra.style.animationPlayState = "paused";
|
|
112
|
-
});
|
|
113
|
-
r(this, "retomarTimer", () => {
|
|
114
|
-
!this.isPausado || this.tempoRestante <= 0 || (this.isPausado = !1, this.progressoBarra.style.animationPlayState = "running", this.iniciarTimer(Math.max(this.tempoRestante, 300)));
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
configurarAcao(t) {
|
|
118
|
-
this.acaoConfig = t, this.botaoAcaoElement.textContent = t.rotulo, this.acoesElement.style.display = "flex";
|
|
119
|
-
const o = t.tipo || "primario";
|
|
120
|
-
this.botaoAcaoElement.className = `ui-alerta__botao-acao ui-alerta__botao-acao--${o}`;
|
|
121
|
-
}
|
|
122
|
-
connectedCallback() {
|
|
123
|
-
super.connectedCallback(), this.containerRef = this.parentElement, this.alertaElement.classList.add("ui-toast__banner"), this.acaoConfig && this.listeners.add(this.botaoAcaoElement, "click", this.handleAcaoClick);
|
|
124
|
-
const t = this.getAttribute("duracao") || this.getAttribute("duration") || "4000", o = parseInt(t, 10);
|
|
125
|
-
this.tempoRestante = isNaN(o) ? 4e3 : o, this.tempoRestante > 0 ? (this.progressoContainer.style.display = "block", this.progressoBarra.style.animationDuration = `${this.tempoRestante}ms`, this.getAttribute("pausar-no-hover") !== "false" && (this.listeners.add(this, "mouseenter", this.pausarTimer), this.listeners.add(this, "mouseleave", this.retomarTimer), this.listeners.add(this, "focusin", this.pausarTimer), this.listeners.add(this, "focusout", this.retomarTimer)), this.iniciarTimer(this.tempoRestante)) : this.progressoContainer.style.display = "none";
|
|
126
|
-
}
|
|
127
|
-
fechar() {
|
|
128
|
-
const t = this.parentElement || this.containerRef;
|
|
129
|
-
super.fechar(), t && t.id.startsWith("ui-toast-container-") && t.children.length === 0 && t.remove();
|
|
130
|
-
}
|
|
131
|
-
disconnectedCallback() {
|
|
132
|
-
super.disconnectedCallback(), this.timerId && (clearTimeout(this.timerId), this.timerId = null), this.containerRef && this.containerRef.id.startsWith("ui-toast-container-") && this.containerRef.children.length === 0 && (this.containerRef.remove(), this.containerRef = null);
|
|
133
|
-
}
|
|
134
|
-
iniciarTimer(t) {
|
|
135
|
-
this.timerId && clearTimeout(this.timerId), this.inicioTimestamp = Date.now(), this.timerId = setTimeout(() => {
|
|
136
|
-
this.fechar();
|
|
137
|
-
}, t);
|
|
138
|
-
}
|
|
139
|
-
static obterContainer(t) {
|
|
140
|
-
const o = `ui-toast-container-${t}`;
|
|
141
|
-
let e = document.getElementById(o);
|
|
142
|
-
return e || (e = document.createElement("div"), e.id = o, e.style.position = "fixed", e.style.setProperty("z-index", "var(--ui-z-toast, 1100)"), e.style.display = "flex", e.style.gap = "10px", e.style.maxWidth = "400px", e.style.width = "calc(100vw - 32px)", e.style.pointerEvents = "none", e.style.boxSizing = "border-box", e.style.transition = "all 0.2s ease", t === "top-right" ? (e.style.top = "20px", e.style.right = "20px", e.style.flexDirection = "column") : t === "top-left" ? (e.style.top = "20px", e.style.left = "20px", e.style.flexDirection = "column") : t === "bottom-left" ? (e.style.bottom = "20px", e.style.left = "20px", e.style.flexDirection = "column-reverse") : t === "top-center" ? (e.style.top = "20px", e.style.left = "50%", e.style.transform = "translateX(-50%)", e.style.flexDirection = "column") : t === "bottom-center" ? (e.style.bottom = "20px", e.style.left = "50%", e.style.transform = "translateX(-50%)", e.style.flexDirection = "column-reverse") : (e.style.bottom = "20px", e.style.right = "20px", e.style.flexDirection = "column-reverse"), document.body.appendChild(e)), e;
|
|
143
|
-
}
|
|
144
|
-
// Utilitário estático para disparo imperativo de Toasts de qualquer lugar no código
|
|
145
|
-
static notificar(t) {
|
|
146
|
-
if (typeof document > "u") return null;
|
|
147
|
-
const o = t.posicao || "bottom-right", e = document.createElement("ui-toast");
|
|
148
|
-
return t.tipo && e.setAttribute("tipo", t.tipo), t.titulo && e.setAttribute("titulo", t.titulo), t.mensagem && e.setAttribute("mensagem", t.mensagem), t.duracao !== void 0 && e.setAttribute("duracao", String(t.duracao)), t.pausarNoHover === !1 && e.setAttribute("pausar-no-hover", "false"), e.setAttribute("posicao", o), t.fechavel !== !1 && e.setAttribute("fechavel", ""), t.acao && e.configurarAcao(t.acao), n.obterContainer(o).appendChild(e), e;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
c("ui-toast", n);
|
|
152
|
-
export {
|
|
153
|
-
l as I,
|
|
154
|
-
u as U,
|
|
155
|
-
n as a
|
|
156
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var p=(i,a,t)=>a in i?d(i,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[a]=t;var r=(i,a,t)=>p(i,typeof a!="symbol"?a+"":a,t);const h=require("./listener-bag-D5omxZ9h.cjs"),c=require("./ssr-safe-CiHD1adl.cjs"),b=':host{display:block;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-alerta{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;border-radius:var(--ui-raio-borda, 8px);border:1px solid transparent;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);color:var(--ui-cor-texto, #e1e1e6);box-sizing:border-box;position:relative;transition:opacity .2s ease,transform .2s ease;line-height:1.4}.ui-alerta__icone{display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:2px;line-height:1}.ui-alerta__icone svg,.ui-alerta__icone ::slotted(svg),.ui-alerta__icone ::slotted(ui-icone){shape-rendering:geometricPrecision}.ui-alerta__conteudo{flex:1}.ui-alerta__titulo{font-size:14px;font-weight:600;margin:0 0 2px;line-height:1.2}.ui-alerta__mensagem{font-size:13px;margin:0;opacity:.9}.ui-alerta__close{background:transparent;border:none;color:currentColor;opacity:.7;font-size:14px;cursor:pointer;padding:2px 6px;border-radius:var(--ui-raio-sm, 4px);line-height:1;flex-shrink:0;margin-top:-2px;margin-right:-4px;transition:opacity .15s ease,background-color .15s ease}.ui-alerta__close:hover{opacity:1;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 15%,transparent)}.ui-alerta--sucesso{background-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 30%,transparent);color:var(--ui-cor-texto-sucesso, #00E08A)}.ui-alerta--sucesso .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--erro{background-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 30%,transparent);color:var(--ui-cor-texto-erro, #ff5555)}.ui-alerta--erro .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--alerta{background-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 30%,transparent);color:var(--ui-cor-texto-alerta, #ffb86c)}.ui-alerta--alerta .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta--info{background-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 12%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 30%,transparent);color:var(--ui-cor-texto-info, #33b5ff)}.ui-alerta--info .ui-alerta__mensagem{color:var(--ui-cor-texto, #e1e1e6)}.ui-alerta__acoes{display:flex;align-items:center;flex-shrink:0;margin-left:4px}.ui-alerta__botao-acao{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);border:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 16%,transparent);color:inherit;font-family:inherit;font-size:12px;font-weight:600;padding:4px 10px;border-radius:5px;cursor:pointer;line-height:1;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;transition:background-color .15s ease,border-color .15s ease,transform .1s ease}.ui-alerta__botao-acao:hover{background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 18%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 30%,transparent)}.ui-alerta__botao-acao:active{transform:scale(.96)}.ui-alerta__botao-acao:focus-visible{outline:none;box-shadow:0 0 0 2px var(--ui-cor-fundo, #0b0b0d),0 0 0 4px var(--ui-cor-primaria, #00E08A)}.ui-alerta__botao-acao--primario{background:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 15%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 35%,transparent);color:var(--ui-cor-primaria, #00E08A)}.ui-alerta__botao-acao--primario:hover{background:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 25%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 50%,transparent)}.ui-alerta__botao-acao--destrutivo{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 15%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 35%,transparent);color:var(--ui-cor-texto-erro, #ff5555)}.ui-alerta__botao-acao--destrutivo:hover{background:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 25%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 50%,transparent)}:host(ui-toast){display:block;width:100%;box-sizing:border-box;pointer-events:auto;transition:transform .25s cubic-bezier(.16,1,.3,1),opacity .25s ease}.ui-toast__banner{box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .3)),0 0 0 1px var(--ui-cor-borda, rgba(255, 255, 255, .1));animation:ui-toast-slide .3s cubic-bezier(.16,1,.3,1);position:relative;overflow:hidden;backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px)}.ui-toast__banner.ui-alerta--sucesso{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-sucesso, #00E08A) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-sucesso, #00E08A) 40%,transparent)}.ui-toast__banner.ui-alerta--erro{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-erro, #ff5555) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 40%,transparent)}.ui-toast__banner.ui-alerta--alerta{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-alerta, #ffb86c) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-alerta, #ffb86c) 40%,transparent)}.ui-toast__banner.ui-alerta--info{background-color:color-mix(in srgb,color-mix(in srgb,var(--ui-cor-fundo-elevado, #1a1a1e) 88%,var(--ui-cor-texto-info, #33b5ff) 12%) 60%,transparent);border-color:color-mix(in srgb,var(--ui-cor-texto-info, #33b5ff) 40%,transparent)}.ui-toast__progresso{position:absolute;bottom:0;left:0;right:0;height:2px;background:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent);overflow:hidden}.ui-toast__progresso-barra{width:100%;height:100%;background:currentColor;opacity:.7;transform-origin:left;animation:ui-toast-timer linear forwards}:host(ui-toast:hover) .ui-toast__progresso-barra,:host(ui-toast:focus-within) .ui-toast__progresso-barra{animation-play-state:paused}@keyframes ui-toast-timer{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@keyframes ui-toast-slide{0%{transform:translate(100%);opacity:0}to{transform:translate(0);opacity:1}}@starting-style{:host(ui-toast){opacity:0;transform:translateY(12px) scale(.96)}}',l={sucesso:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>',erro:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="15" y1="9" x2="9" y2="15"></line><line x1="9" y1="9" x2="15" y2="15"></line></svg>',alerta:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',info:'<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>'};class u extends c.SafeHTMLElement{constructor(){super();r(this,"alertaElement");r(this,"iconeElement");r(this,"tituloElement");r(this,"mensagemElement");r(this,"mensagemTextoElement");r(this,"closeElement");r(this,"acoesElement");r(this,"botaoAcaoElement");r(this,"progressoContainer");r(this,"progressoBarra");r(this,"listeners",new h.ListenerBag);const t=this.attachShadow({mode:"open"});t.innerHTML=`
|
|
2
|
-
<style>${b}</style>
|
|
3
|
-
<div class="ui-alerta" part="base" role="alert">
|
|
4
|
-
<span class="ui-alerta__icone" part="icone"></span>
|
|
5
|
-
<div class="ui-alerta__conteudo" part="conteudo">
|
|
6
|
-
<h4 class="ui-alerta__titulo" part="titulo" style="display: none;"></h4>
|
|
7
|
-
<p class="ui-alerta__mensagem" part="mensagem">
|
|
8
|
-
<span class="ui-alerta__mensagem-texto" style="display: none;"></span>
|
|
9
|
-
<slot></slot>
|
|
10
|
-
</p>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="ui-alerta__acoes" style="display: none;">
|
|
13
|
-
<button type="button" class="ui-alerta__botao-acao" part="acao"></button>
|
|
14
|
-
</div>
|
|
15
|
-
<button class="ui-alerta__close" part="fechar" type="button" aria-label="Fechar alerta" style="display: none;" title="Fechar">✕</button>
|
|
16
|
-
<div class="ui-toast__progresso" part="progresso" style="display: none;">
|
|
17
|
-
<div class="ui-toast__progresso-barra"></div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
`,this.alertaElement=t.querySelector(".ui-alerta"),this.iconeElement=t.querySelector(".ui-alerta__icone"),this.tituloElement=t.querySelector(".ui-alerta__titulo"),this.mensagemElement=t.querySelector(".ui-alerta__mensagem"),this.mensagemTextoElement=t.querySelector(".ui-alerta__mensagem-texto"),this.closeElement=t.querySelector(".ui-alerta__close"),this.acoesElement=t.querySelector(".ui-alerta__acoes"),this.botaoAcaoElement=t.querySelector(".ui-alerta__botao-acao"),this.progressoContainer=t.querySelector(".ui-toast__progresso"),this.progressoBarra=t.querySelector(".ui-toast__progresso-barra")}static get observedAttributes(){return["tipo","variante","variant","titulo","title","mensagem","fechavel","dismissible"]}connectedCallback(){this.listeners.cleanup(),this.listeners.add(this.closeElement,"click",()=>this.fechar()),this.syncState()}disconnectedCallback(){this.listeners.cleanup()}attributeChangedCallback(t,o,e){this.syncState()}fechar(){this.dispatchEvent(new CustomEvent("ui-fechar",{bubbles:!0,composed:!0})),this.remove()}syncState(){const t=this.getAttribute("tipo")||this.getAttribute("variante")||this.getAttribute("variant")||"info",o=this.getAttribute("titulo")||this.getAttribute("title"),e=this.getAttribute("mensagem"),s=this.hasAttribute("fechavel")||this.hasAttribute("dismissible");this.alertaElement.className=`ui-alerta ui-alerta--${t}`;const m=l[t]||l.info;this.iconeElement.innerHTML=m,o?(this.tituloElement.textContent=o,this.tituloElement.style.display="block"):(this.tituloElement.style.display="none",this.tituloElement.textContent=""),e?(this.mensagemTextoElement.textContent=e,this.mensagemTextoElement.style.display="inline"):(this.mensagemTextoElement.style.display="none",this.mensagemTextoElement.textContent=""),s?this.closeElement.style.display="block":this.closeElement.style.display="none"}}c.definirCustomElement("ui-alerta",u);class n extends u{constructor(){super(...arguments);r(this,"timerId",null);r(this,"tempoRestante",4e3);r(this,"inicioTimestamp",0);r(this,"isPausado",!1);r(this,"acaoConfig");r(this,"containerRef",null);r(this,"handleAcaoClick",t=>{var o,e,s;t.stopPropagation(),(o=this.acaoConfig)!=null&&o.onClick&&this.acaoConfig.onClick(t),this.dispatchEvent(new CustomEvent("ui-toast-acao",{detail:{rotulo:(e=this.acaoConfig)==null?void 0:e.rotulo,tipo:(s=this.acaoConfig)==null?void 0:s.tipo},bubbles:!0,composed:!0})),this.fechar()});r(this,"pausarTimer",()=>{if(this.isPausado||this.tempoRestante<=0)return;this.isPausado=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null);const t=Date.now()-this.inicioTimestamp;this.tempoRestante=Math.max(0,this.tempoRestante-t),this.progressoBarra.style.animationPlayState="paused"});r(this,"retomarTimer",()=>{!this.isPausado||this.tempoRestante<=0||(this.isPausado=!1,this.progressoBarra.style.animationPlayState="running",this.iniciarTimer(Math.max(this.tempoRestante,300)))})}configurarAcao(t){this.acaoConfig=t,this.botaoAcaoElement.textContent=t.rotulo,this.acoesElement.style.display="flex";const o=t.tipo||"primario";this.botaoAcaoElement.className=`ui-alerta__botao-acao ui-alerta__botao-acao--${o}`}connectedCallback(){super.connectedCallback(),this.containerRef=this.parentElement,this.alertaElement.classList.add("ui-toast__banner"),this.acaoConfig&&this.listeners.add(this.botaoAcaoElement,"click",this.handleAcaoClick);const t=this.getAttribute("duracao")||this.getAttribute("duration")||"4000",o=parseInt(t,10);this.tempoRestante=isNaN(o)?4e3:o,this.tempoRestante>0?(this.progressoContainer.style.display="block",this.progressoBarra.style.animationDuration=`${this.tempoRestante}ms`,this.getAttribute("pausar-no-hover")!=="false"&&(this.listeners.add(this,"mouseenter",this.pausarTimer),this.listeners.add(this,"mouseleave",this.retomarTimer),this.listeners.add(this,"focusin",this.pausarTimer),this.listeners.add(this,"focusout",this.retomarTimer)),this.iniciarTimer(this.tempoRestante)):this.progressoContainer.style.display="none"}fechar(){const t=this.parentElement||this.containerRef;super.fechar(),t&&t.id.startsWith("ui-toast-container-")&&t.children.length===0&&t.remove()}disconnectedCallback(){super.disconnectedCallback(),this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.containerRef&&this.containerRef.id.startsWith("ui-toast-container-")&&this.containerRef.children.length===0&&(this.containerRef.remove(),this.containerRef=null)}iniciarTimer(t){this.timerId&&clearTimeout(this.timerId),this.inicioTimestamp=Date.now(),this.timerId=setTimeout(()=>{this.fechar()},t)}static obterContainer(t){const o=`ui-toast-container-${t}`;let e=document.getElementById(o);return e||(e=document.createElement("div"),e.id=o,e.style.position="fixed",e.style.setProperty("z-index","var(--ui-z-toast, 1100)"),e.style.display="flex",e.style.gap="10px",e.style.maxWidth="400px",e.style.width="calc(100vw - 32px)",e.style.pointerEvents="none",e.style.boxSizing="border-box",e.style.transition="all 0.2s ease",t==="top-right"?(e.style.top="20px",e.style.right="20px",e.style.flexDirection="column"):t==="top-left"?(e.style.top="20px",e.style.left="20px",e.style.flexDirection="column"):t==="bottom-left"?(e.style.bottom="20px",e.style.left="20px",e.style.flexDirection="column-reverse"):t==="top-center"?(e.style.top="20px",e.style.left="50%",e.style.transform="translateX(-50%)",e.style.flexDirection="column"):t==="bottom-center"?(e.style.bottom="20px",e.style.left="50%",e.style.transform="translateX(-50%)",e.style.flexDirection="column-reverse"):(e.style.bottom="20px",e.style.right="20px",e.style.flexDirection="column-reverse"),document.body.appendChild(e)),e}static notificar(t){if(typeof document>"u")return null;const o=t.posicao||"bottom-right",e=document.createElement("ui-toast");return t.tipo&&e.setAttribute("tipo",t.tipo),t.titulo&&e.setAttribute("titulo",t.titulo),t.mensagem&&e.setAttribute("mensagem",t.mensagem),t.duracao!==void 0&&e.setAttribute("duracao",String(t.duracao)),t.pausarNoHover===!1&&e.setAttribute("pausar-no-hover","false"),e.setAttribute("posicao",o),t.fechavel!==!1&&e.setAttribute("fechavel",""),t.acao&&e.configurarAcao(t.acao),n.obterContainer(o).appendChild(e),e}}c.definirCustomElement("ui-toast",n);exports.ICONES_ALERTA=l;exports.UIAlerta=u;exports.UIToast=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var E=(o,e,t)=>e in o?v(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var m=(o,e,t)=>E(o,typeof e!="symbol"?e+"":e,t);const A=require("./ui-toast-DGTZKne5.cjs");class I{constructor(){m(this,"listeners",new Map);m(this,"_observandoSistema",!1);this.observarTemaDoSistema()}on(e,t){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t),()=>this.off(e,t)}once(e,t){const r=u=>{this.off(e,r),t(u)};this.on(e,r)}off(e,t){const r=this.listeners.get(e);r&&(r.delete(t),r.size===0&&this.listeners.delete(e))}emit(e,t){const r=this.listeners.get(e);r&&r.forEach(u=>{try{u(t)}catch(f){console.error(`[UIBus] Erro ao executar ouvinte do evento "${e}":`,f)}}),typeof window<"u"&&window.dispatchEvent(new CustomEvent(`uibus:${e}`,{detail:t,bubbles:!0,composed:!0}))}abrirModal(e){if(typeof document>"u")return!1;const t=document.getElementById(e);return t&&typeof t.abrir=="function"?(t.abrir(),this.emit("modal:aberto",{id:e}),!0):t?(t.setAttribute("aberto",""),this.emit("modal:aberto",{id:e}),!0):(console.warn(`[UIBus] Modal com ID "${e}" não encontrado no DOM.`),!1)}fecharModal(e){if(typeof document>"u")return!1;if(e){const t=document.getElementById(e);return t&&typeof t.fechar=="function"?(t.fechar(),t.hasAttribute("aberto")||t.hasAttribute("open")?!1:(this.emit("modal:fechado",{id:e}),!0)):t?(t.removeAttribute("aberto"),t.removeAttribute("open"),this.emit("modal:fechado",{id:e}),!0):!1}else return document.querySelectorAll("ui-modal[aberto], ui-modal[open], ui-dialog[aberto], ui-dialog[open]").forEach(r=>{typeof r.fechar=="function"?r.fechar():(r.removeAttribute("aberto"),r.removeAttribute("open"))}),this.emit("modal:fechado-todos"),!0}abrirDrawer(e){if(typeof document>"u")return!1;const t=document.getElementById(e);return t&&typeof t.abrir=="function"?(t.abrir(),this.emit("drawer:aberto",{id:e}),!0):t?(t.setAttribute("aberto",""),this.emit("drawer:aberto",{id:e}),!0):(console.warn(`[UIBus] Drawer com ID "${e}" não encontrado no DOM.`),!1)}fecharDrawer(e){if(typeof document>"u")return!1;if(e){const t=document.getElementById(e);return t&&typeof t.fechar=="function"?(t.fechar(),this.emit("drawer:fechado",{id:e}),!0):t?(t.removeAttribute("aberto"),t.removeAttribute("open"),this.emit("drawer:fechado",{id:e}),!0):!1}else return document.querySelectorAll("ui-drawer[aberto], ui-drawer[open], ui-sheet[aberto], ui-sheet[open]").forEach(r=>{typeof r.fechar=="function"?r.fechar():(r.removeAttribute("aberto"),r.removeAttribute("open"))}),this.emit("drawer:fechado-todos"),!0}notificar(e){typeof e=="string"?A.UIToast.notificar({mensagem:e,tipo:"info"}):A.UIToast.notificar(e)}async copiar(e,t){if(typeof navigator>"u"||!navigator.clipboard)return!1;try{return await navigator.clipboard.writeText(e),t!==void 0&&this.notificar({tipo:"sucesso",mensagem:t||"Copiado para a área de transferência!"}),this.emit("clipboard:copiado",{texto:e}),!0}catch(r){return console.error("[UIBus] Falha ao copiar texto:",r),this.notificar({tipo:"erro",mensagem:"Não foi possível copiar o texto."}),!1}}definirDensidade(e){let t=34;typeof e=="number"?t=Math.max(15,e):e==="compacta"?t=26:e==="relaxada"?t=42:t=34,!(typeof document>"u")&&(document.documentElement.style.setProperty("--ui-altura-minima",`${t}px`),document.documentElement.style.setProperty("--ui-campo-altura",`${t}px`),document.documentElement.setAttribute("data-ui-densidade",typeof e=="string"?e:"custom"),this.emit("densidade:alterada",{densidade:e,alturaPx:t}))}obterTema(){if(typeof document>"u")return"escuro";const e=w(document.documentElement);return e||(T()?"claro":"escuro")}definirTema(e){if(typeof document>"u")return e==="claro"?"claro":"escuro";const t=document.documentElement;if(e==="auto")t.removeAttribute("data-tema"),t.removeAttribute("data-theme"),t.classList.remove("dark","light");else{const u=e||(this.obterTema()==="escuro"?"claro":"escuro");t.setAttribute("data-tema",u),t.classList.toggle("dark",u==="escuro"),t.classList.toggle("light",u==="claro")}const r=this.obterTema();return this.emit("tema:alterado",{tema:r}),r}observarTemaDoSistema(){var e,t;this._observandoSistema||typeof window>"u"||typeof window.matchMedia!="function"||(this._observandoSistema=!0,(t=(e=window.matchMedia("(prefers-color-scheme: light)")).addEventListener)==null||t.call(e,"change",()=>{w(document.documentElement)||this.emit("tema:alterado",{tema:this.obterTema()})}))}}function w(o){const e=o.getAttribute("data-tema")||o.getAttribute("data-theme");return e==="escuro"||e==="dark"?"escuro":e==="claro"||e==="light"?"claro":o.classList.contains("dark")?"escuro":o.classList.contains("light")?"claro":null}function T(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: light)").matches}const n=new I;let y=!1;function S(o){if(o.hasAttribute("disabled")||o.hasAttribute("carregando")||o.getAttribute("aria-disabled")==="true"||o.localName.startsWith("ui-")&&o.hasAttribute("loading"))return!0;try{return o.matches(":disabled")}catch{return!1}}function x(){y||typeof document>"u"||(y=!0,document.addEventListener("click",o=>{const e=o.composedPath?o.composedPath():[o.target],t="[target-modal], [modal-alvo], [dismiss-modal], [fechar-modal], [target-drawer], [drawer-alvo], [dismiss-drawer], [fechar-drawer], [toast-sucesso], [toast-erro], [toast-alerta], [toast-info], [copiar-texto], [alternar-tema], [definir-densidade], [limpar-form]";let r=null;for(const i of e)if(i instanceof HTMLElement&&i.matches(t)){r=i;break}if(!r||S(r))return;const u=r.getAttribute("target-modal")||r.getAttribute("modal-alvo");if(u&&n.abrirModal(u),r.hasAttribute("dismiss-modal")||r.hasAttribute("fechar-modal")){const i=r.getAttribute("dismiss-modal")||r.getAttribute("fechar-modal");if(i&&i!=="")n.fecharModal(i);else{let s=null;for(const a of e)if(a instanceof HTMLElement&&(a.matches("ui-modal, ui-dialog")||a.tagName==="UI-MODAL"||a.tagName==="UI-DIALOG")){s=a;break}s&&(typeof s.fechar=="function"?s.fechar():(s.removeAttribute("aberto"),s.removeAttribute("open")))}}const f=r.getAttribute("target-drawer")||r.getAttribute("drawer-alvo");if(f&&n.abrirDrawer(f),r.hasAttribute("dismiss-drawer")||r.hasAttribute("fechar-drawer")){const i=r.getAttribute("dismiss-drawer")||r.getAttribute("fechar-drawer");if(i&&i!=="")n.fecharDrawer(i);else{let s=null;for(const a of e)if(a instanceof HTMLElement&&(a.matches("ui-drawer, ui-sheet, ui-painel-lateral, ui-gaveta")||a.tagName.startsWith("UI-DRAWER")||a.tagName.startsWith("UI-SHEET"))){s=a;break}s&&(typeof s.fechar=="function"?s.fechar():(s.removeAttribute("aberto"),s.removeAttribute("open")))}}const d=r.getAttribute("toast-sucesso");d&&n.notificar({tipo:"sucesso",mensagem:d});const l=r.getAttribute("toast-erro");l&&n.notificar({tipo:"erro",mensagem:l});const h=r.getAttribute("toast-alerta");h&&n.notificar({tipo:"alerta",mensagem:h});const b=r.getAttribute("toast-info");b&&n.notificar({tipo:"info",mensagem:b});const c=r.getAttribute("copiar-texto");if(c!==null){let i=c;if(c.startsWith("#")||c.startsWith(".")||c.match(/^[a-zA-Z0-9_-]+$/))try{let a=null;c.startsWith("#")||c.startsWith(".")?a=document.querySelector(c):a=document.getElementById(c)||document.querySelector(`#${c}`),a&&(i=a.value!==void 0&&a.value!==null?a.value:a.textContent||"")}catch{}const s=r.getAttribute("copiar-mensagem")||"Copiado com sucesso!";n.copiar(i,s)}r.hasAttribute("alternar-tema")&&n.definirTema();const p=r.getAttribute("definir-densidade");p&&n.definirDensidade(p);const g=r.getAttribute("limpar-form");if(g){const i=document.getElementById(g);i&&typeof i.reset=="function"&&(i.reset(),n.notificar({tipo:"info",mensagem:"Formulário limpo."}))}}))}exports.UIBus=n;exports.initZeroJSTriggers=x;
|