@workday/canvas-kit-docs 6.3.5 → 7.0.0-alpha.0-next.3

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.
Files changed (32) hide show
  1. package/dist/commonjs/lib/specs.js +56 -0
  2. package/dist/es6/lib/specs.js +56 -0
  3. package/dist/mdx/7.0-MIGRATION-GUIDE.mdx +61 -0
  4. package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +16 -22
  5. package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +8 -13
  6. package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +8 -12
  7. package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +15 -22
  8. package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +8 -13
  9. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +1 -0
  10. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +6 -4
  11. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +1 -0
  12. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +6 -4
  13. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +1 -0
  14. package/dist/mdx/react/action-bar/ActionBar.mdx +7 -25
  15. package/dist/mdx/react/action-bar/examples/Basic.tsx +3 -3
  16. package/dist/mdx/react/banner/Banner.mdx +203 -19
  17. package/dist/mdx/react/banner/PropTables.splitprops.tsx +39 -0
  18. package/dist/mdx/react/banner/examples/ActionText.tsx +8 -1
  19. package/dist/mdx/react/banner/examples/Basic.tsx +8 -1
  20. package/dist/mdx/react/banner/examples/Error.tsx +8 -1
  21. package/dist/mdx/react/banner/examples/RefForwarding.tsx +25 -0
  22. package/dist/mdx/react/banner/examples/Sticky.tsx +12 -7
  23. package/dist/mdx/react/banner/examples/StickyAnimation.tsx +63 -0
  24. package/dist/mdx/react/banner/examples/StickyRTL.tsx +36 -0
  25. package/dist/mdx/react/banner/examples/ThemedAlert.tsx +28 -0
  26. package/dist/mdx/react/banner/examples/ThemedError.tsx +29 -0
  27. package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +9 -12
  28. package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +9 -12
  29. package/dist/mdx/react/skeleton/examples/Simulation.tsx +10 -9
  30. package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
  31. package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
  32. package/package.json +3 -3
@@ -4,11 +4,24 @@ import ActionText from './examples/ActionText';
4
4
  import Basic from './examples/Basic';
5
5
  import Error from './examples/Error';
6
6
  import Sticky from './examples/Sticky';
7
+ import ThemedAlert from './examples/ThemedAlert';
8
+ import ThemedError from './examples/ThemedError';
9
+ import RefForwarding from './examples/RefForwarding';
10
+ import StickyAnimation from './examples/StickyAnimation';
11
+ import StickyRTL from './examples/StickyRTL';
12
+ import {
13
+ BannerHoistedComponent,
14
+ BannerModelConfigComponent,
15
+ BannerIconComponent,
16
+ BannerLabelComponent,
17
+ BannerActionComponent,
18
+ } from './PropTables.splitprops.tsx';
7
19
 
8
20
 
9
21
  # Canvas Kit Banner
10
22
 
11
- Banners surface important information and feedback to the user about a task, action, or state.
23
+ `Banner` is a [compound component](/getting-started/for-developers/resources/compound-components/)
24
+ used surface important information and feedback to the user about a task, action, or state.
12
25
 
