@workday/canvas-kit-docs 14.0.0-alpha.1229-next.0 → 14.0.0-alpha.1233-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 +266 -1710
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +99 -30
- package/dist/mdx/labs-react/combobox/Combobox.mdx +1 -1
- package/dist/mdx/labs-react/search-form/SearchForm.mdx +14 -2
- 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/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/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
|
@@ -26,13 +26,17 @@ any questions.
|
|
|
26
26
|
- [Avatar in Main](#avatar-in-main)
|
|
27
27
|
- [Combobox (Labs)](#combobox-labs)
|
|
28
28
|
- [Radio (Main)](#radio-main)
|
|
29
|
+
- [SearchForm (Labs)](#search-form-labs)
|
|
29
30
|
- [Segmented Control (Main)](#segmented-control-main)
|
|
30
31
|
- [Side Panel (Main)](#side-panel-main)
|
|
31
32
|
- [Tokens](#tokens)
|
|
32
33
|
- [Removals](#removals)
|
|
33
34
|
- [Deprecated Buttons](#deprecated-buttons)
|
|
35
|
+
- [Input Provider](#input-provider)
|
|
34
36
|
- [Menu (preview)](#menu-preview)
|
|
35
|
-
- [readyOnlyPillStencil and removeablePillStencil]
|
|
37
|
+
- [readyOnlyPillStencil and removeablePillStencil](readyOnlyPillStencil-and-removeablePillStencil)
|
|
38
|
+
- [Text Area](#text-area)
|
|
39
|
+
- [Text Input](#text-input)
|
|
36
40
|
- [Troubleshooting](#troubleshooting)
|
|
37
41
|
- [Glossary](#glossary)
|
|
38
42
|
- [Main](#main)
|
|
@@ -104,42 +108,48 @@ yarn remove @workday/canvas-kit-codemod
|
|
|
104
108
|
|
|
105
109
|
### Canvas Provider 🚨
|
|
106
110
|
|
|
107
|
-
**PRs:** [#3407](https://github.com/Workday/canvas-kit/pull/3407),
|
|
111
|
+
**PRs:** [#3407](https://github.com/Workday/canvas-kit/pull/3407),
|
|
112
|
+
[#3394](https://github.com/Workday/canvas-kit/pull/3394)
|
|
108
113
|
|
|
109
114
|
- `CanvasThemePalette` and `CanvasTheme` type have been updated to include a `lighter` property.
|
|
110
115
|
- `CanvasProvider` `theme` prop has been updated to include a `lighter` color for each palette.
|
|
111
116
|
|
|
112
117
|
#### Breaking Changes
|
|
113
118
|
|
|
114
|
-
Canvas Provider has been updated to **remove** default branding colors to ensure proper cascading of
|
|
119
|
+
Canvas Provider has been updated to **remove** default branding colors to ensure proper cascading of
|
|
120
|
+
our CSS variables. Instead of generating a palette and shifting the brightness and darkness with
|
|
121
|
+
`chroma.js`, we use `oklch` to generate the palette colors.
|
|
115
122
|
|
|
116
|
-
**Before in v13**
|
|
117
|
-
|
|
123
|
+
**Before in v13** In v13, the `useTheme` hook would call `createCanvasTheme` which generated a
|
|
124
|
+
palette given a `main` color via `chroma.js`.
|
|
118
125
|
|
|
119
126
|
```tsx
|
|
120
127
|
<CanvasProvider theme={{canvas: {palette: {primary: {main: 'purple'}}}}}>
|
|
121
|
-
<App/>
|
|
128
|
+
<App />
|
|
122
129
|
</CanvasProvider>
|
|
123
130
|
```
|
|
124
131
|
|
|
125
|
-
**After in v14**
|
|
126
|
-
|
|
132
|
+
**After in v14** We use `oklch` to generate the palette colors. The color shifting will be
|
|
133
|
+
different. If you want more control over the colors, we suggest providing the full palette object.
|
|
127
134
|
|
|
128
135
|
```tsx
|
|
129
|
-
<CanvasProvider
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
<CanvasProvider
|
|
137
|
+
theme={{
|
|
138
|
+
canvas: {
|
|
139
|
+
palette: {
|
|
140
|
+
primary: {
|
|
141
|
+
lightest: base.blue25,
|
|
142
|
+
light: base.blue200,
|
|
143
|
+
main: base.blue600,
|
|
144
|
+
dark: base.blue700,
|
|
145
|
+
darkest: base.blue800,
|
|
146
|
+
contrast: base.neutral0,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<App />
|
|
143
153
|
</CanvasProvider>
|
|
144
154
|
```
|
|
145
155
|
|
|
@@ -147,19 +157,26 @@ We use `oklch` to generate the palette colors. The color shifting will be differ
|
|
|
147
157
|
|
|
148
158
|
```tsx
|
|
149
159
|
<CanvasProvider theme={{canvas: {palette: {primary: {main: cssVar(base.blue600)}}}}}>
|
|
150
|
-
<App/>
|
|
160
|
+
<App />
|
|
151
161
|
</CanvasProvider>
|
|
152
162
|
```
|
|
153
163
|
|
|
154
|
-
> **Note:** The way `chroma.js` and `oklch` generate colors **is different**. While we work on a
|
|
164
|
+
> **Note:** The way `chroma.js` and `oklch` generate colors **is different**. While we work on a
|
|
165
|
+
> better algorithm to determine hue, chroma and lightness and color shifting that best represents an
|
|
166
|
+
> accessible palette, **you may see color discrepancies**. If you want to continue using the old way
|
|
167
|
+
> of generating a color palette with `chroma.js`, you can use `createCanvasTheme`.
|
|
155
168
|
|
|
156
169
|
```tsx
|
|
157
|
-
<CanvasProvider
|
|
158
|
-
|
|
170
|
+
<CanvasProvider
|
|
171
|
+
theme={{canvas: createCanvasTheme({palette: {primary: {main: cssVar(base.blue600)}}})}}
|
|
172
|
+
>
|
|
173
|
+
<App />
|
|
159
174
|
</CanvasProvider>
|
|
160
175
|
```
|
|
161
176
|
|
|
162
|
-
The reason for this change is to ensure that the CSS variables properly cascade to all components.
|
|
177
|
+
The reason for this change is to ensure that the CSS variables properly cascade to all components.
|
|
178
|
+
Before in v13, the `CanvasProvider` would add the brand tokens under a class name, creating a higher
|
|
179
|
+
specificity.
|
|
163
180
|
|
|
164
181
|
## Component Updates
|
|
165
182
|
|
|
@@ -387,7 +404,8 @@ These changes are only **visual** and should not affect the functionality of the
|
|
|
387
404
|
|
|
388
405
|
### Pill
|
|
389
406
|
|
|
390
|
-
**PRs:** [#3430](https://github.com/Workday/canvas-kit/pull/3430),
|
|
407
|
+
**PRs:** [#3430](https://github.com/Workday/canvas-kit/pull/3430),
|
|
408
|
+
[#3446](https://github.com/Workday/canvas-kit/pull/3446)
|
|
391
409
|
|
|
392
410
|
- `Pill` has been updated to use the `Avatar` component from Preview. This change requires that you
|
|
393
411
|
provide a value for the `name` prop.
|
|
@@ -397,7 +415,8 @@ These changes are only **visual** and should not affect the functionality of the
|
|
|
397
415
|
- The `Pill` component no longer supports `'default'` as a value for the `variant` prop. If the
|
|
398
416
|
`variant` prop is not provided, the component will use its default styling.
|
|
399
417
|
|
|
400
|
-
- `readyOnlyPillStencil` and `removeablePillStencil` have been removed due to some styling clean up.
|
|
418
|
+
- `readyOnlyPillStencil` and `removeablePillStencil` have been removed due to some styling clean up.
|
|
419
|
+
Please use `pillStencil` instead.
|
|
401
420
|
|
|
402
421
|
**Before in v13**
|
|
403
422
|
|
|
@@ -417,7 +436,6 @@ These changes are only **visual** and should not affect the functionality of the
|
|
|
417
436
|
</Pill>
|
|
418
437
|
```
|
|
419
438
|
|
|
420
|
-
|
|
421
439
|
### Search Form 🚨
|
|
422
440
|
|
|
423
441
|
**PR:** [#3303](https://github.com/Workday/canvas-kit/pull/3303)
|
|
@@ -552,6 +570,13 @@ The Radio component in `@workday/canvas-kit-react/radio` has been deprecated. Pl
|
|
|
552
570
|
[Radio](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-radio--docs) component
|
|
553
571
|
from the same package, which offers improved accessibility and API consistency.
|
|
554
572
|
|
|
573
|
+
### Search Form (Labs)
|
|
574
|
+
|
|
575
|
+
**PR:** [#3469](https://github.com/Workday/canvas-kit/pull/3469)
|
|
576
|
+
|
|
577
|
+
The `SearchForm` in `@workday/canvas-kit-labs-react/search-form` has been deprecated and will be removed in a future major release. Please migrate to the new
|
|
578
|
+
[Combobox](https://workday.github.io/canvas-kit/?path=/docs/features-combobox--docs#usage) in `@workday/canvas-kit-react`.
|
|
579
|
+
|
|
555
580
|
### Segmented Control (Main)
|
|
556
581
|
|
|
557
582
|
The Segmented Control component in `@workday/canvas-kit-react/segmented-control` has been
|
|
@@ -591,6 +616,34 @@ as a reminder of how far we've come and it part we're thankful for this change.
|
|
|
591
616
|
Al though unlikely, but not impossible, if you were using `DeprecatedButton` please use our flexible
|
|
592
617
|
and themable buttons like `PrimaryButton`, `ScondaryButton` or `TertiaryButton`.
|
|
593
618
|
|
|
619
|
+
### Input Provider
|
|
620
|
+
|
|
621
|
+
We've removed `InputProvider` from our codebase and the `CanvasProvider`. The intent of the provider
|
|
622
|
+
was to check the users input and apply focus styles accordingly to our components. This was needed
|
|
623
|
+
when we still supported IE11 to ensure we could be consistent on styling based on user input events.
|
|
624
|
+
Since dropping support and moving to `:focus-visible`, we no longer need this provider. We now allow
|
|
625
|
+
browser heuristics to determine when an element should receive visual focus styles. For more
|
|
626
|
+
information, please view the
|
|
627
|
+
[MDN docs on `:focus-visible`](https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible).
|
|
628
|
+
|
|
629
|
+
If you are trying to apply focus styles to our components, we strongly avise to use `:focus-visible`
|
|
630
|
+
pseudo selector.
|
|
631
|
+
|
|
632
|
+
```tsx
|
|
633
|
+
import {createStyles} from '@workday/canvas-kit-styling'
|
|
634
|
+
import {PrimaryButton} from '@workday/canvas-kit-react/button'
|
|
635
|
+
|
|
636
|
+
const buttonStyles = createStyles({
|
|
637
|
+
'&:focus-visible': {
|
|
638
|
+
outline: '2px solid red'
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
<PrimaryButton cs={buttonStyles}>
|
|
643
|
+
Click Me
|
|
644
|
+
</PrimaryButton>
|
|
645
|
+
```
|
|
646
|
+
|
|
594
647
|
### Menu (preview)
|
|
595
648
|
|
|
596
649
|
**PR:** [#3353](https://github.com/Workday/canvas-kit/pull/3353)
|
|
@@ -604,6 +657,22 @@ We've removed `Menu` from `@workday/canvas-kit-preview-react` package. Please us
|
|
|
604
657
|
The `readyOnlyPillStencil` and `removeablePillStencil` utilities have been removed from the Pill
|
|
605
658
|
package. Please use `pillStencil` instead.
|
|
606
659
|
|
|
660
|
+
### Text Area (preview)
|
|
661
|
+
|
|
662
|
+
**PR:** [#3471](https://github.com/Workday/canvas-kit/pull/3471)
|
|
663
|
+
|
|
664
|
+
We've removed `TextArea` from `@workday/canvas-kit-preview-react` package. Please use
|
|
665
|
+
[TextArea](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-textarea--docs) from
|
|
666
|
+
`@workday/canvas-kit-react` instead.
|
|
667
|
+
|
|
668
|
+
### Text Input (preview)
|
|
669
|
+
|
|
670
|
+
**PR:** [#3471](https://github.com/Workday/canvas-kit/pull/3471)
|
|
671
|
+
|
|
672
|
+
We've removed `TextInput` from `@workday/canvas-kit-preview-react` package. Please use
|
|
673
|
+
[TextInput](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-text-input--docs)
|
|
674
|
+
from `@workday/canvas-kit-react` instead. =======
|
|
675
|
+
|
|
607
676
|
---
|
|
608
677
|
|
|
609
678
|
## Troubleshooting
|
|
@@ -18,7 +18,7 @@ import RTL from './examples/RTL';
|
|
|
18
18
|
<InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
|
|
19
19
|
<InformationHighlight.Icon />
|
|
20
20
|
<InformationHighlight.Body>
|
|
21
|
-
`Combobox` in
|
|
21
|
+
`Combobox` in Labs has been deprecated and will be removed in a future major version. Please
|
|
22
22
|
use `Combobox` in Main instead.
|
|
23
23
|
</InformationHighlight.Body>
|
|
24
24
|
<InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/features-combobox--docs">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {ExampleCodeBlock, SymbolDoc} from '@workday/canvas-kit-docs';
|
|
1
|
+
import {ExampleCodeBlock, SymbolDoc, StorybookStatusIndicator,} from '@workday/canvas-kit-docs';
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';import Basic from './examples/Basic';
|
|
2
3
|
import Collapsed from './examples/Collapsed';
|
|
3
4
|
import CustomTheme from './examples/CustomTheme';
|
|
4
5
|
import Grow from './examples/Grow';
|
|
@@ -7,7 +8,18 @@ import Theming from './examples/Theming';
|
|
|
7
8
|
import CustomStyles from './examples/CustomStyles';
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
# Canvas Kit Search Form
|
|
11
|
+
# Canvas Kit Search Form <StorybookStatusIndicator type="deprecated" />
|
|
12
|
+
|
|
13
|
+
<InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
|
|
14
|
+
<InformationHighlight.Icon />
|
|
15
|
+
<InformationHighlight.Body>
|
|
16
|
+
`SearchForm` in Labs has been deprecated and will be removed in a future major version. Please
|
|
17
|
+
use `Combobox` in Main instead.
|
|
18
|
+
</InformationHighlight.Body>
|
|
19
|
+
<InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/features-combobox--docs#usage">
|
|
20
|
+
View Autocomplete Example
|
|
21
|
+
</InformationHighlight.Link>
|
|
22
|
+
</InformationHighlight>
|
|
11
23
|
|
|
12
24
|
`SearchForm` is a search form that contains a `Combobox` for rendering search results. It's
|
|
13
25
|
primarily intended to be used within a `Header`.
|
|
@@ -3,11 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import {useFormik} from 'formik';
|
|
4
4
|
import {object, SchemaOf, string} from 'yup';
|
|
5
5
|
|
|
6
|
-
import {TextInput} from '@workday/canvas-kit-
|
|
6
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
7
7
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
8
8
|
import {TertiaryButton, PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
9
9
|
import {visibleIcon, invisibleIcon} from '@workday/canvas-system-icons-web';
|
|
10
10
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
11
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
11
12
|
|
|
12
13
|
interface LoginSchema {
|
|
13
14
|
email: string;
|
|
@@ -47,40 +48,46 @@ export default () => {
|
|
|
47
48
|
return (
|
|
48
49
|
<form onSubmit={formik.handleSubmit} action=".">
|
|
49
50
|
<Flex gap="xs" flexDirection="column" alignItems="flex-start">
|
|
50
|
-
<
|
|
51
|
+
<FormField
|
|
51
52
|
orientation="vertical"
|
|
52
53
|
isRequired={true}
|
|
53
54
|
error={formik.touched.email && !!formik.errors.email ? 'error' : undefined}
|
|
54
55
|
>
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
<FormField.Label>Email</FormField.Label>
|
|
57
|
+
<FormField.Field>
|
|
58
|
+
<FormField.Input
|
|
59
|
+
as={TextInput}
|
|
60
|
+
name="email"
|
|
61
|
+
autoComplete="username"
|
|
62
|
+
placeholder="yourName@example.com"
|
|
63
|
+
onChange={formik.handleChange}
|
|
64
|
+
onBlur={formik.handleBlur}
|
|
65
|
+
value={formik.values.email}
|
|
66
|
+
/>
|
|
67
|
+
</FormField.Field>
|
|
68
|
+
<FormField.Hint>{formik.touched.email && formik.errors.email}</FormField.Hint>
|
|
69
|
+
</FormField>
|
|
70
|
+
<FormField
|
|
67
71
|
orientation="vertical"
|
|
68
72
|
id={passwordId}
|
|
69
73
|
error={formik.touched.password && !!formik.errors.password ? 'error' : undefined}
|
|
70
74
|
isRequired={true}
|
|
71
75
|
>
|
|
72
|
-
<
|
|
76
|
+
<FormField.Label>Password</FormField.Label>
|
|
73
77
|
<Flex gap="xxs">
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
<FormField.Field>
|
|
79
|
+
<FormField.Input
|
|
80
|
+
as={TextInput}
|
|
81
|
+
type={showPassword ? 'text' : 'password'}
|
|
82
|
+
name="password"
|
|
83
|
+
autoComplete="current-password"
|
|
84
|
+
spellCheck={false}
|
|
85
|
+
ref={passwordRef}
|
|
86
|
+
onChange={formik.handleChange}
|
|
87
|
+
onBlur={formik.handleBlur}
|
|
88
|
+
value={formik.values.password}
|
|
89
|
+
/>
|
|
90
|
+
</FormField.Field>
|
|
84
91
|
<TertiaryButton
|
|
85
92
|
type="button"
|
|
86
93
|
icon={showPassword ? invisibleIcon : visibleIcon}
|
|
@@ -92,10 +99,10 @@ export default () => {
|
|
|
92
99
|
}}
|
|
93
100
|
/>
|
|
94
101
|
</Flex>
|
|
95
|
-
<
|
|
102
|
+
<FormField.Hint>
|
|
96
103
|
{(formik.touched.password && formik.errors.password) || passwordHint}
|
|
97
|
-
</
|
|
98
|
-
</
|
|
104
|
+
</FormField.Hint>
|
|
105
|
+
</FormField>
|
|
99
106
|
|
|
100
107
|
<PrimaryButton type="submit">Submit</PrimaryButton>
|
|
101
108
|
</Flex>
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import {useForm, FieldErrorsImpl} from 'react-hook-form';
|
|
4
4
|
import {object, SchemaOf, string} from 'yup';
|
|
5
5
|
|
|
6
|
-
import {TextInput} from '@workday/canvas-kit-
|
|
6
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
7
7
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
8
8
|
import {TertiaryButton, PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
9
9
|
import {Select} from '@workday/canvas-kit-react/select';
|
|
@@ -120,34 +120,40 @@ export default () => {
|
|
|
120
120
|
<FormField.Hint>{errors.role?.message}</FormField.Hint>
|
|
121
121
|
</Select>
|
|
122
122
|
</FormField>
|
|
123
|
-
<
|
|
123
|
+
<FormField
|
|
124
124
|
orientation="vertical"
|
|
125
125
|
isRequired={true}
|
|
126
126
|
error={!!errors.email ? 'error' : undefined}
|
|
127
127
|
>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
<FormField.Label>Email</FormField.Label>
|
|
129
|
+
<FormField.Field>
|
|
130
|
+
<FormField.Input
|
|
131
|
+
as={TextInput}
|
|
132
|
+
{...register('email')}
|
|
133
|
+
autoComplete="username"
|
|
134
|
+
placeholder="yourName@example.com"
|
|
135
|
+
/>
|
|
136
|
+
</FormField.Field>
|
|
137
|
+
<FormField.Hint>{errors.email?.message}</FormField.Hint>
|
|
138
|
+
</FormField>
|
|
139
|
+
<FormField
|
|
137
140
|
orientation="vertical"
|
|
138
141
|
id={passwordId}
|
|
139
142
|
isRequired={true}
|
|
140
143
|
error={!!errors.password ? 'error' : undefined}
|
|
141
144
|
>
|
|
142
|
-
<
|
|
145
|
+
<FormField.Label>Password</FormField.Label>
|
|
143
146
|
<Flex gap="xxs">
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
<FormField.Field>
|
|
148
|
+
<FormField.Input
|
|
149
|
+
as={TextInput}
|
|
150
|
+
{...passwordRegistration}
|
|
151
|
+
type={showPassword ? 'text' : 'password'}
|
|
152
|
+
autoComplete="current-password"
|
|
153
|
+
spellCheck={false}
|
|
154
|
+
ref={combinePasswordRef}
|
|
155
|
+
/>
|
|
156
|
+
</FormField.Field>
|
|
151
157
|
<TertiaryButton
|
|
152
158
|
type="button"
|
|
153
159
|
icon={showPassword ? invisibleIcon : visibleIcon}
|
|
@@ -159,8 +165,8 @@ export default () => {
|
|
|
159
165
|
}}
|
|
160
166
|
/>
|
|
161
167
|
</Flex>
|
|
162
|
-
<
|
|
163
|
-
</
|
|
168
|
+
<FormField.Hint>{errors.password?.message || passwordHint}</FormField.Hint>
|
|
169
|
+
</FormField>
|
|
164
170
|
|
|
165
171
|
<PrimaryButton type="submit">Submit</PrimaryButton>
|
|
166
172
|
</Flex>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, {useState} from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-
|
|
2
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
3
3
|
import {BodyText, Heading} from '@workday/canvas-kit-react/text';
|
|
4
4
|
import {AriaLiveRegion} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
6
6
|
import {system} from '@workday/canvas-tokens-web';
|
|
7
7
|
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
8
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
8
9
|
|
|
9
10
|
const fruits = [
|
|
10
11
|
'Apples',
|
|
@@ -49,10 +50,12 @@ export default () => {
|
|
|
49
50
|
</BodyText>
|
|
50
51
|
</AriaLiveRegion>
|
|
51
52
|
</Flex>
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
53
|
+
<FormField>
|
|
54
|
+
<FormField.Label>Filter Items:</FormField.Label>
|
|
55
|
+
<FormField.Field>
|
|
56
|
+
<FormField.Input as={TextInput} value={filter} onChange={handleFilter} />
|
|
57
|
+
</FormField.Field>
|
|
58
|
+
</FormField>
|
|
56
59
|
<ul style={listStyles}>
|
|
57
60
|
{filteredFruits.map(i => (
|
|
58
61
|
<BodyText size="small" as="li" cs={listItemStyles} key={i}>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, {useState, useRef} from 'react';
|
|
2
2
|
import {AriaLiveRegion, AccessibleHide} from '@workday/canvas-kit-react/common';
|
|
3
3
|
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
-
import {TextInput} from '@workday/canvas-kit-
|
|
4
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
5
5
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
6
6
|
import {system} from '@workday/canvas-tokens-web';
|
|
7
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
7
8
|
|
|
8
9
|
export default () => {
|
|
9
10
|
const [message, setMessage] = useState('This is an ARIA Live Region!');
|
|
@@ -16,10 +17,12 @@ export default () => {
|
|
|
16
17
|
return (
|
|
17
18
|
<>
|
|
18
19
|
<Flex gap={`var(${system.space.x4})`} alignItems="flex-end">
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
20
|
+
<FormField>
|
|
21
|
+
<FormField.Label>Type your message:</FormField.Label>
|
|
22
|
+
<FormField.Field>
|
|
23
|
+
<FormField.Input as={TextInput} ref={inputRef} />
|
|
24
|
+
</FormField.Field>
|
|
25
|
+
</FormField>
|
|
23
26
|
<PrimaryButton onClick={handleSendMessage}>Send Message</PrimaryButton>
|
|
24
27
|
</Flex>
|
|
25
28
|
<AriaLiveRegion>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, {useState, useRef} from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-
|
|
2
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
3
3
|
import {AriaLiveRegion, changeFocus} from '@workday/canvas-kit-react/common';
|
|
4
4
|
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
5
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
6
|
|
|
6
7
|
export default () => {
|
|
7
8
|
const errMsg = 'Error: First name is required.';
|
|
@@ -12,13 +13,15 @@ export default () => {
|
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
15
|
<>
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<FormField error={hasError ? 'error' : undefined} isRequired={true}>
|
|
17
|
+
<FormField.Label>First Name:</FormField.Label>
|
|
18
|
+
<FormField.Field>
|
|
19
|
+
<FormField.Input onBlur={handleBlur} as={TextInput} ref={inputRef} />
|
|
20
|
+
<FormField.Hint>
|
|
21
|
+
<AriaLiveRegion>{hasError && errMsg}</AriaLiveRegion>
|
|
22
|
+
</FormField.Hint>
|
|
23
|
+
</FormField.Field>
|
|
24
|
+
</FormField>
|
|
22
25
|
<PrimaryButton onClick={handleSubmit}>Continue</PrimaryButton>
|
|
23
26
|
</>
|
|
24
27
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, {useState, useRef} from 'react';
|
|
2
2
|
import {AriaLiveRegion} from '@workday/canvas-kit-react/common';
|
|
3
3
|
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
-
import {
|
|
4
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
5
|
+
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
5
6
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
6
7
|
import {Text} from '@workday/canvas-kit-react/text';
|
|
7
8
|
import {system} from '@workday/canvas-tokens-web';
|
|
@@ -18,6 +19,7 @@ const liveRegionStyle = createStyles({
|
|
|
18
19
|
export default () => {
|
|
19
20
|
const [message, setMessage] = useState('This is an ARIA Live Region!');
|
|
20
21
|
const inputRef = useRef();
|
|
22
|
+
|
|
21
23
|
function handleSendMessage() {
|
|
22
24
|
setMessage(inputRef.current.value);
|
|
23
25
|
inputRef.current.value = '';
|
|
@@ -29,10 +31,12 @@ export default () => {
|
|
|
29
31
|
<Text cs={liveRegionStyle}>{message}</Text>
|
|
30
32
|
</AriaLiveRegion>
|
|
31
33
|
<Flex gap={`var(${system.space.x4})`} alignItems="flex-end">
|
|
32
|
-
<
|
|
33
|
-
<
|
|
34
|
-
<
|
|
35
|
-
|
|
34
|
+
<FormField>
|
|
35
|
+
<FormField.Label>Type your message:</FormField.Label>
|
|
36
|
+
<FormField.Field>
|
|
37
|
+
<FormField.Input as={TextInput} ref={inputRef} />
|
|
38
|
+
</FormField.Field>
|
|
39
|
+
</FormField>
|
|
36
40
|
<PrimaryButton onClick={handleSendMessage}>Send Message</PrimaryButton>
|
|
37
41
|
</Flex>
|
|
38
42
|
</>
|
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.1233-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.1233-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.1233-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.0.0-alpha.1233-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.0.0-alpha.1233-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": "7ed1570b966cb8473b3db07695fb2bc86af7739c"
|
|
65
65
|
}
|