@workday/canvas-kit-docs 11.0.0-alpha.657-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 +818 -324
- 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/loading-sparkles/LoadingSparkles.mdx +15 -2
- package/dist/mdx/preview-react/loading-sparkles/examples/Basic.tsx +59 -1
- 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,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
|
};
|
|
@@ -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 currently sold out."
|
|
18
|
-
label="Choose Your Pizza Crust"
|
|
19
|
-
useFieldset={true}
|
|
20
|
-
>
|
|
21
|
-
<RadioGroup name={useUniqueId()} onChange={handleChange} value={value}>
|
|
14
|
+
<FormField error="error" 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 currently sold out</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
|
|
|
@@ -11,17 +11,14 @@ export default () => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
|
-
<FormField
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
useFieldset={true}
|
|
18
|
-
>
|
|
19
|
-
<RadioGroup name={useUniqueId()} onChange={handleChange} value={value}>
|
|
14
|
+
<FormField orientation="horizontal" as="fieldset">
|
|
15
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
16
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
20
17
|
<Radio label="Deep dish" value="deep-dish" />
|
|
21
18
|
<Radio label="Thin" value="thin" />
|
|
22
19
|
<Radio label="Gluten free" value="gluten-free" />
|
|
23
20
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
24
|
-
</
|
|
21
|
+
</FormField.Input>
|
|
25
22
|
</FormField>
|
|
26
23
|
);
|
|
27
24
|
};
|
|
@@ -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 {Subtext} from '@workday/canvas-kit-react/text';
|
|
5
5
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
@@ -13,13 +13,14 @@ export default () => {
|
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<>
|
|
16
|
-
<FormField
|
|
17
|
-
<
|
|
16
|
+
<FormField as="fieldset">
|
|
17
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
18
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
18
19
|
<Radio label="Deep dish" />
|
|
19
20
|
<Radio label="Thin" />
|
|
20
21
|
<Radio label="Gluten free" />
|
|
21
22
|
<Radio label="Cauliflower" />
|
|
22
|
-
</
|
|
23
|
+
</FormField.Input>
|
|
23
24
|
</FormField>
|
|
24
25
|
<Subtext size="large">Value: {value}</Subtext>
|
|
25
26
|
</>
|
|
@@ -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 {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
5
5
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
6
6
|
|
|
@@ -18,13 +18,14 @@ export default () => {
|
|
|
18
18
|
|
|
19
19
|
return (
|
|
20
20
|
<>
|
|
21
|
-
<FormField
|
|
22
|
-
<
|
|
21
|
+
<FormField as="fieldset">
|
|
22
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
23
|
+
<FormField.Input as={RadioGroup} name={useUniqueId()} onChange={handleChange} value={value}>
|
|
23
24
|
<Radio label="Deep dish" value="deep-dish" />
|
|
24
25
|
<Radio label="Thin" value="thin" />
|
|
25
26
|
<Radio label="Gluten free" ref={glutenFreeRef} value="gluten-free" />
|
|
26
27
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
27
|
-
</
|
|
28
|
+
</FormField.Input>
|
|
28
29
|
</FormField>
|
|
29
30
|
<PrimaryButton onClick={handleClick}>Select Gluten Free</PrimaryButton>
|
|
30
31
|
</>
|
|
@@ -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 isRequired={true} 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 label="Gluten free" value="gluten-free" />
|
|
19
20
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
20
|
-
</
|
|
21
|
+
</FormField.Input>
|
|
21
22
|
</FormField>
|
|
22
23
|
);
|
|
23
24
|
};
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
|
|
@@ -31,6 +31,18 @@ yarn add @workday/canvas-kit-react
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
+
<InformationHighlight style={{margin: '1.5rem 0'}}>
|
|
35
|
+
<InformationHighlight.Icon />
|
|
36
|
+
<InformationHighlight.Heading>Note</InformationHighlight.Heading>
|
|
37
|
+
<InformationHighlight.Body>
|
|
38
|
+
These examples are using FormField from Preview. We can plan to promote this component to the
|
|
39
|
+
Main package in a future major version.
|
|
40
|
+
</InformationHighlight.Body>
|
|
41
|
+
<InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-form-field--basic">
|
|
42
|
+
View Form Field (Preview) Documentation
|
|
43
|
+
</InformationHighlight.Link>
|
|
44
|
+
</InformationHighlight>
|
|
45
|
+
|
|
34
46
|
### Basic Example
|
|
35
47
|
|
|
36
48
|
`Select` supports a
|
|
@@ -76,13 +88,10 @@ trigger an event to change the selected item.
|
|
|
76
88
|
|
|
77
89
|
<ExampleCodeBlock code={HoistedModel} />
|
|
78
90
|
|
|
79
|
-
### Label Position
|
|
80
|
-
|
|
81
|
-
Set the `labelPosition` prop of the wrapping `FormField` to designate the position of the label
|
|
82
|
-
relative to the `Select`. `labelPosition` accepts the following values:
|
|
91
|
+
### Label Position Horizontal
|
|
83
92
|
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
Set the `orientation` prop of the Form Field to designate the position of the label relative to the
|
|
94
|
+
input component. By default, the orientation will be set to `vertical`.
|
|
86
95
|
|
|
87
96
|
<ExampleCodeBlock code={LabelPosition} />
|
|
88
97
|
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -21,17 +21,15 @@ export default () => {
|
|
|
21
21
|
return (
|
|
22
22
|
<Flex flexDirection="column">
|
|
23
23
|
<Select items={options}>
|
|
24
|
-
<FormField
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
label="Contact"
|
|
28
|
-
>
|
|
29
|
-
<Select.Input onChange={e => handleChange(e)} id="alert-select" />
|
|
24
|
+
<FormField error="alert">
|
|
25
|
+
<FormField.Label>Contact</FormField.Label>
|
|
26
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} id="alert-select" />
|
|
30
27
|
<Select.Popper>
|
|
31
28
|
<Select.Card>
|
|
32
29
|
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
33
30
|
</Select.Card>
|
|
34
31
|
</Select.Popper>
|
|
32
|
+
<FormField.Hint>Please choose a form of contact.</FormField.Hint>
|
|
35
33
|
</FormField>
|
|
36
34
|
</Select>
|
|
37
35
|
Selected value: {value}
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -22,8 +22,9 @@ export default () => {
|
|
|
22
22
|
return (
|
|
23
23
|
<Flex flexDirection="column">
|
|
24
24
|
<Select items={options}>
|
|
25
|
-
<FormField
|
|
26
|
-
<
|
|
25
|
+
<FormField>
|
|
26
|
+
<FormField.Label>Contact</FormField.Label>
|
|
27
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} />
|
|
27
28
|
<Select.Popper>
|
|
28
29
|
<Select.Card>
|
|
29
30
|
<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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -30,8 +30,9 @@ export default () => {
|
|
|
30
30
|
return (
|
|
31
31
|
<Flex flexDirection="column">
|
|
32
32
|
<Select items={options} onSelect={handleSelect}>
|
|
33
|
-
<FormField
|
|
34
|
-
<
|
|
33
|
+
<FormField>
|
|
34
|
+
<FormField.Label>Contact</FormField.Label>
|
|
35
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} />
|
|
35
36
|
<Select.Popper>
|
|
36
37
|
<Select.Card>
|
|
37
38
|
<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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -22,8 +22,9 @@ export default () => {
|
|
|
22
22
|
return (
|
|
23
23
|
<Flex flexDirection="column">
|
|
24
24
|
<Select items={options} nonInteractiveIds={['Fax (disabled)']}>
|
|
25
|
-
<FormField
|
|
26
|
-
<
|
|
25
|
+
<FormField>
|
|
26
|
+
<FormField.Label>Contact</FormField.Label>
|
|
27
|
+
<FormField.Input as={Select.Input} disabled onChange={e => handleChange(e)} />
|
|
27
28
|
<Select.Popper>
|
|
28
29
|
<Select.Card>
|
|
29
30
|
<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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -22,8 +22,9 @@ export default () => {
|
|
|
22
22
|
return (
|
|
23
23
|
<Flex flexDirection="column">
|
|
24
24
|
<Select items={options} nonInteractiveIds={['Fax (disabled)', 'Mobile Phone']}>
|
|
25
|
-
<FormField
|
|
26
|
-
<
|
|
25
|
+
<FormField>
|
|
26
|
+
<FormField.Label>Contact</FormField.Label>
|
|
27
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} />
|
|
27
28
|
<Select.Popper>
|
|
28
29
|
<Select.Card>
|
|
29
30
|
<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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -21,12 +21,9 @@ export default () => {
|
|
|
21
21
|
return (
|
|
22
22
|
<Flex flexDirection="column">
|
|
23
23
|
<Select items={options} nonInteractiveIds={['Fax (disabled)']}>
|
|
24
|
-
<FormField
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
label="Contact"
|
|
28
|
-
>
|
|
29
|
-
<Select.Input onChange={e => handleChange(e)} />
|
|
24
|
+
<FormField error="error">
|
|
25
|
+
<FormField.Label>Contact</FormField.Label>
|
|
26
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} />
|
|
30
27
|
<Select.Popper>
|
|
31
28
|
<Select.Card>
|
|
32
29
|
<Select.List>
|
|
@@ -38,6 +35,7 @@ export default () => {
|
|
|
38
35
|
</Select.List>
|
|
39
36
|
</Select.Card>
|
|
40
37
|
</Select.Popper>
|
|
38
|
+
<FormField.Hint>Fax is disabled. Please choose a different option.</FormField.Hint>
|
|
41
39
|
</FormField>
|
|
42
40
|
</Select>
|
|
43
41
|
Selected Value: {value}
|
|
@@ -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 {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -20,8 +20,9 @@ export default () => {
|
|
|
20
20
|
return (
|
|
21
21
|
<Flex>
|
|
22
22
|
<Select model={model}>
|
|
23
|
-
<FormField
|
|
24
|
-
<
|
|
23
|
+
<FormField cs={{width: '100%'}}>
|
|
24
|
+
<FormField.Label>Contact</FormField.Label>
|
|
25
|
+
<FormField.Input grow as={Select.Input} />
|
|
25
26
|
<Select.Popper>
|
|
26
27
|
<Select.Card>
|
|
27
28
|
{model.state.items.length > 0 && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {SecondaryButton} 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 {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
5
5
|
import {BodyText} from '@workday/canvas-kit-react/text';
|
|
6
6
|
|
|
@@ -22,8 +22,9 @@ export default () => {
|
|
|
22
22
|
return (
|
|
23
23
|
<>
|
|
24
24
|
<Select model={model}>
|
|
25
|
-
<FormField
|
|
26
|
-
<
|
|
25
|
+
<FormField>
|
|
26
|
+
<FormField.Label>Contact</FormField.Label>
|
|
27
|
+
<FormField.Input as={Select.Input} />
|
|
27
28
|
<Select.Popper>
|
|
28
29
|
<Select.Card>
|
|
29
30
|
<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 {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -20,8 +20,9 @@ export default () => {
|
|
|
20
20
|
return (
|
|
21
21
|
<Flex>
|
|
22
22
|
<Select model={model}>
|
|
23
|
-
<FormField
|
|
24
|
-
<
|
|
23
|
+
<FormField orientation="horizontal">
|
|
24
|
+
<FormField.Label>Contact</FormField.Label>
|
|
25
|
+
<FormField.Input as={Select.Input} />
|
|
25
26
|
<Select.Popper>
|
|
26
27
|
<Select.Card>
|
|
27
28
|
{model.state.items.length > 0 && (
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -38,9 +38,10 @@ const cities = [
|
|
|
38
38
|
export default () => {
|
|
39
39
|
return (
|
|
40
40
|
<Box>
|
|
41
|
-
<FormField
|
|
41
|
+
<FormField>
|
|
42
|
+
<FormField.Label>Choose a City</FormField.Label>
|
|
42
43
|
<Select items={cities}>
|
|
43
|
-
<Select.Input />
|
|
44
|
+
<FormField.Input as={Select.Input} />
|
|
44
45
|
<Select.Popper>
|
|
45
46
|
<Select.Card maxHeight={200}>
|
|
46
47
|
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
5
5
|
|
|
6
6
|
const options = [
|
|
@@ -14,7 +14,7 @@ const options = [
|
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const [value, setValue] = React.useState('medium');
|
|
17
|
-
const ref = React.useRef
|
|
17
|
+
const ref = React.useRef(null);
|
|
18
18
|
|
|
19
19
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
20
20
|
setValue(event.target.value);
|
|
@@ -28,16 +28,17 @@ export default () => {
|
|
|
28
28
|
|
|
29
29
|
return (
|
|
30
30
|
<>
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
31
|
+
<FormField>
|
|
32
|
+
<Select items={options}>
|
|
33
|
+
<FormField.Label>Contact</FormField.Label>
|
|
34
|
+
<FormField.Input as={Select.Input} ref={ref} onChange={e => handleChange(e)} />
|
|
34
35
|
<Select.Popper>
|
|
35
36
|
<Select.Card>
|
|
36
37
|
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
37
38
|
</Select.Card>
|
|
38
39
|
</Select.Popper>
|
|
39
|
-
</
|
|
40
|
-
</
|
|
40
|
+
</Select>
|
|
41
|
+
</FormField>
|
|
41
42
|
<PrimaryButton onClick={handleClick}>Focus Select</PrimaryButton>
|
|
42
43
|
</>
|
|
43
44
|
);
|
|
@@ -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 {Select} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -21,16 +21,17 @@ export default () => {
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<Flex flexDirection="column">
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
<
|
|
24
|
+
<FormField isRequired>
|
|
25
|
+
<Select items={options}>
|
|
26
|
+
<FormField.Label>Contact</FormField.Label>
|
|
27
|
+
<FormField.Input as={Select.Input} onChange={e => handleChange(e)} />
|
|
27
28
|
<Select.Popper>
|
|
28
29
|
<Select.Card>
|
|
29
30
|
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
30
31
|
</Select.Card>
|
|
31
32
|
</Select.Popper>
|
|
32
|
-
</
|
|
33
|
-
</
|
|
33
|
+
</Select>
|
|
34
|
+
</FormField>
|
|
34
35
|
Selected Value: {value}
|
|
35
36
|
</Flex>
|
|
36
37
|
);
|