@workday/canvas-kit-docs 5.3.0-next.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 (80) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/lib/specs.js +263 -33
  3. package/dist/es6/lib/specs.js +263 -33
  4. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +259 -1
  5. package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
  6. package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
  7. package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
  8. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
  9. package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
  10. package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +1 -1
  11. package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
  12. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
  13. package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
  14. package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
  15. package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
  16. package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
  17. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
  18. package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
  19. package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
  20. package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
  21. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
  22. package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
  23. package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
  24. package/dist/mdx/{labs-react → preview-react}/text-input/TextInput.mdx +40 -18
  25. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
  26. package/dist/mdx/{labs-react/text-input/examples/HiddenLabel.tsx → preview-react/text-input/examples/Basic.tsx} +3 -3
  27. package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
  28. package/dist/mdx/{labs-react → preview-react}/text-input/examples/Error.tsx +6 -9
  29. package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
  30. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
  31. package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
  32. package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
  33. package/dist/mdx/{labs-react → preview-react}/text-input/examples/LoginForm.tsx +10 -5
  34. package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
  35. package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
  36. package/dist/mdx/{labs-react → preview-react}/text-input/examples/RefForwarding.tsx +7 -6
  37. package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
  38. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
  39. package/dist/mdx/{labs-react → preview-react}/text-input/examples/ThemedError.tsx +8 -11
  40. package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
  41. package/dist/mdx/react/button/button/Button.mdx +34 -9
  42. package/dist/mdx/react/button/button/examples/Primary.tsx +10 -1
  43. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +14 -0
  44. package/dist/mdx/react/button/button/examples/Secondary.tsx +10 -1
  45. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +14 -0
  46. package/dist/mdx/react/button/button/examples/Tertiary.tsx +10 -1
  47. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +14 -0
  48. package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
  49. package/dist/mdx/react/pagination/pagination.mdx +5 -3
  50. package/dist/mdx/react/popup/Popup.mdx +34 -36
  51. package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
  52. package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
  53. package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
  54. package/dist/mdx/react/radio/examples/Error.tsx +3 -3
  55. package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
  56. package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
  57. package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
  58. package/dist/mdx/react/radio/examples/Required.tsx +3 -3
  59. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
  60. package/dist/mdx/react/tabs/Tabs.mdx +67 -36
  61. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  62. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +41 -13
  63. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  64. package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
  65. package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
  66. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
  67. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  68. package/dist/mdx/react/toast/toast.mdx +1 -17
  69. package/dist/mdx/react/tooltip/Tooltip.mdx +1 -1
  70. package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
  71. package/package.json +3 -3
  72. package/dist/mdx/labs-react/text-input/examples/Alert.tsx +0 -46
  73. package/dist/mdx/labs-react/text-input/examples/Basic.tsx +0 -20
  74. package/dist/mdx/labs-react/text-input/examples/Disabled.tsx +0 -20
  75. package/dist/mdx/labs-react/text-input/examples/Grow.tsx +0 -20
  76. package/dist/mdx/labs-react/text-input/examples/LabelPosition.tsx +0 -20
  77. package/dist/mdx/labs-react/text-input/examples/Password.tsx +0 -20
  78. package/dist/mdx/labs-react/text-input/examples/Placeholder.tsx +0 -20
  79. package/dist/mdx/labs-react/text-input/examples/Required.tsx +0 -20
  80. package/dist/mdx/labs-react/text-input/examples/ThemedAlert.tsx +0 -51
@@ -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
+ };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
2
+ import {changeFocus} from '@workday/canvas-kit-react/common';
3
3
  import {VStack} from '@workday/canvas-kit-labs-react/layout';
4
- import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
+ import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
5
6
 
6
7
  export default () => {
7
8
  const [value, setValue] = React.useState('');
@@ -12,16 +13,16 @@ export default () => {
12
13
  };
13
14
 
14
15
  const handleClick = () => {
15
- ref.current.focus();
16
+ changeFocus(ref.current)
16
17
  };
17
18
 
18
19
  return (
19
- <VStack spacing="xxxs" alignItems="flex-start">
20
- <TextInput>
20
+ <VStack spacing='xxxs' alignItems='flex-start'>
21
+ <TextInput orientation='vertical'>
21
22
  <TextInput.Label>Email</TextInput.Label>
22
23
  <TextInput.Field onChange={handleChange} value={value} ref={ref} />
23
24
  </TextInput>
24
- <PrimaryButton onClick={handleClick}>Focus Text Input</PrimaryButton>
25
+ <SecondaryButton onClick={handleClick}>Focus Text Input</SecondaryButton>
25
26
  </VStack>
26
27
  );
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
+ };
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
3
- import {VStack} from '@workday/canvas-kit-labs-react/layout';
2
+ import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
4
3
  import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
