@ons/design-system 54.0.1 → 55.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 (108) hide show
  1. package/components/access-code/_macro.njk +3 -3
  2. package/components/accordion/_macro.njk +1 -1
  3. package/components/address-input/_macro.njk +7 -7
  4. package/components/address-output/_macro.njk +7 -7
  5. package/components/autosuggest/_macro.njk +19 -19
  6. package/components/breadcrumbs/_macro.njk +3 -3
  7. package/components/browser-banner/_macro.njk +1 -1
  8. package/components/browser-banner/_macro.spec.js +31 -0
  9. package/components/button/_button.scss +21 -7
  10. package/components/button/_macro.njk +25 -25
  11. package/components/button/_macro.spec.js +2 -2
  12. package/components/call-to-action/_macro.njk +1 -1
  13. package/components/card/_macro.njk +10 -10
  14. package/components/checkboxes/_checkbox-macro.njk +9 -9
  15. package/components/checkboxes/_checkbox.scss +43 -10
  16. package/components/checkboxes/_macro.njk +10 -10
  17. package/components/checkboxes/checkbox-with-fieldset.js +6 -5
  18. package/components/checkboxes/checkboxes.dom.js +6 -9
  19. package/components/code-highlight/_macro.njk +1 -1
  20. package/components/collapsible/_collapsible.scss +2 -1
  21. package/components/collapsible/_macro.njk +7 -7
  22. package/components/date-input/_macro.njk +5 -5
  23. package/components/document-list/_macro.njk +29 -29
  24. package/components/document-list/document-list.scss +2 -0
  25. package/components/download-resources/download-resources.js +19 -0
  26. package/components/download-resources/download-resources.spec.js +95 -0
  27. package/components/duration/_macro.njk +9 -9
  28. package/components/duration/_macro.spec.js +0 -3
  29. package/components/error/_macro.njk +1 -1
  30. package/components/external-link/_macro.njk +2 -2
  31. package/components/external-link/_macro.spec.js +2 -2
  32. package/components/feedback/_macro.njk +2 -2
  33. package/components/field/_macro.njk +5 -5
  34. package/components/fieldset/_fieldset.scss +11 -1
  35. package/components/fieldset/_macro.njk +15 -14
  36. package/components/fieldset/_macro.spec.js +27 -5
  37. package/components/footer/_footer.scss +1 -0
  38. package/components/footer/_macro.njk +18 -18
  39. package/components/footer/_macro.spec.js +18 -0
  40. package/components/header/_header.scss +7 -2
  41. package/components/header/_macro.njk +63 -37
  42. package/components/header/_macro.spec.js +82 -14
  43. package/components/hero/_macro.njk +16 -16
  44. package/components/hero/_macro.spec.js +1 -1
  45. package/components/icons/_macro.njk +2 -2
  46. package/components/images/_macro.njk +3 -3
  47. package/components/input/_input-type.scss +7 -0
  48. package/components/input/_input.scss +13 -2
  49. package/components/input/_macro.njk +40 -34
  50. package/components/input/_macro.spec.js +64 -59
  51. package/components/label/_label.scss +1 -1
  52. package/components/label/_macro.njk +27 -15
  53. package/components/label/_macro.spec.js +31 -0
  54. package/components/language-selector/_macro.njk +1 -1
  55. package/components/lists/_macro.njk +22 -22
  56. package/components/lists/_macro.spec.js +2 -2
  57. package/components/message/_macro.njk +6 -6
  58. package/components/message/_message.scss +1 -0
  59. package/components/message-list/_macro.njk +1 -1
  60. package/components/metadata/_macro.njk +2 -2
  61. package/components/modal/_macro.njk +6 -6
  62. package/components/modal/_modal.scss +10 -9
  63. package/components/mutually-exclusive/_macro.njk +1 -1
  64. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  65. package/components/navigation/_macro.njk +9 -10
  66. package/components/navigation/_macro.spec.js +0 -1
  67. package/components/pagination/_macro.njk +3 -3
  68. package/components/pagination/_pagination.scss +1 -0
  69. package/components/panel/_macro.njk +38 -43
  70. package/components/panel/_macro.spec.js +24 -33
  71. package/components/panel/_panel.scss +13 -5
  72. package/components/phase-banner/_macro.njk +1 -1
  73. package/components/phase-banner/_macro.spec.js +31 -0
  74. package/components/phase-banner/_phase-banner.scss +1 -0
  75. package/components/promotional-banner/_macro.njk +2 -2
  76. package/components/question/_macro.njk +18 -18
  77. package/components/quote/_macro.njk +2 -2
  78. package/components/radios/_macro.njk +8 -8
  79. package/components/radios/_radio.scss +15 -3
  80. package/components/radios/check-radios.js +5 -1
  81. package/components/related-content/_macro.njk +2 -2
  82. package/components/relationships/_macro.njk +2 -2
  83. package/components/reply/_macro.njk +2 -2
  84. package/components/section-navigation/_macro.njk +2 -2
  85. package/components/select/_macro.njk +8 -8
  86. package/components/share-page/_macro.njk +2 -2
  87. package/components/skip-to-content/_skip.scss +2 -1
  88. package/components/status/_macro.njk +2 -2
  89. package/components/summary/_macro.njk +25 -25
  90. package/components/table/_macro.njk +13 -12
  91. package/components/table/_macro.spec.js +0 -27
  92. package/components/table/_table.scss +13 -6
  93. package/components/table/sortable-table.js +1 -0
  94. package/components/table-of-contents/_macro.njk +4 -4
  95. package/components/tabs/_tabs.scss +5 -3
  96. package/components/textarea/_macro.njk +8 -8
  97. package/components/timeline/_macro.njk +1 -1
  98. package/components/video/_macro.njk +1 -1
  99. package/css/census.css +1 -1
  100. package/css/ids.css +1 -1
  101. package/css/main.css +1 -1
  102. package/layout/_template.njk +57 -44
  103. package/package.json +1 -1
  104. package/scripts/main.es5.js +1 -1
  105. package/scripts/main.js +1 -1
  106. package/scss/base/_global.scss +1 -0
  107. package/scss/overrides/hcm.scss +205 -46
  108. package/scss/patternlib.scss +1 -0
