@ons/design-system 65.0.0 → 65.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 (61) hide show
  1. package/components/address-input/autosuggest.address.error.js +1 -1
  2. package/components/address-input/autosuggest.address.js +2 -2
  3. package/components/address-input/autosuggest.address.spec.js +5 -5
  4. package/components/autosuggest/_autosuggest.scss +11 -6
  5. package/components/autosuggest/_macro.njk +32 -31
  6. package/components/autosuggest/_macro.spec.js +18 -18
  7. package/components/autosuggest/autosuggest.spec.js +31 -31
  8. package/components/autosuggest/autosuggest.ui.js +8 -9
  9. package/components/card/_card.scss +14 -0
  10. package/components/card/_macro.njk +7 -8
  11. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +88 -0
  12. package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +70 -0
  13. package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +72 -0
  14. package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +60 -0
  15. package/components/content-pagination/_content-pagination.scss +1 -1
  16. package/components/document-list/_macro.njk +5 -7
  17. package/components/document-list/_macro.spec.js +2 -2
  18. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  19. package/components/document-list/example-document-list-search-results.njk +3 -3
  20. package/components/fieldset/_fieldset.scss +1 -1
  21. package/components/header/_macro.njk +4 -4
  22. package/components/header/example-header-external-with-navigation.njk +5 -5
  23. package/components/header/example-header-external-with-service-links.njk +3 -3
  24. package/components/header/example-header-external-with-sub-navigation.njk +10 -10
  25. package/components/header/example-header-internal.njk +2 -2
  26. package/components/header/example-header-neutral-for-multicoloured-logo.njk +6 -6
  27. package/components/list/_list.scss +5 -2
  28. package/components/list/_macro.njk +22 -10
  29. package/components/list/_macro.spec.js +42 -0
  30. package/components/navigation/_macro.njk +6 -6
  31. package/components/navigation/_macro.spec.js +4 -4
  32. package/components/pagination/_macro.njk +17 -2
  33. package/components/pagination/_pagination.scss +14 -0
  34. package/components/question/example-question-interviewer-note.njk +1 -1
  35. package/components/radios/example-radios-with-clear-button-expanded.njk +98 -0
  36. package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +70 -0
  37. package/components/radios/example-radios-with-revealed-radios-expanded.njk +69 -0
  38. package/components/radios/example-radios-with-revealed-select-expanded.njk +70 -0
  39. package/components/radios/example-radios-with-revealed-text-input-expanded.njk +81 -0
  40. package/components/relationships/_macro.spec.js +9 -11
  41. package/components/relationships/example-relationships-error.njk +28 -28
  42. package/components/relationships/example-relationships-you.njk +29 -29
  43. package/components/relationships/example-relationships.njk +28 -28
  44. package/components/relationships/relationships.spec.js +13 -13
  45. package/components/reply/_macro.njk +5 -2
  46. package/components/reply/_macro.spec.js +7 -1
  47. package/components/section-navigation/_macro.njk +2 -1
  48. package/components/section-navigation/_macro.spec.js +2 -13
  49. package/components/tabs/_macro.njk +5 -5
  50. package/components/tabs/_macro.spec.js +1 -1
  51. package/components/tabs/example-tabs-details.njk +3 -0
  52. package/components/tabs/example-tabs.njk +0 -1
  53. package/components/textarea/example-textarea-error.njk +4 -4
  54. package/css/main.css +2 -2
  55. package/css/print.css +1 -1
  56. package/js/cookies-settings.js +1 -1
  57. package/package.json +19 -21
  58. package/scripts/main.es5.js +1 -1
  59. package/scripts/main.js +1 -1
  60. package/scss/overrides/hcm.scss +4 -4
  61. package/scss/print.scss +1 -1
@@ -10,7 +10,14 @@ const EXAMPLE_TEXTAREA = {
10
10
  name: 'reply',
11
11
  label: {
12
12
  text: 'Reply',
13
+ description: 'Reply description',
13
14
  },
15
+ charCheckLimit: {
16
+ limit: 300,
17
+ charCountSingular: '{x} more character needed',
18
+ charCountPlural: '{x} more characters needed',
19
+ },
20
+ rows: 5,
14
21
  };
15
22
 
16
23
  const EXAMPLE_BUTTON = {
@@ -40,7 +47,6 @@ describe('macro: reply', () => {
40
47
  const textareaSpy = faker.spy('textarea');
41
48
 
42
49
  cheerio.load(faker.renderComponent('reply', EXAMPLE_REPLY));
43
-
44
50
  expect(textareaSpy.occurrences[0]).toEqual(EXAMPLE_TEXTAREA);
45
51
  });
46
52
 
@@ -1,5 +1,6 @@
1
1
  {% macro onsSectionNavigation(params) %}
2
- <nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %} {% if params.classes %} {{ params.classes }} {% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %} aria-label="{{ params.ariaLabel | default("Section menu") }}">
2
+ <nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %} {% if params.classes %} {{ params.classes }} {% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %} aria-labelledby="{{ params.hiddenTitleId | default("section-menu-nav-title")}}">
3
+ <h2 class="ons-u-vh" id="{{ params.hiddenTitleId | default("section-menu-nav-title") }}">{{ params.hiddenTitle | default("Pages in this section") }}</h2>
3
4
  {% if params.sections %}
4
5
  {% for section in params.sections %}
5
6
  <div class="ons-section-nav__sub">
@@ -135,21 +135,10 @@ describe('macro: section-navigation', () => {
135
135
  expect($('.ons-section-nav').hasClass('custom-class')).toBe(true);
136
136
  });
