govuk_publishing_components 21.50.1 → 21.51.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: aba7af8d97c47a66a1cc2e94b2140a16a7575f106405043722de56e026f48818
4
- data.tar.gz: 9ef24b3f37b401f85f3c83bb77c34b6a86291016082ff489decbd07ec2618002
3
+ metadata.gz: fedf34db2684991bab29ed8f0b4fb255955d0c224c212fac7a39ec770aea839f
4
+ data.tar.gz: e951f2b97efa24c267d1d16148f8ca9ee3c68cc55d368deb88228491c7be4574
5
5
  SHA512:
6
- metadata.gz: 9cef0d13da3a06b72d2120250fdc957bc060452a324ea86927bd87d93a1ad9401ce3c7dc9e778c3f668535309f904acd1d275a5ff11f1a5ebca7a2456cbf0543
7
- data.tar.gz: b80eed8af5d8b9d830d8d02acd65a81e3d5b0e089bf4d100b2694f2ccd6621dddb34e2f86adc2a66623a59faef85f623a2305976083d90cbce2930fa4947f8d6
6
+ metadata.gz: fce07b54ebb9312b2ff11803363761a1aaf112514e8bc3c614e2184fe2d5d6605fd15ee59b4becf9d055acf9f7b4f7bfecf297f06a8bb4e9043b640967e7b157
7
+ data.tar.gz: 0a9f8e24d9b3cf7b69b8d2d8e145b12efb14d2a0f44e6a5a07b88c6ab151ec0fede4cb4f40bacb63fdfb38488a3af942a749e3f6b08605088effae9b161ec4ab
@@ -1,6 +1,4 @@
1
1
  // = require_tree ./lib
2
2
  // = require_tree ./components
3
- // = require govuk/all.js
4
3
 
5
- // Initialise all GOVUKFrontend components
6
- window.GOVUKFrontend.initAll()
4
+ window.GOVUKFrontend.initAll = function () {}
@@ -1,2 +1,5 @@
1
1
  // This component relies on JavaScript from GOV.UK Frontend
2
2
  // = require govuk/components/accordion/accordion.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Accordion = window.GOVUKFrontend
@@ -0,0 +1,5 @@
1
+ // This component relies on JavaScript from GOV.UK Frontend
2
+ // = require govuk/components/button/button.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Button = window.GOVUKFrontend
@@ -1,2 +1,5 @@
1
1
  // This component relies on JavaScript from GOV.UK Frontend
2
2
  // = require govuk/components/character-count/character-count.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.CharacterCount = window.GOVUKFrontend
@@ -1,7 +1,8 @@
1
1
  /* eslint-env jquery */
2
2
  // = require govuk/components/checkboxes/checkboxes.js
3
3
  window.GOVUK = window.GOVUK || {}
4
- window.GOVUK.Modules = window.GOVUK.Modules || {};
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
5
6
 