@@ -480,33 +480,6 @@ describe('macro: table', () => {
480
480
 
481
481
  expect($('.ons-table').attr('data-aria-desc')).toBe('descending');
482
482
  });
483
-
484
- it('adds visually hidden class to column headers', () => {
485
- const $ = cheerio.load(renderComponent('table', params));
486
-
487
- const hasClass = mapAll($('.ons-table__header > span'), node => node.hasClass('ons-u-vh'));
488
- expect(hasClass).toEqual([true, true, true]);
489
- });
490
-
491
- it('renders "sort-sprite" icon for each column header', () => {
492
- const faker = templateFaker();
493
- const iconsSpy = faker.spy('icons');
494
-
495
- faker.renderComponent('table', params);
496
-
497
- expect(iconsSpy.occurrences[0]).toEqual({
498
- iconType: 'sort-sprite',
499
- id: 'Column 1',
500
- });
501
- expect(iconsSpy.occurrences[1]).toEqual({
502
- iconType: 'sort-sprite',
503
- id: 'Column 2',
504
- });
505
- expect(iconsSpy.occurrences[2]).toEqual({
506
- iconType: 'sort-sprite',
507
- id: 'Column 3',
508
- });
509
- });
510
483
  });
511
484
 
512
485
  describe('table caption', () => {
@@ -4,6 +4,10 @@
4
4
  margin-bottom: 1rem;
5
5
  width: 100%;
6
6
 
7
+ &__head {
8
+ border-bottom: 2px solid $color-grey-75;
9
+ }
10
+
7
11
  &__caption {
8
12
  font-weight: 700;
9
13
  text-align: left;
@@ -13,7 +17,7 @@
13
17
  &__cell {
14
18
  @include nth-element(1, 0);
15
19
 
16
- border-bottom: 2px solid $color-grey-100;
20
+ border-bottom: 2px solid $color-grey-75;
17
21
  overflow: hidden;
18
22
  padding: 0.5rem 0 0.5rem 1rem;
19
23
  text-align: left;
@@ -64,8 +68,12 @@
64
68
  display: none;
65
69
  }
66
70
 
71
+ .ons-table__head {
72
+ border-bottom: none;
73
+ }
74
+
67
75
  .ons-table__body .ons-table__row {
68
- border-bottom: 2px solid $color-grey-100;
76
+ border-bottom: 2px solid $color-grey-75;
69
77
  display: block;
70
78
  margin-bottom: 1rem;
71
79
  }
@@ -108,7 +116,8 @@
108
116
  width: 100%;
109
117
  &:focus {
110
118
  box-shadow: 0 0 0 3px $color-page-light, 0 0 0 5px $color-text-link-focus, 0 0 0 8px $color-focus;
111
- outline: none;
119
+ outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
120
+ outline-offset: 1px;
112
121
  }
113
122
  .ons-table__header,
114
123
  .ons-table__cell {
@@ -182,8 +191,6 @@
182
191
  }
183
192
 
184
193
  .ons-table__header {
185
- position: relative;
186
-
187
194
  .ons-table__sort-button {
188
195
  background-color: transparent;
189
196
  border: 0;
@@ -205,7 +212,7 @@
205
212
  }
206
213
 
207
214
  .ons-svg-icon {
208
- fill: $color-grey-35;
215
+ fill: $color-grey-75;
209
216
  height: 0.8rem;
210
217
  padding-bottom: 0.1rem;
211
218
  width: 0.8rem;
@@ -28,6 +28,7 @@ export default class TableSort {
28
28
  createHeadingButtons(heading, i) {
29
29
  const text = heading.textContent.trim();
30
30
  heading.childNodes[1].remove();
31
+ heading.childNodes[2].classList.remove('ons-u-d-no');
31
32
  const button = document.createElement('button');
32
33
  button.setAttribute('aria-label', this.table.getAttribute('data-aria-sort') + ' ' + text);
33
34
  button.setAttribute('type', 'button');
@@ -3,7 +3,7 @@
3
3
  {% from "components/skip-to-content/_macro.njk" import onsSkipToContent %}
4
4
 
5
5
  <aside class="ons-toc-container" role="complementary">
6
- {% if params.skipLink is defined and params.skipLink %}
6
+ {% if params.skipLink %}
7
7
  {{
8
8
  onsSkipToContent({
9
9
  "url": params.skipLink.url,
@@ -14,9 +14,9 @@
14
14
 
15
15
  <nav class="ons-toc" aria-label="{{ params.ariaLabel | default('Table of contents') }}">
16
16
  <h2 class="ons-toc__title ons-u-fs-r--b ons-u-mb-s">{{ params.title }}</h2>
17
- {% if params.lists is defined and params.lists %}
17
+ {% if params.lists %}
18
18
  {% for list in params.lists %}
19
- {% if list.listHeading is defined and list.listHeading %}
19
+ {% if list.listHeading %}
20
20
  <h3 class="ons-u-fs-r ons-u-mb-xs">{{ list.listHeading }}<span class="ons-u-vh"> {{ list.listHeadingHidden }}</span>:</h3>
21
21
  {% endif %}
22
22
  {{
@@ -28,7 +28,7 @@
28
28
  })
29
29
  }}
30
30
  {% endfor %}
31
- {% elif params.itemsList is defined and params.itemsList %}
31
+ {% elif params.itemsList %}
32
32
  {{
33
33
  onsList({
34
34
  "element": 'ol',
@@ -71,7 +71,10 @@
71
71
  inset -17px 0 0 0 $color-button-secondary,
72
72
  inset 0 -13px 0 0 $color-text-link-focus;
73
73
  color: $color-text-link-focus;
74
- outline: none;
74
+
75
+ // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
76
+ outline: 3px solid transparent;
77
+ outline-offset: 1px;
75
78
  text-decoration: underline solid $color-text 2px;
76
79
  }
77
80
 
@@ -86,7 +89,6 @@
86
89
 
87
90
  &:focus {
88
91
  background-color: $color-focus;
89
- border-bottom: 1px solid $color-page-light;
90
92
  box-shadow: inset 0 0 0 9px $color-page-light,
91
93
  inset 17px 0 0 0 $color-page-light,
92
94
  inset -17px 0 0 0 $color-page-light,
@@ -108,7 +110,7 @@
108
110
 
109
111
  &:focus {
110
112
  box-shadow: 0 0 0 3px $color-page-light, 0 0 0 5px $color-text-link-focus, 0 0 0 8px $color-focus;
111
- outline: none;
113
+ outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
112
114
  z-index: 1;
113
115
  }
114
116
  }
@@ -8,7 +8,7 @@
8
8
  {% set field %}
9
9
  {% set textareaExclusiveClass = " ons-js-exclusive-group-item" if params.mutuallyExclusive else "" %}
10
10
 
11
- {% if params.label is defined and params.label %}
11
+ {% if params.label %}
12
12
  {{ onsLabel({
13
13
  "for": params.id,
14
14
  "text": params.label.text,
@@ -19,20 +19,20 @@
19
19
 
20
20
  <textarea
21
21
  id="{{ params.id }}"
22
- class="ons-input ons-input--textarea {% if params.error is defined and params.error %} ons-input--error {% endif %}{% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.limit is defined and params.charCheckLimit.limit %} ons-js-char-limit-input{% endif %}{{ textareaExclusiveClass }} {{ params.classes if params.classes is defined and params.classes }} {% if params.width is defined and params.width %}ons-input--w-{{ params.width }}{% endif %}"
23
- {% if params.name is defined and params.name %}
22
+ class="ons-input ons-input--textarea {% if params.error %} ons-input--error {% endif %}{% if params.charCheckLimit and params.charCheckLimit.limit %} ons-js-char-limit-input{% endif %}{{ textareaExclusiveClass }} {{ params.classes if params.classes }} {% if params.width %}ons-input--w-{{ params.width }}{% endif %}"
23
+ {% if params.name %}
24
24
  name="{{ params.name }}"
25
25
  {% endif %}
26
26
  rows="{{ params.rows | default(8) }}"
27
- {% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.limit is defined and params.charCheckLimit.limit %}
27
+ {% if params.charCheckLimit and params.charCheckLimit.limit %}
28
28
  maxlength="{{ params.charCheckLimit.limit }}"
29
29
  data-char-limit-ref="{{ params.id }}-lim-remaining"
30
30
  aria-describedby="{{ params.id }}-lim-remaining"
31
31
  {% endif %}
32
- {% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
33
- >{{ params.value if params.value is defined and params.value }}</textarea>
32
+ {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
33
+ >{{ params.value if params.value }}</textarea>
34
34
 
35
- {% if params.charCheckLimit is defined and params.charCheckLimit and params.charCheckLimit.limit is defined and params.charCheckLimit.limit %}
35
+ {% if params.charCheckLimit and params.charCheckLimit.limit %}
36
36
  {% call onsCharLimit({
37
37
  "id": params.id ~ "-lim",
38
38
  "limit": params.charCheckLimit.limit,
@@ -43,7 +43,7 @@
43
43
  {% endif %}
44
44
  {% endset %}
45
45
 
46
- {% if params.mutuallyExclusive is defined and params.mutuallyExclusive %}
46
+ {% if params.mutuallyExclusive %}
47
47
  {% call onsMutuallyExclusive({
48
48
  "id": params.fieldId,
49
49
  "classes": params.fieldClasses,
@@ -9,7 +9,7 @@
9
9
 
10
10
  <h2 class="ons-timeline__heading">{{ item.heading }}</h2>
11
11
 
12
- {% if item.itemsList is defined and item.itemsList %}
12
+ {% if item.itemsList %}
13
13
 
14
14
  {{
15
15
  onsList({
@@ -1,6 +1,6 @@
1
1
  {%- macro onsVideo(params) -%}
2
2
  <div class="ons-video">
3
- {% if params.youtubeUrl is defined and params.youtubeUrl %}
3
+ {% if params.youtubeUrl %}
4
4
  <iframe title="{{ params.title }}" class="ons-video__iframe" src="{{ params.youtubeUrl }}" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
5
5
  {% endif %}
6
6
  </div>