@saasmakers/ui 0.1.81 → 0.1.82

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,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseOverlay } from '../../types/bases'
3
+ import { onKeyStroke } from '@vueuse/core'
3
4
  import { Motion } from 'motion-v'
4
5
  import useMotion from '../../composables/useMotion'
5
6
 
@@ -14,7 +15,7 @@ withDefaults(defineProps<BaseOverlay>(), {
14
15
 
15
16
  const emit = defineEmits<{
16
17
  click: [event: MouseEvent]
17
- close: [event: MouseEvent]
18
+ close: [event: KeyboardEvent | MouseEvent]
18
19
  }>()
19
20
 
20
21
  defineSlots<{
@@ -28,14 +29,19 @@ function onClick(event: MouseEvent) {
28
29
  emit('click', event)
29
30
  }
30
31
 
31
- function onClose(event: MouseEvent) {
32
+ function onClose(event: KeyboardEvent | MouseEvent) {
32
33
  emit('close', event)
33
34
  }
35
+
36
+ onKeyStroke('Escape', (event) => {
37
+ event.preventDefault()
38
+
39
+ onClose(event)
40
+ })
34
41
  </script>
35
42
 
36
43
  <template>
37
44
  <div
38
- v-hotkey="{ esc: onClose }"
39
45
  :class="{
40
46
  'fixed inset-0': fixed,
41
47
  'cursor-pointer': clickable || hasClose,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
3
  "type": "module",
4
- "version": "0.1.81",
4
+ "version": "0.1.82",
5
5
  "private": false,
6
6
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
7
7
  "license": "MIT",