@workday/canvas-kit-docs 5.2.11 → 5.3.0-next.18

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 (59) hide show
  1. package/dist/commonjs/lib/specs.js +366 -18
  2. package/dist/es6/lib/specs.js +366 -18
  3. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +554 -0
  4. package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
  5. package/dist/mdx/labs-react/search-form/SearchForm.mdx +64 -0
  6. package/dist/mdx/labs-react/search-form/examples/Basic.tsx +61 -0
  7. package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +72 -0
  8. package/dist/mdx/labs-react/search-form/examples/Grow.tsx +62 -0
  9. package/dist/mdx/labs-react/search-form/examples/PropTables.splitProps.tsx +4 -0
  10. package/dist/mdx/labs-react/search-form/examples/RTL.tsx +70 -0
  11. package/dist/mdx/labs-react/search-form/examples/Theming.tsx +64 -0
  12. package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
  13. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
  14. package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
  15. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
  16. package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
  17. package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
  18. package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
  19. package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
  20. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
  21. package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
  22. package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
  23. package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
  24. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
  25. package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
  26. package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
  27. package/dist/mdx/preview-react/text-input/TextInput.mdx +145 -0
  28. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
  29. package/dist/mdx/preview-react/text-input/examples/Basic.tsx +17 -0
  30. package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
  31. package/dist/mdx/preview-react/text-input/examples/Error.tsx +40 -0
  32. package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
  33. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
  34. package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
  35. package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
  36. package/dist/mdx/preview-react/text-input/examples/LoginForm.tsx +105 -0
  37. package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
  38. package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
  39. package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +28 -0
  40. package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
  41. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
  42. package/dist/mdx/preview-react/text-input/examples/ThemedError.tsx +37 -0
  43. package/dist/mdx/react/button/button/Button.mdx +27 -2
  44. package/dist/mdx/react/button/button/examples/Primary.tsx +10 -1
  45. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +14 -0
  46. package/dist/mdx/react/button/button/examples/Secondary.tsx +10 -1
  47. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +14 -0
  48. package/dist/mdx/react/button/button/examples/Tertiary.tsx +10 -1
  49. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +14 -0
  50. package/dist/mdx/react/tabs/Tabs.mdx +31 -5
  51. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  52. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +41 -13
  53. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  54. package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
  55. package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
  56. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
  57. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  58. package/dist/mdx/react/text-area/TextArea.mdx +1 -1
  59. package/package.json +3 -3
