@ons/design-system 72.11.0 → 73.0.1

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.
@@ -0,0 +1,13 @@
1
+ {% from "components/announcement-banner/_macro.njk" import onsAnnouncementBanner %}
2
+
3
+ {{
4
+ onsAnnouncementBanner({
5
+ "variants": ['red', 'wide'],
6
+ "title": 'National emergency',
7
+ "description": 'This is a level 1 incident',
8
+ "link": {
9
+ "text": 'More information',
10
+ "url": '#0'
11
+ }
12
+ })
13
+ }}
@@ -2,7 +2,7 @@
2
2
 
3
3
  {{
4
4
  onsAnnouncementBanner({
5
- "variants": ['red', 'wide'],
5
+ "variants": 'red',
6
6
  "title": 'National emergency',
7
7
  "description": 'This is a level 1 incident',
8
8
  "link": {
@@ -18,14 +18,6 @@ $button-shadow-size: 3px;
18
18
  vertical-align: top;
19
19
  white-space: nowrap;
20
20
 
21
- // Transparent border for IE11 High Contrast mode support due to 'border: 0' on buttons
22
- &::after {
23
- border: ems($button-shadow-size) solid transparent;
24
- inset: 0 0 - (ems($button-shadow-size)) 0; // Makes sure button shadow is selectable
25
- content: '';
26
- position: absolute;
27
- }
28
-
29
21
  &--search {
30
22
  .ons-icon {
31
23
  margin: 0.125rem 0.5rem 0.125rem 0;
@@ -88,7 +80,7 @@ $button-shadow-size: 3px;
88
80
  color: var(--ons-color-text-inverse);
89
81
  display: flex;
90
82
  align-items: center;
91
- padding: 0.75rem 1rem;
83
+ padding: 0.875rem 1rem;
92
84
  // Required for Google Tag Manager
93
85
  pointer-events: none;
94
86
  position: relative;
@@ -399,25 +399,6 @@
399
399
  }
400
400
  }
401
401
 
402
- &--dark,
403
- &--navy-blue {
404
- .ons-breadcrumbs__link {
405
- color: var(--ons-color-text-inverse);
406
-
407
- &:hover {
408
- color: var(--ons-color-text-inverse);
409
- text-decoration: underline solid var(--ons-color-text-inverse) 2px;
410
- }
411
- &:focus {
412
- color: var(--ons-color-text);
413
- }
414
- &:focus:hover {
415
- color: var(--ons-color-text);
416
- text-decoration: none;
417
- }
418
- }
419
- }
420
-
421
402
  &__badge-link {
422
403
  display: block;
423
404
  width: fit-content;
@@ -471,9 +452,6 @@
471
452
  padding-top: 2rem;
472
453
  position: relative;
473
454
  z-index: 5;
474
- #{$root}--with-breadcrumbs & {
475
- padding-top: 1rem;
476
- }
477
455
  }
478
456
 
479
457
  &__title-container {
@@ -6,7 +6,7 @@
6
6
  {% set detailsColumns = params.detailsColumns | default ('8') %}
7
7
 
8
8
  <section
9
- class="ons-hero ons-grid--gutterless{% if params.breadcrumbs %}{{ ' ' }}ons-hero--with-breadcrumbs{% endif %}{% if params.variants and params.variants is not string %}{% for variant in params.variants %}{{ ' ' }}ons-hero--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-hero--{{ params.variants }}{% endif %}"
9
+ class="ons-hero ons-grid--gutterless{% if params.variants and params.variants is not string %}{% for variant in params.variants %}{{ ' ' }}ons-hero--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-hero--{{ params.variants }}{% endif %}"
10
10
  >
11
11
  {% if params.variants == 'navy-blue' %}
12
12
  <div class="ons-hero__circles" aria-hidden="true">
@@ -23,18 +23,6 @@
23
23
  {% endif %}
24
24
  <div class="ons-hero__container ons-container{{ ' ons-container--wide' if params.wide }}">
25
25
  <div class="ons-hero__details ons-grid__col ons-col-{{ detailsColumns }}@m col-10@s@m">
26
- {% if params.breadcrumbs %}
27
- {% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
28
- {{
29
- onsBreadcrumbs({
30
- "itemsList": params.breadcrumbs.itemsList,
31
- "ariaLabel": params.breadcrumbs.ariaLabel,
32
- "id": params.breadcrumbs.id,
33
- "classes": 'ons-u-pt-no' ~ (' ' + params.breadcrumbs.classes if params.breadcrumbs.classes else '')
34
- })
35
- }}
36
- {% endif %}
37
-
38
26
  <div class="ons-hero__content">
39
27
  <div class="ons-hero__title-container">
40
28
  <header>
@@ -252,35 +252,6 @@ describe('macro: hero', () => {
252
252
  });
253
253
  });
254
254
 
255
- it('outputs the correct breadcrumbs', () => {
256
- const $ = cheerio.load(
257
- renderComponent('hero', {
258
- ...EXAMPLE_HERO,
259
- variants: 'grey',
260
- breadcrumbs: {
261
- ariaLabel: 'Breadcrumbs',
262
- itemsList: [
263
- {
264
- url: '/breadcrumb-1',
265
- text: 'Breadcrumbs 1',
266
- },
267
- {
268
- url: '/breadcrumb-2',
269
- text: 'Breadcrumbs 2',
270
- },
271
- ],
272
- },
273
- }),
274
- );
275
-
276
- const breadcrumbs = $('.ons-breadcrumbs__link');
277
- expect($(breadcrumbs).length).toBe(2);
278
- expect($(breadcrumbs[0]).attr('href')).toBe('/breadcrumb-1');
279
- expect($(breadcrumbs[0]).text().trim()).toBe('Breadcrumbs 1');
280
- expect($(breadcrumbs[1]).attr('href')).toBe('/breadcrumb-2');
281
- expect($(breadcrumbs[1]).text().trim()).toBe('Breadcrumbs 2');
282
- });
283
-
284
255
  it('outputs the correct description list value', () => {
285
256
  const $ = cheerio.load(
286
257
  renderComponent('hero', {
@@ -22,23 +22,6 @@
22
22
  "title": 'Retail sales rise amid summer discounts and sporting events, according to a first estimate',
23
23
  "text": 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum id mattis ligula, nec sollicitudin arcu. Donec non tristique tellus. Donec eget malesuada lorem.',
24
24
  "censusLogo": true,
25
- "breadcrumbs": {
26
- "ariaLabel": 'Breadcrumbs',
27
- "itemsList": [
28
- {
29
- "url": '/',
30
- "text": 'Home'
31
- },
32
- {
33
- "url": '/',
34
- "text": 'Business, industry and trade'
35
- },
36
- {
37
- "url": '/',
38
- "text": 'Retail industry'
39
- }
40
- ]
41
- },
42
25
  "descriptionList": {
43
26
  "termCol": "5",
44
27
  "descriptionCol": "7",
@@ -10,15 +10,6 @@
10
10
  "text": 'Sales by retailers in Great Britain directly to end consumers, including spending on goods (in store and online)
11
11
  (Retail Sales Index) and spending on services (Index of Services). The industry as a whole is used as an indicator
12
12
  of how the wider economy is performing and the strength of consumer spending.',
13
- "breadcrumbs": {
14
- "ariaLabel": 'Breadcrumbs',
15
- "itemsList": [
16
- {
17
- "url": '/',
18
- "text": 'Home'
19
- }
20
- ]
21
- },
22
13
  "variants": 'pale-blue'
23
14
  })
24
15
  }}
@@ -6,7 +6,7 @@
6
6
  <a href="{{ message.subject.url }}" class="ons-u-fs-r--b">{{ message.subject.text }}</a>
7
7
  {% if message.unread %}<span class="ons-message-item__unread ons-u-fs-s">({{ params.unreadText }})</span>{% endif %}
8
8
  </h3>
9
- <dl class="ons-message-item__metadata" aria-label="{{ params.ariaLabelMetaData | default("Message metadata") }}">
9
+ <dl class="ons-message-item__metadata" aria-label="{{ params.ariaLabelMetaData | default('Message metadata') }}">
10
10
  <dt class="ons-message-item__metadata-term ons-message-item__metadata-term--from ons-u-vh">{{ params.fromLabel }}:</dt>
11
11
  <dd class="ons-message-item__metadata-value ons-message-item__metadata-value--from ons-u-fs-r--b">
12
12
  {{ message.fromText }}
@@ -16,11 +16,7 @@
16
16
  {{ message.dateText }}
17
17
  </dd>
18
18
  <dt class="ons-message-item__metadata-term ons-message-item__metadata-term--body ons-u-vh">
19
- {% if params.ariaLabelMsg and not params.bodyLabel %}
20
- {{ params.ariaLabelMsg | default("Message text") }}:
21
- {% else %}
22
- {{ params.bodyLabel | default("Message text") }}:
23
- {% endif %}
19
+ {{ params.bodyLabel | default("Message text") }}:
24
20
  </dt>
25
21
  <dd class="ons-message-item__metadata-value ons-message-item__metadata-value--body ons-u-fs-r ons-u-mt-s">
26
22
  {{ message.body | safe }}
@@ -42,28 +42,7 @@ const EXAMPLE_MESSAGE_LIST = {
42
42
  ariaLabelMetaData: 'Message information',
43
43
  };
44
44
 
45
- const EXAMPLE_MESSAGE_LIST_WITH_DEPRECATED_ARIALABELMSG_PARAM = {
46
- unreadText: 'New',
47
- fromLabel: 'From',
48
- dateLabel: 'Date',
49
- hiddenReadLabel: 'Read the message',
50
- ariaLabelMsg: 'Aria Label Msg Preview',
51
- messages: [
52
- {
53
- id: 'message1',
54
- unread: true,
55
- subject: {
56
- url: 'https://example.com/message/1',
57
- text: 'Example message subject',
58
- },
59
- fromText: 'Example Sender 1',
60
- dateText: 'Tue 4 Jul 2020 at 7:47',
61
- body: 'An example message.',
62
- },
63
- ],
64
- };
65
-
66
- const EXAMPLE_MESSAGE_LIST_WIHTOUT_BODYLABEL_PARAM = {
45
+ const EXAMPLE_MESSAGE_LIST_WITHOUT_BODYLABEL_PARAM = {
67
46
  unreadText: 'New',
68
47
  fromLabel: 'From',
69
48
  dateLabel: 'Date',
@@ -139,31 +118,14 @@ describe('macro: message-list', () => {
139
118
  expect($('.ons-message-item__link:first').text()).toContain('Read the message: ');
140
119
  });
141
120
 
142
- it('has visually hidden label `bodyLabel` when only `bodyLabel` is provided`', () => {
121
+ it('has visually hidden label `bodyLabel` when `bodyLabel` is provided`', () => {
143
122
  const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_MINIMAL));
144
123
 
145
124
  expect($('.ons-message-item__metadata-term--body:first').text().trim()).toBe('Body:');
146
125
  });
147
126
 
148
- it('has visually hidden label `bodyLabel` when both `bodyLabel` and `ariaLabelMsg` are provided`', () => {
149
- const $ = cheerio.load(
150
- renderComponent('message-list', {
151
- ...EXAMPLE_MESSAGE_LIST_MINIMAL,
152
- ariaLabelMsg: 'Aria Label Msg Preview',
153
- }),
154
- );
155
-
156
- expect($('.ons-message-item__metadata-term--body:first').text().trim()).toBe('Body:');
157
- });
158
-
159
- it('has visually hidden deprecated label `ariaLabelMsg` when only `ariaLabelMsg` is provided', () => {
160
- const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_WITH_DEPRECATED_ARIALABELMSG_PARAM));
161
-
162
- expect($('.ons-message-item__metadata-term--body:first').text().trim()).toBe('Aria Label Msg Preview:');
163
- });
164
-
165
- it('has the defualt text for visually hidden label `bodyLabel` when both `bodyLabel` and `ariaLabelMsg` are not provided', () => {
166
- const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_WIHTOUT_BODYLABEL_PARAM));
127
+ it('has the default text for visually hidden label `bodyLabel` when `bodyLabel` is not provided', () => {
128
+ const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_WITHOUT_BODYLABEL_PARAM));
167
129
 
168
130
  expect($('.ons-message-item__metadata-term--body:first').text().trim()).toBe('Message text:');
169
131
  });
@@ -36,7 +36,7 @@ layout: ~
36
36
 
37
37
  {% block main %}
38
38
  <div class="ons-page__container ons-container">
39
- <div class="ons-grid ons-js-toc-container">
39
+ <div class="ons-grid ons-js-table-of-contents-container">
40
40
  <div class="ons-grid__col ons-grid__col--sticky@m ons-col-4@m">
41
41
  {{
42
42
  onsTableOfContents({
@@ -1,6 +1,6 @@
1
1
  {% from "components/table-of-contents/_macro.njk" import onsTableOfContents %}
2
2
  <div class="ons-page__container ons-container">
3
- <div class="ons-grid ons-js-toc-container">
3
+ <div class="ons-grid ons-js-table-of-contents-container">
4
4
  <div class="ons-grid__col ons-grid__col--sticky@m ons-col-4@m">
5
5
  {{-
6
6
  onsTableOfContents({
@@ -1,7 +1,7 @@
1
1
  import domready from '../../js/domready';
2
2
 
3
3
  async function tableOfContents() {
4
- const tableOfContents = [...document.querySelectorAll('.ons-js-toc-container')];
4
+ const tableOfContents = [...document.querySelectorAll('.ons-js-table-of-contents-container')];
5
5
 
6
6
  if (tableOfContents.length) {
7
7
  const TableOfContents = (await import('./table-of-contents')).default;
@@ -9,7 +9,7 @@ describe('script: table-of-contents', () => {
9
9
  /* eslint-disable indent */
10
10
  `
11
11
  <div class="ons-page__container ons-container">
12
- <div class="ons-grid ons-js-toc-container">
12
+ <div class="ons-grid ons-js-table-of-contents-container">
13
13
  <div class="ons-grid__col ons-grid__col--sticky@m ons-col-4@m">
14
14
  ${renderComponent('table-of-contents', {
15
15
  title: 'Contents',
@@ -71,7 +71,7 @@ describe('script: table-of-contents-fixed-position', () => {
71
71
  /* eslint-disable indent */
72
72
  `
73
73
  <div class="ons-page__container ons-container">
74
- <div class="ons-grid ons-js-toc-container">
74
+ <div class="ons-grid ons-js-table-of-contents-container">
75
75
  <div id="sticky-container" class="ons-grid__col ons-grid__col--sticky@m ons-col-4@m">
76
76
  ${renderComponent('table-of-contents', {
77
77
  title: 'Contents',