-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
f0ebfe2
commit d992f0b
Showing
7 changed files
with
99 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import * as React from 'react'; | ||
|
||
import { | ||
PCRColors, | ||
PCRColorsOutline, | ||
RadioCheckboxVariants, | ||
RadioCheckboxFillModes, | ||
RadioCheckboxAnimations, | ||
SwitchFillModes, | ||
} from './types'; | ||
|
||
export type BaseProps<S> = React.HTMLAttributes<HTMLInputElement> & { | ||
/** | ||
* The current checkbox state. | ||
*/ | ||
state: S; | ||
|
||
/** | ||
* Dispatch method from React.useState or `this.setState` from class component. | ||
*/ | ||
setState: React.Dispatch<React.SetStateAction<S>>; | ||
|
||
/** | ||
* A label to show in the Checkbox. This can be any JSX node or string. | ||
*/ | ||
children?: React.ReactNode; | ||
|
||
/** | ||
* Specify one of the colors. | ||
*/ | ||
color?: PCRColors | PCRColorsOutline; | ||
|
||
/** | ||
* Specify one of the variants. | ||
*/ | ||
variant?: RadioCheckboxVariants; | ||
|
||
/** | ||
* Specify one of the fill modes. | ||
*/ | ||
fill?: RadioCheckboxFillModes | SwitchFillModes; | ||
|
||
/** | ||
* Specify one of the animations. | ||
*/ | ||
animation?: RadioCheckboxAnimations; | ||
|
||
/** | ||
* Pass an icon to render. | ||
*/ | ||
icon?: React.ReactComponentElement<any, HTMLElement>; | ||
|
||
/** | ||
* Runs inside the default onChange handler for the Checkbox. | ||
*/ | ||
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
|
||
/** | ||
* Set the checkbox as disabled. | ||
*/ | ||
disabled?: boolean; | ||
|
||
/** | ||
* Set the checkbox as locked. This will also set the | ||
* `aria-disabled` attribute to `true`. | ||
*/ | ||
locked?: boolean; | ||
|
||
/** | ||
* Pass additional class names to the `.pretty` div. | ||
*/ | ||
className?: string; | ||
|
||
/** | ||
* Set the value of the input field. | ||
*/ | ||
value?: string; | ||
|
||
/** | ||
* Make the checkbox, radio, or switcher bigger. | ||
*/ | ||
bigger?: boolean; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type PCRColors = 'primary' | 'success' | 'info' | 'warning' | 'danger'; | ||
export type PCRColorsOutline = 'primary-o' | 'success-o' | 'info-o' | 'warning-o' | 'danger-o'; | ||
|
||
export type RadioCheckboxVariants = 'curve' | 'round' | 'plain'; | ||
export type RadioCheckboxFillModes = 'fill' | 'thick'; | ||
export type SwitchFillModes = 'outline' | 'fill' | 'slim'; | ||
|
||
export type SwitchAnimations = 'smooth' | 'jelly' | 'tada'; | ||
export type RadioCheckboxAnimations = SwitchAnimations | 'rotate' | 'pulse'; |
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