mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
1 line
5.8 KiB
JavaScript
1 line
5.8 KiB
JavaScript
import{j as o,D as i,E as m,ad as Y,d as ee,V as te,ah as oe,r as b,G as ae,as as le,A as se,c as ne,b as ie,q as e,M as I,L as r,H as W,I as A,at as de,S as D,N as $,au as re,k as y,l as N,m as ce,K as ue,n as fe,_ as pe}from"./chunk-449c23a2.js";import{g as _e}from"./chunk-9a43cce8.js";import{u as me}from"./chunk-340feaf0.js";const ve={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},he=m("path",{fill:"currentColor",d:"M11.83 9L15 12.16V12a3 3 0 0 0-3-3h-.17m-4.3.8l1.55 1.55c-.05.21-.08.42-.08.65a3 3 0 0 0 3 3c.22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53a5 5 0 0 1-5-5c0-.79.2-1.53.53-2.2M2 4.27l2.28 2.28l.45.45C3.08 8.3 1.78 10 1 12c1.73 4.39 6 7.5 11 7.5c1.55 0 3.03-.3 4.38-.84l.43.42L19.73 22L21 20.73L3.27 3M12 7a5 5 0 0 1 5 5c0 .64-.13 1.26-.36 1.82l2.93 2.93c1.5-1.25 2.7-2.89 3.43-4.75c-1.73-4.39-6-7.5-11-7.5c-1.4 0-2.74.25-4 .7l2.17 2.15C10.74 7.13 11.35 7 12 7Z"},null,-1),be=[he];function ye(v,h){return o(),i("svg",ve,be)}const ke={name:"mdi-eye-off",render:ye},ge={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},Ce=m("path",{fill:"currentColor",d:"M12 9a3 3 0 0 0-3 3a3 3 0 0 0 3 3a3 3 0 0 0 3-3a3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5a5 5 0 0 1 5-5a5 5 0 0 1 5 5a5 5 0 0 1-5 5m0-12.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5Z"},null,-1),we=[Ce];function xe(v,h){return o(),i("svg",ge,we)}const $e={name:"mdi-eye",render:xe},Le={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"},Be=m("path",{fill:"currentColor",d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z"},null,-1),ze=[Be];function Ve(v,h){return o(),i("svg",Le,ze)}const Re={name:"mdi-close",render:Ve},{useTheme:Te}=Y({dark:{backgroundColor:"#333333",borderColor:"#333333",focus:{backgroundColor:"#1ea54c1a"}},light:{backgroundColor:"#ffffff",borderColor:"#e0e0e69e",focus:{backgroundColor:"#ffffff"}}}),Me=["for"],Ie={class:"feedback-wrapper"},We=["id","placeholder","readonly","disabled","data-test-id","autocapitalize","autocomplete","autocorrect","spellcheck","rows"],Ae=["id","type","placeholder","readonly","disabled","data-test-id","autocapitalize","autocomplete","autocorrect","spellcheck"],De={key:0,class:"feedback"},Ne=ee({__name:"c-input-text",props:{value:{default:""},id:{default:_e},placeholder:{default:"Input text"},label:{default:void 0},readonly:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},validationRules:{default:()=>[]},validationWatch:{default:void 0},validation:{default:void 0},labelPosition:{default:"top"},labelWidth:{default:"auto"},labelAlign:{default:"left"},clearable:{type:Boolean,default:!1},testId:{default:void 0},autocapitalize:{default:void 0},autocomplete:{default:void 0},autocorrect:{default:void 0},spellcheck:{type:[String,Boolean],default:void 0},rawText:{type:Boolean,default:!1},type:{default:"text"},multiline:{type:Boolean,default:!1},rows:{default:3},autosize:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!1},monospace:{type:Boolean,default:!1}},emits:["update:value"],setup(v,{expose:h,emit:S}){const d=v;te(t=>({"1578999c":e(u).error.color,b18512fa:e(u).error.color+22,"15951ced":e(Z),"1460862c":e(E),e1b5bfd6:e(x).backgroundColor,e9ed6052:e(x).borderColor,"1728643c":e(u).text.baseColor,ffa9e664:e(u).text.mutedColor,ac68db28:e(u).primary.color,"0ab89a02":e(x).focus.backgroundColor}));const a=oe(d,"value",S),c=b(!1),{id:k,placeholder:L,label:B,validationRules:H,labelPosition:P,labelWidth:Z,labelAlign:E,autosize:z,readonly:V,disabled:g,clearable:U,type:j,multiline:C,rows:q,rawText:l,autofocus:G,monospace:R}=ae(d),w=d.validation??me({rules:H,source:a,watch:d.validationWatch}),x=Te(),u=le(),s=b(),f=b(),p=b();se([a,z,C,p,s],()=>fe(()=>{d.multiline&&z.value&&K()}),{immediate:!0});function K(){if(!s.value||!p.value)return;const t=s.value.scrollHeight+2;p.value.style.height=`${t}px`}const F=ne(()=>d.type==="password"&&!c.value?"password":"text");function T(){s.value&&s.value.focus(),f.value&&f.value.focus()}function J(){s.value&&s.value.blur?.(),f.value&&f.value.blur?.()}return ie(()=>{G.value&&T()}),h({inputWrapperRef:p,focus:T,blur:J}),(t,n)=>{const O=Re,M=ue,Q=$e,X=ke;return o(),i("div",{class:$(["c-input-text",{disabled:e(g),error:!e(w).isValid,"label-left":e(P)==="left",multiline:e(C)}])},[e(B)?(o(),i("label",{key:0,for:e(k),class:"label"},I(e(B)),9,Me)):r("",!0),m("div",Ie,[m("div",{ref_key:"inputWrapperRef",ref:p,class:"input-wrapper"},[W(t.$slots,"prefix",{},void 0,!0),e(C)?A((o(),i("textarea",{key:0,id:e(k),ref_key:"textareaRef",ref:s,"onUpdate:modelValue":n[0]||(n[0]=_=>D(a)?a.value=_:null),class:$(["input",{"leading-5 !font-mono":e(R)}]),placeholder:e(L),readonly:e(V),disabled:e(g),"data-test-id":t.testId,autocapitalize:t.autocapitalize??(e(l)?"off":void 0),autocomplete:t.autocomplete??(e(l)?"off":void 0),autocorrect:t.autocorrect??(e(l)?"off":void 0),spellcheck:t.spellcheck??(e(l)?!1:void 0),rows:e(q)},null,10,We)),[[de,e(a)]]):A((o(),i("input",{key:1,id:e(k),ref_key:"inputRef",ref:f,"onUpdate:modelValue":n[1]||(n[1]=_=>D(a)?a.value=_:null),type:e(F),class:$(["input",{"leading-5 !font-mono":e(R)}]),size:"1",placeholder:e(L),readonly:e(V),disabled:e(g),"data-test-id":t.testId,autocapitalize:t.autocapitalize??(e(l)?"off":void 0),autocomplete:t.autocomplete??(e(l)?"off":void 0),autocorrect:t.autocorrect??(e(l)?"off":void 0),spellcheck:t.spellcheck??(e(l)?!1:void 0)},null,10,Ae)),[[re,e(a)]]),e(U)&&e(a)?(o(),y(M,{key:2,variant:"text",circle:"",size:"small",onClick:n[2]||(n[2]=_=>a.value="")},{default:N(()=>[ce(O)]),_:1})):r("",!0),e(j)==="password"?(o(),y(M,{key:3,variant:"text",circle:"",size:"small",onClick:n[3]||(n[3]=_=>c.value=!e(c))},{default:N(()=>[e(c)?r("",!0):(o(),y(Q,{key:0})),e(c)?(o(),y(X,{key:1})):r("",!0)]),_:1})):r("",!0),W(t.$slots,"suffix",{},void 0,!0)],512),e(w).isValid?r("",!0):(o(),i("span",De,I(e(w).message),1))])],2)}}});const Ze=pe(Ne,[["__scopeId","data-v-c4df69f5"]]);export{Ze as _};
|