govuk_publishing_components 64.1.1 → 64.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ce0c3f4602a7fc50dd1f1f38a9d177c256c320842afd37f83260571361c8aef
4
- data.tar.gz: 851ec585153e68a005871ad0a242130d0e8df04e10902c888750f51186a63410
3
+ metadata.gz: b76aa67410518b26c0c6d78c41091e672f6e365fc88b9da459cceb52839edcbb
4
+ data.tar.gz: 4ce5beffe1d098ae456534a6bb82e414092b645e96b0b342f75700c6b237a635
5
5
  SHA512:
6
- metadata.gz: 994f0af2defdd9971a6c22b14e039e9afc801ef18d704527287fc6d355ba1a2d9ea2c898fd1a067992e7a6f289529c8844e4822f8e855b69cfbcdad204dd4ea7
7
- data.tar.gz: b9b4edbc35f12d6373aca1df522393529da9124a65eb64b8598c120963815be5f405b29dede59ea5a9277123c1d1632e2753ecc9d9b727bcb0a62e5932cc9b3b
6
+ metadata.gz: e7212d1dd0e31d1a87adf5463afb9b57b0751a398adabf47357f93586499ac70b2009c6032b9a4c356f9e07f63c9ef7d968041bcabc01d784a708d7703df704d
7
+ data.tar.gz: e3793bc2726f8e95f930dabcaf0a0cd8bd8e3bf14077c105b757878986fce456a74a9e1cc492488ad7f5be0bd3bc14cd5f9bed9cc54e260e763ef2a820168764
@@ -49,7 +49,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
49
49
 
50
50
  this.$html.classList.add('gem-o-template--modal')
51
51
  this.$body.classList.add('gem-o-template__body--modal')
52
- this.$body.classList.add('gem-o-template__body--blur')
53
52
  this.$focusedElementBeforeOpen = document.activeElement
54
53
  this.$module.style.display = 'block'
55
54
  this.$dialogBox.focus()
@@ -64,7 +63,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
64
63
 
65
64
  this.$html.classList.remove('gem-o-template--modal')
66
65
  this.$body.classList.remove('gem-o-template__body--modal')
67
- this.$body.classList.remove('gem-o-template__body--blur')
68
66
  this.$module.style.display = 'none'
69
67
  this.$focusedElementBeforeOpen.focus()
70
68
 
@@ -13,6 +13,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}
13
13
  return
14
14
  }
15
15
 
16
+ const blankOptionText = 'Select none'
16
17
  const placeholderOption = this.module.querySelector(
17
18
  'option[value=""]:first-child'
18
19
  )
@@ -42,6 +43,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}
42
43
  const inner = this.containerInner.element
43
44
  const input = this.input.element
44
45
  inner.prepend(input)
46
+ } else {
47
+ // Update text for blank option in the hidden select
48
+ const selectElement = this.passedElement.element
49
+ if (selectElement.id.search('blank') > 0) {
50
+ selectElement.firstChild.innerText = blankOptionText
51
+ }
52
+ // Update text for blank option in the choices dropdown
53
+ // choices.js 'lastChild' in this context is the listbox of choices:
54
+ const listbox = this.dropdown.element.lastChild
55
+ // choices.js 'firstChild' in this context is the first option.
56
+ // This always displays "Select One" for selects with a blank option:
57
+ var blankOption = listbox.firstChild
58
+ if (blankOption && blankOption.id.search('blank') > 0) {
59
+ blankOption.innerText = blankOptionText
60
+ }
45
61
  }
46
62
  // Add aria-labelledby to the listbox as well as the combobox
47
63
  const listbox = this.itemList.element
@@ -54,6 +70,23 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}
54
70
  }
55
71
  })
56
72
 
73
+ // Reset blank 'Select One' to 'Select None' on each change
74
+ // This is because choices.js rebuilds the widget on each
75
+ // change event and resets the text. We can't use the preferred
76
+ // refresh method as this loses the current state of the dropdown.
77
+ const selectElement = this.choices.passedElement.element
78
+ const listbox = this.choices.dropdown.element.lastChild
79
+ selectElement.addEventListener(
80
+ 'change',
81
+ function (event) {
82
+ var blankOption = listbox.firstChild
83
+ if (blankOption && blankOption.id.search('blank') > 0) {
84
+ blankOption.innerText = blankOptionText
85
+ }
86
+ },
87
+ false
88
+ )
89
+
57
90
  this.module.choices = this.choices
