katalyst-govuk-formbuilder 1.27.0 → 1.28.0

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: dfb2cbe250e87159a13e8e7e5a034bf8874f3f0b3e7f11420b0da4613f18bf50
4
- data.tar.gz: 6f2ab67eb3cc1b24b519c401d647f7e6be65e00e73736d47834838bf72b566d0
3
+ metadata.gz: '088f97f2c42cd5766eaa77fd9e85f60a2a02ea9b988aa3c6fb4924f107f1ac52'
4
+ data.tar.gz: bfc23680580b356b1a4eff07a82cc5770c36740a76819e84fd6cd4a9adf3a239
5
5
  SHA512:
6
- metadata.gz: 9a5fd246ff1ede995f1897e9b1feb0dd08c9a9aac71495317b0a59b56f49e3440695e8fcd7e536e02888c5089ae443fadac055f6aeb9356f47e47505367e96b3
7
- data.tar.gz: 245ddd162c6a15a028324889dfdac533849bfc690f98d9550719faaf93d3a7d2bbf888591f217b94515d4d05a89b60db0acb69581061778b7f09d151632db6af
6
+ metadata.gz: a9c4758793c31b396fa8e75620f20ada27970b4da30f885b18acb5d7e62514fa8565bd5cff4965f76f6dddc4baf6ed28e72a102cd23e67e77bf339b947fe7eed
7
+ data.tar.gz: 371302ba7c537c19bb0ec1ab31610b96f05dd1e999abef60aed649123bc96199b63a42667e54109df2b01475eb644414d2bdca0afa015ef170616667654aebc7
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  :root {
9
- --govuk-frontend-version: "6.2.0";
9
+ --govuk-frontend-version: "6.3.0";
10
10
  }
11
11
 
12
12
  :root {
@@ -1516,6 +1516,7 @@
1516
1516
  margin-left: -10px;
1517
1517
  }
1518
1518
  .govuk-checkboxes--small .govuk-checkboxes__label {
1519
+ max-width: calc(100% - 50px);
1519
1520
  padding-left: 1px;
1520
1521
  }
