@square/maker
Version:
📚 Maker Design System by Square
2 lines • 6.03 kB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("chroma-js"),require("../../components/Loading"));else if("function"==typeof define&&define.amd)define(["chroma-js","../../components/Loading"],e);else{var o="object"==typeof exports?e(require("chroma-js"),require("../../components/Loading")):e(t["chroma-js"],t["../../components/Loading"]);for(var n in o)("object"==typeof exports?exports:t)[n]=o[n]}}(this,(function(t,e){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=4)}([function(e,o){e.exports=t},function(t,e,o){t.exports={Button:"📚4-7-0vs3NG",shape_pill:"📚4-7-01_8xg",shape_squared:"📚4-7-03Ung1",iconButton:"📚4-7-02hOhT",size_small:"📚4-7-03mhFp",size_medium:"📚4-7-01rDgi",size_large:"📚4-7-0rQizU",fullWidth:"📚4-7-03cxyu",align_center:"📚4-7-0fThGd",align_stack:"📚4-7-027OBH","align_space-between":"📚4-7-0YIcKo",loading:"📚4-7-02sKEl",Loading:"📚4-7-01jW1M",MainText:"📚4-7-0dEw6R",InformationText:"📚4-7-015CNr"}},function(t,e,o){"use strict";var n=o(1),r=o.n(n);o.d(e,"default",(function(){return r.a}))},function(t,o){t.exports=e},function(t,e,o){"use strict";o.r(e),o.d(e,"MButton",(function(){return p}));var n=o(0),r=o.n(n),i=o(3);function a(t){return t.alpha(.3)}function l(t){return r.a.mix(t,"#000",.05)}function s(t){return r.a.mix(t,"#000",.1)}const c={primary:function(t){const e=r()(t.color),o=l(e),n=s(e),i=function(t,e){if(!e||r.a.contrast(t,e)<4.5){const e=.32,o=t.luminance()>e;return r()(o?"#000":"#fff")}return e}(e,t.textColor?r()(t.textColor):void 0),c=l(i),u=s(i),d=a(e);return{"--small-padding":"8px 16px","--medium-padding":"12px 24px","--large-padding":"20px 32px","--color-main":e.hex(),"--color-main-hover":o.hex(),"--color-main-active":n.hex(),"--color-contrast":i.hex(),"--color-contrast-hover":c.hex(),"--color-contrast-active":u.hex(),"--color-focus":d.hex()}},secondary:function(t){const e=r()(t.color),o=l(e),n=s(e),i=a(e);return{"--small-padding":"8px 16px","--medium-padding":"12px 24px","--large-padding":"20px 32px","--color-main":"transparent","--color-main-hover":"rgba(0, 0, 0, 0.05)","--color-main-active":"rgba(0, 0, 0, 0.1)","--color-contrast":e.hex(),"--color-contrast-hover":o.hex(),"--color-contrast-active":n.hex(),"--color-focus":i.hex(),"--outline-border":"inset 0 0 0 1px var(--color-contrast)"}},tertiary:function(t){const e=r()(t.color),o=l(e),n=s(e),i=a(e);return{"--small-padding":"8px","--medium-padding":"12px","--large-padding":"20px","--color-main":"transparent","--color-main-hover":"rgba(0, 0, 0, 0.05)","--color-main-active":"rgba(0, 0, 0, 0.1)","--color-contrast":e.hex(),"--color-contrast-hover":o.hex(),"--color-contrast-active":n.hex(),"--color-focus":i.hex()}}};var u={components:{MLoading:i.MLoading},inheritAttrs:!1,props:{type:{type:String,default:"button"},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)},fullWidth:{type:Boolean,default:!1},color:{type:String,default:"#000",validator:t=>r.a.valid(t)},textColor:{type:String,default:void 0,validator:t=>r.a.valid(t)},variant:{type:String,default:"primary",validator:t=>["primary","secondary","tertiary"].includes(t)},shape:{type:String,default:"rounded",validator:t=>["squared","rounded","pill"].includes(t)},disabled:{type:Boolean,default:!1},align:{type:String,default:"center",validator:t=>["center","stack","space-between"].includes(t)},loading:{type:Boolean,default:!1}},computed:{style(){return c[this.variant]({color:this.color,textColor:this.textColor})}},methods:{isSingleChild(){if(this.$scopedSlots.information)return!1;const t=(this.$slots.default||[]).filter((t=>t.tag||t.text.trim().length>0));return 1===t.length&&t[0].tag}}},d=o(2);var p=function(t,e,o,n,r,i,a,l){var s,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=o,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(s=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=s):r&&(s=l?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),s)if(c.functional){c._injectStyles=s;var u=c.render;c.render=function(t,e){return s.call(e),u(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,s):[s]}return{exports:t,options:c}}(u,(function(){var t,e=this,o=e.$createElement,n=e._self._c||o;return n("button",e._g(e._b({class:[e.$s.Button,e.$s["size_"+e.size],e.$s["shape_"+e.shape],e.$s["align_"+e.align],(t={},t[e.$s.fullWidth]=e.fullWidth,t[e.$s.iconButton]=e.isSingleChild(),t[e.$s.loading]=e.loading,t)],style:e.style,attrs:{type:e.type,disabled:e.disabled}},"button",e.$attrs,!1),e.$listeners),[e.loading?n("m-loading",{class:e.$s.Loading}):e._e(),e._v(" "),n("span",{class:e.$s.MainText},[e._t("default")],2),e._v(" "),e.$scopedSlots.information?n("span",{class:e.$s.InformationText},[e._t("information")],2):e._e()],1)}),[],!1,(function(t){this.$s=d.default.locals||d.default}),null,null).exports}])}));
//# sourceMappingURL=script.js.map