@workday/canvas-kit-docs 11.0.0-alpha.662-next.0 → 11.0.0-alpha.667-next.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 (85) hide show
  1. package/dist/es6/lib/docs.js +191 -146
  2. package/dist/mdx/preview-react/form-field/FormField.mdx +18 -0
  3. package/dist/mdx/preview-react/form-field/examples/AllFields.tsx +12 -12
  4. package/dist/mdx/preview-react/form-field/examples/Grow.tsx +21 -0
  5. package/dist/mdx/preview-react/form-field/examples/ThemedErrors.tsx +36 -0
  6. package/dist/mdx/preview-react/menu/Menu.mdx +10 -1
  7. package/dist/mdx/preview-react/radio/Radio.mdx +2 -5
  8. package/dist/mdx/preview-react/radio/examples/Basic.tsx +11 -4
  9. package/dist/mdx/preview-react/radio/examples/Custom.tsx +11 -4
  10. package/dist/mdx/preview-react/radio/examples/Disabled.tsx +5 -4
  11. package/dist/mdx/preview-react/radio/examples/Error.tsx +1 -1
  12. package/dist/mdx/preview-react/radio/examples/Inverse.tsx +7 -10
  13. package/dist/mdx/preview-react/radio/examples/LabelPosition.tsx +5 -8
  14. package/dist/mdx/preview-react/radio/examples/NoValue.tsx +5 -8
  15. package/dist/mdx/preview-react/radio/examples/RefForwarding.tsx +5 -4
  16. package/dist/mdx/preview-react/radio/examples/Required.tsx +7 -10
  17. package/dist/mdx/preview-react/radio/examples/StandaloneRadio.tsx +7 -4
  18. package/dist/mdx/preview-react/text-area/TextArea.mdx +9 -0
  19. package/dist/mdx/preview-react/text-input/TextInput.mdx +12 -2
  20. package/dist/mdx/react/checkbox/Checkbox.mdx +16 -6
  21. package/dist/mdx/react/checkbox/examples/Alert.tsx +11 -7
  22. package/dist/mdx/react/checkbox/examples/Error.tsx +11 -7
  23. package/dist/mdx/react/checkbox/examples/LabelPosition.tsx +9 -3
  24. package/dist/mdx/react/checkbox/examples/Required.tsx +9 -3
  25. package/dist/mdx/react/color-picker/color-input/ColorInput.mdx +16 -6
  26. package/dist/mdx/react/color-picker/color-input/examples/Alert.tsx +5 -8
  27. package/dist/mdx/react/color-picker/color-input/examples/Basic.tsx +4 -3
  28. package/dist/mdx/react/color-picker/color-input/examples/Checked.tsx +4 -3
  29. package/dist/mdx/react/color-picker/color-input/examples/Disabled.tsx +4 -3
  30. package/dist/mdx/react/color-picker/color-input/examples/Error.tsx +5 -8
  31. package/dist/mdx/react/color-picker/color-input/examples/Grow.tsx +4 -3
  32. package/dist/mdx/react/color-picker/color-input/examples/LabelPosition.tsx +4 -3
  33. package/dist/mdx/react/color-picker/color-input/examples/RefForwarding.tsx +4 -3
  34. package/dist/mdx/react/color-picker/color-input/examples/Required.tsx +4 -3
  35. package/dist/mdx/react/color-picker/color-input/examples/ValidColorChange.tsx +5 -3
  36. package/dist/mdx/react/color-picker/color-preview/ColorPreview.mdx +16 -6
  37. package/dist/mdx/react/color-picker/color-preview/examples/LabelPosition.tsx +4 -3
  38. package/dist/mdx/react/color-picker/color-preview/examples/RefForwarding.tsx +4 -3
  39. package/dist/mdx/react/common/examples/ResponsiveStyles.tsx +4 -3
  40. package/dist/mdx/react/dialog/examples/Basic.tsx +4 -3
  41. package/dist/mdx/react/dialog/examples/Focus.tsx +4 -3
  42. package/dist/mdx/react/form-field/FormField.mdx +9 -0
  43. package/dist/mdx/react/modal/examples/CustomFocus.tsx +9 -3
  44. package/dist/mdx/react/modal/examples/FormModal.tsx +7 -5
  45. package/dist/mdx/react/modal/examples/ReturnFocus.tsx +6 -4
  46. package/dist/mdx/react/radio/Radio.mdx +19 -8
  47. package/dist/mdx/react/radio/examples/Alert.tsx +6 -10
  48. package/dist/mdx/react/radio/examples/Basic.tsx +5 -4
  49. package/dist/mdx/react/radio/examples/Disabled.tsx +5 -4
  50. package/dist/mdx/react/radio/examples/Error.tsx +6 -10
  51. package/dist/mdx/react/radio/examples/LabelPosition.tsx +5 -8
  52. package/dist/mdx/react/radio/examples/NoValue.tsx +5 -4
  53. package/dist/mdx/react/radio/examples/RefForwarding.tsx +5 -4
  54. package/dist/mdx/react/radio/examples/Required.tsx +5 -4
  55. package/dist/mdx/react/select/Select.mdx +16 -7
  56. package/dist/mdx/react/select/examples/Alert.tsx +5 -7
  57. package/dist/mdx/react/select/examples/Basic.tsx +4 -3
  58. package/dist/mdx/react/select/examples/Complex.tsx +4 -3
  59. package/dist/mdx/react/select/examples/Disabled.tsx +4 -3
  60. package/dist/mdx/react/select/examples/DisabledOption.tsx +4 -3
  61. package/dist/mdx/react/select/examples/Error.tsx +5 -7
  62. package/dist/mdx/react/select/examples/Grow.tsx +4 -3
  63. package/dist/mdx/react/select/examples/HoistedModel.tsx +4 -3
  64. package/dist/mdx/react/select/examples/LabelPosition.tsx +4 -3
  65. package/dist/mdx/react/select/examples/MenuHeight.tsx +4 -3
  66. package/dist/mdx/react/select/examples/RefForwarding.tsx +8 -7
  67. package/dist/mdx/react/select/examples/Required.tsx +7 -6
  68. package/dist/mdx/react/select/examples/WithIcons.tsx +11 -6
  69. package/dist/mdx/react/skeleton/examples/Simulation.tsx +7 -5
  70. package/dist/mdx/react/status-indicator/StatusIndicator.mdx +10 -0
  71. package/dist/mdx/react/switch/Switch.mdx +16 -7
  72. package/dist/mdx/react/table/Table.mdx +7 -0
  73. package/dist/mdx/react/text-area/TextArea.mdx +18 -11
  74. package/dist/mdx/react/text-area/examples/Alert.tsx +5 -8
  75. package/dist/mdx/react/text-area/examples/Basic.tsx +4 -3
  76. package/dist/mdx/react/text-area/examples/Disabled.tsx +4 -3
  77. package/dist/mdx/react/text-area/examples/Error.tsx +5 -8
  78. package/dist/mdx/react/text-area/examples/Grow.tsx +4 -3
  79. package/dist/mdx/react/text-area/examples/LabelPosition.tsx +4 -3
  80. package/dist/mdx/react/text-area/examples/Placeholder.tsx +9 -3
  81. package/dist/mdx/react/text-area/examples/RefForwarding.tsx +4 -3
  82. package/dist/mdx/react/text-area/examples/Required.tsx +4 -3
  83. package/dist/mdx/react/text-area/examples/ResizeConstraints.tsx +9 -3
  84. package/dist/mdx/react/text-input/TextInput.mdx +16 -7
  85. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
 
