@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
|
@@ -14,6 +14,8 @@ import CustomId from './examples/CustomId';
|
|
|
14
14
|
import AllFields from './examples/AllFields';
|
|
15
15
|
import Hint from './examples/Hint';
|
|
16
16
|
import FieldSet from './examples/FieldSet';
|
|
17
|
+
import Grow from './examples/Grow';
|
|
18
|
+
import ThemedError from './examples/ThemedErrors';
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
# Canvas Kit Form Field
|
|
@@ -75,6 +77,15 @@ input component. By default, the orientation will be set to `vertical`.
|
|
|
75
77
|
|
|
76
78
|
<ExampleCodeBlock code={LabelPositionHorizontal} />
|
|
77
79
|
|
|
80
|
+
### Grow
|
|
81
|
+
|
|
82
|
+
Set the `grow` prop of the Form Field to `true` to configure it (including the wrapped input
|
|
83
|
+
component) to expand to the width of its container.
|
|
84
|
+
|
|
85
|
+
**Note: This Prop is deprecated and will be removed in a future major version.**
|
|
86
|
+
|
|
87
|
+
<ExampleCodeBlock code={Grow} />
|
|
88
|
+
|
|
78
89
|
### Ref Forwarding
|
|
79
90
|
|
|
80
91
|
If you need full customization you can use the `FormField` behavior hooks to build your own
|
|
@@ -120,6 +131,13 @@ Form Field should allow you to use it with all `inputs` including `Select`, `Tex
|
|
|
120
131
|
|
|
121
132
|
<ExampleCodeBlock code={AllFields} />
|
|
122
133
|
|
|
134
|
+
### Themed Errors
|
|
135
|
+
|
|
136
|
+
You can theme your error rings by wrapping an input in a `CanvasProvider` and defining
|
|
137
|
+
`focusOutline` and `error` properties on the `theme`.
|
|
138
|
+
|
|
139
|
+
<ExampleCodeBlock code={ThemedError} />
|
|
140
|
+
|
|
123
141
|
## Component API
|
|
124
142
|
|
|
125
143
|
<SymbolDoc name="FormField" fileName="/preview-react/" />
|
|
@@ -18,26 +18,26 @@ export default () => {
|
|
|
18
18
|
borderRadius: '4px',
|
|
19
19
|
}}
|
|
20
20
|
>
|
|
21
|
-
<FormField>
|
|
21
|
+
<FormField grow>
|
|
22
22
|
<FormField.Label>First Name</FormField.Label>
|
|
23
|
-
<FormField.Input
|
|
23
|
+
<FormField.Input as={TextInput} />
|
|
24
24
|
</FormField>
|
|
25
25
|
|
|
26
|
-
<FormField isRequired={true} error="alert">
|
|
26
|
+
<FormField isRequired={true} error="alert" grow>
|
|
27
27
|
<FormField.Label>Email</FormField.Label>
|
|
28
|
-
<FormField.Container
|
|
29
|
-
<FormField.Input
|
|
28
|
+
<FormField.Container>
|
|
29
|
+
<FormField.Input as={TextInput} />
|
|
30
30
|
<FormField.Hint>Hint text for your input</FormField.Hint>
|
|
31
31
|
</FormField.Container>
|
|
32
32
|
</FormField>
|
|
33
|
-
<FormField>
|
|
33
|
+
<FormField grow>
|
|
34
34
|
<FormField.Label>Text Area Label</FormField.Label>
|
|
35
|
-
<FormField.Input
|
|
35
|
+
<FormField.Input as={TextArea} />
|
|
36
36
|
</FormField>
|
|
37
|
-
<FormField error="error"
|
|
37
|
+
<FormField error="error" grow>
|
|
38
38
|
<FormField.Label>Choose a Crust</FormField.Label>
|
|
39
39
|
<Select items={['Pizza', 'Cheeseburger', 'Fries']}>
|
|
40
|
-
<FormField.Input
|
|
40
|
+
<FormField.Input as={Select.Input} />
|
|
41
41
|
<Select.Popper>
|
|
42
42
|
<Select.Card>
|
|
43
43
|
<Select.List>{item => <Select.Item>{item}</Select.Item>}</Select.List>
|
|
@@ -45,7 +45,7 @@ export default () => {
|
|
|
45
45
|
</Select.Popper>
|
|
46
46
|
</Select>
|
|
47
47
|
</FormField>
|
|
48
|
-
<FormField as="fieldset" isRequired={true} error={'error'} orientation="horizontal">
|
|
48
|
+
<FormField as="fieldset" isRequired={true} error={'error'} orientation="horizontal" grow>
|
|
49
49
|
<FormField.Label as="legend">Radio Group Legend</FormField.Label>
|
|
50
50
|
<FormField.Container>
|
|
51
51
|
<FormField.Input as={RadioGroup}>
|
|
@@ -60,14 +60,14 @@ export default () => {
|
|
|
60
60
|
<FormField.Hint>Error Message</FormField.Hint>
|
|
61
61
|
</FormField.Container>
|
|
62
62
|
</FormField>
|
|
63
|
-
<FormField as="fieldset">
|
|
63
|
+
<FormField as="fieldset" grow>
|
|
64
64
|
<FormField.Label as="legend">Checkbox Legend</FormField.Label>
|
|
65
65
|
<FormField.Input checked={true} as={Checkbox} label="Checkbox Label" />
|
|
66
66
|
<FormField.Input checked={false} as={Checkbox} label="Thin Crust" />
|
|
67
67
|
<FormField.Input checked={false} as={Checkbox} label="Extra Cheese" />
|
|
68
68
|
</FormField>
|
|
69
69
|
|
|
70
|
-
<FormField orientation="horizontal">
|
|
70
|
+
<FormField orientation="horizontal" grow>
|
|
71
71
|
<FormField.Label>Switch Label</FormField.Label>
|
|
72
72
|
<FormField.Input as={Switch} />
|
|
73
73
|
</FormField>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
3
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
const [value, setValue] = React.useState('');
|
|
8
|
+
|
|
9
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
10
|
+
setValue(event.target.value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Flex>
|
|
15
|
+
<FormField grow>
|
|
16
|
+
<FormField.Label>First Name</FormField.Label>
|
|
17
|
+
<FormField.Input as={TextInput} value={value} onChange={handleChange} />
|
|
18
|
+
</FormField>
|
|
19
|
+
</Flex>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
3
|
+
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
4
|
+
import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
|
|
5
|
+
import {colors, space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
const [value, setValue] = React.useState('');
|
|
9
|
+
|
|
10
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
11
|
+
setValue(event.target.value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const theme: PartialEmotionCanvasTheme = {
|
|
15
|
+
canvas: {
|
|
16
|
+
palette: {
|
|
17
|
+
common: {
|
|
18
|
+
focusOutline: colors.grapeSoda300,
|
|
19
|
+
},
|
|
20
|
+
error: {
|
|
21
|
+
main: colors.islandPunch400,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<CanvasProvider theme={theme}>
|
|
29
|
+
<FormField error={!value ? 'error' : undefined} isRequired={true} orientation="vertical">
|
|
30
|
+
<FormField.Label>Email</FormField.Label>
|
|
31
|
+
<FormField.Input as={TextInput} onChange={handleChange} value={value} />
|
|
32
|
+
<FormField.Hint paddingTop={space.xxs}>{!value && 'Please enter an email.'}</FormField.Hint>
|
|
33
|
+
</FormField>
|
|
34
|
+
</CanvasProvider>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -19,8 +19,21 @@ yarn add @workday/canvas-kit-react
|
|
|
19
19
|
|
|
20
20
|
### Basic Example
|
|
21
21
|
|
|
22
|
-
`LoadingSparkles` is designed to work out-of-the-box, but you'll need to add
|
|
23
|
-
|
|
22
|
+
`LoadingSparkles` is designed to work out-of-the-box, but you'll need to add some wiring for screen
|
|
23
|
+
readers. In the example below, we're simulating a loading state with a `setTimeout` that's triggered
|
|
24
|
+
when the "Generate Quote" button is clicked.
|
|
25
|
+
|
|
26
|
+
The ARIA live region uses the `aria-label` on `LoadingSparkles` to announce the loading state. And
|
|
27
|
+
it uses the text in `AccessibleHide` to announce when loading is complete. In a real-world
|
|
28
|
+
application, you would probably add another state for loading failures. Also note that generated
|
|
29
|
+
text should live outside the live region. This content doesn't need to be announced to screen
|
|
30
|
+
readers.
|
|
31
|
+
|
|
32
|
+
#### Consolidating ARIA Live Regions
|
|
33
|
+
|
|
34
|
+
In the example, we wrapped `LoadingSparkles` inside our `AriaLiveRegion` component, but in general
|
|
35
|
+
you should not have multiple ARIA live regions on the page at once. If you already have a live
|
|
36
|
+
region, consider sending these loading messages there instead of adding another region.
|
|
24
37
|
|
|
25
38
|
<ExampleCodeBlock code={Basic} />
|
|
26
39
|
|
|
@@ -1,6 +1,64 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
3
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
2
4
|
import {LoadingSparkles} from '@workday/canvas-kit-preview-react/loading-sparkles';
|
|
5
|
+
import {AccessibleHide, AriaLiveRegion} from '@workday/canvas-kit-react/common';
|
|
6
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
7
|
+
|
|
8
|
+
const containerStyles = createStyles({
|
|
9
|
+
minHeight: '3.5rem',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: '0.5rem',
|
|
13
|
+
});
|
|
3
14
|
|
|
4
15
|
export default () => {
|
|
5
|
-
|
|
16
|
+
const [loadingStatus, setLoadingStatus] = React.useState<'idle' | 'loading' | 'success'>('idle');
|
|
17
|
+
const [quote, setQuote] = React.useState('');
|
|
18
|
+
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (loadingStatus === 'loading') {
|
|
21
|
+
const mockLoading = setTimeout(() => {
|
|
22
|
+
setLoadingStatus('success');
|
|
23
|
+
setQuote(getQuote());
|
|
24
|
+
}, 3000);
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
clearTimeout(mockLoading);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}, [loadingStatus]);
|
|
31
|
+
|
|
32
|
+
const handleClick = () => {
|
|
33
|
+
setQuote('');
|
|
34
|
+
setLoadingStatus('loading');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
<div className={containerStyles}>
|
|
40
|
+
{quote && <Text cs={{maxWidth: '60ch'}}>{quote}</Text>}
|
|
41
|
+
<AriaLiveRegion>
|
|
42
|
+
{loadingStatus === 'loading' && <LoadingSparkles aria-label="loading" />}
|
|
43
|
+
{loadingStatus === 'success' && (
|
|
44
|
+
<AccessibleHide role="status">loading complete</AccessibleHide>
|
|
45
|
+
)}
|
|
46
|
+
</AriaLiveRegion>
|
|
47
|
+
</div>
|
|
48
|
+
<SecondaryButton onClick={handleClick}>Generate Quote</SecondaryButton>
|
|
49
|
+
</>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const robotQuotes = [
|
|
54
|
+
'The Zeroth Law: A robot may not harm humanity, or, by inaction, allow humanity to come to harm.',
|
|
55
|
+
'Law 1: A robot may not injure a human being or, through inaction, allow a human being to come to harm.',
|
|
56
|
+
'Law 2: A robot must obey the orders given it by human beings except where such orders would conflict with the First Law.',
|
|
57
|
+
'Law 3: A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.',
|
|
58
|
+
'There is nothing so eternally adhesive as the memory of power.',
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const getQuote = () => {
|
|
62
|
+
const index = Math.floor(Math.random() * robotQuotes.length);
|
|
63
|
+
return robotQuotes[index];
|
|
6
64
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
2
2
|
import {DeprecatedMenu, DeprecatedMenuItem} from '@workday/canvas-kit-preview-react/menu';
|
|
3
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
3
4
|
|
|
4
5
|
import Basic from './examples/Basic';
|
|
5
6
|
import ContextMenu from './examples/ContextMenu';
|
|
@@ -9,7 +10,15 @@ import Headers from './examples/Headers';
|
|
|
9
10
|
import ManyItems from './examples/ManyItems';
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
# Canvas Kit Menu
|
|
13
|
+
# Canvas Kit Menu
|
|
14
|
+
|
|
15
|
+
<StatusIndicator variant="red">
|
|
16
|
+
<StatusIndicator.Label>Deprecated</StatusIndicator.Label>
|
|
17
|
+
</StatusIndicator>
|
|
18
|
+
|
|
19
|
+
`Menu` in Preview been deprecated and will be removed in a future major version. Please use
|
|
20
|
+
[Menu in Main](https://workday.github.io/canvas-kit/?path=/docs/components-popups-menu--basic)
|
|
21
|
+
instead.
|
|
13
22
|
|
|
14
23
|
`DeprecatedMenu` displays a list of options when triggered by an action or UI element like an icon
|
|
15
24
|
or button.
|
|
@@ -73,11 +73,8 @@ It will forward `ref` to its underlying `<input type="radio">` element.
|
|
|
73
73
|
|
|
74
74
|
### Label Position
|
|
75
75
|
|
|
76
|
-
Set the `
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- `FormField.LabelPosition.Top` (Default)
|
|
80
|
-
- `FormField.LabelPosition.Left`
|
|
76
|
+
Set the `orientation` prop of the Form Field to designate the position of the label relative to the
|
|
77
|
+
input component. By default, the orientation will be set to `vertical`.
|
|
81
78
|
|
|
82
79
|
<ExampleCodeBlock code={LabelPosition} />
|
|
83
80
|
|
|
@@ -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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -15,8 +15,15 @@ export default () => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Flex flexDirection="column">
|
|
18
|
-
<FormField
|
|
19
|
-
<
|
|
18
|
+
<FormField as="fieldset">
|
|
19
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
20
|
+
<FormField.Input
|
|
21
|
+
as={RadioGroup}
|
|
22
|
+
name="pizza-crust"
|
|
23
|
+
onChange={handleChange}
|
|
24
|
+
width="200px"
|
|
25
|
+
value={value}
|
|
26
|
+
>
|
|
20
27
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
21
28
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
22
29
|
<RadioGroup.RadioButton value="gluten-free">Gluten free</RadioGroup.RadioButton>
|
|
@@ -24,7 +31,7 @@ export default () => {
|
|
|
24
31
|
<RadioGroup.RadioButton value="custom">
|
|
25
32
|
Butter - the best thing to put on bread
|
|
26
33
|
</RadioGroup.RadioButton>
|
|
27
|
-
</
|
|
34
|
+
</FormField.Input>
|
|
28
35
|
</FormField>
|
|
29
36
|
Value selected: {value}
|
|
30
37
|
</Flex>
|
|
@@ -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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -15,8 +15,15 @@ export default () => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Flex flexDirection="column">
|
|
18
|
-
<FormField
|
|
19
|
-
<
|
|
18
|
+
<FormField as="fieldset">
|
|
19
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
20
|
+
<FormField.Input
|
|
21
|
+
as={RadioGroup}
|
|
22
|
+
name="pizza-crust-custom"
|
|
23
|
+
onChange={handleChange}
|
|
24
|
+
width="200px"
|
|
25
|
+
value={value}
|
|
26
|
+
>
|
|
20
27
|
<RadioGroup.Label>
|
|
21
28
|
<RadioGroup.Label.Input value="deep-dish" />
|
|
22
29
|
<RadioGroup.Label.Text color="berrySmoothie400">Deep dish</RadioGroup.Label.Text>
|
|
@@ -29,7 +36,7 @@ export default () => {
|
|
|
29
36
|
<RadioGroup.Label.Input value="cauliflower" />
|
|
30
37
|
<RadioGroup.Label.Text color="berrySmoothie400">Cauliflower</RadioGroup.Label.Text>
|
|
31
38
|
</RadioGroup.Label>
|
|
32
|
-
</
|
|
39
|
+
</FormField.Input>
|
|
33
40
|
</FormField>
|
|
34
41
|
Value selected: {value}
|
|
35
42
|
</Flex>
|
|
@@ -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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
|
|
5
5
|
export default () => {
|
|
@@ -12,15 +12,16 @@ export default () => {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
return (
|
|
15
|
-
<FormField
|
|
16
|
-
<
|
|
15
|
+
<FormField as="fieldset">
|
|
16
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
17
|
+
<FormField.Input as={RadioGroup} name="crust-disabled" onChange={handleChange} value={value}>
|
|
17
18
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
18
19
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
19
20
|
<RadioGroup.RadioButton disabled value="gluten-free">
|
|
20
21
|
Gluten free (sold out)
|
|
21
22
|
</RadioGroup.RadioButton>
|
|
22
23
|
<RadioGroup.RadioButton value="cauliflower">Cauliflower</RadioGroup.RadioButton>
|
|
23
|
-
</
|
|
24
|
+
</FormField.Input>
|
|
24
25
|
</FormField>
|
|
25
26
|
);
|
|
26
27
|
};
|
|
@@ -13,7 +13,7 @@ export default () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<FormField error="error">
|
|
16
|
+
<FormField error="error" as="fieldset">
|
|
17
17
|
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
18
18
|
<FormField.Input as={RadioGroup} name="crust-error" onChange={handleChange} value={value}>
|
|
19
19
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Box} from '@workday/canvas-kit-react/layout';
|
|
3
3
|
import {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
|
-
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
|
-
import {styled} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
5
|
+
import {styled, StyledType} from '@workday/canvas-kit-react/common';
|
|
6
6
|
import {colors} from '@workday/canvas-kit-react/tokens';
|
|
7
7
|
|
|
8
|
-
const StyledFormField = styled(FormField)({
|
|
8
|
+
const StyledFormField = styled(FormField)<StyledType>({
|
|
9
9
|
legend: {
|
|
10
10
|
color: colors.frenchVanilla100,
|
|
11
11
|
},
|
|
@@ -23,12 +23,9 @@ export default () => {
|
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<Box backgroundColor="blueberry400" padding="s">
|
|
26
|
-
<StyledFormField
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
useFieldset={true}
|
|
30
|
-
>
|
|
31
|
-
<RadioGroup name="crust-inverse" onChange={handleChange} value={value}>
|
|
26
|
+
<StyledFormField as="fieldset">
|
|
27
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
28
|
+
<FormField.Input as={RadioGroup} name="crust-inverse" onChange={handleChange} value={value}>
|
|
32
29
|
<RadioGroup.RadioButton variant="inverse" value="deep-dish">
|
|
33
30
|
Deep dish
|
|
34
31
|
</RadioGroup.RadioButton>
|
|
@@ -41,7 +38,7 @@ export default () => {
|
|
|
41
38
|
<RadioGroup.RadioButton variant="inverse" value="cauliflower">
|
|
42
39
|
Cauliflower
|
|
43
40
|
</RadioGroup.RadioButton>
|
|
44
|
-
</
|
|
41
|
+
</FormField.Input>
|
|
45
42
|
</StyledFormField>
|
|
46
43
|
</Box>
|
|
47
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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
|
|
5
5
|
export default () => {
|
|
@@ -12,17 +12,14 @@ export default () => {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
return (
|
|
15
|
-
<FormField
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
useFieldset={true}
|
|
19
|
-
>
|
|
20
|
-
<RadioGroup name="crust-label" onChange={handleChange} value={value}>
|
|
15
|
+
<FormField orientation="horizontal" as="fieldset">
|
|
16
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
17
|
+
<FormField.Input as={RadioGroup} name="crust-label" onChange={handleChange} value={value}>
|
|
21
18
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
22
19
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
23
20
|
<RadioGroup.RadioButton value="gluten-free">Gluten free</RadioGroup.RadioButton>
|
|
24
21
|
<RadioGroup.RadioButton value="cauliflower">Cauliflower</RadioGroup.RadioButton>
|
|
25
|
-
</
|
|
22
|
+
</FormField.Input>
|
|
26
23
|
</FormField>
|
|
27
24
|
);
|
|
28
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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
|
|
5
5
|
export default () => {
|
|
@@ -12,17 +12,14 @@ export default () => {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
return (
|
|
15
|
-
<FormField
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
useFieldset={true}
|
|
19
|
-
>
|
|
20
|
-
<RadioGroup name="crust-no-value" onChange={handleChange} value={value}>
|
|
15
|
+
<FormField as="fieldset">
|
|
16
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
17
|
+
<FormField.Input as={RadioGroup} name="crust-no-value" onChange={handleChange} value={value}>
|
|
21
18
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
22
19
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
23
20
|
<RadioGroup.RadioButton value="gluten-free">Gluten free</RadioGroup.RadioButton>
|
|
24
21
|
<RadioGroup.RadioButton value="cauliflower">Cauliflower</RadioGroup.RadioButton>
|
|
25
|
-
</
|
|
22
|
+
</FormField.Input>
|
|
26
23
|
</FormField>
|
|
27
24
|
);
|
|
28
25
|
};
|
|
@@ -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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
@@ -20,15 +20,16 @@ export default () => {
|
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<>
|
|
23
|
-
<FormField
|
|
24
|
-
<
|
|
23
|
+
<FormField as="fieldset">
|
|
24
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
25
|
+
<FormField.Input as={RadioGroup} name="crust-ref" onChange={handleChange} value={value}>
|
|
25
26
|
<RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
|
|
26
27
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
27
28
|
<RadioGroup.RadioButton value="gluten-free" ref={glutenFreeRef}>
|
|
28
29
|
Gluten free
|
|
29
30
|
</RadioGroup.RadioButton>
|
|
30
31
|
<RadioGroup.RadioButton value="cauliflower">Cauliflower</RadioGroup.RadioButton>
|
|
31
|
-
</
|
|
32
|
+
</FormField.Input>
|
|
32
33
|
</FormField>
|
|
33
34
|
<PrimaryButton onClick={handleClick}>Select Gluten Free</PrimaryButton>
|
|
34
35
|
</>
|
|
@@ -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 {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
|
|
5
5
|
export default () => {
|
|
@@ -12,14 +12,10 @@ export default () => {
|
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
14
|
return (
|
|
15
|
-
<FormField
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
hintText="You must choose a crust"
|
|
20
|
-
hintId="choose-crust"
|
|
21
|
-
>
|
|
22
|
-
<RadioGroup
|
|
15
|
+
<FormField isRequired={true} as="fieldset">
|
|
16
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
17
|
+
<FormField.Input
|
|
18
|
+
as={RadioGroup}
|
|
23
19
|
name="crust-required"
|
|
24
20
|
onChange={handleChange}
|
|
25
21
|
value={value}
|
|
@@ -29,7 +25,8 @@ export default () => {
|
|
|
29
25
|
<RadioGroup.RadioButton value="thin">Thin</RadioGroup.RadioButton>
|
|
30
26
|
<RadioGroup.RadioButton value="gluten-free">Gluten free</RadioGroup.RadioButton>
|
|
31
27
|
<RadioGroup.RadioButton value="cauliflower">Cauliflower</RadioGroup.RadioButton>
|
|
32
|
-
</
|
|
28
|
+
</FormField.Input>
|
|
29
|
+
<FormField.Hint>You must choose a crust</FormField.Hint>
|
|
33
30
|
</FormField>
|
|
34
31
|
);
|
|
35
32
|
};
|
|
@@ -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 {StyledRadioButton} from '@workday/canvas-kit-preview-react/radio';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
|
|
@@ -15,10 +15,12 @@ export default () => {
|
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<Flex flexDirection="column">
|
|
18
|
-
<FormField
|
|
18
|
+
<FormField as="fieldset">
|
|
19
|
+
<FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
|
|
19
20
|
<Flex gap="m">
|
|
20
21
|
<Flex as="label" gap="xs">
|
|
21
|
-
<
|
|
22
|
+
<FormField.Input
|
|
23
|
+
as={StyledRadioButton}
|
|
22
24
|
onChange={handleChange}
|
|
23
25
|
value="deep-dish"
|
|
24
26
|
name="pizza-crust-standalone"
|
|
@@ -27,7 +29,8 @@ export default () => {
|
|
|
27
29
|
Deep dish
|
|
28
30
|
</Flex>
|
|
29
31
|
<Flex as="label" gap="xs">
|
|
30
|
-
<
|
|
32
|
+
<FormField.Input
|
|
33
|
+
as={StyledRadioButton}
|
|
31
34
|
onChange={handleChange}
|
|
32
35
|
value="gluten-free"
|
|
33
36
|
checked={value === 'gluten-free'}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
2
2
|
|
|
3
3
|
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
4
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
4
5
|
|
|
5
6
|
import Alert from './examples/Alert';
|
|
6
7
|
import Basic from './examples/Basic';
|
|
@@ -18,6 +19,14 @@ import ResizeConstraints from './examples/ResizeConstraints';
|
|
|
18
19
|
|
|
19
20
|
# Canvas Kit Text Area
|
|
20
21
|
|
|
22
|
+
<StatusIndicator variant="red">
|
|
23
|
+
<StatusIndicator.Label>Deprecated</StatusIndicator.Label>
|
|
24
|
+
</StatusIndicator>
|
|
25
|
+
|
|
26
|
+
`TextArea` in Preview has been deprecated and will be removed in a future major version. Please use
|
|
27
|
+
[`FormField` in Preview](https://workday.github.io/canvas-kit/?path=/story/preview-inputs-form-field--basic)
|
|
28
|
+
instead.
|
|
29
|
+
|
|
21
30
|
TextArea's allow users to enter and edit multiple lines of text.
|
|
22
31
|
|
|
23
32
|
[> Workday Design Reference](https://design.workday.com/components/inputs/text-area)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
2
2
|
|
|
3
3
|
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
4
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
4
5
|
|
|
5
6
|
import Basic from './examples/Basic';
|
|
6
7
|
import Disabled from './examples/Disabled';
|
|
@@ -22,6 +23,14 @@ import Alert from './examples/Alert';
|
|
|
22
23
|
|
|
23
24
|
# Canvas Kit Text Input
|
|
24
25
|
|
|
26
|
+
<StatusIndicator variant="red">
|
|
27
|
+
<StatusIndicator.Label>Deprecated</StatusIndicator.Label>
|
|
28
|
+
</StatusIndicator>
|
|
29
|
+
|
|
30
|
+
`TextInput` in Preview has been deprecated and will be removed in a future major version. Please use
|
|
31
|
+
[`FormField` in Preview](https://workday.github.io/canvas-kit/?path=/story/preview-inputs-form-field--basic)
|
|
32
|
+
instead.
|
|
33
|
+
|
|
25
34
|
Text Inputs allow users to enter words or characters without styling.
|
|
26
35
|
|
|
27
36
|
[> Workday Design Reference](https://design.workday.com/components/inputs/text-input)
|
|
@@ -68,8 +77,9 @@ of the immutiblity.
|
|
|
68
77
|
|
|
69
78
|
### Hidden
|
|
70
79
|
|
|
71
|
-
Set `TextInput.Field`'s `type` prop to
|
|
72
|
-
|
|
80
|
+
Set `TextInput.Field`'s `type` prop to `hidden` to completly hide a field while still submitting its
|
|
81
|
+
value, often used for things like security tokens. Note: You will likely need to manually
|
|
82
|
+
set`aria-describedby={undefined}`and`id={undefined}`
|
|
73
83
|
|
|
74
84
|
<ExampleCodeBlock code={Hidden} />
|
|
75
85
|
|