@nationalarchives/frontend 0.1.65 → 0.2.1

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 (237) hide show
  1. package/config/.eslintrc.js +1 -1
  2. package/config/.htmlvalidate.json +12 -5
  3. package/config/stylelint.config.js +1 -0
  4. package/nationalarchives/all.css +1 -1
  5. package/nationalarchives/all.css.map +1 -1
  6. package/nationalarchives/all.js +1 -1
  7. package/nationalarchives/all.js.map +1 -1
  8. package/nationalarchives/all.mjs +0 -18
  9. package/nationalarchives/analytics.js +1 -1
  10. package/nationalarchives/analytics.js.map +1 -1
  11. package/nationalarchives/analytics.mjs +1 -1
  12. package/nationalarchives/components/_forms.scss +9 -0
  13. package/nationalarchives/components/_index.scss +2 -35
  14. package/nationalarchives/components/_presentation.scss +23 -0
  15. package/nationalarchives/components/accordion/accordion.css +1 -1
  16. package/nationalarchives/components/accordion/accordion.css.map +1 -1
  17. package/nationalarchives/components/accordion/accordion.js +1 -1
  18. package/nationalarchives/components/accordion/accordion.js.map +1 -1
  19. package/nationalarchives/components/accordion/accordion.mjs +1 -4
  20. package/nationalarchives/components/accordion/accordion.scss +4 -0
  21. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  22. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
  23. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
  24. package/nationalarchives/components/button/button.css +1 -1
  25. package/nationalarchives/components/button/button.css.map +1 -1
  26. package/nationalarchives/components/button/button.scss +9 -9
  27. package/nationalarchives/components/card/card.css +1 -1
  28. package/nationalarchives/components/card/card.css.map +1 -1
  29. package/nationalarchives/components/card/card.scss +15 -0
  30. package/nationalarchives/components/card/fixtures.json +74 -26
  31. package/nationalarchives/components/card/macro-options.json +7 -7
  32. package/nationalarchives/components/card/template.njk +7 -4
  33. package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
  34. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  35. package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
  36. package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
  37. package/nationalarchives/components/checkboxes/macro-options.json +6 -0
  38. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  39. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  40. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  41. package/nationalarchives/components/date-input/date-input.css +1 -1
  42. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  43. package/nationalarchives/components/date-input/date-input.scss +2 -2
  44. package/nationalarchives/components/date-input/fixtures.json +5 -5
  45. package/nationalarchives/components/date-input/template.njk +1 -1
  46. package/nationalarchives/components/date-search/date-search.css +1 -1
  47. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  48. package/nationalarchives/components/date-search/date-search.scss +2 -2
  49. package/nationalarchives/components/details/details.css.map +1 -1
  50. package/nationalarchives/components/details/template.njk +3 -1
  51. package/nationalarchives/components/error-summary/error-summary.css +1 -1
  52. package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
  53. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  54. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  55. package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
  56. package/nationalarchives/components/error-summary/error-summary.scss +3 -4
  57. package/nationalarchives/components/files-list/_index.scss +1 -0
  58. package/nationalarchives/components/files-list/files-list.css +1 -0
  59. package/nationalarchives/components/files-list/files-list.css.map +1 -0
  60. package/nationalarchives/components/{files/files.scss → files-list/files-list.scss} +2 -7
  61. package/nationalarchives/components/files-list/fixtures.json +74 -0
  62. package/nationalarchives/components/{files → files-list}/macro-options.json +6 -0
  63. package/nationalarchives/components/files-list/macro.njk +3 -0
  64. package/nationalarchives/components/files-list/template.njk +33 -0
  65. package/nationalarchives/components/footer/footer.css.map +1 -1
  66. package/nationalarchives/components/footer/footer.js +1 -1
  67. package/nationalarchives/components/footer/footer.js.map +1 -1
  68. package/nationalarchives/components/gallery/fixtures.json +1 -1
  69. package/nationalarchives/components/gallery/gallery.css +1 -1
  70. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  71. package/nationalarchives/components/gallery/gallery.js +1 -1
  72. package/nationalarchives/components/gallery/gallery.js.map +1 -1
  73. package/nationalarchives/components/gallery/gallery.scss +36 -29
  74. package/nationalarchives/components/gallery/template.njk +10 -8
  75. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  76. package/nationalarchives/components/global-header/global-header.js +1 -1
  77. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  78. package/nationalarchives/components/header/header.css.map +1 -1
  79. package/nationalarchives/components/header/header.js +1 -1
  80. package/nationalarchives/components/header/header.js.map +1 -1
  81. package/nationalarchives/components/hero/hero.css +1 -1
  82. package/nationalarchives/components/hero/hero.css.map +1 -1
  83. package/nationalarchives/components/hero/hero.scss +0 -24
  84. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  85. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  86. package/nationalarchives/components/index-grid/index-grid.scss +1 -1
  87. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  88. package/nationalarchives/components/picture/picture.css.map +1 -1
  89. package/nationalarchives/components/picture/picture.js +1 -1
  90. package/nationalarchives/components/picture/picture.js.map +1 -1
  91. package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
  92. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
  93. package/nationalarchives/components/radios/radios.css +1 -1
  94. package/nationalarchives/components/radios/radios.css.map +1 -1
  95. package/nationalarchives/components/radios/radios.scss +1 -1
  96. package/nationalarchives/components/records-list/_index.scss +1 -0
  97. package/nationalarchives/components/records-list/fixtures.json +42 -0
  98. package/nationalarchives/components/records-list/macro.njk +3 -0
  99. package/nationalarchives/components/records-list/records-list.css +1 -0
  100. package/nationalarchives/components/records-list/records-list.css.map +1 -0
  101. package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +1 -1
  102. package/nationalarchives/components/records-list/template.njk +21 -0
  103. package/nationalarchives/components/search-field/search-field.css +1 -1
  104. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  105. package/nationalarchives/components/search-field/search-field.scss +1 -1
  106. package/nationalarchives/components/select/select.css +1 -1
  107. package/nationalarchives/components/select/select.css.map +1 -1
  108. package/nationalarchives/components/select/select.scss +2 -2
  109. package/nationalarchives/components/sidebar/fixtures.json +12 -2
  110. package/nationalarchives/components/sidebar/sidebar.css +1 -1
  111. package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
  112. package/nationalarchives/components/sidebar/template.njk +9 -0
  113. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  114. package/nationalarchives/components/skip-link/skip-link.js +1 -1
  115. package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
  116. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  117. package/nationalarchives/components/tabs/tabs.js +1 -1
  118. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  119. package/nationalarchives/components/text-input/text-input.css +1 -1
  120. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  121. package/nationalarchives/components/text-input/text-input.scss +2 -2
  122. package/nationalarchives/components/textarea/textarea.css +1 -1
  123. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  124. package/nationalarchives/components/textarea/textarea.scss +2 -2
  125. package/nationalarchives/components/warning/warning.css +1 -1
  126. package/nationalarchives/components/warning/warning.css.map +1 -1
  127. package/nationalarchives/components/warning/warning.scss +1 -0
  128. package/nationalarchives/global-header-package.css +1 -1
  129. package/nationalarchives/global-header-package.css.map +1 -1
  130. package/nationalarchives/global-header-package.scss +1 -1
  131. package/nationalarchives/print.css +1 -1
  132. package/nationalarchives/print.css.map +1 -1
  133. package/nationalarchives/prototype-kit.css +1 -1
  134. package/nationalarchives/prototype-kit.css.map +1 -1
  135. package/nationalarchives/templates/fixtures.json +1 -1
  136. package/nationalarchives/tools/_colour.scss +28 -53
  137. package/nationalarchives/utilities/_columns.scss +1 -1
  138. package/nationalarchives/utilities/_index.scss +1 -0
  139. package/nationalarchives/utilities/_reset.scss +2 -8
  140. package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
  141. package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
  142. package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +6 -1
  143. package/nationalarchives/utilities/grid/macro.njk +3 -0
  144. package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +27 -9
  145. package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +2 -2
  146. package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +20 -8
  147. package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +30 -10
  148. package/nationalarchives/variables/_colour.scss +12 -5
  149. package/package.json +3 -3
  150. package/nationalarchives/components/accordion/accordion.stories.js +0 -432
  151. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
  152. package/nationalarchives/components/button/button-group.stories.js +0 -114
  153. package/nationalarchives/components/button/button.stories.js +0 -207
  154. package/nationalarchives/components/card/card.stories.js +0 -402
  155. package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
  156. package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
  157. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
  158. package/nationalarchives/components/date-input/date-input.stories.js +0 -119
  159. package/nationalarchives/components/date-search/date-search.stories.js +0 -124
  160. package/nationalarchives/components/details/details.stories.js +0 -33
  161. package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
  162. package/nationalarchives/components/featured-records/_index.scss +0 -1
  163. package/nationalarchives/components/featured-records/featured-records.css +0 -1
  164. package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
  165. package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
  166. package/nationalarchives/components/featured-records/fixtures.json +0 -42
  167. package/nationalarchives/components/featured-records/macro.njk +0 -3
  168. package/nationalarchives/components/featured-records/template.njk +0 -21
  169. package/nationalarchives/components/files/_index.scss +0 -1
  170. package/nationalarchives/components/files/files.css +0 -1
  171. package/nationalarchives/components/files/files.css.map +0 -1
  172. package/nationalarchives/components/files/files.stories.js +0 -59
  173. package/nationalarchives/components/files/fixtures.json +0 -71
  174. package/nationalarchives/components/files/macro.njk +0 -3
  175. package/nationalarchives/components/files/template.njk +0 -33
  176. package/nationalarchives/components/footer/footer.stories.js +0 -241
  177. package/nationalarchives/components/gallery/gallery.stories.js +0 -87
  178. package/nationalarchives/components/global-header/global-header.stories.js +0 -364
  179. package/nationalarchives/components/grid/_index.scss +0 -1
  180. package/nationalarchives/components/grid/grid.css +0 -1
  181. package/nationalarchives/components/grid/grid.css.map +0 -1
  182. package/nationalarchives/components/grid/grid.stories.js +0 -279
  183. package/nationalarchives/components/grid/macro.njk +0 -3
  184. package/nationalarchives/components/header/header.stories.js +0 -239
  185. package/nationalarchives/components/hero/hero.stories.js +0 -326
  186. package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
  187. package/nationalarchives/components/pagination/pagination.stories.js +0 -532
  188. package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
  189. package/nationalarchives/components/picture/picture.stories.js +0 -75
  190. package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
  191. package/nationalarchives/components/radios/radios.stories.js +0 -244
  192. package/nationalarchives/components/search-field/search-field.stories.js +0 -88
  193. package/nationalarchives/components/search-filters/_index.scss +0 -1
  194. package/nationalarchives/components/search-filters/fixtures.json +0 -16
  195. package/nationalarchives/components/search-filters/macro-options.json +0 -39
  196. package/nationalarchives/components/search-filters/macro.njk +0 -3
  197. package/nationalarchives/components/search-filters/search-filters.css +0 -1
  198. package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
  199. package/nationalarchives/components/search-filters/search-filters.js +0 -2
  200. package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
  201. package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
  202. package/nationalarchives/components/search-filters/search-filters.scss +0 -198
  203. package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
  204. package/nationalarchives/components/search-filters/template.njk +0 -108
  205. package/nationalarchives/components/select/select.stories.js +0 -197
  206. package/nationalarchives/components/sensitive-image/_index.scss +0 -1
  207. package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
  208. package/nationalarchives/components/sensitive-image/macro-options.json +0 -58
  209. package/nationalarchives/components/sensitive-image/macro.njk +0 -3
  210. package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
  211. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
  212. package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
  213. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
  214. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
  215. package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
  216. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
  217. package/nationalarchives/components/sensitive-image/template.njk +0 -11
  218. package/nationalarchives/components/sidebar/sidebar.stories.js +0 -227
  219. package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
  220. package/nationalarchives/components/tabs/tabs.stories.js +0 -300
  221. package/nationalarchives/components/text-input/text-input.stories.js +0 -188
  222. package/nationalarchives/components/textarea/textarea.stories.js +0 -130
  223. package/nationalarchives/components/warning/warning.stories.js +0 -39
  224. package/nationalarchives/stories/intro.mdx +0 -13
  225. package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
  226. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1513
  227. package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
  228. package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
  229. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
  230. package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
  231. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
  232. package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
  233. package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
  234. /package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
  235. /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
  236. /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
  237. /package/nationalarchives/{components → utilities}/grid/template.njk +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nationalarchives/frontend",