13
26
  [> Workday Design Reference](https://design.workday.com/components/indicators/banners)
14
27
 
@@ -22,38 +35,209 @@ yarn add @workday/canvas-kit-react
22
35
 
23
36
  ### Basic Example
24
37
 
38
+ Use the children of `Banner.Label` to set the main text for the `Banner`.
39
+
25
40
  <ExampleCodeBlock code={Basic} />
26
41
 
27
- ### Error Type
42
+ ### Action Text
28
43
 
29
- Set the `error` prop of the Banner to designate the severity of the message presented in the banner.
30
- `error` accepts the following values:
44
+ Use the children of `Banner.ActionText` to customize the action text contained in the `Banner`. The
45
+ text has default value of `View All`.
31
46
 
32
- - `Banner.ErrorType.Alert` (Default)
33
- - `Banner.ErrorType.Error`
47
+ <ExampleCodeBlock code={ActionText} />
34
48
 
35
- <ExampleCodeBlock code={Error} />
49
+ ### Error Type
36
50
 
37
- ### Variant
51
+ Set the `hasError` prop of the `Banner` to designate the severity of the message presented in the
52
+ banner. This will change the defualt icon to `exclamationCircleIcon`.
38
53
 
39
- Banner is available in two variants. `variant` accepts the following values:
54
+ <ExampleCodeBlock code={Error} />
40
55
 
41
- - `Banner.Variant.Full` (Default)
42
- - `Banner.Variant.Sticky`
56
+ ### Sticky
43
57
 
44
- Use the `Sticky` variant if the Banner is to be displayed along the right edge of the page.
58
+ Set the `isSticky` prop of the `Banner` to display it along the right edge of the page. When true,
59
+ the `Banner.ActionText` will be hidden. Some basic styles will be applied, but you will still need
60
+ to manually set the css `position` value.
45
61
 
46
62
  <ExampleCodeBlock code={Sticky} />
47
63
 
48
- #### Action Text
64
+ You can use keyframes to animate the `Banner` in.
49
65
 
50
- Set the `actionText` prop to customize the text of the link contained in the Banner. `actionText` is
51
- only available in the `Full` variant and has a default value of `View All`.
66
+ <ExampleCodeBlock code={StickyAnimation} />
52
67
 
53
- <ExampleCodeBlock code={ActionText} />
68
+ ### RefForwarding
69
+
70
+ `Banner` supports ref forwarding. It will forward ref to its underlying button element.
71
+
72
+ <ExampleCodeBlock code={RefForwarding} />
73
+
74
+ ### Right-to-Left (RTL)
75
+
76
+ Banner supports right-to-left languages when specified in the CanvasProvider theme.
77
+
78
+ <ExampleCodeBlock code={StickyRTL} />
79
+
80
+ ### Themed Banners
81
+
82
+ Banners use the `useThemedPalette` hook for themeing. By default, your alert theme is used. `main`
83
+ will be used for the background, `dark` for the hover background, and `contrast` for the text.
84
+
85
+ <ExampleCodeBlock code={ThemedAlert} />
86
+
87
+ If you set the `hasError` prop, the banner will use your error theme.
88
+
89
+ <ExampleCodeBlock code={ThemedError} />
90
+
91
+ ## Components
92
+
93
+ ### Banner
94
+
95
+ #### Usage
96
+
97
+ `Banner` is a container component rendered as a `<button>` element that is responsible for creating
98
+ a `BannerModel` and sharing it with its subcomponents using React context.
99
+
100
+ ```tsx
101
+ <Banner
102
+ isSticky={true}
103
+ hasError={true} id:
104
+ 'custom-banner-id'
105
+ onClick={() => console.log('clicked banner')}
106
+ >
107
+ {/* Child components */}
108
+ </Banner>
109
+ ```
110
+
111
+ Alternatively, you may pass in a model using the hoisted model pattern.
112
+
113
+ ```tsx
114
+ const model = useBannerModel({
115
+ isSticky: true,
116
+ hasError: true,
117
+ id: 'custom-banner-id',
118
+ });
119
+
120
+ return (
121
+ <Banner onClick={() => console.log('clicked banner')} model={model}>
122
+ {/* Child components */}
123
+ </Banner>
124
+ );
125
+ ```
126
+
127
+ #### Props
128
+
129
+ Undocumented props are spread to the underlying `<button>` element.
130
+
131
+ <ArgsTable of={BannerModelConfigComponent} />
132
+
133
+ If you're using the hoisted model pattern, follow this table instead (refer to the [Model](#model)
134
+ section for more information about `BannerModel`):
135
+
136
+ <ArgsTable of={BannerHoistedComponent} />
137
+
138
+ ### Banner.Icon
139
+
140
+ #### Usage
141
+
142
+ `Banner.Icon` is a styled `<SystemIcon>`. The icon defaults to exclamationTriangleIcon or
143
+ exclamationCircleIcon when the model's hasError is true.
144
+
145
+ ```tsx
146
+ <Banner.Icon />
147
+ ```
148
+
149
+ #### Props
150
+
151
+ You can override the default icon if needed.
152
+
153
+ Undocumented props are spread to the underlying `<SystemIcon>` element.
154
+
155
+ <ArgsTable of={BannerIconComponent} />
156
+
157
+ ### Banner.Label
158
+
159
+ #### Usage
160
+
161
+ `Banner.Label` is a styled `<Flex>`. This component will get an id that will be used for the
162
+ aria-describedby on the top level `<button>`.
163
+
164
+ ```tsx
165
+ <Banner.Label>3 Warnings</Banner.Label>
166
+ ```
167
+
168
+ #### Props
169
+
170
+ The children prop will be used as the Primary text of the Banner.
171
+
172
+ Undocumented props are spread to the underlying `<Flex>` element.
173
+
174
+ <ArgsTable of={BannerLabelComponent} />
175
+
176
+ ### Banner.ActionText
177
+
178
+ #### Usage
179
+
180
+ `Banner.ActionText` is a styled `<Box>`. This component will get an id that will be used for the
181
+ aria-labelledby on the top level `<button>`. This component will be visually hidden when the model's
182
+ `isSticky` prop is set to true.
183
+
184
+ ```tsx
185
+ <Banner.ActionText>Custom call to action</Banner.ActionText>
186
+ ```
187
+
188
+ #### Props
189
+
190
+ The children prop will be used as the 'call to action' text of the Banner.
191
+
192
+ Undocumented props are spread to the underlying `<Box>` element.
193
+
194
+ <ArgsTable of={BannerActionComponent} />
195
+
196
+ ## Model
197
+
198
+ If `Banner` was stripped of all its markup, attributes, and styling, what would remain is the
199
+ [model](/getting-started/for-developers/resources/compound-components/#models). The model is an
200
+ object that holds the `state`, i.e. a description of the current snapshot in time of the component.
201
+
202
+ By default, `Banner` will create a model and share it internally with its subcomponents using React
203
+ context. You may subscribe to `BannerContext` if you wish to create a custom subcomponent for your
204
+ implementation. Here's a simple example.
205
+
206
+ ```tsx
207
+ import * as React from 'react';
208
+ import {Banner, BannerModelContext} from '@workday/canvas-kit-react/banner';
209
+
210
+ const CustomText = (props: React.HTMLAttributes<HTMLSpanElement>) => {
211
+ const model = React.useContext(BannerModelContext);
212
+
213
+ return <span {...props}>{model.state.hasError ? 'Error:' : 'Warning:'}</span>;
214
+ };
215
+
216
+ export const CustomBanner = () => {
217
+ return (
218
+ <Banner>
219
+ <CustomText />
220
+ {/* Other subcomponents */}
221
+ </Banner>
222
+ );
223
+ };
224
+ ```
225
+
226
+ Alternatively, if you need direct access to the model's `state` outside of the `Banner` component,
227
+ you may configure your own model with `useBannerModel` and pass it to `Banner` via a pattern called
228
+ [hoisting the model](/getting-started/for-developers/resources/compound-components/#configuring-a-model).
229
+
230
+ ```tsx
231
+ const model = useBannerModel({
232
+ isError: true,
233
+ });
234
+
235
+ <Banner model={model}>{/* Child components */}</Banner>;
236
+ ```
54
237
 
55
- ## Props
238
+ ### Config
56
239
 
57
- Undocumented props are spread to the outermost element rendered by Banner.
240
+ `useBannerModel` accepts a configuration object with the following properties and returns a
241
+ `BannerModel` with a `state` property.
58
242
 
59
- <ArgsTable of={Banner} />
243
+ <ArgsTable of={BannerModelConfigComponent} />
@@ -0,0 +1,39 @@
1
+ import {BannerModel, BannerModelConfig} from '@workday/canvas-kit-react/banner';
2
+ import {CanvasSystemIcon} from '@workday/design-assets-types';
3
+ import {BannerActionProps} from '../lib/BannerAction';
4
+
5
+ // <ArgsTable of={Banner} /> generates a very large props table given that
6
+ // BannerProps includes FlexProps. Use this dummy component instead to
7
+ // limit the props shown.
8
+ export const BannerHoistedComponent = (_: {model: BannerModel}) => <div />;
9
+
10
+ // <ArgsTable of={Banner.Icon} /> generates a props table with
11
+ // SystemIcon props. Use this dummy component instead to limit the props shown.
12
+ export const BannerIconComponent = (_: {
13
+ /**
14
+ * Icon to show next to label
15
+ * @default `exclamationTriangleIcon` or `exclamationCircleIcon` when hasError is true
16
+ */
17
+ icon?: CanvasSystemIcon;
18
+ }) => <div />;
19
+
20
+ // <ArgsTable of={Banner.Label} /> generates a props table with
21
+ // Flex props. Use this dummy component instead to limit the props shown.
22
+ export const BannerLabelComponent = (_: {
23
+ /**
24
+ * The text of the Banner.
25
+ */
26
+ children: React.ReactNode;
27
+ }) => <div />;
28
+
29
+ // <ArgsTable of={Banner.ActionText} /> generates a props table with
30
+ // Box props. Use this dummy component instead to limit the props shown.
31
+ export const BannerActionComponent = (_: {
32
+ /**
33
+ * The text of the Banner action.
34
+ * @default 'View All'
35
+ */
36
+ children?: React.ReactNode;
37
+ }) => <div />;
38
+
39
+ export const BannerModelConfigComponent = (_: BannerModelConfig) => <div />;
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
+
2
3
  import {Banner} from '@workday/canvas-kit-react/banner';
3
4
 
4
5
  export default () => {
5
- return <Banner actionText="Show Details" label="3 Warnings" />;
6
+ return (
7
+ <Banner>
8
+ <Banner.Icon />
9
+ <Banner.Label>3 Warnings</Banner.Label>
10
+ <Banner.ActionText>Show Details</Banner.ActionText>
11
+ </Banner>
12
+ );
6
13
  };
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
+
2
3
  import {Banner} from '@workday/canvas-kit-react/banner';
3
4
 
4
5
  export default () => {
5
- return <Banner label="3 Warnings" />;
6
+ return (
7
+ <Banner onClick={() => console.log('clicked banner')}>
8
+ <Banner.Icon />
9
+ <Banner.Label>3 Warnings</Banner.Label>
10
+ <Banner.ActionText />
11
+ </Banner>
12
+ );
6
13
  };
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
+
2
3
  import {Banner} from '@workday/canvas-kit-react/banner';
3
4
 
4
5
  export default () => {
5
- return <Banner error={Banner.ErrorType.Error} label="3 Errors" />;
6
+ return (
7
+ <Banner hasError={true}>
8
+ <Banner.Icon />
9
+ <Banner.Label>3 Errors</Banner.Label>
10
+ <Banner.ActionText />
11
+ </Banner>
12
+ );
6
13
  };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+
3
+ import {changeFocus} from '@workday/canvas-kit-react/common';
4
+ import {Banner} from '@workday/canvas-kit-react/banner';
5
+ import {SecondaryButton} from '../../..';
6
+ import {VStack} from '@workday/canvas-kit-labs-react';
7
+
8
+ export default () => {
9
+ const bannerRef = React.useRef<HTMLButtonElement>(null);
10
+
11
+ const focusBanner = () => {
12
+ changeFocus(bannerRef.current);
13
+ };
14
+
15
+ return (
16
+ <VStack spacing="xs" alignItems="flex-start">
17
+ <Banner ref={bannerRef}>
18
+ <Banner.Icon />
19
+ <Banner.Label>3 Warnings</Banner.Label>
20
+ <Banner.ActionText />
21
+ </Banner>
22
+ <SecondaryButton onClick={focusBanner}>Focus Banner</SecondaryButton>
23
+ </VStack>
24
+ );
25
+ };
@@ -1,16 +1,21 @@
1
1
  import React from 'react';
2
- import {Banner} from '@workday/canvas-kit-react/banner';
3
2
  import {Box} from '@workday/canvas-kit-labs-react/common';
3
+ import {Banner} from '@workday/canvas-kit-react/banner';
4
+ import {styled} from '@workday/canvas-kit-react/common';
5
+
6
+ const StyledBanner = styled(Banner)({
7
+ position: 'absolute',
8
+ right: 0,
9
+ });
4
10
 
5
11
  export default () => {
6
12
  return (
7
13
  <Box height={64}>
8
- <Banner
9
- error={Banner.ErrorType.Error}
10
- label="3 Errors"
11
- variant={Banner.Variant.Sticky}
12
- style={{position: 'absolute', right: 0}}
13
- />
14
+ <StyledBanner hasError={true} isSticky={true}>
15
+ <Banner.Icon />
16
+ <Banner.Label>3 Errors</Banner.Label>
17
+ <Banner.ActionText />
18
+ </StyledBanner>
14
19
  </Box>
15
20
  );
16
21
  };
@@ -0,0 +1,63 @@
1
+ /** @jsxRuntime classic */
2
+ /** @jsx jsx */
3
+ import {jsx, keyframes} from '@emotion/core';
4
+ import React from 'react';
5
+
6
+ import {CSSProperties} from '@workday/canvas-kit-react/tokens';
7
+ import {Box, useThemeRTL} from '@workday/canvas-kit-labs-react/common';
8
+ import {loopIcon} from '@workday/canvas-system-icons-web';
9
+ import {Banner} from '@workday/canvas-kit-react/banner';
10
+
11
+ const containerStyles: CSSProperties = {
12
+ position: 'absolute',
13
+ right: 0,
14
+ overflow: 'hidden',
15
+ };
16
+
17
+ export default () => {
18
+ const {themeRTL, theme} = useThemeRTL();
19
+ const bannerRef = React.useRef<HTMLButtonElement>(null);
20
+ const containerRef = React.useRef<HTMLDivElement>(null);
21
+ const [styles, setStyles] = React.useState<CSSProperties>();
22
+
23
+ const [rerun, setRerun] = React.useState(1); // Only needed for demo purposes
24
+
25
+ React.useLayoutEffect(() => {
26
+ let width = bannerRef.current.offsetWidth;
27
+ if (theme.canvas.direction === 'rtl') {
28
+ width *= -1;
29
+ }
30
+ const slideInKeyframes = keyframes({
31
+ '0%': {
32
+ transform: `translateX(${width}px)`,
33
+ },
34
+ '100%': {
35
+ transform: `translateX(0 * ${rerun})`,
36
+ },
37
+ });
38
+
39
+ setStyles({
40
+ margin: '4px 0px 4px 4px', // Room for focus outline since container is overflow hidden
41
+ animation: `${slideInKeyframes} .3s ease-out forwards`,
42
+ });
43
+ }, [theme.canvas.direction, rerun]);
44
+
45
+ return (
46
+ <Box height={64}>
47
+ <div css={containerStyles} ref={containerRef}>
48
+ <div css={themeRTL(styles)}>
49
+ <Banner
50
+ onClick={() => setRerun(r => r + 1)}
51
+ hasError={true}
52
+ isSticky={true}
53
+ ref={bannerRef}
54
+ >
55
+ <Banner.Icon icon={loopIcon} />
56
+ <Banner.Label>Click to run animation</Banner.Label>
57
+ <Banner.ActionText />
58
+ </Banner>
59
+ </div>
60
+ </div>
61
+ </Box>
62
+ );
63
+ };
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+
3
+ import {Box, useThemeRTL} from '@workday/canvas-kit-labs-react/common';
4
+ import {
5
+ CanvasProvider,
6
+ ContentDirection,
7
+ PartialEmotionCanvasTheme,
8
+ styled,
9
+ } from '@workday/canvas-kit-react/common';
10
+ import {Banner} from '@workday/canvas-kit-react/banner';
11
+
12
+ const theme: PartialEmotionCanvasTheme = {
13
+ canvas: {
14
+ direction: ContentDirection.RTL,
15
+ },
16
+ };
17
+
18
+ const StyledStickyBanner = styled(Banner)({
19
+ position: 'absolute',
20
+ left: 0,
21
+ });
22
+
23
+ export default () => {
24
+ const {themeRTL} = useThemeRTL();
25
+ return (
26
+ <CanvasProvider theme={theme}>
27
+ <Box height={64}>
28
+ <StyledStickyBanner isSticky={true}>
29
+ <Banner.Icon />
30
+ <Banner.Label>3 אזהרות</Banner.Label>
31
+ <Banner.ActionText />
32
+ </StyledStickyBanner>
33
+ </Box>
34
+ </CanvasProvider>
35
+ );
36
+ };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+
3
+ import {Banner} from '@workday/canvas-kit-react/banner';
4
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
5
+ import {colors} from '@workday/canvas-kit-react/tokens';
6
+
7
+ export default () => {
8
+ const theme: PartialEmotionCanvasTheme = {
9
+ canvas: {
10
+ palette: {
11
+ alert: {
12
+ main: colors.kiwi200,
13
+ dark: colors.kiwi300,
14
+ },
15
+ },
16
+ },
17
+ };
18
+
19
+ return (
20
+ <CanvasProvider theme={theme}>
21
+ <Banner>
22
+ <Banner.Icon />
23
+ <Banner.Label>3 Items</Banner.Label>
24
+ <Banner.ActionText />
25
+ </Banner>
26
+ </CanvasProvider>
27
+ );
28
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+
3
+ import {Banner} from '@workday/canvas-kit-react/banner';
4
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
5
+ import {colors} from '@workday/canvas-kit-react/tokens';
6
+
7
+ export default () => {
8
+ const theme: PartialEmotionCanvasTheme = {
9
+ canvas: {
10
+ palette: {
11
+ error: {
12
+ main: colors.islandPunch500,
13
+ dark: colors.islandPunch600,
14
+ contrast: colors.berrySmoothie100,
15
+ },
16
+ },
17
+ },
18
+ };
19
+
20
+ return (
21
+ <CanvasProvider theme={theme}>
22
+ <Banner hasError={true}>
23
+ <Banner.Icon />
24
+ <Banner.Label>3 Items</Banner.Label>
25
+ <Banner.ActionText />
26
+ </Banner>
27
+ </CanvasProvider>
28
+ );
29
+ };
@@ -1,20 +1,17 @@
1
- /** @jsx jsx */
2
- import {jsx} from '@emotion/core';
3
1
  import React from 'react';
4
2
 
5
- import {space, colors, borderRadius} from '@workday/canvas-kit-react/tokens';
3
+ import {colors} from '@workday/canvas-kit-react/tokens';
6
4
  import {IconButton} from '@workday/canvas-kit-react/button';
7
5
  import {activityStreamIcon} from '@workday/canvas-system-icons-web';
8
-
9
- const blueBackground = {
10
- backgroundColor: colors.blueberry400,
11
- borderRadius: borderRadius.m,
12
- padding: space.xxs,
13
- display: 'inline-block',
14
- };
6
+ import {Flex} from '@workday/canvas-kit-labs-react/layout';
15
7
 
16
8
  export default () => (
17
- <div css={blueBackground}>
9
+ <Flex
10
+ display="inline-flex"
11
+ backgroundColor={colors.blackPepper400}
12
+ borderRadius="m"
13
+ padding="xxs"
14
+ >
18
15
  <IconButton icon={activityStreamIcon} aria-label="Activity Stream" variant="inverse" />
19
- </div>
16
+ </Flex>
20
17
  );
@@ -1,20 +1,17 @@
1
- /** @jsx jsx */
2
- import {jsx} from '@emotion/core';
3
1
  import React from 'react';
4
2
 
5
- import {space, colors, borderRadius} from '@workday/canvas-kit-react/tokens';
3
+ import {colors} from '@workday/canvas-kit-react/tokens';
6
4
  import {IconButton} from '@workday/canvas-kit-react/button';
7
5
  import {activityStreamIcon} from '@workday/canvas-system-icons-web';
8
-
9
- const blueBackground = {
10
- backgroundColor: colors.blueberry400,
11
- borderRadius: borderRadius.m,
12
- padding: space.xxs,
13
- display: 'inline-block',
14
- };
6
+ import {Flex} from '@workday/canvas-kit-labs-react/layout';
15
7
 
16
8
  export default () => (
17
- <div css={blueBackground}>
9
+ <Flex
10
+ display="inline-flex"
11
+ backgroundColor={colors.blackPepper400}
12
+ borderRadius="m"
13
+ padding="xxs"
14
+ >
18
15
  <IconButton icon={activityStreamIcon} aria-label="Activity Stream" variant="inverseFilled" />
19
- </div>
16
+ </Flex>
20
17
  );
@@ -1,6 +1,5 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
- import {jsx, keyframes} from '@emotion/core';
2
+ import {keyframes} from '@emotion/core';
4
3
 
5
4
  import {
6
5
  Card,
@@ -9,6 +8,7 @@ import {
9
8
  SecondaryButton,
10
9
  SystemIconCircle,
11
10
  TextInput,
11
+ styled,
12
12
  } from '@workday/canvas-kit-react';
13
13
 
14
14
  import {Box, Flex} from '@workday/canvas-kit-labs-react';
@@ -16,6 +16,7 @@ import {Box, Flex} from '@workday/canvas-kit-labs-react';
16
16
  import {Skeleton} from '@workday/canvas-kit-react/skeleton';
17
17
  import {borderRadius, space, type} from '@workday/canvas-kit-react/tokens';
18
18
  import {patternIcon} from '@workday/canvas-system-icons-web';
19
+ import {StyledType} from '@workday/canvas-kit-react/common';
19
20
 
20
21
  const fadeOut = keyframes`
21
22
  from {
@@ -27,6 +28,10 @@ const fadeOut = keyframes`
27
28
  }
28
29
  `;
29
30
 
31
+ const StyledSimulation = styled(Box)<StyledType>({
32
+ pointerEvents: 'none',
33
+ });
34
+
30
35
  export default () => {
31
36
  const [loading, setLoading] = React.useState(true);
32
37
  const [loadTime, setLoadTime] = React.useState('3000');
@@ -96,16 +101,12 @@ export default () => {
96
101
  </Box>
97
102
  )}
98
103
 
99
- <Box
104
+ <StyledSimulation
100
105
  position="absolute"
101
106
  top={0}
102
107
  left={0}
103
108
  width="100%"
104
- css={{
105
- pointerEvents: 'none',
106
- animation: !loading ? `${fadeOut} 150ms ease-out` : undefined,
107
- animationFillMode: !loading ? 'forwards' : undefined,
108
- }}
109
+ animation={!loading ? `${fadeOut} 150ms ease-out forwards` : undefined}
109
110
  >
110
111
  <Skeleton>
111
112
  <Flex alignItems="center">
@@ -120,7 +121,7 @@ export default () => {
120
121
  </Flex>
121
122
  <Skeleton.Text lineCount={3} />
122
123
  </Skeleton>
123
- </Box>
124
+ </StyledSimulation>
124
125
  </Box>
125
126
  </Card.Body>
126
127
  </Card>