summaryrefslogtreecommitdiff
path: root/packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx')
-rw-r--r--packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx b/packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx
index 361eb39a3..3bce0123f 100644
--- a/packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/InputChoiceStacked.tsx
@@ -9,10 +9,10 @@ export interface Choice {
value: string;
}
-export function InputChoiceStacked(
+export function InputChoiceStacked<T extends object, K extends keyof T>(
props: {
choices: Choice[];
- } & UIFormProps<string>,
+ } & UIFormProps<T, K>,
): VNode {
const {
choices,
@@ -26,9 +26,7 @@ export function InputChoiceStacked(
after,
converter,
} = props;
- const { value, onChange, state, isDirty } = useField<{
- [s: string]: undefined | string;
- }>(name);
+ const { value, onChange, state, isDirty } = useField<T, K>(name);
if (state.hidden) {
return <Fragment />;
}
@@ -58,7 +56,11 @@ export function InputChoiceStacked(
name="server-size"
defaultValue={choice.value}
onClick={(e) => {
- onChange(value === choice.value ? undefined : choice.value);
+ onChange(
+ (value === choice.value
+ ? undefined
+ : choice.value) as T[K],
+ );
}}
class="sr-only"
aria-labelledby="server-size-0-label"