govuk_publishing_components 62.0.0 → 62.1.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/option-select.js +4 -3
- data/app/assets/javascripts/govuk_publishing_components/lib/filter-list.js +48 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +373 -245
- data/app/assets/stylesheets/component_guide/application.scss +1 -42
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +5 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +6 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/_option-select.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +6 -38
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +2 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss +6 -1
- data/app/controllers/govuk_publishing_components/applications_page_controller.rb +50 -0
- data/app/models/govuk_publishing_components/applications_page.rb +64 -0
- data/app/views/govuk_publishing_components/applications_page/_table-content.html.erb +39 -0
- data/app/views/govuk_publishing_components/applications_page/show.html.erb +37 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +5 -1
- data/app/views/govuk_publishing_components/component_guide/_component_list.html.erb +14 -0
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +3 -3
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +50 -75
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +7 -7
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +27 -25
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +6 -0
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +7 -1
- data/config/routes.rb +1 -0
- data/lib/govuk_publishing_components/minitest/component_guide_test.rb +1 -1
- data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +7 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +37 -133
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +37 -133
- data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/fixtures.json +34 -29
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/macro-options.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-default.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-conditional-reveal.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-divider-and-none.html +30 -30
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-error.html +26 -26
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small-with-long-text.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-small.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-conditional-items.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-and-none.html +30 -30
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-divider-none-and-conditional-items.html +40 -40
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-error-message.html +32 -32
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-hints-on-items.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-legend-as-a-page-heading.html +27 -27
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-optional-form-group-classes-showing-group-error.html +36 -36
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-pre-checked-values.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template-with-very-long-option-text.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +2 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +36 -132
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +35 -6
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/fixtures.json +17 -0
- data/node_modules/govuk-frontend/dist/govuk/components/file-upload/template-enhanced-multiple-files.html +10 -0
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +20 -20
- data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +7 -15
- data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/fixtures.json +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template-with-many-pages.html +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/pagination/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/radios/fixtures.json +36 -31
- data/node_modules/govuk-frontend/dist/govuk/components/radios/macro-options.json +3 -3
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-default.html +17 -17
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-inline.html +19 -19
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-inline.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-a-divider.html +24 -24
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-conditional-reveal.html +27 -27
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-error.html +26 -26
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-hint.html +25 -25
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small-with-long-text.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-small.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-a-divider.html +24 -24
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-item-checked.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items-and-pre-checked-value.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-conditional-items.html +35 -35
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-fieldset-and-error-message.html +20 -20
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hint.html +19 -19
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-hints-on-items.html +23 -23
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-legend-as-page-heading.html +21 -21
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-optional-form-group-classes-showing-group-error.html +36 -36
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template-with-very-long-option-text.html +28 -28
- data/node_modules/govuk-frontend/dist/govuk/components/radios/template.njk +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +1 -7
- data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +16 -16
- data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/fixtures.json +46 -0
- data/node_modules/govuk-frontend/dist/govuk/components/task-list/template-forced-hover-state.html +37 -0
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +1 -7
- data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +3 -3
- data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css +2 -2
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.css.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
- data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +34 -0
- data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
- data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +4 -4
- data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +1 -126
- data/node_modules/govuk-frontend/dist/govuk/i18n.mjs.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
- data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
- data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +7 -0
- data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss.map +1 -1
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
- data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss.map +1 -1
- data/node_modules/govuk-frontend/govuk-prototype-kit.config.json +1 -1
- data/node_modules/govuk-frontend/package.json +9 -8
- metadata +9 -4
- data/app/assets/javascripts/component_guide/filter-components.js +0 -35
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
- data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss.map +0 -1
|
@@ -117,7 +117,7 @@ class FileUpload extends ConfigurableComponent {
|
|
|
117
117
|
if (this.$button.disabled) return;
|
|
118
118
|
if (event.target instanceof Node) {
|
|
119
119
|
if (this.$root.contains(event.target)) {
|
|
120
|
-
if (event.dataTransfer &&
|
|
120
|
+
if (event.dataTransfer && this.canDrop(event.dataTransfer)) {
|
|
121
121
|
if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {
|
|
122
122
|
this.showDraggingState();
|
|
123
123
|
this.$announcements.innerText = this.i18n.t('enteredDropZone');
|
|
@@ -139,12 +139,30 @@ class FileUpload extends ConfigurableComponent {
|
|
|
139
139
|
}
|
|
140
140
|
onDrop(event) {
|
|
141
141
|
event.preventDefault();
|
|
142
|
-
if (event.dataTransfer &&
|
|
142
|
+
if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {
|
|
143
143
|
this.$input.files = event.dataTransfer.files;
|
|
144
144
|
this.$input.dispatchEvent(new CustomEvent('change'));
|
|
145
145
|
this.hideDraggingState();
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
canFillInput(dataTransfer) {
|
|
149
|
+
return this.matchesInputCapacity(dataTransfer.files.length);
|
|
150
|
+
}
|
|
151
|
+
canDrop(dataTransfer) {
|
|
152
|
+
if (dataTransfer.items.length) {
|
|
153
|
+
return this.matchesInputCapacity(countFileItems(dataTransfer.items));
|
|
154
|
+
}
|
|
155
|
+
if (dataTransfer.types.length) {
|
|
156
|
+
return dataTransfer.types.includes('Files');
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
matchesInputCapacity(numberOfFiles) {
|
|
161
|
+
if (this.$input.multiple) {
|
|
162
|
+
return numberOfFiles > 0;
|
|
163
|
+
}
|
|
164
|
+
return numberOfFiles === 1;
|
|
165
|
+
}
|
|
148
166
|
onChange() {
|
|
149
167
|
const fileCount = this.$input.files.length;
|
|
150
168
|
if (fileCount === 0) {
|
|
@@ -191,6 +209,13 @@ class FileUpload extends ConfigurableComponent {
|
|
|
191
209
|
this.$root.classList.toggle('govuk-drop-zone--disabled', this.$button.disabled);
|
|
192
210
|
}
|
|
193
211
|
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Counts the number of `DataTransferItem` whose kind is `file`
|
|
215
|
+
*
|
|
216
|
+
* @param {DataTransferItemList} list - The list
|
|
217
|
+
* @returns {number} - The number of items whose kind is `file` in the list
|
|
218
|
+
*/
|
|
194
219
|
FileUpload.moduleName = 'govuk-file-upload';
|
|
195
220
|
FileUpload.defaults = Object.freeze({
|
|
196
221
|
i18n: {
|
|
@@ -212,10 +237,14 @@ FileUpload.schema = Object.freeze({
|
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
239
|
});
|
|
215
|
-
function
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
240
|
+
function countFileItems(list) {
|
|
241
|
+
let result = 0;
|
|
242
|
+
for (let i = 0; i < list.length; i++) {
|
|
243
|
+
if (list[i].kind === 'file') {
|
|
244
|
+
result++;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return result;
|
|
219
248
|
}
|
|
220
249
|
|
|
221
250
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload.mjs","sources":["../../../../src/govuk/components/file-upload/file-upload.mjs"],"sourcesContent":["import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { formatErrorMessage } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nexport class FileUpload extends ConfigurableComponent {\n /**\n * @private\n * @type {HTMLFileInputElement}\n */\n $input\n\n /**\n * @private\n */\n $button\n\n /**\n * @private\n */\n $status\n\n /** @private */\n i18n\n\n /** @private */\n id\n\n /** @private */\n $announcements\n\n /**\n * @private\n * @type {boolean | undefined}\n */\n enteredAnotherElement\n\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n const $input = this.$root.querySelector('input')\n\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n })\n }\n\n if ($input.type !== 'file') {\n throw new ElementError(\n formatErrorMessage(\n FileUpload,\n 'File input (`<input type=\"file\">`) attribute (`type`) is not `file`'\n )\n )\n }\n\n this.$input = /** @type {HTMLFileInputElement} */ ($input)\n\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n })\n }\n\n this.id = this.$input.id\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue(this.$root, 'lang')\n })\n\n const $label = this.findLabel()\n // Add an ID to the label if it doesn't have one already\n // so it can be referenced by `aria-labelledby`\n if (!$label.id) {\n $label.id = `${this.id}-label`\n }\n\n // we need to copy the 'id' of the root element\n // to the new button replacement element\n // so that focus will work in the error summary\n this.$input.id = `${this.id}-input`\n\n // Hide the native input\n this.$input.setAttribute('hidden', 'true')\n\n // Create the file selection button\n const $button = document.createElement('button')\n $button.classList.add('govuk-file-upload-button')\n $button.type = 'button'\n $button.id = this.id\n $button.classList.add('govuk-file-upload-button--empty')\n\n // Copy `aria-describedby` if present so hints and errors\n // are associated to the `<button>`\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby')\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy)\n }\n\n // Create status element that shows what/how many files are selected\n const $status = document.createElement('span')\n $status.className = 'govuk-body govuk-file-upload-button__status'\n $status.setAttribute('aria-live', 'polite')\n $status.innerText = this.i18n.t('noFileChosen')\n\n $button.appendChild($status)\n\n const commaSpan = document.createElement('span')\n commaSpan.className = 'govuk-visually-hidden'\n commaSpan.innerText = ', '\n commaSpan.id = `${this.id}-comma`\n\n $button.appendChild(commaSpan)\n\n const containerSpan = document.createElement('span')\n containerSpan.className =\n 'govuk-file-upload-button__pseudo-button-container'\n\n const buttonSpan = document.createElement('span')\n buttonSpan.className =\n 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'\n buttonSpan.innerText = this.i18n.t('chooseFilesButton')\n\n containerSpan.appendChild(buttonSpan)\n\n // Add a space so the button and instruction read correctly\n // when CSS is disabled\n containerSpan.insertAdjacentText('beforeend', ' ')\n\n const instructionSpan = document.createElement('span')\n instructionSpan.className =\n 'govuk-body govuk-file-upload-button__instruction'\n instructionSpan.innerText = this.i18n.t('dropInstruction')\n\n containerSpan.appendChild(instructionSpan)\n\n $button.appendChild(containerSpan)\n $button.setAttribute(\n 'aria-labelledby',\n `${$label.id} ${commaSpan.id} ${$button.id}`\n )\n $button.addEventListener('click', this.onClick.bind(this))\n $button.addEventListener('dragover', (event) => {\n // prevent default to allow drop\n event.preventDefault()\n })\n\n // Assemble these all together\n this.$root.insertAdjacentElement('afterbegin', $button)\n\n this.$input.setAttribute('tabindex', '-1')\n this.$input.setAttribute('aria-hidden', 'true')\n\n // Make all these new variables available to the module\n this.$button = $button\n this.$status = $status\n\n // Bind change event to the underlying input\n this.$input.addEventListener('change', this.onChange.bind(this))\n\n // Synchronise the `disabled` state between the button and underlying input\n this.updateDisabledState()\n this.observeDisabledState()\n\n // Handle drop zone visibility\n // A live region to announce when users enter or leave the drop zone\n this.$announcements = document.createElement('span')\n this.$announcements.classList.add('govuk-file-upload-announcements')\n this.$announcements.classList.add('govuk-visually-hidden')\n this.$announcements.setAttribute('aria-live', 'assertive')\n this.$root.insertAdjacentElement('afterend', this.$announcements)\n\n // if there is no CSS and input is hidden\n // button will need to handle drop event\n this.$button.addEventListener('drop', this.onDrop.bind(this))\n\n // While user is dragging, it gets a little more complex because of Safari.\n // Safari doesn't fill `relatedTarget` on `dragleave` (nor `dragenter`).\n // This means we can't use `relatedTarget` to:\n // - check if the user is still within the wrapper\n // (`relatedTarget` being a descendant of the wrapper)\n // - check if the user is still over the viewport\n // (`relatedTarget` being null if outside)\n\n // Thanks to `dragenter` bubbling, we can listen on the `document` with a\n // single function and update the visibility based on whether we entered a\n // node inside or outside the wrapper.\n document.addEventListener(\n 'dragenter',\n this.updateDropzoneVisibility.bind(this)\n )\n\n // To detect if we're outside the document, we can track if there was a\n // `dragenter` event preceding a `dragleave`. If there wasn't, this means\n // we're outside the document.\n //\n // The order of events is guaranteed by the HTML specs:\n // https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true\n })\n\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n\n this.enteredAnotherElement = false\n })\n }\n\n /**\n * Updates the visibility of the dropzone as users enters the various elements on the page\n *\n * @private\n * @param {DragEvent} event - The `dragenter` event\n */\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return\n\n // DOM interfaces only type `event.target` as `EventTarget`\n // so we first need to make sure it's a `Node`\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n // Only update the class and make the announcement if not already visible\n // to avoid repeated announcements on NVDA (2024.4) + Firefox (133)\n if (\n !this.$button.classList.contains(\n 'govuk-file-upload-button--dragging'\n )\n ) {\n this.showDraggingState()\n this.$announcements.innerText = this.i18n.t('enteredDropZone')\n }\n }\n } else {\n // Only hide the dropzone if it is visible to prevent announcing user\n // left the drop zone when they enter the page but haven't reached yet\n // the file upload component\n if (\n this.$button.classList.contains('govuk-file-upload-button--dragging')\n ) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n }\n }\n }\n\n /**\n * Show the drop zone visually\n *\n * @private\n */\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging')\n }\n\n /**\n * Hides the drop zone visually\n *\n * @private\n */\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging')\n }\n\n /**\n * Handles user dropping on the component\n *\n * @private\n * @param {DragEvent} event - The `dragenter` event\n */\n onDrop(event) {\n event.preventDefault()\n\n if (event.dataTransfer && isContainingFiles(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files\n\n // Dispatch a `change` event so external code that would rely on the `<input>`\n // dispatching an event when files are dropped still work.\n // Use a `CustomEvent` so our events are distinguishable from browser's native events\n this.$input.dispatchEvent(new CustomEvent('change'))\n\n this.hideDraggingState()\n }\n }\n\n /**\n * Check if the value of the underlying input has changed\n *\n * @private\n */\n onChange() {\n const fileCount = this.$input.files.length\n\n if (fileCount === 0) {\n // If there are no files, show the default selection text\n this.$status.innerText = this.i18n.t('noFileChosen')\n this.$button.classList.add('govuk-file-upload-button--empty')\n } else {\n if (\n // If there is 1 file, just show the file name\n fileCount === 1\n ) {\n this.$status.innerText = this.$input.files[0].name\n } else {\n // Otherwise, tell the user how many files are selected\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n })\n }\n\n this.$button.classList.remove('govuk-file-upload-button--empty')\n }\n }\n\n /**\n * Looks up the `<label>` element associated to the field\n *\n * @private\n * @returns {HTMLElement} The `<label>` element associated to the field\n * @throws {ElementError} If the `<label>` cannot be found\n */\n findLabel() {\n // Use `label` in the selector so TypeScript knows the type fo `HTMLElement`\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`)\n\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n })\n }\n\n return $label\n }\n\n /**\n * When the button is clicked, emulate clicking the actual, hidden file input\n *\n * @private\n */\n onClick() {\n this.$input.click()\n }\n\n /**\n * Create a mutation observer to check if the input's attributes altered.\n *\n * @private\n */\n observeDisabledState() {\n const observer = new MutationObserver((mutationList) => {\n for (const mutation of mutationList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'disabled'\n ) {\n this.updateDisabledState()\n }\n }\n })\n\n observer.observe(this.$input, {\n attributes: true\n })\n }\n\n /**\n * Synchronise the `disabled` state between the input and replacement button.\n *\n * @private\n */\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled\n\n this.$root.classList.toggle(\n 'govuk-drop-zone--disabled',\n this.$button.disabled\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-file-upload'\n\n /**\n * File upload default config\n *\n * @see {@link FileUploadConfig}\n * @constant\n * @type {FileUploadConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n // the 'one' string isn't used as the component displays the filename\n // instead, however it's here for coverage's sake\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n })\n\n /**\n * File upload config schema\n *\n * @constant\n * @satisfies {Schema<FileUploadConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' }\n }\n })\n}\n\n/**\n * Checks if the given `DataTransfer` contains files\n *\n * @internal\n * @param {DataTransfer} dataTransfer - The `DataTransfer` to check\n * @returns {boolean} - `true` if it contains files or we can't infer it, `false` otherwise\n */\nfunction isContainingFiles(dataTransfer) {\n // Safari sometimes does not provide info about types :'(\n // In which case best not to assume anything and try to set the files\n const hasNoTypesInfo = dataTransfer.types.length === 0\n\n // When dragging images, there's a mix of mime types + Files\n // which we can't assign to the native input\n const isDraggingFiles = dataTransfer.types.some((type) => type === 'Files')\n\n return hasNoTypesInfo || isDraggingFiles\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n"],"names":["FileUpload","ConfigurableComponent","constructor","$root","config","$input","$button","$status","i18n","id","$announcements","enteredAnotherElement","querySelector","ElementError","component","identifier","type","formatErrorMessage","I18n","locale","closestAttributeValue","$label","findLabel","setAttribute","document","createElement","classList","add","ariaDescribedBy","getAttribute","className","innerText","t","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","addEventListener","onClick","bind","event","preventDefault","insertAdjacentElement","onChange","updateDisabledState","observeDisabledState","onDrop","updateDropzoneVisibility","disabled","hideDraggingState","target","Node","contains","dataTransfer","isContainingFiles","showDraggingState","remove","files","dispatchEvent","CustomEvent","fileCount","length","name","count","click","observer","MutationObserver","mutationList","mutation","attributeName","observe","attributes","toggle","moduleName","defaults","Object","freeze","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","one","other","enteredDropZone","leftDropZone","schema","properties","hasNoTypesInfo","types","isDraggingFiles","some"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,SAASC,qBAAqB,CAAC;AAgCpD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAC9B,IAAA,KAAK,CAACD,KAAK,EAAEC,MAAM,CAAC;AAAA,IAAA,IAAA,CAhCtBC,MAAM,GAAA,MAAA;AAAA,IAAA,IAAA,CAKNC,OAAO,GAAA,MAAA;AAAA,IAAA,IAAA,CAKPC,OAAO,GAAA,MAAA;AAAA,IAAA,IAAA,CAGPC,IAAI,GAAA,MAAA;AAAA,IAAA,IAAA,CAGJC,EAAE,GAAA,MAAA;AAAA,IAAA,IAAA,CAG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AAAA,IAAI,EAAE;AACJuE,IAAAA,iBAAiB,EAAE,aAAa;AAChCC,IAAAA,eAAe,EAAE,cAAc;AAC/BC,IAAAA,YAAY,EAAE,gBAAgB;AAC9BC,IAAAA,mBAAmB,EAAE;AAGnBC,MAAAA,GAAG,EAAE,sBAAsB;AAC3BC,MAAAA,KAAK,EAAE;KACR;AACDC,IAAAA,eAAe,EAAE,mBAAmB;AACpCC,IAAAA,YAAY,EAAE;AAChB;AACF,CAAC,CAAC;AA9ZStF,UAAU,CAsaduF,MAAM,GAAGV,MAAM,CAACC,MAAM,CAAC;AAC5BU,EAAAA,UAAU,EAAE;AACVhF,IAAAA,IAAI,EAAE;AAAEQ,MAAAA,IAAI,EAAE;AAAS;AACzB;AACF,CAAC,CAAC;AAUJ,SAASwC,iBAAiBA,CAACD,YAAY,EAAE;EAGvC,MAAMkC,cAAc,GAAGlC,YAAY,CAACmC,KAAK,CAAC3B,MAAM,KAAK,CAAC;AAItD,EAAA,MAAM4B,eAAe,GAAGpC,YAAY,CAACmC,KAAK,CAACE,IAAI,CAAE5E,IAAI,IAAKA,IAAI,KAAK,OAAO,CAAC;EAE3E,OAAOyE,cAAc,IAAIE,eAAe;AAC1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"file-upload.mjs","sources":["../../../../src/govuk/components/file-upload/file-upload.mjs"],"sourcesContent":["import { closestAttributeValue } from '../../common/closest-attribute-value.mjs'\nimport { ConfigurableComponent } from '../../common/configuration.mjs'\nimport { formatErrorMessage } from '../../common/index.mjs'\nimport { ElementError } from '../../errors/index.mjs'\nimport { I18n } from '../../i18n.mjs'\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nexport class FileUpload extends ConfigurableComponent {\n /**\n * @private\n * @type {HTMLFileInputElement}\n */\n $input\n\n /**\n * @private\n */\n $button\n\n /**\n * @private\n */\n $status\n\n /** @private */\n i18n\n\n /** @private */\n id\n\n /** @private */\n $announcements\n\n /**\n * @private\n * @type {boolean | undefined}\n */\n enteredAnotherElement\n\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config)\n\n const $input = this.$root.querySelector('input')\n\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n })\n }\n\n if ($input.type !== 'file') {\n throw new ElementError(\n formatErrorMessage(\n FileUpload,\n 'File input (`<input type=\"file\">`) attribute (`type`) is not `file`'\n )\n )\n }\n\n this.$input = /** @type {HTMLFileInputElement} */ ($input)\n\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n })\n }\n\n this.id = this.$input.id\n\n this.i18n = new I18n(this.config.i18n, {\n // Read the fallback if necessary rather than have it set in the defaults\n locale: closestAttributeValue(this.$root, 'lang')\n })\n\n const $label = this.findLabel()\n // Add an ID to the label if it doesn't have one already\n // so it can be referenced by `aria-labelledby`\n if (!$label.id) {\n $label.id = `${this.id}-label`\n }\n\n // we need to copy the 'id' of the root element\n // to the new button replacement element\n // so that focus will work in the error summary\n this.$input.id = `${this.id}-input`\n\n // Hide the native input\n this.$input.setAttribute('hidden', 'true')\n\n // Create the file selection button\n const $button = document.createElement('button')\n $button.classList.add('govuk-file-upload-button')\n $button.type = 'button'\n $button.id = this.id\n $button.classList.add('govuk-file-upload-button--empty')\n\n // Copy `aria-describedby` if present so hints and errors\n // are associated to the `<button>`\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby')\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy)\n }\n\n // Create status element that shows what/how many files are selected\n const $status = document.createElement('span')\n $status.className = 'govuk-body govuk-file-upload-button__status'\n $status.setAttribute('aria-live', 'polite')\n $status.innerText = this.i18n.t('noFileChosen')\n\n $button.appendChild($status)\n\n const commaSpan = document.createElement('span')\n commaSpan.className = 'govuk-visually-hidden'\n commaSpan.innerText = ', '\n commaSpan.id = `${this.id}-comma`\n\n $button.appendChild(commaSpan)\n\n const containerSpan = document.createElement('span')\n containerSpan.className =\n 'govuk-file-upload-button__pseudo-button-container'\n\n const buttonSpan = document.createElement('span')\n buttonSpan.className =\n 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button'\n buttonSpan.innerText = this.i18n.t('chooseFilesButton')\n\n containerSpan.appendChild(buttonSpan)\n\n // Add a space so the button and instruction read correctly\n // when CSS is disabled\n containerSpan.insertAdjacentText('beforeend', ' ')\n\n const instructionSpan = document.createElement('span')\n instructionSpan.className =\n 'govuk-body govuk-file-upload-button__instruction'\n instructionSpan.innerText = this.i18n.t('dropInstruction')\n\n containerSpan.appendChild(instructionSpan)\n\n $button.appendChild(containerSpan)\n $button.setAttribute(\n 'aria-labelledby',\n `${$label.id} ${commaSpan.id} ${$button.id}`\n )\n $button.addEventListener('click', this.onClick.bind(this))\n $button.addEventListener('dragover', (event) => {\n // prevent default to allow drop\n event.preventDefault()\n })\n\n // Assemble these all together\n this.$root.insertAdjacentElement('afterbegin', $button)\n\n this.$input.setAttribute('tabindex', '-1')\n this.$input.setAttribute('aria-hidden', 'true')\n\n // Make all these new variables available to the module\n this.$button = $button\n this.$status = $status\n\n // Bind change event to the underlying input\n this.$input.addEventListener('change', this.onChange.bind(this))\n\n // Synchronise the `disabled` state between the button and underlying input\n this.updateDisabledState()\n this.observeDisabledState()\n\n // Handle drop zone visibility\n // A live region to announce when users enter or leave the drop zone\n this.$announcements = document.createElement('span')\n this.$announcements.classList.add('govuk-file-upload-announcements')\n this.$announcements.classList.add('govuk-visually-hidden')\n this.$announcements.setAttribute('aria-live', 'assertive')\n this.$root.insertAdjacentElement('afterend', this.$announcements)\n\n // if there is no CSS and input is hidden\n // button will need to handle drop event\n this.$button.addEventListener('drop', this.onDrop.bind(this))\n\n // While user is dragging, it gets a little more complex because of Safari.\n // Safari doesn't fill `relatedTarget` on `dragleave` (nor `dragenter`).\n // This means we can't use `relatedTarget` to:\n // - check if the user is still within the wrapper\n // (`relatedTarget` being a descendant of the wrapper)\n // - check if the user is still over the viewport\n // (`relatedTarget` being null if outside)\n\n // Thanks to `dragenter` bubbling, we can listen on the `document` with a\n // single function and update the visibility based on whether we entered a\n // node inside or outside the wrapper.\n document.addEventListener(\n 'dragenter',\n this.updateDropzoneVisibility.bind(this)\n )\n\n // To detect if we're outside the document, we can track if there was a\n // `dragenter` event preceding a `dragleave`. If there wasn't, this means\n // we're outside the document.\n //\n // The order of events is guaranteed by the HTML specs:\n // https://html.spec.whatwg.org/multipage/dnd.html#drag-and-drop-processing-model\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true\n })\n\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n\n this.enteredAnotherElement = false\n })\n }\n\n /**\n * Updates the visibility of the dropzone as users enters the various elements on the page\n *\n * @private\n * @param {DragEvent} event - The `dragenter` event\n */\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return\n\n // DOM interfaces only type `event.target` as `EventTarget`\n // so we first need to make sure it's a `Node`\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && this.canDrop(event.dataTransfer)) {\n // Only update the class and make the announcement if not already visible\n // to avoid repeated announcements on NVDA (2024.4) + Firefox (133)\n if (\n !this.$button.classList.contains(\n 'govuk-file-upload-button--dragging'\n )\n ) {\n this.showDraggingState()\n this.$announcements.innerText = this.i18n.t('enteredDropZone')\n }\n }\n } else {\n // Only hide the dropzone if it is visible to prevent announcing user\n // left the drop zone when they enter the page but haven't reached yet\n // the file upload component\n if (\n this.$button.classList.contains('govuk-file-upload-button--dragging')\n ) {\n this.hideDraggingState()\n this.$announcements.innerText = this.i18n.t('leftDropZone')\n }\n }\n }\n }\n\n /**\n * Show the drop zone visually\n *\n * @private\n */\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging')\n }\n\n /**\n * Hides the drop zone visually\n *\n * @private\n */\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging')\n }\n\n /**\n * Handles user dropping on the component\n *\n * @private\n * @param {DragEvent} event - The `dragenter` event\n */\n onDrop(event) {\n event.preventDefault()\n\n if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files\n\n // Dispatch a `change` event so external code that would rely on the `<input>`\n // dispatching an event when files are dropped still work.\n // Use a `CustomEvent` so our events are distinguishable from browser's native events\n this.$input.dispatchEvent(new CustomEvent('change'))\n\n this.hideDraggingState()\n }\n }\n\n /**\n * Confirms if enhanced `<input>` can be filled with files from the given `DataTransfer`\n *\n * @param {DataTransfer} dataTransfer - The `DataTransfer` being dropped\n * @returns {boolean} - true if the `DataTransfer` contains files, in number matching the `multiple` attribute of the original `<input>`\n * @private\n */\n canFillInput(dataTransfer) {\n return this.matchesInputCapacity(dataTransfer.files.length)\n }\n\n /**\n * Confirms if the content of a `DataTransfer` dragged over component can be dropped\n *\n * Unfortunately, there's a certain level of uncertainty in Safari which does not\n * even provide a list of `items` while dragging (and seems to even miss the `types` sometimes)\n *\n * @param {DataTransfer} dataTransfer - The `DataTransfer` being dragged\n * @returns {boolean} - true if the `DataTransfer` looks OK for filling the input, false otherwise\n * @private\n */\n canDrop(dataTransfer) {\n // If the browser is kind enough to give a list of items, we'll use that as source of truth\n if (dataTransfer.items.length) {\n return this.matchesInputCapacity(countFileItems(dataTransfer.items))\n }\n\n // If we have some type information, we'll use that\n if (dataTransfer.types.length) {\n return dataTransfer.types.includes('Files')\n }\n\n // If we have nothing to go by, we'll assume things are OK\n // until we have a more accurate picture inside the `drop` event\n return true\n }\n\n /**\n * Confirms the given number of files matches that allowed by the enhanced `<input>`\n *\n * @param {number} numberOfFiles - The number of files\n * @returns {boolean} - `true` if the enhanced `<input>` can accept that number of files\n * @private\n */\n matchesInputCapacity(numberOfFiles) {\n if (this.$input.multiple) {\n return numberOfFiles > 0\n }\n\n return numberOfFiles === 1\n }\n\n /**\n * Check if the value of the underlying input has changed\n *\n * @private\n */\n onChange() {\n const fileCount = this.$input.files.length\n\n if (fileCount === 0) {\n // If there are no files, show the default selection text\n this.$status.innerText = this.i18n.t('noFileChosen')\n this.$button.classList.add('govuk-file-upload-button--empty')\n } else {\n if (\n // If there is 1 file, just show the file name\n fileCount === 1\n ) {\n this.$status.innerText = this.$input.files[0].name\n } else {\n // Otherwise, tell the user how many files are selected\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n })\n }\n\n this.$button.classList.remove('govuk-file-upload-button--empty')\n }\n }\n\n /**\n * Looks up the `<label>` element associated to the field\n *\n * @private\n * @returns {HTMLElement} The `<label>` element associated to the field\n * @throws {ElementError} If the `<label>` cannot be found\n */\n findLabel() {\n // Use `label` in the selector so TypeScript knows the type fo `HTMLElement`\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`)\n\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n })\n }\n\n return $label\n }\n\n /**\n * When the button is clicked, emulate clicking the actual, hidden file input\n *\n * @private\n */\n onClick() {\n this.$input.click()\n }\n\n /**\n * Create a mutation observer to check if the input's attributes altered.\n *\n * @private\n */\n observeDisabledState() {\n const observer = new MutationObserver((mutationList) => {\n for (const mutation of mutationList) {\n if (\n mutation.type === 'attributes' &&\n mutation.attributeName === 'disabled'\n ) {\n this.updateDisabledState()\n }\n }\n })\n\n observer.observe(this.$input, {\n attributes: true\n })\n }\n\n /**\n * Synchronise the `disabled` state between the input and replacement button.\n *\n * @private\n */\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled\n\n this.$root.classList.toggle(\n 'govuk-drop-zone--disabled',\n this.$button.disabled\n )\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'govuk-file-upload'\n\n /**\n * File upload default config\n *\n * @see {@link FileUploadConfig}\n * @constant\n * @type {FileUploadConfig}\n */\n static defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n // the 'one' string isn't used as the component displays the filename\n // instead, however it's here for coverage's sake\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n })\n\n /**\n * File upload config schema\n *\n * @constant\n * @satisfies {Schema<FileUploadConfig>}\n */\n static schema = Object.freeze({\n properties: {\n i18n: { type: 'object' }\n }\n })\n}\n\n/**\n * Counts the number of `DataTransferItem` whose kind is `file`\n *\n * @param {DataTransferItemList} list - The list\n * @returns {number} - The number of items whose kind is `file` in the list\n */\nfunction countFileItems(list) {\n let result = 0\n\n // `DataTransferItemList` is not iterable\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < list.length; i++) {\n if (list[i].kind === 'file') {\n result++\n }\n }\n return result\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n"],"names":["FileUpload","ConfigurableComponent","constructor","$root","config","$input","$button","$status","i18n","id","$announcements","enteredAnotherElement","querySelector","ElementError","component","identifier","type","formatErrorMessage","I18n","locale","closestAttributeValue","$label","findLabel","setAttribute","document","createElement","classList","add","ariaDescribedBy","getAttribute","className","innerText","t","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","addEventListener","onClick","bind","event","preventDefault","insertAdjacentElement","onChange","updateDisabledState","observeDisabledState","onDrop","updateDropzoneVisibility","disabled","hideDraggingState","target","Node","contains","dataTransfer","canDrop","showDraggingState","remove","canFillInput","files","dispatchEvent","CustomEvent","matchesInputCapacity","length","items","countFileItems","types","includes","numberOfFiles","multiple","fileCount","name","count","click","observer","MutationObserver","mutationList","mutation","attributeName","observe","attributes","toggle","moduleName","defaults","Object","freeze","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","one","other","enteredDropZone","leftDropZone","schema","properties","list","result","i","kind"],"mappings":";;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,SAASC,qBAAqB,CAAC;AAgCpD;AACF;AACA;AACA;AACEC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,MAAM,GAAG,EAAE,EAAE;AAC9B,IAAA,KAAK,CAACD,KAAK,EAAEC,MAAM,CAAC;AAAA,IAAA,IAAA,CAhCtBC,MAAM,GAAA,MAAA;AAAA,IAAA,IAAA,CAKNC,OAAO,GAAA,MAAA;AAAA,IAAA,IAAA,CAKPC,OAAO,GAAA,MAAA;AAAA,IAAA,IAAA,CAGPC,IAAI,GAAA,MAAA;AAAA,IAAA,IAAA,CAGJC,EAAE,GAAA,MAAA;AAAA,IAAA,IAAA,CAGFC,cAAc,GAAA,MAAA;AAAA,IAAA,IAAA,CA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AId,EAAA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACjC,MAAM,EAAEmC,CAAC,EAAE,EAAE;IACpC,IAAIF,IAAI,CAACE,CAAC,CAAC,CAACC,IAAI,KAAK,MAAM,EAAE;AAC3BF,MAAAA,MAAM,EAAE;AACV,IAAA;AACF,EAAA;AACA,EAAA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;;;"}
|
|
@@ -114,6 +114,23 @@
|
|
|
114
114
|
"screenshot": false,
|
|
115
115
|
"html": "<div class=\"govuk-form-group govuk-form-group--error\">\n <label class=\"govuk-label\" for=\"file-upload-3\">\n Upload a file\n </label>\n <div id=\"file-upload-3-hint\" class=\"govuk-hint\">\n Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.\n </div>\n <p id=\"file-upload-3-error\" class=\"govuk-error-message\">\n <span class=\"govuk-visually-hidden\">Error:</span> Error message goes here\n </p>\n <div\n class=\"govuk-drop-zone\"\n data-module=\"govuk-file-upload\">\n <input class=\"govuk-file-upload govuk-file-upload--error\" id=\"file-upload-3\" name=\"file-upload-3\" type=\"file\" aria-describedby=\"file-upload-3-hint file-upload-3-error\">\n </div>\n</div>"
|
|
116
116
|
},
|
|
117
|
+
{
|
|
118
|
+
"name": "enhanced, multiple files",
|
|
119
|
+
"options": {
|
|
120
|
+
"javascript": true,
|
|
121
|
+
"id": "file-upload-3",
|
|
122
|
+
"name": "file-upload-3",
|
|
123
|
+
"label": {
|
|
124
|
+
"text": "Upload files"
|
|
125
|
+
},
|
|
126
|
+
"multiple": true
|
|
127
|
+
},
|
|
128
|
+
"hidden": false,
|
|
129
|
+
"description": "",
|
|
130
|
+
"pageTemplateOptions": {},
|
|
131
|
+
"screenshot": false,
|
|
132
|
+
"html": "<div class=\"govuk-form-group\">\n <label class=\"govuk-label\" for=\"file-upload-3\">\n Upload files\n </label>\n <div\n class=\"govuk-drop-zone\"\n data-module=\"govuk-file-upload\">\n <input class=\"govuk-file-upload\" id=\"file-upload-3\" name=\"file-upload-3\" type=\"file\" multiple>\n </div>\n</div>"
|
|
133
|
+
},
|
|
117
134
|
{
|
|
118
135
|
"name": "with value",
|
|
119
136
|
"options": {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="govuk-form-group">
|
|
2
|
+
<label class="govuk-label" for="file-upload-3">
|
|
3
|
+
Upload files
|
|
4
|
+
</label>
|
|
5
|
+
<div
|
|
6
|
+
class="govuk-drop-zone"
|
|
7
|
+
data-module="govuk-file-upload">
|
|
8
|
+
<input class="govuk-file-upload" id="file-upload-3" name="file-upload-3" type="file" multiple>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
.govuk-footer__meta-item--grow {
|
|
61
61
|
flex: 1; // Support: Flexbox
|
|
62
|
-
@
|
|
62
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
63
63
|
flex-basis: 320px; // Support: Flexbox
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
.govuk-footer__licence-logo {
|
|
68
68
|
display: inline-block;
|
|
69
69
|
margin-right: govuk-spacing(2);
|
|
70
|
-
@
|
|
70
|
+
@media #{govuk-until-breakpoint(desktop)} {
|
|
71
71
|
margin-bottom: govuk-spacing(3);
|
|
72
72
|
}
|
|
73
73
|
vertical-align: top;
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
margin-bottom: govuk-spacing(6);
|
|
142
142
|
padding-bottom: govuk-spacing(4);
|
|
143
143
|
|
|
144
|
-
@
|
|
144
|
+
@media #{govuk-until-breakpoint(tablet)} {
|
|
145
145
|
padding-bottom: govuk-spacing(2);
|
|
146
146
|
}
|
|
147
147
|
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
column-gap: $govuk-gutter; // Support: Columns
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
@
|
|
175
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
176
176
|
.govuk-footer__list--columns-2 {
|
|
177
177
|
column-count: 2; // Support: Columns
|
|
178
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/govuk/components/footer/_index.scss"],"names":[],"mappings":"AAAA;EACE,2DAA2D;EAC3D,sCAAsC;EACtC,kDAAkD;;EAElD,6BAA6B;EAC7B,sCAAsC;EACtC,uCAAuC;;EAEvC;IACE,mEAAmE;IACnE,2CAA2C;IAC3C,8CAA8C;;IAE9C,0CAA0C;IAC1C,yBAAyB;IACzB;;;;KAIC;EACH;;EAEA;IACE,+BAA+B;EACjC;;EAEA;IACE,0BAA0B;IAC1B,8BAA8B;EAChC;;EAEA;IACE,SAAS,EAAE,8BAA8B;IACzC,6CAA6C;IAC7C,SAAS,EAAE,8BAA8B;IACzC,wBAAwB;IACxB;;;;KAIC;EACH;;EAEA;IACE,aAAa,EAAE,kBAAkB;IACjC,iCAAiC;IACjC,gCAAgC;IAChC,eAAe,EAAE,kBAAkB;IACnC,qBAAqB,EAAE,kBAAkB;IACzC,uBAAuB,EAAE,kBAAkB;EAC7C;;EAEA;IACE,gCAAgC;IAChC,+BAA+B;IAC/B,+BAA+B;EACjC;;EAEA;IACE,OAAO,EAAE,kBAAkB;IAC3B;MACE,iBAAiB,EAAE,kBAAkB;IACvC;EACF;;EAEA;IACE,qBAAqB;IACrB,8BAA8B;IAC9B;MACE,+BAA+B;IACjC;IACA,mBAAmB;IACnB,wEAAwE;IACxE,mDAAmD;IACnD,yBAAyB;EAC3B;;EAEA;IACE,qFAAqF;IACrF,qBAAqB;IACrB,+EAA+E;IAC/E,uCAAuC;IACvC,kBAAkB;EACpB;;EAEA;IACE,WAAW;IACX,cAAc;IACd,WAAW;IACX,kEAAkE;IAClE,oDAAoD;IACpD,4BAA4B;IAC5B,2BAA2B;IAC3B,iFAAiF;IACjF,kBAAkB;IAClB,mBAAmB;;IAEnB,kEAAkE;IAClE,qEAAqE;IACrE,+DAA+D;IAC/D,yEAAyE;IACzE,sBAAsB;IACtB;MACE,wBAAwB;MACxB,sDAA8C;cAA9C,8CAA8C;MAC9C,8BAAsB;cAAtB,sBAAsB;MACtB,6BAAqB;cAArB,qBAAqB;MACrB,mFAA2E;cAA3E,2EAA2E;;MAE3E,qEAAqE;MACrE,mEAAmE;MACnE,iCAAiC;MACjC;QACE,oBAAoB;MACtB;IACF;EACF;;EAEA;IACE,aAAa;IACb,+BAA+B;IAC/B,UAAU;EACZ;;EAEA;IACE,+BAA+B;EACjC;;EAEA;IACE,qBAAqB;IACrB,8BAA8B;IAC9B,+BAA+B;EACjC;;EAEA;IACE,+BAA+B;IAC/B,gCAAgC;;IAEhC;MACE,gCAAgC;IAClC;;IAEA,wBAAwB;IACxB;;;;KAIC;EACH;;EAEA;IACE,uBAAuB;IACvB,iCAAiC;IACjC,gCAAgC;EAClC;;EAEA;IACE,qBAAqB;IACrB,4BAA4B;IAC5B,mBAAmB;EACrB;;EAEA;IACE,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,yBAAyB,EAAE,kBAAkB;EAC/C;;EAEA;IACE;MACE,eAAe,EAAE,kBAAkB;IACrC;;IAEA;MACE,eAAe,EAAE,kBAAkB;IACrC;EACF;;EAEA;IACE,6CAA6C;EAC/C;;EAEA;IACE,gBAAgB;EAClB;AACF","file":"_index.scss","sourcesContent":["@include govuk-exports(\"govuk/component/footer\") {\n $govuk-footer-background: $govuk-template-background-colour;\n $govuk-footer-text: $govuk-text-colour;\n $govuk-footer-content-border: $govuk-border-colour;\n\n // Royal Arms image dimensions\n $govuk-footer-crest-image-width: 125px;\n $govuk-footer-crest-image-height: 102px;\n\n .govuk-footer {\n @include govuk-font($size: if($govuk-new-typography-scale, 19, 16));\n @include govuk-responsive-padding(7, \"top\");\n @include govuk-responsive-padding(5, \"bottom\");\n\n border-top: 10px solid $govuk-brand-colour;\n color: $govuk-footer-text;\n @include _govuk-rebrand(\n \"background\",\n $from: $govuk-footer-background,\n $to: $_govuk-rebrand-template-background-colour\n );\n }\n\n .govuk-footer__crown {\n margin-bottom: govuk-spacing(5);\n }\n\n .govuk-footer__link {\n @include govuk-link-common;\n @include govuk-link-style-text;\n }\n\n .govuk-footer__section-break {\n margin: 0; // Reset `<hr>` default margins\n @include govuk-responsive-margin(8, \"bottom\");\n border: 0; // Reset `<hr>` default borders\n border-bottom: 1px solid;\n @include _govuk-rebrand(\n \"border-bottom-color\",\n $from: $govuk-footer-content-border,\n $to: $_govuk-rebrand-border-colour-on-blue-tint-95\n );\n }\n\n .govuk-footer__meta {\n display: flex; // Support: Flexbox\n margin-right: -$govuk-gutter-half;\n margin-left: -$govuk-gutter-half;\n flex-wrap: wrap; // Support: Flexbox\n align-items: flex-end; // Support: Flexbox\n justify-content: center; // Support: Flexbox\n }\n\n .govuk-footer__meta-item {\n margin-right: $govuk-gutter-half;\n margin-bottom: govuk-spacing(5);\n margin-left: $govuk-gutter-half;\n }\n\n .govuk-footer__meta-item--grow {\n flex: 1; // Support: Flexbox\n @
|
|
1
|
+
{"version":3,"sources":["../../../../src/govuk/components/footer/_index.scss"],"names":[],"mappings":"AAAA;EACE,2DAA2D;EAC3D,sCAAsC;EACtC,kDAAkD;;EAElD,6BAA6B;EAC7B,sCAAsC;EACtC,uCAAuC;;EAEvC;IACE,mEAAmE;IACnE,2CAA2C;IAC3C,8CAA8C;;IAE9C,0CAA0C;IAC1C,yBAAyB;IACzB;;;;KAIC;EACH;;EAEA;IACE,+BAA+B;EACjC;;EAEA;IACE,0BAA0B;IAC1B,8BAA8B;EAChC;;EAEA;IACE,SAAS,EAAE,8BAA8B;IACzC,6CAA6C;IAC7C,SAAS,EAAE,8BAA8B;IACzC,wBAAwB;IACxB;;;;KAIC;EACH;;EAEA;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AAqB;IACrB,4BAA4B;IAC5B,mBAAmB;EACrB;;EAEA;IACE,SAAS;IACT,UAAU;IACV,gBAAgB;IAChB,yBAAyB,EAAE,kBAAkB;EAC/C;;EAEA;IACE;MACE,eAAe,EAAE,kBAAkB;IACrC;;IAEA;MACE,eAAe,EAAE,kBAAkB;IACrC;EACF;;EAEA;IACE,6CAA6C;EAC/C;;EAEA;IACE,gBAAgB;EAClB;AACF","file":"_index.scss","sourcesContent":["@include govuk-exports(\"govuk/component/footer\") {\n $govuk-footer-background: $govuk-template-background-colour;\n $govuk-footer-text: $govuk-text-colour;\n $govuk-footer-content-border: $govuk-border-colour;\n\n // Royal Arms image dimensions\n $govuk-footer-crest-image-width: 125px;\n $govuk-footer-crest-image-height: 102px;\n\n .govuk-footer {\n @include govuk-font($size: if($govuk-new-typography-scale, 19, 16));\n @include govuk-responsive-padding(7, \"top\");\n @include govuk-responsive-padding(5, \"bottom\");\n\n border-top: 10px solid $govuk-brand-colour;\n color: $govuk-footer-text;\n @include _govuk-rebrand(\n \"background\",\n $from: $govuk-footer-background,\n $to: $_govuk-rebrand-template-background-colour\n );\n }\n\n .govuk-footer__crown {\n margin-bottom: govuk-spacing(5);\n }\n\n .govuk-footer__link {\n @include govuk-link-common;\n @include govuk-link-style-text;\n }\n\n .govuk-footer__section-break {\n margin: 0; // Reset `<hr>` default margins\n @include govuk-responsive-margin(8, \"bottom\");\n border: 0; // Reset `<hr>` default borders\n border-bottom: 1px solid;\n @include _govuk-rebrand(\n \"border-bottom-color\",\n $from: $govuk-footer-content-border,\n $to: $_govuk-rebrand-border-colour-on-blue-tint-95\n );\n }\n\n .govuk-footer__meta {\n display: flex; // Support: Flexbox\n margin-right: -$govuk-gutter-half;\n margin-left: -$govuk-gutter-half;\n flex-wrap: wrap; // Support: Flexbox\n align-items: flex-end; // Support: Flexbox\n justify-content: center; // Support: Flexbox\n }\n\n .govuk-footer__meta-item {\n margin-right: $govuk-gutter-half;\n margin-bottom: govuk-spacing(5);\n margin-left: $govuk-gutter-half;\n }\n\n .govuk-footer__meta-item--grow {\n flex: 1; // Support: Flexbox\n @media #{govuk-until-breakpoint(tablet)} {\n flex-basis: 320px; // Support: Flexbox\n }\n }\n\n .govuk-footer__licence-logo {\n display: inline-block;\n margin-right: govuk-spacing(2);\n @media #{govuk-until-breakpoint(desktop)} {\n margin-bottom: govuk-spacing(3);\n }\n vertical-align: top;\n // Work around SVGs not inheriting color from parent in forced color mode\n // (https://github.com/w3c/csswg-drafts/issues/6310)\n forced-color-adjust: auto;\n }\n\n .govuk-footer__licence-description {\n // This makes the license description reflow under the logo when space gets too narrow\n display: inline-block;\n // This prevents the description from having orphans when space is narrow enough\n // and makes the text reflow more nicely\n text-wrap: balance;\n }\n\n .govuk-footer__copyright-logo::before {\n content: \"\";\n display: block;\n width: 100%;\n padding-top: ($govuk-footer-crest-image-height + govuk-spacing(2));\n background-image: govuk-image-url(\"govuk-crest.svg\");\n background-repeat: no-repeat;\n background-position: 50% 0%;\n background-size: $govuk-footer-crest-image-width $govuk-footer-crest-image-height;\n text-align: center;\n white-space: nowrap;\n\n // Where possible use the crest as a mask instead. This lets us use\n // currentColor, increasing the contrast of the image and matching the\n // user's prefered foreground colour in e.g. forced colors mode.\n // We test for `mask-position` rather than `mask-image` because of a false\n // positive in Edge 17.\n @supports (mask-position: initial) {\n background: currentcolor;\n mask-image: govuk-image-url(\"govuk-crest.svg\");\n mask-repeat: no-repeat;\n mask-position: 50% 0%;\n mask-size: $govuk-footer-crest-image-width $govuk-footer-crest-image-height;\n\n // currentcolor doesn't seem to be computed correctly in forced colors\n // mode so force the background color to match the system link color\n // (matching the text in the link)\n @media screen and (forced-colors: active) {\n background: linktext;\n }\n }\n }\n\n .govuk-footer__inline-list {\n margin-top: 0;\n margin-bottom: govuk-spacing(3);\n padding: 0;\n }\n\n .govuk-footer__meta-custom {\n margin-bottom: govuk-spacing(4);\n }\n\n .govuk-footer__inline-list-item {\n display: inline-block;\n margin-right: govuk-spacing(3);\n margin-bottom: govuk-spacing(1);\n }\n\n .govuk-footer__heading {\n margin-bottom: govuk-spacing(6);\n padding-bottom: govuk-spacing(4);\n\n @media #{govuk-until-breakpoint(tablet)} {\n padding-bottom: govuk-spacing(2);\n }\n\n border-bottom: 1px solid;\n @include _govuk-rebrand(\n \"border-bottom-color\",\n $from: $govuk-footer-content-border,\n $to: $_govuk-rebrand-border-colour-on-blue-tint-95\n );\n }\n\n .govuk-footer__navigation {\n @include govuk-clearfix;\n margin-right: -$govuk-gutter-half;\n margin-left: -$govuk-gutter-half;\n }\n\n .govuk-footer__section {\n display: inline-block;\n margin-bottom: $govuk-gutter;\n vertical-align: top;\n }\n\n .govuk-footer__list {\n margin: 0;\n padding: 0;\n list-style: none;\n column-gap: $govuk-gutter; // Support: Columns\n }\n\n @media #{govuk-from-breakpoint(desktop)} {\n .govuk-footer__list--columns-2 {\n column-count: 2; // Support: Columns\n }\n\n .govuk-footer__list--columns-3 {\n column-count: 3; // Support: Columns\n }\n }\n\n .govuk-footer__list-item {\n @include govuk-responsive-margin(4, \"bottom\");\n }\n\n .govuk-footer__list-item:last-child {\n margin-bottom: 0;\n }\n}\n"]}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.govuk-header--with-js-navigation {
|
|
34
|
-
@
|
|
34
|
+
@media #{govuk-until-breakpoint(desktop)} {
|
|
35
35
|
.govuk-header__logo {
|
|
36
36
|
// Protect the absolute positioned menu button from overlapping with the
|
|
37
37
|
// logo with right padding using the button's width
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
fill: #00ffe0;
|
|
118
118
|
|
|
119
119
|
// Override Dot colour when printing
|
|
120
|
-
@
|
|
120
|
+
@media print {
|
|
121
121
|
fill: currentcolor;
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
// Align vertically with logo when not wrapped
|
|
153
153
|
vertical-align: top;
|
|
154
154
|
|
|
155
|
-
@
|
|
155
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
156
156
|
margin-top: $product-name-offset-tablet;
|
|
157
157
|
@-moz-document url-prefix() {
|
|
158
158
|
margin-top: $product-name-offset-tablet - 0.5px;
|
|
@@ -184,11 +184,11 @@
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
// Remove top margin on the breakpoints too
|
|
187
|
-
@
|
|
187
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
188
188
|
margin-top: 0;
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
@
|
|
191
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
192
192
|
margin-top: 0;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -227,7 +227,7 @@
|
|
|
227
227
|
margin-right: govuk-spacing(2);
|
|
228
228
|
font-size: 30px; // We don't have a mixin that produces 30px font size
|
|
229
229
|
|
|
230
|
-
@
|
|
230
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
231
231
|
display: inline;
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
// Apply margins to internal elements to emulate padding
|
|
278
278
|
margin-bottom: govuk-spacing(3);
|
|
279
279
|
|
|
280
|
-
@
|
|
280
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
281
281
|
// Magic number to align service name baseline with the GOV.UK logo
|
|
282
282
|
$service-name-offset: 4px;
|
|
283
283
|
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
.govuk-header__logo {
|
|
295
295
|
@include govuk-responsive-margin($govuk-header-vertical-spacing-value, "bottom");
|
|
296
296
|
|
|
297
|
-
@
|
|
297
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
298
298
|
width: 33.33%;
|
|
299
299
|
padding-right: $govuk-gutter-half;
|
|
300
300
|
float: left;
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
.govuk-header__content {
|
|
322
|
-
@
|
|
322
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
323
323
|
width: 66.66%;
|
|
324
324
|
padding-left: $govuk-gutter-half;
|
|
325
325
|
float: left;
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
@include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
-
@
|
|
364
|
+
@media #{govuk-from-breakpoint(mobile)} {
|
|
365
365
|
position: absolute;
|
|
366
366
|
// calculate top offset by:
|
|
367
367
|
// - getting the vertical spacing for the top and the bottom of the header
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
margin: 0;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
@
|
|
377
|
+
@media #{govuk-from-breakpoint(tablet)} {
|
|
378
378
|
top: govuk-spacing(3);
|
|
379
379
|
}
|
|
380
380
|
|
|
@@ -389,13 +389,13 @@
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
.govuk-header__navigation {
|
|
392
|
-
@
|
|
392
|
+
@media #{govuk-until-breakpoint(mobile)} {
|
|
393
393
|
@include _govuk-rebrand {
|
|
394
394
|
padding-bottom: govuk-spacing(3);
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
@
|
|
398
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
399
399
|
margin-bottom: govuk-spacing(2);
|
|
400
400
|
|
|
401
401
|
@include _govuk-rebrand {
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
|
|
413
413
|
.govuk-header__service-name + .govuk-header__navigation {
|
|
414
414
|
@include _govuk-rebrand {
|
|
415
|
-
@
|
|
415
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
416
416
|
// If there's both a service name and navigation,
|
|
417
417
|
// remove the extra padding between them on desktop
|
|
418
418
|
padding-top: 0;
|
|
@@ -434,14 +434,14 @@
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
@include _govuk-rebrand {
|
|
437
|
-
@
|
|
437
|
+
@media #{govuk-from-breakpoint(mobile)} and #{govuk-until-breakpoint(desktop)} {
|
|
438
438
|
padding-bottom: govuk-spacing(3);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
.govuk-header__navigation--end {
|
|
444
|
-
@
|
|
444
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
445
445
|
margin: 0;
|
|
446
446
|
padding: govuk-spacing(1) 0;
|
|
447
447
|
text-align: right;
|
|
@@ -452,7 +452,7 @@
|
|
|
452
452
|
padding: govuk-spacing(2) 0;
|
|
453
453
|
border-bottom: 1px solid $govuk-header-nav-item-border-color;
|
|
454
454
|
|
|
455
|
-
@
|
|
455
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
456
456
|
display: inline-block;
|
|
457
457
|
margin-right: govuk-spacing(3);
|
|
458
458
|
padding: govuk-spacing(1) 0;
|
|
@@ -470,7 +470,7 @@
|
|
|
470
470
|
padding-top: govuk-spacing(3);
|
|
471
471
|
|
|
472
472
|
// ...except on desktop
|
|
473
|
-
@
|
|
473
|
+
@media #{govuk-from-breakpoint(desktop)} {
|
|
474
474
|
padding-top: govuk-spacing(1);
|
|
475
475
|
}
|
|
476
476
|
|
|
@@ -503,7 +503,7 @@
|
|
|
503
503
|
|
|
504
504
|
// When printing, use the normal blue as this contrasts better with the
|
|
505
505
|
// white printing header
|
|
506
|
-
@
|
|
506
|
+
@media print {
|
|
507
507
|
color: $govuk-brand-colour;
|
|
508
508
|
}
|
|
509
509
|
|
|
@@ -524,7 +524,7 @@
|
|
|
524
524
|
border-bottom: 0;
|
|
525
525
|
}
|
|
526
526
|
|
|
527
|
-
@
|
|
527
|
+
@media print {
|
|
528
528
|
.govuk-header {
|
|
529
529
|
border-bottom-width: 0;
|
|
530
530
|
color: govuk-colour("black");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/govuk/components/header/_index.scss"],"names":[],"mappings":"AAAA;EACE,+CA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;MAClC;IACF;EACF;;EAEA;IACE,sCAAsC;IACtC,SAAS;IACT,UAAU;IACV,gBAAgB;;IAEhB;MACE,aAAa;IACf;;IAEA;MACE;QACE,gCAAgC;MAClC;IACF;EACF;;EAEA;IACE;MACE,SAAS;MACT,2BAA2B;MAC3B,iBAAiB;IACnB;EACF;;EAEA;IACE,2BAA2B;IAC3B,4DAA4D;;IAE5D;MACE,qBAAqB;MACrB,8BAA8B;MAC9B,2BAA2B;MAC3B,SAAS;IACX;;IAEA;MACE,mCAAmC;MACnC,qCAAqC;MACrC,mBAAmB;IACrB;;IAEA;MACE,sCAAsC;MACtC,6BAA6B;;MAE7B,sBAAsB;MACtB;QACE,6BAA6B;MAC/B;;MAEA,0DAA0D;MAC1D,0CAA0C;;MAE1C,wEAAwE;MACxE;QACE,wCAAwC;MAC1C;IACF;EACF;;EAEA;IACE;MACE;QACE,iEAAiE;QACjE,qCAAqC;MACvC;;MAEA;;;QAGE,gCAAgC;;QAEhC;UACE,cAAc;QAChB;MACF;;MAEA,sEAAsE;MACtE,uBAAuB;MACvB;QACE,0BAA0B;MAC5B;;MAEA,yEAAyE;MACzE,8BAA8B;MAC9B;QACE,+BAA+B;;QAE/B;UACE,+BAA+B;QACjC;MACF;IACF;EACF;;EAEA;IACE,eAAe;IACf,gBAAgB;EAClB;;EAEA;IACE;MACE,sBAAsB;MACtB,4BAA4B;MAC5B,uBAAuB;IACzB;;IAEA;MACE;;QAEE,4BAA4B;MAC9B;;MAEA,mEAAmE;MACnE;QACE,aAAa;MACf;IACF;EACF;AACF","file":"_index.scss","sourcesContent":["@include govuk-exports(\"govuk/component/header\") {\n $govuk-header-background: govuk-colour(\"black\");\n $govuk-header-border-color: $govuk-brand-colour;\n $govuk-header-border-width: govuk-spacing(2);\n $govuk-header-text: govuk-colour(\"white\");\n $govuk-header-link-active: #1d8feb;\n $govuk-header-nav-item-border-color: #2e3133;\n $govuk-header-link-underline-thickness: 3px;\n $govuk-header-vertical-spacing-value: 2;\n // This crown height is only used to calculate top offset of mobile menu button\n // as the crown svg height is the only thing that controls the height of the header\n $govuk-header-crown-height: 30px;\n $govuk-header-menu-button-height: 24px;\n $govuk-header-menu-button-width: 80px;\n\n $govuk-header-rebrand-background: $govuk-brand-colour;\n $govuk-header-rebrand-logo-bottom-margin: 2px;\n\n .govuk-header {\n @include govuk-font($size: 16, $line-height: 1);\n\n // Add a transparent bottom border for forced-colour modes\n @include _govuk-rebrand(\n \"border-bottom\",\n $from: govuk-spacing(2) solid govuk-colour(\"white\"),\n $to: 1px solid transparent\n );\n @include _govuk-rebrand(\"background\", $from: $govuk-header-background, $to: $govuk-header-rebrand-background);\n\n color: $govuk-header-text;\n }\n\n .govuk-header--with-js-navigation {\n @include govuk-media-query($until: desktop) {\n .govuk-header__logo {\n // Protect the absolute positioned menu button from overlapping with the\n // logo with right padding using the button's width\n padding-right: $govuk-header-menu-button-width;\n }\n }\n }\n\n .govuk-header__container--full-width {\n padding: 0 govuk-spacing(3);\n border-color: $govuk-header-border-color;\n\n .govuk-header__menu-button {\n right: govuk-spacing(3);\n }\n }\n\n .govuk-header__container {\n @include govuk-clearfix;\n position: relative;\n margin-bottom: -$govuk-header-border-width;\n padding-top: govuk-spacing($govuk-header-vertical-spacing-value);\n border-bottom: $govuk-header-border-width solid $govuk-header-border-color;\n\n @include _govuk-rebrand {\n // Remove the space allocated to the blue bar\n margin-bottom: 0;\n\n // Remove padding as the child elements are now responsible for spacing\n padding-top: 0;\n\n // Remove the blue bar\n border-bottom: none;\n }\n }\n\n // TODO: Remove this when _govuk-rebrand becomes the default\n .govuk-header--full-width-border {\n border-bottom-color: $govuk-header-border-color;\n\n .govuk-header__container {\n border-bottom-color: transparent;\n }\n }\n\n .govuk-header__logotype {\n display: inline-block;\n position: relative;\n top: -3px;\n\n // Add a gap after the logo in case it's followed by a product name. This\n // gets removed later if the logotype is a :last-child.\n margin-right: govuk-spacing(1);\n fill: currentcolor;\n vertical-align: top;\n\n // Prevent readability backplate from obscuring underline in Windows High\n // Contrast Mode\n @media (forced-colors: active) {\n forced-color-adjust: none;\n color: linktext;\n }\n\n // Remove the gap after the logo if there's no product name to keep hover\n // and focus states neat\n &:last-child {\n margin-right: 0;\n }\n\n @include _govuk-rebrand {\n margin-right: govuk-px-to-rem(7px); // 1 'dot'\n margin-bottom: $govuk-header-rebrand-logo-bottom-margin;\n\n // Remove right-margin if there's no product name\n &:last-child {\n margin-right: 0;\n }\n }\n }\n\n // Colour in the Dot\n .govuk-logo-dot {\n fill: #00ffe0;\n\n // Override Dot colour when printing\n @include govuk-media-query($media-type: print) {\n fill: currentcolor;\n }\n\n // Override Dot colour on forced colours mode\n @media (forced-colors: active) {\n fill: currentcolor;\n }\n\n // Override Dot colour on focus\n :focus & {\n fill: currentcolor;\n }\n }\n\n .govuk-header__product-name {\n $product-name-offset: if($govuk-new-typography-scale, 7px, 10px);\n $product-name-offset-tablet: 5px;\n\n @include govuk-font-size($size: 24, $line-height: 1);\n @include govuk-typography-weight-regular;\n display: inline-table;\n\n // Maintain space below logo when wrapped\n margin-top: $product-name-offset;\n\n // Firefox places the GOV.UK logo one pixel higher, due to how it rounds\n // subpixels, so nudge the product name in FF to still be aligned.\n @-moz-document url-prefix() {\n margin-top: $product-name-offset - 0.5px;\n }\n\n // Align vertically with logo when not wrapped\n vertical-align: top;\n\n @include govuk-media-query($from: tablet) {\n margin-top: $product-name-offset-tablet;\n @-moz-document url-prefix() {\n margin-top: $product-name-offset-tablet - 0.5px;\n }\n }\n\n @include _govuk-rebrand {\n // Remove top margin\n margin-top: 0;\n\n // Remove 1px from the bottom to account for the font-size being 1px\n // larger than the logo height.\n margin-bottom: govuk-px-to-rem(-1px);\n\n // Magic number font-size that visually aligns with GOV.UK logo.\n // Also stops reducing the product name size on narrow screens\n font-size: govuk-px-to-rem(31px);\n\n // Reduce letter spacing\n letter-spacing: -0.015em;\n\n // Prevent forced colour modes from applying a background colour behind\n // the product name, which cuts off the underline that appears on hover.\n forced-color-adjust: none;\n\n @media screen and (forced-colors: active) {\n color: LinkText;\n background: transparent;\n }\n\n // Remove top margin on the breakpoints too\n @include govuk-media-query($from: tablet) {\n margin-top: 0;\n }\n\n @include govuk-media-query($from: desktop) {\n margin-top: 0;\n }\n }\n }\n\n .govuk-header__link {\n // Avoid using the `govuk-link-common` mixin because the links in the header\n // get a special treatment, because:\n //\n // - underlines are only visible on hover\n // - all links get a 3px underline regardless of text size, as there are\n // multiple grouped elements close to one another and having slightly\n // different underline widths looks unbalanced\n @include govuk-link-style-inverse;\n\n text-decoration: none;\n\n &:hover {\n text-decoration: underline;\n text-decoration-thickness: $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n }\n\n .govuk-header__link--homepage {\n // Font size needs to be set on the link so that the box sizing is correct\n // in Firefox\n display: inline-block;\n margin-right: govuk-spacing(2);\n font-size: 30px; // We don't have a mixin that produces 30px font size\n\n @include govuk-media-query($from: desktop) {\n display: inline;\n }\n\n &:link,\n &:visited {\n text-decoration: none;\n }\n\n &:hover,\n &:active {\n // Negate the added border\n margin-bottom: $govuk-header-link-underline-thickness * -1;\n border-bottom: $govuk-header-link-underline-thickness solid;\n }\n\n // Remove any borders that show when focused and hovered.\n &:focus {\n margin-bottom: 0;\n border-bottom: 0;\n }\n\n @include _govuk-rebrand {\n display: inline;\n\n // Remove word-spacing from within the logo so we can ignore\n // whitespace characters in the HTML\n word-spacing: govuk-px-to-rem(-6px);\n\n // Reset word-spacing for child elements\n > * {\n word-spacing: 0;\n }\n\n &:not(:focus) {\n background-color: $govuk-header-rebrand-background;\n }\n }\n }\n\n .govuk-header__service-name {\n display: inline-block;\n margin-bottom: govuk-spacing(2);\n @include govuk-font-size($size: 24);\n @include govuk-typography-weight-bold;\n\n @include _govuk-rebrand {\n // Apply margins to internal elements to emulate padding\n margin-bottom: govuk-spacing(3);\n\n @include govuk-media-query($from: desktop) {\n // Magic number to align service name baseline with the GOV.UK logo\n $service-name-offset: 4px;\n\n margin: (govuk-spacing(3) + $service-name-offset) 0 (govuk-spacing(3) - $service-name-offset);\n }\n }\n }\n\n .govuk-header__logo,\n .govuk-header__content {\n box-sizing: border-box;\n }\n\n .govuk-header__logo {\n @include govuk-responsive-margin($govuk-header-vertical-spacing-value, \"bottom\");\n\n @include govuk-media-query($from: desktop) {\n width: 33.33%;\n padding-right: $govuk-gutter-half;\n float: left;\n vertical-align: top;\n\n // Reset float when logo is the last child, without a navigation\n &:last-child {\n width: auto;\n padding-right: 0;\n float: none;\n }\n }\n\n @include _govuk-rebrand {\n // Apply margins to internal elements to emulate padding\n margin-bottom: 0;\n\n // Magic numbers, set padding to vertically centre align the logo\n padding-top: 16px;\n padding-bottom: 14px - $govuk-header-rebrand-logo-bottom-margin;\n }\n }\n\n .govuk-header__content {\n @include govuk-media-query($from: desktop) {\n width: 66.66%;\n padding-left: $govuk-gutter-half;\n float: left;\n }\n }\n\n .govuk-header__menu-button {\n @include govuk-font($size: 16);\n max-width: $govuk-header-menu-button-width;\n min-height: $govuk-header-menu-button-height;\n margin-bottom: govuk-spacing(1);\n padding: 0;\n border: 0;\n color: govuk-colour(\"white\");\n background: none;\n word-break: break-all;\n cursor: pointer;\n\n &:hover {\n text-decoration: solid underline $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n\n &::after {\n @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);\n content: \"\";\n margin-left: govuk-spacing(1);\n }\n\n &[aria-expanded=\"true\"]::after {\n @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);\n }\n\n @include govuk-media-query($from: mobile) {\n position: absolute;\n // calculate top offset by:\n // - getting the vertical spacing for the top and the bottom of the header\n // - adding that to the crown height\n // - dividing it by 2 so you have the vertical centre of the header\n // - subtracting half the height of the menu button\n top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -\n ($govuk-header-menu-button-height / 2);\n right: 0;\n margin: 0;\n }\n\n @include govuk-media-query($from: tablet) {\n top: govuk-spacing(3);\n }\n\n .govuk-frontend-supported & {\n display: block;\n }\n\n &[hidden],\n .govuk-frontend-supported &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation {\n @include govuk-media-query($until: mobile) {\n @include _govuk-rebrand {\n padding-bottom: govuk-spacing(3);\n }\n }\n\n @include govuk-media-query($from: desktop) {\n margin-bottom: govuk-spacing(2);\n\n @include _govuk-rebrand {\n // Magic number so that the bottom of the nav links aligns with the\n // baseline of the GOV.UK logo\n $navigation-offset: 7px;\n\n // Apply margins to internal elements to emulate padding\n margin-bottom: 0;\n padding: (govuk-spacing(3) + $navigation-offset) 0 (govuk-spacing(3) - $navigation-offset);\n }\n }\n }\n\n .govuk-header__service-name + .govuk-header__navigation {\n @include _govuk-rebrand {\n @include govuk-media-query($from: desktop) {\n // If there's both a service name and navigation,\n // remove the extra padding between them on desktop\n padding-top: 0;\n\n // Restore the full bottom padding as the navigation isn't standalone\n padding-bottom: govuk-spacing(3);\n }\n }\n }\n\n .govuk-header__navigation-list {\n // Reset user-agent default list styles\n margin: 0;\n padding: 0;\n list-style: none;\n\n &[hidden] {\n display: none;\n }\n\n @include _govuk-rebrand {\n @include govuk-media-query($from: mobile, $until: desktop) {\n padding-bottom: govuk-spacing(3);\n }\n }\n }\n\n .govuk-header__navigation--end {\n @include govuk-media-query($from: desktop) {\n margin: 0;\n padding: govuk-spacing(1) 0;\n text-align: right;\n }\n }\n\n .govuk-header__navigation-item {\n padding: govuk-spacing(2) 0;\n border-bottom: 1px solid $govuk-header-nav-item-border-color;\n\n @include govuk-media-query($from: desktop) {\n display: inline-block;\n margin-right: govuk-spacing(3);\n padding: govuk-spacing(1) 0;\n border: 0;\n }\n\n a {\n @include govuk-font-size($size: 16);\n @include govuk-typography-weight-bold;\n white-space: nowrap;\n }\n\n @include _govuk-rebrand {\n // Increase top padding of nav items...\n padding-top: govuk-spacing(3);\n\n // ...except on desktop\n @include govuk-media-query($from: desktop) {\n padding-top: govuk-spacing(1);\n }\n\n // Change the dividing line colour between mobile nav items\n border-bottom-color: govuk-colour(\"white\");\n\n // Reduce default weight of links so that we can use bold for active ones\n a {\n @include govuk-typography-weight-regular;\n }\n }\n }\n\n .govuk-header__navigation-item--active {\n a {\n @include _govuk-rebrand {\n // Change active links to use bold text instead of changing colour\n @include govuk-typography-weight-bold;\n }\n\n &:link,\n &:hover,\n &:visited {\n color: $govuk-header-link-active;\n\n @include _govuk-rebrand {\n color: inherit;\n }\n }\n\n // When printing, use the normal blue as this contrasts better with the\n // white printing header\n @include govuk-media-query($media-type: print) {\n color: $govuk-brand-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n\n @include _govuk-rebrand {\n color: $govuk-focus-text-colour;\n }\n }\n }\n }\n\n .govuk-header__navigation-item:last-child {\n margin-right: 0;\n border-bottom: 0;\n }\n\n @include govuk-media-query($media-type: print) {\n .govuk-header {\n border-bottom-width: 0;\n color: govuk-colour(\"black\");\n background: transparent;\n }\n\n .govuk-header__link {\n &:link,\n &:visited {\n color: govuk-colour(\"black\");\n }\n\n // Do not append link href to GOV.UK link when printing (e.g. '(/)')\n &::after {\n display: none;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/govuk/components/header/_index.scss"],"names":[],"mappings":"AAAA;EACE,+CAA+C;EAC/C,+CAA+C;EAC/C,4CAA4C;EAC5C,yCAAyC;EACzC,kCAAkC;EAClC,4CAA4C;EAC5C,2CAA2C;EAC3C,uCAAuC;EACvC,8EAA8E;EAC9E,kFAAkF;EAClF,gCAAgC;EAChC,sCAAsC;EACtC,qCAAqC;;EAErC,qDAAqD;EACrD,6CAA6C;;EAE7C;IACE,+CAA+C;;IAE/C,yDAAyD;IACzD;;;;KAIC;IACD,6GAA6G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BAA2B;MAC3B,SAAS;IACX;;IAEA;MACE,mCAAmC;MACnC,qCAAqC;MACrC,mBAAmB;IACrB;;IAEA;MACE,sCAAsC;MACtC,6BAA6B;;MAE7B,sBAAsB;MACtB;QACE,6BAA6B;MAC/B;;MAEA,0DAA0D;MAC1D,0CAA0C;;MAE1C,wEAAwE;MACxE;QACE,wCAAwC;MAC1C;IACF;EACF;;EAEA;IACE;MACE;QACE,iEAAiE;QACjE,qCAAqC;MACvC;;MAEA;;;QAGE,gCAAgC;;QAEhC;UACE,cAAc;QAChB;MACF;;MAEA,sEAAsE;MACtE,uBAAuB;MACvB;QACE,0BAA0B;MAC5B;;MAEA,yEAAyE;MACzE,8BAA8B;MAC9B;QACE,+BAA+B;;QAE/B;UACE,+BAA+B;QACjC;MACF;IACF;EACF;;EAEA;IACE,eAAe;IACf,gBAAgB;EAClB;;EAEA;IACE;MACE,sBAAsB;MACtB,4BAA4B;MAC5B,uBAAuB;IACzB;;IAEA;MACE;;QAEE,4BAA4B;MAC9B;;MAEA,mEAAmE;MACnE;QACE,aAAa;MACf;IACF;EACF;AACF","file":"_index.scss","sourcesContent":["@include govuk-exports(\"govuk/component/header\") {\n $govuk-header-background: govuk-colour(\"black\");\n $govuk-header-border-color: $govuk-brand-colour;\n $govuk-header-border-width: govuk-spacing(2);\n $govuk-header-text: govuk-colour(\"white\");\n $govuk-header-link-active: #1d8feb;\n $govuk-header-nav-item-border-color: #2e3133;\n $govuk-header-link-underline-thickness: 3px;\n $govuk-header-vertical-spacing-value: 2;\n // This crown height is only used to calculate top offset of mobile menu button\n // as the crown svg height is the only thing that controls the height of the header\n $govuk-header-crown-height: 30px;\n $govuk-header-menu-button-height: 24px;\n $govuk-header-menu-button-width: 80px;\n\n $govuk-header-rebrand-background: $govuk-brand-colour;\n $govuk-header-rebrand-logo-bottom-margin: 2px;\n\n .govuk-header {\n @include govuk-font($size: 16, $line-height: 1);\n\n // Add a transparent bottom border for forced-colour modes\n @include _govuk-rebrand(\n \"border-bottom\",\n $from: govuk-spacing(2) solid govuk-colour(\"white\"),\n $to: 1px solid transparent\n );\n @include _govuk-rebrand(\"background\", $from: $govuk-header-background, $to: $govuk-header-rebrand-background);\n\n color: $govuk-header-text;\n }\n\n .govuk-header--with-js-navigation {\n @media #{govuk-until-breakpoint(desktop)} {\n .govuk-header__logo {\n // Protect the absolute positioned menu button from overlapping with the\n // logo with right padding using the button's width\n padding-right: $govuk-header-menu-button-width;\n }\n }\n }\n\n .govuk-header__container--full-width {\n padding: 0 govuk-spacing(3);\n border-color: $govuk-header-border-color;\n\n .govuk-header__menu-button {\n right: govuk-spacing(3);\n }\n }\n\n .govuk-header__container {\n @include govuk-clearfix;\n position: relative;\n margin-bottom: -$govuk-header-border-width;\n padding-top: govuk-spacing($govuk-header-vertical-spacing-value);\n border-bottom: $govuk-header-border-width solid $govuk-header-border-color;\n\n @include _govuk-rebrand {\n // Remove the space allocated to the blue bar\n margin-bottom: 0;\n\n // Remove padding as the child elements are now responsible for spacing\n padding-top: 0;\n\n // Remove the blue bar\n border-bottom: none;\n }\n }\n\n // TODO: Remove this when _govuk-rebrand becomes the default\n .govuk-header--full-width-border {\n border-bottom-color: $govuk-header-border-color;\n\n .govuk-header__container {\n border-bottom-color: transparent;\n }\n }\n\n .govuk-header__logotype {\n display: inline-block;\n position: relative;\n top: -3px;\n\n // Add a gap after the logo in case it's followed by a product name. This\n // gets removed later if the logotype is a :last-child.\n margin-right: govuk-spacing(1);\n fill: currentcolor;\n vertical-align: top;\n\n // Prevent readability backplate from obscuring underline in Windows High\n // Contrast Mode\n @media (forced-colors: active) {\n forced-color-adjust: none;\n color: linktext;\n }\n\n // Remove the gap after the logo if there's no product name to keep hover\n // and focus states neat\n &:last-child {\n margin-right: 0;\n }\n\n @include _govuk-rebrand {\n margin-right: govuk-px-to-rem(7px); // 1 'dot'\n margin-bottom: $govuk-header-rebrand-logo-bottom-margin;\n\n // Remove right-margin if there's no product name\n &:last-child {\n margin-right: 0;\n }\n }\n }\n\n // Colour in the Dot\n .govuk-logo-dot {\n fill: #00ffe0;\n\n // Override Dot colour when printing\n @media print {\n fill: currentcolor;\n }\n\n // Override Dot colour on forced colours mode\n @media (forced-colors: active) {\n fill: currentcolor;\n }\n\n // Override Dot colour on focus\n :focus & {\n fill: currentcolor;\n }\n }\n\n .govuk-header__product-name {\n $product-name-offset: if($govuk-new-typography-scale, 7px, 10px);\n $product-name-offset-tablet: 5px;\n\n @include govuk-font-size($size: 24, $line-height: 1);\n @include govuk-typography-weight-regular;\n display: inline-table;\n\n // Maintain space below logo when wrapped\n margin-top: $product-name-offset;\n\n // Firefox places the GOV.UK logo one pixel higher, due to how it rounds\n // subpixels, so nudge the product name in FF to still be aligned.\n @-moz-document url-prefix() {\n margin-top: $product-name-offset - 0.5px;\n }\n\n // Align vertically with logo when not wrapped\n vertical-align: top;\n\n @media #{govuk-from-breakpoint(tablet)} {\n margin-top: $product-name-offset-tablet;\n @-moz-document url-prefix() {\n margin-top: $product-name-offset-tablet - 0.5px;\n }\n }\n\n @include _govuk-rebrand {\n // Remove top margin\n margin-top: 0;\n\n // Remove 1px from the bottom to account for the font-size being 1px\n // larger than the logo height.\n margin-bottom: govuk-px-to-rem(-1px);\n\n // Magic number font-size that visually aligns with GOV.UK logo.\n // Also stops reducing the product name size on narrow screens\n font-size: govuk-px-to-rem(31px);\n\n // Reduce letter spacing\n letter-spacing: -0.015em;\n\n // Prevent forced colour modes from applying a background colour behind\n // the product name, which cuts off the underline that appears on hover.\n forced-color-adjust: none;\n\n @media screen and (forced-colors: active) {\n color: LinkText;\n background: transparent;\n }\n\n // Remove top margin on the breakpoints too\n @media #{govuk-from-breakpoint(tablet)} {\n margin-top: 0;\n }\n\n @media #{govuk-from-breakpoint(desktop)} {\n margin-top: 0;\n }\n }\n }\n\n .govuk-header__link {\n // Avoid using the `govuk-link-common` mixin because the links in the header\n // get a special treatment, because:\n //\n // - underlines are only visible on hover\n // - all links get a 3px underline regardless of text size, as there are\n // multiple grouped elements close to one another and having slightly\n // different underline widths looks unbalanced\n @include govuk-link-style-inverse;\n\n text-decoration: none;\n\n &:hover {\n text-decoration: underline;\n text-decoration-thickness: $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n }\n\n .govuk-header__link--homepage {\n // Font size needs to be set on the link so that the box sizing is correct\n // in Firefox\n display: inline-block;\n margin-right: govuk-spacing(2);\n font-size: 30px; // We don't have a mixin that produces 30px font size\n\n @media #{govuk-from-breakpoint(desktop)} {\n display: inline;\n }\n\n &:link,\n &:visited {\n text-decoration: none;\n }\n\n &:hover,\n &:active {\n // Negate the added border\n margin-bottom: $govuk-header-link-underline-thickness * -1;\n border-bottom: $govuk-header-link-underline-thickness solid;\n }\n\n // Remove any borders that show when focused and hovered.\n &:focus {\n margin-bottom: 0;\n border-bottom: 0;\n }\n\n @include _govuk-rebrand {\n display: inline;\n\n // Remove word-spacing from within the logo so we can ignore\n // whitespace characters in the HTML\n word-spacing: govuk-px-to-rem(-6px);\n\n // Reset word-spacing for child elements\n > * {\n word-spacing: 0;\n }\n\n &:not(:focus) {\n background-color: $govuk-header-rebrand-background;\n }\n }\n }\n\n .govuk-header__service-name {\n display: inline-block;\n margin-bottom: govuk-spacing(2);\n @include govuk-font-size($size: 24);\n @include govuk-typography-weight-bold;\n\n @include _govuk-rebrand {\n // Apply margins to internal elements to emulate padding\n margin-bottom: govuk-spacing(3);\n\n @media #{govuk-from-breakpoint(desktop)} {\n // Magic number to align service name baseline with the GOV.UK logo\n $service-name-offset: 4px;\n\n margin: (govuk-spacing(3) + $service-name-offset) 0 (govuk-spacing(3) - $service-name-offset);\n }\n }\n }\n\n .govuk-header__logo,\n .govuk-header__content {\n box-sizing: border-box;\n }\n\n .govuk-header__logo {\n @include govuk-responsive-margin($govuk-header-vertical-spacing-value, \"bottom\");\n\n @media #{govuk-from-breakpoint(desktop)} {\n width: 33.33%;\n padding-right: $govuk-gutter-half;\n float: left;\n vertical-align: top;\n\n // Reset float when logo is the last child, without a navigation\n &:last-child {\n width: auto;\n padding-right: 0;\n float: none;\n }\n }\n\n @include _govuk-rebrand {\n // Apply margins to internal elements to emulate padding\n margin-bottom: 0;\n\n // Magic numbers, set padding to vertically centre align the logo\n padding-top: 16px;\n padding-bottom: 14px - $govuk-header-rebrand-logo-bottom-margin;\n }\n }\n\n .govuk-header__content {\n @media #{govuk-from-breakpoint(desktop)} {\n width: 66.66%;\n padding-left: $govuk-gutter-half;\n float: left;\n }\n }\n\n .govuk-header__menu-button {\n @include govuk-font($size: 16);\n max-width: $govuk-header-menu-button-width;\n min-height: $govuk-header-menu-button-height;\n margin-bottom: govuk-spacing(1);\n padding: 0;\n border: 0;\n color: govuk-colour(\"white\");\n background: none;\n word-break: break-all;\n cursor: pointer;\n\n &:hover {\n text-decoration: solid underline $govuk-header-link-underline-thickness;\n\n @if $govuk-link-underline-offset {\n text-underline-offset: $govuk-link-underline-offset;\n }\n }\n\n &:focus {\n @include govuk-focused-text;\n }\n\n &::after {\n @include govuk-shape-arrow($direction: down, $base: 10px, $display: inline-block);\n content: \"\";\n margin-left: govuk-spacing(1);\n }\n\n &[aria-expanded=\"true\"]::after {\n @include govuk-shape-arrow($direction: up, $base: 10px, $display: inline-block);\n }\n\n @media #{govuk-from-breakpoint(mobile)} {\n position: absolute;\n // calculate top offset by:\n // - getting the vertical spacing for the top and the bottom of the header\n // - adding that to the crown height\n // - dividing it by 2 so you have the vertical centre of the header\n // - subtracting half the height of the menu button\n top: (((govuk-spacing($govuk-header-vertical-spacing-value) * 2) + $govuk-header-crown-height) / 2) -\n ($govuk-header-menu-button-height / 2);\n right: 0;\n margin: 0;\n }\n\n @media #{govuk-from-breakpoint(tablet)} {\n top: govuk-spacing(3);\n }\n\n .govuk-frontend-supported & {\n display: block;\n }\n\n &[hidden],\n .govuk-frontend-supported &[hidden] {\n display: none;\n }\n }\n\n .govuk-header__navigation {\n @media #{govuk-until-breakpoint(mobile)} {\n @include _govuk-rebrand {\n padding-bottom: govuk-spacing(3);\n }\n }\n\n @media #{govuk-from-breakpoint(desktop)} {\n margin-bottom: govuk-spacing(2);\n\n @include _govuk-rebrand {\n // Magic number so that the bottom of the nav links aligns with the\n // baseline of the GOV.UK logo\n $navigation-offset: 7px;\n\n // Apply margins to internal elements to emulate padding\n margin-bottom: 0;\n padding: (govuk-spacing(3) + $navigation-offset) 0 (govuk-spacing(3) - $navigation-offset);\n }\n }\n }\n\n .govuk-header__service-name + .govuk-header__navigation {\n @include _govuk-rebrand {\n @media #{govuk-from-breakpoint(desktop)} {\n // If there's both a service name and navigation,\n // remove the extra padding between them on desktop\n padding-top: 0;\n\n // Restore the full bottom padding as the navigation isn't standalone\n padding-bottom: govuk-spacing(3);\n }\n }\n }\n\n .govuk-header__navigation-list {\n // Reset user-agent default list styles\n margin: 0;\n padding: 0;\n list-style: none;\n\n &[hidden] {\n display: none;\n }\n\n @include _govuk-rebrand {\n @media #{govuk-from-breakpoint(mobile)} and #{govuk-until-breakpoint(desktop)} {\n padding-bottom: govuk-spacing(3);\n }\n }\n }\n\n .govuk-header__navigation--end {\n @media #{govuk-from-breakpoint(desktop)} {\n margin: 0;\n padding: govuk-spacing(1) 0;\n text-align: right;\n }\n }\n\n .govuk-header__navigation-item {\n padding: govuk-spacing(2) 0;\n border-bottom: 1px solid $govuk-header-nav-item-border-color;\n\n @media #{govuk-from-breakpoint(desktop)} {\n display: inline-block;\n margin-right: govuk-spacing(3);\n padding: govuk-spacing(1) 0;\n border: 0;\n }\n\n a {\n @include govuk-font-size($size: 16);\n @include govuk-typography-weight-bold;\n white-space: nowrap;\n }\n\n @include _govuk-rebrand {\n // Increase top padding of nav items...\n padding-top: govuk-spacing(3);\n\n // ...except on desktop\n @media #{govuk-from-breakpoint(desktop)} {\n padding-top: govuk-spacing(1);\n }\n\n // Change the dividing line colour between mobile nav items\n border-bottom-color: govuk-colour(\"white\");\n\n // Reduce default weight of links so that we can use bold for active ones\n a {\n @include govuk-typography-weight-regular;\n }\n }\n }\n\n .govuk-header__navigation-item--active {\n a {\n @include _govuk-rebrand {\n // Change active links to use bold text instead of changing colour\n @include govuk-typography-weight-bold;\n }\n\n &:link,\n &:hover,\n &:visited {\n color: $govuk-header-link-active;\n\n @include _govuk-rebrand {\n color: inherit;\n }\n }\n\n // When printing, use the normal blue as this contrasts better with the\n // white printing header\n @media print {\n color: $govuk-brand-colour;\n }\n\n // When focussed, the text colour needs to be darker to ensure that colour\n // contrast is still acceptable\n &:focus {\n color: $govuk-focus-text-colour;\n\n @include _govuk-rebrand {\n color: $govuk-focus-text-colour;\n }\n }\n }\n }\n\n .govuk-header__navigation-item:last-child {\n margin-right: 0;\n border-bottom: 0;\n }\n\n @media print {\n .govuk-header {\n border-bottom-width: 0;\n color: govuk-colour(\"black\");\n background: transparent;\n }\n\n .govuk-header__link {\n &:link,\n &:visited {\n color: govuk-colour(\"black\");\n }\n\n // Do not append link href to GOV.UK link when printing (e.g. '(/)')\n &::after {\n display: none;\n }\n }\n }\n}\n"]}
|