and-component-library
Version:
Distribution of AND Web Components
3 lines (2 loc) • 6.51 kB
JavaScript
function t(){}function e(t){return t()}function n(){return Object.create(null)}function o(t){t.forEach(e)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function i(t,e,n){t.insertBefore(e,n||null)}function c(t){t.parentNode.removeChild(t)}function a(t){return document.createElement(t)}function l(t){return document.createTextNode(t)}function d(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}let u;function p(t){u=t}function f(){if(!u)throw new Error("Function called outside component initialization");return u}function b(){const t=f();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const r=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}(e,n);o.slice().forEach(e=>{e.call(t,r)})}}}const h=[],y=[],$=[],m=[],g=Promise.resolve();let k=!1;function v(t){$.push(t)}let x=!1;const E=new Set;function _(){if(!x){x=!0;do{for(let t=0;t<h.length;t+=1){const e=h[t];p(e),w(e.$$)}for(p(null),h.length=0;y.length;)y.pop()();for(let t=0;t<$.length;t+=1){const e=$[t];E.has(e)||(E.add(e),e())}$.length=0}while(h.length);for(;m.length;)m.pop()();k=!1,x=!1,E.clear()}}function w(t){if(null!==t.fragment){t.update(),o(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(v)}}const C=new Set;function F(t,e){-1===t.$$.dirty[0]&&(h.push(t),k||(k=!0,g.then(_)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function j(s,i,a,l,d,f,b=[-1]){const h=u;p(s);const y=i.props||{},$=s.$$={fragment:null,ctx:null,props:f,update:t,not_equal:d,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(h?h.$$.context:[]),callbacks:n(),dirty:b,skip_bound:!1};let m=!1;if($.ctx=a?a(s,y,(t,e,...n)=>{const o=n.length?n[0]:e;return $.ctx&&d($.ctx[t],$.ctx[t]=o)&&(!$.skip_bound&&$.bound[t]&&$.bound[t](o),m&&F(s,t)),e}):[],$.update(),m=!0,o($.before_update),$.fragment=!!l&&l($.ctx),i.target){if(i.hydrate){const t=function(t){return Array.from(t.childNodes)}(i.target);$.fragment&&$.fragment.l(t),t.forEach(c)}else $.fragment&&$.fragment.c();i.intro&&((g=s.$$.fragment)&&g.i&&(C.delete(g),g.i(k))),function(t,n,s){const{fragment:i,on_mount:c,on_destroy:a,after_update:l}=t.$$;i&&i.m(n,s),v(()=>{const n=c.map(e).filter(r);a?a.push(...n):o(n),t.$$.on_mount=[]}),l.forEach(v)}(s,i.target,i.anchor),_()}var g,k;p(h)}let A;"function"==typeof HTMLElement&&(A=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,n){this[t]=n}$destroy(){!function(t,e){const n=t.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});var L={dispatch(t,e,n){t.dispatchEvent&&t.dispatchEvent(new CustomEvent(e,{detail:n}))},dispatchCustomEvent(t,e,n,o){let r=o||{};e&&e.type&&e.target&&(r={type:e.type,target:e.target},n||(n=e.type)),this.dispatch(t,n,r)}};function T(e){let n,o,r,s,u,p,f;return{c(){n=a("link"),o=l(" "),r=a("button"),s=l(e[1]),this.c=t,d(n,"rel","stylesheet"),d(n,"href","and-component-styles.css"),d(n,"disabled",e[4]),d(r,"id",e[2]),d(r,"type",e[0]),d(r,"class",u=["storybook-button",e[5],e[3]].join(" ")),r.disabled=e[6]},m(t,c){var a,l,d,u;i(t,n,c),i(t,o,c),i(t,r,c),function(t,e){t.appendChild(e)}(r,s),p||(a=r,l="click",d=e[7],a.addEventListener(l,d,u),f=()=>a.removeEventListener(l,d,u),p=!0)},p(t,[e]){16&e&&d(n,"disabled",t[4]),2&e&&function(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}(s,t[1]),4&e&&d(r,"id",t[2]),1&e&&d(r,"type",t[0]),40&e&&u!==(u=["storybook-button",t[5],t[3]].join(" "))&&d(r,"class",u),64&e&&(r.disabled=t[6])},i:t,o:t,d(t){t&&c(n),t&&c(o),t&&c(r),p=!1,f()}}}function M(t,e,n){let{primary:o}=e,{type:r="button"}=e,{label:s=""}=e,{id:i="and-button"}=e,{class:c=""}=e,{disabled:a=!1}=e,{overidestyle:l=!1}=e;const d=f(),u=b();let p,h,y;return t.$$set=t=>{"primary"in t&&n(8,o=t.primary),"type"in t&&n(0,r=t.type),"label"in t&&n(1,s=t.label),"id"in t&&n(2,i=t.id),"class"in t&&n(3,c=t.class),"disabled"in t&&n(9,a=t.disabled),"overidestyle"in t&&n(10,l=t.overidestyle)},t.$$.update=()=>{1024&t.$$.dirty&&n(4,p=!l||null),256&t.$$.dirty&&n(5,h=o?"storybook-button--primary":"storybook-button--secondary"),512&t.$$.dirty&&n(6,y=a?"true":"")},[r,s,i,c,p,h,y,function(t){u("click",t),L.dispatchCustomEvent(d,t,"click")},o,a,l]}class z extends A{constructor(t){super(),this.shadowRoot.innerHTML="<style>@import url(https://fonts.googleapis.com/css2?family=Poppins);:root{--step:50}.storybook-button{font-family:'Poppins', sans-serif;font-size:16px;font-size:torem(16px);border:0;min-width:6.25rem;min-height:2.5rem;border-radius:0.625rem;cursor:pointer;display:inline-block;line-height:1;padding:0.5rem 1.4375rem}.storybook-button--primary{color:white;background-color:#FF323C}.storybook-button--primary:hover{background:#e5000b}.storybook-button--primary:focus{outline:0;background:#980007}.storybook-button--primary:disabled{color:#FF323C;background:#ffcbce}.storybook-button--secondary{color:white;background-color:#2897FF}.storybook-button--secondary:hover{background:#0071db}.storybook-button--secondary:focus{background:#00498e}.storybook-button--secondary:disabled{color:#2897FF;background:#c1e1ff}</style>",j(this,{target:this.shadowRoot},M,T,s,{primary:8,type:0,label:1,id:2,class:3,disabled:9,overidestyle:10}),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),_()))}static get observedAttributes(){return["primary","type","label","id","class","disabled","overidestyle"]}get primary(){return this.$$.ctx[8]}set primary(t){this.$set({primary:t}),_()}get type(){return this.$$.ctx[0]}set type(t){this.$set({type:t}),_()}get label(){return this.$$.ctx[1]}set label(t){this.$set({label:t}),_()}get id(){return this.$$.ctx[2]}set id(t){this.$set({id:t}),_()}get class(){return this.$$.ctx[3]}set class(t){this.$set({class:t}),_()}get disabled(){return this.$$.ctx[9]}set disabled(t){this.$set({disabled:t}),_()}get overidestyle(){return this.$$.ctx[10]}set overidestyle(t){this.$set({overidestyle:t}),_()}}customElements.define("and-button",z);export default z;
//# sourceMappingURL=Button.js.map