@vue-interface/btn-activity 2.0.0-beta.10 → 2.0.0-beta.12

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,273 +1,31 @@
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
- function r(t, i = "px") {
3
- return t != null && t !== !1 && isFinite(t) ? `${t}${i}` : t;
4
- }
5
- const V = b({
6
- props: {
7
- absolute: Boolean,
8
- center: Boolean,
9
- label: String,
10
- size: {
11
- type: String,
12
- default: "md"
13
- },
14
- registry: {
15
- type: String,
16
- default: "indicators"
17
- },
18
- type: {
19
- type: String,
20
- required: !0
21
- },
22
- height: [String, Number],
23
- maxHeight: [String, Number],
24
- minHeight: [String, Number],
25
- width: [String, Number],
26
- maxWidth: [String, Number],
27
- minWidth: [String, Number]
28
- },
29
- data: () => ({
30
- is: null
31
- }),
32
- setup(t) {
33
- return {
34
- registryInstance: O(t.registry || "indicators")
35
- };
36
- },
37
- computed: {
38
- classes() {
39
- return {
40
- "activity-indicator-center": this.center,
41
- "activity-indicator-absolute": this.absolute,
42
- [this.size && `activity-indicator-${this.size}`]: !!this.size
43
- };
44
- },
45
- style() {
46
- return {
47
- width: r(this.width),
48
- maxWidth: r(this.maxWidth),
49
- minWidth: r(this.minWidth),
50
- height: r(this.height),
51
- maxHeight: r(this.maxHeight),
52
- minHeight: r(this.minHeight)
53
- };
54
- }
55
- },
56
- async mounted() {
57
- const t = await this.component();
58
- this.is = () => t;
59
- },
60
- methods: {
61
- async component() {
62
- let t = this.registryInstance.get(this.type);
63
- return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
64
- }
65
- }
66
- }), W = (t, i) => {
67
- const e = t.__vccOpts || t;
68
- for (const [n, s] of i)
69
- e[n] = s;
70
- return e;
71
- }, D = { class: "activity-indicator-content" }, L = {
72
- key: 1,
73
- class: "activity-indicator-label"
74
- };
75
- function I(t, i, e, n, s, o) {
76
- return a(), g("div", {
77
- class: j(["activity-indicator", t.classes]),
78
- style: N(t.style)
79
- }, [
80
- E("div", D, [
81
- t.is ? (a(), y(x(t.is()), {
82
- key: 0,
83
- class: "mx-auto"
84
- })) : $("", !0),
85
- t.label ? (a(), g("div", L, f(t.label), 1)) : $("", !0)
86
- ])
87
- ], 6);
88
- }
89
- const Z = /* @__PURE__ */ W(V, [["render", I]]);
90
- var F = Object.defineProperty, M = (t, i, e) => i in t ? F(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, T = (t, i, e) => (M(t, typeof i != "symbol" ? i + "" : i, e), e), u = function() {
91
- return u = Object.assign || function(t) {
92
- for (var i, e = 1, n = arguments.length; e < n; e++) {
93
- i = arguments[e];
94
- for (var s in i)
95
- Object.prototype.hasOwnProperty.call(i, s) && (t[s] = i[s]);
96
- }
97
- return t;
98
- }, u.apply(this, arguments);
99
- };
100
- function q(t) {
101
- return t.toLowerCase();
102
- }
103
- var G = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
104
- function K(t, i) {
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, 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
- for (; h.charAt(m - 1) === "\0"; )
109
- m--;
110
- return h.slice(p, m).split("\0").map(v).join(B);
111
- }
112
- function S(t, i, e) {
113
- return i instanceof RegExp ? t.replace(i, e) : i.reduce(function(n, s) {
114
- return n.replace(s, e);
115
- }, t);
116
- }
117
- function Q(t, i) {
118
- return i === void 0 && (i = {}), K(t, u({ delimiter: "." }, i));
119
- }
120
- function d(t, i) {
121
- return i === void 0 && (i = {}), Q(t, u({ delimiter: "-" }, i));
122
- }
123
- class U {
124
- constructor(i = {}) {
125
- T(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(i).forEach(([e, n]) => {
126
- this.register(e, n);
127
- });
128
- }
129
- get(i) {
130
- const e = this.components.get(
131
- i = d(i)
132
- );
133
- if (e)
134
- return e;
135
- throw new Error(`"${i}" has not been registered yet!`);
136
- }
137
- register(i, e) {
138
- return typeof i == "object" ? (Object.entries(i).forEach(([n, s]) => {
139
- this.register(d(n), s);
140
- }), this) : (this.components.set(d(i), e), this);
141
- }
142
- remove(i) {
143
- return this.components.delete(d(i)), this;
144
- }
145
- reset() {
146
- return this.components = /* @__PURE__ */ new Map(), this;
147
- }
148
- }
149
- function X(t = {}) {
150
- return new U(t);
151
- }
152
- X();
153
- const Y = {
154
- props: {
155
- componentPrefix: String,
156
- size: String,
157
- sizePrefix: String
158
- },
159
- computed: {
160
- sizeableClassPrefix() {
161
- return this.sizePrefix || this.componentPrefix;
162
- },
163
- hasSizeablePrefix() {
164
- return this.size === void 0 ? !1 : !!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`));
165
- },
166
- sizeableClass() {
167
- return this.size ? !this.sizeableClassPrefix || this.hasSizeablePrefix ? this.size : `${this.sizeableClassPrefix}-${this.size}` : "";
168
- }
169
- }
170
- }, tt = {
171
- props: {
172
- componentPrefix: String,
173
- variant: String,
174
- variantPrefix: String
175
- },
176
- computed: {
177
- variantClassPrefix() {
178
- return this.variantPrefix || this.componentPrefix;
179
- },
180
- hasVariantPrefix() {
181
- return this.variant === void 0 ? !1 : !!this.variant.match(new RegExp(`^${this.variantClassPrefix}`));
182
- },
183
- variantClass() {
184
- return this.variant ? !this.variantClassPrefix || this.hasVariantPrefix ? this.variant : `${this.variantClassPrefix}-${this.variant}` : "";
185
- }
186
- }
187
- }, it = b({
188
- mixins: [
189
- Y,
190
- tt
191
- ],
192
- props: {
193
- active: Boolean,
194
- block: Boolean,
195
- componentPrefix: {
196
- type: String,
197
- default: "btn"
198
- },
199
- disabled: Boolean,
200
- label: String,
201
- outline: Boolean,
202
- tag: String,
203
- variant: {
204
- type: String,
205
- default: "primary"
206
- }
207
- },
208
- computed: {
209
- classes() {
210
- return [
211
- "btn",
212
- this.variantClass,
213
- this.sizeableClass,
214
- this.active && "active",
215
- this.block && "btn-block",
216
- this.disabled && "disabled"
217
- ];
218
- },
219
- component() {
220
- return this.tag ? this.tag : this.$attrs.href ? "a" : "button";
221
- },
222
- variantClassPrefix() {
223
- return (this.variantPrefix || this.componentPrefix) + (this.outline ? "-outline" : "");
224
- }
225
- }
226
- }), et = (t, i) => {
227
- const e = t.__vccOpts || t;
228
- for (const [n, s] of i)
229
- e[n] = s;
230
- return e;
231
- };
232
- function st(t, i, e, n, s, o) {
233
- return a(), y(x(t.component), w(t.$attrs, {
234
- disabled: t.disabled,
235
- class: t.classes,
236
- role: "button"
237
- }), {
238
- default: A(() => [
239
- C(t.$slots, "default", {}, () => [
240
- k(f(t.label), 1)
241
- ])
242
- ]),
243
- _: 3
244
- }, 16, ["disabled", "class"]);
245
- }
246
- const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
247
- const i = parseFloat(t || 0), e = t && t.match(/m?s/), n = e ? e[0] : !1;
1
+ import { ActivityIndicator as d } from "@vue-interface/activity-indicator";
2
+ import { Btn as v } from "@vue-interface/btn";
3
+ import { defineComponent as h, resolveComponent as n, openBlock as y, createBlock as p, mergeProps as b, withCtx as m, renderSlot as u, createTextVNode as f, toDisplayString as g, createVNode as A, normalizeProps as $, guardReactiveProps as k } from "vue";
4
+ const w = function(t) {
5
+ const e = parseFloat(t || 0), i = t && t.match(/m?s/), a = i ? i[0] : !1;
248
6
  let s;
249
- switch (n) {
7
+ switch (a) {
250
8
  case "s":
251
- s = i * 1e3;
9
+ s = e * 1e3;
252
10
  break;
253
11
  case "ms":
254
12
  default:
255
- s = i;
13
+ s = e;
256
14
  break;
257
15
  }
258
16
  return s || 0;
259
- }, z = function(t, i) {
260
- const e = (t.ownerDocument || document).defaultView;
17
+ }, o = function(t, e) {
18
+ const i = (t.ownerDocument || document).defaultView;
261
19
  setTimeout(
262
- i,
263
- rt(
264
- e == null ? void 0 : e.getComputedStyle(t).animationDuration
20
+ e,
21
+ w(
22
+ i == null ? void 0 : i.getComputedStyle(t).animationDuration
265
23
  )
266
24
  );
267
- }, at = b({
25
+ }, B = h({
268
26
  components: {
269
- ActivityIndicator: Z,
270
- Btn: nt
27
+ ActivityIndicator: d,
28
+ Btn: v
271
29
  },
272
30
  inheritAttrs: !1,
273
31
  props: {
@@ -385,7 +143,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
385
143
  * Hide the activity indicator inside the button.
386
144
  */
387
145
  hideActivity() {
388
- this.$el.classList.add("btn-hide-activity"), z(this.$el, () => {
146
+ this.$el.classList.add("btn-hide-activity"), o(this.$el, () => {
389
147
  this.disabled || this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
390
148
  });
391
149
  },
@@ -393,7 +151,7 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
393
151
  * Show the activity indicator inside the button.
394
152
  */
395
153
  showActivity() {
396
- this.currentActivity = !0, this.disable(), z(this.$el, () => {
154
+ this.currentActivity = !0, this.disable(), o(this.$el, () => {
397
155
  this.$el.classList.add("btn-activity"), this.$emit("show-activity");
398
156
  });
399
157
  },
@@ -405,15 +163,15 @@ const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
405
163
  }
406
164
  }
407
165
  });
408
- const ot = (t, i) => {
409
- const e = t.__vccOpts || t;
410
- for (const [n, s] of i)
411
- e[n] = s;
412
- return e;
166
+ const S = (t, e) => {
167
+ const i = t.__vccOpts || t;
168
+ for (const [a, s] of e)
169
+ i[a] = s;
170
+ return i;
413
171
  };
414
- function ct(t, i, e, n, s, o) {
415
- const c = P("activity-indicator"), v = P("btn");
416
- return a(), y(v, w({
172
+ function P(t, e, i, a, s, C) {
173
+ const c = n("activity-indicator"), r = n("btn");
174
+ return y(), p(r, b({
417
175
  active: t.active,
418
176
  block: t.block,
419
177
  disabled: t.disabled,
@@ -422,7 +180,7 @@ function ct(t, i, e, n, s, o) {
422
180
  variant: t.variant,
423
181
  class: t.classes
424
182
  }, Object.assign({}, t.$attrs, { onClick: void 0 }), {
425
- onClick: i[0] || (i[0] = (l) => !t.disabled && t.$emit("click", l, {
183
+ onClick: e[0] || (e[0] = (l) => !t.disabled && t.$emit("click", l, {
426
184
  disable: t.disable,
427
185
  enable: t.enable,
428
186
  toggle: t.toggle,
@@ -430,16 +188,16 @@ function ct(t, i, e, n, s, o) {
430
188
  hideActivity: t.hideActivity
431
189
  }))
432
190
  }), {
433
- default: A(() => [
434
- C(t.$slots, "default", {}, () => [
435
- k(f(t.label), 1)
191
+ default: m(() => [
192
+ u(t.$slots, "default", {}, () => [
193
+ f(g(t.label), 1)
436
194
  ]),
437
- _(c, H(R(t.indicatorProps)), null, 16)
195
+ A(c, $(k(t.indicatorProps)), null, 16)
438
196
  ]),
439
197
  _: 3
440
198
  }, 16, ["active", "block", "disabled", "size", "tag", "variant", "class"]);
441
199
  }
442
- const ht = /* @__PURE__ */ ot(at, [["render", ct]]);
200
+ const O = /* @__PURE__ */ S(B, [["render", P]]);
443
201
  export {
444
- ht as BtnActivity
202
+ O as BtnActivity
445
203
  };
@@ -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,w=(t,i,n)=>i in t?C(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,A=(t,i,n)=>(w(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 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 n=i.splitRegexp,r=n===void 0?B:n,s=i.stripRegexp,d=s===void 0?j:s,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,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 E{constructor(i={}){A(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 V(t={}){return new E(t)}V();const D={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}`:""}}},_={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:[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({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="",Z=(t,i)=>{const n=t.__vccOpts||t;for(const[r,s]of i)n[r]=s;return n};function M(t,i,n,r,s,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=Z(I,[["render",M]]);a.BtnActivity=F,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@vue-interface/activity-indicator"),require("@vue-interface/btn"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@vue-interface/activity-indicator","@vue-interface/btn","vue"],o):(n=typeof globalThis<"u"?globalThis:n||self,o(n.BtnActivity={},n.VueInterfaceActivityIndicator,n.VueInterfaceBtn,n.Vue))})(this,function(n,o,d,i){"use strict";const l=function(t){const s=parseFloat(t||0),e=t&&t.match(/m?s/),c=e?e[0]:!1;let a;switch(c){case"s":a=s*1e3;break;case"ms":default:a=s;break}return a||0},r=function(t,s){const e=(t.ownerDocument||document).defaultView;setTimeout(s,l(e==null?void 0:e.getComputedStyle(t).animationDuration))},y=i.defineComponent({components:{ActivityIndicator:o.ActivityIndicator,Btn:d.Btn},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"),r(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(),r(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}}),m="",v=(t,s)=>{const e=t.__vccOpts||t;for(const[c,a]of s)e[c]=a;return e};function h(t,s,e,c,a,g){const u=i.resolveComponent("activity-indicator"),b=i.resolveComponent("btn");return i.openBlock(),i.createBlock(b,i.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:s[0]||(s[0]=f=>!t.disabled&&t.$emit("click",f,{disable:t.disable,enable:t.enable,toggle:t.toggle,showActivity:t.showActivity,hideActivity:t.hideActivity}))}),{default:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(t.label),1)]),i.createVNode(u,i.normalizeProps(i.guardReactiveProps(t.indicatorProps)),null,16)]),_:3},16,["active","block","disabled","size","tag","variant","class"])}const p=v(y,[["render",h]]);n.BtnActivity=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/btn-activity",
3
- "version": "2.0.0-beta.10",
3
+ "version": "2.0.0-beta.12",
4
4
  "description": "A Vue activity button component.",
5
5
  "type": "module",
6
6
  "files": [