@thibezer/ui-components-kit 2.28.0 → 2.28.2
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 +35 -0
- package/dist/camadas.cjs +82 -82
- package/dist/camadas.js +1135 -1037
- package/dist/campo-texto.cjs +2 -2
- package/dist/campo-texto.js +29 -29
- package/dist/canvas.cjs +38 -38
- package/dist/canvas.js +1045 -1022
- package/dist/components/ui-area-texto/ui-area-texto.d.ts +3 -0
- package/dist/components/ui-camadas/camadas-metricas.d.ts +2 -3
- package/dist/components/ui-camadas/camadas-selecao-api.d.ts +1 -0
- package/dist/components/ui-camadas/camadas-selecao.d.ts +17 -2
- package/dist/components/ui-camadas/camadas-sincronizacao-dom.d.ts +2 -0
- package/dist/components/ui-camadas/tipos.d.ts +2 -0
- package/dist/components/ui-camadas/ui-camadas.d.ts +2 -0
- package/dist/components/ui-campo-texto/ui-campo-texto.d.ts +3 -0
- package/dist/components/ui-canvas-cad/cad-hud-coordenadas.d.ts +12 -0
- package/dist/components/ui-canvas-cad/ui-canvas-cad.d.ts +6 -1
- package/dist/components/ui-tabela/tabela-corpo.d.ts +10 -0
- package/dist/components/ui-tabela/tabela-declarativa.d.ts +11 -0
- package/dist/components/ui-tabela/tabela-dom.d.ts +1 -0
- package/dist/components/ui-tabela/tabela-header.d.ts +1 -0
- package/dist/components/ui-tabela/tabela-renderizador.d.ts +4 -0
- package/dist/components/ui-tabela/tipos.d.ts +11 -0
- package/dist/components/ui-tabela/ui-tabela.d.ts +22 -2
- package/dist/components/ui-tabela-propriedades/editores-basicos.d.ts +6 -6
- package/dist/components/ui-tabela-propriedades/editores-cad.d.ts +5 -5
- package/dist/components/ui-tabela-propriedades/propriedades-dom-utils.d.ts +6 -4
- package/dist/components/ui-tabela-propriedades/propriedades-editores.d.ts +2 -2
- package/dist/components/ui-tabela-propriedades/propriedades-flutuante.d.ts +1 -1
- package/dist/components/ui-tabela-propriedades/propriedades-gerenciador-valores.d.ts +11 -11
- package/dist/components/ui-tabela-propriedades/propriedades-render-arvore.d.ts +4 -4
- package/dist/components/ui-tabela-propriedades/propriedades-splitter.d.ts +1 -0
- package/dist/components/ui-tabela-propriedades/propriedades-valor-misto.d.ts +9 -5
- package/dist/components/ui-tabela-propriedades/tipos.d.ts +10 -8
- package/dist/components/ui-tabela-propriedades/ui-tabela-propriedades.d.ts +9 -7
- package/dist/custom-elements.json +13485 -12764
- package/dist/data.cjs +1 -1
- package/dist/data.js +107 -100
- package/dist/feature_caixa-BLVtatpp.cjs +1 -0
- package/dist/feature_caixa-CHAdzESq.js +806 -0
- package/dist/{feature_desenho-BH-E1Q9Q.cjs → feature_desenho-DRHnu8u8.cjs} +1 -1
- package/dist/{feature_desenho-CC8Mp5Gp.js → feature_desenho-edf-dHuf.js} +2 -2
- package/dist/feature_metricas-CKQGG2nz.cjs +1 -0
- package/dist/feature_metricas-DGfd21VR.js +130 -0
- package/dist/forms.cjs +7 -7
- package/dist/forms.js +24 -24
- package/dist/geometria-px-DEAIxMG5.js +512 -0
- package/dist/geometria-px-DJcNHXbE.cjs +1 -0
- package/dist/gerencigeo-canvas/dms.d.ts +7 -0
- package/dist/gerencigeo-canvas/feature_algoritmos.d.ts +1 -4
- package/dist/gerencigeo-canvas/utils.d.ts +1 -3
- package/dist/index.cjs +7 -7
- package/dist/index.js +228 -219
- package/dist/mapa.cjs +1 -1
- package/dist/mapa.js +1 -1
- package/dist/motor.cjs +1 -1
- package/dist/motor.js +113 -111
- package/dist/prancha-nucleo.cjs +3 -3
- package/dist/prancha-nucleo.js +283 -282
- package/dist/prancha.cjs +1 -1
- package/dist/prancha.js +3 -3
- package/dist/tabela.cjs +8 -8
- package/dist/tabela.js +1367 -1136
- package/dist/tipos-elementos.d.ts +28 -8
- package/dist/tipos-vue.d.ts +30 -12
- package/dist/utils-B2HuBLwz.js +108 -0
- package/dist/utils-DpPysTeU.cjs +1 -0
- package/package.json +1 -1
- package/dist/feature_caixa-4M4MkFH7.cjs +0 -1
- package/dist/feature_caixa-BVc5LenS.js +0 -824
- package/dist/geometria-px-Cyi_oPD6.cjs +0 -1
- package/dist/geometria-px-DHMPUsxC.js +0 -639
- package/dist/utils-ClVgqVyJ.cjs +0 -1
- package/dist/utils-DrHoxxmf.js +0 -83
package/dist/campo-texto.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var v=(a,o,t)=>o in a?f(a,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[o]=t;var i=(a,o,t)=>v(a,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const
|
|
1
|
+
"use strict";var f=Object.defineProperty;var v=(a,o,t)=>o in a?f(a,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[o]=t;var i=(a,o,t)=>v(a,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const s=require("./kit-base-BmkPi5Rz.cjs"),E=':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;vertical-align:middle}.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, 34px);min-height:var(--ui-campo-altura, 34px);background:var(--ui-degrade-interno, var(--ui-campo-texto-fundo, var(--ui-fundo-elevado, 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:var(--ui-degrade-interno, var(--ui-campo-texto-fundo, var(--ui-fundo-card, 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:var(--ui-campo-texto-desabilitado-fundo, 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:var(--ui-campo-texto-rotulo-fundo, 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:var(--ui-campo-texto-rotulo-fundo, 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}}:host(.squarecircle) .ui-campo-texto__container,:host(.squarecircles) .ui-campo-texto__container,:host(.ui-squarecircle) .ui-campo-texto__container,:host(.ui-squarecircles) .ui-campo-texto__container,:host([formato="squarecircle"]) .ui-campo-texto__container,:host([formato="squarecircles"]) .ui-campo-texto__container,:host([formato="squircle"]) .ui-campo-texto__container{border-radius:var(--ui-raio-lg, 10px)}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-card: var(--ui-gradiente-card)}:host([variante="linha"]) .ui-campo-texto__wrapper,:host([variante="sublinhado"]) .ui-campo-texto__wrapper,:host([variante="underline"]) .ui-campo-texto__wrapper{background:transparent!important;border:none;border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:0;padding-left:0;padding-right:0;box-shadow:none}:host([variante="linha"]) .ui-campo-texto__wrapper--foco,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--foco,:host([variante="underline"]) .ui-campo-texto__wrapper--foco{border-bottom-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 1px 0 0 var(--ui-cor-primaria, #00E08A)}:host([variante="linha"]) .ui-campo-texto__wrapper--erro,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--erro,:host([variante="underline"]) .ui-campo-texto__wrapper--erro{border-bottom-color:var(--ui-cor-texto-erro, #ff5555)!important;box-shadow:0 1px 0 0 var(--ui-cor-texto-erro, #ff5555)!important}:host([variante="linha"]) .ui-campo-texto__wrapper--disabled,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--disabled,:host([variante="underline"]) .ui-campo-texto__wrapper--disabled{background:transparent!important}:host([variante="linha"][label-flutuante]) .ui-campo-texto__label,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label,:host([variante="linha"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label--ativa{background:transparent;left:0!important;padding-left:0}:host([variante="linha"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label--ativa{top:-12px}:host([variante="linha"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa),:host([variante="sublinhado"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa),:host([variante="underline"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa){left:22px!important}',d=["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",...s.ATRIBUTOS_DEGRADE];function m(){return`
|
|
2
2
|
<style>${E}</style>
|
|
3
3
|
<div class="ui-campo-texto__container">
|
|
4
4
|
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="ui-campo-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
16
|
-
`}function b(a){const{labelElement:o,inputElement:t,labelText:e,placeholderText:s,isFlutuante:l,estaFocado:n,obrigatorio:c}=a,u=t.value.trim()!=="";let h=!1;try{h=t.matches(":-webkit-autofill")}catch{h=!1}e?(r.renderizarRotulo(o,e,!!c,"ui-campo-texto__asterisco"),o.style.display="flex",l&&(n||u||h)?o.classList.add("ui-campo-texto__label--ativa"):o.classList.remove("ui-campo-texto__label--ativa")):o.style.display="none",l&&!n&&!u&&!h?t.placeholder="":t.placeholder=s}function g(a,o,t){o?(a.classList.add("ui-campo-texto__icone--clicavel"),a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",t?"Ocultar senha":"Exibir senha")):(a.classList.remove("ui-campo-texto__icone--clicavel"),a.removeAttribute("role"),a.removeAttribute("tabindex"),a.removeAttribute("aria-label"))}function x(a,o,t,e,s,l,n="ui-campo-texto"){e?(a.classList.add(`${n}__wrapper--erro`),o.setAttribute("aria-invalid","true")):(a.classList.remove(`${n}__wrapper--erro`),o.removeAttribute("aria-invalid")),e&&s?(t.textContent=`⚠️ ${s}`,t.className=`${n}__helper ${n}__helper--erro`,t.style.display="block"):l?(t.textContent=l,t.className=`${n}__helper`,t.style.display="block"):t.style.display="none"}class p extends r.FormAssociatedElement{constructor(){super();i(this,"labelElement");i(this,"wrapperElement");i(this,"inputElement");i(this,"helperElement");i(this,"rightIconContainer");i(this,"leftSlotElement");i(this,"_senhaVisivel",!1);i(this,"listeners",new r.ListenerBag);i(this,"_checkTimer",null);i(this,"_focado",!1);i(this,"_inputId");i(this,"_defaultValue","");i(this,"handleSlotChange",()=>{this.syncState()});i(this,"handleHostClick",t=>{r.cliqueVeioDeRotuloExterno(this,t)&&!this.disabled&&this.inputElement.focus()});i(this,"handleRightIconClick",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleRightIconKeyDown",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleFocus",()=>{this._focado=!0,this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"),this.syncState()});i(this,"handleBlur",()=>{this._focado=!1,this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"),this.syncState()});i(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&&r.submeterImplicitamente(e)})});i(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}))});i(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=m(),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=r.gerarIdUnico("ui-input"),this.inputElement.id=this._inputId,this.labelElement.htmlFor=this._inputId,this.helperElement.id=`${this._inputId}-helper`}static get observedAttributes(){return d}focus(t){this.inputElement.focus(t)}blur(){this.inputElement.blur()}connectedCallback(){this.listeners.cleanup(),this.listeners.add(this.inputElement,"input",this.handleInput),this.listeners.add(this.inputElement,"change",this.handleChange),this.listeners.add(this.inputElement,"focus",this.handleFocus),this.listeners.add(this.inputElement,"blur",this.handleBlur),this.listeners.add(this.inputElement,"keydown",this.handleKeyDown),this.listeners.add(this.rightIconContainer,"click",this.handleRightIconClick),this.listeners.add(this.rightIconContainer,"keydown",this.handleRightIconKeyDown),this.listeners.add(this.leftSlotElement,"slotchange",this.handleSlotChange),this.listeners.add(this,"click",this.handleHostClick),this._defaultValue=this.getAttribute("value")||"",this.hasAttribute("value")&&!this.inputElement.value&&(this.inputElement.value=this._defaultValue),this.syncState(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=setTimeout(()=>this.syncState(),100)}disconnectedCallback(){this.listeners.cleanup(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=null}attributeChangedCallback(t,e,s){t==="value"&&s!==this.inputElement.value&&!this._focado&&(this.inputElement.value=s||""),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(){return r.inteiroOuNulo(this.getAttribute("minlength")??this.getAttribute("min-length"))??-1}set minLength(t){t>=0?this.setAttribute("minlength",String(t)):this.removeAttribute("minlength"),this.syncState()}get maxLength(){return r.inteiroOuNulo(this.getAttribute("maxlength")??this.getAttribute("max-length"))??-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 u,h;const t=this.getAttribute("min"),e=this.getAttribute("max"),s=this.inputElement?this.inputElement.value:"",l=this.getAttribute("value")||s,n=!!((h=(u=this.inputElement)==null?void 0:u.validity)!=null&&h.badInput),c=r.validarRestricoesCampoTexto({val:s,rawVal:l,badInput:n,disabled:this.disabled,required:this.required,tipo:this.type,minlength:this.minLength>=0?this.minLength:null,maxlength:this.maxLength>=0?this.maxLength:null,min:t!==null?parseFloat(t):null,max:e!==null?parseFloat(e):null,step:this.getAttribute("step"),pattern:this.getAttribute("pattern"),customError:this._customErrorMessage,mensagemValidacao:this.getAttribute("mensagem-validacao")});r.aplicarValidadeInternals(this.internals,c,this.inputElement)}alternarVisibilidadeSenha(){var s;if(!(this.getAttribute("tipo")==="password"||this._senhaVisivel))return;this._senhaVisivel=!this._senhaVisivel,this.inputElement.type=this._senhaVisivel?"text":"password";const e=(s=this.shadowRoot)==null?void 0:s.querySelector('slot[name="icone-direita"]');e&&e.assignedElements().forEach(n=>{var c,u;(((c=n.textContent)==null?void 0:c.trim())==="👁️"||((u=n.textContent)==null?void 0:u.trim())==="🙈")&&(n.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"),r.aplicarAlturaControle(this),r.aplicarDegradeNoElemento(this,this.wrapperElement),b({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 e=this.getAttribute("tipo")||this.getAttribute("type")||"text";if(!this._senhaVisivel)try{this.inputElement.type=e}catch{this.inputElement.type="text"}this.minLength>=0?this.inputElement.minLength=this.minLength:this.inputElement.removeAttribute("minlength"),this.maxLength>=0?this.inputElement.maxLength=this.maxLength:this.inputElement.removeAttribute("maxlength");const s=this.getAttribute("pattern");s!==null?this.inputElement.pattern=s:this.inputElement.removeAttribute("pattern"),this.internals.setFormValue(this.inputElement.value);const l=this.hasAttribute("disabled")||this._formDisabled,n=this.hasAttribute("readonly");this.inputElement.disabled=l,this.inputElement.readOnly=n,l?this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled"):this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");const c=e==="password"||this.hasAttribute("alternar-senha");g(this.rightIconContainer,c,this._senhaVisivel);const u=this.hasAttribute("erro")||this.hasAttribute("mensagem-erro");x(this.wrapperElement,this.inputElement,this.helperElement,u,this.getAttribute("mensagem-erro"),this.getAttribute("helper-text")),this.helperElement.style.display==="none"?this.inputElement.removeAttribute("aria-describedby"):this.inputElement.setAttribute("aria-describedby",this.helperElement.id),this.required?this.inputElement.setAttribute("aria-required","true"):this.inputElement.removeAttribute("aria-required"),this.atualizarValidade()}sincronizarNomeAcessivel(){const t=this.getAttribute("label")?"":r.obterRotuloExterno(this,this.internals);t?this.inputElement.setAttribute("aria-label",t):this.inputElement.removeAttribute("aria-label")}}class _ extends p{}r.definirCustomElement("ui-campo-texto",p);r.definirCustomElement("ui-input",_);exports.ATRIBUTOS_OBSERVADOS_CAMPO_TEXTO=d;exports.UICampoTexto=p;exports.UIInput=_;exports.criarTemplateCampoTexto=m;exports.sincronizarFeedbackErro=x;exports.sincronizarIconeSenha=g;exports.sincronizarLabelEPlaceholder=b;
|
|
16
|
+
`}function b(a){const{labelElement:o,inputElement:t,labelText:e,placeholderText:n,isFlutuante:l,estaFocado:r,obrigatorio:c}=a,u=t.value.trim()!=="";let h=!1;try{h=t.matches(":-webkit-autofill")}catch{h=!1}e?(s.renderizarRotulo(o,e,!!c,"ui-campo-texto__asterisco"),o.style.display="flex",l&&(r||u||h)?o.classList.add("ui-campo-texto__label--ativa"):o.classList.remove("ui-campo-texto__label--ativa")):o.style.display="none",l&&!r&&!u&&!h?t.placeholder="":t.placeholder=n}function x(a,o,t){o?(a.classList.add("ui-campo-texto__icone--clicavel"),a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label",t?"Ocultar senha":"Exibir senha")):(a.classList.remove("ui-campo-texto__icone--clicavel"),a.removeAttribute("role"),a.removeAttribute("tabindex"),a.removeAttribute("aria-label"))}function _(a,o,t,e,n,l,r="ui-campo-texto"){e?(a.classList.add(`${r}__wrapper--erro`),o.setAttribute("aria-invalid","true")):(a.classList.remove(`${r}__wrapper--erro`),o.removeAttribute("aria-invalid")),e&&n?(t.textContent=`⚠️ ${n}`,t.className=`${r}__helper ${r}__helper--erro`,t.style.display="block"):l?(t.textContent=l,t.className=`${r}__helper`,t.style.display="block"):t.style.display="none"}class p extends s.FormAssociatedElement{constructor(){super();i(this,"labelElement");i(this,"wrapperElement");i(this,"inputElement");i(this,"helperElement");i(this,"rightIconContainer");i(this,"leftSlotElement");i(this,"_senhaVisivel",!1);i(this,"listeners",new s.ListenerBag);i(this,"_checkTimer",null);i(this,"_focado",!1);i(this,"_inputId");i(this,"_defaultValue","");i(this,"handleSlotChange",()=>{this.syncState()});i(this,"handleHostClick",t=>{s.cliqueVeioDeRotuloExterno(this,t)&&!this.disabled&&this.inputElement.focus()});i(this,"handleRightIconClick",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleRightIconKeyDown",t=>{(this.getAttribute("tipo")==="password"||this.hasAttribute("alternar-senha"))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.alternarVisibilidadeSenha())});i(this,"handleFocus",()=>{this._focado=!0,this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"),this.syncState()});i(this,"handleBlur",()=>{this._focado=!1,this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"),this.syncState()});i(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&&s.submeterImplicitamente(e)})});i(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}))});i(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=m(),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=s.gerarIdUnico("ui-input"),this.inputElement.id=this._inputId,this.labelElement.htmlFor=this._inputId,this.helperElement.id=`${this._inputId}-helper`}static get observedAttributes(){return d}focus(t){this.inputElement.focus(t)}blur(){this.inputElement.blur()}connectedCallback(){this.listeners.cleanup(),this.listeners.add(this.inputElement,"input",this.handleInput),this.listeners.add(this.inputElement,"change",this.handleChange),this.listeners.add(this.inputElement,"focus",this.handleFocus),this.listeners.add(this.inputElement,"blur",this.handleBlur),this.listeners.add(this.inputElement,"keydown",this.handleKeyDown),this.listeners.add(this.rightIconContainer,"click",this.handleRightIconClick),this.listeners.add(this.rightIconContainer,"keydown",this.handleRightIconKeyDown),this.listeners.add(this.leftSlotElement,"slotchange",this.handleSlotChange),this.listeners.add(this,"click",this.handleHostClick),this._defaultValue=this.getAttribute("value")||"",this.hasAttribute("value")&&!this.inputElement.value&&(this.inputElement.value=this._defaultValue),this.syncState(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=setTimeout(()=>this.syncState(),100)}disconnectedCallback(){this.listeners.cleanup(),this._checkTimer&&clearTimeout(this._checkTimer),this._checkTimer=null}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(){return s.inteiroOuNulo(this.getAttribute("minlength")??this.getAttribute("min-length"))??-1}set minLength(t){t>=0?this.setAttribute("minlength",String(t)):this.removeAttribute("minlength"),this.syncState()}get maxLength(){return s.inteiroOuNulo(this.getAttribute("maxlength")??this.getAttribute("max-length"))??-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 u,h;const t=this.getAttribute("min"),e=this.getAttribute("max"),n=this.inputElement?this.inputElement.value:"",l=this.getAttribute("value")||n,r=!!((h=(u=this.inputElement)==null?void 0:u.validity)!=null&&h.badInput),c=s.validarRestricoesCampoTexto({val:n,rawVal:l,badInput:r,disabled:this.disabled,required:this.required,tipo:this.type,minlength:this.minLength>=0?this.minLength:null,maxlength:this.maxLength>=0?this.maxLength:null,min:t!==null?parseFloat(t):null,max:e!==null?parseFloat(e):null,step:this.getAttribute("step"),pattern:this.getAttribute("pattern"),customError:this._customErrorMessage,mensagemValidacao:this.getAttribute("mensagem-validacao")});s.aplicarValidadeInternals(this.internals,c,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(r=>{var c,u;(((c=r.textContent)==null?void 0:c.trim())==="👁️"||((u=r.textContent)==null?void 0:u.trim())==="🙈")&&(r.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"),s.aplicarAlturaControle(this),s.aplicarDegradeNoElemento(this,this.wrapperElement),b({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 e=this.getAttribute("tipo")||this.getAttribute("type")||"text";if(!this._senhaVisivel)try{this.inputElement.type=e}catch{this.inputElement.type="text"}this.minLength>=0?this.inputElement.minLength=this.minLength:this.inputElement.removeAttribute("minlength"),this.maxLength>=0?this.inputElement.maxLength=this.maxLength:this.inputElement.removeAttribute("maxlength");const n=this.getAttribute("pattern");n!==null?this.inputElement.pattern=n:this.inputElement.removeAttribute("pattern"),this.internals.setFormValue(this.inputElement.value);const l=this.hasAttribute("disabled")||this._formDisabled,r=this.hasAttribute("readonly");this.inputElement.disabled=l,this.inputElement.readOnly=r,l?this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled"):this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");const c=e==="password"||this.hasAttribute("alternar-senha");x(this.rightIconContainer,c,this._senhaVisivel);const u=this.hasAttribute("erro")||this.hasAttribute("mensagem-erro");_(this.wrapperElement,this.inputElement,this.helperElement,u,this.getAttribute("mensagem-erro"),this.getAttribute("helper-text")),this.helperElement.style.display==="none"?this.inputElement.removeAttribute("aria-describedby"):this.inputElement.setAttribute("aria-describedby",this.helperElement.id),this.required?this.inputElement.setAttribute("aria-required","true"):this.inputElement.removeAttribute("aria-required"),this.atualizarValidade()}sincronizarNomeAcessivel(){const t=this.getAttribute("label")?"":s.obterRotuloExterno(this,this.internals);t?this.inputElement.setAttribute("aria-label",t):this.inputElement.removeAttribute("aria-label")}}class g extends p{}s.definirCustomElement("ui-campo-texto",p);s.definirCustomElement("ui-input",g);exports.ATRIBUTOS_OBSERVADOS_CAMPO_TEXTO=d;exports.UICampoTexto=p;exports.UIInput=g;exports.criarTemplateCampoTexto=m;exports.sincronizarFeedbackErro=_;exports.sincronizarIconeSenha=x;exports.sincronizarLabelEPlaceholder=b;
|
package/dist/campo-texto.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
|
-
var b = (a,
|
|
3
|
-
var i = (a,
|
|
2
|
+
var b = (a, o, t) => o in a ? m(a, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[o] = t;
|
|
3
|
+
var i = (a, o, t) => b(a, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { A as
|
|
6
|
-
const
|
|
5
|
+
import { A as x, R as _, F as g, L as f, u as v, T as c, V as E, W as y, j as w, g as A, E as S, p as k, X as q, d as p } from "./kit-base-CBXA66aM.js";
|
|
6
|
+
const C = ':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;vertical-align:middle}.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, 34px);min-height:var(--ui-campo-altura, 34px);background:var(--ui-degrade-interno, var(--ui-campo-texto-fundo, var(--ui-fundo-elevado, 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:var(--ui-degrade-interno, var(--ui-campo-texto-fundo, var(--ui-fundo-card, 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:var(--ui-campo-texto-desabilitado-fundo, 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:var(--ui-campo-texto-rotulo-fundo, 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:var(--ui-campo-texto-rotulo-fundo, 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}}:host(.squarecircle) .ui-campo-texto__container,:host(.squarecircles) .ui-campo-texto__container,:host(.ui-squarecircle) .ui-campo-texto__container,:host(.ui-squarecircles) .ui-campo-texto__container,:host([formato="squarecircle"]) .ui-campo-texto__container,:host([formato="squarecircles"]) .ui-campo-texto__container,:host([formato="squircle"]) .ui-campo-texto__container{border-radius:var(--ui-raio-lg, 10px)}:host(.degrade),:host(.ui-degrade),:host(.gradiente),:host(.ui-gradiente),:host([degrade]:not([degrade="false"]):not([degrade="none"]):not([degrade="0"]):not([degrade="off"])),:host([gradiente]:not([gradiente="false"]):not([gradiente="none"]):not([gradiente="0"]):not([gradiente="off"])),:host([gradient]:not([gradient="false"]):not([gradient="none"]):not([gradient="0"]):not([gradient="off"])){--ui-fundo-elevado: var(--ui-gradiente-elevado);--ui-fundo-card: var(--ui-gradiente-card)}:host([variante="linha"]) .ui-campo-texto__wrapper,:host([variante="sublinhado"]) .ui-campo-texto__wrapper,:host([variante="underline"]) .ui-campo-texto__wrapper{background:transparent!important;border:none;border-bottom:1px solid var(--ui-cor-borda, rgba(255, 255, 255, .12));border-radius:0;padding-left:0;padding-right:0;box-shadow:none}:host([variante="linha"]) .ui-campo-texto__wrapper--foco,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--foco,:host([variante="underline"]) .ui-campo-texto__wrapper--foco{border-bottom-color:var(--ui-cor-primaria, #00E08A);box-shadow:0 1px 0 0 var(--ui-cor-primaria, #00E08A)}:host([variante="linha"]) .ui-campo-texto__wrapper--erro,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--erro,:host([variante="underline"]) .ui-campo-texto__wrapper--erro{border-bottom-color:var(--ui-cor-texto-erro, #ff5555)!important;box-shadow:0 1px 0 0 var(--ui-cor-texto-erro, #ff5555)!important}:host([variante="linha"]) .ui-campo-texto__wrapper--disabled,:host([variante="sublinhado"]) .ui-campo-texto__wrapper--disabled,:host([variante="underline"]) .ui-campo-texto__wrapper--disabled{background:transparent!important}:host([variante="linha"][label-flutuante]) .ui-campo-texto__label,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label,:host([variante="linha"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label--ativa{background:transparent;left:0!important;padding-left:0}:host([variante="linha"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="sublinhado"][label-flutuante]) .ui-campo-texto__label--ativa,:host([variante="underline"][label-flutuante]) .ui-campo-texto__label--ativa{top:-12px}:host([variante="linha"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa),:host([variante="sublinhado"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa),:host([variante="underline"][label-flutuante][tem-icone-esquerda]) .ui-campo-texto__label:not(.ui-campo-texto__label--ativa){left:22px!important}', V = [
|
|
7
7
|
"label",
|
|
8
8
|
"placeholder",
|
|
9
9
|
"value",
|
|
@@ -33,11 +33,11 @@ const q = ':host{display:flex;flex-direction:column;gap:4px;width:100%;box-sizin
|
|
|
33
33
|
"height",
|
|
34
34
|
"densidade",
|
|
35
35
|
"aria-label",
|
|
36
|
-
...
|
|
36
|
+
...x
|
|
37
37
|
];
|
|
38
38
|
function I() {
|
|
39
39
|
return `
|
|
40
|
-
<style>${
|
|
40
|
+
<style>${C}</style>
|
|
41
41
|
<div class="ui-campo-texto__container">
|
|
42
42
|
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
43
43
|
<div class="ui-campo-texto__wrapper" part="campo">
|
|
@@ -54,22 +54,22 @@ function I() {
|
|
|
54
54
|
`;
|
|
55
55
|
}
|
|
56
56
|
function L(a) {
|
|
57
|
-
const { labelElement:
|
|
57
|
+
const { labelElement: o, inputElement: t, labelText: e, placeholderText: n, isFlutuante: s, estaFocado: r, obrigatorio: u } = a, l = t.value.trim() !== "";
|
|
58
58
|
let h = !1;
|
|
59
59
|
try {
|
|
60
60
|
h = t.matches(":-webkit-autofill");
|
|
61
61
|
} catch {
|
|
62
62
|
h = !1;
|
|
63
63
|
}
|
|
64
|
-
e ? (
|
|
64
|
+
e ? (_(o, e, !!u, "ui-campo-texto__asterisco"), o.style.display = "flex", s && (r || l || h) ? o.classList.add("ui-campo-texto__label--ativa") : o.classList.remove("ui-campo-texto__label--ativa")) : o.style.display = "none", s && !r && !l && !h ? t.placeholder = "" : t.placeholder = n;
|
|
65
65
|
}
|
|
66
|
-
function T(a,
|
|
67
|
-
|
|
66
|
+
function T(a, o, t) {
|
|
67
|
+
o ? (a.classList.add("ui-campo-texto__icone--clicavel"), a.setAttribute("role", "button"), a.setAttribute("tabindex", "0"), a.setAttribute("aria-label", t ? "Ocultar senha" : "Exibir senha")) : (a.classList.remove("ui-campo-texto__icone--clicavel"), a.removeAttribute("role"), a.removeAttribute("tabindex"), a.removeAttribute("aria-label"));
|
|
68
68
|
}
|
|
69
|
-
function z(a,
|
|
70
|
-
e ? (a.classList.add(`${
|
|
69
|
+
function z(a, o, t, e, n, s, r = "ui-campo-texto") {
|
|
70
|
+
e ? (a.classList.add(`${r}__wrapper--erro`), o.setAttribute("aria-invalid", "true")) : (a.classList.remove(`${r}__wrapper--erro`), o.removeAttribute("aria-invalid")), e && n ? (t.textContent = `⚠️ ${n}`, t.className = `${r}__helper ${r}__helper--erro`, t.style.display = "block") : s ? (t.textContent = s, t.className = `${r}__helper`, t.style.display = "block") : t.style.display = "none";
|
|
71
71
|
}
|
|
72
|
-
class d extends
|
|
72
|
+
class d extends g {
|
|
73
73
|
constructor() {
|
|
74
74
|
super();
|
|
75
75
|
i(this, "labelElement");
|
|
@@ -110,7 +110,7 @@ class d extends _ {
|
|
|
110
110
|
if (t.key !== "Enter" || t.isComposing || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
|
|
111
111
|
const e = this.form;
|
|
112
112
|
e && setTimeout(() => {
|
|
113
|
-
!t.defaultPrevented && this.isConnected &&
|
|
113
|
+
!t.defaultPrevented && this.isConnected && q(e);
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
i(this, "handleInput", (t) => {
|
|
@@ -163,8 +163,8 @@ class d extends _ {
|
|
|
163
163
|
disconnectedCallback() {
|
|
164
164
|
this.listeners.cleanup(), this._checkTimer && clearTimeout(this._checkTimer), this._checkTimer = null;
|
|
165
165
|
}
|
|
166
|
-
attributeChangedCallback(t, e,
|
|
167
|
-
t === "value" &&
|
|
166
|
+
attributeChangedCallback(t, e, n) {
|
|
167
|
+
t === "value" && n !== this.inputElement.value && !this._focado && (this.inputElement.value = n || ""), this.syncState();
|
|
168
168
|
}
|
|
169
169
|
get value() {
|
|
170
170
|
return this.inputElement ? this.inputElement.value : this.getAttribute("value") || "";
|
|
@@ -220,10 +220,10 @@ class d extends _ {
|
|
|
220
220
|
}
|
|
221
221
|
atualizarValidade() {
|
|
222
222
|
var l, h;
|
|
223
|
-
const t = this.getAttribute("min"), e = this.getAttribute("max"),
|
|
224
|
-
val:
|
|
225
|
-
rawVal:
|
|
226
|
-
badInput:
|
|
223
|
+
const t = this.getAttribute("min"), e = this.getAttribute("max"), n = this.inputElement ? this.inputElement.value : "", s = this.getAttribute("value") || n, r = !!((h = (l = this.inputElement) == null ? void 0 : l.validity) != null && h.badInput), u = E({
|
|
224
|
+
val: n,
|
|
225
|
+
rawVal: s,
|
|
226
|
+
badInput: r,
|
|
227
227
|
disabled: this.disabled,
|
|
228
228
|
required: this.required,
|
|
229
229
|
tipo: this.type,
|
|
@@ -239,13 +239,13 @@ class d extends _ {
|
|
|
239
239
|
y(this.internals, u, this.inputElement);
|
|
240
240
|
}
|
|
241
241
|
alternarVisibilidadeSenha() {
|
|
242
|
-
var
|
|
242
|
+
var n;
|
|
243
243
|
if (!(this.getAttribute("tipo") === "password" || this._senhaVisivel)) return;
|
|
244
244
|
this._senhaVisivel = !this._senhaVisivel, this.inputElement.type = this._senhaVisivel ? "text" : "password";
|
|
245
|
-
const e = (
|
|
246
|
-
e && e.assignedElements().forEach((
|
|
245
|
+
const e = (n = this.shadowRoot) == null ? void 0 : n.querySelector('slot[name="icone-direita"]');
|
|
246
|
+
e && e.assignedElements().forEach((r) => {
|
|
247
247
|
var u, l;
|
|
248
|
-
(((u =
|
|
248
|
+
(((u = r.textContent) == null ? void 0 : u.trim()) === "👁️" || ((l = r.textContent) == null ? void 0 : l.trim()) === "🙈") && (r.textContent = this._senhaVisivel ? "🙈" : "👁️");
|
|
249
249
|
}), this.dispatchEvent(
|
|
250
250
|
new CustomEvent("ui-toggle-senha", {
|
|
251
251
|
detail: { visivel: this._senhaVisivel },
|
|
@@ -255,7 +255,7 @@ class d extends _ {
|
|
|
255
255
|
);
|
|
256
256
|
}
|
|
257
257
|
syncState() {
|
|
258
|
-
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda"),
|
|
258
|
+
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda"), w(this), A(this, this.wrapperElement), L({
|
|
259
259
|
labelElement: this.labelElement,
|
|
260
260
|
inputElement: this.inputElement,
|
|
261
261
|
labelText: this.getAttribute("label"),
|
|
@@ -272,10 +272,10 @@ class d extends _ {
|
|
|
272
272
|
this.inputElement.type = "text";
|
|
273
273
|
}
|
|
274
274
|
this.minLength >= 0 ? this.inputElement.minLength = this.minLength : this.inputElement.removeAttribute("minlength"), this.maxLength >= 0 ? this.inputElement.maxLength = this.maxLength : this.inputElement.removeAttribute("maxlength");
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
this.inputElement.disabled =
|
|
275
|
+
const n = this.getAttribute("pattern");
|
|
276
|
+
n !== null ? this.inputElement.pattern = n : this.inputElement.removeAttribute("pattern"), this.internals.setFormValue(this.inputElement.value);
|
|
277
|
+
const s = this.hasAttribute("disabled") || this._formDisabled, r = this.hasAttribute("readonly");
|
|
278
|
+
this.inputElement.disabled = s, this.inputElement.readOnly = r, s ? this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled") : this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");
|
|
279
279
|
const u = e === "password" || this.hasAttribute("alternar-senha");
|
|
280
280
|
T(this.rightIconContainer, u, this._senhaVisivel);
|
|
281
281
|
const l = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|