govuk_publishing_components 9.3.6 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/assets/stylesheets/component_guide/application.scss +10 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/admin_styles.scss +13 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +66 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -0
- data/app/models/govuk_publishing_components/component_doc.rb +12 -0
- data/app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb +7 -5
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +22 -0
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +39 -0
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +26 -0
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +10 -0
- data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +142 -0
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +28 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -0
- data/app/views/layouts/govuk_publishing_components/application.html.erb +5 -0
- data/config/initializers/assets.rb +12 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +13 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/README.md +96 -0
- data/node_modules/govuk-frontend/all-ie8.scss +6 -0
- data/node_modules/govuk-frontend/all.js +1720 -0
- data/node_modules/govuk-frontend/all.scss +11 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
- data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
- data/node_modules/govuk-frontend/common.js +39 -0
- data/node_modules/govuk-frontend/components/_all.scss +26 -0
- data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
- data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
- data/node_modules/govuk-frontend/components/button/README.md +319 -0
- data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
- data/node_modules/govuk-frontend/components/button/button.js +548 -0
- data/node_modules/govuk-frontend/components/button/button.njk +3 -0
- data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/button/template.njk +35 -0
- data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
- data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
- data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
- data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
- data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
- data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
- data/node_modules/govuk-frontend/components/details/README.md +237 -0
- data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
- data/node_modules/govuk-frontend/components/details/details.js +836 -0
- data/node_modules/govuk-frontend/components/details/details.njk +7 -0
- data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
- data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/details/template.njk +10 -0
- data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
- data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
- data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
- data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
- data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
- data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
- data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
- data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
- data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
- data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
- data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
- data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
- data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
- data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
- data/node_modules/govuk-frontend/components/footer/README.md +284 -0
- data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
- data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
- data/node_modules/govuk-frontend/components/header/README.md +524 -0
- data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
- data/node_modules/govuk-frontend/components/header/header.js +717 -0
- data/node_modules/govuk-frontend/components/header/header.njk +3 -0
- data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/header/template.njk +82 -0
- data/node_modules/govuk-frontend/components/hint/README.md +157 -0
- data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
- data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
- data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
- data/node_modules/govuk-frontend/components/input/README.md +416 -0
- data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
- data/node_modules/govuk-frontend/components/input/input.njk +9 -0
- data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/input/template.njk +42 -0
- data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
- data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
- data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
- data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
- data/node_modules/govuk-frontend/components/label/README.md +193 -0
- data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
- data/node_modules/govuk-frontend/components/label/label.njk +6 -0
- data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/label/template.njk +15 -0
- data/node_modules/govuk-frontend/components/panel/README.md +151 -0
- data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
- data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
- data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
- data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
- data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
- data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
- data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
- data/node_modules/govuk-frontend/components/radios/README.md +686 -0
- data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
- data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
- data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
- data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
- data/node_modules/govuk-frontend/components/select/README.md +387 -0
- data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
- data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/select/select.njk +24 -0
- data/node_modules/govuk-frontend/components/select/template.njk +44 -0
- data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
- data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
- data/node_modules/govuk-frontend/components/table/README.md +585 -0
- data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
- data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/table/table.njk +45 -0
- data/node_modules/govuk-frontend/components/table/template.njk +39 -0
- data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
- data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
- data/node_modules/govuk-frontend/components/tag/README.md +150 -0
- data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
- data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
- data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
- data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
- data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
- data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
- data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
- data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
- data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
- data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
- data/node_modules/govuk-frontend/core/_all.scss +6 -0
- data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
- data/node_modules/govuk-frontend/core/_links.scss +40 -0
- data/node_modules/govuk-frontend/core/_lists.scss +63 -0
- data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
- data/node_modules/govuk-frontend/core/_template.scss +16 -0
- data/node_modules/govuk-frontend/core/_typography.scss +186 -0
- data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
- data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
- data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
- data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
- data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
- data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
- data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
- data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
- data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
- data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
- data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
- data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
- data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
- data/node_modules/govuk-frontend/objects/_all.scss +4 -0
- data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
- data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
- data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
- data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
- data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
- data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
- data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
- data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
- data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
- data/node_modules/govuk-frontend/package.json +89 -0
- data/node_modules/govuk-frontend/settings/_all.scss +21 -0
- data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
- data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
- data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
- data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
- data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
- data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
- data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
- data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
- data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
- data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
- data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
- data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
- data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
- data/node_modules/govuk-frontend/template.njk +56 -0
- data/node_modules/govuk-frontend/tools/_all.scss +7 -0
- data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
- data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
- data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
- data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
- data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
- data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
- data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
- data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
- data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
- data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
- metadata +249 -2
@@ -0,0 +1,100 @@
|
|
1
|
+
////
|
2
|
+
/// @group helpers
|
3
|
+
////
|
4
|
+
|
5
|
+
/// Map of grid column widths
|
6
|
+
///
|
7
|
+
/// @type Map
|
8
|
+
/// @access private
|
9
|
+
|
10
|
+
$_govuk-grid-widths: (
|
11
|
+
one-quarter: 25%,
|
12
|
+
one-third: 33.3333%,
|
13
|
+
one-half: 50%,
|
14
|
+
two-thirds: 66.6666%,
|
15
|
+
three-quarters: 75%,
|
16
|
+
full: 100%
|
17
|
+
) !default;
|
18
|
+
|
19
|
+
/// Grid width percentage
|
20
|
+
///
|
21
|
+
/// @param {String} $key - Name of grid width (e.g. two-thirds)
|
22
|
+
/// @return {Number} Percentage width
|
23
|
+
/// @throw if `$key` is not a valid grid width
|
24
|
+
/// @access public
|
25
|
+
|
26
|
+
@function grid-width($key) {
|
27
|
+
@if map-has-key($_govuk-grid-widths, $key) {
|
28
|
+
@return map-get($_govuk-grid-widths, $key);
|
29
|
+
}
|
30
|
+
|
31
|
+
@error "Unknown grid width `#{$key}`";
|
32
|
+
}
|
33
|
+
|
34
|
+
/// Generate grid row styles
|
35
|
+
///
|
36
|
+
/// Creates a grid row class with a standardised margin.
|
37
|
+
///
|
38
|
+
/// @param {String} $class [govuk-grid-row] CSS class name
|
39
|
+
///
|
40
|
+
/// @example scss - Default
|
41
|
+
/// @include govuk-grid-row;
|
42
|
+
///
|
43
|
+
/// @example scss - Customising the class name
|
44
|
+
/// @include govuk-grid-row("app-grid");
|
45
|
+
///
|
46
|
+
/// @access public
|
47
|
+
|
48
|
+
@mixin govuk-grid-row($class: "govuk-grid-row") {
|
49
|
+
.#{$class} {
|
50
|
+
@include govuk-clearfix;
|
51
|
+
margin-right: - ($govuk-gutter-half);
|
52
|
+
margin-left: - ($govuk-gutter-half);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
/// Generate grid column styles
|
57
|
+
///
|
58
|
+
/// Creates a cross browser grid column with a class of '.govuk-grid-column' by
|
59
|
+
/// default, and a standardised gutter between the columns.
|
60
|
+
///
|
61
|
+
/// Common widths are predefined above as keywords in the `$grid-widths` map.
|
62
|
+
///
|
63
|
+
/// By default their width changes from 100% to specified width at the 'tablet'
|
64
|
+
/// breakpoint, but that can be configured to be any other breakpoint by using
|
65
|
+
/// the `$at` parameter.
|
66
|
+
///
|
67
|
+
/// @param {String} $class [govuk-grid-column] CSS class name
|
68
|
+
/// @param {String} $width [full] one-quarter | one-third | one-half | two-third | three-quarters | full
|
69
|
+
/// @param {String} $float [left] left | right
|
70
|
+
/// @param {String} $at [tablet] - mobile | tablet | desktop | any custom breakpoint in px or em
|
71
|
+
///
|
72
|
+
/// @example scss - Default
|
73
|
+
/// @include govuk-grid-column(two-thirds)
|
74
|
+
///
|
75
|
+
/// @example scss - Customising the class name
|
76
|
+
/// @include govuk-grid-column(one-half, $class: "test-column");
|
77
|
+
///
|
78
|
+
/// @example scss - Customising the breakpoint where width percentage is applied
|
79
|
+
/// @include govuk-grid-column(one-half, $at: desktop);
|
80
|
+
///
|
81
|
+
/// @example scss - Customising the float direction
|
82
|
+
/// @include govuk-grid-column(one-half, $float: right);
|
83
|
+
///
|
84
|
+
/// @access public
|
85
|
+
|
86
|
+
@mixin govuk-grid-column($width: full, $float: left, $at: tablet, $class: "govuk-grid-column") {
|
87
|
+
|
88
|
+
.#{$class}-#{$width} {
|
89
|
+
-webkit-box-sizing: border-box;
|
90
|
+
box-sizing: border-box;
|
91
|
+
@if $at != desktop {
|
92
|
+
width: 100%;
|
93
|
+
}
|
94
|
+
padding: 0 $govuk-gutter-half;
|
95
|
+
@include govuk-media-query($from: $at) {
|
96
|
+
width: grid-width($width);
|
97
|
+
float: $float;
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
@@ -0,0 +1,149 @@
|
|
1
|
+
////
|
2
|
+
/// @group helpers
|
3
|
+
////
|
4
|
+
|
5
|
+
/// Common link mixin
|
6
|
+
///
|
7
|
+
/// Provides the typography and focus state, regardless of link style.
|
8
|
+
///
|
9
|
+
/// @access public
|
10
|
+
|
11
|
+
@mixin govuk-link-common {
|
12
|
+
@include govuk-typography-common;
|
13
|
+
@include govuk-focusable-fill;
|
14
|
+
}
|
15
|
+
|
16
|
+
/// Default link style mixin
|
17
|
+
///
|
18
|
+
/// Provides the default unvisited, visited, hover and active states for links.
|
19
|
+
///
|
20
|
+
/// If you use this mixin in a component you must also include the
|
21
|
+
/// govuk-link-common mixin in order to get the focus state.
|
22
|
+
///
|
23
|
+
/// @example scss
|
24
|
+
/// .govuk-component__link {
|
25
|
+
/// @include govuk-link-common;
|
26
|
+
/// @include govuk-link-style-muted;
|
27
|
+
/// }
|
28
|
+
///
|
29
|
+
/// @access public
|
30
|
+
|
31
|
+
@mixin govuk-link-style-default {
|
32
|
+
&:link {
|
33
|
+
color: $govuk-link-colour;
|
34
|
+
}
|
35
|
+
|
36
|
+
&:visited {
|
37
|
+
color: $govuk-link-visited-colour;
|
38
|
+
}
|
39
|
+
|
40
|
+
&:hover {
|
41
|
+
color: $govuk-link-hover-colour;
|
42
|
+
}
|
43
|
+
|
44
|
+
&:active {
|
45
|
+
color: $govuk-link-active-colour;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
/// Muted style link mixin
|
50
|
+
///
|
51
|
+
/// Used for secondary links on a page - the link will appear in muted colours
|
52
|
+
/// regardless of visited state.
|
53
|
+
///
|
54
|
+
/// If you use this mixin in a component you must also include the
|
55
|
+
/// govuk-link-common mixin in order to get the focus state.
|
56
|
+
///
|
57
|
+
/// @example scss
|
58
|
+
/// .govuk-component__link {
|
59
|
+
/// @include govuk-link-common;
|
60
|
+
/// @include govuk-link-style-muted;
|
61
|
+
/// }
|
62
|
+
///
|
63
|
+
/// @access public
|
64
|
+
|
65
|
+
@mixin govuk-link-style-muted {
|
66
|
+
&:link,
|
67
|
+
&:visited,
|
68
|
+
&:hover,
|
69
|
+
&:active {
|
70
|
+
color: $govuk-secondary-text-colour;
|
71
|
+
}
|
72
|
+
|
73
|
+
// When focussed, the text colour needs to be darker to ensure that colour
|
74
|
+
// contrast is still acceptable
|
75
|
+
&:focus {
|
76
|
+
color: $govuk-text-colour;
|
77
|
+
}
|
78
|
+
|
79
|
+
// alphagov/govuk_template includes a specific a:link:focus selector designed
|
80
|
+
// to make unvisited links a slightly darker blue when focussed, so we need to
|
81
|
+
// override the text colour for that combination of selectors.
|
82
|
+
@include govuk-compatibility(govuk_template) {
|
83
|
+
&:link:focus {
|
84
|
+
@include govuk-text-colour;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/// Text style link mixin
|
90
|
+
///
|
91
|
+
/// Overrides the colour of links to match the text colour. Generally used by
|
92
|
+
/// navigation components, such as breadcrumbs or the back link.
|
93
|
+
///
|
94
|
+
/// If you use this mixin in a component you must also include the
|
95
|
+
/// govuk-link-common mixin in order to get the focus state.
|
96
|
+
///
|
97
|
+
/// @example scss
|
98
|
+
/// .govuk-component__link {
|
99
|
+
/// @include govuk-link-common;
|
100
|
+
/// @include govuk-link-style-text;
|
101
|
+
/// }
|
102
|
+
///
|
103
|
+
/// @access public
|
104
|
+
|
105
|
+
@mixin govuk-link-style-text {
|
106
|
+
// Override link colour to use text colour
|
107
|
+
&:link,
|
108
|
+
&:visited,
|
109
|
+
&:hover,
|
110
|
+
&:active,
|
111
|
+
&:focus {
|
112
|
+
@include govuk-text-colour;
|
113
|
+
}
|
114
|
+
|
115
|
+
// alphagov/govuk_template includes a specific a:link:focus selector designed
|
116
|
+
// to make unvisited links a slightly darker blue when focussed, so we need to
|
117
|
+
// override the text colour for that combination of selectors.
|
118
|
+
@include govuk-compatibility(govuk_template) {
|
119
|
+
&:link:focus {
|
120
|
+
@include govuk-text-colour;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
/// Print friendly link mixin
|
126
|
+
///
|
127
|
+
/// When printing, append the the destination URL to the link text, as long
|
128
|
+
/// as the URL starts with either `/`, `http://` or `https://`.
|
129
|
+
///
|
130
|
+
/// @access public
|
131
|
+
|
132
|
+
@mixin govuk-link-print-friendly {
|
133
|
+
@include govuk-media-query($media-type: print) {
|
134
|
+
|
135
|
+
&[href^="/"],
|
136
|
+
&[href^="http://"],
|
137
|
+
&[href^="https://"] {
|
138
|
+
&::after {
|
139
|
+
content: " (" attr(href) ")";
|
140
|
+
font-size: 90%;
|
141
|
+
|
142
|
+
// Because the URLs may be very long, ensure that they may be broken
|
143
|
+
// at arbitrary points if there are no otherwise acceptable break
|
144
|
+
// points in the line
|
145
|
+
word-wrap: break-word;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
////
|
2
|
+
/// @group helpers
|
3
|
+
////
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
// =========================================================
|
8
|
+
// Wrangle sass-mq config...
|
9
|
+
// =========================================================
|
10
|
+
|
11
|
+
// Pass our breakpoints and static breakpoint definitions through to sass-mq.
|
12
|
+
$mq-breakpoints: if(variable-exists(govuk-breakpoints), $govuk-breakpoints, ());
|
13
|
+
$mq-static-breakpoint: if(variable-exists(govuk-ie8-breakpoint), $govuk-ie8-breakpoint, desktop);
|
14
|
+
|
15
|
+
$mq-show-breakpoints: ();
|
16
|
+
|
17
|
+
@if (variable-exists(govuk-show-breakpoints) and $govuk-show-breakpoints) {
|
18
|
+
$mq-show-breakpoints: map-keys($govuk-breakpoints);
|
19
|
+
}
|
20
|
+
|
21
|
+
// When building a stylesheet for IE8, set $mq-responsive to false in order to
|
22
|
+
// 'rasterize' any media queries.
|
23
|
+
|
24
|
+
$mq-responsive: true;
|
25
|
+
@if (variable-exists(govuk-is-ie8) and $govuk-is-ie8) {
|
26
|
+
$mq-responsive: false;
|
27
|
+
}
|
28
|
+
|
29
|
+
// This is a horrible, horrible hack to prevent the 'dev mode' CSS to display
|
30
|
+
// the current breakpoint from being included multiple times.
|
31
|
+
//
|
32
|
+
// We can't use the `exports` mixin for this because import directives cannot be
|
33
|
+
// used within control directives 😠
|
34
|
+
$sass-mq-already-included: false !default;
|
35
|
+
|
36
|
+
@if $sass-mq-already-included {
|
37
|
+
$mq-show-breakpoints: ();
|
38
|
+
}
|
39
|
+
|
40
|
+
@import "../vendor/sass-mq";
|
41
|
+
|
42
|
+
$sass-mq-already-included: true;
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
// =========================================================
|
47
|
+
// Helpers
|
48
|
+
// =========================================================
|
49
|
+
|
50
|
+
/// Media Query
|
51
|
+
///
|
52
|
+
/// This is a currently a wrapper for sass-mq - abstracted so that we can
|
53
|
+
/// replace it in the future if we so choose.
|
54
|
+
///
|
55
|
+
/// @param {String | Boolean} $from [false] - One of $govuk-breakpoints
|
56
|
+
/// @param {String | Boolean} $until [false] - One of $govuk-breakpoints
|
57
|
+
/// @param {String | Boolean} $and [false] - Additional media query parameters
|
58
|
+
/// @param {String} $media-type [all] - Media type: screen, print…
|
59
|
+
///
|
60
|
+
/// @ignore Undocumented mq API, for advanced use only:
|
61
|
+
/// @ignore @param {Map} $breakpoints [$govuk-breakpoints]
|
62
|
+
/// @ignore @param {String} $static-breakpoint [$govuk-ie8-breakpoint]
|
63
|
+
/// @ignore @param {Boolean} $responsive [$govuk-is-ie8]
|
64
|
+
///
|
65
|
+
/// @content styling rules, wrapped into a @media query when $responsive is true
|
66
|
+
///
|
67
|
+
/// @example scss
|
68
|
+
/// .element {
|
69
|
+
/// @include govuk-media-query($from: mobile) {
|
70
|
+
/// color: red;
|
71
|
+
/// }
|
72
|
+
/// @include govuk-media-query($until: tablet) {
|
73
|
+
/// color: blue;
|
74
|
+
/// }
|
75
|
+
/// @include govuk-media-query(mobile, tablet) {
|
76
|
+
/// color: green;
|
77
|
+
/// }
|
78
|
+
/// @include govuk-media-query($from: tablet, $and: '(orientation: landscape)') {
|
79
|
+
/// color: teal;
|
80
|
+
/// }
|
81
|
+
/// @include govuk-media-query(950px) {
|
82
|
+
/// color: hotpink;
|
83
|
+
/// }
|
84
|
+
/// @include govuk-media-query(tablet, $media-type: screen) {
|
85
|
+
/// color: hotpink;
|
86
|
+
/// }
|
87
|
+
/// }
|
88
|
+
///
|
89
|
+
/// @access public
|
90
|
+
|
91
|
+
@mixin govuk-media-query($args...) {
|
92
|
+
@include mq($args...) {
|
93
|
+
@content;
|
94
|
+
};
|
95
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
////
|
2
|
+
/// @group helpers
|
3
|
+
////
|
4
|
+
|
5
|
+
/// Calculate the height of an equilateral triangle
|
6
|
+
///
|
7
|
+
/// Multiplying half the length of the base of an equilateral triangle by the
|
8
|
+
/// square root of three gives us its height. We use 1.732 as an approximation.
|
9
|
+
///
|
10
|
+
/// @param {Number} $base - Length of the base of the triangle
|
11
|
+
/// @return {Number} Calculated height of the triangle
|
12
|
+
/// @access private
|
13
|
+
|
14
|
+
@function _govuk-equilateral-height($base) {
|
15
|
+
$square-root-of-three: 1.732;
|
16
|
+
|
17
|
+
@return ($base / 2) * $square-root-of-three;
|
18
|
+
}
|
19
|
+
|
20
|
+
/// Arrow mixin
|
21
|
+
///
|
22
|
+
/// Generate Arrows (triangles) by using a mix of transparent (1) and coloured
|
23
|
+
/// borders. The coloured borders inherit the text colour of the element (2).
|
24
|
+
///
|
25
|
+
/// Ensure the arrow is rendered correctly if browser colours are overridden by
|
26
|
+
/// providing a clip path (3). Without this the transparent borders are
|
27
|
+
/// overridden to become visible which results in a square.
|
28
|
+
///
|
29
|
+
/// We need both because older browsers do not support clip-path.
|
30
|
+
///
|
31
|
+
/// @param {String} $direction - Direction for arrow: up, right, down, left.
|
32
|
+
/// @param {Number} $base - Length of the triangle 'base' side
|
33
|
+
/// @param {Number} $height [null] - Height of triangle. Omit for equilateral.
|
34
|
+
/// @param {String} $display [block] - CSS display property of the arrow
|
35
|
+
///
|
36
|
+
/// @access public
|
37
|
+
|
38
|
+
@mixin govuk-shape-arrow($direction, $base, $height: null, $display: block) {
|
39
|
+
display: $display;
|
40
|
+
|
41
|
+
width: 0;
|
42
|
+
height: 0;
|
43
|
+
|
44
|
+
border-style: solid;
|
45
|
+
border-color: transparent; // 1
|
46
|
+
|
47
|
+
$perpendicular: $base / 2;
|
48
|
+
|
49
|
+
@if ($height == null) {
|
50
|
+
$height: _govuk-equilateral-height($base);
|
51
|
+
}
|
52
|
+
|
53
|
+
@if $direction == "up" {
|
54
|
+
-webkit-clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
|
55
|
+
clip-path: polygon(50% 0%, 0% 100%, 100% 100%); // 3
|
56
|
+
|
57
|
+
border-width: 0 $perpendicular $height $perpendicular;
|
58
|
+
border-bottom-color: inherit; // 2
|
59
|
+
} @else if $direction == "right" {
|
60
|
+
-webkit-clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
|
61
|
+
clip-path: polygon(0% 0%, 100% 50%, 0% 100%); // 3
|
62
|
+
|
63
|
+
border-width: $perpendicular 0 $perpendicular $height;
|
64
|
+
border-left-color: inherit; // 2
|
65
|
+
} @else if $direction == "down" {
|
66
|
+
-webkit-clip-path: polygon(0% 0%, 50% 100%, 100% 0%);
|
67
|
+
clip-path: polygon(0% 0%, 50% 100%, 100% 0%); // 3
|
68
|
+
|
69
|
+
border-width: $height $perpendicular 0 $perpendicular;
|
70
|
+
border-top-color: inherit; // 2
|
71
|
+
} @else if $direction == "left" {
|
72
|
+
-webkit-clip-path: polygon(0% 50%, 100% 100%, 100% 0%);
|
73
|
+
clip-path: polygon(0% 50%, 100% 100%, 100% 0%); // 3
|
74
|
+
|
75
|
+
border-width: $perpendicular $height $perpendicular 0;
|
76
|
+
border-right-color: inherit; // 2
|
77
|
+
} @else {
|
78
|
+
@error "Invalid arrow direction: expected `up`, `right`, `down` or `left`, got `#{$direction}`";
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,152 @@
|
|
1
|
+
////
|
2
|
+
/// @group helpers
|
3
|
+
////
|
4
|
+
|
5
|
+
/// Single point spacing
|
6
|
+
///
|
7
|
+
/// Returns measurement corresponding to the spacing point requested.
|
8
|
+
///
|
9
|
+
/// @param {Number} $spacing-point - Point on the spacing scale (set in `settings/_spacing.sccs`)
|
10
|
+
///
|
11
|
+
/// @returns {String} Spacing Measurement eg. 10px
|
12
|
+
///
|
13
|
+
/// @example scss
|
14
|
+
/// .element {
|
15
|
+
/// padding: govuk-spacing(5);
|
16
|
+
/// top: govuk-spacing(2) !important; // if `!important` is required
|
17
|
+
/// }
|
18
|
+
/// @access public
|
19
|
+
|
20
|
+
@function govuk-spacing($spacing-point) {
|
21
|
+
|
22
|
+
$actual-input-type: type-of($spacing-point);
|
23
|
+
@if $actual-input-type != "number" {
|
24
|
+
@error "Expected a number (integer), but got a "
|
25
|
+
+ "#{$actual-input-type}.";
|
26
|
+
}
|
27
|
+
|
28
|
+
@if not map-has-key($govuk-spacing-points, $spacing-point) {
|
29
|
+
@error "Unknown spacing variable `#{$spacing-point}`. Make sure you are using a point from the spacing scale in `_settings/spacing.scss`.";
|
30
|
+
}
|
31
|
+
|
32
|
+
@return map-get($govuk-spacing-points, $spacing-point);
|
33
|
+
}
|
34
|
+
|
35
|
+
/// Responsive spacing
|
36
|
+
///
|
37
|
+
/// Adds responsive spacing (either padding or margin, depending on `$property`)
|
38
|
+
/// by fetching a 'spacing map' from the responsive spacing scale, which defines
|
39
|
+
/// different spacing values at different breakpoints.
|
40
|
+
///
|
41
|
+
/// To generate responsive spacing, use 'govuk-responsive-margin' or
|
42
|
+
/// 'govuk-responsive-padding' mixins
|
43
|
+
///
|
44
|
+
/// @param {Number} $responsive-spacing-point - Point on the responsive spacing
|
45
|
+
/// scale, corresponds to a map of breakpoints and spacing values
|
46
|
+
/// @param {String} $property - Property to add spacing to (e.g. 'margin')
|
47
|
+
/// @param {String} $direction [all] - Direction to add spacing to
|
48
|
+
/// (`top`, `right`, `bottom`, `left`, `all`)
|
49
|
+
/// @param {Boolean} $important [false] - Whether to mark as `!important`
|
50
|
+
/// @param {Number} $adjustment [false] - Offset to adjust spacing by
|
51
|
+
///
|
52
|
+
/// @access private
|
53
|
+
|
54
|
+
@mixin _govuk-responsive-spacing($responsive-spacing-point, $property, $direction: "all", $important: false, $adjustment: false) {
|
55
|
+
|
56
|
+
$actual-input-type: type-of($responsive-spacing-point);
|
57
|
+
@if $actual-input-type != "number" {
|
58
|
+
@error "Expected a number (integer), but got a " + "#{$actual-input-type}.";
|
59
|
+
}
|
60
|
+
|
61
|
+
@if not map-has-key($govuk-spacing-responsive-scale, $responsive-spacing-point) {
|
62
|
+
@error "Unknown spacing point `#{$responsive-spacing-point}`. Make sure you are using a point from the "
|
63
|
+
+ "responsive spacing scale in `_settings/spacing.scss`.";
|
64
|
+
}
|
65
|
+
|
66
|
+
// Make sure that the return value from `_settings/spacing.scss` is a map.
|
67
|
+
$scale-map: map-get($govuk-spacing-responsive-scale, $responsive-spacing-point);
|
68
|
+
$actual-map-type: type-of($scale-map);
|
69
|
+
@if $actual-map-type != "map" {
|
70
|
+
@error "Expected a number (integer), but got a "
|
71
|
+
+ "#{$actual-map-type}. Make sure you are using a map to set the responsive spacing in `_settings/spacing.scss`)";
|
72
|
+
}
|
73
|
+
|
74
|
+
// Loop through each breakpoint in the map
|
75
|
+
@each $breakpoint, $breakpoint-value in $scale-map {
|
76
|
+
|
77
|
+
@if ($adjustment) {
|
78
|
+
$breakpoint-value: $breakpoint-value + $adjustment;
|
79
|
+
}
|
80
|
+
|
81
|
+
// The 'null' breakpoint is for mobile.
|
82
|
+
@if $breakpoint == null {
|
83
|
+
|
84
|
+
@if $direction == all {
|
85
|
+
#{$property}: $breakpoint-value iff($important, !important);
|
86
|
+
} @else {
|
87
|
+
#{$property}-#{$direction}: $breakpoint-value iff($important, !important);
|
88
|
+
}
|
89
|
+
} @else {
|
90
|
+
@include govuk-media-query($from: $breakpoint) {
|
91
|
+
@if $direction == all {
|
92
|
+
#{$property}: $breakpoint-value iff($important, !important);
|
93
|
+
} @else {
|
94
|
+
#{$property}-#{$direction}: $breakpoint-value iff($important, !important);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
/// Responsive margin
|
102
|
+
///
|
103
|
+
/// Adds responsive margin by fetching a 'spacing map' from the responsive
|
104
|
+
/// spacing scale, which defines different spacing values at different
|
105
|
+
/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.
|
106
|
+
///
|
107
|
+
/// @see {mixin} _govuk-responsive-spacing
|
108
|
+
///
|
109
|
+
/// @param {Number} $responsive-spacing-point - Point on the responsive spacing
|
110
|
+
/// scale, corresponds to a map of breakpoints and spacing values
|
111
|
+
/// @param {String} $direction [all] - Direction to add spacing to
|
112
|
+
/// (`top`, `right`, `bottom`, `left`, `all`)
|
113
|
+
/// @param {Boolean} $important [false] - Whether to mark as `!important`
|
114
|
+
/// @param {Number} $adjustment [false] - Offset to adjust spacing by
|
115
|
+
///
|
116
|
+
/// @example scss
|
117
|
+
/// .element {
|
118
|
+
/// @include govuk-responsive-margin(6, "left", $adjustment: 1px);
|
119
|
+
/// }
|
120
|
+
///
|
121
|
+
/// @access public
|
122
|
+
|
123
|
+
@mixin govuk-responsive-margin($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false) {
|
124
|
+
@include _govuk-responsive-spacing($responsive-spacing-point, "margin", $direction, $important, $adjustment);
|
125
|
+
}
|
126
|
+
|
127
|
+
/// Responsive padding
|
128
|
+
///
|
129
|
+
/// Adds responsive padding by fetching a 'spacing map' from the responsive
|
130
|
+
/// spacing scale, which defines different spacing values at different
|
131
|
+
/// breakpoints. Wrapper for the `_govuk-responsive-spacing` mixin.
|
132
|
+
///
|
133
|
+
/// @see {mixin} _govuk-responsive-spacing
|
134
|
+
///
|
135
|
+
/// @param {Number} $responsive-spacing-point - Point on the responsive spacing
|
136
|
+
/// scale, corresponds to a map of breakpoints and spacing values
|
137
|
+
/// @param {String} $direction [all] - Direction to add spacing to
|
138
|
+
/// (`top`, `right`, `bottom`, `left`, `all`)
|
139
|
+
/// @param {Boolean} $important [false] - Whether to mark as `!important`
|
140
|
+
/// @param {Number} $adjustment [false] - Offset to adjust spacing
|
141
|
+
///
|
142
|
+
/// @example scss
|
143
|
+
/// .element {
|
144
|
+
/// @include govuk-responsive-padding(6, "left", $adjustment: 1px);
|
145
|
+
/// }
|
146
|
+
///
|
147
|
+
/// @access public
|
148
|
+
|
149
|
+
|
150
|
+
@mixin govuk-responsive-padding($responsive-spacing-point, $direction: "all", $important: false, $adjustment: false) {
|
151
|
+
@include _govuk-responsive-spacing($responsive-spacing-point, "padding", $direction, $important, $adjustment);
|
152
|
+
}
|