@nationalarchives/frontend 0.1.42 → 0.1.44
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/govuk-prototype-kit.config.json +10 -7
- 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/analytics.js +1 -1
- package/nationalarchives/analytics.js.map +1 -1
- package/nationalarchives/analytics.mjs +168 -73
- package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/template.njk +2 -1
- package/nationalarchives/components/button/button-group.stories.js +122 -0
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/button.scss +4 -8
- package/nationalarchives/components/button/button.stories.js +36 -38
- package/nationalarchives/components/button/fixtures.json +3 -3
- package/nationalarchives/components/button/template.njk +9 -8
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +10 -5
- package/nationalarchives/components/card/card.stories.js +39 -23
- package/nationalarchives/components/card/fixtures.json +16 -2
- package/nationalarchives/components/card/macro-options.json +0 -6
- package/nationalarchives/components/card/template.njk +1 -4
- package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
- package/nationalarchives/components/cookie-banner/fixtures.json +10 -10
- package/nationalarchives/components/date-input/date-input.css.map +1 -1
- package/nationalarchives/components/date-search/date-search.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.css +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/error-summary/error-summary.scss +1 -1
- package/nationalarchives/components/featured-records/featured-records.css +1 -1
- package/nationalarchives/components/featured-records/featured-records.css.map +1 -1
- package/nationalarchives/components/featured-records/featured-records.scss +1 -1
- package/nationalarchives/components/footer/analytics.js +95 -0
- package/nationalarchives/components/footer/fixtures.json +10 -10
- package/nationalarchives/components/footer/footer.css +1 -1
- package/nationalarchives/components/footer/footer.css.map +1 -1
- package/nationalarchives/components/footer/footer.scss +4 -3
- package/nationalarchives/components/footer/footer.stories.js +12 -9
- package/nationalarchives/components/footer/template.njk +17 -12
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/gallery/template.njk +1 -1
- package/nationalarchives/components/global-header/README.md +1 -1
- package/nationalarchives/components/global-header/analytics.js +49 -3
- package/nationalarchives/components/global-header/fixtures.json +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/global-header/global-header.mjs +40 -79
- package/nationalarchives/components/global-header/global-header.scss +9 -6
- package/nationalarchives/components/global-header/macro-options.json +12 -0
- package/nationalarchives/components/global-header/template.njk +7 -7
- package/nationalarchives/components/grid/grid.css +1 -1
- package/nationalarchives/components/grid/grid.css.map +1 -1
- package/nationalarchives/components/grid/grid.scss +0 -1
- package/nationalarchives/components/header/analytics.js +3 -8
- package/nationalarchives/components/header/fixtures.json +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/header/header.mjs +32 -41
- package/nationalarchives/components/header/header.scss +3 -2
- package/nationalarchives/components/header/macro-options.json +6 -0
- package/nationalarchives/components/header/template.njk +6 -6
- 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/index-grid/fixtures.json +8 -8
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/macro-options.json +1 -1
- package/nationalarchives/components/index-grid/template.njk +41 -38
- package/nationalarchives/components/message/message.css +1 -1
- package/nationalarchives/components/message/message.css.map +1 -1
- package/nationalarchives/components/message/message.scss +2 -3
- package/nationalarchives/components/pagination/fixtures.json +1 -1
- package/nationalarchives/components/pagination/macro-options.json +6 -0
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/pagination/pagination.stories.js +44 -0
- package/nationalarchives/components/pagination/template.njk +5 -2
- package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
- package/nationalarchives/components/picture/analytics.js +5 -9
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
- package/nationalarchives/components/radios/radios.css.map +1 -1
- package/nationalarchives/components/search-field/search-field.css.map +1 -1
- package/nationalarchives/components/search-filters/search-filters.css.map +1 -1
- package/nationalarchives/components/select/select.css.map +1 -1
- package/nationalarchives/components/sensitive-image/fixtures.json +3 -3
- package/nationalarchives/components/sensitive-image/template.njk +1 -1
- package/nationalarchives/components/skip-link/skip-link.css +1 -1
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/skip-link/skip-link.scss +1 -1
- package/nationalarchives/components/skip-link/skip-link.stories.js +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/text-input/text-input.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/global-header-package.css +1 -1
- package/nationalarchives/global-header-package.css.map +1 -1
- package/nationalarchives/global-header-package.scss +4 -6
- package/nationalarchives/lib/analytics-helpers.mjs +13 -8
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +29 -15
- package/nationalarchives/stories/utilities/tables/tables.stories.js +30 -28
- package/nationalarchives/templates/fixtures.json +28 -0
- package/nationalarchives/templates/index-grid.njk +149 -0
- package/nationalarchives/templates/layouts/_generic.njk +11 -25
- package/nationalarchives/templates/layouts/_prototype-kit.njk +4 -4
- package/nationalarchives/templates/list.njk +55 -0
- package/nationalarchives/templates/plain.njk +94 -0
- package/nationalarchives/tools/_a11y.scss +11 -2
- package/nationalarchives/tools/_colour.scss +24 -0
- package/nationalarchives/tools/_spacing.scss +14 -2
- package/nationalarchives/utilities/_a11y.scss +4 -0
- package/nationalarchives/utilities/_forms.scss +1 -1
- package/nationalarchives/utilities/_global.scss +5 -5
- package/nationalarchives/utilities/_lists.scss +1 -1
- package/nationalarchives/utilities/_reset.scss +5 -2
- package/nationalarchives/utilities/_tables.scss +23 -6
- package/nationalarchives/utilities/_typography.scss +3 -21
- package/nationalarchives/variables/_a11y.scss +2 -0
- package/nationalarchives/variables/_grid.scss +1 -1
- package/nationalarchives/variables/_index.scss +1 -0
- package/package.json +5 -2
- package/nationalarchives/templates/homepage.njk +0 -17
- package/nationalarchives/templates/search-results.njk +0 -34
- package/nationalarchives/templates/topics.njk +0 -38
- package/nationalarchives/tests/analytics.test.js +0 -11
- package/nationalarchives/tests/cookies.test.js +0 -487
- package/nationalarchives/tests/uuid.test.js +0 -11
@@ -6,6 +6,7 @@ import {
|
|
6
6
|
} from "./lib/analytics-helpers.mjs";
|
7
7
|
import BreadcrumbAnalytics from "./components/breadcrumbs/analytics.js";
|
8
8
|
import CheckboxesAnalytics from "./components/checkboxes/analytics.js";
|
9
|
+
import FooterAnalytics from "./components/footer/analytics.js";
|
9
10
|
import GlobalHeaderAnalytics from "./components/global-header/analytics.js";
|
10
11
|
import HeaderAnalytics from "./components/header/analytics.js";
|
11
12
|
import HeroAnalytics from "./components/hero/analytics.js";
|
@@ -18,6 +19,7 @@ import TextareaAnalytics from "./components/textarea/analytics.js";
|
|
18
19
|
const componentAnalytics = [
|
19
20
|
...BreadcrumbAnalytics,
|
20
21
|
...CheckboxesAnalytics,
|
22
|
+
...FooterAnalytics,
|
21
23
|
...GlobalHeaderAnalytics,
|
22
24
|
...HeaderAnalytics,
|
23
25
|
...HeroAnalytics,
|
@@ -36,14 +38,55 @@ class EventTracker {
|
|
36
38
|
events = [];
|
37
39
|
|
38
40
|
/** @protected */
|
39
|
-
|
41
|
+
startTime = new Date();
|
40
42
|
|
41
|
-
|
43
|
+
/** @protected */
|
44
|
+
prefix = "tna";
|
45
|
+
|
46
|
+
constructor(options = {}) {
|
47
|
+
const { prefix = null } = options;
|
48
|
+
if (prefix) {
|
49
|
+
this.prefix = prefix;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
start(initAll) {
|
54
|
+
if (!navigator.doNotTrack || navigator.doNotTrack !== 1) {
|
55
|
+
if (this.cookies.isPolicyAccepted("usage")) {
|
56
|
+
this.enableTracking();
|
57
|
+
} else {
|
58
|
+
window[this.ga4Disable] = true;
|
59
|
+
this.cookies.set(this.ga4Disable, "true");
|
60
|
+
}
|
61
|
+
this.cookies.on("changePolicy", (policies) => {
|
62
|
+
if (Object.hasOwn(policies, "usage")) {
|
63
|
+
if (policies["usage"]) {
|
64
|
+
this.enableTracking();
|
65
|
+
} else {
|
66
|
+
this.disableTracking();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
});
|
70
|
+
if (initAll) {
|
71
|
+
this.initAll();
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
enableTracking() {}
|
77
|
+
|
78
|
+
disableTracking() {}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Initialise all TNA Frontend component analytics.
|
82
|
+
*/
|
83
|
+
initAll() {
|
42
84
|
componentAnalytics.forEach((componentConfig) => {
|
43
85
|
this.addListener(
|
44
86
|
componentConfig.scope,
|
45
87
|
componentConfig.areaName,
|
46
88
|
componentConfig.events,
|
89
|
+
componentConfig.rootEventName || "",
|
47
90
|
);
|
48
91
|
});
|
49
92
|
}
|
@@ -52,9 +95,10 @@ class EventTracker {
|
|
52
95
|
* Add an event listener.
|
53
96
|
* @param {String|HTMLElement} scope - The element to which the listener is scoped.
|
54
97
|
* @param {String} areaName - The name of the component to pass on to the tracker.
|
55
|
-
* @param {{eventName: String, targetElement: String|undefined, on: String, data: {value: Function|String|undefined, state: Function|String|undefined, [String]:
|
98
|
+
* @param {{eventName: String, targetElement: String|undefined, on: String, data: {value: Function|String|undefined, state: Function|String|undefined, group: Function|String|undefined, [String]: String|Integer}, rootData:{[String]: Function|String}}[]} events - The configuration of events to track along with their optional value and state which can be computed.
|
99
|
+
* @param {String} rootEventName - The event name to use if specified (prefix).
|
56
100
|
*/
|
57
|
-
addListener(scope, areaName, events) {
|
101
|
+
addListener(scope, areaName, events, rootEventName = "") {
|
58
102
|
let scopeArray;
|
59
103
|
if (typeof scope === "string") {
|
60
104
|
scopeArray = Array.from(document.querySelectorAll(scope));
|
@@ -65,31 +109,33 @@ class EventTracker {
|
|
65
109
|
return;
|
66
110
|
}
|
67
111
|
scopeArray.forEach(($scope) => {
|
68
|
-
events.forEach((
|
69
|
-
if (!
|
112
|
+
events.forEach((eventConfig) => {
|
113
|
+
if (!eventConfig.on) {
|
70
114
|
return;
|
71
115
|
}
|
72
|
-
if (
|
116
|
+
if (eventConfig.targetElement) {
|
73
117
|
Array.from(
|
74
|
-
$scope.querySelectorAll(
|
75
|
-
).forEach(($el) =>
|
118
|
+
$scope.querySelectorAll(eventConfig.targetElement),
|
119
|
+
).forEach(($el, index) =>
|
76
120
|
this.attachListener(
|
77
121
|
$el,
|
78
|
-
componentTracking.on,
|
79
122
|
$scope,
|
80
|
-
|
81
|
-
|
82
|
-
|
123
|
+
rootEventName,
|
124
|
+
eventConfig,
|
125
|
+
scope,
|
126
|
+
areaName,
|
127
|
+
index + 1,
|
83
128
|
),
|
84
129
|
);
|
85
130
|
} else {
|
86
131
|
this.attachListener(
|
87
132
|
$scope,
|
88
|
-
componentTracking.on,
|
89
133
|
$scope,
|
90
|
-
|
91
|
-
|
92
|
-
|
134
|
+
rootEventName,
|
135
|
+
eventConfig,
|
136
|
+
scope,
|
137
|
+
areaName,
|
138
|
+
1,
|
93
139
|
);
|
94
140
|
}
|
95
141
|
});
|
@@ -97,56 +143,78 @@ class EventTracker {
|
|
97
143
|
}
|
98
144
|
|
99
145
|
/** @protected */
|
100
|
-
generateEventName(areaName,
|
101
|
-
return `${areaName}.${
|
146
|
+
generateEventName(areaName, eventConfig) {
|
147
|
+
return `${this.prefix}.${areaName}.${eventConfig.eventName || eventConfig.on}`;
|
102
148
|
}
|
103
149
|
|
104
150
|
/** @protected */
|
105
151
|
attachListener(
|
106
152
|
$el,
|
107
|
-
eventTrigger,
|
108
153
|
$scope,
|
109
|
-
|
110
|
-
|
111
|
-
|
154
|
+
rootEventName,
|
155
|
+
eventConfig,
|
156
|
+
scope,
|
157
|
+
areaName,
|
158
|
+
index,
|
112
159
|
) {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
?
|
130
|
-
:
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
160
|
+
const { on, data, targetElement, rootData = {} } = eventConfig;
|
161
|
+
$el.addEventListener(on, (event) =>
|
162
|
+
this.recordEvent(
|
163
|
+
rootEventName
|
164
|
+
? `${this.prefix}.${rootEventName}`
|
165
|
+
: this.generateEventName(areaName, eventConfig),
|
166
|
+
{
|
167
|
+
...data,
|
168
|
+
name: this.generateEventName(areaName, eventConfig),
|
169
|
+
value: data?.value
|
170
|
+
? this.computedValue(data.value, $el, $scope, event, index)
|
171
|
+
: null,
|
172
|
+
state: data?.state
|
173
|
+
? this.computedValue(data.state, $el, $scope, event, index)
|
174
|
+
: null,
|
175
|
+
group: data?.group
|
176
|
+
? this.computedValue(data.group, $el, $scope, event, index)
|
177
|
+
: null,
|
178
|
+
xPath: getXPathTo($el),
|
179
|
+
targetElement: targetElement,
|
180
|
+
timeSincePageLoad: new Date() - this.startTime,
|
181
|
+
index,
|
182
|
+
scope,
|
183
|
+
areaName,
|
184
|
+
},
|
185
|
+
Object.fromEntries(
|
186
|
+
Object.entries(rootData).map(([key, value]) => [
|
187
|
+
key,
|
188
|
+
this.computedValue(value, $el, $scope, event, index),
|
189
|
+
]),
|
190
|
+
),
|
191
|
+
),
|
137
192
|
);
|
138
193
|
}
|
139
194
|
|
140
195
|
/** @protected */
|
141
|
-
|
142
|
-
|
196
|
+
computedValue(value, $el, $scope, event, index) {
|
197
|
+
return typeof value === "function"
|
198
|
+
? value.call(this, $el, $scope, event, index)
|
199
|
+
: value ?? null;
|
200
|
+
}
|
201
|
+
|
202
|
+
/** @protected */
|
203
|
+
recordEvent(eventName, data, rootData = {}) {
|
204
|
+
this.events.push({
|
205
|
+
event: eventName,
|
206
|
+
[`${this.prefix}.event`]: data,
|
207
|
+
...rootData,
|
208
|
+
});
|
143
209
|
}
|
144
210
|
|
145
211
|
/** @protected */
|
146
212
|
getTnaMetaTags() {
|
147
213
|
return Object.fromEntries(
|
148
214
|
Array.from(
|
149
|
-
document.head.querySelectorAll(
|
215
|
+
document.head.querySelectorAll(
|
216
|
+
`meta[name^='${this.prefix}.'][content]`,
|
217
|
+
),
|
150
218
|
).map(($metaEl) => [
|
151
219
|
$metaEl.getAttribute("name"),
|
152
220
|
$metaEl.getAttribute("content"),
|
@@ -163,31 +231,47 @@ class EventTracker {
|
|
163
231
|
* @public
|
164
232
|
*/
|
165
233
|
class GA4 extends EventTracker {
|
234
|
+
/** @protected */
|
166
235
|
trackingCodeAdded = false;
|
236
|
+
|
237
|
+
/** @protected */
|
167
238
|
trackingEnabled = false;
|
239
|
+
|
240
|
+
/** @protected */
|
168
241
|
gTagId;
|
169
242
|
|
170
|
-
constructor(
|
171
|
-
|
243
|
+
constructor(options = {}) {
|
244
|
+
if (GA4._instance) {
|
245
|
+
return GA4._instance;
|
246
|
+
}
|
247
|
+
const { id = null, prefix = null, initAll = true } = options;
|
248
|
+
if (!id) {
|
249
|
+
throw Error("ID was not specified");
|
250
|
+
}
|
251
|
+
super({ prefix });
|
252
|
+
GA4._instance = this;
|
172
253
|
this.gTagId = id;
|
254
|
+
this.ga4Disable = `ga-disable-${this.gTagId}`;
|
173
255
|
window.dataLayer = window.dataLayer || [];
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
if (policies["usage"]) {
|
180
|
-
this.enableTracking();
|
181
|
-
} else {
|
182
|
-
this.disableTracking();
|
183
|
-
}
|
184
|
-
}
|
185
|
-
});
|
256
|
+
this.start(initAll);
|
257
|
+
}
|
258
|
+
|
259
|
+
destroy() {
|
260
|
+
GA4._instance = null;
|
186
261
|
}
|
187
262
|
|
188
263
|
/** @protected */
|
189
|
-
recordEvent(eventName, data) {
|
190
|
-
const ga4Data = {
|
264
|
+
recordEvent(eventName, data, rootData = {}) {
|
265
|
+
const ga4Data = {
|
266
|
+
event: eventName,
|
267
|
+
...Object.fromEntries(
|
268
|
+
Object.entries(data).map(([key, value]) => [
|
269
|
+
`${this.prefix}.event.${key}`,
|
270
|
+
value,
|
271
|
+
]),
|
272
|
+
),
|
273
|
+
...rootData,
|
274
|
+
};
|
191
275
|
this.pushToDataLayer(ga4Data);
|
192
276
|
}
|
193
277
|
|
@@ -204,8 +288,8 @@ class GA4 extends EventTracker {
|
|
204
288
|
/** @protected */
|
205
289
|
enableTracking() {
|
206
290
|
if (!this.trackingEnabled) {
|
207
|
-
window[
|
208
|
-
this.
|
291
|
+
window[this.ga4Disable] = false;
|
292
|
+
this.cookies.set(this.ga4Disable, "false");
|
209
293
|
if (!this.trackingCodeAdded) {
|
210
294
|
this.pushToDataLayer({
|
211
295
|
"gtm.start": new Date().getTime(),
|
@@ -215,20 +299,31 @@ class GA4 extends EventTracker {
|
|
215
299
|
const script = document.createElement("script");
|
216
300
|
script.async = true;
|
217
301
|
script.src = `https://www.googletagmanager.com/gtm.js?id=${this.gTagId}&l=dataLayer`;
|
218
|
-
|
302
|
+
if (firstScript) {
|
303
|
+
firstScript.parentNode.insertBefore(script, firstScript);
|
304
|
+
} else {
|
305
|
+
document.head.appendChild(script);
|
306
|
+
}
|
219
307
|
this.trackingCodeAdded = true;
|
220
|
-
this.
|
308
|
+
const tnaMetaTags = this.getTnaMetaTags();
|
309
|
+
if (Object.keys(tnaMetaTags).length) {
|
310
|
+
this.pushToDataLayer(tnaMetaTags);
|
311
|
+
}
|
221
312
|
}
|
222
|
-
this.
|
313
|
+
this.trackingEnabled = true;
|
223
314
|
}
|
224
315
|
}
|
225
316
|
|
226
317
|
/** @protected */
|
227
318
|
disableTracking() {
|
228
319
|
if (this.trackingEnabled) {
|
229
|
-
window[
|
230
|
-
this.
|
320
|
+
window[this.ga4Disable] = true;
|
321
|
+
this.cookies.set(this.ga4Disable, "true");
|
322
|
+
this.cookies.delete("_ga");
|
323
|
+
// this.cookies.delete("_gat_gtag_UA_43169816_3");
|
324
|
+
// this.cookies.delete("_gid");
|
231
325
|
this.trackingEnabled = false;
|
326
|
+
window.location.reload();
|
232
327
|
}
|
233
328
|
}
|
234
329
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/components/breadcrumbs/breadcrumbs.scss","../../../../src/nationalarchives/tools/_media.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"CAIA,iBACE,iBACA,oBAEA,uBACE,wBAGF,uBACE,SACA,UAEA,gBAEA,aACA,eAGF,uBACE,aAGE,sDACE,gBAEA,qBAEA,wBAEA,YACA,eAIJ,mCACE,aCoBJ,wBDrBE,mCAII,iCAKN,uBACE,qBAEA,kFEuCF,cACA,uBFlCE,6BEiCF,WACA,uBA2RA,8BFtUA,uBAcI,qBACA,oBAEA,qBEgEA,yBAIA,qCFhEA,6BACE,0BEoBN,cACA,iCAIA,sBAEA,4CAyQA,0DF5SI,qBACA,oBAEA,qBEgEA,yBAIA,qCFhEA,gEACE,0BEoBN,cACA,iCAIA,sBAEA,2CA8QE,+BADF,mDFhTI,qBACA,oBAEA,qBEgEA,yBAIA,qCFhEA,yDACE,0BEoBN,cACA,iCAIA,sBAEA,4CFlBA,8CACE,SACA,UACA,YAEA,kBACA,oBACA,oBAEA,+BAEA,YAEA,gBACA,eAEA,oDACE,cG3CJ,0BACA,0BC3CsC,MJwFlC,+BCvCJ,wBD4CE,oHACE,cCvCJ,aD4CE,uBACE,wBAEA,mCACE","file":"breadcrumbs.css","sourcesContent":["@use \"../../tools/colour\";\n@use \"../../tools/media\";\n@use \"../../tools/typography\";\n\n.tna-breadcrumbs {\n padding-top: 1rem;\n padding-bottom: 1rem;\n\n &:focus {\n outline: none !important;\n }\n\n &__list {\n margin: 0;\n padding: 0;\n\n list-style: none;\n\n display: flex;\n flex-wrap: wrap;\n }\n\n &__item {\n display: flex;\n\n + .tna-breadcrumbs__item {\n &::before {\n margin: 0 0.75rem;\n\n display: inline-block;\n\n vertical-align: baseline;\n\n content: \"\\203A\";\n content: \"\\203A\" / \"\";\n }\n }\n\n &--expandable {\n display: none;\n\n @include media.on-mobile {\n display: inline-block !important;\n }\n }\n }\n\n &__link {\n display: inline-block;\n\n &,\n &:link,\n &:visited {\n @include colour.colour-font(\"font-base\");\n }\n\n &:hover {\n @include colour.colour-font(\"font-dark\");\n }\n\n @include colour.on-high-contrast-and-forced-colours {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n\n text-decoration: none;\n\n @include colour.colour-border(\"keyline-dark\", 1px);\n\n &:hover {\n text-decoration: underline;\n\n @include colour.colour-font(\"contrast-background\");\n\n @include colour.colour-background(\"contrast-font-base\");\n }\n }\n }\n\n button#{&}__link {\n margin: 0;\n padding: 0;\n height: 100%;\n\n font-size: inherit;\n line-height: inherit;\n font-weight: inherit;\n\n background-color: transparent;\n\n border: none;\n\n appearance: none;\n cursor: pointer;\n\n &:hover {\n color: inherit;\n @include typography.interacted-text-decoration;\n\n background-color: transparent;\n }\n }\n\n @include media.on-mobile {\n &--collapsed &__item:not(:first-child, &__item--expandable, :last-child) {\n display: none;\n }\n }\n\n @include media.on-print {\n &__item {\n display: flex !important;\n\n &--expandable {\n display: none !important;\n }\n }\n }\n}\n","@use \"../variables/media\";\n\n// 0 ======= 320 = 480 ===== 768 == 1024 ========================== min-width/max-width (px)\n// | . | | |\n// |-TINY----------|-SMALL---|-MED--|-LARGE------------------------\n// | . | | |\n// |<------------->| | | on-tiny\n// |<----------------------->| | on-mobile\n// |<------------------------------>| on-smaller-than-large\n// | . |<------->| | on-small\n// | . |<------------------------- on-larger-than-tiny\n// | . | |<---->| on-medium\n// | . | |<--------------- on-larger-than-mobile\n// | . | | |<-------- on-large\n// |<------->. | | | Smallest device\n\n@mixin on-large() {\n @media #{media.$media-large} {\n @content;\n }\n}\n\n@mixin on-medium() {\n @media #{media.$media-medium} {\n @content;\n }\n}\n\n@mixin on-small() {\n @media #{media.$media-small} {\n @content;\n }\n}\n\n@mixin on-tiny() {\n @media #{media.$media-tiny} {\n @content;\n }\n}\n\n@mixin on-larger-than-mobile() {\n @media #{media.$media-gt-mobile} {\n @content;\n }\n}\n\n@mixin on-larger-than-tiny() {\n @media #{media.$media-gt-tiny} {\n @content;\n }\n}\n\n@mixin on-smaller-than-large() {\n @media #{media.$media-lt-large} {\n @content;\n }\n}\n\n@mixin on-mobile() {\n @media #{media.$media-mobile} {\n @content;\n }\n}\n\n@mixin on-print() {\n @media print {\n @content;\n }\n}\n","@use \"sass:map\";\n@use \"sass:list\";\n@use \"../variables/colour\";\n@use \"../tools/media\";\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 }\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 }\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 }\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 }\n }\n}\n\n@mixin accent-css-vars($colour) {\n @if $colour == \"yellow\" {\n --accent-background: #{brand-colour(\"yellow\")} !important;\n --accent-background-light: #{brand-colour(\"cream\")} !important;\n --accent-font-base: #{brand-colour(\"black\")} !important;\n --accent-font-dark: #{brand-colour(\"black\")} !important;\n --accent-font-light: #{brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{brand-colour(\"black\", 0.45)} !important;\n --accent-link: #{brand-colour(\"black\")} !important;\n --accent-link-visited: #{brand-colour(\"black\")} !important;\n --accent-keyline: #{brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{brand-colour(\"black\", 0.8)} !important;\n --button-accent-background: #{brand-colour(\"yellow\")} !important;\n } @else {\n --accent-font-base: #{brand-colour(\"white\")} !important;\n --accent-font-dark: #{brand-colour(\"white\")} !important;\n --accent-font-light: #{brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{brand-colour(\"white\", 0.45)} !important;\n --accent-link: #{brand-colour(\"white\")} !important;\n --accent-link-visited: #{brand-colour(\"white\")} !important;\n --accent-keyline: #{brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{brand-colour(\"white\", 0.8)} !important;\n --button-accent-text: #{brand-colour(\"white\")} !important;\n @if $colour == \"pink\" {\n --accent-background: #{brand-colour(\"maroon\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-pink\")} !important;\n --button-accent-background: #{brand-colour(\"maroon\")} !important;\n } @else if $colour == \"orange\" {\n --accent-background: #{brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-orange\")} !important;\n --button-accent-background: #{brand-colour(\"chestnut\")} !important;\n } @else if $colour == \"green\" {\n --accent-background: #{brand-colour(\"forest\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-green\")} !important;\n --button-accent-background: #{brand-colour(\"forest\")} !important;\n } @else if $colour == \"blue\" {\n --accent-background: #{brand-colour(\"navy\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-blue\")} !important;\n --button-accent-background: #{brand-colour(\"navy\")} !important;\n }\n }\n}\n\n@mixin colour-font(\n $colour,\n $important: false,\n $default-palette: colour.$colour-palette-default\n) {\n color: map.get($default-palette, $colour) if($important, !important, null);\n color: var(--#{$colour}) if($important, !important, null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n background-color: var(--#{$colour}) if($important, !important, 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 $property: border-#{$direction};\n border-#{$direction}: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n border-#{$direction}: $width\n var(--#{$colour})\n $style\n if($important, !important, null);\n } @else {\n border-#{$direction}-color: map.get(\n colour.$colour-palette-default,\n $colour\n )\n if($important, !important, null);\n border-#{$direction}-color: var(--#{$colour})\n if($important, !important, null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n border: $width var(--#{$colour}) $style if($important, !important, null);\n } @else {\n border-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n border-color: var(--#{$colour}) if($important, !important, null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n outline: $width var(--#{$colour}) $style if($important, !important, null);\n } @else {\n outline-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n outline-color: var(--#{$colour}) if($important, !important, null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n fill: var(--#{$colour}) if($important, !important, null);\n}\n\n%light {\n @include colour-css-vars(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n}\n\n@mixin light {\n @extend %light;\n}\n\n%dark {\n @include colour-css-vars-dark(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n}\n\n@mixin dark {\n @extend %dark;\n}\n\n%plain {\n .tna-template--system-theme & {\n @extend %light;\n\n @media (prefers-color-scheme: dark) {\n @include colour-css-vars-dark;\n }\n\n @media (prefers-contrast: more) and (prefers-color-scheme: dark) {\n @include colour-css-vars-high-contrast-dark;\n }\n }\n\n .tna-template--light-theme & {\n @include colour-css-vars;\n }\n\n .tna-template--dark-theme & {\n @include colour-css-vars-dark;\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast;\n }\n\n .tna-template--high-contrast-theme.tna-template--dark-theme & {\n @include colour-css-vars-high-contrast-dark;\n }\n\n --background: var(--page-background);\n}\n\n@mixin plain {\n @extend %plain;\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%tint {\n @include colour-background(\"background-tint\");\n @include colour-font(\"font-base\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent-background {\n @include colour-background(\"accent-background\");\n}\n\n@mixin accent-background {\n @extend %accent-background;\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 // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\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\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 }\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}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n@mixin on-high-contrast {\n .tna-template--high-contrast-theme & {\n @content;\n }\n\n .tna-template--system-theme & {\n @media (prefers-contrast: more) {\n @content;\n }\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","@use \"sass:math\";\n@use \"colour\";\n@use \"../variables/typography\";\n\n@mixin relative-font-size($fontSizePx) {\n font-size: #{math.div($fontSizePx, typography.$relative-1rem-px)}rem;\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\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 @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: \"wdth\" 100;\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 @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n font-optical-sizing: auto;\n font-style: normal;\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include relative-font-size(14);\n text-transform: uppercase;\n line-height: #{math.div(typography.$relative-1rem-px, 14)};\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n}\n","@use \"sass:math\";\n\n$use-local-fonts: false !default;\n\n$relative-1rem-px: 16; // 16px is always 1rem\n\n$body-font-size-px: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: #{math.div($relative-1rem-px, $body-font-size-px) * 2} !default; // 1.77777\n\n$interactive-text-decoration-thickness: 3.5px !default;\n\n$main-font: \"Open Sans\" !default;\n$main-font-family: $main-font, sans-serif !default;\n$main-font-weight: 400 !default;\n$main-font-weight-bold: 700 !default;\n\n$heading-font-family: supria-sans-condensed, \"Arial Narrow\", sans-serif !default;\n$heading-font-weight: 500 !default;\n\n$detail-font-family: \"Roboto Mono\", monospace !default;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n"]}
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/components/breadcrumbs/breadcrumbs.scss","../../../../src/nationalarchives/tools/_media.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"CAIA,iBACE,iBACA,oBAEA,uBACE,wBAGF,uBACE,SACA,UAEA,gBAEA,aACA,eAGF,uBACE,aAGE,sDACE,gBAEA,qBAEA,wBAEA,YACA,eAIJ,mCACE,aCoBJ,wBDrBE,mCAII,iCAKN,uBACE,qBAEA,kFEuCF,cACA,uBFlCE,6BEiCF,WACA,uBAmTA,8BF9VA,uBAcI,qBACA,oBAEA,qBEoEA,yBAIA,qCFpEA,6BACE,0BEoBN,cACA,iCAIA,sBAEA,4CAiSA,0DFpUI,qBACA,oBAEA,qBEoEA,yBAIA,qCFpEA,gEACE,0BEoBN,cACA,iCAIA,sBAEA,2CAsSE,+BADF,mDFxUI,qBACA,oBAEA,qBEoEA,yBAIA,qCFpEA,yDACE,0BEoBN,cACA,iCAIA,sBAEA,4CFlBA,8CACE,SACA,UACA,YAEA,kBACA,oBACA,oBAEA,+BAEA,YAEA,gBACA,eAEA,oDACE,cG3CJ,0BACA,0BC3CsC,MJwFlC,+BCvCJ,wBD4CE,oHACE,cCvCJ,aD4CE,uBACE,wBAEA,mCACE","file":"breadcrumbs.css","sourcesContent":["@use \"../../tools/colour\";\n@use \"../../tools/media\";\n@use \"../../tools/typography\";\n\n.tna-breadcrumbs {\n padding-top: 1rem;\n padding-bottom: 1rem;\n\n &:focus {\n outline: none !important;\n }\n\n &__list {\n margin: 0;\n padding: 0;\n\n list-style: none;\n\n display: flex;\n flex-wrap: wrap;\n }\n\n &__item {\n display: flex;\n\n + .tna-breadcrumbs__item {\n &::before {\n margin: 0 0.75rem;\n\n display: inline-block;\n\n vertical-align: baseline;\n\n content: \"\\203A\";\n content: \"\\203A\" / \"\";\n }\n }\n\n &--expandable {\n display: none;\n\n @include media.on-mobile {\n display: inline-block !important;\n }\n }\n }\n\n &__link {\n display: inline-block;\n\n &,\n &:link,\n &:visited {\n @include colour.colour-font(\"font-base\");\n }\n\n &:hover {\n @include colour.colour-font(\"font-dark\");\n }\n\n @include colour.on-high-contrast-and-forced-colours {\n padding-right: 0.75rem;\n padding-left: 0.75rem;\n\n text-decoration: none;\n\n @include colour.colour-border(\"keyline-dark\", 1px);\n\n &:hover {\n text-decoration: underline;\n\n @include colour.colour-font(\"contrast-background\");\n\n @include colour.colour-background(\"contrast-font-base\");\n }\n }\n }\n\n button#{&}__link {\n margin: 0;\n padding: 0;\n height: 100%;\n\n font-size: inherit;\n line-height: inherit;\n font-weight: inherit;\n\n background-color: transparent;\n\n border: none;\n\n appearance: none;\n cursor: pointer;\n\n &:hover {\n color: inherit;\n @include typography.interacted-text-decoration;\n\n background-color: transparent;\n }\n }\n\n @include media.on-mobile {\n &--collapsed &__item:not(:first-child, &__item--expandable, :last-child) {\n display: none;\n }\n }\n\n @include media.on-print {\n &__item {\n display: flex !important;\n\n &--expandable {\n display: none !important;\n }\n }\n }\n}\n","@use \"../variables/media\";\n\n// 0 ======= 320 = 480 ===== 768 == 1024 ========================== min-width/max-width (px)\n// | . | | |\n// |-TINY----------|-SMALL---|-MED--|-LARGE------------------------\n// | . | | |\n// |<------------->| | | on-tiny\n// |<----------------------->| | on-mobile\n// |<------------------------------>| on-smaller-than-large\n// | . |<------->| | on-small\n// | . |<------------------------- on-larger-than-tiny\n// | . | |<---->| on-medium\n// | . | |<--------------- on-larger-than-mobile\n// | . | | |<-------- on-large\n// |<------->. | | | Smallest device\n\n@mixin on-large() {\n @media #{media.$media-large} {\n @content;\n }\n}\n\n@mixin on-medium() {\n @media #{media.$media-medium} {\n @content;\n }\n}\n\n@mixin on-small() {\n @media #{media.$media-small} {\n @content;\n }\n}\n\n@mixin on-tiny() {\n @media #{media.$media-tiny} {\n @content;\n }\n}\n\n@mixin on-larger-than-mobile() {\n @media #{media.$media-gt-mobile} {\n @content;\n }\n}\n\n@mixin on-larger-than-tiny() {\n @media #{media.$media-gt-tiny} {\n @content;\n }\n}\n\n@mixin on-smaller-than-large() {\n @media #{media.$media-lt-large} {\n @content;\n }\n}\n\n@mixin on-mobile() {\n @media #{media.$media-mobile} {\n @content;\n }\n}\n\n@mixin on-print() {\n @media print {\n @content;\n }\n}\n","@use \"sass:map\";\n@use \"sass:list\";\n@use \"../variables/colour\";\n@use \"../tools/media\";\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 }\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 }\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 }\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 }\n }\n}\n\n@mixin accent-css-vars($colour) {\n @if $colour == \"yellow\" {\n --accent-background: #{brand-colour(\"yellow\")} !important;\n --accent-background-light: #{brand-colour(\"cream\")} !important;\n --accent-font-base: #{brand-colour(\"black\")} !important;\n --accent-font-dark: #{brand-colour(\"black\")} !important;\n --accent-font-light: #{brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{brand-colour(\"black\", 0.45)} !important;\n --accent-link: #{brand-colour(\"black\")} !important;\n --accent-link-visited: #{brand-colour(\"black\")} !important;\n --accent-keyline: #{brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{brand-colour(\"black\", 0.8)} !important;\n --button-accent-background: #{brand-colour(\"yellow\")} !important;\n } @else {\n --accent-font-base: #{brand-colour(\"white\")} !important;\n --accent-font-dark: #{brand-colour(\"white\")} !important;\n --accent-font-light: #{brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{brand-colour(\"white\", 0.45)} !important;\n --accent-link: #{brand-colour(\"white\")} !important;\n --accent-link-visited: #{brand-colour(\"white\")} !important;\n --accent-keyline: #{brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{brand-colour(\"white\", 0.8)} !important;\n --button-accent-text: #{brand-colour(\"white\")} !important;\n @if $colour == \"pink\" {\n --accent-background: #{brand-colour(\"maroon\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-pink\")} !important;\n --button-accent-background: #{brand-colour(\"maroon\")} !important;\n } @else if $colour == \"orange\" {\n --accent-background: #{brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-orange\")} !important;\n --button-accent-background: #{brand-colour(\"chestnut\")} !important;\n } @else if $colour == \"green\" {\n --accent-background: #{brand-colour(\"forest\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-green\")} !important;\n --button-accent-background: #{brand-colour(\"forest\")} !important;\n } @else if $colour == \"blue\" {\n --accent-background: #{brand-colour(\"navy\")} !important;\n --accent-background-light: #{brand-colour(\"pastel-blue\")} !important;\n --button-accent-background: #{brand-colour(\"navy\")} !important;\n }\n }\n}\n\n@mixin colour-font(\n $colour,\n $important: false,\n $default-palette: colour.$colour-palette-default\n) {\n color: map.get($default-palette, $colour) if($important, !important, null);\n color: var(--#{$colour}) if($important, !important, null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n background-color: var(--#{$colour}) if($important, !important, null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)} if($important, !important, 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 $property: border-#{$direction};\n border-#{$direction}: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n border-#{$direction}: $width\n var(--#{$colour})\n $style\n if($important, !important, null);\n } @else {\n border-#{$direction}-color: map.get(\n colour.$colour-palette-default,\n $colour\n )\n if($important, !important, null);\n border-#{$direction}-color: var(--#{$colour})\n if($important, !important, null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n border: $width var(--#{$colour}) $style if($important, !important, null);\n } @else {\n border-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n border-color: var(--#{$colour}) if($important, !important, null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width\n map.get(colour.$colour-palette-default, $colour)\n $style\n if($important, !important, null);\n outline: $width var(--#{$colour}) $style if($important, !important, null);\n } @else {\n outline-color: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n outline-color: var(--#{$colour}) if($important, !important, null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: map.get(colour.$colour-palette-default, $colour)\n if($important, !important, null);\n fill: var(--#{$colour}) if($important, !important, null);\n}\n\n@mixin thick-keyline($direction) {\n @include colour-border(\"keyline\", 5px, solid, $direction);\n}\n\n@mixin thick-keyline-dark($direction) {\n @include colour-border(\"keyline-dark\", 5px, solid, $direction);\n}\n\n@mixin thick-keyline-accent($direction) {\n @include colour-border(\"accent-background\", 5px, solid, $direction);\n}\n\n@mixin thick-keyline-error($direction) {\n @include colour-border(\"form-error\", 5px, solid, $direction);\n}\n\n@mixin thick-keyline-brand($direction, $brandColour) {\n border-#{$direction}: 5px #{brand-colour($brandColour)} solid;\n}\n\n%light {\n @include colour-css-vars(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast(\"form-error\");\n }\n}\n\n@mixin light {\n @extend %light;\n}\n\n%dark {\n @include colour-css-vars-dark(\"form-error\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast-dark(\"form-error\");\n }\n}\n\n@mixin dark {\n @extend %dark;\n}\n\n%plain {\n .tna-template--system-theme & {\n @extend %light;\n\n @media (prefers-color-scheme: dark) {\n @include colour-css-vars-dark;\n }\n\n @media (prefers-contrast: more) and (prefers-color-scheme: dark) {\n @include colour-css-vars-high-contrast-dark;\n }\n }\n\n .tna-template--light-theme & {\n @include colour-css-vars;\n }\n\n .tna-template--dark-theme & {\n @include colour-css-vars-dark;\n }\n\n .tna-template--high-contrast-theme & {\n @include colour-css-vars-high-contrast;\n }\n\n .tna-template--high-contrast-theme.tna-template--dark-theme & {\n @include colour-css-vars-high-contrast-dark;\n }\n\n --background: var(--page-background);\n}\n\n@mixin plain {\n @extend %plain;\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\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\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\", false, colour.$colour-palette-dark);\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%tint {\n @include colour-background(\"background-tint\");\n @include colour-font(\"font-base\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent-background {\n @include colour-background(\"accent-background\");\n}\n\n@mixin accent-background {\n @extend %accent-background;\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 // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\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\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 }\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}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n@mixin on-high-contrast {\n .tna-template--high-contrast-theme & {\n @content;\n }\n\n .tna-template--system-theme & {\n @media (prefers-contrast: more) {\n @content;\n }\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","@use \"sass:math\";\n@use \"colour\";\n@use \"../variables/typography\";\n\n@mixin relative-font-size($fontSizePx) {\n font-size: #{math.div($fontSizePx, typography.$relative-1rem-px)}rem;\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\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 @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n font-optical-sizing: auto;\n font-style: normal;\n font-variation-settings: \"wdth\" 100;\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 @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n font-optical-sizing: auto;\n font-style: normal;\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include relative-font-size(14);\n text-transform: uppercase;\n line-height: #{math.div(typography.$relative-1rem-px, 14)};\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n}\n","@use \"sass:math\";\n\n$use-local-fonts: false !default;\n\n$relative-1rem-px: 16; // 16px is always 1rem\n\n$body-font-size-px: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: #{math.div($relative-1rem-px, $body-font-size-px) * 2} !default; // 1.77777\n\n$interactive-text-decoration-thickness: 3.5px !default;\n\n$main-font: \"Open Sans\" !default;\n$main-font-family: $main-font, sans-serif !default;\n$main-font-weight: 400 !default;\n$main-font-weight-bold: 700 !default;\n\n$heading-font-family: supria-sans-condensed, \"Arial Narrow\", sans-serif !default;\n$heading-font-weight: 500 !default;\n\n$detail-font-family: \"Roboto Mono\", monospace !default;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n"]}
|
@@ -2,7 +2,8 @@
|
|
2
2
|
{%- if params.noCollapse -%}
|
3
3
|
{%- set containerClasses = containerClasses.concat('tna-breadcrumbs--no-collapse') -%}
|
4
4
|
{%- endif -%}
|
5
|
-
|
5
|
+
{%- set classes = containerClasses | join(' ') -%}
|
6
|
+
<nav class="tna-breadcrumbs{% if classes %} {{ classes }}{% endif %}" data-module="tna-breadcrumbs" aria-label="Breadcrumb"{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
6
7
|
<ol class="tna-breadcrumbs__list" {%- if params.structuredData %} itemscope itemtype="https://schema.org/BreadcrumbList"{% endif %}>
|
7
8
|
{%- for item in params.items -%}
|
8
9
|
<li class="tna-breadcrumbs__item" {%- if params.structuredData %} itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"{% endif %}>
|
@@ -0,0 +1,122 @@
|
|
1
|
+
import Button from "./template.njk";
|
2
|
+
|
3
|
+
export default {
|
4
|
+
title: "Components/Button group",
|
5
|
+
};
|
6
|
+
|
7
|
+
const Template = ({
|
8
|
+
text,
|
9
|
+
href,
|
10
|
+
title,
|
11
|
+
icon,
|
12
|
+
accent,
|
13
|
+
small,
|
14
|
+
plain,
|
15
|
+
iconOnly,
|
16
|
+
iconOnlyOnMobile,
|
17
|
+
rightAlignIcon,
|
18
|
+
buttonElement,
|
19
|
+
buttonType,
|
20
|
+
classes,
|
21
|
+
attributes,
|
22
|
+
}) =>
|
23
|
+
Button({
|
24
|
+
params: {
|
25
|
+
text,
|
26
|
+
href,
|
27
|
+
title,
|
28
|
+
icon,
|
29
|
+
accent,
|
30
|
+
small,
|
31
|
+
plain,
|
32
|
+
iconOnly,
|
33
|
+
iconOnlyOnMobile,
|
34
|
+
rightAlignIcon,
|
35
|
+
buttonElement,
|
36
|
+
buttonType,
|
37
|
+
classes,
|
38
|
+
attributes,
|
39
|
+
},
|
40
|
+
});
|
41
|
+
|
42
|
+
const GroupTemplate = ({ buttons }) =>
|
43
|
+
`<div class="tna-button-group">
|
44
|
+
${buttons.map((button) => Template(button)).join("")}
|
45
|
+
</div>`;
|
46
|
+
|
47
|
+
export const Group = GroupTemplate.bind({});
|
48
|
+
Group.args = {
|
49
|
+
buttons: [
|
50
|
+
{
|
51
|
+
text: "Standard",
|
52
|
+
href: "#",
|
53
|
+
classes: "tna-button--demo",
|
54
|
+
},
|
55
|
+
{
|
56
|
+
text: "Accent",
|
57
|
+
href: "#",
|
58
|
+
accent: true,
|
59
|
+
classes: "tna-button--demo",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
text: "Icon",
|
63
|
+
href: "#",
|
64
|
+
icon: "phone",
|
65
|
+
classes: "tna-button--demo",
|
66
|
+
},
|
67
|
+
{
|
68
|
+
text: "Right Aligned Icon",
|
69
|
+
href: "#",
|
70
|
+
icon: "chevron-right",
|
71
|
+
rightAlignIcon: true,
|
72
|
+
classes: "tna-button--demo",
|
73
|
+
},
|
74
|
+
{
|
75
|
+
text: "Icon Only",
|
76
|
+
href: "#",
|
77
|
+
icon: "list",
|
78
|
+
iconOnly: true,
|
79
|
+
classes: "tna-button--demo",
|
80
|
+
},
|
81
|
+
{
|
82
|
+
text: "Icon Only On Mobile",
|
83
|
+
href: "#",
|
84
|
+
icon: "list",
|
85
|
+
iconOnlyOnMobile: true,
|
86
|
+
classes: "tna-button--demo",
|
87
|
+
},
|
88
|
+
{
|
89
|
+
text: "Plain",
|
90
|
+
plain: true,
|
91
|
+
classes: "tna-button--demo",
|
92
|
+
},
|
93
|
+
{
|
94
|
+
text: "Plain With Icon",
|
95
|
+
href: "#",
|
96
|
+
icon: "map-location-dot",
|
97
|
+
plain: true,
|
98
|
+
classes: "tna-button--demo",
|
99
|
+
},
|
100
|
+
{
|
101
|
+
text: "Button",
|
102
|
+
buttonElement: true,
|
103
|
+
classes: "tna-button--demo",
|
104
|
+
},
|
105
|
+
],
|
106
|
+
};
|
107
|
+
|
108
|
+
const GroupOfSmallTemplate = ({ buttons }) =>
|
109
|
+
`<div class="tna-button-group">
|
110
|
+
${buttons.map((button) => Template({ ...button, text: `Small ${button.text}`, small: true })).join("")}
|
111
|
+
</div>`;
|
112
|
+
|
113
|
+
export const GroupOfSmall = GroupOfSmallTemplate.bind({});
|
114
|
+
GroupOfSmall.args = Group.args;
|
115
|
+
|
116
|
+
const SmallGroupTemplate = ({ buttons }) =>
|
117
|
+
`<div class="tna-button-group tna-button-group--small">
|
118
|
+
${buttons.map((button) => Template({ ...button, text: `Small ${button.text}` })).join("")}
|
119
|
+
</div>`;
|
120
|
+
|
121
|
+
export const SmallGroup = SmallGroupTemplate.bind({});
|
122
|
+
SmallGroup.args = Group.args;
|