govuk_publishing_components 65.2.2 → 66.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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/component_guide/accessibility-test.js +0 -2
  3. data/app/assets/javascripts/component_guide/application.js +1 -0
  4. data/app/assets/javascripts/component_guide/audit-filter.js +0 -3
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-auto-tracker.js +0 -3
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-copy-tracker.js +0 -4
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +0 -3
  8. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-ecommerce-tracker.js +7 -12
  9. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +0 -3
  10. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-finder-tracker.js +2 -7
  11. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-focus-loss-tracker.js +0 -3
  12. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-change-tracker.js +0 -3
  13. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +6 -9
  14. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +0 -3
  15. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +0 -4
  16. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js +0 -4
  17. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js +1 -6
  18. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js +0 -3
  19. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-search-tracker.js +3 -3
  20. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-smart-answer-results-tracker.js +0 -2
  21. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +0 -4
  22. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-video-tracker.js +0 -4
  23. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/init-ga4.js +0 -5
  24. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +1 -5
  25. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +0 -2
  26. data/app/assets/javascripts/govuk_publishing_components/components/add-another.js +0 -3
  27. data/app/assets/javascripts/govuk_publishing_components/components/app-promo-banner.js +0 -3
  28. data/app/assets/javascripts/govuk_publishing_components/components/button.js +0 -2
  29. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +0 -2
  30. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +0 -2
  31. data/app/assets/javascripts/govuk_publishing_components/components/contents-list-with-body.js +0 -3
  32. data/app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js +0 -3
  33. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +0 -3
  34. data/app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js +0 -3
  35. data/app/assets/javascripts/govuk_publishing_components/components/cross-service-header.js +0 -3
  36. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +0 -2
  37. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +0 -2
  38. data/app/assets/javascripts/govuk_publishing_components/components/file-upload.js +0 -2
  39. data/app/assets/javascripts/govuk_publishing_components/components/global-banner.js +0 -2
  40. data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +0 -3
  41. data/app/assets/javascripts/govuk_publishing_components/components/intervention.js +0 -3
  42. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +0 -2
  43. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +0 -3
  44. data/app/assets/javascripts/govuk_publishing_components/components/metadata.js +0 -3
  45. data/app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js +0 -3
  46. data/app/assets/javascripts/govuk_publishing_components/components/option-select.js +0 -3
  47. data/app/assets/javascripts/govuk_publishing_components/components/password-input.js +0 -2
  48. data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +0 -3
  49. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +0 -2
  50. data/app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js +0 -3
  51. data/app/assets/javascripts/govuk_publishing_components/components/search-with-autocomplete.js +0 -4
  52. data/app/assets/javascripts/govuk_publishing_components/components/select-with-search.js +0 -2
  53. data/app/assets/javascripts/govuk_publishing_components/components/service-navigation.js +0 -2
  54. data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +0 -3
  55. data/app/assets/javascripts/govuk_publishing_components/components/skip-link.js +0 -2
  56. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +0 -3
  57. data/app/assets/javascripts/govuk_publishing_components/components/table.js +0 -3
  58. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +0 -2
  59. data/app/assets/javascripts/govuk_publishing_components/dependencies.js +0 -3
  60. data/app/assets/javascripts/govuk_publishing_components/domain-config.js +0 -1
  61. data/app/assets/javascripts/govuk_publishing_components/initialise-vars.js +7 -0
  62. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +0 -1
  63. data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +0 -4
  64. data/app/assets/javascripts/govuk_publishing_components/lib/extend-object.js +0 -1
  65. data/app/assets/javascripts/govuk_publishing_components/lib/filter-list.js +0 -3
  66. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +0 -2
  67. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +0 -2
  68. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +1 -3
  69. data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +0 -3
  70. data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +0 -2
  71. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +0 -2
  72. data/app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js +0 -1
  73. data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +1 -0
  74. data/app/assets/javascripts/govuk_publishing_components/modules.js +9 -10
  75. data/app/assets/stylesheets/component_guide/application.scss +65 -0
  76. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +13 -3
  77. data/app/controllers/govuk_publishing_components/applications_page_controller.rb +1 -1
  78. data/app/views/govuk_publishing_components/applications_page/show.html.erb +21 -18
  79. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +141 -139
  80. data/app/views/govuk_publishing_components/audit/show.html.erb +1 -0
  81. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +16 -11
  82. data/app/views/govuk_publishing_components/components/feedback/_survey_signup_form.html.erb +8 -6
  83. data/app/views/layouts/govuk_publishing_components/application.html.erb +1 -1
  84. data/config/locales/en.yml +1 -1
  85. data/lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb +2 -2
  86. data/lib/govuk_publishing_components/version.rb +1 -1
  87. data/node_modules/axe-core/axe.js +322 -248
  88. data/node_modules/axe-core/axe.min.js +2 -2
  89. data/node_modules/axe-core/locales/_template.json +7 -0
  90. data/node_modules/axe-core/package.json +1 -1
  91. data/node_modules/axe-core/sri-history.json +4 -0
  92. data/node_modules/choices.js/package.json +1 -1
  93. data/node_modules/choices.js/public/assets/scripts/choices.js +43 -15
  94. data/node_modules/choices.js/public/assets/scripts/choices.min.js +2 -2
  95. data/node_modules/choices.js/public/assets/scripts/choices.mjs +43 -15
  96. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.js +43 -15
  97. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.min.js +2 -2
  98. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.mjs +43 -15
  99. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.js +43 -15
  100. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.min.js +2 -2
  101. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.mjs +43 -15
  102. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.js +43 -15
  103. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.min.js +2 -2
  104. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.mjs +43 -15
  105. data/node_modules/choices.js/public/types/src/scripts/components/input.d.ts +5 -2
  106. data/node_modules/choices.js/src/scripts/choices.ts +9 -4
  107. data/node_modules/choices.js/src/scripts/components/input.ts +39 -9
  108. metadata +3 -2
