-
-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
157 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import classNames from 'classnames'; | ||
import type { ComponentProps } from 'react'; | ||
import { forwardRef } from 'react'; | ||
import { DeepPartial } from '..'; | ||
import { mergeDeep } from '../../helpers/mergeDeep'; | ||
import { useTheme } from '../Flowbite/ThemeContext'; | ||
|
||
export interface FlowbiteCheckboxTheme { | ||
base: string; | ||
} | ||
|
||
export type CheckboxProps = Omit<ComponentProps<'input'>, 'type' | 'ref'>; | ||
export interface CheckboxProps extends Omit<ComponentProps<'input'>, 'type' | 'ref'> { | ||
theme?: DeepPartial<FlowbiteCheckboxTheme>; | ||
} | ||
|
||
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>( | ||
({ theme: customTheme = {}, className, ...props }, ref) => { | ||
const theme = mergeDeep(useTheme().theme.checkbox, customTheme); | ||
|
||
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(({ className, ...props }, ref) => { | ||
const theme = useTheme().theme.checkbox; | ||
return <input ref={ref} className={classNames(theme.base, className)} type="checkbox" {...props} />; | ||
}); | ||
return <input ref={ref} className={classNames(theme.base, className)} type="checkbox" {...props} />; | ||
}, | ||
); | ||
|
||
Checkbox.displayName = 'Checkbox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import classNames from 'classnames'; | ||
import type { ComponentProps } from 'react'; | ||
import { forwardRef } from 'react'; | ||
import { DeepPartial } from '..'; | ||
import { mergeDeep } from '../../helpers/mergeDeep'; | ||
import { useTheme } from '../Flowbite/ThemeContext'; | ||
|
||
export interface FlowbiteRadioTheme { | ||
base: string; | ||
} | ||
|
||
export type RadioProps = Omit<ComponentProps<'input'>, 'type' | 'ref'>; | ||
export interface RadioProps extends Omit<ComponentProps<'input'>, 'type' | 'ref'> { | ||
theme?: DeepPartial<FlowbiteRadioTheme>; | ||
} | ||
|
||
export const Radio = forwardRef<HTMLInputElement, RadioProps>( | ||
({ theme: customTheme = {}, className, ...props }, ref) => { | ||
const theme = mergeDeep(useTheme().theme.radio, customTheme); | ||
|
||
export const Radio = forwardRef<HTMLInputElement, RadioProps>(({ className, ...props }, ref) => { | ||
const theme = useTheme().theme.radio; | ||
return <input ref={ref} className={classNames(theme.base, className)} type="radio" {...props} />; | ||
}); | ||
return <input ref={ref} className={classNames(theme.base, className)} type="radio" {...props} />; | ||
}, | ||
); | ||
|
||
Radio.displayName = 'Radio'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.