katalyst-govuk-formbuilder 1.2.0 → 1.2.2
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 +4 -4
- data/app/assets/builds/katalyst/govuk/formbuilder.css +54 -0
- data/lib/govuk_design_system_formbuilder/elements/check_box_field.rb +45 -0
- data/lib/govuk_design_system_formbuilder/elements/rich_text_area.rb +0 -2
- data/lib/katalyst/govuk/formbuilder/version.rb +1 -1
- data/lib/katalyst/govuk/formbuilder.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0239e89e8855a5ded349983abca46fbf5a5c0bd7afb2acc9c550baf167c10f27'
|
4
|
+
data.tar.gz: 1c644907ab50cf26ea1d179d829c0c14498b01e8ce2f1639fc64efdac009d32f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce9b3e9bfd4068f39b984d3b8035335b51dc141ad65a56f42ee373688c777ddd4a1db38fdbd8b7f4a4a0b5863e45b63767676ad90927a48899778890670dea9
|
7
|
+
data.tar.gz: 4ac11cc52ef5cdffedca22504d96b8571611a62697f5aae4a4277d3828fedf3f87caa1f13cdd3b4617491465462f52a6b3658a334996afef0680f034c8be29e3
|
@@ -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
|
+
# Generates a check box within a fieldset to be used as a boolean toggle for a single attribute.
|
8
|
+
# The values are 1 (toggled on), and 0 (toggled off).
|
9
|
+
#
|
10
|
+
# @param attribute_name [Symbol] The name of the attribute
|
11
|
+
# @param small [Boolean] controls whether small check boxes are used instead of regular-sized ones
|
12
|
+
# @param hint [Hash,Proc] The content of the hint. No hint will be added if 'text' is left +nil+. When a +Proc+ is
|
13
|
+
# supplied the hint will be wrapped in a +div+ instead of a +span+
|
14
|
+
# @option hint text [String] the hint text
|
15
|
+
# @option hint kwargs [Hash] additional arguments are applied as attributes to the hint
|
16
|
+
# @param link_errors [Boolean] controls whether this checkbox should be linked to from {#govuk_error_summary}
|
17
|
+
# @option label text [String] the label text
|
18
|
+
# @option label size [String] the size of the label font, can be +xl+, +l+, +m+, +s+ or nil
|
19
|
+
# @option label tag [Symbol,String] the label's wrapper tag, intended to allow labels to act as page headings
|
20
|
+
# @option label hidden [Boolean] control the visibility of the label. Hidden labels will still be read by screenreaders
|
21
|
+
# @option label kwargs [Hash] additional arguments are applied as attributes on the +label+ element
|
22
|
+
# @option kwargs [Hash] kwargs additional arguments are applied as attributes to the +input+ element
|
23
|
+
# @param block [Block] any HTML passed in will form the contents of the fieldset
|
24
|
+
# @return [ActiveSupport::SafeBuffer] HTML output
|
25
|
+
#
|
26
|
+
# @example A single check box for terms and conditions
|
27
|
+
# = f.govuk_check_box_field :terms_agreed,
|
28
|
+
# link_errors: true,
|
29
|
+
# label: { text: 'Do you agree with our terms and conditions?' },
|
30
|
+
# hint: { text: 'You will not be able to proceed unless you do' }
|
31
|
+
#
|
32
|
+
def govuk_check_box_field(attribute_name, value = 1, unchecked_value = 0,
|
33
|
+
small: false, 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, value, unchecked_value,
|
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
|
@@ -53,8 +53,6 @@ end
|
|
53
53
|
|
54
54
|
module GOVUKDesignSystemFormBuilder
|
55
55
|
module Builder
|
56
|
-
delegate :config, to: GOVUKDesignSystemFormBuilder
|
57
|
-
|
58
56
|
# Generates a pair of +trix-toolbar+ and +trix-editor+ elements with a label, optional hint. Requires action-text to
|
59
57
|
# be correctly setup in the application
|
60
58
|
#
|
@@ -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/check_box_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.
|
4
|
+
version: 1.2.2
|
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-
|
11
|
+
date: 2022-11-02 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/check_box_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
|