@khanacademy/wonder-blocks-form 4.0.8 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ffe3758d: Add indeterminate state to checkbox
8
+
9
+ ## 4.0.9
10
+
11
+ ### Patch Changes
12
+
13
+ - d0f0ce7e: Updates input to StyledInput and uses style prop
14
+ - 1269f6e0: Allow text highlighting on choice components
15
+ - f71343d6: Remove ClickableBehavior from Choice to improve screenreader a11y
16
+ - Updated dependencies [3c400719]
17
+ - Updated dependencies [a6164ed0]
18
+ - @khanacademy/wonder-blocks-core@5.1.0
19
+ - @khanacademy/wonder-blocks-clickable@3.0.9
20
+ - @khanacademy/wonder-blocks-icon@2.0.9
21
+ - @khanacademy/wonder-blocks-layout@2.0.9
22
+ - @khanacademy/wonder-blocks-typography@2.0.9
23
+
3
24
  ## 4.0.8
4
25
 
5
26
  ### Patch Changes
@@ -1,16 +1,12 @@
1
1
  import * as React from "react";
2
2
  import type { ChoiceCoreProps } from "../util/types";
3
- type Props = ChoiceCoreProps & {
4
- hovered: boolean;
5
- focused: boolean;
6
- pressed: boolean;
7
- waiting: boolean;
8
- };
9
3
  /**
10
4
  * The internal stateless ☑️ Checkbox
11
5
  */
