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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Justin Kimbrell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Button Activity
2
+
3
+ The `btn-activity` component provides an interactive button with built-in activity indicators for async operations. It extends the standard button and combines activity indicators.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm i @vue-interface/btn-activity
9
+ ```
10
+
11
+ ```bash
12
+ yarn add @vue-interface/btn-activity
13
+ ```
14
+
15
+ ```bash
16
+ npm i @vue-interface/btn-activity
17
+ ```
18
+
19
+ ```bash
20
+ bun i @vue-interface/btn-activity
21
+ ```
22
+
23
+ ## Basic Usage
24
+
25
+ ```vue
26
+ <BtnActivity :indicator="Dots" @click="onClick">Dots</BtnActivity>
27
+ ```
28
+
29
+ For more comprehensive documentation and examples, please visit the [online documentation](https://vue-interface.github.io/packages/btn-activity/).
30
+
@@ -1,397 +1,83 @@
1
- import { defineComponent as b, inject as O, openBlock as a, createElementBlock as g, normalizeClass as j, normalizeStyle as N, createElementVNode as E, createBlock as y, resolveDynamicComponent as x, createCommentVNode as $, toDisplayString as f, mergeProps as w, withCtx as A, renderSlot as C, createTextVNode as k, resolveComponent as P, createVNode as _, normalizeProps as H, guardReactiveProps as R } from "vue";
2
- function r(t, i = "px") {
3
- return t != null && t !== !1 && isFinite(t) ? `${t}${i}` : t;
4
- }
5
- const V = b({
1
+ import { defineComponent as f, ref as y, watchEffect as v, watch as m, createElementBlock as b, openBlock as l, normalizeClass as c, renderSlot as x, createVNode as h, createTextVNode as k, toDisplayString as z, Transition as g, withCtx as w, createBlock as B, createCommentVNode as S, unref as C } from "vue";
2
+ import { ActivityIndicator as A } from "@vue-interface/activity-indicator";
3
+ const N = ["disabled"], T = /* @__PURE__ */ f({
4
+ __name: "BtnActivity",
6
5
  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]
6
+ activity: { type: Boolean },
7
+ indicator: {},
8
+ indicatorSize: { default: "xs" },
9
+ label: { default: void 0 },
10
+ orientation: { default: "right" },
11
+ variant: { default: "btn-primary" },
12
+ size: { default: "btn-md" },
13
+ block: { type: Boolean },
14
+ disabled: { type: Boolean }
28
15
  },
29
- data: () => ({
30
- is: null
31
- }),
32
- setup(t) {
33
- return {
34
- registryInstance: O(t.registry || "indicators")
35
- };
36
- },
37
- computed: {
38
- classes() {
39
- return {
40
- "activity-indicator-center": this.center,
41
- "activity-indicator-absolute": this.absolute,
42
- [this.size && `activity-indicator-${this.size}`]: !!this.size
43
- };
44
- },
45
- style() {
46
- return {
47
- width: r(this.width),
48
- maxWidth: r(this.maxWidth),
49
- minWidth: r(this.minWidth),
50
- height: r(this.height),
51
- maxHeight: r(this.maxHeight),
52
- minHeight: r(this.minHeight)
53
- };
54
- }
55
- },
56
- async mounted() {
57
- const t = await this.component();
58
- this.is = () => t;
59
- },
60
- methods: {
61
- async component() {
62
- let t = this.registryInstance.get(this.type);
63
- return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
64
- }
65
- }
66
- }), W = (t, i) => {
67
- const e = t.__vccOpts || t;
68
- for (const [n, s] of i)
69
- e[n] = s;
70
- return e;
71
- }, D = { class: "activity-indicator-content" }, L = {
72
- key: 1,
73
- class: "activity-indicator-label"
74
- };
75
- function I(t, i, e, n, s, o) {
76
- return a(), g("div", {
77
- class: j(["activity-indicator", t.classes]),
78
- style: N(t.style)
79
- }, [
80
- E("div", D, [
81
- t.is ? (a(), y(x(t.is()), {
82
- key: 0,
83
- class: "mx-auto"
84
- })) : $("", !0),
85
- t.label ? (a(), g("div", L, f(t.label), 1)) : $("", !0)
86
- ])
87
- ], 6);
88
- }
89
- const Z = /* @__PURE__ */ W(V, [["render", I]]);
90
- var F = Object.defineProperty, M = (t, i, e) => i in t ? F(t, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[i] = e, T = (t, i, e) => (M(t, typeof i != "symbol" ? i + "" : i, e), e), u = function() {
91
- return u = Object.assign || function(t) {
92
- for (var i, e = 1, n = arguments.length; e < n; e++) {
93
- i = arguments[e];
94
- for (var s in i)
95
- Object.prototype.hasOwnProperty.call(i, s) && (t[s] = i[s]);
96
- }
97
- return t;
98
- }, u.apply(this, arguments);
99
- };
100
- function q(t) {
101
- return t.toLowerCase();
102
- }
103
- var G = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
104
- function K(t, i) {
105
- i === void 0 && (i = {});
106
- for (var e = i.splitRegexp, n = e === void 0 ? G : e, s = i.stripRegexp, o = s === void 0 ? J : s, c = i.transform, v = c === void 0 ? q : c, l = i.delimiter, B = l === void 0 ? " " : l, h = S(S(t, n, "$1\0$2"), o, "\0"), p = 0, m = h.length; h.charAt(p) === "\0"; )
107
- p++;
108
- for (; h.charAt(m - 1) === "\0"; )
109
- m--;
110
- return h.slice(p, m).split("\0").map(v).join(B);
111
- }
112
- function S(t, i, e) {
113
- return i instanceof RegExp ? t.replace(i, e) : i.reduce(function(n, s) {
114
- return n.replace(s, e);
115
- }, t);
116
- }
117
- function Q(t, i) {
118
- return i === void 0 && (i = {}), K(t, u({ delimiter: "." }, i));
119
- }
120
- function d(t, i) {
121
- return i === void 0 && (i = {}), Q(t, u({ delimiter: "-" }, i));
122
- }
123
- class U {
124
- constructor(i = {}) {
125
- T(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(i).forEach(([e, n]) => {
126
- this.register(e, n);
16
+ emits: ["click", "hide-activity", "show-activity"],
17
+ setup(t, { emit: r }) {
18
+ const n = t, i = r, e = y(n.activity);
19
+ v(() => {
20
+ e.value = n.activity;
21
+ }), m(e, (a) => {
22
+ i(a ? "show-activity" : "hide-activity");
127
23
  });
128
- }
129
- get(i) {
130
- const e = this.components.get(
131
- i = d(i)
132
- );
133
- if (e)
134
- return e;
135
- throw new Error(`"${i}" has not been registered yet!`);
136
- }
137
- register(i, e) {
138
- return typeof i == "object" ? (Object.entries(i).forEach(([n, s]) => {
139
- this.register(d(n), s);
140
- }), this) : (this.components.set(d(i), e), this);
141
- }
142
- remove(i) {
143
- return this.components.delete(d(i)), this;
144
- }
145
- reset() {
146
- return this.components = /* @__PURE__ */ new Map(), this;
147
- }
148
- }
149
- function X(t = {}) {
150
- return new U(t);
151
- }
152
- X();
153
- const Y = {
154
- props: {
155
- componentPrefix: String,
156
- size: String,
157
- sizePrefix: String
158
- },
159
- computed: {
160
- sizeableClassPrefix() {
161
- return this.sizePrefix || this.componentPrefix;
162
- },
163
- hasSizeablePrefix() {
164
- return this.size === void 0 ? !1 : !!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`));
165
- },
166
- sizeableClass() {
167
- return this.size ? !this.sizeableClassPrefix || this.hasSizeablePrefix ? this.size : `${this.sizeableClassPrefix}-${this.size}` : "";
168
- }
169
- }
170
- }, tt = {
171
- props: {
172
- componentPrefix: String,
173
- variant: String,
174
- variantPrefix: String
175
- },
176
- computed: {
177
- variantClassPrefix() {
178
- return this.variantPrefix || this.componentPrefix;
179
- },
180
- hasVariantPrefix() {
181
- return this.variant === void 0 ? !1 : !!this.variant.match(new RegExp(`^${this.variantClassPrefix}`));
182
- },
183
- variantClass() {
184
- return this.variant ? !this.variantClassPrefix || this.hasVariantPrefix ? this.variant : `${this.variantClassPrefix}-${this.variant}` : "";
185
- }
186
- }
187
- }, it = b({
188
- mixins: [
189
- Y,
190
- tt
191
- ],
192
- props: {
193
- active: Boolean,
194
- block: Boolean,
195
- componentPrefix: {
196
- type: String,
197
- default: "btn"
198
- },
199
- disabled: Boolean,
200
- label: String,
201
- outline: Boolean,
202
- tag: String,
203
- variant: {
204
- type: String,
205
- default: "primary"
206
- }
207
- },
208
- computed: {
209
- classes() {
210
- return [
211
- "btn",
212
- this.variantClass,
213
- this.sizeableClass,
214
- this.active && "active",
215
- this.block && "btn-block",
216
- this.disabled && "disabled"
217
- ];
218
- },
219
- component() {
220
- return this.tag ? this.tag : this.$attrs.href ? "a" : "button";
221
- },
222
- variantClassPrefix() {
223
- return (this.variantPrefix || this.componentPrefix) + (this.outline ? "-outline" : "");
224
- }
225
- }
226
- }), et = (t, i) => {
227
- const e = t.__vccOpts || t;
228
- for (const [n, s] of i)
229
- e[n] = s;
230
- return e;
231
- };
232
- function st(t, i, e, n, s, o) {
233
- return a(), y(x(t.component), w(t.$attrs, {
234
- disabled: t.disabled,
235
- class: t.classes,
236
- role: "button"
237
- }), {
238
- default: A(() => [
239
- C(t.$slots, "default", {}, () => [
240
- k(f(t.label), 1)
241
- ])
242
- ]),
243
- _: 3
244
- }, 16, ["disabled", "class"]);
245
- }
246
- const nt = /* @__PURE__ */ et(it, [["render", st]]), rt = function(t) {
247
- const i = parseFloat(t || 0), e = t && t.match(/m?s/), n = e ? e[0] : !1;
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
- components: {
269
- ActivityIndicator: Z,
270
- Btn: nt
271
- },
272
- inheritAttrs: !1,
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: {
283
- type: String,
284
- default: void 0
285
- },
286
- orientation: {
287
- type: String,
288
- default: "right"
289
- },
290
- size: {
291
- type: String,
292
- default: "md"
293
- },
294
- tag: {
295
- type: String,
296
- default: void 0
297
- },
298
- variant: {
299
- type: String,
300
- default: "primary"
24
+ function s() {
25
+ e.value = !e.value;
301
26
  }
302
- },
303
- emits: ["click", "hide-activity", "show-activity"],
304
- data() {
305
- return {
306
- currentActivity: this.activity
27
+ const d = {
28
+ status: e,
29
+ toggle: s
307
30
  };
308
- },
309
- computed: {
310
- classes() {
311
- return {
312
- disabled: this.disabled,
313
- active: this.active,
314
- "btn-activity": this.activity,
315
- [`btn-activity-${this.orientation.replace("btn-activity-", "")}`]: !!this.orientation,
316
- [`btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-", "")}`]: !!this.indicatorProps.type
317
- };
318
- },
319
- indicatorProps() {
320
- return Object.assign(
31
+ return (a, o) => (l(), b("button", {
32
+ type: "button",
33
+ disabled: t.disabled,
34
+ class: c([
35
+ "btn",
36
+ t.variant,
37
+ t.size,
321
38
  {
322
- type: "spinner"
323
- },
324
- (typeof this.indicator == "string" ? {
325
- type: this.indicator
326
- } : this.indicator) || {}
327
- );
328
- }
329
- },
330
- watch: {
331
- activity(t) {
332
- t ? this.showActivity() : this.hideActivity();
333
- }
334
- },
335
- mounted() {
336
- this.activity && this.showActivity();
337
- },
338
- methods: {
339
- disable() {
340
- this.$el.disabled = !0, this.$el.classList.add("disabled");
341
- },
342
- enable() {
343
- this.$el.disabled = !1, this.$el.classList.remove("disabled");
344
- },
345
- hideActivity() {
346
- this.$el.classList.add("btn-hide-activity"), z(this.$el, () => {
347
- this.disabled || this.enable(), this.currentActivity = !1, this.$el.classList.remove("btn-activity", "btn-hide-activity"), this.$emit("hide-activity");
348
- });
349
- },
350
- showActivity() {
351
- this.currentActivity = !0, this.disable(), z(this.$el, () => {
352
- this.$el.classList.add("btn-activity"), this.$emit("show-activity");
353
- });
354
- },
355
- toggle() {
356
- this.currentActivity ? this.hideActivity() : this.showActivity();
357
- }
39
+ "w-full": t.block,
40
+ "gap-1": ["xs", "sm"].includes(t.indicatorSize),
41
+ "gap-2": ["md", "lg", "xl"].includes(t.indicatorSize),
42
+ "flex-col-reverse": t.orientation === "top",
43
+ "flex-col": t.orientation === "bottom",
44
+ "flex-row-reverse": t.orientation === "left",
45
+ "inline-flex items-center justify-center": !0,
46
+ "opacity-50 cursor-not-allowed": t.disabled
47
+ }
48
+ ]),
49
+ onClick: o[0] || (o[0] = (u) => i("click", u, d))
50
+ }, [
51
+ x(a.$slots, "default", {}, () => [
52
+ k(z(t.label), 1)
53
+ ]),
54
+ h(g, {
55
+ "enter-active-class": "transition-all ease-out duration-250",
56
+ "enter-from-class": "opacity-0",
57
+ "enter-to-class": "opacity-100",
58
+ "leave-active-class": "transition-all ease-in duration-250",
59
+ "leave-from-class": "opacity-100",
60
+ "leave-to-class": "opacity-0"
61
+ }, {
62
+ default: w(() => [
63
+ e.value ? (l(), B(C(A), {
64
+ key: 0,
65
+ type: t.indicator,
66
+ size: t.indicatorSize,
67
+ class: c({
68
+ "pt-1": t.orientation === "top",
69
+ "pb-1": t.orientation === "bottom",
70
+ "pr-1": t.orientation === "left",
71
+ "pl-1": t.orientation === "right"
72
+ })
73
+ }, null, 8, ["type", "size", "class"])) : S("", !0)
74
+ ]),
75
+ _: 1
76
+ })
77
+ ], 10, N));
358
78
  }
359
79
  });
