@ons/design-system 70.0.17 → 72.0.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 (204) hide show
  1. package/components/access-code/_macro.njk +4 -4
  2. package/components/access-code/_macro.spec.js +8 -8
  3. package/components/access-code/example-access-code-error.njk +2 -2
  4. package/components/access-code/example-access-code.njk +2 -2
  5. package/components/accordion/_macro.njk +1 -1
  6. package/components/accordion/_macro.spec.js +1 -1
  7. package/components/address-input/_macro.njk +7 -7
  8. package/components/address-input/_macro.spec.js +16 -15
  9. package/components/address-input/autosuggest.address.error.js +1 -1
  10. package/components/address-input/autosuggest.address.js +25 -25
  11. package/components/address-input/autosuggest.address.spec.js +6 -5
  12. package/components/address-input/example-address-input-editable.njk +5 -4
  13. package/components/address-input/example-address-input.njk +4 -5
  14. package/components/autosuggest/_autosuggest.scss +8 -8
  15. package/components/autosuggest/_macro.njk +5 -5
  16. package/components/autosuggest/autosuggest.spec.js +1 -1
  17. package/components/back-to-top/_back-to-top.scss +2 -2
  18. package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
  19. package/components/breadcrumbs/_breadcrumbs.scss +1 -1
  20. package/components/button/_button.scss +24 -16
  21. package/components/button/_macro.njk +3 -3
  22. package/components/button/example-button-custom.njk +1 -1
  23. package/components/card/_card.scss +0 -6
  24. package/components/card/_macro.njk +9 -9
  25. package/components/card/_macro.spec.js +57 -24
  26. package/components/card/example-card-set-with-images.njk +30 -18
  27. package/components/card/example-card-set-with-lists.njk +57 -45
  28. package/components/card/example-card-set.njk +27 -15
  29. package/components/card/example-card.njk +9 -5
  30. package/components/char-check-limit/_macro.njk +1 -1
  31. package/components/checkboxes/_checkbox.scss +4 -4
  32. package/components/checkboxes/_checkboxes.scss +1 -1
  33. package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
  34. package/components/cookies-banner/_cookies-banner.scss +5 -5
  35. package/components/cookies-banner/_macro.njk +15 -13
  36. package/components/cookies-banner/_macro.spec.js +1 -1
  37. package/components/details/_details.scss +5 -6
  38. package/components/details/_macro.njk +4 -4
  39. package/components/details/_macro.spec.js +1 -1
  40. package/components/document-list/_document-list.scss +0 -2
  41. package/components/document-list/_macro.njk +18 -18
  42. package/components/document-list/_macro.spec.js +16 -14
  43. package/components/document-list/example-document-list-article-featured.njk +5 -3
  44. package/components/document-list/example-document-list-articles.njk +15 -9
  45. package/components/document-list/example-document-list-downloads.njk +15 -9
  46. package/components/document-list/example-document-list-search-result-featured.njk +5 -3
  47. package/components/document-list/example-document-list-search-results.njk +20 -12
  48. package/components/download-resources/_download-resources.scss +1 -2
  49. package/components/download-resources/download-resources.spec.js +12 -6
  50. package/components/external-link/_macro.njk +1 -1
  51. package/components/external-link/_macro.spec.js +1 -1
  52. package/components/external-link/example-external-link.njk +1 -1
  53. package/components/feedback/_macro.njk +1 -1
  54. package/components/feedback/_macro.spec.js +3 -3
  55. package/components/feedback/example-feedback-call-to-action.njk +1 -1
  56. package/components/field/_field-group.scss +0 -2
  57. package/components/field/_field.scss +1 -2
  58. package/components/fieldset/_fieldset.scss +2 -2
  59. package/components/fieldset/_macro.njk +1 -1
  60. package/components/fieldset/_macro.spec.js +1 -1
  61. package/components/footer/_footer.scss +12 -7
  62. package/components/footer/_macro.njk +54 -34
  63. package/components/footer/_macro.spec.js +90 -28
  64. package/components/footer/example-footer-cymraeg.njk +1 -1
  65. package/components/footer/example-footer-transactional.njk +1 -1
  66. package/components/footer/example-footer-warning.njk +1 -1
  67. package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
  68. package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
  69. package/components/footer/example-footer-with-copyright.njk +1 -1
  70. package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
  71. package/components/footer/example-footer-with-multiple-logos.njk +172 -0
  72. package/components/footer/example-footer.njk +1 -1
  73. package/components/header/_header.scss +7 -14
  74. package/components/header/_macro.njk +19 -19
  75. package/components/header/_macro.spec.js +17 -17
  76. package/components/header/example-header-external-for-surveys.njk +2 -2
  77. package/components/header/example-header-external-welsh.njk +2 -2
  78. package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
  79. package/components/header/example-header-external-with-sub-navigation.njk +1 -1
  80. package/components/header/example-header-multiple-logos.njk +4 -4
  81. package/components/hero/_hero.scss +6 -8
  82. package/components/hero/_macro.njk +1 -1
  83. package/components/icon/_icon.scss +4 -4
  84. package/components/icon/_macro.njk +4 -4
  85. package/components/icon/_macro.spec.js +2 -2
  86. package/components/image/_image.scss +1 -1
  87. package/components/image/_macro.njk +1 -1
  88. package/components/image/_macro.spec.js +10 -10
  89. package/components/image/example-image-for-regular-screens.njk +1 -1
  90. package/components/input/_input-type.scss +0 -2
  91. package/components/input/_input.scss +10 -10
  92. package/components/input/_macro.njk +4 -2
  93. package/components/input/example-input-search-with-character-check.njk +1 -1
  94. package/components/input/example-input-search.njk +1 -1
  95. package/components/label/_label.scss +1 -3
  96. package/components/language-selector/_macro.njk +3 -3
  97. package/components/language-selector/_macro.spec.js +7 -7
  98. package/components/list/_list.scss +1 -5
  99. package/components/list/_macro.njk +9 -10
  100. package/components/list/_macro.spec.js +50 -9
  101. package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
  102. package/components/message/_macro.njk +3 -3
  103. package/components/message/_macro.spec.js +3 -3
  104. package/components/message-list/_macro.njk +2 -2
  105. package/components/message-list/_macro.spec.js +8 -4
  106. package/components/message-list/_message-list.scss +2 -2
  107. package/components/navigation/_macro.njk +9 -9
  108. package/components/navigation/_macro.spec.js +2 -2
  109. package/components/navigation/_navigation.scss +2 -6
  110. package/components/navigation/navigation.dom.js +1 -1
  111. package/components/navigation/navigation.spec.js +4 -4
  112. package/components/pagination/_macro.njk +2 -2
  113. package/components/pagination/_pagination.scss +1 -7
  114. package/components/panel/_macro.njk +5 -4
  115. package/components/panel/_macro.spec.js +2 -2
  116. package/components/panel/_panel.scss +12 -8
  117. package/components/password/_macro.njk +1 -1
  118. package/components/password/_macro.spec.js +2 -2
  119. package/components/phase-banner/_macro.njk +1 -1
  120. package/components/phase-banner/_phase-banner.scss +3 -4
  121. package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
  122. package/components/phase-banner/example-phase-banner-beta.njk +1 -1
  123. package/components/question/_macro.njk +8 -8
  124. package/components/question/_macro.spec.js +3 -3
  125. package/components/question/_question.scss +3 -3
  126. package/components/radios/_macro.njk +1 -1
  127. package/components/radios/_macro.spec.js +1 -1
  128. package/components/radios/_radios.scss +1 -1
  129. package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
  130. package/components/radios/example-radios-with-clear-button.njk +1 -1
  131. package/components/related-content/_macro.spec.js +2 -2
  132. package/components/related-content/_related-content.scss +1 -1
  133. package/components/related-content/example-related-content-general.njk +2 -2
  134. package/components/related-content/example-related-content-social-media.njk +1 -1
  135. package/components/reply/_macro.njk +3 -1
  136. package/components/reply/_macro.spec.js +1 -1
  137. package/components/reply/reply.spec.js +1 -1
  138. package/components/section-navigation/_macro.njk +10 -10
  139. package/components/section-navigation/_macro.spec.js +15 -15
  140. package/components/section-navigation/_section-navigation.scss +3 -8
  141. package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
  142. package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
  143. package/components/section-navigation/example-section-navigation.njk +3 -3
  144. package/components/select/example-select-with-inline-label.njk +1 -1
  145. package/components/share-page/_macro.njk +7 -7
  146. package/components/share-page/_macro.spec.js +2 -2
  147. package/components/share-page/example-share-page.njk +1 -1
  148. package/components/status/_status.scss +1 -1
  149. package/components/summary/_macro.njk +33 -33
  150. package/components/summary/_macro.spec.js +34 -34
  151. package/components/summary/_summary.scss +2 -4
  152. package/components/summary/example-summary-card-grouped.njk +34 -34
  153. package/components/summary/example-summary-grouped-total.njk +7 -7
  154. package/components/summary/example-summary-grouped-with-errors.njk +9 -9
  155. package/components/summary/example-summary-grouped.njk +34 -34
  156. package/components/summary/example-summary-household.njk +7 -7
  157. package/components/summary/example-summary-hub-minimal.njk +8 -8
  158. package/components/summary/example-summary-hub.njk +16 -16
  159. package/components/summary/example-summary-multiple.njk +7 -7
  160. package/components/summary/example-summary-no-action.njk +5 -5
  161. package/components/summary/example-summary.njk +9 -9
  162. package/components/table/_table.scss +2 -3
  163. package/components/table-of-contents/_macro.njk +3 -3
  164. package/components/table-of-contents/_macro.spec.js +3 -3
  165. package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
  166. package/components/tabs/_macro.njk +3 -3
  167. package/components/tabs/_macro.spec.js +3 -3
  168. package/components/tabs/_tabs.scss +3 -4
  169. package/components/tabs/example-tabs-details.njk +1 -1
  170. package/components/text-indent/_text-indent.scss +1 -1
  171. package/components/timeline/_macro.njk +4 -4
  172. package/components/timeline/_macro.spec.js +3 -3
  173. package/components/timeline/_timeline.scss +4 -3
  174. package/components/timeline/example-timeline.njk +1 -1
  175. package/components/upload/_upload.scss +2 -2
  176. package/components/video/_macro.njk +4 -4
  177. package/components/video/_macro.spec.js +2 -2
  178. package/components/video/_video.scss +1 -1
  179. package/components/video/example-video.njk +2 -2
  180. package/components/video/video.spec.js +2 -2
  181. package/css/main.css +1 -1
  182. package/layout/_dsTemplate.njk +1 -1
  183. package/layout/_template.njk +31 -31
  184. package/package.json +1 -1
  185. package/scripts/main.es5.js +1 -1
  186. package/scripts/main.js +1 -1
  187. package/scss/base/_global.scss +2 -0
  188. package/scss/base/_typography.scss +0 -2
  189. package/scss/main.scss +0 -1
  190. package/scss/objects/_container.scss +1 -1
  191. package/scss/objects/_page.scss +2 -3
  192. package/scss/overrides/rtl.scss +1 -1
  193. package/scss/utilities/_grid.scss +103 -96
  194. package/scss/utilities/_margin.scss +11 -5
  195. package/scss/utilities/_padding.scss +12 -5
  196. package/scss/utilities/_typography.scss +2 -1
  197. package/scss/vars/_forms.scss +8 -10
  198. package/scss/vars/_grid.scss +4 -4
  199. package/scss/vars/_typography.scss +26 -19
  200. package/components/call-to-action/_call-to-action.scss +0 -8
  201. package/components/call-to-action/_macro.njk +0 -24
  202. package/components/call-to-action/_macro.spec.js +0 -48
  203. package/components/call-to-action/example-call-to-action-default.njk +0 -15
  204. package/components/metadata/_macro.njk +0 -14
