govuk_publishing_components 21.54.0 → 21.55.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/govuk_publishing_components/action-link--nhs.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link--nhs.svg +1 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow--simple.png +0 -0
- data/app/assets/images/govuk_publishing_components/action-link-arrow.png +0 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +5 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +38 -7
- data/app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss +0 -38
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +1 -4
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +47 -25
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +23 -3
- data/app/views/govuk_publishing_components/components/docs/action_link.yml +43 -15
- data/lib/govuk_publishing_components/presenters/breadcrumb_selector.rb +7 -7
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
- data/lib/govuk_publishing_components/presenters/machine_readable/faq_page_schema.rb +7 -6
- data/lib/govuk_publishing_components/presenters/machine_readable/html_publication_schema.rb +77 -0
- data/lib/govuk_publishing_components/presenters/schema_org.rb +24 -16
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/README.md +6 -6
- data/node_modules/govuk-frontend/govuk/_base.scss +3 -0
- data/node_modules/govuk-frontend/govuk/all.js +1 -1
- data/node_modules/govuk-frontend/govuk/all.scss +1 -3
- data/node_modules/govuk-frontend/govuk/components/_all.scss +31 -29
- data/node_modules/govuk-frontend/govuk/components/accordion/_accordion.scss +2 -208
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +207 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/_back-link.scss +2 -65
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +112 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_breadcrumbs.scss +2 -118
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +138 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +6 -0
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/template.njk +12 -1
- data/node_modules/govuk-frontend/govuk/components/button/_button.scss +2 -284
- data/node_modules/govuk-frontend/govuk/components/button/_index.scss +280 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/_character-count.scss +2 -31
- data/node_modules/govuk-frontend/govuk/components/character-count/_index.scss +28 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_checkboxes.scss +2 -308
- data/node_modules/govuk-frontend/govuk/components/checkboxes/_index.scss +304 -0
- data/node_modules/govuk-frontend/govuk/components/date-input/_date-input.scss +2 -30
- data/node_modules/govuk-frontend/govuk/components/date-input/_index.scss +26 -0
- data/node_modules/govuk-frontend/govuk/components/details/_details.scss +2 -88
- data/node_modules/govuk-frontend/govuk/components/details/_index.scss +84 -0
- data/node_modules/govuk-frontend/govuk/components/error-message/_error-message.scss +2 -15
- data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +11 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/_error-summary.scss +2 -59
- data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +55 -0
- data/node_modules/govuk-frontend/govuk/components/fieldset/_fieldset.scss +2 -68
- data/node_modules/govuk-frontend/govuk/components/fieldset/_index.scss +64 -0
- data/node_modules/govuk-frontend/govuk/components/file-upload/_file-upload.scss +2 -81
- data/node_modules/govuk-frontend/govuk/components/file-upload/_index.scss +77 -0
- data/node_modules/govuk-frontend/govuk/components/footer/_footer.scss +2 -244
- data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +238 -0
- data/node_modules/govuk-frontend/govuk/components/header/_header.scss +2 -318
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +312 -0
- data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +7 -1
- data/node_modules/govuk-frontend/govuk/components/header/template.njk +2 -2
- data/node_modules/govuk-frontend/govuk/components/hint/_hint.scss +2 -50
- data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +46 -0
- data/node_modules/govuk-frontend/govuk/components/input/_index.scss +99 -0
- data/node_modules/govuk-frontend/govuk/components/input/_input.scss +2 -103
- data/node_modules/govuk-frontend/govuk/components/inset-text/_index.scss +24 -0
- data/node_modules/govuk-frontend/govuk/components/inset-text/_inset-text.scss +2 -28
- data/node_modules/govuk-frontend/govuk/components/label/_index.scss +41 -0
- data/node_modules/govuk-frontend/govuk/components/label/_label.scss +2 -45
- data/node_modules/govuk-frontend/govuk/components/panel/_index.scss +40 -0
- data/node_modules/govuk-frontend/govuk/components/panel/_panel.scss +2 -44
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_index.scss +27 -0
- data/node_modules/govuk-frontend/govuk/components/phase-banner/_phase-banner.scss +2 -31
- data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +342 -0
- data/node_modules/govuk-frontend/govuk/components/radios/_radios.scss +2 -346
- data/node_modules/govuk-frontend/govuk/components/select/_index.scss +53 -0
- data/node_modules/govuk-frontend/govuk/components/select/_select.scss +2 -57
- data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +33 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/_skip-link.scss +2 -37
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +153 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_summary-list.scss +2 -157
- data/node_modules/govuk-frontend/govuk/components/table/_index.scss +50 -0
- data/node_modules/govuk-frontend/govuk/components/table/_table.scss +2 -54
- data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +138 -0
- data/node_modules/govuk-frontend/govuk/components/tabs/_tabs.scss +2 -142
- data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +87 -0
- data/node_modules/govuk-frontend/govuk/components/tag/_tag.scss +2 -91
- data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +51 -0
- data/node_modules/govuk-frontend/govuk/components/textarea/_textarea.scss +2 -55
- data/node_modules/govuk-frontend/govuk/components/warning-text/_index.scss +56 -0
- data/node_modules/govuk-frontend/govuk/components/warning-text/_warning-text.scss +2 -60
- data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_links.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_lists.scss +17 -3
- data/node_modules/govuk-frontend/govuk/core/_section-break.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_template.scss +5 -3
- data/node_modules/govuk-frontend/govuk/core/_typography.scss +5 -3
- data/node_modules/govuk-frontend/govuk/helpers/_clearfix.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_focused.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_grid.scss +2 -1
- data/node_modules/govuk-frontend/govuk/helpers/_links.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_media-queries.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_shape-arrow.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_spacing.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_typography.scss +1 -1
- data/node_modules/govuk-frontend/govuk/helpers/_visually-hidden.scss +1 -1
- data/node_modules/govuk-frontend/govuk/objects/_form-group.scss +1 -3
- data/node_modules/govuk-frontend/govuk/objects/_grid.scss +1 -3
- data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +5 -3
- data/node_modules/govuk-frontend/govuk/objects/_width-container.scss +2 -4
- data/node_modules/govuk-frontend/govuk/overrides/_display.scss +5 -3
- data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +5 -3
- data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +5 -3
- data/node_modules/govuk-frontend/govuk/overrides/_width.scss +5 -3
- data/node_modules/govuk-frontend/govuk/settings/_ie8.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_compatibility.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_font-url.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_ie8.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_image-url.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_px-to-em.scss +1 -1
- data/node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss +1 -1
- data/node_modules/govuk-frontend/package.json +21 -21
- metadata +49 -2
@@ -46,7 +46,7 @@ module GovukPublishingComponents
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def output
|
49
|
-
return content_item_options unless content_item_navigation.
|
49
|
+
return content_item_options unless content_item_navigation.html_publication_with_parent?
|
50
50
|
return parent_item_options if parent_item_navigation.priority_breadcrumbs
|
51
51
|
|
52
52
|
step_by_step_header = parent_item_options[:step_by_step]
|
@@ -58,20 +58,20 @@ module GovukPublishingComponents
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def options(navigation)
|
61
|
-
if navigation.
|
61
|
+
if navigation.content_tagged_to_a_finder?
|
62
62
|
{
|
63
|
-
step_by_step:
|
64
|
-
breadcrumbs: navigation.
|
63
|
+
step_by_step: false,
|
64
|
+
breadcrumbs: navigation.breadcrumbs,
|
65
65
|
}
|
66
66
|
elsif navigation.content_tagged_to_current_step_by_step?
|
67
67
|
{
|
68
68
|
step_by_step: true,
|
69
69
|
breadcrumbs: navigation.step_nav_helper.header,
|
70
70
|
}
|
71
|
-
elsif navigation.
|
71
|
+
elsif navigation.priority_breadcrumbs
|
72
72
|
{
|
73
|
-
step_by_step:
|
74
|
-
breadcrumbs: navigation.
|
73
|
+
step_by_step: true,
|
74
|
+
breadcrumbs: navigation.priority_breadcrumbs,
|
75
75
|
}
|
76
76
|
elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs
|
77
77
|
{
|
@@ -24,9 +24,8 @@ module GovukPublishingComponents
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def questions_and_answers_markup
|
27
|
-
question_and_answers
|
28
|
-
|
29
|
-
.map do |question, value|
|
27
|
+
question_and_answers.select { |_, value| value[:answer].present? }
|
28
|
+
.map do |question, value|
|
30
29
|
q_and_a_url = section_url(value[:anchor])
|
31
30
|
|
32
31
|
{
|
@@ -52,9 +51,7 @@ module GovukPublishingComponents
|
|
52
51
|
#
|
53
52
|
# - :anchor: the id of the h2 (autogenerated by the markdown converter).
|
54
53
|
# This is used to build links directly to the section in question
|
55
|
-
def question_and_answers
|
56
|
-
doc = Nokogiri::HTML(html)
|
57
|
-
|
54
|
+
def question_and_answers
|
58
55
|
question = page.title
|
59
56
|
|
60
57
|
doc.xpath("html/body").children.each_with_object({}) do |element, q_and_as|
|
@@ -71,6 +68,10 @@ module GovukPublishingComponents
|
|
71
68
|
end
|
72
69
|
end
|
73
70
|
|
71
|
+
def doc
|
72
|
+
@doc ||= Nokogiri::HTML(page.body)
|
73
|
+
end
|
74
|
+
|
74
75
|
def question_hash_is_unset?(q_and_as, question)
|
75
76
|
q_and_as[question].nil?
|
76
77
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class HtmlPublicationSchema < FaqPageSchema
|
4
|
+
attr_reader :page
|
5
|
+
|
6
|
+
def initialize(page)
|
7
|
+
@page = page
|
8
|
+
end
|
9
|
+
|
10
|
+
def structured_data
|
11
|
+
return ArticleSchema.new(page).structured_data if less_than_two_headings_of_any_one_type?
|
12
|
+
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def heading_counts
|
17
|
+
@heading_counts ||= (1..5).each_with_object({}) do |n, hash|
|
18
|
+
heading = "h#{n}"
|
19
|
+
hash[heading] = doc.xpath("//*[@class=\"govspeak\"]//#{heading}").count
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def less_than_two_headings_of_any_one_type?
|
24
|
+
heading_counts.values.max < 2
|
25
|
+
end
|
26
|
+
|
27
|
+
def question_and_answers
|
28
|
+
headings.each_with_object({}) do |heading, hash|
|
29
|
+
question = heading.text
|
30
|
+
|
31
|
+
next_heading = heading_pairs[heading]
|
32
|
+
next_heading_path = next_heading && next_heading.path
|
33
|
+
answer = content_between(heading.path, next_heading_path)
|
34
|
+
|
35
|
+
hash[question] = {
|
36
|
+
answer: answer.map(&:to_s).join,
|
37
|
+
anchor: heading.attr(:id),
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def headings
|
43
|
+
@headings ||= doc.xpath("//*[@class=\"govspeak\"]//#{first_heading_type_with_more_than_one_occurance}")
|
44
|
+
end
|
45
|
+
|
46
|
+
def first_heading_type_with_more_than_one_occurance
|
47
|
+
heading_counts.detect { |_k, v| v > 1 }.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def heading_pairs
|
51
|
+
@heading_pairs ||= pairs_hash(headings)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Converts [:a, :b, :c] into
|
55
|
+
# {:a => :b, :b => :c}
|
56
|
+
def pairs_hash(array)
|
57
|
+
all_but_last = array[0..-2]
|
58
|
+
all_but_first = array[1..-1]
|
59
|
+
pairs = [all_but_last, all_but_first].transpose
|
60
|
+
Hash[pairs]
|
61
|
+
end
|
62
|
+
|
63
|
+
# From: https://stackoverflow.com/a/7816046/1014251
|
64
|
+
# If `stop_xpath` is `nil` gets text to end of content
|
65
|
+
def content_between(start_xpath, stop_xpath = nil)
|
66
|
+
node = doc.at_xpath(start_xpath).next_element
|
67
|
+
stop = stop_xpath && doc.at_xpath(stop_xpath)
|
68
|
+
[].tap do |content|
|
69
|
+
while node && node != stop
|
70
|
+
content << node
|
71
|
+
node = node.next_element
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -4,6 +4,7 @@ require "govuk_publishing_components/presenters/machine_readable/creative_work_s
|
|
4
4
|
require "govuk_publishing_components/presenters/machine_readable/faq_page_schema"
|
5
5
|
require "govuk_publishing_components/presenters/machine_readable/government_service_schema"
|
6
6
|
require "govuk_publishing_components/presenters/machine_readable/has_part_schema"
|
7
|
+
require "govuk_publishing_components/presenters/machine_readable/html_publication_schema"
|
7
8
|
require "govuk_publishing_components/presenters/machine_readable/is_part_of_schema"
|
8
9
|
require "govuk_publishing_components/presenters/machine_readable/news_article_schema"
|
9
10
|
require "govuk_publishing_components/presenters/machine_readable/organisation_schema"
|
@@ -22,22 +23,29 @@ module GovukPublishingComponents
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def structured_data
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
26
|
+
schema_for_page.new(page).structured_data
|
27
|
+
end
|
28
|
+
|
29
|
+
def schema_for_page
|
30
|
+
case page.schema
|
31
|
+
when :faq
|
32
|
+
FaqPageSchema
|
33
|
+
when :article
|
34
|
+
ArticleSchema
|
35
|
+
when :government_service
|
36
|
+
GovernmentServiceSchema
|
37
|
+
when :news_article
|
38
|
+
NewsArticleSchema
|
39
|
+
when :person
|
40
|
+
PersonSchema
|
41
|
+
when :organisation
|
42
|
+
OrganisationSchema
|
43
|
+
when :search_results_page
|
44
|
+
SearchResultsPageSchema
|
45
|
+
when :dataset
|
46
|
+
DatasetSchema
|
47
|
+
when :html_publication
|
48
|
+
HtmlPublicationSchema
|
41
49
|
else
|
42
50
|
raise "#{page.schema} is not supported"
|
43
51
|
end
|
@@ -21,12 +21,12 @@ Once installed, you will be able to use the code from the examples in the
|
|
21
21
|
### 1. Install with npm (recommended)
|
22
22
|
|
23
23
|
We recommend [installing GOV.UK Frontend using node package manager
|
24
|
-
(npm)](https://
|
24
|
+
(npm)](https://frontend.design-system.service.gov.uk/installing-with-npm/).
|
25
25
|
|
26
26
|
### 2. Install by using compiled files
|
27
27
|
|
28
28
|
You can also [download the compiled and minified assets (CSS, JavaScript) from
|
29
|
-
GitHub](https://
|
29
|
+
GitHub](https://frontend.design-system.service.gov.uk/installing-from-dist/).
|
30
30
|
|
31
31
|
## Importing styles
|
32
32
|
|
@@ -40,7 +40,7 @@ To import add the below to your Sass file:
|
|
40
40
|
@import "node_modules/govuk-frontend/govuk/all";
|
41
41
|
```
|
42
42
|
|
43
|
-
[More details on importing styles](https://
|
43
|
+
[More details on importing styles](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#css)
|
44
44
|
|
45
45
|
## Importing JavaScript
|
46
46
|
|
@@ -59,14 +59,14 @@ Next you need to initialise the script by adding:
|
|
59
59
|
<script>window.GOVUKFrontend.initAll()</script>
|
60
60
|
```
|
61
61
|
|
62
|
-
[More details on importing Javascript and advanced options](https://
|
62
|
+
[More details on importing Javascript and advanced options](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#javascript)
|
63
63
|
|
64
64
|
|
65
65
|
## Importing assets
|
66
66
|
|
67
67
|
In order to import GOV.UK Frontend images and fonts to your project, you should configure your application to reference or copy the relevant GOV.UK Frontend assets.
|
68
68
|
|
69
|
-
[More details on importing assets](https://
|
69
|
+
[More details on importing assets](https://frontend.design-system.service.gov.uk/importing-css-assets-and-javascript/#font-and-image-assets)
|
70
70
|
|
71
71
|
|
72
72
|
## Getting updates
|
@@ -76,7 +76,7 @@ To be notified when there’s a new release, you can either:
|
|
76
76
|
- [watch the govuk-frontend Github repository](https://help.github.com/en/articles/watching-and-unwatching-repositories)
|
77
77
|
- join the [#govuk-design-system channel on cross-government Slack](https://ukgovernmentdigital.slack.com/app_redirect?channel=govuk-design-system)
|
78
78
|
|
79
|
-
Find out how to [update with npm](https://
|
79
|
+
Find out how to [update with npm](https://frontend.design-system.service.gov.uk/updating-with-npm/).
|
80
80
|
|
81
81
|
## Licence
|
82
82
|
|
@@ -891,7 +891,7 @@ Accordion.prototype.initHeaderAttributes = function ($headerWrapper, index) {
|
|
891
891
|
icon.className = this.iconClass;
|
892
892
|
icon.setAttribute('aria-hidden', 'true');
|
893
893
|
|
894
|
-
$
|
894
|
+
$button.appendChild(icon);
|
895
895
|
};
|
896
896
|
|
897
897
|
// When section toggled, set and store state
|
@@ -1,29 +1,31 @@
|
|
1
|
-
@import "
|
2
|
-
|
3
|
-
@import "
|
4
|
-
@import "
|
5
|
-
@import "
|
6
|
-
@import "
|
7
|
-
@import "
|
8
|
-
@import "
|
9
|
-
@import "
|
10
|
-
@import "
|
11
|
-
@import "
|
12
|
-
@import "
|
13
|
-
@import "
|
14
|
-
@import "
|
15
|
-
@import "
|
16
|
-
@import "
|
17
|
-
@import "
|
18
|
-
@import "
|
19
|
-
@import "
|
20
|
-
@import "
|
21
|
-
@import "
|
22
|
-
@import "
|
23
|
-
@import "
|
24
|
-
@import "
|
25
|
-
@import "
|
26
|
-
@import "
|
27
|
-
@import "
|
28
|
-
@import "
|
29
|
-
@import "
|
1
|
+
@import "../base";
|
2
|
+
|
3
|
+
@import "accordion/index";
|
4
|
+
@import "back-link/index";
|
5
|
+
@import "breadcrumbs/index";
|
6
|
+
@import "button/index";
|
7
|
+
@import "checkboxes/index";
|
8
|
+
@import "character-count/index";
|
9
|
+
@import "summary-list/index";
|
10
|
+
@import "date-input/index";
|
11
|
+
@import "details/index";
|
12
|
+
@import "error-message/index";
|
13
|
+
@import "error-summary/index";
|
14
|
+
@import "fieldset/index";
|
15
|
+
@import "file-upload/index";
|
16
|
+
@import "footer/index";
|
17
|
+
@import "hint/index";
|
18
|
+
@import "header/index";
|
19
|
+
@import "input/index";
|
20
|
+
@import "inset-text/index";
|
21
|
+
@import "label/index";
|
22
|
+
@import "panel/index";
|
23
|
+
@import "phase-banner/index";
|
24
|
+
@import "tabs/index";
|
25
|
+
@import "tag/index";
|
26
|
+
@import "radios/index";
|
27
|
+
@import "select/index";
|
28
|
+
@import "skip-link/index";
|
29
|
+
@import "table/index";
|
30
|
+
@import "textarea/index";
|
31
|
+
@import "warning-text/index";
|
@@ -1,208 +1,2 @@
|
|
1
|
-
@import "../../
|
2
|
-
@import "
|
3
|
-
@import "../../helpers/all";
|
4
|
-
|
5
|
-
|
6
|
-
@include govuk-exports("govuk/component/accordion") {
|
7
|
-
|
8
|
-
$govuk-accordion-link-colour: $govuk-link-colour;
|
9
|
-
$govuk-accordion-link-hover-colour: govuk-colour("light-blue");
|
10
|
-
$govuk-accordion-border-width: 3px;
|
11
|
-
|
12
|
-
.govuk-accordion {
|
13
|
-
@include govuk-responsive-margin(6, "bottom");
|
14
|
-
}
|
15
|
-
|
16
|
-
// Borders between accordion sections
|
17
|
-
.govuk-accordion__section {
|
18
|
-
padding-top: govuk-spacing(3);
|
19
|
-
}
|
20
|
-
|
21
|
-
.govuk-accordion__section-header {
|
22
|
-
padding-top: govuk-spacing(3);
|
23
|
-
padding-bottom: govuk-spacing(3);
|
24
|
-
}
|
25
|
-
|
26
|
-
.govuk-accordion__section-heading {
|
27
|
-
margin-top: 0; // Override browser default
|
28
|
-
margin-bottom: 0; // Override browser default
|
29
|
-
}
|
30
|
-
|
31
|
-
// Buttons within the sections don’t need default styling
|
32
|
-
.govuk-accordion__section-button {
|
33
|
-
@include govuk-font($size: 24, $weight: bold);
|
34
|
-
display: inline-block;
|
35
|
-
margin-bottom: 0;
|
36
|
-
padding-top: govuk-spacing(3);
|
37
|
-
}
|
38
|
-
|
39
|
-
.govuk-accordion__section-summary {
|
40
|
-
margin-top: govuk-spacing(2);
|
41
|
-
margin-bottom: 0;
|
42
|
-
}
|
43
|
-
|
44
|
-
// Remove the bottom margin from the last item inside the content
|
45
|
-
.govuk-accordion__section-content > :last-child {
|
46
|
-
margin-bottom: 0;
|
47
|
-
}
|
48
|
-
|
49
|
-
// JavaScript enabled
|
50
|
-
.js-enabled {
|
51
|
-
|
52
|
-
.govuk-accordion {
|
53
|
-
// Border at the bottom of the whole accordion
|
54
|
-
border-bottom: 1px solid $govuk-border-colour;
|
55
|
-
}
|
56
|
-
|
57
|
-
// Borders between accordion sections
|
58
|
-
.govuk-accordion__section {
|
59
|
-
padding-top: 0;
|
60
|
-
}
|
61
|
-
|
62
|
-
// Hide the body of collapsed sections
|
63
|
-
.govuk-accordion__section-content {
|
64
|
-
display: none;
|
65
|
-
@include govuk-responsive-padding(3, "top");
|
66
|
-
@include govuk-responsive-padding(3, "bottom");
|
67
|
-
}
|
68
|
-
|
69
|
-
// Show the body of expanded sections
|
70
|
-
.govuk-accordion__section--expanded .govuk-accordion__section-content {
|
71
|
-
display: block;
|
72
|
-
}
|
73
|
-
|
74
|
-
// This is styled to look like a link not a button
|
75
|
-
.govuk-accordion__open-all {
|
76
|
-
@include govuk-font($size: 16);
|
77
|
-
position: relative;
|
78
|
-
z-index: 1;
|
79
|
-
margin: 0;
|
80
|
-
padding: 0;
|
81
|
-
border-width: 0;
|
82
|
-
color: $govuk-link-colour;
|
83
|
-
background: none;
|
84
|
-
cursor: pointer;
|
85
|
-
-webkit-appearance: none;
|
86
|
-
|
87
|
-
@include govuk-link-common;
|
88
|
-
@include govuk-link-style-default;
|
89
|
-
|
90
|
-
// Remove default button focus outline in Firefox
|
91
|
-
&::-moz-focus-inner {
|
92
|
-
padding: 0;
|
93
|
-
border: 0;
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
// Section headers have a pointer cursor as an additional affordance
|
98
|
-
.govuk-accordion__section-header {
|
99
|
-
position: relative;
|
100
|
-
// Safe area on the right to avoid clashing with icon
|
101
|
-
padding-right: 40px;
|
102
|
-
border-top: 1px solid $govuk-border-colour;
|
103
|
-
color: $govuk-accordion-link-colour;
|
104
|
-
cursor: pointer;
|
105
|
-
}
|
106
|
-
|
107
|
-
// For devices that can't hover such as touch devices,
|
108
|
-
// remove hover state as it can be stuck in that state (iOS).
|
109
|
-
@media (hover: none) {
|
110
|
-
.govuk-accordion__section-header:hover {
|
111
|
-
border-top-color: $govuk-accordion-link-colour;
|
112
|
-
box-shadow: inset 0 $govuk-accordion-border-width 0 0 $govuk-accordion-link-colour;
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
// Buttons within the headers don’t need default styling
|
117
|
-
.govuk-accordion__section-button {
|
118
|
-
@include govuk-typography-common;
|
119
|
-
margin-top: 0;
|
120
|
-
margin-bottom: 0;
|
121
|
-
margin-left: 0;
|
122
|
-
padding: 0;
|
123
|
-
border-width: 0;
|
124
|
-
color: inherit;
|
125
|
-
background: none;
|
126
|
-
text-align: left;
|
127
|
-
cursor: pointer;
|
128
|
-
-webkit-appearance: none;
|
129
|
-
|
130
|
-
&:focus {
|
131
|
-
@include govuk-focused-text;
|
132
|
-
}
|
133
|
-
|
134
|
-
// Remove default button focus outline in Firefox
|
135
|
-
&::-moz-focus-inner {
|
136
|
-
padding: 0;
|
137
|
-
border: 0;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
// Extend the touch area of the button to span the section header
|
142
|
-
.govuk-accordion__section-button:after {
|
143
|
-
content: "";
|
144
|
-
position: absolute;
|
145
|
-
top: 0;
|
146
|
-
right: 0;
|
147
|
-
bottom: 0;
|
148
|
-
left: 0;
|
149
|
-
}
|
150
|
-
|
151
|
-
.govuk-accordion__section-button:hover:not(:focus) {
|
152
|
-
text-decoration: underline;
|
153
|
-
}
|
154
|
-
|
155
|
-
// For devices that can't hover such as touch devices,
|
156
|
-
// remove hover state as it can be stuck in that state (iOS).
|
157
|
-
@media (hover: none) {
|
158
|
-
.govuk-accordion__section-button:hover {
|
159
|
-
text-decoration: none;
|
160
|
-
}
|
161
|
-
}
|
162
|
-
|
163
|
-
.govuk-accordion__controls {
|
164
|
-
text-align: right;
|
165
|
-
}
|
166
|
-
|
167
|
-
// Display an icon to the right of each header to indicate open/closed status,
|
168
|
-
// and as an additional affordance.
|
169
|
-
.govuk-accordion__icon {
|
170
|
-
position: absolute;
|
171
|
-
top: 50%;
|
172
|
-
right: 15px;
|
173
|
-
width: 16px;
|
174
|
-
height: 16px;
|
175
|
-
margin-top: -8px;
|
176
|
-
}
|
177
|
-
|
178
|
-
.govuk-accordion__icon:after,
|
179
|
-
.govuk-accordion__icon:before {
|
180
|
-
content: "";
|
181
|
-
box-sizing: border-box;
|
182
|
-
position: absolute;
|
183
|
-
top: 0;
|
184
|
-
right: 0;
|
185
|
-
bottom: 0;
|
186
|
-
left: 0;
|
187
|
-
width: 25%;
|
188
|
-
height: 25%;
|
189
|
-
margin: auto;
|
190
|
-
border: 2px solid transparent;
|
191
|
-
background-color: govuk-colour("black");
|
192
|
-
}
|
193
|
-
|
194
|
-
.govuk-accordion__icon:before {
|
195
|
-
width: 100%;
|
196
|
-
}
|
197
|
-
|
198
|
-
.govuk-accordion__icon:after {
|
199
|
-
height: 100%;
|
200
|
-
}
|
201
|
-
|
202
|
-
// Vertical bar should be hidden when section is open, to display a '-' icon
|
203
|
-
.govuk-accordion__section--expanded .govuk-accordion__icon:after {
|
204
|
-
content: " ";
|
205
|
-
display: none;
|
206
|
-
}
|
207
|
-
}
|
208
|
-
}
|
1
|
+
@import "../../base";
|
2
|
+
@import "./index";
|