dxw_govuk_frontend_rails 3.10.2 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +61 -40
- 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 +1 -1
- data/vendor/assets/stylesheets/components/_all.scss +1 -0
- data/vendor/assets/stylesheets/components/button/_index.scss +2 -0
- data/vendor/assets/stylesheets/components/character-count/_index.scss +1 -0
- data/vendor/assets/stylesheets/components/cookie-banner/_cookie-banner.scss +2 -0
- data/vendor/assets/stylesheets/components/cookie-banner/_index.scss +51 -0
- data/vendor/assets/stylesheets/components/table/_index.scss +21 -0
- data/vendor/assets/stylesheets/objects/_all.scss +1 -0
- data/vendor/assets/stylesheets/objects/_button-group.scss +94 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53ce04369f5585d9d7e25d250a3e346746bf5b8541387d23b9debfa85996d034
|
4
|
+
data.tar.gz: 50c7eedd8c1c126a6f55873bdb8e9955747de10048909861a086c81b2ae0bef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82eba76e269590ae83f405a02c03c76177d9d9bf35610e9f4a8b34a4e3550e5ab63f7d66c919744b5b404e08568af98924085f2c18fb17c1a38e8d33e96c958b
|
7
|
+
data.tar.gz: 68f8c51f435994ece6f8d8e219e3c369cfa4579e42cc2fb5f55d272cfd4504563c44f742c23595a7673d74ea6bdc0d05c34105d9d0a38054e31001468458f403
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,91 +1,112 @@
|
|
1
|
-
#
|
1
|
+
# GOV.UK Frontend for Rails
|
2
2
|
|
3
3
|
## Read this first
|
4
4
|
|
5
|
-
Although this gem makes it super easy to add the
|
6
|
-
|
7
|
-
|
5
|
+
Although this gem makes it super easy to add the GOV.UK Frontend to your Rails
|
6
|
+
applications, we would recommend using it as a guide to add the GOV.UK Frontend
|
7
|
+
yourself.
|
8
8
|
|
9
|
-
## About
|
9
|
+
## About
|
10
|
+
|
11
|
+
Adds the GOV.UK Frontend for Rails using the asset pipeline.
|
10
12
|
|
11
13
|
https://github.com/alphagov/govuk-frontend
|
12
14
|
|
13
15
|
## Breaking Changes in v3.0.0
|
14
16
|
|
15
|
-
This release of the
|
17
|
+
This release of the GOV.UK Frontend has breaking changes! Do not update to this
|
16
18
|
version until you have read and understood:
|
17
19
|
|
18
|
-
You will not be required to updated any file paths with govuk as we take care
|
19
|
-
that for you, all others changes will need to be managed:
|
20
|
+
You will not be required to updated any file paths with `govuk` as we take care
|
21
|
+
of that for you, all others changes will need to be managed:
|
20
22
|
|
21
23
|
https://github.com/alphagov/govuk-frontend/releases/tag/v3.0.0
|
22
24
|
|
23
25
|
## Limitations
|
24
26
|
|
25
|
-
This gem does not include the ie8 version of
|
26
|
-
standard no longer requires
|
27
|
+
This gem does not include the `ie8` version of GOV.UK Frontend, as the service
|
28
|
+
standard no longer requires support for Internet Explorer versions less than 11:
|
27
29
|
|
28
30
|
https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices
|
29
31
|
|
30
|
-
This gem and its documentation cannot tell you how to use the
|
31
|
-
see the
|
32
|
+
This gem and its documentation cannot tell you how to use the GOV.UK patterns
|
33
|
+
effectively, see the GOV.UK Design System documentation for that:
|
34
|
+
|
35
|
+
https://design-system.service.gov.uk/
|
32
36
|
|
33
|
-
|
37
|
+
## Installation
|
34
38
|
|
35
39
|
Add this line to your application's Gemfile:
|
36
40
|
|
37
|
-
```ruby
|
41
|
+
```ruby
|
42
|
+
gem 'dxw_govuk_frontend_rails'
|
43
|
+
```
|
38
44
|
|
39
45
|
And then execute:
|
40
46
|
|
41
|
-
|
47
|
+
```
|
48
|
+
$ bundle
|
49
|
+
```
|
50
|
+
|
51
|
+
## Usage
|
42
52
|
|
43
|
-
|
53
|
+
Your Rails app will need to have SCSS enabled.
|
54
|
+
|
55
|
+
**IMPORTANT: You must not use this library without changes if the service you
|
56
|
+
are building is not on GOV.UK. Read and understand the guidance here:**
|
57
|
+
|
58
|
+
https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk#if-your-service-isnt-on-govuk
|
44
59
|
|
45
60
|
### Basic usage
|
46
61
|
|
47
|
-
If the service you are building does not need to modify or extend the
|
48
|
-
Frontend all you need to do is import the main
|
62
|
+
If the service you are building does not need to modify or extend the GOV.UK
|
63
|
+
Frontend, all you need to do is import the main SCSS and JavaScript files into
|
49
64
|
your Rails app:
|
50
65
|
|
51
|
-
- create a
|
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:
|
66
|
+
- create a SCSS file in your application:
|
57
67
|
|
58
|
-
|
68
|
+
`app/assets/stylesheets/govuk_frontend_rails.scss`
|
59
69
|
|
60
|
-
-
|
70
|
+
- import the styles into `govuk_frontend_rails.scss`:
|
61
71
|
|
62
|
-
|
63
|
-
|
72
|
+
`@import "govuk-frontend-rails";`
|
73
|
+
|
74
|
+
- import the `govuk-frontend-rails.scss` file in the comment block in
|
75
|
+
`app/assets/stylesheets/application.css` or equivalent:
|
76
|
+
|
77
|
+
`*= require govuk_frontend_rails`
|
78
|
+
|
79
|
+
- import the JavaScript in the comment block of
|
80
|
+
`app/assets/javascripts/application.js`:
|
81
|
+
|
82
|
+
`//= require govuk_frontend_rails`
|
83
|
+
|
84
|
+
- initialise the GOV.UK Frontend either in a .js file or in your application
|
64
85
|
layout:
|
65
86
|
|
66
|
-
|
67
|
-
- update your application markup to use the GOVUK Frontend class names
|
87
|
+
`window.onload = function() { window.GOVUKFrontend.initAll() };`
|
68
88
|
|
69
|
-
|
70
|
-
are building is not on GOV.UK, read and understand the guidance here:
|
89
|
+
- update your application markup to use the GOV.UK Frontend class names
|
71
90
|
|
72
|
-
|
91
|
+
## Tracking GOV.UK Frontend versions
|
73
92
|
|
74
|
-
|
93
|
+
We aim to track the latest version of GOV.UK Frontend but we may fall behind.
|
94
|
+
Opening an issue if we are behind on a new release would be helpful, or open a
|
95
|
+
PR to update to the latest release!
|
75
96
|
|
76
|
-
## Updating to a new
|
97
|
+
## Updating to a new version of GOV.UK Frontend
|
77
98
|
|
78
|
-
When a new version of the
|
99
|
+
When a new version of the GOV.UK Frontend is released:
|
79
100
|
|
80
|
-
- make a new branch with the
|
101
|
+
- make a new branch with the GOV.UK Frontend version number
|
81
102
|
- set the new version number in `package.json` and
|
82
103
|
`lib/dxw_govuk_frontend_rails/version.rb`
|
83
|
-
- run
|
104
|
+
- run `npm update` to get the new release of the GOV.UK Frontend
|
84
105
|
- run `bundle exec rake` to compile the new assets
|
85
106
|
- commit the changes
|
86
|
-
- tag with the same release number as
|
107
|
+
- tag with the same release number as GOV.UK Frontend
|
87
108
|
- push the change
|
88
109
|
- push the tag
|
89
110
|
- merge your branch
|
90
111
|
- make a new release of the tag on GitHub
|
91
|
-
- GitHub
|
112
|
+
- GitHub actions 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.11.0",
|
9
|
+
"resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-3.11.0.tgz",
|
10
|
+
"integrity": "sha512-1hW/3etYBtKPM+PNdWVOijvWVI3mpYL8eb7WLTtlh/Qxf2mCp6LkCsZk9I034n4EJBYQ5jlUWsUlTOOIypftpg=="
|
11
11
|
}
|
12
12
|
}
|
13
13
|
}
|
data/package.json
CHANGED
@@ -1498,7 +1498,7 @@ function CharacterCount ($module) {
|
|
1498
1498
|
this.$module = $module;
|
1499
1499
|
this.$textarea = $module.querySelector('.govuk-js-character-count');
|
1500
1500
|
if (this.$textarea) {
|
1501
|
-
this.$countMessage = $module.querySelector('[id=' + this.$textarea.id + '-info]');
|
1501
|
+
this.$countMessage = $module.querySelector('[id="' + this.$textarea.id + '-info"]');
|
1502
1502
|
}
|
1503
1503
|
}
|
1504
1504
|
|
@@ -29,6 +29,8 @@
|
|
29
29
|
position: relative;
|
30
30
|
width: 100%;
|
31
31
|
margin-top: 0;
|
32
|
+
margin-right: 0;
|
33
|
+
margin-left: 0;
|
32
34
|
@include govuk-responsive-margin(6, "bottom", $adjustment: $button-shadow-size); // s2
|
33
35
|
padding: (govuk-spacing(2) - $govuk-border-width-form-element) govuk-spacing(2) (govuk-spacing(2) - $govuk-border-width-form-element - ($button-shadow-size / 2)); // s1
|
34
36
|
border: $govuk-border-width-form-element solid transparent;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
@include govuk-exports("govuk/component/cookie-banner") {
|
2
|
+
|
3
|
+
// This needs to be kept in sync with the header component's styles
|
4
|
+
$border-bottom-width: govuk-spacing(2);
|
5
|
+
|
6
|
+
.govuk-cookie-banner {
|
7
|
+
@include govuk-font($size: 19);
|
8
|
+
|
9
|
+
padding-top: govuk-spacing(4);
|
10
|
+
// The component does not set bottom spacing.
|
11
|
+
// The bottom spacing should be created by the items inside the component.
|
12
|
+
|
13
|
+
// Visually separate the cookie banner from content underneath
|
14
|
+
// when user changes colours in their browser.
|
15
|
+
border-bottom: $border-bottom-width solid transparent;
|
16
|
+
|
17
|
+
background-color: govuk-colour("light-grey", $legacy: "grey-3");
|
18
|
+
}
|
19
|
+
|
20
|
+
// Support older browsers which don't hide elements with the `hidden` attribute
|
21
|
+
// when user hides the whole cookie banner with a 'Hide' button.
|
22
|
+
.govuk-cookie-banner[hidden] {
|
23
|
+
display: none;
|
24
|
+
}
|
25
|
+
|
26
|
+
.govuk-cookie-banner__message {
|
27
|
+
// Remove the extra height added by the separator border.
|
28
|
+
margin-bottom: -$border-bottom-width;
|
29
|
+
|
30
|
+
&[hidden] {
|
31
|
+
// Support older browsers which don't hide elements with the `hidden` attribute
|
32
|
+
// when the visibility of cookie and replacement messages is toggled.
|
33
|
+
display: none;
|
34
|
+
}
|
35
|
+
|
36
|
+
&:focus {
|
37
|
+
// Remove the native visible focus indicator when the element is programmatically focused.
|
38
|
+
//
|
39
|
+
// The focused cookie banner is the first element on the page and the last thing the user
|
40
|
+
// interacted with prior to it gaining focus.
|
41
|
+
// We therefore assume that moving focus to it is not going to surprise users, and that giving
|
42
|
+
// it a visible focus indicator could be more confusing than helpful, especially as the
|
43
|
+
// element is not normally keyboard operable.
|
44
|
+
//
|
45
|
+
// We have flagged this in the research section of the guidance as something to monitor.
|
46
|
+
//
|
47
|
+
// A related discussion: https://github.com/w3c/wcag/issues/1001
|
48
|
+
outline: none;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
@@ -47,4 +47,25 @@
|
|
47
47
|
display: table-caption;
|
48
48
|
text-align: left;
|
49
49
|
}
|
50
|
+
|
51
|
+
// Modifiers that make captions look more like their equivalent headings
|
52
|
+
|
53
|
+
.govuk-table__caption--xl {
|
54
|
+
@include govuk-font($size: 48, $weight: bold);
|
55
|
+
margin-bottom: govuk-spacing(3);
|
56
|
+
}
|
57
|
+
|
58
|
+
.govuk-table__caption--l {
|
59
|
+
@include govuk-font($size: 36, $weight: bold);
|
60
|
+
margin-bottom: govuk-spacing(3);
|
61
|
+
}
|
62
|
+
|
63
|
+
.govuk-table__caption--m {
|
64
|
+
@include govuk-font($size: 24, $weight: bold);
|
65
|
+
margin-bottom: govuk-spacing(3);
|
66
|
+
}
|
67
|
+
|
68
|
+
.govuk-table__caption--s {
|
69
|
+
@include govuk-font($size: 19, $weight: bold);
|
70
|
+
}
|
50
71
|
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
@import "../base";
|
2
|
+
|
3
|
+
@include govuk-exports("govuk/objects/button-group") {
|
4
|
+
// Button groups can be used to group buttons and links together as a group.
|
5
|
+
//
|
6
|
+
// Within a button group:
|
7
|
+
//
|
8
|
+
// - links are styled to line up visually with the buttons, including being
|
9
|
+
// centre-aligned on mobile
|
10
|
+
// - spacing between the buttons and links is handled automatically, including
|
11
|
+
// when they wrap across multiple lines
|
12
|
+
.govuk-button-group {
|
13
|
+
$horizontal-gap: govuk-spacing(3);
|
14
|
+
$vertical-gap: govuk-spacing(3);
|
15
|
+
|
16
|
+
// These need to be kept in sync with the button component's styles
|
17
|
+
$button-padding: govuk-spacing(2);
|
18
|
+
$button-shadow-size: $govuk-border-width-form-element;
|
19
|
+
|
20
|
+
$link-spacing: govuk-spacing(1);
|
21
|
+
|
22
|
+
@include govuk-responsive-margin(6, "bottom", $adjustment: $vertical-gap * -1);
|
23
|
+
|
24
|
+
// Flexbox is used to center-align links on mobile, align everything along
|
25
|
+
// the baseline on tablet and above, and to removes extra whitespace that
|
26
|
+
// we'd get between the buttons and links because they're inline-blocks.
|
27
|
+
//
|
28
|
+
// Ideally we'd use `gap` with flexbox rather than having to do it all with
|
29
|
+
// margins, but unfortunately the support isn't there (yet) and @supports
|
30
|
+
// doesn't play nicely with it
|
31
|
+
// (https://github.com/w3c/csswg-drafts/issues/3559)
|
32
|
+
display: -webkit-box;
|
33
|
+
display: -ms-flexbox;
|
34
|
+
display: flex;
|
35
|
+
-webkit-box-orient: vertical;
|
36
|
+
-webkit-box-direction: normal;
|
37
|
+
-ms-flex-direction: column;
|
38
|
+
flex-direction: column;
|
39
|
+
-webkit-box-align: center;
|
40
|
+
-ms-flex-align: center;
|
41
|
+
align-items: center;
|
42
|
+
|
43
|
+
// Give links within the button group the same font-size and line-height
|
44
|
+
// as buttons.
|
45
|
+
//
|
46
|
+
// Because we want the focus state to be tight around the link text, we use
|
47
|
+
// margins where the buttons would use padding.
|
48
|
+
.govuk-link {
|
49
|
+
@include govuk-font($size: 19, $line-height: 19px);
|
50
|
+
display: inline-block;
|
51
|
+
// Prevent links overflowing their container in IE10/11 because of bug
|
52
|
+
// with align-items: center
|
53
|
+
max-width: 100%;
|
54
|
+
margin-top: $link-spacing;
|
55
|
+
margin-bottom: $link-spacing + $vertical-gap;
|
56
|
+
text-align: center;
|
57
|
+
}
|
58
|
+
|
59
|
+
// Reduce the bottom margin to the size of the vertical gap (accommodating
|
60
|
+
// the button shadow) – the 'lost' margin is moved to the button-group.
|
61
|
+
.govuk-button {
|
62
|
+
margin-bottom: $vertical-gap + $button-shadow-size;
|
63
|
+
}
|
64
|
+
|
65
|
+
// On tablet and above, we also introduce a 'column gap' between the
|
66
|
+
// buttons and links in each row and left align links
|
67
|
+
@include govuk-media-query($from: tablet) {
|
68
|
+
// Cancel out the column gap for the last item in each row
|
69
|
+
margin-right: ($horizontal-gap * -1);
|
70
|
+
|
71
|
+
-webkit-box-orient: horizontal;
|
72
|
+
|
73
|
+
-webkit-box-direction: normal;
|
74
|
+
|
75
|
+
-ms-flex-direction: row;
|
76
|
+
|
77
|
+
flex-direction: row;
|
78
|
+
-ms-flex-wrap: wrap;
|
79
|
+
flex-wrap: wrap;
|
80
|
+
-webkit-box-align: baseline;
|
81
|
+
-ms-flex-align: baseline;
|
82
|
+
align-items: baseline;
|
83
|
+
|
84
|
+
.govuk-button,
|
85
|
+
.govuk-link {
|
86
|
+
margin-right: $horizontal-gap;
|
87
|
+
}
|
88
|
+
|
89
|
+
.govuk-link {
|
90
|
+
text-align: left;
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
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.11.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:
|
12
|
+
date: 2021-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -93,6 +93,8 @@ files:
|
|
93
93
|
- vendor/assets/stylesheets/components/character-count/_index.scss
|
94
94
|
- vendor/assets/stylesheets/components/checkboxes/_checkboxes.scss
|
95
95
|
- vendor/assets/stylesheets/components/checkboxes/_index.scss
|
96
|
+
- vendor/assets/stylesheets/components/cookie-banner/_cookie-banner.scss
|
97
|
+
- vendor/assets/stylesheets/components/cookie-banner/_index.scss
|
96
98
|
- vendor/assets/stylesheets/components/date-input/_date-input.scss
|
97
99
|
- vendor/assets/stylesheets/components/date-input/_index.scss
|
98
100
|
- vendor/assets/stylesheets/components/details/_details.scss
|
@@ -163,6 +165,7 @@ files:
|
|
163
165
|
- vendor/assets/stylesheets/helpers/_typography.scss
|
164
166
|
- vendor/assets/stylesheets/helpers/_visually-hidden.scss
|
165
167
|
- vendor/assets/stylesheets/objects/_all.scss
|
168
|
+
- vendor/assets/stylesheets/objects/_button-group.scss
|
166
169
|
- vendor/assets/stylesheets/objects/_form-group.scss
|
167
170
|
- vendor/assets/stylesheets/objects/_grid.scss
|
168
171
|
- vendor/assets/stylesheets/objects/_main-wrapper.scss
|
@@ -218,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
221
|
- !ruby/object:Gem::Version
|
219
222
|
version: '0'
|
220
223
|
requirements: []
|
221
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.2.15
|
222
225
|
signing_key:
|
223
226
|
specification_version: 4
|
224
227
|
summary: Adds the GOVUK frontend to a Rails application that uses the Asset Pipeline.
|