@@ -7,9 +7,8 @@ $button-shadow-size: 3px;
7
7
  cursor: pointer;
8
8
  display: inline-block;
9
9
  font-family: inherit;
10
- font-size: 1rem;
11
- font-weight: $font-weight-bold;
12
- line-height: 1.35;
10
+ @extend .ons-u-fs-r--b;
11
+
13
12
  margin: 0;
14
13
  padding: 0;
15
14
  position: relative;
@@ -38,19 +37,17 @@ $button-shadow-size: 3px;
38
37
  &__inner {
39
38
  background: var(--ons-color-button);
40
39
  border-radius: $input-radius;
41
- box-shadow: 0 ems($button-shadow-size) 0 var(--ons-color-button-shadow);
40
+ box-shadow: 0 rems($button-shadow-size) 0 var(--ons-color-button-shadow);
42
41
  color: var(--ons-color-text-inverse);
43
- display: inherit;
44
- padding: 0.7em 1em 0.8em;
42
+ display: flex;
43
+ align-items: center;
44
+ padding: 0.75rem 1rem;
45
45
  // Required for Google Tag Manager
46
46
  pointer-events: none;
47
47
  position: relative;
48
-
49
48
  .ons-icon {
50
49
  fill: var(--ons-color-text-inverse);
51
50
  height: 18px;
52
- margin-top: -$button-shadow-size;
53
- vertical-align: middle;
54
51
  width: 18px;
55
52
  }
56
53
  }
