@workday/canvas-kit-docs 11.0.0-alpha.662-next.0 → 11.0.0-alpha.664-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.
- package/dist/es6/lib/docs.js +110 -144
- package/dist/mdx/preview-react/form-field/FormField.mdx +18 -0
- package/dist/mdx/preview-react/form-field/examples/AllFields.tsx +12 -12
- package/dist/mdx/preview-react/form-field/examples/Grow.tsx +21 -0
- package/dist/mdx/preview-react/form-field/examples/ThemedErrors.tsx +36 -0
- package/dist/mdx/preview-react/menu/Menu.mdx +10 -1
- package/dist/mdx/preview-react/radio/Radio.mdx +2 -5
- package/dist/mdx/preview-react/radio/examples/Basic.tsx +11 -4
- package/dist/mdx/preview-react/radio/examples/Custom.tsx +11 -4
- package/dist/mdx/preview-react/radio/examples/Disabled.tsx +5 -4
- package/dist/mdx/preview-react/radio/examples/Error.tsx +1 -1
- package/dist/mdx/preview-react/radio/examples/Inverse.tsx +7 -10
- package/dist/mdx/preview-react/radio/examples/LabelPosition.tsx +5 -8
- package/dist/mdx/preview-react/radio/examples/NoValue.tsx +5 -8
- package/dist/mdx/preview-react/radio/examples/RefForwarding.tsx +5 -4
- package/dist/mdx/preview-react/radio/examples/Required.tsx +7 -10
- package/dist/mdx/preview-react/radio/examples/StandaloneRadio.tsx +7 -4
- package/dist/mdx/preview-react/text-area/TextArea.mdx +9 -0
- package/dist/mdx/preview-react/text-input/TextInput.mdx +12 -2
- package/dist/mdx/react/checkbox/Checkbox.mdx +16 -6
- package/dist/mdx/react/checkbox/examples/Alert.tsx +11 -7
- package/dist/mdx/react/checkbox/examples/Error.tsx +11 -7
- package/dist/mdx/react/checkbox/examples/LabelPosition.tsx +9 -3
- package/dist/mdx/react/checkbox/examples/Required.tsx +9 -3
- package/dist/mdx/react/color-picker/color-input/ColorInput.mdx +16 -6
- package/dist/mdx/react/color-picker/color-input/examples/Alert.tsx +5 -8
- package/dist/mdx/react/color-picker/color-input/examples/Basic.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/Checked.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/Disabled.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/Error.tsx +5 -8
- package/dist/mdx/react/color-picker/color-input/examples/Grow.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/LabelPosition.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/RefForwarding.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/Required.tsx +4 -3
- package/dist/mdx/react/color-picker/color-input/examples/ValidColorChange.tsx +5 -3
- package/dist/mdx/react/color-picker/color-preview/ColorPreview.mdx +16 -6
- package/dist/mdx/react/color-picker/color-preview/examples/LabelPosition.tsx +4 -3
- package/dist/mdx/react/color-picker/color-preview/examples/RefForwarding.tsx +4 -3
- package/dist/mdx/react/common/examples/ResponsiveStyles.tsx +4 -3
- package/dist/mdx/react/dialog/examples/Basic.tsx +4 -3
- package/dist/mdx/react/dialog/examples/Focus.tsx +4 -3
- package/dist/mdx/react/form-field/FormField.mdx +9 -0
- package/dist/mdx/react/modal/examples/CustomFocus.tsx +9 -3
- package/dist/mdx/react/modal/examples/FormModal.tsx +7 -5
- package/dist/mdx/react/modal/examples/ReturnFocus.tsx +6 -4
- package/dist/mdx/react/radio/Radio.mdx +19 -8
- package/dist/mdx/react/radio/examples/Alert.tsx +6 -10
- package/dist/mdx/react/radio/examples/Basic.tsx +5 -4
- package/dist/mdx/react/radio/examples/Disabled.tsx +5 -4
- package/dist/mdx/react/radio/examples/Error.tsx +6 -10
- package/dist/mdx/react/radio/examples/LabelPosition.tsx +5 -8
- package/dist/mdx/react/radio/examples/NoValue.tsx +5 -4
- package/dist/mdx/react/radio/examples/RefForwarding.tsx +5 -4
- package/dist/mdx/react/radio/examples/Required.tsx +5 -4
- package/dist/mdx/react/select/Select.mdx +16 -7
- package/dist/mdx/react/select/examples/Alert.tsx +5 -7
- package/dist/mdx/react/select/examples/Basic.tsx +4 -3
- package/dist/mdx/react/select/examples/Complex.tsx +4 -3
- package/dist/mdx/react/select/examples/Disabled.tsx +4 -3
- package/dist/mdx/react/select/examples/DisabledOption.tsx +4 -3
- package/dist/mdx/react/select/examples/Error.tsx +5 -7
- package/dist/mdx/react/select/examples/Grow.tsx +4 -3
- package/dist/mdx/react/select/examples/HoistedModel.tsx +4 -3
- package/dist/mdx/react/select/examples/LabelPosition.tsx +4 -3
- package/dist/mdx/react/select/examples/MenuHeight.tsx +4 -3
- package/dist/mdx/react/select/examples/RefForwarding.tsx +8 -7
- package/dist/mdx/react/select/examples/Required.tsx +7 -6
- package/dist/mdx/react/select/examples/WithIcons.tsx +11 -6
- package/dist/mdx/react/skeleton/examples/Simulation.tsx +7 -5
- package/dist/mdx/react/status-indicator/StatusIndicator.mdx +10 -0
- package/dist/mdx/react/switch/Switch.mdx +16 -7
- package/dist/mdx/react/table/Table.mdx +7 -0
- package/dist/mdx/react/text-area/TextArea.mdx +18 -11
- package/dist/mdx/react/text-area/examples/Alert.tsx +5 -8
- package/dist/mdx/react/text-area/examples/Basic.tsx +4 -3
- package/dist/mdx/react/text-area/examples/Disabled.tsx +4 -3
- package/dist/mdx/react/text-area/examples/Error.tsx +5 -8
- package/dist/mdx/react/text-area/examples/Grow.tsx +4 -3
- package/dist/mdx/react/text-area/examples/LabelPosition.tsx +4 -3
- package/dist/mdx/react/text-area/examples/Placeholder.tsx +9 -3
- package/dist/mdx/react/text-area/examples/RefForwarding.tsx +4 -3
- package/dist/mdx/react/text-area/examples/Required.tsx +4 -3
- package/dist/mdx/react/text-area/examples/ResizeConstraints.tsx +9 -3
- package/dist/mdx/react/text-input/TextInput.mdx +16 -7
- package/package.json +6 -6
|
@@ -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
|
-
|
|
82
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
14
|
-
<
|
|
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
|
|
14
|
-
<
|
|
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
|
|
14
|
-
<
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
14
|
-
<
|
|
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
|
|
14
|
-
<
|
|
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
|
|
21
|
-
<
|
|
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
|
|
14
|
-
<
|
|
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
|
|
21
|
-
<
|
|
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
|
-
|
|
41
|
-
|
|
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
|
|
8
|
-
<
|
|
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
|
|
18
|
-
<
|
|
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
|
|
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
|
|
27
|
-
<
|
|
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
|
|
29
|
-
<
|
|
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
|
|
33
|
-
<
|
|
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
|
|
36
|
-
<
|
|
35
|
+
<FormField>
|
|
36
|
+
<FormField.Label>First Name</FormField.Label>
|
|
37
|
+
<FormField.Input as={TextInput} name="first" />
|
|
37
38
|
</FormField>
|
|
38
|
-
<FormField
|
|
39
|
-
<
|
|
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
|
|
22
|
-
<
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
71
|
-
|
|
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
|
|
|
@@ -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 {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
4
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
5
5
|
|
|
@@ -11,19 +11,15 @@ export default () => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<FormField
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
hintText="Deep dish is an extra $2.99"
|
|
18
|
-
label="Choose Your Pizza Crust"
|
|
19
|
-
useFieldset={true}
|
|
20
|
-
>
|
|
21
|
-
<RadioGroup name={useUniqueId()} onChange={handleChange} value={value}>
|
|
14
|
+
<FormField error="alert" as="fieldset">
|
|
15
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
16
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
22
17
|
<Radio label="Deep dish" value="deep-dish" />
|
|
23
18
|
<Radio label="Thin" value="thin" />
|
|
24
19
|
<Radio label="Gluten free" value="gluten-free" />
|
|
25
20
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
26
|
-
</
|
|
21
|
+
</FormField.Input>
|
|
22
|
+
<FormField.Hint>Deep dish is an extra $2.99</FormField.Hint>
|
|
27
23
|
</FormField>
|
|
28
24
|
);
|
|
29
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 {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
4
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
@@ -12,14 +12,15 @@ export default () => {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
|
-
<FormField
|
|
16
|
-
<
|
|
15
|
+
<FormField as="fieldset" cs={{width: space.xl}}>
|
|
16
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
17
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
17
18
|
<Radio label="Deep dish" value="deep-dish" />
|
|
18
19
|
<Radio label="Thin" value="thin" />
|
|
19
20
|
<Radio label="Gluten free" value="gluten-free" />
|
|
20
21
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
21
22
|
<Radio label="Butter - the best thing to put on bread" value="butter" />
|
|
22
|
-
</
|
|
23
|
+
</FormField.Input>
|
|
23
24
|
</FormField>
|
|
24
25
|
);
|
|
25
26
|
};
|
|
@@ -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 {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
4
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
5
5
|
|
|
@@ -11,13 +11,14 @@ export default () => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<FormField
|
|
15
|
-
<
|
|
14
|
+
<FormField as="fieldset">
|
|
15
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
16
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
16
17
|
<Radio label="Deep dish" value="deep-dish" />
|
|
17
18
|
<Radio label="Thin" value="thin" />
|
|
18
19
|
<Radio disabled={true} label="Gluten free (sold out)" value="gluten-free" />
|
|
19
20
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
20
|
-
</
|
|
21
|
+
</FormField.Input>
|
|
21
22
|
</FormField>
|
|
22
23
|
);
|
|
23
24
|
};
|