@vue-interface/btn-activity 2.0.0-beta.8 → 2.0.0-beta.9

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as b, inject as O, openBlock as a, createElementBlock as g, normalizeClass as j, normalizeStyle as N, createElementVNode as E, createBlock as f, resolveDynamicComponent as x, createCommentVNode as $, toDisplayString as y, mergeProps as w, withCtx as A, renderSlot as C, createTextVNode as k, resolveComponent as P, createVNode as _, normalizeProps as H, guardReactiveProps as R } from "vue";
1
+ import { defineComponent as b, inject as O, openBlock as a, createElementBlock as g, normalizeClass as j, normalizeStyle as N, createElementVNode as E, createBlock as y, resolveDynamicComponent as x, createCommentVNode as $, toDisplayString as f, mergeProps as w, withCtx as A, renderSlot as C, createTextVNode as k, resolveComponent as P, createVNode as _, normalizeProps as H, guardReactiveProps as R } from "vue";
2
2
  function r(t, i = "px") {
3
3
  return t != null && t !== !1 && isFinite(t) ? `${t}${i}` : t;
4
4
  }
@@ -78,11 +78,11 @@ function I(t, i, e, n, s, o) {
78
78
  style: N(t.style)
79
79
  }, [
80
80
  E("div", D, [
81
- t.is ? (a(), f(x(t.is()), {
81
+ t.is ? (a(), y(x(t.is()), {
82
82
  key: 0,
83
83
  class: "mx-auto"
84
84
  })) : $("", !0),
85
- t.label ? (a(), g("div", L, y(t.label), 1)) : $("", !0)
85
+ t.label ? (a(), g("div", L, f(t.label), 1)) : $("", !0)
86
86
  ])
87
87
  ], 6);
88
88
  }
@@ -103,11 +103,11 @@ function q(t) {
103
103
  var G = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
104
104
  function K(t, i) {
105
105
  i === void 0 && (i = {});
106
- for (var e = i.splitRegexp, n = e === void 0 ? G : e, s = i.stripRegexp, o = s === void 0 ? J : s, c = i.transform, p = c === void 0 ? q : c, l = i.delimiter, B = l === void 0 ? " " : l, h = S(S(t, n, "$1\0$2"), o, "\0"), v = 0, m = h.length; h.charAt(v) === "\0"; )
107
- v++;
106
+ for (var e = i.splitRegexp, n = e === void 0 ? G : e, s = i.stripRegexp, o = s === void 0 ? J : s, c = i.transform, v = c === void 0 ? q : c, l = i.delimiter, B = l === void 0 ? " " : l, h = S(S(t, n, "$1\0$2"), o, "\0"), p = 0, m = h.length; h.charAt(p) === "\0"; )
107
+ p++;
108
108
  for (; h.charAt(m - 1) === "\0"; )
109
109
  m--;
110
- return h.slice(v, m).split("\0").map(p).join(B);
110
+ return h.slice(p, m).split("\0").map(v).join(B);
111
111
  }
112
112
  function S(t, i, e) {
113
113
  return i instanceof RegExp ? t.replace(i, e) : i.reduce(function(n, s) {
@@ -230,14 +230,14 @@ const Y = {
230
230
  return e;
231
231
  };
232
232
  function st(t, i, e, n, s, o) {
233
- return a(), f(x(t.component), w(t.$attrs, {
233
+ return a(), y(x(t.component), w(t.$attrs, {
234
234
  disabled: t.disabled,
235
235
  class: t.classes,
236
236
  role: "button"
237
237
  }), {
238
238
  default: A(() => [
239
239
  C(t.$slots, "default", {}, () => [
240
- k(y(t.label), 1)
240
+ k(f(t.label), 1)
241
241
  ])
242
242
  ]),
243
243
  _: 3
@@ -265,11 +265,11 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
265
265
  )
266
266
  );
267
267
  }, at = b({
268
- inheritAttrs: !1,
269
268
  components: {
270
269
  ActivityIndicator: Z,
271
270
  Btn: nt
272
271
  },
272
+ inheritAttrs: !1,
273
273
  props: {
274
274
  active: Boolean,
275
275
  activity: Boolean,
@@ -279,7 +279,10 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
279
279
  type: [Object, String],
280
280
  default: "spinner"
281
281
  },
282
- label: String,
282
+ label: {
283
+ type: String,
284
+ default: void 0
285
+ },
283
286
  orientation: {
284
287
  type: String,
285
288
  default: "right"
@@ -288,12 +291,16 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
288
291
  type: String,
289
292
  default: "md"
290
293
  },
291
- tag: String,
294
+ tag: {
295
+ type: String,
296
+ default: void 0
297
+ },
292
298
  variant: {
293
299
  type: String,
294
300
  default: "primary"
295
301
  }
296
302
  },
303
+ emits: ["click", "hide-activity", "show-activity"],
297
304
  data() {
298
305
  return {
299
306
  currentActivity: this.activity
@@ -306,10 +313,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
306
313
  active: this.active,
307
314
  "btn-activity": this.activity,
308
315
  [`btn-activity-${this.orientation.replace("btn-activity-", "")}`]: !!this.orientation,
309
- [`'btn-activity-indicator-${this.indicatorProps.type.replace(
310
- "btn-activity-indicator-",
311
- ""
312
- )}`]: !!this.indicatorProps.type
316
+ [`btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-", "")}`]: !!this.indicatorProps.type
313
317
  };
314
318
  },
315
319
  indicatorProps() {
@@ -340,7 +344,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
340
344
  },
341
345
  hideActivity() {
342
346
  this.$el.classList.add("btn-hide-activity"), z(this.$el, () => {
343
- this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
347
+ this.disabled || this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
344
348
  });
345
349
  },
346
350
  showActivity() {
@@ -360,15 +364,16 @@ const ot = (t, i) => {
360
364
  return e;
361
365
  };
362
366
  function ct(t, i, e, n, s, o) {
363
- const c = P("activity-indicator"), p = P("btn");
364
- return a(), f(p, w({
367
+ const c = P("activity-indicator"), v = P("btn");
368
+ return a(), y(v, w({
365
369
  active: t.active,
366
370
  block: t.block,
367
371
  disabled: t.disabled,
368
372
  size: t.size,
369
373
  tag: t.tag,
370
374
  variant: t.variant,
371
- class: t.classes,
375
+ class: t.classes
376
+ }, Object.assign({}, t.$attrs, { onClick: void 0 }), {
372
377
  onClick: i[0] || (i[0] = (l) => !t.disabled && t.$emit("click", l, {
373
378
  disable: t.disable,
374
379
  enable: t.enable,
@@ -376,10 +381,10 @@ function ct(t, i, e, n, s, o) {
376
381
  showActivity: t.showActivity,
377
382
  hideActivity: t.hideActivity
378
383
  }))
379
- }, Object.assign({}, t.$attrs, { onClick: void 0 })), {
384
+ }), {
380
385
  default: A(() => [
381
386
  C(t.$slots, "default", {}, () => [
382
- k(y(t.label), 1)
387
+ k(f(t.label), 1)
383
388
  ]),
384
389
  _(c, H(R(t.indicatorProps)), null, 16)
385
390
  ]),
@@ -1 +1 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.BtnActivity={},a.Vue))})(this,function(a,e){"use strict";function o(t,i="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${i}`:t}const v=e.defineComponent({props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:String,default:"indicators"},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},data:()=>({is:null}),setup(t){return{registryInstance:e.inject(t.registry||"indicators")}},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:o(this.width),maxWidth:o(this.maxWidth),minWidth:o(this.minWidth),height:o(this.height),maxHeight:o(this.maxHeight),minHeight:o(this.minHeight)}}},async mounted(){const t=await this.component();this.is=()=>t},methods:{async component(){let t=this.registryInstance.get(this.type);return t instanceof Promise?t:(typeof t=="function"&&(t=await t()),t.default?t.default:t)}}}),$=(t,i)=>{const n=t.__vccOpts||t;for(const[r,s]of i)n[r]=s;return n},P={class:"activity-indicator-content"},S={key:1,class:"activity-indicator-label"};function x(t,i,n,r,s,d){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["activity-indicator",t.classes]),style:e.normalizeStyle(t.style)},[e.createElementVNode("div",P,[t.is?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.is()),{key:0,class:"mx-auto"})):e.createCommentVNode("",!0),t.label?(e.openBlock(),e.createElementBlock("div",S,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0)])],6)}const z=$(v,[["render",x]]);var C=Object.defineProperty,A=(t,i,n)=>i in t?C(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,w=(t,i,n)=>(A(t,typeof i!="symbol"?i+"":i,n),n),c=function(){return c=Object.assign||function(t){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},c.apply(this,arguments)};function B(t){return t.toLowerCase()}var k=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],j=/[^A-Z0-9]+/gi;function O(t,i){i===void 0&&(i={});for(var n=i.splitRegexp,r=n===void 0?k:n,s=i.stripRegexp,d=s===void 0?j:s,h=i.transform,u=h===void 0?B:h,p=i.delimiter,q=p===void 0?" ":p,m=b(b(t,r,"$1\0$2"),d,"\0"),f=0,y=m.length;m.charAt(f)==="\0";)f++;for(;m.charAt(y-1)==="\0";)y--;return m.slice(f,y).split("\0").map(u).join(q)}function b(t,i,n){return i instanceof RegExp?t.replace(i,n):i.reduce(function(r,s){return r.replace(s,n)},t)}function N(t,i){return i===void 0&&(i={}),O(t,c({delimiter:"."},i))}function l(t,i){return i===void 0&&(i={}),N(t,c({delimiter:"-"},i))}class _{constructor(i={}){w(this,"components"),this.components=new Map,Object.entries(i).forEach(([n,r])=>{this.register(n,r)})}get(i){const n=this.components.get(i=l(i));if(n)return n;throw new Error(`"${i}" has not been registered yet!`)}register(i,n){return typeof i=="object"?(Object.entries(i).forEach(([r,s])=>{this.register(l(r),s)}),this):(this.components.set(l(i),n),this)}remove(i){return this.components.delete(l(i)),this}reset(){return this.components=new Map,this}}function E(t={}){return new _(t)}E();const V={props:{componentPrefix:String,size:String,sizePrefix:String},computed:{sizeableClassPrefix(){return this.sizePrefix||this.componentPrefix},hasSizeablePrefix(){return this.size===void 0?!1:!!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`))},sizeableClass(){return this.size?!this.sizeableClassPrefix||this.hasSizeablePrefix?this.size:`${this.sizeableClassPrefix}-${this.size}`:""}}},D={props:{componentPrefix:String,variant:String,variantPrefix:String},computed:{variantClassPrefix(){return this.variantPrefix||this.componentPrefix},hasVariantPrefix(){return this.variant===void 0?!1:!!this.variant.match(new RegExp(`^${this.variantClassPrefix}`))},variantClass(){return this.variant?!this.variantClassPrefix||this.hasVariantPrefix?this.variant:`${this.variantClassPrefix}-${this.variant}`:""}}},H=e.defineComponent({mixins:[V,D],props:{active:Boolean,block:Boolean,componentPrefix:{type:String,default:"btn"},disabled:Boolean,label:String,outline:Boolean,tag:String,variant:{type:String,default:"primary"}},computed:{classes(){return["btn",this.variantClass,this.sizeableClass,this.active&&"active",this.block&&"btn-block",this.disabled&&"disabled"]},component(){return this.tag?this.tag:this.$attrs.href?"a":"button"},variantClassPrefix(){return(this.variantPrefix||this.componentPrefix)+(this.outline?"-outline":"")}}}),R=(t,i)=>{const n=t.__vccOpts||t;for(const[r,s]of i)n[r]=s;return n};function T(t,i,n,r,s,d){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),e.mergeProps(t.$attrs,{disabled:t.disabled,class:t.classes,role:"button"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])]),_:3},16,["disabled","class"])}const W=R(H,[["render",T]]),L=function(t){const i=parseFloat(t||0),n=t&&t.match(/m?s/),r=n?n[0]:!1;let s;switch(r){case"s":s=i*1e3;break;case"ms":default:s=i;break}return s||0},g=function(t,i){const n=(t.ownerDocument||document).defaultView;setTimeout(i,L(n==null?void 0:n.getComputedStyle(t).animationDuration))},I=e.defineComponent({inheritAttrs:!1,components:{ActivityIndicator:z,Btn:W},props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,indicator:{type:[Object,String],default:"spinner"},label:String,orientation:{type:String,default:"right"},size:{type:String,default:"md"},tag:String,variant:{type:String,default:"primary"}},data(){return{currentActivity:this.activity}},computed:{classes(){return{disabled:this.disabled,active:this.active,"btn-activity":this.activity,[`btn-activity-${this.orientation.replace("btn-activity-","")}`]:!!this.orientation,[`'btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-","")}`]:!!this.indicatorProps.type}},indicatorProps(){return Object.assign({type:"spinner"},(typeof this.indicator=="string"?{type:this.indicator}:this.indicator)||{})}},watch:{activity(t){t?this.showActivity():this.hideActivity()}},mounted(){this.activity&&this.showActivity()},methods:{disable(){this.$el.disabled=!0,this.$el.classList.add("disabled")},enable(){this.$el.disabled=!1,this.$el.classList.remove("disabled")},hideActivity(){this.$el.classList.add("btn-hide-activity"),g(this.$el,()=>{this.enable(),this.currentActivity=!1,this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},showActivity(){this.currentActivity=!0,this.disable(),g(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}}),G="",M=(t,i)=>{const n=t.__vccOpts||t;for(const[r,s]of i)n[r]=s;return n};function Z(t,i,n,r,s,d){const h=e.resolveComponent("activity-indicator"),u=e.resolveComponent("btn");return e.openBlock(),e.createBlock(u,e.mergeProps({active:t.active,block:t.block,disabled:t.disabled,size:t.size,tag:t.tag,variant:t.variant,class:t.classes,onClick:i[0]||(i[0]=p=>!t.disabled&&t.$emit("click",p,{disable:t.disable,enable:t.enable,toggle:t.toggle,showActivity:t.showActivity,hideActivity:t.hideActivity}))},Object.assign({},t.$attrs,{onClick:void 0})),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),e.createVNode(h,e.normalizeProps(e.guardReactiveProps(t.indicatorProps)),null,16)]),_:3},16,["active","block","disabled","size","tag","variant","class"])}const F=M(I,[["render",Z]]);a.BtnActivity=F,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.BtnActivity={},a.Vue))})(this,function(a,e){"use strict";function o(t,i="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${i}`:t}const v=e.defineComponent({props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:String,default:"indicators"},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},data:()=>({is:null}),setup(t){return{registryInstance:e.inject(t.registry||"indicators")}},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:o(this.width),maxWidth:o(this.maxWidth),minWidth:o(this.minWidth),height:o(this.height),maxHeight:o(this.maxHeight),minHeight:o(this.minHeight)}}},async mounted(){const t=await this.component();this.is=()=>t},methods:{async component(){let t=this.registryInstance.get(this.type);return t instanceof Promise?t:(typeof t=="function"&&(t=await t()),t.default?t.default:t)}}}),$=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s},P={class:"activity-indicator-content"},S={key:1,class:"activity-indicator-label"};function x(t,i,s,r,n,d){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["activity-indicator",t.classes]),style:e.normalizeStyle(t.style)},[e.createElementVNode("div",P,[t.is?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.is()),{key:0,class:"mx-auto"})):e.createCommentVNode("",!0),t.label?(e.openBlock(),e.createElementBlock("div",S,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0)])],6)}const z=$(v,[["render",x]]);var C=Object.defineProperty,w=(t,i,s)=>i in t?C(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s,A=(t,i,s)=>(w(t,typeof i!="symbol"?i+"":i,s),s),c=function(){return c=Object.assign||function(t){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},c.apply(this,arguments)};function k(t){return t.toLowerCase()}var B=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],j=/[^A-Z0-9]+/gi;function O(t,i){i===void 0&&(i={});for(var s=i.splitRegexp,r=s===void 0?B:s,n=i.stripRegexp,d=n===void 0?j:n,h=i.transform,f=h===void 0?k:h,p=i.delimiter,q=p===void 0?" ":p,m=b(b(t,r,"$1\0$2"),d,"\0"),u=0,y=m.length;m.charAt(u)==="\0";)u++;for(;m.charAt(y-1)==="\0";)y--;return m.slice(u,y).split("\0").map(f).join(q)}function b(t,i,s){return i instanceof RegExp?t.replace(i,s):i.reduce(function(r,n){return r.replace(n,s)},t)}function N(t,i){return i===void 0&&(i={}),O(t,c({delimiter:"."},i))}function l(t,i){return i===void 0&&(i={}),N(t,c({delimiter:"-"},i))}class _{constructor(i={}){A(this,"components"),this.components=new Map,Object.entries(i).forEach(([s,r])=>{this.register(s,r)})}get(i){const s=this.components.get(i=l(i));if(s)return s;throw new Error(`"${i}" has not been registered yet!`)}register(i,s){return typeof i=="object"?(Object.entries(i).forEach(([r,n])=>{this.register(l(r),n)}),this):(this.components.set(l(i),s),this)}remove(i){return this.components.delete(l(i)),this}reset(){return this.components=new Map,this}}function E(t={}){return new _(t)}E();const V={props:{componentPrefix:String,size:String,sizePrefix:String},computed:{sizeableClassPrefix(){return this.sizePrefix||this.componentPrefix},hasSizeablePrefix(){return this.size===void 0?!1:!!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`))},sizeableClass(){return this.size?!this.sizeableClassPrefix||this.hasSizeablePrefix?this.size:`${this.sizeableClassPrefix}-${this.size}`:""}}},D={props:{componentPrefix:String,variant:String,variantPrefix:String},computed:{variantClassPrefix(){return this.variantPrefix||this.componentPrefix},hasVariantPrefix(){return this.variant===void 0?!1:!!this.variant.match(new RegExp(`^${this.variantClassPrefix}`))},variantClass(){return this.variant?!this.variantClassPrefix||this.hasVariantPrefix?this.variant:`${this.variantClassPrefix}-${this.variant}`:""}}},H=e.defineComponent({mixins:[V,D],props:{active:Boolean,block:Boolean,componentPrefix:{type:String,default:"btn"},disabled:Boolean,label:String,outline:Boolean,tag:String,variant:{type:String,default:"primary"}},computed:{classes(){return["btn",this.variantClass,this.sizeableClass,this.active&&"active",this.block&&"btn-block",this.disabled&&"disabled"]},component(){return this.tag?this.tag:this.$attrs.href?"a":"button"},variantClassPrefix(){return(this.variantPrefix||this.componentPrefix)+(this.outline?"-outline":"")}}}),R=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s};function T(t,i,s,r,n,d){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),e.mergeProps(t.$attrs,{disabled:t.disabled,class:t.classes,role:"button"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])]),_:3},16,["disabled","class"])}const W=R(H,[["render",T]]),L=function(t){const i=parseFloat(t||0),s=t&&t.match(/m?s/),r=s?s[0]:!1;let n;switch(r){case"s":n=i*1e3;break;case"ms":default:n=i;break}return n||0},g=function(t,i){const s=(t.ownerDocument||document).defaultView;setTimeout(i,L(s==null?void 0:s.getComputedStyle(t).animationDuration))},I=e.defineComponent({components:{ActivityIndicator:z,Btn:W},inheritAttrs:!1,props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,indicator:{type:[Object,String],default:"spinner"},label:{type:String,default:void 0},orientation:{type:String,default:"right"},size:{type:String,default:"md"},tag:{type:String,default:void 0},variant:{type:String,default:"primary"}},emits:["click","hide-activity","show-activity"],data(){return{currentActivity:this.activity}},computed:{classes(){return{disabled:this.disabled,active:this.active,"btn-activity":this.activity,[`btn-activity-${this.orientation.replace("btn-activity-","")}`]:!!this.orientation,[`btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-","")}`]:!!this.indicatorProps.type}},indicatorProps(){return Object.assign({type:"spinner"},(typeof this.indicator=="string"?{type:this.indicator}:this.indicator)||{})}},watch:{activity(t){t?this.showActivity():this.hideActivity()}},mounted(){this.activity&&this.showActivity()},methods:{disable(){this.$el.disabled=!0,this.$el.classList.add("disabled")},enable(){this.$el.disabled=!1,this.$el.classList.remove("disabled")},hideActivity(){this.$el.classList.add("btn-hide-activity"),g(this.$el,()=>{this.disabled||this.enable(),this.currentActivity=!1,this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},showActivity(){this.currentActivity=!0,this.disable(),g(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}}),G="",M=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s};function Z(t,i,s,r,n,d){const h=e.resolveComponent("activity-indicator"),f=e.resolveComponent("btn");return e.openBlock(),e.createBlock(f,e.mergeProps({active:t.active,block:t.block,disabled:t.disabled,size:t.size,tag:t.tag,variant:t.variant,class:t.classes},Object.assign({},t.$attrs,{onClick:void 0}),{onClick:i[0]||(i[0]=p=>!t.disabled&&t.$emit("click",p,{disable:t.disable,enable:t.enable,toggle:t.toggle,showActivity:t.showActivity,hideActivity:t.hideActivity}))}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),e.createVNode(h,e.normalizeProps(e.guardReactiveProps(t.indicatorProps)),null,16)]),_:3},16,["active","block","disabled","size","tag","variant","class"])}const F=M(I,[["render",Z]]);a.BtnActivity=F,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -25,7 +25,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
25
25
  /**
26
26
  * The button label.
27
27
  */
28
- label: StringConstructor;
28
+ label: {
29
+ type: StringConstructor;
30
+ default: undefined;
31
+ };
29
32
  /**
30
33
  * The orientation of the activity button inside the button.
31
34
  */
@@ -43,7 +46,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
43
46
  /**
44
47
  * The HTML tag.
45
48
  */
46
- tag: StringConstructor;
49
+ tag: {
50
+ type: StringConstructor;
51
+ default: undefined;
52
+ };
47
53
  /**
48
54
  * The variant of the button.
49
55
  */
@@ -61,7 +67,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
61
67
  [x: string]: any;
62
68
  disabled: any;
63
69
  active: any;
64
- "btn-activity": any;
70
+ 'btn-activity': any;
65
71
  };
66
72
  indicatorProps(): any;
67
73
  }, {
@@ -85,7 +91,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
85
91
  * Show the activity indicator inside the button.
86
92
  */
87
93
  toggle(): void;
88
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
94
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "hide-activity" | "show-activity")[], "click" | "hide-activity" | "show-activity", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
89
95
  /**
90
96
  * Make the button appear with the active state.
91
97
  */
@@ -112,7 +118,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
112
118
  /**
113
119
  * The button label.
114
120
  */
115
- label: StringConstructor;
121
+ label: {
122
+ type: StringConstructor;
123
+ default: undefined;
124
+ };
116
125
  /**
117
126
  * The orientation of the activity button inside the button.
118
127
  */
@@ -130,7 +139,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
130
139
  /**
131
140
  * The HTML tag.
132
141
  */
133
- tag: StringConstructor;
142
+ tag: {
143
+ type: StringConstructor;
144
+ default: undefined;
145
+ };
134
146
  /**
135
147
  * The variant of the button.
136
148
  */
@@ -138,11 +150,17 @@ declare const _sfc_main: import("vue").DefineComponent<{
138
150
  type: StringConstructor;
139
151
  default: string;
140
152
  };
141
- }>>, {
153
+ }>> & {
154
+ onClick?: ((...args: any[]) => any) | undefined;
155
+ "onHide-activity"?: ((...args: any[]) => any) | undefined;
156
+ "onShow-activity"?: ((...args: any[]) => any) | undefined;
157
+ }, {
158
+ label: string;
142
159
  size: string;
143
160
  active: boolean;
144
161
  block: boolean;
145
162
  disabled: boolean;
163
+ tag: string;
146
164
  variant: string;
147
165
  activity: boolean;
148
166
  indicator: string | Record<string, any>;
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@vue-interface/btn-activity",
3
- "version": "2.0.0-beta.8",
3
+ "version": "2.0.0-beta.9",
4
4
  "description": "A Vue activity button component.",
5
5
  "type": "module",
6
6
  "files": [
7
- "index.js",
8
7
  "dist"
9
8
  ],
10
9
  "main": "./dist/btn-activity.umd.cjs",
@@ -54,6 +53,7 @@
54
53
  },
55
54
  "devDependencies": {
56
55
  "@vitejs/plugin-vue": "^3.1.2",
56
+ "@vue/eslint-config-typescript": "^11.0.2",
57
57
  "autoprefixer": "^10.4.2",
58
58
  "babel-eslint": "^10.1.0",
59
59
  "babel-preset-vue": "^2.0.2",