@@ -106,12 +103,12 @@ $button-shadow-size: 3px;
106
103
  // Small buttons
107
104
  &--small,
108
105
  &--mobile {
109
- font-size: 0.9rem;
106
+ line-height: 1.25rem !important;
110
107
  }
111
108
 
112
109
  &--small & {
113
110
  &__inner {
114
- padding: 0.5em 0.7em;
111
+ padding: 0.5rem 0.75rem;
115
112
  .ons-icon {
116
113
  height: 16px;
117
114
  width: 16px;
@@ -122,7 +119,7 @@ $button-shadow-size: 3px;
122
119
  &--small.ons-btn--ghost &,
123
120
  &--mobile & {
124
121
  &__inner {
125
- padding: 0.5em 0.7em;
122
+ padding: 0.5rem 0.75rem;
126
123
  }
127
124
  }
128
125
 
@@ -391,6 +388,9 @@ $button-shadow-size: 3px;
391
388
  transition: opacity 0.3s ease-in-out;
392
389
  width: 27px;
393
390
  }
391
+ .ons-btn__text {
392
+ margin-left: 0;
393
+ }
394
394
  }
395
395
  }
396
396
 
@@ -405,7 +405,8 @@ $button-shadow-size: 3px;
405
405
  &__inner {
406
406
  color: transparent;
407
407
  .ons-icon {
408
- margin-left: 0 !important;
408
+ @extend .ons-u-ml-no;
409
+
409
410
  opacity: 1;
410
411
  }
411
412
  }
