summaryrefslogtreecommitdiff
path: root/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-05-22 10:40:13 -0300
committerSebastian <sebasjm@gmail.com>2023-05-22 10:40:13 -0300
commit3e95ae356a98d01e523bdf48547db4114ff224fe (patch)
tree7cc1e488b902bb3a3eeba92ff81ea0e383ed542d /packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
parent0544b8358af68df87dbc472221d8c0842c2b2db0 (diff)
downloadwallet-core-3e95ae356a98d01e523bdf48547db4114ff224fe.tar.gz
wallet-core-3e95ae356a98d01e523bdf48547db4114ff224fe.tar.bz2
wallet-core-3e95ae356a98d01e523bdf48547db4114ff224fe.zip
fix break on build
Diffstat (limited to 'packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx')
-rw-r--r--packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
index dd85453e5..8369e509d 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputSelectMultiple.tsx
@@ -4,16 +4,16 @@ import { LabelWithTooltipMaybeRequired, UIFormProps } from "./InputLine.js";
import { useField } from "./useField.js";
import { useState } from "preact/hooks";
-export function InputSelectMultiple(
+export function InputSelectMultiple<T extends object, K extends keyof T>(
props: {
choices: Choice[];
unique?: boolean;
max?: number;
- } & UIFormProps<Array<string>>,
+ } & UIFormProps<T, K>,
): VNode {
const { name, label, choices, placeholder, tooltip, required, unique, max } =
props;
- const { value, onChange } = useField<{ [s: string]: Array<string> }>(name);
+ const { value, onChange } = useField<T, K>(name);
const [filter, setFilter] = useState<string | undefined>(undefined);
const regex = new RegExp(`.*${filter}.*`, "i");
@@ -21,7 +21,7 @@ export function InputSelectMultiple(
return { ...prev, [curr.value]: curr.label };
}, {} as Record<string, string>);
- const list = value ?? [];
+ const list = (value ?? []) as string[];
const filteredChoices =
filter === undefined
? undefined
@@ -44,7 +44,7 @@ export function InputSelectMultiple(
onClick={() => {
const newValue = [...list];
newValue.splice(idx, 1);
- onChange(newValue);
+ onChange(newValue as T[K]);
setFilter(undefined);
}}
class="group relative h-5 w-5 rounded-sm hover:bg-gray-500/20"
@@ -119,7 +119,7 @@ export function InputSelectMultiple(
}
const newValue = [...list];
newValue.splice(0, 0, v.value);
- onChange(newValue);
+ onChange(newValue as T[K]);
}}
// tabindex="-1"