@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
@@ -8,6 +8,7 @@
8
8
  font-size: 0.85rem;
9
9
  line-height: 1em;
10
10
  margin: 0 0.5rem 0 0;
11
+ outline: 2px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
11
12
  padding: 0.4rem;
12
13
  text-transform: uppercase;
13
14
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  <div class="ons-grid ons-grid--gutterless">
8
8
 
9
- {% if params.image is defined %}
9
+ {% if params.image %}
10
10
 
11
11
  <div class="ons-grid__col ons-col-7@s">
12
12
 
@@ -19,7 +19,7 @@
19
19
  <div class="ons-grid__col ons-col-4@s ons-push-1@s ons-u-d-no@xxs@s">
20
20
 
21
21
  <div class="ons-promo-banner__image">
22
- {% if params.image.smallSrc is defined and params.image.smallSrc %}
22
+ {% if params.image.smallSrc %}
23
23
  <img srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x" src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}">
24
24
  {% else %}
25
25
  <img src="{{ params.image.src }}" alt="{{ params.image.alt }}">
@@ -1,10 +1,10 @@
1
1
  {% macro onsQuestion(params) %}
2
2
 
3
- {%- set titleHtml -%}{% if params.readDescriptionFirst is defined and params.readDescriptionFirst == true and params.description is defined and params.description %}
3
+ {%- set titleHtml -%}{% if params.readDescriptionFirst == true and params.description %}
4
4
  <div class="ons-question__description ons-u-vh">{{ params.description | safe }} </div>{% endif %}{{- params.title | safe -}}
5
5
  {%- endset -%}
6
6
 
7
- {%- set descHtml -%}{% if params.readDescriptionFirst is defined and params.readDescriptionFirst == true %}
7
+ {%- set descHtml -%}{% if params.readDescriptionFirst == true %}
8
8
  <div aria-hidden="true" {% if params.legendIsQuestionTitle is not defined %}class="ons-question__description ons-question__description--aria-hidden"{% endif %}>{{- params.description | safe -}}</div>
9
9
  {% elif params.legendIsQuestionTitle is not defined %}
10
10
  <div class="ons-question__description ons-u-mb-m">{{- params.description | safe -}}</div>
@@ -16,7 +16,7 @@
16
16
  <div class="ons-question__instruction ons-u-mb-m">{{ params.instruction | safe }}</div>
17
17
  {% endset %}
18
18
 
19
- {% if params.definition is defined and params.definition %}
19
+ {% if params.definition %}
20
20
  {% set questionDefinition %}
21
21
  {% from "components/collapsible/_macro.njk" import onsCollapsible %}
