@vue-interface/btn-activity 2.0.0-beta.5 → 2.0.0-beta.6

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.
@@ -0,0 +1,392 @@
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";
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(), f(x(t.is()), {
82
+ key: 0,
83
+ class: "mx-auto"
84
+ })) : $("", !0),
85
+ t.label ? (a(), g("div", L, y(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, 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++;
108
+ for (; h.charAt(m - 1) === "\0"; )
109
+ m--;
110
+ return h.slice(v, m).split("\0").map(p).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(), f(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(y(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;
248
+ let s;
249
+ switch (n) {
250
+ case "s":
251
+ s = i * 1e3;
252
+ break;
253
+ case "ms":
254
+ default:
255
+ s = i;
256
+ break;
257
+ }
258
+ return s || 0;
259
+ }, z = function(t, i) {
260
+ const e = (t.ownerDocument || document).defaultView;
261
+ setTimeout(
262
+ i,
263
+ rt(
264
+ e == null ? void 0 : e.getComputedStyle(t).animationDuration
265
+ )
266
+ );
267
+ }, at = b({
268
+ inheritAttrs: !1,
269
+ components: {
270
+ ActivityIndicator: Z,
271
+ Btn: nt
272
+ },
273
+ props: {
274
+ active: Boolean,
275
+ activity: Boolean,
276
+ block: Boolean,
277
+ disabled: Boolean,
278
+ indicator: {
279
+ type: [Object, String],
280
+ default: "spinner"
281
+ },
282
+ label: String,
283
+ orientation: {
284
+ type: String,
285
+ default: "right"
286
+ },
287
+ size: {
288
+ type: String,
289
+ default: "md"
290
+ },
291
+ tag: String,
292
+ variant: {
293
+ type: String,
294
+ default: "primary"
295
+ }
296
+ },
297
+ data() {
298
+ return {
299
+ currentActivity: this.activity
300
+ };
301
+ },
302
+ computed: {
303
+ classes() {
304
+ return {
305
+ disabled: this.disabled,
306
+ active: this.active,
307
+ "btn-activity": this.activity,
308
+ [`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
313
+ };
314
+ },
315
+ indicatorProps() {
316
+ return Object.assign(
317
+ {
318
+ type: "spinner"
319
+ },
320
+ (typeof this.indicator == "string" ? {
321
+ type: this.indicator
322
+ } : this.indicator) || {}
323
+ );
324
+ }
325
+ },
326
+ watch: {
327
+ activity(t) {
328
+ t ? this.showActivity() : this.hideActivity();
329
+ }
330
+ },
331
+ mounted() {
332
+ this.activity && this.showActivity();
333
+ },
334
+ methods: {
335
+ disable() {
336
+ this.$el.disabled = !0, this.$el.classList.add("disabled");
337
+ },
338
+ enable() {
339
+ this.$el.disabled = !1, this.$el.classList.remove("disabled");
340
+ },
341
+ hideActivity() {
342
+ 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");
344
+ });
345
+ },
346
+ showActivity() {
347
+ this.currentActivity = !0, this.disable(), z(this.$el, () => {
348
+ this.$el.classList.add("btn-activity"), this.$emit("show-activity");
349
+ });
350
+ },
351
+ toggle() {
352
+ this.currentActivity ? this.hideActivity() : this.showActivity();
353
+ }
354
+ }
355
+ });
356
+ const ot = (t, i) => {
357
+ const e = t.__vccOpts || t;
358
+ for (const [n, s] of i)
359
+ e[n] = s;
360
+ return e;
361
+ };
362
+ function ct(t, i, e, n, s, o) {
363
+ const c = P("activity-indicator"), p = P("btn");
364
+ return a(), f(p, w({
365
+ active: t.active,
366
+ block: t.block,
367
+ disabled: t.disabled,
368
+ size: t.size,
369
+ tag: t.tag,
370
+ variant: t.variant,
371
+ class: t.classes,
372
+ onClick: i[0] || (i[0] = (l) => !t.disabled && t.$emit("click", l, {
373
+ disable: t.disable,
374
+ enable: t.enable,
375
+ toggle: t.toggle,
376
+ showActivity: t.showActivity,
377
+ hideActivity: t.hideActivity
378
+ }))
379
+ }, Object.assign({}, t.$attrs, { onClick: void 0 })), {
380
+ default: A(() => [
381
+ C(t.$slots, "default", {}, () => [
382
+ k(y(t.label), 1)
383
+ ]),
384
+ _(c, H(R(t.indicatorProps)), null, 16)
385
+ ]),
386
+ _: 3
387
+ }, 16, ["active", "block", "disabled", "size", "tag", "variant", "class"]);
388
+ }
389
+ const ht = /* @__PURE__ */ ot(at, [["render", ct]]);
390
+ export {
391
+ ht as BtnActivity
392
+ };
@@ -0,0 +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,234 +1,151 @@
1
- declare const _sfc_main: {
2
- name: string;
3
- components: {
4
- ActivityIndicator: {
5
- props: {
6
- absolute: BooleanConstructor;
7
- center: BooleanConstructor;
8
- label: StringConstructor;
9
- size: {
10
- type: StringConstructor;
11
- default: string;
12
- };
13
- registry: {
14
- type: StringConstructor;
15
- default: string;
16
- };
17
- type: {
18
- type: StringConstructor;
19
- required: boolean;
20
- };
21
- height: (StringConstructor | NumberConstructor)[];
22
- maxHeight: (StringConstructor | NumberConstructor)[];
23
- minHeight: (StringConstructor | NumberConstructor)[];
24
- width: (StringConstructor | NumberConstructor)[];
25
- maxWidth: (StringConstructor | NumberConstructor)[];
26
- minWidth: (StringConstructor | NumberConstructor)[];
27
- };
28
- data: () => {
29
- is: null;
30
- };
31
- setup(props: any): {
32
- registryInstance: unknown;
33
- };
34
- computed: {
35
- classes(): {
36
- [x: number]: boolean;
37
- 'activity-indicator-center': any;
38
- 'activity-indicator-absolute': any;
39
- };
40
- style(): {
41
- width: string | undefined;
42
- maxWidth: string | undefined;
43
- minWidth: string | undefined;
44
- height: string | undefined;
45
- maxHeight: string | undefined;
46
- minHeight: string | undefined;
47
- };
48
- };
49
- mounted(): Promise<void>;
50
- methods: {
51
- component(): Promise<any>;
52
- };
53
- };
54
- Btn: {
55
- name: string;
56
- mixins: ({
57
- props: {
58
- componentPrefix: StringConstructor;
59
- size: StringConstructor;
60
- sizePrefix: StringConstructor;
61
- };
62
- computed: {
63
- sizeableClassPrefix(): string | undefined;
64
- hasSizeablePrefix(): boolean;
65
- sizeableClass(): string;
66
- };
67
- } | {
68
- props: {
69
- componentPrefix: StringConstructor;
70
- variant: StringConstructor;
71
- variantPrefix: StringConstructor;
72
- };
73
- computed: {
74
- variantClassPrefix(): string | undefined;
75
- hasVariantPrefix(): boolean;
76
- variantClass(): string;
77
- };
78
- })[];
79
- props: {
80
- active: BooleanConstructor; /**
81
- * Make the button appear with the active state.
82
- *
83
- * @property {Boolean}
84
- */
85
- block: BooleanConstructor;
86
- componentPrefix: {
87
- type: StringConstructor;
88
- default: string;
89
- };
90
- disabled: BooleanConstructor;
91
- label: StringConstructor;
92
- outline: BooleanConstructor;
93
- tag: StringConstructor;
94
- variant: {
95
- type: StringConstructor;
96
- default: string;
97
- };
98
- };
99
- computed: {
100
- classes(): string[];
101
- component(): string;
102
- variantClassPrefix(): string;
103
- };
104
- };
1
+ declare const _sfc_main: import("vue").DefineComponent<{
2
+ /**
3
+ * Make the button appear with the active state.
4
+ */
5
+ active: BooleanConstructor;
6
+ /**
7
+ * Show the activity indicator inside the button.
8
+ */
9
+ activity: BooleanConstructor;
10
+ /**
11
+ * Display the button as block width.
12
+ */
13
+ block: BooleanConstructor;
14
+ /**
15
+ * Disable the button.
16
+ */
17
+ disabled: BooleanConstructor;
18
+ /**
19
+ * The type of activity indicator inside the button.
20
+ */
21
+ indicator: {
22
+ type: (StringConstructor | ObjectConstructor)[];
23
+ default: string;
105
24
  };
106
- props: {
107
- /**
108
- * Make the button appear with the active state.
109
- *
110
- * @property {Boolean}
111
- */
112
- active: BooleanConstructor;
113
- /**
114
- * Show the activity indicator inside the button.
115
- *
116
- * @property {Boolean}
117
- */
118
- activity: BooleanConstructor;
119
- /**
120
- * Display the button as block width.
121
- *
122
- * @property {Boolean}
123
- */
124
- block: BooleanConstructor;
125
- /**
126
- * Disable the button.
127
- *
128
- * @property {Boolean}
129
- */
130
- disabled: BooleanConstructor;
131
- /**
132
- * The type of activity indicator inside the button.
133
- *
134
- * @property {String}
135
- */
136
- indicator: {
137
- type: (ObjectConstructor | StringConstructor)[];
138
- default: string;
139
- };
140
- /**
141
- * The button label.
142
- *
143
- * @property {String}
144
- */
145
- label: StringConstructor;
146
- /**
147
- * The orientation of the activity button inside the button.
148
- *
149
- * @property {String}
150
- */
151
- orientation: {
152
- type: StringConstructor;
153
- default: string;
154
- };
155
- /**
156
- * The size of the button.
157
- *
158
- * @property {String}
159
- */
160
- size: {
161
- type: StringConstructor;
162
- default: string;
163
- };
164
- /**
165
- * The HTML tag.
166
- *
167
- * @property {String}
168
- */
169
- tag: StringConstructor;
170
- /**
171
- * The variant of the button.
172
- *
173
- * @property {String}
174
- */
175
- variant: {
176
- type: StringConstructor;
177
- default: string;
178
- };
25
+ /**
26
+ * The button label.
27
+ */
28
+ label: StringConstructor;
29
+ /**
30
+ * The orientation of the activity button inside the button.
31
+ */
32
+ orientation: {
33
+ type: StringConstructor;
34
+ default: string;
179
35
  };
180
- data(): {
181
- currentActivity: any;
36
+ /**
37
+ * The size of the button.
38
+ */
39
+ size: {
40
+ type: StringConstructor;
41
+ default: string;
182
42
  };
183
- computed: {
184
- /**
185
- * An object of classes to append to the button.
186
- *
187
- * @return void
188
- */
189
- classes(): {
190
- [x: string]: any;
191
- disabled: any;
192
- active: any;
193
- "btn-activity": any;
194
- };
195
- indicatorProps(): any;
43
+ /**
44
+ * The HTML tag.
45
+ */
46
+ tag: StringConstructor;
47
+ /**
48
+ * The variant of the button.
49
+ */
50
+ variant: {
51
+ type: StringConstructor;
52
+ default: string;
196
53
  };
197
- watch: {
198
- activity(value: boolean): void;
54
+ }, unknown, {
55
+ currentActivity: boolean;
56
+ }, {
57
+ /**
58
+ * An object of classes to append to the button.
59
+ */
60
+ classes(): {
61
+ [x: string]: any;
62
+ disabled: any;
63
+ active: any;
64
+ "btn-activity": any;
199
65
  };
200
- mounted(): void;
201
- methods: {
202
- /**
203
- * Disable the button.
204
- *
205
- * @return void
206
- */
207
- disable(): void;
208
- /**
209
- * Enable the button.
210
- *
211
- * @return void
212
- */
213
- enable(): void;
214
- /**
215
- * Hide the activity indicator inside the button.
216
- *
217
- * @return void
218
- */
219
- hideActivity(): void;
220
- /**
221
- * Show the activity indicator inside the button.
222
- *
223
- * @return void
224
- */
225
- showActivity(): void;
226
- /**
227
- * Show the activity indicator inside the button.
228
- *
229
- * @return void
230
- */
231
- toggle(): void;
66
+ indicatorProps(): any;
67
+ }, {
68
+ /**
69
+ * Disable the button.
70
+ */
71
+ disable(): void;
72
+ /**
73
+ * Enable the button.
74
+ */
75
+ enable(): void;
76
+ /**
77
+ * Hide the activity indicator inside the button.
78
+ */
79
+ hideActivity(): void;
80
+ /**
81
+ * Show the activity indicator inside the button.
82
+ */
83
+ showActivity(): void;
84
+ /**
85
+ * Show the activity indicator inside the button.
86
+ */
87
+ toggle(): void;
88
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
89
+ /**
90
+ * Make the button appear with the active state.
91
+ */
92
+ active: BooleanConstructor;
93
+ /**
94
+ * Show the activity indicator inside the button.
95
+ */
96
+ activity: BooleanConstructor;
97
+ /**
98
+ * Display the button as block width.
99
+ */
100
+ block: BooleanConstructor;
101
+ /**
102
+ * Disable the button.
103
+ */
104
+ disabled: BooleanConstructor;
105
+ /**
106
+ * The type of activity indicator inside the button.
107
+ */
108
+ indicator: {
109
+ type: (StringConstructor | ObjectConstructor)[];
110
+ default: string;
232
111
  };
233
- };
112
+ /**
113
+ * The button label.
114
+ */
115
+ label: StringConstructor;
116
+ /**
117
+ * The orientation of the activity button inside the button.
118
+ */
119
+ orientation: {
120
+ type: StringConstructor;
121
+ default: string;
122
+ };
123
+ /**
124
+ * The size of the button.
125
+ */
126
+ size: {
127
+ type: StringConstructor;
128
+ default: string;
129
+ };
130
+ /**
131
+ * The HTML tag.
132
+ */
133
+ tag: StringConstructor;
134
+ /**
135
+ * The variant of the button.
136
+ */
137
+ variant: {
138
+ type: StringConstructor;
139
+ default: string;
140
+ };
141
+ }>>, {
142
+ size: string;
143
+ active: boolean;
144
+ block: boolean;
145
+ disabled: boolean;
146
+ variant: string;
147
+ activity: boolean;
148
+ indicator: string | Record<string, any>;
149
+ orientation: string;
150
+ }>;
234
151
  export default _sfc_main;
File without changes
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@vue-interface/btn-activity",
3
- "version": "2.0.0-beta.5",
3
+ "version": "2.0.0-beta.6",
4
4
  "description": "A Vue activity button component.",
5
+ "type": "module",
5
6
  "files": [
6
7
  "index.js",
7
8
  "dist"
8
9
  ],
9
- "main": "./dist/btn-activity.umd.js",
10
- "module": "./dist/btn-activity.es.js",
10
+ "main": "./dist/btn-activity.umd.cjs",
11
+ "module": "./dist/btn-activity.js",
12
+ "style": "./dist/style.css",
11
13
  "types": "./dist/index.d.ts",
12
14
  "exports": {
13
15
  ".": {
14
- "import": "./dist/btn-activity.es.js",
15
- "require": "./dist/btn-activity.umd.js",
16
+ "import": "./dist/btn-activity.js",
17
+ "require": "./dist/btn-activity.umd.cjs",
16
18
  "types": "./dist/index.d.ts"
17
19
  }
18
20
  },
@@ -46,11 +48,10 @@
46
48
  },
47
49
  "homepage": "https://github.com/vue-interface/btn-activity/docs#readme",
48
50
  "dependencies": {
49
- "@vue-interface/activity-indicator": "^2.0.0-beta.4",
51
+ "@vue-interface/activity-indicator": "^2.0.0-beta.6",
50
52
  "@vue-interface/btn": "^3.0.0-beta.3"
51
53
  },
52
54
  "devDependencies": {
53
- "@rollup/plugin-babel": "^6.0.0",
54
55
  "@vitejs/plugin-vue": "^3.1.2",
55
56
  "autoprefixer": "^10.4.2",
56
57
  "babel-eslint": "^10.1.0",
@@ -1,303 +0,0 @@
1
- import { inject as P, openBlock as c, createElementBlock as h, normalizeClass as m, normalizeStyle as S, createElementVNode as z, createBlock as o, resolveDynamicComponent as y, createCommentVNode as d, toDisplayString as l, mergeProps as _, withCtx as b, renderSlot as f, createTextVNode as p, resolveComponent as u, createVNode as $, normalizeProps as C, guardReactiveProps as B } from "vue";
2
- function r(t, e = "px") {
3
- return t != null && t !== !1 && isFinite(t) ? `${t}${e}` : t;
4
- }
5
- const w = {
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: P(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
- }, A = (t, e) => {
67
- const i = t.__vccOpts || t;
68
- for (const [a, s] of e)
69
- i[a] = s;
70
- return i;
71
- }, k = {
72
- class: "activity-indicator-content"
73
- }, N = {
74
- key: 1,
75
- class: "activity-indicator-label"
76
- };
77
- function H(t, e, i, a, s, n) {
78
- return c(), h("div", {
79
- class: m(["activity-indicator", n.classes]),
80
- style: S(n.style)
81
- }, [z("div", k, [t.is ? (c(), o(y(t.is()), {
82
- key: 0,
83
- class: "mx-auto"
84
- })) : d("", !0), i.label ? (c(), h("div", N, l(i.label), 1)) : d("", !0)])], 6);
85
- }
86
- const O = /* @__PURE__ */ A(w, [["render", H]]), V = {
87
- props: {
88
- componentPrefix: String,
89
- size: String,
90
- sizePrefix: String
91
- },
92
- computed: {
93
- sizeableClassPrefix() {
94
- return this.sizePrefix || this.componentPrefix;
95
- },
96
- hasSizeablePrefix() {
97
- return this.size === void 0 ? !1 : !!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`));
98
- },
99
- sizeableClass() {
100
- return this.size ? !this.sizeableClassPrefix || this.hasSizeablePrefix ? this.size : `${this.sizeableClassPrefix}-${this.size}` : "";
101
- }
102
- }
103
- }, W = {
104
- props: {
105
- componentPrefix: String,
106
- variant: String,
107
- variantPrefix: String
108
- },
109
- computed: {
110
- variantClassPrefix() {
111
- return this.variantPrefix || this.componentPrefix;
112
- },
113
- hasVariantPrefix() {
114
- return this.variant === void 0 ? !1 : !!this.variant.match(new RegExp(`^${this.variantClassPrefix}`));
115
- },
116
- variantClass() {
117
- return this.variant ? !this.variantClassPrefix || this.hasVariantPrefix ? this.variant : `${this.variantClassPrefix}-${this.variant}` : "";
118
- }
119
- }
120
- }, D = {
121
- name: "Btn",
122
- mixins: [V, W],
123
- props: {
124
- active: Boolean,
125
- block: Boolean,
126
- componentPrefix: {
127
- type: String,
128
- default: "btn"
129
- },
130
- disabled: Boolean,
131
- label: String,
132
- outline: Boolean,
133
- tag: String,
134
- variant: {
135
- type: String,
136
- default: "primary"
137
- }
138
- },
139
- computed: {
140
- classes() {
141
- return ["btn", this.variantClass, this.sizeableClass, this.active && "active", this.block && "btn-block", this.disabled && "disabled"];
142
- },
143
- component() {
144
- return this.tag ? this.tag : this.$attrs.href ? "a" : "button";
145
- },
146
- variantClassPrefix() {
147
- return (this.variantPrefix || this.componentPrefix) + (this.outline ? "-outline" : "");
148
- }
149
- }
150
- }, E = (t, e) => {
151
- const i = t.__vccOpts || t;
152
- for (const [a, s] of e)
153
- i[a] = s;
154
- return i;
155
- };
156
- function L(t, e, i, a, s, n) {
157
- return c(), o(y(n.component), _(t.$attrs, {
158
- disabled: i.disabled,
159
- class: n.classes,
160
- role: "button"
161
- }), {
162
- default: b(() => [f(t.$slots, "default", {}, () => [p(l(i.label), 1)])]),
163
- _: 3
164
- }, 16, ["disabled", "class"]);
165
- }
166
- const j = /* @__PURE__ */ E(D, [["render", L]]), I = function(t) {
167
- const e = parseFloat(t || 0), i = t && t.match(/m?s/), a = i ? i[0] : !1;
168
- let s;
169
- switch (a) {
170
- case "s":
171
- s = e * 1e3;
172
- break;
173
- case "ms":
174
- default:
175
- s = e;
176
- break;
177
- }
178
- return s || 0;
179
- }, v = function(t, e) {
180
- const i = (t.ownerDocument || document).defaultView;
181
- setTimeout(
182
- e,
183
- I(i == null ? void 0 : i.getComputedStyle(t).animationDuration)
184
- );
185
- }, R = {
186
- name: "BtnActivity",
187
- components: {
188
- ActivityIndicator: O,
189
- Btn: j
190
- },
191
- props: {
192
- active: Boolean,
193
- activity: Boolean,
194
- block: Boolean,
195
- disabled: Boolean,
196
- indicator: {
197
- type: [Object, String],
198
- default: "spinner"
199
- },
200
- label: String,
201
- orientation: {
202
- type: String,
203
- default: "right"
204
- },
205
- size: {
206
- type: String,
207
- default: "md"
208
- },
209
- tag: String,
210
- variant: {
211
- type: String,
212
- default: "primary"
213
- }
214
- },
215
- data() {
216
- return {
217
- currentActivity: this.activity
218
- };
219
- },
220
- computed: {
221
- classes() {
222
- return {
223
- disabled: this.disabled,
224
- active: this.active,
225
- "btn-activity": this.activity,
226
- [`btn-activity-${this.orientation.replace("btn-activity-", "")}`]: !!this.orientation,
227
- [`'btn-activity-indicator-${this.indicatorProps.type.replace(
228
- "btn-activity-indicator-",
229
- ""
230
- )}`]: !!this.indicatorProps.type
231
- };
232
- },
233
- indicatorProps() {
234
- return Object.assign(
235
- {
236
- type: "spinner"
237
- },
238
- (typeof this.indicator == "string" ? {
239
- type: this.indicator
240
- } : this.indicator) || {}
241
- );
242
- }
243
- },
244
- watch: {
245
- activity(t) {
246
- t ? this.showActivity() : this.hideActivity();
247
- }
248
- },
249
- mounted() {
250
- this.activity && this.showActivity();
251
- },
252
- methods: {
253
- disable() {
254
- this.$el.disabled = !0, this.$el.classList.add("disabled");
255
- },
256
- enable() {
257
- this.$el.disabled = !1, this.$el.classList.remove("disabled");
258
- },
259
- hideActivity() {
260
- this.$el.classList.add("btn-hide-activity"), v(this.$el, () => {
261
- this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
262
- });
263
- },
264
- showActivity() {
265
- this.currentActivity = !0, this.disable(), v(this.$el, () => {
266
- this.$el.classList.add("btn-activity"), this.$emit("show-activity");
267
- });
268
- },
269
- toggle() {
270
- this.currentActivity ? this.hideActivity() : this.showActivity();
271
- }
272
- }
273
- };
274
- const T = (t, e) => {
275
- const i = t.__vccOpts || t;
276
- for (const [a, s] of e)
277
- i[a] = s;
278
- return i;
279
- };
280
- function F(t, e, i, a, s, n) {
281
- const g = u("activity-indicator"), x = u("btn");
282
- return c(), o(x, {
283
- active: i.active,
284
- block: i.block,
285
- disabled: i.disabled,
286
- size: i.size,
287
- tag: i.tag,
288
- variant: i.variant,
289
- class: m(n.classes)
290
- }, {
291
- default: b(() => [
292
- f(t.$slots, "default", {}, () => [
293
- p(l(i.label), 1)
294
- ]),
295
- $(g, C(B(n.indicatorProps)), null, 16)
296
- ]),
297
- _: 3
298
- }, 8, ["active", "block", "disabled", "size", "tag", "variant", "class"]);
299
- }
300
- const G = /* @__PURE__ */ T(R, [["render", F]]);
301
- export {
302
- G as BtnActivity
303
- };
@@ -1 +0,0 @@
1
- (function(o,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(o=typeof globalThis<"u"?globalThis:o||self,i(o.BtnActivity={},o.Vue))})(this,function(o,i){"use strict";function c(t,s="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${s}`:t}const d={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:i.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:c(this.width),maxWidth:c(this.maxWidth),minWidth:c(this.minWidth),height:c(this.height),maxHeight:c(this.maxHeight),minHeight:c(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)}}},h=(t,s)=>{const e=t.__vccOpts||t;for(const[a,n]of s)e[a]=n;return e},m={class:"activity-indicator-content"},y={key:1,class:"activity-indicator-label"};function f(t,s,e,a,n,r){return i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["activity-indicator",r.classes]),style:i.normalizeStyle(r.style)},[i.createElementVNode("div",m,[t.is?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(t.is()),{key:0,class:"mx-auto"})):i.createCommentVNode("",!0),e.label?(i.openBlock(),i.createElementBlock("div",y,i.toDisplayString(e.label),1)):i.createCommentVNode("",!0)])],6)}const p=h(d,[["render",f]]),b={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}`:""}}},u={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}`:""}}},g={name:"Btn",mixins:[b,u],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":"")}}},v=(t,s)=>{const e=t.__vccOpts||t;for(const[a,n]of s)e[a]=n;return e};function x(t,s,e,a,n,r){return i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.component),i.mergeProps(t.$attrs,{disabled:e.disabled,class:r.classes,role:"button"}),{default:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(e.label),1)])]),_:3},16,["disabled","class"])}const S=v(g,[["render",x]]),P=function(t){const s=parseFloat(t||0),e=t&&t.match(/m?s/),a=e?e[0]:!1;let n;switch(a){case"s":n=s*1e3;break;case"ms":default:n=s;break}return n||0},l=function(t,s){const e=(t.ownerDocument||document).defaultView;setTimeout(s,P(e==null?void 0:e.getComputedStyle(t).animationDuration))},z={name:"BtnActivity",components:{ActivityIndicator:p,Btn:S},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"),l(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(),l(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}},A="",_=(t,s)=>{const e=t.__vccOpts||t;for(const[a,n]of s)e[a]=n;return e};function B(t,s,e,a,n,r){const k=i.resolveComponent("activity-indicator"),$=i.resolveComponent("btn");return i.openBlock(),i.createBlock($,{active:e.active,block:e.block,disabled:e.disabled,size:e.size,tag:e.tag,variant:e.variant,class:i.normalizeClass(r.classes)},{default:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(e.label),1)]),i.createVNode(k,i.normalizeProps(i.guardReactiveProps(r.indicatorProps)),null,16)]),_:3},8,["active","block","disabled","size","tag","variant","class"])}const C=_(z,[["render",B]]);o.BtnActivity=C,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});