@nationalarchives/frontend 0.1.65 → 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 (205) 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/components/_forms.scss +9 -0
  10. package/nationalarchives/components/_index.scss +2 -35
  11. package/nationalarchives/components/_presentation.scss +23 -0
  12. package/nationalarchives/components/accordion/accordion.css.map +1 -1
  13. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  14. package/nationalarchives/components/button/button.css +1 -1
  15. package/nationalarchives/components/button/button.css.map +1 -1
  16. package/nationalarchives/components/button/button.scss +9 -9
  17. package/nationalarchives/components/card/card.css +1 -1
  18. package/nationalarchives/components/card/card.css.map +1 -1
  19. package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
  20. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  21. package/nationalarchives/components/checkboxes/checkboxes.njk +1 -1
  22. package/nationalarchives/components/checkboxes/checkboxes.scss +1 -1
  23. package/nationalarchives/components/checkboxes/macro-options.json +6 -0
  24. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  25. package/nationalarchives/components/date-input/date-input.css +1 -1
  26. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  27. package/nationalarchives/components/date-input/date-input.scss +2 -2
  28. package/nationalarchives/components/date-input/fixtures.json +5 -5
  29. package/nationalarchives/components/date-input/template.njk +1 -1
  30. package/nationalarchives/components/date-search/date-search.css +1 -1
  31. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  32. package/nationalarchives/components/date-search/date-search.scss +2 -2
  33. package/nationalarchives/components/details/details.css.map +1 -1
  34. package/nationalarchives/components/error-summary/error-summary.css +1 -1
  35. package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
  36. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  37. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  38. package/nationalarchives/components/error-summary/error-summary.mjs +1 -1
  39. package/nationalarchives/components/error-summary/error-summary.scss +3 -4
  40. package/nationalarchives/components/files-list/_index.scss +1 -0
  41. package/nationalarchives/components/files-list/files-list.css +1 -0
  42. package/nationalarchives/components/files-list/files-list.css.map +1 -0
  43. package/nationalarchives/components/{files/files.scss → files-list/files-list.scss} +2 -1
  44. package/nationalarchives/components/files-list/fixtures.json +71 -0
  45. package/nationalarchives/components/files-list/macro.njk +3 -0
  46. package/nationalarchives/components/files-list/template.njk +33 -0
  47. package/nationalarchives/components/footer/footer.css.map +1 -1
  48. package/nationalarchives/components/gallery/fixtures.json +1 -1
  49. package/nationalarchives/components/gallery/gallery.css +1 -1
  50. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  51. package/nationalarchives/components/gallery/gallery.scss +5 -6
  52. package/nationalarchives/components/gallery/template.njk +11 -7
  53. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  54. package/nationalarchives/components/header/header.css.map +1 -1
  55. package/nationalarchives/components/hero/hero.css +1 -1
  56. package/nationalarchives/components/hero/hero.css.map +1 -1
  57. package/nationalarchives/components/hero/hero.scss +0 -24
  58. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  59. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  60. package/nationalarchives/components/index-grid/index-grid.scss +1 -1
  61. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  62. package/nationalarchives/components/picture/picture.css.map +1 -1
  63. package/nationalarchives/components/quick-filters/quick-filters.css +1 -1
  64. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
  65. package/nationalarchives/components/radios/radios.css +1 -1
  66. package/nationalarchives/components/radios/radios.css.map +1 -1
  67. package/nationalarchives/components/radios/radios.scss +1 -1
  68. package/nationalarchives/components/records-list/_index.scss +1 -0
  69. package/nationalarchives/components/records-list/fixtures.json +42 -0
  70. package/nationalarchives/components/records-list/macro.njk +3 -0
  71. package/nationalarchives/components/records-list/records-list.css +1 -0
  72. package/nationalarchives/components/records-list/records-list.css.map +1 -0
  73. package/nationalarchives/components/{featured-records/featured-records.scss → records-list/records-list.scss} +1 -1
  74. package/nationalarchives/components/records-list/template.njk +21 -0
  75. package/nationalarchives/components/search-field/search-field.css +1 -1
  76. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  77. package/nationalarchives/components/search-field/search-field.scss +1 -1
  78. package/nationalarchives/components/select/select.css +1 -1
  79. package/nationalarchives/components/select/select.css.map +1 -1
  80. package/nationalarchives/components/select/select.scss +2 -2
  81. package/nationalarchives/components/sidebar/fixtures.json +12 -2
  82. package/nationalarchives/components/sidebar/sidebar.css +1 -1
  83. package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
  84. package/nationalarchives/components/sidebar/template.njk +9 -0
  85. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  86. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  87. package/nationalarchives/components/text-input/text-input.css +1 -1
  88. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  89. package/nationalarchives/components/text-input/text-input.scss +2 -2
  90. package/nationalarchives/components/textarea/textarea.css +1 -1
  91. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  92. package/nationalarchives/components/textarea/textarea.scss +2 -2
  93. package/nationalarchives/components/warning/warning.css +1 -1
  94. package/nationalarchives/components/warning/warning.css.map +1 -1
  95. package/nationalarchives/components/warning/warning.scss +1 -0
  96. package/nationalarchives/global-header-package.css +1 -1
  97. package/nationalarchives/global-header-package.css.map +1 -1
  98. package/nationalarchives/global-header-package.scss +1 -1
  99. package/nationalarchives/print.css +1 -1
  100. package/nationalarchives/print.css.map +1 -1
  101. package/nationalarchives/prototype-kit.css +1 -1
  102. package/nationalarchives/prototype-kit.css.map +1 -1
  103. package/nationalarchives/tools/_colour.scss +25 -50
  104. package/nationalarchives/utilities/_columns.scss +1 -1
  105. package/nationalarchives/utilities/_index.scss +1 -0
  106. package/nationalarchives/utilities/_reset.scss +2 -8
  107. package/nationalarchives/utilities/{_colour.scss → colour/_index.scss} +2 -2
  108. package/nationalarchives/utilities/{_forms.scss → forms/_index.scss} +6 -6
  109. package/nationalarchives/utilities/grid/macro.njk +3 -0
  110. package/nationalarchives/utilities/{_lists.scss → lists/_index.scss} +16 -7
  111. package/nationalarchives/utilities/{_overrides.scss → overrides/_index.scss} +2 -2
  112. package/nationalarchives/utilities/{_tables.scss → tables/_index.scss} +5 -5
  113. package/nationalarchives/utilities/{_typography.scss → typography/_index.scss} +5 -5
  114. package/nationalarchives/variables/_colour.scss +12 -5
  115. package/package.json +1 -1
  116. package/nationalarchives/components/accordion/accordion.stories.js +0 -432
  117. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +0 -128
  118. package/nationalarchives/components/button/button-group.stories.js +0 -114
  119. package/nationalarchives/components/button/button.stories.js +0 -207
  120. package/nationalarchives/components/card/card.stories.js +0 -402
  121. package/nationalarchives/components/checkboxes/checkboxes.stories.js +0 -241
  122. package/nationalarchives/components/compound-filters/compound-filters.stories.js +0 -61
  123. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +0 -250
  124. package/nationalarchives/components/date-input/date-input.stories.js +0 -119
  125. package/nationalarchives/components/date-search/date-search.stories.js +0 -124
  126. package/nationalarchives/components/details/details.stories.js +0 -33
  127. package/nationalarchives/components/error-summary/error-summary.stories.js +0 -59
  128. package/nationalarchives/components/featured-records/_index.scss +0 -1
  129. package/nationalarchives/components/featured-records/featured-records.css +0 -1
  130. package/nationalarchives/components/featured-records/featured-records.css.map +0 -1
  131. package/nationalarchives/components/featured-records/featured-records.stories.js +0 -50
  132. package/nationalarchives/components/featured-records/fixtures.json +0 -42
  133. package/nationalarchives/components/featured-records/macro.njk +0 -3
  134. package/nationalarchives/components/featured-records/template.njk +0 -21
  135. package/nationalarchives/components/files/_index.scss +0 -1
  136. package/nationalarchives/components/files/files.css +0 -1
  137. package/nationalarchives/components/files/files.css.map +0 -1
  138. package/nationalarchives/components/files/files.stories.js +0 -59
  139. package/nationalarchives/components/files/fixtures.json +0 -71
  140. package/nationalarchives/components/files/macro.njk +0 -3
  141. package/nationalarchives/components/files/template.njk +0 -33
  142. package/nationalarchives/components/footer/footer.stories.js +0 -241
  143. package/nationalarchives/components/gallery/gallery.stories.js +0 -87
  144. package/nationalarchives/components/global-header/global-header.stories.js +0 -364
  145. package/nationalarchives/components/grid/_index.scss +0 -1
  146. package/nationalarchives/components/grid/grid.css +0 -1
  147. package/nationalarchives/components/grid/grid.css.map +0 -1
  148. package/nationalarchives/components/grid/grid.stories.js +0 -279
  149. package/nationalarchives/components/grid/macro.njk +0 -3
  150. package/nationalarchives/components/header/header.stories.js +0 -239
  151. package/nationalarchives/components/hero/hero.stories.js +0 -326
  152. package/nationalarchives/components/index-grid/index-grid.stories.js +0 -128
  153. package/nationalarchives/components/pagination/pagination.stories.js +0 -532
  154. package/nationalarchives/components/phase-banner/phase-banner.stories.js +0 -39
  155. package/nationalarchives/components/picture/picture.stories.js +0 -75
  156. package/nationalarchives/components/quick-filters/quick-filters.stories.js +0 -76
  157. package/nationalarchives/components/radios/radios.stories.js +0 -244
  158. package/nationalarchives/components/search-field/search-field.stories.js +0 -88
  159. package/nationalarchives/components/search-filters/_index.scss +0 -1
  160. package/nationalarchives/components/search-filters/fixtures.json +0 -16
  161. package/nationalarchives/components/search-filters/macro-options.json +0 -39
  162. package/nationalarchives/components/search-filters/macro.njk +0 -3
  163. package/nationalarchives/components/search-filters/search-filters.css +0 -1
  164. package/nationalarchives/components/search-filters/search-filters.css.map +0 -1
  165. package/nationalarchives/components/search-filters/search-filters.js +0 -2
  166. package/nationalarchives/components/search-filters/search-filters.js.map +0 -1
  167. package/nationalarchives/components/search-filters/search-filters.mjs +0 -67
  168. package/nationalarchives/components/search-filters/search-filters.scss +0 -198
  169. package/nationalarchives/components/search-filters/search-filters.stories.js +0 -207
  170. package/nationalarchives/components/search-filters/template.njk +0 -108
  171. package/nationalarchives/components/select/select.stories.js +0 -197
  172. package/nationalarchives/components/sensitive-image/_index.scss +0 -1
  173. package/nationalarchives/components/sensitive-image/fixtures.json +0 -51
  174. package/nationalarchives/components/sensitive-image/macro-options.json +0 -58
  175. package/nationalarchives/components/sensitive-image/macro.njk +0 -3
  176. package/nationalarchives/components/sensitive-image/sensitive-image.css +0 -1
  177. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +0 -1
  178. package/nationalarchives/components/sensitive-image/sensitive-image.js +0 -2
  179. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +0 -1
  180. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +0 -23
  181. package/nationalarchives/components/sensitive-image/sensitive-image.scss +0 -85
  182. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +0 -86
  183. package/nationalarchives/components/sensitive-image/template.njk +0 -11
  184. package/nationalarchives/components/sidebar/sidebar.stories.js +0 -227
  185. package/nationalarchives/components/skip-link/skip-link.stories.js +0 -76
  186. package/nationalarchives/components/tabs/tabs.stories.js +0 -300
  187. package/nationalarchives/components/text-input/text-input.stories.js +0 -188
  188. package/nationalarchives/components/textarea/textarea.stories.js +0 -130
  189. package/nationalarchives/components/warning/warning.stories.js +0 -39
  190. package/nationalarchives/stories/intro.mdx +0 -13
  191. package/nationalarchives/stories/utilities/colour-schemes/colour-combinations.stories.js +0 -293
  192. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +0 -1513
  193. package/nationalarchives/stories/utilities/forms/forms.mdx +0 -117
  194. package/nationalarchives/stories/utilities/lists/lists.stories.js +0 -212
  195. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +0 -42
  196. package/nationalarchives/stories/utilities/tables/tables.stories.js +0 -47
  197. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +0 -94
  198. package/nationalarchives/stories/utilities/typography/headings.stories.js +0 -33
  199. package/nationalarchives/stories/utilities/typography/typography.stories.js +0 -91
  200. package/nationalarchives/components/{files → files-list}/macro-options.json +0 -0
  201. package/nationalarchives/components/{featured-records → records-list}/macro-options.json +0 -0
  202. package/nationalarchives/{components/grid/grid.scss → utilities/grid/_index.scss} +1 -1
  203. /package/nationalarchives/{components → utilities}/grid/fixtures.json +0 -0
  204. /package/nationalarchives/{components → utilities}/grid/macro-options.json +0 -0
  205. /package/nationalarchives/{components → utilities}/grid/template.njk +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
- };
@@ -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;