@nationalarchives/frontend 0.1.64 → 0.2.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 (270) hide show
  1. package/config/.babelrc.json +19 -0
  2. package/config/.eslintrc.js +25 -0
  3. package/config/.htmlvalidate.json +17 -0
  4. package/config/stylelint.config.js +240 -0
  5. package/nationalarchives/all.css +1 -3
  6. package/nationalarchives/all.css.map +1 -1
  7. package/nationalarchives/all.js +1 -1
  8. package/nationalarchives/all.js.map +1 -1
  9. package/nationalarchives/all.mjs +34 -18
  10. package/nationalarchives/all.scss +0 -2
  11. package/nationalarchives/components/_forms.scss +9 -0
  12. package/nationalarchives/components/_index.scss +2 -34
  13. package/nationalarchives/components/_presentation.scss +23 -0
  14. package/nationalarchives/components/accordion/accordion.css +1 -1
  15. package/nationalarchives/components/accordion/accordion.css.map +1 -1
  16. package/nationalarchives/components/accordion/accordion.js +1 -1
  17. package/nationalarchives/components/accordion/accordion.js.map +1 -1
  18. package/nationalarchives/components/accordion/accordion.mjs +92 -24
  19. package/nationalarchives/components/accordion/accordion.scss +56 -18
  20. package/nationalarchives/components/accordion/fixtures.json +34 -7
  21. package/nationalarchives/components/accordion/macro-options.json +14 -2
  22. package/nationalarchives/components/accordion/template.njk +7 -5
  23. package/nationalarchives/components/breadcrumbs/breadcrumbs.css +1 -1
  24. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  25. package/nationalarchives/components/breadcrumbs/breadcrumbs.scss +0 -10
  26. package/nationalarchives/components/breadcrumbs/template.njk +1 -1
  27. package/nationalarchives/components/button/button.css +1 -1
  28. package/nationalarchives/components/button/button.css.map +1 -1
  29. package/nationalarchives/components/button/button.scss +32 -10
  30. package/nationalarchives/components/button/macro-options.json +6 -0
  31. package/nationalarchives/components/button/template.njk +3 -1
  32. package/nationalarchives/components/card/card.css +1 -1
  33. package/nationalarchives/components/card/card.css.map +1 -1
  34. package/nationalarchives/components/card/template.njk +5 -5
  35. package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
  36. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  37. package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
  38. package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
  39. package/nationalarchives/components/checkboxes/macro-options.json +6 -0
  40. package/nationalarchives/components/checkboxes/template.njk +1 -1
  41. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  42. package/nationalarchives/components/compound-filters/template.njk +1 -1
  43. package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
  44. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  45. package/nationalarchives/components/cookie-banner/cookie-banner.scss +0 -2
  46. package/nationalarchives/components/cookie-banner/template.njk +1 -2
  47. package/nationalarchives/components/date-input/date-input.css +1 -1
  48. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  49. package/nationalarchives/components/date-input/date-input.scss +2 -2
  50. package/nationalarchives/components/date-input/fixtures.json +5 -5
  51. package/nationalarchives/components/date-input/template.njk +2 -2
  52. package/nationalarchives/components/date-search/date-search.css +1 -1
  53. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  54. package/nationalarchives/components/date-search/date-search.njk +2 -2
  55. package/nationalarchives/components/date-search/date-search.scss +2 -2
  56. package/nationalarchives/components/date-search/template.njk +1 -1
  57. package/nationalarchives/components/details/details.css.map +1 -1
  58. package/nationalarchives/components/details/template.njk +1 -1
  59. package/nationalarchives/components/error-summary/error-summary.css +1 -1
  60. package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
  61. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  62. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  63. package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
  64. package/nationalarchives/components/error-summary/error-summary.scss +3 -4
  65. package/nationalarchives/components/error-summary/template.njk +1 -1
  66. package/nationalarchives/components/files-list/_index.scss +1 -0
  67. package/nationalarchives/components/files-list/files-list.css +1 -0
  68. package/nationalarchives/components/files-list/files-list.css.map +1 -0
  69. package/nationalarchives/components/files-list/files-list.scss +80 -0
  70. package/nationalarchives/components/files-list/fixtures.json +71 -0
  71. package/nationalarchives/components/{sensitive-image → files-list}/macro-options.json +20 -20
  72. package/nationalarchives/components/files-list/macro.njk +3 -0
  73. package/nationalarchives/components/files-list/template.njk +33 -0
  74. package/nationalarchives/components/footer/footer.css +1 -1
  75. package/nationalarchives/components/footer/footer.css.map +1 -1
  76. package/nationalarchives/components/footer/footer.scss +0 -2
  77. package/nationalarchives/components/footer/macro-options.json +0 -6
  78. package/nationalarchives/components/footer/template.njk +1 -1
  79. package/nationalarchives/components/gallery/fixtures.json +35 -1
  80. package/nationalarchives/components/gallery/gallery.css +1 -1
  81. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  82. package/nationalarchives/components/gallery/gallery.js +1 -1
  83. package/nationalarchives/components/gallery/gallery.js.map +1 -1
  84. package/nationalarchives/components/gallery/gallery.mjs +192 -53
  85. package/nationalarchives/components/gallery/gallery.scss +317 -56
  86. package/nationalarchives/components/gallery/macro-options.json +34 -49
  87. package/nationalarchives/components/gallery/template.njk +74 -33
  88. package/nationalarchives/components/global-header/global-header.css +1 -1
  89. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  90. package/nationalarchives/components/global-header/global-header.scss +0 -2
  91. package/nationalarchives/components/global-header/template.njk +1 -1
  92. package/nationalarchives/components/header/header.css +1 -1
  93. package/nationalarchives/components/header/header.css.map +1 -1
  94. package/nationalarchives/components/header/header.scss +3 -5
  95. package/nationalarchives/components/header/template.njk +1 -1
  96. package/nationalarchives/components/hero/hero.css +1 -1
  97. package/nationalarchives/components/hero/hero.css.map +1 -1
  98. package/nationalarchives/components/hero/hero.scss +0 -24
  99. package/nationalarchives/components/hero/template.njk +1 -1
  100. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  101. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  102. package/nationalarchives/components/index-grid/index-grid.scss +1 -1
  103. package/nationalarchives/components/index-grid/template.njk +3 -3
  104. package/nationalarchives/components/pagination/pagination.css +1 -1
  105. package/nationalarchives/components/pagination/pagination.css.map +1 -1
  106. package/nationalarchives/components/pagination/pagination.scss +1 -1
  107. package/nationalarchives/components/pagination/template.njk +1 -1
  108. package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
  109. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  110. package/nationalarchives/components/phase-banner/phase-banner.scss +0 -2
  111. package/nationalarchives/components/phase-banner/template.njk +1 -1
  112. package/nationalarchives/components/picture/picture.css.map +1 -1
  113. package/nationalarchives/components/picture/picture.js +1 -1
  114. package/nationalarchives/components/picture/picture.js.map +1 -1
  115. package/nationalarchives/components/picture/picture.mjs +2 -2
  116. package/nationalarchives/components/picture/template.njk +1 -1
  117. package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
  118. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
  119. package/nationalarchives/components/quick-filters/template.njk +1 -1
  120. package/nationalarchives/components/radios/radios.css +1 -1
  121. package/nationalarchives/components/radios/radios.css.map +1 -1
  122. package/nationalarchives/components/radios/radios.njk +1 -1
  123. package/nationalarchives/components/radios/radios.scss +1 -1
  124. package/nationalarchives/components/radios/template.njk +1 -1
  125. package/nationalarchives/components/records-list/_index.scss +1 -0
  126. package/nationalarchives/components/records-list/fixtures.json +42 -0
  127. package/nationalarchives/components/records-list/macro.njk +3 -0
  128. package/nationalarchives/components/records-list/records-list.css +1 -0
  129. package/nationalarchives/components/records-list/records-list.css.map +1 -0
  130. package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +2 -2
  131. package/nationalarchives/components/records-list/template.njk +21 -0
  132. package/nationalarchives/components/search-field/search-field.css +1 -1
  133. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  134. package/nationalarchives/components/search-field/search-field.scss +3 -2
  135. package/nationalarchives/components/search-field/template.njk +2 -2
  136. package/nationalarchives/components/select/select.css +1 -1
  137. package/nationalarchives/components/select/select.css.map +1 -1
  138. package/nationalarchives/components/select/select.scss +2 -2
  139. package/nationalarchives/components/select/template.njk +2 -2
  140. package/nationalarchives/components/sidebar/fixtures.json +18 -8
  141. package/nationalarchives/components/sidebar/macro-options.json +9 -2
  142. package/nationalarchives/components/sidebar/sidebar.css +1 -1
  143. package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
  144. package/nationalarchives/components/sidebar/template.njk +12 -3
  145. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  146. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  147. package/nationalarchives/components/skip-link/skip-link.scss +0 -2
  148. package/nationalarchives/components/skip-link/template.njk +1 -1
  149. package/nationalarchives/components/tabs/tabs.css +1 -1
  150. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  151. package/nationalarchives/components/tabs/tabs.scss +0 -12
  152. package/nationalarchives/components/tabs/template.njk +1 -1
  153. package/nationalarchives/components/text-input/template.njk +1 -1
  154. package/nationalarchives/components/text-input/text-input.css +1 -1
  155. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  156. package/nationalarchives/components/text-input/text-input.njk +2 -2
  157. package/nationalarchives/components/text-input/text-input.scss +2 -2
  158. package/nationalarchives/components/textarea/template.njk +2 -2
  159. package/nationalarchives/components/textarea/textarea.css +1 -1
  160. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  161. package/nationalarchives/components/textarea/textarea.scss +2 -2
  162. package/nationalarchives/components/warning/template.njk +1 -1
  163. package/nationalarchives/components/warning/warning.css +1 -1
  164. package/nationalarchives/components/warning/warning.css.map +1 -1
  165. package/nationalarchives/components/warning/warning.scss +2 -0
  166. package/nationalarchives/global-header-package.css +1 -1
  167. package/nationalarchives/global-header-package.css.map +1 -1
  168. package/nationalarchives/global-header-package.scss +1 -1
  169. package/nationalarchives/print.css +6 -0
  170. package/nationalarchives/print.css.map +1 -0
  171. package/nationalarchives/print.scss +44 -0
  172. package/nationalarchives/prototype-kit.css +1 -3
  173. package/nationalarchives/prototype-kit.css.map +1 -1
  174. package/nationalarchives/templates/layouts/_generic.njk +6 -6
  175. package/nationalarchives/tools/_a11y.scss +4 -0
  176. package/nationalarchives/tools/_colour.scss +75 -79
  177. package/nationalarchives/tools/_media.scss +0 -10
  178. package/nationalarchives/utilities/_columns.scss +1 -1
  179. package/nationalarchives/utilities/_index.scss +1 -0
  180. package/nationalarchives/utilities/_reset.scss +2 -8
  181. package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
  182. package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
  183. package/nationalarchives/utilities/grid/macro.njk +3 -0
  184. package/nationalarchives/{components → utilities}/grid/template.njk +1 -1
  185. package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +16 -7
  186. package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +8 -2
  187. package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +5 -5
  188. package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +8 -5
  189. package/nationalarchives/variables/_colour.scss +12 -5
  190. package/package.json +1 -1
  191. package/nationalarchives/components/accordion/accordion.stories.js +0 -410
  192. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
  193. package/nationalarchives/components/button/button-group.stories.js +0 -114
  194. package/nationalarchives/components/button/button.stories.js +0 -204
  195. package/nationalarchives/components/card/card.stories.js +0 -402
  196. package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
  197. package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
  198. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
  199. package/nationalarchives/components/date-input/date-input.stories.js +0 -119
  200. package/nationalarchives/components/date-search/date-search.stories.js +0 -124
  201. package/nationalarchives/components/details/details.stories.js +0 -33
  202. package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
  203. package/nationalarchives/components/featured-records/_index.scss +0 -1
  204. package/nationalarchives/components/featured-records/featured-records.css +0 -1
  205. package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
  206. package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
  207. package/nationalarchives/components/featured-records/fixtures.json +0 -42
  208. package/nationalarchives/components/featured-records/macro.njk +0 -3
  209. package/nationalarchives/components/featured-records/template.njk +0 -21
  210. package/nationalarchives/components/footer/footer.stories.js +0 -241
  211. package/nationalarchives/components/gallery/gallery.stories.js +0 -74
  212. package/nationalarchives/components/global-header/global-header.stories.js +0 -364
  213. package/nationalarchives/components/grid/_index.scss +0 -1
  214. package/nationalarchives/components/grid/grid.css +0 -1
  215. package/nationalarchives/components/grid/grid.css.map +0 -1
  216. package/nationalarchives/components/grid/grid.stories.js +0 -279
  217. package/nationalarchives/components/grid/macro.njk +0 -3
  218. package/nationalarchives/components/header/header.stories.js +0 -239
  219. package/nationalarchives/components/hero/hero.stories.js +0 -326
  220. package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
  221. package/nationalarchives/components/pagination/pagination.stories.js +0 -532
  222. package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
  223. package/nationalarchives/components/picture/picture.stories.js +0 -75
  224. package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
  225. package/nationalarchives/components/radios/radios.stories.js +0 -244
  226. package/nationalarchives/components/search-field/search-field.stories.js +0 -88
  227. package/nationalarchives/components/search-filters/_index.scss +0 -1
  228. package/nationalarchives/components/search-filters/fixtures.json +0 -16
  229. package/nationalarchives/components/search-filters/macro-options.json +0 -39
  230. package/nationalarchives/components/search-filters/macro.njk +0 -3
  231. package/nationalarchives/components/search-filters/search-filters.css +0 -1
  232. package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
  233. package/nationalarchives/components/search-filters/search-filters.js +0 -2
  234. package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
  235. package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
  236. package/nationalarchives/components/search-filters/search-filters.scss +0 -198
  237. package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
  238. package/nationalarchives/components/search-filters/template.njk +0 -108
  239. package/nationalarchives/components/select/select.stories.js +0 -197
  240. package/nationalarchives/components/sensitive-image/_index.scss +0 -1
  241. package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
  242. package/nationalarchives/components/sensitive-image/macro.njk +0 -3
  243. package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
  244. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
  245. package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
  246. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
  247. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
  248. package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
  249. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
  250. package/nationalarchives/components/sensitive-image/template.njk +0 -11
  251. package/nationalarchives/components/sidebar/sidebar.stories.js +0 -224
  252. package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
  253. package/nationalarchives/components/tabs/tabs.stories.js +0 -300
  254. package/nationalarchives/components/text-input/text-input.stories.js +0 -188
  255. package/nationalarchives/components/textarea/textarea.stories.js +0 -130
  256. package/nationalarchives/components/warning/warning.stories.js +0 -39
  257. package/nationalarchives/stories/intro.mdx +0 -13
  258. package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
  259. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1535
  260. package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
  261. package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
  262. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
  263. package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
  264. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
  265. package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
  266. package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
  267. package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
  268. package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +3 -3
  269. /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
  270. /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
@@ -1,410 +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
- items: { control: "object" },
7
- group: { control: "text" },
8
- classes: { control: "text" },
9
- attributes: { control: "object" },
10
- };
11
-
12
- Object.keys(argTypes).forEach((argType) => {
13
- argTypes[argType].description = macroOptions.find(
14
- (option) => option.name === argType,
15
- )?.description;
16
- });
17
-
18
- export default {
19
- title: "Components/Accordion",
20
- argTypes,
21
- };
22
-
23
- const Template = ({ items, group, classes, attributes }) =>
24
- Accordion({
25
- params: { items, group, classes, attributes },
26
- });
27
-
28
- export const Standard = Template.bind({});
29
- Standard.args = {
30
- items: [
31
- {
32
- title: "Alpha",
33
- text: "Content",
34
- },
35
- {
36
- title: "Beta",
37
- 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>",
38
- },
39
- {
40
- title: "Gamma",
41
- body: `<ul class="tna-ul">
42
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
43
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
44
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
45
- <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>
46
- </ul>`,
47
- },
48
- {
49
- title: "Delta",
50
- body: `<div class="tna-table-wrapper">
51
- <table class="tna-table">
52
- <caption class="tna-table__caption">
53
- Records added and removed between 2020 and 2022.
54
- </caption>
55
- <thead class="tna-table__head">
56
- <tr class="tna-table__row">
57
- <th class="tna-table__header" scope="col">Year</th>
58
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
59
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
60
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
61
- </tr>
62
- </thead>
63
- <tbody class="tna-table__body">
64
- <tr>
65
- <th class="tna-table__header" scope="row">2020</th>
66
- <td class="tna-table__cell">Rat</td>
67
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
68
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
69
- </tr>
70
- <tr>
71
- <th class="tna-table__header" scope="row">2021</th>
72
- <td class="tna-table__cell">Ox</td>
73
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
74
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
75
- </tr>
76
- <tr>
77
- <th class="tna-table__header" scope="row">2022</th>
78
- <td class="tna-table__cell">Tiger</td>
79
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
80
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
81
- </tr>
82
- </tbody>
83
- <tfoot class="tna-table__foot">
84
- <tr>
85
- <th class="tna-table__header" scope="row">Totals</th>
86
- <td class="tna-table__cell"></td>
87
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
88
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
89
- </tr>
90
- </tfoot>
91
- </table>
92
- </div>`,
93
- },
94
- ],
95
- group: "group-1",
96
- classes: "tna-accordion--demo",
97
- };
98
-
99
- export const OpenItems = Template.bind({});
100
- OpenItems.parameters = {
101
- chromatic: { disableSnapshot: true },
102
- };
103
- OpenItems.args = {
104
- items: [
105
- {
106
- title: "Alpha",
107
- text: "Content",
108
- },
109
- {
110
- title: "Beta",
111
- 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>",
112
- },
113
- {
114
- title: "Gamma",
115
- body: `<ul class="tna-ul">
116
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
117
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
118
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
119
- <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>
120
- </ul>`,
121
- open: true,
122
- },
123
- {
124
- title: "Delta",
125
- body: `<div class="tna-table-wrapper">
126
- <table class="tna-table">
127
- <caption class="tna-table__caption">
128
- Records added and removed between 2020 and 2022.
129
- </caption>
130
- <thead class="tna-table__head">
131
- <tr class="tna-table__row">
132
- <th class="tna-table__header" scope="col">Year</th>
133
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
134
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
135
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
136
- </tr>
137
- </thead>
138
- <tbody class="tna-table__body">
139
- <tr>
140
- <th class="tna-table__header" scope="row">2020</th>
141
- <td class="tna-table__cell">Rat</td>
142
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
143
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
144
- </tr>
145
- <tr>
146
- <th class="tna-table__header" scope="row">2021</th>
147
- <td class="tna-table__cell">Ox</td>
148
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
149
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
150
- </tr>
151
- <tr>
152
- <th class="tna-table__header" scope="row">2022</th>
153
- <td class="tna-table__cell">Tiger</td>
154
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
155
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
156
- </tr>
157
- </tbody>
158
- <tfoot class="tna-table__foot">
159
- <tr>
160
- <th class="tna-table__header" scope="row">Totals</th>
161
- <td class="tna-table__cell"></td>
162
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
163
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
164
- </tr>
165
- </tfoot>
166
- </table>
167
- </div>`,
168
- },
169
- ],
170
- group: "group-2",
171
- classes: "tna-accordion--demo",
172
- };
173
-
174
- export const NoGroup = Template.bind({});
175
- NoGroup.parameters = {
176
- chromatic: { disableSnapshot: true },
177
- };
178
- NoGroup.args = {
179
- items: [
180
- {
181
- title: "Alpha",
182
- text: "Content",
183
- },
184
- {
185
- title: "Beta",
186
- 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>",
187
- },
188
- {
189
- title: "Gamma",
190
- body: `<ul class="tna-ul">
191
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
192
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
193
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
194
- <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>
195
- </ul>`,
196
- },
197
- {
198
- title: "Delta",
199
- body: `<div class="tna-table-wrapper">
200
- <table class="tna-table">
201
- <caption class="tna-table__caption">
202
- Records added and removed between 2020 and 2022.
203
- </caption>
204
- <thead class="tna-table__head">
205
- <tr class="tna-table__row">
206
- <th class="tna-table__header" scope="col">Year</th>
207
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
208
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
209
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
210
- </tr>
211
- </thead>
212
- <tbody class="tna-table__body">
213
- <tr>
214
- <th class="tna-table__header" scope="row">2020</th>
215
- <td class="tna-table__cell">Rat</td>
216
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
217
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
218
- </tr>
219
- <tr>
220
- <th class="tna-table__header" scope="row">2021</th>
221
- <td class="tna-table__cell">Ox</td>
222
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
223
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
224
- </tr>
225
- <tr>
226
- <th class="tna-table__header" scope="row">2022</th>
227
- <td class="tna-table__cell">Tiger</td>
228
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
229
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
230
- </tr>
231
- </tbody>
232
- <tfoot class="tna-table__foot">
233
- <tr>
234
- <th class="tna-table__header" scope="row">Totals</th>
235
- <td class="tna-table__cell"></td>
236
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
237
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
238
- </tr>
239
- </tfoot>
240
- </table>
241
- </div>`,
242
- },
243
- ],
244
- classes: "tna-accordion--demo",
245
- };
246
-
247
- export const Test = Template.bind({});
248
- Test.parameters = {
249
- chromatic: { disableSnapshot: true },
250
- };
251
- Test.args = {
252
- items: [
253
- {
254
- title: "Alpha",
255
- text: "Content",
256
- },
257
- {
258
- title: "Beta",
259
- 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>",
260
- },
261
- {
262
- title: "Gamma",
263
- body: `<ul class="tna-ul">
264
- <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
265
- <li>Nulla dignissim vehicula magna, et hendrerit quam iaculis a. Mauris in ultricies enim.</li>
266
- <li>Donec bibendum est leo, sed dapibus mauris facilisis vitae.</li>
267
- <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>
268
- </ul>`,
269
- },
270
- {
271
- title: "Delta",
272
- body: `<div class="tna-table-wrapper">
273
- <table class="tna-table">
274
- <caption class="tna-table__caption">
275
- Records added and removed between 2020 and 2022.
276
- </caption>
277
- <thead class="tna-table__head">
278
- <tr class="tna-table__row">
279
- <th class="tna-table__header" scope="col">Year</th>
280
- <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
281
- <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
282
- <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
283
- </tr>
284
- </thead>
285
- <tbody class="tna-table__body">
286
- <tr>
287
- <th class="tna-table__header" scope="row">2020</th>
288
- <td class="tna-table__cell">Rat</td>
289
- <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
290
- <td class="tna-table__cell tna-table__cell--numeric">789</td>
291
- </tr>
292
- <tr>
293
- <th class="tna-table__header" scope="row">2021</th>
294
- <td class="tna-table__cell">Ox</td>
295
- <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
296
- <td class="tna-table__cell tna-table__cell--numeric">123</td>
297
- </tr>
298
- <tr>
299
- <th class="tna-table__header" scope="row">2022</th>
300
- <td class="tna-table__cell">Tiger</td>
301
- <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
302
- <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
303
- </tr>
304
- </tbody>
305
- <tfoot class="tna-table__foot">
306
- <tr>
307
- <th class="tna-table__header" scope="row">Totals</th>
308
- <td class="tna-table__cell"></td>
309
- <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
310
- <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
311
- </tr>
312
- </tfoot>
313
- </table>
314
- </div>`,
315
- },
316
- ],
317
- group: "group-1",
318
- classes: "tna-accordion--demo",
319
- };
320
- Test.play = async ({ step }) => {
321
- const $allDetails = Array.from(
322
- document.querySelectorAll(".tna-accordion__details"),
323
- );
324
-
325
- await step("Initial load", async () => {
326
- await $allDetails.forEach(async ($details) => {
327
- await expect(
328
- $details.querySelector(".tna-accordion__summary"),
329
- ).toBeVisible();
330
- await expect(
331
- $details.querySelector(".tna-accordion__content"),
332
- ).not.toBeVisible();
333
- });
334
- });
335
-
336
- await step("Open first item", async () => {
337
- await fireEvent.click(
338
- $allDetails[0].querySelector(".tna-accordion__summary"),
339
- );
340
- console.log($allDetails[0].querySelector(".tna-accordion__summary"));
341
- await $allDetails.forEach(async ($details, index) => {
342
- if (index === 0) {
343
- await expect(
344
- $details.querySelector(".tna-accordion__content"),
345
- ).toBeVisible();
346
- } else {
347
- await expect(
348
- $details.querySelector(".tna-accordion__content"),
349
- ).not.toBeVisible();
350
- }
351
- });
352
- });
353
-
354
- await step("Close first item", async () => {
355
- await fireEvent.click(
356
- $allDetails[0].querySelector(".tna-accordion__summary"),
357
- );
358
- await $allDetails.forEach(async ($details) => {
359
- await expect(
360
- $details.querySelector(".tna-accordion__content"),
361
- ).not.toBeVisible();
362
- });
363
- });
364
-
365
- await step("Open first item", async () => {
366
- await fireEvent.click(
367
- $allDetails[0].querySelector(".tna-accordion__summary"),
368
- );
369
- await $allDetails.forEach(async ($details, index) => {
370
- if (index === 0) {
371
- await expect(
372
- $details.querySelector(".tna-accordion__content"),
373
- ).toBeVisible();
374
- } else {
375
- await expect(
376
- $details.querySelector(".tna-accordion__content"),
377
- ).not.toBeVisible();
378
- }
379
- });
380
- });
381
-
382
- // TODO: fireEvent doesn't work on Firefox
383
- // await step("Open second item", async () => {
384
- // await fireEvent.click(
385
- // $allDetails[1].querySelector(".tna-accordion__summary"),
386
- // );
387
- // await $allDetails.forEach(async ($details, index) => {
388
- // if (index === 1) {
389
- // await expect(
390
- // $details.querySelector(".tna-accordion__content"),
391
- // ).toBeVisible();
392
- // } else {
393
- // await expect(
394
- // $details.querySelector(".tna-accordion__content"),
395
- // ).not.toBeVisible();
396
- // }
397
- // });
398
- // });
399
-
400
- // await step("Close second item", async () => {
401
- // await fireEvent.click(
402
- // $allDetails[1].querySelector(".tna-accordion__summary"),
403
- // );
404
- // await $allDetails.forEach(async ($details) => {
405
- // await expect(
406
- // $details.querySelector(".tna-accordion__content"),
407
- // ).not.toBeVisible();
408
- // });
409
- // });
410
- };
@@ -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
- };
@@ -1,114 +0,0 @@
1
- import Button from "./template.njk";
2
-
3
- export default {
4
- title: "Components/Button group",
5
- };
6
-
7
- const Template = ({
8
- text,
9
- href,
10
- title,
11
- icon,
12
- accent,
13
- small,
14
- plain,
15
- iconOnly,
16
- iconOnlyOnMobile,
17
- rightAlignIcon,
18
- buttonElement,
19
- buttonType,
20
- classes,
21
- attributes,
22
- }) =>
23
- Button({
24
- params: {
25
- text,
26
- href,
27
- title,
28
- icon,
29
- accent,
30
- small,
31
- plain,
32
- iconOnly,
33
- iconOnlyOnMobile,
34
- rightAlignIcon,
35
- buttonElement,
36
- buttonType,
37
- classes,
38
- attributes,
39
- },
40
- });
41
-
42
- const GroupTemplate = ({ buttons }) =>
43
- `<div class="tna-button-group">
44
- ${buttons.map((button) => Template(button)).join("")}
45
- </div>`;
46
-
47
- export const Group = GroupTemplate.bind({});
48
- Group.args = {
49
- buttons: [
50
- {
51
- text: "Standard",
52
- href: "#",
53
- classes: "tna-button--demo",
54
- },
55
- {
56
- text: "Accent",
57
- href: "#",
58
- accent: true,
59
- classes: "tna-button--demo",
60
- },
61
- {
62
- text: "Icon",
63
- href: "#",
64
- icon: "phone",
65
- classes: "tna-button--demo",
66
- },
67
- {
68
- text: "Right Aligned Icon",
69
- href: "#",
70
- icon: "chevron-right",
71
- rightAlignIcon: true,
72
- classes: "tna-button--demo",
73
- },
74
- {
75
- text: "Icon Only",
76
- href: "#",
77
- icon: "list",
78
- iconOnly: true,
79
- classes: "tna-button--demo",
80
- },
81
- {
82
- text: "Icon Only On Mobile",
83
- href: "#",
84
- icon: "list",
85
- iconOnlyOnMobile: true,
86
- classes: "tna-button--demo",
87
- },
88
- {
89
- text: "Plain",
90
- plain: true,
91
- classes: "tna-button--demo",
92
- },
93
- {
94
- text: "Plain With Icon",
95
- href: "#",
96
- icon: "map-location-dot",
97
- plain: true,
98
- classes: "tna-button--demo",
99
- },
100
- {
101
- text: "Button",
102
- buttonElement: true,
103
- classes: "tna-button--demo",
104
- },
105
- ],
106
- };
107
-
108
- const SmallGroupTemplate = ({ buttons }) =>
109
- `<div class="tna-button-group tna-button-group--small">
110
- ${buttons.map((button) => Template({ ...button, text: `Small ${button.text}` })).join("")}
111
- </div>`;
112
-
113
- export const SmallGroup = SmallGroupTemplate.bind({});
114
- SmallGroup.args = Group.args;