5
5
  export default () => {
6
6
  const [checked, setChecked] = React.useState(false);
@@ -10,12 +10,16 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField
14
- error={FormField.ErrorType.Error}
15
- hintId="hint-error"
16
- hintText="You must agree to the terms before proceeding"
17
- >
18
- <Checkbox checked={checked} label="I agree to the terms" onChange={handleChange} />
13
+ <FormField error="error" orientation="horizontal">
14
+ <FormField.Container>
15
+ <FormField.Input
16
+ as={Checkbox}
17
+ checked={checked}
18
+ label="I agree to the terms"
19
+ onChange={handleChange}
20
+ />
21
+ <FormField.Hint>You must agree to the terms before proceeding</FormField.Hint>
22
+ </FormField.Container>
19
23
  </FormField>
20
24
  );
21
25
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
 
5
5
  export default () => {
6
6
  const [checked, setChecked] = React.useState(false);
@@ -10,8 +10,14 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Terms" labelPosition={FormField.LabelPosition.Left}>
14
- <Checkbox checked={checked} label="I agree to the terms" onChange={handleChange} />
13
+ <FormField orientation="horizontal">
14
+ <FormField.Label>Terms</FormField.Label>
15
+ <FormField.Input
16
+ as={Checkbox}
17
+ checked={checked}
18
+ label="I agree to the terms"
19
+ onChange={handleChange}
20
+ />
15
21
  </FormField>
16
22
  );
