# All files / src/Input Input.styled.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
100% Lines 5/5

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

    2x

    8x

    8x

    8x

    8x

     import { Style, Styles } from 'jss'
    import { Theme } from '../styles'
    import { InputClassProps } from './Input.type'

    const wrapper: Style = {
      display: 'inline-block',
      position: 'relative',
      minWidth: 200,
      font: 'inherit'
    }

    const root = (theme: Theme) => ({
      outline: 'none',
      font: 'inherit',
      width: '100%',
      borderRadius: 2,
      border: '2px solid',
      borderColor: theme.colors!.standard!.default,
      transition: theme.transitions!.input,
      // ${th.size('medium.input')},
      '&:hover': {
        borderColor: theme.colors!.standard!.dark1
      },
      '&:active, &:focus': {
        borderColor: theme.colors!.primary!.default
      },
      '&:disabled': {
        color: theme.colors!.standard!.dark2,
        backgroundColor: theme.colors!.standard!.light1,
        cursor: 'not-allowed',
        pointerEvents: 'none'
      },
      ...theme.sizes!.medium!.input
    })
    const error = (theme: Theme): Style => ({
      borderColor: theme.colors!.error!.default,
      '&:hover': {
        borderColor: theme.colors!.error!.default
      },
      '&:active, &:focus': {
        borderColor: theme.colors!.error!.default
      }
    })

    const clearedIcon = (theme: Theme): Style => ({
      height: '100%',
      position: 'absolute',
      right: 0,
      top: 0,
      fontSize: 12,
      cursor: 'pointer',
      display: 'inline-flex',
      justifyContent: 'center',
      alignItems: 'center',
      transition: theme.transitions!.input,
      '&:hover': {
        backgroundColor: theme.colors!.primary!.default,
        color: theme.colors!.white!.default
      }
    })

    export const styles = (theme: Theme): Styles<InputClassProps> => ({
      root: root(theme),
      error: error(theme),
      wrapper,
      clearedIcon: clearedIcon(theme)
    })