@@ -482,7 +483,6 @@ $button-shadow-size: 3px;
482
483
  box-shadow: none;
483
484
  color: var(--ons-color-branded-text);
484
485
  display: block;
485
- font-size: 1rem;
486
486
  font-weight: $font-weight-regular;
487
487
  padding: 0.6rem 1rem;
488
488
  text-align: left;
@@ -490,7 +490,7 @@ $button-shadow-size: 3px;
490
490
  .ons-icon {
491
491
  fill: var(--ons-color-branded-text);
492
492
  float: right;
493
- margin-top: 3px;
493
+ margin-top: 0.25rem;
494
494
  }
495
495
  }
496
496
  }
@@ -552,8 +552,16 @@ $button-shadow-size: 3px;
552
552
  }
553
553
  }
554
554
 
555
+ .ons-search__btn {
556
+ height: 92.5%; //this is to allow the button to be fully aligned with the input by accounting for the shadow box of 3px
557
+ .ons-btn__inner:has(> .ons-icon) {
558
+ padding-right: 0.75rem;
559
+ height: 100%;
560
+ }
561
+ }
562
+
555
563
  .ons-btn-group {
556
- @extend .ons-u-mb-m;
564
+ @extend .ons-u-mb-l;
557
565
 
558
566
  align-items: baseline;
559
567
  display: flex;
@@ -86,7 +86,7 @@
86
86
  {{-
87
87
  onsIcon({
88
88
  "iconType": iconType,
89
- "classes": 'ons-u-mr-xs'
89
+ "classes": 'ons-u-mr-2xs'
90
90
  })
91
91
  -}}
92
92
  {%- endif -%}
@@ -95,7 +95,7 @@
95
95
  {{-
96
96
  onsIcon({
97
97
  "iconType": iconType,
98
- "classes": 'ons-u-ml-xs'
98
+ "classes": 'ons-u-ml-2xs'
99
99
  })
100
100
  -}}
101
101
  {%- endif -%}
@@ -105,7 +105,7 @@
105
105
  "iconType": iconType
106
106
  })
107
107
  -}}
108
- <span class="ons-btn__text ons-u-vh@xxs@s">{{- params.html | safe if params.html else params.text -}}</span>
108
+ <span class="ons-btn__text ons-u-vh@2xs@s">{{- params.html | safe if params.html else params.text -}}</span>
109
109
  {%- else -%}
110
110
  <span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
111
111
  {%- endif -%}
@@ -1,6 +1,6 @@
1
1
  {% from "components/button/_macro.njk" import onsButton %}
2
2
 