17
23
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
 
5
5
  export default () => {
6
6
  const [checked, setChecked] = React.useState(false);
@@ -10,8 +10,14 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Terms" required={true}>
14
- <Checkbox checked={checked} label="I agree to the terms" onChange={handleChange} />
13
+ <FormField isRequired={true}>
14
+ <FormField.Label>Terms</FormField.Label>
15
+ <FormField.Input
16
+ as={Checkbox}
17
+ checked={checked}
18
+ label="I agree to the terms"
19
+ onChange={handleChange}
20
+ />
15
21
  </FormField>
16
22
  );
17
23
  };
@@ -1,6 +1,7 @@
1
1
  import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
2
2
 
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
+ import {InformationHighlight} from '@workday/canvas-kit-docs';
4
5
 
5
6
  import Alert from './examples/Alert';
6
7
  import Basic from './examples/Basic';
@@ -28,6 +29,18 @@ yarn add @workday/canvas-kit-react
28
29
 
29
30
  ## Usage
30
31
 
32
+ <InformationHighlight style={{margin: '1.5rem 0'}}>
33
+ <InformationHighlight.Icon />
34
+ <InformationHighlight.Heading>Note</InformationHighlight.Heading>
35
+ <InformationHighlight.Body>
36
+ These examples are using FormField from Preview. We can plan to promote this component to the
37
+ Main package in a future major version.
38
+ </InformationHighlight.Body>
39
+ <InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-form-field--basic">
40
+ View Form Field (Preview) Documentation
41
+ </InformationHighlight.Link>
42
+ </InformationHighlight>
43
+
31
44
  ### Basic Example
32
45
 
33
46
  Color Input should be used in tandem with [Form Field](/components/inputs/form-field/) to meet
@@ -73,13 +86,10 @@ the width of its container.
73
86
 
74
87
  The `grow` prop may also be applied directly to the Color Input if Form Field is not being used.
75
88
 
76
- ### Label Position
77
-
78
- Set the `labelPosition` prop of the wrapping Form Field to designate the position of the label
79
- relative to the Color Input. `labelPosition` accepts the following values:
89
+ ### Label Position Horizontal
80
90
 
81
- - `FormField.LabelPosition.Top` (Default)
82
- - `FormField.LabelPosition.Left`
91
+ Set the `orientation` prop of the Form Field to designate the position of the label relative to the
92
+ input component. By default, the orientation will be set to `vertical`.
83
93
 
84
94
  <ExampleCodeBlock code={LabelPosition} />
85
95
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,13 +10,10 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField
14
- error={FormField.ErrorType.Alert}
15
- hintId="hint-alert"
16
- hintText="Please select a background color."
17
- label="Background Color"
18
- >
19
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField error="alert">
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} value={value} />
16
+ <FormField.Hint>Please select a background color.</FormField.Hint>
20
17
  </FormField>