@@ -1,4 +1,4 @@
1
- /*! choices.js v11.2.1 | © 2026 Josh Johnson | https://github.com/Choices-js/Choices#readme */
1
+ /*! choices.js v11.2.2 | © 2026 Josh Johnson | https://github.com/Choices-js/Choices#readme */
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -558,14 +558,40 @@ var Input = /** @class */ (function () {
558
558
  return this;
559
559
  };
560
560
  /**
561
- * Set the correct input width based on placeholder
562
- * value or input value
561
+ * Set the correct input width based on placeholder value or input value.
562
+ * Renders text into a hidden off-screen span that inherits the input's
563
+ * CSS classes and measures its pixel width, then converts to `ch` units.
564
+ * This correctly handles CJK, Hangul, fullwidth forms, emoji, and any
565
+ * font — no hard-coded code-point ranges required.
563
566
  */
564
567
  Input.prototype.setWidth = function () {
565
- // Resize input to contents or placeholder
566
568
  var element = this.element;
567
- element.style.minWidth = "".concat(element.placeholder.length + 1, "ch");
568
- element.style.width = "".concat(element.value.length + 1, "ch");
569
+ var value = element.value, placeholder = element.placeholder;
570
+ var minWidth = 0;
571
+ var width = 0;
572
+ if (value || placeholder) {
573
+ var e = document.createElement('span');
574
+ e.style.position = 'absolute';
575
+ e.style.visibility = 'hidden';
576
+ e.style.whiteSpace = 'pre';
577
+ e.style.height = 'auto';
578
+ e.style.width = 'auto';
579
+ e.style.minWidth = '1ch';
580
+ addClassesToElement(e, Array.from(element.classList));
581
+ element.after(e);
582
+ var chInPx = parseFloat(getComputedStyle(e).width);
583
+ if (placeholder) {
584
+ e.innerText = placeholder;
585
+ minWidth = parseFloat(getComputedStyle(e).width) / chInPx;
586
+ }
587
+ if (value) {
588
+ e.innerText = value;
589
+ width = parseFloat(getComputedStyle(e).width) / chInPx;
590
+ }
591
+ e.remove();
592
+ }
593
+ element.style.minWidth = "".concat(Math.ceil(minWidth) + 1, "ch");
594
+ element.style.width = "".concat(Math.ceil(width) + 1, "ch");
569
595
  };
570
596
  Input.prototype.setActiveDescendant = function (activeDescendantID) {
571
597
  this.element.setAttribute('aria-activedescendant', activeDescendantID);
@@ -574,9 +600,7 @@ var Input = /** @class */ (function () {
574
600
  this.element.removeAttribute('aria-activedescendant');
575
601
  };
576
602
  Input.prototype._onInput = function () {
577
- if (this.type !== PassedElementTypes.SelectOne) {
578
- this.setWidth();
579
- }
603
+ this.setWidth();
580
604
  };
581
605
  Input.prototype._onPaste = function (event) {
582
606
  if (this.preventPaste) {
@@ -2035,8 +2059,8 @@ var Choices = /** @class */ (function () {
2035
2059
  _this.passedElement.triggerEvent(EventType.showDropdown);
2036
2060
  var activeElement = _this.choiceList.element.querySelector(getClassNamesSelector(_this.config.classNames.selectedState));
2037
2061
  if (activeElement !== null && !isScrolledIntoView(activeElement, _this.choiceList.element)) {
2038
- // We use the native scrollIntoView function instead of choiceList.scrollToChildElement to avoid animated scroll.
2039
- activeElement.scrollIntoView();
2062
+ // scrollIntoView can cause entire page scrolling, scrollToChildElement causes undesired animation
2063
+ _this.choiceList.element.scrollTop = activeElement.offsetTop;
2040
2064
  }
2041
2065
  });
2042
2066
  return this;
@@ -2206,8 +2230,8 @@ var Choices = /** @class */ (function () {
2206
2230
  if (!Array.isArray(fetcher_1)) {
2207
2231
  throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof fetcher_1));
2208
2232
  }
2209
- // recursion with results, it's sync and choices were cleared already
2210
- return this.setChoices(fetcher_1, value, label, false);
2233
+ // eslint-disable-next-line no-param-reassign
2234
+ choicesArrayOrFetcher = fetcher_1;
2211
2235
  }
2212
2236
  if (!Array.isArray(choicesArrayOrFetcher)) {
2213
2237
  throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");
@@ -2245,6 +2269,10 @@ var Choices = /** @class */ (function () {
2245
2269
  });
2246
2270
  _this.unhighlightAll();
2247
2271
  });
2272
+ // ensure any notice is displayed as expected when the dropdown is open
2273
+ if (this.dropdown.isActive && this._canAddUserChoices) {
2274
+ this._canCreateItem(this.input.value);
2275
+ }
2248
2276
  // @todo integrate with Store
2249
2277
  this._searcher.reset();
2250
2278
  return this;
@@ -2797,7 +2825,7 @@ var Choices = /** @class */ (function () {
2797
2825
  if (!config.singleModeForMultiSelect && maxItemCount > 0 && maxItemCount <= this._store.items.length) {
2798
2826
  this.choiceList.element.replaceChildren('');
2799
2827
  this._notice = undefined;
2800
- this._displayNotice(typeof maxItemText === 'function' ? maxItemText(maxItemCount) : maxItemText, NoticeTypes.addChoice);
2828
+ this._displayNotice(typeof maxItemText === 'function' ? maxItemText(maxItemCount) : maxItemText, NoticeTypes.addChoice, false);
2801
2829
  return false;
2802
2830
  }
2803
2831
  if (this._notice && this._notice.type === NoticeTypes.addChoice) {
@@ -3636,7 +3664,7 @@ var Choices = /** @class */ (function () {
3636
3664
  throw new TypeError("".concat(caller, " called for an element which has multiple instances of Choices initialised on it"));
3637
3665
  }
3638
3666
  };
3639
- Choices.version = '11.2.1';
3667
+ Choices.version = '11.2.2';
3640
3668
  return Choices;
3641
3669
  }());
3642
3670
 
@@ -24,8 +24,11 @@ export default class Input {
24
24
  blur(): void;
25
25
  clear(setWidth?: boolean): this;
26
26
  /**
27
- * Set the correct input width based on placeholder
28
- * value or input value
27
+ * Set the correct input width based on placeholder value or input value.
28
+ * Renders text into a hidden off-screen span that inherits the input's
29
+ * CSS classes and measures its pixel width, then converts to `ch` units.
30
+ * This correctly handles CJK, Hangul, fullwidth forms, emoji, and any
31
+ * font — no hard-coded code-point ranges required.
29
32
  */
30
33
  setWidth(): void;
31
34
  setActiveDescendant(activeDescendantID: string): void;
@@ -527,8 +527,8 @@ class Choices {
527
527
  );
528
528
 
529
529
  if (activeElement !== null && !isScrolledIntoView(activeElement, this.choiceList.element)) {
530
- // We use the native scrollIntoView function instead of choiceList.scrollToChildElement to avoid animated scroll.
531
- activeElement.scrollIntoView();
530
+ // scrollIntoView can cause entire page scrolling, scrollToChildElement causes undesired animation
531
+ this.choiceList.element.scrollTop = activeElement.offsetTop;
532
532
  }
533
533
  });
534
534
 
@@ -725,8 +725,8 @@ class Choices {
725
725
  );
726
726
  }
727
727
 
728
- // recursion with results, it's sync and choices were cleared already
729
- return this.setChoices(fetcher, value, label, false);
728
+ // eslint-disable-next-line no-param-reassign
729
+ choicesArrayOrFetcher = fetcher;
730
730
  }
731
731
 
732
732
  if (!Array.isArray(choicesArrayOrFetcher)) {
@@ -778,6 +778,10 @@ class Choices {
778
778
 
779
779
  this.unhighlightAll();
780
780
  });
781
+ // ensure any notice is displayed as expected when the dropdown is open
782
+ if (this.dropdown.isActive && this._canAddUserChoices) {
783
+ this._canCreateItem(this.input.value);
784
+ }
781
785
 
782
786
  // @todo integrate with Store
783
787
  this._searcher.reset();
@@ -1416,6 +1420,7 @@ class Choices {
1416
1420
  this._displayNotice(
1417
1421
  typeof maxItemText === 'function' ? maxItemText(maxItemCount) : maxItemText,
1418
1422
  NoticeTypes.addChoice,
1423
+ false,
1419
1424
  );
1420
1425
 
1421
1426
  return false;
@@ -1,5 +1,6 @@
1
1
  import { ClassNames } from '../interfaces/class-names';
2
- import { PassedElementType, PassedElementTypes } from '../interfaces/passed-element-type';
2
+ import { PassedElementType } from '../interfaces/passed-element-type';
3
+ import { addClassesToElement } from '../lib/utils';
3
4
 
4
5
  export default class Input {
5
6
  element: HTMLInputElement;
@@ -106,14 +107,45 @@ export default class Input {
106
107
  }
107
108
 
108
109
  /**
109
- * Set the correct input width based on placeholder
110
- * value or input value
110
+ * Set the correct input width based on placeholder value or input value.
111
+ * Renders text into a hidden off-screen span that inherits the input's
112
+ * CSS classes and measures its pixel width, then converts to `ch` units.
113
+ * This correctly handles CJK, Hangul, fullwidth forms, emoji, and any
114
+ * font — no hard-coded code-point ranges required.
111
115
  */
112
116
  setWidth(): void {
113
- // Resize input to contents or placeholder
114
117
  const { element } = this;
115
- element.style.minWidth = `${element.placeholder.length + 1}ch`;
116
- element.style.width = `${element.value.length + 1}ch`;
118
+ const { value, placeholder } = element;
119
+ let minWidth = 0;
120
+ let width = 0;
121
+
122
+ if (value || placeholder) {
123
+ const e = document.createElement('span');
124
+ e.style.position = 'absolute';
125
+ e.style.visibility = 'hidden';
126
+ e.style.whiteSpace = 'pre';
127
+ e.style.height = 'auto';
128
+ e.style.width = 'auto';
129
+ e.style.minWidth = '1ch';
130
+ addClassesToElement(e, Array.from(element.classList));
131
+ element.after(e);
132
+ const chInPx = parseFloat(getComputedStyle(e).width);
133
+
134
+ if (placeholder) {
135
+ e.innerText = placeholder;
136
+ minWidth = parseFloat(getComputedStyle(e).width) / chInPx;
137
+ }
138
+
139
+ if (value) {
140
+ e.innerText = value;
141
+ width = parseFloat(getComputedStyle(e).width) / chInPx;
142
+ }
143
+
144
+ e.remove();
145
+ }
146
+
147
+ element.style.minWidth = `${Math.ceil(minWidth) + 1}ch`;
148
+ element.style.width = `${Math.ceil(width) + 1}ch`;
117
149
  }
118
150
 
119
151
  setActiveDescendant(activeDescendantID: string): void {
@@ -125,9 +157,7 @@ export default class Input {
125
157
  }
126
158
 
127
159
  _onInput(): void {
128
- if (this.type !== PassedElementTypes.SelectOne) {
129
- this.setWidth();
130
- }
160
+ this.setWidth();
131
161
  }
132
162
 
133
163
  _onPaste(event: ClipboardEvent): void {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 65.2.2
4
+ version: 66.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -520,6 +520,7 @@ files:
520
520
  - app/assets/javascripts/govuk_publishing_components/components/tabs.js
521
521
  - app/assets/javascripts/govuk_publishing_components/dependencies.js
522
522
  - app/assets/javascripts/govuk_publishing_components/domain-config.js
523
+ - app/assets/javascripts/govuk_publishing_components/initialise-vars.js
523
524
  - app/assets/javascripts/govuk_publishing_components/lib.js
524
525
  - app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js
525
526
  - app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js
@@ -2116,7 +2117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
2116
2117
  requirements:
2117
2118
  - - ">="
2118
2119
  - !ruby/object:Gem::Version
2119
- version: '3.2'
2120
+ version: 3.3.1
2120
2121
  required_rubygems_version: !ruby/object:Gem::Requirement
2121
2122
  requirements:
2122
2123
  - - ">="