dxw_govuk_frontend_rails 3.2.0 → 3.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61748f1e13e72d91ec0f332ab57f1aed6576a0aefd522c7c302778a8618f74e5
4
- data.tar.gz: 2ba98295582b3a676de197ee93e0625542579925020a169c672802eee641be52
3
+ metadata.gz: 4d4acfd39c6602f72f50fd8e2747ac3f99708422eb74c9083f968d05d735135d
4
+ data.tar.gz: 8696f9c16710bedbe45ceef93cebcfce11579a42a30ffb5cabc39e00f6d7f78b
5
5
  SHA512:
6
- metadata.gz: 9b59f87fef5d49b8519d8bf8f6fbd4899b8fb4c602fbe7ebf4a934f73e70e0addb429edc341c66ce94734716bee9637a70be02bb05be5f3d4b23407294d6bb97
7
- data.tar.gz: 362e8387f34f0995a5d7bb00d03fcb0fb2f8a71f03219ae9b42df429cfd9a1e19a6ebdfae9e337a7d7dd6e3b7a1b33f94b75d3057d08535aa761dc601136218d
6
+ metadata.gz: 79005a142ab72a650b9a8259faa9106c7e0aeda3ae180df70ced6732ff4d794ce23effd8e85f89d7f3c9a2880b347b04e006507b91cfa3626836a1bddaa77103
7
+ data.tar.gz: 74ab6084a3189937c9825bceeb4a9ddf0c94603a32579733f396bbc9cb8061d24bb4e009c431d294afd08c15612918bd370841a1181c9020cb5e2ddd602ebcaf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dxw_govuk_frontend_rails (3.2.0)
4
+ dxw_govuk_frontend_rails (3.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module DxwGovukFrontendRails
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
data/package-lock.json CHANGED
@@ -5,9 +5,9 @@
5
5
  "requires": true,
6
6
  "dependencies": {
7
7
  "govuk-frontend": {
8
- "version": "3.2.0",
9
- "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.2.0.tgz",
10
- "integrity": "sha512-OtJozAGMEKFu195fNVVrQHUX7+znCkA4cXDKs4lgFlRQOTzN1ogT9010GBARuoTwbeL0VqQ8nerZYjVxH/wafA=="
8
+ "version": "3.3.0",
9
+ "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.3.0.tgz",
10
+ "integrity": "sha512-ncOGTAV6mzz1CPBlr/UGETiG3IO6P3b0CvSI0wxBz7Uo0A/6jttLoxkvuYXju2oNA2yqRh2NjD1zJUOP3Q32CQ=="
11
11
  }
12
12
  }
13
13
  }
data/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "lib": "lib"
8
8
  },
9
9
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "npx node-sass ./vendor/assets/stylesheets/govuk-frontend-rails.scss /tmp/govuk-frontend-rails.css"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -21,6 +21,6 @@
21
21
  },
22
22
  "homepage": "https://github.com/mec/dxw_govuk_frontend_rails#readme",
23
23
  "dependencies": {
24
- "govuk-frontend": "3.2.0"
24
+ "govuk-frontend": "3.3.0"
25
25
  }
26
26
  }