3
- "version": "0.1.65",
3
+ "version": "0.2.1",
4
4
  "description": "The National Archives frontend styles",
5
5
  "scripts": {
6
6
  "start": "storybook dev -p 6006",
@@ -56,7 +56,7 @@
56
56
  "@storybook/html": "^8.1.10",
57
57
  "@storybook/html-webpack5": "^8.1.10",
58
58
  "@storybook/test": "^8.1.10",
59
- "@storybook/test-runner": "^0.18.2",
59
+ "@storybook/test-runner": "^0.19.1",
60
60
  "axe-playwright": "^2.0.1",
61
61
  "babel-jest": "^29.7.0",
62
62
  "babel-loader": "^9.0.1",
@@ -66,7 +66,7 @@
66
66
  "diff": "^5.1.0",
67
67
  "eslint": "^8.52.0",
68
68
  "eslint-plugin-storybook": "^0.8.0",
69
- "glob": "^10.3.10",
69
+ "glob": "^11.0.0",
70
70
  "html-validate": "^8.18.2",
71
71
  "jest-environment-jsdom": "^29.7.0",
72
72
  "mdx-mermaid": "^2.0.0",
@@ -1,432 +0,0 @@
1
- import Accordion from "./template.njk";
2
- import macroOptions from "./macro-options.json";
3
- import { fireEvent, expect } from "@storybook/test";
4
-
5
- const argTypes = {
6
- itemHeadingLevel: { control: { type: "number", min: 1, max: 6 } },
7
- items: { control: "object" },
8
- id: { control: "text" },
9
- openMultipleItems: { control: "boolean" },
10
- classes: { control: "text" },
11
- attributes: { control: "object" },
12
- };
13
-
14
- Object.keys(argTypes).forEach((argType) => {
15
- argTypes[argType].description = macroOptions.find(
16
- (option) => option.name === argType,
17
- )?.description;
18
- });
19
-
20
- export default {
21
- title: "Components/Accordion",
22
- argTypes,
23
- };
24
-
25
- const Template = ({
26
- itemHeadingLevel,
27
- items,
28
- id,
29
- openMultipleItems,
30
- classes,
31
- attributes,
32
- }) =>
33
- Accordion({
34
- params: {
35
- itemHeadingLevel,
36
- items,
37
- id,
38
- openMultipleItems,
39
- classes,
40
- attributes,
41
- },
42
- });
43
-
44
- export const Standard = Template.bind({});
45
- Standard.args = {
46
- itemHeadingLevel: 2,
47
- items: [
48
- {
49
- title: "Alpha",
50
- text: "Content",
51
- },
52
- {
53
- title: "Beta",
54
- body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim. Donec bibendum est leo, sed dapibus mauris facilisis vitae.</p><p>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit mi vel rhoncus aliquam.</p><p>Pellentesque ultrices bibendum nibh, sit amet ornare turpis efficitur id. Aenean ullamcorper neque eget justo sagittis, rutrum ultrices urna varius. Mauris sodales a lorem at sodales.</p>",
55
- },
56
- {
57
- title: "Gamma",
58
- body: `<ul class="tna-ul">
59
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
60
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
61
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
62
- <li>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi.</li>
63
- </ul>`,
64
- },
65
- {
66
- title: "Delta",
67
- body: `<div class="tna-table-wrapper">
68
- <table class="tna-table">
69
- <caption class="tna-table__caption">
70
- Records added and removed between 2020 and 2022.
71
- </caption>
72
- <thead class="tna-table__head">
73
- <tr class="tna-table__row">
74
- <th class="tna-table__header" scope="col">Year</th>
75
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
76
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
77
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
78
- </tr>
79
- </thead>
80
- <tbody class="tna-table__body">
81
- <tr>
82
- <th class="tna-table__header" scope="row">2020</th>
83
- <td class="tna-table__cell">Rat</td>
84
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
85
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
86
- </tr>
87
- <tr>
88
- <th class="tna-table__header" scope="row">2021</th>
89
- <td class="tna-table__cell">Ox</td>
90
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
91
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
92
- </tr>
93
- <tr>
94
- <th class="tna-table__header" scope="row">2022</th>
95
- <td class="tna-table__cell">Tiger</td>
96
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
97
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
98
- </tr>
99
- </tbody>
100
- <tfoot class="tna-table__foot">
101
- <tr>
102
- <th class="tna-table__header" scope="row">Totals</th>
103
- <td class="tna-table__cell"></td>
104
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
105
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
106
- </tr>
107
- </tfoot>
108
- </table>
109
- </div>`,
110
- },
111
- ],
112
- id: "accordion-example-Standard",
113
- classes: "tna-accordion--demo",
114
- };
115
-
116
- export const OpenItems = Template.bind({});
117
- OpenItems.parameters = {
118
- chromatic: { disableSnapshot: true },
119
- };
120
- OpenItems.args = {
121
- itemHeadingLevel: 2,
122
- items: [
123
- {
124
- title: "Alpha",
125
- text: "Content",
126
- },
127
- {
128
- title: "Beta",
129
- body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim. Donec bibendum est leo, sed dapibus mauris facilisis vitae.</p><p>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit mi vel rhoncus aliquam.</p><p>Pellentesque ultrices bibendum nibh, sit amet ornare turpis efficitur id. Aenean ullamcorper neque eget justo sagittis, rutrum ultrices urna varius. Mauris sodales a lorem at sodales.</p>",
130
- },
131
- {
132
- title: "Gamma",
133
- body: `<ul class="tna-ul">
134
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
135
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
136
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
137
- <li>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi.</li>
138
- </ul>`,
139
- open: true,
140
- },
141
- {
142
- title: "Delta",
143
- body: `<div class="tna-table-wrapper">
144
- <table class="tna-table">
145
- <caption class="tna-table__caption">
146
- Records added and removed between 2020 and 2022.
147
- </caption>
148
- <thead class="tna-table__head">
149
- <tr class="tna-table__row">
150
- <th class="tna-table__header" scope="col">Year</th>
151
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
152
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
153
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
154
- </tr>
155
- </thead>
156
- <tbody class="tna-table__body">
157
- <tr>
158
- <th class="tna-table__header" scope="row">2020</th>
159
- <td class="tna-table__cell">Rat</td>
160
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
161
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
162
- </tr>
163
- <tr>
164
- <th class="tna-table__header" scope="row">2021</th>
165
- <td class="tna-table__cell">Ox</td>
166
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
167
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
168
- </tr>
169
- <tr>
170
- <th class="tna-table__header" scope="row">2022</th>
171
- <td class="tna-table__cell">Tiger</td>
172
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
173
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
174
- </tr>
175
- </tbody>
176
- <tfoot class="tna-table__foot">
177
- <tr>
178
- <th class="tna-table__header" scope="row">Totals</th>
179
- <td class="tna-table__cell"></td>
180
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
181
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
182
- </tr>
183
- </tfoot>
184
- </table>
185
- </div>`,
186
- },
187
- ],
188
- id: "accordion-example-OpenItems",
189
- classes: "tna-accordion--demo",
190
- };
191
-
192
- export const NotExclusive = Template.bind({});
193
- NotExclusive.parameters = {
194
- chromatic: { disableSnapshot: true },
195
- };
196
- NotExclusive.args = {
197
- itemHeadingLevel: 2,
198
- items: [
199
- {
200
- title: "Alpha",
201
- text: "Content",
202
- },
203
- {
204
- title: "Beta",
205
- body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim. Donec bibendum est leo, sed dapibus mauris facilisis vitae.</p><p>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit mi vel rhoncus aliquam.</p><p>Pellentesque ultrices bibendum nibh, sit amet ornare turpis efficitur id. Aenean ullamcorper neque eget justo sagittis, rutrum ultrices urna varius. Mauris sodales a lorem at sodales.</p>",
206
- },
207
- {
208
- title: "Gamma",
209
- body: `<ul class="tna-ul">
210
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
211
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
212
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
213
- <li>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi.</li>
214
- </ul>`,
215
- },
216
- {
217
- title: "Delta",
218
- body: `<div class="tna-table-wrapper">
219
- <table class="tna-table">
220
- <caption class="tna-table__caption">
221
- Records added and removed between 2020 and 2022.
222
- </caption>
223
- <thead class="tna-table__head">
224
- <tr class="tna-table__row">
225
- <th class="tna-table__header" scope="col">Year</th>
226
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
227
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
228
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
229
- </tr>
230
- </thead>
231
- <tbody class="tna-table__body">
232
- <tr>
233
- <th class="tna-table__header" scope="row">2020</th>
234
- <td class="tna-table__cell">Rat</td>
235
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
236
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
237
- </tr>
238
- <tr>
239
- <th class="tna-table__header" scope="row">2021</th>
240
- <td class="tna-table__cell">Ox</td>
241
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
242
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
243
- </tr>
244
- <tr>
245
- <th class="tna-table__header" scope="row">2022</th>
246
- <td class="tna-table__cell">Tiger</td>
247
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
248
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
249
- </tr>
250
- </tbody>
251
- <tfoot class="tna-table__foot">
252
- <tr>
253
- <th class="tna-table__header" scope="row">Totals</th>
254
- <td class="tna-table__cell"></td>
255
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
256
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
257
- </tr>
258
- </tfoot>
259
- </table>
260
- </div>`,
261
- },
262
- ],
263
- id: "accordion-example-NotExclusive",
264
- openMultipleItems: true,
265
- classes: "tna-accordion--demo",
266
- };
267
-
268
- export const Test = Template.bind({});
269
- Test.parameters = {
270
- chromatic: { disableSnapshot: true },
271
- };
272
- Test.args = {
273
- itemHeadingLevel: 2,
274
- items: [
275
- {
276
- title: "Alpha",
277
- text: "Content",
278
- },
279
- {
280
- title: "Beta",
281
- body: "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim. Donec bibendum est leo, sed dapibus mauris facilisis vitae.</p><p>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla blandit mi vel rhoncus aliquam.</p><p>Pellentesque ultrices bibendum nibh, sit amet ornare turpis efficitur id. Aenean ullamcorper neque eget justo sagittis, rutrum ultrices urna varius. Mauris sodales a lorem at sodales.</p>",
282
- },
283
- {
284
- title: "Gamma",
285
- body: `<ul class="tna-ul">
286
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
287
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
288
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
289
- <li>Quisque hendrerit condimentum nisl, non volutpat ex eleifend at. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Morbi id suscipit felis, sed tincidunt arcu. Etiam vel blandit diam, vitae commodo mi.</li>
290
- </ul>`,
291
- },
292
- {
293
- title: "Delta",
294
- body: `<div class="tna-table-wrapper">
295
- <table class="tna-table">
296
- <caption class="tna-table__caption">
297
- Records added and removed between 2020 and 2022.
298
- </caption>
299
- <thead class="tna-table__head">
300
- <tr class="tna-table__row">
301
- <th class="tna-table__header" scope="col">Year</th>
302
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
303
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
304
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
305
- </tr>
306
- </thead>
307
- <tbody class="tna-table__body">
308
- <tr>
309
- <th class="tna-table__header" scope="row">2020</th>
310
- <td class="tna-table__cell">Rat</td>
311
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
312
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
313
- </tr>
314
- <tr>
315
- <th class="tna-table__header" scope="row">2021</th>
316
- <td class="tna-table__cell">Ox</td>
317
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
318
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
319
- </tr>
320
- <tr>
321
- <th class="tna-table__header" scope="row">2022</th>
322
- <td class="tna-table__cell">Tiger</td>
323
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
324
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
325
- </tr>
326
- </tbody>
327
- <tfoot class="tna-table__foot">
328
- <tr>
329
- <th class="tna-table__header" scope="row">Totals</th>
330
- <td class="tna-table__cell"></td>
331
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
332
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
333
- </tr>
334
- </tfoot>
335
- </table>
336
- </div>`,
337
- },
338
- ],
339
- id: "accordion-example-Test",
340
- classes: "tna-accordion--demo",
341
- };
342
- Test.play = async ({ step }) => {
343
- const $allDetails = Array.from(
344
- document.querySelectorAll(".tna-accordion__details"),
345
- );
346
-
347
- await step("Initial load", async () => {
348
- await $allDetails.forEach(async ($details) => {
349
- await expect(
350
- $details.querySelector(".tna-accordion__summary"),
351
- ).toBeVisible();
352
- await expect(
353
- $details.querySelector(".tna-accordion__content"),
354
- ).not.toBeVisible();
355
- });
356
- });
357
-
358
- await step("Open first item", async () => {
359
- await fireEvent.click(
360
- $allDetails[0].querySelector(".tna-accordion__summary"),
361
- );
362
- console.log($allDetails[0].querySelector(".tna-accordion__summary"));
363
- await $allDetails.forEach(async ($details, index) => {
364
- if (index === 0) {
365
- await expect(
366
- $details.querySelector(".tna-accordion__content"),
367
- ).toBeVisible();
368
- } else {
369
- await expect(
370
- $details.querySelector(".tna-accordion__content"),
371
- ).not.toBeVisible();
372
- }
373
- });
374
- });
375
-
376
- await step("Close first item", async () => {
377
- await fireEvent.click(
378
- $allDetails[0].querySelector(".tna-accordion__summary"),
379
- );
380
- await $allDetails.forEach(async ($details) => {
381
- await expect(
382
- $details.querySelector(".tna-accordion__content"),
383
- ).not.toBeVisible();
384
- });
385
- });
386
-
387
- await step("Open first item", async () => {
388
- await fireEvent.click(
389
- $allDetails[0].querySelector(".tna-accordion__summary"),
390
- );
391
- await $allDetails.forEach(async ($details, index) => {
392
- if (index === 0) {
393
- await expect(
394
- $details.querySelector(".tna-accordion__content"),
395
- ).toBeVisible();
396
- } else {
397
- await expect(
398
- $details.querySelector(".tna-accordion__content"),
399
- ).not.toBeVisible();
400
- }
401
- });
402
- });
403
-
404
- // TODO: fireEvent doesn't work on Firefox
405
- // await step("Open second item", async () => {
406
- // await fireEvent.click(
407
- // $allDetails[1].querySelector(".tna-accordion__summary"),
408
- // );
409
- // await $allDetails.forEach(async ($details, index) => {
410
- // if (index === 1) {
411
- // await expect(
412
- // $details.querySelector(".tna-accordion__content"),
413
- // ).toBeVisible();
414
- // } else {
415
- // await expect(
416
- // $details.querySelector(".tna-accordion__content"),
417
- // ).not.toBeVisible();
418
- // }
419
- // });
420
- // });
421
-
422
- // await step("Close second item", async () => {
423
- // await fireEvent.click(
424
- // $allDetails[1].querySelector(".tna-accordion__summary"),
425
- // );
426
- // await $allDetails.forEach(async ($details) => {
427
- // await expect(
428
- // $details.querySelector(".tna-accordion__content"),
429
- // ).not.toBeVisible();
430
- // });
431
- // });
432
- };
@@ -1,128 +0,0 @@
1
- import Breadcrumbs from "./template.njk";
2
- import macroOptions from "./macro-options.json";
3
- import { within, userEvent, expect } from "@storybook/test";
4
- import { customViewports } from "../../../../.storybook/viewports";
5
-
6
- const argTypes = {
7
- items: { control: "object" },
8
- noCollapse: { control: "boolean" },
9
- structuredData: { control: "boolean" },
10
- classes: { control: "text" },
11
- attributes: { control: "object" },
12
- };
13
-
14
- Object.keys(argTypes).forEach((argType) => {
15
- argTypes[argType].description = macroOptions.find(
16
- (option) => option.name === argType,
17
- )?.description;
18
- });
19
-
20
- export default {
21
- title: "Components/Breadcrumbs",
22
- argTypes,
23
- };
24
-
25
- const Template = ({ items, noCollapse, structuredData, classes, attributes }) =>
26
- Breadcrumbs({
27
- params: {
28
- items,
29
- noCollapse,
30
- structuredData,
31
- classes,
32
- attributes,
33
- },
34
- });
35
-
36
- export const Standard = Template.bind({});
37
- Standard.args = {
38
- items: [
39
- {
40
- text: "Alpha",
41
- href: "#/alpha",
42
- },
43
- {
44
- text: "Beta",
45
- href: "#/beta",
46
- },
47
- {
48
- text: "Gamma",
49
- href: "#/gamma",
50
- },
51
- {
52
- text: "Delta",
53
- href: "#/delta",
54
- },
55
- {
56
- text: "Epsilon",
57
- href: "#/epsilon",
58
- },
59
- ],
60
- classes: "tna-breadcrumbs--demo",
61
- };
62
-
63
- export const NoCollapse = Template.bind({});
64
- NoCollapse.parameters = {
65
- viewport: {
66
- defaultViewport: "small",
67
- },
68
- chromatic: {
69
- viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
70
- },
71
- };
72
- NoCollapse.args = {
73
- ...Standard.args,
74
- noCollapse: true,
75
- };
76
-
77
- export const Mobile = Template.bind({});
78
- Mobile.parameters = {
79
- viewport: {
80
- defaultViewport: "small",
81
- },
82
- chromatic: {
83
- viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
84
- },
85
- };
86
- Mobile.args = {
87
- ...Standard.args,
88
- };
89
-
90
- export const MobileExpanded = Template.bind({});
91
- MobileExpanded.parameters = {
92
- viewport: {
93
- defaultViewport: "small",
94
- },
95
- chromatic: {
96
- viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
97
- },
98
- };
99
- MobileExpanded.args = {
100
- ...Standard.args,
101
- };
102
- MobileExpanded.play = async ({ args, canvasElement }) => {
103
- const canvas = within(canvasElement);
104
-
105
- const $module = document.querySelector('[data-module="tna-breadcrumbs"]');
106
- const $items = args.items.map((item) => canvas.getByText(item.text));
107
- const $expandButton = document.querySelector(
108
- ".tna-breadcrumbs__item--expandable button",
109
- );
110
-
111
- await expect($items[0]).toBeVisible();
112
- await expect($items[1]).not.toBeVisible();
113
- await expect($items[2]).not.toBeVisible();
114
- await expect($items[3]).not.toBeVisible();
115
- await expect($items[4]).toBeVisible();
116
- await expect($expandButton).toBeVisible();
117
-
118
- await userEvent.click($expandButton);
119
-
120
- await expect($items[0]).toBeVisible();
121
- await expect($items[1]).toBeVisible();
122
- await expect($items[2]).toBeVisible();
123
- await expect($items[3]).toBeVisible();
124
- await expect($items[4]).toBeVisible();
125
- await expect($expandButton).not.toBeVisible();
126
-
127
- await expect($module).toHaveFocus();
128
- };