@citizenplane/pimp 9.7.12 → 9.7.14

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": "9.7.12",
3
+ "version": "9.7.14",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8080",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -22,6 +22,7 @@
22
22
  :suggestions="options"
23
23
  :typeahead
24
24
  @click="handleClick"
25
+ @complete="handleSearch"
25
26
  @hide="handleOverlayHidden"
26
27
  @keydown.enter="toggleDropdown"
27
28
  @keydown.esc.stop
@@ -79,13 +80,12 @@
79
80
  <script setup lang="ts">
80
81
  import { absolutePosition, getOuterWidth } from '@primeuix/utils/dom'
81
82
  import AutoComplete from 'primevue/autocomplete'
82
- import { ref, computed, onMounted, watch } from 'vue'
83
+ import { ref, computed, onMounted } from 'vue'
83
84
 
84
85
  import BaseInputLabel from '@/components/BaseInputLabel.vue'
85
86
  import BaseSelectClearButton from '@/components/BaseSelectClearButton.vue'
86
87
  import TransitionExpand from '@/components/TransitionExpand.vue'
87
88
 
88
- import { debounce } from '@/helpers/functions'
89
89
  import { isEmpty } from '@/helpers/object'
90
90
 
91
91
  interface Emits {
@@ -94,6 +94,7 @@ interface Emits {
94
94
  (e: 'update:modelValue', value: Record<string, unknown> | Record<string, unknown>[] | string[] | null): void
95
95
  (e: 'overlayShown'): void
96
96
  (e: 'overlayHidden'): void
97
+ (e: 'searchChange', value: string | object): void
97
98
  }
98
99
 
99
100
  interface Props {
@@ -188,6 +189,7 @@ const displayClearButton = computed(() => {
188
189
  return props.isClearable && !isEmpty(selectModel.value)
189
190
  })
190
191
 
192
+ const handleSearch = (event: { query: string }) => emit('search', event.query)
191
193
  const handleClear = () => (selectModel.value = null)
192
194
  const handleOverlayShown = () => emit('overlayShown')
193
195
  const handleOverlayHidden = () => emit('overlayHidden')
@@ -195,13 +197,9 @@ const handleOverlayHidden = () => emit('overlayHidden')
195
197
  const handleValueChange = (newValue: string | object) => {
196
198
  if (typeof newValue !== 'string') return
197
199
  searchQuery.value = newValue
200
+ emit('searchChange', newValue)
198
201
  }
199
202
 
200
- watch(
201
- searchQuery,
202
- debounce((newValue) => emit('search', newValue), 500),
203
- )
204
-
205
203
  const getInputElement = () => {
206
204
  if (!multiselect.value) return null
207
205
  // @ts-expect-error '$el' does not exist on type instance of AutoComplete