@pingux/astro 2.208.0-alpha.0 → 2.208.1-alpha.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.
Files changed (143) hide show
  1. package/lib/cjs/components/AIComponents/PromptInput/PromptInputReadMe.mdx +12 -15
  2. package/lib/cjs/components/AccordionGridGroup/AccordionGridGroup.mdx +13 -19
  3. package/lib/cjs/components/AccordionGroup/AccordionGroup.mdx +16 -17
  4. package/lib/cjs/components/ArrayField/ArrayField.mdx +10 -15
  5. package/lib/cjs/components/Badge/Badge.mdx +6 -8
  6. package/lib/cjs/components/Breadcrumbs/Breadcrumbs.mdx +11 -17
  7. package/lib/cjs/components/Button/Button.mdx +8 -12
  8. package/lib/cjs/components/Calendar/Calendar.mdx +17 -22
  9. package/lib/cjs/components/Callout/Callout.mdx +8 -13
  10. package/lib/cjs/components/Card/Card.mdx +6 -8
  11. package/lib/cjs/components/CheckboxField/CheckboxField.mdx +11 -16
  12. package/lib/cjs/components/CodeEditor/CodeEditor.mdx +8 -13
  13. package/lib/cjs/components/CodeView/CodeView.mdx +5 -8
  14. package/lib/cjs/components/CollapsiblePanel/CollapsiblePanel.mdx +10 -13
  15. package/lib/cjs/components/ColorField/ColorField.mdx +13 -18
  16. package/lib/cjs/components/ComboBoxField/ComboBoxField.mdx +13 -15
  17. package/lib/cjs/components/CopyText/CopyText.mdx +6 -8
  18. package/lib/cjs/components/DataTable/DataTable.mdx +17 -22
  19. package/lib/cjs/components/DatePicker/DatePicker.mdx +20 -27
  20. package/lib/cjs/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.mdx +14 -19
  21. package/lib/cjs/components/ExpandableText/ExpandableText.mdx +9 -15
  22. package/lib/cjs/components/FileInputField/FileInputField.mdx +11 -16
  23. package/lib/cjs/components/Footer/Footer.mdx +9 -14
  24. package/lib/cjs/components/GridList/GridList.mdx +16 -21
  25. package/lib/cjs/components/HelpHint/HelpHint.mdx +8 -14
  26. package/lib/cjs/components/Icon/Icon.mdx +5 -3
  27. package/lib/cjs/components/IconButton/IconButton.mdx +7 -10
  28. package/lib/cjs/components/IconButtonToggle/IconButtonToggle.mdx +9 -15
  29. package/lib/cjs/components/Image/Image.mdx +4 -4
  30. package/lib/cjs/components/ImageUploadField/ImageUploadField.mdx +18 -24
  31. package/lib/cjs/components/Link/Link.mdx +5 -6
  32. package/lib/cjs/components/LinkSelectField/LinkSelectField.mdx +18 -24
  33. package/lib/cjs/components/ListItem/ListItem.mdx +6 -6
  34. package/lib/cjs/components/ListView/ListView.mdx +22 -23
  35. package/lib/cjs/components/Loader/Loader.mdx +6 -5
  36. package/lib/cjs/components/Menu/Menu.mdx +13 -18
  37. package/lib/cjs/components/Messages/Messages.mdx +9 -13
  38. package/lib/cjs/components/Modal/Modal.mdx +18 -19
  39. package/lib/cjs/components/MultivaluesField/MultivaluesField.mdx +14 -20
  40. package/lib/cjs/components/NavBar/NavBar.mdx +12 -17
  41. package/lib/cjs/components/NavSideBar/NavSideBar.mdx +12 -17
  42. package/lib/cjs/components/NavigationHeader/NavigationHeader.mdx +11 -16
  43. package/lib/cjs/components/NumberField/NumberField.mdx +16 -17
  44. package/lib/cjs/components/OverlayPanel/OverlayPanel.mdx +10 -14
  45. package/lib/cjs/components/Pagination/Pagination.mdx +9 -13
  46. package/lib/cjs/components/PasswordField/PasswordField.mdx +10 -15
  47. package/lib/cjs/components/PopoverMenu/PopoverMenu.mdx +16 -22
  48. package/lib/cjs/components/ProgressBar/ProgressBar.mdx +6 -7
  49. package/lib/cjs/components/RadioGroupField/RadioGroupField.mdx +11 -17
  50. package/lib/cjs/components/RangeCalendar/RangeCalendar.mdx +17 -22
  51. package/lib/cjs/components/RockerButtonGroup/RockerButtonGroup.mdx +11 -16
  52. package/lib/cjs/components/SearchField/SearchField.mdx +8 -10
  53. package/lib/cjs/components/SelectField/SelectField.mdx +18 -23
  54. package/lib/cjs/components/Separator/Separator.mdx +4 -3
  55. package/lib/cjs/components/ServerErrorBoundary/ServerErrorBoundary.mdx +6 -8
  56. package/lib/cjs/components/SliderField/SliderField.mdx +12 -15
  57. package/lib/cjs/components/StatusIcon/StatusIcon.mdx +4 -3
  58. package/lib/cjs/components/Stepper/Stepper.mdx +18 -20
  59. package/lib/cjs/components/SwitchField/SwitchField.mdx +9 -14
  60. package/lib/cjs/components/Tabs/Tabs.mdx +13 -18
  61. package/lib/cjs/components/TextAreaField/TextAreaField.mdx +8 -12
  62. package/lib/cjs/components/TextField/TextField.mdx +8 -12
  63. package/lib/cjs/components/TimeField/TimeField.mdx +12 -18
  64. package/lib/cjs/components/TooltipTrigger/TooltipTrigger.mdx +4 -3
  65. package/lib/cjs/types/accessibilityTable.d.ts +8 -0
  66. package/lib/cjs/types/accessibilityTable.js +6 -0
  67. package/lib/cjs/types/index.d.ts +1 -0
  68. package/lib/cjs/types/index.js +75 -64
  69. package/lib/cjs/utils/docUtils/AccessibilityTable.d.ts +3 -0
  70. package/lib/cjs/utils/docUtils/AccessibilityTable.js +38 -0
  71. package/lib/cjs/utils/docUtils/AccessibilityTable.test.js +192 -0
  72. package/lib/cjs/utils/docUtils/accessibilityTableConstants.d.ts +130 -0
  73. package/lib/cjs/utils/docUtils/accessibilityTableConstants.js +137 -0
  74. package/lib/components/AIComponents/PromptInput/PromptInputReadMe.mdx +12 -15
  75. package/lib/components/AccordionGridGroup/AccordionGridGroup.mdx +13 -19
  76. package/lib/components/AccordionGroup/AccordionGroup.mdx +16 -17
  77. package/lib/components/ArrayField/ArrayField.mdx +10 -15
  78. package/lib/components/Badge/Badge.mdx +6 -8
  79. package/lib/components/Breadcrumbs/Breadcrumbs.mdx +11 -17
  80. package/lib/components/Button/Button.mdx +8 -12
  81. package/lib/components/Calendar/Calendar.mdx +17 -22
  82. package/lib/components/Callout/Callout.mdx +8 -13
  83. package/lib/components/Card/Card.mdx +6 -8
  84. package/lib/components/CheckboxField/CheckboxField.mdx +11 -16
  85. package/lib/components/CodeEditor/CodeEditor.mdx +8 -13
  86. package/lib/components/CodeView/CodeView.mdx +5 -8
  87. package/lib/components/CollapsiblePanel/CollapsiblePanel.mdx +10 -13
  88. package/lib/components/ColorField/ColorField.mdx +13 -18
  89. package/lib/components/ComboBoxField/ComboBoxField.mdx +13 -15
  90. package/lib/components/CopyText/CopyText.mdx +6 -8
  91. package/lib/components/DataTable/DataTable.mdx +17 -22
  92. package/lib/components/DatePicker/DatePicker.mdx +20 -27
  93. package/lib/components/EnvironmentBreadcrumb/EnvironmentBreadcrumb.mdx +14 -19
  94. package/lib/components/ExpandableText/ExpandableText.mdx +9 -15
  95. package/lib/components/FileInputField/FileInputField.mdx +11 -16
  96. package/lib/components/Footer/Footer.mdx +9 -14
  97. package/lib/components/GridList/GridList.mdx +16 -21
  98. package/lib/components/HelpHint/HelpHint.mdx +8 -14
  99. package/lib/components/Icon/Icon.mdx +5 -3
  100. package/lib/components/IconButton/IconButton.mdx +7 -10
  101. package/lib/components/IconButtonToggle/IconButtonToggle.mdx +9 -15
  102. package/lib/components/Image/Image.mdx +4 -4
  103. package/lib/components/ImageUploadField/ImageUploadField.mdx +18 -24
  104. package/lib/components/Link/Link.mdx +5 -6
  105. package/lib/components/LinkSelectField/LinkSelectField.mdx +18 -24
  106. package/lib/components/ListItem/ListItem.mdx +6 -6
  107. package/lib/components/ListView/ListView.mdx +22 -23
  108. package/lib/components/Loader/Loader.mdx +6 -5
  109. package/lib/components/Menu/Menu.mdx +13 -18
  110. package/lib/components/Messages/Messages.mdx +9 -13
  111. package/lib/components/Modal/Modal.mdx +18 -19
  112. package/lib/components/MultivaluesField/MultivaluesField.mdx +14 -20
  113. package/lib/components/NavBar/NavBar.mdx +12 -17
  114. package/lib/components/NavSideBar/NavSideBar.mdx +12 -17
  115. package/lib/components/NavigationHeader/NavigationHeader.mdx +11 -16
  116. package/lib/components/NumberField/NumberField.mdx +16 -17
  117. package/lib/components/OverlayPanel/OverlayPanel.mdx +10 -14
  118. package/lib/components/Pagination/Pagination.mdx +9 -13
  119. package/lib/components/PasswordField/PasswordField.mdx +10 -15
  120. package/lib/components/PopoverMenu/PopoverMenu.mdx +16 -22
  121. package/lib/components/ProgressBar/ProgressBar.mdx +6 -7
  122. package/lib/components/RadioGroupField/RadioGroupField.mdx +11 -17
  123. package/lib/components/RangeCalendar/RangeCalendar.mdx +17 -22
  124. package/lib/components/RockerButtonGroup/RockerButtonGroup.mdx +11 -16
  125. package/lib/components/SearchField/SearchField.mdx +8 -10
  126. package/lib/components/SelectField/SelectField.mdx +18 -23
  127. package/lib/components/Separator/Separator.mdx +4 -3
  128. package/lib/components/ServerErrorBoundary/ServerErrorBoundary.mdx +6 -8
  129. package/lib/components/SliderField/SliderField.mdx +12 -15
  130. package/lib/components/StatusIcon/StatusIcon.mdx +4 -3
  131. package/lib/components/Stepper/Stepper.mdx +18 -20
  132. package/lib/components/SwitchField/SwitchField.mdx +9 -14
  133. package/lib/components/Tabs/Tabs.mdx +13 -18
  134. package/lib/components/TextAreaField/TextAreaField.mdx +8 -12
  135. package/lib/components/TextField/TextField.mdx +8 -12
  136. package/lib/components/TimeField/TimeField.mdx +12 -18
  137. package/lib/components/TooltipTrigger/TooltipTrigger.mdx +4 -3
  138. package/lib/types/accessibilityTable.js +1 -0
  139. package/lib/types/index.js +1 -0
  140. package/lib/utils/docUtils/AccessibilityTable.js +30 -0
  141. package/lib/utils/docUtils/AccessibilityTable.test.js +190 -0
  142. package/lib/utils/docUtils/accessibilityTableConstants.js +130 -0
  143. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as SelectFieldStories from './SelectField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={SelectFieldStories} isTemplate />
5
7
 
@@ -22,26 +24,19 @@ This component requires the OverlayProvider and Item originating from [react-sta
22
24
 
23
25
  ### Accessibility
24
26
 
25
- #### Keyboard Navigation
26
-
27
- These keys provide additional functionality to the component.
28
-
29
- | Keys | Functions |
30
- | ---- | --------- |
31
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
32
- | Shift + Tab | Moves focus to the previous focusable component.|
33
- | Space or Enter | Pressing Space or Enter when the trigger button is focused opens or closes the menu. Pressing Space or Enter when the menu item is focused selects the listbox option. |
34
- | Arrow keys | Can be used to move through the listbox selection. |
35
- | Typing in input field | Adds focus to it and opens the popover. |
36
- | Home(Fn + Right Arrow Key) Or Control/Command + Home | Shifts the focus to the first item in the listbox. |
37
- | End(Fn + Left Arrow Key) Or Control/Command + End | Shifts the focus to the last item in the listbox. |
38
- | Esc | Pressing the escape key closes the popover menu and adds focus to the input.|
39
-
40
- #### Screen readers
41
-
42
- This component uses the following attributes to assist screen readers:
43
- - The trigger button uses the **`aria-labelledby`** attribute to reference the label ID, the **`aria-expanded`** attribute to indicate the expansion or collapse of the popover,
44
- - The **`aria-haspopup`** attribute indicates the type of popup content as a listbox. Once expanded, the **`aria-controls`** attribute is added to the button pointing to the popover.
45
- - The component uses the **`aria-invalid`** attribute to detect incorrect values or status errors, and is set to “False” by default.
46
- - The listbox uses the **`aria-labelledby`** attribute pointing to the label ID.
47
- - Each option in the list uses the **`aria-selected`** attribute to indicate the selection state, **`aria-posinset`** to give the option’s position in the current set of list items, and **`aria-setsize`** to define the current set of options. The default **`aria-disabled`** value is false for each option.
27
+ <AccessibilityTable keyboardRows={[
28
+ KeyboardRows.tabField,
29
+ KeyboardRows.shiftTabFocusPrevious,
30
+ { key: 'Space or Enter', description: 'Pressing Space or Enter when the trigger button is focused opens or closes the menu. Pressing Space or Enter when the menu item is focused selects the listbox option.' },
31
+ { key: 'Arrow keys', description: 'Can be used to move through the listbox selection.' },
32
+ KeyboardRows.typingOpenPopover,
33
+ KeyboardRows.homeFirstListboxItem,
34
+ KeyboardRows.endLastListboxItem,
35
+ { key: 'Esc', description: 'Pressing the escape key closes the popover menu and adds focus to the input.' },
36
+ ]} screenReaderRows={[
37
+ "The trigger button uses the **`aria-labelledby`** attribute to reference the label ID, the **`aria-expanded`** attribute to indicate the expansion or collapse of the popover, ",
38
+ "The **`aria-haspopup`** attribute indicates the type of popup content as a listbox. Once expanded, the **`aria-controls`** attribute is added to the button pointing to the popover. ",
39
+ "The component uses the **`aria-invalid`** attribute to detect incorrect values or status errors, and is set to “False” by default.",
40
+ "The listbox uses the **`aria-labelledby`** attribute pointing to the label ID.",
41
+ "Each option in the list uses the **`aria-selected`** attribute to indicate the selection state, **`aria-posinset`** to give the option’s position in the current set of list items, and **`aria-setsize`** to define the current set of options. The default **`aria-disabled`** value is false for each option.",
42
+ ]} />
@@ -1,5 +1,6 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as SeparatorStories from './Separator.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
3
4
 
4
5
  <Meta of={SeparatorStories} isTemplate />
5
6
 
@@ -15,6 +16,6 @@ This component can be used independently and does not require additional compone
15
16
 
16
17
  ### Accessibility
17
18
 
18
- #### Screen Readers
19
-
20
- The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous
19
+ <AccessibilityTable screenReaderRows={[
20
+ 'The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous',
21
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from "@storybook/addon-docs/blocks";
2
2
  import * as ServerErrorBoundaryStories from './ServerErrorBoundary.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={ServerErrorBoundaryStories} isTemplate />
5
7
 
@@ -15,11 +17,7 @@ This component can be used independently and does not require additional compone
15
17
 
16
18
  This component should adhere to the [WAI-ARIA Button](https://www.w3.org/TR/wai-aria-practices-1.1/examples/button/button.html) accessibility guidelines.
17
19
 
18
- #### Keyboard Navigation
19
-
20
- These keys provide additional functionality to the component.
21
-
22
- | Keys | Functions |
23
- | -------------- | ----------------------------------------------------- |
24
- | Space or Enter | Selects the button. |
25
- | Tab | Focuses the button and follows the page tab sequence. |
20
+ <AccessibilityTable keyboardRows={[
21
+ KeyboardRows.spaceEnterSelectsButton,
22
+ KeyboardRows.tabFocusesButton,
23
+ ]} />
@@ -1,5 +1,6 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as SliderFieldStories from './SliderField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
3
4
 
4
5
  <Meta of={SliderFieldStories} isTemplate />
5
6
 
@@ -57,20 +58,16 @@ The `SliderField` component is used to allow users to select a value from a rang
57
58
 
58
59
  This component adheres to accessibility guidelines to ensure a better user experience for all users.
59
60
 
60
- #### Keyboard Navigation
61
-
62
- | Keys | Function |
63
- | ------------ | ----------------------------------------------------------------------- |
64
- | Tab | Moves focus to the slider. |
65
- | Arrow Keys | Adjusts the slider value incrementally. |
66
- | Home | Moves the slider to the minimum value. |
67
- | End | Moves the slider to the maximum value. |
68
-
69
- #### Screen Readers
70
-
71
- - **`aria-valuenow`**: Announces the current value of the slider.
72
- - **`aria-valuemin` and `aria-valuemax`**: Define the minimum and maximum values of the slider.
73
- - **`aria-orientation`**: Indicates whether the slider is horizontal or vertical.
61
+ <AccessibilityTable keyboardRows={[
62
+ { key: 'Tab', description: 'Moves focus to the slider.' },
63
+ { key: 'Arrow Keys', description: 'Adjusts the slider value incrementally.' },
64
+ { key: 'Home', description: 'Moves the slider to the minimum value.' },
65
+ { key: 'End', description: 'Moves the slider to the maximum value.' },
66
+ ]} screenReaderRows={[
67
+ '**`aria-valuenow`**: Announces the current value of the slider.',
68
+ '**`aria-valuemin` and `aria-valuemax`**: Define the minimum and maximum values of the slider.',
69
+ '**`aria-orientation`**: Indicates whether the slider is horizontal or vertical.',
70
+ ]} />
74
71
 
75
72
  ### Example Usage
76
73
 
@@ -125,4 +122,4 @@ This component adheres to accessibility guidelines to ensure a better user exper
125
122
  minValue={0}
126
123
  maxValue={100}
127
124
  />
128
- ```
125
+ ```
@@ -1,5 +1,6 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as StatusIconStories from './StatusIcon.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
3
4
 
4
5
  <Meta of={StatusIconStories} isTemplate />
5
6
 
@@ -15,6 +16,6 @@ It is built on top of the [Box from Theme-UI](https://theme-ui.com/components/bo
15
16
 
16
17
  This component can be used independently and does not require additional components.
17
18
 
18
- #### Screen Readers
19
-
20
- If the icon has a title associated with it, the **`aria-labelledby`** attribute is used to provide the label ID.
19
+ <AccessibilityTable screenReaderRows={[
20
+ 'If the icon has a title associated with it, the **`aria-labelledby`** attribute is used to provide the label ID.',
21
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from "@storybook/addon-docs/blocks";
2
2
  import * as StepperStories from './Stepper.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows, ScreenReaderRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={StepperStories} isTemplate />
5
7
 
@@ -23,26 +25,22 @@ This component requires the Item originating from [react-stately/collections](ht
23
25
 
24
26
  This component should adhere to the [WAI-ARIA Stepper](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) accessibility guidelines.
25
27
 
26
- #### Keyboard Navigation
27
-
28
- These keys provide additional functionality to the component.
29
-
30
- | Keys | Function |
31
- | ---------------------------------------------------- | ------------------------------------------------------------------------------------- |
32
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
33
- | Arrow keys | When this field is focused, the arrow keys can be used to navigate through the steps. |
34
- | Shift + Tab | Moves focus to the previous focusable component. |
35
- | Home(Fn + Right Arrow Key) Or Control/Command + Home | Shifts the focus to the first step. |
36
- | End(Fn + Left Arrow Key) Or Control/Command + End | Shifts the focus to the last step. |
37
-
38
- #### Screen Readers
39
-
40
- This component uses the following attributes to assist screen readers:
41
-
42
- - The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous.
43
- - Each step uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.
44
- - Each step uses the **`aria-labelledby`** with the label ID to reference it.
45
-
28
+ <AccessibilityTable
29
+ keyboardRows={[
30
+ KeyboardRows.tabField,
31
+ { key: 'Arrow keys', description: 'When this field is focused, the arrow keys can be used to navigate through the steps.' },
32
+ KeyboardRows.shiftTabFocusPrevious,
33
+ { key: 'Home(Fn + Right Arrow Key) Or Control/Command + Home', description: 'Shifts the focus to the first step.' },
34
+ { key: 'End(Fn + Left Arrow Key) Or Control/Command + End', description: 'Shifts the focus to the last step.' },
35
+ ]}
36
+ screenReaderRows={[
37
+ ScreenReaderRows.ariaOrientationNoTrailingSpace,
38
+ 'Each step uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.',
39
+ 'Each step uses the **`aria-labelledby`** with the label ID to reference it.',
40
+ ]}
41
+ />
42
+
43
+ {/* Non-standard section: '#### Usage' contains layout guidance. Flagged for future migration. */}
46
44
  #### Usage
47
45
 
48
46
  - The stepper component is always center-aligned in its context, whether it's in a page, a panel, or a popup.
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as SwitchFieldStories from './SwitchField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={SwitchFieldStories} isTemplate />
5
7
 
@@ -21,17 +23,10 @@ This component can be used independently and does not require additional compone
21
23
 
22
24
  This component should adhere to the [WAI-ARIA Switch](https://www.w3.org/WAI/ARIA/apg/patterns/switch/) accessibility guidelines.
23
25
 
24
- #### Keyboard Navigation
25
-
26
- These keys provide additional functionality to the component.
27
-
28
- | Keys | Functions |
29
- | ---- | --------- |
30
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
31
- | Shift + Tab | Moves focus to the previous focusable component.|
32
- | Space | When focused, Space toggles the switched field. |
33
-
34
- #### Screen readers
35
-
36
- The hidden input uses the **`aria-labelledby`** attribute to associate the label, the **`aria-label`** attribute to provide an accessible name,
37
- and the **`aria-checked`** attribute for the switched state.
26
+ <AccessibilityTable keyboardRows={[
27
+ KeyboardRows.tabField,
28
+ KeyboardRows.shiftTabFocusPrevious,
29
+ { key: 'Space', description: 'When focused, Space toggles the switched field.' },
30
+ ]} screenReaderRows={[
31
+ 'The hidden input uses the **`aria-labelledby`** attribute to associate the label, the **`aria-label`** attribute to provide an accessible name, and the **`aria-checked`** attribute for the switched state.',
32
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as TabsStories from './Tabs.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows, ScreenReaderRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={TabsStories} isTemplate />
5
7
 
@@ -21,21 +23,14 @@ This component requires the Tab component.
21
23
 
22
24
  This component should adhere to the [WAI-ARIA Tabs](https://www.w3.org/WAI/ARIA/apg/patterns/tabs/) accessibility guidelines.
23
25
 
24
- #### Keyboard Navigation
25
-
26
- These keys provide additional functionality to the component.
27
-
28
- | Keys | Function |
29
- | ---- | ---- |
30
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
31
- | Arrow keys | When a tab is focused, tabs can be navigated using the left and right arrow keys. |
32
- | Shift + Tab | Moves focus to the previous focusable component. |
33
- | Home(Fn + Right Arrow Key) Or Control/Command + Home| Shifts the focus to the first tab. |
34
- | End(Fn + Left Arrow Key) Or Control/Command + End | Shifts the focus to the last tab. |
35
-
36
- #### Screen Readers
37
-
38
- This component uses the following attributes to assist screen readers:
39
- - The **`aria-orientation`** attribute indicates whether the orientation is horizontal, vertical, unknown, or ambiguous.
40
- - Each tab uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.
41
- - Each tab uses the **`aria-labelledby`** with the label ID to reference it.
26
+ <AccessibilityTable keyboardRows={[
27
+ KeyboardRows.tabField,
28
+ { key: 'Arrow keys', description: 'When a tab is focused, tabs can be navigated using the left and right arrow keys.' },
29
+ KeyboardRows.shiftTabFocusPrevious,
30
+ { key: 'Home(Fn + Right Arrow Key) Or Control/Command + Home', description: 'Shifts the focus to the first tab.' },
31
+ { key: 'End(Fn + Left Arrow Key) Or Control/Command + End', description: 'Shifts the focus to the last tab.' },
32
+ ]} screenReaderRows={[
33
+ ScreenReaderRows.ariaOrientationWithTrailingSpace,
34
+ 'Each tab uses the **`aria-selected`** attribute to indicate the selection status, and the **`aria-control`** attribute is supplied with the associated panel ID that displays the content.',
35
+ 'Each tab uses the **`aria-labelledby`** with the label ID to reference it.',
36
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as TextAreaFieldStories from './TextAreaField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows, ScreenReaderRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={TextAreaFieldStories} isTemplate />
5
7
 
@@ -21,15 +23,9 @@ This component can be used independently and does not require additional compone
21
23
 
22
24
  ### Accessibility
23
25
 
24
- #### Keyboard Navigation
25
-
26
- These keys provide additional functionality to the component.
27
-
28
- | Keys | Functions |
29
- | ---- | --------- |
30
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
31
- | Shift + Tab | Moves focus to the previous focusable component. |
32
-
33
- #### Screen readers
34
-
35
- This component uses the **`aria-labelledby`** attribute pointing to the label, and the **`aria-invalid`** attribute to detect incorrect values or status errors, which is set to “False” by default.
26
+ <AccessibilityTable keyboardRows={[
27
+ KeyboardRows.tabField,
28
+ KeyboardRows.shiftTabFocusPrevious,
29
+ ]} screenReaderRows={[
30
+ ScreenReaderRows.ariaLabelledByInvalidFalse,
31
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as TextFieldStories from './TextField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows, ScreenReaderRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={TextFieldStories} isTemplate />
5
7
 
@@ -21,15 +23,9 @@ This component can be used independently and does not require additional compone
21
23
 
22
24
  ### Accessibility
23
25
 
24
- #### Keyboard Navigation
25
-
26
- These keys provide additional functionality to the component.
27
-
28
- | Keys | Functions |
29
- | ---- | --------- |
30
- | Tab | The field is focusable using the Tab key and follows the page tab sequence. |
31
- | Shift + Tab | Moves focus to the previous focusable component. |
32
-
33
- #### Screen readers
34
-
35
- This component uses the **`aria-labelledby`** attribute pointing to the label, and the **`aria-invalid`** attribute to detect incorrect values or status errors, which is set to “False” by default.
26
+ <AccessibilityTable keyboardRows={[
27
+ KeyboardRows.tabField,
28
+ KeyboardRows.shiftTabFocusPrevious,
29
+ ]} screenReaderRows={[
30
+ ScreenReaderRows.ariaLabelledByInvalidFalse,
31
+ ]} />
@@ -1,5 +1,7 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as TimeFieldStories from './TimeField.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
4
+ import { KeyboardRows, ScreenReaderRows } from '../../utils/docUtils/accessibilityTableConstants';
3
5
 
4
6
  <Meta of={TimeFieldStories} isTemplate />
5
7
 
@@ -16,21 +18,13 @@ and [useTimeFieldState](https://react-spectrum.adobe.com/react-stately/useTimeFi
16
18
 
17
19
  This component can be used independently and does not require additional components.
18
20
 
19
- #### Keyboard Navigation
20
-
21
- These keys provide additional functionality to the component.
22
-
23
- | Keys | Functions |
24
- | ---- | --------- |
25
- | Tab | Focuses the field and follows the page tab sequence. |
26
- | Shift + Tab | Moves focus to the previous focusable component. |
27
- | Up and down Arrow keys | When segments are focused, it increments and decrements time values |
28
- | Left and right arrows | Moves focus between segments. |
29
-
30
- #### Screen Readers
31
-
32
- This component uses the following attributes to assist screen readers:
33
-
34
- - The **`aria-label`** attribute is used to provide an accessible name.
35
- - The hidden input, TimeField, and all spin buttons have an **`aria-labelledby`** attribute pointing to the label ID, along with the **`aria-label`** attribute for an accessible name.
36
- - Each spin button has an **`aria-valuenow`**, **`aria-valuemin`**, and **`aria-valuemax`** to represent the current value, minimum allowed value, and maximum allowed value.
21
+ <AccessibilityTable keyboardRows={[
22
+ KeyboardRows.tabFocusesField,
23
+ KeyboardRows.shiftTabFocusPrevious,
24
+ { key: 'Up and down Arrow keys', description: 'When segments are focused, it increments and decrements time values.' },
25
+ { key: 'Left and right arrows', description: 'Moves focus between segments.' },
26
+ ]} screenReaderRows={[
27
+ ScreenReaderRows.ariaLabelAccessibleName,
28
+ 'The hidden input, TimeField, and all spin buttons have an **`aria-labelledby`** attribute pointing to the label ID, along with the **`aria-label`** attribute for an accessible name.',
29
+ 'Each spin button has an **`aria-valuenow`**, **`aria-valuemin`**, and **`aria-valuemax`** to represent the current value, minimum allowed value, and maximum allowed value.',
30
+ ]} />
@@ -1,5 +1,6 @@
1
1
  import { Meta } from '@storybook/addon-docs/blocks';
2
2
  import * as TooltipTriggerStories from './TooltipTrigger.stories';
3
+ import AccessibilityTable from '../../utils/docUtils/AccessibilityTable';
3
4
 
4
5
  <Meta of={TooltipTriggerStories} isTemplate />
5
6
 
@@ -19,6 +20,6 @@ This component requires the [Button](./?path=/docs/components-button--default) a
19
20
 
20
21
  ### Accessibility
21
22
 
22
- #### Screen Readers
23
-
24
- The trigger button uses the **`aria-describedby`** attribute with the tooltip container ID to announce the screen reader content when it becomes visible.
23
+ <AccessibilityTable screenReaderRows={[
24
+ 'The trigger button uses the **`aria-describedby`** attribute with the tooltip container ID to announce the screen reader content when it becomes visible.',
25
+ ]} />
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from './accessibilityTable';
1
2
  export * from './arrayField';
2
3
  export * from './avatar';
3
4
  export * from './badge';
@@ -0,0 +1,30 @@
1
+ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
2
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
+ import React from 'react';
4
+ import Markdown from 'markdown-to-jsx';
5
+ import { v4 as uuid } from 'uuid';
6
+ import { jsx as ___EmotionJSX } from "@emotion/react";
7
+ var AccessibilityTable = function AccessibilityTable(_ref) {
8
+ var keyboardRows = _ref.keyboardRows,
9
+ keyboardDescription = _ref.keyboardDescription,
10
+ screenReaderRows = _ref.screenReaderRows;
11
+ var hasKeyboard = _Array$isArray(keyboardRows) && keyboardRows.length > 0;
12
+ var hasScreenReader = _Array$isArray(screenReaderRows) && screenReaderRows.length > 0;
13
+ if (!hasKeyboard && !hasScreenReader) {
14
+ return null;
15
+ }
16
+ return ___EmotionJSX(React.Fragment, null, hasKeyboard && ___EmotionJSX(React.Fragment, null, ___EmotionJSX("h4", null, "Keyboard Navigation"), ___EmotionJSX("p", null, keyboardDescription || 'These keys provide additional functionality to the component.'), ___EmotionJSX("table", null, ___EmotionJSX("thead", null, ___EmotionJSX("tr", null, ___EmotionJSX("th", null, "Key"), ___EmotionJSX("th", null, "Function"))), ___EmotionJSX("tbody", null, _mapInstanceProperty(keyboardRows).call(keyboardRows, function (row) {
17
+ return ___EmotionJSX("tr", {
18
+ key: row.key + uuid()
19
+ }, ___EmotionJSX("td", null, ___EmotionJSX("span", null, row.key)), ___EmotionJSX("td", null, ___EmotionJSX(Markdown, {
20
+ options: {
21
+ forceInline: true
22
+ }
23
+ }, row.description)));
24
+ })))), hasScreenReader && ___EmotionJSX(React.Fragment, null, ___EmotionJSX("h4", null, "Screen Readers"), ___EmotionJSX("p", null, "This component uses the following attributes to assist screen readers:"), ___EmotionJSX("ul", null, _mapInstanceProperty(screenReaderRows).call(screenReaderRows, function (item) {
25
+ return ___EmotionJSX("li", {
26
+ key: item + uuid()
27
+ }, ___EmotionJSX(Markdown, null, item));
28
+ }))));
29
+ };
30
+ export default AccessibilityTable;
@@ -0,0 +1,190 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
2
+ import React from 'react';
3
+ import { render, screen } from '@testing-library/react';
4
+ import { universalComponentTests } from '../testUtils/universalComponentTest';
5
+ import AccessibilityTable from './AccessibilityTable';
6
+
7
+ // Needs to be added to each component test file
8
+ import { jsx as ___EmotionJSX } from "@emotion/react";
9
+ universalComponentTests({
10
+ renderComponent: function renderComponent(props) {
11
+ return ___EmotionJSX(AccessibilityTable, _extends({
12
+ keyboardRows: [{
13
+ key: 'Tab',
14
+ description: 'Focus next element'
15
+ }]
16
+ }, props));
17
+ },
18
+ skipForwardRefTest: true
19
+ });
20
+ test('renders nothing when both keyboardRows and screenReaderRows are absent', function () {
21
+ var _render = render(___EmotionJSX(AccessibilityTable, null)),
22
+ container = _render.container;
23
+ expect(container).toBeEmptyDOMElement();
24
+ });
25
+ test('renders nothing when both props are provided as empty arrays', function () {
26
+ var _render2 = render(___EmotionJSX(AccessibilityTable, {
27
+ keyboardRows: [],
28
+ screenReaderRows: []
29
+ })),
30
+ container = _render2.container;
31
+ expect(container).toBeEmptyDOMElement();
32
+ });
33
+ describe('keyboard navigation section', function () {
34
+ var keyboardRows = [{
35
+ key: 'Tab',
36
+ description: 'Focus next element'
37
+ }, {
38
+ key: 'Shift+Tab',
39
+ description: 'Focus previous element'
40
+ }];
41
+ test('renders the Keyboard Navigation heading', function () {
42
+ render(___EmotionJSX(AccessibilityTable, {
43
+ keyboardRows: keyboardRows
44
+ }));
45
+ expect(screen.getByText('Keyboard Navigation')).toBeInTheDocument();
46
+ });
47
+ test('renders the keyboard section description paragraph', function () {
48
+ render(___EmotionJSX(AccessibilityTable, {
49
+ keyboardRows: keyboardRows
50
+ }));
51
+ expect(screen.getByText('These keys provide additional functionality to the component.')).toBeInTheDocument();
52
+ });
53
+ test('renders Key and Function column headers', function () {
54
+ render(___EmotionJSX(AccessibilityTable, {
55
+ keyboardRows: keyboardRows
56
+ }));
57
+ expect(screen.getByText('Key')).toBeInTheDocument();
58
+ expect(screen.getByText('Function')).toBeInTheDocument();
59
+ });
60
+ test('renders one row per keyboardRows entry', function () {
61
+ render(___EmotionJSX(AccessibilityTable, {
62
+ keyboardRows: keyboardRows
63
+ }));
64
+ var rows = screen.getAllByRole('row');
65
+ // thead has 1 row, tbody has 2 rows (one per entry)
66
+ expect(rows).toHaveLength(3);
67
+ });
68
+ test('renders the key cell for each row', function () {
69
+ render(___EmotionJSX(AccessibilityTable, {
70
+ keyboardRows: keyboardRows
71
+ }));
72
+ expect(screen.getByText('Tab')).toBeInTheDocument();
73
+ expect(screen.getByText('Shift+Tab')).toBeInTheDocument();
74
+ });
75
+ test('does not render the Screen Readers section', function () {
76
+ render(___EmotionJSX(AccessibilityTable, {
77
+ keyboardRows: keyboardRows
78
+ }));
79
+ expect(screen.queryByText('Screen Readers')).not.toBeInTheDocument();
80
+ });
81
+ test('renders a custom keyboardDescription when the prop is provided', function () {
82
+ render(___EmotionJSX(AccessibilityTable, {
83
+ keyboardRows: keyboardRows,
84
+ keyboardDescription: "Custom keyboard description for this component."
85
+ }));
86
+ expect(screen.getByText('Custom keyboard description for this component.')).toBeInTheDocument();
87
+ });
88
+ test('does not render a custom keyboardDescription when the prop is omitted', function () {
89
+ render(___EmotionJSX(AccessibilityTable, {
90
+ keyboardRows: keyboardRows
91
+ }));
92
+ expect(screen.queryByText('Custom keyboard description for this component.')).not.toBeInTheDocument();
93
+ });
94
+ test('falls back to the default description when keyboardDescription is an empty string', function () {
95
+ render(___EmotionJSX(AccessibilityTable, {
96
+ keyboardRows: keyboardRows,
97
+ keyboardDescription: ""
98
+ }));
99
+ expect(screen.getByText('These keys provide additional functionality to the component.')).toBeInTheDocument();
100
+ });
101
+ });
102
+ describe('screen reader section', function () {
103
+ var screenReaderRows = ['aria-label', 'aria-expanded'];
104
+ test('renders the Screen Readers heading', function () {
105
+ render(___EmotionJSX(AccessibilityTable, {
106
+ screenReaderRows: screenReaderRows
107
+ }));
108
+ expect(screen.getByText('Screen Readers')).toBeInTheDocument();
109
+ });
110
+ test('renders the screen reader section description paragraph', function () {
111
+ render(___EmotionJSX(AccessibilityTable, {
112
+ screenReaderRows: screenReaderRows
113
+ }));
114
+ expect(screen.getByText('This component uses the following attributes to assist screen readers:')).toBeInTheDocument();
115
+ });
116
+ test('renders a list with one item per screenReaderRows entry', function () {
117
+ render(___EmotionJSX(AccessibilityTable, {
118
+ screenReaderRows: screenReaderRows
119
+ }));
120
+ var items = screen.getAllByRole('listitem');
121
+ expect(items).toHaveLength(screenReaderRows.length);
122
+ });
123
+ test('renders text content for each screen reader row item', function () {
124
+ render(___EmotionJSX(AccessibilityTable, {
125
+ screenReaderRows: screenReaderRows
126
+ }));
127
+ expect(screen.getByText('aria-label')).toBeInTheDocument();
128
+ expect(screen.getByText('aria-expanded')).toBeInTheDocument();
129
+ });
130
+ test('does not render the Keyboard Navigation section', function () {
131
+ render(___EmotionJSX(AccessibilityTable, {
132
+ screenReaderRows: screenReaderRows
133
+ }));
134
+ expect(screen.queryByText('Keyboard Navigation')).not.toBeInTheDocument();
135
+ });
136
+ });
137
+ describe('both sections together', function () {
138
+ var keyboardRows = [{
139
+ key: 'Tab',
140
+ description: 'Focus next element'
141
+ }];
142
+ var screenReaderRows = ['aria-label'];
143
+ test('renders both headings when both props are provided', function () {
144
+ render(___EmotionJSX(AccessibilityTable, {
145
+ keyboardRows: keyboardRows,
146
+ screenReaderRows: screenReaderRows
147
+ }));
148
+ expect(screen.getByText('Keyboard Navigation')).toBeInTheDocument();
149
+ expect(screen.getByText('Screen Readers')).toBeInTheDocument();
150
+ });
151
+ test('renders both the table and the list', function () {
152
+ render(___EmotionJSX(AccessibilityTable, {
153
+ keyboardRows: keyboardRows,
154
+ screenReaderRows: screenReaderRows
155
+ }));
156
+ expect(screen.getByRole('table')).toBeInTheDocument();
157
+ expect(screen.getByRole('list')).toBeInTheDocument();
158
+ });
159
+ });
160
+ describe('markdown rendering', function () {
161
+ test('renders bold markdown in row.description as a strong element', function () {
162
+ var keyboardRows = [{
163
+ key: 'Enter',
164
+ description: '**Confirm** selection'
165
+ }];
166
+ render(___EmotionJSX(AccessibilityTable, {
167
+ keyboardRows: keyboardRows
168
+ }));
169
+ var strongEl = screen.getByText('Confirm');
170
+ expect(strongEl.tagName).toBe('STRONG');
171
+ });
172
+ test('renders plain text description via markdown-to-jsx without error', function () {
173
+ var keyboardRows = [{
174
+ key: 'Tab',
175
+ description: 'Focus next element'
176
+ }];
177
+ render(___EmotionJSX(AccessibilityTable, {
178
+ keyboardRows: keyboardRows
179
+ }));
180
+ expect(screen.getByText('Focus next element')).toBeInTheDocument();
181
+ });
182
+ test('renders bold markdown in screenReaderRows item as a strong element', function () {
183
+ var screenReaderRows = ['**aria-label**: describes the element'];
184
+ render(___EmotionJSX(AccessibilityTable, {
185
+ screenReaderRows: screenReaderRows
186
+ }));
187
+ var strongEl = screen.getByText('aria-label');
188
+ expect(strongEl.tagName).toBe('STRONG');
189
+ });
190
+ });