@vue-interface/btn-activity 1.1.0 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,308 +1,93 @@
1
- function _typeof(obj) {
2
- "@babel/helpers - typeof";
3
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
4
- return typeof obj2;
5
- } : function(obj2) {
6
- return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
7
- }, _typeof(obj);
8
- }
9
- function _classCallCheck(instance, Constructor) {
10
- if (!(instance instanceof Constructor)) {
11
- throw new TypeError("Cannot call a class as a function");
12
- }
13
- }
14
- function _defineProperties(target, props) {
15
- for (var i = 0; i < props.length; i++) {
16
- var descriptor = props[i];
17
- descriptor.enumerable = descriptor.enumerable || false;
18
- descriptor.configurable = true;
19
- if ("value" in descriptor)
20
- descriptor.writable = true;
21
- Object.defineProperty(target, descriptor.key, descriptor);
22
- }
23
- }
24
- function _createClass(Constructor, protoProps, staticProps) {
25
- if (protoProps)
26
- _defineProperties(Constructor.prototype, protoProps);
27
- if (staticProps)
28
- _defineProperties(Constructor, staticProps);
29
- Object.defineProperty(Constructor, "prototype", {
30
- writable: false
31
- });
32
- return Constructor;
33
- }
34
- function _setPrototypeOf(o, p) {
35
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
36
- o2.__proto__ = p2;
37
- return o2;
38
- };
39
- return _setPrototypeOf(o, p);
40
- }
41
- function _isNativeReflectConstruct() {
42
- if (typeof Reflect === "undefined" || !Reflect.construct)
43
- return false;
44
- if (Reflect.construct.sham)
45
- return false;
46
- if (typeof Proxy === "function")
47
- return true;
48
- try {
49
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
50
- }));
51
- return true;
52
- } catch (e) {
53
- return false;
54
- }
55
- }
56
- function _construct(Parent, args, Class) {
57
- if (_isNativeReflectConstruct()) {
58
- _construct = Reflect.construct;
59
- } else {
60
- _construct = function _construct2(Parent2, args2, Class2) {
61
- var a = [null];
62
- a.push.apply(a, args2);
63
- var Constructor = Function.bind.apply(Parent2, a);
64
- var instance = new Constructor();
65
- if (Class2)
66
- _setPrototypeOf(instance, Class2.prototype);
67
- return instance;
68
- };
69
- }
70
- return _construct.apply(null, arguments);
71
- }
72
- function _slicedToArray(arr, i) {
73
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
74
- }
75
- function _arrayWithHoles(arr) {
76
- if (Array.isArray(arr))
77
- return arr;
78
- }
79
- function _iterableToArrayLimit(arr, i) {
80
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
81
- if (_i == null)
82
- return;
83
- var _arr = [];
84
- var _n = true;
85
- var _d = false;
86
- var _s, _e;
87
- try {
88
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
89
- _arr.push(_s.value);
90
- if (i && _arr.length === i)
91
- break;
92
- }
93
- } catch (err) {
94
- _d = true;
95
- _e = err;
96
- } finally {
97
- try {
98
- if (!_n && _i["return"] != null)
99
- _i["return"]();
100
- } finally {
101
- if (_d)
102
- throw _e;
103
- }
104
- }
105
- return _arr;
106
- }
107
- function _unsupportedIterableToArray(o, minLen) {
108
- if (!o)
109
- return;
110
- if (typeof o === "string")
111
- return _arrayLikeToArray(o, minLen);
112
- var n = Object.prototype.toString.call(o).slice(8, -1);
113
- if (n === "Object" && o.constructor)
114
- n = o.constructor.name;
115
- if (n === "Map" || n === "Set")
116
- return Array.from(o);
117
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
118
- return _arrayLikeToArray(o, minLen);
119
- }
120
- function _arrayLikeToArray(arr, len) {
121
- if (len == null || len > arr.length)
122
- len = arr.length;
123
- for (var i = 0, arr2 = new Array(len); i < len; i++)
124
- arr2[i] = arr[i];
125
- return arr2;
126
- }
127
- function _nonIterableRest() {
128
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
129
- }
130
- var _assign = function __assign() {
131
- _assign = Object.assign || function __assign22(t) {
132
- for (var s, i = 1, n = arguments.length; i < n; i++) {
133
- s = arguments[i];
134
- for (var p in s) {
135
- if (Object.prototype.hasOwnProperty.call(s, p))
136
- t[p] = s[p];
137
- }
1
+ import { openBlock as c, createElementBlock as d, normalizeClass as m, normalizeStyle as $, createElementVNode as k, createBlock as P, resolveDynamicComponent as z, createCommentVNode as p, toDisplayString as S, resolveComponent as B, createTextVNode as E, renderSlot as D, createVNode as N, normalizeProps as O, guardReactiveProps as R } from "vue";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+ var u = function() {
17
+ return u = Object.assign || function(e) {
18
+ for (var i, n = 1, s = arguments.length; n < s; n++) {
19
+ i = arguments[n];
20
+ for (var r in i)
21
+ Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r]);
138
22
  }
139
- return t;
140
- };
141
- return _assign.apply(this, arguments);
23
+ return e;
24
+ }, u.apply(this, arguments);
142
25
  };
