aboutsummaryrefslogtreecommitdiff
path: root/packages/web-util/src/forms/InputChoiceHorizontal.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/web-util/src/forms/InputChoiceHorizontal.tsx')
-rw-r--r--packages/web-util/src/forms/InputChoiceHorizontal.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/web-util/src/forms/InputChoiceHorizontal.tsx b/packages/web-util/src/forms/InputChoiceHorizontal.tsx
index 82a7c3115..d8361718d 100644
--- a/packages/web-util/src/forms/InputChoiceHorizontal.tsx
+++ b/packages/web-util/src/forms/InputChoiceHorizontal.tsx
@@ -12,10 +12,10 @@ export interface ChoiceH<V> {
export function InputChoiceHorizontal<T extends object, K extends keyof T>(
props: {
- choices: ChoiceH<T[K]>[];
+ choices: ChoiceH<string>[];
} & UIFormProps<T, K>,
): VNode {
- const { choices, label, tooltip, help, required } = props;
+ const { choices, label, tooltip, help, required, converter } = props;
//FIXME: remove deprecated
const fieldCtx = useField<T, K>(props.name);
const { value, onChange, state } =
@@ -38,7 +38,7 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>(
const isLast = idx === choices.length - 1;
let clazz =
"relative inline-flex items-center px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 focus:z-10";
- if (choice.value === value) {
+ if (converter?.fromStringUI(choice.value as any) === value) {
clazz +=
" text-white bg-indigo-600 hover:bg-indigo-500 ring-2 ring-indigo-600 hover:ring-indigo-500";
} else {
@@ -61,7 +61,7 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>(
class={clazz}
onClick={(e) => {
onChange(
- (value === choice.value ? undefined : choice.value) as any,
+ (value === choice.value ? undefined : converter?.fromStringUI(choice.value as any)) as any,
);
}}
>