21
18
  );
22
19
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Background Color">
14
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField>
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Background Color">
14
- <ColorInput onChange={handleChange} showCheck={true} value={value} />
13
+ <FormField>
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} showCheck={true} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Background Color">
14
- <ColorInput disabled onChange={handleChange} value={value} />
13
+ <FormField>
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} disabled onChange={handleChange} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,13 +10,10 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField
14
- error={FormField.ErrorType.Error}
15
- hintId="hint-error"
16
- hintText="Please select a background color."
17
- label="Background Color"
18
- >
19
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField error="error">
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} value={value} />
16
+ <FormField.Hint>Please select a background color.</FormField.Hint>
20
17
  </FormField>
21
18
  );
22
19
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField grow={true} label="Background Color">
14
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField cs={{width: '100%'}}>
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input cs={{width: '100%'}} as={ColorInput} onChange={handleChange} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Background Color" labelPosition={FormField.LabelPosition.Left}>
14
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField orientation="horizontal">
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
5
5
 
6
6
  export default () => {
@@ -17,8 +17,9 @@ export default () => {
17
17
 
18
18
  return (
19
19
  <>
20
- <FormField label="Background Color">
21
- <ColorInput onChange={handleChange} ref={ref} value={value} />
20
+ <FormField>
21
+ <FormField.Label>Background Color</FormField.Label>
22
+ <FormField.Input as={ColorInput} onChange={handleChange} ref={ref} value={value} />
22
23
  </FormField>
23
24
  <PrimaryButton onClick={handleClick}>Focus Color Input</PrimaryButton>
24
25
  </>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
@@ -10,8 +10,9 @@ export default () => {
10
10
  };
11
11
 
12
12
  return (
13
- <FormField label="Background Color" required={true}>
14
- <ColorInput onChange={handleChange} value={value} />
13
+ <FormField isRequired={true}>
14
+ <FormField.Label>Background Color</FormField.Label>
15
+ <FormField.Input as={ColorInput} onChange={handleChange} value={value} />
15
16
  </FormField>
16
17
  );
17
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorInput} from '@workday/canvas-kit-react/color-picker';
4
4
  import {type} from '@workday/canvas-kit-react/tokens';
5
5
 
@@ -17,8 +17,10 @@ export default () => {
17
17
 
18
18
  return (
19
19
  <>
20
- <FormField label="Background Color">
21
- <ColorInput
20
+ <FormField>
21
+ <FormField.Label>Background Color</FormField.Label>
22
+ <FormField.Input
23
+ as={ColorInput}
22
24
  onChange={handleChange}
23
25
  onValidColorChange={handleValidColorChange}
24
26
  value={value}
@@ -1,6 +1,7 @@
1
1
  import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
2
2
 
3
3
  import {ColorPreview} from '@workday/canvas-kit-react/color-picker';
4
+ import {InformationHighlight} from '@workday/canvas-kit-docs';
4
5
 
5
6
  import Basic from './examples/Basic';
6
7
  import LabelPosition from './examples/LabelPosition';
@@ -21,6 +22,18 @@ yarn add @workday/canvas-kit-react
21
22
 
22
23
  ## Usage
23
24
 
25
+ <InformationHighlight style={{margin: '1.5rem 0'}}>
26
+ <InformationHighlight.Icon />
27
+ <InformationHighlight.Heading>Note</InformationHighlight.Heading>
28
+ <InformationHighlight.Body>
29
+ These examples are using FormField from Preview. We can plan to promote this component to the
30
+ Main package in a future major version.
31
+ </InformationHighlight.Body>
32
+ <InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-form-field--basic">
33
+ View Form Field (Preview) Documentation
34
+ </InformationHighlight.Link>
35
+ </InformationHighlight>
36
+
24
37
  ### Basic Example
25
38
 
26
39
  <ExampleCodeBlock code={Basic} />
@@ -32,13 +45,10 @@ forward `ref` to its underlying `<input type="text">` element.
32
45
 
33
46
  <ExampleCodeBlock code={RefForwarding} />
34
47
 
35
- ### Label Position
36
-
37
- If Form Field is being used, set its `labelPosition` prop to designate the position of the label
38
- relative to the Color Preview. `labelPosition` accepts the following values:
48
+ ### Label Position Horizontal
39
49
 
40
- - `FormField.LabelPosition.Top` (Default)
41
- - `FormField.LabelPosition.Left`
50
+ Set the `orientation` prop of the Form Field to designate the position of the label relative to the
51
+ input component. By default, the orientation will be set to `vertical`.
42
52
 
43
53
  <ExampleCodeBlock code={LabelPosition} />
44
54
 
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {ColorPreview} from '@workday/canvas-kit-react/color-picker';
4
4
 
5
5
  export default () => {
6
6
  return (
7
- <FormField label="Background Color" labelPosition={FormField.LabelPosition.Left}>
8
- <ColorPreview value="#00ffcc" />
7
+ <FormField orientation="horizontal">
8
+ <FormField.Label>Background Color</FormField.Label>
9
+ <FormField.Input as={ColorPreview} value="#00ffcc" />
9
10
  </FormField>
10
11
  );
11
12
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
  import {ColorPreview} from '@workday/canvas-kit-react/color-picker';
5
5
  import {type} from '@workday/canvas-kit-react/tokens';
6
6
 
@@ -14,8 +14,9 @@ export default () => {
14
14
 
15
15
  return (
16
16
  <>
17
- <FormField label="Background Color">
18
- <ColorPreview ref={ref} value="#00ffcc" />
17
+ <FormField>
18
+ <FormField.Label>Background Color</FormField.Label>
19
+ <FormField.Input as={ColorPreview} ref={ref} value="#00ffcc" />
19
20
  </FormField>
20
21
  <p style={type.levels.subtext.large}>Width of Color Preview: {width}</p>
21
22
  <PrimaryButton onClick={handleClick}>Calculate Width of Color Preview</PrimaryButton>
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import {Box, Grid, Flex} from '@workday/canvas-kit-react/layout';
3
3
  import {Text} from '@workday/canvas-kit-react/text';
4
4
  import {useResponsiveContainerStyles, useResizeObserver} from '@workday/canvas-kit-react/common';
5
- import {FormField} from '@workday/canvas-kit-react/form-field';
5
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
6
6
  import {Select} from '@workday/canvas-kit-react/select';
7
7
 
8
8
  const HeadingText = ({children, ...props}) => (
@@ -84,9 +84,10 @@ export default () => {
84
84
 
85
85
  return (
86
86
  <Box ref={ref} width={contWidth}>
87
- <FormField label={'Container Size'}>
87
+ <FormField>
88
+ <FormField.Label>Container Size</FormField.Label>
88
89
  <Select items={['1024px', '768px', '320px']} initialSelectedIds={['1024px']}>
89
- <Select.Input onChange={handleChange} />
90
+ <FormField.Input as={Select.Input} onChange={handleChange} />
90
91
  <Select.Popper>
91
92
  <Select.Card>
92
93
  <Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {FormField} from '@workday/canvas-kit-react/form-field';
2
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {TextInput} from '@workday/canvas-kit-react/text-input';
4
4
  import {Flex} from '@workday/canvas-kit-react/layout';
5
5
  import {Dialog} from '@workday/canvas-kit-react/dialog';
@@ -23,8 +23,9 @@ export default () => {
23
23
  <Dialog.CloseIcon aria-label="Close" />
24
24
  <Dialog.Heading paddingTop="m">Sign Up for 15% Off Your Next Order</Dialog.Heading>
25
25
  <Dialog.Body>
26
- <FormField label="Email">
27
- <TextInput onChange={handleChange} value={value} />
26
+ <FormField>
27
+ <FormField.Label>Email</FormField.Label>
28
+ <FormField.Input as={TextInput} onChange={handleChange} value={value} />
28
29
  </FormField>
29
30
  </Dialog.Body>
30
31
  <Flex gap="s" padding="xxs" marginTop="xxs">
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
  import {TextInput} from '@workday/canvas-kit-react/text-input';
5
5
  import {Flex} from '@workday/canvas-kit-react/layout';
6
6
  import {Dialog} from '@workday/canvas-kit-react/dialog';
@@ -25,8 +25,9 @@ export default () => {
25
25
  <Dialog.CloseIcon aria-label="Close" />
26
26
  <Dialog.Heading paddingTop="m">Sign Up for 15% Off Your Next Order</Dialog.Heading>
27
27
  <Dialog.Body>
28
- <FormField label="Email">
29
- <TextInput onChange={handleChange} value={value} />
28
+ <FormField>
29
+ <FormField.Label>Email</FormField.Label>
30
+ <FormField.Input as={TextInput} onChange={handleChange} value={value} />
30
31
  </FormField>
31
32
  </Dialog.Body>
32
33
  <Flex gap="s" padding="xxs" marginTop="xxs">
@@ -13,10 +13,19 @@ import Grow from './examples/Grow.tsx';
13
13
  import Hint from './examples/Hint.tsx';
14
14
  import LabelPosition from './examples/LabelPosition.tsx';
15
15
  import Required from './examples/Required.tsx';
16
+ import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
16
17
 
17
18
 
18
19
  # Canvas Kit Form Field
19
20
 
21
+ <StatusIndicator variant="red">
22
+ <StatusIndicator.Label>Deprecated</StatusIndicator.Label>
23
+ </StatusIndicator>
24
+
25
+ `FormField` in Main has been deprecated and will be removed in a future major version. Please use
26
+ [`FormField` in Preview](https://workday.github.io/canvas-kit/?path=/story/preview-inputs-form-field--basic)
27
+ instead.
28
+
20
29
  Form Field allows users to wrap input components to make them accessible and adds complementary
21
30
  labels and error messages.
22
31
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
5
5
  import {TextInput} from '@workday/canvas-kit-react/text-input';
6
6
  import {Flex, Box} from '@workday/canvas-kit-react/layout';
7
7
  import {useUniqueId} from '@workday/canvas-kit-react/common';
@@ -29,8 +29,14 @@ export default () => {
29
29
  <Box as="p" id={longDescID} marginTop={0} marginBottom="m">
30
30
  Enter your initials to acknowledge the license.
31
31
  </Box>
32
- <FormField label="Initials" style={{marginBottom: 0}}>
33
- <TextInput ref={ref} value={value} onChange={e => setValue(e.currentTarget.value)} />
32
+ <FormField cs={{marginBottom: 0}}>
33
+ <FormField.Label>Initials</FormField.Label>
34
+ <FormField.Input
35
+ as={TextInput}
36
+ ref={ref}
37
+ value={value}
38
+ onChange={e => setValue(e.currentTarget.value)}
39
+ />
34
40
  </FormField>
35
41
  </Modal.Body>
36
42
  <Flex gap="s" padding="xxs" marginTop="xxs">
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
4
4
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
5
5
  import {Flex} from '@workday/canvas-kit-react/layout';
6
- import {FormField} from '@workday/canvas-kit-react/form-field';
6
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
7
7
  import {TextInput} from '@workday/canvas-kit-react/text-input';
8
8
  import {plusIcon} from '@workday/canvas-system-icons-web';
9
9
 
@@ -32,11 +32,13 @@ export default () => {
32
32
  <Modal.CloseIcon aria-label="Close" />
33
33
  <Modal.Heading>New User</Modal.Heading>
34
34
  <Modal.Body>
35
- <FormField label="First Name">
36
- <TextInput name="first" />
35
+ <FormField>
36
+ <FormField.Label>First Name</FormField.Label>
37
+ <FormField.Input as={TextInput} name="first" />
37
38
  </FormField>
38
- <FormField label="Last Name">
39
- <TextInput name="last" />
39
+ <FormField>
40
+ <FormField.Label>Last Name</FormField.Label>
41
+ <FormField.Input as={TextInput} name="last" />
40
42
  </FormField>
41
43
  </Modal.Body>
42
44
  <Flex gap="s" padding="xxs" marginTop="xxs">
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {DeleteButton} from '@workday/canvas-kit-react/button';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
5
5
  import {Flex, Box} from '@workday/canvas-kit-react/layout';
6
6
  import {Select} from '@workday/canvas-kit-preview-react/select';
7
7
 
@@ -18,8 +18,10 @@ export default () => {
18
18
 
19
19
  return (
20
20
  <Modal model={model}>
21
- <FormField label="Choose an option">
22
- <Select
21
+ <FormField>
22
+ <FormField.Label>Choose an option</FormField.Label>
23
+ <FormField.Input
24
+ as={Select}
23
25
  ref={ref}
24
26
  options={['', 'Delete', 'Two']}
25
27
  value={value}
@@ -32,7 +34,7 @@ export default () => {
32
34
  setValue(e.currentTarget.value);
33
35
  }
34
36
  }}
35
- ></Select>
37
+ />
36
38
  </FormField>
37
39
  <Modal.Overlay>
38
40
  <Modal.Card>
@@ -1,4 +1,4 @@
1
- import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
1
+ import {SymbolDoc, Specifications, InformationHighlight} from '@workday/canvas-kit-docs';
2
2
 
3
3
  import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
4
4
 
@@ -27,6 +27,18 @@ yarn add @workday/canvas-kit-react
27
27
 
28
28
  ## Usage
29
29
 
30
+ <InformationHighlight style={{margin: '1.5rem 0'}}>
31
+ <InformationHighlight.Icon />
32
+ <InformationHighlight.Heading>Note</InformationHighlight.Heading>
33
+ <InformationHighlight.Body>
34
+ These examples are using FormField from Preview. We can plan to promote this component to the
35
+ Main package in a future major version.
36
+ </InformationHighlight.Body>
37
+ <InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-form-field--basic">
38
+ View Form Field (Preview) Documentation
39
+ </InformationHighlight.Link>
40
+ </InformationHighlight>
41
+
30
42
  ### Basic Example
31
43
 
32
44
  Radio Buttons are intended to be grouped together using a Radio Group.
@@ -38,7 +50,9 @@ Radio Group should be used in tandem with [Form Field](/components/inputs/form-f
38
50
 
39
51
  ### Disabled
40
52
 
41
- Set the `disabled` prop of the Radio Button to prevent users from interacting with it. Be careful not to disable a pre-selected Radio Button, this will block keyboard access from the entire Radio Group.
53
+ Set the `disabled` prop of the Radio Button to prevent users from interacting with it. Be careful
54
+ not to disable a pre-selected Radio Button, this will block keyboard access from the entire Radio
55
+ Group.
42
56
 
43
57
  <ExampleCodeBlock code={Disabled} />
44
58
 
@@ -62,13 +76,10 @@ forward `ref` to its underlying `<input type="radio">` element.
62
76
 
63
77
  <ExampleCodeBlock code={RefForwarding} />
64
78
 
65
- ### Label Position
66
-
67
- Set the `labelPosition` prop of the wrapping Form Field to designate the position of the label
68
- relative to the Radio Group. `labelPosition` accepts the following values:
79
+ ### Label Position Horizontal
69
80
 
70
- - `FormField.LabelPosition.Top` (Default)
71
- - `FormField.LabelPosition.Left`
81
+ Set the `orientation` prop of the Form Field to designate the position of the label relative to the
82
+ input component. By default, the orientation will be set to `vertical`.
72
83
 
73
84
  <ExampleCodeBlock code={LabelPosition} />
74
85