dxw_govuk_frontend_rails 3.7.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -0
- data/Gemfile.lock +3 -2
- data/README.md +45 -42
- data/lib/dxw_govuk_frontend_rails/version.rb +1 -1
- data/package-lock.json +3 -3
- data/package.json +1 -1
- data/vendor/assets/javascripts/govuk_frontend_rails.js +160 -57
- data/vendor/assets/stylesheets/components/checkboxes/_index.scss +6 -5
- data/vendor/assets/stylesheets/components/file-upload/_index.scss +0 -27
- data/vendor/assets/stylesheets/components/footer/_index.scss +0 -3
- data/vendor/assets/stylesheets/components/hint/_index.scss +2 -2
- data/vendor/assets/stylesheets/components/input/_index.scss +0 -3
- data/vendor/assets/stylesheets/components/select/_index.scss +0 -3
- data/vendor/assets/stylesheets/components/skip-link/_index.scss +1 -0
- data/vendor/assets/stylesheets/components/textarea/_index.scss +0 -3
- data/vendor/assets/stylesheets/components/warning-text/_index.scss +4 -2
- data/vendor/assets/stylesheets/helpers/_colour.scss +1 -1
- data/vendor/assets/stylesheets/settings/_colours-applied.scss +2 -2
- data/vendor/assets/stylesheets/settings/_colours-palette.scss +1 -1
- data/vendor/assets/stylesheets/settings/_measurements.scss +4 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24366e1d10fcdffc7d4ce6ab81b1af6bc53a01971488e7dc4d1e3dc82b3edf3c
|
4
|
+
data.tar.gz: 9ef221edb271314433d1944067443cb2500536c98cf89e84e672ffd56c5ccc05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb712c7e9a7b679f9727b49d57eefe2ca24c0e2b01b0216999ef20ff4ca5c476a63be78d803ff4651b330d5361a4bd13d342dc44118a667cd41b86c1fd44dee
|
7
|
+
data.tar.gz: 3c0f0d0f3d3dd1182d366a2a547345a63ea13ba90d44a7fa0e914201954c7547aafeff04119f64dcdb1db39c9002d922161df2758f5fc1f05a5290ce45312cc4
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
The [dxw standard contributing guide](https://github.com/dxw/.github/blob/main/CONTRIBUTING.md) applies for this repository.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dxw_govuk_frontend_rails (3.
|
4
|
+
dxw_govuk_frontend_rails (3.8.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -10,6 +10,7 @@ GEM
|
|
10
10
|
|
11
11
|
PLATFORMS
|
12
12
|
ruby
|
13
|
+
x86_64-darwin-19
|
13
14
|
|
14
15
|
DEPENDENCIES
|
15
16
|
bundler (~> 2.0)
|
@@ -17,4 +18,4 @@ DEPENDENCIES
|
|
17
18
|
rake (~> 13.0)
|
18
19
|
|
19
20
|
BUNDLED WITH
|
20
|
-
2.
|
21
|
+
2.2.1
|
data/README.md
CHANGED
@@ -1,88 +1,91 @@
|
|
1
1
|
# GOVUK Frontend for Rails
|
2
2
|
|
3
|
-
|
3
|
+
## Read this first
|
4
|
+
|
5
|
+
Although this gem makes it super easy to add the GOVUK Frontend to your
|
6
|
+
Rails applications, we would recommend using it as a guide to add the
|
7
|
+
GOVUK Frontend yourself.
|
8
|
+
|
9
|
+
## About Adds the GOVUK Frontend for Rails using the asset pipeline.
|
4
10
|
|
5
11
|
https://github.com/alphagov/govuk-frontend
|
6
12
|
|
7
13
|
## Breaking Changes in v3.0.0
|
8
14
|
|
9
|
-
This release of the GOVUK Frontend has breaking changes! Do not update to this
|
15
|
+
This release of the GOVUK Frontend has breaking changes! Do not update to this
|
16
|
+
version until you have read and understood:
|
10
17
|
|
11
|
-
You will not be required to updated any file paths with govuk as we take care of
|
18
|
+
You will not be required to updated any file paths with govuk as we take care of
|
19
|
+
that for you, all others changes will need to be managed:
|
12
20
|
|
13
21
|
https://github.com/alphagov/govuk-frontend/releases/tag/v3.0.0
|
14
22
|
|
15
23
|
## Limitations
|
16
24
|
|
17
|
-
This gem does not include the ie8 version of GOVUK Frontend, as the service
|
25
|
+
This gem does not include the ie8 version of GOVUK Frontend, as the service
|
26
|
+
standard no longer requires it:
|
18
27
|
|
19
28
|
https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices
|
20
29
|
|
21
|
-
This gem and its documentation cannot tell you how to use the GOVUK effectively,
|
30
|
+
This gem and its documentation cannot tell you how to use the GOVUK effectively,
|
31
|
+
see the GOVUK Design System documentation for that:
|
22
32
|
|
23
|
-
https://design-system.service.gov.uk/
|
24
|
-
## Installation
|
33
|
+
https://design-system.service.gov.uk/ ## Installation
|
25
34
|
|
26
35
|
Add this line to your application's Gemfile:
|
27
36
|
|
28
|
-
```ruby
|
29
|
-
gem 'dxw_govuk_frontend_rails'
|
30
|
-
```
|
37
|
+
```ruby gem 'dxw_govuk_frontend_rails' ```
|
31
38
|
|
32
39
|
And then execute:
|
33
40
|
|
34
41
|
$ bundle
|
35
42
|
|
36
|
-
## Usage
|
37
|
-
Your Rails app will need to have sass enabled.
|
43
|
+
## Usage Your Rails app will need to have sass enabled.
|
38
44
|
|
39
45
|
### Basic usage
|
40
46
|
|
41
|
-
If the service you are building does not need to modify or extend the GOVUK
|
47
|
+
If the service you are building does not need to modify or extend the GOVUK
|
48
|
+
Frontend all you need to do is import the main sass and javascript files into
|
49
|
+
your Rails app:
|
42
50
|
|
43
|
-
- create a sass file in your application:
|
44
|
-
```
|
45
|
-
|
46
|
-
```
|
47
|
-
-
|
48
|
-
|
49
|
-
@import "govuk-frontend-rails";
|
50
|
-
```
|
51
|
-
- require the `govuk-frontend-rails.scss` file in `application.css` or equivalent:
|
51
|
+
- create a sass file in your application: ```
|
52
|
+
app/assets/stylesheets/govuk_frontend_rails.scss ```
|
53
|
+
- import the styles into `govuk_frontend_rails.scss`: ```sass @import
|
54
|
+
"govuk-frontend-rails"; ```
|
55
|
+
- require the `govuk-frontend-rails.scss` file in `application.css` or
|
56
|
+
equivalent:
|
52
57
|
|
53
|
-
```
|
54
|
-
*= require govuk_frontend_rails
|
55
|
-
```
|
58
|
+
``` *= require govuk_frontend_rails ```
|
56
59
|
|
57
60
|
- require the javascript into `app/assets/javascripts/application.js`:
|
58
61
|
|
59
|
-
```
|
60
|
-
|
61
|
-
|
62
|
-
- initialise the GOVUK Frontend either in a .js file on in your application layout:
|
62
|
+
``` //= require govuk_frontend_rails ```
|
63
|
+
- initialise the GOVUK Frontend either in a .js file on in your application
|
64
|
+
layout:
|
63
65
|
|
64
|
-
```javascript
|
65
|
-
window.onload = function() {
|
66
|
-
window.GOVUKFrontend.initAll()
|
67
|
-
};
|
68
|
-
```
|
66
|
+
```javascript window.onload = function() { window.GOVUKFrontend.initAll() }; ```
|
69
67
|
- update your application markup to use the GOVUK Frontend class names
|
70
68
|
|
71
|
-
IMPORTANT: You cannot use the GOVUK Frontend without changes if the service you
|
69
|
+
IMPORTANT: You cannot use the GOVUK Frontend without changes if the service you
|
70
|
+
are building is not on GOV.UK, read and understand the guidance here:
|
72
71
|
|
73
72
|
https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk#if-your-service-isnt-on-govuk
|
74
73
|
|
75
|
-
## Tracking version
|
76
|
-
We aim to tracking the version of GOVUK Frontend.
|
74
|
+
## Tracking version We aim to tracking the version of GOVUK Frontend.
|
77
75
|
|
78
76
|
## Updating to a new Version of GOVUK Frontend
|
79
77
|
|
80
78
|
When a new version of the GOVUK Frontend is released:
|
81
79
|
|
82
|
-
-
|
83
|
-
-
|
84
|
-
|
80
|
+
- make a new branch with the GOVUK Frontend version number
|
81
|
+
- set the new version number in `package.json` and
|
82
|
+
`lib/dxw_govuk_frontend_rails/version.rb`
|
83
|
+
- run `npm update` to get the new release of the GOVUK Frontend
|
84
|
+
- run `bundle exec rake` to compile the new assets
|
85
85
|
- commit the changes
|
86
86
|
- tag with the same release number as GOVUK Frontend
|
87
|
-
- push the
|
88
|
-
-
|
87
|
+
- push the change
|
88
|
+
- push the tag
|
89
|
+
- merge your branch
|
90
|
+
- make a new release of the tag on GitHub
|
91
|
+
- GitHub acitons will build the gem and push to Rubygems
|
data/package-lock.json
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
"requires": true,
|
6
6
|
"dependencies": {
|
7
7
|
"govuk-frontend": {
|
8
|
-
"version": "3.
|
9
|
-
"resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.
|
10
|
-
"integrity": "sha512
|
8
|
+
"version": "3.8.0",
|
9
|
+
"resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.8.0.tgz",
|
10
|
+
"integrity": "sha512-+vgXzFsh7wpLRGjFSDvDcA2zNA2wOxT6gGs/KUpkTjF1Uop9BerW/1W/YB1BMpeTEJoPlmrkA19+DS1fqJtL9Q=="
|
11
11
|
}
|
12
12
|
}
|
13
13
|
}
|
data/package.json
CHANGED
@@ -1542,13 +1542,22 @@ CharacterCount.prototype.init = function () {
|
|
1542
1542
|
// Remove hard limit if set
|
1543
1543
|
$module.removeAttribute('maxlength');
|
1544
1544
|
|
1545
|
-
//
|
1546
|
-
|
1547
|
-
|
1545
|
+
// When the page is restored after navigating 'back' in some browsers the
|
1546
|
+
// state of the character count is not restored until *after* the DOMContentLoaded
|
1547
|
+
// event is fired, so we need to sync after the pageshow event in browsers
|
1548
|
+
// that support it.
|
1549
|
+
if ('onpageshow' in window) {
|
1550
|
+
window.addEventListener('pageshow', this.sync.bind(this));
|
1551
|
+
} else {
|
1552
|
+
window.addEventListener('DOMContentLoaded', this.sync.bind(this));
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
this.sync();
|
1556
|
+
};
|
1548
1557
|
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1558
|
+
CharacterCount.prototype.sync = function () {
|
1559
|
+
this.bindChangeEvents();
|
1560
|
+
this.updateCountMessage();
|
1552
1561
|
};
|
1553
1562
|
|
1554
1563
|
// Read data attributes
|
@@ -1596,8 +1605,7 @@ CharacterCount.prototype.checkIfValueChanged = function () {
|
|
1596
1605
|
if (!this.$textarea.oldValue) this.$textarea.oldValue = '';
|
1597
1606
|
if (this.$textarea.value !== this.$textarea.oldValue) {
|
1598
1607
|
this.$textarea.oldValue = this.$textarea.value;
|
1599
|
-
|
1600
|
-
boundUpdateCountMessage();
|
1608
|
+
this.updateCountMessage();
|
1601
1609
|
}
|
1602
1610
|
};
|
1603
1611
|
|
@@ -1666,44 +1674,91 @@ function Checkboxes ($module) {
|
|
1666
1674
|
this.$inputs = $module.querySelectorAll('input[type="checkbox"]');
|
1667
1675
|
}
|
1668
1676
|
|
1677
|
+
/**
|
1678
|
+
* Initialise Checkboxes
|
1679
|
+
*
|
1680
|
+
* Checkboxes can be associated with a 'conditionally revealed' content block –
|
1681
|
+
* for example, a checkbox for 'Phone' could reveal an additional form field for
|
1682
|
+
* the user to enter their phone number.
|
1683
|
+
*
|
1684
|
+
* These associations are made using a `data-aria-controls` attribute, which is
|
1685
|
+
* promoted to an aria-controls attribute during initialisation.
|
1686
|
+
*
|
1687
|
+
* We also need to restore the state of any conditional reveals on the page (for
|
1688
|
+
* example if the user has navigated back), and set up event handlers to keep
|
1689
|
+
* the reveal in sync with the checkbox state.
|
1690
|
+
*/
|
1669
1691
|
Checkboxes.prototype.init = function () {
|
1670
1692
|
var $module = this.$module;
|
1671
1693
|
var $inputs = this.$inputs;
|
1672
1694
|
|
1673
|
-
/**
|
1674
|
-
* Loop over all items with [data-controls]
|
1675
|
-
* Check if they have a matching conditional reveal
|
1676
|
-
* If they do, assign attributes.
|
1677
|
-
**/
|
1678
1695
|
nodeListForEach($inputs, function ($input) {
|
1679
|
-
var
|
1696
|
+
var target = $input.getAttribute('data-aria-controls');
|
1680
1697
|
|
1681
|
-
//
|
1682
|
-
//
|
1683
|
-
if (!
|
1698
|
+
// Skip checkboxes without data-aria-controls attributes, or where the
|
1699
|
+
// target element does not exist.
|
1700
|
+
if (!target || !$module.querySelector('#' + target)) {
|
1684
1701
|
return
|
1685
1702
|
}
|
1686
1703
|
|
1687
|
-
//
|
1688
|
-
|
1704
|
+
// Promote the data-aria-controls attribute to a aria-controls attribute
|
1705
|
+
// so that the relationship is exposed in the AOM
|
1706
|
+
$input.setAttribute('aria-controls', target);
|
1689
1707
|
$input.removeAttribute('data-aria-controls');
|
1690
|
-
|
1691
|
-
|
1708
|
+
});
|
1709
|
+
|
1710
|
+
// When the page is restored after navigating 'back' in some browsers the
|
1711
|
+
// state of form controls is not restored until *after* the DOMContentLoaded
|
1712
|
+
// event is fired, so we need to sync after the pageshow event in browsers
|
1713
|
+
// that support it.
|
1714
|
+
if ('onpageshow' in window) {
|
1715
|
+
window.addEventListener('pageshow', this.syncAllConditionalReveals.bind(this));
|
1716
|
+
} else {
|
1717
|
+
window.addEventListener('DOMContentLoaded', this.syncAllConditionalReveals.bind(this));
|
1718
|
+
}
|
1719
|
+
|
1720
|
+
// Although we've set up handlers to sync state on the pageshow or
|
1721
|
+
// DOMContentLoaded event, init could be called after those events have fired,
|
1722
|
+
// for example if they are added to the page dynamically, so sync now too.
|
1723
|
+
this.syncAllConditionalReveals();
|
1692
1724
|
|
1693
|
-
// Handle events
|
1694
1725
|
$module.addEventListener('click', this.handleClick.bind(this));
|
1695
1726
|
};
|
1696
1727
|
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1728
|
+
/**
|
1729
|
+
* Sync the conditional reveal states for all inputs in this $module.
|
1730
|
+
*/
|
1731
|
+
Checkboxes.prototype.syncAllConditionalReveals = function () {
|
1732
|
+
nodeListForEach(this.$inputs, this.syncConditionalRevealWithInputState.bind(this));
|
1733
|
+
};
|
1734
|
+
|
1735
|
+
/**
|
1736
|
+
* Sync conditional reveal with the input state
|
1737
|
+
*
|
1738
|
+
* Synchronise the visibility of the conditional reveal, and its accessible
|
1739
|
+
* state, with the input's checked state.
|
1740
|
+
*
|
1741
|
+
* @param {HTMLInputElement} $input Checkbox input
|
1742
|
+
*/
|
1743
|
+
Checkboxes.prototype.syncConditionalRevealWithInputState = function ($input) {
|
1744
|
+
var $target = this.$module.querySelector('#' + $input.getAttribute('aria-controls'));
|
1700
1745
|
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1746
|
+
if ($target && $target.classList.contains('govuk-checkboxes__conditional')) {
|
1747
|
+
var inputIsChecked = $input.checked;
|
1748
|
+
|
1749
|
+
$input.setAttribute('aria-expanded', inputIsChecked);
|
1750
|
+
$target.classList.toggle('govuk-checkboxes__conditional--hidden', !inputIsChecked);
|
1704
1751
|
}
|
1705
1752
|
};
|
1706
1753
|
|
1754
|
+
/**
|
1755
|
+
* Click event handler
|
1756
|
+
*
|
1757
|
+
* Handle a click within the $module – if the click occurred on a checkbox, sync
|
1758
|
+
* the state of any associated conditional reveal with the checkbox state.
|
1759
|
+
*
|
1760
|
+
* @param {MouseEvent} event Click event
|
1761
|
+
*/
|
1707
1762
|
Checkboxes.prototype.handleClick = function (event) {
|
1708
1763
|
var $target = event.target;
|
1709
1764
|
|
@@ -1711,7 +1766,7 @@ Checkboxes.prototype.handleClick = function (event) {
|
|
1711
1766
|
var isCheckbox = $target.getAttribute('type') === 'checkbox';
|
1712
1767
|
var hasAriaControls = $target.getAttribute('aria-controls');
|
1713
1768
|
if (isCheckbox && hasAriaControls) {
|
1714
|
-
this.
|
1769
|
+
this.syncConditionalRevealWithInputState($target);
|
1715
1770
|
}
|
1716
1771
|
};
|
1717
1772
|
|
@@ -1959,67 +2014,115 @@ Header.prototype.handleClick = function (event) {
|
|
1959
2014
|
|
1960
2015
|
function Radios ($module) {
|
1961
2016
|
this.$module = $module;
|
2017
|
+
this.$inputs = $module.querySelectorAll('input[type="radio"]');
|
1962
2018
|
}
|
1963
2019
|
|
2020
|
+
/**
|
2021
|
+
* Initialise Radios
|
2022
|
+
*
|
2023
|
+
* Radios can be associated with a 'conditionally revealed' content block – for
|
2024
|
+
* example, a radio for 'Phone' could reveal an additional form field for the
|
2025
|
+
* user to enter their phone number.
|
2026
|
+
*
|
2027
|
+
* These associations are made using a `data-aria-controls` attribute, which is
|
2028
|
+
* promoted to an aria-controls attribute during initialisation.
|
2029
|
+
*
|
2030
|
+
* We also need to restore the state of any conditional reveals on the page (for
|
2031
|
+
* example if the user has navigated back), and set up event handlers to keep
|
2032
|
+
* the reveal in sync with the radio state.
|
2033
|
+
*/
|
1964
2034
|
Radios.prototype.init = function () {
|
1965
2035
|
var $module = this.$module;
|
1966
|
-
var $inputs =
|
2036
|
+
var $inputs = this.$inputs;
|
1967
2037
|
|
1968
|
-
/**
|
1969
|
-
* Loop over all items with [data-controls]
|
1970
|
-
* Check if they have a matching conditional reveal
|
1971
|
-
* If they do, assign attributes.
|
1972
|
-
**/
|
1973
2038
|
nodeListForEach($inputs, function ($input) {
|
1974
|
-
var
|
2039
|
+
var target = $input.getAttribute('data-aria-controls');
|
1975
2040
|
|
1976
|
-
//
|
1977
|
-
//
|
1978
|
-
if (!
|
2041
|
+
// Skip radios without data-aria-controls attributes, or where the
|
2042
|
+
// target element does not exist.
|
2043
|
+
if (!target || !$module.querySelector('#' + target)) {
|
1979
2044
|
return
|
1980
2045
|
}
|
1981
2046
|
|
1982
|
-
//
|
1983
|
-
|
2047
|
+
// Promote the data-aria-controls attribute to a aria-controls attribute
|
2048
|
+
// so that the relationship is exposed in the AOM
|
2049
|
+
$input.setAttribute('aria-controls', target);
|
1984
2050
|
$input.removeAttribute('data-aria-controls');
|
1985
|
-
|
1986
|
-
|
2051
|
+
});
|
2052
|
+
|
2053
|
+
// When the page is restored after navigating 'back' in some browsers the
|
2054
|
+
// state of form controls is not restored until *after* the DOMContentLoaded
|
2055
|
+
// event is fired, so we need to sync after the pageshow event in browsers
|
2056
|
+
// that support it.
|
2057
|
+
if ('onpageshow' in window) {
|
2058
|
+
window.addEventListener('pageshow', this.syncAllConditionalReveals.bind(this));
|
2059
|
+
} else {
|
2060
|
+
window.addEventListener('DOMContentLoaded', this.syncAllConditionalReveals.bind(this));
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
// Although we've set up handlers to sync state on the pageshow or
|
2064
|
+
// DOMContentLoaded event, init could be called after those events have fired,
|
2065
|
+
// for example if they are added to the page dynamically, so sync now too.
|
2066
|
+
this.syncAllConditionalReveals();
|
1987
2067
|
|
1988
2068
|
// Handle events
|
1989
2069
|
$module.addEventListener('click', this.handleClick.bind(this));
|
1990
2070
|
};
|
1991
2071
|
|
1992
|
-
|
1993
|
-
|
2072
|
+
/**
|
2073
|
+
* Sync the conditional reveal states for all inputs in this $module.
|
2074
|
+
*/
|
2075
|
+
Radios.prototype.syncAllConditionalReveals = function () {
|
2076
|
+
nodeListForEach(this.$inputs, this.syncConditionalRevealWithInputState.bind(this));
|
2077
|
+
};
|
1994
2078
|
|
1995
|
-
|
2079
|
+
/**
|
2080
|
+
* Sync conditional reveal with the input state
|
2081
|
+
*
|
2082
|
+
* Synchronise the visibility of the conditional reveal, and its accessible
|
2083
|
+
* state, with the input's checked state.
|
2084
|
+
*
|
2085
|
+
* @param {HTMLInputElement} $input Radio input
|
2086
|
+
*/
|
2087
|
+
Radios.prototype.syncConditionalRevealWithInputState = function ($input) {
|
2088
|
+
var $target = document.querySelector('#' + $input.getAttribute('aria-controls'));
|
2089
|
+
|
2090
|
+
if ($target && $target.classList.contains('govuk-radios__conditional')) {
|
1996
2091
|
var inputIsChecked = $input.checked;
|
1997
2092
|
|
1998
2093
|
$input.setAttribute('aria-expanded', inputIsChecked);
|
1999
|
-
|
2000
|
-
$content.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);
|
2094
|
+
$target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);
|
2001
2095
|
}
|
2002
2096
|
};
|
2003
2097
|
|
2098
|
+
/**
|
2099
|
+
* Click event handler
|
2100
|
+
*
|
2101
|
+
* Handle a click within the $module – if the click occurred on a radio, sync
|
2102
|
+
* the state of the conditional reveal for all radio buttons in the same form
|
2103
|
+
* with the same name (because checking one radio could have un-checked a radio
|
2104
|
+
* in another $module)
|
2105
|
+
*
|
2106
|
+
* @param {MouseEvent} event Click event
|
2107
|
+
*/
|
2004
2108
|
Radios.prototype.handleClick = function (event) {
|
2005
2109
|
var $clickedInput = event.target;
|
2006
|
-
|
2110
|
+
|
2111
|
+
// Ignore clicks on things that aren't radio buttons
|
2007
2112
|
if ($clickedInput.type !== 'radio') {
|
2008
2113
|
return
|
2009
2114
|
}
|
2010
|
-
|
2011
|
-
//
|
2012
|
-
//
|
2013
|
-
// We also only want radios which have aria-controls, as they support conditional reveals.
|
2115
|
+
|
2116
|
+
// We only need to consider radios with conditional reveals, which will have
|
2117
|
+
// aria-controls attributes.
|
2014
2118
|
var $allInputs = document.querySelectorAll('input[type="radio"][aria-controls]');
|
2119
|
+
|
2015
2120
|
nodeListForEach($allInputs, function ($input) {
|
2016
|
-
// Only inputs with the same form owner should change.
|
2017
2121
|
var hasSameFormOwner = ($input.form === $clickedInput.form);
|
2018
|
-
|
2019
|
-
// In radios, only radios with the same name will affect each other.
|
2020
2122
|
var hasSameName = ($input.name === $clickedInput.name);
|
2123
|
+
|
2021
2124
|
if (hasSameName && hasSameFormOwner) {
|
2022
|
-
this.
|
2125
|
+
this.syncConditionalRevealWithInputState($input);
|
2023
2126
|
}
|
2024
2127
|
}.bind(this));
|
2025
2128
|
};
|
@@ -92,12 +92,13 @@
|
|
92
92
|
// rotated 45 degrees
|
93
93
|
.govuk-checkboxes__label::after {
|
94
94
|
content: "";
|
95
|
+
box-sizing: border-box;
|
95
96
|
|
96
97
|
position: absolute;
|
97
98
|
top: 11px;
|
98
99
|
left: 9px;
|
99
|
-
width:
|
100
|
-
height:
|
100
|
+
width: 23px;
|
101
|
+
height: 12px;
|
101
102
|
|
102
103
|
-webkit-transform: rotate(-45deg);
|
103
104
|
|
@@ -105,7 +106,7 @@
|
|
105
106
|
|
106
107
|
transform: rotate(-45deg);
|
107
108
|
border: solid;
|
108
|
-
border-width: 0 0
|
109
|
+
border-width: 0 0 5px 5px;
|
109
110
|
// Fix bug in IE11 caused by transform rotate (-45deg).
|
110
111
|
// See: alphagov/govuk_elements/issues/518
|
111
112
|
border-top-color: transparent;
|
@@ -238,8 +239,8 @@
|
|
238
239
|
.govuk-checkboxes__label::after {
|
239
240
|
top: 15px;
|
240
241
|
left: 6px;
|
241
|
-
width:
|
242
|
-
height:
|
242
|
+
width: 12px;
|
243
|
+
height: 6.5px;
|
243
244
|
border-width: 0 0 3px 3px;
|
244
245
|
}
|
245
246
|
|
@@ -47,31 +47,4 @@
|
|
47
47
|
box-shadow: inset 0 0 0 4px $govuk-input-border-colour;
|
48
48
|
}
|
49
49
|
}
|
50
|
-
|
51
|
-
.govuk-file-upload--error {
|
52
|
-
// As `upload--error` has border, it needs to have the same padding as
|
53
|
-
// the standard focused element.
|
54
|
-
margin-right: -$component-padding;
|
55
|
-
margin-left: -$component-padding;
|
56
|
-
padding-right: $component-padding;
|
57
|
-
padding-left: $component-padding;
|
58
|
-
border: $govuk-border-width-form-element-error solid $govuk-error-colour;
|
59
|
-
|
60
|
-
&:focus {
|
61
|
-
border-color: $govuk-input-border-colour;
|
62
|
-
// Remove `box-shadow` inherited from `:focus` as `file-upload--error`
|
63
|
-
// already has the thicker border.
|
64
|
-
box-shadow: none;
|
65
|
-
}
|
66
|
-
|
67
|
-
// Repeat `:focus` styles to prevent error styles from being applied when
|
68
|
-
// input button is pressed as this moves the focus to "within".
|
69
|
-
// This can't be set together with `:focus` as all versions of IE fail
|
70
|
-
// to recognise `focus-within` and don't set any styles from the block
|
71
|
-
// when it's a selector.
|
72
|
-
&:focus-within {
|
73
|
-
border-color: $govuk-input-border-colour;
|
74
|
-
box-shadow: none;
|
75
|
-
}
|
76
|
-
}
|
77
50
|
}
|
@@ -210,20 +210,17 @@
|
|
210
210
|
padding: 0;
|
211
211
|
list-style: none;
|
212
212
|
-webkit-column-gap: $govuk-gutter;
|
213
|
-
-moz-column-gap: $govuk-gutter;
|
214
213
|
column-gap: $govuk-gutter; // Support: Columns
|
215
214
|
}
|
216
215
|
|
217
216
|
@include govuk-media-query ($from: desktop) {
|
218
217
|
.govuk-footer__list--columns-2 {
|
219
218
|
-webkit-column-count: 2;
|
220
|
-
-moz-column-count: 2;
|
221
219
|
column-count: 2; // Support: Columns
|
222
220
|
}
|
223
221
|
|
224
222
|
.govuk-footer__list--columns-3 {
|
225
223
|
-webkit-column-count: 3;
|
226
|
-
-moz-column-count: 3;
|
227
224
|
column-count: 3; // Support: Columns
|
228
225
|
}
|
229
226
|
}
|
@@ -16,7 +16,7 @@
|
|
16
16
|
// is unlikely that the default or govuk-label--s class would be used in this
|
17
17
|
// case.
|
18
18
|
|
19
|
-
// This adjustment will not work in browsers that do not support :not().
|
19
|
+
// This adjustment will not work in browsers that do not support :not().
|
20
20
|
// Users with these browsers will see the default size margin (5px larger).
|
21
21
|
|
22
22
|
.govuk-label:not(.govuk-label--m):not(.govuk-label--l):not(.govuk-label--xl) + .govuk-hint {
|
@@ -30,7 +30,7 @@
|
|
30
30
|
// it is unlikely that the default or govuk-fieldset__legend--s class would be
|
31
31
|
// used in this case.
|
32
32
|
|
33
|
-
// This adjustment will not work in browsers that do not support :not().
|
33
|
+
// This adjustment will not work in browsers that do not support :not().
|
34
34
|
// Users with these browsers will see the default size margin (5px larger).
|
35
35
|
|
36
36
|
.govuk-fieldset__legend:not(.govuk-fieldset__legend--m):not(.govuk-fieldset__legend--l):not(.govuk-fieldset__legend--xl) + .govuk-hint {
|
@@ -13,13 +13,15 @@
|
|
13
13
|
.govuk-warning-text__icon {
|
14
14
|
@include govuk-font($size: false, $weight: bold);
|
15
15
|
|
16
|
+
box-sizing: border-box;
|
17
|
+
|
16
18
|
display: inline-block;
|
17
19
|
|
18
20
|
position: absolute;
|
19
21
|
left: 0;
|
20
22
|
|
21
|
-
min-width:
|
22
|
-
min-height:
|
23
|
+
min-width: 35px;
|
24
|
+
min-height: 35px;
|
23
25
|
margin-top: -7px;
|
24
26
|
|
25
27
|
@include govuk-media-query($from: tablet) {
|
@@ -52,7 +52,7 @@
|
|
52
52
|
/// colour will be returned which meets contrast requirements . If you want to
|
53
53
|
/// use the non-websafe version you can set this to `false` but your should
|
54
54
|
/// ensure that you still meets contrast requirements for accessibility - for
|
55
|
-
/// example,
|
55
|
+
/// example, do not use the non-websafe version for text.
|
56
56
|
///
|
57
57
|
/// @return {Colour} Representation of colour for organisation
|
58
58
|
/// @throw if `$organisation` is not a known organisation
|
@@ -52,7 +52,7 @@ $govuk-print-text-colour: #000000 !default;
|
|
52
52
|
|
53
53
|
/// Secondary text colour
|
54
54
|
///
|
55
|
-
/// Used for 'muted' text
|
55
|
+
/// Used in for example 'muted' text and help text.
|
56
56
|
///
|
57
57
|
/// @type Colour
|
58
58
|
/// @access public
|
@@ -90,7 +90,7 @@ $govuk-error-colour: govuk-colour("red") !default;
|
|
90
90
|
|
91
91
|
/// Border colour
|
92
92
|
///
|
93
|
-
/// Used for borders, separators, rules
|
93
|
+
/// Used in for example borders, separators, rules and keylines.
|
94
94
|
///
|
95
95
|
/// @type Colour
|
96
96
|
/// @access public
|
@@ -81,8 +81,11 @@ $govuk-border-width-form-element: 2px !default;
|
|
81
81
|
///
|
82
82
|
/// @type Number
|
83
83
|
/// @access public
|
84
|
+
/// @deprecated Use $govuk-border-width-form-element instead. There should be no
|
85
|
+
/// difference in thickness for inputs in the error state, in order to
|
86
|
+
/// maintain a distinct focus state.
|
84
87
|
|
85
|
-
$govuk-border-width-form-element-error:
|
88
|
+
$govuk-border-width-form-element-error: 2px !default;
|
86
89
|
|
87
90
|
/// Form group border width when in error state
|
88
91
|
///
|
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.
|
4
|
+
version: 3.8.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: 2020-
|
12
|
+
date: 2020-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- ".github/workflows/test.yml"
|
50
50
|
- ".gitignore"
|
51
51
|
- CODE_OF_CONDUCT.md
|
52
|
+
- CONTRIBUTING.md
|
52
53
|
- Gemfile
|
53
54
|
- Gemfile.lock
|
54
55
|
- LICENSE.txt
|
@@ -215,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
216
|
- !ruby/object:Gem::Version
|
216
217
|
version: '0'
|
217
218
|
requirements: []
|
218
|
-
rubygems_version: 3.1.
|
219
|
+
rubygems_version: 3.1.4
|
219
220
|
signing_key:
|
220
221
|
specification_version: 4
|
221
222
|
summary: Adds the GOVUK frontend to a Rails application that uses the Asset Pipeline.
|