58
91
  }
59
92
 
@@ -286,7 +286,9 @@
286
286
  return sinceNavigationStart;
287
287
  }
288
288
 
289
- var version = "4.4.2";
289
+ var version = "4.4.3";
290
+ var pkg = {
291
+ version: version};
290
292
 
291
293
  function padStart(str, length$1, char) {
292
294
  while (str[length] < length$1) {
@@ -295,7 +297,8 @@
295
297
  return str;
296
298
  }
297
299
 
298
- var VERSION = version;
300
+ var pkgVersion = pkg.version;
301
+ var VERSION = pkgVersion;
299
302
  /**
300
303
  * Returns the version of the script as a float to be stored in legacy systems that do not support
301
304
  * string versions.
@@ -458,7 +461,7 @@
458
461
  emit("beacon", payload);
459
462
  }
460
463
  }
461
- catch (e) {
464
+ catch (_b) {
462
465
  // Intentionally empty; handled below
463
466
  }
464
467
  if (!this.isSent) {
@@ -636,7 +639,7 @@
636
639
  return currentSelector;
637
640
  }
638
641
  }
639
- catch (error) {
642
+ catch (_a) {
640
643
  // Do nothing.
641
644
  }
642
645
  return selector;
@@ -1461,7 +1464,7 @@
1461
1464
  // Seeing "Permission denied" errors, so do a simple try-catch.
1462
1465
  bCancelable = evt.cancelable;
1463
1466
  }
1464
- catch (e) {
1467
+ catch (_a) {
1465
1468
  // bail - no need to return anything
1466
1469
  logger.logEvent(52 /* LogEvent.InputEventPermissionError */);
1467
1470
  return;
@@ -2053,7 +2056,7 @@
2053
2056
  try {
2054
2057
  size += e.innerHTML[length];
2055
2058
  }
2056
- catch (e) {
2059
+ catch (_a) {
2057
2060
  // It seems like IE throws an error when accessing the innerHTML property
2058
2061
  logger.logEvent(53 /* LogEvent.InnerHtmlAccessError */);
2059
2062
  return -1;
@@ -2359,7 +2362,7 @@
2359
2362
  curtop += el.offsetTop;
2360
2363
  el = el.offsetParent;
2361
2364
  }
2362
- catch (e) {
2365
+ catch (_a) {
2363
2366
  // If we get an exception, just return the current values.
2364
2367
  return [curleft, curtop];
2365
2368
  }
@@ -2681,7 +2684,7 @@
2681
2684
  target = e.target;
2682
2685
  }
2683
2686
  }
2684
- catch (e) {
2687
+ catch (_a) {
2685
2688
  logger.logEvent(54 /* LogEvent.EventTargetAccessError */);
2686
2689
  }
2687
2690
  if (target) {
@@ -2827,7 +2830,7 @@
2827
2830
  }
2828
2831
  }
2829
2832
  }
2830
- catch (e) {
2833
+ catch (_a) {
2831
2834
  logger.logEvent(55 /* LogEvent.CookieReadError */);
2832
2835
  }
2833
2836
  return undefined;
@@ -2842,7 +2845,7 @@
2842
2845
  (globalConfig.cookieDomain ? "; domain=" + globalConfig.cookieDomain : "") +
2843
2846
  "; path=/; SameSite=Lax";
2844
2847
  }
2845
- catch (e) {
2848
+ catch (_a) {
2846
2849
  logger.logEvent(56 /* LogEvent.CookieSetError */);
2847
2850
  }
2848
2851
  }
@@ -2994,9 +2997,9 @@
2994
2997
  */
2995
2998
  function _runCommand(_a) {
2996
2999
  var fn = _a[0], args = _a.slice(1);
2997
- if (typeof globalLux[fn] === "function") {
2998
- // eslint-disable-next-line @typescript-eslint/ban-types
2999
- globalLux[fn].apply(globalLux, args);
3000
+ var method = globalLux[fn];
3001
+ if (typeof method === "function") {
3002
+ method.apply(globalLux, args);
3000
3003
  }
3001
3004
  }
3002
3005
  // Process the command queue
@@ -4,6 +4,10 @@
4
4
  // needs to be this specific to override govuk-heading
5
5
  .gem-c-heading__text {
6
6
  margin: 0;
7
+ // improve visual layout of headings
8
+ // set balance as a fallback for firefox, pretty for other browsers
9
+ text-wrap: balance;
10
+ text-wrap: pretty;
7
11
  }
8
12
  }
9
13
 
@@ -13,7 +13,7 @@
13
13
  @include govuk-text-colour;
14
14
 
15
15
  @include govuk-media-query($until: tablet) {
16
- flex-direction: row-reverse;
16
+ flex-direction: column-reverse;
17
17
  gap: govuk-spacing(3);
18
18
  }
19
19
  }
@@ -142,7 +142,7 @@
142
142
  border-top: none;
143
143
  }
144
144
 
145
- @include govuk-media-query($until: "mobile") {
145
+ @include govuk-media-query($until: mobile) {
146
146
  flex-direction: column-reverse;
147
147
  }
148
148
  }
@@ -71,10 +71,9 @@ $govuk-modal-wide-breakpoint: $govuk-page-width + $govuk-modal-margin * 2 + $gov
71
71
  left: 0;
72
72
  width: 100%;
73
73
  height: 100%;
74
- opacity: .8;
75
- background: govuk-colour("black");
76
74
  pointer-events: none;
77
75
  touch-action: none;
76
+ backdrop-filter: blur(2px) brightness(0.4);
78
77
  }
79
78
 
80
79
  .gem-o-template--modal {
@@ -87,17 +86,6 @@ $govuk-modal-wide-breakpoint: $govuk-page-width + $govuk-modal-margin * 2 + $gov
87
86
  overflow: hidden;
88
87
  }
89
88
 
90
- .gem-o-template__body--blur {
91
- .govuk-skip-link,
92
- .govuk-header,
93
- .govuk-phase-banner,
94
- .govuk-width-container .govuk-back-link,
95
- .govuk-footer,
96
- .govuk-main-wrapper {
97
- filter: blur(2px);
98
- }
99
- }
100
-
101
89
  .gem-c-modal-dialogue__header {
102
90
  padding: 9px govuk-spacing(3) 10px;
103
91
  color: govuk-colour("white");
@@ -1,12 +1,12 @@
1
- <%
2
- cb_helper = GovukPublishingComponents::Presenters::CheckboxesHelper.new(local_assigns)
3
- id = cb_helper.id
4
- component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
5
- component_helper.set_id(id)
6
- component_helper.add_class(cb_helper.css_classes.join(" ")) # cb_helper.css_classes generates "gem-c-checkboxes"
7
- component_helper.add_data_attribute({ module: "gem-checkboxes govuk-checkboxes" })
8
- %>
1
+ <% cb_helper = GovukPublishingComponents::Presenters::CheckboxesHelper.new(local_assigns) %>
9
2
  <% if cb_helper.items.any? %>
3
+ <%
4
+ id = cb_helper.id
5
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
6
+ component_helper.set_id(id)
7
+ component_helper.add_class(cb_helper.css_classes.join(" ")) # cb_helper.css_classes generates "gem-c-checkboxes"
8
+ component_helper.add_data_attribute({ module: "gem-checkboxes govuk-checkboxes" })
9
+ %>
10
10
  <%= tag.div(**component_helper.all_attributes) do %>
11
11
  <% if cb_helper.should_have_fieldset %>
12
12
  <% if cb_helper.heading_markup %>
@@ -30,7 +30,7 @@ examples:
30
30
 
31
31
  This option is not tied to the `heading_level` option in order to give flexibility.
32
32
  data:
33
- text: 'One big heading'
33
+ text: 'One big heading containing a number of words'
34
34
  font_size: "xl"
35
35
  right_to_left:
36
36
  data:
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "64.1.1".freeze
2
+ VERSION = "64.1.2".freeze
3
3
  end
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: 64.1.1
4
+ version: 64.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -2115,7 +2115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2115
2115
  - !ruby/object:Gem::Version
2116
2116
  version: '0'
2117
2117
  requirements: []
2118
- rubygems_version: 4.0.6
2118
+ rubygems_version: 4.0.7
2119
2119
  specification_version: 4
2120
2120
  summary: A gem to document components in GOV.UK frontend applications
2121
2121
  test_files: []