sprintify-ui 0.0.100 → 0.0.101
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/dist/sprintify-ui.es.js +6273 -6268
- package/dist/types/src/components/BaseAutocompleteDropdown.vue.d.ts +3 -1
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.vue +7 -0
- package/src/components/BaseAutocompleteDropdown.vue +5 -7
- package/src/components/BaseTagAutocomplete.vue +7 -0
|
@@ -29,7 +29,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
29
29
|
type: StringConstructor;
|
|
30
30
|
default: string;
|
|
31
31
|
};
|
|
32
|
-
}, {
|
|
32
|
+
}, {
|
|
33
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
34
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("select" | "scrollBottom")[], "select" | "scrollBottom", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
35
|
selected: {
|
|
34
36
|
type: PropType<NormalizedOption | NormalizedOption[] | null | undefined>;
|
|
35
37
|
default: undefined;
|
package/package.json
CHANGED
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
]"
|
|
70
70
|
>
|
|
71
71
|
<BaseAutocompleteDropdown
|
|
72
|
+
ref="dropdown"
|
|
72
73
|
:selected="normalizedModelValue"
|
|
73
74
|
:options="filteredNormalizedOptions"
|
|
74
75
|
:size="size"
|
|
@@ -199,6 +200,10 @@ const hasOptions = useHasOptions(
|
|
|
199
200
|
computed(() => false)
|
|
200
201
|
);
|
|
201
202
|
|
|
203
|
+
const dropdown = ref(null) as Ref<InstanceType<
|
|
204
|
+
typeof BaseAutocompleteDropdown
|
|
205
|
+
> | null>;
|
|
206
|
+
|
|
202
207
|
let timerId = 0;
|
|
203
208
|
const keywords = ref('');
|
|
204
209
|
const autocomplete = ref(null) as Ref<HTMLElement | null>;
|
|
@@ -285,6 +290,8 @@ const onTextInput = (event: Event) => {
|
|
|
285
290
|
const onTextKeydown = (event: KeyboardEvent) => {
|
|
286
291
|
const key = event.key;
|
|
287
292
|
|
|
293
|
+
dropdown.value?.onKeydown(event);
|
|
294
|
+
|
|
288
295
|
// Prevent default behavior for up/down arrows
|
|
289
296
|
|
|
290
297
|
if (key === 'ArrowUp') {
|
|
@@ -177,13 +177,7 @@ function isSelected(option: NormalizedOption): boolean {
|
|
|
177
177
|
|
|
178
178
|
// Arrow actions
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
onBeforeUnmount(() => {
|
|
183
|
-
window.removeEventListener('keydown', onKeyDown);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
function onKeyDown(event: KeyboardEvent) {
|
|
180
|
+
function onKeydown(event: KeyboardEvent) {
|
|
187
181
|
const key = event.key;
|
|
188
182
|
|
|
189
183
|
mouseIsMoving = false;
|
|
@@ -346,4 +340,8 @@ const optionIconClass = computed(() => {
|
|
|
346
340
|
}
|
|
347
341
|
return 'w-5 h-5';
|
|
348
342
|
});
|
|
343
|
+
|
|
344
|
+
defineExpose({
|
|
345
|
+
onKeydown,
|
|
346
|
+
});
|
|
349
347
|
</script>
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
]"
|
|
62
62
|
>
|
|
63
63
|
<BaseAutocompleteDropdown
|
|
64
|
+
ref="dropdown"
|
|
64
65
|
:selected="normalizedModelValue"
|
|
65
66
|
:options="filteredNormalizedOptions"
|
|
66
67
|
:size="size"
|
|
@@ -189,6 +190,10 @@ const hasOptions = useHasOptions(
|
|
|
189
190
|
computed(() => true)
|
|
190
191
|
);
|
|
191
192
|
|
|
193
|
+
const dropdown = ref(null) as Ref<InstanceType<
|
|
194
|
+
typeof BaseAutocompleteDropdown
|
|
195
|
+
> | null>;
|
|
196
|
+
|
|
192
197
|
const keywords = ref('');
|
|
193
198
|
const autocomplete = ref(null) as Ref<HTMLElement | null>;
|
|
194
199
|
const inputElement = ref(null) as Ref<HTMLInputElement | null>;
|
|
@@ -254,6 +259,8 @@ const onTextInput = (event: Event) => {
|
|
|
254
259
|
const onTextKeydown = (event: KeyboardEvent) => {
|
|
255
260
|
const key = event.key;
|
|
256
261
|
|
|
262
|
+
dropdown.value?.onKeydown(event);
|
|
263
|
+
|
|
257
264
|
// Prevent default behavior for up/down arrows
|
|
258
265
|
|
|
259
266
|
if (key === 'ArrowUp') {
|