360
- const ot = (t, i) => {
361
- const e = t.__vccOpts || t;
362
- for (const [n, s] of i)
363
- e[n] = s;
364
- return e;
365
- };
366
- function ct(t, i, e, n, s, o) {
367
- const c = P("activity-indicator"), v = P("btn");
368
- return a(), y(v, w({
369
- active: t.active,
370
- block: t.block,
371
- disabled: t.disabled,
372
- size: t.size,
373
- tag: t.tag,
374
- variant: t.variant,
375
- class: t.classes
376
- }, Object.assign({}, t.$attrs, { onClick: void 0 }), {
377
- onClick: i[0] || (i[0] = (l) => !t.disabled && t.$emit("click", l, {
378
- disable: t.disable,
379
- enable: t.enable,
380
- toggle: t.toggle,
381
- showActivity: t.showActivity,
382
- hideActivity: t.hideActivity
383
- }))
384
- }), {
385
- default: A(() => [
386
- C(t.$slots, "default", {}, () => [
387
- k(f(t.label), 1)
388
- ]),
389
- _(c, H(R(t.indicatorProps)), null, 16)
390
- ]),
391
- _: 3
392
- }, 16, ["active", "block", "disabled", "size", "tag", "variant", "class"]);
393
- }
394
- const ht = /* @__PURE__ */ ot(at, [["render", ct]]);
395
80
  export {
396
- ht as BtnActivity
81
+ T as BtnActivity
397
82
  };
