@vue-interface/btn-activity 4.0.8 → 4.0.9

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,52 +1,52 @@
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({
1
+ import { defineComponent as y, ref as u, watchEffect as v, watch as f, createElementBlock as b, openBlock as n, normalizeClass as o, 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 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
- orientation: { default: "right" },
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: r }) {
18
- const n = t, i = r, e = y(n.activity);
17
+ setup(t, { emit: s }) {
18
+ const c = t, i = s, e = u(c.activity);
19
19
  v(() => {
20
- e.value = n.activity;
21
- }), m(e, (a) => {
20
+ e.value = c.activity;
21
+ }), f(e, (a) => {
22
22
  i(a ? "show-activity" : "hide-activity");
23
23
  });
24
- function s() {
24
+ function d() {
25
25
  e.value = !e.value;
26
26
  }
27
- const d = {
27
+ const r = {
28
28
  status: e,
29
- toggle: s
29
+ toggle: d
30
30
  };
31
- return (a, o) => (l(), b("button", {
31
+ return (a, l) => (n(), b("button", {
32
32
  type: "button",
33
33
  disabled: t.disabled,
34
- class: c([
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.orientation === "top",
43
- "flex-col": t.orientation === "bottom",
44
- "flex-row-reverse": t.orientation === "left",
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: o[0] || (o[0] = (u) => i("click", u, d))
49
+ onClick: l[0] || (l[0] = (m) => i("click", m, r))
50
50
  }, [
51
51
  x(a.$slots, "default", {}, () => [
52
52
  k(z(t.label), 1)
@@ -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 ? (l(), B(C(A), {
63
+ e.value ? (n(), B(p(C), {
64
64
  key: 0,
65
65
  type: t.indicator,
66
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"
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
73
  }, null, 8, ["type", "size", "class"])) : S("", !0)
74
74
  ]),
75
75
  _: 1
76
76
  })
77
- ], 10, N));
77
+ ], 10, A));
78
78
  }
79
79
  });
80
80
  export {
81
- T as BtnActivity
81
+ E as BtnActivity
82
82
  };
83
83
  //# sourceMappingURL=btn-activity.js.map
@@ -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 { 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
+ {"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';\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: ComponentSize<ActivityIndicatorSizePrefix>;\n label?: string;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: ComponentSize<BtnSizePrefix>;\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":";;;;;;;;;;;;;;;;;AAmBA,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,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"})}));
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 { 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"}
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';\n\nexport type BtnActivityProps = {\n activity?: boolean;\n indicator: Component;\n indicatorSize?: ComponentSize<ActivityIndicatorSizePrefix>;\n label?: string;\n placement?: 'top' | 'bottom' | 'left' | 'right';\n variant?: string;\n size?: ComponentSize<BtnSizePrefix>;\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":"0uBAmBA,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,15 @@
1
+ import { ActivityIndicatorSizePrefix } from '@vue-interface/activity-indicator';
1
2
  import { Component, Ref } from 'vue';
2
- import { ActivityIndicatorSize } from '../../activity-indicator/src/ActivityIndicator.vue';
3
+ import { ComponentSize } from '@vue-interface/sizeable';
4
+ export type BtnSizePrefix = 'btn';
3
5
  export type BtnActivityProps = {
4
6
  activity?: boolean;
5
7
  indicator: Component;
6
- indicatorSize?: ActivityIndicatorSize;
8
+ indicatorSize?: ComponentSize<ActivityIndicatorSizePrefix>;
7
9
  label?: string;
8
- orientation?: 'top' | 'bottom' | 'left' | 'right';
10
+ placement?: 'top' | 'bottom' | 'left' | 'right';
9
11
  variant?: string;
10
- size?: string;
12
+ size?: ComponentSize<BtnSizePrefix>;
11
13
  block?: boolean;
12
14
  disabled?: boolean;
13
15
  };
@@ -33,10 +35,10 @@ declare const __VLS_component: import('vue').DefineComponent<BtnActivityProps, {
33
35
  "onHide-activity"?: (() => any) | undefined;
34
36
  "onShow-activity"?: (() => any) | undefined;
35
37
  }>, {
36
- size: string;
38
+ size: ComponentSize<BtnSizePrefix>;
37
39
  label: string;
38
- indicatorSize: ActivityIndicatorSize;
39
- orientation: "top" | "bottom" | "left" | "right";
40
+ indicatorSize: ComponentSize<ActivityIndicatorSizePrefix>;
41
+ placement: "top" | "bottom" | "left" | "right";
40
42
  variant: string;
41
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
42
44
  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.8",
3
+ "version": "4.0.9",
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/activity-indicator": "3.0.6",
48
+ "@vue-interface/sizeable": "2.0.0",
49
+ "@vue-interface/activity-indicator": "3.0.7",
49
50
  "@vue-interface/btn": "5.0.5"
50
51
  },
51
52
  "scripts": {
@@ -1,24 +1,26 @@
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 { ActivityIndicatorSize } from '../../activity-indicator/src/ActivityIndicator.vue';
4
+ import type { ComponentSize } from '@vue-interface/sizeable';
5
+
6
+ export type BtnSizePrefix = 'btn';
5
7
 
6
8
  export type BtnActivityProps = {
7
9
  activity?: boolean;
8
10
  indicator: Component;
9
- indicatorSize?: ActivityIndicatorSize;
11
+ indicatorSize?: ComponentSize<ActivityIndicatorSizePrefix>;
10
12
  label?: string;
11
- orientation?: 'top' | 'bottom' | 'left' | 'right';
13
+ placement?: 'top' | 'bottom' | 'left' | 'right';
12
14
  variant?: string;
13
- size?: string;
15
+ size?: ComponentSize<BtnSizePrefix>;
14
16
  block?: boolean;
15
17
  disabled?: boolean;
16
18
  };
17
19
 
18
20
  const props = withDefaults(defineProps<BtnActivityProps>(), {
19
- indicatorSize: 'xs',
21
+ indicatorSize: 'activity-indicator-xs',
20
22
  label: undefined,
21
- orientation: 'right',
23
+ placement: 'right',
22
24
  variant: 'btn-primary',
23
25
  size: 'btn-md'
24
26
  });
@@ -69,11 +71,11 @@ const context = {
69
71
  size,
70
72
  {
71
73
  'w-full': block,
72
- 'gap-1': ['xs', 'sm'].includes(indicatorSize),
73
- 'gap-2': ['md', 'lg', 'xl'].includes(indicatorSize),
74
- 'flex-col-reverse': orientation === 'top',
75
- 'flex-col': orientation === 'bottom',
76
- 'flex-row-reverse': orientation === 'left',
74
+ 'gap-1': ['activity-indicator-xs', 'activity-indicator-sm'].includes(indicatorSize as string),
75
+ 'gap-2': ['activity-indicator-md', 'activity-indicator-lg', 'activity-indicator-xl'].includes(indicatorSize as string),
76
+ 'flex-col-reverse': placement === 'top',
77
+ 'flex-col': placement === 'bottom',
78
+ 'flex-row-reverse': placement === 'left',
77
79
  'inline-flex items-center justify-center': true,
78
80
  'opacity-50 cursor-not-allowed': disabled,
79
81
  }
@@ -92,10 +94,10 @@ const context = {
92
94
  :type="indicator"
93
95
  :size="indicatorSize"
94
96
  :class="{
95
- 'pt-1': orientation === 'top',
96
- 'pb-1': orientation === 'bottom',
97
- 'pr-1': orientation === 'left',
98
- 'pl-1': orientation === 'right',
97
+ 'pt-1': placement === 'top',
98
+ 'pb-1': placement === 'bottom',
99
+ 'pr-1': placement === 'left',
100
+ 'pl-1': placement === 'right',
99
101
  }" />
100
102
  </Transition>
101
103
  </button>