137
137
 
138
- it('has the provided `ariaLabel` parameter', () => {
139
- const $ = cheerio.load(
140
- renderComponent('section-navigation', {
141
- ...EXAMPLE_SECTION_NAVIGATION,
142
- ariaLabel: 'Section navigation menu',
143
- }),
144
- );
145
-
146
- expect($('.ons-section-nav').attr('aria-label')).toBe('Section navigation menu');
147
- });
148
-
149
- it('assumes a default `ariaLabel` of "Section menu"', () => {
138
+ it('assumes a default `hiddenTitleId` of "Section menu"', () => {
150
139
  const $ = cheerio.load(renderComponent('section-navigation', EXAMPLE_SECTION_NAVIGATION));
151
140
 
152
- expect($('.ons-section-nav').attr('aria-label')).toBe('Section menu');
141
+ expect($('.ons-section-nav').attr('aria-labelledby')).toBe('section-menu-nav-title');
153
142
  });
154
143
 
155
144
  describe('navigation items', () => {
@@ -13,11 +13,11 @@
13
13
  {% set titleTag = params.titleTag | default("h2") %}
14
14
  <{{ titleTag }} class="ons-tabs__title ons-u-fs-r--b ons-u-mt-no">{{ params.title }}</{{ titleTag }}>
15
15
  <div>
16
- <ul class="ons-tabs__list">
17
- {%- for tab in params.tabs -%}
18
- <li class="ons-tab__list-item"><a href="#{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower}}" class="ons-tab" data-ga="click" data-ga-category="tabs" data-ga-action="Show: {{ tab.title }}" data-ga-label="Show: {{ tab.title }}">{{ tab.title }}{% if tab.hiddenSpan %}<span class='ons-u-d-no'>{{tab.hiddenSpan}}</span>{% endif %}</a></li>
19
- {%- endfor -%}
20
- </ul>
16
+ <ul class="ons-tabs__list">
17
+ {%- for tab in params.tabs -%}
18
+ <li class="ons-tab__list-item"><a href="#{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower}}" class="ons-tab" data-ga="click" data-ga-category="tabs" data-ga-action="Show: {{ tab.title }}" data-ga-label="Show: {{ tab.title }}">{{ tab.title }}{% if tab.hiddenSpan %}<span class='ons-u-vh'>{{tab.hiddenSpan}}</span>{% endif %}</a></li>
19
+ {%- endfor -%}
20
+ </ul>
21
21
  </div>
22
22
  {% for tab in params.tabs %}
23
23
  <section id="{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower }}" class="ons-tabs__panel">
@@ -112,7 +112,7 @@ describe('macro: tabs', () => {
112
112
  it('has expected label text in tab links and visually hidden span in tab 1', () => {
113
113
  const $ = cheerio.load(renderComponent('tabs', EXAMPLE_TABS));
114
114
 
115
- expect($('.ons-tab:first').html()).toBe('Tab 1<span class="ons-u-d-no">for Example</span>');
115
+ expect($('.ons-tab:first').html()).toBe('Tab 1<span class="ons-u-vh">for Example</span>');
116
116
  expect(
117
117
  $('.ons-tab:last')
118
118
  .text()
@@ -30,6 +30,7 @@
30
30
  {
31
31
  "id": "video-description",
32
32
  "title": 'Description',
33
+ "hiddenSpan": 'for Census 2021 promotional TV advert video',
33
34
  "content": '<div class="example-video-block__details">
34
35
  <h3 class="ons-u-d-no@s">Description</h3>
35
36
  <p>The census provides a snapshot of everyone in England & Wales. We help local councils get the funding they need.</p>
@@ -39,6 +40,7 @@
39
40
  {
40
41
  "id": "video-transcript",
41
42
  "title": 'Transcript',
43
+ "hiddenSpan": 'for Census 2021 promotional TV advert video',
42
44
  "content": '<div class="example-video-block__details">
43
45
  <h3 class="ons-u-d-no@s">Transcript</h3>
44
46
  <p>I count.</p>
@@ -50,6 +52,7 @@
50
52
  {
51
53
  "id": "video-embed",
52
54
  "title": 'Embed',
55
+ "hiddenSpan": 'code for Census 2021 promotional TV advert video',
53
56
  "content": '<h3 class="ons-u-d-no@s">Embed</h3>
54
57
  <pre class="language-html"><code>' ~ '<iframe width="560" height="315" src="https://www.youtube.com/embed/_EGJlvkgbPo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>' | e ~ '</code></pre>'
55
58
  }
@@ -8,7 +8,6 @@
8
8
  "id": "ukis",
9
9
  "title": 'UKIS',
10
10
  "showTitle": true,
11
- "hiddenSpan": 'for UKIS',
12
11
  "content": '<h3>Aim of this survey</h3>
13
12
  <p class="ons-u-fs-r">The aim of the UK Innovation Survey (UKIS) is to collect data from businesses about various aspects of their innovation related activities. Using this data we can measure the level, types and trends in innovation.</p>
14
13
  <h3>How we’ll use this data</h3>
@@ -8,9 +8,9 @@
8
8
  "text": "Please provide some feedback",
9
9
  "description": "For example, describe any difficulties you experienced in the use of this service"
10
10
  },
11
- "error": {
12
- "id": "feedback-error",
13
- "text": "Enter your feedback"
14
- }
11
+ "error": {
12
+ "id": "feedback-error",
13
+ "text": "Enter your feedback"
14
+ }
15
15
  })
16
16
  }}