Skip to content

chore(deps): pin dependencies #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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",
Expand All @@ -63,15 +63,15 @@
"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",
"ts-loader": "6.2.2",
"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",
Expand Down
23 changes: 4 additions & 19 deletions src/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import Error from '../Error'
import Gutter from '../Gutter'

interface Props {
type?: string
name?: string
onChange?: InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>['onChange']
onChange?: InputHTMLAttributes<HTMLInputElement>['onChange']
onFocus?: () => void
onBlur?: () => void
value?: string | number
Expand All @@ -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
Expand All @@ -40,17 +37,14 @@ interface Props {
* A standardized input component plus textarea
*/
const Input: FunctionComponent<Props> = ({
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 (
<div
className={concat('input', className)}
Expand Down Expand Up @@ -80,12 +74,9 @@ const Input: FunctionComponent<Props> = ({
: null
}

<InputType
<input
className='input__input'
type={type}
name={name}
rows={rows} // textarea
cols={cols} // textarea
min={min}
max={max}
step={step}
Expand All @@ -101,17 +92,11 @@ const Input: FunctionComponent<Props> = ({
...(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}/>

Expand Down
4 changes: 2 additions & 2 deletions src/Select/index.tsx
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -9,7 +9,7 @@ interface Props {
children?: [ReactNode] | ReactNode
className?: string
name?: string
onChange?: React.ChangeEventHandler
onChange?: InputHTMLAttributes<HTMLSelectElement>['onChange']
onBlur?: () => void
value?: string | number
error?: string | boolean
Expand Down
10 changes: 10 additions & 0 deletions src/TextArea/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import { mount } from 'enzyme'

import TextArea from './index'

describe('<TextArea />', () => {
it('renders', () => {
mount(<TextArea />)
})
})
109 changes: 109 additions & 0 deletions src/TextArea/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import * as React from 'react'
import { FunctionComponent, InputHTMLAttributes } from 'react'
import styles from './styles'
import concat from '../_utility/concat'
import Error from '../Error'
import Gutter from '../Gutter'

interface Props {
name?: string
onChange?: InputHTMLAttributes<HTMLTextAreaElement>['onChange']
onFocus?: () => void
onBlur?: () => void
value?: string | number
defaultValue?: string | number
error?: string | boolean
placeholder?: string
className?: string
onClick?: (MouseEvent) => void
background?: string
color?: string
containerStyle?: object
inputStyle?: object
inputErrorStyle?: object
errorStyle?: object
style?: object
label?: string
min?: number
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
}

/**
* A standardized input component plus textarea
*/
const Input: FunctionComponent<Props> = ({
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,
disabled
}) => {
return (
<div
className={concat('text-area', className)}
style={{
...styles.container,
position: 'relative',
...style,
...containerStyle
}}>

{ label
? <>
<label className='text-area__label'> {label} </label>
<Gutter half />
</>
: null }

<textarea
className='textarea__input'
name={name}
rows={rows} // textarea
cols={cols} // textarea
onChange={onChange}
onFocus={onFocus}
onBlur={onBlur}
placeholder={placeholder}
value={value}
defaultValue={defaultValue}
onClick={onClick}
style={{
...styles.input,
textAlign: textAlign || 'left' as 'left',
resize: 'none',
padding: '1rem',
...(background ? { background: background } : null),
...(color ? { color: color } : null),
...inputStyle,
...(error ? (inputErrorStyle || styles.errorBorder) : null),
height: 'auto'
}}
disabled={disabled}/>

{ typeof error === 'string'
? <Error
className='input__error'
style={{
...styles.error,
...errorStyle
}}>

{error}

</Error>
: null }

</div>
)
}

export default Input
7 changes: 7 additions & 0 deletions src/TextArea/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

Input example:

```js
<TextArea />

```
42 changes: 42 additions & 0 deletions src/TextArea/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import config from '../config'

export default {
container: {
width: '100%',
display: 'block'
},
input: {
height: '42px', // uniform height
border: '1px solid rgba(0,0,0, 0.20)',
borderRadius: config.size.corners,
WebkitBorderRadius: config.size.corners,
MozBorderRadius: config.size.corners,
WebkitAppearance: 'none' as 'none', // Disable chrome styles
MozAppearance: 'none' as 'none', // Disable firefox styles
// border: 'none',
// height: '100%',
width: '100%',
margin: 0,
padding: 0,
paddingLeft: '1rem',
paddingRight: '1px', // border fix
WebkitBoxSizing: 'border-box' as 'border-box', /* Safari/Chrome, other WebKit */
MozBoxSizing: 'border-box' as 'border-box', /* Firefox, other Gecko */
boxSizing: 'border-box' as 'border-box', /* Opera/IE 8+ */
// width: '100%',
fontFamily: 'sans-serif',
fontSize: '1rem',
textAlign: 'center' as 'center',
textDecoration: 'none'
},
textarea: {

},

errorBorder: {
border: '2px solid red'
},
error: {
padding: '1rem 0 0 0'
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ export { default as Skeleton } from './Skeleton'
export { default as Spinner } from './Spinner'
export { default as Table } from './Table'
export { default as Tabs } from './Tabs'
export { default as TextArea } from './TextArea'
export { default as Typography } from './Typography'