@@ -1873,7 +1873,9 @@ ErrorSummary.prototype.getFragmentFromUrl = function (url) {
1873
1873
  *
1874
1874
  * Returns the first element that exists from this list:
1875
1875
  *
1876
- * - The `<legend>` associated with the closest `<fieldset>` ancestor
1876
+ * - The `<legend>` associated with the closest `<fieldset>` ancestor, as long
1877
+ * as the top of it is no more than half a viewport height away from the
1878
+ * bottom of the input
1877
1879
  * - The first `<label>` that is associated with the input using for="inputId"
1878
1880
  * - The closest parent `<label>`
1879
1881
  *
@@ -1888,7 +1890,32 @@ ErrorSummary.prototype.getAssociatedLegendOrLabel = function ($input) {
1888
1890
  var legends = $fieldset.getElementsByTagName('legend');
1889
1891
 
1890
1892
  if (legends.length) {
1891
- return legends[0]
1893
+ var $candidateLegend = legends[0];
1894
+
1895
+ // If the input type is radio or checkbox, always use the legend if there
1896
+ // is one.
1897
+ if ($input.type === 'checkbox' || $input.type === 'radio') {
1898
+ return $candidateLegend
1899
+ }
1900
+
1901
+ // For other input types, only scroll to the fieldset’s legend (instead of
1902
+ // the label associated with the input) if the input would end up in the
1903
+ // top half of the screen.
1904
+ //
1905
+ // This should avoid situations where the input either ends up off the
1906
+ // screen, or obscured by a software keyboard.
1907
+ var legendTop = $candidateLegend.getBoundingClientRect().top;
1908
+ var inputRect = $input.getBoundingClientRect();
1909
+
1910
+ // If the browser doesn't support Element.getBoundingClientRect().height
1911
+ // or window.innerHeight (like IE8), bail and just link to the label.
1912
+ if (inputRect.height && window.innerHeight) {
1913
+ var inputBottom = inputRect.top + inputRect.height;
1914
+
1915
+ if (inputBottom - legendTop < window.innerHeight / 2) {
1916
+ return $candidateLegend
1917
+ }
1918
+ }
1892
1919
  }
1893
1920
  }
1894
1921
 
@@ -42,6 +42,7 @@
42
42
  }
43
43
 
44
44
  .govuk-header__logotype {
45
+ display: inline-block;
45
46
  margin-right: govuk-spacing(1);
46
47
  }
47
48
 
@@ -13,6 +13,9 @@
13
13
  box-sizing: border-box;
14
14
  width: 100%;
15
15
  height: 40px;
16
+ @if $govuk-typography-use-rem {
17
+ height: govuk-px-to-rem(40px);
18
+ }
16
19
  margin-top: 0;
17
20
 
18
21
  padding: govuk-spacing(1);
@@ -13,6 +13,9 @@
13
13
  box-sizing: border-box; // should this be global?
14
14
  max-width: 100%;
15
15
  height: 40px;
16
+ @if $govuk-typography-use-rem {
17
+ height: govuk-px-to-rem(40px);
18
+ }
16
19
  padding: govuk-spacing(1); // was 5px 4px 4px - size of it should be adjusted to match other form elements
17
20
  border: $govuk-border-width-form-element solid $govuk-input-border-colour;
18
21
 
@@ -5,9 +5,6 @@
5
5
  @include govuk-exports("govuk/component/warning-text") {
6
6
 
7
7
  .govuk-warning-text {
8
- @include govuk-font($size: 19);
9
- @include govuk-text-colour;
10
-
11
8
  position: relative;
12
9
  @include govuk-responsive-margin(6, "bottom");
13
10
  padding: govuk-spacing(2) 0;
@@ -23,13 +20,15 @@
23
20
  display: inline-block;
24
21
 
25
22
  position: absolute;
26
- top: 50%;
27
23
  left: 0;
28
24
 
29
- min-width: 32px;
25
+ min-width: 29px;
30
26
  min-height: 29px;
31
- margin-top: -20px; // Half the height of the circle (adjusted for NTA)
32
- padding-top: 3px;
27
+ margin-top: -7px;
28
+
29
+ @include govuk-media-query($from: tablet) {
30
+ margin-top: -5px;
31
+ }
33
32
 
34
33
  // When a user customises their colours the background colour will often be removed.
35
34
  // Adding a border to the component keeps it's shape as a circle.
@@ -39,7 +38,7 @@
39
38
  color: govuk-colour("white");
40
39
  background: govuk-colour("black");
41
40
 
42
- font-size: 1.6em;
41
+ font-size: 30px;
43
42
  line-height: 29px;
44
43
 
45
44
  text-align: center;
@@ -53,7 +52,9 @@
53
52
  }
54
53
 
55
54
  .govuk-warning-text__text {
55
+ @include govuk-font($size: 19, $weight: bold);
56
+ @include govuk-text-colour;
56
57
  display: block;
57
- padding-left: 50px;
58
+ padding-left: 45px;
58
59
  }
59
60
  }
@@ -15,4 +15,8 @@
15
15
  .govuk-\!-display-block {
16
16
  display: block !important;
17
17
  }
18
+
19
+ .govuk-\!-display-none {
20
+ display: none !important;
21
+ }
18
22
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dxw_govuk_frontend_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mec