@citizenplane/pimp 18.19.2 → 18.19.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "18.19.2",
3
+ "version": "18.19.3",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8081",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -10,6 +10,7 @@
10
10
  role="button"
11
11
  tabindex="0"
12
12
  :type="type"
13
+ @click="handleClick"
13
14
  >
14
15
  <span class="cpButton__body">
15
16
  <span v-if="isLoading" class="cpButton__loader">
@@ -57,6 +58,10 @@ const props = withDefaults(defineProps<Props>(), {
57
58
  size: 'md',
58
59
  })
59
60
 
61
+ const emit = defineEmits<{
62
+ click: [event: MouseEvent]
63
+ }>()
64
+
60
65
  const slots: Slots = useSlots()
61
66
 
62
67
  const capitalizedAppearance = computed(() => capitalizeFirstLetter(props.appearance))
@@ -73,6 +78,11 @@ const isButtonDisabled = computed(() => props.disabled || props.isLoading)
73
78
 
74
79
  const hrefValue = computed(() => (props.tag === 'a' ? props.href : undefined))
75
80
 
81
+ const handleClick = (event: MouseEvent): void => {
82
+ if (isButtonDisabled.value) return
83
+ emit('click', event)
84
+ }
85
+
76
86
  const dynamicClasses = computed(() => {
77
87
  return [
78
88
  `cpButton--is${capitalizedAppearance.value}`,