govuk_design_system_formbuilder 3.0.2 → 3.0.3b1

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
  SHA256:
3
- metadata.gz: f231ec181996fa0acbc3e94d5382e576331b5900a3399f9b052e0fbd6bc5a7c7
4
- data.tar.gz: 403b62c7f06b053696f7c6fa94eb7ec7971581021cec7b859c20ef5aa318e7b9
3
+ metadata.gz: e8688a1ed5a9271f5618ba56617a4eab9aa1c341514b6d956558adc314282a2a
4
+ data.tar.gz: 29e1c726ef83a28da2bda26a917590ee672e4fb85cb1c3a9a89000636c2fef09
5
5
  SHA512:
6
- metadata.gz: bce07c94910264bcc88923e9096a84b39bf53104ab6b17571dcc3cc1e5ff2d71cf84782d5497cf67ed0d47d1cba92fcb616cabcf11b03fa2ec3de7a17e7e50c8
7
- data.tar.gz: b4aa94516e3026f53ed50830566ca15e314830d2237e6359bd88eea3469746c8e365ee4eb5a80610db22595396c800fd7659d7aafa48d999a21ed51fbb8e06e7
6
+ metadata.gz: fa735d3a296e2dd9f3b12cdb689fd659a9696f8cd33f866502cb48ddc63bba05013d4e87e6c688dacf25cc2de63b554fa6da6acf65bf9887c7e660265d21cc9c
7
+ data.tar.gz: 8273c13b2e36dba076b2120ee5ddd66c25c62153f9aabcc7e041d5eca9e93c4eadde7cfffedf88ebbabb8a7a509551ef0d7f5a3425c002d8afb02e245fb222d2
data/README.md CHANGED
@@ -7,8 +7,8 @@
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
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.4.4%20%E2%95%B1%207.0.2-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/)
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
 
@@ -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.2'.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)) }
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.2
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-02-12 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
@@ -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: