@react-ui-org/react-ui 0.65.0 → 0.66.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.
Files changed (67) hide show
  1. package/dist/react-ui.css +10 -10
  2. package/dist/react-ui.d.ts +35 -27
  3. package/dist/react-ui.development.css +732 -145
  4. package/dist/react-ui.development.js +34 -34
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +2 -2
  7. package/src/components/Button/helpers/getRootLabelVisibilityClassName.ts +1 -1
  8. package/src/components/CheckboxField/CheckboxField.module.scss +7 -3
  9. package/src/components/CheckboxField/CheckboxField.tsx +3 -3
  10. package/src/components/CheckboxField/CheckboxField.types.ts +4 -3
  11. package/src/components/CheckboxField/README.md +25 -3
  12. package/src/components/FileInputField/FileInputField.module.scss +7 -3
  13. package/src/components/FileInputField/FileInputField.tsx +3 -3
  14. package/src/components/FileInputField/FileInputField.types.ts +4 -3
  15. package/src/components/FileInputField/README.md +20 -3
  16. package/src/components/FormLayout/FormLayout.module.scss +4 -6
  17. package/src/components/FormLayout/FormLayoutCustomField.module.scss +7 -3
  18. package/src/components/FormLayout/FormLayoutCustomField.tsx +3 -3
  19. package/src/components/FormLayout/FormLayoutCustomField.types.ts +4 -3
  20. package/src/components/FormLayout/README.md +2 -9
  21. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +1 -0
  22. package/src/components/InputGroup/InputGroup.module.scss +7 -3
  23. package/src/components/InputGroup/InputGroup.tsx +8 -14
  24. package/src/components/InputGroup/README.md +35 -7
  25. package/src/components/Modal/_helpers/getPositionClassName.ts +1 -1
  26. package/src/components/Modal/_helpers/getScrollingClassName.ts +1 -1
  27. package/src/components/Radio/README.md +40 -3
  28. package/src/components/Radio/Radio.module.scss +7 -3
  29. package/src/components/Radio/Radio.tsx +3 -3
  30. package/src/components/Radio/Radio.types.ts +4 -3
  31. package/src/components/SelectField/README.md +53 -6
  32. package/src/components/SelectField/SelectField.module.scss +7 -3
  33. package/src/components/SelectField/SelectField.tsx +3 -3
  34. package/src/components/SelectField/SelectField.types.ts +4 -3
  35. package/src/components/Text/_helpers/getRootClampClassName.ts +1 -1
  36. package/src/components/Text/_helpers/getRootHyphensClassName.ts +1 -1
  37. package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +1 -1
  38. package/src/components/TextArea/README.md +30 -6
  39. package/src/components/TextArea/TextArea.module.scss +7 -3
  40. package/src/components/TextArea/TextArea.tsx +3 -3
  41. package/src/components/TextArea/TextArea.types.ts +4 -3
  42. package/src/components/TextField/README.md +30 -6
  43. package/src/components/TextField/TextField.module.scss +7 -3
  44. package/src/components/TextField/TextField.tsx +3 -3
  45. package/src/components/TextField/TextField.types.ts +6 -5
  46. package/src/components/TextLink/README.md +1 -1
  47. package/src/components/Toggle/README.md +25 -3
  48. package/src/components/Toggle/Toggle.module.scss +7 -3
  49. package/src/components/Toggle/Toggle.tsx +3 -3
  50. package/src/components/Toggle/Toggle.types.ts +4 -3
  51. package/src/components/_helpers/getRootColorClassName.ts +1 -1
  52. package/src/components/_helpers/getRootPriorityClassName.ts +1 -1
  53. package/src/components/_helpers/getRootSizeClassName.ts +1 -1
  54. package/src/components/_helpers/getRootStateClassName.ts +24 -0
  55. package/src/index.ts +1 -1
  56. package/src/styles/settings/_form-fields.scss +2 -1
  57. package/src/styles/theme/_form-fields.scss +16 -11
  58. package/src/styles/theme-constants/_colors.scss +21 -0
  59. package/src/styles/tools/form-fields/_box-field-layout.scss +5 -8
  60. package/src/styles/tools/form-fields/_inline-field-elements.scss +0 -7
  61. package/src/styles/tools/form-fields/_inline-field-layout.scss +0 -8
  62. package/src/styles/tools/form-fields/_variants.scss +7 -7
  63. package/src/theme.scss +37 -12
  64. package/src/types/index.ts +1 -1
  65. package/src/types/states.ts +1 -0
  66. package/src/components/_helpers/getRootValidationStateClassName.ts +0 -20
  67. package/src/types/validationStates.ts +0 -1
