@ons/design-system 62.0.1 → 62.1.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 (212) hide show
  1. package/README.md +0 -63
  2. package/components/access-code/example-access-code-error.njk +87 -0
  3. package/components/access-code/example-access-code.njk +63 -0
  4. package/components/accordion/example-accordion-open.njk +126 -0
  5. package/components/accordion/example-accordion.njk +25 -0
  6. package/components/address-input/example-address-input-editable.njk +52 -0
  7. package/components/address-input/example-address-input-manual.njk +23 -0
  8. package/components/address-input/example-address-input.njk +40 -0
  9. package/components/autosuggest/example-autosuggest-country-multiple.njk +30 -0
  10. package/components/autosuggest/example-autosuggest-country.njk +29 -0
  11. package/components/back-link/example-back-link.njk +17 -0
  12. package/components/breadcrumbs/example-breadcrumbs-single.njk +13 -0
  13. package/components/breadcrumbs/example-breadcrumbs.njk +17 -0
  14. package/components/button/_button.scss +5 -3
  15. package/components/button/example-button-custom.njk +20 -0
  16. package/components/button/example-button-disabled.njk +7 -0
  17. package/components/button/example-button-download.njk +9 -0
  18. package/components/button/example-button-ghost.njk +15 -0
  19. package/components/button/example-button-group.njk +16 -0
  20. package/components/button/example-button-link.njk +7 -0
  21. package/components/button/example-button-loader.njk +9 -0
  22. package/components/button/example-button-new-window.njk +12 -0
  23. package/components/button/example-button-print.njk +8 -0
  24. package/components/button/example-button-secondary-small.njk +8 -0
  25. package/components/button/example-button-secondary.njk +8 -0
  26. package/components/button/example-button-small.njk +8 -0
  27. package/components/button/example-button-timer.njk +9 -0
  28. package/components/button/example-button.njk +6 -0
  29. package/components/call-to-action/example-call-to-action-default.njk +14 -0
  30. package/components/card/example-card-set-with-images.njk +41 -0
  31. package/components/card/example-card-set-with-lists.njk +68 -0
  32. package/components/card/example-card-set.njk +38 -0
  33. package/components/card/example-card.njk +9 -0
  34. package/components/checkboxes/example-checkboxes-disabled.njk +34 -0
  35. package/components/checkboxes/example-checkboxes-error.njk +60 -0
  36. package/components/checkboxes/example-checkboxes-with-descriptions.njk +71 -0
  37. package/components/checkboxes/example-checkboxes-with-hidden-label.njk +177 -0
  38. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes.njk +86 -0
  39. package/components/checkboxes/example-checkboxes-with-revealed-radios.njk +69 -0
  40. package/components/checkboxes/example-checkboxes-with-revealed-select.njk +71 -0
  41. package/components/checkboxes/example-checkboxes-with-revealed-text-input.njk +59 -0
  42. package/components/checkboxes/example-checkboxes-with-select-all-button.njk +51 -0
  43. package/components/checkboxes/example-checkboxes-with-visible-text-input.njk +61 -0
  44. package/components/checkboxes/example-checkboxes-without-border.njk +33 -0
  45. package/components/checkboxes/example-checkboxes.njk +46 -0
  46. package/components/content-pagination/example-content-pagination.njk +20 -0
  47. package/components/cookies-banner/_macro.njk +4 -4
  48. package/components/cookies-banner/_macro.spec.js +41 -1
  49. package/components/cookies-banner/example-cookies-banner-cymraeg.njk +9 -0
  50. package/components/cookies-banner/example-cookies-banner.njk +7 -0
  51. package/components/date-input/example-date-input-error.njk +62 -0
  52. package/components/date-input/example-date-input.njk +36 -0
  53. package/components/details/example-details-with-saved-state.njk +10 -0
  54. package/components/details/example-details-with-warning.njk +19 -0
  55. package/components/details/example-details.njk +9 -0
  56. package/components/document-list/example-document-list-article-featured.njk +31 -0
  57. package/components/document-list/example-document-list-articles.njk +60 -0
  58. package/components/document-list/example-document-list-downloads.njk +59 -0
  59. package/components/document-list/example-document-list-search-result-featured.njk +19 -0
  60. package/components/document-list/example-document-list-search-results.njk +67 -0
  61. package/components/duration/example-duration-error.njk +30 -0
  62. package/components/duration/example-duration.njk +35 -0
  63. package/components/duration/examples-duration-error-for-single-field.njk +31 -0
  64. package/components/external-link/example-external-link.njk +8 -0
  65. package/components/feedback/example-feedback-call-to-action.njk +14 -0
  66. package/components/footer/example-footer-cymraeg.njk +54 -0
  67. package/components/footer/example-footer-default.njk +7 -0
  68. package/components/footer/example-footer-transactional.njk +62 -0
  69. package/components/footer/example-footer-warning.njk +32 -0
  70. package/components/footer/example-footer-with-alternative-organisation.njk +124 -0
  71. package/components/footer/example-footer-with-coat-of-arms.njk +32 -0
  72. package/components/footer/example-footer-with-copyright.njk +35 -0
  73. package/components/footer/example-footer.njk +85 -0
  74. package/components/header/_header.scss +2 -2
  75. package/components/header/_macro.spec.js +97 -0
  76. package/components/header/example-header-default.njk +12 -0
  77. package/components/header/example-header-external-for-survey-with-description.njk +20 -0
  78. package/components/header/example-header-external-for-surveys.njk +33 -0
  79. package/components/header/example-header-external-welsh.njk +29 -0
  80. package/components/header/example-header-external-with-navigation.njk +42 -0
  81. package/components/header/example-header-external-with-service-links.njk +35 -0
  82. package/components/header/example-header-external-with-sub-navigation.njk +132 -0
  83. package/components/header/example-header-internal.njk +32 -0
  84. package/components/header/example-header-neutral-for-multicoloured-logo.njk +59 -0
  85. package/components/hero/example-hero-dark.njk +15 -0
  86. package/components/hero/example-hero-default.njk +14 -0
  87. package/components/images/example-images-for-regular-screens.njk +8 -0
  88. package/components/images/example-images-for-retina-screens.njk +10 -0
  89. package/components/input/example-input-email.njk +12 -0
  90. package/components/input/example-input-number-prefixed.njk +17 -0
  91. package/components/input/example-input-number-suffixed.njk +34 -0
  92. package/components/input/example-input-number.njk +15 -0
  93. package/components/input/example-input-numeric-values.njk +64 -0
  94. package/components/input/example-input-telephone.njk +13 -0
  95. package/components/input/example-input-text-width-constrained.njk +11 -0
  96. package/components/input/example-input-text-with-character-limit-checker.njk +17 -0
  97. package/components/input/example-input-text-with-description.njk +10 -0
  98. package/components/input/example-input-text.njk +9 -0
  99. package/components/label/example-label-with-description.njk +8 -0
  100. package/components/label/example-label.njk +8 -0
  101. package/components/metadata/example-metadata.njk +57 -0
  102. package/components/mutually-exclusive/example-mutually-exclusive-checkboxes.njk +71 -0
  103. package/components/mutually-exclusive/example-mutually-exclusive-date-with-error.njk +47 -0
  104. package/components/mutually-exclusive/example-mutually-exclusive-date.njk +49 -0
  105. package/components/mutually-exclusive/example-mutually-exclusive-duration.njk +45 -0
  106. package/components/mutually-exclusive/example-mutually-exclusive-email.njk +36 -0
  107. package/components/mutually-exclusive/example-mutually-exclusive-multiple-options.njk +63 -0
  108. package/components/mutually-exclusive/example-mutually-exclusive-number.njk +43 -0
  109. package/components/mutually-exclusive/example-mutually-exclusive-textarea.njk +40 -0
  110. package/components/navigation/_macro.njk +1 -1
  111. package/components/pagination/example-pagination-first.njk +24 -0
  112. package/components/pagination/example-pagination-last.njk +24 -0
  113. package/components/pagination/example-pagination-with-no-range-indicator.njk +42 -0
  114. package/components/pagination/example-pagination.njk +116 -0
  115. package/components/panel/example-panel-bare.njk +9 -0
  116. package/components/panel/example-panel-with-announcement.njk +18 -0
  117. package/components/panel/example-panel-with-error-details.njk +18 -0
  118. package/components/panel/example-panel-with-error-summary.njk +25 -0
  119. package/components/panel/example-panel-with-information.njk +7 -0
  120. package/components/panel/example-panel-with-spacious-information.njk +7 -0
  121. package/components/panel/example-panel-with-success-message.njk +10 -0
  122. package/components/panel/example-panel-with-warning.njk +8 -0
  123. package/components/password/example-password.njk +11 -0
  124. package/components/phase-banner/example-phase-banner-alpha.njk +10 -0
  125. package/components/phase-banner/example-phase-banner-beta.njk +9 -0
  126. package/components/question/example-question-ccs.njk +49 -0
  127. package/components/question/example-question-fieldset.njk +99 -0
  128. package/components/question/example-question-interviewer-note.njk +38 -0
  129. package/components/question/example-question-no-fieldset.njk +46 -0
  130. package/components/radios/example-radios-with-clear-button.njk +97 -0
  131. package/components/radios/example-radios-with-descriptions.njk +57 -0
  132. package/components/radios/example-radios-with-error.njk +38 -0
  133. package/components/radios/example-radios-with-revealed-checkboxes.njk +69 -0
  134. package/components/radios/example-radios-with-revealed-radios.njk +68 -0
  135. package/components/radios/example-radios-with-revealed-select.njk +69 -0
  136. package/components/radios/example-radios-with-revealed-text-input.njk +80 -0
  137. package/components/radios/example-radios-with-separator.njk +59 -0
  138. package/components/radios/example-radios-with-visible-text-input.njk +40 -0
  139. package/components/radios/example-radios-without-border.njk +48 -0
  140. package/components/radios/examples-radios.njk +38 -0
  141. package/components/related-content/example-related-content-general.njk +44 -0
  142. package/components/related-content/example-related-content-multiple-rows-of-links.njk +51 -0
  143. package/components/related-content/example-related-content-social-media.njk +40 -0
  144. package/components/relationships/example-relationships-error.njk +211 -0
  145. package/components/relationships/example-relationships-you.njk +187 -0
  146. package/components/relationships/example-relationships.njk +185 -0
  147. package/components/search/example-search-with-character-check.njk +23 -0
  148. package/components/search/example-search-with-placeholder.njk +16 -0
  149. package/components/search/example-search.njk +16 -0
  150. package/components/section-navigation/example-section-navigation-vertical.njk +40 -0
  151. package/components/section-navigation/example-section-navigation.njk +21 -0
  152. package/components/select/example-select-wide.njk +55 -0
  153. package/components/select/example-select-with-error.njk +58 -0
  154. package/components/select/example-select-with-inline-label.njk +23 -0
  155. package/components/select/example-select.njk +50 -0
  156. package/components/share-page/example-share-page.njk +11 -0
  157. package/components/skip-to-content/example-skip-to-content.njk +10 -0
  158. package/components/status/example-status-dead.njk +7 -0
  159. package/components/status/example-status-error.njk +7 -0
  160. package/components/status/example-status-neutral-information.njk +6 -0
  161. package/components/status/example-status-pending.njk +7 -0
  162. package/components/status/example-status-small.njk +8 -0
  163. package/components/status/example-status-success.njk +7 -0
  164. package/components/summary/example-summary-grouped-total.njk +67 -0
  165. package/components/summary/example-summary-grouped-with-errors.njk +96 -0
  166. package/components/summary/example-summary-grouped.njk +353 -0
  167. package/components/summary/example-summary-household-no-rows.njk +20 -0
  168. package/components/summary/example-summary-household.njk +77 -0
  169. package/components/summary/example-summary-hub.njk +170 -0
  170. package/components/summary/example-summary-multiple.njk +81 -0
  171. package/components/summary/example-summary-no-action.njk +40 -0
  172. package/components/summary/example-summary.njk +107 -0
  173. package/components/table/_macro.njk +1 -1
  174. package/components/table/_table.scss +10 -10
  175. package/components/table/example-table-basic.njk +47 -0
  176. package/components/table/example-table-compact.njk +73 -0
  177. package/components/table/example-table-footer.njk +56 -0
  178. package/components/table/example-table-numeric.njk +81 -0
  179. package/components/table/example-table-responsive.njk +89 -0
  180. package/components/table/example-table-scrollable.njk +158 -0
  181. package/components/table/example-table-sortable.njk +236 -0
  182. package/components/table/sortable-table.dom.js +1 -1
  183. package/components/table/sortable-table.js +5 -2
  184. package/components/table-of-contents/example-table-of-contents-grouped.njk +50 -0
  185. package/components/table-of-contents/example-table-of-contents-single.njk +39 -0
  186. package/components/table-of-contents/example-table-of-contents-sticky.njk +78 -0
  187. package/components/tabs/example-tabs-details.njk +59 -0
  188. package/components/tabs/example-tabs.njk +39 -0
  189. package/components/textarea/example-textarea-error.njk +16 -0
  190. package/components/textarea/example-textarea-with-character-limit.njk +18 -0
  191. package/components/textarea/example-textarea.njk +12 -0
  192. package/components/timeline/example-timeline.njk +35 -0
  193. package/components/timeout-modal/example-timeout-modal.njk +16 -0
  194. package/components/timeout-panel/example-panel-with-timeout-warning.njk +13 -0
  195. package/components/upload/example-upload-error.njk +16 -0
  196. package/components/upload/example-upload.njk +12 -0
  197. package/components/video/example-video.njk +14 -0
  198. package/css/main.css +3 -3
  199. package/css/print.css +1 -1
  200. package/layout/_template.njk +1 -12
  201. package/package.json +3 -8
  202. package/scripts/main.es5.js +1 -1
  203. package/scripts/main.js +2 -2
  204. package/scss/base/_typography.scss +2 -2
  205. package/scss/main.scss +0 -1
  206. package/scss/print.scss +13 -5
  207. package/scss/utilities/_highlight.scss +6 -0
  208. package/scss/utilities/_index.scss +1 -0
  209. package/components/code-highlight/_macro.njk +0 -5
  210. package/components/code-highlight/_macro.spec.js +0 -56
  211. package/components/code-highlight/code-highlight.spec.js +0 -18
  212. package/scss/patternlib.scss +0 -148
@@ -0,0 +1,56 @@
1
+ {% from "components/table/_macro.njk" import onsTable %}
2
+ {{
3
+ onsTable({
4
+ "caption": "A basic table with a footer",
5
+ "ths": [
6
+ {
7
+ "value": "Column A"
8
+ },
9
+ {
10
+ "value": "Column B"
11
+ },
12
+ {
13
+ "value": "Column C"
14
+ }
15
+ ],
16
+ "trs": [
17
+ {
18
+ "tds": [
19
+ {
20
+ "value": "Cell A1"
21
+ },
22
+ {
23
+ "value": "Cell B1"
24
+ },
25
+ {
26
+ "value": "Cell C1"
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ "tds": [
32
+ {
33
+ "value": "Cell A2"
34
+ },
35
+ {
36
+ "value": "Cell B2"
37
+ },
38
+ {
39
+ "value": "Cell C2"
40
+ }
41
+ ]
42
+ }
43
+ ],
44
+ "tfoot": [
45
+ {
46
+ "value": "Column summary"
47
+ },
48
+ {
49
+ "value": "Column summary"
50
+ },
51
+ {
52
+ "value": "Column summary"
53
+ }
54
+ ]
55
+ })
56
+ }}
@@ -0,0 +1,81 @@
1
+ {% from "components/table/_macro.njk" import onsTable %}
2
+ {{
3
+ onsTable({
4
+ "caption": "A basic table with numeric values",
5
+ "ths": [
6
+ {
7
+ "value": "Country"
8
+ },
9
+ {
10
+ "value": "Population mid-2020",
11
+ "numeric": true
12
+ },
13
+ {
14
+ "value": "% change 2019 to 2020",
15
+ "numeric": true
16
+ }
17
+ ],
18
+ "trs": [
19
+ {
20
+ "tds": [
21
+ {
22
+ "value": "England"
23
+ },
24
+ {
25
+ "value": "67,081,000",
26
+ "numeric": true
27
+ },
28
+ {
29
+ "value": "0.43",
30
+ "numeric": true
31
+ }
32
+ ]
33
+ },
34
+ {
35
+ "tds": [
36
+ {
37
+ "value": "Northern Ireland"
38
+ },
39
+ {
40
+ "value": "1,896,000",
41
+ "numeric": true
42
+ },
43
+ {
44
+ "value": "0.10",
45
+ "numeric": true
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "tds": [
51
+ {
52
+ "value": "Scotland"
53
+ },
54
+ {
55
+ "value": "5,466,000",
56
+ "numeric": true
57
+ },
58
+ {
59
+ "value": "0.05",
60
+ "numeric": true
61
+ }
62
+ ]
63
+ },
64
+ {
65
+ "tds": [
66
+ {
67
+ "value": "Wales"
68
+ },
69
+ {
70
+ "value": "3,170,000",
71
+ "numeric": true
72
+ },
73
+ {
74
+ "value": "0.53",
75
+ "numeric": true
76
+ }
77
+ ]
78
+ }
79
+ ]
80
+ })
81
+ }}
@@ -0,0 +1,89 @@
1
+ {% from "components/table/_macro.njk" import onsTable %}
2
+ {{
3
+ onsTable({
4
+ "variants": 'responsive',
5
+ "caption": "Responsive table with stacked rows for small viewports",
6
+ "ths": [
7
+ {
8
+ "value": "Country"
9
+ },
10
+ {
11
+ "value": "Highest mountain"
12
+ },
13
+ {
14
+ "value": "Height in metres",
15
+ "numeric": true
16
+ }
17
+ ],
18
+ "trs": [
19
+ {
20
+ "tds": [
21
+ {
22
+ "value": "Scotland",
23
+ "data": "Country"
24
+ },
25
+ {
26
+ "value": "Ben Nevis",
27
+ "data": "Highest mountain"
28
+ },
29
+ {
30
+ "value": "1,345",
31
+ "data": "Height",
32
+ "numeric": true
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "tds": [
38
+ {
39
+ "value": "Wales",
40
+ "data": "Country"
41
+ },
42
+ {
43
+ "value": "Snowdon",
44
+ "data": "Highest mountain"
45
+ },
46
+ {
47
+ "value": "1,085",
48
+ "data": "Height",
49
+ "numeric": true
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "tds": [
55
+ {
56
+ "value": "England",
57
+ "data": "Country"
58
+ },
59
+ {
60
+ "value": "Scafell Pike",
61
+ "data": "Highest mountain"
62
+ },
63
+ {
64
+ "value": "978",
65
+ "data": "Height",
66
+ "numeric": true
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "tds": [
72
+ {
73
+ "value": "Northern Ireland",
74
+ "data": "Country"
75
+ },
76
+ {
77
+ "value": "Slieve Donard",
78
+ "data": "Highest mountain"
79
+ },
80
+ {
81
+ "value": "850",
82
+ "data": "Height",
83
+ "numeric": true
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ })
89
+ }}
@@ -0,0 +1,158 @@
1
+ {% from "components/table/_macro.njk" import onsTable %}
2
+ {{
3
+ onsTable({
4
+ "variants": 'scrollable',
5
+ "caption": "Scrollable table",
6
+ "ariaLabel": "There are 7 columns in this table. Some of the table may be off screen. Scroll or drag horizontally to bring into view.",
7
+ "ths": [
8
+ {
9
+ "value": "ID"
10
+ },
11
+ {
12
+ "value": "Title"
13
+ },
14
+ {
15
+ "value": "Abbreviation"
16
+ },
17
+ {
18
+ "value": "Legal basis"
19
+ },
20
+ {
21
+ "value": "Frequency"
22
+ },
23
+ {
24
+ "value": "Date"
25
+ },
26
+ {
27
+ "value": "Status"
28
+ }
29
+ ],
30
+ "trs": [
31
+ {
32
+ "tds": [
33
+ {
34
+ "value": "023"
35
+ },
36
+ {
37
+ "value": "Monthly Business Survey - Retail Sales Index"
38
+ },
39
+ {
40
+ "value": "RSI"
41
+ },
42
+ {
43
+ "value": "Statistics of Trade Act 1947"
44
+ },
45
+ {
46
+ "value": "Monthly"
47
+ },
48
+ {
49
+ "value": "20 Jan 2018"
50
+ },
51
+ {
52
+ "value": "<span class='ons-status ons-status--success'>Ready</span>"
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "tds": [
58
+ {
59
+ "value": "112"
60
+ },
61
+ {
62
+ "value": "Annual Inward Foreign Direct Investment Survey"
63
+ },
64
+ {
65
+ "value": "AIFDI"
66
+ },
67
+ {
68
+ "value": "Statistics of Trade Act 1947"
69
+ },
70
+ {
71
+ "value": "Annually"
72
+ },
73
+ {
74
+ "value": "26 Feb 2018"
75
+ },
76
+ {
77
+ "value": "<span class='ons-status ons-status--dead'>Not ready</span>"
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "tds": [
83
+ {
84
+ "value": "332"
85
+ },
86
+ {
87
+ "value": "Business Register and Employment Survey"
88
+ },
89
+ {
90
+ "value": "BRES"
91
+ },
92
+ {
93
+ "value": "Statistics of Trade Act 1947"
94
+ },
95
+ {
96
+ "value": "Annually"
97
+ },
98
+ {
99
+ "value": "23 Jan 2013"
100
+ },
101
+ {
102
+ "value": "<span class='ons-status ons-status--info'>In progress</span>"
103
+ }
104
+ ]
105
+ },
106
+ {
107
+ "tds": [
108
+ {
109
+ "value": "654"
110
+ },
111
+ {
112
+ "value": "Quartely Survey of Building Materials Sand and Gravel"
113
+ },
114
+ {
115
+ "value": "QBMS"
116
+ },
117
+ {
118
+ "value": "Statistics of Trade Act 1947 - BEIS"
119
+ },
120
+ {
121
+ "value": "Quartely"
122
+ },
123
+ {
124
+ "value": "24 Jan 2015"
125
+ },
126
+ {
127
+ "value": "<span class='ons-status ons-status--error'>Issue</span>"
128
+ }
129
+ ]
130
+ },
131
+ {
132
+ "tds": [
133
+ {
134
+ "value": "765"
135
+ },
136
+ {
137
+ "value": "Monthly Survey of Building Materials Concrete Building Blocks"
138
+ },
139
+ {
140
+ "value": "MSBB"
141
+ },
142
+ {
143
+ "value": "Voluntary"
144
+ },
145
+ {
146
+ "value": "Monthly"
147
+ },
148
+ {
149
+ "value": "25 Jan 2014"
150
+ },
151
+ {
152
+ "value": "<span class='ons-status ons-status--success'>Ready</span>"
153
+ }
154
+ ]
155
+ }
156
+ ]
157
+ })
158
+ }}
@@ -0,0 +1,236 @@
1
+ {% from "components/table/_macro.njk" import onsTable %}
2
+
3
+ {{
4
+ onsTable({
5
+ "variants": 'sortable',
6
+ "caption": "Javascript enhanced sortable table",
7
+ "sortBy": "Sort by",
8
+ "ariaAsc": "ascending",
9
+ "ariaDesc": "descending",
10
+ "ths": [
11
+ {
12
+ "value": "ID"
13
+ },
14
+ {
15
+ "value": "Title"
16
+ },
17
+ {
18
+ "value": "Abbreviation"
19
+ },
20
+ {
21
+ "value": "Legal basis"
22
+ },
23
+ {
24
+ "value": "Frequency"
25
+ },
26
+ {
27
+ "value": "Date"
28
+ },
29
+ {
30
+ "value": "Status"
31
+ }
32
+ ],
33
+ "trs": [
34
+ {
35
+ "tds": [
36
+ {
37
+ "value": "023"
38
+ },
39
+ {
40
+ "value": "Monthly Business Survey - Retail Sales Index"
41
+ },
42
+ {
43
+ "value": "RSI"
44
+ },
45
+ {
46
+ "value": "Statistics of Trade Act 1947"
47
+ },
48
+ {
49
+ "value": "Monthly",
50
+ "dataSort": "1"
51
+ },
52
+ {
53
+ "value": "20 Jan 2018",
54
+ "dataSort": "2018-01-20"
55
+ },
56
+ {
57
+ "value": "<span class='ons-status ons-status--success'>Ready</span>",
58
+ "dataSort": "0"
59
+ },
60
+ {
61
+ "form": {
62
+ "method": "Get",
63
+ "action": "#",
64
+ "button": {
65
+ "type": "button",
66
+ "text": "View details",
67
+ "variants": ["small", "secondary"],
68
+ "url": "#0"
69
+ }
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "tds": [
76
+ {
77
+ "value": "112"
78
+ },
79
+ {
80
+ "value": "Annual Inward Foreign Direct Investment Survey"
81
+ },
82
+ {
83
+ "value": "AIFDI"
84
+ },
85
+ {
86
+ "value": "Statistics of Trade Act 1947"
87
+ },
88
+ {
89
+ "value": "Annually",
90
+ "dataSort": "12"
91
+ },
92
+ {
93
+ "value": "26 Feb 2018",
94
+ "dataSort": "2018-02-26"
95
+ },
96
+ {
97
+ "value": "<span class='ons-status ons-status--dead'>Not ready</span>",
98
+ "dataSort": "1"
99
+ },
100
+ {
101
+ "form": {
102
+ "method": "Get",
103
+ "action": "#",
104
+ "button": {
105
+ "type": "button",
106
+ "text": "View details",
107
+ "variants": ["small", "secondary"],
108
+ "url": "#0"
109
+ }
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "tds": [
116
+ {
117
+ "value": "332"
118
+ },
119
+ {
120
+ "value": "Business Register and Employment Survey"
121
+ },
122
+ {
123
+ "value": "BRES"
124
+ },
125
+ {
126
+ "value": "Statistics of Trade Act 1947"
127
+ },
128
+ {
129
+ "value": "Annually",
130
+ "dataSort": "12"
131
+ },
132
+ {
133
+ "value": "23 Jan 2013",
134
+ "dataSort": "2013-01-23"
135
+ },
136
+ {
137
+ "value": "<span class='ons-status ons-status--info'>In progress</span>",
138
+ "dataSort": "2"
139
+ },
140
+ {
141
+ "form": {
142
+ "method": "Get",
143
+ "action": "#",
144
+ "button": {
145
+ "type": "button",
146
+ "text": "View details",
147
+ "variants": ["small", "secondary"],
148
+ "url": "#0"
149
+ }
150
+ }
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "tds": [
156
+ {
157
+ "value": "654"
158
+ },
159
+ {
160
+ "value": "Quartely Survey of Building Materials Sand and Gravel"
161
+ },
162
+ {
163
+ "value": "QBMS"
164
+ },
165
+ {
166
+ "value": "Statistics of Trade Act 1947 - BEIS"
167
+ },
168
+ {
169
+ "value": "Quartely",
170
+ "dataSort": "3"
171
+ },
172
+ {
173
+ "value": "24 Jan 2015",
174
+ "dataSort": "2015-01-24"
175
+ },
176
+ {
177
+ "value": "<span class='ons-status ons-status--error'>Issue</span>",
178
+ "dataSort": "3"
179
+ },
180
+ {
181
+ "form": {
182
+ "method": "Get",
183
+ "action": "#",
184
+ "button": {
185
+ "type": "button",
186
+ "text": "View details",
187
+ "variants": ["small", "secondary"],
188
+ "url": "#0"
189
+ }
190
+ }
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ "tds": [
196
+ {
197
+ "value": "765"
198
+ },
199
+ {
200
+ "value": "Monthly Survey of Building Materials Concrete Building Blocks"
201
+ },
202
+ {
203
+ "value": "MSBB"
204
+ },
205
+ {
206
+ "value": "Voluntary"
207
+ },
208
+ {
209
+ "value": "Monthly",
210
+ "dataSort": "1"
211
+ },
212
+ {
213
+ "value": "25 Jan 2014",
214
+ "dataSort": "2014-01-25"
215
+ },
216
+ {
217
+ "value": "<span class='ons-status ons-status--success'>Ready</span>",
218
+ "dataSort": "0"
219
+ },
220
+ {
221
+ "form": {
222
+ "method": "Get",
223
+ "action": "#",
224
+ "button": {
225
+ "type": "button",
226
+ "text": "View details",
227
+ "variants": ["small", "secondary"],
228
+ "url": "#0"
229
+ }
230
+ }
231
+ }
232
+ ]
233
+ }
234
+ ]
235
+ })
236
+ }}
@@ -8,7 +8,7 @@ async function tableSorter() {
8
8
  if (tables.length) {
9
9
  const TableSort = (await import('./sortable-table')).default;
10
10
 
11
- tables.forEach(table => new TableSort(table));
11
+ tables.forEach((table, index) => new TableSort(table, index));
12
12
  }
13
13
  }
14
14
 
@@ -3,12 +3,13 @@ export const classTableBody = 'ons-table__body';
3
3
  export let status;
4
4
 
5
5
  export default class TableSort {
6
- constructor(table) {
6
+ constructor(table, index) {
7
7
  this.table = table;
8
8
  this.options = {};
9
9
  this.options.statusMessage = table.getAttribute('data-aria-sort');
10
10
  this.options.ascendingText = table.getAttribute('data-aria-asc');
11
11
  this.options.descendingText = table.getAttribute('data-aria-desc');
12
+ this.index = index;
12
13
  this.init();
13
14
  }
14
15
 
@@ -35,7 +36,9 @@ export default class TableSort {
35
36
  button.setAttribute('data-index', i);
36
37
  button.setAttribute('class', 'ons-table__sort-button');
37
38
  button.textContent = text;
38
- let sortSprite = document.getElementById('sort-sprite-' + text.toLowerCase());
39
+ const sortSpriteIdText = text.replace(/\s+/g, '-').toLowerCase();
40
+ const sortSprite = document.getElementById('sort-sprite-' + sortSpriteIdText);
41
+ sortSprite.id = 'sort-sprite-' + sortSpriteIdText + '-' + this.index;
39
42
  const sortSpriteParent = sortSprite.parentNode;
40
43
  sortSpriteParent.replaceChild(button, sortSprite);
41
44
  button.appendChild(sortSprite);