@nationalarchives/frontend 0.1.13-prerelease → 0.1.15-prerelease
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/_features.scss +0 -3
- 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 +7 -7
- package/nationalarchives/all.scss +2 -5
- package/nationalarchives/components/breadcrumbs/_index.scss +62 -19
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +2 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +63 -0
- package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +28 -0
- package/nationalarchives/components/breadcrumbs/fixtures.json +1 -1
- package/nationalarchives/components/breadcrumbs/template.njk +3 -3
- package/nationalarchives/components/button/fixtures.json +5 -5
- package/nationalarchives/components/button/template.njk +1 -1
- package/nationalarchives/components/card/_index.scss +72 -29
- package/nationalarchives/components/card/card.stories.js +6 -1
- package/nationalarchives/components/card/fixtures.json +2 -2
- package/nationalarchives/components/card/macro-options.json +6 -6
- package/nationalarchives/components/card/template.njk +5 -5
- package/nationalarchives/components/filters/filters.stories.js +1 -1
- package/nationalarchives/components/footer/_index.scss +7 -4
- package/nationalarchives/components/footer/template.njk +1 -1
- package/nationalarchives/components/header/_index.scss +17 -11
- package/nationalarchives/components/header/header.stories.js +73 -28
- package/nationalarchives/components/header/template.njk +1 -1
- package/nationalarchives/components/hero/_index.scss +4 -15
- package/nationalarchives/components/hero/hero.stories.js +2 -0
- package/nationalarchives/components/index-grid/_index.scss +20 -5
- package/nationalarchives/components/index-grid/index-grid.stories.js +6 -2
- package/nationalarchives/components/index-grid/macro-options.json +22 -2
- package/nationalarchives/components/index-grid/template.njk +12 -6
- package/nationalarchives/components/message/_index.scss +3 -1
- package/nationalarchives/components/picture/_index.scss +13 -32
- package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -1
- package/nationalarchives/components/tabs/_index.scss +6 -12
- package/nationalarchives/components/tabs/tabs.stories.js +3 -1
- package/nationalarchives/patterns/featured-collection/_index.scss +1 -1
- package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +1 -1
- package/nationalarchives/patterns/featured-collection/template.njk +2 -2
- package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.mdx +85 -0
- package/nationalarchives/stories/utilities/{colour.stories.js → colour-schemes/colour-schemes.stories.js} +129 -18
- package/nationalarchives/stories/utilities/overrides/overrides.mdx +66 -0
- package/nationalarchives/stories/utilities/overrides/overrides.stories.js +36 -0
- package/nationalarchives/stories/utilities/{headings.stories.js → typography/headings.stories.js} +2 -1
- package/nationalarchives/stories/utilities/typography/typography.stories.js +34 -0
- package/nationalarchives/tools/_colour.scss +51 -53
- package/nationalarchives/tools/_typography.scss +13 -1
- package/nationalarchives/utilities/_global.scss +10 -22
- package/nationalarchives/utilities/_index.scss +1 -0
- package/nationalarchives/utilities/_overrides.scss +17 -0
- package/nationalarchives/utilities/_typography.scss +36 -27
- package/nationalarchives/variables/_colour.scss +50 -27
- package/nationalarchives/variables/_index.scss +1 -0
- package/nationalarchives/variables/_spacing.scss +7 -0
- package/nationalarchives/variables/_typography.scss +2 -1
- package/package.json +1 -1
- package/nationalarchives/components/card/card.js +0 -2
- package/nationalarchives/components/card/card.js.map +0 -1
- package/nationalarchives/components/card/card.mjs +0 -45
- package/nationalarchives/stories/utilities/typography.stories.js +0 -29
- /package/nationalarchives/stories/utilities/{heading-groups.stories.js → typography/heading-groups.stories.js} +0 -0
- /package/nationalarchives/stories/utilities/{lists.stories.js → typography/lists.stories.js} +0 -0
- /package/nationalarchives/stories/utilities/{typography.mdx → typography/typography.mdx} +0 -0
package/nationalarchives/all.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { Breadcrumbs } from "./components/breadcrumbs/breadcrumbs.mjs";
|
2
2
|
import { Header } from "./components/header/header.mjs";
|
3
3
|
import { Picture } from "./components/picture/picture.mjs";
|
4
4
|
import { SensitiveImage } from "./components/sensitive-image/sensitive-image.mjs";
|
@@ -45,16 +45,16 @@ const initAll = (options) => {
|
|
45
45
|
const $scope =
|
46
46
|
options.scope instanceof HTMLElement ? options.scope : document;
|
47
47
|
|
48
|
+
const $breadcrumbs = $scope.querySelector('[data-module="tna-breadcrumbs"]');
|
49
|
+
if ($breadcrumbs) {
|
50
|
+
new Breadcrumbs($breadcrumbs).init();
|
51
|
+
}
|
52
|
+
|
48
53
|
const $header = $scope.querySelector('[data-module="tna-header"]');
|
49
54
|
if ($header) {
|
50
55
|
new Header($header).init();
|
51
56
|
}
|
52
57
|
|
53
|
-
const $cards = $scope.querySelectorAll('[data-module="tna-card"]');
|
54
|
-
$cards.forEach(($card) => {
|
55
|
-
new Card($card).init();
|
56
|
-
});
|
57
|
-
|
58
58
|
const $pictures = $scope.querySelectorAll('[data-module="tna-picture"]');
|
59
59
|
$pictures.forEach(($picture) => {
|
60
60
|
new Picture($picture).init();
|
@@ -73,4 +73,4 @@ const initAll = (options) => {
|
|
73
73
|
});
|
74
74
|
};
|
75
75
|
|
76
|
-
export { initAll, Header, SensitiveImage, Tabs };
|
76
|
+
export { initAll, Breadcrumbs, Header, Picture, SensitiveImage, Tabs };
|
@@ -5,6 +5,14 @@
|
|
5
5
|
padding-top: 1rem;
|
6
6
|
padding-bottom: 1rem;
|
7
7
|
|
8
|
+
&__wrapper {
|
9
|
+
.tna-template--clicked & {
|
10
|
+
&:focus {
|
11
|
+
outline: none !important;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
8
16
|
&__list {
|
9
17
|
margin: 0;
|
10
18
|
padding: 0;
|
@@ -24,9 +32,15 @@
|
|
24
32
|
|
25
33
|
display: inline-block;
|
26
34
|
|
35
|
+
vertical-align: baseline;
|
36
|
+
|
27
37
|
content: "\203A";
|
28
38
|
}
|
29
39
|
}
|
40
|
+
|
41
|
+
&--expandable {
|
42
|
+
display: none;
|
43
|
+
}
|
30
44
|
}
|
31
45
|
|
32
46
|
&__link {
|
@@ -41,6 +55,46 @@
|
|
41
55
|
&:hover {
|
42
56
|
@include colour.colour-font("font-dark");
|
43
57
|
}
|
58
|
+
|
59
|
+
@include colour.on-high-contrast {
|
60
|
+
padding-right: 0.75rem;
|
61
|
+
padding-left: 0.75rem;
|
62
|
+
|
63
|
+
text-decoration: none;
|
64
|
+
|
65
|
+
border: 1px transparent solid;
|
66
|
+
@include colour.colour-border("keyline-dark");
|
67
|
+
|
68
|
+
&:hover {
|
69
|
+
text-decoration: underline;
|
70
|
+
|
71
|
+
@include colour.colour-font("contrast-background");
|
72
|
+
|
73
|
+
@include colour.colour-background("contrast-font-base");
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
button#{&}__link {
|
79
|
+
margin: 0;
|
80
|
+
padding: 0;
|
81
|
+
height: 100%;
|
82
|
+
|
83
|
+
font-size: inherit;
|
84
|
+
line-height: inherit;
|
85
|
+
font-weight: inherit;
|
86
|
+
|
87
|
+
background-color: transparent;
|
88
|
+
|
89
|
+
border: none;
|
90
|
+
|
91
|
+
appearance: none;
|
92
|
+
cursor: pointer;
|
93
|
+
|
94
|
+
&:hover {
|
95
|
+
text-decoration: underline;
|
96
|
+
text-decoration-thickness: 3px;
|
97
|
+
}
|
44
98
|
}
|
45
99
|
|
46
100
|
@include media.on-mobile {
|
@@ -67,28 +121,17 @@
|
|
67
121
|
// }
|
68
122
|
// }
|
69
123
|
|
70
|
-
&
|
124
|
+
&__list--collapse-on-mobile
|
125
|
+
#{&}__item:not(
|
126
|
+
:first-child,
|
127
|
+
.tna-breadcrumbs__item--expandable,
|
128
|
+
:last-child
|
129
|
+
) {
|
71
130
|
display: none;
|
72
131
|
}
|
73
|
-
}
|
74
|
-
|
75
|
-
@mixin high-contrast {
|
76
|
-
&__link {
|
77
|
-
padding-right: 0.75rem;
|
78
|
-
padding-left: 0.75rem;
|
79
|
-
|
80
|
-
border: 1px transparent solid;
|
81
|
-
@include colour.colour-border("keyline-dark");
|
82
|
-
}
|
83
|
-
}
|
84
|
-
|
85
|
-
.tna-template--high-contrast-theme & {
|
86
|
-
@include high-contrast;
|
87
|
-
}
|
88
132
|
|
89
|
-
|
90
|
-
|
91
|
-
@include high-contrast;
|
133
|
+
&__list--collapse-on-mobile #{&}__item--expandable {
|
134
|
+
display: inline-block;
|
92
135
|
}
|
93
136
|
}
|
94
137
|
}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("TNAFrontend",[],r):"object"==typeof exports?exports.TNAFrontend=r():(e.TNAFrontend=e.TNAFrontend||{},e.TNAFrontend["components/breadcrumbs/breadcrumbs"]=r())}(self,(()=>(()=>{"use strict";var e={948:(e,r,t)=>{t.d(r,{Z:()=>n});const n=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)}))}}},r={};function t(n){var i=r[n];if(void 0!==i)return i.exports;var o=r[n]={exports:{}};return e[n](o,o.exports,t),o.exports}t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{t.r(n),t.d(n,{Breadcrumbs:()=>o});var e=t(948);function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,(void 0,o=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===r(o)?o:String(o)),i)}var o}var o=function(){function r(e){!function(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}(this,r),this.$module=e,this.$breadcrumbsListWrapper=e&&e.querySelector(".tna-breadcrumbs__wrapper"),this.$breadcrumbsList=e&&this.$breadcrumbsListWrapper&&e.querySelector(".tna-breadcrumbs__list"),this.$breadcrumbs=e&&this.$breadcrumbsListWrapper&&this.$breadcrumbsList&&e.querySelectorAll(".tna-breadcrumbs__item")}var t,n;return t=r,(n=[{key:"init",value:function(){var r=this;if(this.$module&&this.$breadcrumbsListWrapper&&this.$breadcrumbsList&&this.$breadcrumbs&&this.$breadcrumbs.length>2){var t="tna-breadcrumbs-".concat((0,e.Z)()),n=document.createElement("li");n.classList.add("tna-breadcrumbs__item","tna-breadcrumbs__item--expandable");var i=document.createElement("button");i.classList.add("tna-breadcrumbs__link"),i.innerHTML="<span class='tna-visually-hidden'>Expand breadcrumbs</span>…",i.setAttribute("aria-expanded","false"),i.setAttribute("aria-controls",t),i.addEventListener("click",(function(){r.$breadcrumbsList.classList.remove("tna-breadcrumbs__list--collapse-on-mobile"),n.remove(),r.$breadcrumbsListWrapper.setAttribute("tabindex","0"),r.$breadcrumbsListWrapper.focus(),r.$breadcrumbsListWrapper.setAttribute("tabindex","-1")})),n.appendChild(i),this.$breadcrumbsList.setAttribute("id",t),this.$breadcrumbsList.insertBefore(n,this.$breadcrumbs[this.$breadcrumbs.length-2].nextSibling)}}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),r}()})(),n})()));
|
2
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"components/breadcrumbs/breadcrumbs.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,sCAAwCC,IAC9G,CATD,CASGK,MAAM,I,yDCDT,QARe,WAAH,OACT,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,UAAU,SAACC,GAAC,OAErDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAI,GAC5DI,SAAS,GAAG,GACf,C,GCLCC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAad,QAGrB,IAAIC,EAASU,EAAyBE,GAAY,CAGjDb,QAAS,CAAC,GAOX,OAHAgB,EAAoBH,GAAUZ,EAAQA,EAAOD,QAASY,GAG/CX,EAAOD,OACf,CCrBAY,EAAoBK,EAAI,CAACjB,EAASkB,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAEpB,EAASmB,IAC5EE,OAAOC,eAAetB,EAASmB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDP,EAAoBQ,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFd,EAAoBkB,EAAK9B,IACH,oBAAX+B,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAetB,EAAS+B,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAetB,EAAS,aAAc,CAAEiC,OAAO,GAAO,E,uuBCHvD,IAAMC,EAAW,WACtB,SAAAA,EAAYC,I,4FAASC,CAAA,KAAAF,GACnBG,KAAKF,QAAUA,EACfE,KAAKC,wBACHH,GAAWA,EAAQI,cAAc,6BACnCF,KAAKG,iBACHL,GACAE,KAAKC,yBACLH,EAAQI,cAAc,0BACxBF,KAAKI,aACHN,GACAE,KAAKC,yBACLD,KAAKG,kBACLL,EAAQO,iBAAiB,yBAC7B,C,QA6CC,O,EA7CAR,G,EAAA,EAAAf,IAAA,OAAAc,MAED,WAAO,IAAAU,EAAA,KACL,GACGN,KAAKF,SACLE,KAAKC,yBACLD,KAAKG,kBACLH,KAAKI,cAKJJ,KAAKI,aAAaG,OAAS,EAAG,CAChC,IAAMC,EAAW,mBAAHC,QAAsBC,EAAAA,EAAAA,MAE9BC,EAAcC,SAASC,cAAc,MAC3CF,EAAYG,UAAUC,IACpB,wBACA,qCAGF,IAAMC,EAAgBJ,SAASC,cAAc,UAC7CG,EAAcF,UAAUC,IAAI,yBAC5BC,EAAcC,UACZ,sEACFD,EAAcE,aAAa,gBAAiB,SAC5CF,EAAcE,aAAa,gBAAiBV,GAC5CQ,EAAcG,iBAAiB,SAAS,WACtCb,EAAKH,iBAAiBW,UAAUM,OAC9B,6CAEFT,EAAYS,SACZd,EAAKL,wBAAwBiB,aAAa,WAAY,KACtDZ,EAAKL,wBAAwBoB,QAC7Bf,EAAKL,wBAAwBiB,aAAa,WAAY,KACxD,IAEAP,EAAYW,YAAYN,GAExBhB,KAAKG,iBAAiBe,aAAa,KAAMV,GACzCR,KAAKG,iBAAiBoB,aACpBZ,EACAX,KAAKI,aAAaJ,KAAKI,aAAaG,OAAS,GAAGiB,YAEpD,CACF,M,oEAAC3B,CAAA,CA3DqB,E","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.mjs","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/breadcrumbs/breadcrumbs.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\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/breadcrumbs/breadcrumbs\"] = factory();\n})(self, () => {\nreturn ","const uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>\n (\n c ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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};","import uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Breadcrumbs {\n constructor($module) {\n this.$module = $module;\n this.$breadcrumbsListWrapper =\n $module && $module.querySelector(\".tna-breadcrumbs__wrapper\");\n this.$breadcrumbsList =\n $module &&\n this.$breadcrumbsListWrapper &&\n $module.querySelector(\".tna-breadcrumbs__list\");\n this.$breadcrumbs =\n $module &&\n this.$breadcrumbsListWrapper &&\n this.$breadcrumbsList &&\n $module.querySelectorAll(\".tna-breadcrumbs__item\");\n }\n\n init() {\n if (\n !this.$module ||\n !this.$breadcrumbsListWrapper ||\n !this.$breadcrumbsList ||\n !this.$breadcrumbs\n ) {\n return;\n }\n\n if (this.$breadcrumbs.length > 2) {\n const uniqueId = `tna-breadcrumbs-${uuidv4()}`;\n\n const $expandable = document.createElement(\"li\");\n $expandable.classList.add(\n \"tna-breadcrumbs__item\",\n \"tna-breadcrumbs__item--expandable\",\n );\n\n const $expandButton = document.createElement(\"button\");\n $expandButton.classList.add(\"tna-breadcrumbs__link\");\n $expandButton.innerHTML =\n \"<span class='tna-visually-hidden'>Expand breadcrumbs</span>…\";\n $expandButton.setAttribute(\"aria-expanded\", \"false\");\n $expandButton.setAttribute(\"aria-controls\", uniqueId);\n $expandButton.addEventListener(\"click\", () => {\n this.$breadcrumbsList.classList.remove(\n \"tna-breadcrumbs__list--collapse-on-mobile\",\n );\n $expandable.remove();\n this.$breadcrumbsListWrapper.setAttribute(\"tabindex\", \"0\");\n this.$breadcrumbsListWrapper.focus();\n this.$breadcrumbsListWrapper.setAttribute(\"tabindex\", \"-1\");\n });\n\n $expandable.appendChild($expandButton);\n\n this.$breadcrumbsList.setAttribute(\"id\", uniqueId);\n this.$breadcrumbsList.insertBefore(\n $expandable,\n this.$breadcrumbs[this.$breadcrumbs.length - 2].nextSibling,\n );\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","replace","c","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Breadcrumbs","$module","_classCallCheck","this","$breadcrumbsListWrapper","querySelector","$breadcrumbsList","$breadcrumbs","querySelectorAll","_this","length","uniqueId","concat","uuidv4","$expandable","document","createElement","classList","add","$expandButton","innerHTML","setAttribute","addEventListener","remove","focus","appendChild","insertBefore","nextSibling"],"sourceRoot":""}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import uuidv4 from "../../lib/uuid.mjs";
|
2
|
+
|
3
|
+
export class Breadcrumbs {
|
4
|
+
constructor($module) {
|
5
|
+
this.$module = $module;
|
6
|
+
this.$breadcrumbsListWrapper =
|
7
|
+
$module && $module.querySelector(".tna-breadcrumbs__wrapper");
|
8
|
+
this.$breadcrumbsList =
|
9
|
+
$module &&
|
10
|
+
this.$breadcrumbsListWrapper &&
|
11
|
+
$module.querySelector(".tna-breadcrumbs__list");
|
12
|
+
this.$breadcrumbs =
|
13
|
+
$module &&
|
14
|
+
this.$breadcrumbsListWrapper &&
|
15
|
+
this.$breadcrumbsList &&
|
16
|
+
$module.querySelectorAll(".tna-breadcrumbs__item");
|
17
|
+
}
|
18
|
+
|
19
|
+
init() {
|
20
|
+
if (
|
21
|
+
!this.$module ||
|
22
|
+
!this.$breadcrumbsListWrapper ||
|
23
|
+
!this.$breadcrumbsList ||
|
24
|
+
!this.$breadcrumbs
|
25
|
+
) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
|
29
|
+
if (this.$breadcrumbs.length > 2) {
|
30
|
+
const uniqueId = `tna-breadcrumbs-${uuidv4()}`;
|
31
|
+
|
32
|
+
const $expandable = document.createElement("li");
|
33
|
+
$expandable.classList.add(
|
34
|
+
"tna-breadcrumbs__item",
|
35
|
+
"tna-breadcrumbs__item--expandable",
|
36
|
+
);
|
37
|
+
|
38
|
+
const $expandButton = document.createElement("button");
|
39
|
+
$expandButton.classList.add("tna-breadcrumbs__link");
|
40
|
+
$expandButton.innerHTML =
|
41
|
+
"<span class='tna-visually-hidden'>Expand breadcrumbs</span>…";
|
42
|
+
$expandButton.setAttribute("aria-expanded", "false");
|
43
|
+
$expandButton.setAttribute("aria-controls", uniqueId);
|
44
|
+
$expandButton.addEventListener("click", () => {
|
45
|
+
this.$breadcrumbsList.classList.remove(
|
46
|
+
"tna-breadcrumbs__list--collapse-on-mobile",
|
47
|
+
);
|
48
|
+
$expandable.remove();
|
49
|
+
this.$breadcrumbsListWrapper.setAttribute("tabindex", "0");
|
50
|
+
this.$breadcrumbsListWrapper.focus();
|
51
|
+
this.$breadcrumbsListWrapper.setAttribute("tabindex", "-1");
|
52
|
+
});
|
53
|
+
|
54
|
+
$expandable.appendChild($expandButton);
|
55
|
+
|
56
|
+
this.$breadcrumbsList.setAttribute("id", uniqueId);
|
57
|
+
this.$breadcrumbsList.insertBefore(
|
58
|
+
$expandable,
|
59
|
+
this.$breadcrumbs[this.$breadcrumbs.length - 2].nextSibling,
|
60
|
+
);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
@@ -54,3 +54,31 @@ Standard.args = {
|
|
54
54
|
],
|
55
55
|
classes: "tna-breadcrumbs--demo",
|
56
56
|
};
|
57
|
+
|
58
|
+
// TODO
|
59
|
+
// export const NoCollapse = Template.bind({});
|
60
|
+
// NoCollapse.args = {
|
61
|
+
// items: [
|
62
|
+
// {
|
63
|
+
// text: "Alpha",
|
64
|
+
// href: "#/alpha",
|
65
|
+
// },
|
66
|
+
// {
|
67
|
+
// text: "Beta",
|
68
|
+
// href: "#/beta",
|
69
|
+
// },
|
70
|
+
// {
|
71
|
+
// text: "Gamma",
|
72
|
+
// href: "#/gamma",
|
73
|
+
// },
|
74
|
+
// {
|
75
|
+
// text: "Delta",
|
76
|
+
// href: "#/delta",
|
77
|
+
// },
|
78
|
+
// {
|
79
|
+
// text: "Epsilon",
|
80
|
+
// href: "#/epsilon",
|
81
|
+
// },
|
82
|
+
// ],
|
83
|
+
// classes: "tna-breadcrumbs--demo",
|
84
|
+
// };
|
@@ -19,7 +19,7 @@
|
|
19
19
|
}
|
20
20
|
]
|
21
21
|
},
|
22
|
-
"html": "<div class=\"tna-breadcrumbs tna-container \"><nav class=\"tna-column tna-column--full\" aria-label=\"Breadcrumb\"><ol class=\"tna-breadcrumbs__list\"><li class=\"tna-breadcrumbs__item\"><a href=\"#/alpha\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Alpha</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/beta\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Beta</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/gamma\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Gamma</a></li></ol></nav></div>",
|
22
|
+
"html": "<div class=\"tna-breadcrumbs tna-container \" data-module=\"tna-breadcrumbs\"><nav class=\"tna-breadcrumbs__wrapper tna-column tna-column--full\" aria-label=\"Breadcrumb\"><ol class=\"tna-breadcrumbs__list tna-breadcrumbs__list--collapse-on-mobile\"><li class=\"tna-breadcrumbs__item\"><a href=\"#/alpha\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Alpha</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/beta\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Beta</a></li><li class=\"tna-breadcrumbs__item\"><a href=\"#/gamma\" class=\"tna-breadcrumbs__link\" data-prefix=\"Back to\">Gamma</a></li></ol></nav></div>",
|
23
23
|
"hidden": false
|
24
24
|
}
|
25
25
|
]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{%- set containerClasses = [params.classes] if params.classes else [] -%}
|
2
|
-
<div class="tna-breadcrumbs tna-container {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
3
|
-
<nav class="tna-column tna-column--full" aria-label="Breadcrumb">
|
4
|
-
<ol class="tna-breadcrumbs__list">
|
2
|
+
<div class="tna-breadcrumbs tna-container {{ containerClasses | join(' ') }}" data-module="tna-breadcrumbs" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
3
|
+
<nav class="tna-breadcrumbs__wrapper tna-column tna-column--full" aria-label="Breadcrumb">
|
4
|
+
<ol class="tna-breadcrumbs__list tna-breadcrumbs__list--collapse-on-mobile">
|
5
5
|
{%- for item in params.items -%}
|
6
6
|
<li class="tna-breadcrumbs__item">
|
7
7
|
<a href="{{ item.href }}" class="tna-breadcrumbs__link" data-prefix="{{ params.prefix if params.prefix else 'Back to' }}" {%- if item.title %} title="{{ item.title }}"{% endif %}>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
"text": "Log in",
|
8
8
|
"href": "#"
|
9
9
|
},
|
10
|
-
"html": "<a href=\"#\" class=\"tna-button \">Log in</a>",
|
10
|
+
"html": "<a href=\"#\" class=\"tna-button \" role=\"button\">Log in</a>",
|
11
11
|
"hidden": false
|
12
12
|
},
|
13
13
|
{
|
@@ -17,7 +17,7 @@
|
|
17
17
|
"href": "#",
|
18
18
|
"title": "Log in to the service"
|
19
19
|
},
|
20
|
-
"html": "<a href=\"#\" class=\"tna-button \" title=\"Log in to the service\">Log in</a>",
|
20
|
+
"html": "<a href=\"#\" class=\"tna-button \" role=\"button\" title=\"Log in to the service\">Log in</a>",
|
21
21
|
"hidden": false
|
22
22
|
},
|
23
23
|
{
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"href": "#",
|
28
28
|
"secondary": true
|
29
29
|
},
|
30
|
-
"html": "<a href=\"#\" class=\"tna-button tna-button--secondary\">Log in</a>",
|
30
|
+
"html": "<a href=\"#\" class=\"tna-button tna-button--secondary\" role=\"button\">Log in</a>",
|
31
31
|
"hidden": false
|
32
32
|
},
|
33
33
|
{
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"href": "#",
|
38
38
|
"classes": "button__test-class"
|
39
39
|
},
|
40
|
-
"html": "<a href=\"#\" class=\"tna-button button__test-class\">Log in</a>",
|
40
|
+
"html": "<a href=\"#\" class=\"tna-button button__test-class\" role=\"button\">Log in</a>",
|
41
41
|
"hidden": false
|
42
42
|
},
|
43
43
|
{
|
@@ -49,7 +49,7 @@
|
|
49
49
|
"data-testattribute": "foobar"
|
50
50
|
}
|
51
51
|
},
|
52
|
-
"html": "<a href=\"#\" class=\"tna-button \" data-testattribute=\"foobar\">Log in</a>",
|
52
|
+
"html": "<a href=\"#\" class=\"tna-button \" role=\"button\" data-testattribute=\"foobar\">Log in</a>",
|
53
53
|
"hidden": false
|
54
54
|
}
|
55
55
|
]
|
@@ -2,6 +2,6 @@
|
|
2
2
|
{%- if params.secondary -%}
|
3
3
|
{%- set buttonClasses = buttonClasses.concat('tna-button--secondary') -%}
|
4
4
|
{%- endif -%}
|
5
|
-
<a href="{{ params.href }}" class="tna-button {{ buttonClasses | join(' ') }}"{%- if params.title %} title="{{ params.title }}"{% endif %} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
5
|
+
<a href="{{ params.href }}" class="tna-button {{ buttonClasses | join(' ') }}" role="button"{%- if params.title %} title="{{ params.title }}"{% endif %} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
6
6
|
{{ params.text }}
|
7
7
|
</a>
|
@@ -1,8 +1,15 @@
|
|
1
|
+
@use "sass:math";
|
2
|
+
@use "../../variables/colour" as colourVars; // TODO
|
1
3
|
@use "../../tools/colour";
|
2
|
-
@use "../../
|
4
|
+
@use "../../tools/typography";
|
5
|
+
@use "../../tools/media";
|
3
6
|
|
4
7
|
.tna-card {
|
5
|
-
margin-bottom:
|
8
|
+
margin-bottom: 2rem;
|
9
|
+
|
10
|
+
&:last-child {
|
11
|
+
margin-bottom: 0;
|
12
|
+
}
|
6
13
|
|
7
14
|
&__inner {
|
8
15
|
display: flex;
|
@@ -24,26 +31,47 @@
|
|
24
31
|
}
|
25
32
|
|
26
33
|
&__image-container {
|
34
|
+
height: 0;
|
27
35
|
margin-bottom: 1rem;
|
36
|
+
// padding-bottom: #{math.div(9, 16) * 100%};
|
37
|
+
padding-bottom: #{math.div(2, 3) * 100%};
|
28
38
|
|
29
39
|
position: relative;
|
30
40
|
order: 1;
|
31
41
|
}
|
32
42
|
|
33
43
|
&__image {
|
34
|
-
|
44
|
+
width: 100%;
|
45
|
+
height: 100%;
|
46
|
+
|
47
|
+
position: absolute;
|
48
|
+
inset: 0;
|
49
|
+
|
50
|
+
object-fit: cover;
|
35
51
|
}
|
36
52
|
|
37
53
|
&__image-label {
|
38
|
-
|
54
|
+
max-width: calc(100% - 2rem);
|
55
|
+
padding: 0.25rem 0.5rem;
|
39
56
|
|
40
57
|
position: absolute;
|
41
58
|
top: 1rem;
|
42
59
|
left: 0;
|
43
60
|
|
61
|
+
@include colour.fixed;
|
62
|
+
|
63
|
+
@include colour.colour-font("font-dark");
|
64
|
+
@include typography.relative-font-size(14);
|
65
|
+
@include typography.main-font-weight-bold;
|
44
66
|
text-transform: uppercase;
|
67
|
+
line-height: #{math.div(16, 14)};
|
45
68
|
|
46
|
-
|
69
|
+
@include colour.colour-background("accent");
|
70
|
+
}
|
71
|
+
|
72
|
+
&--green-label #{&}__image-label {
|
73
|
+
// color: colourVars.$tna-white;
|
74
|
+
background-color: colourVars.$tna-green;
|
47
75
|
}
|
48
76
|
|
49
77
|
&__body {
|
@@ -68,14 +96,8 @@
|
|
68
96
|
|
69
97
|
@include colour.colour-font("font-base");
|
70
98
|
|
71
|
-
// background-color: colour.$tna-yellow;
|
72
99
|
@include colour.colour-background("accent");
|
73
100
|
|
74
|
-
.tna-card__inner {
|
75
|
-
margin-left: 50%;
|
76
|
-
padding: 2rem;
|
77
|
-
}
|
78
|
-
|
79
101
|
.tna-card__heading {
|
80
102
|
padding-bottom: 2rem;
|
81
103
|
|
@@ -87,38 +109,59 @@
|
|
87
109
|
color: inherit;
|
88
110
|
}
|
89
111
|
|
112
|
+
.tna-card__title {
|
113
|
+
@include typography.heading-font;
|
114
|
+
}
|
115
|
+
|
90
116
|
.tna-card__title-link {
|
91
117
|
@include colour.colour-font("font-dark");
|
92
118
|
}
|
93
119
|
|
94
120
|
.tna-card__image-container {
|
95
|
-
margin-bottom:
|
121
|
+
margin-bottom: 2rem;
|
122
|
+
}
|
123
|
+
|
124
|
+
@include media.on-larger-than-mobile {
|
125
|
+
.tna-card__inner {
|
126
|
+
margin-left: 50%;
|
127
|
+
padding: 2rem;
|
128
|
+
}
|
129
|
+
|
130
|
+
.tna-card__image-container {
|
131
|
+
height: auto;
|
132
|
+
margin-bottom: 0;
|
133
|
+
padding-bottom: 0;
|
96
134
|
|
97
|
-
|
98
|
-
|
135
|
+
display: block;
|
136
|
+
|
137
|
+
position: absolute;
|
138
|
+
inset: 0 50% 0 0;
|
139
|
+
}
|
99
140
|
}
|
100
141
|
|
101
|
-
.
|
102
|
-
|
103
|
-
|
104
|
-
|
142
|
+
@include media.on-mobile {
|
143
|
+
.tna-card__inner {
|
144
|
+
padding: 0 0 2rem;
|
145
|
+
}
|
146
|
+
|
147
|
+
.tna-card__heading,
|
148
|
+
.tna-card__body,
|
149
|
+
.tna-card__actions {
|
150
|
+
margin-right: 2rem;
|
151
|
+
margin-left: 2rem;
|
152
|
+
}
|
105
153
|
}
|
106
154
|
}
|
107
155
|
|
108
|
-
@
|
109
|
-
padding: 1rem;
|
110
|
-
|
156
|
+
@include colour.on-high-contrast {
|
111
157
|
border: 1px transparent solid;
|
112
158
|
@include colour.colour-border("keyline-dark");
|
113
|
-
}
|
114
|
-
|
115
|
-
.tna-template--high-contrast-theme & {
|
116
|
-
@include high-contrast;
|
117
|
-
}
|
118
159
|
|
119
|
-
|
120
|
-
.tna-
|
121
|
-
|
160
|
+
.tna-card__heading,
|
161
|
+
.tna-card__body,
|
162
|
+
.tna-card__actions {
|
163
|
+
margin-right: 2rem;
|
164
|
+
margin-left: 2rem;
|
122
165
|
}
|
123
166
|
}
|
124
167
|
}
|
@@ -5,6 +5,7 @@ const argTypes = {
|
|
5
5
|
heading: { control: "object" },
|
6
6
|
href: { control: "text" },
|
7
7
|
image: { control: "object" },
|
8
|
+
label: { control: "text" },
|
8
9
|
body: { control: "text" },
|
9
10
|
text: { control: "text" },
|
10
11
|
actions: { control: "object" },
|
@@ -29,6 +30,7 @@ const Template = ({
|
|
29
30
|
heading,
|
30
31
|
href,
|
31
32
|
image,
|
33
|
+
label,
|
32
34
|
body,
|
33
35
|
text,
|
34
36
|
actions,
|
@@ -42,6 +44,7 @@ const Template = ({
|
|
42
44
|
heading,
|
43
45
|
href,
|
44
46
|
image,
|
47
|
+
label,
|
45
48
|
body,
|
46
49
|
text,
|
47
50
|
actions,
|
@@ -69,6 +72,7 @@ Standard.args = {
|
|
69
72
|
width: 1996,
|
70
73
|
height: 1331,
|
71
74
|
},
|
75
|
+
label: "New",
|
72
76
|
body: "<p>Card body</p>",
|
73
77
|
// actions: [
|
74
78
|
// {
|
@@ -87,7 +91,7 @@ Featured.args = {
|
|
87
91
|
supertitle: "Card supertitle",
|
88
92
|
title: "Card title",
|
89
93
|
level: 3,
|
90
|
-
size: "
|
94
|
+
size: "l",
|
91
95
|
singleSentence: false,
|
92
96
|
},
|
93
97
|
href: "#",
|
@@ -97,6 +101,7 @@ Featured.args = {
|
|
97
101
|
width: 1996,
|
98
102
|
height: 1331,
|
99
103
|
},
|
104
|
+
label: "New",
|
100
105
|
body: "<p>Card body</p>",
|
101
106
|
actions: [
|
102
107
|
{
|
@@ -105,7 +105,7 @@
|
|
105
105
|
},
|
106
106
|
"body": "<p>Card body</p>"
|
107
107
|
},
|
108
|
-
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><
|
108
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><a href=\"\" class=\"tna-card__image-container\" tabindex=\"-1\"><img src=\"https://loremflickr.com/640/360\" alt=\"A placeholder image\" width=\"640\" height=\"360\" class=\"tna-card__image\" /></a><div class=\"tna-card__body\"><p>Card body</p></div></div></div>",
|
109
109
|
"hidden": false
|
110
110
|
},
|
111
111
|
{
|
@@ -124,7 +124,7 @@
|
|
124
124
|
}
|
125
125
|
]
|
126
126
|
},
|
127
|
-
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div><div class=\"tna-card__actions\"><a href=\"#\" class=\"tna-card__action tna-button\"title=\"Go and do the action\">Card action</a></div></div></div>",
|
127
|
+
"html": "<div class=\"tna-card \" data-module=\"tna-card\"><div class=\"tna-card__inner\"><h3 class=\"tna-card__title tna-heading tna-heading--m\">Card title</h3><div class=\"tna-card__body\"><p>Card body</p></div><div class=\"tna-card__actions\"><a href=\"#\" class=\"tna-card__action tna-button\" role=\"button\"title=\"Go and do the action\">Card action</a></div></div></div>",
|
128
128
|
"hidden": false
|
129
129
|
},
|
130
130
|
{
|
@@ -61,12 +61,6 @@
|
|
61
61
|
"required": true,
|
62
62
|
"description": ""
|
63
63
|
},
|
64
|
-
{
|
65
|
-
"name": "label",
|
66
|
-
"type": "string",
|
67
|
-
"required": false,
|
68
|
-
"description": ""
|
69
|
-
},
|
70
64
|
{
|
71
65
|
"name": "width",
|
72
66
|
"type": "number",
|
@@ -81,6 +75,12 @@
|
|
81
75
|
}
|
82
76
|
]
|
83
77
|
},
|
78
|
+
{
|
79
|
+
"name": "label",
|
80
|
+
"type": "string",
|
81
|
+
"required": false,
|
82
|
+
"description": ""
|
83
|
+
},
|
84
84
|
{
|
85
85
|
"name": "body",
|
86
86
|
"type": "string",
|
@@ -40,14 +40,14 @@
|
|
40
40
|
</h{{ params.heading.level }}>
|
41
41
|
{%- endif -%}
|
42
42
|
{%- if params.image -%}
|
43
|
-
<
|
43
|
+
<a href="{{ item.href }}" class="tna-card__image-container" tabindex="-1">
|
44
44
|
<img src="{{ params.image.src }}" alt="{{ params.image.alt }}" width="{{ params.image.width }}" height="{{ params.image.height }}" class="tna-card__image" />
|
45
|
-
{%- if params.
|
45
|
+
{%- if params.label -%}
|
46
46
|
<div class="tna-card__image-label">
|
47
|
-
{{ params.
|
47
|
+
{{ params.label }}
|
48
48
|
</div>
|
49
49
|
{%- endif -%}
|
50
|
-
</
|
50
|
+
</a>
|
51
51
|
{%- endif -%}
|
52
52
|
<div class="tna-card__body">
|
53
53
|
{%- if params.text -%}
|
@@ -59,7 +59,7 @@
|
|
59
59
|
{%- if params.actions -%}
|
60
60
|
<div class="tna-card__actions">
|
61
61
|
{%- for item in params.actions -%}
|
62
|
-
<a href="{{ item.href }}" class="tna-card__action tna-button" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
|
62
|
+
<a href="{{ item.href }}" class="tna-card__action tna-button" role="button" {%- if item.title %}title="{{ item.title }}"{% endif %}>{{ item.text }}</a>
|
63
63
|
{%- endfor -%}
|
64
64
|
</div>
|
65
65
|
{%- endif -%}
|