22
22
  {% call onsCollapsible({
@@ -31,21 +31,21 @@
31
31
  {% endset %}
32
32
  {% endif %}
33
33
 
34
- {% if params.guidance is defined and params.guidance %}
34
+ {% if params.guidance %}
35
35
  {% set questionGuidance %}
36
36
  {% from "components/panel/_macro.njk" import onsPanel %}
37
37
  {% call onsPanel({
38
38
  "classes": "ons-question-guidance ons-u-mb-m"
39
39
  }) %}
40
- {% if params.guidance.content is defined and params.guidance.content %}
40
+ {% if params.guidance.content %}
41
41
  {{ params.guidance.content | safe }}
42
42
  {% endif %}
43
- {% if params.guidance.lists is defined and params.guidance.lists %}
43
+ {% if params.guidance.lists %}
44
44
  {%- for item in params.guidance.lists -%}
45
- {% if item.listHeading is defined and item.listHeading %}
45
+ {% if item.listHeading %}
46
46
  <h2 class="ons-question-guidance__list-heading ons-u-fs-r--b">{{ item.listHeading }}</h2>
47
47
  {% endif %}
48
- {% if item.listLeadingLine is defined and item.listLeadingLine %}
48
+ {% if item.listLeadingLine %}
49
49
  <p class="ons-question-guidance__list-leading-line">{{ item.listLeadingLine }}</p>
50
50
  {% endif %}
51
51
  {% from "components/lists/_macro.njk" import onsList %}
@@ -61,11 +61,11 @@
61
61
  {% endif %}
62
62
 
63
63
  <div
64
- {% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %}
65
- class="ons-question ons-u-mb-l{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
66
- {% 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 %}
64
+ {% if params.id %} id="{{ params.id }}"{% endif %}
65
+ class="ons-question ons-u-mb-l{% if params.classes %} {{ params.classes }}{% endif %}"
66
+ {% 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 %}
67
67
  >
68
- {% if params.legendIsQuestionTitle is defined and params.legendIsQuestionTitle %}
68
+ {% if params.legendIsQuestionTitle %}
69
69
  {% from "components/fieldset/_macro.njk" import onsFieldset %}
70
70
 
71
71
  {# Resolves caller issue in jijna: https://github.com/pallets/jinja/issues/371 #}
@@ -74,7 +74,7 @@
74
74
  {% call onsFieldset({
75
75
  "legendIsQuestionTitle": params.legendIsQuestionTitle,
76
76
  "legend": titleHtml,
77
- "description": descHtml if params.description is defined and params.description else '',
77
+ "description": descHtml if params.description else '',
78
78
  "legendClasses": params.legendClasses,
79
79
  "legendTitleClasses": params.legendTitleClasses
80
80
  }) %}
@@ -87,19 +87,19 @@
87
87
  {{- titleHtml | safe -}}
88
88
  </h1>
89
89
 
90
- {% if params.description is defined and params.description %}
90
+ {% if params.description %}
91
91
  {{- descHtml | safe -}}
92
92
  {% endif %}
93
93
 
94
- {% if params.instruction is defined and params.instruction %}
94
+ {% if params.instruction %}
95
95
  {{- instHtml | safe -}}
96
96
  {% endif %}
97
97
 
98
- {% if params.definition is defined and params.definition %}
98
+ {% if params.definition %}
99
99
  {{- questionDefinition | safe -}}
100
100
  {% endif %}
101
101
 
102
- {% if params.guidance is defined and params.guidance %}
102
+ {% if params.guidance %}
103
103
  {{- questionGuidance | safe -}}
104
104
  {% endif %}
105
105
 
@@ -108,7 +108,7 @@
108
108
  </div>
109
109
  {% endif %}
110
110
 
111
- {% if params.justification is defined and params.justification %}
111
+ {% if params.justification %}
112
112
  {% from "components/collapsible/_macro.njk" import onsCollapsible %}
113
113
  {% call onsCollapsible({
114
114
  "id": params.justification.id,
@@ -6,7 +6,7 @@
6
6
  "iconType": 'quote'
7
7
  })
8
8
  }}
9
- <span class="ons-quote__text ons-u-fs-{{ params.textFontSize if params.textFontSize is defined and params.textFontSize else 'l' }}">{{ caller() if caller else params.text | safe }}</span>
10
- {% if params.ref is defined and params.ref %}<span class="ons-quote__ref">&mdash; {{ params.ref | safe }}</span>{% endif %}
9
+ <span class="ons-quote__text ons-u-fs-{{ params.textFontSize if params.textFontSize else 'l' }}">{{ caller() if caller else params.text | safe }}</span>
10
+ {% if params.ref %}<span class="ons-quote__ref">&mdash; {{ params.ref | safe }}</span>{% endif %}
11
11
  </blockquote>
12
12
  {% endmacro %}
@@ -15,12 +15,12 @@
15
15
  }) %}
16
16
  <div class="ons-radios__items">
17
17
  {% for radio in params.radios %}
18
- {% if params.or is defined and params.or and loop.revindex0 == 0 %}
18
+ {% if params.or and loop.revindex0 == 0 %}
19
19
  <span class="ons-radios__label ons-u-mt-s ons-u-fs-r--b" aria-hidden="true">{{ params.or }}</span>
20
20
  {% endif %}
21
21
  <span class="ons-radios__item{{ " ons-radios__item--no-border" if params.borderless }}">
22
22
  <span class="ons-radio{{ " ons-radio--no-border" if params.borderless }}">
23
- {% if radio.other is defined and radio.other and radio.other.selectAllChildren is defined and radio.other.selectAllChildren == true %}
23
+ {% if radio.other and radio.other.selectAllChildren == true %}
24
24
  {% set selectAllClass = ' ons-js-select-all-children' %}
25
25
  {% else %}
26
26
  {% set selectAllClass = '' %}
@@ -28,12 +28,12 @@
28
28
  <input
29
29
  type="radio"
30
30
  id="{{ radio.id }}"
31
- class="ons-radio__input ons-js-radio{{ ' ' + params.inputClasses if params.inputClasses and params.inputClasses is defined else '' }}{{ ' ' + radio.classes if radio.classes else '' }}{{ ' ons-js-other' if radio.other else '' }}{{ selectAllClass }}"
31
+ class="ons-radio__input ons-js-radio{{ ' ' + params.inputClasses if params.inputClasses else '' }}{{ ' ' + radio.classes if radio.classes else '' }}{{ ' ons-js-other' if radio.other else '' }}{{ selectAllClass }}"
32
32
  value="{{ radio.value }}"
