@workday/canvas-kit-docs 14.0.0-alpha.1230-next.0 → 14.0.0-alpha.1234-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 +138 -980
- package/dist/es6/mdx/installBlock.d.ts.map +1 -1
- package/dist/es6/mdx/installBlock.js +4 -1
- package/dist/es6/mdx/welcomePage.d.ts.map +1 -1
- package/dist/es6/mdx/welcomePage.js +1 -1
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +84 -36
- package/dist/mdx/MAINTAINING.mdx +4 -4
- package/dist/mdx/PACKAGES.mdx +9 -10
- package/dist/mdx/labs-react/combobox/Combobox.mdx +1 -1
- package/dist/mdx/labs-react/search-form/SearchForm.mdx +21 -4
- package/dist/mdx/preview-react/_examples/mdx/examples/TextInputWithFormik.tsx +35 -28
- package/dist/mdx/preview-react/_examples/mdx/examples/TextInputWithReactHookForm.tsx +27 -21
- package/dist/mdx/preview-react/divider/Divider.mdx +15 -5
- package/dist/mdx/preview-react/pill/Pill.mdx +4 -4
- package/dist/mdx/preview-react/radio/Radio.mdx +2 -2
- package/dist/mdx/preview-react/select/Select.mdx +1 -1
- package/dist/mdx/preview-react/status-indicator/StatusIndicator.mdx +2 -2
- package/dist/mdx/react/_examples/mdx/Layouts.mdx +1 -1
- package/dist/mdx/react/_examples/mdx/examples/common/FilterListWithLiveStatus.tsx +8 -5
- package/dist/mdx/react/_examples/mdx/examples/common/HiddenLiveRegion.tsx +8 -5
- package/dist/mdx/react/_examples/mdx/examples/common/TextInputWithLiveError.tsx +11 -8
- package/dist/mdx/react/_examples/mdx/examples/common/VisibleLiveRegion.tsx +9 -5
- package/dist/mdx/react/avatar/avatar/Avatar.mdx +10 -4
- package/dist/mdx/react/button/button/Button.mdx +21 -16
- package/dist/mdx/react/card/card.mdx +1 -1
- package/dist/mdx/react/checkbox/Checkbox.mdx +5 -5
- package/dist/mdx/react/combobox/Combobox.mdx +2 -2
- package/dist/mdx/react/form-field/FormField.mdx +2 -2
- package/dist/mdx/react/select/Select.mdx +6 -6
- package/dist/mdx/react/status-indicator/StatusIndicator.mdx +1 -1
- package/dist/mdx/react/switch/Switch.mdx +5 -5
- package/dist/mdx/react/table/Table.mdx +26 -13
- package/dist/mdx/react/text/BodyText.mdx +2 -2
- package/dist/mdx/react/text/Heading.mdx +2 -2
- package/dist/mdx/react/text/Subtext.mdx +2 -2
- package/dist/mdx/react/text/Text.mdx +2 -2
- package/dist/mdx/react/text/Title.mdx +2 -2
- package/dist/mdx/style-props/STYLE_PROPS.mdx +1 -1
- package/dist/mdx/styling/mdx/CustomizingStyles.mdx +8 -8
- package/dist/mdx/styling/mdx/Overview.mdx +7 -3
- package/dist/mdx/tokens/TokenMigrationFinal.mdx +1 -1
- package/package.json +6 -6
- package/dist/mdx/preview-react/text-area/TextArea.mdx +0 -136
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +0 -35
- package/dist/mdx/preview-react/text-area/examples/Basic.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Error.tsx +0 -40
- package/dist/mdx/preview-react/text-area/examples/Grow.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +0 -22
- package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +0 -28
- package/dist/mdx/preview-react/text-area/examples/Required.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +0 -22
- package/dist/mdx/preview-react/text-input/TextInput.mdx +0 -170
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +0 -33
- package/dist/mdx/preview-react/text-input/examples/Basic.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Error.tsx +0 -40
- package/dist/mdx/preview-react/text-input/examples/Grow.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Hidden.tsx +0 -11
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +0 -22
- package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Password.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/ReadOnly.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +0 -28
- package/dist/mdx/preview-react/text-input/examples/Required.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +0 -51
- package/dist/mdx/preview-react/text-input/examples/ThemedError.tsx +0 -40
- package/dist/mdx/react/_examples/mdx/SearchForm.mdx +0 -19
- package/dist/mdx/react/_examples/mdx/examples/SearchFormBasic.tsx +0 -35
|
@@ -11,9 +11,9 @@ here are the following options:
|
|
|
11
11
|
|
|
12
12
|
### Using `createStyles` with `cs` prop
|
|
13
13
|
|
|
14
|
-
Use `createStyles` in tandem with `cs` prop when you're overriding static styles and making small
|
|
15
|
-
existing Canvas Kit component like padding, color and flex properties. Take our
|
|
16
|
-
an example.
|
|
14
|
+
Use `createStyles` in tandem with `cs` prop when you're overriding static styles and making small
|
|
15
|
+
modifications to an existing Canvas Kit component like padding, color and flex properties. Take our
|
|
16
|
+
`Text` component as an example.
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
19
19
|
import {createStyles} from '@Workday/canvas-kit-styling';
|
|
@@ -45,8 +45,8 @@ const uppercaseTextStyles = createStyles({
|
|
|
45
45
|
<Text className={uppercaseTextStyles}>My uppercased text</Text>;
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
If you need to dynamically apply styles based on some state or prop, use [Stencils](#stencils)
|
|
49
|
-
|
|
48
|
+
If you need to dynamically apply styles based on some state or prop, use [Stencils](#stencils)
|
|
49
|
+
instead.
|
|
50
50
|
|
|
51
51
|
## Stencils
|
|
52
52
|
|
|
@@ -54,8 +54,8 @@ Stencils can be useful when applying dynamic styles or building your own reusabl
|
|
|
54
54
|
|
|
55
55
|
### Extending Stencils
|
|
56
56
|
|
|
57
|
-
[Stencils](https://workday.github.io/canvas-kit/?path=/docs/styling-
|
|
58
|
-
organize the styling of reusable components into base styles, modifiers, and variables. The
|
|
57
|
+
[Stencils](https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-create-stencil--docs)
|
|
58
|
+
help you organize the styling of reusable components into base styles, modifiers, and variables. The
|
|
59
59
|
organization makes it more natural to produce static and clean CSS with optional extraction into CSS
|
|
60
60
|
files.
|
|
61
61
|
|
|
@@ -175,5 +175,5 @@ const NavIcon = ({
|
|
|
175
175
|
```
|
|
176
176
|
|
|
177
177
|
Another example of Stencil extension and customization is our
|
|
178
|
-
[CustomButton](https://workday.github.io/canvas-kit/?path=/story/components-buttons--custom-styles)
|
|
178
|
+
[CustomButton](https://workday.github.io/canvas-kit/?path=/story/components-buttons--docs#custom-styles)
|
|
179
179
|
example. This example highlights the power of inheritance that you get from extending stencils.
|
|
@@ -17,7 +17,7 @@ static parsing process for build time. This system offers several key benefits:
|
|
|
17
17
|
|
|
18
18
|
The motivation behind this custom styling solution stems from the need to move beyond IE11 support
|
|
19
19
|
and implement performance improvements using static styling methods. For more details, refer to the
|
|
20
|
-
[Why Canvas Kit Styling](https://workday.github.io/canvas-kit/?path=/docs/styling-why-canvas-styling--docs)
|
|
20
|
+
[Why Canvas Kit Styling](https://workday.github.io/canvas-kit/?path=/docs/styling-guides-why-canvas-styling--docs)
|
|
21
21
|
section.
|
|
22
22
|
|
|
23
23
|
## Overview
|
|
@@ -326,7 +326,9 @@ together and applies `className` and `style` attributes to a React element.
|
|
|
326
326
|
<InformationHighlight.Icon />
|
|
327
327
|
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
328
328
|
<InformationHighlight.Body>
|
|
329
|
-
For a more in depth overview, please view our
|
|
329
|
+
For a more in depth overview, please view our [Create
|
|
330
|
+
Styles](https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-create-styles--docs)
|
|
331
|
+
docs.
|
|
330
332
|
</InformationHighlight.Body>
|
|
331
333
|
</InformationHighlight>
|
|
332
334
|
|
|
@@ -396,6 +398,8 @@ const ThemedCard = ({isDarkTheme, headerColor, elemProps}) => {
|
|
|
396
398
|
<InformationHighlight.Icon />
|
|
397
399
|
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
398
400
|
<InformationHighlight.Body>
|
|
399
|
-
For a more in depth overview, please view our
|
|
401
|
+
For a more in depth overview, please view our [Create
|
|
402
|
+
Stencil](https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-create-stencil--docs)
|
|
403
|
+
docs.
|
|
400
404
|
</InformationHighlight.Body>
|
|
401
405
|
</InformationHighlight>
|
|
@@ -196,6 +196,6 @@ After completing the token migration:
|
|
|
196
196
|
## Resources
|
|
197
197
|
|
|
198
198
|
- [Canvas Tokens Documentation](https://canvas.workday.com/styles/tokens/)
|
|
199
|
-
- [Canvas Kit Styling Documentation](https://workday.github.io/canvas-kit/?path=/docs/
|
|
199
|
+
- [Canvas Kit Styling Documentation](https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-overview--docs)
|
|
200
200
|
- [Token Migration Discussion](https://github.com/Workday/canvas-tokens/discussions/77)
|
|
201
201
|
- [Canvas Kit GitHub Repository](https://github.com/Workday/canvas-kit)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1234-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.1234-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.1234-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.0.0-alpha.1234-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.0.0-alpha.1234-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.35",
|
|
53
53
|
"@workday/canvas-tokens-web": "3.0.0-alpha.12",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "782f4efdb11b1729f0a706c900be60cfe1910391"
|
|
65
65
|
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExampleCodeBlock,
|
|
3
|
-
StorybookStatusIndicator,
|
|
4
|
-
SymbolDoc,
|
|
5
|
-
Specifications,
|
|
6
|
-
} from '@workday/canvas-kit-docs';
|
|
7
|
-
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
8
|
-
|
|
9
|
-
import Alert from './examples/Alert';
|
|
10
|
-
import Basic from './examples/Basic';
|
|
11
|
-
import Disabled from './examples/Disabled';
|
|
12
|
-
import Error from './examples/Error';
|
|
13
|
-
import Grow from './examples/Grow';
|
|
14
|
-
import LabelPositionVertical from './examples/LabelPositionVertical';
|
|
15
|
-
import LabelPositionHorizontal from './examples/LabelPositionHorizontal';
|
|
16
|
-
import HiddenLabel from './examples/HiddenLabel';
|
|
17
|
-
import Placeholder from './examples/Placeholder';
|
|
18
|
-
import RefForwarding from './examples/RefForwarding';
|
|
19
|
-
import Required from './examples/Required';
|
|
20
|
-
import ResizeConstraints from './examples/ResizeConstraints';
|
|
21
|
-
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
# Canvas Kit Text Area <StorybookStatusIndicator type="deprecated" />
|
|
25
|
-
|
|
26
|
-
<InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
|
|
27
|
-
<InformationHighlight.Icon />
|
|
28
|
-
<InformationHighlight.Body>
|
|
29
|
-
`TextArea` in Preview has been deprecated and will be removed in a future major version. Please
|
|
30
|
-
use `TextArea` in Main instead.
|
|
31
|
-
</InformationHighlight.Body>
|
|
32
|
-
<InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/components-inputs-textarea--docs">
|
|
33
|
-
Text Area Docs
|
|
34
|
-
</InformationHighlight.Link>
|
|
35
|
-
</InformationHighlight>
|
|
36
|
-
|
|
37
|
-
TextArea's allow users to enter and edit multiple lines of text.
|
|
38
|
-
|
|
39
|
-
[> Workday Design Reference](https://design.workday.com/components/inputs/text-area)
|
|
40
|
-
|
|
41
|
-
## Installation
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
yarn add @workday/canvas-kit-preview-react
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
### Basic Example
|
|
50
|
-
|
|
51
|
-
<ExampleCodeBlock code={Basic} />
|
|
52
|
-
|
|
53
|
-
### Disabled
|
|
54
|
-
|
|
55
|
-
Use `TextArea.Field`'s `disabled` prop to prevent users from interacting with the field.
|
|
56
|
-
|
|
57
|
-
<ExampleCodeBlock code={Disabled} />
|
|
58
|
-
|
|
59
|
-
### Placeholder
|
|
60
|
-
|
|
61
|
-
Use `TextArea.Field`'s `placeholder` prop to display a sample of its expected format or value before
|
|
62
|
-
a value has been provided.
|
|
63
|
-
|
|
64
|
-
<ExampleCodeBlock code={Placeholder} />
|
|
65
|
-
|
|
66
|
-
### Required
|
|
67
|
-
|
|
68
|
-
Use `TextArea.Field`'s `isRequired` prop (or use with the `useTextAreaModel` hook) to indicate that
|
|
69
|
-
the field is required. This will also add a red asterisk to `TextArea.Label`.
|
|
70
|
-
|
|
71
|
-
<ExampleCodeBlock code={Required} />
|
|
72
|
-
|
|
73
|
-
### Ref Forwarding
|
|
74
|
-
|
|
75
|
-
`TextArea` supports [ref forwarding](https://reactjs.org/docs/forwarding-refs.html). It will forward
|
|
76
|
-
`ref` to its underlying `<textarea>` element.
|
|
77
|
-
|
|
78
|
-
<ExampleCodeBlock code={RefForwarding} />
|
|
79
|
-
|
|
80
|
-
### Resize Constraints
|
|
81
|
-
|
|
82
|
-
Use the `resize` css attribute to restrict resizing of it to certain dimensions.
|
|
83
|
-
|
|
84
|
-
<ExampleCodeBlock code={ResizeConstraints} />
|
|
85
|
-
|
|
86
|
-
### Grow
|
|
87
|
-
|
|
88
|
-
There are lots of ways to accomplish this. The `TextArea.Field` extends from Box so it is easy to
|
|
89
|
-
extend full width, e.g. setting width prop to 100%, or you can set the `alignItems` prop to
|
|
90
|
-
`stretch` on `TextArea`, etc.
|
|
91
|
-
|
|
92
|
-
<ExampleCodeBlock code={Grow} />
|
|
93
|
-
|
|
94
|
-
### Label Position
|
|
95
|
-
|
|
96
|
-
Use the `orientation` property to set `TextArea.Label`'s position. You can override the default
|
|
97
|
-
spacing using the `gap` prop. Below are examples of both positions:
|
|
98
|
-
|
|
99
|
-
#### Horizontal
|
|
100
|
-
|
|
101
|
-
<ExampleCodeBlock code={LabelPositionHorizontal} />
|
|
102
|
-
|
|
103
|
-
#### Vertical
|
|
104
|
-
|
|
105
|
-
<ExampleCodeBlock code={LabelPositionVertical} />
|
|
106
|
-
|
|
107
|
-
### Visually Hiding The Label
|
|
108
|
-
|
|
109
|
-
If your label is just for screen reader users you can use the `accessibleHide` utility class from
|
|
110
|
-
`@workday/canvas-kit-react/common`. You will likely want to set the `gap` prop on `TextArea` to
|
|
111
|
-
`zero`.
|
|
112
|
-
|
|
113
|
-
<ExampleCodeBlock code={HiddenLabel} />
|
|
114
|
-
|
|
115
|
-
### Error States
|
|
116
|
-
|
|
117
|
-
Use the `hasError` property from `useTextAreaModel` to set the `TextArea` to the Error state. If you
|
|
118
|
-
have an accompanying hint you can use the `TextArea.Hint` subcomponent.
|
|
119
|
-
|
|
120
|
-
<ExampleCodeBlock code={Error} />
|
|
121
|
-
|
|
122
|
-
### Other Visual States
|
|
123
|
-
|
|
124
|
-
Use the `useThemedRing` hook to change the visual state of the `<textarea>` element.
|
|
125
|
-
|
|
126
|
-
#### Alert
|
|
127
|
-
|
|
128
|
-
<ExampleCodeBlock code={Alert} />
|
|
129
|
-
|
|
130
|
-
## Component API
|
|
131
|
-
|
|
132
|
-
<SymbolDoc name="TextArea" fileName="/preview-react/" />
|
|
133
|
-
|
|
134
|
-
## Specifications
|
|
135
|
-
|
|
136
|
-
<Specifications file="TextAreaPreview.spec.ts" name="Text Area" />
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
import {useThemedRing} from '@workday/canvas-kit-react/common';
|
|
4
|
-
import {space, colors} from '@workday/canvas-kit-react/tokens';
|
|
5
|
-
import {Text} from '@workday/canvas-kit-react/text';
|
|
6
|
-
|
|
7
|
-
export default () => {
|
|
8
|
-
const [value, setValue] = React.useState('Hello');
|
|
9
|
-
|
|
10
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
11
|
-
setValue(event.target.value.slice(0, 10));
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const alertStyles = useThemedRing(
|
|
15
|
-
value.length < 3 ? 'success' : value.length < 7 ? 'alert' : 'error'
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const hintColor =
|
|
19
|
-
value.length < 3
|
|
20
|
-
? colors.greenApple600
|
|
21
|
-
: value.length < 7
|
|
22
|
-
? colors.blackPepper300
|
|
23
|
-
: colors.cinnamon500;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<TextArea orientation="vertical">
|
|
27
|
-
<TextArea.Label>Add a comment</TextArea.Label>
|
|
28
|
-
<TextArea.Field cs={alertStyles} onChange={handleChange} value={value} />
|
|
29
|
-
<TextArea.Hint paddingTop={space.xxs}>
|
|
30
|
-
<strong>Character Limit: </strong>
|
|
31
|
-
<Text color={hintColor}>{10 - value.length} Left</Text>
|
|
32
|
-
</TextArea.Hint>
|
|
33
|
-
</TextArea>
|
|
34
|
-
);
|
|
35
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="vertical">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="vertical">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field disabled onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
import {space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('four');
|
|
7
|
-
const [hint, setHint] = React.useState('');
|
|
8
|
-
const [hasError, setHasError] = React.useState(false);
|
|
9
|
-
|
|
10
|
-
const validateInput = (value: string) => {
|
|
11
|
-
const stringLength = value.length;
|
|
12
|
-
if (stringLength !== 3) {
|
|
13
|
-
setHasError(true);
|
|
14
|
-
const hintStart = 'Word length must be';
|
|
15
|
-
setHint(stringLength < 3 ? `${hintStart} greater than 2` : `${hintStart} less than 4`);
|
|
16
|
-
} else {
|
|
17
|
-
setHasError(false);
|
|
18
|
-
setHint('');
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
validateInput(value);
|
|
24
|
-
// Only run on load
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
29
|
-
validateInput(event.target.value);
|
|
30
|
-
setValue(event.target.value);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<TextArea error={hasError ? 'error' : undefined} orientation="vertical">
|
|
35
|
-
<TextArea.Label>A three letter word</TextArea.Label>
|
|
36
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
37
|
-
<TextArea.Hint paddingTop={space.xxs}>{hint}</TextArea.Hint>
|
|
38
|
-
</TextArea>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="vertical" alignItems="stretch">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
import {accessibleHide, styled} from '@workday/canvas-kit-react/common';
|
|
4
|
-
|
|
5
|
-
const StyledTextAreaLabel = styled(TextArea.Label)({
|
|
6
|
-
...accessibleHide,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export default () => {
|
|
10
|
-
const [value, setValue] = React.useState('');
|
|
11
|
-
|
|
12
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
13
|
-
setValue(event.target.value);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<TextArea orientation="vertical" gap="zero">
|
|
18
|
-
<StyledTextAreaLabel>Email</StyledTextAreaLabel>
|
|
19
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
20
|
-
</TextArea>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="horizontalStart">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="vertical" gap="xxxs">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea orientation="vertical">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field placeholder="Let us know how we did!" onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {changeFocus} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
5
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
6
|
-
|
|
7
|
-
export default () => {
|
|
8
|
-
const [value, setValue] = React.useState('');
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
|
|
11
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
12
|
-
setValue(event.target.value);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const handleClick = () => {
|
|
16
|
-
changeFocus(ref.current);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Flex gap="xxxs" alignItems="flex-start" flexDirection="column">
|
|
21
|
-
<TextArea orientation="vertical">
|
|
22
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
23
|
-
<TextArea.Field onChange={handleChange} value={value} ref={ref} />
|
|
24
|
-
</TextArea>
|
|
25
|
-
<SecondaryButton onClick={handleClick}>Focus Text Area</SecondaryButton>
|
|
26
|
-
</Flex>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextArea isRequired={true} orientation="vertical">
|
|
13
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
14
|
-
<TextArea.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextArea>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
3
|
-
import {styled} from '@workday/canvas-kit-react/common';
|
|
4
|
-
|
|
5
|
-
const StyledField = styled(TextArea.Field)({
|
|
6
|
-
resize: 'vertical',
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export default () => {
|
|
10
|
-
const [value, setValue] = React.useState('');
|
|
11
|
-
|
|
12
|
-
const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
13
|
-
setValue(event.target.value);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<TextArea orientation="vertical">
|
|
18
|
-
<TextArea.Label>Leave a review</TextArea.Label>
|
|
19
|
-
<StyledField onChange={handleChange} value={value} />
|
|
20
|
-
</TextArea>
|
|
21
|
-
);
|
|
22
|
-
};
|