@@ -24,7 +24,15 @@ const props = defineProps<Props>();
2424defineEmits ([' update:open' ]);
2525
2626const showPassword = ref <{ [key : string ]: boolean }>({});
27+ const focusedField = ref <string | null >(null );
2728
29+ const unfocus = () => {
30+ // Source - https://stackoverflow.com/a/56899483
31+ // Posted by Wilco, modified by community. See post 'Timeline' for change history
32+ // Retrieved 2026-03-08, License - CC BY-SA 4.0
33+
34+ if (document .activeElement instanceof HTMLElement ) document .activeElement .blur ();
35+ };
2836 </script >
2937<template >
3038 <div
@@ -60,7 +68,7 @@ const showPassword = ref<{ [key: string]: boolean }>({});
6068 >
6169 <label :for =" field.key" class =" text-sm text-gray-300" >{{ field.name }}</label >
6270 <select
63- v-if =" field.choices"
71+ v-if =" field.choices && field.type === 'text' "
6472 :id =" field.key"
6573 v-model =" field.value"
6674 class =" rounded-md border border-black bg-theme-nav p-2 text-white"
@@ -74,6 +82,34 @@ const showPassword = ref<{ [key: string]: boolean }>({});
7482 {{ choice.value }}
7583 </option >
7684 </select >
85+ <div v-else-if =" field.choices && field.type === 'number'" class =" relative inline-block" >
86+ <input
87+ :id =" field.key"
88+ v-model =" field.value"
89+ type =" number"
90+ class =" w-full rounded-md border border-black bg-theme-nav p-2 text-white"
91+ :required =" field.required"
92+ :list =" `${field.key}-choices`"
93+ @focus =" focusedField = field.key"
94+ @blur =" focusedField = null"
95+ >
96+ <ul
97+ v-show =" focusedField === field.key"
98+ :id =" `${field.key}-choices`"
99+ class =" absolute z-20 mt-1 max-h-48 w-full overflow-y-auto rounded-md border border-black bg-theme-nav shadow-lg"
100+ @mousedown.prevent
101+ >
102+ <li
103+ v-for =" choice in field.choices"
104+ :key =" choice.key"
105+ class =" cursor-pointer px-3 py-2 text-sm text-gray-200 hover:bg-black/30 hover:text-white"
106+ @click =" field.value = choice.key; unfocus()"
107+ @keydown.enter =" field.value = choice.key; unfocus()"
108+ >
109+ {{ choice.value }}
110+ </li >
111+ </ul >
112+ </div >
77113 <textarea
78114 v-else-if =" field.type === 'textarea'"
79115 :id =" field.key"
0 commit comments