hmrc-frontend 5.62.0 → 6.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 (55) hide show
  1. package/README.md +54 -1
  2. package/govuk-prototype-kit.config.json +1 -1
  3. package/hmrc/VERSION.txt +1 -1
  4. package/hmrc/{accessible-autocomplete-5.62.0.css → accessible-autocomplete-6.1.0.css} +2 -2
  5. package/hmrc/{accessible-autocomplete-5.62.0.js → accessible-autocomplete-6.1.0.js} +1 -16
  6. package/hmrc/accessible-autocomplete.js +1 -2
  7. package/hmrc/accessible-autocomplete.scss +3 -3
  8. package/hmrc/all-govuk-and-hmrc.js +2 -5
  9. package/hmrc/all-govuk-and-hmrc.scss +1 -1
  10. package/hmrc/all.js +81 -546
  11. package/hmrc/all.scss +0 -1
  12. package/hmrc/components/account-menu/_account-menu.scss +4 -24
  13. package/hmrc/components/account-menu/account-menu.js +0 -1
  14. package/hmrc/components/add-to-a-list/_add-to-a-list.scss +4 -4
  15. package/hmrc/components/back-link-helper/_back-link-helper.scss +4 -0
  16. package/hmrc/components/banner/template.njk +0 -5
  17. package/hmrc/components/currency-input/_currency-input.scss +4 -4
  18. package/hmrc/components/header/template.njk +18 -33
  19. package/hmrc/components/internal-header/README.md +1 -1
  20. package/hmrc/components/internal-header/template.njk +14 -18
  21. package/hmrc/components/list-with-actions/_list-with-actions.scss +3 -3
  22. package/hmrc/components/timeline/_timeline.scss +1 -1
  23. package/hmrc/components/timeout-dialog/_timeout-dialog.scss +4 -9
  24. package/hmrc/components/timeout-dialog/dialog.js +1 -2
  25. package/hmrc/components/timeout-dialog/timeout-dialog.js +0 -5
  26. package/hmrc/components/timeout-dialog/utils.js +3 -4
  27. package/hmrc/components/timeout-dialog/validate-input.js +0 -2
  28. package/hmrc/components/user-research-banner/_user-research-banner.scss +3 -3
  29. package/hmrc/govuk/images/favicon.svg +4 -0
  30. package/hmrc/govuk/images/govuk-icon-180.png +0 -0
  31. package/hmrc/govuk/images/govuk-icon-192.png +0 -0
  32. package/hmrc/govuk/images/govuk-icon-512.png +0 -0
  33. package/hmrc/govuk/images/govuk-icon-mask.svg +3 -0
  34. package/hmrc/hmrc-frontend-6.1.0.min.css +4 -0
  35. package/hmrc/hmrc-frontend-6.1.0.min.js +3 -0
  36. package/hmrc/maps/accessible-autocomplete-6.1.0.css.map +1 -0
  37. package/hmrc/maps/hmrc-frontend-6.1.0.min.css.map +1 -0
  38. package/hmrc/maps/hmrc-frontend-6.1.0.min.js.map +1 -0
  39. package/package.json +2 -2
  40. package/hmrc/all-govuk-and-hmrc-ie8.scss +0 -3
  41. package/hmrc/all-ie8.scss +0 -6
  42. package/hmrc/common.js +0 -17
  43. package/hmrc/govuk/images/govuk-apple-touch-icon-152x152.png +0 -0
  44. package/hmrc/govuk/images/govuk-apple-touch-icon-167x167.png +0 -0
  45. package/hmrc/govuk/images/govuk-apple-touch-icon-180x180.png +0 -0
  46. package/hmrc/govuk/images/govuk-apple-touch-icon.png +0 -0
  47. package/hmrc/govuk/images/govuk-logotype-crown.png +0 -0
  48. package/hmrc/govuk/images/govuk-mask-icon.svg +0 -7
  49. package/hmrc/hmrc-frontend-5.62.0.min.css +0 -4
  50. package/hmrc/hmrc-frontend-5.62.0.min.js +0 -3
  51. package/hmrc/hmrc-frontend-ie8-5.62.0.min.css +0 -2
  52. package/hmrc/maps/accessible-autocomplete-5.62.0.css.map +0 -1
  53. package/hmrc/maps/hmrc-frontend-5.62.0.min.css.map +0 -1
  54. package/hmrc/maps/hmrc-frontend-5.62.0.min.js.map +0 -1
  55. package/hmrc/maps/hmrc-frontend-ie8-5.62.0.min.css.map +0 -1