143
- function lowerCase$1(str) {
144
- return str.toLowerCase();
26
+ function j(t) {
27
+ return t.toLowerCase();
145
28
  }
146
- var DEFAULT_SPLIT_REGEXP$1 = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
147
- var DEFAULT_STRIP_REGEXP$1 = /[^A-Z0-9]+/gi;
148
- function noCase$1(input, options) {
149
- if (options === void 0) {
150
- options = {};
151
- }
152
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP$1 : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP$1 : _b, _c = options.transform, transform = _c === void 0 ? lowerCase$1 : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
153
- var result = replace$1(replace$1(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
154
- var start = 0;
155
- var end = result.length;
156
- while (result.charAt(start) === "\0") {
157
- start++;
158
- }
159
- while (result.charAt(end - 1) === "\0") {
160
- end--;
161
- }
162
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
29
+ var T = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], F = /[^A-Z0-9]+/gi;
30
+ function L(t, e) {
31
+ e === void 0 && (e = {});
32
+ for (var i = e.splitRegexp, n = i === void 0 ? T : i, s = e.stripRegexp, r = s === void 0 ? F : s, o = e.transform, h = o === void 0 ? j : o, g = e.delimiter, C = g === void 0 ? " " : g, l = f(f(t, n, "$1\0$2"), r, "\0"), y = 0, v = l.length; l.charAt(y) === "\0"; )
33
+ y++;
34
+ for (; l.charAt(v - 1) === "\0"; )
35
+ v--;
36
+ return l.slice(y, v).split("\0").map(h).join(C);
163
37
  }
164
- function replace$1(input, re, value) {
165
- if (re instanceof RegExp)
166
- return input.replace(re, value);
167
- return re.reduce(function(input2, re2) {
168
- return input2.replace(re2, value);
169
- }, input);
38
+ function f(t, e, i) {
39
+ return e instanceof RegExp ? t.replace(e, i) : e.reduce(function(n, s) {
40
+ return n.replace(s, i);
41
+ }, t);
170
42
  }
171
- function dotCase$1(input, options) {
172
- if (options === void 0) {
173
- options = {};
174
- }
175
- return noCase$1(input, _assign({
43
+ function H(t, e) {
44
+ return e === void 0 && (e = {}), L(t, u({
176
45
  delimiter: "."
177
- }, options));
46
+ }, e));
178
47
  }
179
- function paramCase$1(input, options) {
180
- if (options === void 0) {
181
- options = {};
182
- }
183
- return dotCase$1(input, _assign({
48
+ function _(t, e) {
49
+ return e === void 0 && (e = {}), H(t, u({
184
50
  delimiter: "-"
185
- }, options));
51
+ }, e));
186
52
  }
187
- var ComponentRegistry = /* @__PURE__ */ function() {
188
- function ComponentRegistry2() {
189
- var _this = this;
190
- var components = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
191
- _classCallCheck(this, ComponentRegistry2);
192
- this.components = {};
193
- Object.entries(components).forEach(function(_ref) {
194
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
195
- _this.register(key, value);
53
+ class w {
54
+ constructor(e = {}) {
55
+ this.components = /* @__PURE__ */ new Map(), Object.entries(e).forEach(([i, n]) => {
56
+ this.register(i, n);
196
57
  });
197
58
  }
198
- _createClass(ComponentRegistry2, [{
199
- key: "get",
200
- value: function get(name) {
201
- var match = this.components[name = paramCase$1(name)];
202
- if (match) {
203
- return match;
204
- }
205
- throw new Error('"'.concat(name, '" has not been registered yet!'));
206
- }
207
- }, {
208
- key: "register",
209
- value: function register(name, value) {
210
- var _this2 = this;
211
- if (_typeof(name) === "object") {
212
- Object.entries(name).forEach(function(_ref3) {
213
- var _ref4 = _slicedToArray(_ref3, 2), name2 = _ref4[0], module = _ref4[1];
214
- _this2.register(paramCase$1(name2), module);
215
- });
216
- return this;
217
- }
218
- this.components[paramCase$1(name)] = value;
219
- return this;
220
- }
221
- }, {
222
- key: "remove",
223
- value: function remove(name) {
224
- delete this.components[paramCase$1(name)];
225
- return this;
226
- }
227
- }, {
228
- key: "reset",
229
- value: function reset() {
230
- this.components = {};
231
- return this;
232
- }
233
- }]);
234
- return ComponentRegistry2;
235
- }();
236
- function factory() {
237
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
238
- args[_key] = arguments[_key];
59
+ get(e) {
60
+ const i = this.components.get(e = _(e));
61
+ if (i)
62
+ return i;
63
+ throw new Error(`"${e}" has not been registered yet!`);
239
64
  }
240
- return _construct(ComponentRegistry, args);
241
- }
242
- const registry = factory();
243
- var render$2 = function() {
244
- var _vm = this;
245
- var _h = _vm.$createElement;
246
- var _c = _vm._self._c || _h;
247
- return _c("div", { staticClass: "activity-indicator", class: _vm.classes, style: _vm.style }, [_c("div", { staticClass: "activity-indicator-content" }, [_c(_vm.component, { tag: "component", staticClass: "mx-auto" }), _vm.label ? _c("div", { staticClass: "activity-indicator-label" }, [_vm._v(" " + _vm._s(_vm.label) + " ")]) : _vm._e()], 1)]);
248
- };
249
- var staticRenderFns$2 = [];
250
- var ActivityIndicator_vue_vue_type_style_index_0_lang = "";
251
- function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
252
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
253
- if (render2) {
254
- options.render = render2;
255
- options.staticRenderFns = staticRenderFns2;
256
- options._compiled = true;
257
- }
258
- if (functionalTemplate) {
259
- options.functional = true;
65
+ register(e, i) {
66
+ return typeof e == "object" ? (Object.entries(e).forEach(([n, s]) => {
67
+ this.register(_(n), s);
68
+ }), this) : (this.components.set(_(e), i), this);
260
69
  }
261
- if (scopeId) {
262
- options._scopeId = "data-v-" + scopeId;
263
- }
264
- var hook;
265
- if (moduleIdentifier) {
266
- hook = function(context) {
267
- context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
268
- if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
269
- context = __VUE_SSR_CONTEXT__;
270
- }
271
- if (injectStyles) {
272
- injectStyles.call(this, context);
273
- }
274
- if (context && context._registeredComponents) {
275
- context._registeredComponents.add(moduleIdentifier);
276
- }
277
- };
278
- options._ssrRegister = hook;
279
- } else if (injectStyles) {
280
- hook = shadowMode ? function() {
281
- injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
282
- } : injectStyles;
70
+ remove(e) {
71
+ return this.components.delete(_(e)), this;
283
72
  }
284
- if (hook) {
285
- if (options.functional) {
286
- options._injectStyles = hook;
287
- var originalRender = options.render;
288
- options.render = function renderWithStyleInjection(h, context) {
289
- hook.call(context);
290
- return originalRender(h, context);
291
- };
292
- } else {
293
- var existing = options.beforeCreate;
294
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
295
- }
73
+ reset() {
74
+ return this.components = /* @__PURE__ */ new Map(), this;
296
75
  }
297
- return {
298
- exports: scriptExports,
299
- options
300
- };
301
76
  }
302
- function unit(value, uom = "px") {
303
- return value !== null && value !== void 0 && value !== false && isFinite(value) ? `${value}${uom}` : value;
77
+ function I(...t) {
78
+ return new w(...t);
79
+ }
80
+ const b = I();
81
+ const A = (t, e) => {
82
+ const i = t.__vccOpts || t;
83
+ for (const [n, s] of e)
84
+ i[n] = s;
85
+ return i;
86
+ };
87
+ function a(t, e = "px") {
88
+ return t != null && t !== !1 && isFinite(t) ? `${t}${e}` : t;
304
89
  }
305
- const __vue2_script$2 = {
90
+ const V = {
306
91
  name: "ActivityIndicator",
307
92
  props: {
308
93
  absolute: Boolean,
@@ -313,14 +98,14 @@ const __vue2_script$2 = {
313
98
  default: "md"
314
99
  },
315
100
  registry: {
316
- type: ComponentRegistry,
101
+ type: w,
317
102
  default() {
318
- return registry;
103
+ return b;
319
104
  }
320
105
  },
321
106
  type: {
322
107
  type: String,
323
- required: true
108
+ required: !0
324
109
  },
325
110
  height: [String, Number],
326
111
  maxHeight: [String, Number],
@@ -329,6 +114,9 @@ const __vue2_script$2 = {
329
114
  maxWidth: [String, Number],
330
115
  minWidth: [String, Number]
331
116
  },
117
+ data: () => ({
118
+ is: null
119
+ }),
332
120
  computed: {
333
121
  classes() {
334
122
  return {
@@ -339,377 +127,154 @@ const __vue2_script$2 = {
339
127
  },
340
128
  style() {
341
129
  return {
342
- width: unit(this.width),
343
- maxWidth: unit(this.maxWidth),
344
- minWidth: unit(this.minWidth),
345
- height: unit(this.height),
346
- maxHeight: unit(this.maxHeight),
347
- minHeight: unit(this.minHeight)
348
- };
349
- },
350
- component() {
351
- return () => {
352
- const component = registry.get(this.type);
353
- if (component instanceof Promise) {
354
- return component;
355
- }
356
- if (typeof component === "function") {
357
- return component();
358
- }
359
- return Promise.resolve(component);
130
+ width: a(this.width),
131
+ maxWidth: a(this.maxWidth),
132
+ minWidth: a(this.minWidth),
133
+ height: a(this.height),
134
+ maxHeight: a(this.maxHeight),
135
+ minHeight: a(this.minHeight)
360
136
  };
361
137
  }
362
- }
363
- };
364
- const __cssModules$2 = {};
365
- var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, null, null, null);
366
- function __vue2_injectStyles$2(context) {
367
- for (let o in __cssModules$2) {
368
- this[o] = __cssModules$2[o];
369
- }
370
- }
371
- var ActivityIndicator = /* @__PURE__ */ function() {
372
- return __component__$2.exports;
373
- }();
374
- var Chase_vue_vue_type_style_index_0_lang = "";
375
- var CircleFade_vue_vue_type_style_index_0_lang = "";
376
- var CircleOrbit_vue_vue_type_style_index_0_lang = "";
377
- var CircleTrail_vue_vue_type_style_index_0_lang = "";
378
- var Dots_vue_vue_type_style_index_0_lang = "";
379
- var DoublePulse_vue_vue_type_style_index_0_lang = "";
380
- var Facebook_vue_vue_type_style_index_0_lang = "";
381
- var Grid_vue_vue_type_style_index_0_lang = "";
382
- var Pulse_vue_vue_type_style_index_0_lang = "";
383
- var Spinner_vue_vue_type_style_index_0_lang = "";
384
- var Spotify_vue_vue_type_style_index_0_lang = "";
385
- var Square_vue_vue_type_style_index_0_lang = "";
386
- var SquareFold_vue_vue_type_style_index_0_lang = "";
387
- var SquareOrbit_vue_vue_type_style_index_0_lang = "";
388
- /*! *****************************************************************************
389
- Copyright (c) Microsoft Corporation.
390
-
391
- Permission to use, copy, modify, and/or distribute this software for any
392
- purpose with or without fee is hereby granted.
393
-
394
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
395
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
396
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
397
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
398
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
399
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
400
- PERFORMANCE OF THIS SOFTWARE.
401
- ***************************************************************************** */
402
- var __assign2 = function() {
403
- __assign2 = Object.assign || function __assign22(t) {
404
- for (var s, i = 1, n = arguments.length; i < n; i++) {
405
- s = arguments[i];
406
- for (var p in s)
407
- if (Object.prototype.hasOwnProperty.call(s, p))
408
- t[p] = s[p];
409
- }
410
- return t;
411
- };
412
- return __assign2.apply(this, arguments);
413
- };
414
- function lowerCase(str) {
415
- return str.toLowerCase();
416
- }
417
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
418
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
419
- function noCase(input, options) {
420
- if (options === void 0) {
421
- options = {};
422
- }
423
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
424
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
425
- var start = 0;
426
- var end = result.length;
427
- while (result.charAt(start) === "\0")
428
- start++;
429
- while (result.charAt(end - 1) === "\0")
430
- end--;
431
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
432
- }
433
- function replace(input, re, value) {
434
- if (re instanceof RegExp)
435
- return input.replace(re, value);
436
- return re.reduce(function(input2, re2) {
437
- return input2.replace(re2, value);
438
- }, input);
439
- }
440
- function dotCase(input, options) {
441
- if (options === void 0) {
442
- options = {};
443
- }
444
- return noCase(input, __assign2({
445
- delimiter: "."
446
- }, options));
447
- }
448
- function paramCase(input, options) {
449
- if (options === void 0) {
450
- options = {};
451
- }
452
- return dotCase(input, __assign2({
453
- delimiter: "-"
454
- }, options));
455
- }
456
- var Sizeable = {
457
- props: {
458
- size: String,
459
- sizePrefix: {
460
- type: String,
461
- default() {
462
- return this.$options.name;
463
- }
464
- }
465
138
  },
466
- computed: {
467
- sizeableClassPrefix() {
468
- return this.sizePrefix && paramCase(this.sizePrefix);
469
- },
470
- sizeableClass() {
471
- if (!this.size || !this.sizeableClassPrefix) {
472
- return "";
473
- }
474
- return `${this.sizeableClassPrefix}-${this.size}`;
475
- }
476
- }
477
- };
478
- var Variant = {
479
- props: {
480
- variant: String,
481
- variantPrefix: {
482
- type: String,
483
- default() {
484
- return this.$options.name && this.$options.name.toLowerCase();
485
- }
486
- }
487
- },
488
- computed: {
489
- variantClassPrefix() {
490
- return this.variantPrefix;
491
- },
492
- variantClass() {
493
- if (!this.variant || !this.variantClassPrefix) {
494
- return "";
495
- }
496
- return `${this.variantClassPrefix}-${this.variant}`;
497
- }
498
- }
499
- };
500
- var render$1 = function() {
501
- var _vm = this;
502
- var _h = _vm.$createElement;
503
- var _c = _vm._self._c || _h;
504
- return _c(_vm.component, { tag: "component", class: _vm.classes, attrs: { "disabled": _vm.disabled, "role": "button" }, on: { "click": function($event) {
505
- !_vm.disabled && _vm.$emit("click", $event);
506
- } } }, [_vm._t("default", function() {
507
- return [_vm._v(_vm._s(_vm.label))];
508
- })], 2);
509
- };
510
- var staticRenderFns$1 = [];
511
- const __vue2_script$1 = {
512
- name: "Btn",
513
- mixins: [
514
- Sizeable,
515
- Variant
516
- ],
517
- props: {
518
- active: Boolean,
519
- block: Boolean,
520
- disabled: Boolean,
521
- label: String,
522
- outline: Boolean,
523
- tag: String,
524
- variant: {
525
- type: String,
526
- default: "primary"
527
- }
139
+ async mounted() {
140
+ const t = await this.component();
141
+ this.is = () => t;
528
142
  },
529
- computed: {
530
- classes() {
531
- return [
532
- "btn",
533
- this.variantClass,
534
- this.sizeableClass,
535
- this.active && "active",
536
- this.block && "btn-block",
537
- this.disabled && "disabled"
538
- ];
539
- },
540
- component() {
541
- if (this.tag) {
542
- return this.tag;
543
- }
544
- if (this.$attrs.to) {
545
- return "router-link";
546
- }
547
- if (this.$attrs.href) {
548
- return "a";
549
- }
550
- return "button";
551
- },
552
- variantClassPrefix() {
553
- return this.variantPrefix + (this.outline ? "-outline" : "");
143
+ methods: {
144
+ async component() {
145
+ let t = b.get(this.type);
146
+ return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
554
147
  }
555
148
  }
149
+ }, W = { class: "activity-indicator-content" }, q = {
150
+ key: 1,
151
+ class: "activity-indicator-label"
556
152
  };
557
- const __cssModules$1 = {};
558
- var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, null, null, null);
559
- function __vue2_injectStyles$1(context) {
560
- for (let o in __cssModules$1) {
561
- this[o] = __cssModules$1[o];
562
- }
153
+ function Z(t, e, i, n, s, r) {
154
+ return c(), d("div", {
155
+ class: m(["activity-indicator", r.classes]),
156
+ style: $(r.style)
157
+ }, [
158
+ k("div", W, [
159
+ t.is ? (c(), P(z(t.is()), {
160
+ key: 0,
161
+ class: "mx-auto"
162
+ })) : p("", !0),
163
+ i.label ? (c(), d("div", q, S(i.label), 1)) : p("", !0)
164
+ ])
165
+ ], 6);
563
166
  }
564
- var Btn = /* @__PURE__ */ function() {
565
- return __component__$1.exports;
566
- }();
567
- var render = function() {
568
- var this$1$1 = this;
569
- var _vm = this;
570
- var _h = _vm.$createElement;
571
- var _c = _vm._self._c || _h;
572
- return _c("btn", { class: _vm.classes, attrs: { "active": _vm.active, "block": _vm.block, "disabled": _vm.disabled, "size": _vm.size, "tag": _vm.tag, "variant": _vm.variant }, on: { "click": function(e) {
573
- return !_vm.disabled && _vm.$emit("click", e, this$1$1);
574
- } } }, [_vm._t("default", function() {
575
- return [_vm._v(_vm._s(_vm.label))];
576
- }), _c("activity-indicator", _vm._b({}, "activity-indicator", _vm.indicatorProps, false))], 2);
577
- };
578
- var staticRenderFns = [];
579
- var BtnActivity_vue_vue_type_style_index_0_lang = "";
580
- const convertAnimationDelayToInt = function(delay) {
581
- const num = parseFloat(delay || 0, 10);
582
- const matches = delay && delay.match(/m?s/);
583
- const unit2 = matches ? matches[0] : false;
584
- let milliseconds;
585
- switch (unit2) {
167
+ const G = /* @__PURE__ */ A(V, [["render", Z]]);
168
+ const M = function(t) {
169
+ const e = parseFloat(t || 0, 10), i = t && t.match(/m?s/), n = i ? i[0] : !1;
170
+ let s;
171
+ switch (n) {
586
172
  case "s":
587
- milliseconds = num * 1e3;
173
+ s = e * 1e3;
588
174
  break;
589
175
  case "ms":
590
176
  default:
591
- milliseconds = num;
177
+ s = e;
592
178
  break;
593
179
  }
594
- return milliseconds || 0;
595
- };
596
- const animated = function(el, callback) {
597
- const defaultView = (el.ownerDocument || document).defaultView;
180
+ return s || 0;
181
+ }, x = function(t, e) {
182
+ const i = (t.ownerDocument || document).defaultView;
598
183
  setTimeout(() => {
599
- callback.apply();
600
- }, convertAnimationDelayToInt(defaultView.getComputedStyle(el).animationDuration));
601
- };
602
- const __vue2_script = {
184
+ e.apply();
185
+ }, M(i.getComputedStyle(t).animationDuration));
186
+ }, U = {
603
187
  name: "BtnActivity",
604
188
  components: {
605
- ActivityIndicator,
606
- Btn
189
+ ActivityIndicator: G
607
190
  },
608
191
  props: {
609
192
  active: Boolean,
610
193
  activity: Boolean,
611
194
  block: Boolean,
612
195
  disabled: Boolean,
613
- indicator: {
614
- type: [Object, String],
615
- default: "spinner"
616
- },
617
196
  label: String,
618
- orientation: {
619
- type: String,
620
- default: "right"
621
- },
197
+ icon: String,
198
+ type: String,
622
199
  size: {
623
200
  type: String,
624
201
  default: "md"
625
202
  },
626
- tag: String,
627
203
  variant: {
628
204
  type: String,
629
205
  default: "primary"
206
+ },
207
+ indicator: {
208
+ type: [Object, String],
209
+ default: "spinner"
210
+ },
211
+ orientation: {
212
+ type: String,
213
+ default: "right"
630
214
  }
631
215
  },
632
- data() {
633
- return {
634
- currentActivity: this.activity
635
- };
636
- },
637
216
  computed: {
638
217
  classes() {
639
- const classes = {
640
- "disabled": this.disabled,
641
- "active": this.active,
218
+ const t = {
219
+ disabled: this.disabled,
220
+ active: this.active,
221
+ "btn-block": this.block,
642
222
  "btn-activity": this.activity
643
223
  };
644
- classes["btn-activity-" + this.orientation.replace("btn-activity-", "")] = !!this.orientation;
645
- classes["btn-activity-indicator-" + this.indicatorProps.type.replace("btn-activity-indicator-", "")] = !!this.indicatorProps.type;
646
- return classes;
224
+ return t["btn-" + this.size.replace("btn-", "")] = !!this.size, t["btn-" + this.variant.replace("btn-", "")] = !!this.variant, t["btn-activity-" + this.orientation.replace("btn-activity-", "")] = !!this.orientation, t["btn-activity-indicator-" + this.indicatorProps.type.replace("btn-activity-indicator-", "")] = !!this.indicatorProps.type, t;
647
225
  },
648
226
  indicatorProps() {
649
227
  return Object.assign({
650
228
  type: "spinner"
651
- }, (typeof this.indicator === "string" ? {
229
+ }, (typeof this.indicator == "string" ? {
652
230
  type: this.indicator
653
231
  } : this.indicator) || {});
654
232
  }
655
233
  },
656
234
  watch: {
657
- activity(value) {
658
- if (value) {
659
- this.showActivity();
660
- } else {
661
- this.hideActivity();
662
- }
663
- }
664
- },
665
- mounted() {
666
- if (this.activity) {
667
- this.showActivity();
235
+ activity(t) {
236
+ t ? this.showActivity() : this.hideActivity();
668
237
  }
669
238
  },
670
239
  methods: {
671
240
  disable() {
672
- this.$el.disabled = true;
673
- this.$el.classList.add("disabled");
241
+ this.$el.disabled = !0;
674
242
  },
675
243
  enable() {
676
- this.$el.disabled = false;
677
- this.$el.classList.remove("disabled");
244
+ this.$el.disabled = !1;
678
245
  },
679
- hideActivity() {
680
- this.$el.classList.add("btn-hide-activity");
681
- animated(this.$el, () => {
682
- this.enable();
683
- this.currentActivity = false;
684
- this.$el.classList.remove("btn-activity", "btn-hide-activity");
685
- this.$emit("hide-activity");
246
+ showActivity() {
247
+ this.disable(), x(this.$el, () => {
248
+ this.$el.classList.add("btn-activity"), this.$emit("show-activity");
686
249
  });
687
250
  },
688
- showActivity() {
689
- this.currentActivity = true;
690
- this.disable();
691
- animated(this.$el, () => {
692
- this.$el.classList.add("btn-activity");
693
- this.$emit("show-activity");
251
+ hideActivity() {
252
+ this.$el.classList.add("btn-hide-activity"), x(this.$el, () => {
253
+ this.enable(), this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
694
254
  });
695
255
  },
696
- toggle() {
697
- if (!this.currentActivity) {
698
- this.showActivity();
699
- } else {
700
- this.hideActivity();
701
- }
256
+ onClick(t) {
257
+ this.disabled ? t.preventDefault() : this.$emit("click", t);
702
258
  }
703
259
  }
704
- };
705
- const __cssModules = {};
706
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
707
- function __vue2_injectStyles(context) {
708
- for (let o in __cssModules) {
709
- this[o] = __cssModules[o];
710
- }
260
+ }, X = ["type"];
261
+ function J(t, e, i, n, s, r) {
262
+ const o = B("activity-indicator");
263
+ return c(), d("button", {
264
+ type: i.type,
265
+ class: m(["btn", r.classes]),
266
+ onClick: e[0] || (e[0] = (...h) => r.onClick && r.onClick(...h))
267
+ }, [
268
+ i.icon ? (c(), d("i", {
269
+ key: 0,
270
+ class: m(i.icon)
271
+ }, null, 2)) : p("", !0),
272
+ E(" " + S(i.label) + " ", 1),
273
+ D(t.$slots, "default"),
274
+ N(o, O(R(r.indicatorProps)), null, 16)
275
+ ], 10, X);
711
276
  }
712
- var BtnActivity = /* @__PURE__ */ function() {
713
- return __component__.exports;
714
- }();
715
- export { BtnActivity };
277
+ const Q = /* @__PURE__ */ A(U, [["render", J]]);
278
+ export {
279
+ Q as BtnActivity
280
+ };
@@ -1,5 +1,4 @@
1
- (function(d,v){typeof exports=="object"&&typeof module!="undefined"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(d=typeof globalThis!="undefined"?globalThis:d||self,v(d.BtnActivity={}))})(this,function(d){"use strict";function v(t){return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(t)}function B(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function S(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function j(t,e,i){return e&&S(t.prototype,e),i&&S(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function b(t,e){return b=Object.setPrototypeOf||function(n,r){return n.__proto__=r,n},b(t,e)}function L(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function y(t,e,i){return L()?y=Reflect.construct:y=function(r,o,s){var u=[null];u.push.apply(u,o);var a=Function.bind.apply(r,u),c=new a;return s&&b(c,s.prototype),c},y.apply(null,arguments)}function x(t,e){return F(t)||I(t,e)||D(t,e)||N()}function F(t){if(Array.isArray(t))return t}function I(t,e){var i=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(i!=null){var n=[],r=!0,o=!1,s,u;try{for(i=i.call(t);!(r=(s=i.next()).done)&&(n.push(s.value),!(e&&n.length===e));r=!0);}catch(a){o=!0,u=a}finally{try{!r&&i.return!=null&&i.return()}finally{if(o)throw u}}return n}}function D(t,e){if(!!t){if(typeof t=="string")return A(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);if(i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set")return Array.from(t);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return A(t,e)}}function A(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function N(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var p=function(){return p=Object.assign||function(i){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])}return i},p.apply(this,arguments)};function W(t){return t.toLowerCase()}var Z=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],H=/[^A-Z0-9]+/gi;function U(t,e){e===void 0&&(e={});for(var i=e.splitRegexp,n=i===void 0?Z:i,r=e.stripRegexp,o=r===void 0?H:r,s=e.transform,u=s===void 0?W:s,a=e.delimiter,c=a===void 0?" ":a,f=C(C(t,n,"$1\0$2"),o,"\0"),_=0,l=f.length;f.charAt(_)==="\0";)_++;for(;f.charAt(l-1)==="\0";)l--;return f.slice(_,l).split("\0").map(u).join(c)}function C(t,e,i){return e instanceof RegExp?t.replace(e,i):e.reduce(function(n,r){return n.replace(r,i)},t)}function M(t,e){return e===void 0&&(e={}),U(t,p({delimiter:"."},e))}function m(t,e){return e===void 0&&(e={}),M(t,p({delimiter:"-"},e))}var P=function(){function t(){var e=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};B(this,t),this.components={},Object.entries(i).forEach(function(n){var r=x(n,2),o=r[0],s=r[1];e.register(o,s)})}return j(t,[{key:"get",value:function(i){var n=this.components[i=m(i)];if(n)return n;throw new Error('"'.concat(i,'" has not been registered yet!'))}},{key:"register",value:function(i,n){var r=this;return v(i)==="object"?(Object.entries(i).forEach(function(o){var s=x(o,2),u=s[0],a=s[1];r.register(m(u),a)}),this):(this.components[m(i)]=n,this)}},{key:"remove",value:function(i){return delete this.components[m(i)],this}},{key:"reset",value:function(){return this.components={},this}}]),t}();function X(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return y(P,e)}const w=X();var G=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"activity-indicator",class:t.classes,style:t.style},[i("div",{staticClass:"activity-indicator-content"},[i(t.component,{tag:"component",staticClass:"mx-auto"}),t.label?i("div",{staticClass:"activity-indicator-label"},[t._v(" "+t._s(t.label)+" ")]):t._e()],1)])},V=[],$t="";function $(t,e,i,n,r,o,s,u){var a=typeof t=="function"?t.options:t;e&&(a.render=e,a.staticRenderFns=i,a._compiled=!0),n&&(a.functional=!0),o&&(a._scopeId="data-v-"+o);var c;if(s?(c=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(l=__VUE_SSR_CONTEXT__),r&&r.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(s)},a._ssrRegister=c):r&&(c=u?function(){r.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:r),c)if(a.functional){a._injectStyles=c;var f=a.render;a.render=function(bt,k){return c.call(k),f(bt,k)}}else{var _=a.beforeCreate;a.beforeCreate=_?[].concat(_,c):[c]}return{exports:t,options:a}}function h(t,e="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${e}`:t}const q={name:"ActivityIndicator",props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:P,default(){return w}},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:h(this.width),maxWidth:h(this.maxWidth),minWidth:h(this.minWidth),height:h(this.height),maxHeight:h(this.maxHeight),minHeight:h(this.minHeight)}},component(){return()=>{const t=w.get(this.type);return t instanceof Promise?t:typeof t=="function"?t():Promise.resolve(t)}}}},R={};var J=$(q,G,V,!1,K,null,null,null);function K(t){for(let e in R)this[e]=R[e]}var Q=function(){return J.exports}(),St="",xt="",At="",Ct="",Pt="",wt="",Rt="",zt="",Ot="",Tt="",Et="",kt="",Bt="",jt="";/*! *****************************************************************************
1
+ (function(c,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(c=typeof globalThis<"u"?globalThis:c||self,n(c.BtnActivity={},c.Vue))})(this,function(c,n){"use strict";/*! *****************************************************************************
3
2
  Copyright (c) Microsoft Corporation.
4
3
 
5
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -12,4 +11,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
13
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var g=function(){return g=Object.assign||function(e){for(var i,n=1,r=arguments.length;n<r;n++){i=arguments[n];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},g.apply(this,arguments)};function Y(t){return t.toLowerCase()}var tt=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],et=/[^A-Z0-9]+/gi;function it(t,e){e===void 0&&(e={});for(var i=e.splitRegexp,n=i===void 0?tt:i,r=e.stripRegexp,o=r===void 0?et:r,s=e.transform,u=s===void 0?Y:s,a=e.delimiter,c=a===void 0?" ":a,f=z(z(t,n,"$1\0$2"),o,"\0"),_=0,l=f.length;f.charAt(_)==="\0";)_++;for(;f.charAt(l-1)==="\0";)l--;return f.slice(_,l).split("\0").map(u).join(c)}function z(t,e,i){return e instanceof RegExp?t.replace(e,i):e.reduce(function(n,r){return n.replace(r,i)},t)}function nt(t,e){return e===void 0&&(e={}),it(t,g({delimiter:"."},e))}function rt(t,e){return e===void 0&&(e={}),nt(t,g({delimiter:"-"},e))}var at={props:{size:String,sizePrefix:{type:String,default(){return this.$options.name}}},computed:{sizeableClassPrefix(){return this.sizePrefix&&rt(this.sizePrefix)},sizeableClass(){return!this.size||!this.sizeableClassPrefix?"":`${this.sizeableClassPrefix}-${this.size}`}}},st={props:{variant:String,variantPrefix:{type:String,default(){return this.$options.name&&this.$options.name.toLowerCase()}}},computed:{variantClassPrefix(){return this.variantPrefix},variantClass(){return!this.variant||!this.variantClassPrefix?"":`${this.variantClassPrefix}-${this.variant}`}}},ot=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i(t.component,{tag:"component",class:t.classes,attrs:{disabled:t.disabled,role:"button"},on:{click:function(n){!t.disabled&&t.$emit("click",n)}}},[t._t("default",function(){return[t._v(t._s(t.label))]})],2)},lt=[];const ct={name:"Btn",mixins:[at,st],props:{active:Boolean,block:Boolean,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.to?"router-link":this.$attrs.href?"a":"button"},variantClassPrefix(){return this.variantPrefix+(this.outline?"-outline":"")}}},O={};var ut=$(ct,ot,lt,!1,ft,null,null,null);function ft(t){for(let e in O)this[e]=O[e]}var _t=function(){return ut.exports}(),vt=function(){var t=this,e=this,i=e.$createElement,n=e._self._c||i;return n("btn",{class:e.classes,attrs:{active:e.active,block:e.block,disabled:e.disabled,size:e.size,tag:e.tag,variant:e.variant},on:{click:function(r){return!e.disabled&&e.$emit("click",r,t)}}},[e._t("default",function(){return[e._v(e._s(e.label))]}),n("activity-indicator",e._b({},"activity-indicator",e.indicatorProps,!1))],2)},dt=[],Lt="";const ht=function(t){const e=parseFloat(t||0,10),i=t&&t.match(/m?s/),n=i?i[0]:!1;let r;switch(n){case"s":r=e*1e3;break;case"ms":default:r=e;break}return r||0},T=function(t,e){const i=(t.ownerDocument||document).defaultView;setTimeout(()=>{e.apply()},ht(i.getComputedStyle(t).animationDuration))},yt={name:"BtnActivity",components:{ActivityIndicator:Q,Btn:_t},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(){const t={disabled:this.disabled,active:this.active,"btn-activity":this.activity};return t["btn-activity-"+this.orientation.replace("btn-activity-","")]=!!this.orientation,t["btn-activity-indicator-"+this.indicatorProps.type.replace("btn-activity-indicator-","")]=!!this.indicatorProps.type,t},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"),T(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(),T(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}},E={};var pt=$(yt,vt,dt,!1,mt,null,null,null);function mt(t){for(let e in E)this[e]=E[e]}var gt=function(){return pt.exports}();d.BtnActivity=gt,Object.defineProperties(d,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ ***************************************************************************** */var l=function(){return l=Object.assign||function(e){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a])}return e},l.apply(this,arguments)};function S(t){return t.toLowerCase()}var w=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],C=/[^A-Z0-9]+/gi;function k(t,e){e===void 0&&(e={});for(var i=e.splitRegexp,s=i===void 0?w:i,r=e.stripRegexp,a=r===void 0?C:r,_=e.transform,h=_===void 0?S:_,x=e.delimiter,V=x===void 0?" ":x,u=p(p(t,s,"$1\0$2"),a,"\0"),y=0,m=u.length;u.charAt(y)==="\0";)y++;for(;u.charAt(m-1)==="\0";)m--;return u.slice(y,m).split("\0").map(h).join(V)}function p(t,e,i){return e instanceof RegExp?t.replace(e,i):e.reduce(function(s,r){return s.replace(r,i)},t)}function A(t,e){return e===void 0&&(e={}),k(t,l({delimiter:"."},e))}function d(t,e){return e===void 0&&(e={}),A(t,l({delimiter:"-"},e))}class g{constructor(e={}){this.components=new Map,Object.entries(e).forEach(([i,s])=>{this.register(i,s)})}get(e){const i=this.components.get(e=d(e));if(i)return i;throw new Error(`"${e}" has not been registered yet!`)}register(e,i){return typeof e=="object"?(Object.entries(e).forEach(([s,r])=>{this.register(d(s),r)}),this):(this.components.set(d(e),i),this)}remove(e){return this.components.delete(d(e)),this}reset(){return this.components=new Map,this}}function B(...t){return new g(...t)}const f=B(),F="",v=(t,e)=>{const i=t.__vccOpts||t;for(const[s,r]of e)i[s]=r;return i};function o(t,e="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${e}`:t}const $={name:"ActivityIndicator",props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:g,default(){return f}},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}),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=f.get(this.type);return t instanceof Promise?t:(typeof t=="function"&&(t=await t()),t.default?t.default:t)}}},E={class:"activity-indicator-content"},P={key:1,class:"activity-indicator-label"};function z(t,e,i,s,r,a){return n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["activity-indicator",a.classes]),style:n.normalizeStyle(a.style)},[n.createElementVNode("div",E,[t.is?(n.openBlock(),n.createBlock(n.resolveDynamicComponent(t.is()),{key:0,class:"mx-auto"})):n.createCommentVNode("",!0),i.label?(n.openBlock(),n.createElementBlock("div",P,n.toDisplayString(i.label),1)):n.createCommentVNode("",!0)])],6)}const N=v($,[["render",z]]),L="",H="",I="",W="",q="",M="",Z="",G="",U="",X="",J="",K="",Q="",Y="",tt="",D=function(t){const e=parseFloat(t||0,10),i=t&&t.match(/m?s/),s=i?i[0]:!1;let r;switch(s){case"s":r=e*1e3;break;case"ms":default:r=e;break}return r||0},b=function(t,e){const i=(t.ownerDocument||document).defaultView;setTimeout(()=>{e.apply()},D(i.getComputedStyle(t).animationDuration))},O={name:"BtnActivity",components:{ActivityIndicator:N},props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,label:String,icon:String,type:String,size:{type:String,default:"md"},variant:{type:String,default:"primary"},indicator:{type:[Object,String],default:"spinner"},orientation:{type:String,default:"right"}},computed:{classes(){const t={disabled:this.disabled,active:this.active,"btn-block":this.block,"btn-activity":this.activity};return t["btn-"+this.size.replace("btn-","")]=!!this.size,t["btn-"+this.variant.replace("btn-","")]=!!this.variant,t["btn-activity-"+this.orientation.replace("btn-activity-","")]=!!this.orientation,t["btn-activity-indicator-"+this.indicatorProps.type.replace("btn-activity-indicator-","")]=!!this.indicatorProps.type,t},indicatorProps(){return Object.assign({type:"spinner"},(typeof this.indicator=="string"?{type:this.indicator}:this.indicator)||{})}},watch:{activity(t){t?this.showActivity():this.hideActivity()}},methods:{disable(){this.$el.disabled=!0},enable(){this.$el.disabled=!1},showActivity(){this.disable(),b(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},hideActivity(){this.$el.classList.add("btn-hide-activity"),b(this.$el,()=>{this.enable(),this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},onClick(t){this.disabled?t.preventDefault():this.$emit("click",t)}}},T=["type"];function j(t,e,i,s,r,a){const _=n.resolveComponent("activity-indicator");return n.openBlock(),n.createElementBlock("button",{type:i.type,class:n.normalizeClass(["btn",a.classes]),onClick:e[0]||(e[0]=(...h)=>a.onClick&&a.onClick(...h))},[i.icon?(n.openBlock(),n.createElementBlock("i",{key:0,class:n.normalizeClass(i.icon)},null,2)):n.createCommentVNode("",!0),n.createTextVNode(" "+n.toDisplayString(i.label)+" ",1),n.renderSlot(t.$slots,"default"),n.createVNode(_,n.normalizeProps(n.guardReactiveProps(a.indicatorProps)),null,16)],10,T)}const R=v(O,[["render",j]]);c.BtnActivity=R,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-interface/btn-activity",
3
- "version": "1.1.0",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "A Vue activity button component.",
5
5
  "files": [
6
6
  "index.js",
@@ -39,22 +39,22 @@
39
39
  },
40
40
  "homepage": "https://github.com/vue-interface/btn-activity/docs#readme",
41
41
  "dependencies": {
42
- "@vue-interface/activity-indicator": "^1.0.4",
43
- "@vue-interface/btn": "^2.0.0",
44
- "vue": "^2.6.14"
42
+ "@vue-interface/activity-indicator": "^2.0.0-beta.0",
43
+ "@vue-interface/btn": "^3.0.0-beta.1"
45
44
  },
46
45
  "devDependencies": {
47
- "@rollup/plugin-babel": "^5.3.0",
46
+ "@rollup/plugin-babel": "^6.0.0",
47
+ "@vitejs/plugin-vue": "^3.1.2",
48
48
  "autoprefixer": "^10.4.2",
49
49
  "babel-eslint": "^10.1.0",
50
50
  "babel-preset-vue": "^2.0.2",
51
51
  "change-case": "^4.1.2",
52
- "eslint": "^6.7.2",
53
- "eslint-plugin-vue": "^6.2.2",
52
+ "eslint": "^8.25.0",
53
+ "eslint-plugin-vue": "^9.6.0",
54
54
  "pascalcase": "^2.0.0",
55
55
  "postcss": "^8.4.6",
56
56
  "tailwindcss": "^3.0.18",
57
- "vite": "^2.7.2",
58
- "vite-plugin-vue2": "^1.9.3"
57
+ "vite": "^3.1.7",
58
+ "vue": "^3.2.40"
59
59
  }
60
60
  }
@@ -1,21 +1,13 @@
1
1
  <template>
2
- <btn
3
- :active="active"
4
- :block="block"
5
- :disabled="disabled"
6
- :size="size"
7
- :tag="tag"
8
- :variant="variant"
9
- :class="classes"
10
- @click="(e) => !disabled && $emit('click', e, this)">
11
- <slot>{{ label }}</slot>
2
+ <button :type="type" class="btn" :class="classes" @click="onClick">
3
+ <i v-if="icon" :class="icon" /> {{ label }}
4
+ <slot />
12
5
  <activity-indicator v-bind="indicatorProps" />
13
- </btn>
6
+ </button>
14
7
  </template>
15
8
 
16
9
  <script>
17
10
  import { ActivityIndicator } from '@vue-interface/activity-indicator';
18
- import { Btn } from '@vue-interface/btn';
19
11
 
20
12
  const convertAnimationDelayToInt = function(delay) {
21
13
  const num = parseFloat(delay || 0, 10);
@@ -48,10 +40,9 @@ const animated = function(el, callback) {
48
40
  export default {
49
41
 
50
42
  name: 'BtnActivity',
51
-
43
+
52
44
  components: {
53
- ActivityIndicator,
54
- Btn
45
+ ActivityIndicator
55
46
  },
56
47
 
57
48
  props: {
@@ -78,38 +69,33 @@ export default {
78
69
  block: Boolean,
79
70
 
80
71
  /**
81
- * Disable the button.
72
+ * Make the button appear with the disabled state.
82
73
  *
83
74
  * @property {Boolean}
84
75
  */
85
76
  disabled: Boolean,
86
77
 
87
78
  /**
88
- * The type of activity indicator inside the button.
79
+ * The button label. If not passed as a property, label must be passed
80
+ * inside the element's html.
89
81
  *
90
82
  * @property {String}
91
83
  */
92
- indicator: {
93
- type: [Object, String],
94
- default: 'spinner'
95
- },
84
+ label: String,
96
85
 
97
86
  /**
98
- * The button label.
87
+ * The button icon
99
88
  *
100
89
  * @property {String}
101
90
  */
102
- label: String,
91
+ icon: String,
103
92
 
104
93
  /**
105
- * The orientation of the activity button inside the button.
94
+ * The `type` attribute for the button element.
106
95
  *
107
96
  * @property {String}
108
97
  */
109
- orientation: {
110
- type: String,
111
- default: 'right'
112
- },
98
+ type: String,
113
99
 
114
100
  /**
115
101
  * The size of the button.
@@ -122,28 +108,35 @@ export default {
122
108
  },
123
109
 
124
110
  /**
125
- * The HTML tag.
111
+ * The variant of the button.
112
+ *
113
+ * @property {String}
114
+ */
115
+ variant: {
116
+ type: String,
117
+ default: 'primary'
118
+ },
119
+
120
+ /**
121
+ * The type of activity indicator inside the button.
126
122
  *
127
123
  * @property {String}
128
124
  */
129
- tag: String,
125
+ indicator: {
126
+ type: [Object, String],
127
+ default: 'spinner'
128
+ },
130
129
 
131
130
  /**
132
- * The variant of the button.
131
+ * The orientation of the activity button inside the button.
133
132
  *
134
133
  * @property {String}
135
134
  */
136
- variant: {
135
+ orientation: {
137
136
  type: String,
138
- default: 'primary'
137
+ default: 'right'
139
138
  }
140
139
  },
141
-
142
- data() {
143
- return {
144
- currentActivity: this.activity
145
- };
146
- },
147
140
 
148
141
  computed: {
149
142
 
@@ -156,9 +149,12 @@ export default {
156
149
  const classes = {
157
150
  'disabled': this.disabled,
158
151
  'active': this.active,
152
+ 'btn-block': this.block,
159
153
  'btn-activity': this.activity
160
154
  };
161
155
 
156
+ classes['btn-' + this.size.replace('btn-', '')] = !!this.size;
157
+ classes['btn-' + this.variant.replace('btn-', '')] = !!this.variant;
162
158
  classes['btn-activity-' + this.orientation.replace('btn-activity-', '')] = !!this.orientation;
163
159
  classes['btn-activity-indicator-' + this.indicatorProps.type.replace('btn-activity-indicator-', '')] = !!this.indicatorProps.type;
164
160
 
@@ -188,12 +184,6 @@ export default {
188
184
 
189
185
  },
190
186
 
191
- mounted() {
192
- if(this.activity) {
193
- this.showActivity();
194
- }
195
- },
196
-
197
187
  methods: {
198
188
 
199
189
  /**
@@ -203,7 +193,6 @@ export default {
203
193
  */
204
194
  disable() {
205
195
  this.$el.disabled = true;
206
- this.$el.classList.add('disabled');
207
196
  },
208
197
 
209
198
  /**
@@ -213,51 +202,48 @@ export default {
213
202
  */
214
203
  enable() {
215
204
  this.$el.disabled = false;
216
- this.$el.classList.remove('disabled');
217
205
  },
218
206
 
219
207
  /**
220
- * Hide the activity indicator inside the button.
208
+ * Show the activity indicator inside the button.
221
209
  *
222
210
  * @return void
223
211
  */
224
- hideActivity() {
225
- this.$el.classList.add('btn-hide-activity');
212
+ showActivity() {
213
+ this.disable();
226
214
 
227
215
  animated(this.$el, () => {
228
- this.enable();
229
- this.currentActivity = false;
230
- this.$el.classList.remove('btn-activity', 'btn-hide-activity');
231
- this.$emit('hide-activity');
216
+ this.$el.classList.add('btn-activity');
217
+ this.$emit('show-activity');
232
218
  });
233
219
  },
234
220
 
235
221
  /**
236
- * Show the activity indicator inside the button.
222
+ * Hide the activity indicator inside the button.
237
223
  *
238
224
  * @return void
239
225
  */
240
- showActivity() {
241
- this.currentActivity = true;
242
- this.disable();
226
+ hideActivity() {
227
+ this.$el.classList.add('btn-hide-activity');
243
228
 
244
229
  animated(this.$el, () => {
245
- this.$el.classList.add('btn-activity');
246
- this.$emit('show-activity');
230
+ this.enable();
231
+ this.$el.classList.remove('btn-activity', 'btn-hide-activity');
232
+ this.$emit('hide-activity');
247
233
  });
248
234
  },
249
235
 
250
236
  /**
251
- * Show the activity indicator inside the button.
237
+ * The click callback function
252
238
  *
253
239
  * @return void
254
240
  */
255
- toggle() {
256
- if(!this.currentActivity) {
257
- this.showActivity();
241
+ onClick(event) {
242
+ if(!this.disabled) {
243
+ this.$emit('click', event);
258
244
  }
259
245
  else {
260
- this.hideActivity();
246
+ event.preventDefault();
261
247
  }
262
248
  }
263
249