katalyst-govuk-formbuilder 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/katalyst/govuk/formbuilder.css +56 -103
  3. data/app/assets/builds/katalyst/govuk/formbuilder.js +69 -58
  4. data/app/assets/builds/katalyst/govuk/formbuilder.min.js +12 -12
  5. data/lib/katalyst/govuk/formbuilder/extensions.rb +16 -0
  6. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/accordion/_index.scss +1 -1
  7. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/back-link/_index.scss +1 -1
  8. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/button/_index.scss +1 -1
  9. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/character-count/_index.scss +1 -1
  10. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +46 -53
  11. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/error-summary/_index.scss +1 -1
  12. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -3
  13. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/footer/_index.scss +1 -1
  14. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/header/_index.scss +24 -7
  15. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/input/_index.scss +5 -10
  16. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/label/_index.scss +3 -3
  17. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +2 -2
  18. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/panel/_index.scss +2 -2
  19. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +8 -2
  20. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/radios/_index.scss +52 -59
  21. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/skip-link/_index.scss +1 -1
  22. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/summary-list/_index.scss +1 -1
  23. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/table/_index.scss +14 -4
  24. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/tabs/_index.scss +1 -1
  25. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_all.scss +1 -1
  26. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +12 -0
  27. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_typography.scss +3 -1
  28. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/helpers/_typography.scss +102 -24
  29. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/overrides/_typography.scss +11 -2
  30. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_measurements.scss +1 -1
  31. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_media-queries.scss +1 -1
  32. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +177 -13
  33. metadata +4 -4
  34. data/vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-version.scss +0 -7
@@ -62,6 +62,23 @@
62
62
  font-weight: $govuk-font-weight-bold if($important, !important, null);
63
63
  }
64
64
 
65
+ /// Tabular number helper
66
+ ///
67
+ /// Switches numerical glyphs (0–9) to use alternative forms with a
68
+ /// monospaced bounding box. This ensures that columns of numbers, such
69
+ /// as those in tables, remain horizontally aligned with one another.
70
+ /// This also has the useful side effect of making numbers more legible
71
+ /// in some situations, such as reference codes, as the numbers are more
72
+ /// distinct and visually separated from one another.
73
+ ///
74
+ /// @param {Boolean} $important [false] - Whether to mark declarations as
75
+ /// `!important`. Generally Used to create override classes.
76
+ /// @access public
77
+
78
+ @mixin govuk-font-tabular-numbers($important: false) {
79
+ font-variant-numeric: tabular-nums if($important, !important, null);
80
+ }
81
+
65
82
  /// Convert line-heights specified in pixels into a relative value, unless
66
83
  /// they are already unit-less (and thus already treated as relative values)
67
84
  /// or the units do not match the units used for the font size.
@@ -80,7 +97,31 @@
80
97
  @return $line-height;
81
98
  }
82
99
 
83
- /// Responsive typography helper
100
+ /// Font size and line height helper
101
+ ///
102
+ /// @param {Number} $size - Point from the type scale (the size as it would
103
+ /// appear on tablet and above)
104
+ /// @param {Number} $override-line-height [false] - Non responsive custom line
105
+ /// height. Omit to use the line height from the font map.
106
+ /// @param {Boolean} $important [false] - Whether to mark declarations as
107
+ /// `!important`.
108
+ ///
109
+ /// @throw if `$size` is not a valid point from the type scale
110
+ ///
111
+ /// @access public
112
+ ///
113
+ /// @alias govuk-font-size
114
+ /// @deprecated Use `govuk-font-size` instead
115
+
116
+ @mixin govuk-typography-responsive($size, $override-line-height: false, $important: false) {
117
+ @include _warning(
118
+ "govuk-typography-responsive",
119
+ "govuk-typography-responsive is deprecated. Use govuk-font-size instead."
120
+ );
121
+ @include govuk-font-size($size, $override-line-height, $important);
122
+ }
123
+
124
+ /// Font size and line height helper
84
125
  ///
85
126
  /// Takes a point from the responsive 'font map' as an argument (the size as it
86
127
  /// would appear on tablet and above), and uses it to create font-size and
