@@ -1,7 +1,7 @@
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
1import React, { useCallback, useEffect, useMemo, useState } from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
4−import Grid from 'components/Grid';
4+import { Flex } from 'indigo-react';
6import { compose } from 'lib/lib';
6import { compose } from 'lib/lib';
7import { kDefaultValidator } from 'lib/validators';
7import { kDefaultValidator } from 'lib/validators';
@@ -124,6 +124,8 @@ export default function Input({
127 disabled = false,
129 disabled = false,
128 mono = false,
130 mono = false,
129 autoFocus = false,
131 autoFocus = false,
@@ -137,6 +139,12 @@ export default function Input({
137 autoFocus: actuallyAutoFocus,
139 autoFocus: actuallyAutoFocus,
142+ // notify parent of enter keypress iff not disabled
143+ const onKeyPress = useCallback(
144+ e => !disabled && e.key === 'Enter' && onEnter && onEnter(),
140 // notify parent of value only when passing
148 // notify parent of value only when passing
141 useEffect(() => {
149 useEffect(() => {
142 pass && onValue && onValue(data);
150 pass && onValue && onValue(data);
@@ -158,15 +166,15 @@ export default function Input({
158 }, [focused, onFocus]);
166 }, [focused, onFocus]);
161− <Grid>
169+ <Flex col>
163− <label className="f6 lh-tall" htmlFor={name}>
170+ <Flex.Item as="label" className="f6 lh-tall" htmlFor={name}>
165− </label>
172+ </Flex.Item>
166− </Grid.Item>
173+ <Flex row>
167− <Grid.Item full>
174+ <Flex.Item
168− <input
175+ as="input"
169 {...rest}
176 {...rest}
177+ cols={[1, accessory ? 11 : 13]}
170 className={cn(
178 className={cn(
171 'b b1 p3',
179 'b b1 p3',
172 { mono },
180 { mono },
@@ -189,12 +197,18 @@ export default function Input({
190 ...(disabled && { pointerEvents: 'none', cursor: 'not-allowed' }),
198 ...(disabled && { pointerEvents: 'none', cursor: 'not-allowed' }),
200+ onKeyPress={onKeyPress}
192 id={name}
201 id={name}
194 autoFocus={actuallyAutoFocus}
202 autoFocus={actuallyAutoFocus}
195 {...bind}
203 {...bind}
197− </Grid.Item>
206+ {accessory && (
198− </Grid>
207+ <Flex.Item style={{ height: '45px', overflow: 'hidden' }}>