katalyst-govuk-formbuilder 1.10.2 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -0
  3. data/app/assets/builds/katalyst/govuk/formbuilder.css +30 -30
  4. data/app/assets/stylesheets/katalyst/govuk/components/combobox/_index.scss +100 -0
  5. data/app/assets/stylesheets/katalyst/govuk/components/richtextarea/_index.scss +3 -4
  6. data/lib/katalyst/govuk/formbuilder/builder.rb +41 -1
  7. data/lib/katalyst/govuk/formbuilder/elements/combobox.rb +60 -0
  8. data/node_modules/govuk-frontend/dist/govuk/components/_index.scss +1 -0
  9. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +35 -31
  10. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +4 -4
  11. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +6 -1
  12. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +16 -13
  13. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +1 -2
  14. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -0
  15. data/node_modules/govuk-frontend/dist/govuk/components/fieldset/_index.scss +3 -5
  16. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +8 -9
  17. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +8 -0
  18. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -4
  19. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +3 -2
  20. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +24 -37
  21. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +13 -9
  22. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +12 -9
  23. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +0 -8
  24. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +7 -5
  25. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +5 -5
  26. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +162 -0
  27. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_service-navigation.scss +4 -0
  28. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +6 -4
  29. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +2 -1
  30. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +11 -8
  31. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +12 -10
  32. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +3 -3
  33. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +2 -2
  34. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +44 -8
  36. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  37. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +2 -2
  38. data/node_modules/govuk-frontend/dist/govuk/helpers/_shape-arrow.scss +1 -1
  39. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +17 -0
  40. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +30 -62
  41. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +5 -1
  42. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +235 -9
  43. metadata +7 -4
  44. data/app/assets/stylesheets/katalyst/govuk/components/richtextarea/_richtextarea.scss +0 -2
@@ -35,11 +35,13 @@
35
35
 