@@ -88,6 +129,7 @@
88
129
  ///
89
130
  /// Example font map:
90
131
  ///
132
+ /// ```scss
91
133
  /// 19: (
92
134
  /// null: (
93
135
  /// font-size: 16px,
@@ -102,31 +144,71 @@
102
144
  /// line-height: 1.15
103
145
  /// )
104
146
  /// );
147
+ /// ```
105
148
  ///
106
- /// @param {Number} $size - Point from the spacing scale (the size as it would
107
- /// appear on tablet and above)
108
- /// @param {Number} $override-line-height [false] - Non responsive custom line
149
+ /// @param {Number | String} $size - Point from the type scale (the size as
150
+ /// it would appear on tablet and above)
151
+ /// @param {Number} $line-height [false] - Non responsive custom line
109
152
  /// height. Omit to use the line height from the font map.
110
153
  /// @param {Boolean} $important [false] - Whether to mark declarations as
111
154
  /// `!important`.
112
155
  ///
113
- /// @throw if `$size` is not a valid point from the spacing scale
156
+ /// @throw if `$size` is not a valid point from the type scale
114
157
  ///
115
158
  /// @access public
116
159
 
117
- @mixin govuk-typography-responsive($size, $override-line-height: false, $important: false) {
118
- @if not map-has-key($govuk-typography-scale, $size) {
119
- @error "Unknown font size `#{$size}` - expected a point from the typography scale.";
160
+ @mixin govuk-font-size($size, $line-height: false, $important: false) {
161
+ // Flag font sizes that start with underscores so we can suppress warnings on
162
+ // deprecated sizes used internally, for example `govuk-font($size: "_14")`
163
+ $size-internal-use-only: str-slice(#{$size}, 1, 1) == "_";
164
+
165
+ // Remove underscore from font sizes flagged for internal use
166
+ @if $size-internal-use-only {
167
+ $size: str-slice(#{$size}, 2);
120
168
  }
121
169
 
170
+ // Check for a font map exactly matching the given size
122
171
  $font-map: map-get($govuk-typography-scale, $size);
123
172
 
173
+ // No match? Try with string type (e.g. $size: "16" not 16)
174
+ @if not $font-map {
175
+ @each $font-size in map-keys($govuk-typography-scale) {
176
+ @if not $font-map and #{$font-size} == #{$size} {
177
+ $font-map: map-get($govuk-typography-scale, $font-size);
178
+ }
179
+ }
180
+ }
181
+
182
+ // Still no match? Throw error
183
+ @if not $font-map {
184
+ @error "Unknown font size `#{$size}` - expected a point from the type scale.";
185
+ }
186
+
187
+ // Check for a deprecation within the type scale
188
+ $deprecation: map-get($font-map, "deprecation");
189
+
190
+ @if $deprecation {
191
+ // Warn on deprecated font sizes unless flagged for internal use
192
+ @if not $size-internal-use-only {
193
+ @include _warning(map-get($deprecation, "key"), map-get($deprecation, "message"));
194
+ }
195
+
196
+ // remove the deprecation map keys so they do not break the breakpoint loop
197
+ $font-map: map-remove($font-map, "deprecation");
198
+ }
199
+
124
200
  @each $breakpoint, $breakpoint-map in $font-map {
125
201
  $font-size: map-get($breakpoint-map, "font-size");
126
202
  $font-size-rem: govuk-px-to-rem($font-size);
127
203
 
128
- $line-height: _govuk-line-height(
129
- $line-height: if($override-line-height, $override-line-height, map-get($breakpoint-map, "line-height")),
204
+ // $calculated-line-height is a separate variable from $line-height,
205
+ // as otherwise the value would get redefined with each loop and
206
+ // eventually break _govuk-line-height.
207
+ //
208
+ // We continue to call the param $line-height to stay consistent with the
209
+ // naming with govuk-font.
210
+ $calculated-line-height: _govuk-line-height(
211
+ $line-height: if($line-height, $line-height, map-get($breakpoint-map, "line-height")),
130
212
  $font-size: $font-size
131
213
  );
132
214
 
@@ -135,20 +217,20 @@
135
217
  // are used in calculations
136
218
  $font-size: $font-size if($important, !important, null);
137
219
  $font-size-rem: $font-size-rem if($important, !important, null);
138
- $line-height: $line-height if($important, !important, null);
220
+ $calculated-line-height: $calculated-line-height if($important, !important, null);
139
221
 
140
222
  @if not $breakpoint {
141
223
  font-size: $font-size-rem;
142
- line-height: $line-height;
224
+ line-height: $calculated-line-height;
143
225
  } @else if $breakpoint == "print" {
144
226
  @include govuk-media-query($media-type: print) {
145
227
  font-size: $font-size;
146
- line-height: $line-height;
228
+ line-height: $calculated-line-height;
147
229
  }
148
230
  } @else {
149
231
  @include govuk-media-query($from: $breakpoint) {
150
232
  font-size: $font-size-rem;
151
- line-height: $line-height;
233
+ line-height: $calculated-line-height;
152
234
  }
153
235
  }
154
236
  }
@@ -156,14 +238,15 @@
156
238
 
157
239
  /// Font helper
158
240
  ///
159
- /// @param {Number | Boolean} $size Point from the spacing scale (the size as it
160
- /// would appear on tablet and above). Use `false` to avoid setting a size.
241
+ /// @param {Number | Boolean | String} $size Point from the type scale (the
242
+ /// size as it would appear on tablet and above). Use `false` to avoid setting
243
+ /// a size.
161
244
  /// @param {String} $weight [regular] - Weight: `bold` or `regular`
162
245
  /// @param {Boolean} $tabular [false] - Whether to use tabular numbers or not
163
246
  /// @param {Number} $line-height [false] - Line-height, if overriding the
164
247
  /// default
165
248
  ///
166
- /// @throw if `$size` is not a valid point from the spacing scale (or false)
249
+ /// @throw if `$size` is not a valid point from the type scale (or false)
167
250
  ///
168
251
  /// @access public
169
252
 
@@ -171,12 +254,7 @@
171
254
  @include govuk-typography-common;
172
255
 
173
256
  @if $tabular {
174
- font-feature-settings: "tnum" 1;
175
-
176
- @supports (font-variant-numeric: tabular-nums) {
177
- font-feature-settings: normal;
178
- font-variant-numeric: tabular-nums;
179
- }
257
+ @include govuk-font-tabular-numbers;
180
258
  }
181
259
 
182
260
  @if $weight == regular {
@@ -186,7 +264,7 @@
186
264
  }
187
265
 
188
266
  @if $size {
189
- @include govuk-typography-responsive($size, $override-line-height: $line-height);
267
+ @include govuk-font-size($size, $line-height);
190
268
  }
191
269
  }
192
270
 
@@ -3,9 +3,18 @@
3
3
 
4
4
  // Generate typography override classes for each responsive font map in the
5
5
  // typography scale eg .govuk-\!-font-size-80
6
- @each $size in map-keys($govuk-typography-scale) {
6
+ //
7
+ // govuk-!-font-size-14 is deprecated
8
+ @each $size, $font-map in $govuk-typography-scale {
7
9
  .govuk-\!-font-size-#{$size} {
8
- @include govuk-typography-responsive($size, $important: true);
10
+ $font-map: map-get($govuk-typography-scale, $size);
11
+
12
+ // Add underscore to deprecated typography scale keys
13
+ @if map-has-key($font-map, "deprecation") {
14
+ $size: _#{$size};
15
+ }
16
+
17
+ @include govuk-font-size($size, $important: true);
9
18
  }
10
19
  }
11
20
 
@@ -1,5 +1,5 @@
1
1
  ////
2
- /// @group settings/measurements
2
+ /// @group settings/layout
3
3
  ////
4
4
 
5
5
  // =========================================================
@@ -1,5 +1,5 @@
1
1
  ////
2
- /// @group settings/media-queries
2
+ /// @group settings/layout
3
3
  ////
4
4
 
5
5
  /// Breakpoint definitions
@@ -16,20 +16,20 @@
16
16
 
17
17
  $govuk-root-font-size: 16px !default;
18
18
 
19
- /// Responsive typography font map
19
+ /// Feature flag for new typography scale
20
20
  ///
21
- /// This is used to generate responsive typography that adapts according to the
22
- /// breakpoints.
21
+ /// When set to true, $govuk-typography-scale will use the new font map instead
22
+ /// of the current/old one as well as apply changes in components to account
23
+ /// for the updated scale.
23
24
  ///
24
- /// Font size and font weight can be defined for each breakpoint. You can define
25
- /// different behaviour on tablet and desktop. The 'null' breakpoint is for
26
- /// mobile.
25
+ /// Should be removed in 6.0.
27
26
  ///
28
- /// Line-heights will automatically be converted from pixel measurements into
29
- /// relative values. For example, with a font-size of 16px and a line-height of
30
- /// 24px, the line-height will be converted to 1.5 before output.
31
- ///
32
- /// You can also specify a separate font size and line height for print media.
27
+ /// @type Boolean
28
+ /// @access public
29
+
30
+ $govuk-new-typography-scale: false !default;
31
+
32
+ /// The font map for the old typography scale
33
33
  ///
34
34
  /// @type Map
35
35
  ///
@@ -38,9 +38,9 @@ $govuk-root-font-size: 16px !default;
38
38
  /// @prop {Number} $point.print.font-size - Font size for `$point` when printing
39
39
  /// @prop {Number} $point.print.line-height - Line height for `$point` when printing
40
40
  ///
41
- /// @access public
41
+ /// @access private
42
42
 
43
- $govuk-typography-scale: (
43
+ $_govuk-typography-scale-legacy: (
44
44
  80: (
45
45
  null: (
46
46
  font-size: 53px,
@@ -151,8 +151,172 @@ $govuk-typography-scale: (
151
151
  print: (
152
152
  font-size: 12pt,
153
153
  line-height: 1.2
154
+ ),
155
+ deprecation: (
156
+ key: "govuk-typography-scale-14",
157
+ message: "14 on the type scale is deprecated and will be removed as " +
158
+ "a possible option in the next major version."
159
+ )
160
+ )
161
+ );
162
+
163
+ /// The font map for the new typography scale
164
+ ///
165
+ /// @type Map
166
+ ///
167
+ /// @prop {Number} $point.$breakpoint.font-size - Font size for `$point` at `$breakpoint`
168
+ /// @prop {Number} $point.$breakpoint.line-height - Line height for `$point` at `$breakpoint`
169
+ /// @prop {Number} $point.print.font-size - Font size for `$point` when printing
170
+ /// @prop {Number} $point.print.line-height - Line height for `$point` when printing
171
+ ///
172
+ /// @access private
173
+
174
+ $_govuk-typography-scale-modern: (
175
+ 80: (
176
+ null: (
177
+ font-size: 53px,
178
+ line-height: 55px
179
+ ),
180
+ tablet: (
181
+ font-size: 80px,
182
+ line-height: 80px
183
+ ),
184
+ print: (
185
+ font-size: 53pt,
186
+ line-height: 1.1
187
+ )
188
+ ),
189
+ 48: (
190
+ null: (
191
+ font-size: 32px,
192
+ line-height: 35px
193
+ ),
194
+ tablet: (
195
+ font-size: 48px,
196
+ line-height: 50px
197
+ ),
198
+ print: (
199
+ font-size: 32pt,
200
+ line-height: 1.15
201
+ )
202
+ ),
203
+ 36: (
204
+ null: (
205
+ font-size: 27px,
206
+ line-height: 30px
207
+ ),
208
+ tablet: (
209
+ font-size: 36px,
210
+ line-height: 40px
211
+ ),
212
+ print: (
213
+ font-size: 24pt,
214
+ line-height: 1.05
215
+ )
216
+ ),
217
+ 27: (
218
+ // Made same as 24 on mobile (consider deprecating this size)
219
+ null:
220
+ (
221
+ font-size: 21px,
222
+ line-height: 25px
223
+ ),
224
+ tablet: (
225
+ font-size: 27px,
226
+ line-height: 30px
227
+ ),
228
+ print: (
229
+ font-size: 18pt,
230
+ line-height: 1.15
231
+ )
232
+ ),
233
+ 24: (
234
+ // Bump up mobile size from 18/20 to 21/25
235
+ null:
236
+ (
237
+ font-size: 21px,
238
+ line-height: 25px
239
+ ),
240
+ tablet: (
241
+ font-size: 24px,
242
+ line-height: 30px
243
+ ),
244
+ print: (
245
+ font-size: 18pt,
246
+ line-height: 1.15
247
+ )
248
+ ),
249
+ 19: (
250
+ // Stay at 19/25 at all sizes
251
+ null:
252
+ (
253
+ font-size: 19px,
254
+ line-height: 25px
255
+ ),
256
+ print: (
257
+ font-size: 14pt,
258
+ line-height: 1.15
259
+ )
260
+ ),
261
+ 16: (
262
+ // Stay at 16/20 at all sizes
263
+ null:
264
+ (
265
+ font-size: 16px,
266
+ line-height: 20px
267
+ ),
268
+ print: (
269
+ font-size: 14pt,
270
+ line-height: 1.2
271
+ )
272
+ ),
273
+ 14: (
274
+ // Stay at 14/20 at all sizes (consider deprecating this size)
275
+ null:
276
+ (
277
+ font-size: 14px,
278
+ line-height: 20px
279
+ ),
280
+ print: (
281
+ font-size: 12pt,
282
+ line-height: 1.2
283
+ ),
284
+ deprecation: (
285
+ key: "govuk-typography-scale-14",
286
+ message: "14 on the type scale is deprecated and will be removed as " +
287
+ "a possible option in the next major version."
154
288
  )
155
289
  )
290
+ );
291
+
292
+ /// Responsive typography font map
293
+ ///
294
+ /// This is used to generate responsive typography that adapts according to the
295
+ /// breakpoints.
296
+ ///
297
+ /// Font size and font weight can be defined for each breakpoint. You can define
298
+ /// different behaviour on tablet and desktop. The 'null' breakpoint is for
299
+ /// mobile.
300
+ ///
301
+ /// Line-heights will automatically be converted from pixel measurements into
302
+ /// relative values. For example, with a font-size of 16px and a line-height of
303
+ /// 24px, the line-height will be converted to 1.5 before output.
304
+ ///
305
+ /// You can also specify a separate font size and line height for print media.
306
+ ///
307
+ /// @type Map
308
+ ///
309
+ /// @prop {Number} $point.$breakpoint.font-size - Font size for `$point` at `$breakpoint`
310
+ /// @prop {Number} $point.$breakpoint.line-height - Line height for `$point` at `$breakpoint`
311
+ /// @prop {Number} $point.print.font-size - Font size for `$point` when printing
312
+ /// @prop {Number} $point.print.line-height - Line height for `$point` when printing
313
+ ///
314
+ /// @access public
315
+
316
+ $govuk-typography-scale: if(
317
+ $govuk-new-typography-scale,
318
+ $_govuk-typography-scale-modern,
319
+ $_govuk-typography-scale-legacy
156
320
  ) !default;
157
321
 
158
322
  /*# sourceMappingURL=_typography-responsive.scss.map */
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.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-11 00:00:00.000000000 Z
11
+ date: 2024-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_design_system_formbuilder
@@ -120,7 +120,7 @@ files:
120
120
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/components/warning-text/_warning-text.scss
121
121
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_all.scss
122
122
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_global-styles.scss
123
- - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-version.scss
123
+ - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss
124
124
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_links.scss
125
125
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_lists.scss
126
126
  - vendor/assets/stylesheets/govuk-frontend/dist/govuk/core/_section-break.scss
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
- rubygems_version: 3.4.10
197
+ rubygems_version: 3.4.19
198
198
  signing_key:
199
199
  specification_version: 4
200
200
  summary: Repackaging of UK.GOV forms for Rails 7 asset pipeline
@@ -1,7 +0,0 @@
1
- :root {
2
- // This variable is automatically overwritten during builds and releases.
3
- // It doesn't need to be updated manually.
4
- --govuk-frontend-version: "5.0.0";
5
- }
6
-
7
- /*# sourceMappingURL=_govuk-frontend-version.scss.map */