@@ -210,7 +210,7 @@ have.
210
210
  onChange={(e) => setFruit(e.target.value)}
211
211
  options={options}
212
212
  required
213
- validationState="valid"
213
+ state="valid"
214
214
  validationText="Great, they're in stock!"
215
215
  value={fruit}
216
216
  />
@@ -219,7 +219,7 @@ have.
219
219
  onChange={(e) => setFruit(e.target.value)}
220
220
  options={options}
221
221
  required
222
- validationState="warning"
222
+ state="warning"
223
223
  validationText="Oh, really?"
224
224
  value={fruit}
225
225
  />
@@ -228,7 +228,7 @@ have.
228
228
  onChange={(e) => setFruit(e.target.value)}
229
229
  options={options}
230
230
  required
231
- validationState="invalid"
231
+ state="invalid"
232
232
  validationText="You must select one kind of fruit."
233
233
  value={fruit}
234
234
  />
@@ -237,6 +237,43 @@ have.
237
237
  })
238
238
  ```
239
239
 
240
+ ### Changed State
241
+
242
+ Changed state highlights fields whose value differs from the saved one, so users
243
+ can review their edits before saving.
244
+
245
+ A field shows one state at a time. When a changed value is also invalid, it's
246
+ up to you to pick the state that matters more to the user.
247
+
248
+ ```docoff-react-preview
249
+ React.createElement(() => {
250
+ const [fruit, setFruit] = React.useState('banana');
251
+ const options = [
252
+ {
253
+ label: 'Apple',
254
+ value: 'apple',
255
+ },
256
+ {
257
+ label: 'Banana',
258
+ value: 'banana',
259
+ },
260
+ {
261
+ label: 'Grapefruit',
262
+ value: 'grapefruit',
263
+ },
264
+ ];
265
+ return (
266
+ <Radio
267
+ label="Your favourite fruit"
268
+ onChange={(e) => setFruit(e.target.value)}
269
+ options={options}
270
+ state="changed"
271
+ value={fruit}
272
+ />
273
+ );
274
+ })
275
+ ```
276
+
240
277
  ### Required State
241
278
 
242
279
  The required state indicates that the input is mandatory.
@@ -57,16 +57,20 @@
57
57
  }
58
58
 
59
59
  // States
60
+ .isRootStateChanged {
61
+ @include variants.state(changed);
62
+ }
63
+
60
64
  .isRootStateInvalid {
61
- @include variants.validation(invalid);
65
+ @include variants.state(invalid);
62
66
  }
63
67
 
64
68
  .isRootStateValid {
65
- @include variants.validation(valid);
69
+ @include variants.state(valid);
66
70
  }
67
71
 
68
72
  .isRootStateWarning {
69
- @include variants.validation(warning);
73
+ @include variants.state(warning);
70
74
  }
71
75
 
72
76
  // Layouts
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
2
2
  import { withGlobalProps } from '../../providers/globalProps';
3
3
  import { classNames } from '../../helpers/classNames/classNames';
4
4
  import { transferProps } from '../../helpers/transferProps';
5
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
5
+ import { getRootStateClassName } from '../_helpers/getRootStateClassName';
6
6
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
7
7
  import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
8
8
  import styles from './Radio.module.scss';
@@ -18,7 +18,7 @@ export const Radio: React.FunctionComponent<RadioProps> = ({
18
18
  options,
19
19
  renderAsRequired = false,
20
20
  required = false,
21
- validationState,
21
+ state,
22
22
  validationText,
23
23
  value,
24
24
  ...restProps
@@ -35,7 +35,7 @@ export const Radio: React.FunctionComponent<RadioProps> = ({
35
35
  : styles.isRootLayoutVertical,
36
36
  disabled && styles.isRootDisabled,
37
37
  (renderAsRequired || required) && styles.isRootRequired,
38
- getRootValidationStateClassName(styles, validationState),
38
+ getRootStateClassName(styles, state),
39
39
  )}
40
40
  disabled={disabled}
41
41
  id={id}
@@ -4,7 +4,7 @@ import type {
4
4
  } from 'react';
5
5
  import type {
6
6
  Layout,
7
- ValidationState,
7
+ State,
8
8
  } from '../../types';
9
9
 
10
10
  export type RadioOption = {
@@ -76,9 +76,10 @@ export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'v
76
76
  */
77
77
  required?: boolean;
78
78
  /**
79
- * Alter the field to provide feedback based on validation result.
79
+ * Alter the field to reflect the state of its data, e.g. a validation result or a change
80
+ * against the saved value.
80
81
  */
81
- validationState?: ValidationState;
82
+ state?: State;
82
83
  /**
83
84
  * Validation message to be displayed.
84
85
  */
@@ -534,7 +534,7 @@ React.createElement(() => {
534
534
  onChange={(e) => setFruit(e.target.value)}
535
535
  options={options}
536
536
  required
537
- validationState="valid"
537
+ state="valid"
538
538
  validationText="Great, they're in stock!"
539
539
  value={fruit}
540
540
  />
@@ -543,7 +543,7 @@ React.createElement(() => {
543
543
  onChange={(e) => setFruit(e.target.value)}
544
544
  options={options}
545
545
  required
546
- validationState="warning"
546
+ state="warning"
547
547
  validationText="Oh, really?"
548
548
  value={fruit}
549
549
  />
@@ -552,7 +552,7 @@ React.createElement(() => {
552
552
  onChange={(e) => setFruit(e.target.value)}
553
553
  options={options}
554
554
  required
555
- validationState="invalid"
555
+ state="invalid"
556
556
  validationText="You must select at least one kind of fruit."
557
557
  value={fruit}
558
558
  />
@@ -561,7 +561,7 @@ React.createElement(() => {
561
561
  onChange={(e) => setFruit(e.target.value)}
562
562
  options={options}
563
563
  required
564
- validationState="valid"
564
+ state="valid"
565
565
  validationText="Great, they're in stock!"
566
566
  value={fruit}
567
567
  variant="filled"
@@ -571,7 +571,7 @@ React.createElement(() => {
571
571
  onChange={(e) => setFruit(e.target.value)}
572
572
  options={options}
573
573
  required
574
- validationState="warning"
574
+ state="warning"
575
575
  validationText="Oh, really?"
576
576
  value={fruit}
577
577
  variant="filled"
@@ -582,7 +582,7 @@ React.createElement(() => {
582
582
  options={options}
583
583
  required
584
584
  value={fruit}
585
- validationState="invalid"
585
+ state="invalid"
586
586
  validationText="You must select at least one kind of fruit."
587
587
  variant="filled"
588
588
  />
@@ -591,6 +591,53 @@ React.createElement(() => {
591
591
  })
592
592
  ```