36
36
  .govuk-skip-link-focused-element {
37
37
  &:focus {
38
- // Remove the native visible focus indicator when the element is programmatically focused.
38
+ // Remove the native visible focus indicator when the element is
39
+ // programmatically focused.
39
40
  //
40
- // We set the focus on the linked element (this is usually the <main> element) when the skip
41
- // link is activated to improve screen reader announcements. However, we remove the visible
42
- // focus indicator from the linked element because the user cannot interact with it.
41
+ // We set the focus on the linked element (this is usually the <main>
42
+ // element) when the skip link is activated to improve screen reader
43
+ // announcements. However, we remove the visible focus indicator from the
44
+ // linked element because the user cannot interact with it.
43
45
  //
44
46
  // A related discussion: https://github.com/w3c/wcag/issues/1001
45
47
  outline: none;
@@ -179,7 +179,8 @@
179
179
  .govuk-summary-card__title-wrapper {
180
180
  padding: govuk-spacing(3);
181
181
 
182
- // Ensures the card header appears separate to the summary list in forced colours mode
182
+ // Ensures the card header appears separate to the summary list in forced
183
+ // colours mode
183
184
  border-bottom: 1px solid transparent;
184
185
  background-color: govuk-colour("light-grey");
185
186
 
@@ -12,11 +12,12 @@
12
12
  // where to break off of.
13
13
  max-width: $govuk-tag-max-width;
14
14
 
15
- // These negative margins make sure that the tag component doesn’t increase the
16
- // size of its container. Otherwise, for example, a table row containing a tag
17
- // will be taller than one containing plain text.
15
+ // These negative margins make sure that the tag component doesn’t increase
16
+ // the size of its container. Otherwise, for example, a table row containing
17
+ // a tag will be taller than one containing plain text.
18
18
  //
19
- // The negative margin added to the top and bottom matches the extra padding added.
19
+ // The negative margin added to the top and bottom matches the extra padding
20
+ // added.
20
21
  margin-top: -2px;
21
22
  margin-bottom: -3px;
22
23
 
@@ -30,11 +31,13 @@
30
31
  overflow-wrap: break-word;
31
32
 
32
33
  // When forced colour mode is active, for example to provide high contrast,
33
- // the background colour of the tag is the same as the rest of the page. To ensure
34
- // that the tag is perceived as separate from any surround text, it is made bold.
34
+ // the background colour of the tag is the same as the rest of the page. To
35
+ // ensure that the tag is perceived as separate from any surround text, it
36
+ // is made bold.
35
37
  //
36
- // Transparent outlines are no longer added, as they make the Tag look indistinguishable
37
- // from a button – but the tag is not interactive in the same way.
38
+ // Transparent outlines are no longer added, as they make the Tag look
39
+ // indistinguishable from a button – but the tag is not interactive in the
40
+ // same way.
38
41
  @media screen and (forced-colors: active) {
39
42
  font-weight: bold;
40
43
  }
@@ -11,11 +11,13 @@
11
11
  list-style-type: none;
12
12
  }
13
13
 
14
- // This uses table layout so that the task name and status always appear side-by-side, with the width of
15
- // each 'column' being flexible depending upon the length of the task names and statuses.
14
+ // This uses table layout so that the task name and status always appear
15
+ // side-by-side, with the width of each 'column' being flexible depending upon
16
+ // the length of the task names and statuses.
16
17
  //
17
- // The position is set to 'relative' so than an absolutely-positioned transparent element box
18
- // can be added within the link so that the whole row can be clickable.
18
+ // The position is set to 'relative' so than an absolutely-positioned
19
+ // transparent element box can be added within the link so that the whole row
20
+ // can be clickable.
19
21
  .govuk-task-list__item {
20
22
  display: table;
21
23
  position: relative;
@@ -30,9 +32,9 @@
30
32
  border-top: 1px solid $govuk-border-colour;
31
33
  }
32
34
 
33
- // This class is added to the <li> elements where the task name is a link.
34
- // The background hover colour is added to help indicate that the whole row is clickable, rather
35
- // than just the visible link text.
35
+ // This class is added to the <li> elements where the task name is a link. The
36
+ // background hover colour is added to help indicate that the whole row is
37
+ // clickable, rather than just the visible link text.
36
38
  .govuk-task-list__item--with-link:hover {
37
39
  background: $govuk-task-list-hover-colour;
38
40
  }
@@ -55,9 +57,9 @@
55
57
  color: $govuk-secondary-text-colour;
56
58
  }
57
59
 
58
- // This adds an empty transparent box covering the whole row, including the task status and
59
- // any hint text. Because this is generated within the link element, this allows the whole area
60
- // to be clickable.
60
+ // This adds an empty transparent box covering the whole row, including the
61
+ // task status and any hint text. Because this is generated within the link
62
+ // element, this allows the whole area to be clickable.
61
63
  .govuk-task-list__link::after {
62
64
  content: "";
63
65
  display: block;
@@ -6,7 +6,7 @@
6
6
  .govuk-textarea {
7
7
  @include govuk-font($size: 19, $line-height: 1.25);
8
8
 
9
- box-sizing: border-box; // should this be global?
9
+ box-sizing: border-box;
10
10
  display: block;
11
11
  width: 100%;
12
12
  min-height: 40px;
@@ -25,8 +25,8 @@
25
25
  // Ensure outline appears outside of the element
26
26
  outline-offset: 0;
27
27
  // Double the border by adding its width again. Use `box-shadow` to do
28
- // this instead of changing `border-width` (which changes element size) and
29
- // since `outline` is already used for the yellow focus state.
28
+ // this instead of changing `border-width` (which changes element size)
29
+ // and since `outline` is already used for the yellow focus state.
30
30
  box-shadow: inset 0 0 0 $govuk-border-width-form-element;
31
31
  }
32
32
 
@@ -25,8 +25,8 @@
25
25
  margin-top: -5px;
26
26
  }
27
27
 
28
- // When a user customises their colours the background colour will often be removed.
29
- // Adding a border to the component keeps it's shape as a circle.
28
+ // When a user customises their colours the background colour will often be
29
+ // removed. Adding a border to the component keeps it's shape as a circle.
30
30
  border: 3px solid $govuk-text-colour;
31
31
  border-radius: 50%;
32
32
 
@@ -1,7 +1,7 @@
1
1
  :root {
2
2
  // This variable is automatically overwritten during builds and releases.
3
3
  // It doesn't need to be updated manually.
4
- --govuk-frontend-version: "5.4.0";
4
+ --govuk-frontend-version: "5.6.0";
5
5
 
6
6
  // CSS custom property for each breakpoint
7
7
  @each $name, $value in $govuk-breakpoints {
@@ -42,25 +42,61 @@
42
42
  /// Get the colour for a government organisation
43
43
  ///
44
44
  /// @param {String} $organisation - Organisation name, lowercase, hyphenated
45
- /// @param {Boolean} $websafe [true] - By default a 'websafe' version of the
46
- /// colour will be returned which meets contrast requirements . If you want to
47
- /// use the non-websafe version you can set this to `false` but your should
48
- /// ensure that you still meets contrast requirements for accessibility - for
49
- /// example, do not use the non-websafe version for text.
45
+ /// @param {Boolean} $websafe - Deprecated. Use $contrast-safe instead.
46
+ /// @param {Boolean} $contrast-safe [true] - By default a version of the colour
47
+ /// will be returned which has a minimum 4.5:1 contrast ratio when used with
48
+ /// white, as per the WCAG 2.1 Level AA guidelines. If you want to use the
49
+ /// non-contrast safe version you can set this to `false` but your should
50
+ /// ensure that you still meets contrast requirements for accessibility -
51
+ /// for example, do not use the non-contrast safe version for text.
50
52
  ///
51
53
  /// @return {Colour} Representation of colour for organisation
52
54
  /// @throw if `$organisation` is not a known organisation
53
55
  /// @access public
54
56
 
55
- @function govuk-organisation-colour($organisation, $websafe: true) {
57
+ @function govuk-organisation-colour($organisation, $websafe: null, $contrast-safe: true) {
58
+ // Check if the $organisation exists in the aliases map. If so, change the
59
+ // value of $organisation to the aliased value.
60
+ @if map-has-key($_govuk_colours-organisations-aliases, $organisation) {
61
+ $organisation: map-get($_govuk_colours-organisations-aliases, $organisation);
62
+ }
63
+
64
+ // Check to see if the organisation exists
56
65
  @if not map-has-key($govuk-colours-organisations, $organisation) {
57
66
  @error "Unknown organisation `#{$organisation}`";
58
67
  }
59
68
 
69
+ // Output a warning if $websafe is set.
70
+ @if $websafe and not index($govuk-suppressed-warnings, "organisation-colour-websafe-param") {
71
+ @warn _warning-text("organisation-colour-websafe-param",
72
+ "The `$websafe` parameter of `govuk-organisation-colour` has been " +
73
+ "renamed to `$contrast-safe`. The old parameter name will be removed in " +
74
+ "the next major version."
75
+ );
76
+ }
77
+
60
78
  $org-colour: map-get($govuk-colours-organisations, $organisation);
61
79
 
62
- @if $websafe and map-has-key($org-colour, colour-websafe) {
63
- @return map-get($org-colour, colour-websafe);
80
+ @if map-has-key($org-colour, deprecation-message) and not index($govuk-suppressed-warnings, "organisation-colours") {
81
+ @warn _warning-text(
82
+ "organisation-colours",
83
+ map-get($org-colour, deprecation-message)
84
+ );
85
+ }
86
+
87
+ // If the $websafe parameter is being used (it has been explicitly set as true
88
+ // or false), assume the user hasn't updated to use $contrast-safe yet and map
89
+ // the old parameter's value onto the new parameter.
90
+ @if type-of($websafe) != "null" {
91
+ $contrast-safe: $websafe;
92
+ }
93
+
94
+ // Determine the contrast-safe key to use depending on whether it's the new
95
+ // palette or the legacy palette
96
+ $safe-key: if($govuk-new-organisation-colours, "contrast-safe", "colour-websafe");
97
+
98
+ @if $contrast-safe and map-has-key($org-colour, $safe-key) {
99
+ @return map-get($org-colour, $safe-key);
64
100
  } @else {
65
101
  @return map-get($org-colour, colour);
66
102
  }
@@ -37,7 +37,7 @@
37
37
  /// }
38
38
  ///
39
39
  /// @example scss - Customising the breakpoint where width percentage is applied
40
- /// .govuk-grid-column-one-half-at-desktop {
40
+ /// .govuk-grid-column-one-half-from-desktop {
41
41
  /// @include govuk-grid-column(one-half, $at: desktop);
42
42
  /// }
43
43
  ///
@@ -229,7 +229,7 @@
229
229
  }
230
230
 
231
231
  // Force a colour change on hover to work around a bug in Safari
232
- // https://bugs.webkit.org/show_bug.cgi?id=224483
232
+ // https://webkit.org/b/224483
233
233
  &:hover {
234
234
  @if type-of($govuk-text-colour) == color {
235
235
  color: rgba($govuk-text-colour, 0.99);
@@ -265,7 +265,7 @@
265
265
  }
266
266
 
267
267
  // Force a colour change on hover to work around a bug in Safari
268
- // https://bugs.webkit.org/show_bug.cgi?id=224483
268
+ // https://webkit.org/b/224483
269
269
  &:hover,
270
270
  &:active {
271
271
  color: rgba(govuk-colour("white"), 0.99);
@@ -54,7 +54,7 @@
54
54
  -webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
55
55
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%); // 3
56
56
 
57
- border-width: 0 $perpendicular $height $perpendicular;
57
+ border-width: 0 $perpendicular $height;
58
58
  border-bottom-color: inherit; // 2
59
59
  } @else if $direction == "right" {
60
60
  -webkit-clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
@@ -79,6 +79,23 @@
79
79
  font-variant-numeric: tabular-nums if($important, !important, null);
80
80
  }
81
81
 
82
+ /// Word break helper
83
+ ///
84
+ /// Forcibly breaks long words that lack spaces, such as email addresses,
85
+ /// across multiple lines when they wouldn't otherwise fit.
86
+ ///
87
+ /// @param {Boolean} $important [false] - Whether to mark declarations as
88
+ /// `!important`. Generally used to create override classes.
89
+ /// @access public
90
+
91
+ @mixin govuk-text-break-word($important: false) {
92
+ // IE 11 and Edge 16–17 only support the non-standard `word-wrap` property
93
+ word-wrap: break-word if($important, !important, null);
94
+
95
+ // All other browsers support `overflow-wrap`
96
+ overflow-wrap: break-word if($important, !important, null);
97
+ }
98
+
82
99
  /// Convert line-heights specified in pixels into a relative value, unless
83
100
  /// they are already unit-less (and thus already treated as relative values)
84
101
  /// or the units do not match the units used for the font size.
@@ -2,7 +2,7 @@
2
2
  /// @group helpers/accessibility
3
3
  ////
4
4
 
5
- /// Hide an element visually, but have it available for screen readers
5
+ /// Helper function containing the common code for the following two mixins
6
6
  ///
7
7
  /// @link https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
8
8
  /// - Hiding Content for Accessibility, Jonathan Snook, February 2011
@@ -11,23 +11,11 @@
11
11
  ///
12
12
  /// @param {Boolean} $important [true] - Whether to mark as `!important`
13
13
  ///
14
- /// @access public
14
+ /// @access private
15
15
 
16
- @mixin govuk-visually-hidden($important: true) {
16
+ @mixin _govuk-visually-hide-content($important: true) {
17
17
  position: absolute if($important, !important, null);
18
18
 
19
- // Absolute positioning has the unintended consequence of removing any
20
- // whitespace surrounding visually hidden text from the accessibility tree.
21
- // Insert a space character before and after visually hidden text to separate
22
- // it from any visible text surrounding it.
23
- &::before {
24
- content: "\00a0";
25
- }
26
-
27
- &::after {
28
- content: "\00a0";
29
- }
30
-
31
19
  width: 1px if($important, !important, null);
32
20
  height: 1px if($important, !important, null);
33
21
  // If margin is set to a negative value it can cause text to be announced in
@@ -36,6 +24,8 @@
36
24
  padding: 0 if($important, !important, null);
37
25
 
38
26
  overflow: hidden if($important, !important, null);
27
+
28
+ // `clip` is needed for IE11 support
39
29
  clip: rect(0 0 0 0) if($important, !important, null);
40
30
  -webkit-clip-path: inset(50%) if($important, !important, null);
41
31
  clip-path: inset(50%) if($important, !important, null);
@@ -55,62 +45,40 @@
55
45
  user-select: none;
56
46
  }
57
47
 
58
- /// Hide an element visually, but have it available for screen readers whilst
59
- /// allowing the element to be focused when navigated to via the keyboard (e.g.
60
- /// for the skip link)
61
- ///
62
- /// This is slightly less opinionated about borders and padding to make it
63
- /// easier to style the focussed element.
48
+ /// Hide an element visually, but have it available for screen readers
64
49
  ///
65
50
  /// @param {Boolean} $important [true] - Whether to mark as `!important`
66
51
  ///
67
52
  /// @access public
68
53
 
69
- @mixin govuk-visually-hidden-focusable($important: true) {
70
- position: absolute if($important, !important, null);
71
-
72
- width: 1px if($important, !important, null);
73
- height: 1px if($important, !important, null);
74
- // If margin is set to a negative value it can cause text to be announced in
75
- // the wrong order in VoiceOver for OSX
76
- margin: 0 if($important, !important, null);
77
-
78
- overflow: hidden if($important, !important, null);
79
- clip: rect(0 0 0 0) if($important, !important, null);
80
- -webkit-clip-path: inset(50%) if($important, !important, null);
81
- clip-path: inset(50%) if($important, !important, null);
82
-
83
- // For long content, line feeds are not interpreted as spaces and small width
84
- // causes content to wrap 1 word per line:
85
- // https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
86
- white-space: nowrap if($important, !important, null);
87
-
88
- // Prevent users from selecting or copying visually-hidden text. This prevents
89
- // a user unintentionally copying more text than they intended and needing to
90
- // manually trim it down again.
91
- -webkit-user-select: none;
92
- -ms-user-select: none;
93
- user-select: none;
94
-
95
- &:active,
96
- &:focus {
97
- position: static if($important, !important, null);
54
+ @mixin govuk-visually-hidden($important: true) {
55
+ @include _govuk-visually-hide-content($important: $important);
98
56
 
99
- width: auto if($important, !important, null);
100
- height: auto if($important, !important, null);
101
- margin: inherit if($important, !important, null);
57
+ // Absolute positioning has the unintended consequence of removing any
58
+ // whitespace surrounding visually hidden text from the accessibility tree.
59
+ // Insert a space character before and after visually hidden text to separate
60
+ // it from any visible text surrounding it.
61
+ &::before {
62
+ content: "\00a0";
63
+ }
102
64
 
103
- overflow: visible if($important, !important, null);
104
- clip: auto if($important, !important, null);
105
- -webkit-clip-path: none if($important, !important, null);
106
- clip-path: none if($important, !important, null);
65
+ &::after {
66
+ content: "\00a0";
67
+ }
68
+ }
107
69
 
108
- white-space: inherit if($important, !important, null);
70
+ /// Hide an element visually, but have it available for screen readers whilst
71
+ /// allowing the element to be focused when navigated to via the keyboard (e.g.
72
+ /// for the skip link)
73
+ ///
74
+ /// @param {Boolean} $important [true] - Whether to mark as `!important`
75
+ ///
76
+ /// @access public
109
77
 
110
- // Allow the text to be selectable now it's visible
111
- -webkit-user-select: text;
112
- -ms-user-select: text;
113
- user-select: text;
78
+ @mixin govuk-visually-hidden-focusable($important: true) {
79
+ // IE 11 doesn't support the combined `:not(:active, :focus)` syntax.
80
+ &:not(:active):not(:focus) {
81
+ @include _govuk-visually-hide-content($important: $important);
114
82
  }
115
83
  }
116
84
 
@@ -28,11 +28,15 @@
28
28
  @include govuk-typography-weight-bold($important: true);
29
29
  }
30
30
 
31
- // Tabular numbers
31
+ // Typography helpers
32
32
 
33
33
  .govuk-\!-font-tabular-numbers {
34
34
  @include govuk-font-tabular-numbers($important: true);
35
35
  }
36
+
37
+ .govuk-\!-text-break-word {
38
+ @include govuk-text-break-word($important: true);
39
+ }
36
40
  }
37
41
 
38
42
  /*# sourceMappingURL=_typography.scss.map */