Skip to content

Commit 435d116

Browse files
committed
added new props
1 parent 4526961 commit 435d116

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

packages/components/src/inputs/AltRadio/AltRadio.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const meta: Meta<typeof AltRadioStateful> = {
1515
className: {
1616
control: 'text',
1717
},
18+
tileClassName: {
19+
control: 'text',
20+
},
1821
title: {
1922
control: 'text',
2023
},

packages/components/src/inputs/AltRadio/AltRadio.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@ import withStateChecked from '@ids-internal/hoc/withStateChecked';
66

77
import { AltRadioProps } from './AltRadio.types';
88

9-
const AltRadio = ({ className = '', label, ...inputProps }: AltRadioProps) => {
9+
const AltRadio = ({ className = '', label, tileClassName = '', title = '', ...inputProps }: AltRadioProps) => {
1010
const { checked = false, disabled = false, error = false, onBlur, onChange, onFocus, onInput } = inputProps;
1111
const inputRef = useRef<HTMLInputElement>(null);
1212
const [isFocused, setIsFocused] = useState(false);
1313
const altRadioClassName = createCssClassNames({
1414
'ids-alt-radio': true,
15-
[className]: true,
15+
[className]: !!className,
1616
});
1717
const altRadioTileClassName = createCssClassNames({
1818
'ids-alt-radio__tile': true,
1919
'ids-alt-radio__tile--checked': checked,
2020
'ids-alt-radio__tile--disabled': disabled,
2121
'ids-alt-radio__tile--error': error,
2222
'ids-alt-radio__tile--focused': isFocused,
23+
[tileClassName]: !!tileClassName,
2324
});
2425
const onTileClick = () => {
2526
inputRef.current?.focus();
@@ -39,7 +40,7 @@ const AltRadio = ({ className = '', label, ...inputProps }: AltRadioProps) => {
3940
};
4041

4142
return (
42-
<div className={altRadioClassName}>
43+
<div className={altRadioClassName} title={title}>
4344
<div className="ids-alt-radio__source">
4445
<BaseChoiceInput
4546
{...inputProps}

packages/components/src/inputs/AltRadio/AltRadio.types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import { BaseChoiceInputProps } from '@ids-internal/partials/BaseChoiceInput';
44

55
export interface AltRadioProps extends Omit<BaseChoiceInputProps, 'type'> {
66
label: ReactNode;
7-
};
7+
tileClassName?: string;
8+
}

0 commit comments

Comments
 (0)