Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 53x 29x 1x 47x | import cx from 'classnames'
export const PREFIX = 'sui'
export const CATEGORY = 'Atom'
export const COMPONENT = 'Input'
export const BASE = `${PREFIX}-${CATEGORY}${COMPONENT}`
export const BASE_CLASS = `${BASE}-input`
// Enums
export const TYPES = {
DATE: 'date',
MASK: 'mask',
NUMBER: 'number',
PASSWORD: 'password',
SUI_PASSWORD: 'sui-password',
TEXT: 'text',
TEL: 'tel',
EMAIL: 'email',
NONE: 'none'
}
export const SIZES = {
XLARGE: 'xl',
LARGE: 'l',
MEDIUM: 'm',
SMALL: 's',
XSMALL: 'xs'
}
export const INPUT_STATES = {
ERROR: 'error',
SUCCESS: 'success',
ALERT: 'alert'
}
export const INPUT_SHAPES = {
ROUNDED: 'rounded',
SQUARE: 'square',
CIRCLE: 'circle'
}
export const noop = () => null
export const isFunction = fn => typeof fn === 'function'
export const getClassNames = ({
size,
charsSize,
hideInput,
noBorder,
readOnly,
errorState,
state,
shape,
className
}) => {
return cx(
BASE_CLASS,
size && `${BASE_CLASS}-size-${size}`,
charsSize && `${BASE_CLASS}--charsSize`,
hideInput && `${BASE_CLASS}--hidden`,
noBorder && `${BASE_CLASS}--noBorder`,
readOnly && `${BASE_CLASS}--readOnly`,
errorState && `${BASE_CLASS}--state-${INPUT_STATES.ERROR}`,
errorState === false && `${BASE_CLASS}--state-${INPUT_STATES.SUCCESS}`,
state && `${BASE_CLASS}--state-${state}`,
shape && `${BASE_CLASS}-shape-${shape}`,
className
)
}
|