@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.
Files changed (46) 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 +110 -0
  4. package/dist/mdx/preview-react/form-field/FormField.mdx +3 -15
  5. package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +16 -22
  6. package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +8 -13
  7. package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +8 -12
  8. package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +15 -22
  9. package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +8 -13
  10. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +1 -0
  11. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +6 -4
  12. package/dist/mdx/preview-react/text-input/TextInput.mdx +7 -0
  13. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +1 -0
  14. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +6 -4
  15. package/dist/mdx/preview-react/{_examples/examples/TextInputWithFormik.tsx → text-input/examples/LoginForm.tsx} +0 -0
  16. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +1 -0
  17. package/dist/mdx/react/action-bar/ActionBar.mdx +7 -25
  18. package/dist/mdx/react/action-bar/examples/Basic.tsx +3 -3
  19. package/dist/mdx/react/banner/Banner.mdx +203 -19
  20. package/dist/mdx/react/banner/PropTables.splitprops.tsx +39 -0
  21. package/dist/mdx/react/banner/examples/ActionText.tsx +8 -1
  22. package/dist/mdx/react/banner/examples/Basic.tsx +8 -1
  23. package/dist/mdx/react/banner/examples/Error.tsx +8 -1
  24. package/dist/mdx/react/banner/examples/RefForwarding.tsx +25 -0
  25. package/dist/mdx/react/banner/examples/Sticky.tsx +12 -7
  26. package/dist/mdx/react/banner/examples/StickyAnimation.tsx +63 -0
  27. package/dist/mdx/react/banner/examples/StickyRTL.tsx +36 -0
  28. package/dist/mdx/react/banner/examples/ThemedAlert.tsx +28 -0
  29. package/dist/mdx/react/banner/examples/ThemedError.tsx +29 -0
  30. package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +9 -12
  31. package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +9 -12
  32. package/dist/mdx/react/modal/Modal.mdx +21 -0
  33. package/dist/mdx/react/modal/examples/Basic.tsx +4 -2
  34. package/dist/mdx/react/modal/examples/BodyOverflow.tsx +56 -0
  35. package/dist/mdx/react/modal/examples/CustomFocus.tsx +5 -2
  36. package/dist/mdx/react/modal/examples/FullOverflow.tsx +55 -0
  37. package/dist/mdx/react/modal/examples/ReturnFocus.tsx +4 -1
  38. package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +5 -2
  39. package/dist/mdx/react/skeleton/examples/Simulation.tsx +10 -9
  40. package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
  41. package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
  42. package/package.json +3 -3
  43. package/dist/mdx/preview-react/_examples/SelectWithFormik.mdx +0 -8
  44. package/dist/mdx/preview-react/_examples/TextInputWithFormik.mdx +0 -8
  45. package/dist/mdx/preview-react/_examples/examples/SelectWithFormik.tsx +0 -47
  46. package/dist/mdx/preview-react/form-field/examples/Select.tsx +0 -50
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+
3
+ import {Modal} from '@workday/canvas-kit-react/modal';
4
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
5
+ import {HStack, VStack, Stack, Box} from '@workday/canvas-kit-labs-react';
6
+ import {space} from '@workday/canvas-kit-react/tokens';
7
+
8
+ export default () => {
9
+ const handleDelete = () => {
10
+ console.log('Deleted item');
11
+ };
12
+
13
+ return (
14
+ <Modal>
15
+ <Modal.Target as={DeleteButton}>Delete Item</Modal.Target>
16
+ <Modal.Overlay>
17
+ <Modal.Card>
18
+ <Modal.CloseIcon aria-label="Close" />
19
+ <Modal.Heading>Delete Item</Modal.Heading>
20
+ <Modal.Body>
21
+ <p>Are you sure you want to delete the item?</p>
22
+ <p>Are you sure you want to delete the item?</p>
23
+ <p>Are you sure you want to delete the item?</p>
24
+ <p>Are you sure you want to delete the item?</p>
25
+ <p>Are you sure you want to delete the item?</p>
26
+ <p>Are you sure you want to delete the item?</p>
27
+ <p>Are you sure you want to delete the item?</p>
28
+ <p>Are you sure you want to delete the item?</p>
29
+ <p>Are you sure you want to delete the item?</p>
30
+ <p>Are you sure you want to delete the item?</p>
31
+ <p>Are you sure you want to delete the item?</p>
32
+ <p>Are you sure you want to delete the item?</p>
33
+ <p>Are you sure you want to delete the item?</p>
34
+ <p>Are you sure you want to delete the item?</p>
35
+ <p>Are you sure you want to delete the item?</p>
36
+ <p>Are you sure you want to delete the item?</p>
37
+ <p>Are you sure you want to delete the item?</p>
38
+ <p>Are you sure you want to delete the item?</p>
39
+ <p>Are you sure you want to delete the item?</p>
40
+ <p>Are you sure you want to delete the item?</p>
41
+ <p>Are you sure you want to delete the item?</p>
42
+ <p>Are you sure you want to delete the item?</p>
43
+ <p>Are you sure you want to delete the item?</p>
44
+ <p>Are you sure you want to delete the item?</p>
45
+ </Modal.Body>
46
+ <HStack spacing="s" paddingTop="s">
47
+ <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
48
+ Delete
49
+ </Modal.CloseButton>
50
+ <Modal.CloseButton>Cancel</Modal.CloseButton>
51
+ </HStack>
52
+ </Modal.Card>
53
+ </Modal.Overlay>
54
+ </Modal>
55
+ );
56
+ };
@@ -3,7 +3,8 @@ import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import FormField from '@workday/canvas-kit-react/form-field';
5
5
  import TextInput from '@workday/canvas-kit-react/text-input';
