Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@clayui/card): LPD-1261 Add name to group all radio type inputs #5828

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/clay-card/src/CardWithHorizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export interface IProps extends React.BaseHTMLAttributes<HTMLDivElement> {
* Props to add to the radio element
*/

radioProps?: React.HTMLAttributes<HTMLInputElement> & {value: string};
radioProps?: React.HTMLAttributes<HTMLInputElement> & {
name: string;
value: string;
};

/**
* Flag to indicate if card is selected
Expand Down Expand Up @@ -101,7 +104,7 @@ export const ClayCardWithHorizontal = ({
},
href,
onSelectChange,
radioProps = {value: ''},
radioProps = {name: '', value: ''},
selectableType,
selected = false,
spritemap,
Expand Down
7 changes: 5 additions & 2 deletions packages/clay-card/src/CardWithInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export interface IProps extends React.BaseHTMLAttributes<HTMLDivElement> {
* Props to add to the radio element
*/

radioProps?: React.HTMLAttributes<HTMLInputElement> & {value: string};
radioProps?: React.HTMLAttributes<HTMLInputElement> & {
name: string;
value: string;
};

/**
* Description of the file
Expand Down Expand Up @@ -154,7 +157,7 @@ export const ClayCardWithInfo = ({
imgProps,
labels,
onSelectChange,
radioProps = {value: ''},
radioProps = {name: '', value: ''},
selectableType,
selected = false,
spritemap,
Expand Down
7 changes: 5 additions & 2 deletions packages/clay-card/src/CardWithUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ export interface IProps extends React.BaseHTMLAttributes<HTMLDivElement> {
* Props to add to the radio element
*/

radioProps?: React.HTMLAttributes<HTMLInputElement> & {value: string};
radioProps?: React.HTMLAttributes<HTMLInputElement> & {
name: string;
value: string;
};

/**
* Flag to indicate if card is selected
Expand Down Expand Up @@ -134,7 +137,7 @@ export const ClayCardWithUser = ({
spritemap,
stickerTitle,
selectableType,
radioProps = {value: ''},
radioProps = {name: '', value: ''},
userImageAlt = 'thumbnail',
userDisplayType,
userImageSrc,
Expand Down
3 changes: 3 additions & 0 deletions packages/clay-card/src/__tests__/__snapshots__/index.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1665,6 +1665,7 @@ exports[`ClayCardWithHorizontal renders with radio button 1`] = `
<input
class="custom-control-input"
disabled=""
name="cards"
role="radio"
type="radio"
value="radio1"
Expand Down Expand Up @@ -2917,6 +2918,7 @@ exports[`ClayCardWithInfo renders with radio button 1`] = `
<label>
<input
class="custom-control-input"
name="cards"
role="radio"
type="radio"
value="radio1"
Expand Down Expand Up @@ -3461,6 +3463,7 @@ exports[`ClayCardWithUser renders with radio button 1`] = `
<label>
<input
class="custom-control-input"
name="cards"
role="radio"
type="radio"
value="radio1"
Expand Down
6 changes: 3 additions & 3 deletions packages/clay-card/src/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ describe('ClayCardWithUser', () => {
href="#"
name="Foo Bar"
onSelectChange={jest.fn()}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
spritemap="/path/to/some/resource.svg"
/>
Expand Down Expand Up @@ -835,7 +835,7 @@ describe('ClayCardWithHorizontal', () => {
disabled
href="#"
onSelectChange={jest.fn()}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
selected={false}
spritemap="/path/to/some/resource.svg"
Expand Down Expand Up @@ -1146,7 +1146,7 @@ describe('ClayCardWithInfo', () => {
<ClayCardWithInfo
href="#"
onSelectChange={jest.fn()}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
selected={false}
spritemap="/path/to/some/resource.svg"
Expand Down
12 changes: 6 additions & 6 deletions packages/clay-card/stories/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const CardWithInfo = (args: any) => {
},
]}
onSelectChange={(value) => setRadioValue(value)}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
selected={radioValue === 'radio1'}
stickerProps={null}
Expand All @@ -132,7 +132,7 @@ export const CardWithInfo = (args: any) => {
},
]}
onSelectChange={(value) => setRadioValue(value)}
radioProps={{value: 'radio2'}}
radioProps={{name: 'cards', value: 'radio2'}}
selectableType="radio"
selected={radioValue === 'radio2'}
stickerProps={null}
Expand Down Expand Up @@ -270,7 +270,7 @@ export const CardWithHorizontal = (args: any) => {
disabled={args.disabled}
href="#"
onSelectChange={setRadioValue}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
selected={radioValue === 'radio1'}
title="Radio Selectable Folder 1"
Expand All @@ -292,7 +292,7 @@ export const CardWithHorizontal = (args: any) => {
disabled={args.disabled}
href="#"
onSelectChange={setRadioValue}
radioProps={{value: 'radio2'}}
radioProps={{name: 'cards', value: 'radio2'}}
selectableType="radio"
selected={radioValue === 'radio2'}
title="Radio Selectable Folder 2"
Expand Down Expand Up @@ -387,7 +387,7 @@ export const CardWithUser = (args: any) => {
disabled={args.disabled}
name="Abraham Kuyper I"
onSelectChange={setRadioValue}
radioProps={{value: 'radio1'}}
radioProps={{name: 'cards', value: 'radio1'}}
selectableType="radio"
selected={radioValue === 'radio1'}
stickerTitle="User Icon"
Expand All @@ -398,7 +398,7 @@ export const CardWithUser = (args: any) => {
disabled={args.disabled}
name="Abraham Kuyper II"
onSelectChange={setRadioValue}
radioProps={{value: 'radio2'}}
radioProps={{name: 'cards', value: 'radio2'}}
selectableType="radio"
selected={radioValue === 'radio2'}
stickerTitle="User Icon"
Expand Down
Loading