Skip to content

Commit

Permalink
Merge pull request #129 from layerx-labs/develop
Browse files Browse the repository at this point in the history
feat: update to 3.0.8
  • Loading branch information
RTAndrew authored Nov 7, 2023
2 parents dc91a00 + 4691781 commit 3ae89ed
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/molecules/checkbox-group/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React, { CSSProperties } from 'react';
import Checkbox from '../../atoms/checkbox';
import Checkbox, { CheckboxProps } from '../../atoms/checkbox';
import ErrorField from '../../atoms/error-field';
import * as Styles from './styles';

export type CheckboxItem = {
value: string;
label?: string | React.ReactNode;
checked?: boolean;
checked?: boolean | null;
/** The item changes can be tracked here
* or inside the `CheckboxGroup' onChange`
*/
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
error?: string;
disabled?: boolean;
Expand All @@ -21,7 +24,10 @@ export interface CheckboxGroupProps {
children?: React.ReactNode;
options?: CheckboxItem[];
error?: string;
onChange?: () => {};
/** The item changes can be tracked here
* or inside the `CheckboxItem' onChange`
*/
onChange?: CheckboxProps['onChange'];
disabled?: boolean;
}

Expand All @@ -45,8 +51,11 @@ const CheckboxGroup = (props: CheckboxGroupProps) => {
<Checkbox
label={value.label}
value={value.value}
checked={value.checked}
onChange={onChange}
checked={value.checked ?? undefined}
onChange={event => {
onChange?.(event);
value.onChange?.(event);
}}
error={!!error}
disabled={disabled}
/>
Expand Down

0 comments on commit 3ae89ed

Please sign in to comment.