@workday/canvas-kit-docs 7.1.0-next.0 → 7.2.0-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.
@@ -712,12 +712,12 @@ export type BasicButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
712
712
  export const BasicButton = ({children, ...elemProps}: BasicButtonProps) => {
713
713
  return (
714
714
  <BaseButton
715
- colors={getPaginationButtonColors(toggled)}
715
+ colors={getPaginationButtonColors()}
716
716
  {...elemProps}
717
717
  >
718
718
  <BaseButton.Label>{children}</BaseButton.Label>
719
719
  <BaseButton.Icon icon={plusIcon}>
720
- </StyledToggleButton>
720
+ </BaseButton>
721
721
  );
722
722
  };
723
723
  ```
@@ -39,7 +39,9 @@ export default () => {
39
39
  if (!formattedValue.length) {
40
40
  setWineList(initialWineList);
41
41
  } else {
42
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
42
+ const filteredItems = initialWineList.filter(wine =>
43
+ wine.toLowerCase().includes(formattedValue)
44
+ );
43
45
  setWineList(filteredItems);
44
46
  }
45
47
  };
@@ -40,7 +40,9 @@ export default () => {
40
40
  if (!formattedValue.length) {
41
41
  setWineList(initialWineList);
42
42
  } else {
43
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
43
+ const filteredItems = initialWineList.filter(wine =>
44
+ wine.toLowerCase().includes(formattedValue)
45
+ );
44
46
  setWineList(filteredItems);
45
47
  }
46
48
  };
@@ -39,7 +39,9 @@ export default () => {
39
39
  if (!formattedValue.length) {
40
40
  setWineList(initialWineList);
41
41
  } else {
42
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
42
+ const filteredItems = initialWineList.filter(wine =>
43
+ wine.toLowerCase().includes(formattedValue)
44
+ );
43
45
  setWineList(filteredItems);
44
46
  }
45
47
  };
@@ -40,7 +40,9 @@ export default () => {
40
40
  if (!formattedValue.length) {
41
41
  setWineList(initialWineList);
42
42
  } else {
43
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
43
+ const filteredItems = initialWineList.filter(wine =>
44
+ wine.toLowerCase().includes(formattedValue)
45
+ );
44
46
  setWineList(filteredItems);
45
47
  }
46
48
  };
@@ -39,7 +39,9 @@ export default () => {
39
39
  if (!formattedValue.length) {
40
40
  setWineList(initialWineList);
41
41
  } else {
42
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
42
+ const filteredItems = initialWineList.filter(wine =>
43
+ wine.toLowerCase().includes(formattedValue)
44
+ );
43
45
  setWineList(filteredItems);
44
46
  }
45
47
  };
@@ -18,8 +18,7 @@ const StyledHeader = styled('h3')({
18
18
  });
19
19
 
20
20
  const StyledSidePanel = styled(SidePanel)({
21
- position: 'absolute',
22
- right: 0,
21
+ marginLeft: 'auto',
23
22
  });
24
23
 
25
24
  const RightPanel = () => {
@@ -46,7 +45,6 @@ export default () => {
46
45
  return (
47
46
  <CanvasProvider theme={{canvas: {direction}}}>
48
47
  <Flex height={320}>
49
- <RightPanel />
50
48
  <Flex
51
49
  as="main"
52
50
  alignItems="center"
@@ -60,6 +58,8 @@ export default () => {
60
58
  Set to {direction === 'ltr' ? 'Right-to-Left' : 'Left-to-Right'}
61
59
  </SecondaryButton>
62
60
  </Flex>
61
+
62
+ <RightPanel />
63
63
  </Flex>
64
64
  </CanvasProvider>
65
65
  );
@@ -0,0 +1,12 @@
1
+ import Basic from './examples/SegmentControlWithText';
2
+
3
+
4
+ # Canvas Kit Examples
5
+
6
+ ## SegmentControl With Text
7
+
8
+ As of `v7`, IconButton was removed, so SegmentControl was changed to support new buttons with
9
+ icon only. This example shows how you use SegmentControl with text until CK
10
+ starts supporting text in SegmentControl buttons. If you'd like to follow along, we have an [open issue](https://github.com/Workday/canvas-kit/issues/207) to enhance the SegmentedControl
11
+
12
+ <ExampleCodeBlock code={Basic} />
@@ -0,0 +1,119 @@
1
+ import * as React from 'react';
2
+
3
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
4
+ import {
5
+ styled,
6
+ StyledType,
7
+ ExtractProps,
8
+ mouseFocusBehavior,
9
+ } from '@workday/canvas-kit-react/common';
10
+ import {colors, borderRadius, space} from '@workday/canvas-kit-react/tokens';
11
+ import {BaseButton, ButtonColors} from '@workday/canvas-kit-react/button';
12
+ import {CanvasIconTypes, CanvasSystemIcon} from '@workday/design-assets-types';
13
+ const placeholderIcon: CanvasSystemIcon = {
14
+ name: '',
15
+ svg: '',
16
+ filename: '',
17
+ type: CanvasIconTypes.System,
18
+ };
19
+
20
+ const getIconButtonColors = (toggled?: boolean): ButtonColors => {
21
+ return {
22
+ default: {
23
+ background: toggled ? colors.blueberry400 : colors.soap200,
24
+ icon: toggled ? colors.frenchVanilla100 : colors.licorice200,
25
+ label: toggled ? colors.frenchVanilla100 : colors.licorice200,
26
+ },
27
+ hover: {
28
+ background: toggled ? colors.blueberry400 : colors.soap300,
29
+ icon: toggled ? colors.frenchVanilla100 : colors.licorice500,
30
+ label: toggled ? colors.frenchVanilla100 : colors.licorice500,
31
+ },
32
+ active: {
33
+ background: toggled ? colors.blueberry400 : colors.soap500,
34
+ icon: toggled ? colors.frenchVanilla100 : colors.licorice500,
35
+ label: toggled ? colors.frenchVanilla100 : colors.licorice500,
36
+ },
37
+ focus: {
38
+ background: toggled ? colors.blueberry400 : undefined,
39
+ icon: toggled ? colors.frenchVanilla100 : colors.licorice500,
40
+ label: toggled ? colors.frenchVanilla100 : colors.licorice500,
41
+ },
42
+ disabled: {
43
+ background: toggled ? colors.soap100 : colors.soap100,
44
+ icon: colors.soap600,
45
+ label: colors.soap600,
46
+ opacity: '1',
47
+ },
48
+ };
49
+ };
50
+
51
+ const StyledBaseButton = styled(BaseButton)<
52
+ ExtractProps<typeof SegmentedControl.Button> & StyledType
53
+ >({
54
+ borderRadius: borderRadius.zero,
55
+ border: `1px solid ${colors.soap500}`,
56
+ borderLeft: 'none',
57
+ minWidth: space.xxxl,
58
+ '&:first-of-type': {
59
+ borderRadius: `${borderRadius.m} 0 0 ${borderRadius.m}`,
60
+ borderLeft: `1px solid ${colors.soap500}`,
61
+ },
62
+ '&:last-of-type': {
63
+ borderRadius: `0 ${borderRadius.m} ${borderRadius.m} 0`,
64
+ },
65
+ '&[aria-pressed="true"]': {
66
+ borderColor: `${colors.blueberry400} !important`,
67
+ '&:hover, &:focus:hover': {
68
+ background: colors.blueberry400,
69
+ },
70
+ },
71
+ '&:focus': {
72
+ borderRadius: borderRadius.m,
73
+ zIndex: 1,
74
+ animation: 'none', // reset focusRing animation
75
+ transition: 'all 120ms, border-radius 1ms',
76
+ ...mouseFocusBehavior({
77
+ '&': {
78
+ borderRadius: borderRadius.zero,
79
+ '&:first-of-type': {
80
+ borderRadius: `${borderRadius.m} 0 0 ${borderRadius.m}`,
81
+ },
82
+ '&:last-of-type': {
83
+ borderRadius: `0 ${borderRadius.m} ${borderRadius.m} 0`,
84
+ },
85
+ },
86
+ }),
87
+ },
88
+ });
89
+
90
+ export default () => {
91
+ const [value, setValue] = React.useState<string | number>('day');
92
+ const handleToggle = (selectedValue: string | number) => {
93
+ setValue(selectedValue);
94
+ };
95
+
96
+ const isDayToggled = value === 'day';
97
+ const isWeekToggled = value === 'week';
98
+
99
+ return (
100
+ <SegmentedControl value={value} onChange={handleToggle}>
101
+ <StyledBaseButton
102
+ icon={{...placeholderIcon}}
103
+ colors={getIconButtonColors(isDayToggled)}
104
+ value="day"
105
+ onClick={() => setValue('day')}
106
+ >
107
+ Day
108
+ </StyledBaseButton>
109
+ <StyledBaseButton
110
+ icon={placeholderIcon}
111
+ colors={getIconButtonColors(isWeekToggled)}
112
+ value="week"
113
+ onClick={() => setValue('week')}
114
+ >
115
+ Week
116
+ </StyledBaseButton>
117
+ </SegmentedControl>
118
+ );
119
+ };
@@ -3,6 +3,7 @@ import {Specifications} from '@workday/canvas-kit-docs';
3
3
 
4
4
  import Basic from './examples/Basic';
5
5
  import Icons from './examples/Icons';
6
+ import DeleteAction from './examples/DeleteAction';
6
7
  import OverflowActionBar from './examples/OverflowActionBar';
7
8
 
8
9
 
@@ -34,11 +35,18 @@ buttons should not be used in the Action Bar.
34
35
 
35
36
  ### Icons Example
36
37
 
37
- `ActionBar.Item` renders a `PrimaryButton` or `SecondaryButton`, so it's possible to use other
38
- Button props with `ActionBar.Item` such as `icon` or `size`.
38
+ `ActionBar.Item` renders a `SecondaryButton` as default, so it's possible to use other Button props
39
+ with `ActionBar.Item` such as `icon` or `size`.
39
40
 
40
41
  <ExampleCodeBlock code={Icons} />
41
42
 
43
+ ### Delete Action Example
44
+
45
+ `ActionBar.Item` is a `SecondaryButton` by default but it's posible to change it to another element,
46
+ such as `DeleteButton`, by using `as` prop.
47
+
48
+ <ExampleCodeBlock code={DeleteAction} />
49
+
42
50
  ### Overflow Example
43
51
 
44
52
  `ActionBar` container can contain up to 3 actions and an Overflow Menu if there are more than 3
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+
3
+ import {ActionBar} from '@workday/canvas-kit-react/action-bar';
4
+ import {DeleteButton} from '@workday/canvas-kit-react/button';
5
+
6
+ export default () => {
7
+ return (
8
+ <ActionBar>
9
+ <ActionBar.List position="relative">
10
+ <ActionBar.Item as={DeleteButton}>Delete Action</ActionBar.Item>
11
+ <ActionBar.Item>Second Action</ActionBar.Item>
12
+ </ActionBar.List>
13
+ </ActionBar>
14
+ );
15
+ };
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Box} from '@workday/canvas-kit-react/layout';
4
- import {useThemeRTL} from '@workday/canvas-kit-labs-react/common';
5
4
  import {
6
5
  CanvasProvider,
7
6
  ContentDirection,
@@ -18,11 +17,10 @@ const theme: PartialEmotionCanvasTheme = {
18
17
 
19
18
  const StyledStickyBanner = styled(Banner)({
20
19
  position: 'absolute',
21
- left: 0,
20
+ right: 0,
22
21
  });
23
22
 
24
23
  export default () => {
25
- const {themeRTL} = useThemeRTL();
26
24
  return (
27
25
  <CanvasProvider theme={theme}>
28
26
  <Box height={64}>
@@ -4,6 +4,7 @@ import Checkbox from '@workday/canvas-kit-react/checkbox/lib/Checkbox.tsx';
4
4
 
5
5
  import Alert from './examples/Alert';
6
6
  import Basic from './examples/Basic';
7
+ import Inverse from './examples/Inverse';
7
8
  import Disabled from './examples/Disabled';
8
9
  import Error from './examples/Error';
9
10
  import Indeterminate from './examples/Indeterminate';
@@ -35,6 +36,12 @@ element.
35
36
 
36
37
  <ExampleCodeBlock code={Basic} />
37
38
 
39
+ ### Inverse
40
+
41
+ Checkbox with inverse variation
42
+
43
+ <ExampleCodeBlock code={Inverse} />
44
+
38
45
  ### Disabled
39
46
 
40
47
  Set the `disabled` prop of the Checkbox to prevent users from interacting with it.
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
+ import {HStack} from '@workday/canvas-kit-react/layout';
4
+
5
+ export default () => {
6
+ const [checked, setChecked] = React.useState(false);
7
+
8
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
9
+ setChecked(event.target.checked);
10
+ };
11
+
12
+ return (
13
+ <HStack spacing="s" backgroundColor="blueberry400" padding="s">
14
+ <Checkbox
15
+ variant="inverse"
16
+ checked={checked}
17
+ label="I agree to the terms"
18
+ onChange={handleChange}
19
+ />
20
+ </HStack>
21
+ );
22
+ };
@@ -5,6 +5,7 @@ import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
5
5
  import Alert from './examples/Alert';
6
6
  import Basic from './examples/Basic';
7
7
  import Disabled from './examples/Disabled';
8
+ import Inverse from './examples/Inverse';
8
9
  import Error from './examples/Error';
9
10
  import LabelPosition from './examples/LabelPosition';
10
11
  import NoValue from './examples/NoValue';
@@ -41,6 +42,12 @@ Set the `disabled` prop of the Radio Button to prevent users from interacting wi
41
42
 
42
43
  <ExampleCodeBlock code={Disabled} />
43
44
 
45
+ ### Inverse
46
+
47
+ Radio with inverse variant
48
+
49
+ <ExampleCodeBlock code={Inverse} />
50
+
44
51
  ### Radio Buttons with No Values
45
52
 
46
53
  The `value` prop may be omitted from Radio Buttons, in which case the `value` prop of the Radio
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import {FormField} from '@workday/canvas-kit-react/form-field';
3
+ import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
4
+ import {Box} from '@workday/canvas-kit-react/layout';
5
+
6
+ export default () => {
7
+ const [value, setValue] = React.useState<string | number>('deep-dish');
8
+
9
+ const handleChange = (value: string | number) => {
10
+ setValue(value);
11
+ };
12
+
13
+ return (
14
+ <Box backgroundColor="blueberry400" padding="s">
15
+ <RadioGroup name="crust" onChange={handleChange} value={value}>
16
+ <Radio variant="inverse" label="Deep dish" value="deep-dish" />
17
+ <Radio variant="inverse" label="Thin" value="thin" />
18
+ <Radio variant="inverse" label="Gluten free" value="gluten-free" />
19
+ <Radio variant="inverse" label="Cauliflower" value="cauliflower" />
20
+ </RadioGroup>
21
+ </Box>
22
+ );
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "7.1.0-next.0+2f9c1930",
3
+ "version": "7.2.0-next.0+4cff0b3c",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -10,7 +10,8 @@
10
10
  "types": "dist/es6/index.d.ts",
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "http://github.com/Workday/canvas-kit/tree/master/modules/specifications"
13
+ "url": "https://github.com/workday/canvas-kit.git",
14
+ "directory": "modules/docs"
14
15
  },
15
16
  "files": [
16
17
  "dist/",
@@ -41,7 +42,7 @@
41
42
  ],
42
43
  "dependencies": {
43
44
  "@storybook/csf": "0.0.1",
44
- "@workday/canvas-kit-react": "^7.1.0-next.0+2f9c1930"
45
+ "@workday/canvas-kit-react": "^7.2.0-next.0+4cff0b3c"
45
46
  },
46
47
  "devDependencies": {
47
48
  "fs-extra": "^10.0.0",
@@ -49,5 +50,5 @@
49
50
  "mkdirp": "^1.0.3",
50
51
  "typescript": "4.1"
51
52
  },
52
- "gitHead": "2f9c193032b814210ceff5a30bbcc5dc2dd1a37c"
53
+ "gitHead": "4cff0b3c4f05257cc3965d757cd018c1acf64481"
53
54
  }