5
4
  import {colors, space} from '@workday/canvas-kit-react/tokens';
6
5
 
@@ -26,15 +25,13 @@ export default () => {
26
25
 
27
26
  return (
28
27
  <CanvasProvider theme={theme}>
29
- <VStack spacing="xxxs" alignItems="flex-start">
30
- <TextInput hasError={!value} isRequired={true}>
31
- <TextInput.Label>Email</TextInput.Label>
32
- <TextInput.Field onChange={handleChange} value={value} />
33
- <TextInput.Hint paddingTop={space.xxs}>
34
- {!value && 'Please enter an email.'}
35
- </TextInput.Hint>
36
- </TextInput>
37
- </VStack>
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>
38
35
  </CanvasProvider>
39
36
  );
40
37
  };
@@ -51,6 +51,6 @@ At 575px, responsive styles will take effect:
51
51
 
52
52
  ## Props
53
53
 
54
- Undocumented props are spread to the underlying container `div` element.
54
+ Undocumented props are spread to the underlying container `<div>` element.
55
55
 
56
56
  <ArgsTable of={ActionBar} />
@@ -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,11 +38,20 @@ 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
- Undocumented props are spread to the underlying `button` element.
54
+ Undocumented props are spread to the underlying `<button>` element.
43
55
 
44
56
  <ArgsTable of={PrimaryButton} />
45
57
 
@@ -49,13 +61,19 @@ 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
- Undocumented props are spread to the underlying `button` element.
76
+ Undocumented props are spread to the underlying `<button>` element.
59
77
 
60
78
  <ArgsTable of={SecondaryButton} />
61
79
 
@@ -66,13 +84,20 @@ 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
- Undocumented props are spread to the underlying `button` element.
100
+ Undocumented props are spread to the underlying `<button>` element.
76
101
 
77
102
  <ArgsTable of={TertiaryButton} />
78
103
 
@@ -86,16 +111,16 @@ before deleting.
86
111
 
87
112
  #### Props
88
113
 
89
- Undocumented props are spread to the underlying `button` element.
114
+ Undocumented props are spread to the underlying `<button>` element.
90
115
 
91
116
  <ArgsTable of={DeleteButton} />
92
117
 
93
118
  ### Accessible Use of the `as` Prop
94
119
 
95
120
  Like many of our components, Buttons accept an `as` prop, which lets you change the underlying
96
- semantic element - usually an `a` (anchor), or a `button`. This should be done with caution to
97
- ensure the best accessibility. Generally, `button` elements should be used for actions, and `a`
98
- (anchor) elements should be used for navigation.
121
+ semantic element - usually an `<a>`, or a `<button>`. This should be done with caution to ensure the
122
+ best accessibility. Generally, `<button>` elements should be used for actions, and `<a>` elements
123
+ should be used for navigation.
99
124
 
100
125
  ## Specifications
101
126
 
@@ -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
+ );
@@ -98,6 +98,6 @@ The `toggle` prop can be used to make icon buttons toggleable.
98
98
 
99
99
  ## Props
100
100
 
101
- Undocumented props are spread to the underlying `button` element.
101
+ Undocumented props are spread to the underlying `<button>` element.
102
102
 
103
103
  <ArgsTable of={IconButton} />