12
- export default class CheckboxCore extends React.Component<Props> {
6
+ export default class CheckboxCore extends React.Component<ChoiceCoreProps> {
7
+ componentDidMount(): void;
8
+ componentDidUpdate(prevProps: Readonly<ChoiceCoreProps>): void;
9
+ inputRef: React.RefObject<HTMLInputElement>;
13
10
  handleChange: () => void;
14
11
  render(): React.ReactNode;
15
12
  }
16
- export {};
@@ -6,19 +6,16 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { ChoiceCoreProps } from "../util/types";
9
- declare type Props = {|
10
- ...ChoiceCoreProps,
11
- ...{|
12
- hovered: boolean,
13
- focused: boolean,
14
- pressed: boolean,
15
- waiting: boolean,
16
- |},
17
- |};
9
+
18
10
  /**
19
11
  * The internal stateless ☑️ Checkbox
20
12
  */
21
- declare export default class CheckboxCore extends React.Component<Props> {
13
+ declare export default class CheckboxCore
14
+ extends React.Component<ChoiceCoreProps>
15
+ {
16
+ componentDidMount(): void;
17
+ componentDidUpdate(prevProps: $ReadOnly<ChoiceCoreProps>): void;
18
+ inputRef: React.RefObject<HTMLInputElement>;
22
19
  handleChange: () => void;
23
20
  render(): React.Node;
24
21
  }
@@ -1,10 +1,11 @@
1
1
  import * as React from "react";
2
2
  import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
3
+ import type { Checked } from "../util/types";
3
4
  type ChoiceComponentProps = AriaProps & {
4
5
  /**
5
- * Whether this component is checked
6
+ * Whether this component is checked or indeterminate
6
7
  */
7
- checked: boolean;
8
+ checked: Checked;
8
9
  /**
9
10
  * Whether this component is disabled
10
11
  */
@@ -6,13 +6,14 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { AriaProps, StyleType } from "@khanacademy/wonder-blocks-core";
9
+ import type { Checked } from "../util/types";
9
10
  declare type ChoiceComponentProps = {|
10
11
  ...AriaProps,
11
12
  ...{|
12
13
  /**
13
- * Whether this component is checked
14
+ * Whether this component is checked or indeterminate
14
15
  */
15
- checked: boolean,
16
+ checked: Checked,
16
17
 
17
18
  /**
18
19
  * Whether this component is disabled
@@ -4,7 +4,7 @@ import CheckboxCore from "./checkbox-core";
4
4
  import RadioCore from "./radio-core";
5
5
  type Props = AriaProps & {
6
6
  /** Whether this choice is checked. */
7
- checked: boolean;
7
+ checked: boolean | null | undefined;
8
8
  /** Whether this choice option is disabled. */
9
9
  disabled: boolean;
10
10
  /** Whether this choice is in error mode. */
@@ -40,7 +40,6 @@ type Props = AriaProps & {
40
40
  variant: "radio" | "checkbox";
41
41
  };
42
42
  type DefaultProps = {
43
- checked: Props["checked"];
44
43
  disabled: Props["disabled"];
45
44
  error: Props["error"];
46
45
  };
@@ -53,10 +52,9 @@ type DefaultProps = {
53
52
  * (because for Choice, that prop would be auto-populated by CheckboxGroup).
54
53
  */ export default class ChoiceInternal extends React.Component<Props> {
55
54
  static defaultProps: DefaultProps;
56
- handleLabelClick: (event: React.SyntheticEvent) => void;
57
55
  handleClick: () => void;
58
56
  getChoiceCoreComponent(): typeof RadioCore | typeof CheckboxCore;
59
- getLabel(): React.ReactNode;
57
+ getLabel(id: string): React.ReactNode;
60
58
  getDescription(id?: string): React.ReactNode;
61
59
  render(): React.ReactNode;
62
60
  }
@@ -14,7 +14,7 @@ declare type Props = {|
14
14
  /**
15
15
  * Whether this choice is checked.
16
16
  */
17
- checked: boolean,
17
+ checked: boolean | null | void,
18
18
 
19
19
  /**
20
20
  * Whether this choice option is disabled.
@@ -74,7 +74,6 @@ declare type Props = {|
74
74
  |},
75
75
  |};
76
76
  declare type DefaultProps = {|
77
- checked: $PropertyType<Props, "checked">,
78
77
  disabled: $PropertyType<Props, "disabled">,
79
78
  error: $PropertyType<Props, "error">,
80
79
  |};
@@ -88,10 +87,9 @@ declare type DefaultProps = {|
88
87
  */
89
88
  declare export default class ChoiceInternal extends React.Component<Props> {
90
89
  static defaultProps: DefaultProps;
91
- handleLabelClick: (event: SyntheticEvent<>) => void;
92
90
  handleClick: () => void;
93
91
  getChoiceCoreComponent(): typeof RadioCore | typeof CheckboxCore;
94
- getLabel(): React.Node;
92
+ getLabel(id: string): React.Node;
95
93
  getDescription(id?: string): React.Node;
96
94
  render(): React.Node;
97
95
  }
@@ -1,15 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { ChoiceCoreProps } from "../util/types";
3
- type Props = ChoiceCoreProps & {
4
- hovered: boolean;
5
- focused: boolean;
6
- pressed: boolean;
7
- waiting: boolean;
8
- };
9
3
  /**
10
4
  * The internal stateless 🔘 Radio button
11
- */ export default class RadioCore extends React.Component<Props> {
5
+ */ export default class RadioCore extends React.Component<ChoiceCoreProps> {
12
6
  handleChange: () => void;
13
7
  render(): React.ReactNode;
14
8
  }
15
- export {};
@@ -6,19 +6,13 @@
6
6
  */
7
7
  import * as React from "react";
8
8
  import type { ChoiceCoreProps } from "../util/types";
9
- declare type Props = {|
10
- ...ChoiceCoreProps,
11
- ...{|
12
- hovered: boolean,
13
- focused: boolean,
14
- pressed: boolean,
15
- waiting: boolean,
16
- |},
17
- |};
9
+
18
10
  /**
19
11
  * The internal stateless 🔘 Radio button
20
12
  */
21
- declare export default class RadioCore extends React.Component<Props> {
13
+ declare export default class RadioCore
14
+ extends React.Component<ChoiceCoreProps>
15
+ {
22
16
  handleChange: () => void;
23
17
  render(): React.Node;
24
18
  }
package/dist/es/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
- import { StyleSheet, css } from 'aphrodite';
2
+ import { StyleSheet } from 'aphrodite';
3
3
  import Color, { mix, fade } from '@khanacademy/wonder-blocks-color';
4
4
  import { addStyle, UniqueIDProvider, View, IDProvider } from '@khanacademy/wonder-blocks-core';
5
- import { getClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
6
5
  import { Strut } from '@khanacademy/wonder-blocks-layout';
7
6
  import Spacing from '@khanacademy/wonder-blocks-spacing';
8
7
  import { LabelMedium, LabelSmall, styles as styles$6 } from '@khanacademy/wonder-blocks-typography';
@@ -36,7 +35,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
36
35
  return target;
37
36
  }
38
37
 
39
- const _excluded$4 = ["checked", "disabled", "error", "groupName", "id", "testId", "hovered", "focused", "pressed", "waiting"];
38
+ const _excluded$4 = ["checked", "disabled", "error", "groupName", "id", "testId"];
39
+ function mapCheckedToAriaChecked(value) {
40
+ switch (value) {
41
+ case true:
42
+ return "true";
43
+ case false:
44
+ return "false";
45
+ default:
46
+ return "mixed";
47
+ }
48
+ }
40
49
  const {
41
50
  blue: blue$1,
42
51
  red: red$1,
@@ -46,17 +55,31 @@ const {
46
55
  offBlack32: offBlack32$1,
47
56
  offBlack50: offBlack50$1
48
57
  } = Color;
49
- const StyledInput$1 = addStyle("input");
50
- const checkboxCheck = {
58
+ const StyledInput$2 = addStyle("input");
59
+ const checkPath = {
51
60
  small: "M11.263 4.324a1 1 0 1 1 1.474 1.352l-5.5 6a1 1 0 0 1-1.505-.036l-2.5-3a1 1 0 1 1 1.536-1.28L6.536 9.48l4.727-5.157z"
52
61
  };
62
+ const indeterminatePath = {
63
+ small: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z"
64
+ };
53
65
  class CheckboxCore extends React.Component {
54
66
  constructor(...args) {
55
67
  super(...args);
68
+ this.inputRef = React.createRef();
56
69
  this.handleChange = () => {
57
70
  return;
58
71
  };
59
72
  }
73
+ componentDidMount() {
74
+ if (this.props.checked == null && this.inputRef.current != null) {
75
+ this.inputRef.current.indeterminate = true;
76
+ }
77
+ }
78
+ componentDidUpdate(prevProps) {
79
+ if (this.inputRef.current != null) {
80
+ this.inputRef.current.indeterminate = this.props.checked == null;
81
+ }
82
+ }
60
83
  render() {
61
84
  const _this$props = this.props,
62
85
  {
@@ -65,32 +88,33 @@ class CheckboxCore extends React.Component {
65
88
  error,
66
89
  groupName,
67
90
  id,
68
- testId,
69
- hovered,
70
- focused,
71
- pressed
91
+ testId
72
92
  } = _this$props,
73
93
  sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$4);
74
94
  const stateStyles = _generateStyles$1(checked, error);
75
- const defaultStyle = [sharedStyles$1.inputReset, sharedStyles$1.default, stateStyles.default, !disabled && (pressed ? stateStyles.active : (hovered || focused) && stateStyles.focus), disabled && sharedStyles$1.disabled];
95
+ const defaultStyle = [sharedStyles$1.inputReset, sharedStyles$1.default, !disabled && stateStyles.default, disabled && sharedStyles$1.disabled];
76
96
  const props = {
77
97
  "data-test-id": testId
78
98
  };
79
- return React.createElement(React.Fragment, null, React.createElement(StyledInput$1, _extends({}, sharedProps, {
99
+ const checkboxIcon = React.createElement(Icon, {
100
+ color: disabled ? offBlack32$1 : white$1,
101
+ icon: checked ? checkPath : indeterminatePath,
102
+ size: "small",
103
+ style: sharedStyles$1.checkboxIcon
104
+ });
105
+ const ariaChecked = mapCheckedToAriaChecked(checked);
106
+ return React.createElement(React.Fragment, null, React.createElement(StyledInput$2, _extends({}, sharedProps, {
107
+ ref: this.inputRef,
80
108
  type: "checkbox",
109
+ "aria-checked": ariaChecked,
81
110
  "aria-invalid": error,
82
- checked: checked,
111
+ checked: checked != null ? checked : undefined,
83
112
  disabled: disabled,
84
113
  id: id,
85
114
  name: groupName,
86
115
  onChange: this.handleChange,
87
116
  style: defaultStyle
88
- }, props)), checked && React.createElement(Icon, {
89
- color: disabled ? offBlack32$1 : white$1,
90
- icon: checkboxCheck,
91
- size: "small",
92
- style: sharedStyles$1.checkIcon
93
- }));
117
+ }, props)), checked || checked == null ? checkboxIcon : React.createElement(React.Fragment, null));
94
118
  }
95
119
  }
96
120
  const size$1 = 16;
@@ -118,7 +142,7 @@ const sharedStyles$1 = StyleSheet.create({
118
142
  borderColor: offBlack16$1,
119
143
  borderWidth: 1
120
144
  },
121
- checkIcon: {
145
+ checkboxIcon: {
122
146
  position: "absolute",
123
147
  pointerEvents: "none"
124
148
  }
@@ -147,35 +171,43 @@ const _generateStyles$1 = (checked, error) => {
147
171
  }
148
172
  const palette = error ? colors$1.error : colors$1.default;
149
173
  let newStyles = {};
150
- if (checked) {
174
+ if (checked || checked == null) {
151
175
  newStyles = {
152
176
  default: {
153
177
  backgroundColor: palette.base,
154
- borderWidth: 0
155
- },
156
- focus: {
157
- boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.base}`
158
- },
159
- active: {
160
- boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.active}`,
161
- background: palette.active
178
+ borderWidth: 0,
179
+ ":focus-visible": {
180
+ boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.base}`
181
+ },
182
+ ":hover": {
183
+ boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.base}`
184
+ },
185
+ ":active": {
186
+ boxShadow: `0 0 0 1px ${white$1}, 0 0 0 3px ${palette.active}`,
187
+ background: palette.active
188
+ }
162
189
  }
163
190
  };
164
191
  } else {
165
192
  newStyles = {
166
193
  default: {
167
194
  backgroundColor: error ? fadedRed$1 : white$1,
168
- borderColor: error ? red$1 : offBlack50$1
169
- },
170
- focus: {
171
- backgroundColor: error ? fadedRed$1 : white$1,
172
- borderColor: palette.base,
173
- borderWidth: 2
174
- },
175
- active: {
176
- backgroundColor: palette.faded,
177
- borderColor: error ? activeRed$1 : blue$1,
178
- borderWidth: 2
195
+ borderColor: error ? red$1 : offBlack50$1,
196
+ ":focus-visible": {
197
+ backgroundColor: error ? fadedRed$1 : white$1,
198
+ borderColor: palette.base,
199
+ borderWidth: 2
200
+ },
201
+ ":hover": {
202
+ backgroundColor: error ? fadedRed$1 : white$1,
203
+ borderColor: palette.base,
204
+ borderWidth: 2
205
+ },
206
+ ":active": {
207
+ backgroundColor: palette.faded,
208
+ borderColor: error ? activeRed$1 : blue$1,
209
+ borderWidth: 2
210
+ }
179
211
  }
180
212
  };
181
213
  }
@@ -183,7 +215,7 @@ const _generateStyles$1 = (checked, error) => {
183
215
  return styles$5[styleKey];
184
216
  };
185
217
 
186
- const _excluded$3 = ["checked", "disabled", "error", "groupName", "id", "testId", "hovered", "focused", "pressed", "waiting"];
218
+ const _excluded$3 = ["checked", "disabled", "error", "groupName", "id", "testId"];
187
219
  const {
188
220
  blue,
189
221
  red,
@@ -193,7 +225,7 @@ const {
193
225
  offBlack32,
194
226
  offBlack50
195
227
  } = Color;
196
- const StyledInput = addStyle("input");
228
+ const StyledInput$1 = addStyle("input");
197
229
  class RadioCore extends React.Component {
198
230
  constructor(...args) {
199
231
  super(...args);
@@ -209,21 +241,18 @@ class RadioCore extends React.Component {
209
241
  error,
210
242
  groupName,
211
243
  id,
212
- testId,
213
- hovered,
214
- focused,
215
- pressed
244
+ testId
216
245
  } = _this$props,
217
246
  sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
218
247
  const stateStyles = _generateStyles(checked, error);
219
- const defaultStyle = [sharedStyles.inputReset, sharedStyles.default, stateStyles.default, !disabled && (pressed ? stateStyles.active : (hovered || focused) && stateStyles.focus), disabled && sharedStyles.disabled];
248
+ const defaultStyle = [sharedStyles.inputReset, sharedStyles.default, !disabled && stateStyles.default, disabled && sharedStyles.disabled];
220
249
  const props = {
221
250
  "data-test-id": testId
222
251
  };
223
- return React.createElement(React.Fragment, null, React.createElement(StyledInput, _extends({}, sharedProps, {
252
+ return React.createElement(React.Fragment, null, React.createElement(StyledInput$1, _extends({}, sharedProps, {
224
253
  type: "radio",
225
254
  "aria-invalid": error,
226
- checked: checked,
255
+ checked: checked != null ? checked : undefined,
227
256
  disabled: disabled,
228
257
  id: id,
229
258
  name: groupName,
@@ -298,31 +327,39 @@ const _generateStyles = (checked, error) => {
298
327
  default: {
299
328
  backgroundColor: white,
300
329
  borderColor: palette.base,
301
- borderWidth: size / 4
302
- },
303
- focus: {
304
- boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.base}`
305
- },
306
- active: {
307
- boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.active}`,
308
- borderColor: palette.active
330
+ borderWidth: size / 4,
331
+ ":focus-visible": {
332
+ boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.base}`
333
+ },
334
+ ":hover": {
335
+ boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.base}`
336
+ },
337
+ ":active": {
338
+ boxShadow: `0 0 0 1px ${white}, 0 0 0 3px ${palette.active}`,
339
+ borderColor: palette.active
340
+ }
309
341
  }
310
342
  };
311
343
  } else {
312
344
  newStyles = {
313
345
  default: {
314
346
  backgroundColor: error ? fadedRed : white,
315
- borderColor: error ? red : offBlack50
316
- },
317
- focus: {
318
- backgroundColor: error ? fadedRed : white,
319
- borderColor: palette.base,
320
- borderWidth: 2
321
- },
322
- active: {
323
- backgroundColor: palette.faded,
324
- borderColor: error ? activeRed : blue,
325
- borderWidth: 2
347
+ borderColor: error ? red : offBlack50,
348
+ ":focus-visible": {
349
+ backgroundColor: error ? fadedRed : white,
350
+ borderColor: palette.base,
351
+ borderWidth: 2
352
+ },
353
+ ":hover": {
354
+ backgroundColor: error ? fadedRed : white,
355
+ borderColor: palette.base,
356
+ borderWidth: 2
357
+ },
358
+ ":active": {
359
+ backgroundColor: palette.faded,
360
+ borderColor: error ? activeRed : blue,
361
+ borderWidth: 2
362
+ }
326
363
  }
327
364
  };
328
365
  }
@@ -330,13 +367,10 @@ const _generateStyles = (checked, error) => {
330
367
  return styles$4[styleKey];
331
368
  };
332
369
 
333
- const _excluded$2 = ["label", "description", "onChange", "style", "className", "variant"];
370
+ const _excluded$2 = ["label", "description", "id", "onChange", "style", "className", "variant"];
334
371
  class ChoiceInternal extends React.Component {
335
372
  constructor(...args) {
336
373
  super(...args);
337
- this.handleLabelClick = event => {
338
- event.preventDefault();
339
- };
340
374
  this.handleClick = () => {
341
375
  const {
342
376
  checked,
@@ -356,17 +390,15 @@ class ChoiceInternal extends React.Component {
356
390
  return CheckboxCore;
357
391
  }
358
392
  }
359
- getLabel() {
393
+ getLabel(id) {
360
394
  const {
361
395
  disabled,
362
- id,
363
396
  label
364
397
  } = this.props;
365
398
  return React.createElement(LabelMedium, {
366
399
  style: [styles$3.label, disabled && styles$3.disabledLabel]
367
400
  }, React.createElement("label", {
368
- htmlFor: id,
369
- onClick: this.handleLabelClick
401
+ htmlFor: id
370
402
  }, label));
371
403
  }
372
404
  getDescription(id) {
@@ -383,41 +415,35 @@ class ChoiceInternal extends React.Component {
383
415
  {
384
416
  label,
385
417
  description,
418
+ id,
386
419
  style,
387
- className,
388
- variant
420
+ className
389
421
  } = _this$props,
390
422
  coreProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
391
423
  const ChoiceCore = this.getChoiceCoreComponent();
392
- const ClickableBehavior = getClickableBehavior();
393
424
  return React.createElement(UniqueIDProvider, {
394
425
  mockOnFirstRender: true,
395
426
  scope: "choice"
396
427
  }, ids => {
428
+ const uniqueId = id || ids.get("main");
397
429
  const descriptionId = description ? ids.get("description") : undefined;
398
430
  return React.createElement(View, {
399
431
  style: style,
400
432
  className: className
401
- }, React.createElement(ClickableBehavior, {
402
- disabled: coreProps.disabled,
403
- onClick: this.handleClick,
404
- role: variant
405
- }, (state, childrenProps) => {
406
- return React.createElement(View, _extends({
407
- style: styles$3.wrapper
408
- }, childrenProps, {
409
- tabIndex: -1
410
- }), React.createElement(ChoiceCore, _extends({}, coreProps, state, {
411
- "aria-describedby": descriptionId
412
- })), React.createElement(Strut, {
413
- size: Spacing.xSmall_8
414
- }), label && this.getLabel());
415
- }), description && this.getDescription(descriptionId));
433
+ }, React.createElement(View, {
434
+ style: styles$3.wrapper,
435
+ tabIndex: -1
436
+ }, React.createElement(ChoiceCore, _extends({}, coreProps, {
437
+ id: uniqueId,
438
+ "aria-describedby": descriptionId,
439
+ onClick: this.handleClick
440
+ })), React.createElement(Strut, {
441
+ size: Spacing.xSmall_8
442
+ }), label && this.getLabel(uniqueId)), description && this.getDescription(descriptionId));
416
443
  });
417
444
  }
418
445
  }
419
446
  ChoiceInternal.defaultProps = {
420
- checked: false,
421
447
  disabled: false,
422
448
  error: false
423
449
  };
@@ -428,7 +454,6 @@ const styles$3 = StyleSheet.create({
428
454
  outline: "none"
429
455
  },
430
456
  label: {
431
- userSelect: "none",
432
457
  marginTop: -2
433
458
  },
434
459
  disabledLabel: {
@@ -626,6 +651,7 @@ class RadioGroup extends React.Component {
626
651
 
627
652
  const _excluded = ["id", "type", "value", "disabled", "onKeyDown", "placeholder", "light", "style", "testId", "readOnly", "autoComplete", "forwardedRef", "onFocus", "onBlur", "onValidate", "validate", "onChange", "required"];
628
653
  const defaultErrorMessage = "This field is required.";
654
+ const StyledInput = addStyle("input");
629
655
  class TextField extends React.Component {
630
656
  constructor(props) {
631
657
  super(props);
@@ -718,8 +744,8 @@ class TextField extends React.Component {
718
744
  forwardedRef
719
745
  } = _this$props,
720
746
  otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
721
- return React.createElement("input", _extends({
722
- className: css([styles$1.input, styles$6.LabelMedium, styles$1.default, disabled ? styles$1.disabled : this.state.focused ? [styles$1.focused, light && styles$1.defaultLight] : this.state.error && [styles$1.error, light && styles$1.errorLight], style && style]),
747
+ return React.createElement(StyledInput, _extends({
748
+ style: [styles$1.input, styles$6.LabelMedium, styles$1.default, disabled ? styles$1.disabled : this.state.focused ? [styles$1.focused, light && styles$1.defaultLight] : !!this.state.error && [styles$1.error, light && styles$1.errorLight], !!this.state.error && styles$1.error, style && style],
723
749
  id: id,
724
750
  type: type,
725
751
  placeholder: placeholder,