@@ -0,0 +1,20 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/core'
3
+ import React from 'react';
4
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
+ import { accessibleHide } from '@workday/canvas-kit-react/common';
6
+
7
+ export default () => {
8
+ const [value, setValue] = React.useState('');
9
+
10
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
11
+ setValue(event.target.value);
12
+ };
13
+
14
+ return (
15
+ <TextInput orientation='vertical' spacing='zero'>
16
+ <TextInput.Label css={{...accessibleHide}}>Email</TextInput.Label>
17
+ <TextInput.Field onChange={handleChange} value={value} />
18
+ </TextInput>
19
+ );
20
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='horizontal'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical' spacing='xxxs'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,105 @@
1
+ import React from 'react';
2
+
3
+ import {useFormik} from 'formik';
4
+ import * as yup from 'yup';
5
+
6
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
7
+ import {HStack, VStack} from '@workday/canvas-kit-labs-react/layout';
8
+ import {IconButton, PrimaryButton} from '@workday/canvas-kit-react/button';
9
+ import {visibleIcon, invisibleIcon} from '@workday/canvas-system-icons-web';
10
+ import {useUniqueId} from '@workday/canvas-kit-react/common';
11
+
12
+ export default () => {
13
+ const passwordMinimum = 8;
14
+ const passwordHint = `Password should be of minimum ${passwordMinimum} characters length`;
15
+ const emailRequired = 'Email is required';
16
+ const passwordRequired = 'Password is required';
17
+
18
+ const validationSchema = yup.object({
19
+ email: yup
20
+ .string()
21
+ .email('Enter a valid email')
22
+ .required(emailRequired),
23
+ password: yup
24
+ .string()
25
+ .min(passwordMinimum, passwordHint)
26
+ .required(passwordRequired),
27
+ });
28
+
29
+ const passwordRef = React.useRef<HTMLInputElement>(null);
30
+ const [showPassword, setShowPassword] = React.useState(false);
31
+ const passwordId = useUniqueId();
32
+
33
+ const formik = useFormik({
34
+ initialValues: {
35
+ email: 'example@baz.com',
36
+ password: 'foobarbaz',
37
+ },
38
+ validationSchema: validationSchema,
39
+ onSubmit: values => {
40
+ passwordRef.current.type = 'password';
41
+
42
+ // Send data to server
43
+ setTimeout(() => {
44
+ alert(JSON.stringify(values, null, 2));
45
+ }, 0);
46
+ },
47
+ });
48
+
49
+ return (
50
+ <form onSubmit={formik.handleSubmit} action=".">
51
+ <VStack spacing='xs' alignItems='flex-start'>
52
+ <TextInput
53
+ orientation='vertical'
54
+ isRequired={true}
55
+ hasError={formik.touched.email && !!formik.errors.email}
56
+ >
57
+ <TextInput.Label>Email</TextInput.Label>
58
+ <TextInput.Field
59
+ name="email"
60
+ autoComplete="username"
61
+ placeholder="yourName@example.com"
62
+ onChange={formik.handleChange}
63
+ onBlur={formik.handleBlur}
64
+ value={formik.values.email}
65
+ />
66
+ <TextInput.Hint>{formik.touched.email && formik.errors.email}</TextInput.Hint>
67
+ </TextInput>
68
+ <TextInput
69
+ orientation='vertical'
70
+ id={passwordId}
71
+ hasError={formik.touched.password && !!formik.errors.password}
72
+ isRequired={true}
73
+ >
74
+ <TextInput.Label>Password</TextInput.Label>
75
+ <HStack spacing="xxs">
76
+ <TextInput.Field
77
+ type={showPassword ? 'text' : 'password'}
78
+ name="password"
79
+ autoComplete="current-password"
80
+ ref={passwordRef}
81
+ onChange={formik.handleChange}
82
+ onBlur={formik.handleBlur}
83
+ value={formik.values.password}
84
+ />
85
+ <IconButton
86
+ type="button"
87
+ icon={showPassword ? invisibleIcon : visibleIcon}
88
+ aria-label={showPassword ? 'Hide Password' : 'Show Password'}
89
+ aria-controls={`input-${passwordId}`}
90
+ onClick={() => {
91
+ setShowPassword(state => !state);
92
+ passwordRef.current.focus();
93
+ }}
94
+ />
95
+ </HStack>
96
+ <TextInput.Hint>
97
+ {(formik.touched.password && formik.errors.password) || passwordHint}
98
+ </TextInput.Hint>
99
+ </TextInput>
100
+
101
+ <PrimaryButton type="submit">Submit</PrimaryButton>
102
+ </VStack>
103
+ </form>
104
+ );
105
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('SuperSecret1');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Password</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} type="password" />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} placeholder="user@email.com" />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import {changeFocus} from '@workday/canvas-kit-react/common';
3
+ import {VStack} from '@workday/canvas-kit-labs-react/layout';
4
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
6
+
7
+ export default () => {
8
+ const [value, setValue] = React.useState('');
9
+ const ref = React.useRef(null);
10
+
11
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
12
+ setValue(event.target.value);
13
+ };
14
+
15
+ const handleClick = () => {
16
+ changeFocus(ref.current)
17
+ };
18
+
19
+ return (
20
+ <VStack spacing='xxxs' alignItems='flex-start'>
21
+ <TextInput orientation='vertical'>
22
+ <TextInput.Label>Email</TextInput.Label>
23
+ <TextInput.Field onChange={handleChange} value={value} ref={ref} />
24
+ </TextInput>
25
+ <SecondaryButton onClick={handleClick}>Focus Text Input</SecondaryButton>
26
+ </VStack>
27
+ );
28
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+
4
+ export default () => {
5
+ const [value, setValue] = React.useState('');
6
+
7
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
8
+ setValue(event.target.value);
9
+ };
10
+
11
+ return (
12
+ <TextInput isRequired={true} orientation='vertical'>
13
+ <TextInput.Label>Email</TextInput.Label>
14
+ <TextInput.Field onChange={handleChange} value={value} />
15
+ </TextInput>
16
+ );
17
+ };
@@ -0,0 +1,46 @@
1
+ /** @jsx jsx */
2
+ import {jsx} from '@emotion/core';
3
+ import React from 'react';
4
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
+ import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
6
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
7
+ import {colors, space} from '@workday/canvas-kit-react/tokens';
8
+
9
+ export default () => {
10
+ const theme: PartialEmotionCanvasTheme = {
11
+ canvas: {
12
+ palette: {
13
+ common: {
14
+ focusOutline: colors.grapeSoda300,
15
+ },
16
+ alert: {
17
+ main: colors.kiwi200,
18
+ darkest: colors.kiwi600,
19
+ },
20
+ },
21
+ },
22
+ };
23
+ return (
24
+ <CanvasProvider theme={theme}>
25
+ <AlertInput />
26
+ </CanvasProvider>
27
+ );
28
+ };
29
+
30
+ const AlertInput = () => {
31
+ const [value, setValue] = React.useState('invalid@email');
32
+
33
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
34
+ setValue(event.target.value);
35
+ };
36
+
37
+ const alertStyles = useThemedRing('alert');
38
+
39
+ return (
40
+ <TextInput orientation='vertical'>
41
+ <TextInput.Label>Email</TextInput.Label>
42
+ <TextInput.Field css={alertStyles} onChange={handleChange} value={value} />
43
+ <TextInput.Hint paddingTop={space.xxs}>Please enter a valid email.</TextInput.Hint>
44
+ </TextInput>
45
+ );
46
+ };
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
3
+ import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
4
+ import {colors, space} from '@workday/canvas-kit-react/tokens';
5
+
6
+ export default () => {
7
+ const [value, setValue] = React.useState('');
8
+
9
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
10
+ setValue(event.target.value);
11
+ };
12
+
13
+ const theme: PartialEmotionCanvasTheme = {
14
+ canvas: {
15
+ palette: {
16
+ common: {
17
+ focusOutline: colors.grapeSoda300,
18
+ },
19
+ error: {
20
+ main: colors.islandPunch400,
21
+ },
22
+ },
23
+ },
24
+ };
25
+
26
+ return (
27
+ <CanvasProvider theme={theme}>
28
+ <TextInput hasError={!value} isRequired={true} orientation='vertical'>
29
+ <TextInput.Label>Email</TextInput.Label>
30
+ <TextInput.Field onChange={handleChange} value={value} />
31
+ <TextInput.Hint paddingTop={space.xxs}>
32
+ {!value && 'Please enter an email.'}
33
+ </TextInput.Hint>
34
+ </TextInput>
35
+ </CanvasProvider>
36
+ );
37
+ };
@@ -7,8 +7,11 @@ import {
7
7
  import {Specifications} from '@workday/canvas-kit-docs';
8
8
 
9
9
  import Primary from './examples/Primary';
10
+ import PrimaryInverse from './examples/PrimaryInverse';
10
11
  import Secondary from './examples/Secondary';
12
+ import SecondaryInverse from './examples/SecondaryInverse';
11
13
  import Tertiary from './examples/Tertiary';
14
+ import TertiaryInverse from './examples/TertiaryInverse';
12
15
  import Delete from './examples/Delete';
13
16
 
14
17
 
@@ -35,8 +38,17 @@ Primary Buttons are high emphasis. Use once per screen to draw attention to the
35
38
  action. Multiple primary buttons make it confusing for the user to understand what action they
36
39
  should take. Not all screens require a Primary Button.
37
40
 
41
+ Primary Buttons have four sizes: `extraSmall`, `small`, `medium`, and `large`. Icons are supported
42
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
43
+
38
44
  <ExampleCodeBlock code={Primary} />
39
45
 
46
+ Primary Buttons also have an `inverse` variant. While it looks similar to the default Secondary
47
+ Button, the default outline as well as the hover and focus states are different. Use this variant
48
+ when you need to place a Primary Button on a dark or colorful background such as `blueberry400`.
49
+
50
+ <ExampleCodeBlock code={PrimaryInverse} />
51
+
40
52
  #### Props
41
53
 
42
54
  Undocumented props are spread to the underlying `<button>` element.
@@ -49,10 +61,16 @@ Secondary Buttons have a medium level of emphasis. Use them for non-critical act
49
61
  Buttons can be used on most pages without restrictions and work well for multiple actions of equal
50
62
  weight. They can be used in conjunction with a Primary Button or independently.
51
63
 
52
- Use the `inverse` variants on dark or colorful backgrounds.
64
+ Secondary Buttons have four sizes: `extraSmall`, `small`, `medium`, and `large`. Icons are supported
65
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
53
66
 
54
67
  <ExampleCodeBlock code={Secondary} />
55
68
 
69
+ Secondary Buttons also have an `inverse` variant. Use this when you need to place a Secondary Button on
70
+ a dark or colorful background such as `blueberry400`.
71
+
72
+ <ExampleCodeBlock code={SecondaryInverse} />
73
+
56
74
  #### Props
57
75
 
58
76
  Undocumented props are spread to the underlying `<button>` element.
@@ -66,10 +84,17 @@ the user may not often be looking to do. Tertiary Buttons have lower prominence
66
84
  not visible until it is interacted with. Use Tertiary Buttons for supplemental actions such as “View
67
85
  More”, “Read More” or “Select a File”. Tertiary Buttons are frequently used on Cards.
68
86
 
69
- Use the `inverse` variants on dark or colorful backgrounds.
87
+ Tertiary Buttons have three sizes: `extraSmall`, `small`, and `medium`. Icons are supported
88
+ for every size and can be positioned to the `left` or `right` with the `iconPosition` prop.
70
89
 
71
90
  <ExampleCodeBlock code={Tertiary} />
72
91
 
92
+ Tertiary Buttons also have an `inverse` variant. Use this when you need to place a Tertiary Button on
93
+ a dark or colorful background such as `blueberry400`.
94
+
95
+ <ExampleCodeBlock code={TertiaryInverse} />
96
+
97
+
73
98
  #### Props
74
99
 
75
100
  Undocumented props are spread to the underlying `<button>` element.
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
4
6
 
5
- export default () => <PrimaryButton>Click Me</PrimaryButton>;
7
+ export default () => (
8
+ <HStack spacing="s" padding="s">
9
+ <PrimaryButton>Primary</PrimaryButton>
10
+ <PrimaryButton icon={plusIcon} iconPosition="right">
11
+ Primary
12
+ </PrimaryButton>
13
+ </HStack>
14
+ );
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
6
+
7
+ export default () => (
8
+ <HStack spacing="s" backgroundColor="blueberry400" padding="s">
9
+ <PrimaryButton variant="inverse">Primary</PrimaryButton>
10
+ <PrimaryButton icon={plusIcon} iconPosition="right" variant="inverse">
11
+ Primary
12
+ </PrimaryButton>
13
+ </HStack>
14
+ );
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
4
6
 
5
- export default () => <SecondaryButton>Click Me</SecondaryButton>;
7
+ export default () => (
8
+ <HStack spacing="s" padding="s">
9
+ <SecondaryButton>Secondary</SecondaryButton>
10
+ <SecondaryButton icon={plusIcon} iconPosition="right">
11
+ Secondary
12
+ </SecondaryButton>
13
+ </HStack>
14
+ );
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
6
+
7
+ export default () => (
8
+ <HStack spacing="s" backgroundColor="blueberry400" padding="s">
9
+ <SecondaryButton variant="inverse">Secondary</SecondaryButton>
10
+ <SecondaryButton icon={plusIcon} iconPosition="right" variant="inverse">
11
+ Secondary
12
+ </SecondaryButton>
13
+ </HStack>
14
+ );
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {TertiaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
4
6
 
5
- export default () => <TertiaryButton>Click Me</TertiaryButton>;
7
+ export default () => (
8
+ <HStack spacing="s" padding="s">
9
+ <TertiaryButton>Tertiary</TertiaryButton>
10
+ <TertiaryButton icon={plusIcon} iconPosition="right">
11
+ Tertiary
12
+ </TertiaryButton>
13
+ </HStack>
14
+ );
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import {TertiaryButton} from '@workday/canvas-kit-react/button';
4
+ import {HStack} from '@workday/canvas-kit-labs-react/layout';
5
+ import {plusIcon} from '@workday/canvas-system-icons-web';
6
+
7
+ export default () => (
8
+ <HStack spacing="s" backgroundColor="blueberry400" padding="s">
9
+ <TertiaryButton variant="inverse">Tertiary</TertiaryButton>
10
+ <TertiaryButton icon={plusIcon} iconPosition="right" variant="inverse">
11
+ Tertiary
12
+ </TertiaryButton>
13
+ </HStack>
14
+ );
@@ -2,9 +2,11 @@ import {Tabs} from '@workday/canvas-kit-react/tabs';
2
2
  import {Specifications} from '@workday/canvas-kit-docs';
3
3
 
4
4
  import Basic from './examples/Basic';
5
- import NamedKeys from './examples/NamedKeys';
5
+ import NamedTabs from './examples/NamedTabs';
6
6
  import RightToLeft from './examples/RightToLeft';
7
+ import OverflowTabs from './examples/OverflowTabs';
7
8
  import DisabledTab from './examples/DisabledTab';
9
+ import Icons from './examples/Icons';
8
10
  import SinglePanel from './examples/SinglePanel';
9
11
  import AlternativeTabStop from './examples/AlternativeTabStop';
10
12
  import HoistedModel from './examples/HoistedModel';
@@ -38,10 +40,26 @@ yarn add @workday/canvas-kit-react
38
40
  in a variety of ways: `Tabs.List`, `Tabs.Item` and `Tabs.Panel`. It follows the
39
41
  [W3 Tabs specification](https://www.w3.org/TR/wai-aria-practices/#tabpanel).
40
42
 
41
- In this example, we set up a basic `Tabs` component with five tabs.
43
+ In this example, we set up a basic `Tabs` component with five tabs. This example uses a static API
44
+ that does not support overflow.
42
45
 
43
46
  <ExampleCodeBlock code={Basic} />
44
47
 
48
+ ### Overflow Tabs
49
+
50
+ Tabs is a responsive component based on the width of its container. If the rendered tabs exceed the
51
+ width of the `Tabs.List`, an overflow menu will be rendered. This only works against the dynamic API
52
+ where you give the `TabsModel` an array of items to be rendered. The dynamic API handles the React
53
+ `key` for you based on the item's identifier. The dynamic API requires either an `id` on each item
54
+ object or a `getId` function that returns an identifier based on the item. The below example uses an
55
+ `id` property on each item.
56
+
57
+ The dynamic API takes in any object, but since nothing is known about your object, a
58
+ [render prop](https://reactjs.org/docs/render-props.html) is necessary to instruct a list how it
59
+ should render.
60
+
61
+ <ExampleCodeBlock code={OverflowTabs} />
62
+
45
63
  ### Hoisted Model
46
64
 
47
65
  By default, `Tabs` will create and use its own [model](#model) internally. Alternatively, you may
@@ -55,13 +73,13 @@ trigger an event to change the active tab.
55
73
 
56
74
  <ExampleCodeBlock code={HoistedModel} />
57
75
 
58
- ### Named Keys
76
+ ### Named Tabs
59
77
 
60
78
  `Tabs.Item` and `Tabs.Panel` both take an optional `name` attribute that is used for the
61
- `onActivate` callback. This example is identical to the Basic Example, but with named keys for the
79
+ `onActivate` callback. This example is identical to the Basic Example, but with named tabs for the
62
80
  `Tabs.Item` and `Tabs.Panel` subcomponents.
63
81
 
64
- <ExampleCodeBlock code={NamedKeys} />
82
+ <ExampleCodeBlock code={NamedTabs} />
65
83
 
66
84
  ### Right-to-Left (RTL)
67
85
 
@@ -75,6 +93,14 @@ Set the `disabled` prop of a `Tabs.Item` to `true` to disable it.
75
93
 
76
94
  <ExampleCodeBlock code={DisabledTab} />
77
95
 
96
+ ### Tab Icons
97
+
98
+ Tabs can have icons. You must set `hasIcon` on the `Tabs.Item` and use the `Icon` and `Text`
99
+ subcomponent. The `hasIcon` changes the `Tabs.Item` to change where overflow detection is from the
100
+ `Tabs.Item` element to the `Tabs.Item.Text` element.
101
+
102
+ <ExampleCodeBlock code={Icons} />
103
+
78
104
  ### Alternative Tab Stop
79
105
 
80
106
  By default, tab panels are focusable for accessibility. If the contents of a tab panel have a
@@ -8,7 +8,7 @@ export default () => {
8
8
  <Tabs>
9
9
  <Tabs.List>
10
10
  <Tabs.Item>First Tab</Tabs.Item>
11
- <Tabs.Item disabled>Disabled Tab</Tabs.Item>
11
+ <Tabs.Item aria-disabled>Disabled Tab</Tabs.Item>
12
12
  <Tabs.Item>Third Tab</Tabs.Item>
13
13
  </Tabs.List>
14
14
  <div style={{marginTop: space.m}}>