@amsterdam/design-system-react 0.15.0 → 0.16.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 (223) hide show
  1. package/README.md +1 -1
  2. package/dist/Accordion/Accordion.js +4 -1
  3. package/dist/Accordion/Accordion.test.js +19 -3
  4. package/dist/Accordion/AccordionSection.test.js +1 -1
  5. package/dist/ActionGroup/ActionGroup.test.js +1 -1
  6. package/dist/Alert/Alert.test.js +1 -1
  7. package/dist/Avatar/Avatar.test.js +1 -1
  8. package/dist/Badge/Badge.test.js +1 -1
  9. package/dist/Blockquote/Blockquote.test.js +3 -4
  10. package/dist/Breadcrumb/Breadcrumb.test.js +1 -1
  11. package/dist/Breadcrumb/BreadcrumbLink.test.js +1 -1
  12. package/dist/Breakout/Breakout.test.js +11 -19
  13. package/dist/Breakout/BreakoutCell.d.ts +3 -1
  14. package/dist/Breakout/BreakoutCell.js +1 -0
  15. package/dist/Breakout/BreakoutCell.test.js +20 -16
  16. package/dist/Button/Button.test.js +8 -1
  17. package/dist/Card/Card.d.ts +10 -0
  18. package/dist/Card/Card.js +8 -1
  19. package/dist/Card/Card.test.js +1 -1
  20. package/dist/Card/CardHeading.d.ts +11 -0
  21. package/dist/Card/CardHeading.js +10 -0
  22. package/dist/Card/CardHeading.test.js +34 -0
  23. package/dist/Card/CardHeadingGroup.test.js +1 -1
  24. package/dist/Card/CardImage.d.ts +7 -0
  25. package/dist/Card/CardImage.js +10 -0
  26. package/dist/{Footer/FooterSpotlight.test.js → Card/CardImage.test.js} +9 -9
  27. package/dist/Card/CardLink.test.js +1 -1
  28. package/dist/CharacterCount/CharacterCount.test.js +1 -1
  29. package/dist/Checkbox/Checkbox.test.js +2 -3
  30. package/dist/Column/Column.d.ts +4 -3
  31. package/dist/Column/Column.js +2 -1
  32. package/dist/Column/Column.test.js +10 -12
  33. package/dist/DateInput/DateInput.test.js +1 -1
  34. package/dist/DescriptionList/DescriptionList.test.js +1 -1
  35. package/dist/DescriptionList/DescriptionListDescription.test.js +1 -1
  36. package/dist/DescriptionList/DescriptionListSection.test.js +1 -1
  37. package/dist/DescriptionList/DescriptionListTerm.test.js +1 -1
  38. package/dist/Dialog/Dialog.test.js +1 -1
  39. package/dist/ErrorMessage/ErrorMessage.test.js +1 -1
  40. package/dist/Field/Field.test.js +1 -1
  41. package/dist/FieldSet/FieldSet.test.js +1 -1
  42. package/dist/Figure/Figure.test.js +1 -1
  43. package/dist/Figure/FigureCaption.test.js +1 -1
  44. package/dist/FileInput/FileInput.test.js +1 -1
  45. package/dist/FileList/FileList.test.js +1 -1
  46. package/dist/FileList/FileListItem.test.js +1 -1
  47. package/dist/Grid/Grid.d.ts +8 -5
  48. package/dist/Grid/Grid.js +2 -0
  49. package/dist/Grid/Grid.test.js +13 -29
  50. package/dist/Grid/GridCell.test.js +2 -8
  51. package/dist/Grid/paddingClasses.d.ts +2 -2
  52. package/dist/Heading/Heading.test.js +17 -11
  53. package/dist/Hint/Hint.test.js +1 -1
  54. package/dist/Icon/Icon.d.ts +1 -1
  55. package/dist/Icon/Icon.test.js +3 -4
  56. package/dist/IconButton/IconButton.js +1 -1
  57. package/dist/IconButton/IconButton.test.js +1 -1
  58. package/dist/Image/Image.d.ts +4 -8
  59. package/dist/Image/Image.test.js +1 -1
  60. package/dist/ImageSlider/ImageSlider.test.js +1 -1
  61. package/dist/ImageSlider/ImageSliderItem.test.js +1 -1
  62. package/dist/ImageSlider/ImageSliderScroller.test.js +1 -1
  63. package/dist/ImageSlider/ImageSliderThumbnails.js +1 -1
  64. package/dist/ImageSlider/ImageSliderThumbnails.test.js +1 -1
  65. package/dist/InvalidFormAlert/InvalidFormAlert.test.js +1 -1
  66. package/dist/Label/Label.test.js +3 -4
  67. package/dist/Link/Link.d.ts +0 -6
  68. package/dist/Link/Link.js +1 -1
  69. package/dist/Link/Link.test.js +22 -29
  70. package/dist/LinkList/LinkList.test.js +1 -1
  71. package/dist/LinkList/LinkListLink.test.js +1 -1
  72. package/dist/Logo/Logo.test.js +2 -3
  73. package/dist/Mark/Mark.test.js +1 -1
  74. package/dist/OrderedList/OrderedList.test.js +1 -1
  75. package/dist/OrderedList/OrderedListItem.test.js +1 -1
  76. package/dist/Overlap/Overlap.test.js +1 -1
  77. package/dist/{Footer/FooterSpotlight.d.ts → Page/Page.d.ts} +2 -2
  78. package/dist/Page/Page.js +9 -0
  79. package/dist/{MegaMenu/MegaMenu.test.js → Page/Page.test.js} +9 -9
  80. package/dist/Page/index.d.ts +2 -0
  81. package/dist/Page/index.js +1 -0
  82. package/dist/{Footer/Footer.d.ts → PageFooter/PageFooter.d.ts} +2 -2
  83. package/dist/PageFooter/PageFooter.js +17 -0
  84. package/dist/{Footer/Footer.test.js → PageFooter/PageFooter.test.js} +9 -9
  85. package/dist/{Footer/FooterMenu.d.ts → PageFooter/PageFooterMenu.d.ts} +2 -2
  86. package/dist/PageFooter/PageFooterMenu.js +9 -0
  87. package/dist/{Footer/FooterMenu.test.js → PageFooter/PageFooterMenu.test.js} +9 -9
  88. package/dist/{Footer/FooterMenuLink.d.ts → PageFooter/PageFooterMenuLink.d.ts} +2 -2
  89. package/dist/PageFooter/PageFooterMenuLink.js +9 -0
  90. package/dist/{Footer/FooterMenuLink.test.js → PageFooter/PageFooterMenuLink.test.js} +9 -9
  91. package/dist/PageFooter/PageFooterSpotlight.d.ts +9 -0
  92. package/dist/PageFooter/PageFooterSpotlight.js +9 -0
  93. package/dist/{MegaMenu/MegaMenuListCategory.test.js → PageFooter/PageFooterSpotlight.test.js} +9 -9
  94. package/dist/PageFooter/index.d.ts +5 -0
  95. package/dist/PageFooter/index.js +1 -0
  96. package/dist/{Header/Header.d.ts → PageHeader/PageHeader.d.ts} +4 -4
  97. package/dist/PageHeader/PageHeader.js +31 -0
  98. package/dist/{Header/Header.test.js → PageHeader/PageHeader.test.js} +37 -38
  99. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.d.ts +2 -0
  100. package/dist/PageHeader/PageHeaderGridCellNarrowWindowOnly.js +6 -0
  101. package/dist/{Header/HeaderGridCellNarrowWindowOnly.test.js → PageHeader/PageHeaderGridCellNarrowWindowOnly.test.js} +10 -10
  102. package/dist/PageHeader/PageHeaderMenuIcon.d.ts +2 -0
  103. package/dist/PageHeader/PageHeaderMenuIcon.js +2 -0
  104. package/dist/{Header/HeaderMenuLink.d.ts → PageHeader/PageHeaderMenuLink.d.ts} +2 -2
  105. package/dist/PageHeader/PageHeaderMenuLink.js +5 -0
  106. package/dist/{Header/HeaderMenuLink.test.js → PageHeader/PageHeaderMenuLink.test.js} +13 -13
  107. package/dist/PageHeader/index.d.ts +3 -0
  108. package/dist/PageHeader/index.js +1 -0
  109. package/dist/PageHeading/PageHeading.test.js +2 -3
  110. package/dist/Pagination/Pagination.test.js +1 -1
  111. package/dist/Paragraph/Paragraph.test.js +1 -1
  112. package/dist/PasswordInput/PasswordInput.test.js +1 -1
  113. package/dist/Radio/Radio.test.js +1 -1
  114. package/dist/Row/Row.d.ts +4 -3
  115. package/dist/Row/Row.js +2 -1
  116. package/dist/Row/Row.test.js +10 -12
  117. package/dist/SearchField/SearchField.d.ts +2 -0
  118. package/dist/SearchField/SearchField.test.js +2 -3
  119. package/dist/SearchField/SearchFieldInput.test.js +2 -3
  120. package/dist/Select/Select.test.js +1 -1
  121. package/dist/Select/SelectOption.test.js +1 -1
  122. package/dist/Select/SelectOptionGroup.test.js +1 -1
  123. package/dist/SkipLink/SkipLink.test.js +1 -1
  124. package/dist/Spotlight/Spotlight.d.ts +4 -2
  125. package/dist/Spotlight/Spotlight.js +1 -0
  126. package/dist/Spotlight/Spotlight.test.js +11 -9
  127. package/dist/StandaloneLink/StandaloneLink.d.ts +17 -0
  128. package/dist/StandaloneLink/StandaloneLink.js +10 -0
  129. package/dist/StandaloneLink/StandaloneLink.test.js +40 -0
  130. package/dist/StandaloneLink/index.d.ts +2 -0
  131. package/dist/StandaloneLink/index.js +1 -0
  132. package/dist/Switch/Switch.test.js +1 -1
  133. package/dist/Table/Table.test.js +1 -1
  134. package/dist/Table/TableBody.test.js +1 -1
  135. package/dist/Table/TableCaption.test.js +1 -1
  136. package/dist/Table/TableCell.test.js +1 -1
  137. package/dist/Table/TableFooter.test.js +1 -1
  138. package/dist/Table/TableHeader.test.js +1 -1
  139. package/dist/Table/TableHeaderCell.test.js +1 -1
  140. package/dist/Table/TableRow.test.js +1 -1
  141. package/dist/TableOfContents/TableOfContents.test.js +1 -1
  142. package/dist/TableOfContents/TableOfContentsLink.test.js +1 -1
  143. package/dist/TableOfContents/TableOfContentsList.test.js +1 -1
  144. package/dist/Tabs/Tabs.d.ts +6 -6
  145. package/dist/Tabs/Tabs.js +4 -5
  146. package/dist/Tabs/Tabs.test.js +21 -6
  147. package/dist/Tabs/TabsButton.d.ts +4 -4
  148. package/dist/Tabs/TabsButton.js +4 -4
  149. package/dist/Tabs/TabsButton.test.js +10 -10
  150. package/dist/Tabs/TabsContext.d.ts +2 -7
  151. package/dist/Tabs/TabsContext.js +0 -1
  152. package/dist/Tabs/TabsList.js +1 -1
  153. package/dist/Tabs/TabsList.test.js +1 -1
  154. package/dist/Tabs/TabsPanel.d.ts +4 -4
  155. package/dist/Tabs/TabsPanel.js +4 -4
  156. package/dist/Tabs/TabsPanel.test.js +10 -12
  157. package/dist/TextArea/TextArea.test.js +1 -1
  158. package/dist/TextInput/TextInput.test.js +2 -3
  159. package/dist/TimeInput/TimeInput.test.js +1 -1
  160. package/dist/UnorderedList/UnorderedList.test.js +1 -1
  161. package/dist/UnorderedList/UnorderedListItem.test.js +1 -1
  162. package/dist/common/accessibility.d.ts +9 -1
  163. package/dist/index.cjs.js +1000 -1057
  164. package/dist/index.cjs.js.map +1 -1
  165. package/dist/index.d.ts +164 -194
  166. package/dist/index.esm.js +998 -1053
  167. package/dist/index.esm.js.map +1 -1
  168. package/dist/index.js +4 -6
  169. package/dist/tsconfig.tsbuildinfo +1 -1
  170. package/package.json +10 -10
  171. package/dist/Footer/Footer.js +0 -17
  172. package/dist/Footer/FooterMenu.js +0 -9
  173. package/dist/Footer/FooterMenuLink.js +0 -9
  174. package/dist/Footer/FooterSpotlight.js +0 -9
  175. package/dist/Footer/index.d.ts +0 -5
  176. package/dist/Footer/index.js +0 -1
  177. package/dist/Header/Header.js +0 -31
  178. package/dist/Header/HeaderGridCellNarrowWindowOnly.d.ts +0 -2
  179. package/dist/Header/HeaderGridCellNarrowWindowOnly.js +0 -6
  180. package/dist/Header/HeaderMenuIcon.d.ts +0 -2
  181. package/dist/Header/HeaderMenuIcon.js +0 -2
  182. package/dist/Header/HeaderMenuLink.js +0 -5
  183. package/dist/Header/index.d.ts +0 -3
  184. package/dist/Header/index.js +0 -1
  185. package/dist/MegaMenu/MegaMenu.d.ts +0 -14
  186. package/dist/MegaMenu/MegaMenu.js +0 -12
  187. package/dist/MegaMenu/MegaMenuListCategory.d.ts +0 -9
  188. package/dist/MegaMenu/MegaMenuListCategory.js +0 -9
  189. package/dist/MegaMenu/index.d.ts +0 -3
  190. package/dist/MegaMenu/index.js +0 -1
  191. package/dist/PageMenu/PageMenu.d.ts +0 -25
  192. package/dist/PageMenu/PageMenu.js +0 -12
  193. package/dist/PageMenu/PageMenu.test.js +0 -45
  194. package/dist/PageMenu/PageMenuLink.d.ts +0 -13
  195. package/dist/PageMenu/PageMenuLink.js +0 -10
  196. package/dist/PageMenu/PageMenuLink.test.js +0 -40
  197. package/dist/PageMenu/index.d.ts +0 -3
  198. package/dist/PageMenu/index.js +0 -1
  199. package/dist/Screen/Screen.d.ts +0 -21
  200. package/dist/Screen/Screen.js +0 -9
  201. package/dist/Screen/Screen.test.d.ts +0 -1
  202. package/dist/Screen/Screen.test.js +0 -40
  203. package/dist/Screen/index.d.ts +0 -2
  204. package/dist/Screen/index.js +0 -1
  205. package/dist/TopTaskLink/TopTaskLink.d.ts +0 -17
  206. package/dist/TopTaskLink/TopTaskLink.js +0 -9
  207. package/dist/TopTaskLink/TopTaskLink.test.d.ts +0 -1
  208. package/dist/TopTaskLink/TopTaskLink.test.js +0 -42
  209. package/dist/TopTaskLink/index.d.ts +0 -1
  210. package/dist/TopTaskLink/index.js +0 -1
  211. /package/dist/{Footer/Footer.test.d.ts → Card/CardHeading.test.d.ts} +0 -0
  212. /package/dist/{Footer/FooterMenu.test.d.ts → Card/CardImage.test.d.ts} +0 -0
  213. /package/dist/{Footer/FooterMenuLink.test.d.ts → Page/Page.test.d.ts} +0 -0
  214. /package/dist/{Footer/FooterSpotlight.test.d.ts → PageFooter/PageFooter.test.d.ts} +0 -0
  215. /package/dist/{Header/HeaderGridCellNarrowWindowOnly.test.d.ts → PageFooter/PageFooterMenu.test.d.ts} +0 -0
  216. /package/dist/{Header/HeaderMenuLink.test.d.ts → PageFooter/PageFooterMenuLink.test.d.ts} +0 -0
  217. /package/dist/{MegaMenu/MegaMenu.test.d.ts → PageFooter/PageFooterSpotlight.test.d.ts} +0 -0
  218. /package/dist/{Header/Header.test.d.ts → PageHeader/PageHeader.test.d.ts} +0 -0
  219. /package/dist/{MegaMenu/MegaMenuListCategory.test.d.ts → PageHeader/PageHeaderGridCellNarrowWindowOnly.test.d.ts} +0 -0
  220. /package/dist/{PageMenu/PageMenu.test.d.ts → PageHeader/PageHeaderMenuLink.test.d.ts} +0 -0
  221. /package/dist/{Header → PageHeader}/matchMedia.mock.d.ts +0 -0
  222. /package/dist/{Header → PageHeader}/matchMedia.mock.js +0 -0
  223. /package/dist/{PageMenu/PageMenuLink.test.d.ts → StandaloneLink/StandaloneLink.test.d.ts} +0 -0
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * @license EUPL-1.2+
4
+ * Copyright Gemeente Amsterdam
5
+ */
6
+ import clsx from 'clsx';
7
+ import { forwardRef } from 'react';
8
+ import { Icon } from '../Icon';
9
+ export const StandaloneLink = forwardRef(({ children, className, color, icon, ...restProps }, ref) => (_jsxs("a", { ...restProps, className: clsx('ams-standalone-link', color && `ams-standalone-link--${color}`, icon && 'ams-standalone-link--with-icon', className), ref: ref, children: [icon && _jsx(Icon, { svg: icon }), children] })));
10
+ StandaloneLink.displayName = 'StandaloneLink';
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render, screen } from '@testing-library/react';
3
+ import { createRef } from 'react';
4
+ import { StandaloneLink } from './StandaloneLink';
5
+ import '@testing-library/jest-dom';
6
+ describe('Standalone Link', () => {
7
+ it('renders with href attribute', () => {
8
+ render(_jsx(StandaloneLink, { href: "#" }));
9
+ const component = screen.getByRole('link');
10
+ expect(component).toBeInTheDocument();
11
+ expect(component).toBeVisible();
12
+ expect(component).toHaveAttribute('href', '#');
13
+ });
14
+ it('renders a design system BEM class name', () => {
15
+ render(_jsx(StandaloneLink, { href: "#" }));
16
+ const component = screen.getByRole('link');
17
+ expect(component).toHaveClass('ams-standalone-link');
18
+ });
19
+ it('renders an extra class name', () => {
20
+ render(_jsx(StandaloneLink, { className: "extra", href: "#" }));
21
+ const component = screen.getByRole('link');
22
+ expect(component).toHaveClass('ams-standalone-link extra');
23
+ });
24
+ it('renders the class name for contrast color', () => {
25
+ render(_jsx(StandaloneLink, { color: "contrast", href: "#" }));
26
+ const component = screen.getByRole('link');
27
+ expect(component).toHaveClass('ams-standalone-link ams-standalone-link--contrast');
28
+ });
29
+ it('renders the class name for inverse color', () => {
30
+ render(_jsx(StandaloneLink, { color: "inverse", href: "#" }));
31
+ const component = screen.getByRole('link');
32
+ expect(component).toHaveClass('ams-standalone-link ams-standalone-link--inverse');
33
+ });
34
+ it('supports ForwardRef in React', () => {
35
+ const ref = createRef();
36
+ render(_jsx(StandaloneLink, { href: "#", ref: ref }));
37
+ const component = screen.getByRole('link');
38
+ expect(ref.current).toBe(component);
39
+ });
40
+ });
@@ -0,0 +1,2 @@
1
+ export { StandaloneLink } from './StandaloneLink';
2
+ export type { StandaloneLinkProps } from './StandaloneLink';
@@ -0,0 +1 @@
1
+ export { StandaloneLink } from './StandaloneLink';
@@ -51,7 +51,7 @@ describe('Switch', () => {
51
51
  const component = container.querySelector(':only-child');
52
52
  expect(component).toHaveClass('ams-switch');
53
53
  });
