@ons/design-system 65.1.0 → 65.2.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.
Files changed (97) hide show
  1. package/README.md +1 -0
  2. package/components/access-code/access-code.scss +3 -3
  3. package/components/access-code/example-access-code-error.njk +1 -1
  4. package/components/access-code/example-access-code.njk +1 -1
  5. package/components/accordion/example-accordion-open.njk +10 -10
  6. package/components/accordion/example-accordion.njk +1 -1
  7. package/components/address-input/example-address-input-editable.njk +2 -2
  8. package/components/address-input/example-address-input-manual.njk +3 -3
  9. package/components/address-input/example-address-input.njk +2 -2
  10. package/components/autosuggest/_autosuggest.scss +3 -8
  11. package/components/autosuggest/_macro.njk +2 -3
  12. package/components/autosuggest/autosuggest.js +2 -1
  13. package/components/autosuggest/autosuggest.spec.js +89 -55
  14. package/components/autosuggest/autosuggest.ui.js +8 -12
  15. package/components/autosuggest/example-autosuggest-country-multiple.njk +4 -3
  16. package/components/autosuggest/example-autosuggest-country.njk +1 -1
  17. package/components/back-link/example-back-link.njk +1 -1
  18. package/components/button/_button.scss +11 -14
  19. package/components/card/example-card-set-with-images.njk +3 -3
  20. package/components/card/example-card-set-with-lists.njk +3 -3
  21. package/components/card/example-card-set.njk +3 -3
  22. package/components/card/example-card.njk +1 -1
  23. package/components/checkboxes/_checkbox.scss +1 -4
  24. package/components/checkboxes/example-checkboxes-disabled.njk +3 -3
  25. package/components/checkboxes/example-checkboxes-error.njk +7 -7
  26. package/components/checkboxes/example-checkboxes-with-descriptions.njk +7 -7
  27. package/components/checkboxes/example-checkboxes-with-hidden-label.njk +9 -9
  28. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +8 -8
  29. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes.njk +8 -8
  30. package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +8 -8
  31. package/components/checkboxes/example-checkboxes-with-revealed-radios.njk +8 -8
  32. package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +4 -4
  33. package/components/checkboxes/example-checkboxes-with-revealed-select.njk +4 -4
  34. package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +6 -6
  35. package/components/checkboxes/example-checkboxes-with-revealed-text-input.njk +6 -6
  36. package/components/checkboxes/example-checkboxes-with-select-all-button.njk +4 -4
  37. package/components/checkboxes/example-checkboxes-with-visible-text-input.njk +6 -6
  38. package/components/checkboxes/example-checkboxes-without-border.njk +3 -3
  39. package/components/checkboxes/example-checkboxes.njk +4 -4
  40. package/components/date-input/example-date-input-error.njk +2 -2
  41. package/components/date-input/example-date-input.njk +1 -1
  42. package/components/details/example-details-with-warning.njk +1 -1
  43. package/components/details/example-details.njk +1 -1
  44. package/components/download-resources/_download-resources.scss +3 -5
  45. package/components/duration/example-duration-error.njk +6 -6
  46. package/components/duration/example-duration.njk +5 -5
  47. package/components/external-link/example-external-link.njk +1 -1
  48. package/components/header/example-header-external-with-service-links.njk +1 -1
  49. package/components/header/example-header-internal.njk +1 -1
  50. package/components/helpers/_grid.scss +6 -0
  51. package/components/helpers/grid.njk +19 -0
  52. package/components/input/_input-type.scss +2 -8
  53. package/components/input/_input.scss +4 -3
  54. package/components/input/example-input-email.njk +1 -1
  55. package/components/input/example-input-number.njk +1 -1
  56. package/components/input/example-input-numeric-values.njk +7 -7
  57. package/components/input/example-input-text-with-character-limit-checker.njk +1 -1
  58. package/components/input/example-input-text-with-description.njk +1 -1
  59. package/components/input/example-input-text.njk +1 -1
  60. package/components/modal/_modal.scss +3 -6
  61. package/components/mutually-exclusive/example-mutually-exclusive-checkboxes.njk +6 -6
  62. package/components/mutually-exclusive/example-mutually-exclusive-date-with-error.njk +2 -2
  63. package/components/mutually-exclusive/example-mutually-exclusive-email.njk +2 -2
  64. package/components/mutually-exclusive/example-mutually-exclusive-multiple-options.njk +5 -5
  65. package/components/navigation/navigation.js +6 -2
  66. package/components/phase-banner/example-phase-banner-alpha.njk +13 -2
  67. package/components/phase-banner/example-phase-banner-beta.njk +13 -2
  68. package/components/radios/example-radios-with-clear-button-expanded.njk +9 -9
  69. package/components/radios/example-radios-with-clear-button.njk +9 -9
  70. package/components/radios/example-radios-with-descriptions.njk +5 -5
  71. package/components/radios/example-radios-with-error.njk +4 -4
  72. package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +8 -8
  73. package/components/radios/example-radios-with-revealed-checkboxes.njk +8 -8
  74. package/components/radios/example-radios-with-revealed-radios-expanded.njk +9 -9
  75. package/components/radios/example-radios-with-revealed-radios.njk +8 -8
  76. package/components/radios/example-radios-with-revealed-select-expanded.njk +5 -5
  77. package/components/radios/example-radios-with-revealed-select.njk +4 -4
  78. package/components/radios/example-radios-with-revealed-text-input-expanded.njk +9 -9
  79. package/components/radios/example-radios-with-revealed-text-input.njk +9 -9
  80. package/components/radios/example-radios-with-visible-text-input.njk +3 -3
  81. package/components/relationships/example-relationships-error.njk +13 -13
  82. package/components/relationships/example-relationships-you.njk +13 -13
  83. package/components/relationships/example-relationships.njk +13 -13
  84. package/components/select/example-select-with-error.njk +1 -1
  85. package/components/select/example-select-with-inline-label.njk +1 -1
  86. package/components/select/example-select.njk +1 -1
  87. package/components/table/_table.scss +7 -3
  88. package/components/textarea/example-textarea-error.njk +1 -1
  89. package/components/upload/example-upload-error.njk +1 -1
  90. package/components/upload/example-upload.njk +1 -1
  91. package/css/main.css +3 -3
  92. package/package.json +8 -10
  93. package/scripts/main.es5.js +1 -1
  94. package/scripts/main.js +1 -1
  95. package/scss/base/_global.scss +3 -2
  96. package/scss/main.scss +1 -0
  97. package/scss/overrides/hcm.scss +10 -10
package/README.md CHANGED
@@ -33,6 +33,7 @@ To enable this we use [nvm (Node Version Manager)](https://github.com/creationix
33
33
 
34
34
  ```bash
35
35
  yarn install
36
+ husky install
36
37
  ```
37
38
 
38
39
  ### Start a local server
@@ -6,17 +6,17 @@
6
6
  text-transform: uppercase;
7
7
  width: 15.1em;
8
8
 
9
- @media all and (min-width: 375px) {
9
+ @media all and (width >= 375px) {
10
10
  font-size: 20px !important;
11
11
  width: 15.1em !important;
12
12
  }
13
13
 
14
- @media all and (max-width: 374px) {
14
+ @media all and (width <= 374px) {
15
15
  letter-spacing: 0;
16
16
  max-width: 12.6em !important;
17
17
  }
18
18
 
19
- @media all and (max-width: 299px) {
19
+ @media all and (width <= 299px) {
20
20
  max-width: 100%;
21
21
  }
22
22
 
@@ -74,7 +74,7 @@ layout: ~
74
74
  {% endset %}
75
75
 
76
76
  {% call onsDetails({
77
- "id": "details",
77
+ "id": "details-access-code-error",
78
78
  "title": "Need to answer separately from your household?",
79
79
  "button": {
80
80
  "close": "Hide this",
@@ -18,7 +18,7 @@ layout: ~
18
18
  <h1 class="ons-u-mt-l">Start study</h1>
19
19
 
20
20
  {{ onsAccessCode({
21
- "id": "access-code",
21
+ "id": "access-code-example",
22
22
  "name": "access-code",
23
23
  "postTextboxLinkText": "Where to find your access code",
24
24
  "postTextboxLinkUrl": "#0",
@@ -13,14 +13,14 @@
13
13
  "name": "dietary",
14
14
  "checkboxes": [
15
15
  {
16
- "id": "data",
16
+ "id": "data-checkbox",
17
17
  "label": {
18
18
  "text": "Data (309)"
19
19
  },
20
20
  "value": "data"
21
21
  },
22
22
  {
23
- "id": "publications",
23
+ "id": "publications-checkbox",
24
24
  "label": {
25
25
  "text": "Publications (137)"
26
26
  },
@@ -33,21 +33,21 @@
33
33
  "name": "name",
34
34
  "checkboxes": [
35
35
  {
36
- "id": "datasets",
36
+ "id": "datasets-checkbox",
37
37
  "label": {
38
38
  "text": "Datasets (100)"
39
39
  },
40
40
  "value": "datasets"
41
41
  },
42
42
  {
43
- "id": "timeseries",
43
+ "id": "timeseries-checkbox",
44
44
  "label": {
45
45
  "text": "Timeseries (20)"
46
46
  },
47
47
  "value": "timeseries"
48
48
  },
49
49
  {
50
- "id": "requested",
50
+ "id": "requested-checkbox",
51
51
  "label": {
52
52
  "text": "User requested data (16)"
53
53
  },
@@ -57,7 +57,7 @@
57
57
  }
58
58
  },
59
59
  {
60
- "id": "areas",
60
+ "id": "areas-checkbox",
61
61
  "label": {
62
62
  "text": "Areas (0)"
63
63
  },
@@ -78,7 +78,7 @@
78
78
  "name": "dietary",
79
79
  "checkboxes": [
80
80
  {
81
- "id": "crime",
81
+ "id": "crime-checkbox",
82
82
  "label": {
83
83
  "text": "Crime (200)"
84
84
  },
@@ -86,14 +86,14 @@
86
86
  "checked": true
87
87
  },
88
88
  {
89
- "id": "education",
89
+ "id": "education-checkbox",
90
90
  "label": {
91
91
  "text": "Education (55)"
92
92
  },
93
- "value": "education"
93
+ "value": "education-checkbox"
94
94
  },
95
95
  {
96
- "id": "disability",
96
+ "id": "disability-checkbox",
97
97
  "label": {
98
98
  "text": "Disability (67)"
99
99
  },
@@ -2,7 +2,7 @@
2
2
 
3
3
  {{
4
4
  onsAccordion({
5
- "id": "accordion",
5
+ "id": "accordion-example",
6
6
  "allButton": {
7
7
  "open": "Show all",
8
8
  "close": "Hide all"
@@ -1,11 +1,11 @@
1
1
  {% from "components/address-input/_macro.njk" import onsAddressInput %}
2
2
 
3
3
  {{ onsAddressInput({
4
- "id": "address",
4
+ "id": "address-input-editable",
5
5
  "dontWrap": true,
6
6
  "label": {
7
7
  "text": "Enter address or postcode and select from results",
8
- "id": "address-label"
8
+ "id": "address-label-input-editable"
9
9
  },
10
10
  "isEditable": true,
11
11
  "mandatory": true,
@@ -1,12 +1,12 @@
1
1
  {% from "components/address-input/_macro.njk" import onsAddressInput %}
2
2
 
3
3
  {{ onsAddressInput({
4
- "id": "address",
4
+ "id": "address-input-manual",
5
5
  "dontWrap": true,
6
6
  "manualEntry": true,
7
7
  "label": {
8
8
  "text": "Enter address or postcode and select from results",
9
- "id": "address-label"
9
+ "id": "address-label-input-manual"
10
10
  },
11
11
  "line1": {
12
12
  "label": "Address line 1"
@@ -20,4 +20,4 @@
20
20
  "postcode": {
21
21
  "label": "Postcode"
22
22
  }
23
- }) }}
23
+ }) }}
@@ -1,11 +1,11 @@
1
1
  {% from "components/address-input/_macro.njk" import onsAddressInput %}
2
2
 
3
3
  {{ onsAddressInput({
4
- "id": "address",
4
+ "id": "address-input",
5
5
  "dontWrap": true,
6
6
  "label": {
7
7
  "text": "Enter address or postcode and select from results",
8
- "id": "address-label"
8
+ "id": "address-label-input"
9
9
  },
10
10
  "isEditable": false,
11
11
  "mandatory": true,
@@ -51,7 +51,7 @@
51
51
  border-bottom: 1px solid var(--ons-color-input-border);
52
52
  }
53
53
 
54
- &:not(&--no-results):not(&--more-results):hover,
54
+ &:not(&--no-results, &--more-results):hover,
55
55
  &--focused:not(&--no-results) {
56
56
  background: var(--ons-color-text-link-hover);
57
57
  border-color: var(--ons-color-text-link-hover);
@@ -63,7 +63,7 @@
63
63
  }
64
64
  }
65
65
 
66
- &:active:not(&--no-results):not(&--more-results) {
66
+ &:active:not(&--no-results, &--more-results) {
67
67
  background: var(--ons-color-focus);
68
68
  color: var(--ons-color-text-link-focus);
69
69
 
@@ -91,11 +91,6 @@
91
91
  }
92
92
  }
93
93
 
94
- &__wrapper {
95
- max-width: max-content;
96
- width: 100%;
97
- }
98
-
99
94
  &__panel.ons-panel--warn {
100
95
  background: none;
101
96
  border: 0;
@@ -133,7 +128,7 @@
133
128
  &--header {
134
129
  .ons-autosuggest__results {
135
130
  border: none;
136
- box-shadow: 0 0 5px 0 rgba(34, 34, 34, 0.6);
131
+ box-shadow: 0 0 5px 0 rgb(34 34 34 / 60%);
137
132
  left: 0;
138
133
  position: absolute;
139
134
  z-index: 10;
@@ -28,6 +28,7 @@
28
28
  {% if params.tooManyResults %}data-too-many-results="{{ params.tooManyResults }}"{% endif %}
29
29
  {% if params.errorMessageAPI %}data-error-api="{{ params.errorMessageAPI }}"{% endif %}
30
30
  {% if params.errorMessageAPILinkText %}data-error-api-link-text="{{ params.errorMessageAPILinkText }}"{% endif %}
31
+ {% if params.language %}data-lang="{{ params.language }}"{% endif %}
31
32
  {% if params.options %}
32
33
  {% if params.options.oneYearAgo %}data-options-one-year-ago="true"{% endif %}
33
34
  {% if params.options.regionCode %}data-options-region-code="{{ params.options.regionCode }}"{% endif %}
@@ -36,14 +37,13 @@
36
37
  >
37
38
 
38
39
  {% set autosuggestResults %}
39
- <div class="ons-autosuggest__results ons-js-autosuggest-results">
40
+ <div class="ons-autosuggest__results ons-js-autosuggest-results{% if params.width %} ons-input--w-{{ params.width }}{% else %} ons-input--w-20{% endif %}">
40
41
  <div id="{{ params.resultsTitleId }}" class="ons-autosuggest__results-title ons-u-fs-s">{{ params.resultsTitle }}</div>
41
42
  <ul class="ons-autosuggest__listbox ons-js-autosuggest-listbox" title="{{ params.resultsTitle }}" role="listbox" id="{{ params.id }}-listbox" tabindex="-1"></ul>
42
43
  </div>
43
44
  <div class="ons-autosuggest__instructions ons-u-vh ons-js-autosuggest-instructions" id="{{ params.id }}-instructions" tabindex="-1">{{ params.instructions }}</div>
44
45
  <div class="ons-autosuggest__status ons-u-vh ons-js-autosuggest-aria-status" aria-live="assertive" aria-atomic="true" role="status" tabindex="-1"></div>
45
46
  {% endset %}
46
- <div class="ons-autosuggest__wrapper">
47
47
  {{ onsInput({
48
48
  "id": params.id,
49
49
  "classes": "ons-js-autosuggest-input " + (params.classes if params.classes else ''),
@@ -69,6 +69,5 @@
69
69
  {% if not params.mutuallyExclusive %}
70
70
  {{ autosuggestResults | safe }}
71
71
  {% endif %}
72
- </div>
73
72
  </div>
74
73
  {% endmacro %}
@@ -3,6 +3,7 @@ import AutosuggestUI from './autosuggest.ui';
3
3
  export default class Autosuggest {
4
4
  constructor(context) {
5
5
  this.context = context;
6
+ this.language = context.getAttribute('data-lang');
6
7
 
7
8
  this.autosuggest = new AutosuggestUI({
8
9
  context,
@@ -13,7 +14,7 @@ export default class Autosuggest {
13
14
  }
14
15
 
15
16
  get lang() {
16
- return document.documentElement.getAttribute('lang').toLowerCase();
17
+ return !this.language ? document.documentElement.getAttribute('lang').toLowerCase() : this.language.toLowerCase();
17
18
  }
18
19
 
19
20
  async onSelect(result) {