Skip to content

Commit

Permalink
Merge pull request mallfoundry#681 from Hector-Chong/feat/generic-che…
Browse files Browse the repository at this point in the history
…ckbox-radio

feat: add generic to Checkbox.Group and Radio.Group
  • Loading branch information
Pilotager authored Feb 6, 2024
2 parents 911e1f2 + c8626a3 commit bad16e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/core/src/checkbox/checkbox-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { prefixClassname } from "../styles"
import CheckboxGroupContext from "./checkbox-group.context"
import { CheckboxGroupDirection } from "./checkbox-group.shared"

export interface CheckboxGroupProps extends ViewProps {
defaultValue?: any[]
value?: any[]
export interface CheckboxGroupProps<T = any> extends ViewProps {
defaultValue?: T[]
value?: T[]
max?: number
direction?: CheckboxGroupDirection
children?: ReactNode

onChange?(value: any[]): void
onChange?(value: T[]): void
}

function CheckboxGroup(props: CheckboxGroupProps) {
function CheckboxGroup<T = any>(props: CheckboxGroupProps<T>) {
const {
defaultValue,
value: valueProp,
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/radio/radio-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ import { prefixClassname } from "../styles"
import RadioGroupContext from "./radio-group.context"
import { RadioGroupDirection } from "./radio-group.shared"

export interface RadioGroupProps extends ViewProps {
defaultValue?: any
value?: any
export interface RadioGroupProps<T = any> extends ViewProps {
defaultValue?: T
value?: T
disabled?: boolean
direction?: RadioGroupDirection
size?: number
children?: ReactNode

onChange?(value: any): void
onChange?(value: T): void
}

function RadioGroup(props: RadioGroupProps) {
function RadioGroup<T = any>(props: RadioGroupProps<T>) {
const {
className,
defaultValue,
Expand Down

0 comments on commit bad16e2

Please sign in to comment.