593
593
 
594
+ ### Changed State
595
+
596
+ Changed state highlights fields whose value differs from the saved one, so users
597
+ can review their edits before saving.
598
+
599
+ A field shows one state at a time. When a changed value is also invalid, it's
600
+ up to you to pick the state that matters more to the user.
601
+
602
+ ```docoff-react-preview
603
+ React.createElement(() => {
604
+ const [fruit, setFruit] = React.useState('banana');
605
+ const options = [
606
+ {
607
+ label: 'Apple',
608
+ value: 'apple',
609
+ },
610
+ {
611
+ label: 'Banana',
612
+ value: 'banana',
613
+ },
614
+ {
615
+ label: 'Grapefruit',
616
+ value: 'grapefruit',
617
+ },
618
+ ];
619
+ return (
620
+ <>
621
+ <SelectField
622
+ label="Your favourite fruit"
623
+ onChange={(e) => setFruit(e.target.value)}
624
+ options={options}
625
+ state="changed"
626
+ value={fruit}
627
+ />
628
+ <SelectField
629
+ label="Your favourite fruit"
630
+ onChange={(e) => setFruit(e.target.value)}
631
+ options={options}
632
+ state="changed"
633
+ value={fruit}
634
+ variant="filled"
635
+ />
636
+ </>
637
+ );
638
+ })
639
+ ```
640
+
594
641
  ### Required State
