diff options
author | Sebastian <sebasjm@gmail.com> | 2023-05-22 10:40:13 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-05-22 10:40:13 -0300 |
commit | 3e95ae356a98d01e523bdf48547db4114ff224fe (patch) | |
tree | 7cc1e488b902bb3a3eeba92ff81ea0e383ed542d /packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx | |
parent | 0544b8358af68df87dbc472221d8c0842c2b2db0 (diff) | |
download | wallet-core-3e95ae356a98d01e523bdf48547db4114ff224fe.tar.xz |
fix break on build
Diffstat (limited to 'packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx')
-rw-r--r-- | packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx index a4ed1ba1c..9af446e6c 100644 --- a/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx +++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectOne.tsx @@ -4,15 +4,13 @@ import { LabelWithTooltipMaybeRequired, UIFormProps } from "./InputLine.js"; import { useField } from "./useField.js"; import { useState } from "preact/hooks"; -export function InputSelectOne( +export function InputSelectOne<T extends object, K extends keyof T>( props: { choices: Choice[]; - } & UIFormProps<Array<string>>, + } & UIFormProps<T, K>, ): VNode { const { name, label, choices, placeholder, tooltip, required } = props; - const { value, onChange } = useField<{ [s: string]: string | undefined }>( - name, - ); + const { value, onChange } = useField<T, K>(name); const [filter, setFilter] = useState<string | undefined>(undefined); const regex = new RegExp(`.*${filter}.*`, "i"); @@ -35,11 +33,11 @@ export function InputSelectOne( /> {value ? ( <span class="inline-flex items-center gap-x-0.5 rounded-md bg-gray-100 p-1 mr-2 font-medium text-gray-600"> - {choiceMap[value]} + {choiceMap[value as string]} <button type="button" onClick={() => { - onChange(undefined); + onChange(undefined!); }} class="group relative h-5 w-5 rounded-sm hover:bg-gray-500/20" > @@ -103,7 +101,7 @@ export function InputSelectOne( role="option" onClick={() => { setFilter(undefined); - onChange(v.value); + onChange(v.value as T[K]); }} // tabindex="-1" |