@square/maker
Version:
📚 Maker Design System by Square
2 lines • 13.5 kB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("chroma-js"),require("lodash/throttle"),require("../../components/TransitionSpringUp"),require("../../components/Loading"));else if("function"==typeof define&&define.amd)define(["chroma-js","lodash/throttle","../../components/TransitionSpringUp","../../components/Loading"],e);else{var n="object"==typeof exports?e(require("chroma-js"),require("lodash/throttle"),require("../../components/TransitionSpringUp"),require("../../components/Loading")):e(t["chroma-js"],t["lodash/throttle"],t["../../components/TransitionSpringUp"],t["../../components/Loading"]);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(function(t,e,n,o){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}([function(e,n){e.exports=t},function(t,e,n){t.exports={transitioning:"📚4-7-01416Q"}},function(t,e,n){t.exports={ActionBar:"📚4-7-03U5MT","hide-on_mobile":"📚4-7-03lNzJ","hide-on_tablet":"📚4-7-019sZd","hide-on_desktop":"📚4-7-01J87j",position_static:"📚4-7-037PDZ",position_relative:"📚4-7-01PdWe",position_absolute:"📚4-7-0qDafz",position_fixed:"📚4-7-02j_wR",Action:"📚4-7-0yzV3E"}},function(t,e,n){t.exports={ActionBarLayer:"📚4-7-011e94",NoActionBar:"📚4-7-0pgGLH"}},function(t,e,n){t.exports={Button:"📚4-7-02y_aD",iconButton:"📚4-7-03UwQ3",fullWidth:"📚4-7-03Umum",align_center:"📚4-7-03Oqio",align_stack:"📚4-7-01LKLk","align_space-between":"📚4-7-01Qb_W",shape_squared:"📚4-7-02jzDo",shape_rounded:"📚4-7-01TQ0X",shape_pill:"📚4-7-0MQT4A",loading:"📚4-7-0_3EPq",Loading:"📚4-7-02vUvx",MainText:"📚4-7-02j62o",InformationText:"📚4-7-011Elk",TruncateText:"📚4-7-01uUUG"}},function(t,e,n){t.exports={ActionBarWrapper:"📚4-7-03zyH_"}},function(t,e,n){"use strict";var o=n(1),r=n.n(o);n.d(e,"default",(function(){return r.a}))},function(t,e,n){"use strict";var o=n(2),r=n.n(o);n.d(e,"default",(function(){return r.a}))},function(t,e,n){"use strict";var o=n(3),r=n.n(o);n.d(e,"default",(function(){return r.a}))},function(t,e,n){"use strict";var o=n(4),r=n.n(o);n.d(e,"default",(function(){return r.a}))},function(t,e,n){"use strict";var o=n(5),r=n.n(o);n.d(e,"default",(function(){return r.a}))},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e,n){t.exports=function(){"use strict";var t=function(t){var e=t.props,n=t.data,o=t.parent,r=function t(e){return Array.isArray(e)?(n=e=>t(e),e.reduce(((t,e)=>t.concat(n(e))),[])):null!==(o=e)&&"object"==typeof o?function(t){let e=[];for(const n in t)t[n]&&e.push(n);return e}(e):"string"==typeof e&&e?[e]:[];var n,o}([n.staticClass,n.class]);if(r){var i,a,s,c=(a=(i=e).body,s=i.document,a?window.document.body:!!s&&window.document.documentElement);if(c){var u=function(t,e){if(!e.length)return;const{classList:n}=t;return e.filter((t=>{if(!n.contains(t))return n.add(t),!0}))}(c,r),l=function(){!function(t,e){if(!e||!e.length)return;let n;for(;n=e.shift();)t.classList.remove(n);t.classList.length||t.removeAttribute("class")}(c,u)};o.$once("hook:beforeUpdate",l),o.$once("hook:destroyed",l)}}},e=Object.prototype.hasOwnProperty,n=function(t,e,n){var o="&"===e[0],r="~"===(e=o?e.slice(1):e)[0],i="!"===(e=r?e.slice(1):e)[0];return{o:t,t:e=i?e.slice(1):e,i:n,u:{once:r,capture:i,passive:o}}},o=function(t){var o,r,i,a=t.props,s=t.listeners,c=t.parent,u=function(t,o){var r,i,a=[];for(var s in o)if(r=o,i=s,e.call(r,i)){var c=o[s],u=n(t,s,c);u.o.addEventListener(u.t,u.i,u.u),a.push(u)}return a}((r=(o=a).body,i=o.document,r?window.document.body:i?window.document:window),s),l=function(){!function(t){for(var e;e=t.shift();)e.o.removeEventListener(e.t,e.i,e.u)}(u)};c.$once("hook:beforeUpdate",l),c.$once("hook:destroyed",l)},r=function(e){o(e),t(e)};return{name:"pseudo-window",functional:!0,props:{document:Boolean,body:Boolean},render:function(t,e){return e.parent._isMounted?r(e):e.parent.$once("hook:mounted",(function(){r(e)})),e.slots().default}}}()},function(t,e){t.exports=o},function(t,e,n){"use strict";function o(t,e,n,o,r,i,a,s){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),a?(c=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)},u._ssrRegister=c):r&&(c=s?function(){r.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(u.functional){u._injectStyles=c;var l=u.render;u.render=function(t,e){return c.call(e),l(t,e)}}else{var d=u.beforeCreate;u.beforeCreate=d?[].concat(d,c):[c]}return{exports:t,options:u}}n.r(e),n.d(e,"MActionBar",(function(){return i})),n.d(e,"MActionBarLayer",(function(){return C})),n.d(e,"MActionBarButton",(function(){return R})),n.d(e,"MInlineActionBar",(function(){return z}));var r,i=o({inject:{actionBar:"action-bar"},inheritAttrs:!1,destroyed(){this.actionBar.unregister(this._uid)},render(){this.actionBar.register(this._uid,this.$slots.default)}},undefined,undefined,!1,null,null,null).exports,a=n(11),s=n.n(a),c=function(t){return t&&t.data&&(t.data.slot=void 0),t},u={functional:!0,render:function(t,e){var n=e.props;return Array.isArray(n.nodes)?n.nodes.map(c):c(n.nodes)}},l=n(12),d={"!":1,"&":2},f=/\B([A-Z])/g,p=/-(\w)/g;function h(t){return t.replace(p,(function(t,e){return e?e.toUpperCase():""}))}function v(t,e,n){if(n){var o=n.value,r=n.modifier,i=t[e];null==i||1===r?t[e]=o:2===r&&(Array.isArray(i)?Array.isArray(o)?i.push.apply(i,o):i.push(o):"object"==typeof i&&"object"==typeof o?Object.assign(i,o):"function"==typeof i&&"function"==typeof o?t[e]=function(){Reflect.apply(i,this,arguments),Reflect.apply(o,this,arguments)}:t[e]+=o)}}function y(t,e,n){t[e]||(t[e]={});var o=t[e];for(var r in n)v(o,r,n[r])}function g(t,e){if(e in t)return e;var n=e.replace(f,"-$1").toLowerCase();return n in t&&n}function m(t){var e={};for(var n in t){var o=t[n],r=d[n.slice(-1)];r?n=n.slice(0,-1):r=0,e[n]={value:o,modifier:r}}return e}function _(t,e){var n=h("static-"+e),o=[t[n],t[e]].filter(Boolean).flat(1/0);if(0!==o.length)return delete t[n],o}function b(t,e){var n=t[e];if(n)return delete t[e],n}function x(t){return t&&{value:t,modifier:0}}var $={functional:!0,render:function(t,e){var n=e.children,o=e.data;if(!n||function(t){for(var e in t)return!1;return!0}(o))return n;var i,a=m(o.attrs),s=m(o.on),c=m(o.nativeOn),u=b(a,"class")||x(_(o,"class")),l=b(a,"style")||x(_(o,"style")),d=b(a,"key")||x(o.key);return l&&"string"==typeof l.value&&(l.value=(i=l.value,Object.fromEntries(i.split(";").map((function(t){var e=t.split(":"),n=e[0],o=e[1];return n&&o&&[h(n.trim()),o.trim()]})).filter(Boolean)))),n.map((function(t){if((t=function(t){r||(r=Object.getPrototypeOf(t).constructor);var e=new r;return Object.assign(e,t),e.componentOptions&&(e.componentOptions=Object.assign({},e.componentOptions),e.componentOptions.propsData=Object.assign({},e.componentOptions.propsData)),e}(t)).tag){t.data||(t.data={});var e=Object.assign({},a),n=t,o=n.data,i=n.componentOptions;i?(y(i,"propsData",function(t,e){var n=t.Ctor.options.props,o={};if(n)for(var r in n){var i=g(e,r);i&&(o[r]=e[i],delete e[i])}return o}(i,e)),y(i,"listeners",s),y(o,"nativeOn",c),o.on=o.nativeOn):y(o,"on",s),y(o,"attrs",e),o.class=_(o,"class"),o.style=_(o,"style"),v(o,"class",u),v(o,"style",l),v(t,"key",d)}return t}))}};var A={inheritAttrs:!1,methods:{zeroWidth(t){Object.assign(t.style,{width:"0px",paddingRight:"0px",paddingLeft:"0px",marginRight:"0px",opacity:0})},removeWidth(t){t.style.width=null},setContentWidth(t,e){let n=t.scrollWidth;"enter"===e&&(n=function(t){const e=t.cloneNode(!0);e.removeAttribute("style"),Object.assign(e.style,{position:"absolute",visibility:"hidden"}),t.parentNode.insertBefore(e,t);const n=e.offsetWidth;return e.remove(),n}(t)),Object.assign(t.style,{width:"".concat(n,"px"),paddingRight:null,paddingLeft:null,marginRight:null,opacity:null})},onLeave(t){this.setContentWidth(t),this.zeroWidth(t)}}},B=n(6);var j={components:{vnodeSyringe:$,TransitionActionBarItems:o(A,(function(){var t=this,e=t.$createElement;return(t._self._c||e)("transition-group",t._b({attrs:{"enter-active-class":t.$s.transitioning,"leave-active-class":t.$s.transitioning},on:{"before-enter":t.zeroWidth,enter:function(e){return t.setContentWidth(e,"enter")},"after-enter":t.removeWidth,"before-leave":function(e){return t.setContentWidth(e,"leave")},leave:t.onLeave,"after-leave":t.removeWidth}},"transition-group",t.$attrs,!1),[t._t("default")],2)}),[],!1,(function(t){this.$s=B.default.locals||B.default}),null,null).exports},props:{position:{type:String,default:"absolute",validator:t=>["static","relative","absolute","fixed"].includes(t)},hideOn:{type:String,default:"none",validator:t=>["none","mobile","tablet","desktop"].includes(t)}}},O=n(7);var w=o(j,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition-action-bar-items",{class:[t.$s.ActionBar,t.$s["position_"+t.position],t.$s["hide-on_"+t.hideOn]],attrs:{tag:"div"}},[n("vnode-syringe",{attrs:{"class&":t.$s.Action}},[t._t("default")],2)],1)}),[],!1,(function(t){this.$s=O.default.locals||O.default}),null,null).exports,S={components:{V:u,MTransitionSpringUp:l.MTransitionSpringUp,AtomicActionBar:w},provide(){const t=this;return{"action-bar":{register(e,n){t.registeredBy=e,t.setActionbar(n)},unregister(e){t.registeredBy===e&&t.setActionbar()}}}},inheritAttrs:!1,data:()=>({registeredBy:void 0,actionBarVnodes:void 0}),computed:{hasActionBar(){return!!this.actionBarVnodes}},created(){this.setActionbar=s()(this.setActionbar,50,{leading:!1})},methods:{setActionbar(t){this.actionBarVnodes=t}}},T=n(8);var C=o(S,(function(){var t,e=this,n=e.$createElement,o=e._self._c||n;return o("div",e._g(e._b({class:[e.$s.ActionBarLayer,(t={},t[e.$s.NoActionBar]=!e.hasActionBar,t)]},"div",e.$attrs,!1),e.$listeners),[e._t("default"),e._v(" "),o("m-transition-spring-up",[e.actionBarVnodes?o("atomic-action-bar",{attrs:{"hide-on":"tablet",position:"fixed"}},[o("v",{attrs:{nodes:e.actionBarVnodes}})],1):e._e()],1)],2)}),[],!1,(function(t){this.$s=T.default.locals||T.default}),null,null).exports,L=n(0),W=n.n(L),E=n(13),k=n.n(E);function M(t){const e=W()(t.color),n=function(t,e){if(!e||W.a.contrast(t,e)<4.5){const e=t.luminance()>.32;return W()(e?"#000":"#fff")}return e}(e,t.textColor?W()(t.textColor):void 0),o=e.alpha(.8);return{"--color-main":e.hex(),"--color-contrast":n.hex(),"--color-focus":o.hex()}}var U={components:{MLoading:n(14).MLoading,PseudoWindow:k.a},inheritAttrs:!1,props:{type:{type:String,default:"button"},fullWidth:{type:Boolean,default:!1},color:{type:String,default:"#000",validator:t=>W.a.valid(t)},textColor:{type:String,default:void 0,validator:t=>W.a.valid(t)},shape:{type:String,default:"pill",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 M({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},handleEscKey(){this.$emit("window-esc")}}},q=n(9);var R=o(U,(function(){var t,e=this,n=e.$createElement,o=e._self._c||n;return o("button",e._g(e._b({class:[e.$s.Button,e.$s["align_"+e.align],e.$s["shape_"+e.shape],(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?o("m-loading",{class:e.$s.Loading}):e._e(),e._v(" "),o("span",{class:[e.$s.MainText,e.$s.TruncateText]},[e._t("default")],2),e._v(" "),e.$scopedSlots.information?o("span",{class:[e.$s.InformationText,e.$s.TruncateText]},[e._t("information")],2):e._e(),e._v(" "),o("pseudo-window",{attrs:{document:""},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.handleEscKey(t)}}})],1)}),[],!1,(function(t){this.$s=q.default.locals||q.default}),null,null).exports,P={components:{AtomicActionBar:w},inheritAttrs:!1},V=n(10);var z=o(P,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.$s.ActionBarWrapper},[n("atomic-action-bar",t._g(t._b({},"atomic-action-bar",t.$attrs,!1),t.$listeners),[t._t("default")],2)],1)}),[],!1,(function(t){this.$s=V.default.locals||V.default}),null,null).exports}])}));
//# sourceMappingURL=script.js.map