govuk_design_system_formbuilder 4.0.0a1 → 4.0.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: cb63962a20ab569ce6283535831fd253e20d993436d554d47807472ce51e22cd
4
- data.tar.gz: fc6356cac0b5bcf49292ae825a0ef5a467b4f44cc137570a9b0e7db8ae857c2d
3
+ metadata.gz: 6910a6f80e3a522452d48392d6393d09c62996e91ebef776113c3a1df4f4690d
4
+ data.tar.gz: ed742d70a77cd65a758211888fc304aa5e122b0c7a6311fd42fcb1d3ca4a86b4
5
5
  SHA512:
6
- metadata.gz: ab50e0155a076d8bd2f4720286ff5415b993f56f741d6fa4abb0c1085442618e0afe12aa9f9035e1599c0cb55af8b15864315a1596971ae055c13ff4a7b56ee2
7
- data.tar.gz: 06d4e19e2d00f9556088a8a9a77dd1b23158b7091021fd183dcb9874dc66c018f66c6e97b6c018f97bb4a64aea528d5f50d57e36953f9079a6adc3a3e54ed14b
6
+ metadata.gz: dfef2a8d28874f33d616d7271bfafadf73474d4593ac734428ba3b9a54a5ca6e39fdccb2cd8e35d219ec7802b99b09b64d0368a680b1002347da59fea6d64b0a
7
+ data.tar.gz: 118aad431b99903782a310413b67ce21dc945591aaed9bc99c5b1c89244d4e360689fcaa9fde3f98067d93c53aa9814af24f6cfb935010ac90b33bfb06c0e1e1
data/README.md CHANGED
@@ -6,7 +6,7 @@
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-4.4.1-brightgreen)](https://design-system.service.gov.uk)
9
+ [![GOV.UK Design System Version](https://img.shields.io/badge/GOV.UK%20Design%20System-4.6.0-brightgreen)](https://design-system.service.gov.uk)
10
10
  [![Rails](https://img.shields.io/badge/Rails-6.1.7%20%E2%95%B1%207.0.4-E16D6D)](https://weblog.rubyonrails.org/releases/)
11
11
  [![Ruby](https://img.shields.io/badge/Ruby-3.0.5%20%20%E2%95%B1%203.1.3%20%20%E2%95%B1%203.2.0-E16D6D)](https://www.ruby-lang.org/en/downloads/)
12
12
 
@@ -130,7 +130,7 @@ git config --global user.name "Julius Hibbert"
130
130
 
131
131
  ## Services using this library
132
132
 
133
- Approximately [70 services use this library](https://github.com/DFE-Digital/govuk-formbuilder/network/dependents),
133
+ Approximately [100 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
 
@@ -12,6 +12,8 @@ module GOVUKDesignSystemFormBuilder
12
12
  #
13
13
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
14
14
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
15
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
16
+ # sequences of letters and numbers. Defaults to +false+.
15
17
  # @param label [Hash,Proc] configures or sets the associated label content
16
18
  # @option label text [String] the label text
17
19
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -50,8 +52,8 @@ module GOVUKDesignSystemFormBuilder
50
52
  # = f.govuk_text_field :callsign,
51
53
  # label: -> { tag.h3('Call-sign') }
52
54
  #
53
- def govuk_text_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
54
- Elements::Inputs::Text.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
55
+ def govuk_text_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, extra_letter_spacing: false, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
56
+ Elements::Inputs::Text.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
55
57
  end
56
58
 
57
59
  # Generates a input of type +tel+
@@ -63,6 +65,8 @@ module GOVUKDesignSystemFormBuilder
63
65
  # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
64
66
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
65
67
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
68
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
69
+ # sequences of letters and numbers. Defaults to +false+.
66
70
  # @param label [Hash,Proc] configures or sets the associated label content
67
71
  # @option label text [String] the label text
68
72
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -102,8 +106,8 @@ module GOVUKDesignSystemFormBuilder
102
106
  # = f.govuk_phone_field :work_number,
103
107
  # label: -> { tag.h3('Work number') }
104
108
  #
105
- def govuk_phone_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
106
- Elements::Inputs::Phone.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
109
+ def govuk_phone_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, extra_letter_spacing: false, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
110
+ Elements::Inputs::Phone.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
107
111
  end
108
112
 
109
113
  # Generates a input of type +email+
@@ -115,6 +119,8 @@ module GOVUKDesignSystemFormBuilder
115
119
  # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
116
120
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
117
121
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
122
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
123
+ # sequences of letters and numbers. Defaults to +false+.
118
124
  # @param label [Hash,Proc] configures or sets the associated label content
119
125
  # @option label text [String] the label text
120
126
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -152,8 +158,8 @@ module GOVUKDesignSystemFormBuilder
152
158
  # = f.govuk_email_field :personal_email,
153
159
  # label: -> { tag.h3('Personal email address') }
154
160
  #
155
- def govuk_email_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
156
- Elements::Inputs::Email.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
161
+ def govuk_email_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, extra_letter_spacing: false, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
162
+ Elements::Inputs::Email.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
157
163
  end
158
164
 
159
165
  # Generates a input of type +password+
@@ -165,6 +171,8 @@ module GOVUKDesignSystemFormBuilder
165
171
  # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
166
172
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
167
173
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
174
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
175
+ # sequences of letters and numbers. Defaults to +false+.
168
176
  # @param label [Hash,Proc] configures or sets the associated label content
169
177
  # @option label text [String] the label text
170
178
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -201,8 +209,8 @@ module GOVUKDesignSystemFormBuilder
201
209
  # = f.govuk_password_field :passcode,
202
210
  # label: -> { tag.h3('What is your secret pass code?') }
203
211
  #
204
- def govuk_password_field(attribute_name, hint: {}, label: {}, width: nil, form_group: {}, caption: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
205
- Elements::Inputs::Password.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
212
+ def govuk_password_field(attribute_name, hint: {}, label: {}, width: nil, extra_letter_spacing: false, form_group: {}, caption: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
213
+ Elements::Inputs::Password.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
206
214
  end
207
215
 
208
216
  # Generates a input of type +url+
@@ -214,6 +222,8 @@ module GOVUKDesignSystemFormBuilder
214
222
  # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
215
223
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
216
224
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
225
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
226
+ # sequences of letters and numbers. Defaults to +false+.
217
227
  # @param label [Hash,Proc] configures or sets the associated label content
218
228
  # @option label text [String] the label text
219
229
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -251,8 +261,8 @@ module GOVUKDesignSystemFormBuilder
251
261
  # = f.govuk_url_field :work_website,
252
262
  # label: -> { tag.h3("Enter your company's website") }
253
263
  #
254
- def govuk_url_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
255
- Elements::Inputs::URL.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
264
+ def govuk_url_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, extra_letter_spacing: false, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
265
+ Elements::Inputs::URL.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
256
266
  end
257
267
 
258
268
  # Generates a input of type +number+
@@ -264,6 +274,8 @@ module GOVUKDesignSystemFormBuilder
264
274
  # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
265
275
  # @param width [Integer,String] sets the width of the input, can be +2+, +3+ +4+, +5+, +10+ or +20+ characters
266
276
  # or +one-quarter+, +one-third+, +one-half+, +two-thirds+ or +full+ width of the container
277
+ # @param extra_letter_spacing [Boolean] when true adds space between characters to increase the readability of
278
+ # sequences of letters and numbers. Defaults to +false+.
267
279
  # @param label [Hash,Proc] configures or sets the associated label content
268
280
  # @option label text [String] the label text
269
281
  # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
@@ -304,8 +316,8 @@ module GOVUKDesignSystemFormBuilder
304
316
  # = f.govuk_url_field :personal_best_over_100m,
305
317
  # label: -> { tag.h3("How many seconds does it take you to run 100m?") }
306
318
  #
307
- def govuk_number_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
308
- Elements::Inputs::Number.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
319
+ def govuk_number_field(attribute_name, hint: {}, label: {}, caption: {}, width: nil, extra_letter_spacing: false, form_group: {}, prefix_text: nil, suffix_text: nil, **kwargs, &block)
320
+ Elements::Inputs::Number.new(self, object_name, attribute_name, hint: hint, label: label, caption: caption, width: width, extra_letter_spacing: extra_letter_spacing, form_group: form_group, prefix_text: prefix_text, suffix_text: suffix_text, **kwargs, &block).html
309
321
  end
310
322
 
311
323
  # Generates a +textarea+ element with a label, optional hint. Also offers
@@ -1,17 +1,18 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
2
  module Traits
3
3
  module Input
4
- def initialize(builder, object_name, attribute_name, hint:, label:, caption:, prefix_text:, suffix_text:, width:, form_group:, **kwargs, &block)
4
+ def initialize(builder, object_name, attribute_name, hint:, label:, caption:, prefix_text:, suffix_text:, width:, extra_letter_spacing:, form_group:, **kwargs, &block)
5
5
  super(builder, object_name, attribute_name, &block)
6
6
 
7
- @width = width
8
- @label = label
9
- @caption = caption
10
- @hint = hint
11
- @prefix_text = prefix_text
12
- @suffix_text = suffix_text
13
- @html_attributes = kwargs
14
- @form_group = form_group
7
+ @width = width
8
+ @label = label
9
+ @caption = caption
10
+ @hint = hint
11
+ @prefix_text = prefix_text
12
+ @suffix_text = suffix_text
13
+ @html_attributes = kwargs
14
+ @form_group = form_group
15
+ @extra_letter_spacing = extra_letter_spacing
15
16
  end
16
17
 
17
18
  def html
@@ -53,13 +54,17 @@ module GOVUKDesignSystemFormBuilder
53
54
  end
54
55
 
55
56
  def classes
56
- [%(#{brand}-input)].push(width_classes, error_classes).compact
57
+ [%(#{brand}-input)].push(width_classes, error_classes, extra_letter_spacing_classes).compact
57
58
  end
58
59
 
59
60
  def error_classes
60
61
  %(#{brand}-input--error) if has_errors?
61
62
  end
62
63
 
64
+ def extra_letter_spacing_classes
65
+ %(#{brand}-input--extra-letter-spacing) if @extra_letter_spacing
66
+ end
67
+
63
68
  def width_classes
64
69
  return if @width.blank?
65
70
 
@@ -1,3 +1,3 @@
1
1
  module GOVUKDesignSystemFormBuilder
2
- VERSION = '4.0.0a1'.freeze
2
+ VERSION = '4.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_design_system_formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0a1
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Yates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-26 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: 4.9.0
137
+ version: 4.10.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.9.0
144
+ version: 4.10.0
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: simplecov
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -176,28 +176,28 @@ dependencies:
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '4.11'
179
+ version: 4.12.15
180
180
  type: :development
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: '4.11'
186
+ version: 4.12.15
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: rouge
189
189
  requirement: !ruby/object:Gem::Requirement
190
190
  requirements:
191
191
  - - "~>"
192
192
  - !ruby/object:Gem::Version
193
- version: 4.0.0
193
+ version: 4.1.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: 4.0.0
200
+ version: 4.1.0
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: rubypants
203
203
  requirement: !ruby/object:Gem::Requirement
@@ -274,14 +274,14 @@ dependencies:
274
274
  requirements:
275
275
  - - "~>"
276
276
  - !ruby/object:Gem::Version
277
- version: 1.7.0
277
+ version: 1.8.1
278
278
  type: :development
279
279
  prerelease: false
280
280
  version_requirements: !ruby/object:Gem::Requirement
281
281
  requirements:
282
282
  - - "~>"
283
283
  - !ruby/object:Gem::Version
284
- version: 1.7.0
284
+ version: 1.8.1
285
285
  description: A Rails form builder that generates form inputs adhering to the GOV.UK
286
286
  Design System
287
287
  email:
@@ -367,9 +367,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
367
367
  version: '0'
368
368
  required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  requirements:
370
- - - ">"
370
+ - - ">="
371
371
  - !ruby/object:Gem::Version
372
- version: 1.3.1
372
+ version: '0'
373
373
  requirements: []
374
374
  rubygems_version: 3.2.33
375
375
  signing_key: