UNPKG

and-component-library

Version:

Distribution of AND Web Components

3 lines (2 loc) 9.39 kB
function e(){}function t(e){return e()}function n(){return Object.create(null)}function s(e){e.forEach(t)}function i(e){return"function"==typeof e}function r(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function o(e,t){e.appendChild(t)}function l(e,t,n){e.insertBefore(t,n||null)}function a(e){e.parentNode.removeChild(e)}function d(e){return document.createElement(e)}function c(e){return document.createTextNode(e)}function u(){return c(" ")}function f(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function h(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function p(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function m(e,t,n){e.classList[n?"add":"remove"](t)}let $;function g(e){$=e}function b(){if(!$)throw new Error("Function called outside component initialization");return $}function v(){const e=b();return(t,n)=>{const s=e.$$.callbacks[t];if(s){const i=function(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}(t,n);s.slice().forEach(t=>{t.call(e,i)})}}}const y=[],x=[],_=[],k=[],E=Promise.resolve();let z=!1;function w(){z||(z=!0,E.then(L))}function C(e){_.push(e)}let q=!1;const F=new Set;function L(){if(!q){q=!0;do{for(let e=0;e<y.length;e+=1){const t=y[e];g(t),M(t.$$)}for(g(null),y.length=0;x.length;)x.pop()();for(let e=0;e<_.length;e+=1){const t=_[e];F.has(t)||(F.add(t),t())}_.length=0}while(y.length);for(;k.length;)k.pop()();z=!1,q=!1,F.clear()}}function M(e){if(null!==e.fragment){e.update(),s(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(C)}}const j=new Set;function A(r,o,l,d,c,u,f=[-1]){const h=$;g(r);const p=o.props||{},m=r.$$={fragment:null,ctx:null,props:u,update:e,not_equal:c,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:n(),dirty:f,skip_bound:!1};let b=!1;if(m.ctx=l?l(r,p,(e,t,...n)=>{const s=n.length?n[0]:t;return m.ctx&&c(m.ctx[e],m.ctx[e]=s)&&(!m.skip_bound&&m.bound[e]&&m.bound[e](s),b&&function(e,t){-1===e.$$.dirty[0]&&(y.push(e),w(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(r,e)),t}):[],m.update(),b=!0,s(m.before_update),m.fragment=!!d&&d(m.ctx),o.target){if(o.hydrate){const e=function(e){return Array.from(e.childNodes)}(o.target);m.fragment&&m.fragment.l(e),e.forEach(a)}else m.fragment&&m.fragment.c();o.intro&&((v=r.$$.fragment)&&v.i&&(j.delete(v),v.i(x))),function(e,n,r){const{fragment:o,on_mount:l,on_destroy:a,after_update:d}=e.$$;o&&o.m(n,r),C(()=>{const n=l.map(t).filter(i);a?a.push(...n):s(n),e.$$.on_mount=[]}),d.forEach(C)}(r,o.target,o.anchor),L()}var v,x;g(h)}let P;"function"==typeof HTMLElement&&(P=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const e in this.$$.slotted)this.appendChild(this.$$.slotted[e])}attributeChangedCallback(e,t,n){this[e]=n}$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(s(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}});var T={dispatch(e,t,n){e.dispatchEvent&&e.dispatchEvent(new CustomEvent(t,{detail:n}))},dispatchCustomEvent(e,t,n,s){let i=s||{};t&&t.type&&t.target&&(i={type:t.type,target:t.target},n||(n=t.type)),this.dispatch(e,n,i)}};function N(e,t,n){const s=e.slice();return s[23]=t[n],s}function O(e){let t,n,s,i,r,f,h,m=e[23].text+"";return{c(){t=d("option"),n=c(m),s=u(),t.__value=i=e[23].value,t.value=t.__value,t.hidden=r=e[23].hidden,t.disabled=f=e[23].disabled,t.selected=h=e[23].selected},m(e,i){l(e,t,i),o(t,n),o(t,s)},p(e,s){4096&s&&m!==(m=e[23].text+"")&&p(n,m),4096&s&&i!==(i=e[23].value)&&(t.__value=i,t.value=t.__value),4096&s&&r!==(r=e[23].hidden)&&(t.hidden=r),4096&s&&f!==(f=e[23].disabled)&&(t.disabled=f),4096&s&&h!==(h=e[23].selected)&&(t.selected=h)},d(e){e&&a(t)}}}function S(e){let t,n;return{c(){t=d("div"),n=c(e[5]),h(t,"class","errorMessage")},m(e,s){l(e,t,s),o(t,n)},p(e,t){32&t&&p(n,e[5])},d(e){e&&a(t)}}}function H(t){let n,i,r,$,g,b,v,y,x,_,k,E,z,w=t[12],C=[];for(let e=0;e<w.length;e+=1)C[e]=O(N(t,w,e));let q=t[7]&&!t[13]&&S(t);return{c(){n=d("link"),i=u(),r=d("div"),$=d("div"),g=d("label"),b=c(t[0]),v=d("br"),y=u(),x=d("select");for(let e=0;e<C.length;e+=1)C[e].c();k=u(),q&&q.c(),this.c=e,h(n,"rel","stylesheet"),h(n,"href","and-component-styles.css"),h(n,"style_disabled",t[9]),h(g,"for",t[4]),h(g,"class","label"),h(x,"id",t[4]),h(x,"class",_=["storybook-select",t[6]].join(" ")),h(x,"name",t[1]),h(x,"form",t[3]),h(x,"size",t[2]),x.required=t[11],x.disabled=t[10],m(x,"validate",t[7]),h($,"class","and-select")},m(e,s){l(e,n,s),l(e,i,s),l(e,r,s),o(r,$),o($,g),o(g,b),o($,v),o($,y),o($,x);for(let e=0;e<C.length;e+=1)C[e].m(x,null);t[19](x),o(r,k),q&&q.m(r,null),E||(z=[f(x,"blur",t[14]),f(x,"change",t[14])],E=!0)},p(e,[t]){if(512&t&&h(n,"style_disabled",e[9]),1&t&&p(b,e[0]),16&t&&h(g,"for",e[4]),4096&t){let n;for(w=e[12],n=0;n<w.length;n+=1){const s=N(e,w,n);C[n]?C[n].p(s,t):(C[n]=O(s),C[n].c(),C[n].m(x,null))}for(;n<C.length;n+=1)C[n].d(1);C.length=w.length}16&t&&h(x,"id",e[4]),64&t&&_!==(_=["storybook-select",e[6]].join(" "))&&h(x,"class",_),2&t&&h(x,"name",e[1]),8&t&&h(x,"form",e[3]),4&t&&h(x,"size",e[2]),2048&t&&(x.required=e[11]),1024&t&&(x.disabled=e[10]),192&t&&m(x,"validate",e[7]),e[7]&&!e[13]?q?q.p(e,t):(q=S(e),q.c(),q.m(r,null)):q&&(q.d(1),q=null)},i:e,o:e,d(e){e&&a(n),e&&a(i),e&&a(r),function(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}(C,e),t[19](null),q&&q.d(),E=!1,s(z)}}}function R(e,t,n){let s,{overidestyle:i=!1}=t,{label:r=null}=t,{name:o=null}=t,{size:l=null}=t,{form:a=null}=t,{id:d="and-select"}=t,{errormessage:c=""}=t,{class:u=""}=t,{disabled:f=!1}=t,{required:h=!1}=t,{options:p='[{"text":"none ","value":"none"}]'}=t,{validate:m=!1}=t;const $=b(),g=v(),y=()=>{n(13,F=!s||s.checkValidity())};var _;let k,z,C,q,F;return _=async()=>{await(w(),E),y()},b().$$.on_mount.push(_),e.$$set=e=>{"overidestyle"in e&&n(15,i=e.overidestyle),"label"in e&&n(0,r=e.label),"name"in e&&n(1,o=e.name),"size"in e&&n(2,l=e.size),"form"in e&&n(3,a=e.form),"id"in e&&n(4,d=e.id),"errormessage"in e&&n(5,c=e.errormessage),"class"in e&&n(6,u=e.class),"disabled"in e&&n(16,f=e.disabled),"required"in e&&n(17,h=e.required),"options"in e&&n(18,p=e.options),"validate"in e&&n(7,m=e.validate)},e.$$.update=()=>{32768&e.$$.dirty&&n(9,k=!i||null),65536&e.$$.dirty&&n(10,z=f?"true":""),131072&e.$$.dirty&&n(11,C=h?"true":""),262144&e.$$.dirty&&n(12,q="string"==typeof p?JSON.parse(p):p)},n(13,F=!0),[r,o,l,a,d,c,u,m,s,k,z,C,q,F,e=>{y(),g("change",e),T.dispatchCustomEvent($,e,"change")},i,f,h,p,function(e){x[e?"unshift":"push"](()=>{s=e,n(8,s),n(12,q),n(18,p)})}]}class B extends P{constructor(e){super(),this.shadowRoot.innerHTML="<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.and-select{display:inline-block;position:relative}.storybook-select{font-family:'Poppins', sans-serif;font-size:16px;font-size:torem(16px);min-width:10.9375rem;min-height:2.5rem;background:white;border:1px solid #323232;box-sizing:border-box;border-radius:0.3125rem;padding:0.2375rem}.storybook-select:disabled{position:absolute;min-width:7.5rem;height:2.5rem;background:white;border:1px solid rgba(50, 50, 50, 0.5);box-sizing:border-box;border-radius:0.3125rem}.label{font-family:'Poppins', sans-serif;font-size:12px;font-size:torem(12px);position:absolute;min-width:2.3125rem;height:1.125rem;line-height:18px}.errorMessage{color:#FF323C;font-size:12px;font-size:torem(12px);font-family:\"Poppins\", sans-serif}.validate:valid{outline:none !important;border:0.8px solid #46991F !important}.validate:invalid{outline:none !important;border:0.8px solid #FF323C !important}</style>",A(this,{target:this.shadowRoot},R,H,r,{overidestyle:15,label:0,name:1,size:2,form:3,id:4,errormessage:5,class:6,disabled:16,required:17,options:18,validate:7}),e&&(e.target&&l(e.target,this,e.anchor),e.props&&(this.$set(e.props),L()))}static get observedAttributes(){return["overidestyle","label","name","size","form","id","errormessage","class","disabled","required","options","validate"]}get overidestyle(){return this.$$.ctx[15]}set overidestyle(e){this.$set({overidestyle:e}),L()}get label(){return this.$$.ctx[0]}set label(e){this.$set({label:e}),L()}get name(){return this.$$.ctx[1]}set name(e){this.$set({name:e}),L()}get size(){return this.$$.ctx[2]}set size(e){this.$set({size:e}),L()}get form(){return this.$$.ctx[3]}set form(e){this.$set({form:e}),L()}get id(){return this.$$.ctx[4]}set id(e){this.$set({id:e}),L()}get errormessage(){return this.$$.ctx[5]}set errormessage(e){this.$set({errormessage:e}),L()}get class(){return this.$$.ctx[6]}set class(e){this.$set({class:e}),L()}get disabled(){return this.$$.ctx[16]}set disabled(e){this.$set({disabled:e}),L()}get required(){return this.$$.ctx[17]}set required(e){this.$set({required:e}),L()}get options(){return this.$$.ctx[18]}set options(e){this.$set({options:e}),L()}get validate(){return this.$$.ctx[7]}set validate(e){this.$set({validate:e}),L()}}customElements.define("and-select",B);export default B; //# sourceMappingURL=Select.js.map