595
642
 
596
643
  The required state indicates that the input is mandatory.
@@ -56,16 +56,20 @@
56
56
  }
57
57
 
58
58
  // States
59
+ .isRootStateChanged {
60
+ @include variants.state(changed);
61
+ }
62
+
59
63
  .isRootStateInvalid {
60
- @include variants.validation(invalid);
64
+ @include variants.state(invalid);
61
65
  }
62
66
 
63
67
  .isRootStateValid {
64
- @include variants.validation(valid);
68
+ @include variants.state(valid);
65
69
  }
66
70
 
67
71
  .isRootStateWarning {
68
- @include variants.validation(warning);
72
+ @include variants.state(warning);
69
73
  }
70
74
 
71
75
  // Invisible label
@@ -3,7 +3,7 @@ import { withGlobalProps } from '../../providers/globalProps';
3
3
  import { classNames } from '../../helpers/classNames/classNames';
4
4
  import { transferProps } from '../../helpers/transferProps';
5
5
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
6
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
+ import { getRootStateClassName } from '../_helpers/getRootStateClassName';
7
7
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
8
  import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
9
9
  import { FormLayoutCustomFieldContext } from '../FormLayout/FormLayoutCustomFieldContext';
@@ -28,7 +28,7 @@ export const SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>
28
28
  renderAsRequired = false,
29
29
  required = false,
30
30
  size = 'medium',
31
- validationState,
31
+ state,
32
32
  validationText,
33
33
  variant = 'outline',
34
34
  ...restProps
@@ -53,7 +53,7 @@ export const SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>
53
53
  styles,
54
54
  resolveContextOrProp(inputGroupContext && inputGroupContext.size, size),
55
55
  ),
56
- getRootValidationStateClassName(styles, validationState),
56
+ getRootStateClassName(styles, state),
57
57
  variant === 'filled' ? styles.isRootVariantFilled : styles.isRootVariantOutline,
58
58
  )}
59
59
  htmlFor={id}
@@ -5,7 +5,7 @@ import type {
5
5
  import type {
6
6
  Layout,
7
7
  Size,
8
- ValidationState,
8
+ State,
9
9
  } from '../../types';
10
10
 
11
11
  export type SelectFieldOption = {
@@ -103,9 +103,10 @@ export type SelectFieldProps = Omit<SelectHTMLAttributes<HTMLSelectElement>, 'si
103
103
  */
104
104
  size?: Size;
105
105
  /**
106
- * Alter the field to provide feedback based on validation result.
106
+ * Alter the field to reflect the state of its data, e.g. a validation result or a change
107
+ * against the saved value.
107
108
  */
108
- validationState?: ValidationState;
109
+ state?: State;
109
110
  /**
110
111
  * Validation message to be displayed.
111
112
  *
@@ -9,5 +9,5 @@ export const getRootClampClassName = (styles: CssModuleClasses, lines?: number)
9
9
  return styles.isRootClampMultiLine;
10
10
  }
11
11
 
12
- return null;
12
+ return undefined;
13
13
  };
@@ -10,5 +10,5 @@ export const getRootHyphensClassName = (styles: CssModuleClasses, hyphens?: Text
10
10
  return styles.isRootHyphensManual;
11
11
  }
12
12
 
13
- return null;
13
+ return undefined;
14
14
  };
@@ -10,5 +10,5 @@ export const getRootWordWrappingClassName = (styles: CssModuleClasses, wordWrapp
10
10
  return styles.isRootWordWrappingLongWords;
11
11
  }
12
12
 
13
- return null;
13
+ return undefined;
14
14
  };
@@ -252,7 +252,7 @@ what happened and what action they should take or what options they have.
252
252
  <TextArea
253
253
  label="Your feedback"
254
254
  onChange={() => {}}
255
- validationState="valid"
255
+ state="valid"
256
256
  validationText="Looks good!"
257
257
  value="Like that!"
258
258
  required
@@ -260,21 +260,21 @@ what happened and what action they should take or what options they have.
260
260
  <TextArea
261
261
  label="Your feedback"
262
262
  onChange={() => {}}
263
- validationState="warning"
263
+ state="warning"
264
264
  validationText="The feedback should be at least 3 characters long."
265
265
  value=".."
266
266
  required
267
267
  />
268
268
  <TextArea
269
269
  label="Your feedback"
270
- validationState="invalid"
270
+ state="invalid"
271
271
  validationText="Please share your feedback with us."
272
272
  required
273
273
  />
274
274
  <TextArea
275
275
  label="Your feedback"
276
276
  onChange={() => {}}
277
- validationState="valid"
277
+ state="valid"
278
278
  validationText="Looks good!"
279
279
  variant="filled"
280
280
  value="Like that!"
@@ -283,7 +283,7 @@ what happened and what action they should take or what options they have.
283
283
  <TextArea
284
284
  label="Your feedback"
285
285
  onChange={() => {}}
286
- validationState="warning"
286
+ state="warning"
287
287
  validationText="The feedback should be at least 3 characters long."
288
288
  variant="filled"
289
289
  value=".."
@@ -291,13 +291,37 @@ what happened and what action they should take or what options they have.
291
291
  />
292
292
  <TextArea
293
293
  label="Your feedback"
294
- validationState="invalid"
294
+ state="invalid"
295
295
  validationText="Please share your feedback with us."
296
296
  variant="filled"
297
297
  required
298
298
  />
299
299
  ```
300
300
 
301
+ ### Changed State
302
+
303
+ Changed state highlights fields whose value differs from the saved one, so users
304
+ can review their edits before saving.
305
+
306
+ A field shows one state at a time. When a changed value is also invalid, it's
307
+ up to you to pick the state that matters more to the user.
308
+
309
+ ```docoff-react-preview
310
+ <TextArea
311
+ label="Your feedback"
312
+ onChange={() => {}}
313
+ state="changed"
314
+ value="Like that!"
315
+ />
316
+ <TextArea
317
+ label="Your feedback"
318
+ onChange={() => {}}
319
+ state="changed"
320
+ variant="filled"
321
+ value="Like that!"
322
+ />
323
+ ```
324
+
301
325
  ### Disabled State
302
326
 
303
327
  It's possible to disable the whole input.
@@ -47,16 +47,20 @@
47
47
  }
48
48
 
49
49
  // States
50
+ .isRootStateChanged {
51
+ @include variants.state(changed);
52
+ }
53
+
50
54
  .isRootStateInvalid {
51
- @include variants.validation(invalid);
55
+ @include variants.state(invalid);
52
56
  }
53
57
 
54
58
  .isRootStateValid {
55
- @include variants.validation(valid);
59
+ @include variants.state(valid);
56
60
  }
57
61
 
58
62
  .isRootStateWarning {
59
- @include variants.validation(warning);
63
+ @include variants.state(warning);
60
64
  }
61
65
 
62
66
  // Invisible label
@@ -3,7 +3,7 @@ import { withGlobalProps } from '../../providers/globalProps';
3
3
  import { classNames } from '../../helpers/classNames/classNames';
4
4
  import { transferProps } from '../../helpers/transferProps';
5
5
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
6
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
+ import { getRootStateClassName } from '../_helpers/getRootStateClassName';
7
7
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
8
  import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
9
9
  import { FormLayoutCustomFieldContext } from '../FormLayout/FormLayoutCustomFieldContext';
@@ -20,7 +20,7 @@ export const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(({
20
20
  layout = 'vertical',
21
21
  required = false,
22
22
  size = 'medium',
23
- validationState,
23
+ state,
24
24
  validationText,
25
25
  variant = 'outline',
26
26
  ...restProps
@@ -40,7 +40,7 @@ export const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(({
40
40
  disabled && styles.isRootDisabled,
41
41
  required && styles.isRootRequired,
42
42
  getRootSizeClassName(styles, size),
43
- getRootValidationStateClassName(styles, validationState),
43
+ getRootStateClassName(styles, state),
44
44
  variant === 'filled' ? styles.isRootVariantFilled : styles.isRootVariantOutline,
45
45
  )}
46
46
  htmlFor={id}
@@ -5,7 +5,7 @@ import type {
5
5
  import type {
6
6
  Layout,
7
7
  Size,
8
- ValidationState,
8
+ State,
9
9
  } from '../../types';
10
10
 
11
11
  export type TextAreaVariant = 'filled' | 'outline';
@@ -61,9 +61,10 @@ export type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
61
61
  */
62
62
  size?: Size;
63
63
  /**
64
- * Alter the field to provide feedback based on validation result.
64
+ * Alter the field to reflect the state of its data, e.g. a validation result or a change
65
+ * against the saved value.
65
66
  */
66
- validationState?: ValidationState;
67
+ state?: State;
67
68
  /**
68
69
  * Validation message to be displayed.
69
70
  */
@@ -377,7 +377,7 @@ have.
377
377
  <TextField
378
378
  label="User name"
379
379
  onChange={() => {}}
380
- validationState="valid"
380
+ state="valid"
381
381
  validationText="Looks good!"
382
382
  value="johnny1986"
383
383
  required
@@ -385,7 +385,7 @@ have.
385
385
  <TextField
386
386
  label="User name"
387
387
  onChange={() => {}}
388
- validationState="warning"
388
+ state="warning"
389
389
  validationText={(
390
390
  <>
391
391
  Account with this name already exists, pick a different one.
@@ -398,14 +398,14 @@ have.
398
398
  />
399
399
  <TextField
400
400
  label="User name"
401
- validationState="invalid"
401
+ state="invalid"
402
402
  validationText="Please enter a user name of your choice."
403
403
  required
404
404
  />
405
405
  <TextField
406
406
  label="User name"
407
407
  onChange={() => {}}
408
- validationState="valid"
408
+ state="valid"
409
409
  validationText="Looks good!"
410
410
  variant="filled"
411
411
  value="johnny1986"
@@ -414,7 +414,7 @@ have.
414
414
  <TextField
415
415
  label="User name"
416
416
  onChange={() => {}}
417
- validationState="warning"
417
+ state="warning"
418
418
  validationText={(
419
419
  <>
420
420
  Account with this name already exists, pick a different one.
@@ -428,13 +428,37 @@ have.
428
428
  />
429
429
  <TextField
430
430
  label="User name"
431
- validationState="invalid"
431
+ state="invalid"
432
432
  validationText="Please enter a user name of your choice."
433
433
  variant="filled"
434
434
  required
435
435
  />
436
436
  ```
437
437
 
438
+ ### Changed State
439
+
440
+ Changed state highlights fields whose value differs from the saved one, so users
441
+ can review their edits before saving.
442
+
443
+ A field shows one state at a time. When a changed value is also invalid, it's
444
+ up to you to pick the state that matters more to the user.
445
+
446
+ ```docoff-react-preview
447
+ <TextField
448
+ label="User name"
449
+ onChange={() => {}}
450
+ state="changed"
451
+ value="johnny1986"
452
+ />
453
+ <TextField
454
+ label="User name"
455
+ onChange={() => {}}
456
+ state="changed"
457
+ variant="filled"
458
+ value="johnny1986"
459
+ />
460
+ ```
461
+
438
462
  ### Disabled State
439
463
 
440
464
  It's possible to disable the whole input.
@@ -50,16 +50,20 @@
50
50
  }
51
51
 
52
52
  // States
53
+ .isRootStateChanged {
54
+ @include variants.state(changed);
55
+ }
56
+
53
57
  .isRootStateInvalid {
54
- @include variants.validation(invalid);
58
+ @include variants.state(invalid);
55
59
  }
56
60
 
57
61
  .isRootStateValid {
58
- @include variants.validation(valid);
62
+ @include variants.state(valid);
59
63
  }
60
64
 
61
65
  .isRootStateWarning {
62
- @include variants.validation(warning);
66
+ @include variants.state(warning);
63
67
  }
64
68
 
65
69
  // Invisible label
@@ -4,7 +4,7 @@ import { withGlobalProps } from '../../providers/globalProps';
4
4
  import { classNames } from '../../helpers/classNames/classNames';
5
5
  import { transferProps } from '../../helpers/transferProps';
6
6
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
7
+ import { getRootStateClassName } from '../_helpers/getRootStateClassName';
8
8
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
9
9
  import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
10
10
  import { FormLayoutCustomFieldContext } from '../FormLayout/FormLayoutCustomFieldContext';
@@ -25,8 +25,8 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(({
25
25
  layout = 'vertical',
26
26
  required = false,
27
27
  size = 'medium',
28
+ state,
28
29
  type = 'text',
29
- validationState,
30
30
  validationText,
31
31
  variant = 'outline',
32
32
  ...restProps
@@ -54,7 +54,7 @@ export const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(({
54
54
  styles,
55
55
  resolveContextOrProp(inputGroupContext && inputGroupContext.size, size),
56
56
  ),
57
- getRootValidationStateClassName(styles, validationState),
57
+ getRootStateClassName(styles, state),
58
58
  variant === 'filled' ? styles.isRootVariantFilled : styles.isRootVariantOutline,
59
59
  )}
60
60
  htmlFor={id}
@@ -5,7 +5,7 @@ import type {
5
5
  import type {
6
6
  Layout,
7
7
  Size,
8
- ValidationState,
8
+ State,
9
9
  } from '../../types';
10
10
 
11
11
  export type TextFieldType = 'email' | 'number' | 'password' | 'tel' | 'text';
@@ -73,13 +73,14 @@ export type TextFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'
73
73
  */
74
74
  size?: Size;
75
75
  /**
76
- * HTML input type, translated as `type` attribute of the input.
76
+ * Alter the field to reflect the state of its data, e.g. a validation result or a change
77
+ * against the saved value.
77
78
  */
78
- type?: TextFieldType;
79
+ state?: State;
79
80
  /**
80
- * Alter the field to provide feedback based on validation result.
81
+ * HTML input type, translated as `type` attribute of the input.
81
82
  */
82
- validationState?: ValidationState;
83
+ type?: TextFieldType;
83
84
  /**
84
85
  * Validation message to be displayed.
85
86
  *
@@ -68,7 +68,7 @@ helps to improve its accessibility.
68
68
  parent component. This applies for components using
69
69
  [Feedback color collection](/docs/foundation/collections#colors) and for
70
70
  components in any of the supported
71
- [validation states](/docs/foundation/colors#validation-states).
71
+ [states](../../docs/foundation/colors.md#states).
72
72
  In such cases, the custom properties marked with an asterisk (\*) are ignored.
73
73
 
74
74
  | Custom Property | Description |