carbon-components-svelte/assets/PasswordInput.d889d584.js
2020-10-02 20:26:53 -07:00

1 line
14 KiB
JavaScript

import{S as t,i as e,s as i,v as l,D as a,q as n,L as s,h as o,k as d,l as r,n as c,o as u,r as p,M as b,w as h,N as f,O as x,I as m,z as v,A as w,t as $,b as g,J as y,C as _,G as L,g as M,y as P,c as C,a as T,m as E,d as z,j as A,p as k,x as B,E as V,F as I,B as N,a5 as R,H as S}from"./index.c2c9d961.js";import{W as D}from"./Preview.4c9c0c28.js";function O(t){let e,i;return{c(){e=s("title"),i=o(t[2])},l(l){e=d(l,"title",{},1);var a=r(e);i=c(a,t[2]),a.forEach(u)},m(t,l){n(t,e,l),p(e,i)},p(t,e){4&e&&b(i,t[2])},d(t){t&&u(e)}}}function Y(t){let e,i,o,c,b,_;const L=t[8].default,M=l(L,t,t[7],null),P=M||function(t){let e,i=t[2]&&O(t);return{c(){i&&i.c(),e=a()},l(t){i&&i.l(t),e=a()},m(t,l){i&&i.m(t,l),n(t,e,l)},p(t,l){t[2]?i?i.p(t,l):(i=O(t),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null)},d(t){i&&i.d(t),t&&u(e)}}}(t);let C=[{"data-carbon-icon":"View16"},{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 16 16"},{fill:"currentColor"},{width:"16"},{height:"16"},{class:t[0]},{preserveAspectRatio:"xMidYMid meet"},{style:t[3]},{id:t[1]},t[4]],T={};for(let t=0;t<C.length;t+=1)T=h(T,C[t]);return{c(){e=s("svg"),i=s("path"),o=s("path"),P&&P.c(),this.h()},l(t){e=d(t,"svg",{"data-carbon-icon":!0,xmlns:!0,viewBox:!0,fill:!0,width:!0,height:!0,class:!0,preserveAspectRatio:!0,style:!0,id:!0},1);var l=r(e);i=d(l,"path",{d:!0},1),r(i).forEach(u),o=d(l,"path",{d:!0},1),r(o).forEach(u),P&&P.l(l),l.forEach(u),this.h()},h(){f(i,"d","M15.5,7.8C14.3,4.7,11.3,2.6,8,2.5C4.7,2.6,1.7,4.7,0.5,7.8c0,0.1,0,0.2,0,0.3c1.2,3.1,4.1,5.2,7.5,5.3\tc3.3-0.1,6.3-2.2,7.5-5.3C15.5,8.1,15.5,7.9,15.5,7.8z M8,12.5c-2.7,0-5.4-2-6.5-4.5c1-2.5,3.8-4.5,6.5-4.5s5.4,2,6.5,4.5\tC13.4,10.5,10.6,12.5,8,12.5z"),f(o,"d","M8,5C6.3,5,5,6.3,5,8s1.3,3,3,3s3-1.3,3-3S9.7,5,8,5z M8,10c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S9.1,10,8,10z"),x(e,T)},m(l,a){n(l,e,a),p(e,i),p(e,o),P&&P.m(e,null),c=!0,b||(_=[m(e,"click",t[9]),m(e,"mouseover",t[10]),m(e,"mouseenter",t[11]),m(e,"mouseleave",t[12]),m(e,"keyup",t[13]),m(e,"keydown",t[14])],b=!0)},p(t,[i]){M?M.p&&128&i&&v(M,L,t,t[7],i,null,null):P&&P.p&&4&i&&P.p(t,i),x(e,T=w(C,[{"data-carbon-icon":"View16"},{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 16 16"},{fill:"currentColor"},{width:"16"},{height:"16"},(!c||1&i)&&{class:t[0]},{preserveAspectRatio:"xMidYMid meet"},(!c||8&i)&&{style:t[3]},(!c||2&i)&&{id:t[1]},16&i&&t[4]]))},i(t){c||($(P,t),c=!0)},o(t){g(P,t),c=!1},d(t){t&&u(e),P&&P.d(t),b=!1,y(_)}}}function j(t,e,i){let l,a,n,s,{$$slots:o={},$$scope:d}=e,{class:r}=e,{id:c}=e,{tabindex:u}=e,{focusable:p=!1}=e,{title:b}=e,{style:f}=e;return t.$$set=t=>{i(18,e=h(h({},e),_(t))),"class"in t&&i(0,r=t.class),"id"in t&&i(1,c=t.id),"tabindex"in t&&i(5,u=t.tabindex),"focusable"in t&&i(6,p=t.focusable),"title"in t&&i(2,b=t.title),"style"in t&&i(3,f=t.style),"$$scope"in t&&i(7,d=t.$$scope)},t.$$.update=()=>{i(15,l=e["aria-label"]),i(16,a=e["aria-labelledby"]),98308&t.$$.dirty&&i(17,n=l||a||b),229472&t.$$.dirty&&i(4,s={"aria-label":l,"aria-labelledby":a,"aria-hidden":!n||void 0,role:n?"img":void 0,focusable:"0"===u||p,tabindex:u})},e=_(e),[r,c,b,f,s,u,p,d,o,function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)}]}class F extends t{constructor(t){super(),e(this,t,j,Y,i,{class:0,id:1,tabindex:5,focusable:6,title:2,style:3})}}function q(t){let e,i;return{c(){e=s("title"),i=o(t[2])},l(l){e=d(l,"title",{},1);var a=r(e);i=c(a,t[2]),a.forEach(u)},m(t,l){n(t,e,l),p(e,i)},p(t,e){4&e&&b(i,t[2])},d(t){t&&u(e)}}}function H(t){let e,i,o,c,b,_;const L=t[8].default,M=l(L,t,t[7],null),P=M||function(t){let e,i=t[2]&&q(t);return{c(){i&&i.c(),e=a()},l(t){i&&i.l(t),e=a()},m(t,l){i&&i.m(t,l),n(t,e,l)},p(t,l){t[2]?i?i.p(t,l):(i=q(t),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null)},d(t){i&&i.d(t),t&&u(e)}}}(t);let C=[{"data-carbon-icon":"ViewOff16"},{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 16 16"},{fill:"currentColor"},{width:"16"},{height:"16"},{class:t[0]},{preserveAspectRatio:"xMidYMid meet"},{style:t[3]},{id:t[1]},t[4]],T={};for(let t=0;t<C.length;t+=1)T=h(T,C[t]);return{c(){e=s("svg"),i=s("path"),o=s("path"),P&&P.c(),this.h()},l(t){e=d(t,"svg",{"data-carbon-icon":!0,xmlns:!0,viewBox:!0,fill:!0,width:!0,height:!0,class:!0,preserveAspectRatio:!0,style:!0,id:!0},1);var l=r(e);i=d(l,"path",{d:!0},1),r(i).forEach(u),o=d(l,"path",{d:!0},1),r(o).forEach(u),P&&P.l(l),l.forEach(u),this.h()},h(){f(i,"d","M2.6,11.3l0.7-0.7C2.6,9.8,1.9,9,1.5,8c1-2.5,3.8-4.5,6.5-4.5c0.7,0,1.4,0.1,2,0.4l0.8-0.8C9.9,2.7,9,2.5,8,2.5\tC4.7,2.6,1.7,4.7,0.5,7.8c0,0.1,0,0.2,0,0.3C1,9.3,1.7,10.4,2.6,11.3z"),f(o,"d","M6 7.9c.1-1 .9-1.8 1.8-1.8l.9-.9C7.2 4.7 5.5 5.6 5.1 7.2 5 7.7 5 8.3 5.1 8.8L6 7.9zM15.5 7.8c-.6-1.5-1.6-2.8-2.9-3.7L15 1.7 14.3 1 1 14.3 1.7 15l2.6-2.6c1.1.7 2.4 1 3.7 1.1 3.3-.1 6.3-2.2 7.5-5.3C15.5 8.1 15.5 7.9 15.5 7.8zM10 8c0 1.1-.9 2-2 2-.3 0-.7-.1-1-.3L9.7 7C9.9 7.3 10 7.6 10 8zM8 12.5c-1 0-2.1-.3-3-.8l1.3-1.3c1.4.9 3.2.6 4.2-.8.7-1 .7-2.4 0-3.4l1.4-1.4c1.1.8 2 1.9 2.6 3.2C13.4 10.5 10.6 12.5 8 12.5z"),x(e,T)},m(l,a){n(l,e,a),p(e,i),p(e,o),P&&P.m(e,null),c=!0,b||(_=[m(e,"click",t[9]),m(e,"mouseover",t[10]),m(e,"mouseenter",t[11]),m(e,"mouseleave",t[12]),m(e,"keyup",t[13]),m(e,"keydown",t[14])],b=!0)},p(t,[i]){M?M.p&&128&i&&v(M,L,t,t[7],i,null,null):P&&P.p&&4&i&&P.p(t,i),x(e,T=w(C,[{"data-carbon-icon":"ViewOff16"},{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 16 16"},{fill:"currentColor"},{width:"16"},{height:"16"},(!c||1&i)&&{class:t[0]},{preserveAspectRatio:"xMidYMid meet"},(!c||8&i)&&{style:t[3]},(!c||2&i)&&{id:t[1]},16&i&&t[4]]))},i(t){c||($(P,t),c=!0)},o(t){g(P,t),c=!1},d(t){t&&u(e),P&&P.d(t),b=!1,y(_)}}}function U(t,e,i){let l,a,n,s,{$$slots:o={},$$scope:d}=e,{class:r}=e,{id:c}=e,{tabindex:u}=e,{focusable:p=!1}=e,{title:b}=e,{style:f}=e;return t.$$set=t=>{i(18,e=h(h({},e),_(t))),"class"in t&&i(0,r=t.class),"id"in t&&i(1,c=t.id),"tabindex"in t&&i(5,u=t.tabindex),"focusable"in t&&i(6,p=t.focusable),"title"in t&&i(2,b=t.title),"style"in t&&i(3,f=t.style),"$$scope"in t&&i(7,d=t.$$scope)},t.$$.update=()=>{i(15,l=e["aria-label"]),i(16,a=e["aria-labelledby"]),98308&t.$$.dirty&&i(17,n=l||a||b),229472&t.$$.dirty&&i(4,s={"aria-label":l,"aria-labelledby":a,"aria-hidden":!n||void 0,role:n?"img":void 0,focusable:"0"===u||p,tabindex:u})},e=_(e),[r,c,b,f,s,u,p,d,o,function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)}]}class G extends t{constructor(t){super(),e(this,t,U,H,i,{class:0,id:1,tabindex:5,focusable:6,title:2,style:3})}}function J(t){let e,i;return{c(){e=M("label"),i=o(t[12]),this.h()},l(l){e=d(l,"LABEL",{for:!0});var a=r(e);i=c(a,t[12]),a.forEach(u),this.h()},h(){f(e,"for",t[16]),P(e,"bx--label",!0),P(e,"bx--visually-hidden",t[13]),P(e,"bx--label--disabled",t[10])},m(t,l){n(t,e,l),p(e,i)},p(t,l){4096&l[0]&&b(i,t[12]),65536&l[0]&&f(e,"for",t[16]),8192&l[0]&&P(e,"bx--visually-hidden",t[13]),1024&l[0]&&P(e,"bx--label--disabled",t[10])},d(t){t&&u(e)}}}function W(t){let e,i;return e=new D({props:{class:"bx--text-input__invalid-icon"}}),{c(){C(e.$$.fragment)},l(t){T(e.$$.fragment,t)},m(t,l){E(e,t,l),i=!0},i(t){i||($(e.$$.fragment,t),i=!0)},o(t){g(e.$$.fragment,t),i=!1},d(t){z(e,t)}}}function K(t){let e;return{c(){e=o(t[6])},l(i){e=c(i,t[6])},m(t,i){n(t,e,i)},p(t,i){64&i[0]&&b(e,t[6])},d(t){t&&u(e)}}}function Q(t){let e;return{c(){e=o(t[5])},l(i){e=c(i,t[5])},m(t,i){n(t,e,i)},p(t,i){32&i[0]&&b(e,t[5])},d(t){t&&u(e)}}}function X(t){let e,i;return e=new F({props:{class:"bx--icon-visibility-on"}}),{c(){C(e.$$.fragment)},l(t){T(e.$$.fragment,t)},m(t,l){E(e,t,l),i=!0},i(t){i||($(e.$$.fragment,t),i=!0)},o(t){g(e.$$.fragment,t),i=!1},d(t){z(e,t)}}}function Z(t){let e,i;return e=new G({props:{class:"bx--icon-visibility-off"}}),{c(){C(e.$$.fragment)},l(t){T(e.$$.fragment,t)},m(t,l){E(e,t,l),i=!0},i(t){i||($(e.$$.fragment,t),i=!0)},o(t){g(e.$$.fragment,t),i=!1},d(t){z(e,t)}}}function tt(t){let e,i;return{c(){e=M("div"),i=o(t[11]),this.h()},l(l){e=d(l,"DIV",{});var a=r(e);i=c(a,t[11]),a.forEach(u),this.h()},h(){P(e,"bx--form__helper-text",!0),P(e,"bx--form__helper-text--disabled",t[10])},m(t,l){n(t,e,l),p(e,i)},p(t,l){2048&l[0]&&b(i,t[11]),1024&l[0]&&P(e,"bx--form__helper-text--disabled",t[10])},d(t){t&&u(e)}}}function et(t){let e,i;return{c(){e=M("div"),i=o(t[15]),this.h()},l(l){e=d(l,"DIV",{id:!0});var a=r(e);i=c(a,t[15]),a.forEach(u),this.h()},h(){f(e,"id",t[19]),P(e,"bx--form-requirement",!0)},m(t,l){n(t,e,l),p(e,i)},p(t,l){32768&l[0]&&b(i,t[15]),524288&l[0]&&f(e,"id",t[19])},d(t){t&&u(e)}}}function it(t){let e,i,l,a,s,o,c,b,x,v,_,L,C,T,E,z,N,R,S,D,O,Y,j=t[12]&&J(t),F=t[14]&&W();function q(t,e){return"text"===t[1]?Q:K}let H=q(t),U=H(t);const G=[Z,X],it=[];function lt(t,e){return"text"===t[1]?0:1}T=lt(t),E=it[T]=G[T](t);let at=!t[14]&&t[11]&&tt(t),nt=t[14]&&et(t),st=[t[20]],ot={};for(let t=0;t<st.length;t+=1)ot=h(ot,st[t]);return{c(){e=M("div"),j&&j.c(),i=A(),l=M("div"),F&&F.c(),a=A(),s=M("input"),v=A(),_=M("button"),L=M("span"),U.c(),C=A(),E.c(),R=A(),at&&at.c(),S=A(),nt&&nt.c(),this.h()},l(t){e=d(t,"DIV",{});var n=r(e);j&&j.l(n),i=k(n),l=d(n,"DIV",{"data-invalid":!0});var o=r(l);F&&F.l(o),a=k(o),s=d(o,"INPUT",{"data-invalid":!0,"aria-invalid":!0,"aria-describedby":!0,id:!0,name:!0,placeholder:!0,type:!0,value:!0,disabled:!0,class:!0}),v=k(o),_=d(o,"BUTTON",{type:!0,class:!0});var c=r(_);L=d(c,"SPAN",{});var p=r(L);U.l(p),p.forEach(u),C=k(c),E.l(c),c.forEach(u),o.forEach(u),R=k(n),at&&at.l(n),S=k(n),nt&&nt.l(n),n.forEach(u),this.h()},h(){f(s,"data-invalid",o=t[14]||void 0),f(s,"aria-invalid",c=t[14]||void 0),f(s,"aria-describedby",b=t[14]?t[19]:void 0),f(s,"id",t[16]),f(s,"name",t[17]),f(s,"placeholder",t[4]),f(s,"type",t[1]),s.value=t[0],s.disabled=t[10],f(s,"class",x=t[3]&&"bx--text-input--"+t[3]),P(s,"bx--text-input",!0),P(s,"bx--password-input",!0),P(s,"bx--text-input--light",t[9]),P(s,"bx--text-input--invalid",t[14]),P(L,"bx--assistive-text",!0),f(_,"type","button"),f(_,"class",z=(t[8]&&"bx--tooltip--"+t[8])+"\n "+(t[7]&&"bx--tooltip--align-"+t[7])),P(_,"bx--text-input--password__visibility__toggle",!0),P(_,"bx--btn--icon-only",!0),P(_,"bx--tooltip__trigger",!0),P(_,"bx--tooltip--a11y",!0),f(l,"data-invalid",N=t[14]||void 0),P(l,"bx--text-input__field-wrapper",!0),B(e,ot),P(e,"bx--form-item",!0),P(e,"bx--text-input-wrapper",!0),P(e,"bx--password-input-wrapper",!t[18])},m(o,d){n(o,e,d),j&&j.m(e,null),p(e,i),p(e,l),F&&F.m(l,null),p(l,a),p(l,s),t[30](s),p(l,v),p(l,_),p(_,L),U.m(L,null),p(_,C),it[T].m(_,null),p(e,R),at&&at.m(e,null),p(e,S),nt&&nt.m(e,null),D=!0,O||(Y=[m(s,"change",t[25]),m(s,"input",t[26]),m(s,"input",t[31]),m(s,"keydown",t[27]),m(s,"focus",t[28]),m(s,"blur",t[29]),m(_,"click",t[32]),m(e,"click",t[21]),m(e,"mouseover",t[22]),m(e,"mouseenter",t[23]),m(e,"mouseleave",t[24])],O=!0)},p(t,n){t[12]?j?j.p(t,n):(j=J(t),j.c(),j.m(e,i)):j&&(j.d(1),j=null),t[14]?F?16384&n[0]&&$(F,1):(F=W(),F.c(),$(F,1),F.m(l,a)):F&&(V(),g(F,1,1,()=>{F=null}),I()),(!D||16384&n[0]&&o!==(o=t[14]||void 0))&&f(s,"data-invalid",o),(!D||16384&n[0]&&c!==(c=t[14]||void 0))&&f(s,"aria-invalid",c),(!D||540672&n[0]&&b!==(b=t[14]?t[19]:void 0))&&f(s,"aria-describedby",b),(!D||65536&n[0])&&f(s,"id",t[16]),(!D||131072&n[0])&&f(s,"name",t[17]),(!D||16&n[0])&&f(s,"placeholder",t[4]),(!D||2&n[0])&&f(s,"type",t[1]),(!D||1&n[0]&&s.value!==t[0])&&(s.value=t[0]),(!D||1024&n[0])&&(s.disabled=t[10]),(!D||8&n[0]&&x!==(x=t[3]&&"bx--text-input--"+t[3]))&&f(s,"class",x),8&n[0]&&P(s,"bx--text-input",!0),8&n[0]&&P(s,"bx--password-input",!0),520&n[0]&&P(s,"bx--text-input--light",t[9]),16392&n[0]&&P(s,"bx--text-input--invalid",t[14]),H===(H=q(t))&&U?U.p(t,n):(U.d(1),U=H(t),U&&(U.c(),U.m(L,null)));let d=T;T=lt(t),T!==d&&(V(),g(it[d],1,1,()=>{it[d]=null}),I(),E=it[T],E||(E=it[T]=G[T](t),E.c()),$(E,1),E.m(_,null)),(!D||384&n[0]&&z!==(z=(t[8]&&"bx--tooltip--"+t[8])+"\n "+(t[7]&&"bx--tooltip--align-"+t[7])))&&f(_,"class",z),384&n[0]&&P(_,"bx--text-input--password__visibility__toggle",!0),384&n[0]&&P(_,"bx--btn--icon-only",!0),384&n[0]&&P(_,"bx--tooltip__trigger",!0),384&n[0]&&P(_,"bx--tooltip--a11y",!0),(!D||16384&n[0]&&N!==(N=t[14]||void 0))&&f(l,"data-invalid",N),!t[14]&&t[11]?at?at.p(t,n):(at=tt(t),at.c(),at.m(e,S)):at&&(at.d(1),at=null),t[14]?nt?nt.p(t,n):(nt=et(t),nt.c(),nt.m(e,null)):nt&&(nt.d(1),nt=null),B(e,ot=w(st,[1048576&n[0]&&t[20]])),P(e,"bx--form-item",!0),P(e,"bx--text-input-wrapper",!0),P(e,"bx--password-input-wrapper",!t[18])},i(t){D||($(F),$(E),D=!0)},o(t){g(F),g(E),D=!1},d(i){i&&u(e),j&&j.d(),F&&F.d(),t[30](null),U.d(),it[T].d(),at&&at.d(),nt&&nt.d(),O=!1,y(Y)}}}function lt(t,e,i){const l=["size","value","type","placeholder","hidePasswordLabel","showPasswordLabel","tooltipAlignment","tooltipPosition","light","disabled","helperText","labelText","hideLabel","invalid","invalidText","id","name","ref"];let a=N(e,l),{size:n}=e,{value:s=""}=e,{type:o="password"}=e,{placeholder:d=""}=e,{hidePasswordLabel:r="Hide password"}=e,{showPasswordLabel:c="Show password"}=e,{tooltipAlignment:u}=e,{tooltipPosition:p}=e,{light:b=!1}=e,{disabled:f=!1}=e,{helperText:x=""}=e,{labelText:m=""}=e,{hideLabel:v=!1}=e,{invalid:w=!1}=e,{invalidText:$=""}=e,{id:g="ccs-"+Math.random().toString(36)}=e,{name:y}=e,{ref:M=null}=e;const P=R("Form");let C,T;return t.$$set=t=>{e=h(h({},e),_(t)),i(20,a=N(e,l)),"size"in t&&i(3,n=t.size),"value"in t&&i(0,s=t.value),"type"in t&&i(1,o=t.type),"placeholder"in t&&i(4,d=t.placeholder),"hidePasswordLabel"in t&&i(5,r=t.hidePasswordLabel),"showPasswordLabel"in t&&i(6,c=t.showPasswordLabel),"tooltipAlignment"in t&&i(7,u=t.tooltipAlignment),"tooltipPosition"in t&&i(8,p=t.tooltipPosition),"light"in t&&i(9,b=t.light),"disabled"in t&&i(10,f=t.disabled),"helperText"in t&&i(11,x=t.helperText),"labelText"in t&&i(12,m=t.labelText),"hideLabel"in t&&i(13,v=t.hideLabel),"invalid"in t&&i(14,w=t.invalid),"invalidText"in t&&i(15,$=t.invalidText),"id"in t&&i(16,g=t.id),"name"in t&&i(17,y=t.name),"ref"in t&&i(2,M=t.ref)},t.$$.update=()=>{65536&t.$$.dirty[0]&&i(19,T="error-"+g)},i(18,C=!!P&&P.isFluid),[s,o,M,n,d,r,c,u,p,b,f,x,m,v,w,$,g,y,C,T,a,function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(e){L(t,e)},function(t){S[t?"unshift":"push"](()=>{M=t,i(2,M)})},({target:t})=>{i(0,s=t.value)},()=>{i(1,o="password"===o?"text":"password")}]}class at extends t{constructor(t){super(),e(this,t,lt,it,i,{size:3,value:0,type:1,placeholder:4,hidePasswordLabel:5,showPasswordLabel:6,tooltipAlignment:7,tooltipPosition:8,light:9,disabled:10,helperText:11,labelText:12,hideLabel:13,invalid:14,invalidText:15,id:16,name:17,ref:2},[-1,-1])}}export{at as P};