Skip to content

Commit d992f0b

Browse files
committed
Fixing build (for realz)
1 parent f0ebfe2 commit d992f0b

File tree

7 files changed

+99
-7
lines changed

7 files changed

+99
-7
lines changed

src/components/BaseInput/BaseInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { BaseProps } from '../../typings/BaseProps';
2+
import { BaseProps } from '../../types/BaseProps';
33
import classNames from 'classnames';
44
import { isDefaultStyle } from '../../utils/utils';
55
import { useMemoizedIcon } from '../../hooks/useMemoizedIcon';

src/components/Checkbox/Checkbox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import * as React from 'react';
22

33
import { useCheckboxChange } from './hooks/useCheckboxChange';
44
import { mergeRefs, warn, getChecked } from '../../utils/utils';
5-
import { BaseProps } from '../../typings/BaseProps';
6-
import { RadioCheckboxFillModes } from '../../typings/types';
5+
import { BaseProps } from '../../types/BaseProps';
6+
import { RadioCheckboxFillModes } from '../../types/types';
77
import { BaseInput } from '../BaseInput/BaseInput';
88
import { useGenericState } from '../../hooks/useGenericState';
99

src/components/Radio/Radio.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { BaseProps } from '../../typings/BaseProps';
2+
import { BaseProps } from '../../types/BaseProps';
33
import { BaseInput } from '../BaseInput/BaseInput';
44
import { useGenericChange, ChangeArgs } from '../../hooks/useGenericChange';
55
import { useGenericState } from '../../hooks/useGenericState';

src/components/Switch/Switch.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import classNames from 'classnames';
33

4-
import { BaseProps } from '../../typings/BaseProps';
4+
import { BaseProps } from '../../types/BaseProps';
55
import { BaseInput } from '../BaseInput/BaseInput';
66

77
import { useGenericChange, ChangeArgs } from '../../hooks/useGenericChange';
8-
import { SwitchFillModes, SwitchAnimations } from '../../typings/types';
8+
import { SwitchFillModes, SwitchAnimations } from '../../types/types';
99
import { getChecked } from '../../utils/utils';
1010
import { useGenericState } from '../../hooks/useGenericState';
1111

src/types/BaseProps.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import * as React from 'react';
2+
3+
import {
4+
PCRColors,
5+
PCRColorsOutline,
6+
RadioCheckboxVariants,
7+
RadioCheckboxFillModes,
8+
RadioCheckboxAnimations,
9+
SwitchFillModes,
10+
} from './types';
11+
12+
export type BaseProps<S> = React.HTMLAttributes<HTMLInputElement> & {
13+
/**
14+
* The current checkbox state.
15+
*/
16+
state: S;
17+
18+
/**
19+
* Dispatch method from React.useState or `this.setState` from class component.
20+
*/
21+
setState: React.Dispatch<React.SetStateAction<S>>;
22+
23+
/**
24+
* A label to show in the Checkbox. This can be any JSX node or string.
25+
*/
26+
children?: React.ReactNode;
27+
28+
/**
29+
* Specify one of the colors.
30+
*/
31+
color?: PCRColors | PCRColorsOutline;
32+
33+
/**
34+
* Specify one of the variants.
35+
*/
36+
variant?: RadioCheckboxVariants;
37+
38+
/**
39+
* Specify one of the fill modes.
40+
*/
41+
fill?: RadioCheckboxFillModes | SwitchFillModes;
42+
43+
/**
44+
* Specify one of the animations.
45+
*/
46+
animation?: RadioCheckboxAnimations;
47+
48+
/**
49+
* Pass an icon to render.
50+
*/
51+
icon?: React.ReactComponentElement<any, HTMLElement>;
52+
53+
/**
54+
* Runs inside the default onChange handler for the Checkbox.
55+
*/
56+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
57+
58+
/**
59+
* Set the checkbox as disabled.
60+
*/
61+
disabled?: boolean;
62+
63+
/**
64+
* Set the checkbox as locked. This will also set the
65+
* `aria-disabled` attribute to `true`.
66+
*/
67+
locked?: boolean;
68+
69+
/**
70+
* Pass additional class names to the `.pretty` div.
71+
*/
72+
className?: string;
73+
74+
/**
75+
* Set the value of the input field.
76+
*/
77+
value?: string;
78+
79+
/**
80+
* Make the checkbox, radio, or switcher bigger.
81+
*/
82+
bigger?: boolean;
83+
};

src/types/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export type PCRColors = 'primary' | 'success' | 'info' | 'warning' | 'danger';
2+
export type PCRColorsOutline = 'primary-o' | 'success-o' | 'info-o' | 'warning-o' | 'danger-o';
3+
4+
export type RadioCheckboxVariants = 'curve' | 'round' | 'plain';
5+
export type RadioCheckboxFillModes = 'fill' | 'thick';
6+
export type SwitchFillModes = 'outline' | 'fill' | 'slim';
7+
8+
export type SwitchAnimations = 'smooth' | 'jelly' | 'tada';
9+
export type RadioCheckboxAnimations = SwitchAnimations | 'rotate' | 'pulse';

src/utils/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BaseProps } from '../typings/BaseProps';
1+
import { BaseProps } from '../types/BaseProps';
22
import { ReactComponentElement } from 'react';
33

44
const __DEV__ = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test';

0 commit comments

Comments
 (0)