@workday/canvas-kit-docs 6.3.6 → 7.0.0-alpha.0-next.4
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/commonjs/lib/specs.js +56 -0
- package/dist/es6/lib/specs.js +56 -0
- package/dist/mdx/7.0-MIGRATION-GUIDE.mdx +110 -0
- package/dist/mdx/preview-react/form-field/FormField.mdx +3 -15
- package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +16 -22
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +8 -13
- package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +8 -12
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +15 -22
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +8 -13
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +1 -0
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +6 -4
- package/dist/mdx/preview-react/text-input/TextInput.mdx +7 -0
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +1 -0
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +6 -4
- package/dist/mdx/preview-react/{_examples/examples/TextInputWithFormik.tsx → text-input/examples/LoginForm.tsx} +0 -0
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +1 -0
- package/dist/mdx/react/action-bar/ActionBar.mdx +7 -25
- package/dist/mdx/react/action-bar/examples/Basic.tsx +3 -3
- package/dist/mdx/react/banner/Banner.mdx +203 -19
- package/dist/mdx/react/banner/PropTables.splitprops.tsx +39 -0
- package/dist/mdx/react/banner/examples/ActionText.tsx +8 -1
- package/dist/mdx/react/banner/examples/Basic.tsx +8 -1
- package/dist/mdx/react/banner/examples/Error.tsx +8 -1
- package/dist/mdx/react/banner/examples/RefForwarding.tsx +25 -0
- package/dist/mdx/react/banner/examples/Sticky.tsx +12 -7
- package/dist/mdx/react/banner/examples/StickyAnimation.tsx +63 -0
- package/dist/mdx/react/banner/examples/StickyRTL.tsx +36 -0
- package/dist/mdx/react/banner/examples/ThemedAlert.tsx +28 -0
- package/dist/mdx/react/banner/examples/ThemedError.tsx +29 -0
- package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +9 -12
- package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +9 -12
- package/dist/mdx/react/modal/Modal.mdx +21 -0
- package/dist/mdx/react/modal/examples/Basic.tsx +4 -2
- package/dist/mdx/react/modal/examples/BodyOverflow.tsx +56 -0
- package/dist/mdx/react/modal/examples/CustomFocus.tsx +5 -2
- package/dist/mdx/react/modal/examples/FullOverflow.tsx +55 -0
- package/dist/mdx/react/modal/examples/ReturnFocus.tsx +4 -1
- package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +5 -2
- package/dist/mdx/react/skeleton/examples/Simulation.tsx +10 -9
- package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
- package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
- package/package.json +3 -3
- package/dist/mdx/preview-react/_examples/SelectWithFormik.mdx +0 -8
- package/dist/mdx/preview-react/_examples/TextInputWithFormik.mdx +0 -8
- package/dist/mdx/preview-react/_examples/examples/SelectWithFormik.tsx +0 -47
- package/dist/mdx/preview-react/form-field/examples/Select.tsx +0 -50
|
@@ -41,6 +41,62 @@ module.exports = {specifications: [
|
|
|
41
41
|
}
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
"type": "file",
|
|
46
|
+
"name": "Banner.spec.ts",
|
|
47
|
+
"children": [
|
|
48
|
+
{
|
|
49
|
+
"type": "describe",
|
|
50
|
+
"name": "Banner",
|
|
51
|
+
"children": [
|
|
52
|
+
{
|
|
53
|
+
"type": "describe",
|
|
54
|
+
"name": "given the [Components/Indicators/Banner/React, Error] story is rendered",
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"type": "it",
|
|
58
|
+
"name": "should pass axe checks"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"type": "it",
|
|
62
|
+
"name": "should have an element with a role of \"button\""
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "it",
|
|
66
|
+
"name": "should have an \"aria-labelledby\" that matches the action"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "it",
|
|
70
|
+
"name": "should have an \"aria-describedby\" that matches the label"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "describe",
|
|
76
|
+
"name": "given the [Components/Indicators/Banner/React, Sticky] story is rendered",
|
|
77
|
+
"children": [
|
|
78
|
+
{
|
|
79
|
+
"type": "it",
|
|
80
|
+
"name": "should pass axe checks"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "it",
|
|
84
|
+
"name": "should have an element with a role of \"button\""
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "it",
|
|
88
|
+
"name": "should have an \"aria-labelledby\" that matches the action"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "it",
|
|
92
|
+
"name": "should have an \"aria-describedby\" that matches the label"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
44
100
|
{
|
|
45
101
|
"type": "file",
|
|
46
102
|
"name": "Breadcrumbs.spec.ts",
|
package/dist/es6/lib/specs.js
CHANGED
|
@@ -41,6 +41,62 @@ module.exports = {specifications: [
|
|
|
41
41
|
}
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
"type": "file",
|
|
46
|
+
"name": "Banner.spec.ts",
|
|
47
|
+
"children": [
|
|
48
|
+
{
|
|
49
|
+
"type": "describe",
|
|
50
|
+
"name": "Banner",
|
|
51
|
+
"children": [
|
|
52
|
+
{
|
|
53
|
+
"type": "describe",
|
|
54
|
+
"name": "given the [Components/Indicators/Banner/React, Error] story is rendered",
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"type": "it",
|
|
58
|
+
"name": "should pass axe checks"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"type": "it",
|
|
62
|
+
"name": "should have an element with a role of \"button\""
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"type": "it",
|
|
66
|
+
"name": "should have an \"aria-labelledby\" that matches the action"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "it",
|
|
70
|
+
"name": "should have an \"aria-describedby\" that matches the label"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"type": "describe",
|
|
76
|
+
"name": "given the [Components/Indicators/Banner/React, Sticky] story is rendered",
|
|
77
|
+
"children": [
|
|
78
|
+
{
|
|
79
|
+
"type": "it",
|
|
80
|
+
"name": "should pass axe checks"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "it",
|
|
84
|
+
"name": "should have an element with a role of \"button\""
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "it",
|
|
88
|
+
"name": "should have an \"aria-labelledby\" that matches the action"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"type": "it",
|
|
92
|
+
"name": "should have an \"aria-describedby\" that matches the label"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
44
100
|
{
|
|
45
101
|
"type": "file",
|
|
46
102
|
"name": "Breadcrumbs.spec.ts",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Canvas Kit 7.0 Migration Guide
|
|
2
|
+
|
|
3
|
+
Below are the breaking changes made in Canvas Kit v7. Please
|
|
4
|
+
[reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
|
|
5
|
+
any questions about the update.
|
|
6
|
+
|
|
7
|
+
- [Codemod](#codemod)
|
|
8
|
+
- [ActionBar Component Updates](#actionbar-component-updates)
|
|
9
|
+
- [Status Indicator Width](#status-indicator-width)
|
|
10
|
+
- [Popup Cards](popup-cards)
|
|
11
|
+
|
|
12
|
+
## Codemod
|
|
13
|
+
|
|
14
|
+
Please use our [codemod package](https://github.com/Workday/canvas-kit/tree/master/modules/codemod)
|
|
15
|
+
to automatically update your code to work with a majority of the breaking changes in the migration
|
|
16
|
+
from Canvas Kit v6 to v7:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
> npx @workday/canvas-kit-codemod v7 [path]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> Note: This codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` extensions. You may need to make
|
|
23
|
+
> some manual changes in other file types (`.json`, `.mdx`, `.md`, etc.).
|
|
24
|
+
|
|
25
|
+
> Note: You may need to run your linter after executing the codemod, as it's resulting formatting
|
|
26
|
+
> (spacing, quotes, etc.) may not match your project's styling.
|
|
27
|
+
|
|
28
|
+
**Breaking changes accounted for by this codemod will be marked with a 🤖.**
|
|
29
|
+
|
|
30
|
+
**Please verify all changes made by the codemod. As a safety precaution, we recommend committing the
|
|
31
|
+
changes from the codemod as a single isolated commit (separate from other changes) so you can
|
|
32
|
+
rollback more easily if necessary.**
|
|
33
|
+
|
|
34
|
+
[Let us know](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you
|
|
35
|
+
encounter any issues or use cases that we've missed. The `@workday/canvas-kit-codemod` package will
|
|
36
|
+
help us maintain additional codemod transforms to make future migrations easier.
|
|
37
|
+
|
|
38
|
+
## ActionBar Component Updates
|
|
39
|
+
|
|
40
|
+
We've refactored our ActionBar components to simplify logic.
|
|
41
|
+
|
|
42
|
+
PR: https://github.com/Workday/canvas-kit/pull/1396
|
|
43
|
+
|
|
44
|
+
**Changes:**
|
|
45
|
+
|
|
46
|
+
- Component has been converted to compound component.
|
|
47
|
+
- `fixed` prop has been removed from component.
|
|
48
|
+
- Now ActionBar uses `position` prop to set container position instead `fixed` prop.
|
|
49
|
+
- Fixed position has been set as default if there is not passed `position` prop.
|
|
50
|
+
|
|
51
|
+
## Status Indicator Width
|
|
52
|
+
|
|
53
|
+
Status Indicators currently truncate when they reach their max width of `150px`. After receiving
|
|
54
|
+
requests to increase this, we have upped it by 25% to `200px`.
|
|
55
|
+
|
|
56
|
+
We've also added a prop (`maxWidth`) to configure this if you need to. While this increases
|
|
57
|
+
flexibility, please keep in mind that status text should be short, direct, and preferably a single
|
|
58
|
+
word.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<StatusIndicator label="Slightly Longer Status" type={StatusIndicator.Type.Gray} maxWidth={250} />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Popup Cards
|
|
65
|
+
|
|
66
|
+
`Popup.Card` (this includes `Modal.Card` and `Dialog.Card`) components are now a flexbox container.
|
|
67
|
+
This was done to support overflowing content (by default, the `Popup.Body` component). The idea is
|
|
68
|
+
the card is a vertical flexbox container and the `Popup.Heading`, `Popup.Body`, and any other
|
|
69
|
+
children are flex items. The `Popup.Body` now has an `overflow-y: auto` on it to naturally allow the
|
|
70
|
+
body content to overflow in a scroll container. This is a breaking change if your `Popup`, `Modal`,
|
|
71
|
+
or `Dialog` doesn't work with a flexbox with `flex-direction: column`. In most cases, this shouldn't
|
|
72
|
+
matter. If this change does cause your popup to display correctly, you may need to play around with
|
|
73
|
+
flex item containers.
|
|
74
|
+
|
|
75
|
+
An example where this might break:
|
|
76
|
+
|
|
77
|
+
A common Modal has a heading, body, and footer (Cancel/Submit buttons). If the Cancel and Submit
|
|
78
|
+
buttons are direct children of the `Modal.Card` like the following:
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Modal.Card>
|
|
82
|
+
<Modal.Heading>Some Heading</Modal.Heading>
|
|
83
|
+
<Modal.Body>Some Body</Modal.Body>
|
|
84
|
+
<SecondaryButton>Cancel</SecondaryButton>
|
|
85
|
+
<PrimaryButton>Submit</PrimaryButton>
|
|
86
|
+
</Modal.Card>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The buttons will become vertical flex items instead of the default which is displaying inline-block.
|
|
90
|
+
Before, the buttons would layout next to each other horizontally. After, the buttons will stack
|
|
91
|
+
vertically. To fix this, you'll have to add another element to be a flex item from the `Modal.Card`.
|
|
92
|
+
Our examples use `HStack` to align the buttons. The following will render correctly after this
|
|
93
|
+
change:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<Modal.Card>
|
|
97
|
+
<Modal.Heading>Some Heading</Modal.Heading>
|
|
98
|
+
<Modal.Body>Some Body</Modal.Body>
|
|
99
|
+
<HStack spacing="s">
|
|
100
|
+
<SecondaryButton>Cancel</SecondaryButton>
|
|
101
|
+
<PrimaryButton>Submit</PrimaryButton>
|
|
102
|
+
</HStack>
|
|
103
|
+
</Modal.Card>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If your code contains any hacks to make a `Modal` overflow, these hacks should now be removed.
|
|
107
|
+
[This example shows how body content overflows](https://workday.github.io/canvas-kit/?path=/docs/components-popups-modal-react--body-overflow)
|
|
108
|
+
(you may have to limit your browser height to see the overflow). Before you had to manually set the
|
|
109
|
+
`max-height` of the `Modal.Body` element using calculations. These should be removed. The
|
|
110
|
+
`Popup.Card` now has a max height and the `Popup.Body` height is automatically calculated.
|
|
@@ -3,7 +3,6 @@ import {Specifications} from '@workday/canvas-kit-docs';
|
|
|
3
3
|
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
4
4
|
|
|
5
5
|
import Custom from './examples/Custom';
|
|
6
|
-
import WithSelect from './examples/Select';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
# Canvas Kit Form Field
|
|
@@ -21,19 +20,8 @@ yarn add @workday/canvas-kit-preview-react
|
|
|
21
20
|
|
|
22
21
|
### Customizing With Behavior Hooks Example
|
|
23
22
|
|
|
24
|
-
If you need full customization you can use the
|
|
25
|
-
|
|
23
|
+
If you need full customization you can use the form field behavior hooks to build your own solution.
|
|
24
|
+
It is also easy it work with custom components or third party libraries and get the CKR
|
|
26
25
|
accessibility guarantees by using the `as` prop.
|
|
27
26
|
|
|
28
|
-
<ExampleCodeBlock code={Custom} />
|
|
29
|
-
|
|
30
|
-
### Use with Select
|
|
31
|
-
|
|
32
|
-
For some custom inputs, such as Canvas Kit's `Select`, you won't be able to reliably cast the
|
|
33
|
-
`FormField.Input` with the `as` prop. Instead you'll want to use `FormField`'s hooks for the
|
|
34
|
-
implementation. In the example below, we're using the `useFormFieldModel` hook to hoist the model
|
|
35
|
-
and providing it to the `useFormFieldInput` behavior hook. Then we pass the model to the `FormField`
|
|
36
|
-
component and the input props to `Select`. This connects `Select` to the `FormField` components and
|
|
37
|
-
provides it with all the accessible attributes it needs.
|
|
38
|
-
|
|
39
|
-
<ExampleCodeBlock code={WithSelect} />
|
|
27
|
+
<ExampleCodeBlock code={Custom} />
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {jsx} from '@emotion/core';
|
|
4
2
|
import {colors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
5
3
|
import {AccentIcon} from '@workday/canvas-kit-react/icon';
|
|
6
4
|
import {rocketIcon} from '@workday/canvas-accent-icons-web';
|
|
7
5
|
import {SidePanel, useSidePanel} from '@workday/canvas-kit-preview-react/side-panel';
|
|
8
|
-
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
9
|
-
import {
|
|
6
|
+
import {Flex, HStack} from '@workday/canvas-kit-labs-react/layout';
|
|
7
|
+
import {styled} from '@workday/canvas-kit-react/common';
|
|
8
|
+
|
|
9
|
+
const StyledHeader = styled('h3')({
|
|
10
|
+
...type.levels.body.large,
|
|
11
|
+
color: colors.licorice500,
|
|
12
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const StyledAccentIcon = styled(AccentIcon)({
|
|
16
|
+
marginRight: space.s,
|
|
17
|
+
});
|
|
10
18
|
|
|
11
19
|
export default () => {
|
|
12
20
|
const {panelProps, labelProps} = useSidePanel();
|
|
13
21
|
|
|
14
|
-
const {themeRTL} = useThemeRTL();
|
|
15
|
-
const iconStyles = themeRTL({
|
|
16
|
-
marginRight: space.s,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
22
|
return (
|
|
20
|
-
<
|
|
23
|
+
<HStack spacing="s" height={320}>
|
|
21
24
|
<SidePanel {...panelProps}>
|
|
22
25
|
<Flex alignItems="center" paddingY="s" paddingX="xs">
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
css={{
|
|
26
|
-
...type.levels.body.large,
|
|
27
|
-
color: colors.licorice500,
|
|
28
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
29
|
-
}}
|
|
30
|
-
{...labelProps}
|
|
31
|
-
>
|
|
32
|
-
Tasks Panel
|
|
33
|
-
</h3>
|
|
26
|
+
<StyledAccentIcon icon={rocketIcon} />
|
|
27
|
+
<StyledHeader {...labelProps}>Tasks Panel</StyledHeader>
|
|
34
28
|
</Flex>
|
|
35
29
|
</SidePanel>
|
|
36
|
-
</
|
|
30
|
+
</HStack>
|
|
37
31
|
);
|
|
38
32
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {jsx} from '@emotion/core';
|
|
4
2
|
import {colors, type} from '@workday/canvas-kit-react/tokens';
|
|
5
3
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
6
4
|
import {
|
|
@@ -9,12 +7,18 @@ import {
|
|
|
9
7
|
SidePanelTransitionStates,
|
|
10
8
|
} from '@workday/canvas-kit-preview-react/side-panel';
|
|
11
9
|
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
12
|
-
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
10
|
+
import {CanvasProvider, styled} from '@workday/canvas-kit-react/common';
|
|
13
11
|
import {AccentIcon} from '@workday/canvas-kit-react/icon';
|
|
14
12
|
import {rocketIcon} from '@workday/canvas-accent-icons-web';
|
|
15
13
|
// local helper hook for setting content direction;
|
|
16
14
|
import {useDirection} from './useDirection';
|
|
17
15
|
|
|
16
|
+
const StyledHeader = styled('h3')({
|
|
17
|
+
...type.levels.body.large,
|
|
18
|
+
color: colors.licorice500,
|
|
19
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
20
|
+
});
|
|
21
|
+
|
|
18
22
|
export default () => {
|
|
19
23
|
const {direction, toggleDirection} = useDirection();
|
|
20
24
|
const {expanded, panelProps, labelProps, controlProps} = useSidePanel();
|
|
@@ -32,16 +36,7 @@ export default () => {
|
|
|
32
36
|
<Flex marginInlineEnd="s">
|
|
33
37
|
<AccentIcon icon={rocketIcon} />
|
|
34
38
|
</Flex>
|
|
35
|
-
<
|
|
36
|
-
css={{
|
|
37
|
-
...type.levels.body.large,
|
|
38
|
-
color: colors.licorice500,
|
|
39
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
40
|
-
}}
|
|
41
|
-
{...labelProps}
|
|
42
|
-
>
|
|
43
|
-
Tasks Panel
|
|
44
|
-
</h3>
|
|
39
|
+
<StyledHeader {...labelProps}>Tasks Panel</StyledHeader>
|
|
45
40
|
</Flex>
|
|
46
41
|
)}
|
|
47
42
|
</SidePanel>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {jsx} from '@emotion/core';
|
|
4
2
|
import {
|
|
5
3
|
SidePanel,
|
|
6
4
|
useSidePanel,
|
|
@@ -9,6 +7,13 @@ import {
|
|
|
9
7
|
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
10
8
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
11
9
|
import {colors, type} from '@workday/canvas-kit-react/tokens';
|
|
10
|
+
import {styled} from '@workday/canvas-kit-react/common';
|
|
11
|
+
|
|
12
|
+
const StyledHeader = styled('h3')({
|
|
13
|
+
...type.levels.body.large,
|
|
14
|
+
color: colors.licorice500,
|
|
15
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
16
|
+
});
|
|
12
17
|
|
|
13
18
|
export default () => {
|
|
14
19
|
const {expanded, panelProps, labelProps, controlProps} = useSidePanel({initialExpanded: false});
|
|
@@ -28,16 +33,7 @@ export default () => {
|
|
|
28
33
|
>
|
|
29
34
|
{panelState === 'expanded' && (
|
|
30
35
|
<Flex alignItems="center" paddingY="s" paddingX="xs">
|
|
31
|
-
<
|
|
32
|
-
css={{
|
|
33
|
-
...type.levels.body.large,
|
|
34
|
-
color: colors.licorice500,
|
|
35
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
36
|
-
}}
|
|
37
|
-
{...labelProps}
|
|
38
|
-
>
|
|
39
|
-
Tasks Panel
|
|
40
|
-
</h3>
|
|
36
|
+
<StyledHeader {...labelProps}>Tasks Panel</StyledHeader>
|
|
41
37
|
</Flex>
|
|
42
38
|
)}
|
|
43
39
|
</SidePanel>
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {jsx} from '@emotion/core';
|
|
4
2
|
import {colors, type} from '@workday/canvas-kit-react/tokens';
|
|
5
3
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
6
4
|
import {
|
|
@@ -8,42 +6,37 @@ import {
|
|
|
8
6
|
useSidePanel,
|
|
9
7
|
SidePanelTransitionStates,
|
|
10
8
|
} from '@workday/canvas-kit-preview-react/side-panel';
|
|
11
|
-
import {useThemeRTL} from '@workday/canvas-kit-labs-react/common';
|
|
12
9
|
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
13
|
-
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
10
|
+
import {CanvasProvider, styled} from '@workday/canvas-kit-react/common';
|
|
14
11
|
// local helper hook for setting content direction;
|
|
15
12
|
import {useDirection} from './useDirection';
|
|
16
13
|
|
|
14
|
+
const StyledHeader = styled('h3')({
|
|
15
|
+
...type.levels.body.large,
|
|
16
|
+
color: colors.licorice500,
|
|
17
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const StyledSidePanel = styled(SidePanel)({
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
right: 0,
|
|
23
|
+
});
|
|
24
|
+
|
|
17
25
|
const RightPanel = () => {
|
|
18
26
|
const {expanded, panelProps, labelProps, controlProps} = useSidePanel();
|
|
19
27
|
const [panelState, setPanelState] = React.useState<SidePanelTransitionStates>(
|
|
20
28
|
expanded ? 'expanded' : 'collapsed'
|
|
21
29
|
);
|
|
22
30
|
|
|
23
|
-
const {themeRTL} = useThemeRTL();
|
|
24
|
-
const panelStyles = themeRTL({
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
right: 0,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
31
|
return (
|
|
30
|
-
<
|
|
32
|
+
<StyledSidePanel {...panelProps} onStateTransition={setPanelState} origin="right">
|
|
31
33
|
<SidePanel.ToggleButton {...controlProps} />
|
|
32
34
|
{panelState === 'expanded' && (
|
|
33
35
|
<Flex alignItems="center" justifyContent="flex-end" paddingY="s" paddingX="xs">
|
|
34
|
-
<
|
|
35
|
-
css={{
|
|
36
|
-
...type.levels.body.large,
|
|
37
|
-
color: colors.licorice500,
|
|
38
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
39
|
-
}}
|
|
40
|
-
{...labelProps}
|
|
41
|
-
>
|
|
42
|
-
Tasks Panel
|
|
43
|
-
</h3>
|
|
36
|
+
<StyledHeader {...labelProps}>Tasks Panel</StyledHeader>
|
|
44
37
|
</Flex>
|
|
45
38
|
)}
|
|
46
|
-
</
|
|
39
|
+
</StyledSidePanel>
|
|
47
40
|
);
|
|
48
41
|
};
|
|
49
42
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import {jsx} from '@emotion/core';
|
|
4
2
|
import {colors, type} from '@workday/canvas-kit-react/tokens';
|
|
5
3
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
6
4
|
import {
|
|
@@ -9,10 +7,16 @@ import {
|
|
|
9
7
|
SidePanelTransitionStates,
|
|
10
8
|
} from '@workday/canvas-kit-preview-react/side-panel';
|
|
11
9
|
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
12
|
-
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
10
|
+
import {CanvasProvider, styled} from '@workday/canvas-kit-react/common';
|
|
13
11
|
// local helper hook for setting content direction;
|
|
14
12
|
import {useDirection} from './useDirection';
|
|
15
13
|
|
|
14
|
+
const StyledHeader = styled('h3')({
|
|
15
|
+
...type.levels.body.large,
|
|
16
|
+
color: colors.licorice500,
|
|
17
|
+
fontWeight: type.properties.fontWeights.bold,
|
|
18
|
+
});
|
|
19
|
+
|
|
16
20
|
export default () => {
|
|
17
21
|
const {direction, toggleDirection} = useDirection();
|
|
18
22
|
const {expanded, panelProps, labelProps, controlProps} = useSidePanel();
|
|
@@ -27,16 +31,7 @@ export default () => {
|
|
|
27
31
|
<SidePanel.ToggleButton {...controlProps} />
|
|
28
32
|
{panelState === 'expanded' && (
|
|
29
33
|
<Flex alignItems="center" paddingY="s" paddingX="xs">
|
|
30
|
-
<
|
|
31
|
-
css={{
|
|
32
|
-
...type.levels.body.large,
|
|
33
|
-
color: colors.licorice500,
|
|
34
|
-
fontWeight: type.properties.fontWeights.bold,
|
|
35
|
-
}}
|
|
36
|
-
{...labelProps}
|
|
37
|
-
>
|
|
38
|
-
Alternate Panel
|
|
39
|
-
</h3>
|
|
34
|
+
<StyledHeader {...labelProps}>Alternate Panel</StyledHeader>
|
|
40
35
|
</Flex>
|
|
41
36
|
)}
|
|
42
37
|
</SidePanel>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import {jsx} from '@emotion/core';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import {TextArea} from '@workday/canvas-kit-preview-react/text-area';
|
|
5
|
-
import {accessibleHide} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {accessibleHide, styled} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
const StyledTextAreaLabel = styled(TextArea.Label)({
|
|
6
|
+
...accessibleHide,
|
|
7
|
+
});
|
|
6
8
|
|
|
7
9
|
export default () => {
|
|
8
10
|
const [value, setValue] = React.useState('');
|
|
@@ -13,7 +15,7 @@ export default () => {
|
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
17
|
<TextArea orientation="vertical" spacing="zero">
|
|
16
|
-
<
|
|
18
|
+
<StyledTextAreaLabel>Email</StyledTextAreaLabel>
|
|
17
19
|
<TextArea.Field onChange={handleChange} value={value} />
|
|
18
20
|
</TextArea>
|
|
19
21
|
);
|
|
@@ -16,6 +16,7 @@ import ThemedAlert from './examples/ThemedAlert';
|
|
|
16
16
|
import ThemedError from './examples/ThemedError';
|
|
17
17
|
import Error from './examples/Error';
|
|
18
18
|
import Alert from './examples/Alert';
|
|
19
|
+
import LoginForm from './examples/LoginForm';
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
# Canvas Kit Text Input
|
|
@@ -127,6 +128,12 @@ used in an outer ring.
|
|
|
127
128
|
|
|
128
129
|
<ExampleCodeBlock code={ThemedAlert} />
|
|
129
130
|
|
|
131
|
+
#### Full example
|
|
132
|
+
|
|
133
|
+
Login Form using Formik
|
|
134
|
+
|
|
135
|
+
<ExampleCodeBlock code={LoginForm} />
|
|
136
|
+
|
|
130
137
|
## Props
|
|
131
138
|
|
|
132
139
|
Undocumented props are spread to the underlying `<input>` element.
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import {jsx} from '@emotion/core';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
5
|
-
import {accessibleHide} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {accessibleHide, styled} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
const StyledTextAreaLabel = styled(TextInput.Label)({
|
|
6
|
+
...accessibleHide,
|
|
7
|
+
});
|
|
6
8
|
|
|
7
9
|
export default () => {
|
|
8
10
|
const [value, setValue] = React.useState('');
|
|
@@ -13,7 +15,7 @@ export default () => {
|
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
17
|
<TextInput orientation="vertical" spacing="zero">
|
|
16
|
-
<
|
|
18
|
+
<StyledTextAreaLabel>Email</StyledTextAreaLabel>
|
|
17
19
|
<TextInput.Field onChange={handleChange} value={value} />
|
|
18
20
|
</TextInput>
|
|
19
21
|
);
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ import Basic from './examples/Basic';
|
|
|
6
6
|
|
|
7
7
|
# Canvas Kit Action Bar
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Action Bar contains primary and secondary actions related to a page or task.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -19,38 +19,20 @@ yarn add @workday/canvas-kit-react
|
|
|
19
19
|
### Basic Example
|
|
20
20
|
|
|
21
21
|
Here is a basic example of an `ActionBar` with two buttons. Although not required,
|
|
22
|
-
[buttons](../../button) are often used in in action bars. The primary action button should be
|
|
23
|
-
aligned followed by secondary buttons.
|
|
24
|
-
UIs" and on mobile devices.
|
|
22
|
+
[buttons](../../button) are often used in in action bars. The primary action button should be used
|
|
23
|
+
only once and left aligned followed by secondary buttons.
|
|
25
24
|
|
|
26
25
|
<ExampleCodeBlock code={Basic} />
|
|
27
26
|
|
|
28
|
-
### Fixed
|
|
29
|
-
|
|
30
|
-
The Action Bar generally lives at the bottom of the viewport. If you would like this behavior
|
|
31
|
-
automatically (using `position: fixed`), you can use the `fixed` prop.
|
|
32
|
-
|
|
33
|
-
```tsx
|
|
34
|
-
<ActionBar fixed={true}>
|
|
35
|
-
<PrimaryButton>Button</PrimaryButton>
|
|
36
|
-
<SecondaryButton>Button</SecondaryButton>
|
|
37
|
-
</ActionBar>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
27
|
## Responsive Behavior
|
|
41
28
|
|
|
42
|
-
At
|
|
43
|
-
|
|
44
|
-
- Applies a flex box to the buttons
|
|
45
|
-
- Makes single-button groups full width
|
|
46
|
-
- All buttons will become the same width (`flex: 1`).
|
|
47
|
-
- Button order will become reversed, making left-aligned primary buttons right-aligned.
|
|
29
|
+
At 768px, responsive styles will take effect:
|
|
48
30
|
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
- All primary and secondary buttons will become the same width (`flex: 1`).
|
|
32
|
+
- Container Bar padding will be decreased to small (`16px`) for all sides.
|
|
51
33
|
|
|
52
34
|
## Props
|
|
53
35
|
|
|
54
|
-
Undocumented props are spread to the underlying
|
|
36
|
+
Undocumented props are spread to the underlying `HStack` component.
|
|
55
37
|
|
|
56
38
|
<ArgsTable of={ActionBar} />
|
|
@@ -4,8 +4,8 @@ import {ActionBar} from '@workday/canvas-kit-react/action-bar';
|
|
|
4
4
|
import {PrimaryButton, SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
5
5
|
|
|
6
6
|
export default () => (
|
|
7
|
-
<ActionBar>
|
|
8
|
-
<PrimaryButton>
|
|
9
|
-
<SecondaryButton>
|
|
7
|
+
<ActionBar position="relative">
|
|
8
|
+
<PrimaryButton>First Action</PrimaryButton>
|
|
9
|
+
<SecondaryButton>Second Action</SecondaryButton>
|
|
10
10
|
</ActionBar>
|
|
11
11
|
);
|