@cypress-design/vue-checkbox 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,2 +1,4 @@
1
- (function(e,l){typeof exports=="object"&&typeof module!="undefined"?module.exports=l(require("vue"),require("@cypress-design/icon-registry")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/icon-registry"],l):(e=typeof globalThis!="undefined"?globalThis:e||self,e.Checkbox=l(e.Vue,e.IconRegistry))})(this,function(e,l){"use strict";function d(o){if(o&&o.__esModule)return o;var n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});return o&&Object.keys(o).forEach(function(t){if(t!=="default"){var r=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return o[t]}})}}),n.default=o,Object.freeze(n)}var u=d(l);const m=({body:o,compiledClasses:n,size:t,class:r,interactiveColorsOnGroup:c,...a})=>{Object.keys(a).forEach(s=>{s.toLowerCase().endsWith("color")&&delete a[s]});const i={width:t,height:t,fill:"none",innerHTML:o,...a};return n.length&&(i.class=n.join(" ")),i},b=o=>{const{sizeWithDefault:n,compiledClasses:t}=u.getComponentAttributes({...o,availableSizes:["16"]}),c={16:'<path d="M5 8.5 7.5 11 11 5" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[n];if(!c)throw Error(`Icon "checkmark-small" is not available in size ${n}`);return e.h("svg",m({...o,size:n,body:c,compiledClasses:t}))},f={class:"relative flex items-center"},p=["id","name","disabled","checked"];return e.defineComponent({__name:"Checkbox",props:{id:{default:crypto.randomUUID()},checked:{type:Boolean},color:{default:"indigo"},disabled:{type:Boolean},modelValue:{type:Boolean},label:null},emits:["update:modelValue"],setup(o,{emit:n}){const t=o,r=e.ref(t.modelValue||t.checked);function c(){r.value=!r.value,n("update:modelValue",r.value)}const a=e.computed(()=>["block border-1 rounded h-16px w-16px",t.disabled?"border-gray-200 bg-gray-100":r.value?{"border-indigo-500 bg-indigo-400":t.color==="indigo","border-jade-500 bg-jade-400":t.color==="jade","border-red-500 bg-red-400":t.color==="red"}:"border-gray-200 bg-white"]);return(i,s)=>(e.openBlock(),e.createElementBlock("label",f,[e.createElementVNode("input",{id:o.id,class:"absolute inset-0 w-0 h-0 opacity-0",name:o.id,type:"checkbox",onChange:c,disabled:t.disabled,checked:r.value},null,40,p),r.value?(e.openBlock(),e.createBlock(e.unref(b),{key:0,strokeColor:"white",class:"absolute"})):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(a))},null,2),e.renderSlot(i.$slots,"label",{},()=>[o.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["block ml-2 text-16px leading-normal font-light select-none",o.disabled?"text-gray-500":"text-gray-800"])},e.toDisplayString(o.label),3)):e.createCommentVNode("",!0)])]))}})});
1
+ (function(e,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("vue"),require("@cypress-design/icon-registry")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/icon-registry"],r):(e=typeof globalThis<"u"?globalThis:e||self,e.Checkbox=r(e.Vue,e.IconRegistry))})(this,function(e,r){"use strict";function m(t){if(t&&t.__esModule)return t;const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(l,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return l.default=t,Object.freeze(l)}const b=m(r),f=({body:t,compiledClasses:l,size:o,class:n,interactiveColorsOnGroup:d,...i})=>{const a=Object.keys(i).reduce((u,c)=>(r.ICON_COLOR_PROP_NAMES.includes(c)||(u[c]=i[c]),u),{}),s={width:o,height:o,fill:"none",innerHTML:t,...a};return l.length&&(s.class=l.join(" ")),s},g=t=>{const{sizeWithDefault:l,compiledClasses:o}=b.getComponentAttributes({...t,availableSizes:["16"]}),n={16:'<path d="M5 8.5 7.5 11 11 5" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[l];if(!n)throw Error(`Icon "checkmark-small" is not available in size ${l}`);return e.h("svg",f({...t,size:l,body:n,compiledClasses:o}))},p={class:"relative flex items-center"},h=["id","name","disabled","checked"],k=["for"];function y(){return String(Date.now().toString(32)+Math.random().toString(16)).replace(/\./g,"")}return e.defineComponent({__name:"Checkbox",props:{id:{default:y()},name:null,checked:{type:Boolean},color:{default:"indigo"},disabled:{type:Boolean},modelValue:{type:Boolean},label:null},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,n=e.ref(o.modelValue||o.checked);function d(){n.value=!n.value,l("update:modelValue",n.value)}const i=e.computed(()=>["block border-1 rounded h-16px w-16px",o.disabled?"border-gray-200 bg-gray-100":n.value?{"border-indigo-500 bg-indigo-400":o.color==="indigo","border-jade-500 bg-jade-400":o.color==="jade","border-red-500 bg-red-400":o.color==="red"}:"border-gray-200 bg-white"]);return(a,s)=>(e.openBlock(),e.createElementBlock("div",p,[e.createElementVNode("input",{id:t.id,class:"absolute inset-0 w-0 h-0 opacity-0",name:t.name||t.id,type:"checkbox",onChange:d,disabled:o.disabled,checked:n.value},null,40,h),n.value?(e.openBlock(),e.createBlock(e.unref(g),{key:0,strokeColor:"white",class:"absolute"})):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(i))},null,2),e.createElementVNode("label",{class:"block",for:t.id},[e.renderSlot(a.$slots,"label",{},()=>[t.label?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["ml-2 text-16px leading-normal font-light select-none",t.disabled?"text-gray-500":"text-gray-800"])},e.toDisplayString(t.label),3)):e.createCommentVNode("",!0)])],8,k)]))}})});
2
+ /* <windicss-keep class="block border-1 rounded h-16px w-16px border-gray-200 bg-gray-100 border-indigo-500 bg-indigo-400 border-jade-500 bg-jade-400 border-red-500 bg-red-400 bg-white relative flex items-center absolute inset-0 w-0 h-0 opacity-0 ml-2 text-16px leading-normal font-light select-none text-gray-500 text-gray-800 icon-dark-white"> */
3
+
2
4
  //# sourceMappingURL=index.umd.js.map