@saasmakers/ui 1.4.33 → 1.4.35

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.
@@ -31,6 +31,7 @@ const props = withDefaults(defineProps<Omit<FieldInput, 'modelValue'>>(), {
31
31
  const emit = defineEmits<{
32
32
  blur: [event: FocusEvent]
33
33
  focus: [event: FocusEvent]
34
+ keydown: [event: KeyboardEvent, value: string]
34
35
  keyup: [event: KeyboardEvent, value: string ]
35
36
  submit: [event: KeyboardEvent, value: string ]
36
37
  }>()
@@ -126,6 +127,12 @@ function onFieldKeyDown(event: KeyboardEvent) {
126
127
  return event.preventDefault()
127
128
  }
128
129
 
130
+ emit('keydown', event, value)
131
+ }
132
+
133
+ function onFieldKeyUp(event: KeyboardEvent) {
134
+ const value = (event.target as HTMLInputElement).value
135
+
129
136
  emit('keyup', event, value)
130
137
  }
131
138
 
@@ -202,6 +209,7 @@ defineExpose({ focus })
202
209
  @focus="onFieldFocus"
203
210
  @input="onFieldInput"
204
211
  @keydown="onFieldKeyDown"
212
+ @keyup="onFieldKeyUp"
205
213
  >
206
214
 
207
215
  <BaseSpinner
@@ -92,8 +92,10 @@ const filteredColumns = computed(() => {
92
92
  .filter(column => column.options.length > 0)
93
93
  })
94
94
 
95
- const hasFilteredResults = computed(() => {
96
- return filteredColumns.value.some(column => column.options.length > 0)
95
+ const firstFilteredOption = computed(() => {
96
+ const column = filteredColumns.value.find(column => column.options.length > 0)
97
+
98
+ return column?.options[0]
97
99
  })
98
100
 
99
101
  const selectedOption = computed(() => {
@@ -102,10 +104,6 @@ const selectedOption = computed(() => {
102
104
  })
103
105
  })
104
106
 
105
- const showNoResults = computed(() => {
106
- return props.searchable && !!searchQueryCleaned.value && !hasFilteredResults.value
107
- })
108
-
109
107
  watch(opened, (isOpened) => {
110
108
  if (isOpened && props.searchable) {
111
109
  nextTick(() => {
@@ -172,10 +170,14 @@ function onOptionKeyDown(event: KeyboardEvent) {
172
170
  }
173
171
  }
174
172
 
175
- function onSearchKeyup(event: KeyboardEvent) {
173
+ function onSearchKeydown(event: KeyboardEvent) {
176
174
  if (event.key === 'Escape') {
177
175
  reset()
178
176
  }
177
+ else if (event.key === 'Enter' && !props.disabled && firstFilteredOption.value) {
178
+ event.preventDefault()
179
+ onOptionClick(event as unknown as MouseEvent, firstFilteredOption.value)
180
+ }
179
181
  }
180
182
 
181
183
  function reset() {
@@ -312,12 +314,12 @@ function selectOption(event: MouseEvent, value: string) {
312
314
  class="px-3"
313
315
  :placeholder="searchPlaceholder || t('search')"
314
316
  :size="size"
315
- @keyup="onSearchKeyup"
317
+ @keydown="onSearchKeydown"
316
318
  />
317
319
  </div>
318
320
 
319
321
  <div
320
- v-if="showNoResults"
322
+ v-if="searchable && searchQueryCleaned && !firstFilteredOption"
321
323
  class="flex justify-center border-b border-gray-200 p-3 dark:border-gray-800"
322
324
  >
323
325
  <BaseIcon
@@ -1,102 +1,99 @@
1
1
  import type { Directive } from 'vue'
2
- import type { LayerIconIcon as LayerIconIconType, LayerIconValue as LayerIconValueType } from '../composables/useLayerIcons'
3
- import type * as Bases from './bases'
4
- import type * as Fields from './fields'
5
2
 
6
3
  declare global {
7
4
  // Bases
8
- type BaseAlert = Bases.BaseAlert
9
- type BaseAlignment = Bases.BaseAlignment
10
-
11
- type BaseAvatar = Bases.BaseAvatar
12
- type BaseBackground = Bases.BaseBackground
13
- type BaseBordered = Bases.BaseBordered
14
- type BaseBorderedColor = Bases.BaseBorderedColor
15
- type BaseButton = Bases.BaseButton
16
- type BaseButtonRounded = Bases.BaseButtonRounded
17
- type BaseButtonSize = Bases.BaseButtonSize
18
- type BaseButtonType = Bases.BaseButtonType
19
- type BaseCharacter = Bases.BaseCharacter
20
- type BaseCharacterCharacter = Bases.BaseCharacterCharacter
21
- type BaseCharacterSize = Bases.BaseCharacterSize
22
- type BaseChart = Bases.BaseChart
23
- type BaseChartType = Bases.BaseChartType
24
- type BaseColor = Bases.BaseColor
25
- type BaseDivider = Bases.BaseDivider
26
- type BaseDividerBorderStyle = Bases.BaseDividerBorderStyle
27
- type BaseDividerNavigateDirection = Bases.BaseDividerNavigateDirection
28
- type BaseDividerSize = Bases.BaseDividerSize
29
- type BaseEmoji = Bases.BaseEmoji
30
- type BaseHeading = Bases.BaseHeading
31
- type BaseHeadingAlignment = Bases.BaseHeadingAlignment
32
- type BaseHeadingSize = Bases.BaseHeadingSize
33
- type BaseHeadingTag = Bases.BaseHeadingTag
34
- type BaseIcon = Bases.BaseIcon
35
- type BaseMessage = Bases.BaseMessage
36
- type BaseMetric = Bases.BaseMetric
37
- type BaseMetricAlignment = Bases.BaseMetricAlignment
38
- type BaseMetricPerformance = Bases.BaseMetricPerformance
39
- type BaseMetricSize = Bases.BaseMetricSize
40
- type BaseOverlay = Bases.BaseOverlay
41
- type BaseOverlayOpacity = Bases.BaseOverlayOpacity
42
- type BaseOverlayPosition = Bases.BaseOverlayPosition
43
- type BaseParagraph = Bases.BaseParagraph
44
- type BaseParagraphAlignment = Bases.BaseParagraphAlignment
45
- type BaseParagraphSize = Bases.BaseParagraphSize
46
- type BasePower = Bases.BasePower
47
- type BasePowerPower = Bases.BasePowerPower
48
- type BasePowerSize = Bases.BasePowerSize
49
- type BaseQuote = Bases.BaseQuote
50
- type BaseQuoteBackground = Bases.BaseQuoteBackground
51
- type BaseQuoteSize = Bases.BaseQuoteSize
52
- type BaseSize = Bases.BaseSize
53
- type BaseSpinner = Bases.BaseSpinner
54
- type BaseStatus = Bases.BaseStatus
55
- type BaseTag = Bases.BaseTag
56
- type BaseTags = Bases.BaseTags
57
- type BaseTagSize = Bases.BaseTagSize
58
- type BaseText = Bases.BaseText
59
- type BaseTextText = Bases.BaseTextText
60
- type BaseToast = Bases.BaseToast
61
- type BaseToastAction = Bases.BaseToastAction
5
+ type BaseAlert = import('./bases').BaseAlert
6
+ type BaseAlignment = import('./bases').BaseAlignment
7
+ type BaseAvatar = import('./bases').BaseAvatar
8
+ type BaseBackground = import('./bases').BaseBackground
9
+ type BaseBordered = import('./bases').BaseBordered
10
+ type BaseBorderedColor = import('./bases').BaseBorderedColor
11
+ type BaseButton = import('./bases').BaseButton
12
+ type BaseButtonRounded = import('./bases').BaseButtonRounded
13
+ type BaseButtonSize = import('./bases').BaseButtonSize
14
+ type BaseButtonType = import('./bases').BaseButtonType
15
+ type BaseCharacter = import('./bases').BaseCharacter
16
+ type BaseCharacterCharacter = import('./bases').BaseCharacterCharacter
17
+ type BaseCharacterSize = import('./bases').BaseCharacterSize
18
+ type BaseChart = import('./bases').BaseChart
19
+ type BaseChartType = import('./bases').BaseChartType
20
+ type BaseColor = import('./bases').BaseColor
21
+ type BaseDivider = import('./bases').BaseDivider
22
+ type BaseDividerBorderStyle = import('./bases').BaseDividerBorderStyle
23
+ type BaseDividerNavigateDirection = import('./bases').BaseDividerNavigateDirection
24
+ type BaseDividerSize = import('./bases').BaseDividerSize
25
+ type BaseEmoji = import('./bases').BaseEmoji
26
+ type BaseHeading = import('./bases').BaseHeading
27
+ type BaseHeadingAlignment = import('./bases').BaseHeadingAlignment
28
+ type BaseHeadingSize = import('./bases').BaseHeadingSize
29
+ type BaseHeadingTag = import('./bases').BaseHeadingTag
30
+ type BaseIcon = import('./bases').BaseIcon
31
+ type BaseMessage = import('./bases').BaseMessage
32
+ type BaseMetric = import('./bases').BaseMetric
33
+ type BaseMetricAlignment = import('./bases').BaseMetricAlignment
34
+ type BaseMetricPerformance = import('./bases').BaseMetricPerformance
35
+ type BaseMetricSize = import('./bases').BaseMetricSize
36
+ type BaseOverlay = import('./bases').BaseOverlay
37
+ type BaseOverlayOpacity = import('./bases').BaseOverlayOpacity
38
+ type BaseOverlayPosition = import('./bases').BaseOverlayPosition
39
+ type BaseParagraph = import('./bases').BaseParagraph
40
+ type BaseParagraphAlignment = import('./bases').BaseParagraphAlignment
41
+ type BaseParagraphSize = import('./bases').BaseParagraphSize
42
+ type BasePower = import('./bases').BasePower
43
+ type BasePowerPower = import('./bases').BasePowerPower
44
+ type BasePowerSize = import('./bases').BasePowerSize
45
+ type BaseQuote = import('./bases').BaseQuote
46
+ type BaseQuoteBackground = import('./bases').BaseQuoteBackground
47
+ type BaseQuoteSize = import('./bases').BaseQuoteSize
48
+ type BaseSize = import('./bases').BaseSize
49
+ type BaseSpinner = import('./bases').BaseSpinner
50
+ type BaseStatus = import('./bases').BaseStatus
51
+ type BaseTag = import('./bases').BaseTag
52
+ type BaseTags = import('./bases').BaseTags
53
+ type BaseTagSize = import('./bases').BaseTagSize
54
+ type BaseText = import('./bases').BaseText
55
+ type BaseTextText = import('./bases').BaseTextText
56
+ type BaseToast = import('./bases').BaseToast
57
+ type BaseToastAction = import('./bases').BaseToastAction
62
58
 
63
59
  // Libraries
64
60
  type ChartistBarChartData = import('chartist').BarChartData
65
61
  type ChartistLineChartData = import('chartist').LineChartData
66
-
67
62
  type ChartistOptions = import('chartist').Options
68
63
  type ChartistPieChartData = import('chartist').PieChartData
64
+
69
65
  // Fields
70
- type FieldAvatar = Fields.FieldAvatar
71
- type FieldBackground = Fields.FieldBackground
72
- type FieldCheckbox = Fields.FieldCheckbox
73
- type FieldDays = Fields.FieldDays
74
- type FieldEmojis = Fields.FieldEmojis
75
- type FieldInput = Fields.FieldInput
76
- type FieldInputAlignment = Fields.FieldInputAlignment
77
- type FieldInputBorder = Fields.FieldInputBorder
78
- type FieldInputType = Fields.FieldInputType
79
- type FieldLabel = Fields.FieldLabel
80
- type FieldMessage = Fields.FieldMessage
81
- type FieldSelect = Fields.FieldSelect
82
- type FieldSelectBorder = Fields.FieldSelectBorder
83
- type FieldSelectColumn = Fields.FieldSelectColumn
84
- type FieldSelectDirection = Fields.FieldSelectDirection
85
- type FieldSelectMaxHeight = Fields.FieldSelectMaxHeight
86
- type FieldSelectOption = Fields.FieldSelectOption
87
- type FieldSize = Fields.FieldSize
88
- type FieldStatus = Fields.FieldStatus
89
- type FieldTabs = Fields.FieldTabs
90
- type FieldTabsAction = Fields.FieldTabsAction
91
- type FieldTabsTab = Fields.FieldTabsTab
92
- type FieldTabsTheme = Fields.FieldTabsTheme
66
+ type FieldAvatar = import('./fields').FieldAvatar
67
+ type FieldBackground = import('./fields').FieldBackground
68
+ type FieldCheckbox = import('./fields').FieldCheckbox
69
+ type FieldDays = import('./fields').FieldDays
70
+ type FieldEmojis = import('./fields').FieldEmojis
71
+ type FieldInput = import('./fields').FieldInput
72
+ type FieldInputAlignment = import('./fields').FieldInputAlignment
73
+ type FieldInputBorder = import('./fields').FieldInputBorder
74
+ type FieldInputType = import('./fields').FieldInputType
75
+ type FieldLabel = import('./fields').FieldLabel
76
+ type FieldMessage = import('./fields').FieldMessage
77
+ type FieldSelect = import('./fields').FieldSelect
78
+ type FieldSelectBorder = import('./fields').FieldSelectBorder
79
+ type FieldSelectColumn = import('./fields').FieldSelectColumn
80
+ type FieldSelectDirection = import('./fields').FieldSelectDirection
81
+ type FieldSelectMaxHeight = import('./fields').FieldSelectMaxHeight
82
+ type FieldSelectOption = import('./fields').FieldSelectOption
83
+ type FieldSize = import('./fields').FieldSize
84
+ type FieldStatus = import('./fields').FieldStatus
85
+ type FieldTabs = import('./fields').FieldTabs
86
+ type FieldTabsAction = import('./fields').FieldTabsAction
87
+ type FieldTabsTab = import('./fields').FieldTabsTab
88
+ type FieldTabsTheme = import('./fields').FieldTabsTheme
89
+ type FieldTextarea = import('./fields').FieldTextarea
90
+ type FieldTime = import('./fields').FieldTime
93
91
 
94
- type FieldTextarea = Fields.FieldTextarea
95
- type FieldTime = Fields.FieldTime
96
92
  // Project
97
- type LayerIconIcon = LayerIconIconType
98
- type LayerIconValue = LayerIconValueType
93
+ type LayerIconIcon = import('../composables/useLayerIcons').LayerIconIcon
94
+ type LayerIconValue = import('../composables/useLayerIcons').LayerIconValue
99
95
  type Meta<T> = import('@nuxtjs/storybook').Meta<T>
96
+
100
97
  // Navigator
101
98
  interface Navigator {
102
99
  userAgentData?: {
@@ -108,9 +105,9 @@ declare global {
108
105
  platform?: string
109
106
  }
110
107
  }
108
+
111
109
  type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
112
110
  type StoryObj<T> = import('@nuxtjs/storybook').StoryObj<T>
113
-
114
111
  type VuelidateValidation = import('@vuelidate/core').BaseValidation
115
112
  }
116
113
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "1.4.33",
3
+ "version": "1.4.35",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",