6
7
  (function (Modules) {
7
8
  'use strict'
@@ -1,2 +1,5 @@
1
1
  // This component relies on JavaScript from GOV.UK Frontend
2
2
  // = require govuk/components/error-summary/error-summary.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.ErrorSummary = window.GOVUKFrontend
@@ -0,0 +1,5 @@
1
+ // This component relies on JavaScript from GOV.UK Frontend
2
+ // = require govuk/components/header/header.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Header = window.GOVUKFrontend
@@ -1,2 +1,5 @@
1
1
  // This component relies on JavaScript from GOV.UK Frontend
2
2
  // = require govuk/components/radios/radios.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Radios = window.GOVUKFrontend
@@ -0,0 +1,5 @@
1
+ // This component relies on JavaScript from GOV.UK Frontend
2
+ // = require govuk/components/tabs/tabs.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Tabs = window.GOVUKFrontend
@@ -0,0 +1 @@
1
+ // = require_tree ./lib
@@ -28,13 +28,25 @@
28
28
  for (var i = 0, l = modules.length; i < l; i++) {
29
29
  var module
30
30
  var element = $(modules[i])
31
- var type = camelCaseAndCapitalise(element.data('module'))
31
+ var moduleName = camelCaseAndCapitalise(element.data('module'))
32
32
  var started = element.data('module-started')
33
+ var frontendModuleName = moduleName.replace('Govuk', '')
33
34
 
34
- if (typeof GOVUK.Modules[type] === 'function' && !started) {
35
- module = new GOVUK.Modules[type]()
35
+ if ( // GOV.UK Publishing & Legacy Modules
36
+ typeof GOVUK.Modules[moduleName] === 'function' &&
37
+ !GOVUK.Modules[moduleName].prototype.init &&
38
+ !started
39
+ ) {
40
+ module = new GOVUK.Modules[moduleName]()
36
41
  module.start(element)
37
42
  element.data('module-started', true)
43
+ } else if ( // GOV.UK Frontend Modules
44
+ typeof GOVUK.Modules[frontendModuleName] === 'function' &&
45
+ GOVUK.Modules[frontendModuleName].prototype.init &&
46
+ !started
47
+ ) {
48
+ module = new GOVUK.Modules[frontendModuleName](element[0]).init()
49
+ element.data('module-started', true)
38
50
  }
39
51
  }
40
52
 
@@ -1,12 +1,5 @@
1
1
  // This file contains the styles for the Component Guide.
2
2
 
3
- @import "govuk_publishing_components/components/helpers/govuk-frontend-settings";
4
- @import "govuk_publishing_components/components/helpers/markdown-typography";
5
- @import "govuk/settings/all";
6
- @import "govuk/tools/all";
7
- @import "govuk/helpers/all";
8
- @import "govuk/core/all";
9
-
10
3
  @import "govuk_publishing_components/all_components";
11
4
 
12
5
  $gem-guide-border-width: 1px;
@@ -1,20 +1,11 @@
1
1
  // This is the file that the application needs to include in order to use
2
2
  // the components.
3
3
 
4
- // Include all of the GOV.UK Frontend styles. This includes fonts, and individual components.
4
+ @import "govuk_publishing_components/govuk_frontend_support";
5
+ @import "govuk_publishing_components/component_support";
5
6
 
6
- @import "components/helpers/govuk-frontend-settings";
7
-
8
- // Include common imports used by many components
9
- @import "govuk/all";
10
-
11
- @import "components/helpers/variables";
12
- @import "components/helpers/brand-colours";
13
- @import "components/mixins/govuk-template-link-focus-override";
14
- @import "components/mixins/media-down";
15
- @import "components/mixins/margins";
16
- @import "components/mixins/clearfix";
17
- @import "components/mixins/css3";
7
+ // Include all govuk frontend components
8
+ @import "govuk/components/all";
18
9
 
19
10
  // components
20
11
  @import "components/accordion";
@@ -1,6 +1,3 @@
1
- @import "govuk/settings/colours-organisations";
2
- @import "govuk/helpers/colour";
3
-
4
1
  @mixin organisation-brand-colour {
5
2
  @each $organisation in map-keys($govuk-colours-organisations) {
6
3
  .brand--#{$organisation} {
@@ -10,6 +10,7 @@ module GovukPublishingComponents
10
10
  @components_in_use_docs = components_in_use_docs.used_in_this_app
11
11
  @components_in_use_sass = components_in_use_sass(false)
12
12
  @components_in_use_print_sass = components_in_use_sass(true)
13
+ @components_in_use_js = components_in_use_js
13
14
  end
14
15
 
15
16
  def show
@@ -62,6 +63,25 @@ module GovukPublishingComponents
62
63
  }.compact.uniq.sort.join("\n").squeeze("\n").prepend(additional_files)
63
64
  end
64
65
 
66
+ def components_in_use_js
67
+ additional_files = "//= require govuk_publishing_components/lib\n"
68
+
69
+ components = components_in_use
70
+ extra_components = []
71
+
72
+ components.each do |component|
73
+ components_in_component = components_within_component(component)
74
+ extra_components << components_in_component
75
+ end
76
+
77
+ components << extra_components.compact
78
+ components = components.flatten.uniq.sort
79
+
80
+ components.map { |component|
81
+ "//= require govuk_publishing_components/components/#{component.gsub('_', '-')}" if component_has_js_file(component.gsub("_", "-"))
82
+ }.compact.uniq.sort.join("\n").squeeze("\n").prepend(additional_files)
83
+ end
84
+
65
85
  private
66
86
 
67
87
  def component_docs
@@ -95,6 +115,10 @@ module GovukPublishingComponents
95
115
  Pathname.new(@component_gem_path + "/app/assets/stylesheets/govuk_publishing_components/components/#{print_path}_#{component}.scss").exist?
96
116
  end
97
117
 
118
+ def component_has_js_file(component)
119
+ Pathname.new(@component_gem_path + "/app/assets/javascripts/govuk_publishing_components/components/#{component}.js").exist?
120
+ end
121
+
98
122
  def components_within_component(component)
99
123
  data = File.read(@component_gem_path + "/app/views/govuk_publishing_components/components/_#{component}.html.erb")
100
124
  match = data.scan(/(govuk_publishing_components\/components\/[a-z_-]+)/)
@@ -20,7 +20,7 @@
20
20
  <h2 class="component-doc-h2">Gem components used by this app (<%= @components_in_use_docs.length %>)</h2>
21
21
 
22
22
  <%= render "govuk_publishing_components/components/details", {
23
- title: "Suggested Sass for this application"
23
+ title: "Suggested imports for this application"
24
24
  } do %>
25
25
  <%= render "govuk_publishing_components/components/textarea", {
26
26
  label: {
@@ -36,6 +36,13 @@
36
36
  name: "print-sass",
37
37
  value: @components_in_use_print_sass
38
38
  } %>
39
+ <%= render "govuk_publishing_components/components/textarea", {
40
+ label: {
41
+ text: "Add this to your application's main js file, before your other local imports."
42
+ },
43
+ name: "main-js",
44
+ value: @components_in_use_js
45
+ } %>
39
46
  <% end %>
40
47
  <pre>
41
48
 
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.50.1".freeze
2
+ VERSION = "21.51.0".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 21.50.1
4
+ version: 21.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
@@ -408,6 +408,7 @@ files:
408
408
  - app/assets/javascripts/component_guide/visual-regression.js
409
409
  - app/assets/javascripts/govuk_publishing_components/all_components.js
410
410
  - app/assets/javascripts/govuk_publishing_components/components/accordion.js
411
+ - app/assets/javascripts/govuk_publishing_components/components/button.js
411
412
  - app/assets/javascripts/govuk_publishing_components/components/character-count.js
412
413
  - app/assets/javascripts/govuk_publishing_components/components/checkboxes.js
413
414
  - app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js
@@ -417,11 +418,14 @@ files:
417
418
  - app/assets/javascripts/govuk_publishing_components/components/error-summary.js
418
419
  - app/assets/javascripts/govuk_publishing_components/components/feedback.js
419
420
  - app/assets/javascripts/govuk_publishing_components/components/govspeak.js
421
+ - app/assets/javascripts/govuk_publishing_components/components/header.js
420
422
  - app/assets/javascripts/govuk_publishing_components/components/initial-focus.js
421
423
  - app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
422
424
  - app/assets/javascripts/govuk_publishing_components/components/radio.js
423
425
  - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
426
+ - app/assets/javascripts/govuk_publishing_components/components/tabs.js
424
427
  - app/assets/javascripts/govuk_publishing_components/dependencies.js
428
+ - app/assets/javascripts/govuk_publishing_components/lib.js
425
429
  - app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js
426
430
  - app/assets/javascripts/govuk_publishing_components/lib/current-location.js
427
431
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js