@@ -20,8 +20,10 @@ import {
20
20
  # Canvas Kit Pagination
21
21
 
22
22
  `Pagination` is a
23
- [compound component](/getting-started/for-developers/resources/compound-components/) for handling
24
- navigation between pages in a range.
23
+ [compound component](/getting-started/for-developers/resources/compound-components/) that allows
24
+ users to navigate between pages in a range.
25
+
26
+ [> Workday Design Reference](https://design.workday.com/components/navigation/pagination)
25
27
 
26
28
  ## Installation
27
29
 
@@ -78,7 +80,7 @@ the range.
78
80
 
79
81
  ### Right-to-Left (RTL)
80
82
 
81
- This example shows how the component supports right-to-left languages.
83
+ `Pagination` supports right-to-left languages when specified in the `CanvasProvider` `theme`.
82
84
 
83
85
  <ExampleCodeBlock code={RTL} />
84
86
 
@@ -52,7 +52,7 @@ The `Popup` component is a generic
52
52
  [Compound Component](/getting-started/for-developers/resources/compound-components/) that is used to
53
53
  build popup UIs that are not already covered by Canvas Kit.
54
54
 
55
- ### Basic
55
+ ### Basic Example
56
56
 
57
57
  The Popup has no pre-defined behaviors built in, therefore the `usePopupModel` must always be used
58
58
  to create a new `model`. This `model` is then used by all behavior hooks to apply additional popup
@@ -63,7 +63,7 @@ popup behaviors. For accessibility, these behaviors should be included most of t
63
63
 
64
64
  <ExampleCodeBlock code={Basic} />
65
65
 
66
- ### Initial focus
66
+ ### Initial Focus
67
67
 
68
68
  If you want focus to move to a specific element when the popup is opened, set the `initialFocusRef`
69
69
  of the model. Check with accessibility before doing this. The following example sets the focus on
@@ -153,7 +153,7 @@ The Popup component automatically handles right-to-left rendering.
153
153
 
154
154
  ## Components
155
155
 
156
- ## Popper
156
+ ### Popper
157
157
 
158
158
  A thin wrapper component around the Popper.js positioning engine. For reference:
159
159
  https://popper.js.org/. `Popper` also automatically works with the `PopupStack` system. `Popper` has
@@ -169,7 +169,7 @@ PopupModel or any associate popup [hooks](#hooks).
169
169
  > element was rendered and that's where extra props were spread to. In v5+, you can provide your own
170
170
  > element if you wish.
171
171
 
172
- ## Popup
172
+ ### Popup
173
173
 
174
174
  This component is a container component that has no semantic element. It provides a React Context
175
175
  model for all Popup subcomponents. If you manually pass a `model` to all subcomponents, this
@@ -189,7 +189,7 @@ container component isn't needed.
189
189
 
190
190
  <ArgsTable of={Popup} />
191
191
 
192
- ## Popup.Target
192
+ ### Popup.Target
193
193
 
194
194
  A `Popup.Target` is any element that is meant to show the Popup. The default component rendered by
195
195
  this component is a `SecondaryButton` element. You can override this by passing the desired
@@ -217,7 +217,7 @@ used, which is `SecondaryButton`. If you don't want any styling, you can do the
217
217
  To add your own styling, you could either add a `css` prop, or make a styled button and pass that
218
218
  styled component via the `as` prop.
219
219
 
220
- ## Popup.Popper
220
+ ### Popup.Popper
221
221
 
222
222
  A `Popup.Popper` is a [Popper](#popper) component that is hooked up to the `PopupModel`
223
223
  automatically. The behavior hook used is called `usePopupPopper`.
@@ -229,7 +229,7 @@ automatically. The behavior hook used is called `usePopupPopper`.
229
229
 
230
230
  <ArgsTable of={Popup.Popper} />
231
231
 
232
- ## Popup.Card
232
+ ### Popup.Card
233
233
 
234
234
  A `Popup.Card` is a wrapper around the `Card` component, but hooked up to a `PopupModel`. By
235
235
  default, this element has a `role=dialog` and an `aria-labelledby`. The behavior hook used is called
@@ -237,7 +237,7 @@ default, this element has a `role=dialog` and an `aria-labelledby`. The behavior
237
237
 
238
238
  <ArgsTable of={Popup.Card} />
239
239
 
240
- ## Popup.CloseButton
240
+ ### Popup.CloseButton
241
241
 
242
242
  A `Popup.CloseButton` is a button that will hide a popup. By default, this is a `SecondaryButton`
243
243
  component, but `as` can be used to render any button element (i.e `<DeleteButton>` or
@@ -245,14 +245,14 @@ component, but `as` can be used to render any button element (i.e `<DeleteButton
245
245
 
246
246
  <ArgsTable of={Popup.CloseButton} />
247
247
 
248
- ## Popup.CloseIcon
248
+ ### Popup.CloseIcon
249
249
 
250
250
  A `Popup.CloseIcon` is an icon button that is the `X` in the top of a popup. It will hide a popup
251
251
  when clicked. The behavior hook used is called `usePopupCloseButton`.
252
252
 
253
253
  <ArgsTable of={Popup.CloseIcon} />
254
254
 
255
- ## Popup.Heading
255
+ ### Popup.Heading
256
256
 
257
257
  A `Popup.Heading` is a wrapper around `Card.Heading` that connect the heading to a `PopupModel`. It
258
258
  will add an `id` to the element that match the `aria-labelledby` that is applied to the `Popup.Card`
@@ -260,29 +260,29 @@ element for accessibility. The behavior hook used is called `usePopupHeading`.
260
260
 
261
261
  <ArgsTable of={Popup.Heading} />
262
262
 
263
- ## Popup.Body
263
+ ### Popup.Body
264
264
 
265
265
  A `Popup.Body` is a thin wrapper around `Card.Body` and doesn't actually take a model. It adds
266
266
  `body` styling and nothing else.
267
267
 
268
268
  <ArgsTable of={Popup.Body} />
269
269
 
270
- ## Popup Model
270
+ ## Model
271
271
 
272
272
  The PopupModel contains all state and events needed for Popup behaviors and components. It composes
273
273
  a `DisclosureModel` for showing and hiding content.
274
274
 
275
- ### Popup Model State
275
+ ### Config
276
276
 
277
- <ArgsTable of={PopupStateComponent} />
277
+ <ArgsTable of={PopupModelConfigComponent} />
278
278
 
279
- ### Popup Model Events
279
+ ### State
280
280
 
281
- <ArgsTable of={PopupEventsComponent} />
281
+ <ArgsTable of={PopupStateComponent} />
282
282
 
283
- ### Popup Model Config
283
+ ### Events
284
284
 
285
- <ArgsTable of={PopupModelConfigComponent} />
285
+ <ArgsTable of={PopupEventsComponent} />
286
286
 
287
287
  ## Hooks
288
288
 
@@ -325,7 +325,7 @@ return (
325
325
  );
326
326
  ```
327
327
 
328
- ## useAssistiveHideSiblings
328
+ ### useAssistiveHideSiblings
329
329
 
330
330
  ```ts
331
331
  useAssistiveHideSiblings(model: PopupModel): {}
@@ -341,7 +341,7 @@ VoiceOver for example.
341
341
 
342
342
  This should be used on popup elements that need to hide content (i.e. Modals).
343
343
 
344
- ## useBringToTopOnClick
344
+ ### useBringToTopOnClick
345
345
 
346
346
  ```ts
347
347
  useBringToTopOnClick(model: PopupModel): {}
@@ -355,7 +355,7 @@ like a Modal.
355
355
 
356
356
  This should be used on popup elements that are meant to persist (i.e. Windows).
357
357
 
358
- ## useCloseOnEscape
358
+ ### useCloseOnEscape
359
359
 
360
360
  ```ts
361
361
  useCloseOnEscape(model: PopupModel): {}
@@ -367,7 +367,7 @@ provided model's `state.stackRef` element is the topmost in the stack.
367
367
  This should be used with popup elements that are dismissible like Tooltips, Modals, non-modal
368
368
  dialogs, dropdown menus, etc.
369
369
 
370
- ## useCloseOnOutsideClick
370
+ ### useCloseOnOutsideClick
371
371
 
372
372
  ```ts
373
373
  useCloseOnOutsideClick(model: PopupModel): {}
@@ -382,7 +382,7 @@ This should be used with popup elements that are dismissible like Modals, non-mo
382
382
  dropdown menus, etc. Tooltips and hierarchical menus should use `useAlwaysCloseOnClickOutside`
383
383
  instead.
384
384
 
385
- ## useAlwaysCloseOnOutsideClick
385
+ ### useAlwaysCloseOnOutsideClick
386
386
 
387
387
  ```ts
388
388
  useAlwaysCloseOnOutsideClick(model: PopupModel): {}
@@ -396,7 +396,7 @@ stack. This is useful for Tooltips or hierarchical menus. Adds a
396
396
  This should be used with popup elements that should close no matter their position in the stack
397
397
  (i.e. Tooltips).
398
398
 
399
- ## useDisableBodyScroll
399
+ ### useDisableBodyScroll
400
400
 
401
401
  ```ts
402
402
  useDisableBodyScroll(model: PopupModel): {}
@@ -408,7 +408,7 @@ page scrolling while the popup is visible.
408
408
  This should be used with popup elements that hide all other content and force the user to accept or
409
409
  dismiss the popup before continuing (i.e. Modals).
410
410
 
411
- ## useFocusRedirect
411
+ ### useFocusRedirect
412
412
 
413
413
  ```ts
414
414
  useFocusRedirect(model: PopupModel): {}
@@ -426,7 +426,7 @@ hook does no provide `aria-owns` and this must be provided yourself. Requires
426
426
 
427
427
  This should be used with non-modal dialogs.
428
428
 
429
- ## useFocusTrap
429
+ ### useFocusTrap
430
430
 
431
431
  ```ts
432
432
  useFocusTrap(model: PopupModel): {}
@@ -440,7 +440,7 @@ with [useInitialFocus](#useinitialfocus) and [useReturnFocus](#usereturnfocus).
440
440
 
441
441
  This should be used on popup elements that need to hide content (i.e. Modals).
442
442
 
443
- ## useInitialFocus
443
+ ### useInitialFocus
444
444
 
445
445
  Moves focus within the popup when the popup becomes visible. This is useful for keyboard and screen
446
446
  reader users alike. This should be used with [useFocusRedirect](#usefocusredirect) or
@@ -449,7 +449,7 @@ reader users alike. This should be used with [useFocusRedirect](#usefocusredirec
449
449
  This should be used for popups that have focusable elements inside, like Modals, non-modal dialogs,
450
450
  menus, etc.
451
451
 
452
- ## useReturnFocus
452
+ ### useReturnFocus
453
453
 
454
454
  Returns focus to the target element when the popup is hidden. This works well with
455
455
  [useInitialFocus](#useinitialfocus). This should be used with [useFocusRedirect](#usefocusredirect)
@@ -457,7 +457,7 @@ or [useFocusTrap](#usefocustrap) for a complete focus management solution.
457
457
 
458
458
  This should ble used on popup elements that use [useInitialFocus](#useinitialfocus).
459
459
 
460
- ## usePopupPopper
460
+ ### usePopupPopper
461
461
 
462
462
  ```ts
463
463
  usePopupPopper(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
@@ -466,7 +466,7 @@ usePopupPopper(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
466
466
  Adds the necessary props to a `Popper` component. Used by the [Popup.Popper](#popuppopper)
467
467
  subcomponent.
468
468
 
469
- ## usePopupCard
469
+ ### usePopupCard
470
470
 
471
471
  ```ts
472
472
  usePopupCard(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
@@ -474,7 +474,7 @@ usePopupCard(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
474
474
 
475
475
  Adds the necessary props to a `Card` component. Used by the [Popup.Card](#popupcard) subcomponent.
476
476
 
477
- ## usePopupCloseButton
477
+ ### usePopupCloseButton
478
478
 
479
479
  ```ts
480
480
  usePopupCloseButton(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
@@ -484,18 +484,16 @@ Adds the necessary props to a close button component. Used by the
484
484
  [Popup.CloseButton](#popupclosebutton) subcomponent and [Popup.CloseIcon](#popupcloseicon)
485
485
  subcomponent.
486
486
 
487
- ````
488
-
489
- ## usePopupHeading
487
+ ### usePopupHeading
490
488
 
491
489
  ```ts
492
490
  usePopupHeading(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
493
- ````
491
+ ```
494
492
 
495
493
  Adds the necessary props to a `Heading` component. Used by the [Popup.Heading](#popupheading)
496
494
  subcomponent.
497
495
 
498
- ## usePopupTarget
496
+ ### usePopupTarget
499
497
 
500
498
  ```ts
501
499
  usePopupTarget(model: PopupModel, elemProps: {}, ref: React.Ref<any>): {}
@@ -14,13 +14,13 @@ export default () => {
14
14
  error={FormField.ErrorType.Alert}
15
15
  hintId="hint-alert"
16
16
  hintText="Deep Dish is no longer available. Please select a different crust."
17
- label="Choose your pizza crust"
17
+ label="Choose Your Pizza Crust"
18
18
  useFieldset={true}
19
19
  >
20
20
  <RadioGroup name="crust" onChange={handleChange} value={value}>
21
- <Radio disabled={true} label="Deep Dish (Sold Out)" value="deep-dish" />
21
+ <Radio disabled={true} label="Deep dish (sold out)" value="deep-dish" />
22
22
  <Radio label="Thin" value="thin" />
23
- <Radio label="Gluten Free" value="gluten-free" />
23
+ <Radio label="Gluten free" value="gluten-free" />
24
24
  <Radio label="Cauliflower" value="cauliflower" />
25
25
  </RadioGroup>
26
26
  </FormField>