@vue-interface/btn-activity 4.0.8 → 4.0.10
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/dist/btn-activity.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ActivityIndicator as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as y, ref as u, watchEffect as v, watch as f, openBlock as n, createElementBlock as b, normalizeClass as o, renderSlot as x, createTextVNode as h, toDisplayString as k, createVNode as z, Transition as g, withCtx as w, createBlock as B, unref as S, createCommentVNode as p } from "vue";
|
|
2
|
+
import { ActivityIndicator as C } from "@vue-interface/activity-indicator";
|
|
3
|
+
const A = ["disabled"], E = /* @__PURE__ */ y({
|
|
4
4
|
__name: "BtnActivity",
|
|
5
5
|
props: {
|
|
6
6
|
activity: { type: Boolean },
|
|
7
7
|
indicator: {},
|
|
8
|
-
indicatorSize: { default: "xs" },
|
|
8
|
+
indicatorSize: { default: "activity-indicator-xs" },
|
|
9
9
|
label: { default: void 0 },
|
|
10
|
-
|
|
10
|
+
placement: { default: "right" },
|
|
11
11
|
variant: { default: "btn-primary" },
|
|
12
12
|
size: { default: "btn-md" },
|
|
13
13
|
block: { type: Boolean },
|
|
14
14
|
disabled: { type: Boolean }
|
|
15
15
|
},
|
|
16
16
|
emits: ["click", "hide-activity", "show-activity"],
|
|
17
|
-
setup(t, { emit:
|
|
18
|
-
const
|
|
17
|
+
setup(t, { emit: s }) {
|
|
18
|
+
const c = t, i = s, e = u(c.activity);
|
|
19
19
|
v(() => {
|
|
20
|
-
e.value =
|
|
21
|
-
}),
|
|
20
|
+
e.value = c.activity;
|
|
21
|
+
}), f(e, (a) => {
|
|
22
22
|
i(a ? "show-activity" : "hide-activity");
|
|
23
23
|
});
|
|
24
|
-
function
|
|
24
|
+
function d() {
|
|
25
25
|
e.value = !e.value;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const r = {
|
|
28
28
|
status: e,
|
|
29
|
-
toggle:
|
|
29
|
+
toggle: d
|
|
30
30
|
};
|
|
31
|
-
return (a,
|
|
31
|
+
return (a, l) => (n(), b("button", {
|
|
32
32
|
type: "button",
|
|
33
33
|
disabled: t.disabled,
|
|
34
|
-
class:
|
|
34
|
+
class: o([
|
|
35
35
|
"btn",
|
|
36
36
|
t.variant,
|
|
37
37
|
t.size,
|
|
38
38
|
{
|
|
39
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.
|
|
43
|
-
"flex-col": t.
|
|
44
|
-
"flex-row-reverse": t.
|
|
40
|
+
"gap-1": ["activity-indicator-xs", "activity-indicator-sm"].includes(t.indicatorSize),
|
|
41
|
+
"gap-2": ["activity-indicator-md", "activity-indicator-lg", "activity-indicator-xl"].includes(t.indicatorSize),
|
|
42
|
+
"flex-col-reverse": t.placement === "top",
|
|
43
|
+
"flex-col": t.placement === "bottom",
|
|
44
|
+
"flex-row-reverse": t.placement === "left",
|
|
45
45
|
"inline-flex items-center justify-center": !0,
|
|
46
46
|
"opacity-50 cursor-not-allowed": t.disabled
|
|
47
47
|
}
|
|
48
48
|
]),
|
|
49
|
-
onClick:
|
|
49
|
+
onClick: l[0] || (l[0] = (m) => i("click", m, r))
|
|
50
50
|
}, [
|
|
51
51
|
x(a.$slots, "default", {}, () => [
|
|
52
|
-
k(
|
|
52
|
+
h(k(t.label), 1)
|
|
53
53
|
]),
|
|
54
|
-
|
|
54
|
+
z(g, {
|
|
55
55
|
"enter-active-class": "transition-all ease-out duration-250",
|
|
56
56
|
"enter-from-class": "opacity-0",
|
|
57
57
|
"enter-to-class": "opacity-100",
|
|
@@ -60,24 +60,24 @@ const N = ["disabled"], T = /* @__PURE__ */ f({
|
|
|
60
60
|
"leave-to-class": "opacity-0"
|
|
61
61
|
}, {
|
|
62
62
|
default: w(() => [
|
|
63
|
-
e.value ? (
|
|
63
|
+
e.value ? (n(), B(S(C), {
|
|
64
64
|
key: 0,
|
|
65
65
|
type: t.indicator,
|
|
66
66
|
size: t.indicatorSize,
|
|
67
|
-
class:
|
|
68
|
-
"pt-1": t.
|
|
69
|
-
"pb-1": t.
|
|
70
|
-
"pr-1": t.
|
|
71
|
-
"pl-1": t.
|
|
67
|
+
class: o({
|
|
68
|
+
"pt-1": t.placement === "top",
|
|
69
|
+
"pb-1": t.placement === "bottom",
|
|
70
|
+
"pr-1": t.placement === "left",
|
|
71
|
+
"pl-1": t.placement === "right"
|
|
72
72
|
})
|
|
73
|
-
}, null, 8, ["type", "size", "class"])) :
|
|
73
|
+
}, null, 8, ["type", "size", "class"])) : p("", !0)
|
|
74
74
|
]),
|
|
75
75
|
_: 1
|
|
76
76
|
})
|
|
77
|
-
], 10,
|
|
77
|
+
], 10, A));
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
E as BtnActivity
|
|
82
82
|
};
|
|
83
83
|
//# sourceMappingURL=btn-activity.js.map
|
package/dist/btn-activity.js.map
CHANGED
|
@@ -1 +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 {
|
|
1
|
+
{"version":3,"file":"btn-activity.js","sources":["../src/BtnActivity.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ActivityIndicator, type ActivityIndicatorSizePrefix } from '@vue-interface/activity-indicator';\nimport { ref, watch, watchEffect, type Component, type Ref } from 'vue';\nimport type { ComponentSize } from '@vue-interface/sizeable';\n\nexport type BtnSizePrefix = 'btn';\nexport type IndicatorSize = ComponentSize<ActivityIndicatorSizePrefix>;\nexport type BtnSize = ComponentSize<BtnSizePrefix>;\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: IndicatorSize;\n label?: string;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: BtnSize;\n block?: boolean; \n disabled?: boolean;\n};\n\nconst props = withDefaults(defineProps<BtnActivityProps>(), {\n indicatorSize: 'activity-indicator-xs',\n label: undefined,\n placement: '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': ['activity-indicator-xs', 'activity-indicator-sm'].includes(indicatorSize as string),\n 'gap-2': ['activity-indicator-md', 'activity-indicator-lg', 'activity-indicator-xl'].includes(indicatorSize as string),\n 'flex-col-reverse': placement === 'top',\n 'flex-col': placement === 'bottom',\n 'flex-row-reverse': placement === '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': placement === 'top',\n 'pb-1': placement === 'bottom',\n 'pr-1': placement === 'left',\n 'pl-1': placement === '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":";;;;;;;;;;;;;;;;;AAqBA,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,UAAmF,SAAA,CAAA,yBAAA,uBAAA,EAAA,SAASA,EAAA,aAAa;AAAA,UAAkH,SAAA,CAAA,yBAAA,yBAAA,uBAAA,EAAA,SAASA,EAAA,aAAa;AAAA,8BAAiDA,EAAA,cAAS;AAAA,sBAAwCA,EAAA,cAAS;AAAA,8BAAmDA,EAAA,cAAS;AAAA;2CAA+HA,EAAA;AAAA,QAAA;AAAA;MAeloB,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;mBACf,MASS;AAAA,UARCd,EAAA,cADVe,EASSC,EAAAC,CAAA,GAAA;AAAA;YAPJ,MAAMpB,EAAA;AAAA,YACN,MAAMA,EAAA;AAAA,YACN,OAAKW,EAAA;AAAA,sBAAgCX,EAAA,cAAS;AAAA,sBAAwCA,EAAA,cAAS;AAAA,sBAA2CA,EAAA,cAAS;AAAA,sBAAyCA,EAAA,cAAS;AAAA,YAAA;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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,
|
|
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,d){"use strict";const s=["disabled"],r=t.defineComponent({__name:"BtnActivity",props:{activity:{type:Boolean},indicator:{},indicatorSize:{default:"activity-indicator-xs"},label:{default:void 0},placement:{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 l=e,n=f,a=t.ref(l.activity);t.watchEffect(()=>{a.value=l.activity}),t.watch(a,c=>{n(c?"show-activity":"hide-activity")});function y(){a.value=!a.value}const m={status:a,toggle:y};return(c,o)=>(t.openBlock(),t.createElementBlock("button",{type:"button",disabled:e.disabled,class:t.normalizeClass(["btn",e.variant,e.size,{"w-full":e.block,"gap-1":["activity-indicator-xs","activity-indicator-sm"].includes(e.indicatorSize),"gap-2":["activity-indicator-md","activity-indicator-lg","activity-indicator-xl"].includes(e.indicatorSize),"flex-col-reverse":e.placement==="top","flex-col":e.placement==="bottom","flex-row-reverse":e.placement==="left","inline-flex items-center justify-center":!0,"opacity-50 cursor-not-allowed":e.disabled}]),onClick:o[0]||(o[0]=u=>n("click",u,m))},[t.renderSlot(c.$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(()=>[a.value?(t.openBlock(),t.createBlock(t.unref(d.ActivityIndicator),{key:0,type:e.indicator,size:e.indicatorSize,class:t.normalizeClass({"pt-1":e.placement==="top","pb-1":e.placement==="bottom","pr-1":e.placement==="left","pl-1":e.placement==="right"})},null,8,["type","size","class"])):t.createCommentVNode("",!0)]),_:1})],10,s))}});i.BtnActivity=r,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
|
|
2
2
|
//# sourceMappingURL=btn-activity.umd.cjs.map
|
|
@@ -1 +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 {
|
|
1
|
+
{"version":3,"file":"btn-activity.umd.cjs","sources":["../src/BtnActivity.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ActivityIndicator, type ActivityIndicatorSizePrefix } from '@vue-interface/activity-indicator';\nimport { ref, watch, watchEffect, type Component, type Ref } from 'vue';\nimport type { ComponentSize } from '@vue-interface/sizeable';\n\nexport type BtnSizePrefix = 'btn';\nexport type IndicatorSize = ComponentSize<ActivityIndicatorSizePrefix>;\nexport type BtnSize = ComponentSize<BtnSizePrefix>;\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: IndicatorSize;\n label?: string;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: BtnSize;\n block?: boolean; \n disabled?: boolean;\n};\n\nconst props = withDefaults(defineProps<BtnActivityProps>(), {\n indicatorSize: 'activity-indicator-xs',\n label: undefined,\n placement: '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': ['activity-indicator-xs', 'activity-indicator-sm'].includes(indicatorSize as string),\n 'gap-2': ['activity-indicator-md', 'activity-indicator-lg', 'activity-indicator-xl'].includes(indicatorSize as string),\n 'flex-col-reverse': placement === 'top',\n 'flex-col': placement === 'bottom',\n 'flex-row-reverse': placement === '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': placement === 'top',\n 'pb-1': placement === 'bottom',\n 'pr-1': placement === 'left',\n 'pl-1': placement === '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":"0uBAqBA,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,MAAmF,QAAA,CAAA,wBAAA,uBAAA,EAAA,SAASA,EAAA,aAAa,EAAkH,QAAA,CAAA,wBAAA,wBAAA,uBAAA,EAAA,SAASA,EAAA,aAAa,qBAAiDA,EAAA,YAAS,iBAAwCA,EAAA,YAAS,4BAAmDA,EAAA,YAAS,oFAA+HA,EAAA,QAAA,IAeloB,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,qBACf,IASS,CARCd,EAAA,qBADVe,EAAAA,YASSC,EAAAA,MAAAC,EAAAA,iBAAA,EAAA,OAPJ,KAAMpB,EAAA,UACN,KAAMA,EAAA,cACN,MAAKW,EAAAA,eAAA,QAAgCX,EAAA,YAAS,aAAwCA,EAAA,YAAS,gBAA2CA,EAAA,YAAS,cAAyCA,EAAA,YAAS,OAAA"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { ActivityIndicatorSizePrefix } from '@vue-interface/activity-indicator';
|
|
1
2
|
import { Component, Ref } from 'vue';
|
|
2
|
-
import {
|
|
3
|
+
import { ComponentSize } from '@vue-interface/sizeable';
|
|
4
|
+
export type BtnSizePrefix = 'btn';
|
|
5
|
+
export type IndicatorSize = ComponentSize<ActivityIndicatorSizePrefix>;
|
|
6
|
+
export type BtnSize = ComponentSize<BtnSizePrefix>;
|
|
3
7
|
export type BtnActivityProps = {
|
|
4
8
|
activity?: boolean;
|
|
5
9
|
indicator: Component;
|
|
6
|
-
indicatorSize?:
|
|
10
|
+
indicatorSize?: IndicatorSize;
|
|
7
11
|
label?: string;
|
|
8
|
-
|
|
12
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
9
13
|
variant?: string;
|
|
10
|
-
size?:
|
|
14
|
+
size?: BtnSize;
|
|
11
15
|
block?: boolean;
|
|
12
16
|
disabled?: boolean;
|
|
13
17
|
};
|
|
@@ -33,10 +37,10 @@ declare const __VLS_component: import('vue').DefineComponent<BtnActivityProps, {
|
|
|
33
37
|
"onHide-activity"?: (() => any) | undefined;
|
|
34
38
|
"onShow-activity"?: (() => any) | undefined;
|
|
35
39
|
}>, {
|
|
36
|
-
size:
|
|
40
|
+
size: BtnSize;
|
|
37
41
|
label: string;
|
|
38
|
-
indicatorSize:
|
|
39
|
-
|
|
42
|
+
indicatorSize: IndicatorSize;
|
|
43
|
+
placement: "top" | "bottom" | "left" | "right";
|
|
40
44
|
variant: string;
|
|
41
45
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
42
46
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/btn-activity",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
4
4
|
"description": "A Vue activity button component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/btn-activity.umd.cjs",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"vue": "^3.3.4",
|
|
48
|
-
"@vue-interface/
|
|
48
|
+
"@vue-interface/sizeable": "2.0.0",
|
|
49
|
+
"@vue-interface/activity-indicator": "3.0.8",
|
|
49
50
|
"@vue-interface/btn": "5.0.5"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
package/src/BtnActivity.vue
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { ActivityIndicator } from '@vue-interface/activity-indicator';
|
|
2
|
+
import { ActivityIndicator, type ActivityIndicatorSizePrefix } from '@vue-interface/activity-indicator';
|
|
3
3
|
import { ref, watch, watchEffect, type Component, type Ref } from 'vue';
|
|
4
|
-
import {
|
|
4
|
+
import type { ComponentSize } from '@vue-interface/sizeable';
|
|
5
|
+
|
|
6
|
+
export type BtnSizePrefix = 'btn';
|
|
7
|
+
export type IndicatorSize = ComponentSize<ActivityIndicatorSizePrefix>;
|
|
8
|
+
export type BtnSize = ComponentSize<BtnSizePrefix>;
|
|
5
9
|
|
|
6
10
|
export type BtnActivityProps = {
|
|
7
11
|
activity?: boolean;
|
|
8
12
|
indicator: Component;
|
|
9
|
-
indicatorSize?:
|
|
13
|
+
indicatorSize?: IndicatorSize;
|
|
10
14
|
label?: string;
|
|
11
|
-
|
|
15
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
12
16
|
variant?: string;
|
|
13
|
-
size?:
|
|
17
|
+
size?: BtnSize;
|
|
14
18
|
block?: boolean;
|
|
15
19
|
disabled?: boolean;
|
|
16
20
|
};
|
|
17
21
|
|
|
18
22
|
const props = withDefaults(defineProps<BtnActivityProps>(), {
|
|
19
|
-
indicatorSize: 'xs',
|
|
23
|
+
indicatorSize: 'activity-indicator-xs',
|
|
20
24
|
label: undefined,
|
|
21
|
-
|
|
25
|
+
placement: 'right',
|
|
22
26
|
variant: 'btn-primary',
|
|
23
27
|
size: 'btn-md'
|
|
24
28
|
});
|
|
@@ -69,11 +73,11 @@ const context = {
|
|
|
69
73
|
size,
|
|
70
74
|
{
|
|
71
75
|
'w-full': block,
|
|
72
|
-
'gap-1': ['xs', 'sm'].includes(indicatorSize),
|
|
73
|
-
'gap-2': ['md', 'lg', 'xl'].includes(indicatorSize),
|
|
74
|
-
'flex-col-reverse':
|
|
75
|
-
'flex-col':
|
|
76
|
-
'flex-row-reverse':
|
|
76
|
+
'gap-1': ['activity-indicator-xs', 'activity-indicator-sm'].includes(indicatorSize as string),
|
|
77
|
+
'gap-2': ['activity-indicator-md', 'activity-indicator-lg', 'activity-indicator-xl'].includes(indicatorSize as string),
|
|
78
|
+
'flex-col-reverse': placement === 'top',
|
|
79
|
+
'flex-col': placement === 'bottom',
|
|
80
|
+
'flex-row-reverse': placement === 'left',
|
|
77
81
|
'inline-flex items-center justify-center': true,
|
|
78
82
|
'opacity-50 cursor-not-allowed': disabled,
|
|
79
83
|
}
|
|
@@ -92,10 +96,10 @@ const context = {
|
|
|
92
96
|
:type="indicator"
|
|
93
97
|
:size="indicatorSize"
|
|
94
98
|
:class="{
|
|
95
|
-
'pt-1':
|
|
96
|
-
'pb-1':
|
|
97
|
-
'pr-1':
|
|
98
|
-
'pl-1':
|
|
99
|
+
'pt-1': placement === 'top',
|
|
100
|
+
'pb-1': placement === 'bottom',
|
|
101
|
+
'pr-1': placement === 'left',
|
|
102
|
+
'pl-1': placement === 'right',
|
|
99
103
|
}" />
|
|
100
104
|
</Transition>
|
|
101
105
|
</button>
|