@saasmakers/ui 0.1.108 → 0.1.109

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.
@@ -68,9 +68,9 @@ function onFocus() {
68
68
  hovered.value = true
69
69
  }
70
70
 
71
- function onKeydown(event: KeyboardEvent) {
72
- if ((event.key === 'Enter' || event.key === ' ') && isClickable.value) {
73
- onClick(event as unknown as MouseEvent)
71
+ function onKeyDown(event: KeyboardEvent) {
72
+ if (isClickable.value) {
73
+ (event.currentTarget as HTMLElement).click()
74
74
  }
75
75
  }
76
76
 
@@ -109,7 +109,8 @@ function onMouseLeave() {
109
109
  :aria-disabled="!isClickable"
110
110
  tabindex="0"
111
111
  @click="onClick"
112
- @keydown.prevent="onKeydown"
112
+ @keydown.enter="onKeyDown"
113
+ @keydown.space.prevent="onKeyDown"
113
114
  >
114
115
  <img
115
116
  class="h-full w-full object-cover drag-none"
@@ -22,9 +22,9 @@ function onClick(event: MouseEvent) {
22
22
  emit('click', event, props.emoji)
23
23
  }
24
24
 
25
- function onKeydown(event: KeyboardEvent) {
26
- if ((event.key === 'Enter' || event.key === ' ') && props.clickable) {
27
- onClick(event as unknown as MouseEvent)
25
+ function onKeyDown(event: KeyboardEvent) {
26
+ if (props.clickable) {
27
+ (event.currentTarget as HTMLElement).click()
28
28
  }
29
29
  }
30
30
  </script>
@@ -52,7 +52,8 @@ function onKeydown(event: KeyboardEvent) {
52
52
  role="button"
53
53
  tabindex="0"
54
54
  @click="onClick"
55
- @keydown.prevent="onKeydown"
55
+ @keydown.enter="onKeyDown"
56
+ @keydown.space.prevent="onKeyDown"
56
57
  >
57
58
  <img
58
59
  v-if="emoji"
@@ -99,9 +99,9 @@ function onClick(event: MouseEvent) {
99
99
  emit('click', event)
100
100
  }
101
101
 
102
- function onKeydown(event: KeyboardEvent) {
103
- if ((event.key === 'Enter' || event.key === ' ') && isClickable.value) {
104
- onClick(event as unknown as MouseEvent)
102
+ function onKeyDown(event: KeyboardEvent) {
103
+ if (isClickable.value) {
104
+ (event.currentTarget as HTMLElement).click()
105
105
  }
106
106
  }
107
107
  </script>
@@ -117,7 +117,8 @@ function onKeydown(event: KeyboardEvent) {
117
117
  role="button"
118
118
  tabindex="0"
119
119
  @click="onClick"
120
- @keydown.prevent="onKeydown"
120
+ @keydown.enter="onKeyDown"
121
+ @keydown.space.prevent="onKeyDown"
121
122
  >
122
123
  <component
123
124
  :is="to ? NuxtLinkLocale : 'span'"
@@ -37,9 +37,9 @@ function onClose(event: KeyboardEvent | MouseEvent) {
37
37
  emit('close', event)
38
38
  }
39
39
 
40
- function onKeydown(event: KeyboardEvent) {
41
- if ((event.key === 'Enter' || event.key === ' ') && isClickable.value) {
42
- onClick(event as unknown as MouseEvent)
40
+ function onKeyDown(event: KeyboardEvent) {
41
+ if (isClickable.value) {
42
+ (event.currentTarget as HTMLElement).click()
43
43
  }
44
44
  }
45
45
 
@@ -59,7 +59,8 @@ onKeyStroke('Escape', (event) => {
59
59
  role="button"
60
60
  tabindex="0"
61
61
  @click="onClick"
62
- @keydown.prevent="onKeydown"
62
+ @keydown.enter="onKeyDown"
63
+ @keydown.space.prevent="onKeyDown"
63
64
  >
64
65
  <BaseIcon
65
66
  v-if="hasClose"
@@ -52,9 +52,9 @@ function onBubbleClick(event: MouseEvent) {
52
52
  emit('click', event)
53
53
  }
54
54
 
55
- function onBubbleKeydown(event: KeyboardEvent) {
56
- if ((event.key === 'Enter' || event.key === ' ') && props.clickable) {
57
- onBubbleClick(event as unknown as MouseEvent)
55
+ function onBubbleKeyDown(event: KeyboardEvent) {
56
+ if (props.clickable) {
57
+ (event.currentTarget as HTMLElement).click()
58
58
  }
59
59
  }
60
60
 
@@ -111,7 +111,8 @@ function onClose(event: MouseEvent) {
111
111
  :aria-disabled="!clickable"
112
112
  tabindex="0"
113
113
  @click="onBubbleClick"
114
- @keydown.prevent="onBubbleKeydown"
114
+ @keydown.enter="onBubbleKeyDown"
115
+ @keydown.space.prevent="onBubbleKeyDown"
115
116
  >
116
117
  <div class="flex items-center">
117
118
  <div
@@ -19,9 +19,9 @@ function onClick(event: MouseEvent) {
19
19
  emit('click', event, props.id)
20
20
  }
21
21
 
22
- function onKeydown(event: KeyboardEvent) {
23
- if ((event.key === 'Enter' || event.key === ' ') && props.clickable) {
24
- onClick(event as unknown as MouseEvent)
22
+ function onKeyDown(event: KeyboardEvent) {
23
+ if (props.clickable) {
24
+ (event.currentTarget as HTMLElement).click()
25
25
  }
26
26
  }
27
27
  </script>
@@ -38,7 +38,8 @@ function onKeydown(event: KeyboardEvent) {
38
38
  :aria-disabled="!clickable"
39
39
  tabindex="0"
40
40
  @click="onClick"
41
- @keydown.prevent="onKeydown"
41
+ @keydown.enter="onKeyDown"
42
+ @keydown.space.prevent="onKeyDown"
42
43
  >
43
44
  <div
44
45
  class="relative inline-block cursor-wait flex-initial"
@@ -74,9 +74,9 @@ function onInputSubmit(event: KeyboardEvent) {
74
74
  emit('inputSubmit', event, form.name.trim(), props.id)
75
75
  }
76
76
 
77
- function onKeydown(event: KeyboardEvent) {
78
- if ((event.key === 'Enter' || event.key === ' ') && props.clickable) {
79
- onClick(event as unknown as MouseEvent)
77
+ function onKeyDown(event: KeyboardEvent) {
78
+ if (props.clickable) {
79
+ (event.currentTarget as HTMLElement).click()
80
80
  }
81
81
  }
82
82
 
@@ -100,7 +100,8 @@ function onRemove(event: MouseEvent) {
100
100
  :aria-disabled="!clickable"
101
101
  tabindex="0"
102
102
  @click.stop="onClick"
103
- @keydown.prevent="onKeydown"
103
+ @keydown.enter.stop="onKeyDown"
104
+ @keydown.space.prevent.stop="onKeyDown"
104
105
  @mouseenter="onMouseEnter"
105
106
  @mouseleave="onMouseLeave"
106
107
  @focusin="onFocus"
@@ -14,15 +14,9 @@ const emit = defineEmits<{
14
14
 
15
15
  const { getIcon } = useLayerIcons()
16
16
 
17
- function onClose(event: MouseEvent) {
17
+ function onClose(event: KeyboardEvent | MouseEvent) {
18
18
  if (props.hasClose) {
19
- emit('close', event, props)
20
- }
21
- }
22
-
23
- function onKeydown(event: KeyboardEvent) {
24
- if ((event.key === 'Enter' || event.key === ' ') && props.hasClose) {
25
- onClose(event as unknown as MouseEvent)
19
+ emit('close', event as MouseEvent, props)
26
20
  }
27
21
  }
28
22
  </script>
@@ -34,7 +28,8 @@ function onKeydown(event: KeyboardEvent) {
34
28
  role="button"
35
29
  tabindex="0"
36
30
  @click="onClose"
37
- @keydown.prevent="onKeydown"
31
+ @keydown.enter="onClose"
32
+ @keydown.space.prevent="onClose"
38
33
  >
39
34
  <BaseIcon
40
35
  class="pointer-events-none flex-initial"
@@ -24,15 +24,11 @@ const isClickable = computed(() => {
24
24
  })
25
25
 
26
26
  function onClick(event: MouseEvent) {
27
- if (isClickable.value) {
28
- emit('click', event)
29
- }
27
+ emit('click', event)
30
28
  }
31
29
 
32
- function onKeydown(event: KeyboardEvent) {
33
- if (event.key === 'Enter' || event.key === ' ') {
34
- onClick(event as unknown as MouseEvent)
35
- }
30
+ function onKeyDown(event: KeyboardEvent) {
31
+ (event.currentTarget as HTMLElement).click()
36
32
  }
37
33
  </script>
38
34
 
@@ -61,7 +57,8 @@ function onKeydown(event: KeyboardEvent) {
61
57
  :tabindex="isClickable && !forField ? 0 : undefined"
62
58
  :type="isClickable && !forField ? 'button' : undefined"
63
59
  @click="isClickable ? onClick : undefined"
64
- @keydown.prevent="isClickable ? onKeydown : undefined"
60
+ @keydown.enter="isClickable ? onKeyDown : undefined"
61
+ @keydown.space.prevent="isClickable ? onKeyDown : undefined"
65
62
  >
66
63
  <BaseIcon
67
64
  :icon="icon"
@@ -134,9 +134,9 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
134
134
  }
135
135
  }
136
136
 
137
- function onOptionKeydown(event: KeyboardEvent, option: FieldSelectOption) {
138
- if ((event.key === 'Enter' || event.key === ' ') && !props.disabled) {
139
- onOptionClick(event as unknown as MouseEvent, option)
137
+ function onOptionKeyDown(event: KeyboardEvent) {
138
+ if (!props.disabled) {
139
+ (event.currentTarget as HTMLElement).click()
140
140
  }
141
141
  }
142
142
 
@@ -283,7 +283,8 @@ function selectOption(event: MouseEvent, value: string) {
283
283
  role="button"
284
284
  tabindex="0"
285
285
  @click="onOptionClick($event, option)"
286
- @keydown.prevent="onOptionKeydown($event, option)"
286
+ @keydown.enter.prevent="onOptionKeyDown"
287
+ @keydown.space.prevent="onOptionKeyDown"
287
288
  >
288
289
  <BaseIcon
289
290
  v-if="option.text"
@@ -33,10 +33,9 @@ function onContainerClick() {
33
33
  }
34
34
  }
35
35
 
36
- function onContainerKeydown(event: KeyboardEvent) {
37
- if ((event.key === 'Enter' || event.key === ' ') && !props.disabled && inputRef.value) {
38
- inputRef.value.focus()
39
- inputRef.value.showPicker()
36
+ function onContainerKeyDown(event: KeyboardEvent) {
37
+ if (!props.disabled) {
38
+ (event.currentTarget as HTMLElement).click()
40
39
  }
41
40
  }
42
41
 
@@ -74,7 +73,8 @@ function onFieldBlur(event: FocusEvent) {
74
73
  :aria-disabled="disabled"
75
74
  tabindex="0"
76
75
  @click="onContainerClick"
77
- @keydown.prevent="onContainerKeydown"
76
+ @keydown.enter="onContainerKeyDown"
77
+ @keydown.space.prevent="onContainerKeyDown"
78
78
  >
79
79
  <BaseIcon
80
80
  :icon="getIcon('clock')"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "0.1.108",
3
+ "version": "0.1.109",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "repository": {