diff --git a/package-lock.json b/package-lock.json index b284059..de3ee8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@patomation/ui", - "version": "2.0.0-beta12", + "version": "2.0.0-beta17", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6fe4a46..affded3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patomation/ui", - "version": "2.0.0-beta16", + "version": "2.0.0-beta17", "main": "lib/index.js", "types": "lib/index.d.ts", "private": false, @@ -38,7 +38,7 @@ "@commitlint/config-conventional": "8.3.4", "@types/jest": "25.2.1", "@types/node": "13.11.1", - "@types/react": "^16.9.33", + "@types/react": "16.9.34", "@typescript-eslint/eslint-plugin": "2.27.0", "acorn": "7.1.1", "autoprefixer": "9.7.6", @@ -63,7 +63,7 @@ "minimist": "1.2.5", "nodemon": "2.0.3", "react-docgen-typescript": "1.16.3", - "react-dom": "^16.13.1", + "react-dom": "16.13.1", "react-router-dom": "5.1.2", "react-styleguidist": "11.0.5", "ts-jest": "25.3.1", @@ -71,7 +71,7 @@ "tsconfigs": "4.0.2", "typescript": "3.8.3", "webpack": "4.42.1", - "webpack-bundle-analyzer": "^3.6.1" + "webpack-bundle-analyzer": "3.6.1" }, "peerDependencies": { "react": "^16.13.1", diff --git a/src/Input/index.tsx b/src/Input/index.tsx index c41249c..c9bc3a6 100644 --- a/src/Input/index.tsx +++ b/src/Input/index.tsx @@ -6,9 +6,8 @@ import Error from '../Error' import Gutter from '../Gutter' interface Props { - type?: string name?: string - onChange?: InputHTMLAttributes['onChange'] + onChange?: InputHTMLAttributes['onChange'] onFocus?: () => void onBlur?: () => void value?: string | number @@ -29,8 +28,6 @@ interface Props { max?: number step?: number textAlign?: 'center' | 'left' | '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset' | 'right' | 'end' | 'justify' | 'match-parent' | 'start' | undefined - cols?: number - rows?: number prefix?: string suffix?: string disabled?: boolean @@ -40,17 +37,14 @@ interface Props { * A standardized input component plus textarea */ const Input: FunctionComponent = ({ - type, name, onChange, onFocus, onBlur, value, defaultValue, error, placeholder, + name, onChange, onFocus, onBlur, value, defaultValue, error, placeholder, className, onClick, background, color, containerStyle, inputStyle, inputErrorStyle, errorStyle, style, textAlign, - rows = 3, cols, label, min, max, step, prefix, suffix, disabled }) => { - const InputType = type === 'textarea' ? 'textarea' : 'input' - return (
= ({ : null } - = ({ ...(prefix ? { paddingLeft: '2rem' } : null), - ...(type === 'textarea' ? { - textAlign: 'left' as 'left', - resize: 'none', - padding: '1rem' - } : null), ...(background ? { background: background } : null), ...(color ? { color: color } : null), textAlign, ...inputStyle, - ...(error ? (inputErrorStyle || styles.errorBorder) : null), - ...(type === 'textarea' ? { height: 'auto' } : null) + ...(error ? (inputErrorStyle || styles.errorBorder) : null) }} disabled={disabled}/> diff --git a/src/Select/index.tsx b/src/Select/index.tsx index 615738c..cadce09 100644 --- a/src/Select/index.tsx +++ b/src/Select/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { FunctionComponent, ReactNode } from 'react' +import { FunctionComponent, ReactNode, InputHTMLAttributes } from 'react' import styles from './styles' import concat from '../_utility/concat' @@ -9,7 +9,7 @@ interface Props { children?: [ReactNode] | ReactNode className?: string name?: string - onChange?: React.ChangeEventHandler + onChange?: InputHTMLAttributes['onChange'] onBlur?: () => void value?: string | number error?: string | boolean diff --git a/src/TextArea/index.test.tsx b/src/TextArea/index.test.tsx new file mode 100644 index 0000000..eaad757 --- /dev/null +++ b/src/TextArea/index.test.tsx @@ -0,0 +1,10 @@ +import * as React from 'react' +import { mount } from 'enzyme' + +import TextArea from './index' + +describe('