govuk_design_system_formbuilder 4.0.0rc1 → 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: d47c45ad2ca56f3942aea3cd0f7d6e2f06a89ebfde5b94254ae56477dac2b611
4
- data.tar.gz: 7f8ed5d840ab7b3f5c338ef7ad764b2f5eac7d6e1f35e0918521b385425b9a47
3
+ metadata.gz: 6910a6f80e3a522452d48392d6393d09c62996e91ebef776113c3a1df4f4690d
4
+ data.tar.gz: ed742d70a77cd65a758211888fc304aa5e122b0c7a6311fd42fcb1d3ca4a86b4
5
5
  SHA512:
6
- metadata.gz: 33328d0ac48cea098b5ae01024341b08733b4aef090d673b800e240295bcdc5902f686a000ad482be4bfcb439a7c98d07fda68e97d7951f72ad54aca5d05b9e8
7
- data.tar.gz: 0276bb87a3cd4a20f26152ba72aa1b439cb05726a56c9770f65d2b1cbc417b5820cf5d02d580954faa3766aaac36029d21395688c13e394e6e6ed49775b1c546
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.5.0-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
 
@@ -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.0rc1'.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.0rc1
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-04-13 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
@@ -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: