govuk_publishing_components 34.7.0 → 34.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +3 -10
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +113 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +2 -11
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js +15 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +20 -29
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
- data/app/models/govuk_publishing_components/component_doc.rb +14 -0
- data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +14 -0
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +21 -6
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +5 -2
- data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/_details.html.erb +3 -1
- data/app/views/govuk_publishing_components/components/docs/action_link.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/details.yml +17 -0
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +78 -0
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +0 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- data/node_modules/govuk-frontend/govuk/all.js +4029 -3792
- data/node_modules/govuk-frontend/govuk/all.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +52 -51
- data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/index.js +153 -145
- data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +324 -321
- data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/common.js +154 -146
- data/node_modules/govuk-frontend/govuk/common.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -1
- data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +23 -4
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2059 -1654
- data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +11 -11
- data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +19 -19
- data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +21 -10
- data/node_modules/govuk-frontend/govuk/components/button/button.js +927 -917
- data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2050 -2040
- data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1155 -1147
- data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +23 -23
- data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/details/details.js +800 -799
- data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1058 -1045
- data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
- data/node_modules/govuk-frontend/govuk/components/header/header.js +646 -998
- data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +760 -752
- data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +61 -0
- data/node_modules/govuk-frontend/govuk/components/pagination/template.njk +1 -1
- data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1110 -1107
- data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1017 -1014
- data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +318 -23
- data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +110 -0
- data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +72 -28
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1392 -1264
- data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/i18n.js +363 -364
- data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +242 -241
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +13 -12
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +17 -16
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +547 -546
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +37 -36
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +251 -250
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +21 -20
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +198 -197
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +198 -197
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +106 -105
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +400 -399
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +239 -238
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +72 -71
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +14 -13
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -0
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +17 -16
- data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -0
- data/node_modules/govuk-frontend/govuk-esm/all.mjs +2 -2
- data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +17 -10
- data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +3 -1
- data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +135 -52
- data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +11 -9
- data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +10 -7
- data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +24 -18
- data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +23 -16
- data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +15 -11
- data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +3 -2
- data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +3 -4
- data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +10 -9
- data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +5 -3
- data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +165 -38
- data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +9 -11
- data/node_modules/govuk-frontend/package.json +1 -1
- metadata +37 -2
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"normalise-dataset.js","sources":["../../../src/govuk/vendor/polyfills/Object/defineProperty.mjs","../../../src/govuk/vendor/polyfills/Document.mjs","../../../src/govuk/vendor/polyfills/Element.mjs","../../../src/govuk/vendor/polyfills/Element/prototype/dataset.mjs","../../../src/govuk/vendor/polyfills/String/prototype/trim.mjs","../../../src/govuk/common/normalise-dataset.mjs"],"sourcesContent":["(function(undefined) {\n\n// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js\nvar detect = (\n // In IE8, defineProperty could only act on DOM elements, so full support\n // for the feature requires the ability to set a property on an arbitrary object\n 'defineProperty' in Object && (function() {\n \ttry {\n \t\tvar a = {};\n \t\tObject.defineProperty(a, 'test', {value:42});\n \t\treturn true;\n \t} catch(e) {\n \t\treturn false\n \t}\n }())\n)\n\nif (detect) return\n\n// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always\n(function (nativeDefineProperty) {\n\n\tvar supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');\n\tvar ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';\n\tvar ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';\n\n\tObject.defineProperty = function defineProperty(object, property, descriptor) {\n\n\t\t// Where native support exists, assume it\n\t\tif (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {\n\t\t\treturn nativeDefineProperty(object, property, descriptor);\n\t\t}\n\n\t\tif (object === null || !(object instanceof Object || typeof object === 'object')) {\n\t\t\tthrow new TypeError('Object.defineProperty called on non-object');\n\t\t}\n\n\t\tif (!(descriptor instanceof Object)) {\n\t\t\tthrow new TypeError('Property description must be an object');\n\t\t}\n\n\t\tvar propertyString = String(property);\n\t\tvar hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;\n\t\tvar getterType = 'get' in descriptor && typeof descriptor.get;\n\t\tvar setterType = 'set' in descriptor && typeof descriptor.set;\n\n\t\t// handle descriptor.get\n\t\tif (getterType) {\n\t\t\tif (getterType !== 'function') {\n\t\t\t\tthrow new TypeError('Getter must be a function');\n\t\t\t}\n\t\t\tif (!supportsAccessors) {\n\t\t\t\tthrow new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);\n\t\t\t}\n\t\t\tif (hasValueOrWritable) {\n\t\t\t\tthrow new TypeError(ERR_VALUE_ACCESSORS);\n\t\t\t}\n\t\t\tObject.__defineGetter__.call(object, propertyString, descriptor.get);\n\t\t} else {\n\t\t\tobject[propertyString] = descriptor.value;\n\t\t}\n\n\t\t// handle descriptor.set\n\t\tif (setterType) {\n\t\t\tif (setterType !== 'function') {\n\t\t\t\tthrow new TypeError('Setter must be a function');\n\t\t\t}\n\t\t\tif (!supportsAccessors) {\n\t\t\t\tthrow new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);\n\t\t\t}\n\t\t\tif (hasValueOrWritable) {\n\t\t\t\tthrow new TypeError(ERR_VALUE_ACCESSORS);\n\t\t\t}\n\t\t\tObject.__defineSetter__.call(object, propertyString, descriptor.set);\n\t\t}\n\n\t\t// OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above\n\t\tif ('value' in descriptor) {\n\t\t\tobject[propertyString] = descriptor.value;\n\t\t}\n\n\t\treturn object;\n\t};\n}(Object.defineProperty));\n})\n.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\n","(function(undefined) {\n\n// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js\nvar detect = (\"Document\" in this)\n\nif (detect) return\n\n// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always\nif ((typeof WorkerGlobalScope === \"undefined\") && (typeof importScripts !== \"function\")) {\n\n\tif (this.HTMLDocument) { // IE8\n\n\t\t// HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.\n\t\tthis.Document = this.HTMLDocument;\n\n\t} else {\n\n\t\t// Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.\n\t\tthis.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());\n\t\tthis.Document.prototype = document;\n\t}\n}\n\n\n})\n.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\n","import './Document.mjs'\n\n(function(undefined) {\n\n// Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js\nvar detect = ('Element' in this && 'HTMLElement' in this)\n\nif (detect) return\n\n// Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always\n(function () {\n\n\t// IE8\n\tif (window.Element && !window.HTMLElement) {\n\t\twindow.HTMLElement = window.Element;\n\t\treturn;\n\t}\n\n\t// create Element constructor\n\twindow.Element = window.HTMLElement = new Function('return function Element() {}')();\n\n\t// generate sandboxed iframe\n\tvar vbody = document.appendChild(document.createElement('body'));\n\tvar frame = vbody.appendChild(document.createElement('iframe'));\n\n\t// use sandboxed iframe to replicate Element functionality\n\tvar frameDocument = frame.contentWindow.document;\n\tvar prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));\n\tvar cache = {};\n\n\t// polyfill Element.prototype on an element\n\tvar shiv = function (element, deep) {\n\t\tvar\n\t\tchildNodes = element.childNodes || [],\n\t\tindex = -1,\n\t\tkey, value, childNode;\n\n\t\tif (element.nodeType === 1 && element.constructor !== Element) {\n\t\t\telement.constructor = Element;\n\n\t\t\tfor (key in cache) {\n\t\t\t\tvalue = cache[key];\n\t\t\t\telement[key] = value;\n\t\t\t}\n\t\t}\n\n\t\twhile (childNode = deep && childNodes[++index]) {\n\t\t\tshiv(childNode, deep);\n\t\t}\n\n\t\treturn element;\n\t};\n\n\tvar elements = document.getElementsByTagName('*');\n\tvar nativeCreateElement = document.createElement;\n\tvar interval;\n\tvar loopLimit = 100;\n\n\tprototype.attachEvent('onpropertychange', function (event) {\n\t\tvar\n\t\tpropertyName = event.propertyName,\n\t\tnonValue = !cache.hasOwnProperty(propertyName),\n\t\tnewValue = prototype[propertyName],\n\t\toldValue = cache[propertyName],\n\t\tindex = -1,\n\t\telement;\n\n\t\twhile (element = elements[++index]) {\n\t\t\tif (element.nodeType === 1) {\n\t\t\t\tif (nonValue || element[propertyName] === oldValue) {\n\t\t\t\t\telement[propertyName] = newValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tcache[propertyName] = newValue;\n\t});\n\n\tprototype.constructor = Element;\n\n\tif (!prototype.hasAttribute) {\n\t\t// <Element>.hasAttribute\n\t\tprototype.hasAttribute = function hasAttribute(name) {\n\t\t\treturn this.getAttribute(name) !== null;\n\t\t};\n\t}\n\n\t// Apply Element prototype to the pre-existing DOM as soon as the body element appears.\n\tfunction bodyCheck() {\n\t\tif (!(loopLimit--)) clearTimeout(interval);\n\t\tif (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {\n\t\t\tshiv(document, true);\n\t\t\tif (interval && document.body.prototype) clearTimeout(interval);\n\t\t\treturn (!!document.body.prototype);\n\t\t}\n\t\treturn false;\n\t}\n\tif (!bodyCheck()) {\n\t\tdocument.onreadystatechange = bodyCheck;\n\t\tinterval = setInterval(bodyCheck, 25);\n\t}\n\n\t// Apply to any new elements created after load\n\tdocument.createElement = function createElement(nodeName) {\n\t\tvar element = nativeCreateElement(String(nodeName).toLowerCase());\n\t\treturn shiv(element);\n\t};\n\n\t// remove sandboxed iframe\n\tdocument.removeChild(vbody);\n}());\n\n})\n.call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\n","import '../../Object/defineProperty.mjs'\nimport '../../Element.mjs'\n\n(function(undefined) {\n\n // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/detect.js\n var detect = (function(){\n if (!document.documentElement.dataset) {\n return false;\n }\n var el = document.createElement('div');\n el.setAttribute(\"data-a-b\", \"c\");\n return el.dataset && el.dataset.aB == \"c\";\n }())\n\n if (detect) return\n\n // Polyfill derived from https://raw.githubusercontent.com/Financial-Times/polyfill-library/13cf7c340974d128d557580b5e2dafcd1b1192d1/polyfills/Element/prototype/dataset/polyfill.js\n Object.defineProperty(Element.prototype, 'dataset', {\n get: function() {\n var element = this;\n var attributes = this.attributes;\n var map = {};\n \n for (var i = 0; i < attributes.length; i++) {\n var attribute = attributes[i];\n \n // This regex has been edited from the original polyfill, to add\n // support for period (.) separators in data-* attribute names. These\n // are allowed in the HTML spec, but were not covered by the original\n // polyfill's regex. We use periods in our i18n implementation.\n if (attribute && attribute.name && (/^data-\\w[.\\w-]*$/).test(attribute.name)) {\n var name = attribute.name;\n var value = attribute.value;\n \n var propName = name.substr(5).replace(/-./g, function (prop) {\n return prop.charAt(1).toUpperCase();\n });\n \n // If this browser supports __defineGetter__ and __defineSetter__,\n // continue using defineProperty. If not (like IE 8 and below), we use\n // a hacky fallback which at least gives an object in the right format\n if ('__defineGetter__' in Object.prototype && '__defineSetter__' in Object.prototype) {\n Object.defineProperty(map, propName, {\n enumerable: true,\n get: function() {\n return this.value;\n }.bind({value: value || ''}),\n set: function setter(name, value) {\n if (typeof value !== 'undefined') {\n this.setAttribute(name, value);\n } else {\n this.removeAttribute(name);\n }\n }.bind(element, name)\n });\n } else {\n map[propName] = value\n }\n\n }\n }\n \n return map;\n }\n });\n\n}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});","(function(undefined) {\n\n // Detection from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill\n var detect = ('trim' in String.prototype)\n \n if (detect) return\n\n // Polyfill from https://github.com/mdn/content/blob/cf607d68522cd35ee7670782d3ee3a361eaef2e4/files/en-us/web/javascript/reference/global_objects/string/trim/index.md#polyfill\n String.prototype.trim = function () {\n return this.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n };\n\n}).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});\n","/* eslint-disable es-x/no-string-prototype-trim -- Polyfill imported */\n\nimport '../vendor/polyfills/Element/prototype/dataset.mjs'\nimport '../vendor/polyfills/String/prototype/trim.mjs'\n\n/**\n * Normalise string\n *\n * 'If it looks like a duck, and it quacks like a duck…' 🦆\n *\n * If the passed value looks like a boolean or a number, convert it to a boolean\n * or number.\n *\n * Designed to be used to convert config passed via data attributes (which are\n * always strings) into something sensible.\n *\n * @param {string} value - The value to normalise\n * @returns {string | boolean | number | undefined} Normalised data\n */\nexport function normaliseString (value) {\n if (typeof value !== 'string') {\n return value\n }\n\n var trimmedValue = value.trim()\n\n if (trimmedValue === 'true') {\n return true\n }\n\n if (trimmedValue === 'false') {\n return false\n }\n\n // Empty / whitespace-only strings are considered finite so we need to check\n // the length of the trimmed string as well\n if (trimmedValue.length > 0 && isFinite(trimmedValue)) {\n return Number(trimmedValue)\n }\n\n return value\n}\n\n/**\n * Normalise dataset\n *\n * Loop over an object and normalise each value using normaliseData function\n *\n * @param {DOMStringMap} dataset - HTML element dataset\n * @returns {Object<string, unknown>} Normalised dataset\n */\nexport function normaliseDataset (dataset) {\n var out = {}\n\n for (var key in dataset) {\n out[key] = normaliseString(dataset[key])\n }\n\n return out\n}\n"],"names":[],"mappings":";;;;;;CAAA,CAAC,SAAS,SAAS,EAAE;;CAErB;CACA,IAAI,MAAM;CACV;CACA;CACA,EAAE,gBAAgB,IAAI,MAAM,KAAK,WAAW;CAC5C,GAAG,IAAI;CACP,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;CACf,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;CACjD,IAAI,OAAO,IAAI,CAAC;CAChB,IAAI,CAAC,MAAM,CAAC,EAAE;CACd,IAAI,OAAO,KAAK;CAChB,IAAI;CACJ,GAAG,EAAE,CAAC;CACN,EAAC;;CAED,IAAI,MAAM,EAAE,MAAM;;CAElB;CACA,CAAC,UAAU,oBAAoB,EAAE;;CAEjC,CAAC,IAAI,iBAAiB,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAC7E,CAAC,IAAI,2BAA2B,GAAG,+DAA+D,CAAC;CACnG,CAAC,IAAI,mBAAmB,GAAG,uEAAuE,CAAC;;CAEnG,CAAC,MAAM,CAAC,cAAc,GAAG,SAAS,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;;CAE/E;CACA,EAAE,IAAI,oBAAoB,KAAK,MAAM,KAAK,MAAM,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,OAAO,CAAC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I,IAAI,QAAQ,KAAK,OAAO,MAAM,IAAI,MAAM,IAAI,EAAE,CAAC,CAAC;;CCZhI;AACA,AAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACA,CAAO,SAAS,eAAe,EAAE,KAAK,EAAE;CACxC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;CACjC,IAAI,OAAO,KAAK;CAChB,GAAG;;CAEH,EAAE,IAAI,YAAY,GAAG,KAAK,CAAC,IAAI,GAAE;;CAEjC,EAAE,IAAI,YAAY,KAAK,MAAM,EAAE;CAC/B,IAAI,OAAO,IAAI;CACf,GAAG;;CAEH,EAAE,IAAI,YAAY,KAAK,OAAO,EAAE;CAChC,IAAI,OAAO,KAAK;CAChB,GAAG;;CAEH;CACA;CACA,EAAE,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,YAAY,CAAC,EAAE;CACzD,IAAI,OAAO,MAAM,CAAC,YAAY,CAAC;CAC/B,GAAG;;CAEH,EAAE,OAAO,KAAK;CACd,CAAC;;CAED;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACA,CAAO,SAAS,gBAAgB,EAAE,OAAO,EAAE;CAC3C,EAAE,IAAI,GAAG,GAAG,GAAE;;CAEd,EAAE,KAAK,IAAI,GAAG,IAAI,OAAO,EAAE;CAC3B,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,EAAC;CAC5C,GAAG;;CAEH,EAAE,OAAO,GAAG;CACZ,CAAC;;;;;;;;;"}
|
@@ -1,174 +1,182 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
+
typeof define === 'function' && define.amd ? define('GOVUKFrontend', ['exports'], factory) :
|
4
|
+
(factory((global.GOVUKFrontend = {})));
|
5
5
|
}(this, (function (exports) { 'use strict';
|
6
6
|
|
7
|
-
/**
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
/**
|
8
|
+
* Common helpers which do not require polyfill.
|
9
|
+
*
|
10
|
+
* IMPORTANT: If a helper require a polyfill, please isolate it in its own module
|
11
|
+
* so that the polyfill can be properly tree-shaken and does not burden
|
12
|
+
* the components that do not need that helper
|
13
|
+
*
|
14
|
+
* @module common/index
|
15
|
+
*/
|
16
16
|
|
17
|
-
/**
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
function nodeListForEach (nodes, callback) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
/**
|
18
|
+
* TODO: Ideally this would be a NodeList.prototype.forEach polyfill
|
19
|
+
* This seems to fail in IE8, requires more investigation.
|
20
|
+
* See: https://github.com/imagitama/nodelist-foreach-polyfill
|
21
|
+
*
|
22
|
+
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
|
23
|
+
* @param {nodeListIterator} callback - Callback function to run for each node
|
24
|
+
* @returns {void}
|
25
|
+
*/
|
26
|
+
function nodeListForEach (nodes, callback) {
|
27
|
+
if (window.NodeList.prototype.forEach) {
|
28
|
+
return nodes.forEach(callback)
|
29
|
+
}
|
30
|
+
for (var i = 0; i < nodes.length; i++) {
|
31
|
+
callback.call(window, nodes[i], i, nodes);
|
32
|
+
}
|
32
33
|
}
|
33
|
-
}
|
34
34
|
|
35
|
-
/**
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
function generateUniqueID () {
|
43
|
-
|
44
|
-
|
45
|
-
|
35
|
+
/**
|
36
|
+
* Used to generate a unique string, allows multiple instances of the component
|
37
|
+
* without them conflicting with each other.
|
38
|
+
* https://stackoverflow.com/a/8809472
|
39
|
+
*
|
40
|
+
* @returns {string} Unique ID
|
41
|
+
*/
|
42
|
+
function generateUniqueID () {
|
43
|
+
var d = new Date().getTime();
|
44
|
+
if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {
|
45
|
+
d += window.performance.now(); // use high-precision timer if available
|
46
|
+
}
|
47
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
48
|
+
var r = (d + Math.random() * 16) % 16 | 0;
|
49
|
+
d = Math.floor(d / 16);
|
50
|
+
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
|
51
|
+
})
|
46
52
|
}
|
47
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
48
|
-
var r = (d + Math.random() * 16) % 16 | 0;
|
49
|
-
d = Math.floor(d / 16);
|
50
|
-
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)
|
51
|
-
})
|
52
|
-
}
|
53
53
|
|
54
|
-
/**
|
55
|
-
* Config flattening function
|
56
|
-
*
|
57
|
-
* Takes any number of objects, flattens them into namespaced key-value pairs,
|
58
|
-
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
|
59
|
-
* greatest priority on the LAST item passed in.
|
60
|
-
*
|
61
|
-
* @returns {object} A flattened object of key-value pairs.
|
62
|
-
*/
|
63
|
-
function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
|
64
54
|
/**
|
65
|
-
*
|
66
|
-
*
|
67
|
-
*
|
68
|
-
*
|
55
|
+
* Config flattening function
|
56
|
+
*
|
57
|
+
* Takes any number of objects, flattens them into namespaced key-value pairs,
|
58
|
+
* (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with
|
59
|
+
* greatest priority on the LAST item passed in.
|
69
60
|
*
|
70
|
-
* @
|
71
|
-
* @returns {object} Flattened object with dot-separated keys
|
61
|
+
* @returns {Object<string, unknown>} A flattened object of key-value pairs.
|
72
62
|
*/
|
73
|
-
|
74
|
-
|
75
|
-
|
63
|
+
function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {
|
64
|
+
/**
|
65
|
+
* Function to take nested objects and flatten them to a dot-separated keyed
|
66
|
+
* object. Doing this means we don't need to do any deep/recursive merging of
|
67
|
+
* each of our objects, nor transform our dataset from a flat list into a
|
68
|
+
* nested object.
|
69
|
+
*
|
70
|
+
* @param {Object<string, unknown>} configObject - Deeply nested object
|
71
|
+
* @returns {Object<string, unknown>} Flattened object with dot-separated keys
|
72
|
+
*/
|
73
|
+
var flattenObject = function (configObject) {
|
74
|
+
// Prepare an empty return object
|
75
|
+
var flattenedObject = {};
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
77
|
+
/**
|
78
|
+
* Our flattening function, this is called recursively for each level of
|
79
|
+
* depth in the object. At each level we prepend the previous level names to
|
80
|
+
* the key using `prefix`.
|
81
|
+
*
|
82
|
+
* @param {Partial<Object<string, unknown>>} obj - Object to flatten
|
83
|
+
* @param {string} [prefix] - Optional dot-separated prefix
|
84
|
+
*/
|
85
|
+
var flattenLoop = function (obj, prefix) {
|
86
|
+
// Loop through keys...
|
87
|
+
for (var key in obj) {
|
88
|
+
// Check to see if this is a prototypical key/value,
|
89
|
+
// if it is, skip it.
|
90
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
91
|
+
continue
|
92
|
+
}
|
93
|
+
var value = obj[key];
|
94
|
+
var prefixedKey = prefix ? prefix + '.' + key : key;
|
95
|
+
if (typeof value === 'object') {
|
96
|
+
// If the value is a nested object, recurse over that too
|
97
|
+
flattenLoop(value, prefixedKey);
|
98
|
+
} else {
|
99
|
+
// Otherwise, add this value to our return object
|
100
|
+
flattenedObject[prefixedKey] = value;
|
101
|
+
}
|
96
102
|
}
|
97
|
-
}
|
98
|
-
};
|
103
|
+
};
|
99
104
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
105
|
+
// Kick off the recursive loop
|
106
|
+
flattenLoop(configObject);
|
107
|
+
return flattenedObject
|
108
|
+
};
|
104
109
|
|
105
|
-
|
106
|
-
|
110
|
+
// Start with an empty object as our base
|
111
|
+
var formattedConfigObject = {};
|
107
112
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
// Loop through each of the remaining passed objects and push their keys
|
114
|
+
// one-by-one into configObject. Any duplicate keys will override the existing
|
115
|
+
// key with the new value.
|
116
|
+
for (var i = 0; i < arguments.length; i++) {
|
117
|
+
var obj = flattenObject(arguments[i]);
|
118
|
+
for (var key in obj) {
|
119
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
120
|
+
formattedConfigObject[key] = obj[key];
|
121
|
+
}
|
116
122
|
}
|
117
123
|
}
|
118
|
-
}
|
119
|
-
|
120
|
-
return formattedConfigObject
|
121
|
-
}
|
122
124
|
|
123
|
-
|
124
|
-
* Extracts keys starting with a particular namespace from a flattened config
|
125
|
-
* object, removing the namespace in the process.
|
126
|
-
*
|
127
|
-
* @param {object} configObject - The object to extract key-value pairs from.
|
128
|
-
* @param {string} namespace - The namespace to filter keys with.
|
129
|
-
* @returns {object} Flattened object with dot-separated key namespace removed
|
130
|
-
*/
|
131
|
-
function extractConfigByNamespace (configObject, namespace) {
|
132
|
-
// Check we have what we need
|
133
|
-
if (!configObject || typeof configObject !== 'object') {
|
134
|
-
throw new Error('Provide a `configObject` of type "object".')
|
125
|
+
return formattedConfigObject
|
135
126
|
}
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Extracts keys starting with a particular namespace from a flattened config
|
130
|
+
* object, removing the namespace in the process.
|
131
|
+
*
|
132
|
+
* @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.
|
133
|
+
* @param {string} namespace - The namespace to filter keys with.
|
134
|
+
* @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed
|
135
|
+
* @throws {Error} Config object required
|
136
|
+
* @throws {Error} Namespace string required
|
137
|
+
*/
|
138
|
+
function extractConfigByNamespace (configObject, namespace) {
|
139
|
+
// Check we have what we need
|
140
|
+
if (!configObject || typeof configObject !== 'object') {
|
141
|
+
throw new Error('Provide a `configObject` of type "object".')
|
142
|
+
}
|
143
|
+
if (!namespace || typeof namespace !== 'string') {
|
144
|
+
throw new Error('Provide a `namespace` of type "string" to filter the `configObject` by.')
|
145
|
+
}
|
146
|
+
var newObject = {};
|
147
|
+
for (var key in configObject) {
|
148
|
+
// Split the key into parts, using . as our namespace separator
|
149
|
+
var keyParts = key.split('.');
|
150
|
+
// Check if the first namespace matches the configured namespace
|
151
|
+
if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {
|
152
|
+
// Remove the first item (the namespace) from the parts array,
|
153
|
+
// but only if there is more than one part (we don't want blank keys!)
|
154
|
+
if (keyParts.length > 1) {
|
155
|
+
keyParts.shift();
|
156
|
+
}
|
157
|
+
// Join the remaining parts back together
|
158
|
+
var newKey = keyParts.join('.');
|
159
|
+
// Add them to our new object
|
160
|
+
newObject[newKey] = configObject[key];
|
149
161
|
}
|
150
|
-
// Join the remaining parts back together
|
151
|
-
var newKey = keyParts.join('.');
|
152
|
-
// Add them to our new object
|
153
|
-
newObject[newKey] = configObject[key];
|
154
162
|
}
|
163
|
+
return newObject
|
155
164
|
}
|
156
|
-
return newObject
|
157
|
-
}
|
158
165
|
|
159
|
-
/**
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
+
/**
|
167
|
+
* @callback nodeListIterator
|
168
|
+
* @param {Element} value - The current node being iterated on
|
169
|
+
* @param {number} index - The current index in the iteration
|
170
|
+
* @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()
|
171
|
+
* @returns {void}
|
172
|
+
*/
|
166
173
|
|
167
|
-
// Implementation of common function is gathered in the `common` folder
|
174
|
+
// Implementation of common function is gathered in the `common` folder
|
168
175
|
|
169
|
-
exports.nodeListForEach = nodeListForEach;
|
170
|
-
exports.generateUniqueID = generateUniqueID;
|
171
|
-
exports.mergeConfigs = mergeConfigs;
|
172
|
-
exports.extractConfigByNamespace = extractConfigByNamespace;
|
176
|
+
exports.nodeListForEach = nodeListForEach;
|
177
|
+
exports.generateUniqueID = generateUniqueID;
|
178
|
+
exports.mergeConfigs = mergeConfigs;
|
179
|
+
exports.extractConfigByNamespace = extractConfigByNamespace;
|
173
180
|
|
174
181
|
})));
|
182
|
+
//# sourceMappingURL=common.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"common.js","sources":["../../src/govuk/common/index.mjs","../../src/govuk/common.mjs"],"sourcesContent":["/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n *\n * @module common/index\n */\n\n/**\n * TODO: Ideally this would be a NodeList.prototype.forEach polyfill\n * This seems to fail in IE8, requires more investigation.\n * See: https://github.com/imagitama/nodelist-foreach-polyfill\n *\n * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()\n * @param {nodeListIterator} callback - Callback function to run for each node\n * @returns {void}\n */\nexport function nodeListForEach (nodes, callback) {\n if (window.NodeList.prototype.forEach) {\n return nodes.forEach(callback)\n }\n for (var i = 0; i < nodes.length; i++) {\n callback.call(window, nodes[i], i, nodes)\n }\n}\n\n/**\n * Used to generate a unique string, allows multiple instances of the component\n * without them conflicting with each other.\n * https://stackoverflow.com/a/8809472\n *\n * @returns {string} Unique ID\n */\nexport function generateUniqueID () {\n var d = new Date().getTime()\n if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') {\n d += window.performance.now() // use high-precision timer if available\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0\n d = Math.floor(d / 16)\n return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16)\n })\n}\n\n/**\n * Config flattening function\n *\n * Takes any number of objects, flattens them into namespaced key-value pairs,\n * (e.g. {'i18n.showSection': 'Show section'}) and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @returns {Object<string, unknown>} A flattened object of key-value pairs.\n */\nexport function mergeConfigs (/* configObject1, configObject2, ...configObjects */) {\n /**\n * Function to take nested objects and flatten them to a dot-separated keyed\n * object. Doing this means we don't need to do any deep/recursive merging of\n * each of our objects, nor transform our dataset from a flat list into a\n * nested object.\n *\n * @param {Object<string, unknown>} configObject - Deeply nested object\n * @returns {Object<string, unknown>} Flattened object with dot-separated keys\n */\n var flattenObject = function (configObject) {\n // Prepare an empty return object\n var flattenedObject = {}\n\n /**\n * Our flattening function, this is called recursively for each level of\n * depth in the object. At each level we prepend the previous level names to\n * the key using `prefix`.\n *\n * @param {Partial<Object<string, unknown>>} obj - Object to flatten\n * @param {string} [prefix] - Optional dot-separated prefix\n */\n var flattenLoop = function (obj, prefix) {\n // Loop through keys...\n for (var key in obj) {\n // Check to see if this is a prototypical key/value,\n // if it is, skip it.\n if (!Object.prototype.hasOwnProperty.call(obj, key)) {\n continue\n }\n var value = obj[key]\n var prefixedKey = prefix ? prefix + '.' + key : key\n if (typeof value === 'object') {\n // If the value is a nested object, recurse over that too\n flattenLoop(value, prefixedKey)\n } else {\n // Otherwise, add this value to our return object\n flattenedObject[prefixedKey] = value\n }\n }\n }\n\n // Kick off the recursive loop\n flattenLoop(configObject)\n return flattenedObject\n }\n\n // Start with an empty object as our base\n var formattedConfigObject = {}\n\n // Loop through each of the remaining passed objects and push their keys\n // one-by-one into configObject. Any duplicate keys will override the existing\n // key with the new value.\n for (var i = 0; i < arguments.length; i++) {\n var obj = flattenObject(arguments[i])\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n formattedConfigObject[key] = obj[key]\n }\n }\n }\n\n return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from a flattened config\n * object, removing the namespace in the process.\n *\n * @param {Object<string, unknown>} configObject - The object to extract key-value pairs from.\n * @param {string} namespace - The namespace to filter keys with.\n * @returns {Object<string, unknown>} Flattened object with dot-separated key namespace removed\n * @throws {Error} Config object required\n * @throws {Error} Namespace string required\n */\nexport function extractConfigByNamespace (configObject, namespace) {\n // Check we have what we need\n if (!configObject || typeof configObject !== 'object') {\n throw new Error('Provide a `configObject` of type \"object\".')\n }\n if (!namespace || typeof namespace !== 'string') {\n throw new Error('Provide a `namespace` of type \"string\" to filter the `configObject` by.')\n }\n var newObject = {}\n for (var key in configObject) {\n // Split the key into parts, using . as our namespace separator\n var keyParts = key.split('.')\n // Check if the first namespace matches the configured namespace\n if (Object.prototype.hasOwnProperty.call(configObject, key) && keyParts[0] === namespace) {\n // Remove the first item (the namespace) from the parts array,\n // but only if there is more than one part (we don't want blank keys!)\n if (keyParts.length > 1) {\n keyParts.shift()\n }\n // Join the remaining parts back together\n var newKey = keyParts.join('.')\n // Add them to our new object\n newObject[newKey] = configObject[key]\n }\n }\n return newObject\n}\n\n/**\n * @callback nodeListIterator\n * @param {Element} value - The current node being iterated on\n * @param {number} index - The current index in the iteration\n * @param {NodeListOf<Element>} nodes - NodeList from querySelectorAll()\n * @returns {void}\n */\n","// Implementation of common function is gathered in the `common` folder\n// as some are split in their own modules to limit impacts of the polyfills\n// they require.\n// This module exports the non polyfilled methods as they used to be\n// to avoid breaking changes\nexport * from './common/index.mjs'\n"],"names":[],"mappings":";;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACA,E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@@
|
|
7
7
|
@import "checkboxes/index";
|
8
8
|
@import "character-count/index";
|
9
9
|
@import "cookie-banner/index";
|
10
|
-
@import "summary-list/index";
|
11
10
|
@import "date-input/index";
|
12
11
|
@import "details/index";
|
13
12
|
@import "error-message/index";
|
@@ -29,6 +28,7 @@
|
|
29
28
|
@import "radios/index";
|
30
29
|
@import "select/index";
|
31
30
|
@import "skip-link/index";
|
31
|
+
@import "summary-list/index";
|
32
32
|
@import "table/index";
|
33
33
|
@import "textarea/index";
|
34
34
|
@import "warning-text/index";
|
@@ -46,11 +46,26 @@
|
|
46
46
|
padding-top: 0;
|
47
47
|
}
|
48
48
|
|
49
|
-
// Hide the body of collapsed sections
|
49
|
+
// Hide the body of collapsed sections by default for browsers that lack
|
50
|
+
// support for `content-visibility` paired with [hidden=until-found]
|
50
51
|
.govuk-accordion__section-content {
|
51
52
|
display: none;
|
52
|
-
|
53
|
+
|
53
54
|
@include govuk-responsive-padding(3, "top");
|
55
|
+
@include govuk-responsive-padding(8, "bottom");
|
56
|
+
}
|
57
|
+
|
58
|
+
// Hide the body of collapsed sections using `content-visibility` to enable
|
59
|
+
// page search within [hidden=until-found] regions where browser supported
|
60
|
+
.govuk-accordion__section-content[hidden] {
|
61
|
+
@supports (content-visibility: hidden) {
|
62
|
+
content-visibility: hidden;
|
63
|
+
display: inherit;
|
64
|
+
}
|
65
|
+
|
66
|
+
// Hide the padding of collapsed sections
|
67
|
+
padding-top: 0;
|
68
|
+
padding-bottom: 0;
|
54
69
|
}
|
55
70
|
|
56
71
|
// Show the body of expanded sections
|
@@ -74,7 +89,7 @@
|
|
74
89
|
cursor: pointer;
|
75
90
|
-webkit-appearance: none;
|
76
91
|
|
77
|
-
@include govuk-media-query ($from:
|
92
|
+
@include govuk-media-query ($from: tablet) {
|
78
93
|
margin-bottom: 14px;
|
79
94
|
}
|
80
95
|
|
@@ -274,8 +289,12 @@
|
|
274
289
|
// relates to the content below. Adjust padding to maintain the height of the element.
|
275
290
|
// See https://github.com/alphagov/govuk-frontend/pull/2257#issuecomment-951920798
|
276
291
|
.govuk-accordion__section--expanded .govuk-accordion__section-button {
|
277
|
-
padding-bottom: govuk-spacing(
|
292
|
+
padding-bottom: govuk-spacing(3);
|
278
293
|
border-bottom: 0;
|
294
|
+
|
295
|
+
@include govuk-media-query ($from: tablet) {
|
296
|
+
padding-bottom: govuk-spacing(4);
|
297
|
+
}
|
279
298
|
}
|
280
299
|
|
281
300
|
// As Chevron icon is vertically aligned it overlaps with the focus state bottom border
|