govuk_publishing_components 58.1.1 → 59.0.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.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/select-with-search/cross-icon.svg +6 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-search-tracker.js +4 -0
  4. data/app/assets/javascripts/govuk_publishing_components/components/select-with-search.js +57 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +2 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +14 -136
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +0 -5
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +6 -48
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_select-with-search.scss +168 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_select.scss +6 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_tag.scss +14 -0
  12. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +1 -1
  13. data/app/views/govuk_publishing_components/components/_action_link.html.erb +4 -37
  14. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +0 -2
  15. data/app/views/govuk_publishing_components/components/_select.html.erb +22 -23
  16. data/app/views/govuk_publishing_components/components/_select_with_search.html.erb +14 -0
  17. data/app/views/govuk_publishing_components/components/_share_links.html.erb +17 -9
  18. data/app/views/govuk_publishing_components/components/_tag.html.erb +20 -0
  19. data/app/views/govuk_publishing_components/components/docs/action_link.yml +0 -62
  20. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +13 -0
  21. data/app/views/govuk_publishing_components/components/docs/select.yml +11 -0
  22. data/app/views/govuk_publishing_components/components/docs/select_with_search.yml +196 -0
  23. data/app/views/govuk_publishing_components/components/docs/share_links.yml +10 -0
  24. data/app/views/govuk_publishing_components/components/docs/signup_link.yml +0 -7
  25. data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +1 -7
  26. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +1 -7
  27. data/app/views/govuk_publishing_components/components/docs/tag.yml +57 -0
  28. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +16 -5
  29. data/lib/govuk_publishing_components/presenters/heading_helper.rb +1 -2
  30. data/lib/govuk_publishing_components/presenters/select_helper.rb +8 -5
  31. data/lib/govuk_publishing_components/presenters/select_with_search_helper.rb +92 -0
  32. data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +1 -1
  33. data/lib/govuk_publishing_components/version.rb +1 -1
  34. data/lib/govuk_publishing_components.rb +1 -0
  35. data/node_modules/choices.js/LICENSE +21 -0
  36. data/node_modules/choices.js/README.md +1360 -0
  37. data/node_modules/choices.js/package.json +173 -0
  38. data/node_modules/choices.js/public/assets/scripts/choices.js +5230 -0
  39. data/node_modules/choices.js/public/assets/scripts/choices.min.js +2 -0
  40. data/node_modules/choices.js/public/assets/scripts/choices.mjs +5222 -0
  41. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.js +4748 -0
  42. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.min.js +2 -0
  43. data/node_modules/choices.js/public/assets/scripts/choices.search-basic.mjs +4740 -0
  44. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.js +3631 -0
  45. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.min.js +2 -0
  46. data/node_modules/choices.js/public/assets/scripts/choices.search-kmp.mjs +3623 -0
  47. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.js +3590 -0
  48. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.min.js +2 -0
  49. data/node_modules/choices.js/public/assets/scripts/choices.search-prefix.mjs +3582 -0
  50. data/node_modules/choices.js/public/assets/styles/base.css +180 -0
  51. data/node_modules/choices.js/public/assets/styles/base.css.map +1 -0
  52. data/node_modules/choices.js/public/assets/styles/base.min.css +1 -0
  53. data/node_modules/choices.js/public/assets/styles/choices.css +338 -0
  54. data/node_modules/choices.js/public/assets/styles/choices.css.map +1 -0
  55. data/node_modules/choices.js/public/assets/styles/choices.min.css +1 -0
  56. data/node_modules/choices.js/public/types/src/index.d.ts +6 -0
  57. data/node_modules/choices.js/public/types/src/scripts/actions/choices.d.ts +30 -0
  58. data/node_modules/choices.js/public/types/src/scripts/actions/groups.d.ts +8 -0
  59. data/node_modules/choices.js/public/types/src/scripts/actions/items.d.ts +17 -0
  60. data/node_modules/choices.js/public/types/src/scripts/choices.d.ts +210 -0
  61. data/node_modules/choices.js/public/types/src/scripts/components/container.d.ts +36 -0
  62. data/node_modules/choices.js/public/types/src/scripts/components/dropdown.d.ts +21 -0
  63. data/node_modules/choices.js/public/types/src/scripts/components/index.d.ts +7 -0
  64. data/node_modules/choices.js/public/types/src/scripts/components/input.d.ts +37 -0
  65. data/node_modules/choices.js/public/types/src/scripts/components/list.d.ts +14 -0
  66. data/node_modules/choices.js/public/types/src/scripts/components/wrapped-element.d.ts +21 -0
  67. data/node_modules/choices.js/public/types/src/scripts/components/wrapped-input.d.ts +3 -0
  68. data/node_modules/choices.js/public/types/src/scripts/components/wrapped-select.d.ts +20 -0
  69. data/node_modules/choices.js/public/types/src/scripts/constants.d.ts +1 -0
  70. data/node_modules/choices.js/public/types/src/scripts/defaults.d.ts +4 -0
  71. data/node_modules/choices.js/public/types/src/scripts/interfaces/action-type.d.ts +13 -0
  72. data/node_modules/choices.js/public/types/src/scripts/interfaces/build-flags.d.ts +11 -0
  73. data/node_modules/choices.js/public/types/src/scripts/interfaces/choice-full.d.ts +23 -0
  74. data/node_modules/choices.js/public/types/src/scripts/interfaces/class-names.d.ts +61 -0
  75. data/node_modules/choices.js/public/types/src/scripts/interfaces/event-choice.d.ts +7 -0
  76. data/node_modules/choices.js/public/types/src/scripts/interfaces/event-type.d.ts +14 -0
  77. data/node_modules/choices.js/public/types/src/scripts/interfaces/group-full.d.ts +10 -0
  78. data/node_modules/choices.js/public/types/src/scripts/interfaces/index.d.ts +14 -0
  79. data/node_modules/choices.js/public/types/src/scripts/interfaces/input-choice.d.ts +15 -0
  80. data/node_modules/choices.js/public/types/src/scripts/interfaces/input-group.d.ts +10 -0
  81. data/node_modules/choices.js/public/types/src/scripts/interfaces/item.d.ts +17 -0
  82. data/node_modules/choices.js/public/types/src/scripts/interfaces/keycode-map.d.ts +13 -0
  83. data/node_modules/choices.js/public/types/src/scripts/interfaces/options.d.ts +566 -0
  84. data/node_modules/choices.js/public/types/src/scripts/interfaces/passed-element-type.d.ts +7 -0
  85. data/node_modules/choices.js/public/types/src/scripts/interfaces/passed-element.d.ts +95 -0
  86. data/node_modules/choices.js/public/types/src/scripts/interfaces/position-options-type.d.ts +1 -0
  87. data/node_modules/choices.js/public/types/src/scripts/interfaces/search.d.ts +11 -0
  88. data/node_modules/choices.js/public/types/src/scripts/interfaces/state.d.ts +10 -0
  89. data/node_modules/choices.js/public/types/src/scripts/interfaces/store.d.ts +64 -0
  90. data/node_modules/choices.js/public/types/src/scripts/interfaces/string-pre-escaped.d.ts +3 -0
  91. data/node_modules/choices.js/public/types/src/scripts/interfaces/string-untrusted.d.ts +4 -0
  92. data/node_modules/choices.js/public/types/src/scripts/interfaces/templates.d.ts +29 -0
  93. data/node_modules/choices.js/public/types/src/scripts/interfaces/types.d.ts +18 -0
  94. data/node_modules/choices.js/public/types/src/scripts/lib/choice-input.d.ts +9 -0
  95. data/node_modules/choices.js/public/types/src/scripts/lib/html-guard-statements.d.ts +4 -0
  96. data/node_modules/choices.js/public/types/src/scripts/lib/utils.d.ts +31 -0
  97. data/node_modules/choices.js/public/types/src/scripts/reducers/choices.d.ts +8 -0
  98. data/node_modules/choices.js/public/types/src/scripts/reducers/groups.d.ts +8 -0
  99. data/node_modules/choices.js/public/types/src/scripts/reducers/items.d.ts +9 -0
  100. data/node_modules/choices.js/public/types/src/scripts/search/fuse.d.ts +14 -0
  101. data/node_modules/choices.js/public/types/src/scripts/search/index.d.ts +3 -0
  102. data/node_modules/choices.js/public/types/src/scripts/search/kmp.d.ts +11 -0
  103. data/node_modules/choices.js/public/types/src/scripts/search/prefix-filter.d.ts +11 -0
  104. data/node_modules/choices.js/public/types/src/scripts/store/store.d.ts +59 -0
  105. data/node_modules/choices.js/public/types/src/scripts/templates.d.ts +8 -0
  106. data/node_modules/choices.js/src/entry.js +3 -0
  107. data/node_modules/choices.js/src/icons/cross-inverse.svg +1 -0
  108. data/node_modules/choices.js/src/icons/cross.svg +1 -0
  109. data/node_modules/choices.js/src/index.ts +8 -0
  110. data/node_modules/choices.js/src/scripts/actions/choices.ts +59 -0
  111. data/node_modules/choices.js/src/scripts/actions/groups.ts +14 -0
  112. data/node_modules/choices.js/src/scripts/actions/items.ts +34 -0
  113. data/node_modules/choices.js/src/scripts/choices.ts +2364 -0
  114. data/node_modules/choices.js/src/scripts/components/container.ts +157 -0
  115. data/node_modules/choices.js/src/scripts/components/dropdown.ts +50 -0
  116. data/node_modules/choices.js/src/scripts/components/index.ts +8 -0
  117. data/node_modules/choices.js/src/scripts/components/input.ts +146 -0
  118. data/node_modules/choices.js/src/scripts/components/list.ts +89 -0
  119. data/node_modules/choices.js/src/scripts/components/wrapped-element.ts +89 -0
  120. data/node_modules/choices.js/src/scripts/components/wrapped-input.ts +3 -0
  121. data/node_modules/choices.js/src/scripts/components/wrapped-select.ts +115 -0
  122. data/node_modules/choices.js/src/scripts/constants.ts +1 -0
  123. data/node_modules/choices.js/src/scripts/defaults.ts +93 -0
  124. data/node_modules/choices.js/src/scripts/interfaces/action-type.ts +15 -0
  125. data/node_modules/choices.js/src/scripts/interfaces/build-flags.ts +17 -0
  126. data/node_modules/choices.js/src/scripts/interfaces/choice-full.ts +30 -0
  127. data/node_modules/choices.js/src/scripts/interfaces/class-names.ts +61 -0
  128. data/node_modules/choices.js/src/scripts/interfaces/event-choice.ts +9 -0
  129. data/node_modules/choices.js/src/scripts/interfaces/event-type.ts +16 -0
  130. data/node_modules/choices.js/src/scripts/interfaces/group-full.ts +12 -0
  131. data/node_modules/choices.js/src/scripts/interfaces/index.ts +14 -0
  132. data/node_modules/choices.js/src/scripts/interfaces/input-choice.ts +17 -0
  133. data/node_modules/choices.js/src/scripts/interfaces/input-group.ts +11 -0
  134. data/node_modules/choices.js/src/scripts/interfaces/item.ts +17 -0
  135. data/node_modules/choices.js/src/scripts/interfaces/keycode-map.ts +13 -0
  136. data/node_modules/choices.js/src/scripts/interfaces/options.ts +619 -0
  137. data/node_modules/choices.js/src/scripts/interfaces/passed-element-type.ts +9 -0
  138. data/node_modules/choices.js/src/scripts/interfaces/passed-element.ts +96 -0
  139. data/node_modules/choices.js/src/scripts/interfaces/position-options-type.ts +1 -0
  140. data/node_modules/choices.js/src/scripts/interfaces/search.ts +12 -0
  141. data/node_modules/choices.js/src/scripts/interfaces/state.ts +12 -0
  142. data/node_modules/choices.js/src/scripts/interfaces/store.ts +84 -0
  143. data/node_modules/choices.js/src/scripts/interfaces/string-pre-escaped.ts +3 -0
  144. data/node_modules/choices.js/src/scripts/interfaces/string-untrusted.ts +5 -0
  145. data/node_modules/choices.js/src/scripts/interfaces/templates.ts +66 -0
  146. data/node_modules/choices.js/src/scripts/interfaces/types.ts +21 -0
  147. data/node_modules/choices.js/src/scripts/lib/choice-input.ts +88 -0
  148. data/node_modules/choices.js/src/scripts/lib/html-guard-statements.ts +7 -0
  149. data/node_modules/choices.js/src/scripts/lib/utils.ts +230 -0
  150. data/node_modules/choices.js/src/scripts/reducers/choices.ts +86 -0
  151. data/node_modules/choices.js/src/scripts/reducers/groups.ts +32 -0
  152. data/node_modules/choices.js/src/scripts/reducers/items.ts +86 -0
  153. data/node_modules/choices.js/src/scripts/search/fuse.ts +59 -0
  154. data/node_modules/choices.js/src/scripts/search/index.ts +17 -0
  155. data/node_modules/choices.js/src/scripts/search/kmp.ts +87 -0
  156. data/node_modules/choices.js/src/scripts/search/prefix-filter.ts +42 -0
  157. data/node_modules/choices.js/src/scripts/store/store.ts +184 -0
  158. data/node_modules/choices.js/src/scripts/templates.ts +409 -0
  159. data/node_modules/choices.js/src/styles/base.scss +189 -0
  160. data/node_modules/choices.js/src/styles/choices.scss +414 -0
  161. data/node_modules/choices.js/src/tsconfig.json +22 -0
  162. metadata +137 -4
  163. data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg +0 -5
  164. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.svg +0 -4
  165. data/app/assets/images/govuk_publishing_components/action-link-arrow.svg +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2fbc187d41fb43b4005ecda265842cd3c9dde603272971d6429d674a4fe99d3
4
- data.tar.gz: 17a7f6abba141f6fbb5e12520c8195fedebae2ae55efbe721857431aadefa76c
3
+ metadata.gz: 0a7deb8c0427383f676b2db0de3d2ec37c210ce6715e88288a4560379c1b26b0
4
+ data.tar.gz: 3a5f6ab35ca230632d632f724644aaabdea9b32f2c5018c650574d4a7b92e0fb
5
5
  SHA512:
6
- metadata.gz: d296de9af1c9e495442d31f08bdf5107e657abb510d09e1362d526d741e4f47521cceb2707195d5bca801cfc56ba17d5f8c612da99cb1b0519dd4da457ee5f6e
7
- data.tar.gz: 53ed8e3164202b9d51541016ec88d460559856d78814a01ddea790b5f93858ec485ef02561ad6f08349527121e21e942a60790fd6e72bff42ac73755a8150e50
6
+ metadata.gz: 309714e09e0634fa9204c6f73a20fbe6182b636282d2abb83f74d031a602448f9702b99f17d5cf3a34fd5ccd716c3cc034c273e8e1650def579b0d0d89aae1d2
7
+ data.tar.gz: 036cf76ecc9826028954ac1baaf9b200766da065ea1905c2a87018e03b1d5a530b502f5b161c767ba9c6e4c3fddc22f4a91eeeb1a271986836b6f3e91e10168b
@@ -0,0 +1,6 @@
1
+ <svg width='21' height='21' viewBox='0 0 21 21' xmlns='http://www.w3.org/2000/svg'>
2
+ <g fill='#000' fill-rule='evenodd'>
3
+ <path d='M2.592.044l18.364 18.364-2.548 2.548L.044 2.592z' />
4
+ <path d='M0 18.364L18.364 0l2.548 2.548L2.548 20.912z' />
5
+ </g>
6
+ </svg>
@@ -9,6 +9,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
9
9
  this.$module = $module
10
10
  this.$searchInput = this.$module.querySelector('input[type="search"]')
11
11
 
12
+ this.searchInputName = this.$module.dataset.ga4SearchInputName
12
13
  this.type = this.$module.dataset.ga4SearchType
13
14
  this.url = this.$module.dataset.ga4SearchUrl
14
15
  this.section = this.$module.dataset.ga4SearchSection
@@ -44,6 +45,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
44
45
 
45
46
  setTriggeredAction (event) {
46
47
  if (event.target.type === 'search') {
48
+ // if `searchInputName` set then only set `triggeredAction` to `search`
49
+ // if changed `input[type=search]` matches `input[name=searchInputName]`
50
+ if (this.searchInputName && event.target.name !== this.searchInputName) return
47
51
  this.triggeredAction = 'search'
48
52
  } else if (this.triggeredAction !== 'search') {
49
53
  // The 'search' action always takes precedence over the 'filter' action, so only set the
@@ -0,0 +1,57 @@
1
+ //= require choices.js/public/assets/scripts/choices.min.js
2
+ 'use strict'
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ ;(function (Modules) {
6
+ function SelectWithSearch (module) {
7
+ this.module = module
8
+ }
9
+
10
+ SelectWithSearch.prototype.init = function () {
11
+ if (!this.module.matches('select')) {
12
+ console.error('Module is not a select element')
13
+ return
14
+ }
15
+
16
+ const placeholderOption = this.module.querySelector(
17
+ 'option[value=""]:first-child'
18
+ )
19
+
20
+ if (placeholderOption && placeholderOption.textContent === '') {
21
+ placeholderOption.textContent = this.module.multiple
22
+ ? 'Select all that apply'
23
+ : 'Select one'
24
+ }
25
+
26
+ const ariaDescribedBy = this.module.getAttribute('aria-describedby') || ''
27
+
28
+ this.choices = new window.Choices(this.module, {
29
+ allowHTML: true,
30
+ searchPlaceholderValue: 'Search in list',
31
+ shouldSort: false, // show options and groups in the order they were given
32
+ itemSelectText: '',
33
+ searchResultLimit: 100,
34
+ removeItemButton: this.module.multiple,
35
+ labelId: this.module.id + '-label ' + ariaDescribedBy,
36
+ callbackOnInit: function () {
37
+ // For the multiple select, move the input field to
38
+ // the top of the feedback area, so that the selected
39
+ // 'lozenges' appear afterwards in a more natural flow
40
+ if (this.dropdown.type === 'select-multiple') {
41
+ const inner = this.containerInner.element
42
+ const input = this.input.element
43
+ inner.prepend(input)
44
+ }
45
+ },
46
+ // https://fusejs.io/api/options.html
47
+ fuseOptions: {
48
+ ignoreLocation: true, // matches any part of the string
49
+ threshold: 0 // only matches when characters are sequential
50
+ }
51
+ })
52
+
53
+ this.module.choices = this.choices
54
+ }
55
+
56
+ Modules.SelectWithSearch = SelectWithSearch
57
+ })(window.GOVUK.Modules)
@@ -75,6 +75,7 @@
75
75
  @import "components/search";
76
76
  @import "components/secondary-navigation";
77
77
  @import "components/select";
78
+ @import "components/select-with-search";
78
79
  @import "components/service-navigation";
79
80
  @import "components/share-links";
80
81
  @import "components/signup-link";
@@ -90,6 +91,7 @@
90
91
  @import "components/summary-list";
91
92
  @import "components/tabs";
92
93
  @import "components/table";
94
+ @import "components/tag";
93
95
  @import "components/textarea";
94
96
  @import "components/translation-nav";
95
97
  @import "components/warning-text";
@@ -3,27 +3,28 @@
3
3
  .gem-c-action-link {
4
4
  display: table;
5
5
 
6
+ @include govuk-media-query($until: tablet) {
7
+ max-width: 410px;
8
+ }
9
+
6
10
  &::before {
7
11
  content: "";
8
12
  display: table-cell;
9
- width: 60px;
10
- height: 45px;
11
- background: url("govuk_publishing_components/action-link-arrow.svg");
13
+ width: 36px;
14
+ height: 28px;
15
+ background: url("govuk_publishing_components/action-link-arrow--light.svg");
12
16
  background-repeat: no-repeat;
13
- background-position: 0 50%;
14
- background-size: 45px auto;
15
- }
17
+ background-size: 28px auto;
18
+ background-position: 0 0;
16
19
 
17
- @include govuk-media-query($until: tablet) {
18
- max-width: 410px;
20
+ @include govuk-media-query($from: tablet) {
21
+ width: 45px;
22
+ height: 35px;
23
+ background-size: 35px auto;
24
+ }
19
25
  }
20
26
  }
21
27
 
22
- .gem-c-action-link__contents-wrapper {
23
- display: table-cell;
24
- vertical-align: middle;
25
- }
26
-
27
28
  .gem-c-action-link__link-wrapper {
28
29
  display: table-cell;
29
30
  vertical-align: middle;
@@ -39,59 +40,6 @@
39
40
  }
40
41
  }
41
42
 
42
- .gem-c-action-link__nowrap-text {
43
- white-space: nowrap;
44
- }
45
-
46
- .gem-c-action-link--with-subtext {
47
- max-width: none;
48
-
49
- .gem-c-action-link__link-wrapper,
50
- .gem-c-action-link__subtext-wrapper {
51
- display: block;
52
-
53
- @include govuk-media-query($from: tablet) {
54
- display: table-cell;
55
- vertical-align: middle;
56
- }
57
- }
58
- }
59
-
60
- .gem-c-action-link--mobile-subtext {
61
- .gem-c-action-link__subtext-wrapper {
62
- display: block;
63
- }
64
-
65
- .gem-c-action-link__subtext {
66
- padding: 0;
67
-
68
- &::before {
69
- display: none;
70
- }
71
- }
72
- }
73
-
74
- .gem-c-action-link__subtext {
75
- display: block;
76
- color: inherit;
77
- @include govuk-font(19);
78
-
79
- @include govuk-media-query($from: tablet) {
80
- position: relative;
81
- padding-left: govuk-spacing(4);
82
-
83
- &::before {
84
- content: "";
85
- position: absolute;
86
- top: 10%;
87
- left: govuk-spacing(2);
88
- width: govuk-spacing(2);
89
- height: 80%;
90
- border-left: solid 1px $govuk-text-colour;
91
- }
92
- }
93
- }
94
-
95
43
  .gem-c-action-link--simple {
96
44
  &::before {
97
45
  width: 30px;
@@ -103,76 +51,6 @@
103
51
  }
104
52
  }
105
53
 
106
- .gem-c-action-link--simple-light {
107
- &::before {
108
- width: 30px;
109
- height: 30px;
110
- background: url("govuk_publishing_components/action-link-arrow--simple-light.svg");
111
- background-repeat: no-repeat;
112
- background-size: 25px auto;
113
- background-position: 0 2px;
114
- }
115
- }
116
-
117
- .gem-c-action-link--dark-large-icon {
118
- &::before {
119
- background: url("govuk_publishing_components/action-link-arrow--dark.svg");
120
- height: 34px;
121
- width: 40px;
122
- background-repeat: no-repeat;
123
- background-size: 32px auto;
124
- background-position: 0 2px;
125
- }
126
-
127
- @include govuk-media-query($until: tablet) {
128
- margin-bottom: govuk-spacing(2);
129
- }
130
- }
131
-
132
- .gem-c-action-link--light-icon {
133
- &::before {
134
- width: 36px;
135
- height: 28px;
136
- background: url("govuk_publishing_components/action-link-arrow--light.svg");
137
- background-repeat: no-repeat;
138
- background-size: 28px auto;
139
- background-position: 0 0;
140
-
141
- @include govuk-media-query($from: tablet) {
142
- width: 45px;
143
- height: 35px;
144
- background-size: 35px auto;
145
- }
146
- }
147
- }
148
-
149
- .gem-c-action-link--dark-icon {
150
- max-width: none;
151
-
152
- @include govuk-media-query($until: tablet) {
153
- margin-bottom: govuk-spacing(2);
154
- }
155
-
156
- &::before {
157
- height: 30px;
158
- width: 35px;
159
- background: url("govuk_publishing_components/action-link-arrow--dark.svg");
160
- background-repeat: no-repeat;
161
- background-size: 25px auto;
162
- background-position: 0 2px;
163
- }
164
- }
165
-
166
- .gem-c-action-link--inverse {
167
- color: govuk-colour("white");
168
-
169
- .gem-c-action-link__subtext {
170
- &::before {
171
- border-color: govuk-colour("white");
172
- }
173
- }
174
- }
175
-
176
54
  @include govuk-media-query($media-type: print) {
177
55
  .gem-c-action-link {
178
56
  * {
@@ -5,11 +5,6 @@
5
5
  margin: 0;
6
6
  }
7
7
 
8
- .gem-c-heading--font-size-27 {
9
- @include govuk-text-colour;
10
- @include govuk-font(27, $weight: bold);
11
- }
12
-
13
8
  .gem-c-heading--padding {
14
9
  padding: govuk-spacing(3) 0;
15
10
  }
@@ -2,24 +2,6 @@
2
2
  @import "govuk_publishing_components/components/search";
3
3
  @import "govuk_publishing_components/components/skip-link";
4
4
  @import "govuk/components/header/header";
5
- @import "govuk/components/tag/tag";
6
-
7
- .gem-c-layout-header--production .govuk-header__container {
8
- border-bottom-color: govuk-colour("red");
9
- }
10
-
11
- .gem-c-layout-header--integration .govuk-header__container,
12
- .gem-c-layout-header--staging .govuk-header__container {
13
- border-bottom-color: govuk-colour("yellow");
14
- }
15
-
16
- .gem-c-layout-header--example .govuk-header__container {
17
- border-bottom-color: govuk-colour("bright-purple");
18
- }
19
-
20
- .gem-c-layout-header--development .govuk-header__container {
21
- border-bottom-color: govuk-colour("dark-grey");
22
- }
23
5
 
24
6
  .gem-c-layout-header--no-bottom-border,
25
7
  .gem-c-layout-header--no-bottom-border .govuk-header__container {
@@ -76,6 +58,11 @@
76
58
  }
77
59
  }
78
60
 
61
+ .gem-c-header__environment {
62
+ padding-top: 2px;
63
+ padding-bottom: 3px;
64
+ }
65
+
79
66
  .gem-c-header__logo {
80
67
  @include govuk-media-query($from: desktop) {
81
68
  white-space: nowrap;
@@ -98,34 +85,6 @@
98
85
  }
99
86
  }
100
87
 
101
- .gem-c-environment-tag {
102
- padding: 2px 5px 0;
103
- margin-left: 3px;
104
- margin-top: govuk-spacing(-2);
105
- vertical-align: middle;
106
- @include govuk-font($size: 16, $weight: "bold");
107
- }
108
-
109
- .gem-c-environment-tag--production {
110
- background-color: govuk-colour("red");
111
- color: govuk-colour("white");
112
- }
113
-
114
- .gem-c-environment-tag--example {
115
- background-color: govuk-colour("bright-purple");
116
- }
117
-
118
- .gem-c-environment-tag--development {
119
- background-color: govuk-colour("dark-grey");
120
- color: govuk-colour("white");
121
- }
122
-
123
- .gem-c-environment-tag--staging,
124
- .gem-c-environment-tag--integration {
125
- background-color: govuk-colour("yellow");
126
- color: govuk-colour("black");
127
- }
128
-
129
88
  .govuk-header__navigation-item--collapsed-menu-only {
130
89
  @include govuk-media-query($from: desktop) {
131
90
  display: none;
@@ -155,8 +114,7 @@
155
114
  padding: 0 2mm 2mm 0;
156
115
  }
157
116
 
158
- .gem-c-header__product-name,
159
- .gem-c-environment-tag {
117
+ .gem-c-header__product-name {
160
118
  color: $govuk-print-text-colour;
161
119
  background: none;
162
120
  }
@@ -0,0 +1,168 @@
1
+ // overload the choices.js variables
2
+
3
+ $font-size: 19px;
4
+
5
+ $choices-bg-color: govuk-colour("white") !default;
6
+ $choices-font-size-lg: $font-size !default;
7
+ $choices-font-size-md: $font-size !default;
8
+ $choices-font-size-sm: $font-size !default;
9
+ $choices-primary-color: #ffffff !default; // can't use mixin here because of Choices.js Sass functions
10
+ $choices-text-color: govuk-colour("black");
11
+ $choices-icon-cross: url("select-with-search/cross-icon.svg");
12
+ $choices-border-radius: 0 !default;
13
+ $choices-border-radius-item: 0 !default;
14
+ $choices-z-index: 2 !default;
15
+ $choices-button-dimension: 12px !default;
16
+
17
+ @import "govuk_publishing_components/individual_component_support";
18
+ @import "mixins/prefixed-transform";
19
+ @import "govuk/components/label/label";
20
+ @import "choices.js/src/styles/choices";
21
+
22
+ .gem-c-select-with-search {
23
+ .choices * {
24
+ // Something inside .choices needs this – I'm not sure what yet
25
+ box-sizing: border-box;
26
+ font-family: $govuk-font-family;
27
+ }
28
+
29
+ .choices[data-type*="select-one"]::after {
30
+ @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);
31
+ @include prefixed-transform($translateY: -50%);
32
+ margin: 0;
33
+ }
34
+
35
+ .choices.is-open[data-type*="select-one"]::after {
36
+ margin: 0;
37
+ bottom: govuk-em(1px, $font-size);
38
+ @include prefixed-transform($translateY: -50%, $rotate: 180deg);
39
+ }
40
+
41
+ .choices[data-type*="select-multiple"] .choices__button,
42
+ .choices[data-type*="text"] .choices__button {
43
+ border-color: govuk-colour("mid-grey");
44
+ border-right: 1px solid govuk-colour("mid-grey");
45
+ padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) govuk-spacing(2);
46
+ margin-right: 0;
47
+
48
+ &:hover {
49
+ background-color: govuk-colour("mid-grey");
50
+ border-color: govuk-colour("dark-grey");
51
+ box-shadow: 0 $govuk-border-width-form-element 0 govuk-colour("dark-grey");
52
+ }
53
+
54
+ &:focus {
55
+ background-color: $govuk-focus-colour;
56
+ box-shadow: 0 $govuk-border-width-form-element 0 $govuk-focus-text-colour;
57
+ }
58
+ }
59
+
60
+ .choices.is-disabled {
61
+ .choices__item[data-deletable] {
62
+ background-color: govuk-colour("white");
63
+ }
64
+
65
+ .choices__button {
66
+ display: none;
67
+ }
68
+ }
69
+
70
+ .choices__input {
71
+ display: block;
72
+ margin-bottom: 0;
73
+ }
74
+
75
+ .choices__inner {
76
+ padding: govuk-spacing(1);
77
+ border: $govuk-border-width-form-element solid govuk-colour("black");
78
+ }
79
+
80
+ &.govuk-form-group--error .choices:not(.is-active):not(.is-focused):not(.is-open) .choices__inner {
81
+ border-color: $govuk-error-colour;
82
+ }
83
+
84
+ .choices.is-focused,
85
+ .choices.is-open {
86
+ overflow: visible;
87
+ }
88
+
89
+ .choices.is-flipped .choices__list {
90
+ border-radius: 0; // this isn't set by a variable unlike all other border radius :(
91
+ border-width: $govuk-border-width-form-element;
92
+ }
93
+
94
+ .choices.is-focused .choices__inner,
95
+ .choices.is-open .choices__inner {
96
+ outline: $govuk-focus-width solid $govuk-focus-colour;
97
+ // Ensure outline appears outside of the element
98
+ outline-offset: 0;
99
+ // Double the border by adding its width again. Use `box-shadow` to do
100
+ // this instead of changing `border-width` (which changes element size)
101
+ // and since `outline` is already used for the yellow focus state.
102
+ box-shadow: inset 0 0 0 $govuk-border-width-form-element;
103
+ }
104
+
105
+ .choices__list--multiple {
106
+ display: block;
107
+
108
+ &:not(:empty) {
109
+ margin-block-start: 6px;
110
+ border-block-start: 1px solid $govuk-border-colour;
111
+ padding-block-end: 5px;
112
+ }
113
+ }
114
+
115
+ .choices__list--multiple .choices__item {
116
+ display: inline-flex;
117
+ align-items: center;
118
+ border: 0;
119
+ padding: 0 0 0 govuk-spacing(2);
120
+ margin: govuk-spacing(2) govuk-spacing(2) 0 0;
121
+ background-color: govuk-colour("light-grey");
122
+ box-shadow: 0 $govuk-border-width-form-element 0 govuk-colour("mid-grey");
123
+ line-height: 1;
124
+ color: $govuk-text-colour;
125
+
126
+ .is-disabled & {
127
+ opacity: 0.5;
128
+ }
129
+ }
130
+
131
+ // Dropdown
132
+ .choices__list--dropdown,
133
+ .choices__list[aria-expanded] {
134
+ border: $govuk-border-width-form-element solid govuk-colour("black");
135
+ border-top-width: 0;
136
+
137
+ .is-flipped & {
138
+ border-top-width: $govuk-border-width-form-element;
139
+ border-bottom-width: 0;
140
+ }
141
+ }
142
+
143
+ .choices__list--dropdown .choices__item,
144
+ .choices__list[aria-expanded] .choices__item {
145
+ position: relative;
146
+ border-bottom: 1px solid govuk-colour("mid-grey");
147
+
148
+ &:last-child {
149
+ border-bottom: 0;
150
+ }
151
+ }
152
+
153
+ .choices__list--dropdown .choices__item--selectable.is-highlighted,
154
+ .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
155
+ background-color: govuk-colour("blue");
156
+ border-color: govuk-colour("blue");
157
+ color: govuk-colour("white");
158
+ outline: none;
159
+ }
160
+
161
+ .choices__heading {
162
+ @include govuk-typography-weight-bold;
163
+ color: govuk-colour("black"); // Choices.js doesn't use a variable for this color for some reason :(
164
+ padding: govuk-spacing(6) govuk-spacing(2) govuk-spacing(2);
165
+ border-bottom: 1px solid govuk-colour("mid-grey");
166
+ cursor: default;
167
+ }
168
+ }
@@ -1,6 +1,12 @@
1
1
  @import "govuk_publishing_components/individual_component_support";
2
2
  @import "govuk/components/select/select";
3
3
 
4
+ // Increase height of selects that have a `multiple`
5
+ // attribute otherwise they are too small to be useful.
6
+ .govuk-select[multiple] {
7
+ height: auto;
8
+ }
9
+
4
10
  .gem-c-select__select--full-width {
5
11
  min-width: 100%;
6
12
  max-width: 100%;
@@ -0,0 +1,14 @@
1
+ @import "govuk_publishing_components/individual_component_support";
2
+ @import "govuk/components/tag/tag";
3
+
4
+ .gem-c-tag {
5
+ max-width: none;
6
+ }
7
+
8
+ @include govuk-media-query($media-type: print) {
9
+ .gem-c-tag.govuk-tag {
10
+ color: $govuk-print-text-colour;
11
+ background: none;
12
+ border: 2px solid govuk-colour("black");
13
+ }
14
+ }
@@ -30,7 +30,7 @@
30
30
 
31
31
  h2 {
32
32
  margin: 0 0 govuk-spacing(4) 0;
33
- @include govuk-font($size: 27, $weight: bold);
33
+ @include govuk-font($size: 24, $weight: bold);
34
34
  }
35
35
 
36
36
  h3 {
@@ -3,33 +3,18 @@
3
3
 
4
4
  local_assigns[:margin_bottom] ||= 0
5
5
  text ||= false
6
- nowrap_text ||= false
7
6
  href ||= false
8
- subtext ||= false
9
- subtext_href ||= false
10
- mobile_subtext ||= false
11
7
  inverse ||= false
12
8
  simple ||= false
13
9
  simple_light ||= false
14
- dark_icon ||= false
15
- dark_large_icon ||= false
16
- light_icon ||= false
17
-
18
- css_classes = %w(gem-c-action-link)
19
- css_classes << "gem-c-action-link--inverse" if inverse
20
- css_classes << "gem-c-action-link--dark-icon" if dark_icon
21
- css_classes << "gem-c-action-link--dark-large-icon" if dark_large_icon
22
- css_classes << "gem-c-action-link--light-icon" if light_icon
23
- css_classes << "gem-c-action-link--simple" if simple
24
- css_classes << "gem-c-action-link--simple-light" if simple_light
25
- css_classes << "gem-c-action-link--with-subtext" if subtext
26
- css_classes << "gem-c-action-link--mobile-subtext" if mobile_subtext
27
10
 
28
11
  link_classes = %w(govuk-link gem-c-action-link__link gem-c-force-print-link-styles)
29
12
  link_classes << "govuk-link--inverse" if inverse
30
13
 
31
14
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
32
- component_helper.add_class(css_classes.join(" "))
15
+ component_helper.add_class("gem-c-action-link")
16
+ component_helper.add_class("gem-c-action-link--inverse") if inverse
17
+ component_helper.add_class("gem-c-action-link--simple") if simple
33
18
  %>
34
19
  <% if text.present? %>
35
20
  <%= tag.div(**component_helper.all_attributes) do %>
@@ -37,7 +22,6 @@
37
22
  <span class="gem-c-action-link__link-wrapper">
38
23
  <% main_text = capture do %>
39
24
  <%= text %>
40
- <%= content_tag(:span, nowrap_text, class: "gem-c-action-link__nowrap-text") if nowrap_text %>
41
25
  <% end %>
42
26
 
43
27
  <% if href.present? %>
@@ -48,24 +32,7 @@
48
32
  <%= main_text %>
49
33
  <% end %>
50
34
  </span>
51
-
52
- <% if subtext %>
53
- <span class="gem-c-action-link__subtext-wrapper">
54
- <% if subtext_href %>
55
- <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") do %>
56
- <%= link_to subtext, subtext_href, class: link_classes %>
57
- <% end %>
58
- <% else %>
59
- <%= content_tag(:span, subtext, class: "gem-c-action-link__subtext") %>
60
- <% end %>
61
- </span>
62
- <% end %>
63
- <% end %>
64
-
65
- <% if subtext %>
66
- <%= content_tag(:span, contents, class: "gem-c-action-link__contents-wrapper") %>
67
- <% else %>
68
- <%= contents %>
69
35
  <% end %>
36
+ <%= contents %>
70
37
  <% end %>
71
38
  <% end %>
@@ -12,10 +12,8 @@
12
12
 
13
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
14
  component_helper.add_class("gem-c-layout-header govuk-header")
15
- component_helper.add_class("gem-c-layout-header--#{environment}") if environment
16
15
  component_helper.add_class("gem-c-layout-header--no-bottom-border") if remove_bottom_border
17
16
  component_helper.add_data_attribute({ module: "govuk-header" })
18
-
19
17
  %>
20
18
 
21
19
  <%= tag.header(**component_helper.all_attributes) do %>