govuk_elements_rails 3.0.2 → 3.1.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
  SHA1:
3
- metadata.gz: 3f5a84dbd590c0b2b2caace7b71d843cc051a60a
4
- data.tar.gz: 7087493a1923fc9648705f8cc708eeac5aec313a
3
+ metadata.gz: 0c11c3760410ddee2a303ad32a80c8538ad6d354
4
+ data.tar.gz: 853ddbed025168693a3af55e7c97c59989e3aeab
5
5
  SHA512:
6
- metadata.gz: afa4e526a304e15c82c1a3807ae06465d54cbb7993aab248489ffc8a33ba588bbeff282165f2b99cb2f42ea4ccfa0088d8ea2738aa24a7c472b46bd778e07959
7
- data.tar.gz: 815a7a3e70e5f8d6aa590447f26568c88a3287d0aa609551db83444ab0a535781fd0950ad490392f5fd6d7cd21cb7c0b85113bdedd3184bdb09cba7f1f858deb
6
+ metadata.gz: cb6f9bea9029e360e7fe77b6750f76c02d0d3ca8b2ba7bf1e94ef4c69ac15a8509499a1c7f8880ae737e3360fe3104cdb7c7c92087c561083602b09ab8d9e071
7
+ data.tar.gz: c8f62df813a18975d9f3a5805edb9769afccfe92eae7d67647472573b74474bce471a4bbfbb67cc92392bd0cab17f7a52cd578ddb87d5053f6cb565cdbab5e7e
@@ -1,4 +1,5 @@
1
1
  module GovUKElementsRails
2
2
  class Engine < ::Rails::Engine
3
+ require 'govuk_frontend_toolkit'
3
4
  end
4
5
  end
@@ -10,6 +10,8 @@
10
10
  'use strict'
11
11
 
12
12
  var NATIVE_DETAILS = typeof document.createElement('details').open === 'boolean'
13
+ var KEY_ENTER = 13
14
+ var KEY_SPACE = 32
13
15
 
14
16
  // Add event construct for modern browsers or IE
15
17
  // which fires the callback with a pre-converted target reference
@@ -25,25 +27,50 @@
25
27
  }
26
28
  }
27
29
 
30
+ // Cross-browser character code / key pressed
31
+ function charCode (e) {
32
+ return (typeof e.which === 'number') ? e.which : e.keyCode
33
+ }
34
+
35
+ // Cross-browser preventing default action
36
+ function preventDefault (e) {
37
+ if (e.preventDefault) {
38
+ e.preventDefault()
39
+ } else {
40
+ e.returnValue = false
41
+ }
42
+ }
43
+
28
44
  // Handle cross-modal click events