54
- it('renders an additional class name', () => {
54
+ it('renders an extra class name', () => {
55
55
  const { container } = render(_jsx(Switch, { className: "extra" }));
56
56
  const component = container.querySelector(':only-child');
57
57
  expect(component).toHaveClass('ams-switch extra');
@@ -15,7 +15,7 @@ describe('Table', () => {
15
15
  const component = screen.getByRole('table');
16
16
  expect(component).toHaveClass('ams-table__table');
17
17
  });
18
- it('renders an additional class name', () => {
18
+ it('renders an extra class name', () => {
19
19
  render(_jsx(Table, { className: "extra" }));
20
20
  const component = screen.getByRole('table');
21
21
  expect(component).toHaveClass('ams-table__table extra');
@@ -16,7 +16,7 @@ describe('Table body', () => {
16
16
  const component = screen.getByRole('rowgroup');
17
17
  expect(component).toHaveClass('ams-table__body');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(Table, { children: _jsx(TableBody, { className: "extra" }) }));
21
21
  const component = screen.getByRole('rowgroup');
22
22
  expect(component).toHaveClass('ams-table__body extra');
@@ -21,7 +21,7 @@ describe('Table caption', () => {
21
21
  const caption = component?.querySelector(':only-child');
22
22
  expect(caption).toHaveClass('ams-table__caption');
23
23
  });
24
- it('renders an additional class name', () => {
24
+ it('renders an extra class name', () => {
25
25
  render(_jsx(Table, { children: _jsx(TableCaption, { className: "extra", children: "Caption" }) }));
26
26
  const component = screen.getByRole('table', {
27
27
  name: 'Caption',
@@ -18,7 +18,7 @@ describe('Table cell', () => {
18
18
  const component = screen.getByRole('cell');
19
19
  expect(component).toHaveClass('ams-table__cell');
20
20
  });
21
- it('renders an additional class name', () => {
21
+ it('renders an extra class name', () => {
22
22
  render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { children: _jsx(TableCell, { className: "extra", children: "Data" }) }) }) }));
23
23
  const component = screen.getByRole('cell');
24
24
  expect(component).toHaveClass('ams-table__cell extra');
@@ -16,7 +16,7 @@ describe('Table footer', () => {
16
16
  const component = screen.getByRole('rowgroup');
17
17
  expect(component).toHaveClass('ams-table__footer');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(Table, { children: _jsx(TableFooter, { className: "extra" }) }));
21
21
  const component = screen.getByRole('rowgroup');
22
22
  expect(component).toHaveClass('ams-table__footer extra');
@@ -16,7 +16,7 @@ describe('Table header', () => {
16
16
  const component = screen.getByRole('rowgroup');
17
17
  expect(component).toHaveClass('ams-table__header');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(Table, { children: _jsx(TableHeader, { className: "extra" }) }));
21
21
  const component = screen.getByRole('rowgroup');
22
22
  expect(component).toHaveClass('ams-table__header extra');
@@ -24,7 +24,7 @@ describe('Table header cell', () => {
24
24
  const component = screen.getByRole('columnheader');
25
25
  expect(component).toHaveClass('ams-table__header-cell');
26
26
  });
27
- it('renders an additional class name', () => {
27
+ it('renders an extra class name', () => {
28
28
  render(_jsx(Table, { children: _jsx(TableHeader, { children: _jsx(TableRow, { children: _jsx(TableHeaderCell, { className: "extra", children: "Data" }) }) }) }));
29
29
  const component = screen.getByRole('columnheader');
30
30
  expect(component).toHaveClass('ams-table__header-cell extra');
@@ -17,7 +17,7 @@ describe('Table row', () => {
17
17
  const component = screen.getByRole('row');
18
18
  expect(component).toHaveClass('ams-table__row');
19
19
  });
20
- it('renders an additional class name', () => {
20
+ it('renders an extra class name', () => {
21
21
  render(_jsx(Table, { children: _jsx(TableBody, { children: _jsx(TableRow, { className: "extra" }) }) }));
22
22
  const component = screen.getByRole('row');
23
23
  expect(component).toHaveClass('ams-table__row extra');
@@ -26,7 +26,7 @@ describe('Table of contents', () => {
26
26
  const component = container.querySelector(':only-child');
27
27
  expect(component).toHaveClass('ams-table-of-contents');
28
28
  });
29
- it('renders an additional class name', () => {
29
+ it('renders an extra class name', () => {
30
30
  const { container } = render(_jsx(TableOfContents, { className: "extra" }));
31
31
  const component = container.querySelector(':only-child');
32
32
  expect(component).toHaveClass('ams-table-of-contents extra');
@@ -16,7 +16,7 @@ describe('Table of Contents link', () => {
16
16
  const component = screen.getByRole('link');
17
17
  expect(component).toHaveClass('ams-table-of-contents__link');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(TableOfContents.Link, { className: "extra", href: "#", label: "Test" }));
21
21
  const component = screen.getByRole('link');
22
22
  expect(component).toHaveClass('ams-table-of-contents__link extra');
@@ -14,7 +14,7 @@ describe('Table of Contents list', () => {
14
14
  const component = screen.getByRole('list');
15
15
  expect(component).toHaveClass('ams-table-of-contents__list');
16
16
  });
17
- it('renders an additional class name', () => {
17
+ it('renders an extra class name', () => {
18
18
  render(_jsx(TableOfContents.List, { className: "extra" }));
19
19
  const component = screen.getByRole('list');
20
20
  expect(component).toHaveClass('ams-table-of-contents__list extra');
@@ -4,19 +4,19 @@
4
4
  */
5
5
  import type { HTMLAttributes, PropsWithChildren } from 'react';
6
6
  export type TabsProps = {
7
- /** The identifier of the initially active tab. Corresponds to its `tab` value. */
7
+ /** The identifier of the initially active Tab. Corresponds to its Panel `id` value. */
8
8
  activeTab?: string;
9
- onTabChange?: (tabId: string) => void;
9
+ onTabChange?: (panelId: string) => void;
10
10
  } & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
11
11
  export declare const Tabs: import("react").ForwardRefExoticComponent<{
12
- /** The identifier of the initially active tab. Corresponds to its `tab` value. */
12
+ /** The identifier of the initially active Tab. Corresponds to its Panel `id` value. */
13
13
  activeTab?: string;
14
- onTabChange?: (tabId: string) => void;
14
+ onTabChange?: (panelId: string) => void;
15
15
  } & HTMLAttributes<HTMLDivElement> & {
16
16
  children?: import("react").ReactNode | undefined;
17
17
  } & import("react").RefAttributes<HTMLDivElement>> & {
18
18
  Button: import("react").ForwardRefExoticComponent<{
19
- tab: string;
19
+ 'aria-controls': string;
20
20
  } & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
21
21
  children?: import("react").ReactNode | undefined;
22
22
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -24,7 +24,7 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<{
24
24
  children?: import("react").ReactNode | undefined;
25
25
  } & import("react").RefAttributes<HTMLDivElement>>;
26
26
  Panel: import("react").ForwardRefExoticComponent<{
27
- tab: string;
27
+ id: string;
28
28
  } & HTMLAttributes<HTMLDivElement> & {
29
29
  children?: import("react").ReactNode | undefined;
30
30
  } & import("react").RefAttributes<HTMLDivElement>>;
package/dist/Tabs/Tabs.js CHANGED
@@ -4,13 +4,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  * Copyright Gemeente Amsterdam
5
5
  */
6
6
  import clsx from 'clsx';
7
- import { forwardRef, useEffect, useId, useMemo, useState } from 'react';
7
+ import { forwardRef, useEffect, useMemo, useState } from 'react';
8
8
  import { TabsButton } from './TabsButton';
9
9
  import { TabsContext } from './TabsContext';
10
10
  import { TabsList } from './TabsList';
11
11
  import { TabsPanel } from './TabsPanel';
12
12
  const TabsRoot = forwardRef(({ activeTab, children, className, onTabChange, ...restProps }, ref) => {
13
- const tabsId = useId();
14
13
  const [activeTabId, setActiveTabId] = useState();
15
14
  const allTabIds = useMemo(() => {
16
15
  if (!Array.isArray(children))
@@ -22,11 +21,11 @@ const TabsRoot = forwardRef(({ activeTab, children, className, onTabChange, ...r
22
21
  // TabsList can have 0, 1, or more children
23
22
  // If there is only 1 child, it will be an object
24
23
  if (tabsListChildren.props) {
25
- return [tabsListChildren.props.tab];
24
+ return [tabsListChildren.props['aria-controls']];
26
25
  }
27
26
  // If there is more than 1 child, it will be an array
28
27
  if (Array.isArray(tabsListChildren)) {
29
- return tabsListChildren.map((child) => child.props.tab);
28
+ return tabsListChildren.map((child) => child.props['aria-controls']);
30
29
  }
31
30
  // If there are no children, return an empty array
32
31
  return [];
@@ -47,7 +46,7 @@ const TabsRoot = forwardRef(({ activeTab, children, className, onTabChange, ...r
47
46
  setActiveTabId(tab);
48
47
  onTabChange?.(tab);
49
48
  };
50
- return (_jsx(TabsContext.Provider, { value: { activeTabId, tabsId, updateTab }, children: _jsx("div", { ...restProps, className: clsx('ams-tabs', className), ref: ref, children: children }) }));
49
+ return (_jsx(TabsContext.Provider, { value: { activeTabId, updateTab }, children: _jsx("div", { ...restProps, className: clsx('ams-tabs', className), ref: ref, children: children }) }));
51
50
  });
52
51
  TabsRoot.displayName = 'Tabs';
53
52
  export const Tabs = Object.assign(TabsRoot, {
@@ -16,7 +16,7 @@ describe('Tabs', () => {
16
16
  const component = container.querySelector(':only-child');
17
17
  expect(component).toHaveClass('ams-tabs');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  const { container } = render(_jsx(Tabs, { className: "extra" }));
21
21
  const component = container.querySelector(':only-child');
22
22
  expect(component).toHaveClass('ams-tabs extra');
@@ -28,14 +28,14 @@ describe('Tabs', () => {
28
28
  expect(ref.current).toBe(component);
29
29
  });
30
30
  it('supports children', () => {
31
- render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" })] }));
31
+ render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" })] }));
32
32
  expect(screen.getByRole('tablist')).toBeInTheDocument();
33
33
  expect(screen.getByRole('tab', { selected: true })).toBeInTheDocument();
34
34
  expect(screen.getByRole('tabpanel')).toBeInTheDocument();
35
35
  });
36
36
  it('should select a tab when clicked', async () => {
37
37
  const user = userEvent.setup();
38
- render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" })] }));
38
+ render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" })] }));
39
39
  const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
40
40
  const tabTwo = screen.getByRole('tab', { name: 'Tab 2' });
41
41
  expect(tabOne).toHaveAttribute('aria-selected', 'true');
@@ -55,13 +55,13 @@ describe('Tabs', () => {
55
55
  it('calls onTabChange with the newly activated tab', async () => {
56
56
  const user = userEvent.setup();
57
57
  const onTabChange = jest.fn();
58
- render(_jsx(Tabs, { onTabChange: onTabChange, children: _jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one", children: "Tab 1" }) }) }));
58
+ render(_jsx(Tabs, { onTabChange: onTabChange, children: _jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }) }) }));
59
59
  const button = screen.getByRole('tab', { name: 'Tab 1' });
60
60
  await user.click(button);
61
61
  expect(onTabChange).toHaveBeenCalledWith('one');
62
62
  });
63
63
  it('should be able to set the initially active tab', () => {
64
- render(_jsxs(Tabs, { activeTab: "three", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" }), _jsx(Tabs.Button, { tab: "three", children: "Tab 3" }), _jsx(Tabs.Button, { tab: "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" }), _jsx(Tabs.Panel, { tab: "three", children: "Content 3" }), _jsx(Tabs.Panel, { tab: "four", children: "Content 4" })] }));
64
+ render(_jsxs(Tabs, { activeTab: "three", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" }), _jsx(Tabs.Button, { "aria-controls": "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" }), _jsx(Tabs.Panel, { id: "three", children: "Content 3" }), _jsx(Tabs.Panel, { id: "four", children: "Content 4" })] }));
65
65
  const tabOne = screen.getByRole('tab', { name: 'Tab 1' });
66
66
  const tabThree = screen.getByRole('tab', { name: 'Tab 3' });
67
67
  expect(tabOne).toHaveAttribute('aria-selected', 'false');
@@ -73,7 +73,7 @@ describe('Tabs', () => {
73
73
  it('should set the first tab as the initially active tab when the supplied active tab does not exist', async () => {
74
74
  // Disable console.warn for this test, to prevent it from cluttering the test output
75
75
  jest.spyOn(console, 'warn').mockImplementation(() => { });
76
- render(_jsxs(Tabs, { activeTab: "unknown", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { tab: "one", children: "Tab 1" }), _jsx(Tabs.Button, { tab: "two", children: "Tab 2" }), _jsx(Tabs.Button, { tab: "three", children: "Tab 3" }), _jsx(Tabs.Button, { tab: "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { tab: "one", children: "Content 1" }), _jsx(Tabs.Panel, { tab: "two", children: "Content 2" }), _jsx(Tabs.Panel, { tab: "three", children: "Content 3" }), _jsx(Tabs.Panel, { tab: "four", children: "Content 4" })] }));
76
+ render(_jsxs(Tabs, { activeTab: "unknown", children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" }), _jsx(Tabs.Button, { "aria-controls": "four", children: "Tab 4" })] }), _jsx(Tabs.Panel, { id: "one", children: "Content 1" }), _jsx(Tabs.Panel, { id: "two", children: "Content 2" }), _jsx(Tabs.Panel, { id: "three", children: "Content 3" }), _jsx(Tabs.Panel, { id: "four", children: "Content 4" })] }));
77
77
  const firstTab = screen.getByRole('tab', { name: 'Tab 1' });
78
78
  const lastTab = screen.getByRole('tab', { name: 'Tab 4' });
79
79
  expect(firstTab).toHaveAttribute('aria-selected', 'true');
@@ -82,4 +82,19 @@ describe('Tabs', () => {
82
82
  expect(lastTab).toHaveAttribute('tabindex', '-1');
83
83
  expect(screen.getByRole('tabpanel')).toHaveTextContent('Content 1');
84
84
  });
85
+ it('sets focus on Tabs buttons when using arrow keys', async () => {
86
+ const user = userEvent.setup();
87
+ render(_jsxs(Tabs, { children: [_jsxs(Tabs.List, { children: [_jsx(Tabs.Button, { "aria-controls": "one", children: "Tab 1" }), _jsx(Tabs.Button, { "aria-controls": "two", children: "Tab 2" }), _jsx(Tabs.Button, { "aria-controls": "three", children: "Tab 3" })] }), _jsx(Tabs.Panel, { id: "one" }), _jsx(Tabs.Panel, { id: "two" }), _jsx(Tabs.Panel, { id: "three" })] }));
88
+ const firstButton = screen.getByRole('tab', { name: 'Tab 1' });
89
+ const thirdButton = screen.getByRole('tab', { name: 'Tab 3' });
90
+ await user.click(firstButton);
91
+ expect(firstButton).toHaveFocus();
92
+ // Click the right arrow key twice
93
+ await user.keyboard('{ArrowRight}');
94
+ await user.keyboard('{ArrowRight}');
95
+ expect(thirdButton).toHaveFocus();
96
+ expect(firstButton).not.toHaveFocus();
97
+ await user.keyboard('{ArrowRight}');
98
+ expect(firstButton).toHaveFocus();
99
+ });
85
100
  });
@@ -4,12 +4,12 @@
4
4
  */
5
5
  import type { ButtonHTMLAttributes, PropsWithChildren } from 'react';
6
6
  export type TabsButtonProps = {
7
- /** An identifier. */
8
- tab: string;
7
+ /** The identifier of the corresponding tab panel. */
8
+ 'aria-controls': string;
9
9
  } & PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>>;
10
10
  export declare const TabsButton: import("react").ForwardRefExoticComponent<{
11
- /** An identifier. */
12
- tab: string;
11
+ /** The identifier of the corresponding tab panel. */
12
+ 'aria-controls': string;
13
13
  } & ButtonHTMLAttributes<HTMLButtonElement> & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -6,14 +6,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import clsx from 'clsx';
7
7
  import { forwardRef, startTransition, useContext } from 'react';
8
8
  import { TabsContext } from './TabsContext';
9
- export const TabsButton = forwardRef(({ children, className, onClick, tab, ...restProps }, ref) => {
10
- const { activeTabId, tabsId, updateTab } = useContext(TabsContext);
9
+ export const TabsButton = forwardRef(({ 'aria-controls': ariaControls, children, className, onClick, ...restProps }, ref) => {
10
+ const { activeTabId, updateTab } = useContext(TabsContext);
11
11
  const handleClick = (event) => {
12
12
  onClick?.(event);
13
13
  startTransition(() => {
14
- updateTab(tab);
14
+ updateTab(ariaControls);
15
15
  });
16
16
  };
17
- return (_jsxs("button", { ...restProps, "aria-controls": `${tabsId}-panel-${tab}`, "aria-selected": activeTabId === tab, className: clsx('ams-tabs__button', className), id: `${tabsId}-tab-${tab}`, onClick: handleClick, ref: ref, role: "tab", tabIndex: activeTabId === tab ? 0 : -1, children: [_jsx("span", { "aria-hidden": "true", className: "ams-tabs__button-label-hidden", children: children }), _jsx("span", { className: "ams-tabs__button-label", children: children })] }));
17
+ return (_jsxs("button", { ...restProps, "aria-controls": ariaControls, "aria-selected": activeTabId === ariaControls, className: clsx('ams-tabs__button', className), id: `button-${ariaControls}`, onClick: handleClick, ref: ref, role: "tab", tabIndex: activeTabId === ariaControls ? 0 : -1, type: "button", children: [_jsx("span", { "aria-hidden": "true", className: "ams-tabs__button-label-hidden", children: children }), _jsx("span", { className: "ams-tabs__button-label", children: children })] }));
18
18
  });
19
19
  TabsButton.displayName = 'Tabs.Button';
@@ -5,38 +5,38 @@ import { TabsButton } from './TabsButton';
5
5
  import '@testing-library/jest-dom';
6
6
  describe('Tabs button', () => {
7
7
  it('renders', () => {
8
- render(_jsx(TabsButton, { tab: "one" }));
8
+ render(_jsx(TabsButton, { "aria-controls": "one" }));
9
9
  const component = screen.getByRole('tab');
10
10
  expect(component).toBeInTheDocument();
11
11
  });
12
12
  it('renders a design system BEM class name', () => {
13
- render(_jsx(TabsButton, { tab: "one" }));
13
+ render(_jsx(TabsButton, { "aria-controls": "one" }));
14
14
  const component = screen.getByRole('tab');
15
15
  expect(component).toHaveClass('ams-tabs__button');
16
16
  });
17
- it('renders an additional class name', () => {
18
- render(_jsx(TabsButton, { className: "extra", tab: "one" }));
17
+ it('renders an extra class name', () => {
18
+ render(_jsx(TabsButton, { "aria-controls": "one", className: "extra" }));
19
19
  const component = screen.getByRole('tab');
20
20
  expect(component).toHaveClass('ams-tabs__button extra');
21
21
  });
22
22
  it('renders a label', () => {
23
- render(_jsx(TabsButton, { tab: "one", children: "Label" }));
23
+ render(_jsx(TabsButton, { "aria-controls": "one", children: "Label" }));
24
24
  const component = screen.getByRole('tab', { name: 'Label' });
25
25
  expect(component).toBeInTheDocument();
26
26
  });
27
27
  it('renders the correct id based on the tabs prop', () => {
28
- const { container } = render(_jsx(TabsButton, { tab: "one" }));
29
- const component = container.querySelector('#-tab-one');
28
+ const { container } = render(_jsx(TabsButton, { "aria-controls": "one" }));
29
+ const component = container.querySelector('#button-one');
30
30
  expect(component).toBeInTheDocument();
31
31
  });
32
32
  it('should associate the button with the correct tab', () => {
33
- render(_jsx(TabsButton, { tab: "one" }));
33
+ render(_jsx(TabsButton, { "aria-controls": "one" }));
34
34
  const component = screen.getByRole('tab');
35
- expect(component).toHaveAttribute('aria-controls', '-panel-one');
35
+ expect(component).toHaveAttribute('aria-controls', 'one');
36
36
  });
37
37
  it('supports ForwardRef in React', () => {
38
38
  const ref = createRef();
39
- render(_jsx(TabsButton, { ref: ref, tab: "one" }));
39
+ render(_jsx(TabsButton, { "aria-controls": "one", ref: ref }));
40
40
  const component = screen.getByRole('tab');
41
41
  expect(ref.current).toBe(component);
42
42
  });
@@ -3,14 +3,9 @@
3
3
  * Copyright Gemeente Amsterdam
4
4
  */
5
5
  export type TabsContextValue = {
6
- /** The identifier of the active tab. */
6
+ /** The identifier of the active Tab. */
7
7
  activeTabId?: string;
8
- /**
9
- * The generated identifier for the entire Tabs component.
10
- * This lets you have several Tabs components, possibly with the same tabs, on one page.
11
- */
12
- tabsId: string;
13
- /** A function to update the active tab. */
8
+ /** A function to update the active Tab. */
14
9
  updateTab: (tab: string) => void;
15
10
  };
16
11
  export declare const TabsContext: import("react").Context<TabsContextValue>;
@@ -5,7 +5,6 @@
5
5
  import { createContext } from 'react';
6
6
  const defaultValues = {
7
7
  activeTabId: undefined,
8
- tabsId: '',
9
8
  updateTab: () => { },
10
9
  };
11
10
  export const TabsContext = createContext(defaultValues);
@@ -11,7 +11,7 @@ export const TabsList = forwardRef(({ children, className, ...restProps }, ref)
11
11
  // Use a passed ref if it's there, otherwise use innerRef
12
12
  useImperativeHandle(ref, () => innerRef.current);
13
13
  const { keyDown } = useKeyboardFocus(innerRef, {
14
- focusableElements: ['button[role="tab"]'],
14
+ focusableElements: ['.ams-tabs__button:not([disabled])'],
15
15
  horizontally: true,
16
16
  rotating: true,
17
17
  });
@@ -14,7 +14,7 @@ describe('Tabs list', () => {
14
14
  const component = screen.getByRole('tablist');
15
15
  expect(component).toHaveClass('ams-tabs__list');
16
16
  });
17
- it('renders an additional class name', () => {
17
+ it('renders an extra class name', () => {
18
18
  render(_jsx(TabsList, { className: "extra" }));
19
19
  const component = screen.getByRole('tablist');
20
20
  expect(component).toHaveClass('ams-tabs__list extra');
@@ -4,12 +4,12 @@
4
4
  */
5
5
  import type { HTMLAttributes, PropsWithChildren } from 'react';
6
6
  export type TabsPanelProps = {
7
- /** The identifier of the corresponding Tab. */
8
- tab: string;
7
+ /** The identifier of the Tab Panel. */
8
+ id: string;
9
9
  } & PropsWithChildren<HTMLAttributes<HTMLDivElement>>;
10
10
  export declare const TabsPanel: import("react").ForwardRefExoticComponent<{
11
- /** The identifier of the corresponding Tab. */
12
- tab: string;
11
+ /** The identifier of the Tab Panel. */
12
+ id: string;
13
13
  } & HTMLAttributes<HTMLDivElement> & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -6,11 +6,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import clsx from 'clsx';
7
7
  import { forwardRef, useContext } from 'react';
8
8
  import { TabsContext } from './TabsContext';
9
- export const TabsPanel = forwardRef(({ children, className, tab, ...restProps }, ref) => {
10
- const { activeTabId, tabsId } = useContext(TabsContext);
11
- if (tab !== activeTabId) {
9
+ export const TabsPanel = forwardRef(({ children, className, id, ...restProps }, ref) => {
10
+ const { activeTabId } = useContext(TabsContext);
11
+ if (id !== activeTabId) {
12
12
  return null;
13
13
  }
14
- return (_jsx("div", { ...restProps, "aria-labelledby": `${tabsId}-tab-${tab}`, className: clsx('ams-tabs__panel', className), id: `${tabsId}-panel-${tab}`, ref: ref, role: "tabpanel", tabIndex: 0, children: children }));
14
+ return (_jsx("div", { ...restProps, "aria-labelledby": `button-${id}`, className: clsx('ams-tabs__panel', className), id: id, ref: ref, role: "tabpanel", tabIndex: 0, children: children }));
15
15
  });
16
16
  TabsPanel.displayName = 'Tabs.Panel';
@@ -5,35 +5,33 @@ import { Tabs } from './Tabs';
5
5
  import '@testing-library/jest-dom';
6
6
  describe('Tabs Panel', () => {
7
7
  it('renders', () => {
8
- render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
8
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
9
9
  const component = screen.getByRole('tabpanel');
10
10
  expect(component).toBeInTheDocument();
11
11
  });
12
12
  it('renders a design system BEM class name', () => {
13
- render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
13
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
14
14
  const component = screen.getByRole('tabpanel');
15
15
  expect(component).toHaveClass('ams-tabs__panel');
16
16
  });
17
- it('renders an additional class name', () => {
18
- render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { className: "extra", tab: "one" })] }));
17
+ it('renders an extra class name', () => {
18
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { className: "extra", id: "one" })] }));
19
19
  const component = screen.getByRole('tabpanel');
20
20
  expect(component).toHaveClass('ams-tabs__panel extra');
21
21
  });
22
22
  it('renders the correct id based on the tabs prop', () => {
23
- const { container } = render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
24
- // The start of the id is generated by useId, so we only check the end of the id
25
- const component = container.querySelector('[id$="panel-one"]');
26
- expect(component).toBeInTheDocument();
23
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
24
+ const component = screen.getByRole('tabpanel');
25
+ expect(component).toHaveAttribute('id', 'one');
27
26
  });
28
27
  it('should associate the tab with the correct button', () => {
29
- render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { tab: "one" })] }));
28
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one" })] }));
30
29
  const component = screen.getByRole('tabpanel');
31
- // The start of the attribute value is generated by useId, so we only check the end of the value
32
- expect(component).toHaveAttribute('aria-labelledby', expect.stringMatching(/-tab-one$/));
30
+ expect(component).toHaveAttribute('aria-labelledby', 'button-one');
33
31
  });
34
32
  it('supports ForwardRef in React', () => {
35
33
  const ref = createRef();
36
- render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { tab: "one" }) }), _jsx(Tabs.Panel, { ref: ref, tab: "one" })] }));
34
+ render(_jsxs(Tabs, { children: [_jsx(Tabs.List, { children: _jsx(Tabs.Button, { "aria-controls": "one" }) }), _jsx(Tabs.Panel, { id: "one", ref: ref })] }));
37
35
  const component = screen.getByRole('tabpanel');
38
36
  expect(ref.current).toBe(component);
39
37
  });
@@ -16,7 +16,7 @@ describe('Text area', () => {
16
16
  const component = screen.getByRole('textbox');
17
17
  expect(component).toHaveClass('ams-text-area');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(TextArea, { className: "extra" }));
21
21
  const component = screen.getByRole('textbox');
22
22
  expect(component).toHaveClass('ams-text-area extra');
@@ -16,11 +16,10 @@ describe('Text input', () => {
16
16
  const component = screen.getByRole('textbox');
17
17
  expect(component).toHaveClass('ams-text-input');
18
18
  });
19
- it('renders an additional class name', () => {
19
+ it('renders an extra class name', () => {
20
20
  render(_jsx(TextInput, { className: "extra" }));
21
21
  const component = screen.getByRole('textbox');
22
- expect(component).toHaveClass('extra');
23
- expect(component).toHaveClass('ams-text-input');
22
+ expect(component).toHaveClass('ams-text-input extra');
24
23
  });
25
24
  it('should be working in a controlled state', async () => {
26
25
  function ControlledComponent() {
@@ -15,7 +15,7 @@ describe('Time input', () => {
15
15
  const component = container.querySelector(':only-child');
16
16
  expect(component).toHaveClass('ams-time-input');
17
17
  });
18
- it('renders an additional class name', () => {
18
+ it('renders an extra class name', () => {
19
19
  const { container } = render(_jsx(TimeInput, { className: "extra" }));
20
20
  const component = container.querySelector(':only-child');
21
21
  expect(component).toHaveClass('ams-time-input extra');
@@ -24,7 +24,7 @@ describe('Unordered list', () => {
24
24
  const component = screen.getByRole('list');
25
25
  expect(component).toHaveClass('ams-unordered-list--inverse');
26
26
  });
27
- it('renders an additional class name', () => {
27
+ it('renders an extra class name', () => {
28
28
  render(_jsx(UnorderedList, { className: "extra" }));
29
29
  const component = screen.getByRole('list');
30
30
  expect(component).toHaveClass('ams-unordered-list extra');
@@ -14,7 +14,7 @@ describe('Ordered list item', () => {
14
14
  const component = screen.getByRole('listitem');
15
15
  expect(component).toHaveClass('ams-unordered-list__item');
16
16
  });
17
- it('renders an additional class name', () => {
17
+ it('renders an extra class name', () => {
18
18
  render(_jsx(UnorderedListItem, { className: "extra" }));
19
19
  const component = screen.getByRole('listitem');
20
20
  expect(component).toHaveClass('ams-unordered-list__item extra');