sprintify-ui 0.0.99 → 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 +6274 -6269
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +1 -1
- package/dist/types/src/components/BaseAutocompleteDropdown.vue.d.ts +3 -1
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +1 -1
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +1 -1
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/BaseAutocomplete.vue +7 -0
- package/src/components/BaseAutocompleteDropdown.vue +14 -11
- package/src/components/BaseTagAutocomplete.vue +7 -0
|
@@ -158,11 +158,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
158
158
|
loading: boolean;
|
|
159
159
|
loadingBottom: boolean;
|
|
160
160
|
size: "base" | "xs" | "sm";
|
|
161
|
-
inline: boolean;
|
|
162
161
|
modelValue: Option | null | undefined;
|
|
163
162
|
placeholder: string;
|
|
164
163
|
disabled: boolean;
|
|
165
164
|
hasError: boolean;
|
|
165
|
+
inline: boolean;
|
|
166
166
|
dropdownShow: "focus" | "always";
|
|
167
167
|
modelValueShow: boolean;
|
|
168
168
|
visibleFocus: boolean;
|
|
@@ -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;
|
|
@@ -132,11 +132,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
132
132
|
required: boolean;
|
|
133
133
|
name: string;
|
|
134
134
|
size: "base" | "xs" | "sm";
|
|
135
|
-
inline: boolean;
|
|
136
135
|
modelValue: Option | null | undefined;
|
|
137
136
|
placeholder: string;
|
|
138
137
|
disabled: boolean;
|
|
139
138
|
hasError: boolean;
|
|
139
|
+
inline: boolean;
|
|
140
140
|
dropdownShow: "focus" | "always";
|
|
141
141
|
modelValueShow: boolean;
|
|
142
142
|
visibleFocus: boolean;
|
|
@@ -136,11 +136,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
136
136
|
required: boolean;
|
|
137
137
|
name: string;
|
|
138
138
|
size: "base" | "xs" | "sm";
|
|
139
|
-
inline: boolean;
|
|
140
139
|
modelValue: string | number | null | undefined;
|
|
141
140
|
placeholder: string;
|
|
142
141
|
disabled: boolean;
|
|
143
142
|
hasError: boolean;
|
|
143
|
+
inline: boolean;
|
|
144
144
|
dropdownShow: "focus" | "always";
|
|
145
145
|
modelValueShow: boolean;
|
|
146
146
|
visibleFocus: boolean;
|
|
@@ -78,10 +78,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
78
78
|
}, {
|
|
79
79
|
required: boolean;
|
|
80
80
|
name: string;
|
|
81
|
-
inline: boolean;
|
|
82
81
|
modelValue: string | null | undefined;
|
|
83
82
|
disabled: boolean;
|
|
84
83
|
hasError: boolean;
|
|
84
|
+
inline: boolean;
|
|
85
85
|
minDate: Date;
|
|
86
86
|
maxDate: Date;
|
|
87
87
|
yearRange: number | [number, number];
|
|
@@ -149,10 +149,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
149
149
|
loading: boolean;
|
|
150
150
|
loadingBottom: boolean;
|
|
151
151
|
size: "base" | "xs" | "sm";
|
|
152
|
-
inline: boolean;
|
|
153
152
|
placeholder: string;
|
|
154
153
|
disabled: boolean;
|
|
155
154
|
hasError: boolean;
|
|
155
|
+
inline: boolean;
|
|
156
156
|
dropdownShow: "focus" | "always";
|
|
157
157
|
max: number;
|
|
158
158
|
}>, {
|
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;
|
|
@@ -234,6 +228,10 @@ onMounted(() => {
|
|
|
234
228
|
});
|
|
235
229
|
|
|
236
230
|
function scrollToFocus() {
|
|
231
|
+
if (!dropdown.value) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
|
|
237
235
|
if (!optionRefs.value) {
|
|
238
236
|
return;
|
|
239
237
|
}
|
|
@@ -244,10 +242,11 @@ function scrollToFocus() {
|
|
|
244
242
|
return;
|
|
245
243
|
}
|
|
246
244
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
const dropdownHeight = dropdown.value.clientHeight;
|
|
246
|
+
const offsetTop = option.offsetTop;
|
|
247
|
+
const optionHeight = option.clientHeight;
|
|
248
|
+
|
|
249
|
+
dropdown.value.scrollTop = offsetTop - dropdownHeight / 2 + optionHeight / 2;
|
|
251
250
|
}
|
|
252
251
|
|
|
253
252
|
// Validate focus index
|
|
@@ -341,4 +340,8 @@ const optionIconClass = computed(() => {
|
|
|
341
340
|
}
|
|
342
341
|
return 'w-5 h-5';
|
|
343
342
|
});
|
|
343
|
+
|
|
344
|
+
defineExpose({
|
|
345
|
+
onKeydown,
|
|
346
|
+
});
|
|
344
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') {
|