UNPKG

@square/maker

Version:

Maker Design System by Square

2 lines 3.1 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MSegment:()=>r,MSegmentedControl:()=>l});const n=Symbol("SegmentedControlKey"),o={Segment:"📚19-10-2nE6h6",shape_pill:"📚19-10-2xOf5O",shape_rounded:"📚19-10-2JaraF",shape_squared:"📚19-10-2wGub5",selected:"📚19-10-2JxSKs"};function s(e,t,n,o,s,r,i,l){var a,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),o&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),i?(a=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),s&&s.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},d._ssrRegister=a):s&&(a=l?function(){s.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:s),a)if(d.functional){d._injectStyles=a;var c=d.render;d.render=function(e,t){return a.call(t),c(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,a):[a]}return{exports:e,options:d}}const r=s({inject:{controlState:n},props:{value:{type:void 0,required:!0}},computed:{isSelected(){return this.controlState.currentValue===this.value}},methods:{selectSelf(){this.controlState.currentValue=this.value}}},(function(){var e,t=this,n=t.$createElement;return(t._self._c||n)("button",t._g(t._b({class:[t.$s.Segment,t.$s["shape_"+t.controlState.shapeInner],t.$s["size_"+t.controlState.sizeInner],(e={},e[t.$s.selected]=t.isSelected,e)],on:{click:t.selectSelf}},"button",t.$attrs,!1),t.$listeners),[t._t("default")],2)}),[],!1,(function(e){this.$s=o.locals||o}),null,null).exports;const i={SegmentedControl:"📚19-10-2_fD8_",shape_pill:"📚19-10-2ssIJF",shape_rounded:"📚19-10-2f29hR",shape_squared:"📚19-10-2FwAaH",size_small:"📚19-10-2QLXE_"};const l=s({provide(){return{[n]:this.$data}},model:{prop:"selected",event:"segmented-control:update"},props:{selected:{type:void 0,required:!0},shape:{type:String,default:void 0,validator:e=>["squared","rounded","pill"].includes(e)},size:{type:String,default:"medium",validator:e=>["small","medium"].includes(e)}},data(){return{currentValue:this.selected,sizeInner:this.size,shapeInner:this.shape}},watch:{currentValue(e){this.$emit("segmented-control:update",e)}}},(function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{class:[e.$s.SegmentedControl,e.$s["shape_"+e.shapeInner],e.$s["size_"+e.sizeInner]]},[e._t("default")],2)}),[],!1,(function(e){this.$s=i.locals||i}),null,null).exports;return t})()})); //# sourceMappingURL=script.js.map