package/README.md CHANGED
@@ -46,7 +46,60 @@ npm install
46
46
 
47
47
  For use in frontend microservices running on MDTP, please refer to the [README](https://www.github.com/hmrc/play-frontend-hmrc)
48
48
  in play-frontend-hmrc.
49
-
49
+
50
+ ## Explanations
51
+
52
+ ### Relative `@import`s and SASS load paths
53
+
54
+ Our SASS needs to be compilable in three different contexts:
55
+
56
+ 1. Within the library itself
57
+ 2. Within the node_modules folder of prototypes
58
+ 3. Within the folder that webjar assets get extracted to in tax services
59
+
60
+ [SASS load paths](https://sass-lang.com/documentation/at-rules/use/#load-paths) are folders that SASS will look in for
61
+ paths you try to `@import` SASS files from.
62
+
63
+ #### How will `@import "../../govuk-frontend";` be resolved in these different contexts?
64
+
65
+ ##### 1. Within the library itself during release and local development
66
+
67
+ The govuk-frontend dependency will be located in the node_modules directory, so it will not exist
68
+ at `../../govuk-frontend` relative to the SASS files in the `src/` directory.
69
+
70
+ However, because we are doing the compilation ourselves, we can modify the SASS load paths - and so we
71
+ add `node_modules` folder (where govuk-frontend will be located) via the "includePaths" option of the SASS library we
72
+ use.
73
+
74
+ Then, to resolve `@import "../../govuk-frontend";`, the SASS compiler will first try to find the file
75
+ at `../../govuk-frontend` relative to the file doing the `@import`. Which won't be found, so then it will discard the
76
+ relative parts of the path and try to locate it within any of the folders in the configured SASS load paths - which in
77
+ this case will just be node_modules, and it will be found in `node_modules/govuk-frontend`.
78
+
79
+ Which means you could (though only theoretically, as you will be prevented by automated tests) have any relative path
80
+ prefix at the start of your `@imports` as long as the rest of the path is something that exists in the `node_modules`
81
+ folder.
82
+
83
+ ##### 2. Within the node_modules folder of prototypes
84
+
85
+ In this case, we aren't able to add to the SASS load paths, so the relative parts at the start of our `@import` paths
86
+ matter.
87
+
88
+ So [src/all-govuk-and-hmrc.scss](src/all-govuk-and-hmrc.scss) will be installed
89
+ to `node_modules/hmrc-frontend/hmrc/all-govuk-and-hmrc.scss` and `@import`s of external dependencies from this file will
90
+ need to traverse up two levels to get to the node_modules folder, so `@import "../../govuk-frontend";` will resolve
91
+ to `node_modules/govuk-frontend`.
92
+
93
+ We have
94
+ an [automated test to ensure that we don't use an invalid relative path that would break this use case.](/tasks/gulp/__tests__/after-build-package.test.js#L140-L151)
95
+
96
+ ##### 3. Within the folder that webjar assets get extracted to in tax services
97
+
98
+ The sbt-sassify plugin used by most tax services to compile SASS also has no way to add to the SASS load paths. Luckily,
99
+ the subfolder structure that assets from webjars are extracted into matches what you'd find in node_modules, so the
100
+ relative import paths that work for node_modules for prototypes will also work here (so long as you've got the
101
+ govuk-frontend webjar in your project.)
102
+
50
103
  ## How to contribute
51
104
 
52
105
  ### Design patterns
@@ -10,7 +10,7 @@
10
10
  "pluginDependencies": [
11
11
  {
12
12
  "packageName": "govuk-frontend",
13
- "minVersion": "4.7.0"
13
+ "minVersion": "5.0.0"
14
14
  }
15
15
  ],
16
16
  "assets": [
package/hmrc/VERSION.txt CHANGED
@@ -1 +1 @@
1
- 5.62.0
1
+ 6.1.0
@@ -1,2 +1,2 @@
1
- .autocomplete__wrapper{position:relative}.autocomplete__hint,.autocomplete__input{-webkit-appearance:none;border:2px solid #0b0c0c;border-radius:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin-bottom:0;width:100%}.autocomplete__input{background-color:rgba(0,0,0,0);position:relative}.autocomplete__hint{color:#b1b4b6;position:absolute}.autocomplete__input--default{padding:5px}.autocomplete__input--focused{outline:3px solid #fd0;outline-offset:0;-webkit-box-shadow:inset 0 0 0 2px;box-shadow:inset 0 0 0 2px}.autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{-webkit-box-shadow:rgba(0,0,0,.256863) 0 2px 6px;box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}@media (-ms-high-contrast:active),(forced-colors:active){.autocomplete__menu{border-color:FieldText}.autocomplete__option{background-color:Field;color:FieldText}.autocomplete__option--focused,.autocomplete__option:hover{forced-color-adjust:none;background-color:SelectedItem;border-color:SelectedItem;color:SelectedItemText;outline-color:SelectedItemText}}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:16px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:19px;line-height:1.31579}}.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:16px;font-size:1rem;line-height:1.25}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-family:sans-serif}}@media (min-width:40.0625em){.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-size:19px;font-size:1.1875rem;line-height:1.31579}}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-size:14pt;line-height:1.15}}
2
- /*# sourceMappingURL=maps/accessible-autocomplete-5.62.0.css.map */
1
+ .autocomplete__wrapper{position:relative}.autocomplete__hint,.autocomplete__input{-webkit-appearance:none;border:2px solid #0b0c0c;border-radius:0;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin-bottom:0;width:100%}.autocomplete__input{background-color:rgba(0,0,0,0);position:relative}.autocomplete__hint{color:#b1b4b6;position:absolute}.autocomplete__input--default{padding:5px}.autocomplete__input--focused{outline:3px solid #fd0;outline-offset:0;-webkit-box-shadow:inset 0 0 0 2px;box-shadow:inset 0 0 0 2px}.autocomplete__input--show-all-values{padding:5px 34px 5px 5px;cursor:pointer}.autocomplete__dropdown-arrow-down{z-index:-1;display:inline-block;position:absolute;right:8px;width:24px;height:24px;top:10px}.autocomplete__menu{background-color:#fff;border:2px solid #0b0c0c;border-top:0;color:#0b0c0c;margin:0;max-height:342px;overflow-x:hidden;padding:0;width:100%;width:calc(100% - 4px)}.autocomplete__menu--visible{display:block}.autocomplete__menu--hidden{display:none}.autocomplete__menu--overlay{-webkit-box-shadow:rgba(0,0,0,.256863) 0 2px 6px;box-shadow:0 2px 6px rgba(0,0,0,.256863);left:0;position:absolute;top:100%;z-index:100}.autocomplete__menu--inline{position:relative}.autocomplete__option{border-left-width:0;border-bottom:1px solid #b1b4b6;border-right-width:0;border-top-width:1px;cursor:pointer;display:block;position:relative}.autocomplete__option>*{pointer-events:none}.autocomplete__option:first-of-type{border-top-width:0}.autocomplete__option:last-of-type{border-bottom-width:0}.autocomplete__option--odd{background-color:#fafafa}.autocomplete__option--focused,.autocomplete__option:hover{background-color:#1d70b8;border-color:#1d70b8;color:#fff;outline:0}@media (-ms-high-contrast:active),(forced-colors:active){.autocomplete__menu{border-color:FieldText}.autocomplete__option{background-color:Field;color:FieldText}.autocomplete__option--focused,.autocomplete__option:hover{forced-color-adjust:none;background-color:SelectedItem;border-color:SelectedItem;color:SelectedItemText;outline-color:SelectedItemText}}.autocomplete__option--no-results{background-color:#fafafa;color:#646b6f;cursor:not-allowed}.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:16px;line-height:1.25}.autocomplete__hint,.autocomplete__option{padding:5px}@media (min-width:641px){.autocomplete__hint,.autocomplete__input,.autocomplete__option{font-size:19px;line-height:1.31579}}.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-family:GDS Transport,arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-weight:400;font-size:1rem;line-height:1.25}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-family:sans-serif}}@media (min-width:40.0625em){.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-size:1.1875rem;line-height:1.31579}}@media print{.autocomplete__hint,.autocomplete__input,.autocomplete__wrapper{font-size:14pt;line-height:1.15}}
2
+ /*# sourceMappingURL=maps/accessible-autocomplete-6.1.0.css.map */
@@ -1468,21 +1468,6 @@
1468
1468
 
1469
1469
  var HMRCAccessibleAutocomplete = unwrapExports(accessibleAutocomplete_min);
1470
1470
 
1471
- /**
1472
- * TODO: Ideally this would be a NodeList.prototype.forEach polyfill
1473
- * This seems to fail in IE8, requires more investigation.
1474
- * See: https://github.com/imagitama/nodelist-foreach-polyfill
1475
- */
1476
- // eslint-disable-next-line consistent-return
1477
- function nodeListForEach(nodes, callback) {
1478
- if (window.NodeList.prototype.forEach) {
1479
- return nodes.forEach(callback);
1480
- }
1481
- for (var i = 0; i < nodes.length; i += 1) {
1482
- callback.call(window, nodes[i], i, nodes);
1483
- }
1484
- }
1485
-
1486
1471
  function AccessibleAutoComplete($module, window, document) {
1487
1472
  this.$module = $module;
1488
1473
  this.window = window;
@@ -1530,7 +1515,7 @@
1530
1515
  window.HMRCAccessibleAutocomplete = HMRCAccessibleAutocomplete;
1531
1516
  var $AccessibleAutocomplete = document.querySelectorAll('select[data-module="hmrc-accessible-autocomplete"]');
1532
1517
  if ($AccessibleAutocomplete) {
1533
- nodeListForEach($AccessibleAutocomplete, function (selectElement) {
1518
+ $AccessibleAutocomplete.forEach(function (selectElement) {
1534
1519
  new AccessibleAutoComplete(selectElement, window, document).init();
1535
1520
  });
1536
1521
  }
@@ -1,12 +1,11 @@
1
1
  import HMRCAccessibleAutocomplete from 'accessible-autocomplete';
2
- import { nodeListForEach } from './common';
3
2
  import AccessibleAutoComplete from './components/accessible-autocomplete/accessible-autocomplete';
4
3
 
5
4
  window.HMRCAccessibleAutocomplete = HMRCAccessibleAutocomplete;
6
5
 
7
6
  const $AccessibleAutocomplete = document.querySelectorAll('select[data-module="hmrc-accessible-autocomplete"]');
8
7
  if ($AccessibleAutocomplete) {
9
- nodeListForEach($AccessibleAutocomplete, (selectElement) => {
8
+ $AccessibleAutocomplete.forEach((selectElement) => {
10
9
  new AccessibleAutoComplete(selectElement, window, document).init();
11
10
  });
12
11
  }
@@ -1,8 +1,8 @@
1
1
  $govuk-include-default-font-face: false;
2
2
 
3
- @import "../../govuk-frontend/govuk/settings/all";
4
- @import "../../govuk-frontend/govuk/tools/all";
5
- @import "../../govuk-frontend/govuk/helpers/all";
3
+ @import "../../govuk-frontend/dist/govuk/settings/all";
4
+ @import "../../govuk-frontend/dist/govuk/tools/all";
5
+ @import "../../govuk-frontend/dist/govuk/helpers/all";
6
6
  @import "../../accessible-autocomplete/dist/accessible-autocomplete.min";
7
7
 
8
8
  .autocomplete__wrapper,
@@ -1,8 +1,5 @@
1
- import GOVUKFrontend from 'govuk-frontend/govuk/all';
1
+ import { initAll } from 'govuk-frontend/dist/govuk/govuk-frontend.min';
2
2
  import HMRCFrontend from './all';
3
3
 
4
- window.GOVUKFrontend = GOVUKFrontend;
5
- window.HMRCFrontend = HMRCFrontend;
6
-
7
- GOVUKFrontend.initAll();
4
+ initAll();
8
5
  HMRCFrontend.initAll();
@@ -3,6 +3,6 @@ $hmrc-assets-path: "";
3
3
  $govuk-assets-path: "govuk/";
4
4
  $govuk-new-link-styles: true;
5
5
 
6
- @import "../../govuk-frontend/govuk/all";
6
+ @import "../../govuk-frontend/dist/govuk/all";
7
7
  @import "components/all";
8
8
  @import "hmrc-frontend-print-overrides";