29
45
  function addClickEvent (node, callback) {
30
- // Prevent space(32) from scrolling the page
31
46
  addEvent(node, 'keypress', function (e, target) {
32
- if (target.nodeName === 'SUMMARY') {
33
- if (e.keyCode === 32) {
34
- if (e.preventDefault) {
35
- e.preventDefault()
47
+ // When the key gets pressed - check if it is enter or space
48
+ if (charCode(e) === KEY_ENTER || charCode(e) === KEY_SPACE) {
49
+ if (target.nodeName.toLowerCase() === 'summary') {
50
+ // Prevent space from scrolling the page
51
+ // and enter from submitting a form
52
+ preventDefault(e)
53
+ // Click to let the click event do all the necessary action
54
+ if (target.click) {
55
+ target.click()
36
56
  } else {
37
- e.returnValue = false
57
+ // except Safari 5.1 and under don't support .click() here
58
+ callback(e, target)
38
59
  }
39
60
  }
40
61
  }
41
62
  })
42
- // When the key comes up - check if it is enter(13) or space(32)
63
+
64
+ // Prevent keyup to prevent clicking twice in Firefox when using space key
43
65
  addEvent(node, 'keyup', function (e, target) {
44
- if (e.keyCode === 13 || e.keyCode === 32) { callback(e, target) }
66
+ if (charCode(e) === KEY_SPACE) {
67
+ if (target.nodeName === 'SUMMARY') {
68
+ preventDefault(e)
69
+ }
70
+ }
45
71
  })
46
- addEvent(node, 'mouseup', function (e, target) {
72
+
73
+ addEvent(node, 'click', function (e, target) {
47
74
  callback(e, target)
48
75
  })
49
76
  }
@@ -1,55 +1,5 @@
1
- // GOV.UK front end toolkit
2
- // Sass variables, mixins and functions
3
- // https://github.com/alphagov/govuk_frontend_toolkit/tree/master/stylesheets
1
+ // Import GOV.UK front end toolkit dependencies
2
+ @import "frontend-toolkit";
4
3
 
5
- // Settings (variables)
6
- @import "colours"; // Colour variables
7
- @import "font_stack"; // Font family variables
8
- @import "measurements"; // Widths and gutter variables
9
-
10
- // Mixins
11
- @import "conditionals"; // Media query mixin
12
- @import "device-pixels"; // Retina image mixin
13
- @import "grid_layout"; // Basic grid layout mixin
14
- @import "typography"; // Core bold and heading mixins, also external links
15
- @import "shims"; // Inline block mixin, clearfix placeholder
16
-
17
- // Mixins to generate components (chunks of UI)
18
- @import "design-patterns/alpha-beta";
19
- @import "design-patterns/buttons";
20
- @import "design-patterns/breadcrumbs";
21
-
22
- // Functions
23
- @import "url-helpers"; // Function to output image-url, or prefixed path (Rails and Compass only)
24
-
25
- // GOV.UK elements
26
-
27
- @import "elements/helpers"; // Helper functions and classes
28
-
29
- // Generic (normalize/reset.css)
30
- @import "elements/reset";
31
-
32
- // Base (unclassed HTML elements)
33
- // These are predefined by govuk_template
34
- // If you're not using govuk_template, uncomment the line below.
35
- // @import "elements/govuk-template-base"; // Base styles set by GOV.UK template
36
-
37
- // Objects (unstyled design patterns)
38
- @import "elements/layout"; // Main content container. Grid layout - rows and column widths
39
-
40
- // Components (chunks of UI)
41
- @import "elements/elements-typography"; // Typography
42
- @import "elements/buttons"; // Buttons
43
- @import "elements/icons"; // Icons - numbered steps, calendar, search
44
- @import "elements/lists"; // Lists - numbered, bulleted
45
- @import "elements/tables"; // Tables - regular, numeric
46
- @import "elements/details"; // Details summary
47
- @import "elements/panels"; // Panels with a left grey border
48
- @import "elements/forms"; // Form - wrappers, inputs, labels
49
- @import "elements/forms/form-multiple-choice"; // Custom radio buttons and checkboxes
50
- @import "elements/forms/form-date"; // Date of birth pattern
51
- @import "elements/forms/form-validation"; // Errors and validation
52
- @import "elements/breadcrumbs"; // Breadcrumbs
53
- @import "elements/phase-banner"; // Alpha and beta banners and tags
54
- @import "elements/components"; // GOV.UK prefixed styles - blue highlighted box
55
- @import "elements/shame"; // Hacks and workarounds that will go away eventually
4
+ // Import GOV.UK elements
5
+ @import "elements";
@@ -2,7 +2,7 @@
2
2
  // Used for transaction end pages, and Bank Holidays
3
3
  .govuk-box-highlight {
4
4
  margin: 1em 0;
5
- padding: 2em 0 1em;
5
+ padding: 2em 1em;
6
6
  color: $white;
7
7
  background: $turquoise;
8
8
  text-align: center;
@@ -135,7 +135,8 @@ main {
135
135
  }
136
136
 
137
137
  // Text
138
- p {
138
+ p,
139
+ .body-text {
139
140
  margin-top: em(5, 16);
140
141
  margin-bottom: em(20, 16);
141
142
 
@@ -146,6 +147,10 @@ p {
146
147
 
147
148
  }
148
149
 
150
+ .body-text {
151
+ display: block;
152
+ }
153
+
149
154
  // Lede, or intro text
150
155
  .lede {
151
156
  @include core-24;
@@ -9,6 +9,7 @@
9
9
  // 4. Form hints
10
10
  // 5. Form controls
11
11
  // 6. Form control widths
12
+ // 7. Browser accessibility fixes
12
13
 
13
14
  // 1. Helpers
14
15
  // ==========================================================================
@@ -19,6 +20,11 @@ fieldset {
19
20
  width: 100%;
20
21
  }
21
22
 
23
+ // Hack to let legends or elements within legends have margins in webkit browsers
24
+ legend {
25
+ overflow: hidden;
26
+ }
27
+
22
28
  // Fix left hand gap in IE7 and below
23
29
  @include ie-lte(7) {
24
30
  legend {
@@ -35,14 +41,14 @@ textarea {
35
41
  // 2. Form wrappers
36
42
  // ==========================================================================
37
43
 
38
- // Form section is used to wrap .form-group and has twice its margin
39
- .form-section {
44
+ .form-section,
45
+ .form-group {
40
46
  @extend %contain-floats;
41
47
  @include box-sizing(border-box);
48
+ }
42
49
 
43
- float: left;
44
- width: 100%;
45
-
50
+ // Form section is used to wrap .form-group and has twice its margin
51
+ .form-section {
46
52
  margin-bottom: $gutter;
47
53
 
48
54
  @include media(tablet) {
@@ -52,12 +58,6 @@ textarea {
52
58
 
53
59
  // Form group is used to wrap label and input pairs
54
60
  .form-group {
55
- @extend %contain-floats;
56
- @include box-sizing(border-box);
57
-
58
- float: left;
59
- width: 100%;
60
-
61
61
  margin-bottom: $gutter-half;
62
62
 
63
63
  @include media(tablet) {
@@ -102,9 +102,8 @@ textarea {
102
102
 
103
103
  // Used for the 'or' in between block label options
104
104
  .form-block {
105
- @extend %contain-floats;
106
105
  float: left;
107
- width: 100%;
106
+ clear: left;
108
107
 
109
108
  margin-top: -5px;
110
109
  margin-bottom: 5px;
@@ -162,11 +161,16 @@ textarea {
162
161
  // scss-lint:disable QualifyingElement
163
162
  input.form-control,
164
163
  textarea.form-control {
165
- // Remove inner shadow
164
+ // Disable inner shadow and remove rounded corners
166
165
  -webkit-appearance: none;
167
- // Remove rounded corners
168
166
  border-radius: 0;
169
167
  }
168
+
169
+ textarea.form-control {
170
+ // Disable opacity and background image for Firefox
171
+ opacity: 1;
172
+ background-image: none;
173
+ }
170
174
  // scss-lint:enable QualifyingElement
171
175
 
172
176
 
@@ -223,3 +227,13 @@ textarea.form-control {
223
227
  width: 12.5%;
224
228
  }
225
229
  }
230
+
231
+ // 7. Browser accessibility fixes
232
+ // ==========================================================================
233
+
234
+ option:active,
235
+ option:checked,
236
+ select:focus::-ms-value {
237
+ color: $white;
238
+ background-color: $govuk-blue;
239
+ }
@@ -7,20 +7,6 @@
7
7
  @return ($px / $base) + em;
8
8
  }
9
9
 
10
- // Want to see how the grid works?
11
- // add this class to the body to see how grid padding is set
12
- .example-highlight-grid {
13
- .grid-row {
14
- background: $grey-2;
15
- }
16
-
17
- .column-highlight {
18
- background: $grey-3;
19
- width: 100%;
20
- }
21
-
22
- }
23
-
24
10
  // Hide, but not for screenreaders
25
11
  @mixin visually-hidden {
26
12
  position: absolute;
@@ -49,12 +49,13 @@
49
49
 
50
50
  // The last panel in a group
51
51
  .form-group .panel-border-narrow:last-child {
52
- margin-top: 10px;
52
+ margin-top: 0;
53
53
  margin-bottom: 0;
54
54
  }
55
55
 
56
56
  // For inline panels
57
- .inline .panel-border-narrow {
57
+ .inline .panel-border-narrow,
58
+ .inline .panel-border-narrow:last-child {
58
59
  margin-top: 10px;
59
60
  margin-bottom: 0;
60
61
  }
@@ -12,7 +12,6 @@ table {
12
12
  padding: em(12, 19) em(20, 19) em(9, 19) 0;
13
13
 
14
14
  text-align: left;
15
- color: $black;
16
15
  border-bottom: 1px solid $border-colour;
17
16
  }
18
17
 
@@ -20,6 +19,11 @@ table {
20
19
  font-weight: 700;
21
20
  }
22
21
 
22
+ td:last-child,
23
+ th:last-child {
24
+ padding-right: 0;
25
+ }
26
+
23
27
  // Right align table header cells and table cells with a numeric class
24
28
  .numeric {
25
29
  text-align: right;
@@ -30,6 +34,10 @@ table {
30
34
  td.numeric {
31
35
  font-family: $toolkit-font-stack-tabular;
32
36
  }
37
+
38
+ caption {
39
+ text-align: left;
40
+ }
33
41
  }
34
42
 
35
43
  .table-font-xsmall {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_elements_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob McKinnon
@@ -9,53 +9,53 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-30 00:00:00.000000000 Z
12
+ date: 2017-07-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 4.1.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 4.1.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sass
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 3.2.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 3.2.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: govuk_frontend_toolkit
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: 5.2.0
48
+ version: 6.0.2
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 5.2.0
55
+ version: 6.0.2
56
56
  description: |-
57
- A gem wrapper around govuk_elements v3.0.2
58
- that pulls stylesheet and javascript files into a Rails app. Changelog: https://github.com/alphagov/govuk_elements/blob/04646850aafd2236e11562c65602fc8e92a6d9f0
57
+ A gem wrapper around govuk_elements v3.1.0
58
+ that pulls stylesheet and javascript files into a Rails app. Changelog: https://github.com/alphagov/govuk_elements/blob/7a860c7274fd83484ba42eefe1575e72aefaf55d
59
59
  /CHANGELOG.md
60
60
  email: robin.whittleton@digital.cabinet-office.gov.uk
61
61
  executables: []
@@ -65,6 +65,8 @@ extra_rdoc_files:
65
65
  files:
66
66
  - LICENSE
67
67
  - README.md
68
+ - lib/govuk_elements_rails.rb
69
+ - lib/govuk_elements_rails/engine.rb
68
70
  - vendor/assets/javascripts/details.polyfill.js
69
71
  - vendor/assets/stylesheets/_govuk-elements.scss
70
72
  - vendor/assets/stylesheets/elements/_breadcrumbs.scss
@@ -86,31 +88,29 @@ files:
86
88
  - vendor/assets/stylesheets/elements/forms/_form-date.scss
87
89
  - vendor/assets/stylesheets/elements/forms/_form-multiple-choice.scss
88
90
  - vendor/assets/stylesheets/elements/forms/_form-validation.scss
89
- - lib/govuk_elements_rails/engine.rb
90
- - lib/govuk_elements_rails.rb
91
91
  homepage: https://github.com/alphagov/govuk_elements_rails
92
92
  licenses: []
93
93
  metadata: {}
94
94
  post_install_message:
95
95
  rdoc_options:
96
- - --main
96
+ - "--main"
97
97
  - README.md
98
98
  require_paths:
99
99
  - lib
100
100
  - vendor
101
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.14.1
113
+ rubygems_version: 2.6.10
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: A gem wrapper around http://github.com/alphagov/govuk_elements that pulls