dxw_govuk_frontend_rails 3.3.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 529c34dd67d14019a27162ddeb0eed821d312520591177bf5a78fac565418aa5
4
- data.tar.gz: f9f13780320df3439998c5886b6a95a93934031521b5ed7ba795186b48a95c3a
3
+ metadata.gz: 665a2cf46a22c74d9db17906cdc8ad3582ea81bf03d96961f29e3f46ccb4f4a6
4
+ data.tar.gz: a734d82b07c896ef3af09306721b8088628801f6931e78f5c142d85ab7be0430
5
5
  SHA512:
6
- metadata.gz: 483a3f1dd7911a419df9379d07fed9cd4672847c239cfb111ab6d930e16ae792d54cc2d0bdfe4cea17d276f47d4cf47bc36000bd525685eb662ded08e436709b
7
- data.tar.gz: 5a7e13c09c472066e4f5dfa0c3bbab1258c6f9b05bbbb3ffe7b3a51bc9efdad26bdd95bdcb20a9c950cd43e63293380d38cd158eff17d290ea2f596db7fcfd21
6
+ metadata.gz: 030eac8904fb2fec2d2a62c378722b22430a70e3b3ff311856d4711bb9d900e9fdc1869638751b1bceed600f2b43468a751ffffdef85aff9a685c480022cf66f
7
+ data.tar.gz: 3b554b48352295441e18a1e30a5c5cc1428fa1713c887526b3621d114100b628d594ef3e1bbad9b1bc031eefc76b4ee46c6222abb0d663e3485daee7734e552b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dxw_govuk_frontend_rails (3.3.0)
4
+ dxw_govuk_frontend_rails (3.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module DxwGovukFrontendRails
2
- VERSION = "3.3.1"
2
+ VERSION = "3.4.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.3.0",
9
- "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.3.0.tgz",
10
- "integrity": "sha512-ncOGTAV6mzz1CPBlr/UGETiG3IO6P3b0CvSI0wxBz7Uo0A/6jttLoxkvuYXju2oNA2yqRh2NjD1zJUOP3Q32CQ=="
8
+ "version": "3.4.0",
9
+ "resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.4.0.tgz",
10
+ "integrity": "sha512-rmYPtcCtWgz92QBejYwOnfSxbPGYfvSruLwB4CBk/yJtySHRY0whG1e2/iFRRSj0pMx1Bu+zh/IqCTo+84hbFw=="
11
11
  }
12
12
  }
13
13
  }
data/package.json CHANGED
@@ -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.3.0"
24
+ "govuk-frontend": "3.4.0"
25
25
  }
26
26
  }
