Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ interface Props extends Pick<InputWrapperBaseProps, "feedback"> {
* Callback triggered when the user checks/unchecks an option or changes the quantity
*/
onChange: (selected: SelectedItem[]) => void
/**
* set a unique id for the card element, useful for testing or accessibility purposes
**/
cardId?: string
}

/**
Expand All @@ -60,7 +64,15 @@ interface Props extends Pick<InputWrapperBaseProps, "feedback"> {
* <span type="info">Quantity for each option item has a min/max range, to prevent selecting less or more than the allowed number.</span>
*/
export const InputCheckboxGroup = withSkeletonTemplate<Props>(
({ options, defaultValues = [], onChange, title, isLoading, feedback }) => {
({
options,
defaultValues = [],
onChange,
title,
isLoading,
feedback,
cardId,
}) => {
const [_state, dispatch] = useReducer(
reducer,
makeInitialState({ options, defaultValues }),
Expand Down Expand Up @@ -108,6 +120,7 @@ export const InputCheckboxGroup = withSkeletonTemplate<Props>(
gap="1"
overflow="hidden"
className={cn(getFeedbackStyle(feedback))}
id={cardId}
>
{options.map((optionItem) => {
const currentItem = _state.find(
Expand Down
Loading