83
+ //# sourceMappingURL=btn-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"btn-activity.js","sources":["../src/BtnActivity.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { ref, watch, watchEffect, type Component, type Ref } from 'vue';\nimport { ActivityIndicatorSize } from '../../activity-indicator/src/ActivityIndicator.vue';\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: ActivityIndicatorSize;\n label?: string;\n orientation?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: string;\n block?: boolean; \n disabled?: boolean;\n};\n\nconst props = withDefaults(defineProps<BtnActivityProps>(), {\n indicatorSize: 'xs',\n label: undefined,\n orientation: 'right',\n variant: 'btn-primary',\n size: 'btn-md'\n});\n\nexport type BtnActivityContext = {\n status: Ref<boolean>;\n toggle: () => void;\n}\n\nconst emit = defineEmits<{\n click: [event: MouseEvent, context: BtnActivityContext];\n 'hide-activity': [];\n 'show-activity': [];\n}>();\n\nconst status = ref(props.activity);\n\nwatchEffect(() => {\n status.value = props.activity;\n});\n\nwatch(status, (value) => {\n if(value) {\n emit('show-activity');\n } \n else {\n emit('hide-activity');\n }\n});\n\nfunction toggle() {\n status.value = !status.value;\n}\n\nconst context = {\n status,\n toggle,\n};\n</script>\n\n<template>\n <button\n type=\"button\"\n :disabled=\"disabled\"\n :class=\"[\n 'btn',\n variant,\n size,\n {\n 'w-full': block,\n 'gap-1': ['xs', 'sm'].includes(indicatorSize),\n 'gap-2': ['md', 'lg', 'xl'].includes(indicatorSize),\n 'flex-col-reverse': orientation === 'top',\n 'flex-col': orientation === 'bottom',\n 'flex-row-reverse': orientation === 'left',\n 'inline-flex items-center justify-center': true,\n 'opacity-50 cursor-not-allowed': disabled,\n }\n ]\"\n @click=\"emit('click', $event, context)\"> \n <slot>{{ label }}</slot>\n <Transition\n enter-active-class=\"transition-all ease-out duration-250\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition-all ease-in duration-250\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\">\n <ActivityIndicator\n v-if=\"status\"\n :type=\"indicator\"\n :size=\"indicatorSize\"\n :class=\"{\n 'pt-1': orientation === 'top',\n 'pb-1': orientation === 'bottom',\n 'pr-1': orientation === 'left',\n 'pl-1': orientation === 'right',\n }\" />\n </Transition>\n </button>\n</template>"],"names":["props","__props","emit","__emit","status","ref","watchEffect","watch","value","toggle","context","_createElementBlock","_normalizeClass","_cache","$event","_renderSlot","_ctx","_createVNode","_Transition","_createBlock","_unref","ActivityIndicator"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,UAAMA,IAAQC,GAaRC,IAAOC,GAMPC,IAASC,EAAIL,EAAM,QAAQ;AAEjC,IAAAM,EAAY,MAAM;AACd,MAAAF,EAAO,QAAQJ,EAAM;AAAA,IACzB,CAAC,GAEDO,EAAMH,GAAQ,CAACI,MAAU;AACrB,MACIN,EADDM,IACM,kBAGA,eAHe;AAAA,IAK5B,CAAC;AAED,aAASC,IAAS;AACd,MAAAL,EAAO,QAAQ,CAACA,EAAO;AAAA,IAC3B;AAEA,UAAMM,IAAU;AAAA,MACZ,QAAAN;AAAA,MACA,QAAAK;AAAA,IAAA;2BAKAE,EAsCS,UAAA;AAAA,MArCL,MAAK;AAAA,MACJ,UAAUV,EAAA;AAAA,MACV,OAAKW,EAAA;AAAA;QAAmCX,EAAA;AAAA,QAAqBA,EAAA;AAAA;oBAA8CA,EAAA;AAAA,UAA6C,SAAA,CAAA,MAAA,IAAA,EAAA,SAASA,EAAA,aAAa;AAAA,UAA+C,SAAA,CAAA,MAAA,MAAA,IAAA,EAAA,SAASA,EAAA,aAAa;AAAA,8BAAuCA,EAAA,gBAAW;AAAA,sBAAwCA,EAAA,gBAAW;AAAA,8BAAmDA,EAAA,gBAAW;AAAA;2CAA+HA,EAAA;AAAA,QAAA;AAAA;MAerhB,SAAKY,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEZ,EAAI,SAAUY,GAAQJ,CAAO;AAAA,IAAA;MACrCK,EAAwBC,yBAAxB,MAAwB;AAAA,YAAff,EAAA,KAAK,GAAA,CAAA;AAAA,MAAA;MACdgB,EAiBaC,GAAA;AAAA,QAhBT,sBAAmB;AAAA,QACnB,oBAAiB;AAAA,QACjB,kBAAe;AAAA,QACf,sBAAmB;AAAA,QACnB,oBAAiB;AAAA,QACjB,kBAAe;AAAA,MAAA;;UAELd,EAAA,cADVe,EASSC,EAAAC,CAAA,GAAA;AAAA;YAPJ,MAAMpB,EAAA;AAAA,YACN,MAAMA,EAAA;AAAA,YACN,OAAKW,EAAA;AAAA,sBAAgCX,EAAA,gBAAW;AAAA,sBAAwCA,EAAA,gBAAW;AAAA,sBAA2CA,EAAA,gBAAW;AAAA,sBAAyCA,EAAA,gBAAW;AAAA,YAAA;;;;;;;;"}
@@ -1 +1,2 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a.BtnActivity={},a.Vue))})(this,function(a,e){"use strict";function o(t,i="px"){return t!=null&&t!==!1&&isFinite(t)?`${t}${i}`:t}const v=e.defineComponent({props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:String,default:"indicators"},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},data:()=>({is:null}),setup(t){return{registryInstance:e.inject(t.registry||"indicators")}},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:o(this.width),maxWidth:o(this.maxWidth),minWidth:o(this.minWidth),height:o(this.height),maxHeight:o(this.maxHeight),minHeight:o(this.minHeight)}}},async mounted(){const t=await this.component();this.is=()=>t},methods:{async component(){let t=this.registryInstance.get(this.type);return t instanceof Promise?t:(typeof t=="function"&&(t=await t()),t.default?t.default:t)}}}),$=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s},P={class:"activity-indicator-content"},S={key:1,class:"activity-indicator-label"};function x(t,i,s,r,n,d){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["activity-indicator",t.classes]),style:e.normalizeStyle(t.style)},[e.createElementVNode("div",P,[t.is?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.is()),{key:0,class:"mx-auto"})):e.createCommentVNode("",!0),t.label?(e.openBlock(),e.createElementBlock("div",S,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0)])],6)}const z=$(v,[["render",x]]);var C=Object.defineProperty,w=(t,i,s)=>i in t?C(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s,A=(t,i,s)=>(w(t,typeof i!="symbol"?i+"":i,s),s),c=function(){return c=Object.assign||function(t){for(var i,s=1,r=arguments.length;s<r;s++){i=arguments[s];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},c.apply(this,arguments)};function k(t){return t.toLowerCase()}var B=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],j=/[^A-Z0-9]+/gi;function O(t,i){i===void 0&&(i={});for(var s=i.splitRegexp,r=s===void 0?B:s,n=i.stripRegexp,d=n===void 0?j:n,h=i.transform,f=h===void 0?k:h,p=i.delimiter,q=p===void 0?" ":p,m=b(b(t,r,"$1\0$2"),d,"\0"),u=0,y=m.length;m.charAt(u)==="\0";)u++;for(;m.charAt(y-1)==="\0";)y--;return m.slice(u,y).split("\0").map(f).join(q)}function b(t,i,s){return i instanceof RegExp?t.replace(i,s):i.reduce(function(r,n){return r.replace(n,s)},t)}function N(t,i){return i===void 0&&(i={}),O(t,c({delimiter:"."},i))}function l(t,i){return i===void 0&&(i={}),N(t,c({delimiter:"-"},i))}class _{constructor(i={}){A(this,"components"),this.components=new Map,Object.entries(i).forEach(([s,r])=>{this.register(s,r)})}get(i){const s=this.components.get(i=l(i));if(s)return s;throw new Error(`"${i}" has not been registered yet!`)}register(i,s){return typeof i=="object"?(Object.entries(i).forEach(([r,n])=>{this.register(l(r),n)}),this):(this.components.set(l(i),s),this)}remove(i){return this.components.delete(l(i)),this}reset(){return this.components=new Map,this}}function E(t={}){return new _(t)}E();const V={props:{componentPrefix:String,size:String,sizePrefix:String},computed:{sizeableClassPrefix(){return this.sizePrefix||this.componentPrefix},hasSizeablePrefix(){return this.size===void 0?!1:!!this.size.match(new RegExp(`^${this.sizeableClassPrefix}`))},sizeableClass(){return this.size?!this.sizeableClassPrefix||this.hasSizeablePrefix?this.size:`${this.sizeableClassPrefix}-${this.size}`:""}}},D={props:{componentPrefix:String,variant:String,variantPrefix:String},computed:{variantClassPrefix(){return this.variantPrefix||this.componentPrefix},hasVariantPrefix(){return this.variant===void 0?!1:!!this.variant.match(new RegExp(`^${this.variantClassPrefix}`))},variantClass(){return this.variant?!this.variantClassPrefix||this.hasVariantPrefix?this.variant:`${this.variantClassPrefix}-${this.variant}`:""}}},H=e.defineComponent({mixins:[V,D],props:{active:Boolean,block:Boolean,componentPrefix:{type:String,default:"btn"},disabled:Boolean,label:String,outline:Boolean,tag:String,variant:{type:String,default:"primary"}},computed:{classes(){return["btn",this.variantClass,this.sizeableClass,this.active&&"active",this.block&&"btn-block",this.disabled&&"disabled"]},component(){return this.tag?this.tag:this.$attrs.href?"a":"button"},variantClassPrefix(){return(this.variantPrefix||this.componentPrefix)+(this.outline?"-outline":"")}}}),R=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s};function T(t,i,s,r,n,d){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),e.mergeProps(t.$attrs,{disabled:t.disabled,class:t.classes,role:"button"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])]),_:3},16,["disabled","class"])}const W=R(H,[["render",T]]),L=function(t){const i=parseFloat(t||0),s=t&&t.match(/m?s/),r=s?s[0]:!1;let n;switch(r){case"s":n=i*1e3;break;case"ms":default:n=i;break}return n||0},g=function(t,i){const s=(t.ownerDocument||document).defaultView;setTimeout(i,L(s==null?void 0:s.getComputedStyle(t).animationDuration))},I=e.defineComponent({components:{ActivityIndicator:z,Btn:W},inheritAttrs:!1,props:{active:Boolean,activity:Boolean,block:Boolean,disabled:Boolean,indicator:{type:[Object,String],default:"spinner"},label:{type:String,default:void 0},orientation:{type:String,default:"right"},size:{type:String,default:"md"},tag:{type:String,default:void 0},variant:{type:String,default:"primary"}},emits:["click","hide-activity","show-activity"],data(){return{currentActivity:this.activity}},computed:{classes(){return{disabled:this.disabled,active:this.active,"btn-activity":this.activity,[`btn-activity-${this.orientation.replace("btn-activity-","")}`]:!!this.orientation,[`btn-activity-indicator-${this.indicatorProps.type.replace("btn-activity-indicator-","")}`]:!!this.indicatorProps.type}},indicatorProps(){return Object.assign({type:"spinner"},(typeof this.indicator=="string"?{type:this.indicator}:this.indicator)||{})}},watch:{activity(t){t?this.showActivity():this.hideActivity()}},mounted(){this.activity&&this.showActivity()},methods:{disable(){this.$el.disabled=!0,this.$el.classList.add("disabled")},enable(){this.$el.disabled=!1,this.$el.classList.remove("disabled")},hideActivity(){this.$el.classList.add("btn-hide-activity"),g(this.$el,()=>{this.disabled||this.enable(),this.currentActivity=!1,this.$el.classList.remove("btn-activity","btn-hide-activity"),this.$emit("hide-activity")})},showActivity(){this.currentActivity=!0,this.disable(),g(this.$el,()=>{this.$el.classList.add("btn-activity"),this.$emit("show-activity")})},toggle(){this.currentActivity?this.hideActivity():this.showActivity()}}}),G="",M=(t,i)=>{const s=t.__vccOpts||t;for(const[r,n]of i)s[r]=n;return s};function Z(t,i,s,r,n,d){const h=e.resolveComponent("activity-indicator"),f=e.resolveComponent("btn");return e.openBlock(),e.createBlock(f,e.mergeProps({active:t.active,block:t.block,disabled:t.disabled,size:t.size,tag:t.tag,variant:t.variant,class:t.classes},Object.assign({},t.$attrs,{onClick:void 0}),{onClick:i[0]||(i[0]=p=>!t.disabled&&t.$emit("click",p,{disable:t.disable,enable:t.enable,toggle:t.toggle,showActivity:t.showActivity,hideActivity:t.hideActivity}))}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),e.createVNode(h,e.normalizeProps(e.guardReactiveProps(t.indicatorProps)),null,16)]),_:3},16,["active","block","disabled","size","tag","variant","class"])}const F=M(I,[["render",Z]]);a.BtnActivity=F,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(i,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vue-interface/activity-indicator")):typeof define=="function"&&define.amd?define(["exports","vue","@vue-interface/activity-indicator"],t):(i=typeof globalThis<"u"?globalThis:i||self,t(i.BtnActivity={},i.Vue,i.VueInterfaceActivityIndicator))})(this,(function(i,t,r){"use strict";const s=["disabled"],d=t.defineComponent({__name:"BtnActivity",props:{activity:{type:Boolean},indicator:{},indicatorSize:{default:"xs"},label:{default:void 0},orientation:{default:"right"},variant:{default:"btn-primary"},size:{default:"btn-md"},block:{type:Boolean},disabled:{type:Boolean}},emits:["click","hide-activity","show-activity"],setup(e,{emit:f}){const c=e,a=f,n=t.ref(c.activity);t.watchEffect(()=>{n.value=c.activity}),t.watch(n,o=>{a(o?"show-activity":"hide-activity")});function y(){n.value=!n.value}const u={status:n,toggle:y};return(o,l)=>(t.openBlock(),t.createElementBlock("button",{type:"button",disabled:e.disabled,class:t.normalizeClass(["btn",e.variant,e.size,{"w-full":e.block,"gap-1":["xs","sm"].includes(e.indicatorSize),"gap-2":["md","lg","xl"].includes(e.indicatorSize),"flex-col-reverse":e.orientation==="top","flex-col":e.orientation==="bottom","flex-row-reverse":e.orientation==="left","inline-flex items-center justify-center":!0,"opacity-50 cursor-not-allowed":e.disabled}]),onClick:l[0]||(l[0]=m=>a("click",m,u))},[t.renderSlot(o.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(e.label),1)]),t.createVNode(t.Transition,{"enter-active-class":"transition-all ease-out duration-250","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-all ease-in duration-250","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:t.withCtx(()=>[n.value?(t.openBlock(),t.createBlock(t.unref(r.ActivityIndicator),{key:0,type:e.indicator,size:e.indicatorSize,class:t.normalizeClass({"pt-1":e.orientation==="top","pb-1":e.orientation==="bottom","pr-1":e.orientation==="left","pl-1":e.orientation==="right"})},null,8,["type","size","class"])):t.createCommentVNode("",!0)]),_:1})],10,s))}});i.BtnActivity=d,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
2
+ //# sourceMappingURL=btn-activity.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"btn-activity.umd.cjs","sources":["../src/BtnActivity.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ActivityIndicator } from '@vue-interface/activity-indicator';\nimport { ref, watch, watchEffect, type Component, type Ref } from 'vue';\nimport { ActivityIndicatorSize } from '../../activity-indicator/src/ActivityIndicator.vue';\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: ActivityIndicatorSize;\n label?: string;\n orientation?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: string;\n block?: boolean; \n disabled?: boolean;\n};\n\nconst props = withDefaults(defineProps<BtnActivityProps>(), {\n indicatorSize: 'xs',\n label: undefined,\n orientation: 'right',\n variant: 'btn-primary',\n size: 'btn-md'\n});\n\nexport type BtnActivityContext = {\n status: Ref<boolean>;\n toggle: () => void;\n}\n\nconst emit = defineEmits<{\n click: [event: MouseEvent, context: BtnActivityContext];\n 'hide-activity': [];\n 'show-activity': [];\n}>();\n\nconst status = ref(props.activity);\n\nwatchEffect(() => {\n status.value = props.activity;\n});\n\nwatch(status, (value) => {\n if(value) {\n emit('show-activity');\n } \n else {\n emit('hide-activity');\n }\n});\n\nfunction toggle() {\n status.value = !status.value;\n}\n\nconst context = {\n status,\n toggle,\n};\n</script>\n\n<template>\n <button\n type=\"button\"\n :disabled=\"disabled\"\n :class=\"[\n 'btn',\n variant,\n size,\n {\n 'w-full': block,\n 'gap-1': ['xs', 'sm'].includes(indicatorSize),\n 'gap-2': ['md', 'lg', 'xl'].includes(indicatorSize),\n 'flex-col-reverse': orientation === 'top',\n 'flex-col': orientation === 'bottom',\n 'flex-row-reverse': orientation === 'left',\n 'inline-flex items-center justify-center': true,\n 'opacity-50 cursor-not-allowed': disabled,\n }\n ]\"\n @click=\"emit('click', $event, context)\"> \n <slot>{{ label }}</slot>\n <Transition\n enter-active-class=\"transition-all ease-out duration-250\"\n enter-from-class=\"opacity-0\"\n enter-to-class=\"opacity-100\"\n leave-active-class=\"transition-all ease-in duration-250\"\n leave-from-class=\"opacity-100\"\n leave-to-class=\"opacity-0\">\n <ActivityIndicator\n v-if=\"status\"\n :type=\"indicator\"\n :size=\"indicatorSize\"\n :class=\"{\n 'pt-1': orientation === 'top',\n 'pb-1': orientation === 'bottom',\n 'pr-1': orientation === 'left',\n 'pl-1': orientation === 'right',\n }\" />\n </Transition>\n </button>\n</template>"],"names":["props","__props","emit","__emit","status","ref","watchEffect","watch","value","toggle","context","_createElementBlock","_normalizeClass","_cache","$event","_renderSlot","_ctx","_createVNode","_Transition","_createBlock","_unref","ActivityIndicator"],"mappings":"ytBAiBA,MAAMA,EAAQC,EAaRC,EAAOC,EAMPC,EAASC,EAAAA,IAAIL,EAAM,QAAQ,EAEjCM,EAAAA,YAAY,IAAM,CACdF,EAAO,MAAQJ,EAAM,QACzB,CAAC,EAEDO,QAAMH,EAASI,GAAU,CAEjBN,EADDM,EACM,gBAGA,eAHe,CAK5B,CAAC,EAED,SAASC,GAAS,CACdL,EAAO,MAAQ,CAACA,EAAO,KAC3B,CAEA,MAAMM,EAAU,CACZ,OAAAN,EACA,OAAAK,CAAA,8BAKAE,EAAAA,mBAsCS,SAAA,CArCL,KAAK,SACJ,SAAUV,EAAA,SACV,MAAKW,EAAAA,eAAA,OAAmCX,EAAA,QAAqBA,EAAA,eAA8CA,EAAA,MAA6C,QAAA,CAAA,KAAA,IAAA,EAAA,SAASA,EAAA,aAAa,EAA+C,QAAA,CAAA,KAAA,KAAA,IAAA,EAAA,SAASA,EAAA,aAAa,qBAAuCA,EAAA,cAAW,iBAAwCA,EAAA,cAAW,4BAAmDA,EAAA,cAAW,oFAA+HA,EAAA,QAAA,IAerhB,QAAKY,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAC,GAAEZ,EAAI,QAAUY,EAAQJ,CAAO,EAAA,GACrCK,EAAAA,WAAwBC,sBAAxB,IAAwB,qCAAff,EAAA,KAAK,EAAA,CAAA,CAAA,GACdgB,EAAAA,YAiBaC,EAAAA,WAAA,CAhBT,qBAAmB,uCACnB,mBAAiB,YACjB,iBAAe,cACf,qBAAmB,sCACnB,mBAAiB,cACjB,iBAAe,WAAA,0BAELd,EAAA,qBADVe,EAAAA,YASSC,EAAAA,MAAAC,EAAAA,iBAAA,EAAA,OAPJ,KAAMpB,EAAA,UACN,KAAMA,EAAA,cACN,MAAKW,EAAAA,eAAA,QAAgCX,EAAA,cAAW,aAAwCA,EAAA,cAAW,gBAA2CA,EAAA,cAAW,cAAyCA,EAAA,cAAW,OAAA"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import BtnActivity from './src/BtnActivity.vue';
1
+ import { default as BtnActivity } from './src/BtnActivity.vue';
2
2
  export { BtnActivity };
@@ -1,169 +1,48 @@
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;
24
- };
25
- /**
26
- * The button label.
27
- */
28
- label: {
29
- type: StringConstructor;
30
- default: undefined;
31
- };
32
- /**
33
- * The orientation of the activity button inside the button.
34
- */
35
- orientation: {
36
- type: StringConstructor;
37
- default: string;
38
- };
39
- /**
40
- * The size of the button.
41
- */
42
- size: {
43
- type: StringConstructor;
44
- default: string;
45
- };
46
- /**
47
- * The HTML tag.
48
- */
49
- tag: {
50
- type: StringConstructor;
51
- default: undefined;
52
- };
53
- /**
54
- * The variant of the button.
55
- */
56
- variant: {
57
- type: StringConstructor;
58
- default: string;
59
- };
60
- }, unknown, {
61
- currentActivity: boolean;
62
- }, {
63
- /**
64
- * An object of classes to append to the button.
65
- */
66
- classes(): {
67
- [x: string]: any;
68
- disabled: any;
69
- active: any;
70
- 'btn-activity': any;
71
- };
72
- indicatorProps(): any;
73
- }, {
74
- /**
75
- * Disable the button.
76
- */
77
- disable(): void;
78
- /**
79
- * Enable the button.
80
- */
81
- enable(): void;
82
- /**
83
- * Hide the activity indicator inside the button.
84
- */
85
- hideActivity(): void;
86
- /**
87
- * Show the activity indicator inside the button.
88
- */
89
- showActivity(): void;
90
- /**
91
- * Show the activity indicator inside the button.
92
- */
93
- toggle(): void;
94
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("click" | "hide-activity" | "show-activity")[], "click" | "hide-activity" | "show-activity", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
95
- /**
96
- * Make the button appear with the active state.
97
- */
98
- active: BooleanConstructor;
99
- /**
100
- * Show the activity indicator inside the button.
101
- */
102
- activity: BooleanConstructor;
103
- /**
104
- * Display the button as block width.
105
- */
106
- block: BooleanConstructor;
107
- /**
108
- * Disable the button.
109
- */
110
- disabled: BooleanConstructor;
111
- /**
112
- * The type of activity indicator inside the button.
113
- */
114
- indicator: {
115
- type: (StringConstructor | ObjectConstructor)[];
116
- default: string;
117
- };
118
- /**
119
- * The button label.
120
- */
121
- label: {
122
- type: StringConstructor;
123
- default: undefined;
124
- };
125
- /**
126
- * The orientation of the activity button inside the button.
127
- */
128
- orientation: {
129
- type: StringConstructor;
130
- default: string;
131
- };
132
- /**
133
- * The size of the button.
134
- */
135
- size: {
136
- type: StringConstructor;
137
- default: string;
138
- };
139
- /**
140
- * The HTML tag.
141
- */
142
- tag: {
143
- type: StringConstructor;
144
- default: undefined;
145
- };
146
- /**
147
- * The variant of the button.
148
- */
149
- variant: {
150
- type: StringConstructor;
151
- default: string;
152
- };
153
- }>> & {
154
- onClick?: ((...args: any[]) => any) | undefined;
155
- "onHide-activity"?: ((...args: any[]) => any) | undefined;
156
- "onShow-activity"?: ((...args: any[]) => any) | undefined;
157
- }, {
158
- label: string;
1
+ import { Component, Ref } from 'vue';
2
+ import { ActivityIndicatorSize } from '../../activity-indicator/src/ActivityIndicator.vue';
3
+ export type BtnActivityProps = {
4
+ activity?: boolean;
5
+ indicator: Component;
6
+ indicatorSize?: ActivityIndicatorSize;
7
+ label?: string;
8
+ orientation?: 'top' | 'bottom' | 'left' | 'right';
9
+ variant?: string;
10
+ size?: string;
11
+ block?: boolean;
12
+ disabled?: boolean;
13
+ };
14
+ export type BtnActivityContext = {
15
+ status: Ref<boolean>;
16
+ toggle: () => void;
17
+ };
18
+ declare function __VLS_template(): {
19
+ attrs: Partial<{}>;
20
+ slots: {
21
+ default?(_: {}): any;
22
+ };
23
+ refs: {};
24
+ rootEl: HTMLButtonElement;
25
+ };
26
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
27
+ declare const __VLS_component: import('vue').DefineComponent<BtnActivityProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
+ click: (event: MouseEvent, context: BtnActivityContext) => any;
29
+ "hide-activity": () => any;
30
+ "show-activity": () => any;
31
+ }, string, import('vue').PublicProps, Readonly<BtnActivityProps> & Readonly<{
32
+ onClick?: ((event: MouseEvent, context: BtnActivityContext) => any) | undefined;
33
+ "onHide-activity"?: (() => any) | undefined;
34
+ "onShow-activity"?: (() => any) | undefined;
35
+ }>, {
159
36
  size: string;
160
- active: boolean;
161
- block: boolean;
162
- disabled: boolean;
163
- tag: string;
37
+ label: string;
38
+ indicatorSize: ActivityIndicatorSize;
39
+ orientation: "top" | "bottom" | "left" | "right";
164
40
  variant: string;
165
- activity: boolean;
166
- indicator: string | Record<string, any>;
167
- orientation: string;
168
- }>;
169
- export default _sfc_main;
41
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
42
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
43
+ export default _default;
44
+ type __VLS_WithTemplateSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
package/index.css ADDED
@@ -0,0 +1,3 @@
1
+ @import "tailwindcss";
2
+ @import "@vue-interface/btn";
3
+ @import "@vue-interface/activity-indicator/css";
package/package.json CHANGED
@@ -1,37 +1,23 @@
1
1
  {
2
2
  "name": "@vue-interface/btn-activity",
3
- "version": "2.0.0-beta.9",
3
+ "version": "3.0.1",
4
4
  "description": "A Vue activity button component.",
5
5
  "type": "module",
6
- "files": [
7
- "dist"
8
- ],
9
6
  "main": "./dist/btn-activity.umd.cjs",
10
7
  "module": "./dist/btn-activity.js",
11
- "style": "./dist/style.css",
12
8
  "types": "./dist/index.d.ts",
13
9
  "exports": {
14
10
  ".": {
15
- "import": "./dist/btn-activity.js",
16
- "require": "./dist/btn-activity.umd.cjs",
17
- "types": "./dist/index.d.ts"
18
- },
19
- "./dist/style.css": "./dist/style.css"
11
+ "source": "./index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "require": "./dist/btn-activity.umd.js",
14
+ "import": "./dist/btn-activity.js"
15
+ }
20
16
  },