@@ -1497,6 +1497,9 @@ Details.prototype.polyfillHandleInputs = function (node, callback) {
1497
1497
  function CharacterCount ($module) {
1498
1498
  this.$module = $module;
1499
1499
  this.$textarea = $module.querySelector('.govuk-js-character-count');
1500
+ if (this.$textarea) {
1501
+ this.$countMessage = $module.querySelector('[id=' + this.$textarea.id + '-info]');
1502
+ }
1500
1503
  }
1501
1504
 
1502
1505
  CharacterCount.prototype.defaults = {
@@ -1509,10 +1512,16 @@ CharacterCount.prototype.init = function () {
1509
1512
  // Check for module
1510
1513
  var $module = this.$module;
1511
1514
  var $textarea = this.$textarea;
1512
- if (!$textarea) {
1515
+ var $countMessage = this.$countMessage;
1516
+
1517
+ if (!$textarea || !$countMessage) {
1513
1518
  return
1514
1519
  }
1515
1520
 
1521
+ // We move count message right after the field
1522
+ // Kept for backwards compatibility
1523
+ $textarea.insertAdjacentElement('afterend', $countMessage);
1524
+
1516
1525
  // Read options set using dataset ('data-' values)
1517
1526
  this.options = this.getDataset($module);
1518
1527
 
@@ -1530,23 +1539,16 @@ CharacterCount.prototype.init = function () {
1530
1539
  return
1531
1540
  }
1532
1541
 
1533
- // Generate and reference message
1534
- var boundCreateCountMessage = this.createCountMessage.bind(this);
1535
- this.countMessage = boundCreateCountMessage();
1542
+ // Remove hard limit if set
1543
+ $module.removeAttribute('maxlength');
1536
1544
 
1537
- // If there's a maximum length defined and the count message exists
1538
- if (this.countMessage) {
1539
- // Remove hard limit if set
1540
- $module.removeAttribute('maxlength');
1545
+ // Bind event changes to the textarea
1546
+ var boundChangeEvents = this.bindChangeEvents.bind(this);
1547
+ boundChangeEvents();
1541
1548
 
1542
- // Bind event changes to the textarea
1543
- var boundChangeEvents = this.bindChangeEvents.bind(this);
1544
- boundChangeEvents();
1545
-
1546
- // Update count message
1547
- var boundUpdateCountMessage = this.updateCountMessage.bind(this);
1548
- boundUpdateCountMessage();
1549
- }
1549
+ // Update count message
1550
+ var boundUpdateCountMessage = this.updateCountMessage.bind(this);
1551
+ boundUpdateCountMessage();
1550
1552
  };
1551
1553
 
1552
1554
  // Read data attributes
@@ -1577,27 +1579,6 @@ CharacterCount.prototype.count = function (text) {
1577
1579
  return length
1578
1580
  };
1579
1581
 
1580
- // Generate count message and bind it to the input
1581
- // returns reference to the generated element
1582
- CharacterCount.prototype.createCountMessage = function () {
1583
- var countElement = this.$textarea;
1584
- var elementId = countElement.id;
1585
- // Check for existing info count message
1586
- var countMessage = document.getElementById(elementId + '-info');
1587
- // If there is no existing info count message we add one right after the field
1588
- if (elementId && !countMessage) {
1589
- countElement.insertAdjacentHTML('afterend', '<span id="' + elementId + '-info" class="govuk-hint govuk-character-count__message" aria-live="polite"></span>');
1590
- this.describedBy = countElement.getAttribute('aria-describedby');
1591
- this.describedByInfo = this.describedBy + ' ' + elementId + '-info';
1592
- countElement.setAttribute('aria-describedby', this.describedByInfo);
1593
- countMessage = document.getElementById(elementId + '-info');
1594
- } else {
1595
- // If there is an existing info count message we move it right after the field
1596
- countElement.insertAdjacentElement('afterend', countMessage);
1597
- }
1598
- return countMessage
1599
- };
1600
-
1601
1582
  // Bind input propertychange to the elements and update based on the change
1602
1583
  CharacterCount.prototype.bindChangeEvents = function () {
1603
1584
  var $textarea = this.$textarea;
@@ -1624,7 +1605,7 @@ CharacterCount.prototype.checkIfValueChanged = function () {
1624
1605
  CharacterCount.prototype.updateCountMessage = function () {
1625
1606
  var countElement = this.$textarea;
1626
1607
  var options = this.options;
1627
- var countMessage = this.countMessage;
1608
+ var countMessage = this.$countMessage;
1628
1609
 
1629
1610
  // Determine the remaining number of characters/words
1630
1611
  var currentLength = this.count(countElement.value);
@@ -17,7 +17,10 @@
17
17
 
18
18
  // Allow space for the arrow
19
19
  padding-left: 14px;
20
+ }
20
21
 
22
+ // Only add a custom underline if the component is linkable
23
+ .govuk-back-link[href] {
21
24
  // Use border-bottom rather than text-decoration so that the arrow is
22
25
  // underlined as well.
23
26
  border-bottom: 1px solid govuk-colour("black");
@@ -30,22 +33,22 @@
30
33
  &:focus {
31
34
  border-bottom-color: transparent;
32
35
  }
36
+ }
33
37
 
34
- // Prepend left pointing arrow
35
- &:before {
36
- @include govuk-shape-arrow($direction: left, $base: 10px, $height: 6px);
38
+ // Prepend left pointing arrow
39
+ .govuk-back-link:before {
40
+ @include govuk-shape-arrow($direction: left, $base: 10px, $height: 6px);
37
41
 
38
- content: "";
42
+ content: "";
39
43
 
40
- // Vertically align with the parent element
41
- position: absolute;
44
+ // Vertically align with the parent element
45
+ position: absolute;
42
46
 
43
- top: 0;
44
- bottom: 0;
45
- left: 0;
47
+ top: 0;
48
+ bottom: 0;
49
+ left: 0;
46
50
 
47
- margin: auto;
48
- }
51
+ margin: auto;
49
52
  }
50
53
 
51
54
  @if $govuk-use-legacy-font {
@@ -2,9 +2,27 @@
2
2
  @import "../tools/all";
3
3
  @import "../helpers/all";
4
4
 
5
- @mixin govuk-width-container {
6
- // Limit the width of the container to the page width
7
- max-width: $govuk-page-width;
5
+ ////
6
+ /// @group objects
7
+ ////
8
+
9
+ /// Width container mixin
10
+ ///
11
+ /// Used to create page width and custom width container classes.
12
+ ///
13
+ /// @param {String} $width [$govuk-page-width] - Width in pixels
14
+ ///
15
+ /// @example scss - Creating a 1200px wide container class
16
+ /// .app-width-container--wide {
17
+ /// @include govuk-width-container(1200px);
18
+ /// }
19
+ ///
20
+ /// @access public
21
+
22
+ @mixin govuk-width-container($width: $govuk-page-width) {
23
+
24
+ // By default, limit the width of the container to the page width
25
+ max-width: $width;
8
26
 
9
27
  // On mobile, add half width gutters
10
28
  margin: 0 $govuk-gutter-half;
@@ -38,7 +56,7 @@
38
56
 
39
57
  // As soon as the viewport is greater than the width of the page plus the
40
58
  // gutters, just centre the content instead of adding gutters.
41
- @include govuk-media-query($and: "(min-width: #{($govuk-page-width + $govuk-gutter * 2)})") {
59
+ @include govuk-media-query($and: "(min-width: #{($width + $govuk-gutter * 2)})") {
42
60
  margin: 0 auto;
43
61
 
44
62
  // Since a safe area may have previously been set above,
@@ -49,7 +67,7 @@
49
67
  }
50
68
 
51
69
  @include govuk-if-ie8 {
52
- width: $govuk-page-width;
70
+ width: $width;
53
71
  // Since media queries are not supported in IE8,
54
72
  // we need to duplicate this margin that centers the page.
55
73
  margin: 0 auto;
@@ -70,7 +70,7 @@ $_govuk-colour-palette-modern: (
70
70
  "purple": #4c2c92,
71
71
 
72
72
  "black": #0b0c0c,
73
- "dark-grey": #6f777b,
73
+ "dark-grey": #626a6e,
74
74
  "mid-grey": #b1b4b6,
75
75
  "light-grey": #f3f2f1,
76
76
  "white": #ffffff,
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.3.1
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - mec
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-10-25 00:00:00.000000000 Z
12
+ date: 2019-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler