@thibezer/ui-components-kit 2.6.0 → 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 +73 -0
- package/README.md +2 -2
- 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-cores/tipos.d.ts +2 -0
- package/dist/components/ui-cores/ui-controle-cores.d.ts +8 -3
- package/dist/components/ui-cores/ui-seletor-cor.d.ts +3 -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/cores.cjs +1 -1
- package/dist/cores.js +1 -1
- package/dist/custom-elements.json +19799 -14940
- 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 +13 -14
- package/dist/tabela.cjs +1 -1
- package/dist/tabela.js +1 -1
- package/dist/tipos-elementos.d.ts +9 -3
- package/dist/tipos-vue.d.ts +9 -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-DgEza3wF.js +612 -0
- package/dist/ui-controle-cores-uY__TgwW.cjs +117 -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-botao-OGJV6Vfk.js +0 -165
- package/dist/ui-botao-psS1juof.cjs +0 -12
- package/dist/ui-paleta-ferramentas-CEZYcN4J.js +0 -624
- package/dist/ui-paleta-ferramentas-Dbj1kBS9.cjs +0 -18
- package/dist/ui-skeleton-DI4_9WOX.js +0 -428
- package/dist/ui-skeleton-elhKIh2B.cjs +0 -33
- package/dist/ui-tabela-propriedades-BBr5sqki.cjs +0 -145
- package/dist/ui-tabela-propriedades-Boy7I5yW.js +0 -2412
- 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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";var S=Object.defineProperty;var I=(i,s,t)=>s in i?S(i,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[s]=t;var a=(i,s,t)=>I(i,typeof s!="symbol"?s+"":s,t);const d=require("./ssr-safe-CiHD1adl.cjs"),m=require("./acessibilidade-CSzX-DkG.cjs"),x=require("./form-validacao-DIeyQVH5.cjs"),C=require("./form-submissao-DxKO5MHI.cjs"),k=':host{display:flex;flex-direction:column;gap:4px;width:100%;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){width:auto;display:inline-flex}.ui-campo-texto__container{position:relative;width:100%;display:flex;flex-direction:column;justify-content:center}:host([label-flutuante]) .ui-campo-texto__container{margin-top:6px}.ui-campo-texto__label{display:flex;align-items:center;justify-content:space-between;font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-medio, 500);color:var(--ui-cor-texto, #e1e1e6);-webkit-user-select:none;user-select:none;margin-bottom:4px;flex-shrink:0}.ui-campo-texto__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px;font-weight:600}.ui-campo-texto__wrapper{position:relative;display:flex;align-items:center;width:100%;height:var(--ui-campo-altura, 100%);min-height:var(--ui-campo-altura, var(--ui-altura-minima, 15px));background-color:var(--ui-cor-fundo-elevado, #1a1a1e);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);padding:0 8px;gap:6px;box-sizing:border-box;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.ui-campo-texto__wrapper--foco{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);background-color:var(--ui-cor-fundo-menu, #18181c)}.ui-campo-texto__wrapper--erro{border-color:var(--ui-cor-texto-erro, #ff5555)!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 18%,transparent)!important}.ui-campo-texto__wrapper--disabled{opacity:.5;cursor:not-allowed;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-campo-texto__input{flex:1;width:100%;height:100%;min-height:0;background:transparent;border:none;outline:none;color:var(--ui-cor-texto, #e1e1e6);font-family:inherit;font-size:clamp(11px,.85rem,13px);line-height:1.2;padding:0;margin:0;box-sizing:border-box}.ui-campo-texto__input::placeholder{color:var(--ui-cor-texto-secundario, #888899);opacity:.65}.ui-campo-texto__input:disabled{cursor:not-allowed}.ui-campo-texto__icone{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0;font-size:14px;line-height:1;max-height:100%}.ui-campo-texto__icone svg,.ui-campo-texto__icone ::slotted(svg),.ui-campo-texto__icone ::slotted(ui-icone){shape-rendering:geometricPrecision;display:inline-flex;vertical-align:middle}.ui-campo-texto__icone--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none;transition:opacity .15s ease,transform .15s ease}.ui-campo-texto__icone--clicavel:hover{opacity:.85;transform:scale(1.1)}:host([label-flutuante]) .ui-campo-texto__label{position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:12px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;z-index:3;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);padding:0 4px;border-radius:3px;margin-bottom:0;white-space:nowrap;max-width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;transition:top .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1),color .15s ease,font-size .15s ease}:host([label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label{left:28px}:host([label-flutuante]) .ui-campo-texto__label--ativa{top:-8px;left:8px!important;transform:translateY(0) scale(.85);transform-origin:left top;font-weight:600;color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}:host([label-flutuante][erro]) .ui-campo-texto__label--ativa,:host([label-flutuante][mensagem-erro]) .ui-campo-texto__label--ativa{color:var(--ui-cor-texto-erro, #ff5555)}.ui-campo-texto__helper{font-size:var(--ui-tamanho-caption, 11px);color:var(--ui-cor-texto-secundario, #888899);line-height:var(--ui-altura-linha-compacta, 1.2);margin-top:2px}.ui-campo-texto__helper--erro{color:var(--ui-cor-texto-erro, #ff5555);font-weight:500;display:flex;align-items:center;gap:4px}.ui-campo-texto__wrapper{touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-campo-texto__input{touch-action:manipulation}@media (max-width: 640px),(pointer: coarse) and (max-width: 1024px){.ui-campo-texto__input{font-size:16px!important}:host(:not([inline])) .ui-campo-texto__wrapper{min-height:max(var(--ui-campo-altura, 38px),38px);padding:0 10px}.ui-campo-texto__label{font-size:13px}.ui-campo-texto__icone--clicavel{min-width:32px;min-height:32px}}',f=["label","placeholder","value","tipo","type","obrigatorio","required","minlength","min-length","maxlength","max-length","pattern","min","max","step","mensagem-validacao","helper-text","erro","mensagem-erro","disabled","readonly","label-flutuante","alternar-senha","tamanho","size","altura","height","densidade","aria-label"];function v(){return`
|
|
2
|
+
<style>${k}</style>
|
|
3
|
+
<div class="ui-campo-texto__container">
|
|
4
|
+
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
5
|
+
<div class="ui-campo-texto__wrapper" part="campo">
|
|
6
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--esquerda" part="icone icone-esquerda">
|
|
7
|
+
<slot name="icone-esquerda"></slot>
|
|
8
|
+
</span>
|
|
9
|
+
<input class="ui-campo-texto__input" part="input" type="text" />
|
|
10
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--direita" part="icone icone-direita">
|
|
11
|
+
<slot name="icone-direita"></slot>
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ui-campo-texto__helper" part="ajuda" style="display: none;"></div>
|
|
16
|
+
`}function _(i,s,t,e){if(i.textContent=s,!t)return;const n=document.createElement("span");n.className=e,n.setAttribute("aria-hidden","true"),n.textContent="*",i.append(" ",n)}function E(i){const{labelElement:s,inputElement:t,labelText:e,placeholderText:n,isFlutuante:r,estaFocado:o,obrigatorio:u}=i,l=t.value.trim()!=="";let h=!1;try{h=t.matches(":-webkit-autofill")}catch{h=!1}e?(_(s,e,!!u,"ui-campo-texto__asterisco"),s.style.display="flex",r&&(o||l||h)?s.classList.add("ui-campo-texto__label--ativa"):s.classList.remove("ui-campo-texto__label--ativa")):s.style.display="none",r&&!o&&!l&&!h?t.placeholder="":t.placeholder=n}function y(i,s,t){s?(i.classList.add("ui-campo-texto__icone--clicavel"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label",t?"Ocultar senha":"Exibir senha")):(i.classList.remove("ui-campo-texto__icone--clicavel"),i.removeAttribute("role"),i.removeAttribute("tabindex"),i.removeAttribute("aria-label"))}function A(i,s,t,e,n,r){e?(i.classList.add("ui-campo-texto__wrapper--erro"),s.setAttribute("aria-invalid","true")):(i.classList.remove("ui-campo-texto__wrapper--erro"),s.removeAttribute("aria-invalid")),e&&n?(t.textContent=`⚠️ ${n}`,t.className="ui-campo-texto__helper ui-campo-texto__helper--erro",t.style.display="block"):r?(t.textContent=r,t.className="ui-campo-texto__helper",t.style.display="block"):t.style.display="none"}class b extends d.SafeHTMLElement{constructor(){super();a(this,"internals");a(this,"_formDisabled",!1);a(this,"_customErrorMessage","");this.internals=typeof this.attachInternals=="function"?this.attachInternals():{}}formDisabledCallback(t){this._formDisabled=t,this.syncState()}get form(){var t;return this.closest("form")??((t=this.internals)==null?void 0:t.form)??null}get required(){return this.hasAttribute("obrigatorio")||this.hasAttribute("required")}set required(t){t?this.setAttribute("obrigatorio",""):(this.removeAttribute("obrigatorio"),this.removeAttribute("required")),this.syncState()}get obrigatorio(){return this.required}set obrigatorio(t){this.required=t}get validity(){var t;return this.atualizarValidade(),(t=this.internals)==null?void 0:t.validity}get validationMessage(){var t;return this.atualizarValidade(),((t=this.internals)==null?void 0:t.validationMessage)??""}get willValidate(){var t;return((t=this.internals)==null?void 0:t.willValidate)??!1}checkValidity(){var t,e;return this.atualizarValidade(),((e=(t=this.internals)==null?void 0:t.checkValidity)==null?void 0:e.call(t))??!0}reportValidity(){var t,e;return this.atualizarValidade(),((e=(t=this.internals)==null?void 0:t.reportValidity)==null?void 0:e.call(t))??!0}setCustomValidity(t){this._customErrorMessage=t||"",this.atualizarValidade()}}a(b,"formAssociated",!0);class g extends b{constructor(){super();a(this,"labelElement");a(this,"wrapperElement");a(this,"inputElement");a(this,"helperElement");a(this,"rightIconContainer");a(this,"leftSlotElement");a(this,"_senhaVisivel",!1);a(this,"_checkTimer",null);a(this,"_focado",!1);a(this,"_inputId");a(this,"_defaultValue","");a(this,"handleSlotChange",()=>{this.syncState()});a(this,"handleHostClick",t=>{m.cliqueVeioDeRotuloExterno(this,t)&&!this.disabled&&this.inputElement.focus()});a(this,"handleRightIconClick",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.stopPropagation(),this.alternarVisibilidadeSenha())});a(this,"handleRightIconKeyDown",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.alternarVisibilidadeSenha())});a(this,"handleFocus",()=>{this._focado=!0,this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"),this.syncState()});a(this,"handleBlur",()=>{this._focado=!1,this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"),this.syncState()});a(this,"handleKeyDown",t=>{if(t.key!=="Enter"||t.isComposing||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;const e=this.form;e&&setTimeout(()=>{!t.defaultPrevented&&this.isConnected&&C.submeterImplicitamente(e)})});a(this,"handleInput",t=>{t.stopPropagation();const e=t.target.value;this.internals.setFormValue(e),this.syncState(),this.dispatchEvent(new CustomEvent("ui-input",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))});a(this,"handleChange",t=>{t.stopPropagation();const e=t.target.value;this.internals.setFormValue(e),this.syncState(),this.dispatchEvent(new CustomEvent("ui-change",{detail:{value:e},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))});const t=this.attachShadow({mode:"open",delegatesFocus:!0});t.innerHTML=v(),this.labelElement=t.querySelector(".ui-campo-texto__label"),this.wrapperElement=t.querySelector(".ui-campo-texto__wrapper"),this.inputElement=t.querySelector(".ui-campo-texto__input"),this.helperElement=t.querySelector(".ui-campo-texto__helper"),this.rightIconContainer=t.querySelector(".ui-campo-texto__icone--direita"),this.leftSlotElement=t.querySelector('slot[name="icone-esquerda"]'),this._inputId=m.gerarIdUnico("ui-input"),this.inputElement.id=this._inputId,this.labelElement.htmlFor=this._inputId,this.helperElement.id=`${this._inputId}-helper`,this.inputElement.setAttribute("aria-describedby",`${this._inputId}-helper`)}static get observedAttributes(){return f}focus(t){this.inputElement.focus(t)}blur(){this.inputElement.blur()}connectedCallback(){this.inputElement.addEventListener("input",this.handleInput),this.inputElement.addEventListener("change",this.handleChange),this.inputElement.addEventListener("focus",this.handleFocus),this.inputElement.addEventListener("blur",this.handleBlur),this.inputElement.addEventListener("keydown",this.handleKeyDown),this.rightIconContainer.addEventListener("click",this.handleRightIconClick),this.rightIconContainer.addEventListener("keydown",this.handleRightIconKeyDown),this.leftSlotElement.addEventListener("slotchange",this.handleSlotChange),this.addEventListener("click",this.handleHostClick),this._defaultValue=this.getAttribute("value")||"",this.hasAttribute("value")&&!this.inputElement.value&&(this.inputElement.value=this._defaultValue),this.syncState(),this._checkTimer=setTimeout(()=>this.syncState(),100)}disconnectedCallback(){this.inputElement.removeEventListener("input",this.handleInput),this.inputElement.removeEventListener("change",this.handleChange),this.inputElement.removeEventListener("focus",this.handleFocus),this.inputElement.removeEventListener("blur",this.handleBlur),this.inputElement.removeEventListener("keydown",this.handleKeyDown),this.rightIconContainer.removeEventListener("click",this.handleRightIconClick),this.rightIconContainer.removeEventListener("keydown",this.handleRightIconKeyDown),this.leftSlotElement.removeEventListener("slotchange",this.handleSlotChange),this.removeEventListener("click",this.handleHostClick),this._checkTimer&&clearTimeout(this._checkTimer)}attributeChangedCallback(t,e,n){t==="value"&&n!==this.inputElement.value&&!this._focado&&(this.inputElement.value=n||""),this.syncState()}get value(){return this.inputElement?this.inputElement.value:this.getAttribute("value")||""}set value(t){if(this.setAttribute("value",t),this.inputElement)try{this.inputElement.value=t}catch{}this.syncState()}formResetCallback(){var t;this.inputElement.value=this._defaultValue,(t=this.internals)==null||t.setFormValue(this._defaultValue),this.syncState()}formStateRestoreCallback(t,e){typeof t=="string"&&(this.value=t)}get name(){return this.getAttribute("name")||""}set name(t){this.setAttribute("name",t)}get type(){return this.getAttribute("tipo")||this.getAttribute("type")||"text"}get disabled(){return this.hasAttribute("disabled")||this._formDisabled}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get minLength(){const t=this.getAttribute("minlength")??this.getAttribute("min-length");return t?parseInt(t,10):-1}set minLength(t){t>=0?this.setAttribute("minlength",String(t)):this.removeAttribute("minlength"),this.syncState()}get maxLength(){const t=this.getAttribute("maxlength")??this.getAttribute("max-length");return t?parseInt(t,10):-1}set maxLength(t){t>=0?this.setAttribute("maxlength",String(t)):this.removeAttribute("maxlength"),this.syncState()}get pattern(){return this.getAttribute("pattern")||""}set pattern(t){t?this.setAttribute("pattern",t):this.removeAttribute("pattern"),this.syncState()}atualizarValidade(){var c,p;const t=this.getAttribute("minlength")??this.getAttribute("min-length"),e=this.getAttribute("maxlength")??this.getAttribute("max-length"),n=this.getAttribute("min"),r=this.getAttribute("max"),o=this.inputElement?this.inputElement.value:"",u=this.getAttribute("value")||o,l=!!((p=(c=this.inputElement)==null?void 0:c.validity)!=null&&p.badInput),h=x.validarRestricoesCampoTexto({val:o,rawVal:u,badInput:l,disabled:this.disabled,required:this.required,tipo:this.type,minlength:t!==null?parseInt(t,10):null,maxlength:e!==null?parseInt(e,10):null,min:n!==null?parseFloat(n):null,max:r!==null?parseFloat(r):null,step:this.getAttribute("step"),pattern:this.getAttribute("pattern"),customError:this._customErrorMessage,mensagemValidacao:this.getAttribute("mensagem-validacao")});x.aplicarValidadeInternals(this.internals,h,this.inputElement)}alternarVisibilidadeSenha(){var n;if(!(this.getAttribute("tipo")==="password"||this._senhaVisivel))return;this._senhaVisivel=!this._senhaVisivel,this.inputElement.type=this._senhaVisivel?"text":"password";const e=(n=this.shadowRoot)==null?void 0:n.querySelector('slot[name="icone-direita"]');e&&e.assignedElements().forEach(o=>{var u,l;(((u=o.textContent)==null?void 0:u.trim())==="👁️"||((l=o.textContent)==null?void 0:l.trim())==="🙈")&&(o.textContent=this._senhaVisivel?"🙈":"👁️")}),this.dispatchEvent(new CustomEvent("ui-toggle-senha",{detail:{visivel:this._senhaVisivel},bubbles:!0,composed:!0}))}syncState(){this.leftSlotElement.assignedNodes().length>0||this.querySelector('[slot="icone-esquerda"]')!==null?this.setAttribute("tem-icone-esquerda",""):this.removeAttribute("tem-icone-esquerda");const e=this.getAttribute("altura")||this.getAttribute("height");e?this.style.setProperty("--ui-campo-altura",isNaN(Number(e))?e:`${e}px`):this.style.removeProperty("--ui-campo-altura"),E({labelElement:this.labelElement,inputElement:this.inputElement,labelText:this.getAttribute("label"),placeholderText:this.getAttribute("placeholder")||"",isFlutuante:this.hasAttribute("label-flutuante"),estaFocado:this._focado,obrigatorio:this.required}),this.sincronizarNomeAcessivel();const n=this.getAttribute("tipo")||this.getAttribute("type")||"text";if(!this._senhaVisivel)try{this.inputElement.type=n}catch{this.inputElement.type="text"}const r=this.getAttribute("minlength")??this.getAttribute("min-length");r!==null?this.inputElement.minLength=parseInt(r,10):this.inputElement.removeAttribute("minlength");const o=this.getAttribute("maxlength")??this.getAttribute("max-length");o!==null?this.inputElement.maxLength=parseInt(o,10):this.inputElement.removeAttribute("maxlength");const u=this.getAttribute("pattern");u!==null?this.inputElement.pattern=u:this.inputElement.removeAttribute("pattern"),this.internals.setFormValue(this.inputElement.value);const l=this.hasAttribute("disabled")||this._formDisabled,h=this.hasAttribute("readonly");this.inputElement.disabled=l,this.inputElement.readOnly=h,l?this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled"):this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");const c=n==="password"||this.hasAttribute("alternar-senha");y(this.rightIconContainer,c,this._senhaVisivel);const p=this.hasAttribute("erro")||this.hasAttribute("mensagem-erro");A(this.wrapperElement,this.inputElement,this.helperElement,p,this.getAttribute("mensagem-erro"),this.getAttribute("helper-text")),this.atualizarValidade()}sincronizarNomeAcessivel(){const t=this.getAttribute("label")?"":m.obterRotuloExterno(this,this.internals);t?this.inputElement.setAttribute("aria-label",t):this.inputElement.removeAttribute("aria-label")}}class w extends g{}d.definirCustomElement("ui-campo-texto",g);d.definirCustomElement("ui-input",w);exports.ATRIBUTOS_OBSERVADOS_CAMPO_TEXTO=f;exports.FormAssociatedElement=b;exports.UICampoTexto=g;exports.UIInput=w;exports.criarTemplateCampoTexto=v;exports.renderizarRotulo=_;exports.sincronizarFeedbackErro=A;exports.sincronizarIconeSenha=y;exports.sincronizarLabelEPlaceholder=E;
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var x = (i, s, t) => s in i ? g(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t;
|
|
3
|
+
var a = (i, s, t) => x(i, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { S as f, d as m } from "./ssr-safe-5cWfJP-s.js";
|
|
5
|
+
import { g as v, o as _, c as E } from "./acessibilidade-CUlSXc2X.js";
|
|
6
|
+
import { v as y, a as A } from "./form-validacao-BlQFxUVj.js";
|
|
7
|
+
import { a as w } from "./form-submissao-C-SPRKgT.js";
|
|
8
|
+
const S = ':host{display:flex;flex-direction:column;gap:4px;width:100%;box-sizing:border-box;font-family:var(--ui-fonte-base, "Inter", sans-serif)}:host([inline]){width:auto;display:inline-flex}.ui-campo-texto__container{position:relative;width:100%;display:flex;flex-direction:column;justify-content:center}:host([label-flutuante]) .ui-campo-texto__container{margin-top:6px}.ui-campo-texto__label{display:flex;align-items:center;justify-content:space-between;font-size:var(--ui-tamanho-corpo-sm, 13px);font-weight:var(--ui-peso-medio, 500);color:var(--ui-cor-texto, #e1e1e6);-webkit-user-select:none;user-select:none;margin-bottom:4px;flex-shrink:0}.ui-campo-texto__asterisco{color:var(--ui-cor-texto-erro, #ff5555);margin-left:2px;font-weight:600}.ui-campo-texto__wrapper{position:relative;display:flex;align-items:center;width:100%;height:var(--ui-campo-altura, 100%);min-height:var(--ui-campo-altura, var(--ui-altura-minima, 15px));background-color:var(--ui-cor-fundo-elevado, #1a1a1e);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 6px);padding:0 8px;gap:6px;box-sizing:border-box;transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease}.ui-campo-texto__wrapper--foco{border-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 18%,transparent);background-color:var(--ui-cor-fundo-menu, #18181c)}.ui-campo-texto__wrapper--erro{border-color:var(--ui-cor-texto-erro, #ff5555)!important;box-shadow:0 0 0 2px color-mix(in srgb,var(--ui-cor-texto-erro, #ff5555) 18%,transparent)!important}.ui-campo-texto__wrapper--disabled{opacity:.5;cursor:not-allowed;background-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 3%,transparent)}.ui-campo-texto__input{flex:1;width:100%;height:100%;min-height:0;background:transparent;border:none;outline:none;color:var(--ui-cor-texto, #e1e1e6);font-family:inherit;font-size:clamp(11px,.85rem,13px);line-height:1.2;padding:0;margin:0;box-sizing:border-box}.ui-campo-texto__input::placeholder{color:var(--ui-cor-texto-secundario, #888899);opacity:.65}.ui-campo-texto__input:disabled{cursor:not-allowed}.ui-campo-texto__icone{display:inline-flex;align-items:center;justify-content:center;color:var(--ui-cor-texto-secundario, #888899);flex-shrink:0;font-size:14px;line-height:1;max-height:100%}.ui-campo-texto__icone svg,.ui-campo-texto__icone ::slotted(svg),.ui-campo-texto__icone ::slotted(ui-icone){shape-rendering:geometricPrecision;display:inline-flex;vertical-align:middle}.ui-campo-texto__icone--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none;transition:opacity .15s ease,transform .15s ease}.ui-campo-texto__icone--clicavel:hover{opacity:.85;transform:scale(1.1)}:host([label-flutuante]) .ui-campo-texto__label{position:absolute;left:8px;top:50%;transform:translateY(-50%);font-size:12px;color:var(--ui-cor-texto-secundario, #888899);pointer-events:none;z-index:3;background-color:var(--ui-cor-fundo-elevado, #1a1a1e);padding:0 4px;border-radius:3px;margin-bottom:0;white-space:nowrap;max-width:calc(100% - 16px);overflow:hidden;text-overflow:ellipsis;transition:top .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1),color .15s ease,font-size .15s ease}:host([label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label{left:28px}:host([label-flutuante]) .ui-campo-texto__label--ativa{top:-8px;left:8px!important;transform:translateY(0) scale(.85);transform-origin:left top;font-weight:600;color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-elevado, #1a1a1e)}:host([label-flutuante][erro]) .ui-campo-texto__label--ativa,:host([label-flutuante][mensagem-erro]) .ui-campo-texto__label--ativa{color:var(--ui-cor-texto-erro, #ff5555)}.ui-campo-texto__helper{font-size:var(--ui-tamanho-caption, 11px);color:var(--ui-cor-texto-secundario, #888899);line-height:var(--ui-altura-linha-compacta, 1.2);margin-top:2px}.ui-campo-texto__helper--erro{color:var(--ui-cor-texto-erro, #ff5555);font-weight:500;display:flex;align-items:center;gap:4px}.ui-campo-texto__wrapper{touch-action:manipulation;-webkit-tap-highlight-color:transparent}.ui-campo-texto__input{touch-action:manipulation}@media (max-width: 640px),(pointer: coarse) and (max-width: 1024px){.ui-campo-texto__input{font-size:16px!important}:host(:not([inline])) .ui-campo-texto__wrapper{min-height:max(var(--ui-campo-altura, 38px),38px);padding:0 10px}.ui-campo-texto__label{font-size:13px}.ui-campo-texto__icone--clicavel{min-width:32px;min-height:32px}}', k = [
|
|
9
|
+
"label",
|
|
10
|
+
"placeholder",
|
|
11
|
+
"value",
|
|
12
|
+
"tipo",
|
|
13
|
+
"type",
|
|
14
|
+
"obrigatorio",
|
|
15
|
+
"required",
|
|
16
|
+
"minlength",
|
|
17
|
+
"min-length",
|
|
18
|
+
"maxlength",
|
|
19
|
+
"max-length",
|
|
20
|
+
"pattern",
|
|
21
|
+
"min",
|
|
22
|
+
"max",
|
|
23
|
+
"step",
|
|
24
|
+
"mensagem-validacao",
|
|
25
|
+
"helper-text",
|
|
26
|
+
"erro",
|
|
27
|
+
"mensagem-erro",
|
|
28
|
+
"disabled",
|
|
29
|
+
"readonly",
|
|
30
|
+
"label-flutuante",
|
|
31
|
+
"alternar-senha",
|
|
32
|
+
"tamanho",
|
|
33
|
+
"size",
|
|
34
|
+
"altura",
|
|
35
|
+
"height",
|
|
36
|
+
"densidade",
|
|
37
|
+
"aria-label"
|
|
38
|
+
];
|
|
39
|
+
function C() {
|
|
40
|
+
return `
|
|
41
|
+
<style>${S}</style>
|
|
42
|
+
<div class="ui-campo-texto__container">
|
|
43
|
+
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
44
|
+
<div class="ui-campo-texto__wrapper" part="campo">
|
|
45
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--esquerda" part="icone icone-esquerda">
|
|
46
|
+
<slot name="icone-esquerda"></slot>
|
|
47
|
+
</span>
|
|
48
|
+
<input class="ui-campo-texto__input" part="input" type="text" />
|
|
49
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--direita" part="icone icone-direita">
|
|
50
|
+
<slot name="icone-direita"></slot>
|
|
51
|
+
</span>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="ui-campo-texto__helper" part="ajuda" style="display: none;"></div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
function I(i, s, t, e) {
|
|
58
|
+
if (i.textContent = s, !t) return;
|
|
59
|
+
const n = document.createElement("span");
|
|
60
|
+
n.className = e, n.setAttribute("aria-hidden", "true"), n.textContent = "*", i.append(" ", n);
|
|
61
|
+
}
|
|
62
|
+
function V(i) {
|
|
63
|
+
const { labelElement: s, inputElement: t, labelText: e, placeholderText: n, isFlutuante: r, estaFocado: o, obrigatorio: u } = i, l = t.value.trim() !== "";
|
|
64
|
+
let h = !1;
|
|
65
|
+
try {
|
|
66
|
+
h = t.matches(":-webkit-autofill");
|
|
67
|
+
} catch {
|
|
68
|
+
h = !1;
|
|
69
|
+
}
|
|
70
|
+
e ? (I(s, e, !!u, "ui-campo-texto__asterisco"), s.style.display = "flex", r && (o || l || h) ? s.classList.add("ui-campo-texto__label--ativa") : s.classList.remove("ui-campo-texto__label--ativa")) : s.style.display = "none", r && !o && !l && !h ? t.placeholder = "" : t.placeholder = n;
|
|
71
|
+
}
|
|
72
|
+
function L(i, s, t) {
|
|
73
|
+
s ? (i.classList.add("ui-campo-texto__icone--clicavel"), i.setAttribute("role", "button"), i.setAttribute("tabindex", "0"), i.setAttribute("aria-label", t ? "Ocultar senha" : "Exibir senha")) : (i.classList.remove("ui-campo-texto__icone--clicavel"), i.removeAttribute("role"), i.removeAttribute("tabindex"), i.removeAttribute("aria-label"));
|
|
74
|
+
}
|
|
75
|
+
function q(i, s, t, e, n, r) {
|
|
76
|
+
e ? (i.classList.add("ui-campo-texto__wrapper--erro"), s.setAttribute("aria-invalid", "true")) : (i.classList.remove("ui-campo-texto__wrapper--erro"), s.removeAttribute("aria-invalid")), e && n ? (t.textContent = `⚠️ ${n}`, t.className = "ui-campo-texto__helper ui-campo-texto__helper--erro", t.style.display = "block") : r ? (t.textContent = r, t.className = "ui-campo-texto__helper", t.style.display = "block") : t.style.display = "none";
|
|
77
|
+
}
|
|
78
|
+
class d extends f {
|
|
79
|
+
constructor() {
|
|
80
|
+
super();
|
|
81
|
+
a(this, "internals");
|
|
82
|
+
a(this, "_formDisabled", !1);
|
|
83
|
+
a(this, "_customErrorMessage", "");
|
|
84
|
+
this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : {};
|
|
85
|
+
}
|
|
86
|
+
// === Ciclo de Vida Form-Associated Custom Elements ===
|
|
87
|
+
formDisabledCallback(t) {
|
|
88
|
+
this._formDisabled = t, this.syncState();
|
|
89
|
+
}
|
|
90
|
+
get form() {
|
|
91
|
+
var t;
|
|
92
|
+
return this.closest("form") ?? ((t = this.internals) == null ? void 0 : t.form) ?? null;
|
|
93
|
+
}
|
|
94
|
+
get required() {
|
|
95
|
+
return this.hasAttribute("obrigatorio") || this.hasAttribute("required");
|
|
96
|
+
}
|
|
97
|
+
set required(t) {
|
|
98
|
+
t ? this.setAttribute("obrigatorio", "") : (this.removeAttribute("obrigatorio"), this.removeAttribute("required")), this.syncState();
|
|
99
|
+
}
|
|
100
|
+
get obrigatorio() {
|
|
101
|
+
return this.required;
|
|
102
|
+
}
|
|
103
|
+
set obrigatorio(t) {
|
|
104
|
+
this.required = t;
|
|
105
|
+
}
|
|
106
|
+
// === API de Validação Nativa ===
|
|
107
|
+
get validity() {
|
|
108
|
+
var t;
|
|
109
|
+
return this.atualizarValidade(), (t = this.internals) == null ? void 0 : t.validity;
|
|
110
|
+
}
|
|
111
|
+
get validationMessage() {
|
|
112
|
+
var t;
|
|
113
|
+
return this.atualizarValidade(), ((t = this.internals) == null ? void 0 : t.validationMessage) ?? "";
|
|
114
|
+
}
|
|
115
|
+
get willValidate() {
|
|
116
|
+
var t;
|
|
117
|
+
return ((t = this.internals) == null ? void 0 : t.willValidate) ?? !1;
|
|
118
|
+
}
|
|
119
|
+
checkValidity() {
|
|
120
|
+
var t, e;
|
|
121
|
+
return this.atualizarValidade(), ((e = (t = this.internals) == null ? void 0 : t.checkValidity) == null ? void 0 : e.call(t)) ?? !0;
|
|
122
|
+
}
|
|
123
|
+
reportValidity() {
|
|
124
|
+
var t, e;
|
|
125
|
+
return this.atualizarValidade(), ((e = (t = this.internals) == null ? void 0 : t.reportValidity) == null ? void 0 : e.call(t)) ?? !0;
|
|
126
|
+
}
|
|
127
|
+
setCustomValidity(t) {
|
|
128
|
+
this._customErrorMessage = t || "", this.atualizarValidade();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
a(d, "formAssociated", !0);
|
|
132
|
+
class b extends d {
|
|
133
|
+
constructor() {
|
|
134
|
+
super();
|
|
135
|
+
a(this, "labelElement");
|
|
136
|
+
a(this, "wrapperElement");
|
|
137
|
+
a(this, "inputElement");
|
|
138
|
+
a(this, "helperElement");
|
|
139
|
+
a(this, "rightIconContainer");
|
|
140
|
+
a(this, "leftSlotElement");
|
|
141
|
+
a(this, "_senhaVisivel", !1);
|
|
142
|
+
a(this, "_checkTimer", null);
|
|
143
|
+
a(this, "_focado", !1);
|
|
144
|
+
a(this, "_inputId");
|
|
145
|
+
a(this, "_defaultValue", "");
|
|
146
|
+
a(this, "handleSlotChange", () => {
|
|
147
|
+
this.syncState();
|
|
148
|
+
});
|
|
149
|
+
a(this, "handleHostClick", (t) => {
|
|
150
|
+
E(this, t) && !this.disabled && this.inputElement.focus();
|
|
151
|
+
});
|
|
152
|
+
a(this, "handleRightIconClick", (t) => {
|
|
153
|
+
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
154
|
+
});
|
|
155
|
+
a(this, "handleRightIconKeyDown", (t) => {
|
|
156
|
+
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
157
|
+
});
|
|
158
|
+
a(this, "handleFocus", () => {
|
|
159
|
+
this._focado = !0, this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
160
|
+
});
|
|
161
|
+
a(this, "handleBlur", () => {
|
|
162
|
+
this._focado = !1, this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* Enter submete o formulário como num <input> nativo. Aguarda um tick para que
|
|
166
|
+
* ouvintes do consumidor possam cancelar com `preventDefault()` no keydown.
|
|
167
|
+
*/
|
|
168
|
+
a(this, "handleKeyDown", (t) => {
|
|
169
|
+
if (t.key !== "Enter" || t.isComposing || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
|
|
170
|
+
const e = this.form;
|
|
171
|
+
e && setTimeout(() => {
|
|
172
|
+
!t.defaultPrevented && this.isConnected && w(e);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
a(this, "handleInput", (t) => {
|
|
176
|
+
t.stopPropagation();
|
|
177
|
+
const e = t.target.value;
|
|
178
|
+
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
179
|
+
new CustomEvent("ui-input", {
|
|
180
|
+
detail: { value: e },
|
|
181
|
+
bubbles: !0,
|
|
182
|
+
composed: !0
|
|
183
|
+
})
|
|
184
|
+
), this.dispatchEvent(
|
|
185
|
+
new Event("input", {
|
|
186
|
+
bubbles: !0,
|
|
187
|
+
composed: !0
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
a(this, "handleChange", (t) => {
|
|
192
|
+
t.stopPropagation();
|
|
193
|
+
const e = t.target.value;
|
|
194
|
+
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
195
|
+
new CustomEvent("ui-change", {
|
|
196
|
+
detail: { value: e },
|
|
197
|
+
bubbles: !0,
|
|
198
|
+
composed: !0
|
|
199
|
+
})
|
|
200
|
+
), this.dispatchEvent(
|
|
201
|
+
new Event("change", {
|
|
202
|
+
bubbles: !0,
|
|
203
|
+
composed: !0
|
|
204
|
+
})
|
|
205
|
+
);
|
|
206
|
+
});
|
|
207
|
+
const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
|
|
208
|
+
t.innerHTML = C(), this.labelElement = t.querySelector(".ui-campo-texto__label"), this.wrapperElement = t.querySelector(".ui-campo-texto__wrapper"), this.inputElement = t.querySelector(".ui-campo-texto__input"), this.helperElement = t.querySelector(".ui-campo-texto__helper"), this.rightIconContainer = t.querySelector(".ui-campo-texto__icone--direita"), this.leftSlotElement = t.querySelector('slot[name="icone-esquerda"]'), this._inputId = v("ui-input"), this.inputElement.id = this._inputId, this.labelElement.htmlFor = this._inputId, this.helperElement.id = `${this._inputId}-helper`, this.inputElement.setAttribute("aria-describedby", `${this._inputId}-helper`);
|
|
209
|
+
}
|
|
210
|
+
static get observedAttributes() {
|
|
211
|
+
return k;
|
|
212
|
+
}
|
|
213
|
+
focus(t) {
|
|
214
|
+
this.inputElement.focus(t);
|
|
215
|
+
}
|
|
216
|
+
blur() {
|
|
217
|
+
this.inputElement.blur();
|
|
218
|
+
}
|
|
219
|
+
connectedCallback() {
|
|
220
|
+
this.inputElement.addEventListener("input", this.handleInput), this.inputElement.addEventListener("change", this.handleChange), this.inputElement.addEventListener("focus", this.handleFocus), this.inputElement.addEventListener("blur", this.handleBlur), this.inputElement.addEventListener("keydown", this.handleKeyDown), this.rightIconContainer.addEventListener("click", this.handleRightIconClick), this.rightIconContainer.addEventListener("keydown", this.handleRightIconKeyDown), this.leftSlotElement.addEventListener("slotchange", this.handleSlotChange), this.addEventListener("click", this.handleHostClick), this._defaultValue = this.getAttribute("value") || "", this.hasAttribute("value") && !this.inputElement.value && (this.inputElement.value = this._defaultValue), this.syncState(), this._checkTimer = setTimeout(() => this.syncState(), 100);
|
|
221
|
+
}
|
|
222
|
+
disconnectedCallback() {
|
|
223
|
+
this.inputElement.removeEventListener("input", this.handleInput), this.inputElement.removeEventListener("change", this.handleChange), this.inputElement.removeEventListener("focus", this.handleFocus), this.inputElement.removeEventListener("blur", this.handleBlur), this.inputElement.removeEventListener("keydown", this.handleKeyDown), this.rightIconContainer.removeEventListener("click", this.handleRightIconClick), this.rightIconContainer.removeEventListener("keydown", this.handleRightIconKeyDown), this.leftSlotElement.removeEventListener("slotchange", this.handleSlotChange), this.removeEventListener("click", this.handleHostClick), this._checkTimer && clearTimeout(this._checkTimer);
|
|
224
|
+
}
|
|
225
|
+
attributeChangedCallback(t, e, n) {
|
|
226
|
+
t === "value" && n !== this.inputElement.value && !this._focado && (this.inputElement.value = n || ""), this.syncState();
|
|
227
|
+
}
|
|
228
|
+
get value() {
|
|
229
|
+
return this.inputElement ? this.inputElement.value : this.getAttribute("value") || "";
|
|
230
|
+
}
|
|
231
|
+
set value(t) {
|
|
232
|
+
if (this.setAttribute("value", t), this.inputElement)
|
|
233
|
+
try {
|
|
234
|
+
this.inputElement.value = t;
|
|
235
|
+
} catch {
|
|
236
|
+
}
|
|
237
|
+
this.syncState();
|
|
238
|
+
}
|
|
239
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
240
|
+
formResetCallback() {
|
|
241
|
+
var t;
|
|
242
|
+
this.inputElement.value = this._defaultValue, (t = this.internals) == null || t.setFormValue(this._defaultValue), this.syncState();
|
|
243
|
+
}
|
|
244
|
+
formStateRestoreCallback(t, e) {
|
|
245
|
+
typeof t == "string" && (this.value = t);
|
|
246
|
+
}
|
|
247
|
+
get name() {
|
|
248
|
+
return this.getAttribute("name") || "";
|
|
249
|
+
}
|
|
250
|
+
set name(t) {
|
|
251
|
+
this.setAttribute("name", t);
|
|
252
|
+
}
|
|
253
|
+
get type() {
|
|
254
|
+
return this.getAttribute("tipo") || this.getAttribute("type") || "text";
|
|
255
|
+
}
|
|
256
|
+
get disabled() {
|
|
257
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
258
|
+
}
|
|
259
|
+
set disabled(t) {
|
|
260
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
261
|
+
}
|
|
262
|
+
get minLength() {
|
|
263
|
+
const t = this.getAttribute("minlength") ?? this.getAttribute("min-length");
|
|
264
|
+
return t ? parseInt(t, 10) : -1;
|
|
265
|
+
}
|
|
266
|
+
set minLength(t) {
|
|
267
|
+
t >= 0 ? this.setAttribute("minlength", String(t)) : this.removeAttribute("minlength"), this.syncState();
|
|
268
|
+
}
|
|
269
|
+
get maxLength() {
|
|
270
|
+
const t = this.getAttribute("maxlength") ?? this.getAttribute("max-length");
|
|
271
|
+
return t ? parseInt(t, 10) : -1;
|
|
272
|
+
}
|
|
273
|
+
set maxLength(t) {
|
|
274
|
+
t >= 0 ? this.setAttribute("maxlength", String(t)) : this.removeAttribute("maxlength"), this.syncState();
|
|
275
|
+
}
|
|
276
|
+
get pattern() {
|
|
277
|
+
return this.getAttribute("pattern") || "";
|
|
278
|
+
}
|
|
279
|
+
set pattern(t) {
|
|
280
|
+
t ? this.setAttribute("pattern", t) : this.removeAttribute("pattern"), this.syncState();
|
|
281
|
+
}
|
|
282
|
+
atualizarValidade() {
|
|
283
|
+
var c, p;
|
|
284
|
+
const t = this.getAttribute("minlength") ?? this.getAttribute("min-length"), e = this.getAttribute("maxlength") ?? this.getAttribute("max-length"), n = this.getAttribute("min"), r = this.getAttribute("max"), o = this.inputElement ? this.inputElement.value : "", u = this.getAttribute("value") || o, l = !!((p = (c = this.inputElement) == null ? void 0 : c.validity) != null && p.badInput), h = y({
|
|
285
|
+
val: o,
|
|
286
|
+
rawVal: u,
|
|
287
|
+
badInput: l,
|
|
288
|
+
disabled: this.disabled,
|
|
289
|
+
required: this.required,
|
|
290
|
+
tipo: this.type,
|
|
291
|
+
minlength: t !== null ? parseInt(t, 10) : null,
|
|
292
|
+
maxlength: e !== null ? parseInt(e, 10) : null,
|
|
293
|
+
min: n !== null ? parseFloat(n) : null,
|
|
294
|
+
max: r !== null ? parseFloat(r) : null,
|
|
295
|
+
step: this.getAttribute("step"),
|
|
296
|
+
pattern: this.getAttribute("pattern"),
|
|
297
|
+
customError: this._customErrorMessage,
|
|
298
|
+
mensagemValidacao: this.getAttribute("mensagem-validacao")
|
|
299
|
+
});
|
|
300
|
+
A(this.internals, h, this.inputElement);
|
|
301
|
+
}
|
|
302
|
+
alternarVisibilidadeSenha() {
|
|
303
|
+
var n;
|
|
304
|
+
if (!(this.getAttribute("tipo") === "password" || this._senhaVisivel)) return;
|
|
305
|
+
this._senhaVisivel = !this._senhaVisivel, this.inputElement.type = this._senhaVisivel ? "text" : "password";
|
|
306
|
+
const e = (n = this.shadowRoot) == null ? void 0 : n.querySelector('slot[name="icone-direita"]');
|
|
307
|
+
e && e.assignedElements().forEach((o) => {
|
|
308
|
+
var u, l;
|
|
309
|
+
(((u = o.textContent) == null ? void 0 : u.trim()) === "👁️" || ((l = o.textContent) == null ? void 0 : l.trim()) === "🙈") && (o.textContent = this._senhaVisivel ? "🙈" : "👁️");
|
|
310
|
+
}), this.dispatchEvent(
|
|
311
|
+
new CustomEvent("ui-toggle-senha", {
|
|
312
|
+
detail: { visivel: this._senhaVisivel },
|
|
313
|
+
bubbles: !0,
|
|
314
|
+
composed: !0
|
|
315
|
+
})
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
syncState() {
|
|
319
|
+
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda");
|
|
320
|
+
const e = this.getAttribute("altura") || this.getAttribute("height");
|
|
321
|
+
e ? this.style.setProperty("--ui-campo-altura", isNaN(Number(e)) ? e : `${e}px`) : this.style.removeProperty("--ui-campo-altura"), V({
|
|
322
|
+
labelElement: this.labelElement,
|
|
323
|
+
inputElement: this.inputElement,
|
|
324
|
+
labelText: this.getAttribute("label"),
|
|
325
|
+
placeholderText: this.getAttribute("placeholder") || "",
|
|
326
|
+
isFlutuante: this.hasAttribute("label-flutuante"),
|
|
327
|
+
estaFocado: this._focado,
|
|
328
|
+
obrigatorio: this.required
|
|
329
|
+
}), this.sincronizarNomeAcessivel();
|
|
330
|
+
const n = this.getAttribute("tipo") || this.getAttribute("type") || "text";
|
|
331
|
+
if (!this._senhaVisivel)
|
|
332
|
+
try {
|
|
333
|
+
this.inputElement.type = n;
|
|
334
|
+
} catch {
|
|
335
|
+
this.inputElement.type = "text";
|
|
336
|
+
}
|
|
337
|
+
const r = this.getAttribute("minlength") ?? this.getAttribute("min-length");
|
|
338
|
+
r !== null ? this.inputElement.minLength = parseInt(r, 10) : this.inputElement.removeAttribute("minlength");
|
|
339
|
+
const o = this.getAttribute("maxlength") ?? this.getAttribute("max-length");
|
|
340
|
+
o !== null ? this.inputElement.maxLength = parseInt(o, 10) : this.inputElement.removeAttribute("maxlength");
|
|
341
|
+
const u = this.getAttribute("pattern");
|
|
342
|
+
u !== null ? this.inputElement.pattern = u : this.inputElement.removeAttribute("pattern"), this.internals.setFormValue(this.inputElement.value);
|
|
343
|
+
const l = this.hasAttribute("disabled") || this._formDisabled, h = this.hasAttribute("readonly");
|
|
344
|
+
this.inputElement.disabled = l, this.inputElement.readOnly = h, l ? this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled") : this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");
|
|
345
|
+
const c = n === "password" || this.hasAttribute("alternar-senha");
|
|
346
|
+
L(this.rightIconContainer, c, this._senhaVisivel);
|
|
347
|
+
const p = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|
|
348
|
+
q(
|
|
349
|
+
this.wrapperElement,
|
|
350
|
+
this.inputElement,
|
|
351
|
+
this.helperElement,
|
|
352
|
+
p,
|
|
353
|
+
this.getAttribute("mensagem-erro"),
|
|
354
|
+
this.getAttribute("helper-text")
|
|
355
|
+
), this.atualizarValidade();
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Sem o atributo `label`, o input nativo herda o nome acessível de fora do Shadow DOM
|
|
359
|
+
* (`aria-label` no host, `<label for>` ou `<label>` envolvente).
|
|
360
|
+
*/
|
|
361
|
+
sincronizarNomeAcessivel() {
|
|
362
|
+
const t = this.getAttribute("label") ? "" : _(this, this.internals);
|
|
363
|
+
t ? this.inputElement.setAttribute("aria-label", t) : this.inputElement.removeAttribute("aria-label");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
class z extends b {
|
|
367
|
+
}
|
|
368
|
+
m("ui-campo-texto", b);
|
|
369
|
+
m("ui-input", z);
|
|
370
|
+
export {
|
|
371
|
+
k as A,
|
|
372
|
+
d as F,
|
|
373
|
+
b as U,
|
|
374
|
+
z as a,
|
|
375
|
+
L as b,
|
|
376
|
+
C as c,
|
|
377
|
+
V as d,
|
|
378
|
+
I as r,
|
|
379
|
+
q as s
|
|
380
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var _ = (a, i, e) => i in a ? E(a, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[i] = e;
|
|
3
|
+
var r = (a, i, e) => _(a, typeof i != "symbol" ? i + "" : i, e);
|
|
4
|
+
import { L as w } from "./listener-bag-DQgv7OON.js";
|
|
5
|
+
import { d as A, S as k } from "./ssr-safe-5cWfJP-s.js";
|
|
6
|
+
import { e as S, a as C } from "./opcoes-CJYLi6kd.js";
|
|
7
|
+
const L = ':host{display:block;width:100%;box-sizing:border-box}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}', f = ["plano", "elevado", "destaque"];
|
|
8
|
+
class q extends k {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
r(this, "cardElement");
|
|
12
|
+
r(this, "listeners", new w());
|
|
13
|
+
r(this, "handleSlotChange", () => {
|
|
14
|
+
this.syncState();
|
|
15
|
+
});
|
|
16
|
+
r(this, "handleClick", (e) => {
|
|
17
|
+
if (!this.disabled) {
|
|
18
|
+
if (e && e.target && e.target instanceof HTMLElement) {
|
|
19
|
+
const t = e.target.closest('button, a, input, select, textarea, ui-botao, ui-switch, ui-checkbox, ui-radio, [role="button"]');
|
|
20
|
+
if (t && t !== this.cardElement)
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.clicavel && (this.dispatchEvent(
|
|
24
|
+
new CustomEvent("ui-click", {
|
|
25
|
+
detail: {
|
|
26
|
+
id: this.id || "sem-id"
|
|
27
|
+
},
|
|
28
|
+
bubbles: !0,
|
|
29
|
+
composed: !0
|
|
30
|
+
})
|
|
31
|
+
), this.dispatchEvent(
|
|
32
|
+
new CustomEvent("ui-clique", {
|
|
33
|
+
detail: {
|
|
34
|
+
id: this.id || "sem-id"
|
|
35
|
+
},
|
|
36
|
+
bubbles: !0,
|
|
37
|
+
composed: !0
|
|
38
|
+
})
|
|
39
|
+
));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
r(this, "handleKeyDown", (e) => {
|
|
43
|
+
!this.clicavel || this.disabled || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.handleClick());
|
|
44
|
+
});
|
|
45
|
+
const e = this.attachShadow({ mode: "open" });
|
|
46
|
+
e.innerHTML = `
|
|
47
|
+
<style>${L}</style>
|
|
48
|
+
<div class="ui-card" part="base">
|
|
49
|
+
<div class="ui-card__media" part="midia">
|
|
50
|
+
<slot name="midia"></slot>
|
|
51
|
+
<slot name="media"></slot>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="ui-card__header" part="cabecalho">
|
|
54
|
+
<slot name="cabecalho"></slot>
|
|
55
|
+
<slot name="header"></slot>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="ui-card__body" part="corpo">
|
|
58
|
+
<slot></slot>
|
|
59
|
+
</div>
|
|
60
|
+
<div class="ui-card__footer" part="rodape">
|
|
61
|
+
<slot name="rodape"></slot>
|
|
62
|
+
<slot name="footer"></slot>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
`, this.cardElement = e.querySelector(".ui-card");
|
|
66
|
+
}
|
|
67
|
+
static get observedAttributes() {
|
|
68
|
+
return [
|
|
69
|
+
"elevacao",
|
|
70
|
+
"elevation",
|
|
71
|
+
"variante",
|
|
72
|
+
"variant",
|
|
73
|
+
"clicavel",
|
|
74
|
+
"clickable",
|
|
75
|
+
"compacto",
|
|
76
|
+
"compact",
|
|
77
|
+
"disabled"
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
connectedCallback() {
|
|
81
|
+
var t;
|
|
82
|
+
this.listeners.cleanup(), this.listeners.add(this.cardElement, "click", this.handleClick), this.listeners.add(this.cardElement, "keydown", this.handleKeyDown);
|
|
83
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelectorAll("slot");
|
|
84
|
+
e == null || e.forEach((s) => this.listeners.add(s, "slotchange", this.handleSlotChange)), this.syncState();
|
|
85
|
+
}
|
|
86
|
+
disconnectedCallback() {
|
|
87
|
+
this.listeners.cleanup();
|
|
88
|
+
}
|
|
89
|
+
attributeChangedCallback(e, t, s) {
|
|
90
|
+
this.syncState();
|
|
91
|
+
}
|
|
92
|
+
get clicavel() {
|
|
93
|
+
return this.hasAttribute("clicavel") || this.hasAttribute("clickable");
|
|
94
|
+
}
|
|
95
|
+
set clicavel(e) {
|
|
96
|
+
e ? this.setAttribute("clicavel", "") : (this.removeAttribute("clicavel"), this.removeAttribute("clickable")), this.syncState();
|
|
97
|
+
}
|
|
98
|
+
get disabled() {
|
|
99
|
+
return this.hasAttribute("disabled");
|
|
100
|
+
}
|
|
101
|
+
set disabled(e) {
|
|
102
|
+
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled"), this.syncState();
|
|
103
|
+
}
|
|
104
|
+
syncState() {
|
|
105
|
+
var b, p, m;
|
|
106
|
+
const e = S(this.getAttribute("elevacao") || this.getAttribute("elevation"), f, "plano"), t = C(this.getAttribute("variante") || this.getAttribute("variant"), f), s = this.clicavel, g = this.hasAttribute("compacto") || this.hasAttribute("compact"), c = this.disabled;
|
|
107
|
+
this.cardElement.className = "ui-card", this.cardElement.classList.add(`ui-card--${e}`), t && this.cardElement.classList.add(`ui-card--${t}`), s ? (this.cardElement.classList.add("ui-card--clicavel"), this.cardElement.setAttribute("role", "button"), this.cardElement.setAttribute("tabindex", c ? "-1" : "0")) : (this.cardElement.removeAttribute("role"), this.cardElement.removeAttribute("tabindex")), c ? this.cardElement.setAttribute("aria-disabled", "true") : this.cardElement.removeAttribute("aria-disabled"), g && this.cardElement.classList.add("ui-card--compacto"), c && this.cardElement.classList.add("ui-card--disabled");
|
|
108
|
+
const n = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".ui-card__header"), u = (p = this.shadowRoot) == null ? void 0 : p.querySelector(".ui-card__footer"), h = (m = this.shadowRoot) == null ? void 0 : m.querySelector(".ui-card__media"), d = (v) => {
|
|
109
|
+
var x;
|
|
110
|
+
const y = v.map((o) => `slot[name="${o}"]`).join(", ");
|
|
111
|
+
return Array.from(((x = this.shadowRoot) == null ? void 0 : x.querySelectorAll(y)) || []).some((o) => o.assignedNodes({ flatten: !0 }).some((l) => l.nodeType === Node.ELEMENT_NODE || l.textContent && l.textContent.trim() !== "")) || v.some((o) => this.querySelector(`[slot="${o}"]`) !== null);
|
|
112
|
+
};
|
|
113
|
+
h && (h.style.display = d(["midia", "media"]) ? "block" : "none"), n && (n.style.display = d(["cabecalho", "header"]) ? "flex" : "none"), u && (u.style.display = d(["rodape", "footer"]) ? "flex" : "none");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
A("ui-card", q);
|
|
117
|
+
export {
|
|
118
|
+
q as U
|
|
119
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";var A=Object.defineProperty;var k=(a,i,e)=>i in a?A(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e;var r=(a,i,e)=>k(a,typeof i!="symbol"?i+"":i,e);const S=require("./listener-bag-D5omxZ9h.cjs"),y=require("./ssr-safe-CiHD1adl.cjs"),f=require("./opcoes-CkyDxBuQ.cjs"),C=':host{display:block;width:100%;box-sizing:border-box}:host(.h-full),:host([style*="height: 100%"]){height:100%}.ui-card{display:flex;flex-direction:column;width:100%;height:100%;box-sizing:border-box;background-color:var(--ui-cor-fundo-card, #18181c);border:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:var(--ui-raio-borda, 8px);overflow:hidden;transition:transform .2s cubic-bezier(.4,0,.2,1),box-shadow .2s cubic-bezier(.4,0,.2,1),border-color .2s ease;color:var(--ui-cor-texto, #e1e1e6);font-family:var(--ui-fonte-base, "Inter", sans-serif)}.ui-card--plano{background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:none}.ui-card--elevado{background-color:var(--ui-cor-fundo-elevado, #1e1e24);box-shadow:var(--ui-sombra-lg, 0 8px 24px rgba(0, 0, 0, .4));border-color:color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 8%,transparent)}.ui-card--destaque{border-color:var(--ui-cor-primaria, #00E08A);background-color:var(--ui-cor-fundo-card, #18181c);box-shadow:0 0 0 1px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 25%,transparent)}.ui-card--clicavel{cursor:pointer;-webkit-user-select:none;user-select:none}.ui-card--clicavel:hover{transform:translateY(-3px);border-color:var(--ui-cor-primaria, #00E08A);box-shadow:var(--ui-sombra-lg, 0 10px 30px rgba(0, 0, 0, .5)),0 0 15px color-mix(in srgb,var(--ui-cor-primaria, #00E08A) 15%,transparent)}.ui-card--clicavel:active{transform:translateY(-1px)}.ui-card--disabled{opacity:.5;cursor:not-allowed!important;pointer-events:none}.ui-card__media{width:100%;overflow:hidden;display:block;line-height:0}::slotted([slot="midia"]),::slotted([slot="media"]){width:100%;height:auto;display:block;object-fit:cover}.ui-card__header{padding:14px 16px 8px;display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card__body{padding:12px 16px;flex:1;box-sizing:border-box}.ui-card__footer{padding:10px 16px 14px;border-top:1px solid color-mix(in srgb,var(--ui-cor-texto, #e1e1e6) 6%,transparent);display:flex;align-items:center;justify-content:space-between;gap:12px;box-sizing:border-box}.ui-card--compacto .ui-card__header{padding:10px 12px 6px}.ui-card--compacto .ui-card__body{padding:8px 12px}.ui-card--compacto .ui-card__footer{padding:8px 12px 10px}',g=["plano","elevado","destaque"];class E extends y.SafeHTMLElement{constructor(){super();r(this,"cardElement");r(this,"listeners",new S.ListenerBag);r(this,"handleSlotChange",()=>{this.syncState()});r(this,"handleClick",e=>{if(!this.disabled){if(e&&e.target&&e.target instanceof HTMLElement){const t=e.target.closest('button, a, input, select, textarea, ui-botao, ui-switch, ui-checkbox, ui-radio, [role="button"]');if(t&&t!==this.cardElement)return}this.clicavel&&(this.dispatchEvent(new CustomEvent("ui-click",{detail:{id:this.id||"sem-id"},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("ui-clique",{detail:{id:this.id||"sem-id"},bubbles:!0,composed:!0})))}});r(this,"handleKeyDown",e=>{!this.clicavel||this.disabled||(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.handleClick())});const e=this.attachShadow({mode:"open"});e.innerHTML=`
|
|
2
|
+
<style>${C}</style>
|
|
3
|
+
<div class="ui-card" part="base">
|
|
4
|
+
<div class="ui-card__media" part="midia">
|
|
5
|
+
<slot name="midia"></slot>
|
|
6
|
+
<slot name="media"></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="ui-card__header" part="cabecalho">
|
|
9
|
+
<slot name="cabecalho"></slot>
|
|
10
|
+
<slot name="header"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="ui-card__body" part="corpo">
|
|
13
|
+
<slot></slot>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ui-card__footer" part="rodape">
|
|
16
|
+
<slot name="rodape"></slot>
|
|
17
|
+
<slot name="footer"></slot>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`,this.cardElement=e.querySelector(".ui-card")}static get observedAttributes(){return["elevacao","elevation","variante","variant","clicavel","clickable","compacto","compact","disabled"]}connectedCallback(){var t;this.listeners.cleanup(),this.listeners.add(this.cardElement,"click",this.handleClick),this.listeners.add(this.cardElement,"keydown",this.handleKeyDown);const e=(t=this.shadowRoot)==null?void 0:t.querySelectorAll("slot");e==null||e.forEach(s=>this.listeners.add(s,"slotchange",this.handleSlotChange)),this.syncState()}disconnectedCallback(){this.listeners.cleanup()}attributeChangedCallback(e,t,s){this.syncState()}get clicavel(){return this.hasAttribute("clicavel")||this.hasAttribute("clickable")}set clicavel(e){e?this.setAttribute("clicavel",""):(this.removeAttribute("clicavel"),this.removeAttribute("clickable")),this.syncState()}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled"),this.syncState()}syncState(){var b,p,m;const e=f.escolherOpcao(this.getAttribute("elevacao")||this.getAttribute("elevation"),g,"plano"),t=f.escolherOpcaoOpcional(this.getAttribute("variante")||this.getAttribute("variant"),g),s=this.clicavel,_=this.hasAttribute("compacto")||this.hasAttribute("compact"),c=this.disabled;this.cardElement.className="ui-card",this.cardElement.classList.add(`ui-card--${e}`),t&&this.cardElement.classList.add(`ui-card--${t}`),s?(this.cardElement.classList.add("ui-card--clicavel"),this.cardElement.setAttribute("role","button"),this.cardElement.setAttribute("tabindex",c?"-1":"0")):(this.cardElement.removeAttribute("role"),this.cardElement.removeAttribute("tabindex")),c?this.cardElement.setAttribute("aria-disabled","true"):this.cardElement.removeAttribute("aria-disabled"),_&&this.cardElement.classList.add("ui-card--compacto"),c&&this.cardElement.classList.add("ui-card--disabled");const n=(b=this.shadowRoot)==null?void 0:b.querySelector(".ui-card__header"),u=(p=this.shadowRoot)==null?void 0:p.querySelector(".ui-card__footer"),h=(m=this.shadowRoot)==null?void 0:m.querySelector(".ui-card__media"),d=v=>{var x;const w=v.map(o=>`slot[name="${o}"]`).join(", ");return Array.from(((x=this.shadowRoot)==null?void 0:x.querySelectorAll(w))||[]).some(o=>o.assignedNodes({flatten:!0}).some(l=>l.nodeType===Node.ELEMENT_NODE||l.textContent&&l.textContent.trim()!==""))||v.some(o=>this.querySelector(`[slot="${o}"]`)!==null)};h&&(h.style.display=d(["midia","media"])?"block":"none"),n&&(n.style.display=d(["cabecalho","header"])?"flex":"none"),u&&(u.style.display=d(["rodape","footer"])?"flex":"none")}}y.definirCustomElement("ui-card",E);exports.UICard=E;
|