govuk_design_system_formbuilder 3.0.0 → 3.0.3b1

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: 5431741c89f055b1f15ae71906531d15d2ecc0be3052bb7f532a485829b14f90
4
- data.tar.gz: be2a909ef9dc527f086b62446a39e72be35fc893131e4218e3a1f1d138a0eeb6
3
+ metadata.gz: e8688a1ed5a9271f5618ba56617a4eab9aa1c341514b6d956558adc314282a2a
4
+ data.tar.gz: 29e1c726ef83a28da2bda26a917590ee672e4fb85cb1c3a9a89000636c2fef09
5
5
  SHA512:
6
- metadata.gz: 986679d3cb0ab2953a945c04ad46fae65788e0de23bdef6df1febb1884fd01a039552c2973130637e10851cc9f176d7b5f3c5a2db0ac9ddb1871484cd5186ccb
7
- data.tar.gz: e9dc03abd08f7ae026d0ae95efb3d36ae32dc6530101747ea1f1fb236c18c4156670fa60654df88d5d2562251f319358b43c49e6fd819da4afd840997296eef5
6
+ metadata.gz: fa735d3a296e2dd9f3b12cdb689fd659a9696f8cd33f866502cb48ddc63bba05013d4e87e6c688dacf25cc2de63b554fa6da6acf65bf9887c7e660265d21cc9c
7
+ data.tar.gz: 8273c13b2e36dba076b2120ee5ddd66c25c62153f9aabcc7e041d5eca9e93c4eadde7cfffedf88ebbabb8a7a509551ef0d7f5a3425c002d8afb02e245fb222d2
data/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
  [![Gem](https://img.shields.io/gem/dt/govuk_design_system_formbuilder?logo=rubygems)](https://rubygems.org/gems/govuk_design_system_formbuilder)
7
7
  [![Test Coverage](https://api.codeclimate.com/v1/badges/110136fb22341d3ba646/test_coverage)](https://codeclimate.com/github/DFE-Digital/govuk-formbuilder/test_coverage)
8
8
  [![GitHub license](https://img.shields.io/github/license/DFE-Digital/govuk_design_system_formbuilder)](https://github.com/DFE-Digital/govuk-formbuilder/blob/main/LICENSE)
9
- [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-3.14.0-brightgreen)](https://design-system.service.gov.uk)
10
- [![Rails](https://img.shields.io/badge/Rails-6.1.4.4%20%E2%95%B1%207.0.1-E16D6D)](https://weblog.rubyonrails.org/releases/)
11
- [![Ruby](https://img.shields.io/badge/Ruby-2.7.5%20%20%E2%95%B1%203.0.3%20%20%E2%95%B1%203.1.0-E16D6D)](https://www.ruby-lang.org/en/downloads/)
9
+ [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.0.1-brightgreen)](https://design-system.service.gov.uk)
10
+ [![Rails](https://img.shields.io/badge/Rails-6.1.5%20%E2%95%B1%207.0.3-E16D6D)](https://weblog.rubyonrails.org/releases/)
11
+ [![Ruby](https://img.shields.io/badge/Ruby-2.7.6%20%20%E2%95%B1%203.0.4%20%20%E2%95%B1%203.1.2-E16D6D)](https://www.ruby-lang.org/en/downloads/)
12
12
 
13
13
  This library provides an easy-to-use form builder for the [GOV.UK Design System](https://design-system.service.gov.uk/).
14
14
 
@@ -55,7 +55,7 @@ configured.
55
55
  To get up and running quickly and easily try kickstarting your project with a
56
56
  pre-configured template:
57
57
 
58
- * [DfE Boilerplate](https://github.com/DFE-Digital/govuk-rails-boilerplate)
58
+ * [DfE Rails Template](https://github.com/DFE-Digital/rails-template)
59
59
  * [DEFRA Ruby Template](https://github.com/DEFRA/defra-ruby-template)
60
60
 
61
61
  ## Setup 🔧
@@ -130,7 +130,7 @@ git config --global user.name "Julius Hibbert"
130
130
 
131
131
  ## Services using this library
132
132
 
133
- Approximately [40 services use this library](https://github.com/DFE-Digital/govuk-formbuilder/network/dependents),
133
+ Approximately [70 services use this library](https://github.com/DFE-Digital/govuk-formbuilder/network/dependents),
134
134
  here are a few from the <abbr title="Department for Education">DfE</abbr>, <abbr title="Ministry of Justice">MoJ</abbr>, and
135
135
  <abbr title="Department for Business, Energy & Industrial Strategy">BEIS</abbr>.
136
136
 
@@ -121,7 +121,6 @@ module GOVUKDesignSystemFormBuilder
121
121
  def options
122
122
  {
123
123
  class: classes,
124
- tabindex: -1,
125
124
  role: 'alert',
126
125
  data: {
127
126
  module: %(#{brand}-error-summary)
@@ -1,68 +1,12 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
2
  module Traits
3
3
  module HTMLAttributes
4
- # Attributes eases working with default and custom attributes by:
5
- # * deeply merging them so both the default (required) attributes are
6
- # present
7
- # * joins the arrays into strings to maintain Rails 6.0.* compatibility
8
- class Attributes
9
- # Only try to combine and merge these attributes that contain a list of
10
- # values separated by a space. All other values should be merged in a
11
- # regular fashion (where the custom value overrides the default)
12
- MERGEABLE = [
13
- %i(class),
14
- %i(aria controls),
15
- %i(aria describedby),
16
- %i(aria flowto),
17
- %i(aria labelledby),
18
- %i(aria owns),
19
- ].freeze
20
-
21
- def initialize(defaults, custom)
22
- @merged = defaults.deeper_merge(deep_split_values(custom))
23
- end
24
-
25
- def to_h
26
- deep_join_values(@merged)
27
- end
28
-
29
- private
30
-
31
- def deep_split_values(hash, parent = nil)
32
- hash.each.with_object({}) do |(key, value), result|
33
- result[key] = case value
34
- when Hash
35
- deep_split_values(value, key)
36
- when String
37
- split_mergeable(key, value, parent)
38
- else
39
- value
40
- end
41
- end
42
- end
43
-
44
- def split_mergeable(key, value, parent = nil)
45
- return value.presence unless [parent, key].compact.in?(MERGEABLE)
46
-
47
- value.split
48
- end
49
-
50
- def deep_join_values(hash)
51
- hash.each.with_object({}) do |(key, value), result|
52
- result[key] = case value
53
- when Hash
54
- deep_join_values(value)
55
- when Array
56
- value.uniq.join(' ').presence
57
- else
58
- value
59
- end
60
- end
61
- end
62
- end
4
+ using HTMLAttributesUtils
63
5
 
64
6
  def attributes(html_attributes = {})
65
- Attributes.new(options, html_attributes).to_h
7
+ options
8
+ .deep_merge_html_attributes(html_attributes)
9
+ .deep_tidy_html_attributes
66
10
  end
67
11
  end
68
12
  end
@@ -1,3 +1,3 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.0.3b1'.freeze
3
3
  end
@@ -1,5 +1,5 @@
1
- require 'deep_merge/rails_compat'
2
1
  require 'active_support/configurable'
2
+ require 'html_attributes_utils'
3
3
 
4
4
  [%w(presenters *.rb), %w(refinements *.rb), %w(traits *.rb), %w(*.rb), %w(elements ** *.rb), %w(containers ** *.rb)]
5
5
  .flat_map { |matcher| Dir.glob(File.join(__dir__, 'govuk_design_system_formbuilder', *matcher)) }
@@ -57,8 +57,8 @@ module GOVUKDesignSystemFormBuilder
57
57
  # * +:default_error_summary_turbo_prefix+ is used to disable turbo/turbolinks from
58
58
  # handling clicks on links in the error summary. When it's a string (eg,
59
59
  # turbo), that will result in links with the attribute 'data-turbo=false'.
60
- # When nil, no data attribute will be added. Defaults to 'turbolinks' for
61
- # compatibilitiy's sake; this will change to 'turbo' when Rails 7 is released
60
+ # When nil, no data attribute will be added. Defaults to turbo since Rails 7,
61
+ # change to 'turbolinks' for Rails 6.1
62
62
  #
63
63
  # * +:localisation_schema_fallback+ sets the prefix elements for the array
64
64
  # used to build the localisation string. The final two elements are always
@@ -88,7 +88,7 @@ module GOVUKDesignSystemFormBuilder
88
88
  default_error_summary_title: 'There is a problem',
89
89
  default_error_summary_presenter: Presenters::ErrorSummaryPresenter,
90
90
  default_error_summary_error_order_method: nil,
91
- default_error_summary_turbo_prefix: 'turbolinks',
91
+ default_error_summary_turbo_prefix: 'turbo',
92
92
  default_collection_check_boxes_include_hidden: true,
93
93
  default_collection_radio_buttons_include_hidden: true,
94
94
  default_submit_validate: false,
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_design_system_formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.3b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-07 00:00:00.000000000 Z
11
+ date: 2022-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: deep_merge
14
+ name: html-attributes-utils
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.1
19
+ version: 0.9.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.1
26
+ version: 0.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionview
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 4.2.0
137
+ version: 4.3.0
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: 4.2.0
144
+ version: 4.3.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: simplecov
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -190,14 +190,14 @@ dependencies:
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: 3.26.0
193
+ version: 3.28.0
194
194
  type: :development
195
195
  prerelease: false
196
196
  version_requirements: !ruby/object:Gem::Requirement
197
197
  requirements:
198
198
  - - "~>"
199
199
  - !ruby/object:Gem::Version
200
- version: 3.26.0
200
+ version: 3.28.0
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rubypants
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -368,9 +368,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
368
  version: '0'
369
369
  required_rubygems_version: !ruby/object:Gem::Requirement
370
370
  requirements:
371
- - - ">="
371
+ - - ">"
372
372
  - !ruby/object:Gem::Version
373
- version: '0'
373
+ version: 1.3.1
374
374
  requirements: []
375
375
  rubygems_version: 3.1.6
376
376
  signing_key: