@citizenplane/pimp 9.7.12 → 9.7.15

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.15",
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 {
@@ -188,6 +188,7 @@ const displayClearButton = computed(() => {
188
188
  return props.isClearable && !isEmpty(selectModel.value)
189
189
  })
190
190
 
191
+ const handleSearch = (event: { query: string }) => emit('search', event.query)
191
192
  const handleClear = () => (selectModel.value = null)
192
193
  const handleOverlayShown = () => emit('overlayShown')
193
194
  const handleOverlayHidden = () => emit('overlayHidden')
@@ -195,12 +196,10 @@ const handleOverlayHidden = () => emit('overlayHidden')
195
196
  const handleValueChange = (newValue: string | object) => {
196
197
  if (typeof newValue !== 'string') return
197
198
  searchQuery.value = newValue
198
- }
199
199
 
200
- watch(
201
- searchQuery,
202
- debounce((newValue) => emit('search', newValue), 500),
203
- )
200
+ // NOTE: because @complete is not triggered when the input is cleared
201
+ if (newValue === '') emit('search', newValue)
202
+ }
204
203
 
205
204
  const getInputElement = () => {
206
205
  if (!multiselect.value) return null