@square/maker
Version:
Maker Design System by Square
2 lines • 14.2 kB
JavaScript
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("../../components/Loading"),require("../../components/Theme"),require("../../components/Transition"),require("../../utils/get-contrast"),require("../../utils/transitions"),require("colord"),require("lodash/throttle"));else if("function"==typeof define&&define.amd)define(["../../components/Loading","../../components/Theme","../../components/Transition","../../utils/get-contrast","../../utils/transitions","colord","lodash/throttle"],e);else{var n="object"==typeof exports?e(require("../../components/Loading"),require("../../components/Theme"),require("../../components/Transition"),require("../../utils/get-contrast"),require("../../utils/transitions"),require("colord"),require("lodash/throttle")):e(t["../../components/Loading"],t["../../components/Theme"],t["../../components/Transition"],t["../../utils/get-contrast"],t["../../utils/transitions"],t.colord,t["lodash/throttle"]);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(function(t,e,n,o,i,r,s){return(()=>{var a={89:function(t){t.exports=function(){"use strict";var t=function(t){var e=t.props,n=t.data,o=t.parent,i=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(i){var r,s,a,l=(s=(r=e).body,a=r.document,s?window.document.body:!!a&&window.document.documentElement);if(l){var c=function(t,e){if(!e.length)return;const{classList:n}=t;return e.filter((t=>{if(!n.contains(t))return n.add(t),!0}))}(l,i),u=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")}(l,c)};o.$once("hook:beforeUpdate",u),o.$once("hook:destroyed",u)}}},e=Object.prototype.hasOwnProperty,n=function(t,e,n){var o="&"===e[0],i="~"===(e=o?e.slice(1):e)[0],r="!"===(e=i?e.slice(1):e)[0];return{o:t,t:e=r?e.slice(1):e,i:n,u:{once:i,capture:r,passive:o}}},o=function(t){var o,i,r,s=t.props,a=t.listeners,l=t.parent,c=function(t,o){var i,r,s=[];for(var a in o)if(i=o,r=a,e.call(i,r)){var l=o[a],c=n(t,a,l);c.o.addEventListener(c.t,c.i,c.u),s.push(c)}return s}((i=(o=s).body,r=o.document,i?window.document.body:r?window.document:window),a),u=function(){!function(t){for(var e;e=t.shift();)e.o.removeEventListener(e.t,e.i,e.u)}(c)};l.$once("hook:beforeUpdate",u),l.$once("hook:destroyed",u)},i=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?i(e):e.parent.$once("hook:mounted",(function(){i(e)})),e.slots().default}}}()},175:e=>{"use strict";e.exports=t},219:t=>{"use strict";t.exports=e},249:t=>{"use strict";t.exports=n},174:t=>{"use strict";t.exports=o},387:t=>{"use strict";t.exports=i},235:t=>{"use strict";t.exports=r},400:t=>{"use strict";t.exports=s}},l={};function c(t){var e=l[t];if(void 0!==e)return e.exports;var n=l[t]={exports:{}};return a[t].call(n.exports,n,n.exports,c),n.exports}c.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return c.d(e,{a:e}),e},c.d=(t,e)=>{for(var n in e)c.o(e,n)&&!c.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),c.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return(()=>{"use strict";c.r(u),c.d(u,{MActionBar:()=>e,MActionBarButton:()=>V,MActionBarLayer:()=>S,MInlineActionBar:()=>R});function t(t,e,n,o,i,r,s,a){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),o&&(c.functional=!0),r&&(c._scopeId="data-v-"+r),s?(l=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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},c._ssrRegister=l):i&&(l=a?function(){i.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(t,e){return l.call(e),u(t,e)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,l):[l]}return{exports:t,options:c}}const e=t({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;var n=c(400),o=c.n(n),i=function(t){return t&&t.data&&(t.data.slot=void 0),t};const r={functional:!0,render:function(t,e){var n=e.props;return Array.isArray(n.nodes)?n.nodes.map(i):i(n.nodes)}};var s,a=c(249),l=c(387),d={"!":1,"&":2},p=/\B([A-Z])/g,f=/-(\w)/g;function h(t){return t.replace(f,(function(t,e){return e?e.toUpperCase():""}))}function v(t,e,n){if(n){var o=n.value,i=n.modifier,r=t[e];null==r||1===i?t[e]=o:2===i&&(Array.isArray(r)?Array.isArray(o)?r.push.apply(r,o):r.push(o):"object"==typeof r&&"object"==typeof o?Object.assign(r,o):"function"==typeof r&&"function"==typeof o?t[e]=function(){Reflect.apply(r,this,arguments),Reflect.apply(o,this,arguments)}:t[e]+=o)}}function g(t,e,n){t[e]||(t[e]={});var o=t[e];for(var i in n)v(o,i,n[i])}function m(t,e){if(e in t)return e;var n=e.replace(p,"-$1").toLowerCase();return n in t&&n}function y(t){var e={};for(var n in t){var o=t[n],i=d[n.slice(-1)];i?n=n.slice(0,-1):i=0,e[n]={value:o,modifier:i}}return e}function b(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 _(t,e){var n=t[e];if(n)return delete t[e],n}function x(t){return t&&{value:t,modifier:0}}const $={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,r=y(o.attrs),a=y(o.on),l=y(o.nativeOn),c=_(r,"class")||x(b(o,"class")),u=_(r,"style")||x(b(o,"style")),d=_(r,"key")||x(o.key);return u&&"string"==typeof u.value&&(u.value=(i=u.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){s||(s=Object.getPrototypeOf(t).constructor);var e=new s;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({},r),n=t,o=n.data,i=n.componentOptions;i?(g(i,"propsData",function(t,e){var n=t.Ctor.options.props,o={};if(n)for(var i in n){var r=m(e,i);r&&(o[i]=e[r],delete e[r])}return o}(i,e)),g(i,"listeners",a),g(o,"nativeOn",l),o.on=o.nativeOn):g(o,"on",a),g(o,"attrs",e),o.class=b(o,"class"),o.style=b(o,"style"),v(o,"class",c),v(o,"style",u),v(t,"key",d)}return t}))}};const B={transitioning:"📚19-10-2p4DKS"};const A=t({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)}}},(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.locals||B}),null,null).exports,T={ActionBar:"📚19-10-2NVWNC","hide-on_mobile":"📚19-10-2njr_s","hide-on_tablet":"📚19-10-2xUToq","hide-on_desktop":"📚19-10-2ylNUx",position_static:"📚19-10-2HsaF6",position_relative:"📚19-10-2_rTqS",position_absolute:"📚19-10-2epy_9",position_fixed:"📚19-10-2laSC3",Action:"📚19-10-2UltaY"};const C=t({components:{vnodeSyringe:$,TransitionActionBarItems:A},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)}}},(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=T.locals||T}),null,null).exports,w={components:{V:r,MTransition:a.MTransition,AtomicActionBar:C},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,springUpBounceFn:l.springUpBounceFn,springDownBounceFn:l.springDownBounceFn}),computed:{hasActionBar(){return!!this.actionBarVnodes}},created(){this.setActionbar=o()(this.setActionbar,50,{leading:!1})},methods:{setActionbar(t){this.actionBarVnodes=t}}},O={ActionBarLayer:"📚19-10-2QtxK6",NoActionBar:"📚19-10-2_EoEp"};const S=t(w,(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",{attrs:{enter:e.springUpBounceFn,leave:e.springDownBounceFn}},[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=O.locals||O}),null,null).exports;var W=c(235),L=c(89),j=c.n(L),M=c(175),E=c(219),k=c(174);const q={components:{MLoading:M.MLoading,PseudoWindow:j()},inject:{theme:{default:(0,E.defaultTheme)(),from:E.MThemeKey}},inheritAttrs:!1,props:{type:{type:String,default:"button"},fullWidth:{type:Boolean,default:void 0},color:{type:String,default:void 0,validator:t=>(0,W.colord)(t).isValid()},textColor:{type:String,default:void 0,validator:t=>(0,W.colord)(t).isValid()},shape:{type:String,default:void 0,validator:t=>["squared","rounded","pill"].includes(t)},disabled:{type:Boolean,default:!1},align:{type:String,default:void 0,validator:t=>["center","stack","space-between"].includes(t)},loading:{type:Boolean,default:!1}},computed:{...(0,E.resolveThemeableProps)("actionbarbutton",["color","shape","textColor","align","fullWidth"]),style(){let t={color:this.resolvedColor,textColor:this.resolvedTextColor};return this.isSingleChild()&&(t={color:this.color||this.theme.colors.elevation||"#000",textColor:this.textColor||this.resolvedColor}),function(t){const e=(0,W.colord)(t.color),n=(0,k.getContrast)(t.color,t.textColor),o=e.isDark()?"lighten":"darken",i=e[o](.08).toHex(),r=e[o](.16).toHex(),s=e.alpha(.3).toHex();return{"--color-main":t.color,"--color-contrast":n,"--color-hover":i,"--color-active":r,"--color-focus":s}}(t)},isDisabled(){return this.disabled||this.loading}},methods:{getVnodesWithContent:t=>(t||[]).filter((t=>t.tag||t.text.trim().length>0)),isSingleChild(){if(this.$scopedSlots.information)return!1;const t=this.getVnodesWithContent(this.$slots.default);return 1===t.length&&t[0].tag},hasMainAndLabelText(){if(!this.$scopedSlots.information)return!1;const t=this.getVnodesWithContent(this.$slots.default),e=this.getVnodesWithContent(this.$scopedSlots.information());return t.length>0&&e.length>0},handleEscKey(){this.$emit("window-esc")}}},F={Button:"📚19-10-2smfDa",iconButton:"📚19-10-2wl71c",fullWidth:"📚19-10-2k3WSG",align_center:"📚19-10-2m_wVq",align_stack:"📚19-10-2esBM6","align_space-between":"📚19-10-2fp8ry",shape_squared:"📚19-10-2_7nvF",shape_rounded:"📚19-10-2rQNc1",shape_pill:"📚19-10-2CEm4W",loading:"📚19-10-2feGRw",Loading:"📚19-10-2MOFpI",MainText:"📚19-10-2Q1M3A",InformationText:"📚19-10-2GUJEG",hasMainAndLabelText:"📚19-10-2_pBaa",TruncateText:"📚19-10-2TaLoL"};const V=t(q,(function(){var t,e,n=this,o=n.$createElement,i=n._self._c||o;return i("button",n._g(n._b({class:[n.$s.Button,n.$s["align_"+n.resolvedAlign],n.$s["shape_"+n.resolvedShape],(t={},t[n.$s.fullWidth]=n.resolvedFullWidth,t[n.$s.iconButton]=n.isSingleChild()&&!n.resolvedFullWidth,t[n.$s.hasMainAndLabelText]=n.hasMainAndLabelText(),t[n.$s.loading]=n.loading,t)],style:n.style,attrs:{type:n.type,disabled:n.isDisabled}},"button",n.$attrs,!1),n.$listeners),[n.loading?i("m-loading",{class:n.$s.Loading}):n._e(),n._v(" "),i("span",{class:[n.$s.MainText,(e={},e[n.$s.TruncateText]=!n.isSingleChild(),e)]},[n._t("default")],2),n._v(" "),n.$scopedSlots.information?i("span",{class:[n.$s.InformationText,n.$s.TruncateText]},[n._t("information")],2):n._e(),n._v(" "),i("pseudo-window",{attrs:{document:""},on:{keyup:function(t){return!t.type.indexOf("key")&&n._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:n.handleEscKey.apply(null,arguments)}}})],1)}),[],!1,(function(t){this.$s=F.locals||F}),null,null).exports;const D={components:{AtomicActionBar:C,MTransition:a.MTransition},inheritAttrs:!1,data:()=>({loaded:!1,springUpBounceFn:l.springUpBounceFn,springDownBounceFn:l.springDownBounceFn}),mounted(){setTimeout((()=>{this.loaded=!!this.$slots.default}),600)}},U={ActionBarWrapper:"📚19-10-2Dtcu5"};const R=t(D,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.$s.ActionBarWrapper},[n("m-transition",{attrs:{enter:t.springUpBounceFn,leave:t.springDownBounceFn}},[t.loaded?n("atomic-action-bar",t._g(t._b({},"atomic-action-bar",t.$attrs,!1),t.$listeners),[t._t("default")],2):t._e()],1)],1)}),[],!1,(function(t){this.$s=U.locals||U}),null,null).exports})(),u})()}));
//# sourceMappingURL=script.js.map