6
- import {HStack} from '@workday/canvas-kit-labs-react';
6
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
7
+ import {Box} from '@workday/canvas-kit-labs-react/common';
7
8
 
8
9
  export default () => {
9
10
  const ref = React.useRef<HTMLInputElement>(null);
@@ -24,7 +25,9 @@ export default () => {
24
25
  <Modal.CloseIcon aria-label="Close" />
25
26
  <Modal.Heading>Delete Item</Modal.Heading>
26
27
  <Modal.Body>
27
- <p>Enter name to confirm deletion</p>
28
+ <Box as="p" marginTop={0} marginBottom="m">
29
+ Enter name to confirm deletion
30
+ </Box>
28
31
  <FormField label="Item name">
29
32
  <TextInput ref={ref} value={value} onChange={e => setValue(e.currentTarget.value)} />
30
33
  </FormField>
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+
3
+ import {Modal} from '@workday/canvas-kit-react/modal';
4
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
5
+ import {HStack} from '@workday/canvas-kit-labs-react';
6
+
7
+ export default () => {
8
+ const handleDelete = () => {
9
+ console.log('Deleted item');
10
+ };
11
+
12
+ return (
13
+ <Modal>
14
+ <Modal.Target as={DeleteButton}>Delete Item</Modal.Target>
15
+ <Modal.OverflowOverlay>
16
+ <Modal.Card maxHeight="inherit" height="inherit">
17
+ <Modal.CloseIcon aria-label="Close" />
18
+ <Modal.Heading>Delete Item</Modal.Heading>
19
+ <Modal.Body>
20
+ <p>Are you sure you want to delete the item?</p>
21
+ <p>Are you sure you want to delete the item?</p>
22
+ <p>Are you sure you want to delete the item?</p>
23
+ <p>Are you sure you want to delete the item?</p>
24
+ <p>Are you sure you want to delete the item?</p>
25
+ <p>Are you sure you want to delete the item?</p>
26
+ <p>Are you sure you want to delete the item?</p>
27
+ <p>Are you sure you want to delete the item?</p>
28
+ <p>Are you sure you want to delete the item?</p>
29
+ <p>Are you sure you want to delete the item?</p>
30
+ <p>Are you sure you want to delete the item?</p>
31
+ <p>Are you sure you want to delete the item?</p>
32
+ <p>Are you sure you want to delete the item?</p>
33
+ <p>Are you sure you want to delete the item?</p>
34
+ <p>Are you sure you want to delete the item?</p>
35
+ <p>Are you sure you want to delete the item?</p>
36
+ <p>Are you sure you want to delete the item?</p>
37
+ <p>Are you sure you want to delete the item?</p>
38
+ <p>Are you sure you want to delete the item?</p>
39
+ <p>Are you sure you want to delete the item?</p>
40
+ <p>Are you sure you want to delete the item?</p>
41
+ <p>Are you sure you want to delete the item?</p>
42
+ <p>Are you sure you want to delete the item?</p>
43
+ <p>Are you sure you want to delete the item?</p>
44
+ </Modal.Body>
45
+ <HStack spacing="s">
46
+ <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
47
+ Delete
48
+ </Modal.CloseButton>
49
+ <Modal.CloseButton>Cancel</Modal.CloseButton>
50
+ </HStack>
51
+ </Modal.Card>
52
+ </Modal.OverflowOverlay>
53
+ </Modal>
54
+ );
55
+ };
@@ -3,6 +3,7 @@ import {Modal, useModalModel} from '@workday/canvas-kit-react/modal';
3
3
  import {DeleteButton, SecondaryButton} from '@workday/canvas-kit-react/button';
4
4
  import {FormField} from '@workday/canvas-kit-react/form-field';
5
5
  import {HStack} from '@workday/canvas-kit-labs-react/layout';
6
+ import {Box} from '@workday/canvas-kit-labs-react/common';
6
7
  import {Select} from '@workday/canvas-kit-preview-react/select';
7
8
 
8
9
  export default () => {
@@ -39,7 +40,9 @@ export default () => {
39
40
  <Modal.CloseIcon aria-label="Close" />
40
41
  <Modal.Heading>Delete Item</Modal.Heading>
41
42
  <Modal.Body>
42
- <p>Are you sure you want to delete the item?</p>
43
+ <Box as="p" marginTop={0} marginBottom="m">
44
+ Are you sure you want to delete the item?
45
+ </Box>
43
46
  <HStack spacing="s">
44
47
  <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
45
48
  Delete
@@ -10,7 +10,8 @@ import {
10
10
  useDisableBodyScroll,
11
11
  } from '@workday/canvas-kit-react/popup';
12
12
  import {DeleteButton} from '@workday/canvas-kit-react/button';
13
- import {HStack} from '@workday/canvas-kit-labs-react';
13
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
14
+ import {Box} from '@workday/canvas-kit-labs-react/common';
14
15
 
15
16
  export default () => {
16
17
  const model = usePopupModel();
@@ -32,7 +33,9 @@ export default () => {
32
33
  <Modal.Card>
33
34
  <Modal.Heading>Delete Item</Modal.Heading>
34
35
  <Modal.Body>
35
- <p>Are you sure you want to delete the item?</p>
36
+ <Box as="p" marginTop={0} marginBottom="m">
37
+ Are you sure you want to delete the item?
38
+ </Box>
36
39
  <HStack spacing="s">
37
40
  <Modal.CloseButton as={DeleteButton} onClick={handleDelete}>
38
41
  Delete
@@ -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>
@@ -3,6 +3,7 @@ import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
3
3
  import Basic from './examples/Basic';
4
4
  import Icon from './examples/Icon';
5
5
  import Emphasis from './examples/Emphasis';
6
+ import MaxWidth from './examples/MaxWidth';
6
7
 
7
8
 
8
9
  # Canvas Kit Status Indicator
@@ -54,6 +55,17 @@ label.
54
55
 
55
56
  <ExampleCodeBlock code={Icon} />
56
57
 
58
+ ### Max Width
59
+
60
+ By default, the maximum width of a Status Indicator is `200px`. When the text in the StatusIndicator
61
+ exceeds the max width, it will be truncated with an ellipsis. This maxWidth can be customized.
62
+
63
+ Avoid truncation wherever possible by using shorter text in Status Indicators. In the case where
64
+ truncation is necessary, you should use an `OverflowTooltip`. For the full text to be accessible
65
+ when you do this, you should make the tooltip focusable with `tabIndex`.
66
+
67
+ <ExampleCodeBlock code={MaxWidth} />
68
+
57
69
  ## Props
58
70
 
59
71
  Undocumented props are spread to the outermost element rendered by Status Indicator.
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import styled from '@emotion/styled';
3
+ import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
4
+ import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
5
+ import {space} from '@workday/canvas-kit-react/tokens';
6
+
7
+ const StatusIndicators = styled('div')({
8
+ '& > *': {
9
+ margin: space.xxs,
10
+ },
11
+ });
12
+
13
+ export default () => {
14
+ return (
15
+ <StatusIndicators>
16
+ <StatusIndicator
17
+ label="Longer Than Normal Ellipsized Status"
18
+ type={StatusIndicator.Type.Blue}
19
+ maxWidth={250}
20
+ />
21
+ <OverflowTooltip>
22
+ <StatusIndicator
23
+ label="Overflow Tooltip On Hover/Focus Status"
24
+ type={StatusIndicator.Type.Green}
25
+ tabIndex={0}
26
+ />
27
+ </OverflowTooltip>
28
+ </StatusIndicators>
29
+ );
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "6.3.6",
3
+ "version": "7.0.0-alpha.0-next.4+bdd1ec94",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "@storybook/csf": "0.0.1",
53
- "@workday/canvas-kit-react": "^6.3.6"
53
+ "@workday/canvas-kit-react": "^7.0.0-alpha.0-next.4+bdd1ec94"
54
54
  },
55
55
  "devDependencies": {
56
56
  "fs-extra": "^10.0.0",
@@ -58,5 +58,5 @@
58
58
  "mkdirp": "^1.0.3",
59
59
  "typescript": "^3.8.3"
60
60
  },
61
- "gitHead": "3322ef6ba113940373412840edd14d35a7a3093c"
61
+ "gitHead": "bdd1ec9493a5a2dc4d67e4cc33adcba13efee4b7"
62
62
  }
@@ -1,8 +0,0 @@
1
- import SelectWithFormik from './examples/SelectWithFormik';
2
-
3
-
4
- # Canvas Kit Examples
5
-
6
- ## Select With Formik
7
-
8
- <ExampleCodeBlock code={SelectWithFormik} />
@@ -1,8 +0,0 @@
1
- import TextInputWithFormik from './examples/TextInputWithFormik';
2
-
3
-
4
- # Canvas Kit Examples
5
-
6
- ## Text Input With Formik
7
-
8
- <ExampleCodeBlock code={TextInputWithFormik} />
@@ -1,47 +0,0 @@
1
- import * as React from 'react';
2
- import {useFormik} from 'formik';
3
- import {Select} from '@workday/canvas-kit-preview-react/select';
4
- import {
5
- FormField,
6
- useFormFieldInput,
7
- useFormFieldModel,
8
- } from '@workday/canvas-kit-preview-react/form-field';
9
-
10
- export default () => {
11
- const formik = useFormik({
12
- initialValues: {
13
- selectedBook: '',
14
- },
15
- onSubmit: data => {
16
- console.log(data);
17
- },
18
- });
19
-
20
- const model = useFormFieldModel();
21
- const formFieldInputProps = useFormFieldInput(model);
22
-
23
- return (
24
- <form onSubmit={formik.handleSubmit}>
25
- <FormField orientation="vertical" alignItems="stretch">
26
- <FormField.Label>Choose a book</FormField.Label>
27
- <Select
28
- name="selectedBook"
29
- options={bookList}
30
- onChange={event => formik.setFieldValue('selectedBook', event.currentTarget.value)}
31
- value={formik.values.selectedBook}
32
- grow
33
- {...formFieldInputProps}
34
- />
35
- </FormField>
36
- </form>
37
- );
38
- };
39
-
40
- const bookList = [
41
- {label: 'Dessert Person by Claire Saffitz', value: 'dessert person'},
42
- {label: 'Elements of Pizza by Ken Forkish', value: 'the elements of pizza'},
43
- {label: 'Flour Water Salt Yeast by Ken Forkish', value: 'flour water salt yeast'},
44
- {label: 'Mastering Pasta by Marc Verti', value: 'mastering pasta'},
45
- {label: 'Patisserie by Christophe Felder', value: 'patisserie'},
46
- {label: 'Tartine by Elisabeth Prueitt & Chad Robertson', value: 'tartine'},
47
- ];
@@ -1,50 +0,0 @@
1
- import * as React from 'react';
2
- import {
3
- FormField,
4
- useFormFieldInput,
5
- useFormFieldModel,
6
- } from '@workday/canvas-kit-preview-react/form-field';
7
- import {Select} from '@workday/canvas-kit-preview-react/select';
8
-
9
- export default () => {
10
- const [selected, setSelected] = React.useState(wineList[0].value);
11
- // Hoist the FormField model so we can pass it to `useFormFieldInput`
12
- const model = useFormFieldModel({isRequired: true});
13
- // Get all the FormField-related input props to pass to `Select`
14
- const formFieldInputProps = useFormFieldInput(model);
15
-
16
- return (
17
- <FormField orientation="vertical" model={model}>
18
- <FormField.Label>Choose a wine</FormField.Label>
19
- <Select
20
- options={wineList}
21
- value={selected}
22
- onChange={event => setSelected(event.currentTarget.value)}
23
- {...formFieldInputProps}
24
- />
25
- <FormField.Hint>When in doubt, go with the Chianti.</FormField.Hint>
26
- </FormField>
27
- );
28
- };
29
-
30
- export default [
31
- {label: 'Beaujolais', value: 'beaujolais'},
32
- {label: 'Bordeaux', value: 'bordeaux'},
33
- {label: 'Cabernet Sauvignon', value: 'cabernet sauvignon'},
34
- {label: 'Champagne', value: 'champagne'},
35
- {label: 'Chardonnay', value: 'chardonnay'},
36
- {label: 'Chianti', value: 'chianti'},
37
- {label: 'Malbec', value: 'malbec'},
38
- {label: 'Merlot', value: 'merlot'},
39
- {label: 'Pinot Grigio', value: 'pinot grigio'},
40
- {label: 'Pinot Gris', value: 'pinot gris'},
41
- {label: 'Pinot Noir', value: 'pinot noir'},
42
- {label: 'Primitivo', value: 'primitivo'},
43
- {label: 'Prosecco', value: 'prosecco'},
44
- {label: 'Riesling', value: 'riesling'},
45
- {label: 'Rioja', value: 'rioja'},
46
- {label: 'Rosé', value: 'rosé'},
47
- {label: 'Sauvignon Blanc', value: 'sauvignon blanc'},
48
- {label: 'Syrah', value: 'syrah'},
49
- {label: 'Zinfandel', value: 'zinfandel'},
50
- ];