Skip to content

Commit

Permalink
Fixing build (for realz)
Browse files Browse the repository at this point in the history
  • Loading branch information
atomicpages committed Nov 9, 2019
1 parent f0ebfe2 commit d992f0b
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/BaseInput/BaseInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { BaseProps } from '../../typings/BaseProps';
import { BaseProps } from '../../types/BaseProps';
import classNames from 'classnames';
import { isDefaultStyle } from '../../utils/utils';
import { useMemoizedIcon } from '../../hooks/useMemoizedIcon';
Expand Down
4 changes: 2 additions & 2 deletions src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react';

import { useCheckboxChange } from './hooks/useCheckboxChange';
import { mergeRefs, warn, getChecked } from '../../utils/utils';
import { BaseProps } from '../../typings/BaseProps';
import { RadioCheckboxFillModes } from '../../typings/types';
import { BaseProps } from '../../types/BaseProps';
import { RadioCheckboxFillModes } from '../../types/types';
import { BaseInput } from '../BaseInput/BaseInput';
import { useGenericState } from '../../hooks/useGenericState';

Expand Down
2 changes: 1 addition & 1 deletion src/components/Radio/Radio.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { BaseProps } from '../../typings/BaseProps';
import { BaseProps } from '../../types/BaseProps';
import { BaseInput } from '../BaseInput/BaseInput';
import { useGenericChange, ChangeArgs } from '../../hooks/useGenericChange';
import { useGenericState } from '../../hooks/useGenericState';
Expand Down
4 changes: 2 additions & 2 deletions src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as React from 'react';
import classNames from 'classnames';

import { BaseProps } from '../../typings/BaseProps';
import { BaseProps } from '../../types/BaseProps';
import { BaseInput } from '../BaseInput/BaseInput';

import { useGenericChange, ChangeArgs } from '../../hooks/useGenericChange';
import { SwitchFillModes, SwitchAnimations } from '../../typings/types';
import { SwitchFillModes, SwitchAnimations } from '../../types/types';
import { getChecked } from '../../utils/utils';
import { useGenericState } from '../../hooks/useGenericState';

Expand Down
83 changes: 83 additions & 0 deletions src/types/BaseProps.ts
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;
};
9 changes: 9 additions & 0 deletions src/types/types.ts
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';
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseProps } from '../typings/BaseProps';
import { BaseProps } from '../types/BaseProps';
import { ReactComponentElement } from 'react';

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

0 comments on commit d992f0b

Please sign in to comment.