3
- <div class="ons-u-mb-m">
3
+ <div class="ons-u-mb-l">
4
4
  {{
5
5
  onsButton({
6
6
  "type": 'button',
@@ -17,12 +17,6 @@
17
17
  text-decoration-thickness: 3px;
18
18
  }
19
19
 
20
- &__title {
21
- // This is to allow the focus state for multi lined title links to render the focus style correctly.
22
- // This should be corrected when the typography scale is improved.
23
- line-height: 1.65 !important;
24
- }
25
-
26
20
  @include mq(m) {
27
21
  margin: 0;
28
22
  .ons-grid__col & {
@@ -1,11 +1,11 @@
1
1
  {%- macro onsCard(params) -%}
2
- {% set headingLevel = params.headingLevel | default(2) | string %}
2
+ {% set headingLevel = params.title.headingLevel | default(2) | string %}
3
3
  {% set openingHeadingTag = "<h" + headingLevel %}
4
4
  {% set closingHeadingTag = "</h" + headingLevel + ">" %}
5
- {% set placeholderSrcset = (params.image.placeholderURL if params.image.placeholderURL else "") + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderURL if params.image.placeholderURL else "") + "/img/large/placeholder-card.png 2x" %}
5
+ {% set placeholderSrcset = (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderUrl if params.image.placeholderUrl else "") + "/img/large/placeholder-card.png 2x" %}
6
6
 
7
7
  <div class="ons-card">
8
- <a href="{{ params.url }}" class="ons-card__link">
8
+ <a href="{{ params.title.url }}" class="ons-card__link">
9
9
  {%- if params.image -%}
10
10
  {% if params.image.smallSrc %}
11
11
  <img
@@ -17,31 +17,31 @@
17
17
  alt="{{ params.image.alt }}"
18
18
  loading="lazy"
19
19
  />
20
- {% elif params.image == true or params.image.placeholderURL %}
20
+ {% elif params.image == true or params.image.placeholderUrl %}
21
21
  <img
22
22
  class="ons-card__image ons-u-mb-s "
23
23
  height="100"
24
24
  width="303"
25
25
  srcset="{{ placeholderSrcset }}"
26
- src="{{- params.image.placeholderURL if params.image.placeholderURL -}}/img/small/placeholder-card.png"
26
+ src="{{- params.image.placeholderUrl if params.image.placeholderUrl -}}/img/small/placeholder-card.png"
27
27
  alt=""
28
28
  loading="lazy"
29
29
  />
30
30
  {% endif %}
31
31
  {%- endif -%}
32
32
  {{ openingHeadingTag | safe }}
33
- class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m') }}" id="{{ params.id }}"> {{ params.title }}
33
+ class="ons-card__title {{ params.title.classes | default('ons-u-fs-m') }}" id="{{ params.title.id }}"> {{ params.title.text }}
34
34
  {{ closingHeadingTag | safe }}
35
35
  </a>
36
36
 
37
- <p id="{{ params.textId }}">{{ params.text }}</p>
37
+ <p id="{{ params.body.id }}">{{ params.body.text }}</p>
38
38
 
39
- {%- if params.itemsList -%}
39
+ {%- if params.body.itemsList -%}
40
40
  {% from "components/list/_macro.njk" import onsList %}
41
41
  {{
42
42
  onsList({
43
43
  "variants": 'dashed',
44
- "itemsList": params.itemsList
44
+ "itemsList": params.body.itemsList
45
45
  })
46
46
  }}
47
47
  {% endif %}
@@ -6,15 +6,17 @@ import axe from '../../tests/helpers/axe';
6
6
  import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
7
7
 
8
8
  const EXAMPLE_CARD_WITHOUT_IMAGE = {
9
- title: 'Example card title',
10
- text: 'Example card text.',
11
- textId: 'example-text-id',
9
+ title: {
10
+ text: 'Example card title',
11
+ },
12
+ body: {
13
+ text: 'Example card text.',
14
+ id: 'example-text-id',
15
+ },
12
16
  };
13
17
 
14
18
  const EXAMPLE_CARD_WITH_IMAGE = {
15
- title: 'Example card title',
16
- text: 'Example card text.',
17
- textId: 'example-text-id',
19
+ ...EXAMPLE_CARD_WITHOUT_IMAGE,
18
20
  image: {
19
21
  smallSrc: 'example-small.png',
20
22
  largeSrc: 'example-large.png',
@@ -23,18 +25,14 @@ const EXAMPLE_CARD_WITH_IMAGE = {
23
25
  };
24
26
 
25
27
  const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE = {
26
- title: 'Example card title',
27
- text: 'Example card text.',
28
- textId: 'example-text-id',
28
+ ...EXAMPLE_CARD_WITHOUT_IMAGE,
29
29
  image: true,
30
30
  };
31
31
 
32
32
  const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH = {
33
- title: 'Example card title',
34
- text: 'Example card text.',
35
- textId: 'example-text-id',
33
+ ...EXAMPLE_CARD_WITHOUT_IMAGE,
36
34
  image: {
37
- placeholderURL: '/placeholder-image-url',
35
+ placeholderUrl: '/placeholder-image-url',
38
36
  },
39
37
  };
40
38
 
@@ -59,8 +57,14 @@ describe('macro: card', () => {
59
57
  ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
60
58
  const $ = cheerio.load(
61
59
  renderComponent('card', {
62
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
63
- headingLevel,
60
+ title: {
61
+ text: 'Example card title',
62
+ headingLevel: headingLevel,
63
+ },
64
+ body: {
65
+ text: 'Example card text.',
66
+ id: 'example-text-id',
67
+ },
64
68
  }),
65
69
  );
66
70
 
@@ -78,8 +82,14 @@ describe('macro: card', () => {
78
82
  const listsSpy = faker.spy('list');
79
83
 
80
84
  faker.renderComponent('card', {
81
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
82
- itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
85
+ title: {
86
+ text: 'Example card title',
87
+ },
88
+ body: {
89
+ text: 'Example card text.',
90
+ id: 'example-text-id',
91
+ itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }],
92
+ },
83
93
  });
84
94
 
85
95
  expect(listsSpy.occurrences[0]).toEqual({
@@ -91,8 +101,14 @@ describe('macro: card', () => {
91
101
  it('outputs a hyperlink with the provided `url`', () => {
92
102
  const $ = cheerio.load(
93
103
  renderComponent('card', {
94
- ...EXAMPLE_CARD_WITHOUT_IMAGE,
95
- url: 'https://example.com',
104
+ title: {
105
+ text: 'Example card title',
106
+ url: 'https://example.com',
107
+ },
108
+ body: {
109
+ text: 'Example card text.',
110
+ id: 'example-text-id',
111
+ },
96
112
  }),
97
113
  );
98
114
 
@@ -120,8 +136,19 @@ describe('macro: card', () => {
120
136
  ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
121
137
  const $ = cheerio.load(
122
138
  renderComponent('card', {
123
- ...EXAMPLE_CARD_WITH_IMAGE,
124
- headingLevel,
139
+ title: {
140
+ text: 'Example card title',
141
+ headingLevel: headingLevel,
142
+ },
143
+ body: {
144
+ text: 'Example card text.',
145
+ id: 'example-text-id',
146
+ },
147
+ image: {
148
+ smallSrc: 'example-small.png',
149
+ largeSrc: 'example-large.png',
150
+ alt: 'Example alt text',
151
+ },
125
152
  }),
126
153
  );
127
154
 
@@ -141,8 +168,14 @@ describe('macro: card', () => {
141
168
  it('outputs a hyperlink with the provided `url`', () => {
142
169
  const $ = cheerio.load(
143
170
  renderComponent('card', {
144
- ...EXAMPLE_CARD_WITH_IMAGE,
145
- url: 'https://example.com',
171
+ title: {
172
+ text: 'Example card title',
173
+ url: 'https://example.com',
174
+ },
175
+ body: {
176
+ text: 'Example card text.',
177
+ id: 'example-text-id',
178
+ },
146
179
  }),
147
180
  );
148
181
 
@@ -206,7 +239,7 @@ describe('macro: card', () => {
206
239
  });
207
240
  });
208
241
 
209
- describe('with a default placeholder image with `placeholderURL`', () => {
242
+ describe('with a default placeholder image with `placeholderUrl`', () => {
210
243
  it('outputs an `img` element', () => {
211
244
  const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH));
212
245
 
@@ -4,12 +4,16 @@
4
4
  <div class="ons-grid__col ons-col-4@m">
5
5
  {{
6
6
  onsCard({
7
- "id": 'card-with-image-1',
8
- "textId": 'text1',
9
- "title": 'About the census',
10
- "url": '#0',
11
- "text": 'The census is a survey that gives us information about all the households in England and Wales.',
12
- "image": true
7
+ "image": true,
8
+ "title": {
9
+ "id": 'card-with-image-1',
10
+ "text": 'About the census',
11
+ "url": '#0'
12
+ },
13
+ "body":{
14
+ "text": 'The census is a survey that gives us information about all the households in England and Wales.',
15
+ "id": 'text1'
16
+ }
13
17
  })
14
18
  }}
15
19
  </div>
@@ -17,12 +21,16 @@
17
21
  <div class="ons-grid__col ons-col-4@m">
18
22
  {{
19
23
  onsCard({
20
- "id": 'card-with-image-2',
21
- "textId": 'text2',
22
- "title": 'Working on the census',
23
- "url": '#0',
24
- "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.',
25
- "image": true
24
+ "image": true,
25
+ "title": {
26
+ "id": 'card-with-image-2',
27
+ "text": 'Working on the census',
28
+ "url": '#0'
29
+ },
30
+ "body":{
31
+ "id": 'text2',
32
+ "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.'
33
+ }
26
34
  })
27
35
  }}
28
36
  </div>
@@ -30,12 +38,16 @@
30
38
  <div class="ons-grid__col ons-col-4@m">
31
39
  {{
32
40
  onsCard({
33
- "id": 'card-with-image-3',
34
- "textId": 'text3',
35
- "title": 'Your data and security',
36
- "url": '#0',
37
- "text": 'How we keep your data safe and what happens to your personal information.',
38
- "image": true
41
+ "image": true,
42
+ "title": {
43
+ "id": 'card-with-image-3',
44
+ "text": 'Your data and security',
45
+ "url": '#0'
46
+ },
47
+ "body":{
48
+ "id": 'text3',
49
+ "text": 'How we keep your data safe and what happens to your personal information.'
50
+ }
39
51
  })
40
52
  }}
41
53
  </div>
@@ -4,21 +4,25 @@
4
4
  <div class="ons-grid__col ons-col-4@m">
5
5
  {{
6
6
  onsCard({
7
- "id": 'card-with-list-1',
8
- "textId": 'text1',
9
- "title": 'About the census',
10
- "url": '#0',
11
- "text": 'The census is a survey that gives us information about all the households in England and Wales.',
12
- "itemsList": [
13
- {
14
- "url": '#0',
15
- "text": 'List item 1 about the census'
16
- },
17
- {
18
- "url": '#0',
19
- "text": 'List item 2 about the census'
20
- }
21
- ]
7
+ "title": {
8
+ "id": 'card-with-list-1',
9
+ "text": 'About the census',
10
+ "url": '#0'
11
+ },
12
+ "body":{
13
+ "id": 'text1',
14
+ "text": 'The census is a survey that gives us information about all the households in England and Wales.',
15
+ "itemsList": [
16
+ {
17
+ "url": '#0',
18
+ "text": 'List item 1 about the census'
19
+ },
20
+ {
21
+ "url": '#0',
22
+ "text": 'List item 2 about the census'
23
+ }
24
+ ]
25
+ }
22
26
  })
23
27
  }}
24
28
  </div>
@@ -26,21 +30,25 @@
26
30
  <div class="ons-grid__col ons-col-4@m">
27
31
  {{
28
32
  onsCard({
29
- "id": 'card-with-list-2',
30
- "textId": 'text2',
31
- "title": 'Working on the census',
32
- "url": '#0',
33
- "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.',
34
- "itemsList": [
35
- {
36
- "url": '#0',
37
- "text": 'List item 1 about working on the census'
38
- },
39
- {
40
- "url": '#0',
41
- "text": 'List item 2 about working on the census'
42
- }
43
- ]
33
+ "title": {
34
+ "id": 'card-with-list-2',
35
+ "text": 'Working on the census',
36
+ "url": '#0'
37
+ },
38
+ "body":{
39
+ "id": 'text2',
40
+ "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.',
41
+ "itemsList": [
42
+ {
43
+ "url": '#0',
44
+ "text": 'List item 1 about working on the census'
45
+ },
46
+ {
47
+ "url": '#0',
48
+ "text": 'List item 2 about working on the census'
49
+ }
50
+ ]
51
+ }
44
52
  })
45
53
  }}
46
54
  </div>
@@ -48,21 +56,25 @@
48
56
  <div class="ons-grid__col ons-col-4@m">
49
57
  {{
50
58
  onsCard({
51
- "id": 'card-with-list-3',
52
- "textId": 'text3',
53
- "title": 'Your data and security',
54
- "url": '#0',
55
- "text": 'How we keep your data safe and what happens to your personal information.',
56
- "itemsList": [
57
- {
58
- "url": '#0',
59
- "text": 'List item 1 about your data and security'
60
- },
61
- {
62
- "url": '#0',
63
- "text": 'List item 2 about your data and security'
64
- }
65
- ]
59
+ "title": {
60
+ "id": 'card-with-list-3',
61
+ "text": 'Your data and security',
62
+ "url": '#0'
63
+ },
64
+ "body":{
65
+ "id": 'text3',
66
+ "text": 'How we keep your data safe and what happens to your personal information.',
67
+ "itemsList": [
68
+ {
69
+ "url": '#0',
70
+ "text": 'List item 1 about your data and security'
71
+ },
72
+ {
73
+ "url": '#0',
74
+ "text": 'List item 2 about your data and security'
75
+ }
76
+ ]
77
+ }
66
78
  })
67
79
  }}
68
80
  </div>
@@ -4,11 +4,15 @@
4
4
  <div class="ons-grid__col ons-col-4@m">
5
5
  {{
6
6
  onsCard({
7
- "id": 'card-set-1',
8
- "textId": 'text1',
9
- "title": 'About the census',
10
- "url": '#0',
11
- "text": 'The census is a survey that gives us information about all the households in England and Wales.'
7
+ "title": {
8
+ "id": 'card-set-1',
9
+ "text": 'About the census',
10
+ "url": '#0'
11
+ },
12
+ "body":{
13
+ "id": 'text1',
14
+ "text": 'The census is a survey that gives us information about all the households in England and Wales.'
15
+ }
12
16
  })
13
17
  }}
14
18
  </div>
@@ -16,11 +20,15 @@
16
20
  <div class="ons-grid__col ons-col-4@m">
17
21
  {{
18
22
  onsCard({
19
- "id": 'card-set-2',
20
- "textId": 'text2',
21
- "title": 'Working on the census',
22
- "url": '#0',
23
- "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.'
23
+ "title": {
24
+ "id": 'card-set-2',
25
+ "text": 'Working on the census',
26
+ "url": '#0'
27
+ },
28
+ "body":{
29
+ "id": 'text2',
30
+ "text": 'For Census 2021, we’ll be hiring at least 30,000 field staff across England and Wales.'
31
+ }
24
32
  })
25
33
  }}
26
34
  </div>
@@ -28,11 +36,15 @@
28
36
  <div class="ons-grid__col ons-col-4@m">
29
37
  {{
30
38
  onsCard({
31
- "id": 'card-set-3',
32
- "textId": 'text3',
33
- "title": 'Your data and security',
34
- "url": '#0',
35
- "text": 'How we keep your data safe and what happens to your personal information.'
39
+ "title": {
40
+ "id": 'card-set-3',
41
+ "text": 'Your data and security',
42
+ "url": '#0'
43
+ },
44
+ "body":{
45
+ "id": 'text3',
46
+ "text": 'How we keep your data safe and what happens to your personal information.'
47
+ }
36
48
  })
37
49
  }}
38
50
  </div>
@@ -2,10 +2,14 @@
2
2
 
3
3
  {{
4
4
  onsCard({
5
- "id": 'card-example',
6
- "textId": 'text',
7
- "title": 'Your data and security',
8
- "url": '#0',
9
- "text": 'How we keep your data safe and what happens to your personal information.'
5
+ "title": {
6
+ "id": 'card-example',
7
+ "text": 'Your data and security',
8
+ "url": '#0'
9
+ },
10
+ "body":{
11
+ "id": 'text',
12
+ "text": 'How we keep your data safe and what happens to your personal information.'
13
+ }
10
14
  })
11
15
  }}
@@ -5,7 +5,7 @@
5
5
  {% endif %}
6
6
  <span
7
7
  id="{{ params.id }}"
8
- class="ons-input__limit ons-u-fs-s--b ons-u-d-no ons-u-mt-xs"
8
+ class="ons-input__limit ons-u-fs-s--b ons-u-d-no ons-u-mt-2xs"
9
9
  data-charcount-singular="{{ params.charCountSingular }}"
10
10
  data-charcount-plural="{{ params.charCountPlural }}"
11
11
  data-charcount-limit-singular="{{ params.charCountOverLimitSingular }}"