33
33
  name="{{ params.name }}"
34
- {% if (radio.checked is defined and radio.checked) or (params.value is defined and params.value == radio.value) %} checked {% endif %}
35
- {% if radio.other is defined and radio.other and not radio.other.open %} aria-controls="{{ radio.id }}-other-wrap" aria-haspopup="true"{% endif %}
36
- {% if radio.attributes is defined and radio.attributes %}{% for attribute, value in (radio.attributes.items() if radio.attributes is mapping and radio.attributes.items else radio.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
34
+ {% if radio.checked or (params.value is defined and params.value == radio.value) %} checked {% endif %}
35
+ {% if radio.other and not radio.other.open %} aria-controls="{{ radio.id }}-other-wrap" aria-haspopup="true"{% endif %}
36
+ {% if radio.attributes %}{% for attribute, value in (radio.attributes.items() if radio.attributes is mapping and radio.attributes.items else radio.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
37
37
  >
38
38
  {{ onsLabel({
39
39
  "id": radio.id + "-label",
@@ -43,7 +43,7 @@
43
43
  "classes": "ons-radio__label " + radio.label.classes | default(''),
44
44
  "description": radio.label.description
45
45
  }) }}
46
- {% if radio.other is defined and radio.other %}
46
+ {% if radio.other %}
47
47
  {% set otherType = radio.other.otherType | default('input') %}
48
48
  <span class="ons-radio__other{{ " " + 'ons-radio__other--open' if radio.other.open else "" }}" id="{{ radio.id }}-other-wrap">
49
49
  {% if otherType == "input" %}
@@ -124,7 +124,7 @@
124
124
  {% endif %}
125
125
  {% endfor %}
126
126
  </div>
127
- {% if params.clearRadios is defined and params.clearRadios %}
127
+ {% if params.clearRadios %}
128
128
  {{ onsButton({
129
129
  "text": params.clearRadios.text,
130
130
  "name": params.clearRadios.name,
@@ -6,15 +6,22 @@
6
6
 
7
7
  background: $color-grey-5;
8
8
  border-radius: 50%;
9
- box-shadow: inset 0 0 0 3px $color-white;
9
+ box-shadow: inset 0 0 0 3px $color-input-bg;
10
10
 
11
- &:checked {
12
- background: $color-input-border;
11
+ &::after {
12
+ border-color: $color-input-border;
13
+ border-radius: 50%;
14
+ border-width: 6px;
15
+ height: 0;
16
+ left: 3px;
17
+ top: 3px;
18
+ width: 0;
13
19
  }
14
20
  }
15
21
 
16
22
  &.ons-radio--no-border {
17
23
  @extend .ons-checkbox--no-border;
24
+
18
25
  & > .ons-radio__input {
19
26
  @extend .ons-radio__input;
20
27
  &:focus,
@@ -23,6 +30,7 @@
23
30
  background: none;
24
31
  border: none;
25
32
  box-shadow: none;
33
+ outline: none;
26
34
  }
27
35
  }
28
36
 
@@ -30,6 +38,10 @@
30
38
  box-shadow: inset 0 0 0 3px $color-input-bg, 0 0 0 $input-border-width $color-input-border, 0 0 0 4px $color-focus;
31
39
  }
32
40
  }
41
+
42
+ .ons-radio__label--with-description {
43
+ padding: 0;
44
+ }
33
45
  }
34
46
 
35
47
  &__label {
@@ -3,11 +3,15 @@ export default class CheckRadios {
3
3
  this.radio = radio;
4
4
  this.openOther = openOther;
5
5
  this.input = this.openOther.querySelector('.ons-input');
6
+ this.input.tabIndex = -1;
6
7
 
7
8
  this.setInputBlurAttributes();
8
9
  this.input.addEventListener('focus', this.checkRadio.bind(this));
9
10
  this.radio.addEventListener('change', this.setInputFocusAttributes.bind(this));
10
- this.radio.addEventListener('blur', this.setInputBlurAttributes.bind(this));
11
+ this.radio.addEventListener('focus', this.setInputFocusAttributes.bind(this));
12
+ if (this.radio.type == 'radio') {
13
+ this.input.addEventListener('blur', this.setInputBlurAttributes.bind(this));
14
+ }
11
15
  }
12
16
 
13
17
  checkRadio() {
@@ -1,13 +1,13 @@
1
1
  {% macro onsRelatedContent(params) %}
2
2
 
3
- {% if params is defined and params and params.classes is defined and params.classes %}
3
+ {% if params.classes %}
4
4
  {% set classes = ' ' + params.classes %}
5
5
  {% endif %}
6
6
 
7
7
  <aside class="ons-related-content{{ classes }}" aria-label="{{ params.ariaLabel | default("Related content") }}">
8
8
 
9
9
  <div class="ons-related-content__body">
10
- {% if params.rows is defined and params.rows %}
10
+ {% if params.rows %}
11
11
  {% for row in params.rows %}
12
12
  {% from "components/related-content/_section-macro.njk" import onsRelatedContentSection %}
13
13
  {% call onsRelatedContentSection(
@@ -2,8 +2,8 @@
2
2
 
3
3
  {% macro onsRelationships(params) %}
4
4
  <div
5
- {% if params.id is defined and params.id %}id="{{ params.id }}"{% endif %}
6
- class="ons-relationships ons-js-relationships{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
5
+ {% if params.id %}id="{{ params.id }}"{% endif %}
6
+ class="ons-relationships ons-js-relationships{% if params.classes %} {{ params.classes }}{% endif %}"
7
7
  >
8
8
  {{ onsRadios({
9
9
  "name": params.name,
@@ -12,7 +12,7 @@
12
12
  })
13
13
  }}
14
14
  <div class="ons-grid ons-grid--flex ons-grid--gutterless ons-grid--vertical-center ons-grid--no-wrap@s ons-u-mt-m ons-u-mb-m">
15
- <div class="ons-grid__col">
15
+ <div class="ons-grid__col ons-u-mr-m ons-u-mb-s">
16
16
  {{
17
17
  onsButton({
18
18
  "id": params.button.id,
@@ -22,7 +22,7 @@
22
22
  })
23
23
  }}
24
24
  </div>
25
- <div class="ons-grid__col ons-u-ml-m">
25
+ <div class="ons-grid__col ons-u-mb-s">
26
26
  <a class="ons-reply__link" href="{{ params.closeLinkUrl }}">{{ params.closeLinkText }}</a>
27
27
  </div>
28
28
  </div>
@@ -1,5 +1,5 @@
1
1
  {% macro onsSectionNavigation(params) %}
2
- <nav class="ons-section-nav{% if params.variants is defined and params.variants == 'vertical' %} ons-section-nav--vertical{% endif %}" id="{{ params.id }}" aria-label="{{ params.ariaLabel | default("Section menu") }}">
2
+ <nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %}" id="{{ params.id }}" aria-label="{{ params.ariaLabel | default("Section menu") }}">
3
3
  <ul class="ons-section-nav__list">
4
4
  {% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
5
5
  {% if (params.currentPath and (item.url == params.currentPath or item.url in params.currentPath)) or (params.tabQuery and params.tabQuery == item.title|lower) %}
@@ -9,7 +9,7 @@
9
9
  {% endif %}
10
10
  <li class="ons-section-nav__item{% if item.classes %} ' ' + {{ item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
11
11
  <a class="ons-section-nav__link" href="{{ item.url }}"{% if isCurrent == true %} aria-current="location"{% endif %}>{{ item.title }}</a>
12
- {% if item.anchors is defined and item.anchors %}
12
+ {% if item.anchors %}
13
13
  <ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
14
14
  {% for anchor in item.anchors %}
15
15
  <li class="ons-section-nav__item ons-list__item">
@@ -8,7 +8,7 @@
8
8
  "legendClasses": params.legendClasses,
9
9
  "dontWrap": params.dontWrap,
10
10
  "error": params.error,
11
- "inline": params.label.inline if params.label is defined and params.label else ''
11
+ "inline": params.label.inline if params.label else ''
12
12
  }) %}
13
13
  {{
14
14
  onsLabel({
@@ -21,16 +21,16 @@
21
21
  <select
22
22
  id="{{ params.id }}"
23
23
  name="{{ params.name }}"
24
- class="ons-input ons-input--select{% if params.classes %} {{ params.classes }}{% endif %}{% if params.error is defined and params.error %} ons-input--error{% endif %}"
25
- {% if params.value is defined and params.value %}value="{{ params.value}}" {% endif %}
26
- {% 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 %}
24
+ class="ons-input ons-input--select{% if params.classes %} {{ params.classes }}{% endif %}{% if params.error %} ons-input--error{% endif %}"
25
+ {% if params.value %}value="{{ params.value}}" {% endif %}
26
+ {% 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 %}
27
27
  >
28
28
  {% for option in params.options %}
29
29
  <option value="{{ option.value | default(option.text) }}"
30
- {% if option.id is defined and option.id %}id="{{ option.id }}" {% endif %}
31
- {% if option.selected is defined and option.selected %}selected {% endif %}
32
- {% if option.disabled is defined and option.disabled %}disabled {% endif %}
33
- {% if params.attributes is defined and params.attributes %}{% for attribute, value in option.attributes %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
30
+ {% if option.id %}id="{{ option.id }}" {% endif %}
31
+ {% if option.selected %}selected {% endif %}
32
+ {% if option.disabled %}disabled {% endif %}
33
+ {% if params.attributes %}{% for attribute, value in option.attributes %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
34
34
  >
35
35
  {{- option.text -}}
36
36
  </option>
@@ -7,7 +7,7 @@
7
7
  {% endif %}
8
8
 
9
9
  {% set list = [] %}
10
- {% if params.facebook is defined and params.facebook and params.facebook == true %}
10
+ {% if params.facebook and params.facebook == true %}
11
11
  {% set facebook =
12
12
  {
13
13
  "url": 'https://www.facebook.com/sharer/sharer.php?u=' ~ params.pageURL|urlencode,
@@ -20,7 +20,7 @@
20
20
 
21
21
  {% set list = (list.push(facebook), list) %}
22
22
  {% endif %}
23
- {% if params.twitter is defined and params.twitter and params.twitter == true %}
23
+ {% if params.twitter and params.twitter == true %}
24
24
  {% set twitter =
25
25
  {
26
26
  "url": 'https://twitter.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageURL|urlencode,
@@ -21,7 +21,8 @@
21
21
  height: auto;
22
22
  margin: inherit;
23
23
  max-height: 20em;
24
- outline: none;
24
+ outline: 3px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
25
+ outline-offset: -4px;
25
26
  overflow: visible;
26
27
  padding: 1rem;
27
28
  position: static;
@@ -1,11 +1,11 @@
1
1
  {% macro onsStatus(params) %}
2
- {% if params.type is defined and params.type %}
2
+ {% if params.type %}
3
3
  {% set typeClass = ' ons-status--' + params.type %}
4
4
  {% else %}
5
5
  {% set typeClass = ' ons-status--info' %}
6
6
  {% endif %}
7
7
 
8
- {% if params.size is defined and params.size == 'small' %}
8
+ {% if params.size == 'small' %}
9
9
  {% set sizeClass = ' ons-status--small' %}
10
10
  {% endif %}
11
11
 
@@ -2,25 +2,25 @@
2
2
  {% set className = "ons-summary" %}
3
3
  {% set titleSize = "2" %}
4
4
 
5
- {% if params.classes is defined and params.classes %}
5
+ {% if params.classes %}
6
6
  {% set className = className + " " + params.classes %}
7
7
  {% endif %}
8
8
 
9
- {% if params.hub is defined and params.hub %}
9
+ {% if params.hub %}
10
10
  {% set className = className + " ons-summary--hub" %}
11
11
  {% endif %}
12
12
  <div class="{{ className }}">
13
13
  {% for summary in params.summaries %}
14
- {% if summary.summaryTitle is defined and summary.summaryTitle %}
14
+ {% if summary.summaryTitle %}
15
15
  <h2 class="ons-summary__title ons-u-mb-m">{{ summary.summaryTitle }}</h2>
16
16
  {% set titleSize = "3" %}
17
17
  {% endif %}
18
18
  {% for group in summary.groups %}
19
- <div {% if group.id is defined and group.id %}id="{{ group.id }}" {% endif %} class="ons-summary__group">
20
- {% if group.groupTitle is defined and group.groupTitle %}
19
+ <div {% if group.id %}id="{{ group.id }}" {% endif %} class="ons-summary__group">
20
+ {% if group.groupTitle %}
21
21
  <h{{ titleSize }} class="ons-summary__group-title">{{ group.groupTitle }}</h{{ titleSize }}>
22
22
  {% endif %}
23
- {% if group.headers is defined and group.headers and group.rows is defined and group.rows %}
23
+ {% if group.headers and group.rows %}
24
24
  <table class="ons-summary__items">
25
25
  <thead class="ons-u-vh">
26
26
  <tr>
@@ -32,23 +32,23 @@
32
32
 
33
33
  {% for row in (group.rows if group.rows is iterable else group.rows.items()) %}
34
34
  {% set itemClass = "" %}
35
- {% if row.error is defined and row.error %} {% set itemClass = " ons-summary__item--error" %}{% endif %}
36
- {% if row.total is defined and row.total %} {% set itemClass = itemClass + " ons-summary__item--total" %}{% endif %}
35
+ {% if row.error %} {% set itemClass = " ons-summary__item--error" %}{% endif %}
36
+ {% if row.total %} {% set itemClass = itemClass + " ons-summary__item--total" %}{% endif %}
37
37
 
38
- <tbody {% if row.id is defined and row.id %}id="{{ row.id }}" {% endif %}class="ons-summary__item{{ itemClass }}">
39
- {% if row.errorMessage is defined and row.errorMessage or (row.rowItems | length > 1 and row.rowTitle) %}
38
+ <tbody {% if row.id %}id="{{ row.id }}" {% endif %}class="ons-summary__item{{ itemClass }}">
39
+ {% if row.errorMessage or (row.rowItems | length > 1 and row.rowTitle) %}
40
40
  <tr class="ons-summary__row">
41
41
  <th colspan="3" class="ons-summary__row-title ons-u-fs-r">{{ row.errorMessage or row.rowTitle }}</th>
42
42
  </tr>
43
43
  {% endif %}
44
44
 
45
45
  {% for rowItem in row.rowItems %}
46
- <tr {% if rowItem.id is defined and rowItem.id %}id="{{ rowItem.id }}" {% endif %}class="ons-summary__row{{ " ons-summary__row--has-values" if rowItem.valueList else "" }}">
46
+ <tr {% if rowItem.id %}id="{{ rowItem.id }}" {% endif %}class="ons-summary__row{{ " ons-summary__row--has-values" if rowItem.valueList else "" }}">
47
47
  <td
48
48
  class="ons-summary__item-title"
49
- {% if rowItem.rowTitleAttributes is defined and rowItem.rowTitleAttributes %}{% for attribute, value in (rowItem.rowTitleAttributes.items() if rowItem.rowTitleAttributes is mapping and rowItem.rowTitleAttributes.items else rowItem.rowTitleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
49
+ {% if rowItem.rowTitleAttributes %}{% for attribute, value in (rowItem.rowTitleAttributes.items() if rowItem.rowTitleAttributes is mapping and rowItem.rowTitleAttributes.items else rowItem.rowTitleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
50
50
  >
51
- {% if rowItem.iconType is defined and rowItem.iconType %}
51
+ {% if rowItem.iconType %}
52
52
  {% from "components/icons/_macro.njk" import onsIcon %}
53
53
  <span class="ons-summary__item-title-icon {% if rowItem.iconType == 'check' %} ons-summary__item-title-icon--check{% endif %}">
54
54
  {{
@@ -62,19 +62,19 @@
62
62
  <div class="ons-summary__item--text{{ ' ons-summary__item-title--text' if rowItem.iconType else "" }}">{{ rowItem.rowTitle | default(row.rowTitle) | safe }}</div>
63
63
 
64
64
  {# Render section status for mobile if is hub #}
65
- {% if params.hub is defined and params.hub and rowItem.valueList is defined and rowItem.valueList %}
65
+ {% if params.hub and rowItem.valueList %}
66
66
  <span class="ons-u-d-no@s ons-u-fs-r"> — {{ rowItem.valueList[0].text | safe }}</span>
67
67
  {% endif %}
68
68
  </td>
69
- {% if rowItem.valueList is defined and rowItem.valueList %}
69
+ {% if rowItem.valueList %}
70
70
  <td
71
71
  class="ons-summary__values"
72
72
  {% if rowItem.actions == null %} colspan="2"{% endif %}
73
- {% if rowItem.attributes is defined and rowItem.attributes %}{% for attribute, value in (rowItem.attributes.items() if rowItem.attributes is mapping and rowItem.attributes.items else rowItem.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
73
+ {% if rowItem.attributes %}{% for attribute, value in (rowItem.attributes.items() if rowItem.attributes is mapping and rowItem.attributes.items else rowItem.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
74
74
  >
75
75
  {% if rowItem.valueList | length == 1 %}
76
76
  <span class="ons-summary__text">{{ rowItem.valueList[0].text | safe }}</span>
77
- {% if rowItem.valueList[0].other is defined and rowItem.valueList[0].other or rowItem.valueList[0].other == 0 %}
77
+ {% if rowItem.valueList[0].other or rowItem.valueList[0].other == 0 %}
78
78
  <ul class="ons-u-mb-no">
79
79
  <li>{{ rowItem.valueList[0].other | safe }}</li>
80
80
  </ul>
@@ -84,7 +84,7 @@
84
84
  {% for value in (rowItem.valueList if rowItem.valueList is iterable else rowItem.valueList.items()) %}
85
85
  <li>
86
86
  <span class="ons-summary__text">{{ value.text | safe }}</span>
87
- {% if value.other is defined and value.other or value.other == 0 %}
87
+ {% if value.other or value.other == 0 %}
88
88
  <ul class="ons-u-mb-no">
89
89
  <li>{{ value.other | safe }}</li>
90
90
  </ul>
@@ -95,15 +95,15 @@
95
95
  {% endif %}
96
96
  </td>
97
97
  {% endif %}
98
- {% if rowItem.actions is defined and rowItem.actions %}
98
+ {% if rowItem.actions %}
99
99
  <td class="ons-summary__actions">
100
100
  {% for action in (rowItem.actions if rowItem.actions is iterable else rowItem.actions.items()) %}
101
101
  {% if loop.index > 1 %}<span class="ons-summary__spacer"></span>{% endif %}
102
102
  <a
103
103
  href="{{ action.url }}"
104
104
  class="ons-summary__button"
105
- {% if action.ariaLabel is defined and action.ariaLabel %} aria-label="{{ action.ariaLabel }}"{% endif %}
106
- {% if action.attributes is defined and action.attributes %}{% for attribute, value in (action.attributes.items() if action.attributes is mapping and action.attributes.items else action.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
105
+ {% if action.ariaLabel %} aria-label="{{ action.ariaLabel }}"{% endif %}
106
+ {% if action.attributes %}{% for attribute, value in (action.attributes.items() if action.attributes is mapping and action.attributes.items else action.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
107
107
  >{{ action.text }}</a>
108
108
  {% endfor %}
109
109
  </td>
@@ -113,13 +113,13 @@
113
113
  </tbody>
114
114
  {% endfor %}
115
115
  </table>
116
- {% elif group.placeholderText is defined and group.placeholderText %}
116
+ {% elif group.placeholderText %}
117
117
  <span class="ons-summary__placeholder">{{ group.placeholderText }}</span>
118
118
  {% endif %}
119
119
 
120
- {% if group.summaryLink is defined and group.summaryLink %}
121
- <div class="ons-summary__link{% if group.placeholderText is defined and group.placeholderText or group.rows is defined and group.rows %} ons-u-pt-s{% endif %}{% if group.placeholderText is not defined and group.rows is defined and group.rows | length > 1 %} ons-u-bt{% endif %}">
122
- <a {% if group.summaryLink.attributes is defined and group.summaryLink.attributes %}{% for attribute, value in (group.summaryLink.attributes.items() if group.summaryLink.attributes is mapping and group.summaryLink.attributes.items else group.summaryLink.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %} href="{{ group.summaryLink.url }}">{{ group.summaryLink.text }}</a>
120
+ {% if group.summaryLink %}
121
+ <div class="ons-summary__link{% if group.placeholderText or group.rows %} ons-u-pt-s{% endif %}{% if group.placeholderText is not defined and group.rows | length > 1 %} ons-u-bt{% endif %}">
122
+ <a {% if group.summaryLink.attributes %}{% for attribute, value in (group.summaryLink.attributes.items() if group.summaryLink.attributes is mapping and group.summaryLink.attributes.items else group.summaryLink.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %} href="{{ group.summaryLink.url }}">{{ group.summaryLink.text }}</a>
123
123
  </div>
124
124
  {% endif %}
125
125
  </div>
@@ -8,20 +8,21 @@
8
8
  <div class="ons-table-scrollable ons-table-scrollable--on">
9
9
  <div class="ons-table-scrollable__content" tabindex="0" role="region" aria-label="{{ params.caption }}. {{ params.ariaLabel | default("Scrollable table") }}">
10
10
  {% endif %}
11
- <table {% if params.id is defined and params.id %}id="{{ params.id }}"{% endif %} class="ons-table{% if params.tableClasses is defined and params.tableClasses %} {{ params.tableClasses }}{% endif %}{% if variants is defined and variants %}{% if variants is not string %}{% for variant in variants %} ons-table--{{ variant }}{% endfor %}{% else %} ons-table--{{ variants }}{% endif %}{% endif %}" {% if params.sortBy is defined and params.sortBy and 'sortable' in variants %}data-aria-sort="{{ params.sortBy }}" data-aria-asc="{{ params.ariaAsc }}" data-aria-desc="{{ params.ariaDesc }}"{% endif %}>
12
- {% if params.caption is defined and params.caption %}
11
+ <table {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-table{% if params.tableClasses %} {{ params.tableClasses }}{% endif %}{% if variants %}{% if variants is not string %}{% for variant in variants %} ons-table--{{ variant }}{% endfor %}{% else %} ons-table--{{ variants }}{% endif %}{% endif %}" {% if params.sortBy and 'sortable' in variants %}data-aria-sort="{{ params.sortBy }}" data-aria-asc="{{ params.ariaAsc }}" data-aria-desc="{{ params.ariaDesc }}"{% endif %}>
12
+ {% if params.caption %}
13
13
  <caption class="ons-table__caption{{ " ons-u-vh" if params.hideCaption }}">{{ params.caption }}</caption>
14
14
  {% endif %}
15
15
  <thead class="ons-table__head">
16
16
  <tr class="ons-table__row">
17
17
  {% for th in params.ths %}
18
- <th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses is defined and th.thClasses }}{{ " ons-table__header--numeric" if th.numeric is defined and th.numeric }}"{% if 'sortable' in variants %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}>
19
- <span {% if 'sortable' in variants %}class="ons-u-vh"{% endif %}>{{- th.value -}}</span>
18
+ <th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses }}{{ " ons-table__header--numeric" if th.numeric }}"{% if 'sortable' in variants %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}>
19
+ <span>{{- th.value -}}</span>
20
20
  {% if 'sortable' in variants %}
21
21
  {{
22
22
  onsIcon({
23
23
  "iconType": "sort-sprite",
24
- "id": th.value
24
+ "id": th.value,
25
+ "classes": 'ons-u-d-no'
25
26
  })
26
27
  }}
27
28
  {% endif %}
@@ -31,10 +32,10 @@
31
32
  </thead>
32
33
  <tbody class="ons-table__body">
33
34
  {% for tr in params.trs %}
34
- <tr class="ons-table__row{{ " ons-table__row--highlight" if tr.highlight }}" {% if tr.name is defined and tr.name %} name="{{ tr.name }}"{% endif %} {% if tr.id is defined and tr.id %} id="{{ tr.id }}"{% endif %}>
35
+ <tr class="ons-table__row{{ " ons-table__row--highlight" if tr.highlight }}" {% if tr.name %} name="{{ tr.name }}"{% endif %} {% if tr.id %} id="{{ tr.id }}"{% endif %}>
35
36
  {% for td in tr.tds %}
36
- <td class="ons-table__cell{{ ' ' + td.tdClasses if td.tdClasses is defined and td.tdClasses }}{{ " ons-table__cell--numeric" if td.numeric is defined and td.numeric }}" {% if td.id is defined and td.id %} id="{{ td.id }}"{% endif %} {% if td.name is defined and td.name %} name="{{ td.name }}"{% endif %} {% if td.data is defined and td.data %} data-th="{{ td.data }}"{% endif %} {% if td.dataSort is defined and td.dataSort %} data-sort-value="{{ td.dataSort }}"{% endif %}>
37
- {% if td.form is defined and td.form %}
37
+ <td class="ons-table__cell{{ ' ' + td.tdClasses if td.tdClasses }}{{ " ons-table__cell--numeric" if td.numeric }}" {% if td.id %} id="{{ td.id }}"{% endif %} {% if td.name %} name="{{ td.name }}"{% endif %} {% if td.data %} data-th="{{ td.data }}"{% endif %} {% if td.dataSort %} data-sort-value="{{ td.dataSort }}"{% endif %}>
38
+ {% if td.form %}
38
39
  <form action="{{ td.form.action }}" method="{{ td.form.method | default('POST')}}">
39
40
  {{
40
41
  onsButton({
@@ -46,14 +47,14 @@
46
47
  "name": td.form.button.name if td.form.button.name
47
48
  })
48
49
  }}
49
- {% if td.form.hiddenFormField is defined and td.form.hiddenFormField %}
50
+ {% if td.form.hiddenFormField %}
50
51
  {% for hiddenField in td.form.hiddenFormField %}
51
- <input type="hidden" {% if hiddenField.name is defined and hiddenField.name %} name="{{ hiddenField.name }}"{% endif %} {% if hiddenField.value is defined and hiddenField.value %} value="{{ hiddenField.value }}"{% endif %} />
52
+ <input type="hidden" {% if hiddenField.name %} name="{{ hiddenField.name }}"{% endif %} {% if hiddenField.value %} value="{{ hiddenField.value }}"{% endif %} />
52
53
  {% endfor %}
53
54
  {% endif %}
54
55
  </form>
55
56
  {% endif %}
56
- {% if td.value is defined and td.value %}
57
+ {% if td.value %}
57
58
  {{ td.value | safe }}
58
59
  {% endif %}
59
60
  </td>
@@ -61,7 +62,7 @@
61
62
  </tr>
62
63
  {% endfor %}
63
64
  </tbody>
64
- {% if params.tfoot is defined and params.tfoot %}
65
+ {% if params.tfoot %}
65
66
  <tfoot class="ons-table__foot">
66
67
  <tr class="ons-table__row">
67
68
  {% for tfootCell in params.tfoot %}