Skip to content

Commit

Permalink
fix: radio fieldId usage
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavPetrik committed Mar 14, 2023
1 parent ff6a082 commit 0252b84
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/radio-field/RadioField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ export const RadioField = <Option, Field extends SelectField>({
label={label}
helperText={helperText}
>
{({ color, helperText, id, ...fieldProps }) => (
{({ color, helperText, id: fieldId, ...fieldProps }) => (
<>
{renderOptions.map(({ id, value, label }) => (
<div className="flex items-center gap-2" key={value}>
<div className="flex items-center gap-2" key={id}>
<Radio
{...props}
role="radio"
{...uiProps}
{...fieldProps}
id={id}
value={value}
name={props.name ?? id}
name={props.name ?? fieldId}
checked={props.value === value}
aria-checked={props.value === value}
{...uiProps}
{...fieldProps}
/>
<Label htmlFor={id}>{label}</Label>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
countryOptions,
profileFields,
} from "@form-atoms/field/dist/scenarios/profile";

import { CheckboxField } from "../checkbox-field";
import { FileField } from "../file-field";
import { NumberField } from "../number-field";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
password,
passwordInitial,
} from "@form-atoms/field/dist/scenarios/password";

import { TextField } from "./TextField";
import { FormStory, StoryForm } from "../stories";

Expand Down

0 comments on commit 0252b84

Please sign in to comment.