on master help sign in
feat: keep text black after has been touched
df16638Matt Condon (shrugs)
src/indigo-react/components/CheckboxInput.js+1
@@ -23,6 +23,7 @@ export default function CheckboxInput({
23 bind,
23 bind,
24 autoFocus,
24 autoFocus,
25 disabled,
25 disabled,
26+ touched,
26
27
27 // ignored
28 // ignored
28 initialValue,
29 initialValue,
src/indigo-react/components/Input.js+3−2
@@ -27,6 +27,7 @@ export default React.memo(function Input({
27 bind,
27 bind,
28 autoFocus,
28 autoFocus,
29 disabled,
29 disabled,
30+ touched,
30
31
31 // ignored
32 // ignored
32 initialValue,
33 initialValue,
@@ -82,8 +83,8 @@ export default React.memo(function Input({
82 'bg-gray1': disabled,
83 'bg-gray1': disabled,
83 },
84 },
84 {
85 {
85− gray4: !focused,
86+ gray4: !focused && !touched,
86− black: focused,
87+ black: focused || touched,
87 },
88 },
88 {
89 {
89 'b-green3': visiblyPassed,
90 'b-green3': visiblyPassed,
src/indigo-react/components/SelectInput.js+1
@@ -31,6 +31,7 @@ export default function SelectInput({
31 autoFocus,
31 autoFocus,
32 disabled,
32 disabled,
33 options,
33 options,
34+ touched,
34
35
35 // ignored
36 // ignored
36 initialValue,
37 initialValue,
src/indigo-react/components/ToggleInput.js+1
@@ -25,6 +25,7 @@ export default function ToggleInput({
25 bind,
25 bind,
26 autoFocus,
26 autoFocus,
27 disabled,
27 disabled,
28+ touched,
28
29
29 // ignored
30 // ignored
30 initialValue,
31 initialValue,
src/indigo-react/lib/useForm.js+2
@@ -217,6 +217,7 @@ export default function useForm(inputConfigs = []) {
217 error: errors[i],
217 error: errors[i],
218 hintError: hintErrors[i],
218 hintError: hintErrors[i],
219 focused: focuses[i],
219 focused: focuses[i],
220+ touched: hasBeenTouched[name],
220 autoFocus: autoFocus && !disabled,
221 autoFocus: autoFocus && !disabled,
221 disabled,
222 disabled,
222 ...rest,
223 ...rest,
@@ -241,6 +242,7 @@ export default function useForm(inputConfigs = []) {
241 errors,
242 errors,
242 hintErrors,
243 hintErrors,
243 focuses,
244 focuses,
245+ hasBeenTouched,
244 onChange,
246 onChange,
245 onFocus,
247 onFocus,
246 onBlur,
248 onBlur,