21
17
  "browserslist": "last 2 versions, > 0.5%, ie >= 11",
22
- "scripts": {
23
- "dev": "vite",
24
- "build": "vite build",
25
- "preview": "vite preview",
26
- "pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
27
- "release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
28
- "release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
29
- "release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
30
- "release": "git add . -A; git commit; git push --tags origin; npm publish;"
31
- },
32
18
  "repository": {
33
19
  "type": "git",
34
- "url": "git+https://github.com/vue-interface/btn-activity.git"
20
+ "url": "git+https://github.com/vue-interface/vue-interface.github.io"
35
21
  },
36
22
  "keywords": [
37
23
  "Form",
@@ -42,29 +28,26 @@
42
28
  "Bootstrap"
43
29
  ],
44
30
  "author": "Justin Kimbrell",
45
- "license": "ISC",
31
+ "license": "MIT",
46
32
  "bugs": {
47
- "url": "https://github.com/vue-interface/btn-activity/issues"
33
+ "url": "https://github.com/vue-interface/vue-interface.github.io"
48
34
  },
49
- "homepage": "https://github.com/vue-interface/btn-activity/docs#readme",
50
- "dependencies": {
51
- "@vue-interface/activity-indicator": "^2.0.0-beta.7",
52
- "@vue-interface/btn": "^3.0.0-beta.4"
35
+ "homepage": "https://github.com/vue-interface/vue-interface",
36
+ "readme": "README.md",
37
+ "files": [
38
+ "dist",
39
+ "index.css",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "peerDependencies": {
44
+ "vue": "^3.3.4",
45
+ "@vue-interface/activity-indicator": "3.0.1",
46
+ "@vue-interface/btn": "4.0.1"
53
47
  },
54
- "devDependencies": {
55
- "@vitejs/plugin-vue": "^3.1.2",
56
- "@vue/eslint-config-typescript": "^11.0.2",
57
- "autoprefixer": "^10.4.2",
58
- "babel-eslint": "^10.1.0",
59
- "babel-preset-vue": "^2.0.2",
60
- "change-case": "^4.1.2",
61
- "eslint": "^8.25.0",
62
- "eslint-plugin-vue": "^9.6.0",
63
- "pascalcase": "^2.0.0",
64
- "postcss": "^8.4.6",
65
- "tailwindcss": "^3.0.18",
66
- "vite": "^3.1.7",
67
- "vite-plugin-dts": "^1.7.1",
68
- "vue": "^3.2.40"
48
+ "scripts": {
49
+ "dev": "vite",
50
+ "build": "vue-tsc && vite build",
51
+ "preview": "vite preview"
69
52
  }
70
- }
53
+ }
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- @-webkit-keyframes btn-activity-in{0%,to{-webkit-transform:scale(1);transform:scale(1)}30%{-webkit-transform:scale(.98);transform:scale(.98)}}@keyframes btn-activity-in{0%,to{-webkit-transform:scale(1);transform:scale(1)}30%{-webkit-transform:scale(.98);transform:scale(.98)}}@-webkit-keyframes btn-activity-out{0%,to{-webkit-transform:scale(1);transform:scale(1)}70%{-webkit-transform:scale(.98);transform:scale(.98)}}@keyframes btn-activity-out{0%,to{-webkit-transform:scale(1);transform:scale(1)}70%{-webkit-transform:scale(.98);transform:scale(.98)}}.btn-activity-top,.btn.btn-activity-top,.btn-activity-bottom,.btn.btn-activity-bottom,.btn-activity-left,.btn.btn-activity-left,.btn-activity-right,.btn.btn-activity-right{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;position:relative;-webkit-transition:all 166.5ms ease-in;transition:all 166.5ms ease-in}.btn-activity-top .activity-indicator,.btn-activity-bottom .activity-indicator,.btn-activity-left .activity-indicator,.btn-activity-right .activity-indicator{opacity:0;position:absolute;visibility:hidden;-webkit-transition:opacity 333ms ease-in;transition:opacity 333ms ease-in}.btn-activity-top,.btn-activity-bottom{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.btn-activity-top .activity-indicator,.btn-activity-bottom .activity-indicator{margin-left:auto;margin-right:auto}.btn-activity-top{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.btn-activity-top .activity-indicator{padding-bottom:1em}.btn-activity-bottom .activity-indicator{padding-top:1em}.btn-activity-left,.btn-activity-right{-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.btn-activity-left{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.btn-activity-left .activity-indicator{padding-right:1em}.btn-activity-right .activity-indicator{padding-left:1em}.btn-activity:not(.btn-link){-webkit-animation:btn-activity-in 333ms;animation:btn-activity-in 333ms}.btn-hide-activity:not(.btn-link){-webkit-animation:btn-activity-out 333ms;animation:btn-activity-out 333ms}.btn-activity.btn-hide-activity .activity-indicator{opacity:0}.btn-activity .activity-indicator{opacity:1;visibility:visible;position:relative;font-size:.55em}