@nationalarchives/frontend 1.1.0 → 1.3.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.
- package/nationalarchives/all+analytics.js +1 -1
- package/nationalarchives/all+analytics.js.map +1 -1
- package/nationalarchives/all+analytics.mjs +0 -2
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +0 -2
- package/nationalarchives/analytics.js +1 -1
- package/nationalarchives/analytics.js.map +1 -1
- package/nationalarchives/analytics.mjs +4 -3
- package/nationalarchives/assets/fonts/fa-brands-400.woff2 +0 -0
- package/nationalarchives/assets/fonts/fa-solid-900.woff2 +0 -0
- package/nationalarchives/components/_presentation.scss +1 -1
- package/nationalarchives/components/accordion/accordion.css.map +1 -1
- package/nationalarchives/components/accordion/accordion.js +1 -1
- package/nationalarchives/components/accordion/accordion.js.map +1 -1
- package/nationalarchives/components/back-link/back-link.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +0 -1
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +2 -2
- package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
- package/nationalarchives/components/checkboxes/checkboxes.scss +26 -13
- package/nationalarchives/components/checkboxes/fixtures.json +52 -0
- package/nationalarchives/components/code-block/code-block.css.map +1 -1
- package/nationalarchives/components/code-block/code-block.js +1 -1
- package/nationalarchives/components/code-block/code-block.js.map +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.mjs +18 -35
- package/nationalarchives/components/cookie-banner/fixtures.json +0 -9
- package/nationalarchives/components/cookie-banner/macro-options.json +0 -7
- package/nationalarchives/components/cookie-banner/template.njk +0 -1
- package/nationalarchives/components/date-input/date-input.css +1 -1
- package/nationalarchives/components/date-input/date-input.css.map +1 -1
- package/nationalarchives/components/date-input/date-input.js +1 -1
- package/nationalarchives/components/date-input/date-input.js.map +1 -1
- package/nationalarchives/components/date-input/date-input.mjs +0 -4
- package/nationalarchives/components/date-input/fixtures.json +24 -0
- package/nationalarchives/components/date-search/date-search.css +1 -1
- package/nationalarchives/components/date-search/date-search.css.map +1 -1
- package/nationalarchives/components/details/details.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.js +1 -1
- package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
- package/nationalarchives/components/fieldset/fieldset.css.map +1 -1
- package/nationalarchives/components/file-input/file-input.css.map +1 -1
- package/nationalarchives/components/file-input/file-input.js +1 -1
- package/nationalarchives/components/file-input/file-input.js.map +1 -1
- package/nationalarchives/components/file-input/file-input.mjs +3 -13
- package/nationalarchives/components/files-list/files-list.css.map +1 -1
- package/nationalarchives/components/files-list/macro-options.json +1 -1
- package/nationalarchives/components/footer/fixtures.json +2 -2
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.js +1 -1
- package/nationalarchives/components/footer/footer.js.map +1 -1
- package/nationalarchives/components/footer/footer.mjs +5 -5
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/gallery.js +1 -1
- package/nationalarchives/components/gallery/gallery.js.map +1 -1
- package/nationalarchives/components/global-header/global-header.css +1 -1
- package/nationalarchives/components/global-header/global-header.css.map +1 -1
- package/nationalarchives/components/global-header/global-header.js +1 -1
- package/nationalarchives/components/global-header/global-header.js.map +1 -1
- package/nationalarchives/components/header/header.css +1 -1
- package/nationalarchives/components/header/header.css.map +1 -1
- package/nationalarchives/components/header/header.js +1 -1
- package/nationalarchives/components/header/header.js.map +1 -1
- package/nationalarchives/components/hero/fixtures.json +7 -7
- package/nationalarchives/components/hero/hero.css +1 -1
- package/nationalarchives/components/hero/hero.css.map +1 -1
- package/nationalarchives/components/hero/hero.scss +1 -1
- package/nationalarchives/components/hero/template.njk +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/panel/panel.css.map +1 -1
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/picture/picture.css +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/picture/picture.js +1 -1
- package/nationalarchives/components/picture/picture.js.map +1 -1
- package/nationalarchives/components/picture/picture.scss +4 -0
- package/nationalarchives/components/radios/fixtures.json +52 -0
- package/nationalarchives/components/radios/radios.css +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/radios/radios.scss +26 -13
- package/nationalarchives/components/search-field/search-field.css +1 -1
- package/nationalarchives/components/search-field/search-field.css.map +1 -1
- package/nationalarchives/components/secondary-navigation/secondary-navigation.css.map +1 -1
- package/nationalarchives/components/select/select.css +1 -1
- package/nationalarchives/components/select/select.css.map +1 -1
- package/nationalarchives/components/sidebar/fixtures.json +14 -6
- package/nationalarchives/components/sidebar/macro-options.json +56 -0
- package/nationalarchives/components/sidebar/sidebar.css.map +1 -1
- package/nationalarchives/components/sidebar/sidebar.js +1 -1
- package/nationalarchives/components/sidebar/sidebar.js.map +1 -1
- package/nationalarchives/components/sidebar/template.njk +3 -3
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.js +1 -1
- package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
- package/nationalarchives/components/tabs/macro-options.json +21 -0
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.js +1 -1
- package/nationalarchives/components/tabs/tabs.js.map +1 -1
- package/nationalarchives/components/tabs/tabs.mjs +11 -1
- package/nationalarchives/components/tabs/tabs.scss +31 -33
- package/nationalarchives/components/tabs/template.njk +3 -3
- package/nationalarchives/components/tags/_index.scss +1 -0
- package/nationalarchives/components/tags/fixtures.json +194 -0
- package/nationalarchives/components/tags/macro-options.json +73 -0
- package/nationalarchives/components/tags/macro.njk +3 -0
- package/nationalarchives/components/tags/tags.css +1 -0
- package/nationalarchives/components/tags/tags.css.map +1 -0
- package/nationalarchives/components/tags/tags.scss +68 -0
- package/nationalarchives/components/tags/template.njk +20 -0
- package/nationalarchives/components/text-input/text-input.css +1 -1
- package/nationalarchives/components/text-input/text-input.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.js +1 -1
- package/nationalarchives/components/text-input/text-input.js.map +1 -1
- package/nationalarchives/components/textarea/textarea.css +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.js +1 -1
- package/nationalarchives/components/textarea/textarea.js.map +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/error-page.css +1 -1
- package/nationalarchives/error-page.css.map +1 -1
- package/nationalarchives/font-awesome.css +5 -5
- package/nationalarchives/font-awesome.css.map +1 -1
- package/nationalarchives/ie.css +1 -1
- package/nationalarchives/ie.css.map +1 -1
- package/nationalarchives/print.css +1 -1
- package/nationalarchives/print.css.map +1 -1
- package/nationalarchives/print.scss +17 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/templates/fixtures.json +25 -0
- package/nationalarchives/templates/layouts/_generic.njk +14 -2
- package/nationalarchives/tools/_colour.scss +5 -0
- package/nationalarchives/utilities/overrides/_index.scss +0 -6
- package/nationalarchives/variables/_a11y.scss +2 -0
- package/nationalarchives/variables/_forms.scss +2 -0
- package/package.json +17 -19
- package/nationalarchives/components/quick-filters/_index.scss +0 -1
- package/nationalarchives/components/quick-filters/fixtures.json +0 -131
- package/nationalarchives/components/quick-filters/macro-options.json +0 -54
- package/nationalarchives/components/quick-filters/macro.njk +0 -3
- package/nationalarchives/components/quick-filters/quick-filters.css +0 -1
- package/nationalarchives/components/quick-filters/quick-filters.css.map +0 -1
- package/nationalarchives/components/quick-filters/quick-filters.scss +0 -70
- package/nationalarchives/components/quick-filters/template.njk +0 -13
- package/nationalarchives/lib/cookie-events.mjs +0 -70
- package/nationalarchives/lib/cookies.mjs +0 -398
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/tabs/tabs.js","mappings":"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","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/tabs/tabs.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class Tabs {\n constructor($module) {\n this.$module = $module;\n this.$tabList = $module && $module.querySelector(\".tna-tabs__list\");\n this.$tabListItemLinks =\n $module &&\n this.$tabList &&\n this.$tabList.querySelectorAll(\".tna-tabs__button\");\n this.$tabItems = $module && $module.querySelectorAll(\".tna-tabs__item\");\n\n if (\n !this.$module ||\n !this.$tabList ||\n !this.$tabListItemLinks ||\n !this.$tabItems ||\n this.$tabListItemLinks.length !== this.$tabItems.length\n ) {\n return;\n }\n\n this.currentTabIndex = 0;\n this.init();\n }\n\n init() {\n this.$module.classList.add(\"tna-tabs--interactive\");\n this.$tabList.removeAttribute(\"hidden\");\n this.$tabListItemLinks.forEach(($tabListItemLink) => {\n const tabPanelID = $tabListItemLink.getAttribute(\"aria-controls\");\n $tabListItemLink.setAttribute(\"aria-selected\", false);\n const $tabPanel = document.getElementById(tabPanelID);\n $tabPanel.setAttribute(\"aria-labelledby\", $tabListItemLink.id);\n $tabPanel.setAttribute(\"role\", \"tabpanel\");\n $tabListItemLink.addEventListener(\n \"click\",\n (event) => this.handleItemLinkClick(event),\n true,\n );\n });\n this.switchTabByIndex(this.currentTabIndex);\n this.$module.addEventListener(\"keydown\", (event) =>\n this.handleItemLinkKeyDown(event),\n );\n }\n\n handleItemLinkClick(itemLinkClickEvent) {\n itemLinkClickEvent.preventDefault();\n const targetItem =\n itemLinkClickEvent.currentTarget.getAttribute(\"aria-controls\");\n this.switchTabByID(targetItem);\n }\n\n handleItemLinkKeyDown(itemLinkKeyDownEvent) {\n let preventDefaultKeyAction = false;\n switch (itemLinkKeyDownEvent.key) {\n case \"ArrowLeft\":\n case \"ArrowUp\":\n this.previousTab();\n preventDefaultKeyAction = true;\n break;\n case \"ArrowRight\":\n case \"ArrowDown\":\n this.nextTab();\n preventDefaultKeyAction = true;\n break;\n case \"Home\":\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(0, true);\n preventDefaultKeyAction = true;\n break;\n case \"End\":\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.$tabListItemLinks.length - 1, true);\n preventDefaultKeyAction = true;\n break;\n default:\n break;\n }\n if (preventDefaultKeyAction) {\n itemLinkKeyDownEvent.stopPropagation();\n itemLinkKeyDownEvent.preventDefault();\n }\n }\n\n nextTab() {\n /* eslint-disable-next-line no-magic-numbers */\n if (this.currentTabIndex < this.$tabListItemLinks.length - 1) {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.currentTabIndex + 1, true);\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(0, true);\n }\n }\n\n previousTab() {\n /* eslint-disable-next-line no-magic-numbers */\n if (this.currentTabIndex >= 1) {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.currentTabIndex - 1, true);\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.$tabListItemLinks.length - 1, true);\n }\n }\n\n switchTabByIndex(newIndex, switchFocus = false) {\n this.currentTabIndex = newIndex;\n this.$tabListItemLinks.forEach(($tabListItemLink, index) => {\n if (index === this.currentTabIndex) {\n $tabListItemLink.setAttribute(\"aria-selected\", true);\n $tabListItemLink.setAttribute(\"tabindex\", \"0\");\n if (switchFocus) {\n $tabListItemLink.focus();\n }\n } else {\n $tabListItemLink.setAttribute(\"aria-selected\", false);\n $tabListItemLink.setAttribute(\"tabindex\", \"-1\");\n }\n });\n this.$tabItems.forEach(($tabItem, index) => {\n if (index === this.currentTabIndex) {\n $tabItem.removeAttribute(\"hidden\");\n $tabItem.setAttribute(\"tabindex\", \"0\");\n } else {\n $tabItem.setAttribute(\"hidden\", \"\");\n $tabItem.setAttribute(\"tabindex\", \"-1\");\n }\n });\n }\n\n switchTabByID(targetId) {\n const index = Array.from(this.$tabItems).findIndex(\n ($tabItem) => $tabItem.getAttribute(\"id\") === targetId,\n );\n this.switchTabByIndex(index);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Tabs","constructor","$module","this","$tabList","querySelector","$tabListItemLinks","querySelectorAll","$tabItems","length","currentTabIndex","init","classList","add","removeAttribute","forEach","$tabListItemLink","tabPanelID","getAttribute","setAttribute","$tabPanel","document","getElementById","id","addEventListener","event","handleItemLinkClick","switchTabByIndex","handleItemLinkKeyDown","itemLinkClickEvent","preventDefault","targetItem","currentTarget","switchTabByID","itemLinkKeyDownEvent","preventDefaultKeyAction","previousTab","nextTab","stopPropagation","newIndex","switchFocus","index","focus","$tabItem","targetId","Array","from","findIndex"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"components/tabs/tabs.js","mappings":"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","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/tabs/tabs.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nconst __webpack_require__ = {};\n\n","// define getter/value functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class Tabs {\n constructor($module) {\n this.$module = $module;\n this.$tabList = $module && $module.querySelector(\".tna-tabs__list\");\n this.$tabListItemLinks =\n $module &&\n this.$tabList &&\n this.$tabList.querySelectorAll(\".tna-tabs__button\");\n this.$tabItems = $module && $module.querySelectorAll(\".tna-tabs__item\");\n\n if (\n !this.$module ||\n !this.$tabList ||\n !this.$tabListItemLinks ||\n !this.$tabItems ||\n this.$tabListItemLinks.length !== this.$tabItems.length\n ) {\n return;\n }\n\n this.currentTabIndex = this.$module.dataset.activeTabOnLoad\n ? parseInt(this.$module.dataset.activeTabOnLoad, 10)\n : 0;\n this.allowClose = this.$module.dataset.allowClose === \"true\";\n this.init();\n }\n\n init() {\n this.$module.classList.add(\"tna-tabs--interactive\");\n this.$tabList.removeAttribute(\"hidden\");\n this.$tabListItemLinks.forEach(($tabListItemLink) => {\n const tabPanelID = $tabListItemLink.getAttribute(\"aria-controls\");\n $tabListItemLink.setAttribute(\"aria-selected\", false);\n const $tabPanel = document.getElementById(tabPanelID);\n $tabPanel.setAttribute(\"aria-labelledby\", $tabListItemLink.id);\n $tabPanel.setAttribute(\"role\", \"tabpanel\");\n $tabListItemLink.addEventListener(\n \"click\",\n (event) => this.handleItemLinkClick(event),\n true,\n );\n });\n this.switchTabByIndex(this.currentTabIndex);\n this.$module.addEventListener(\"keydown\", (event) =>\n this.handleItemLinkKeyDown(event),\n );\n }\n\n handleItemLinkClick(itemLinkClickEvent) {\n itemLinkClickEvent.preventDefault();\n const targetItem =\n itemLinkClickEvent.currentTarget.getAttribute(\"aria-controls\");\n this.switchTabByID(targetItem);\n }\n\n handleItemLinkKeyDown(itemLinkKeyDownEvent) {\n let preventDefaultKeyAction = false;\n switch (itemLinkKeyDownEvent.key) {\n case \"ArrowLeft\":\n case \"ArrowUp\":\n this.previousTab();\n preventDefaultKeyAction = true;\n break;\n case \"ArrowRight\":\n case \"ArrowDown\":\n this.nextTab();\n preventDefaultKeyAction = true;\n break;\n case \"Home\":\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(0, true);\n preventDefaultKeyAction = true;\n break;\n case \"End\":\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.$tabListItemLinks.length - 1, true);\n preventDefaultKeyAction = true;\n break;\n default:\n break;\n }\n if (preventDefaultKeyAction) {\n itemLinkKeyDownEvent.stopPropagation();\n itemLinkKeyDownEvent.preventDefault();\n }\n }\n\n nextTab() {\n /* eslint-disable-next-line no-magic-numbers */\n if (this.currentTabIndex < this.$tabListItemLinks.length - 1) {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.currentTabIndex + 1, true);\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(0, true);\n }\n }\n\n previousTab() {\n /* eslint-disable-next-line no-magic-numbers */\n if (this.currentTabIndex >= 1) {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.currentTabIndex - 1, true);\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n this.switchTabByIndex(this.$tabListItemLinks.length - 1, true);\n }\n }\n\n switchTabByIndex(newIndex, switchFocus = false) {\n this.currentTabIndex = newIndex;\n const isTabAlreadySelected =\n this.$tabListItemLinks[this.currentTabIndex]\n ?.getAttribute(\"aria-selected\")\n .toString() === \"true\";\n if (isTabAlreadySelected && this.allowClose) {\n this.currentTabIndex = -1;\n }\n this.$tabListItemLinks.forEach(($tabListItemLink, index) => {\n if (index === this.currentTabIndex) {\n $tabListItemLink.setAttribute(\"aria-selected\", true);\n $tabListItemLink.setAttribute(\"tabindex\", \"0\");\n if (switchFocus) {\n $tabListItemLink.focus();\n }\n } else {\n $tabListItemLink.setAttribute(\"aria-selected\", false);\n $tabListItemLink.setAttribute(\"tabindex\", \"-1\");\n }\n });\n this.$tabItems.forEach(($tabItem, index) => {\n if (index === this.currentTabIndex) {\n $tabItem.removeAttribute(\"hidden\");\n $tabItem.setAttribute(\"tabindex\", \"0\");\n } else {\n $tabItem.setAttribute(\"hidden\", \"\");\n $tabItem.setAttribute(\"tabindex\", \"-1\");\n }\n });\n }\n\n switchTabByID(targetId) {\n const index = Array.from(this.$tabItems).findIndex(\n ($tabItem) => $tabItem.getAttribute(\"id\") === targetId,\n );\n this.switchTabByIndex(index);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","Tabs","constructor","$module","this","$tabList","querySelector","$tabListItemLinks","querySelectorAll","$tabItems","length","currentTabIndex","dataset","activeTabOnLoad","parseInt","allowClose","init","classList","add","removeAttribute","forEach","$tabListItemLink","tabPanelID","getAttribute","setAttribute","$tabPanel","document","getElementById","id","addEventListener","event","handleItemLinkClick","switchTabByIndex","handleItemLinkKeyDown","itemLinkClickEvent","preventDefault","targetItem","currentTarget","switchTabByID","itemLinkKeyDownEvent","preventDefaultKeyAction","previousTab","nextTab","stopPropagation","newIndex","switchFocus","toString","index","focus","$tabItem","targetId","Array","from","findIndex"],"sourceRoot":""}
|
|
@@ -18,7 +18,10 @@ export class Tabs {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
this.currentTabIndex =
|
|
21
|
+
this.currentTabIndex = this.$module.dataset.activeTabOnLoad
|
|
22
|
+
? parseInt(this.$module.dataset.activeTabOnLoad, 10)
|
|
23
|
+
: 0;
|
|
24
|
+
this.allowClose = this.$module.dataset.allowClose === "true";
|
|
22
25
|
this.init();
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -106,6 +109,13 @@ export class Tabs {
|
|
|
106
109
|
|
|
107
110
|
switchTabByIndex(newIndex, switchFocus = false) {
|
|
108
111
|
this.currentTabIndex = newIndex;
|
|
112
|
+
const isTabAlreadySelected =
|
|
113
|
+
this.$tabListItemLinks[this.currentTabIndex]
|
|
114
|
+
?.getAttribute("aria-selected")
|
|
115
|
+
.toString() === "true";
|
|
116
|
+
if (isTabAlreadySelected && this.allowClose) {
|
|
117
|
+
this.currentTabIndex = -1;
|
|
118
|
+
}
|
|
109
119
|
this.$tabListItemLinks.forEach(($tabListItemLink, index) => {
|
|
110
120
|
if (index === this.currentTabIndex) {
|
|
111
121
|
$tabListItemLink.setAttribute("aria-selected", true);
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-wrap: nowrap;
|
|
18
18
|
align-items: stretch;
|
|
19
|
-
gap: spacing.space(0.5);
|
|
20
19
|
|
|
21
20
|
position: relative;
|
|
22
21
|
z-index: 2;
|
|
@@ -24,13 +23,7 @@
|
|
|
24
23
|
list-style: none;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
&--small &__list {
|
|
28
|
-
gap: spacing.space(0.25);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
26
|
&__button {
|
|
32
|
-
padding: bordersVars.$thick-border-width 0;
|
|
33
|
-
|
|
34
27
|
position: relative;
|
|
35
28
|
|
|
36
29
|
text-align: center;
|
|
@@ -41,9 +34,7 @@
|
|
|
41
34
|
|
|
42
35
|
border: 1px transparent solid;
|
|
43
36
|
border-bottom: none;
|
|
44
|
-
|
|
45
|
-
border-radius: bordersVars.$rounded-border-radius
|
|
46
|
-
bordersVars.$rounded-border-radius 0 0;
|
|
37
|
+
@include borders.rounded-border;
|
|
47
38
|
|
|
48
39
|
cursor: pointer;
|
|
49
40
|
|
|
@@ -55,34 +46,39 @@
|
|
|
55
46
|
padding-top: 0;
|
|
56
47
|
|
|
57
48
|
@include colour.colour-border("keyline");
|
|
49
|
+
border-radius: bordersVars.$rounded-border-radius
|
|
50
|
+
bordersVars.$rounded-border-radius 0 0;
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
content: "";
|
|
52
|
+
@include colour.colour-background("background");
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
position: absolute;
|
|
65
|
-
top: 100%;
|
|
66
|
-
right: 0;
|
|
67
|
-
left: 0;
|
|
68
|
-
|
|
69
|
-
@include colour.colour-background("background");
|
|
54
|
+
&:focus {
|
|
55
|
+
@include borders.rounded-border;
|
|
70
56
|
}
|
|
71
57
|
}
|
|
72
58
|
}
|
|
73
59
|
|
|
74
60
|
&__button-inner {
|
|
75
|
-
|
|
61
|
+
margin: spacing.space(0.25) spacing.space(0.25)
|
|
62
|
+
calc(spacing.space(0.25) + 1px);
|
|
63
|
+
padding: spacing.space(0.375) spacing.space(0.75);
|
|
76
64
|
|
|
77
65
|
display: block;
|
|
78
66
|
|
|
79
67
|
text-decoration: underline;
|
|
80
68
|
|
|
81
|
-
@include colour.colour-font("font-
|
|
69
|
+
@include colour.colour-font("font-base");
|
|
70
|
+
|
|
71
|
+
// @include colour.base;
|
|
72
|
+
// @include colour.tint;
|
|
73
|
+
@include colour.colour-background("background-tint");
|
|
74
|
+
|
|
75
|
+
@include borders.rounded-border;
|
|
82
76
|
}
|
|
83
77
|
|
|
84
78
|
&--small &__button-inner {
|
|
85
|
-
|
|
79
|
+
margin: spacing.space(0.125) spacing.space(0.125)
|
|
80
|
+
calc(spacing.space(0.125) + 1px);
|
|
81
|
+
padding: spacing.space(0.25) spacing.space(0.5);
|
|
86
82
|
|
|
87
83
|
@include typography.font-size(16);
|
|
88
84
|
}
|
|
@@ -95,7 +91,8 @@
|
|
|
95
91
|
&__button[aria-selected="true"] &__button-inner {
|
|
96
92
|
text-decoration: none;
|
|
97
93
|
|
|
98
|
-
|
|
94
|
+
background: transparent;
|
|
95
|
+
|
|
99
96
|
border-radius: #{bordersVars.$rounded-border-radius - 1px}
|
|
100
97
|
#{bordersVars.$rounded-border-radius - 1px} 0 0;
|
|
101
98
|
}
|
|
@@ -107,22 +104,23 @@
|
|
|
107
104
|
|
|
108
105
|
position: relative;
|
|
109
106
|
z-index: 1;
|
|
107
|
+
|
|
108
|
+
&:has(:focus-visible) {
|
|
109
|
+
z-index: 3;
|
|
110
|
+
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
&__item {
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
margin-top: -1px;
|
|
115
|
+
|
|
116
|
+
border-radius: 0.1px 0.1px #{bordersVars.$rounded-border-radius}
|
|
117
|
+
#{bordersVars.$rounded-border-radius};
|
|
118
|
+
|
|
119
|
+
@include a11y.focus-indicator-only-on-keyboard-focus;
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
&--interactive &__item {
|
|
118
123
|
padding: spacing.space(1);
|
|
119
124
|
@include colour.colour-border("keyline", 1px, solid);
|
|
120
125
|
}
|
|
121
|
-
|
|
122
|
-
&--tint#{&}--interactive &__button[aria-selected="true"],
|
|
123
|
-
&--tint#{&}--interactive &__button:hover &__button-inner,
|
|
124
|
-
&--tint#{&}--interactive &__button:focus-visible &__button-inner,
|
|
125
|
-
&--tint#{&}--interactive &__items {
|
|
126
|
-
@include colour.tint;
|
|
127
|
-
}
|
|
128
126
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
|
2
|
-
{%- if params.
|
|
3
|
-
{%- set containerClasses = containerClasses.concat('tna-tabs--
|
|
2
|
+
{%- if params.small -%}
|
|
3
|
+
{%- set containerClasses = containerClasses.concat('tna-tabs--small') -%}
|
|
4
4
|
{%- endif -%}
|
|
5
5
|
{%- set classes = containerClasses | join(' ') -%}
|
|
6
|
-
<div class="tna-tabs{% if classes %} {{ classes }}{% endif %}" data-module="tna-tabs"{% for attribute, value in params.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
|
6
|
+
<div class="tna-tabs{% if classes %} {{ classes }}{% endif %}" data-module="tna-tabs"{% if params.activeTabOnLoad %} data-active-tab-on-load="{{ params.activeTabOnLoad }}"{% endif %}{% if params.allowClose %} data-allow-close="true"{% endif %}{% for attribute, value in params.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
|
7
7
|
<div class="tna-tabs__list" role="tablist" hidden>
|
|
8
8
|
{%- for item in params.items %}
|
|
9
9
|
<button type="button" class="tna-tabs__button" id="{{ item.id }}-tab" aria-controls="{{ item.id }}" role="tab">
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use "tags";
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "tags",
|
|
3
|
+
"fixtures": [
|
|
4
|
+
{
|
|
5
|
+
"name": "plain",
|
|
6
|
+
"options": {
|
|
7
|
+
"items": [
|
|
8
|
+
{
|
|
9
|
+
"label": "All",
|
|
10
|
+
"href": "#?filter=all",
|
|
11
|
+
"selected": true
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"label": "Medieval (974—1485)",
|
|
15
|
+
"title": "Medieval",
|
|
16
|
+
"href": "#?filter=alpha"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"label": "Early Modern (1485—1714)",
|
|
20
|
+
"href": "#?filter=beta"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "Georgians (1714—1837)"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"label": "Victorians (1837—1901)",
|
|
27
|
+
"title": "Victorians"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"html": "<ul class=\"tna-tags\"><li class=\"tna-tags__item tna-tags__item--selected\"><a href=\"#?filter=all\" class=\"tna-tags__link\">All</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=alpha\" aria-label=\"Medieval\" title=\"Medieval\" class=\"tna-tags__link\">Medieval (974—1485)</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=beta\" class=\"tna-tags__link\">Early Modern (1485—1714)</a></li><li class=\"tna-tags__item\"><span class=\"tna-tags__link\">Georgians (1714—1837)</span></li><li class=\"tna-tags__item\"><span class=\"tna-tags__link\">Victorians (1837—1901)</span></li></ul>",
|
|
32
|
+
"hidden": false
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "stacked",
|
|
36
|
+
"options": {
|
|
37
|
+
"items": [
|
|
38
|
+
{
|
|
39
|
+
"label": "All",
|
|
40
|
+
"href": "#?filter=all",
|
|
41
|
+
"selected": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"label": "Alpha",
|
|
45
|
+
"href": "#?filter=alpha"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"label": "Beta",
|
|
49
|
+
"href": "#?filter=beta"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"label": "Gamma",
|
|
53
|
+
"href": "#?filter=gamma"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"stack": true
|
|
57
|
+
},
|
|
58
|
+
"html": "<ul class=\"tna-tags tna-tags--stacked\"><li class=\"tna-tags__item tna-tags__item--selected\"><a href=\"#?filter=all\" class=\"tna-tags__link\">All</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=alpha\" class=\"tna-tags__link\">Alpha</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=beta\" class=\"tna-tags__link\">Beta</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=gamma\" class=\"tna-tags__link\">Gamma</a></li></ul>",
|
|
59
|
+
"hidden": false
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "small",
|
|
63
|
+
"options": {
|
|
64
|
+
"items": [
|
|
65
|
+
{
|
|
66
|
+
"label": "All",
|
|
67
|
+
"href": "#?filter=all",
|
|
68
|
+
"selected": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"label": "Alpha",
|
|
72
|
+
"href": "#?filter=alpha"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"label": "Beta",
|
|
76
|
+
"href": "#?filter=beta"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"label": "Gamma",
|
|
80
|
+
"href": "#?filter=gamma"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"small": true
|
|
84
|
+
},
|
|
85
|
+
"html": "<ul class=\"tna-tags tna-tags--small\"><li class=\"tna-tags__item tna-tags__item--selected\"><a href=\"#?filter=all\" class=\"tna-tags__link\">All</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=alpha\" class=\"tna-tags__link\">Alpha</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=beta\" class=\"tna-tags__link\">Beta</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=gamma\" class=\"tna-tags__link\">Gamma</a></li></ul>",
|
|
86
|
+
"hidden": false
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "items with classes",
|
|
90
|
+
"options": {
|
|
91
|
+
"items": [
|
|
92
|
+
{
|
|
93
|
+
"label": "All",
|
|
94
|
+
"href": "#?filter=all",
|
|
95
|
+
"classes": "test-class-1"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"label": "Alpha",
|
|
99
|
+
"href": "#?filter=alpha",
|
|
100
|
+
"classes": "test-class-2"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"label": "Beta",
|
|
104
|
+
"classes": "test-class-3"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
"html": "<ul class=\"tna-tags\"><li class=\"tna-tags__item\"><a href=\"#?filter=all\" class=\"tna-tags__link test-class-1\">All</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=alpha\" class=\"tna-tags__link test-class-2\">Alpha</a></li><li class=\"tna-tags__item\"><span class=\"tna-tags__link test-class-3\">Beta</span></li></ul>",
|
|
109
|
+
"hidden": false
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "items with attributes",
|
|
113
|
+
"options": {
|
|
114
|
+
"items": [
|
|
115
|
+
{
|
|
116
|
+
"label": "All",
|
|
117
|
+
"href": "#?filter=all",
|
|
118
|
+
"attributes": {
|
|
119
|
+
"data-test-1": "test-attribute-1"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"label": "Alpha",
|
|
124
|
+
"href": "#?filter=alpha",
|
|
125
|
+
"attributes": {
|
|
126
|
+
"data-test-2": "test-attribute-2"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"label": "Beta",
|
|
131
|
+
"classes": "test-class-3",
|
|
132
|
+
"attributes": {
|
|
133
|
+
"data-test-3": "test-attribute-3"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
"html": "<ul class=\"tna-tags\"><li class=\"tna-tags__item\"><a href=\"#?filter=all\" class=\"tna-tags__link\" data-test-1=\"test-attribute-1\">All</a></li><li class=\"tna-tags__item\"><a href=\"#?filter=alpha\" class=\"tna-tags__link\" data-test-2=\"test-attribute-2\">Alpha</a></li><li class=\"tna-tags__item\"><span class=\"tna-tags__link test-class-3\" data-test-3=\"test-attribute-3\">Beta</span></li></ul>",
|
|
139
|
+
"hidden": false
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "with classes",
|
|
143
|
+
"options": {
|
|
144
|
+
"items": [
|
|
145
|
+
{
|
|
146
|
+
"label": "Alpha",
|
|
147
|
+
"href": "?alpha",
|
|
148
|
+
"selected": true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"label": "Beta",
|
|
152
|
+
"href": "?beta",
|
|
153
|
+
"classes": "test-class-2"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"label": "Gamma",
|
|
157
|
+
"href": "?gamma"
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"classes": "test-class"
|
|
161
|
+
},
|
|
162
|
+
"html": "<ul class=\"tna-tags test-class\"><li class=\"tna-tags__item tna-tags__item--selected\"><a href=\"?alpha\" class=\"tna-tags__link\">Alpha</a></li><li class=\"tna-tags__item\"><a href=\"?beta\" class=\"tna-tags__link test-class-2\">Beta</a></li><li class=\"tna-tags__item\"><a href=\"?gamma\" class=\"tna-tags__link\">Gamma</a></li></ul>",
|
|
163
|
+
"hidden": false
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "with attributes",
|
|
167
|
+
"options": {
|
|
168
|
+
"items": [
|
|
169
|
+
{
|
|
170
|
+
"label": "Alpha",
|
|
171
|
+
"href": "?alpha",
|
|
172
|
+
"selected": true
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"label": "Beta",
|
|
176
|
+
"href": "?beta",
|
|
177
|
+
"attributes": {
|
|
178
|
+
"data-testattribute2": "foobar2"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"label": "Gamma",
|
|
183
|
+
"href": "?gamma"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"attributes": {
|
|
187
|
+
"data-testattribute": "foobar"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"html": "<ul class=\"tna-tags\" data-testattribute=\"foobar\"><li class=\"tna-tags__item tna-tags__item--selected\"><a href=\"?alpha\" class=\"tna-tags__link\">Alpha</a></li><li class=\"tna-tags__item\"><a href=\"?beta\" class=\"tna-tags__link\" data-testattribute2=\"foobar2\">Beta</a></li><li class=\"tna-tags__item\"><a href=\"?gamma\" class=\"tna-tags__link\">Gamma</a></li></ul>",
|
|
191
|
+
"hidden": false
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "items",
|
|
4
|
+
"type": "array",
|
|
5
|
+
"required": true,
|
|
6
|
+
"description": "A list of items to display as tags.",
|
|
7
|
+
"params": [
|
|
8
|
+
{
|
|
9
|
+
"name": "label",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"required": true,
|
|
12
|
+
"description": "The text label for the tag."
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "href",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"required": false,
|
|
18
|
+
"description": "An optional URL for the tag item. If not provided, the tag will be rendered as a plain text item."
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "title",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"required": false,
|
|
24
|
+
"description": "If an `href` is specified, this is an optional title attribute for the tag item."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "selected",
|
|
28
|
+
"type": "boolean",
|
|
29
|
+
"required": false,
|
|
30
|
+
"description": "If `true`, highlight the tag as selected.",
|
|
31
|
+
"default": false
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "classes",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"required": false,
|
|
37
|
+
"description": "Classes to add to the tag item."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "attributes",
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": false,
|
|
43
|
+
"description": "HTML attributes (for example data attributes) to add to the tag item."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "stack",
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"required": false,
|
|
51
|
+
"description": "If `true`, stack the tags vertically.",
|
|
52
|
+
"default": false
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "small",
|
|
56
|
+
"type": "boolean",
|
|
57
|
+
"required": false,
|
|
58
|
+
"description": "If `true`, reduce the font size and padding of the tag items.",
|
|
59
|
+
"default": false
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "classes",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"required": false,
|
|
65
|
+
"description": "Classes to add to the tags."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "attributes",
|
|
69
|
+
"type": "object",
|
|
70
|
+
"required": false,
|
|
71
|
+
"description": "HTML attributes (for example data attributes) to add to the tags."
|
|
72
|
+
}
|
|
73
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.tna-tags{margin-top:2rem}.tna-tags:first-child{margin-top:0}.tna-tags{display:flex;flex-wrap:wrap;gap:0.5rem 0.75rem;list-style:none}.tna-tags--small{gap:0.5rem;font-size:1rem}.tna-tags--stacked{flex-direction:column;align-items:flex-start}.tna-tags__item{position:relative}.tna-tags__link{padding:0 0.625rem;display:block;line-height:1.75;border:1px var(--keyline, rgba(38, 38, 42, 0.25)) solid;border-radius:2px}.tna-tags__item--selected .tna-tags__link{padding-left:calc(0.625rem + 5px);font-weight:700}.tna-tags__item--selected .tna-tags__link::after{content:"";position:absolute;top:0;bottom:0;left:0;border-left:5px var(--accent-border, rgb(140, 150, 148)) solid;border-radius:2px 0 0 2px}.tna-tags--small .tna-tags__link{padding-inline:0.5rem}.tna-tags--small .tna-tags__item--selected .tna-tags__link{padding-left:calc(0.5rem + 5px)}/*# sourceMappingURL=tags.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/tools/_spacing.scss","../../../../src/nationalarchives/components/tags/tags.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_borders.scss","../../../../src/nationalarchives/variables/_borders.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"AA0BA,UACE,gBAUA,sBACE,aChCJ,UAGE,aACA,eACA,mBAEA,gBAEA,iBACE,WCVF,eDeA,mBACE,sBACA,uBAGF,gBACE,kBAGF,gBACE,mBAEA,cAEA,iBE2EE,wDC3GJ,cCDsB,IJuCtB,0CACE,kCCnBF,YIiBsB,ILMpB,iDACE,WAEA,kBACA,MACA,SACA,OEgDA,+DF7CA,0BAKJ,iCACE,sBAGF,2DACE","file":"tags.css","sourcesContent":["@use \"sass:map\";\n@use \"sass:math\";\n@use \"../variables/spacing\";\n@use \"../variables/typography\";\n@use \"../tools/media\";\n\n/*\n * ------------------------------------------\n * Spacing is created with rem rather than px\n * units as when users use a custom font size\n * some browsers handle the resize of rem and\n * em separately from px which causes spacing\n * and layout issues, so to ensure everything\n * remaians consistent we use rem for spacing\n * and typography. The original intention was\n * separation so that we could scale the type\n * without affecting spacing, but in practice\n * there are too many ways to change the font\n * size in various browsers and devices\n * ------------------------------------------\n */\n@function space($size) {\n // @return #{$size * spacing.$spacing-unit-px}px;\n @return #{$size}rem;\n}\n\n%space-above {\n margin-top: space(2);\n @extend %no-space-above-for-first-children;\n}\n\n%space-only-above {\n margin: #{space(2)} 0 0;\n @extend %no-space-above-for-first-children;\n}\n\n%no-space-above-for-first-children {\n &:first-child {\n margin-top: 0;\n }\n}\n\n@mixin space-above($zero-other-margins: false) {\n @if $zero-other-margins {\n @extend %space-only-above;\n } @else {\n @extend %space-above;\n }\n}\n\n@mixin no-spacing-generator($suffix: \"\") {\n @if $suffix != \"\" {\n $suffix: \"-\" + $suffix;\n }\n @each $property in margin, padding {\n @each $direction in top, bottom {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix},\n .tna-\\!--no-#{$property}-#{$combined-direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n } @else {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n }\n }\n }\n}\n\n@mixin spacing-generator($suffix: \"\") {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n\n @include media.on-mobile {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing-mobile {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n }\n}\n","@use \"../../variables/borders\" as bordersVars;\n@use \"../../tools/borders\";\n@use \"../../tools/colour\";\n@use \"../../tools/spacing\";\n@use \"../../tools/typography\";\n\n.tna-tags {\n @include spacing.space-above;\n\n display: flex;\n flex-wrap: wrap;\n gap: spacing.space(0.5) spacing.space(0.75);\n\n list-style: none;\n\n &--small {\n gap: spacing.space(0.5);\n\n @include typography.font-size(16);\n }\n\n &--stacked {\n flex-direction: column;\n align-items: flex-start;\n }\n\n &__item {\n position: relative;\n }\n\n &__link {\n padding: 0 spacing.space(0.625);\n\n display: block;\n\n line-height: 1.75;\n\n @include colour.colour-border(\"keyline\", 1px);\n @include borders.rounded-border;\n }\n\n &__item--selected &__link {\n padding-left: calc(spacing.space(0.625) + bordersVars.$thick-border-width);\n\n @include typography.main-font-weight-bold;\n\n &::after {\n content: \"\";\n\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n @include colour.thick-keyline-accent(left);\n border-radius: bordersVars.$rounded-border-radius 0 0\n bordersVars.$rounded-border-radius;\n }\n }\n\n &--small &__link {\n padding-inline: spacing.space(0.5);\n }\n\n &--small &__item--selected &__link {\n padding-left: calc(spacing.space(0.5) + bordersVars.$thick-border-width);\n }\n}\n","@use \"sass:math\";\n@use \"../variables/typography\";\n@use \"colour\";\n@use \"media\";\n\n@mixin font-size($font-size-px) {\n font-size: #{math.div($font-size-px, typography.$relative-1rem-px)}rem;\n}\n\n@mixin relative-font-size($font-size-px) {\n @warn \"relative-font-size() will soon be deprecated in favour of font-size().\";\n @include font-size($font-size-px);\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\n}\n\n@mixin main-font-weight-medium {\n font-weight: typography.$main-font-weight-medium;\n}\n\n@mixin main-font-weight-bold {\n font-weight: typography.$main-font-weight-bold;\n}\n\n@mixin main-font($bold: false) {\n font-family: typography.$main-font-family;\n font-variation-settings: \"wdth\" 100;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n}\n\n@mixin heading-font {\n font-family: typography.$heading-font-family;\n font-weight: typography.$heading-font-weight;\n}\n\n@mixin detail-font($bold: false) {\n font-family: typography.$detail-font-family;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include font-size(14);\n line-height: 1.1;\n text-transform: uppercase;\n}\n\n@mixin interactable-text-decoration {\n text-decoration-thickness: typography.$interactable-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin heading-generator(\n $font-size-default,\n $font-size-medium,\n $font-size-small,\n $font-size-tiny,\n $line-height\n) {\n $small-and-tiny-identical: $font-size-small == $font-size-tiny;\n $medium-small-and-tiny-identical: $font-size-medium == $font-size-small and\n $small-and-tiny-identical;\n $all-identical: $font-size-default == $font-size-medium and\n $medium-small-and-tiny-identical and $small-and-tiny-identical;\n line-height: $line-height;\n @include font-size($font-size-default);\n\n @if $all-identical != true {\n @if $medium-small-and-tiny-identical != true {\n @include media.on-medium {\n @include font-size($font-size-medium);\n }\n\n @if $small-and-tiny-identical != true {\n @include media.on-small {\n @include font-size($font-size-small);\n }\n\n @include media.on-tiny {\n @include font-size($font-size-tiny);\n }\n } @else {\n @include media.on-mobile {\n @include font-size($font-size-small);\n }\n }\n } @else {\n @include media.on-smaller-than-large {\n @include font-size($font-size-medium);\n }\n }\n }\n}\n","@use \"sass:list\";\n@use \"sass:map\";\n@use \"sass:meta\";\n@use \"../variables/a11y\";\n@use \"../variables/borders\";\n@use \"../variables/forms\";\n@use \"../variables/colour\";\n@use \"../variables/features\";\n@use \"../tools/media\";\n\n$base-colours: (\n \"background\",\n \"font-base\",\n \"font-dark\",\n \"font-light\",\n \"icon-light\",\n \"link\",\n \"link-visited\",\n \"keyline\",\n \"keyline-dark\"\n);\n\n@function brand-colour($colour, $opacity: 1) {\n @return colour.brand-colour($colour, $opacity);\n}\n\n@mixin colour-css-vars($excludes...) {\n @each $name, $value in colour.$colour-palette-default {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index((\"keyline\", \"keyline-dark\"), $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@function colour-var($colour) {\n @return var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n );\n}\n\n@mixin colour-font($colour, $important: false) {\n color: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: colour-var($colour)\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)}\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-border(\n $colour,\n $width: \"\",\n $style: solid,\n $direction: \"\",\n $important: false\n) {\n @if $direction != \"\" {\n @if $width != \"\" {\n border-#{$direction}: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-#{$direction}-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-color: var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n )\n if(sass($important): !important; else: null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n outline-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n%colour-input {\n @include colour-font(\"input-foreground\");\n @include colour-background(\"input-background\");\n @include colour-border(\"input-border\", forms.$form-field-border-width);\n\n &:hover {\n outline: a11y.$focus-outline-active-total-width var(--keyline) solid;\n }\n}\n\n@mixin colour-input() {\n @extend %colour-input;\n}\n\n@mixin thick-keyline($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-dark($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline-dark\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline-dark\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-accent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"accent-border\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"accent-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-error($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\n \"form-error-border\",\n $border-width,\n solid,\n $direction\n );\n } @else {\n @include colour-border(\"form-error-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-brand($direction: \"\", $brandColour, $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width #{brand-colour($brandColour)} solid;\n } @else {\n border: $border-width #{brand-colour($brandColour)} solid;\n }\n}\n\n@mixin thick-keyline-transparent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width transparent solid;\n } @else {\n border: $border-width transparent solid;\n }\n}\n\n%always-light {\n @include colour-css-vars;\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast;\n }\n}\n\n@mixin always-light {\n @extend %always-light;\n}\n\n%contrast {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin contrast {\n @extend %contrast;\n}\n\n%contrast-on-mobile {\n @include media.on-mobile {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\n}\n\n%base {\n @each $name, $value in $base-colours {\n --#{$name}: var(--base-#{$value});\n }\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin base {\n @extend %base;\n}\n\n%tint {\n --background: var(--background-tint);\n\n @include colour-background(\"background\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent {\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%accent-light {\n --background: var(--accent-background-light);\n --font-base: #{map.get(colour.$colour-palette-default, \"font-base\")};\n --font-dark: #{map.get(colour.$colour-palette-default, \"font-dark\")};\n --font-light: #{map.get(colour.$colour-palette-default, \"font-light\")};\n --icon-light: #{map.get(colour.$colour-palette-default, \"icon-light\")};\n --keyline: #{map.get(colour.$colour-palette-default, \"keyline\")};\n --keyline-dark: #{map.get(colour.$colour-palette-default, \"keyline-dark\")};\n --button-text: #{map.get(colour.$colour-palette-default, \"button-text\")};\n --button-background: #{map.get(\n colour.$colour-palette-default,\n \"button-background\"\n )};\n --button-hover-text: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-text\"\n )};\n --button-hover-background: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-background\"\n )};\n --accent-border: var(--accent-background);\n\n @include colour-background(\"background\");\n @include colour-font(\"font-base\");\n\n .tna-template--system-theme & {\n @media (prefers-color-scheme: dark) {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n }\n\n .tna-template--dark-theme & {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n%yellow-accent {\n --accent-background: #{colour.brand-colour(\"yellow\")} !important;\n --accent-background-light: #{colour.brand-colour(\"cream\")} !important;\n --accent-border: #{colour.brand-colour(\"yellow\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"yellow\")} !important;\n --accent-font-base: #{colour.brand-colour(\"black\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"black\")} !important;\n --accent-font-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"black\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"black\")} !important;\n --accent-keyline: #{colour.brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"black\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"yellow\")} !important;\n}\n\n@mixin yellow-accent {\n @extend %yellow-accent;\n}\n\n%accent-lighter-text {\n --accent-font-base: #{colour.brand-colour(\"white\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"white\")} !important;\n --accent-font-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"white\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"white\")} !important;\n --accent-keyline: #{colour.brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"white\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"white\")} !important;\n}\n\n%black-accent {\n --accent-background: #{colour.brand-colour(\"black\")} !important;\n --accent-background-light: #{colour.brand-colour(\"light-grey\")} !important;\n --accent-border: #{colour.brand-colour(\"black\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"grey\")} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"grey\")} !important;\n}\n\n@mixin black-accent {\n @extend %accent-lighter-text;\n @extend %black-accent;\n}\n\n%pink-accent {\n --accent-background: #{colour.brand-colour(\"maroon\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-pink\")} !important;\n --accent-border: #{colour.brand-colour(\"maroon\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"pink\")} !important;\n --button-accented-background: #{colour.brand-colour(\"maroon\")} !important;\n}\n\n@mixin pink-accent {\n @extend %accent-lighter-text;\n @extend %pink-accent;\n}\n\n%orange-accent {\n --accent-background: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-orange\")} !important;\n --accent-border: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"orange\")} !important;\n --button-accented-background: #{colour.brand-colour(\"chestnut\")} !important;\n}\n\n@mixin orange-accent {\n @extend %accent-lighter-text;\n @extend %orange-accent;\n}\n\n%green-accent {\n --accent-background: #{colour.brand-colour(\"forest\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-green\")} !important;\n --accent-border: #{colour.brand-colour(\"forest\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"green\")} !important;\n --button-accented-background: #{colour.brand-colour(\"forest\")} !important;\n}\n\n@mixin green-accent {\n @extend %accent-lighter-text;\n @extend %green-accent;\n}\n\n%blue-accent {\n --accent-background: #{colour.brand-colour(\"navy\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-blue\")} !important;\n --accent-border: #{colour.brand-colour(\"navy\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"blue\")} !important;\n --button-accented-background: #{colour.brand-colour(\"navy\")} !important;\n}\n\n@mixin blue-accent {\n @extend %accent-lighter-text;\n @extend %blue-accent;\n}\n\n@mixin on-high-contrast {\n @media (prefers-contrast: more) {\n @content;\n }\n}\n\n@mixin on-forced-colours {\n @media (forced-colors: active) {\n @content;\n }\n}\n\n@mixin on-high-contrast-and-forced-colours {\n @include on-forced-colours {\n @content;\n }\n\n @include on-high-contrast {\n @content;\n }\n}\n\n%image-loader-background {\n background: linear-gradient(\n -45deg,\n rgb(0 0 0 / 25%),\n rgb(255 255 255 / 25%),\n rgb(0 0 0 / 25%)\n );\n background-size: 500% 500%;\n background-position: 0 50%;\n\n animation: image-loader-background ease-in-out 1.2s infinite;\n\n @media (prefers-reduced-motion) {\n animation: none !important;\n }\n}\n\n@mixin image-loader-background {\n @if features.$image-loader-animations {\n @extend %image-loader-background;\n }\n}\n","@use \"../variables/borders\";\n\n@mixin rounded-border {\n border-radius: borders.$rounded-border-radius;\n}\n","$thick-border-width: 5px !default;\n$very-thick-border-width: 8px !default;\n$rounded-border-radius: 2px !default;\n","@use \"sass:math\";\n\n/*\n * ------------------------------------------\n * The typefaces, sizes and spacings that are\n * defined in this file have been selected to\n * ensure 100% match with the latest National\n * Archives brand guidelines - avoid changing\n * or overwriting any of these values without\n * signing off with the Digital Services team\n * first\n * ------------------------------------------\n */\n\n$relative-1rem-px: 16; // 16px = 1rem\n\n/*\n * ------------------------------------------\n * When true, use the included font files for\n * Open Sans and Roboto Mono, rather than the\n * versions hosted by Google Fonts\n * ------------------------------------------\n */\n$use-local-fonts: false !default;\n\n$body-font-size-px: 19 !default;\n$body-font-size-px-medium: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: 1.75 !default;\n\n$interactable-text-decoration-offset: 0.125em !default;\n$interactable-text-decoration-thickness: #{math.div(1.5, $relative-1rem-px)}rem !default;\n$interactive-text-decoration-thickness: #{math.div(4, $relative-1rem-px)}rem !default;\n\n$main-font-family-name: \"Open Sans\" !default;\n$main-font-family:\n #{$main-font-family-name},\n sans-serif;\n$main-font-weight: 400 !default;\n$main-font-weight-medium: 600 !default;\n$main-font-weight-bold: 700 !default;\n$main-font-file: \"OpenSans-Regular.ttf\" !default;\n$main-font-file-medium: \"OpenSans-SemiBold.ttf\" !default;\n$main-font-file-bold: \"OpenSans-Bold.ttf\" !default;\n\n/*\n * ------------------------------------------\n * To use Supria Sans Condensed (which is the\n * approved heading typeface for The National\n * Archives), you need to obtain a licence to\n * properly embed the CSS files with the font\n * definitions in your service - check with a\n * member of the Digital Services team on how\n * to get a licence\n * ------------------------------------------\n */\n$heading-font-family-name: \"supria-sans-condensed\" !default;\n$heading-font-family:\n #{$heading-font-family-name},\n \"Arial Narrow\",\n sans-serif;\n$heading-font-weight: 500 !default;\n\n/*\n * ------------------------------------------\n * The detail font should be a monospace font\n * and is used for chips, supertitles as well\n * as the date search component\n * ------------------------------------------\n */\n$detail-font-family-name: \"Roboto Mono\" !default;\n$detail-font-family:\n #{$detail-font-family-name},\n monospace;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n$detail-font-file: \"RobotoMono-Regular.ttf\" !default;\n$detail-font-file-bold: \"RobotoMono-Medium.ttf\" !default;\n\n$heading-xl-font-size-default: 64 !default;\n$heading-xl-font-size-medium: 48 !default;\n$heading-xl-font-size-small: 36 !default;\n$heading-xl-font-size-tiny: $heading-xl-font-size-small !default;\n$heading-xl-line-height: 1.1 !default;\n\n$heading-l-font-size-default: 36 !default;\n$heading-l-font-size-medium: 32 !default;\n$heading-l-font-size-small: 29 !default;\n$heading-l-font-size-tiny: $heading-l-font-size-small !default;\n$heading-l-line-height: 1.15 !default;\n\n$heading-m-font-size-default: 22 !default;\n$heading-m-font-size-medium: $heading-m-font-size-default !default;\n$heading-m-font-size-small: 21 !default;\n$heading-m-font-size-tiny: $heading-m-font-size-small !default;\n$heading-m-line-height: 1.4 !default;\n\n$heading-s-font-size-default: 19 !default;\n$heading-s-font-size-medium: $heading-s-font-size-default !default;\n$heading-s-font-size-small: $heading-s-font-size-default !default;\n$heading-s-font-size-tiny: $heading-s-font-size-default !default;\n$heading-s-line-height: 1.5 !default;\n\n$code-font-family: Consolas, Monaco, \"Ubuntu Mono\", monospace !default;\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@use "../../variables/borders" as bordersVars;
|
|
2
|
+
@use "../../tools/borders";
|
|
3
|
+
@use "../../tools/colour";
|
|
4
|
+
@use "../../tools/spacing";
|
|
5
|
+
@use "../../tools/typography";
|
|
6
|
+
|
|
7
|
+
.tna-tags {
|
|
8
|
+
@include spacing.space-above;
|
|
9
|
+
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
gap: spacing.space(0.5) spacing.space(0.75);
|
|
13
|
+
|
|
14
|
+
list-style: none;
|
|
15
|
+
|
|
16
|
+
&--small {
|
|
17
|
+
gap: spacing.space(0.5);
|
|
18
|
+
|
|
19
|
+
@include typography.font-size(16);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--stacked {
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&__item {
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&__link {
|
|
32
|
+
padding: 0 spacing.space(0.625);
|
|
33
|
+
|
|
34
|
+
display: block;
|
|
35
|
+
|
|
36
|
+
line-height: 1.75;
|
|
37
|
+
|
|
38
|
+
@include colour.colour-border("keyline", 1px);
|
|
39
|
+
@include borders.rounded-border;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__item--selected &__link {
|
|
43
|
+
padding-left: calc(spacing.space(0.625) + bordersVars.$thick-border-width);
|
|
44
|
+
|
|
45
|
+
@include typography.main-font-weight-bold;
|
|
46
|
+
|
|
47
|
+
&::after {
|
|
48
|
+
content: "";
|
|
49
|
+
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
|
|
55
|
+
@include colour.thick-keyline-accent(left);
|
|
56
|
+
border-radius: bordersVars.$rounded-border-radius 0 0
|
|
57
|
+
bordersVars.$rounded-border-radius;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&--small &__link {
|
|
62
|
+
padding-inline: spacing.space(0.5);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--small &__item--selected &__link {
|
|
66
|
+
padding-left: calc(spacing.space(0.5) + bordersVars.$thick-border-width);
|
|
67
|
+
}
|
|
68
|
+
}
|