@thibezer/ui-components-kit 2.24.1 → 2.25.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 +83 -1
- package/dist/botao.cjs +12 -1
- package/dist/botao.js +162 -3
- package/dist/camadas.cjs +311 -1
- package/dist/camadas.js +3244 -148
- package/dist/campo-texto.cjs +16 -1
- package/dist/campo-texto.js +308 -7
- package/dist/canvas.cjs +22 -22
- package/dist/canvas.js +230 -233
- package/dist/card.cjs +20 -1
- package/dist/card.js +145 -2
- package/dist/components/ui-canvas-prancha/index.d.ts +1 -1
- package/dist/components/ui-canvas-prancha/prancha-teclado.d.ts +26 -0
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha-base.d.ts +9 -0
- package/dist/components/ui-canvas-prancha/ui-canvas-prancha.d.ts +2 -2
- package/dist/components/ui-editor-prancha/editor-barra.d.ts +19 -0
- package/dist/components/ui-editor-prancha/editor-modos.d.ts +35 -0
- package/dist/components/ui-editor-prancha/editor-tipos.d.ts +4 -0
- package/dist/components/ui-editor-prancha/index.d.ts +1 -0
- package/dist/components/ui-editor-prancha/ui-editor-prancha.d.ts +63 -7
- package/dist/core/alvo-digitavel.d.ts +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +43 -54
- package/dist/{cores-utils-BrdynxRd.js → cores-utils-DMyqWvZh.js} +2 -2
- package/dist/cores.cjs +32 -1
- package/dist/cores.js +300 -13
- package/dist/custom-elements.json +11945 -11071
- package/dist/data.cjs +28 -1
- package/dist/data.js +286 -99
- package/dist/{feature_caixa-2Sxv3tGa.js → feature_caixa-BVc5LenS.js} +42 -42
- package/dist/{feature_desenho-BVHivWIB.js → feature_desenho-CC8Mp5Gp.js} +2 -2
- package/dist/feedback.cjs +52 -1
- package/dist/feedback.js +655 -25
- package/dist/forms.cjs +66 -1
- package/dist/forms.js +1216 -39
- package/dist/{geometria-px-DUs5FgLE.js → geometria-px-DHMPUsxC.js} +47 -47
- package/dist/index.cjs +67 -1
- package/dist/index.js +1476 -274
- package/dist/kit-base-BmkPi5Rz.cjs +2 -0
- package/dist/kit-base-CBXA66aM.js +1084 -0
- package/dist/mapa.cjs +5 -5
- package/dist/mapa.js +16 -17
- package/dist/modal.cjs +18 -1
- package/dist/modal.js +235 -29
- package/dist/motor.js +49 -49
- package/dist/prancha-nucleo.cjs +3 -1
- package/dist/prancha-nucleo.js +3120 -277
- package/dist/prancha.cjs +38 -1
- package/dist/prancha.js +3470 -228
- package/dist/register.cjs +1 -1
- package/dist/register.js +3 -20
- package/dist/seletor-mapa-base.cjs +13 -13
- package/dist/seletor-mapa-base.js +3 -5
- package/dist/tabela.cjs +142 -1
- package/dist/tabela.js +3773 -92
- package/dist/tipos-elementos.d.ts +7 -3
- package/dist/tipos-vue.d.ts +6 -3
- package/dist/tools.cjs +16 -1
- package/dist/tools.js +1564 -26
- package/dist/{ui-seletor-cor-Cd8jkzXG.js → ui-seletor-cor-CPjA9vhZ.js} +8 -9
- package/dist/ui-seletor-cor-D_ifitEN.cjs +83 -0
- package/dist/utils-ClVgqVyJ.cjs +1 -0
- package/dist/utils-DrHoxxmf.js +83 -0
- package/package.json +43 -2
- package/dist/acessibilidade-CSzX-DkG.cjs +0 -1
- package/dist/acessibilidade-CUlSXc2X.js +0 -38
- package/dist/altura-controle-ukMRPckR.cjs +0 -1
- package/dist/altura-controle-vxQiXG4q.js +0 -62
- package/dist/alvo-digitavel-CzCvNVQ3.js +0 -23
- package/dist/alvo-digitavel-DbH0hYFf.cjs +0 -1
- package/dist/degrade-CIxvOTUv.cjs +0 -1
- package/dist/degrade-gDa5sW__.js +0 -119
- package/dist/feature_caixa-CnYPKVFS.cjs +0 -1
- package/dist/feature_caixa-DCs9ZeSk.js +0 -1038
- package/dist/feature_historico-BAIYk1Me.cjs +0 -3
- package/dist/feature_historico-C4h9y5fu.js +0 -3039
- package/dist/form-atalhos-7JTYvumA.cjs +0 -1
- package/dist/form-atalhos-DDTlpgaB.js +0 -203
- package/dist/form-erros-CwPz7Jr4.cjs +0 -1
- package/dist/form-erros-DT5HklfD.js +0 -184
- package/dist/form-submissao-C-SPRKgT.js +0 -61
- package/dist/form-submissao-DxKO5MHI.cjs +0 -1
- package/dist/form-validacao-BlQFxUVj.js +0 -104
- package/dist/form-validacao-DIeyQVH5.cjs +0 -1
- package/dist/geometria-px-DKrWq_XY.js +0 -639
- package/dist/leaflet-CEPcxGWV.cjs +0 -1
- package/dist/leaflet-DOq10gfg.js +0 -84
- package/dist/leaflet-loader-94z5VsdY.cjs +0 -2
- package/dist/leaflet-loader-Cjcdgj5R.js +0 -21
- package/dist/listener-bag-D5omxZ9h.cjs +0 -1
- package/dist/listener-bag-DQgv7OON.js +0 -34
- package/dist/motor-By2te6PZ.js +0 -1400
- package/dist/motor-CkMxd378.cjs +0 -1
- package/dist/opcoes-CupvWVIm.js +0 -24
- package/dist/opcoes-vdAUY5OI.cjs +0 -1
- package/dist/parts-CaoQiCfI.js +0 -7
- package/dist/parts-vQa2873h.cjs +0 -1
- package/dist/prancha-paleta-BZ-9QDgh.js +0 -5276
- package/dist/prancha-paleta-Bb24vP71.cjs +0 -17
- package/dist/ssr-safe-5cWfJP-s.js +0 -10
- package/dist/ssr-safe-CiHD1adl.cjs +0 -1
- package/dist/svg-seguro-ChVJ2L2z.js +0 -74
- package/dist/svg-seguro-J2RM1Ssf.cjs +0 -1
- package/dist/ui-badge-DE58YSBY.cjs +0 -28
- package/dist/ui-badge-KgmI3jOD.js +0 -201
- package/dist/ui-botao-Dz8YvmiA.cjs +0 -12
- package/dist/ui-botao-zLkcMMyP.js +0 -168
- package/dist/ui-bus-CUd99VJi.js +0 -177
- package/dist/ui-bus-XqBLlTYQ.cjs +0 -1
- package/dist/ui-camadas-DoHPnbQm.js +0 -3133
- package/dist/ui-camadas-Vx7wYD4D.cjs +0 -311
- package/dist/ui-campo-texto-Dliyt9qr.cjs +0 -16
- package/dist/ui-campo-texto-btevggO3.js +0 -379
- package/dist/ui-card-7IEYbCN0.js +0 -150
- package/dist/ui-card-Bx8EyzYY.cjs +0 -20
- package/dist/ui-card-C-EJoKnm.js +0 -150
- package/dist/ui-card-DFnRp9bl.js +0 -146
- package/dist/ui-card-DrWVJQKw.cjs +0 -20
- package/dist/ui-card-DsIjHMmG.cjs +0 -20
- package/dist/ui-controle-cores-B1w_Yl69.cjs +0 -32
- package/dist/ui-controle-cores-BRjMvmMn.js +0 -291
- package/dist/ui-controle-cores-BcH9k2Fa.js +0 -292
- package/dist/ui-controle-cores-CvSTP6gJ.cjs +0 -32
- package/dist/ui-editor-prancha-CIngI6yI.js +0 -2886
- package/dist/ui-editor-prancha-DorSe6sC.cjs +0 -31
- package/dist/ui-linha-2kY7TNUJ.cjs +0 -38
- package/dist/ui-linha-B4mBRm1x.cjs +0 -61
- package/dist/ui-linha-DTEIIww4.js +0 -1167
- package/dist/ui-linha-KFF86FW5.js +0 -752
- package/dist/ui-modal-BrXzVZ65.js +0 -216
- package/dist/ui-modal-lARKzEVZ.cjs +0 -18
- package/dist/ui-paleta-ferramentas-Bu6JaT0s.js +0 -1245
- package/dist/ui-paleta-ferramentas-D3Jhwt26.cjs +0 -21
- package/dist/ui-paleta-ferramentas-DebHYiwd.js +0 -1615
- package/dist/ui-paleta-ferramentas-Dgejtluh.js +0 -1423
- package/dist/ui-paleta-ferramentas-hzyo8wBt.cjs +0 -22
- package/dist/ui-paleta-ferramentas-jWuICjW8.cjs +0 -22
- package/dist/ui-seletor-cor-0RLjcME6.cjs +0 -83
- package/dist/ui-seletor-cor-CMuuW-Ym.cjs +0 -83
- package/dist/ui-seletor-cor-DFIQ1sin.js +0 -405
- package/dist/ui-skeleton-BLEV6h3k.js +0 -653
- package/dist/ui-skeleton-B_XTaGrX.cjs +0 -52
- package/dist/ui-switch-BXIDwC-Y.cjs +0 -66
- package/dist/ui-switch-Ctxk-jKS.js +0 -1212
- package/dist/ui-tabela-CXxqbwXv.cjs +0 -7
- package/dist/ui-tabela-Cd0vOwnT.js +0 -1459
- package/dist/ui-tabela-propriedades-C5cIF5ES.js +0 -3779
- package/dist/ui-tabela-propriedades-CJyo568n.js +0 -3517
- package/dist/ui-tabela-propriedades-D96Djx-q.cjs +0 -136
- package/dist/ui-tabela-propriedades-Wa34hfIr.cjs +0 -142
- package/dist/ui-tabela-propriedades-ahQhQauu.js +0 -2329
- package/dist/ui-tabela-propriedades-w9JWhjHy.cjs +0 -142
- package/dist/zero-js-triggers-CJT988bR.js +0 -83
- package/dist/zero-js-triggers-CgM9IIQB.cjs +0 -1
package/dist/campo-texto.cjs
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";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 r=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)}',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",...r.ATRIBUTOS_DEGRADE];function m(){return`
|
|
2
|
+
<style>${E}</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" 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;
|
package/dist/campo-texto.js
CHANGED
|
@@ -1,11 +1,312 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var b = (a, s, t) => s in a ? m(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
|
3
|
+
var i = (a, s, t) => b(a, typeof s != "symbol" ? s + "" : s, t);
|
|
1
4
|
/* empty css */
|
|
2
|
-
import { A as
|
|
5
|
+
import { A as g, R as x, F as _, L as f, u as v, T as c, V as E, W as y, j as A, g as w, E as S, p as k, X as C, d as p } from "./kit-base-CBXA66aM.js";
|
|
6
|
+
const q = ':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)}', V = [
|
|
7
|
+
"label",
|
|
8
|
+
"placeholder",
|
|
9
|
+
"value",
|
|
10
|
+
"tipo",
|
|
11
|
+
"type",
|
|
12
|
+
"obrigatorio",
|
|
13
|
+
"required",
|
|
14
|
+
"minlength",
|
|
15
|
+
"min-length",
|
|
16
|
+
"maxlength",
|
|
17
|
+
"max-length",
|
|
18
|
+
"pattern",
|
|
19
|
+
"min",
|
|
20
|
+
"max",
|
|
21
|
+
"step",
|
|
22
|
+
"mensagem-validacao",
|
|
23
|
+
"helper-text",
|
|
24
|
+
"erro",
|
|
25
|
+
"mensagem-erro",
|
|
26
|
+
"disabled",
|
|
27
|
+
"readonly",
|
|
28
|
+
"label-flutuante",
|
|
29
|
+
"alternar-senha",
|
|
30
|
+
"tamanho",
|
|
31
|
+
"size",
|
|
32
|
+
"altura",
|
|
33
|
+
"height",
|
|
34
|
+
"densidade",
|
|
35
|
+
"aria-label",
|
|
36
|
+
...g
|
|
37
|
+
];
|
|
38
|
+
function I() {
|
|
39
|
+
return `
|
|
40
|
+
<style>${q}</style>
|
|
41
|
+
<div class="ui-campo-texto__container">
|
|
42
|
+
<label class="ui-campo-texto__label" part="rotulo" style="display: none;"></label>
|
|
43
|
+
<div class="ui-campo-texto__wrapper" part="campo">
|
|
44
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--esquerda" part="icone icone-esquerda">
|
|
45
|
+
<slot name="icone-esquerda"></slot>
|
|
46
|
+
</span>
|
|
47
|
+
<input class="ui-campo-texto__input" part="input" type="text" />
|
|
48
|
+
<span class="ui-campo-texto__icone ui-campo-texto__icone--direita" part="icone icone-direita">
|
|
49
|
+
<slot name="icone-direita"></slot>
|
|
50
|
+
</span>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="ui-campo-texto__helper" part="ajuda" aria-live="polite" style="display: none;"></div>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
function L(a) {
|
|
57
|
+
const { labelElement: s, inputElement: t, labelText: e, placeholderText: o, isFlutuante: r, estaFocado: n, obrigatorio: u } = a, l = t.value.trim() !== "";
|
|
58
|
+
let h = !1;
|
|
59
|
+
try {
|
|
60
|
+
h = t.matches(":-webkit-autofill");
|
|
61
|
+
} catch {
|
|
62
|
+
h = !1;
|
|
63
|
+
}
|
|
64
|
+
e ? (x(s, e, !!u, "ui-campo-texto__asterisco"), s.style.display = "flex", r && (n || l || h) ? s.classList.add("ui-campo-texto__label--ativa") : s.classList.remove("ui-campo-texto__label--ativa")) : s.style.display = "none", r && !n && !l && !h ? t.placeholder = "" : t.placeholder = o;
|
|
65
|
+
}
|
|
66
|
+
function T(a, s, t) {
|
|
67
|
+
s ? (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
|
+
}
|
|
69
|
+
function z(a, s, t, e, o, r, n = "ui-campo-texto") {
|
|
70
|
+
e ? (a.classList.add(`${n}__wrapper--erro`), s.setAttribute("aria-invalid", "true")) : (a.classList.remove(`${n}__wrapper--erro`), s.removeAttribute("aria-invalid")), e && o ? (t.textContent = `⚠️ ${o}`, t.className = `${n}__helper ${n}__helper--erro`, t.style.display = "block") : r ? (t.textContent = r, t.className = `${n}__helper`, t.style.display = "block") : t.style.display = "none";
|
|
71
|
+
}
|
|
72
|
+
class d extends _ {
|
|
73
|
+
constructor() {
|
|
74
|
+
super();
|
|
75
|
+
i(this, "labelElement");
|
|
76
|
+
i(this, "wrapperElement");
|
|
77
|
+
i(this, "inputElement");
|
|
78
|
+
i(this, "helperElement");
|
|
79
|
+
i(this, "rightIconContainer");
|
|
80
|
+
i(this, "leftSlotElement");
|
|
81
|
+
i(this, "_senhaVisivel", !1);
|
|
82
|
+
i(this, "listeners", new f());
|
|
83
|
+
i(this, "_checkTimer", null);
|
|
84
|
+
i(this, "_focado", !1);
|
|
85
|
+
i(this, "_inputId");
|
|
86
|
+
i(this, "_defaultValue", "");
|
|
87
|
+
i(this, "handleSlotChange", () => {
|
|
88
|
+
this.syncState();
|
|
89
|
+
});
|
|
90
|
+
i(this, "handleHostClick", (t) => {
|
|
91
|
+
k(this, t) && !this.disabled && this.inputElement.focus();
|
|
92
|
+
});
|
|
93
|
+
i(this, "handleRightIconClick", (t) => {
|
|
94
|
+
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
95
|
+
});
|
|
96
|
+
i(this, "handleRightIconKeyDown", (t) => {
|
|
97
|
+
(this.getAttribute("tipo") === "password" || this.hasAttribute("alternar-senha")) && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.stopPropagation(), this.alternarVisibilidadeSenha());
|
|
98
|
+
});
|
|
99
|
+
i(this, "handleFocus", () => {
|
|
100
|
+
this._focado = !0, this.wrapperElement.classList.add("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
101
|
+
});
|
|
102
|
+
i(this, "handleBlur", () => {
|
|
103
|
+
this._focado = !1, this.wrapperElement.classList.remove("ui-campo-texto__wrapper--foco"), this.syncState();
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Enter submete o formulário como num <input> nativo. Aguarda um tick para que
|
|
107
|
+
* ouvintes do consumidor possam cancelar com `preventDefault()` no keydown.
|
|
108
|
+
*/
|
|
109
|
+
i(this, "handleKeyDown", (t) => {
|
|
110
|
+
if (t.key !== "Enter" || t.isComposing || t.altKey || t.ctrlKey || t.metaKey || t.shiftKey) return;
|
|
111
|
+
const e = this.form;
|
|
112
|
+
e && setTimeout(() => {
|
|
113
|
+
!t.defaultPrevented && this.isConnected && C(e);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
i(this, "handleInput", (t) => {
|
|
117
|
+
t.stopPropagation();
|
|
118
|
+
const e = t.target.value;
|
|
119
|
+
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
120
|
+
new CustomEvent("ui-input", {
|
|
121
|
+
detail: { value: e },
|
|
122
|
+
bubbles: !0,
|
|
123
|
+
composed: !0
|
|
124
|
+
})
|
|
125
|
+
), this.dispatchEvent(
|
|
126
|
+
new Event("input", {
|
|
127
|
+
bubbles: !0,
|
|
128
|
+
composed: !0
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
i(this, "handleChange", (t) => {
|
|
133
|
+
t.stopPropagation();
|
|
134
|
+
const e = t.target.value;
|
|
135
|
+
this.internals.setFormValue(e), this.syncState(), this.dispatchEvent(
|
|
136
|
+
new CustomEvent("ui-change", {
|
|
137
|
+
detail: { value: e },
|
|
138
|
+
bubbles: !0,
|
|
139
|
+
composed: !0
|
|
140
|
+
})
|
|
141
|
+
), this.dispatchEvent(
|
|
142
|
+
new Event("change", {
|
|
143
|
+
bubbles: !0,
|
|
144
|
+
composed: !0
|
|
145
|
+
})
|
|
146
|
+
);
|
|
147
|
+
});
|
|
148
|
+
const t = this.attachShadow({ mode: "open", delegatesFocus: !0 });
|
|
149
|
+
t.innerHTML = I(), 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`;
|
|
150
|
+
}
|
|
151
|
+
static get observedAttributes() {
|
|
152
|
+
return V;
|
|
153
|
+
}
|
|
154
|
+
focus(t) {
|
|
155
|
+
this.inputElement.focus(t);
|
|
156
|
+
}
|
|
157
|
+
blur() {
|
|
158
|
+
this.inputElement.blur();
|
|
159
|
+
}
|
|
160
|
+
connectedCallback() {
|
|
161
|
+
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);
|
|
162
|
+
}
|
|
163
|
+
disconnectedCallback() {
|
|
164
|
+
this.listeners.cleanup(), this._checkTimer && clearTimeout(this._checkTimer), this._checkTimer = null;
|
|
165
|
+
}
|
|
166
|
+
attributeChangedCallback(t, e, o) {
|
|
167
|
+
t === "value" && o !== this.inputElement.value && !this._focado && (this.inputElement.value = o || ""), this.syncState();
|
|
168
|
+
}
|
|
169
|
+
get value() {
|
|
170
|
+
return this.inputElement ? this.inputElement.value : this.getAttribute("value") || "";
|
|
171
|
+
}
|
|
172
|
+
set value(t) {
|
|
173
|
+
if (this.setAttribute("value", t), this.inputElement)
|
|
174
|
+
try {
|
|
175
|
+
this.inputElement.value = t;
|
|
176
|
+
} catch {
|
|
177
|
+
}
|
|
178
|
+
this.syncState();
|
|
179
|
+
}
|
|
180
|
+
// === Ciclo de Vida Form-Associated Custom Elements (W3C FACE) ===
|
|
181
|
+
formResetCallback() {
|
|
182
|
+
var t;
|
|
183
|
+
this.inputElement.value = this._defaultValue, (t = this.internals) == null || t.setFormValue(this._defaultValue), this.syncState();
|
|
184
|
+
}
|
|
185
|
+
formStateRestoreCallback(t, e) {
|
|
186
|
+
typeof t == "string" && (this.value = t);
|
|
187
|
+
}
|
|
188
|
+
get name() {
|
|
189
|
+
return this.getAttribute("name") || "";
|
|
190
|
+
}
|
|
191
|
+
set name(t) {
|
|
192
|
+
this.setAttribute("name", t);
|
|
193
|
+
}
|
|
194
|
+
get type() {
|
|
195
|
+
return this.getAttribute("tipo") || this.getAttribute("type") || "text";
|
|
196
|
+
}
|
|
197
|
+
get disabled() {
|
|
198
|
+
return this.hasAttribute("disabled") || this._formDisabled;
|
|
199
|
+
}
|
|
200
|
+
set disabled(t) {
|
|
201
|
+
t ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
202
|
+
}
|
|
203
|
+
get minLength() {
|
|
204
|
+
return c(this.getAttribute("minlength") ?? this.getAttribute("min-length")) ?? -1;
|
|
205
|
+
}
|
|
206
|
+
set minLength(t) {
|
|
207
|
+
t >= 0 ? this.setAttribute("minlength", String(t)) : this.removeAttribute("minlength"), this.syncState();
|
|
208
|
+
}
|
|
209
|
+
get maxLength() {
|
|
210
|
+
return c(this.getAttribute("maxlength") ?? this.getAttribute("max-length")) ?? -1;
|
|
211
|
+
}
|
|
212
|
+
set maxLength(t) {
|
|
213
|
+
t >= 0 ? this.setAttribute("maxlength", String(t)) : this.removeAttribute("maxlength"), this.syncState();
|
|
214
|
+
}
|
|
215
|
+
get pattern() {
|
|
216
|
+
return this.getAttribute("pattern") || "";
|
|
217
|
+
}
|
|
218
|
+
set pattern(t) {
|
|
219
|
+
t ? this.setAttribute("pattern", t) : this.removeAttribute("pattern"), this.syncState();
|
|
220
|
+
}
|
|
221
|
+
atualizarValidade() {
|
|
222
|
+
var l, h;
|
|
223
|
+
const t = this.getAttribute("min"), e = this.getAttribute("max"), o = this.inputElement ? this.inputElement.value : "", r = this.getAttribute("value") || o, n = !!((h = (l = this.inputElement) == null ? void 0 : l.validity) != null && h.badInput), u = E({
|
|
224
|
+
val: o,
|
|
225
|
+
rawVal: r,
|
|
226
|
+
badInput: n,
|
|
227
|
+
disabled: this.disabled,
|
|
228
|
+
required: this.required,
|
|
229
|
+
tipo: this.type,
|
|
230
|
+
minlength: this.minLength >= 0 ? this.minLength : null,
|
|
231
|
+
maxlength: this.maxLength >= 0 ? this.maxLength : null,
|
|
232
|
+
min: t !== null ? parseFloat(t) : null,
|
|
233
|
+
max: e !== null ? parseFloat(e) : null,
|
|
234
|
+
step: this.getAttribute("step"),
|
|
235
|
+
pattern: this.getAttribute("pattern"),
|
|
236
|
+
customError: this._customErrorMessage,
|
|
237
|
+
mensagemValidacao: this.getAttribute("mensagem-validacao")
|
|
238
|
+
});
|
|
239
|
+
y(this.internals, u, this.inputElement);
|
|
240
|
+
}
|
|
241
|
+
alternarVisibilidadeSenha() {
|
|
242
|
+
var o;
|
|
243
|
+
if (!(this.getAttribute("tipo") === "password" || this._senhaVisivel)) return;
|
|
244
|
+
this._senhaVisivel = !this._senhaVisivel, this.inputElement.type = this._senhaVisivel ? "text" : "password";
|
|
245
|
+
const e = (o = this.shadowRoot) == null ? void 0 : o.querySelector('slot[name="icone-direita"]');
|
|
246
|
+
e && e.assignedElements().forEach((n) => {
|
|
247
|
+
var u, l;
|
|
248
|
+
(((u = n.textContent) == null ? void 0 : u.trim()) === "👁️" || ((l = n.textContent) == null ? void 0 : l.trim()) === "🙈") && (n.textContent = this._senhaVisivel ? "🙈" : "👁️");
|
|
249
|
+
}), this.dispatchEvent(
|
|
250
|
+
new CustomEvent("ui-toggle-senha", {
|
|
251
|
+
detail: { visivel: this._senhaVisivel },
|
|
252
|
+
bubbles: !0,
|
|
253
|
+
composed: !0
|
|
254
|
+
})
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
syncState() {
|
|
258
|
+
this.leftSlotElement.assignedNodes().length > 0 || this.querySelector('[slot="icone-esquerda"]') !== null ? this.setAttribute("tem-icone-esquerda", "") : this.removeAttribute("tem-icone-esquerda"), A(this), w(this, this.wrapperElement), L({
|
|
259
|
+
labelElement: this.labelElement,
|
|
260
|
+
inputElement: this.inputElement,
|
|
261
|
+
labelText: this.getAttribute("label"),
|
|
262
|
+
placeholderText: this.getAttribute("placeholder") || "",
|
|
263
|
+
isFlutuante: this.hasAttribute("label-flutuante"),
|
|
264
|
+
estaFocado: this._focado,
|
|
265
|
+
obrigatorio: this.required
|
|
266
|
+
}), this.sincronizarNomeAcessivel();
|
|
267
|
+
const e = this.getAttribute("tipo") || this.getAttribute("type") || "text";
|
|
268
|
+
if (!this._senhaVisivel)
|
|
269
|
+
try {
|
|
270
|
+
this.inputElement.type = e;
|
|
271
|
+
} catch {
|
|
272
|
+
this.inputElement.type = "text";
|
|
273
|
+
}
|
|
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 o = this.getAttribute("pattern");
|
|
276
|
+
o !== null ? this.inputElement.pattern = o : this.inputElement.removeAttribute("pattern"), this.internals.setFormValue(this.inputElement.value);
|
|
277
|
+
const r = this.hasAttribute("disabled") || this._formDisabled, n = this.hasAttribute("readonly");
|
|
278
|
+
this.inputElement.disabled = r, this.inputElement.readOnly = n, r ? this.wrapperElement.classList.add("ui-campo-texto__wrapper--disabled") : this.wrapperElement.classList.remove("ui-campo-texto__wrapper--disabled");
|
|
279
|
+
const u = e === "password" || this.hasAttribute("alternar-senha");
|
|
280
|
+
T(this.rightIconContainer, u, this._senhaVisivel);
|
|
281
|
+
const l = this.hasAttribute("erro") || this.hasAttribute("mensagem-erro");
|
|
282
|
+
z(
|
|
283
|
+
this.wrapperElement,
|
|
284
|
+
this.inputElement,
|
|
285
|
+
this.helperElement,
|
|
286
|
+
l,
|
|
287
|
+
this.getAttribute("mensagem-erro"),
|
|
288
|
+
this.getAttribute("helper-text")
|
|
289
|
+
), 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();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Sem o atributo `label`, o input nativo herda o nome acessível de fora do Shadow DOM
|
|
293
|
+
* (`aria-label` no host, `<label for>` ou `<label>` envolvente).
|
|
294
|
+
*/
|
|
295
|
+
sincronizarNomeAcessivel() {
|
|
296
|
+
const t = this.getAttribute("label") ? "" : S(this, this.internals);
|
|
297
|
+
t ? this.inputElement.setAttribute("aria-label", t) : this.inputElement.removeAttribute("aria-label");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
class F extends d {
|
|
301
|
+
}
|
|
302
|
+
p("ui-campo-texto", d);
|
|
303
|
+
p("ui-input", F);
|
|
3
304
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
305
|
+
V as ATRIBUTOS_OBSERVADOS_CAMPO_TEXTO,
|
|
306
|
+
d as UICampoTexto,
|
|
307
|
+
F as UIInput,
|
|
308
|
+
I as criarTemplateCampoTexto,
|
|
309
|
+
z as sincronizarFeedbackErro,
|
|
9
310
|
T as sincronizarIconeSenha,
|
|
10
|
-
|
|
311
|
+
L as sincronizarLabelEPlaceholder
|
|
11
312
|
};
|