1521
1522
  .govuk-checkboxes--small .govuk-checkboxes__label::before {
@@ -1807,6 +1808,7 @@
1807
1808
  padding: 5px;
1808
1809
  border: 2px solid;
1809
1810
  border-color: var(--govuk-input-border-colour, #0b0c0c);
1811
+ color: var(--govuk-text-colour, #0b0c0c);
1810
1812
  background-color: #f3f3f3;
1811
1813
  text-align: center;
1812
1814
  white-space: nowrap;
@@ -2614,6 +2616,7 @@
2614
2616
  margin-left: -10px;
2615
2617
  }
2616
2618
  .govuk-radios--small .govuk-radios__label {
2619
+ max-width: calc(100% - 50px);
2617
2620
  padding-left: 1px;
2618
2621
  }
2619
2622
  .govuk-radios--small .govuk-radios__label::before {
@@ -2660,39 +2663,39 @@
2660
2663
  }
2661
2664
  }
2662
2665
 
2663
- .govuk-richtextarea {
2666
+ .govuk-rich-textarea {
2664
2667
  font-family: "Open Sans", sans-serif;
2665
2668
  -webkit-font-smoothing: antialiased;
2666
2669
  -moz-osx-font-smoothing: grayscale;
2667
2670
  }
2668
2671
  @media print {
2669
- .govuk-richtextarea {
2672
+ .govuk-rich-textarea {
2670
2673
  font-family: sans-serif;
2671
2674
  }
2672
2675
  }
2673
- .govuk-richtextarea {
2676
+ .govuk-rich-textarea {
2674
2677
  font-weight: 400;
2675
2678
  font-size: 1.1875rem;
2676
2679
  line-height: 1.25;
2677
2680
  }
2678
2681
  @media print {
2679
- .govuk-richtextarea {
2682
+ .govuk-rich-textarea {
2680
2683
  font-size: 14pt;
2681
2684
  line-height: 1.25;
2682
2685
  }
2683
2686
  }
2684
- .govuk-richtextarea {
2687
+ .govuk-rich-textarea {
2685
2688
  box-sizing: border-box;
2686
2689
  display: block;
2687
2690
  width: 100%;
2688
2691
  margin-bottom: 20px;
2689
2692
  }
2690
2693
  @media (min-width: 40.0625em) {
2691
- .govuk-richtextarea {
2694
+ .govuk-rich-textarea {
2692
2695
  margin-bottom: 30px;
2693
2696
  }
2694
2697
  }
2695
- .govuk-richtextarea {
2698
+ .govuk-rich-textarea {
2696
2699
  padding: 5px;
2697
2700
  resize: vertical;
2698
2701
  background-color: #ffffff;
@@ -2702,23 +2705,23 @@
2702
2705
  border-color: var(--govuk-input-border-colour, #0b0c0c);
2703
2706
  -webkit-appearance: none;
2704
2707
  }
2705
- .govuk-richtextarea:focus {
2708
+ .govuk-rich-textarea:focus {
2706
2709
  outline: 3px solid;
2707
2710
  outline-color: var(--govuk-focus-colour, #ffdd00);
2708
2711
  outline-offset: 0;
2709
2712
  box-shadow: inset 0 0 0 2px var(--govuk-input-border-colour, #0b0c0c);
2710
2713
  }
2711
- .govuk-richtextarea:disabled {
2714
+ .govuk-rich-textarea:disabled {
2712
2715
  opacity: 0.5;
2713
2716
  color: inherit;
2714
2717
  background-color: transparent;
2715
2718
  cursor: not-allowed;
2716
2719
  }
2717
2720
 
2718
- .govuk-richtextarea--error {
2721
+ .govuk-rich-textarea--error {
2719
2722
  border-color: var(--govuk-error-colour, #ca3535);
2720
2723
  }
2721
- .govuk-richtextarea--error:focus {
2724
+ .govuk-rich-textarea--error:focus {
2722
2725
  border-color: var(--govuk-input-border-colour, #0b0c0c);
2723
2726
  }
2724
2727
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  /// @access private
4
4
  @mixin styles {
5
- .govuk-richtextarea {
5
+ .govuk-rich-textarea {
6
6
  @include base.govuk-font($size: 19, $line-height: 1.25);
7
7
 
8
8
  box-sizing: border-box;
@@ -35,7 +35,7 @@
35
35
  }
36
36
  }
37
37
 
38
- .govuk-richtextarea--error {
38
+ .govuk-rich-textarea--error {
39
39
  border-color: base.govuk-functional-colour(error);
40
40
 
41
41
  &:focus {
@@ -194,20 +194,13 @@ module Katalyst
194
194
  # = f.govuk_rich_text_area :instructions,
195
195
  # label: -> { tag.h3("How do you set it up?") }
196
196
  #
197
- # @example A rich text area with a custom direct upload url and a custom stimulus controller
198
- # = f.govuk_rich_text_area :description,
199
- # data: {
200
- # direct_upload_url: direct_uploads_url,
201
- # controller: "content--editor--trix",
202
- # action: "trix-initialize->content--editor--trix#trixInitialize",
203
- # }
204
- #
205
- def govuk_rich_text_area(attribute_name, hint: {}, label: {}, caption: {}, form_group: {}, **, &)
206
- Elements::RichTextArea.new(
197
+ def govuk_rich_textarea(attribute_name, hint: {}, label: {}, caption: {}, form_group: {}, **, &)
198
+ Elements::RichTextarea.new(
207
199
  self, object_name, attribute_name,
208
200
  hint:, label:, caption:, form_group:, **, &
209
201
  ).html
210
202
  end
203
+ alias_method :govuk_rich_text_area, :govuk_rich_textarea
211
204
 
212
205
  # Generates a +combobox+ element that uses Hotwire Combobox to generate a combobox selection element.
213
206
  # @see https://hotwirecombobox.com
@@ -6,7 +6,7 @@ module Katalyst
6
6
  module GOVUK
7
7
  module FormBuilder
8
8
  module Elements
9
- class RichTextArea < GOVUKDesignSystemFormBuilder::Base
9
+ class RichTextarea < GOVUKDesignSystemFormBuilder::Base
10
10
  using GOVUKDesignSystemFormBuilder::PrefixableArray
11
11
 
12
12
  include GOVUKDesignSystemFormBuilder::Traits::Error
@@ -38,18 +38,18 @@ module Katalyst
38
38
 
39
39
  def html
40
40
  GOVUKDesignSystemFormBuilder::Containers::FormGroup.new(*bound, **@form_group).html do
41
- safe_join([label_element, supplemental_content, hint_element, error_element, rich_text_area])
41
+ safe_join([label_element, supplemental_content, hint_element, error_element, rich_textarea])
42
42
  end
43
43
  end
44
44
 
45
45
  private
46
46
 
47
- def rich_text_area
48
- @builder.rich_text_area(@attribute_name, **attributes(@html_attributes))
47
+ def rich_textarea
48
+ @builder.rich_textarea(@attribute_name, **attributes(@html_attributes))
49
49
  end
50
50
 
51
51
  def classes
52
- build_classes(%(richtextarea), %(richtextarea--error) => has_errors?).prefix(brand)
52
+ build_classes(%(rich-textarea), %(rich-textarea--error) => has_errors?).prefix(brand)
53
53
  end
54
54
 
55
55
  def options
@@ -13,6 +13,7 @@
13
13
  @import "fieldset";
14
14
  @import "file-upload";
15
15
  @import "footer";
16
+ @import "generic-header";
16
17
  @import "header";
17
18
  @import "hint";
18
19
  @import "input";
@@ -13,6 +13,7 @@
13
13
  @use "fieldset";
14
14
  @use "file-upload";
15
15
  @use "footer";
16
+ @use "generic-header";
16
17
  @use "header";
17
18
  @use "hint";
18
19
  @use "input";
@@ -41,7 +41,7 @@
41
41
  // __item using flex-wrap because we want hints on a separate line.
42
42
  max-width: calc(100% - #{(($govuk-checkboxes-label-padding-left-right * 2) + $govuk-touch-target-size)});
43
43
  margin-bottom: 0;
44
- padding: (base.govuk-spacing(1) + base.$govuk-border-width-form-element) base.govuk-spacing(3);
44
+ padding: (base.govuk-spacing(1) + base.$govuk-border-width-form-element) $govuk-checkboxes-label-padding-left-right;
45
45
  cursor: pointer;
46
46
  // remove 300ms pause on mobile
47
47
  touch-action: manipulation;
@@ -206,6 +206,12 @@
206
206
  }
207
207
 
208
208
  .govuk-checkboxes__label {
209
+ // Recalculate max-width to account for the smaller checkbox size
210
+ // 1px comes from padding-left (defined below)
211
+ max-width: calc(
212
+ 100% - #{($govuk-touch-target-size - $input-offset) + $govuk-checkboxes-label-padding-left-right + 1px}
213
+ );
214
+
209
215
  // Create a tiny space between the small checkbox hover state so that it
210
216
  // doesn't clash with the label
211
217
  padding-left: 1px;
@@ -0,0 +1,6 @@
1
+ @use "../../settings/warnings--internal";
2
+
3
+ @include warnings--internal.component-scss-file-warning("generic-header");
4
+
5
+ @import "index";
6
+
@@ -0,0 +1,8 @@
1
+ @use "mixin";
2
+
3
+ @import "../../base";
4
+
5
+ @include govuk-exports("govuk/component/generic-header") {
6
+ @include mixin.styles;
7
+ }
8
+
@@ -0,0 +1,5 @@
1
+ @use "../../custom-properties";
2
+ @use "mixin";
3
+
4
+ @include mixin.styles;
5
+
@@ -0,0 +1,136 @@
1
+ ////
2
+ /// @group components/generic-header
3
+ ////
4
+
5
+ @use "../../base";
6
+
7
+ /// Width of transparent bottom border of header.
8
+ /// Set to provide a visual border in forced colour modes
9
+ ///
10
+ /// @type Number
11
+ /// @access private
12
+ $header-forced-colour-border-width: 1px;
13
+
14
+ /// Shared block header styles, with automatic background setting
15
+ ///
16
+ /// @param {String} $background - background colour of header
17
+ /// @access private
18
+ @mixin block-styles($background: base.govuk-colour("black")) {
19
+ @include base.govuk-font($size: 16, $line-height: 1);
20
+
21
+ // Add a transparent bottom border for forced-colour modes
22
+ border-bottom: $header-forced-colour-border-width solid transparent;
23
+ color: base.govuk-colour("white");
24
+ background: $background;
25
+
26
+ @media print {
27
+ border-bottom-width: 0;
28
+ color: base.govuk-functional-colour(text);
29
+ background: transparent;
30
+ }
31
+ }
32
+
33
+ /// Shared header full width container styles
34
+ ///
35
+ /// @access private
36
+ @mixin full-width-container-styles() {
37
+ padding: 0 base.$govuk-gutter-half;
38
+ }
39
+
40
+ /// Shared header logo container element styles, with automating padding setting
41
+ ///
42
+ /// @param {String} $padding-top - top padding of logo container
43
+ /// @param {String} $padding-bottom - bottom padding of logo container
44
+ /// @access private
45
+ @mixin logo-styles(
46
+ $padding-top: (
47
+ base.govuk-spacing(3)
48
+ ),
49
+ $padding-bottom: (
50
+ base.govuk-spacing(3)
51
+ )
52
+ ) {
53
+ padding-top: $padding-top;
54
+ padding-bottom: $padding-bottom;
55
+ }
56
+
57
+ /// Shared header logo link element styles
58
+ ///
59
+ /// @access private
60
+ @mixin link-styles {
61
+ // Avoid using the `base.govuk-link-common` mixin because the links in the
62
+ // header get a special treatment, because:
63
+ //
64
+ // - underlines are only visible on hover
65
+ // - all links get a 3px underline regardless of text size, as there are
66
+ // multiple grouped elements close to one another and having slightly
67
+ // different underline widths looks unbalanced
68
+ //
69
+ // Font size needs to be set on the link so that the box sizing is correct
70
+ // in Firefox
71
+ display: inline;
72
+ margin-right: base.govuk-spacing(2);
73
+ font-size: 30px; // We don't have a mixin that produces 30px font size
74
+ text-decoration: none;
75
+
76
+ @include base.govuk-link-style-inverse;
77
+
78
+ &:link,
79
+ &:visited {
80
+ text-decoration: none;
81
+ }
82
+
83
+ &:hover,
84
+ &:active {
85
+ // Negate the added border
86
+ $link-underline-thickness: 3px;
87
+ margin-bottom: $link-underline-thickness * -1;
88
+ border-bottom: $link-underline-thickness solid;
89
+ }
90
+
91
+ &:focus {
92
+ // Remove any borders that show when focused and hovered.
93
+ margin-bottom: 0;
94
+ border-bottom: 0;
95
+
96
+ @include base.govuk-focused-text;
97
+ }
98
+
99
+ @media print {
100
+ &:link,
101
+ &:visited {
102
+ color: base.govuk-functional-colour(text);
103
+ }
104
+
105
+ // Do not append link href to GOV.UK link when printing (e.g. '(/)')
106
+ &::after {
107
+ content: "";
108
+ }
109
+ }
110
+ }
111
+
112
+ /// @access private
113
+ @mixin styles {
114
+ .govuk-generic-header {
115
+ @include block-styles;
116
+ }
117
+
118
+ .govuk-generic-header__container--full-width {
119
+ @include full-width-container-styles;
120
+ }
121
+
122
+ .govuk-generic-header__logo {
123
+ @include logo-styles;
124
+ }
125
+
126
+ .govuk-generic-header__homepage-link {
127
+ @include link-styles;
128
+
129
+ // Automatically centre align direct child elements to help users with
130
+ // positioning their logo assets eg: as `svg`s or `img`s
131
+ > * {
132
+ vertical-align: top;
133
+ }
134
+ }
135
+ }
136
+
@@ -1,45 +1,26 @@
1
1
  @use "../../base";
2
+ @use "../generic-header/mixin" as genericHeader;
2
3
 
3
4
  /// @access private
4
5
  @mixin styles {
5
6
  $logo-bottom-margin: 2px;
6
7
 
7
8
  .govuk-header {
8
- @include base.govuk-font($size: 16, $line-height: 1);
9
-
10
- // Add a transparent bottom border for forced-colour modes
11
- border-bottom: 1px solid transparent;
12
- color: base.govuk-colour("white");
13
- background: base.govuk-functional-colour(brand);
9
+ @include genericHeader.block-styles($background: base.govuk-functional-colour("brand"));
14
10
  }
15
11
 
16
12
  .govuk-header__container--full-width {
17
- padding: 0 base.govuk-spacing(3);
13
+ @include genericHeader.full-width-container-styles;
18
14
  }
19
15
 
20
16
  .govuk-header__logo {
21
- box-sizing: border-box;
22
-
23
17
  // Magic numbers, set padding to vertically centre align the logo
24
- padding-top: 16px;
25
- padding-bottom: 14px - $logo-bottom-margin;
18
+ @include genericHeader.logo-styles($padding-top: 16px, $padding-bottom: 14px - $logo-bottom-margin);
26
19
  }
27
20
 
28
21
  .govuk-header__homepage-link {
29
- // Avoid using the `base.govuk-link-common` mixin because the links in the
30
- // header get a special treatment, because:
31
- //
32
- // - underlines are only visible on hover
33
- // - all links get a 3px underline regardless of text size, as there are
34
- // multiple grouped elements close to one another and having slightly
35
- // different underline widths looks unbalanced
36
- //
37
- // Font size needs to be set on the link so that the box sizing is correct
38
- // in Firefox
39
- display: inline;
40
- margin-right: base.govuk-spacing(2);
41
- font-size: 30px; // We don't have a mixin that produces 30px font size
42
- text-decoration: none;
22
+ @include genericHeader.link-styles;
23
+
43
24
  // Remove word-spacing from within the logo so we can ignore
44
25
  // whitespace characters in the HTML
45
26
  word-spacing: base.govuk-px-to-rem(-6px);
@@ -47,28 +28,6 @@
47
28
  > * {
48
29
  word-spacing: 0;
49
30
  }
50
- @include base.govuk-link-style-inverse;
51
-
52
- &:link,
53
- &:visited {
54
- text-decoration: none;
55
- }
56
-
57
- &:hover,
58
- &:active {
59
- // Negate the added border
60
- $link-underline-thickness: 3px;
61
- margin-bottom: $link-underline-thickness * -1;
62
- border-bottom: $link-underline-thickness solid;
63
- }
64
-
65
- &:focus {
66
- // Remove any borders that show when focused and hovered.
67
- margin-bottom: 0;
68
- border-bottom: 0;
69
-
70
- @include base.govuk-focused-text;
71
- }
72
31
  }
73
32
 
74
33
  .govuk-header__logotype {
@@ -146,24 +105,6 @@
146
105
  }
147
106
 
148
107
  @media print {
149
- .govuk-header {
150
- border-bottom-width: 0;
151
- color: base.govuk-colour("black");
152
- background: transparent;
153
- }
154
-
155
- .govuk-header__homepage-link {
156
- &:link,
157
- &:visited {
158
- color: base.govuk-colour("black");
159
- }
160
-
161
- // Do not append link href to GOV.UK link when printing (e.g. '(/)')
162
- &::after {
163
- display: none;
164
- }
165
- }
166
-
167
108
  .govuk-header__product-name {
168
109
  // Fix product name alignment in Firefox when printing
169
110
  @-moz-document url-prefix() {
@@ -125,6 +125,7 @@
125
125
  padding: base.govuk-spacing(1);
126
126
  border: base.$govuk-border-width-form-element solid;
127
127
  border-color: base.govuk-functional-colour(input-border);
128
+ color: base.govuk-functional-colour(text);
128
129
  background-color: base.govuk-colour("black", $variant: "tint-95");
129
130
  text-align: center;
130
131
  white-space: nowrap;
@@ -46,7 +46,7 @@
46
46
  100% - #{($govuk-radios-label-padding-left-right + $govuk-touch-target-size + base.govuk-spacing(3))}
47
47
  );
48
48
  margin-bottom: 0;
49
- padding: (base.govuk-spacing(1) + base.$govuk-border-width-form-element) base.govuk-spacing(3);
49
+ padding: (base.govuk-spacing(1) + base.$govuk-border-width-form-element) $govuk-radios-label-padding-left-right;
50
50
  cursor: pointer;
51
51
  // remove 300ms pause on mobile
52
52
  touch-action: manipulation;
@@ -227,6 +227,12 @@
227
227
  }
228
228
 
229
229
  .govuk-radios__label {
230
+ // Recalculate max-width to account for the smaller radio size
231
+ // 1px comes from padding-left (defined below)
232
+ max-width: calc(
233
+ 100% - #{($govuk-touch-target-size - $input-offset) + $govuk-radios-label-padding-left-right + 1px}
234
+ );
235
+
230
236
  // Create a tiny space between the small radio hover state so that it
231
237
  // doesn't clash with the label
232
238
  padding-left: 1px;
@@ -7,7 +7,7 @@
7
7
  // `$govuk-output-custom-properties` is true or not to help with checking if
8
8
  // multiple stylesheets are outputting the same version
9
9
  :root {
10
- --govuk-frontend-version: "6.2.0";
10
+ --govuk-frontend-version: "6.3.0";
11
11
  }
12
12
  }
13
13
 
@@ -24,7 +24,7 @@ $govuk-imported-modules: () !default;
24
24
  ///
25
25
  /// @param {String} $name - Name of module - must be unique within the codebase
26
26
  /// @content The passed content will only be outputted if a module of the same
27
- /// $name has not already been outputted
27
+ /// $name has not already been outputted. Use only with `@import`, not `@use`.
28
28
  /// @access public
29
29
 
30
30
  @mixin govuk-exports($name) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-govuk-formbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
@@ -54,7 +54,7 @@ files:
54
54
  - lib/katalyst/govuk/form_builder/elements/image.rb
55
55
  - lib/katalyst/govuk/form_builder/elements/label.rb
56
56
  - lib/katalyst/govuk/form_builder/elements/legend.rb
57
- - lib/katalyst/govuk/form_builder/elements/rich_text_area.rb
57
+ - lib/katalyst/govuk/form_builder/elements/rich_textarea.rb
58
58
  - lib/katalyst/govuk/form_builder/engine.rb
59
59
  - lib/katalyst/govuk/form_builder/extensions.rb
60
60
  - lib/katalyst/govuk/form_builder/frontend.rb
@@ -127,6 +127,10 @@ files:
127
127
  - node_modules/govuk-frontend/dist/govuk/components/footer/_index.import.scss
128
128
  - node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss
129
129
  - node_modules/govuk-frontend/dist/govuk/components/footer/_mixin.scss
130
+ - node_modules/govuk-frontend/dist/govuk/components/generic-header/_generic-header.import.scss
131
+ - node_modules/govuk-frontend/dist/govuk/components/generic-header/_index.import.scss
132
+ - node_modules/govuk-frontend/dist/govuk/components/generic-header/_index.scss
133
+ - node_modules/govuk-frontend/dist/govuk/components/generic-header/_mixin.scss
130
134
  - node_modules/govuk-frontend/dist/govuk/components/header/_header.import.scss
131
135
  - node_modules/govuk-frontend/dist/govuk/components/header/_index.import.scss
132
136
  - node_modules/govuk-frontend/dist/govuk/components/header/_index.scss