Update input

Make a consistent height with select triggers and fix props
This commit is contained in:
Justin Edmund 2023-06-30 12:28:36 -07:00
parent 072f6425f7
commit fd6e788c4d
2 changed files with 16 additions and 8 deletions

View file

@ -1,3 +1,7 @@
.full {
width: 100%;
}
.input { .input {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
background-color: var(--input-bg); background-color: var(--input-bg);
@ -11,7 +15,7 @@
padding: $unit * 1.5 $unit-2x; padding: $unit * 1.5 $unit-2x;
} }
&.wrapper { &.accessory {
$offset: 2px; $offset: 2px;
align-items: center; align-items: center;
@ -25,7 +29,7 @@
color: var(--text-tertiary); color: var(--text-tertiary);
display: block; display: block;
font-weight: $bold; font-weight: $bold;
line-height: 42px; line-height: 48px;
position: absolute; position: absolute;
right: $unit-2x; right: $unit-2x;
top: 0; top: 0;
@ -36,7 +40,7 @@
border-radius: $input-corner; border-radius: $input-corner;
border: none; border: none;
box-sizing: border-box; box-sizing: border-box;
padding: $unit * 1.5 $unit-2x; padding: ($unit * 1.75) $unit-2x;
width: 100%; width: 100%;
} }
} }
@ -58,6 +62,10 @@
} }
} }
&.number {
min-width: $unit-8x;
}
&.AlignRight { &.AlignRight {
text-align: right; text-align: right;
} }

View file

@ -27,12 +27,12 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
// Classes // Classes
const wrapperClasses = classNames( const wrapperClasses = classNames(
{ {
[styles.wrapper]: showCounter, [styles.wrapper]: true,
[styles.accessory]: showCounter,
[styles.input]: showCounter, [styles.input]: showCounter,
[styles.bound]: showCounter && bound, [styles.bound]: showCounter && bound,
}, },
showCounter && props.className?.split(' ').map((className) => styles[className])
props.className?.split(' ').map((className) => styles[className])
) )
const inputClasses = classNames( const inputClasses = classNames(
@ -43,7 +43,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
!showCounter && !showCounter &&
props.className?.split(' ').map((className) => styles[className]) props.className?.split(' ').map((className) => styles[className])
) )
const { defaultValue, ...inputProps } = props const { defaultValue, hide1Password, ...inputProps } = props
// Hooks // Hooks
useEffect(() => { useEffect(() => {
@ -67,7 +67,7 @@ const Input = React.forwardRef<HTMLInputElement, Props>(function input(
type={props.type} type={props.type}
name={props.name} name={props.name}
placeholder={props.placeholder} placeholder={props.placeholder}
defaultValue={value || ''} value={value || ''}
onBlur={props.onBlur} onBlur={props.onBlur}
onChange={handleChange} onChange={handleChange}
maxLength={props.maxLength} maxLength={props.maxLength}