Skip to content

Commit

Permalink
feat(clerk-js): Finalize formOoptions
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Aug 9, 2023
1 parent 0f1f9dc commit 0b0cc93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/clerk-js/src/ui/elements/FormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type FormControlProps = Omit<PropsOfComponent<typeof Input>, 'label' | 'placehol
hasPassedComplexity: boolean;
enableErrorAfterBlur?: boolean;
informationText?: string;
radios?: {
radioOptions?: {
value: string;
label: string | LocalizationKey;
}[];
Expand Down Expand Up @@ -99,15 +99,15 @@ const RadioGroupItem = (props: {

export const RadioButtons = (
props: PropsOfComponent<typeof Input> & {
radios?: {
radioOptions?: {
value: string;
label: string | LocalizationKey;
}[];
},
) => {
return (
<>
{props.radios?.map(r => (
{props.radioOptions?.map(r => (
<RadioGroupItem
key={r.value}
{...r}
Expand Down Expand Up @@ -305,7 +305,7 @@ export const FormControl = forwardRef<HTMLInputElement, PropsWithChildren<FormCo
setWarning,
setHasPassedComplexity,
hasPassedComplexity,
radios,
radioOptions,
...restInputProps
} = props;

Expand Down Expand Up @@ -397,7 +397,7 @@ export const FormControl = forwardRef<HTMLInputElement, PropsWithChildren<FormCo

const Input = (
<InputElement
radios={radios}
radioOptions={radioOptions}
elementDescriptor={descriptors.formFieldInput}
elementId={descriptors.formFieldInput.setId(id)}
hasError={!!errorMessage}
Expand Down
6 changes: 3 additions & 3 deletions packages/clerk-js/src/ui/utils/useFormControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ type Options = {
validatePassword?: never;
buildErrorMessage?: never;
type?: Exclude<HTMLInputTypeAttribute, 'password' | 'radio'>;
radios?: never;
radioOptions?: never;
}
| {
label: string | LocalizationKey;
type: Extract<HTMLInputTypeAttribute, 'password'>;
validatePassword: boolean;
buildErrorMessage?: (err: ClerkAPIError[]) => ClerkAPIError | string | undefined;
radios?: never;
radioOptions?: never;
}
| {
validatePassword?: never;
buildErrorMessage?: never;
type: Extract<HTMLInputTypeAttribute, 'radio'>;
label?: string | LocalizationKey;
radios: {
radioOptions: {
value: string;
label: string | LocalizationKey;
}[];
Expand Down

0 comments on commit 0b0cc93

Please sign in to comment.