katalyst-govuk-formbuilder 1.2.0 → 1.2.1

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: c6480175ffd7ac7e718126f6b3e41314693c56cf87614d8691fb180adc7048fb
4
- data.tar.gz: 67d870ab5c506e5dcfb9e85a599f1940085457963d04f114f8db11571eba0b9f
3
+ metadata.gz: 0b3226cf4e2ecbf980efe6f5cdab612b5aafe57ffa4377cde05151f42843dc2d
4
+ data.tar.gz: 3b2e6aa556e25ffce43e021fe50153a3de7f4385844906c626297cbf36a676dd
5
5
  SHA512:
6
- metadata.gz: e6b24e8b2adbd0415313a030d1362b0b8739525ef1c0996dfb0d3f8dc4f18e040cb380ac9f4de090a4e9c22b961b6f2e2cd02701e3a5370df0c280b08b151f6a
7
- data.tar.gz: 7bfea8bff24edd542f4a786becbefc587f3ba50e529c8a08f5d8469a12c404b75206cfeaf8ca33e4a0dd7d619741d7403da4324fe34efdf0a1a6fcd8c0854291
6
+ metadata.gz: c0c6e25bebd4cb6783b23d99756355dac5f67456eb25df653ca9c47af5cf735e41a3ccc3020632c07056bd02615f6c31001652a3124be9d3660ef8fbd9dfd104
7
+ data.tar.gz: 8fe14e36cd46640fa7af588b1ca674ad0fbba35194a9b8b4c663bd0bebd4a6242251fc8d95a126d5256d6e00ac2ead0fb9eb86da56e6f4d5b115c1c015815582
@@ -4090,3 +4090,57 @@ x:-moz-any-link {
4090
4090
  width: 25% !important;
4091
4091
  }
4092
4092
  }
4093
+
4094
+ .govuk-richtextarea {
4095
+ font-family: "Open Sans", sans-serif;
4096
+ -webkit-font-smoothing: antialiased;
4097
+ -moz-osx-font-smoothing: grayscale;
4098
+ font-weight: 400;
4099
+ font-size: 16px;
4100
+ font-size: 1rem;
4101
+ line-height: 1.25;
4102
+ box-sizing: border-box;
4103
+ display: block;
4104
+ width: 100%;
4105
+ margin-bottom: 20px;
4106
+ padding: 5px;
4107
+ resize: vertical;
4108
+ border: 2px solid #0b0c0c;
4109
+ border-radius: 0;
4110
+ -webkit-appearance: none;
4111
+ }
4112
+ @media print {
4113
+ .govuk-richtextarea {
4114
+ font-family: sans-serif;
4115
+ }
4116
+ }
4117
+ @media (min-width: 40.0625em) {
4118
+ .govuk-richtextarea {
4119
+ font-size: 19px;
4120
+ font-size: 1.1875rem;
4121
+ line-height: 1.25;
4122
+ }
4123
+ }
4124
+ @media print {
4125
+ .govuk-richtextarea {
4126
+ font-size: 14pt;
4127
+ line-height: 1.25;
4128
+ }
4129
+ }
4130
+ @media (min-width: 40.0625em) {
4131
+ .govuk-richtextarea {
4132
+ margin-bottom: 30px;
4133
+ }
4134
+ }
4135
+ .govuk-richtextarea:focus {
4136
+ outline: 3px solid #ffdd00;
4137
+ outline-offset: 0;
4138
+ box-shadow: inset 0 0 0 2px;
4139
+ }
4140
+
4141
+ .govuk-richtextarea--error {
4142
+ border-color: #d4351c;
4143
+ }
4144
+ .govuk-richtextarea--error:focus {
4145
+ border-color: #0b0c0c;
4146
+ }
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "govuk_design_system_formbuilder"
4
+
5
+ module GOVUKDesignSystemFormBuilder
6
+ module Builder
7
+
8
+ # Generates a check box within a fieldset to be used as a boolean toggle for a single attribute.
9
+ # The values are 1 (toggled on), and 0 (toggled off).
10
+ #
11
+ # @param attribute_name [Symbol] The name of the attribute
12
+ # @param small [Boolean] controls whether small check boxes are used instead of regular-sized ones
13
+ # @param hint [Hash,Proc] The content of the hint. No hint will be added if 'text' is left +nil+. When a +Proc+ is
14
+ # supplied the hint will be wrapped in a +div+ instead of a +span+
15
+ # @option hint text [String] the hint text
16
+ # @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
17
+ # @param link_errors [Boolean] controls whether this checkbox should be linked to from {#govuk_error_summary}
18
+ # @option label text [String] the label text
19
+ # @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
20
+ # @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
21
+ # @option label hidden [Boolean] control the visibility of the label. Hidden labels will still be read by screenreaders
22
+ # @option label kwargs [Hash] additional arguments are applied as attributes on the +label+ element
23
+ # @option kwargs [Hash] kwargs additional arguments are applied as attributes to the +input+ element
24
+ # @param block [Block] any HTML passed in will form the contents of the fieldset
25
+ # @return [ActiveSupport::SafeBuffer] HTML output
26
+ #
27
+ # @example A single check box for terms and conditions
28
+ # = f.govuk_boolean_checkbox_field :terms_agreed,
29
+ # link_errors: true,
30
+ # label: { text: 'Do you agree with our terms and conditions?' },
31
+ # hint: { text: 'You will not be able to proceed unless you do' }
32
+ #
33
+ def govuk_boolean_checkbox_field(attribute_name, small: true, hint: {}, label: {}, link_errors: false, **kwargs, &block)
34
+ govuk_check_boxes_fieldset(attribute_name, legend: nil, multiple: false, small: small) do
35
+ govuk_check_box(attribute_name, 1, 0,
36
+ hint: hint,
37
+ label: label,
38
+ link_errors: link_errors,
39
+ multiple: false,
40
+ exclusive: false,
41
+ **kwargs, &block)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,7 +1,7 @@
1
1
  module Katalyst
2
2
  module GOVUK
3
3
  module Formbuilder
4
- VERSION = "1.2.0"
4
+ VERSION = "1.2.1"
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  require "govuk_design_system_formbuilder"
2
2
  require "govuk_design_system_formbuilder/elements/rich_text_area"
3
+ require "govuk_design_system_formbuilder/elements/boolean_checkbox_field"
3
4
 
4
5
  require "katalyst/govuk/formbuilder/engine"
5
6
  require "katalyst/govuk/formbuilder/frontend"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-govuk-formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder
@@ -38,6 +38,7 @@ files:
38
38
  - app/assets/javascripts/katalyst/govuk/formbuilder.js
39
39
  - app/assets/javascripts/katalyst/govuk/formbuilder.min.js
40
40
  - config/importmap.rb
41
+ - lib/govuk_design_system_formbuilder/elements/boolean_checkbox_field.rb
41
42
  - lib/govuk_design_system_formbuilder/elements/rich_text_area.rb
42
43
  - lib/katalyst/govuk/formbuilder.rb
43
44
  - lib/katalyst/govuk/formbuilder/engine.rb