@ministryofjustice/frontend 5.1.4 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/moj/all.bundle.js +79 -10
- package/moj/all.bundle.js.map +1 -1
- package/moj/all.bundle.mjs +79 -11
- package/moj/all.bundle.mjs.map +1 -1
- package/moj/all.mjs +3 -2
- package/moj/all.mjs.map +1 -1
- package/moj/common/moj-frontend-version.mjs +1 -1
- package/moj/components/_all.scss +2 -0
- package/moj/components/_all.scss.map +1 -1
- package/moj/components/date-picker/date-picker.bundle.js +9 -6
- package/moj/components/date-picker/date-picker.bundle.js.map +1 -1
- package/moj/components/date-picker/date-picker.bundle.mjs +9 -6
- package/moj/components/date-picker/date-picker.bundle.mjs.map +1 -1
- package/moj/components/date-picker/date-picker.mjs +9 -6
- package/moj/components/date-picker/date-picker.mjs.map +1 -1
- package/moj/components/domain-specific/probation/_all.scss +4 -0
- package/moj/components/domain-specific/probation/_all.scss.map +1 -0
- package/moj/components/domain-specific/probation/footer/README.md +22 -0
- package/moj/components/domain-specific/probation/footer/_footer.scss +52 -0
- package/moj/components/domain-specific/probation/footer/_footer.scss.map +1 -0
- package/moj/components/domain-specific/probation/footer/macro.njk +3 -0
- package/moj/components/domain-specific/probation/footer/template.njk +23 -0
- package/moj/components/domain-specific/probation/header/README.md +28 -0
- package/moj/components/domain-specific/probation/header/_header.scss +336 -0
- package/moj/components/domain-specific/probation/header/_header.scss.map +1 -0
- package/moj/components/domain-specific/probation/header/header.bundle.js +75 -0
- package/moj/components/domain-specific/probation/header/header.bundle.js.map +1 -0
- package/moj/components/domain-specific/probation/header/header.bundle.mjs +189 -0
- package/moj/components/domain-specific/probation/header/header.bundle.mjs.map +1 -0
- package/moj/components/domain-specific/probation/header/header.mjs +69 -0
- package/moj/components/domain-specific/probation/header/header.mjs.map +1 -0
- package/moj/components/domain-specific/probation/header/macro.njk +3 -0
- package/moj/components/domain-specific/probation/header/template.njk +109 -0
- package/moj/components/sortable-table/sortable-table.bundle.js +2 -2
- package/moj/components/sortable-table/sortable-table.bundle.js.map +1 -1
- package/moj/components/sortable-table/sortable-table.bundle.mjs +2 -2
- package/moj/components/sortable-table/sortable-table.bundle.mjs.map +1 -1
- package/moj/components/sortable-table/sortable-table.mjs +2 -2
- package/moj/components/sortable-table/sortable-table.mjs.map +1 -1
- package/moj/core/_moj-frontend-properties.scss +1 -1
- package/moj/moj-frontend.min.css +1 -1
- package/moj/moj-frontend.min.css.map +1 -1
- package/moj/moj-frontend.min.js +1 -1
- package/moj/moj-frontend.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/* stylelint-disable max-nesting-depth, selector-no-qualifying-type */
|
|
2
|
+
@use "../../../../vendor/govuk-frontend" as *;
|
|
3
|
+
|
|
4
|
+
/* ==========================================================================
|
|
5
|
+
PROBATION#HEADER
|
|
6
|
+
========================================================================== */
|
|
7
|
+
|
|
8
|
+
.probation-common-header {
|
|
9
|
+
[hidden] {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
color: govuk-colour("white");
|
|
13
|
+
|
|
14
|
+
background-color: govuk-colour("black");
|
|
15
|
+
|
|
16
|
+
&__logo {
|
|
17
|
+
@include govuk-responsive-margin(3, "right");
|
|
18
|
+
position: relative;
|
|
19
|
+
top: -2px;
|
|
20
|
+
padding: 15px 0;
|
|
21
|
+
fill: govuk-colour("white");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__title {
|
|
25
|
+
display: flex;
|
|
26
|
+
|
|
27
|
+
&__organisation-name {
|
|
28
|
+
@include govuk-responsive-margin(2, "right");
|
|
29
|
+
@include govuk-font($size: 24, $weight: "bold");
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.govuk-tag {
|
|
35
|
+
margin: auto 0;
|
|
36
|
+
|
|
37
|
+
@include govuk-media-query($until: 985px) {
|
|
38
|
+
display: none;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__submenu-link {
|
|
44
|
+
@include govuk-link-common;
|
|
45
|
+
@include govuk-link-style-no-visited-state;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&__link {
|
|
49
|
+
@include govuk-link-common;
|
|
50
|
+
@include govuk-link-style-default;
|
|
51
|
+
|
|
52
|
+
&:link,
|
|
53
|
+
&:visited,
|
|
54
|
+
&:active {
|
|
55
|
+
color: govuk-colour("white");
|
|
56
|
+
font-weight: normal;
|
|
57
|
+
text-decoration: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:focus {
|
|
61
|
+
color: govuk-colour("black");
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
|
|
64
|
+
&::after {
|
|
65
|
+
content: "";
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: auto;
|
|
68
|
+
right: 15px;
|
|
69
|
+
bottom: 0;
|
|
70
|
+
left: 15px;
|
|
71
|
+
height: 3px;
|
|
72
|
+
background: govuk-colour("black");
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
svg {
|
|
76
|
+
fill: govuk-colour("black");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
text-decoration: underline;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&__button-width-container {
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&__button-container {
|
|
90
|
+
@include govuk-media-query(925px) {
|
|
91
|
+
position: absolute;
|
|
92
|
+
top: -70px;
|
|
93
|
+
right: 0;
|
|
94
|
+
background-color: govuk-colour("black");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&__navigation {
|
|
99
|
+
display: flex;
|
|
100
|
+
height: 70px;
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
list-style: none;
|
|
104
|
+
flex-direction: row;
|
|
105
|
+
align-items: center;
|
|
106
|
+
|
|
107
|
+
&__item {
|
|
108
|
+
position: relative;
|
|
109
|
+
height: 100%;
|
|
110
|
+
|
|
111
|
+
> button,
|
|
112
|
+
> a {
|
|
113
|
+
display: flex;
|
|
114
|
+
height: 100%;
|
|
115
|
+
padding: 0;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
border: none;
|
|
118
|
+
color: govuk-colour("white");
|
|
119
|
+
background: govuk-colour("black");
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
@include govuk-font(16);
|
|
124
|
+
|
|
125
|
+
&:hover {
|
|
126
|
+
color: govuk-colour("mid-grey");
|
|
127
|
+
|
|
128
|
+
&::after {
|
|
129
|
+
content: "";
|
|
130
|
+
position: absolute;
|
|
131
|
+
top: auto;
|
|
132
|
+
right: 15px;
|
|
133
|
+
bottom: 0;
|
|
134
|
+
left: 15px;
|
|
135
|
+
height: 3px;
|
|
136
|
+
background: govuk-colour("mid-grey");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.probation-common-header__menu-toggle {
|
|
141
|
+
padding: 10px 0;
|
|
142
|
+
|
|
143
|
+
> span {
|
|
144
|
+
display: flex;
|
|
145
|
+
height: 100%;
|
|
146
|
+
padding: 0 15px;
|
|
147
|
+
border-left: 1px solid govuk-colour("white");
|
|
148
|
+
align-items: center;
|
|
149
|
+
|
|
150
|
+
&::before {
|
|
151
|
+
content: "";
|
|
152
|
+
display: inline-block;
|
|
153
|
+
width: 8px;
|
|
154
|
+
height: 8px;
|
|
155
|
+
margin: 3px 15px 0 3px;
|
|
156
|
+
transform: translateY(-35%) rotate(45deg) scale(1);
|
|
157
|
+
border-right: 2px solid govuk-colour("white");
|
|
158
|
+
border-bottom: 2px solid govuk-colour("white");
|
|
159
|
+
vertical-align: middle;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
svg {
|
|
164
|
+
margin: 0 15px 0 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&:hover {
|
|
168
|
+
> span {
|
|
169
|
+
&::before {
|
|
170
|
+
border-right: 2px solid govuk-colour("mid-grey");
|
|
171
|
+
border-bottom: 2px solid govuk-colour("mid-grey");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&.probation-common-header__toggle-open {
|
|
178
|
+
color: govuk-colour("blue");
|
|
179
|
+
background: govuk-colour("light-grey");
|
|
180
|
+
|
|
181
|
+
> span {
|
|
182
|
+
&::before {
|
|
183
|
+
transform: translateY(-0%) rotate(225deg) scale(1);
|
|
184
|
+
border-right: 2px solid govuk-colour("blue");
|
|
185
|
+
border-bottom: 2px solid govuk-colour("blue");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&::after {
|
|
189
|
+
content: "";
|
|
190
|
+
position: absolute;
|
|
191
|
+
top: auto;
|
|
192
|
+
right: 15px;
|
|
193
|
+
bottom: 0;
|
|
194
|
+
left: 15px;
|
|
195
|
+
height: 3px;
|
|
196
|
+
background: govuk-colour("blue");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&:hover {
|
|
201
|
+
color: govuk-colour("dark-grey");
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&:focus-visible {
|
|
206
|
+
outline: 3px solid transparent;
|
|
207
|
+
color: govuk-colour("black");
|
|
208
|
+
background-color: govuk-colour("yellow");
|
|
209
|
+
box-shadow: none;
|
|
210
|
+
text-decoration: none;
|
|
211
|
+
|
|
212
|
+
&::after {
|
|
213
|
+
content: "";
|
|
214
|
+
position: absolute;
|
|
215
|
+
top: auto;
|
|
216
|
+
right: 15px;
|
|
217
|
+
bottom: 0;
|
|
218
|
+
left: 15px;
|
|
219
|
+
height: 3px;
|
|
220
|
+
background: govuk-colour("black");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
> span {
|
|
224
|
+
&::before {
|
|
225
|
+
border-right: 2px solid govuk-colour("black");
|
|
226
|
+
border-bottom: 2px solid govuk-colour("black");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&.item-open {
|
|
233
|
+
+ div {
|
|
234
|
+
> button,
|
|
235
|
+
> a {
|
|
236
|
+
> span {
|
|
237
|
+
border-left: 1px solid transparent;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.probation-common-header__user-menu {
|
|
246
|
+
position: relative;
|
|
247
|
+
z-index: 10000000;
|
|
248
|
+
padding: 15px;
|
|
249
|
+
background: govuk-colour("light-grey");
|
|
250
|
+
|
|
251
|
+
a {
|
|
252
|
+
display: block;
|
|
253
|
+
margin-bottom: 15px;
|
|
254
|
+
font-weight: 700;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
&__pushdown-menu {
|
|
259
|
+
padding: 30px 0 60px;
|
|
260
|
+
background: govuk-colour("light-grey");
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
&__icon-link-wrapper {
|
|
264
|
+
display: flex;
|
|
265
|
+
position: relative;
|
|
266
|
+
height: 100%;
|
|
267
|
+
|
|
268
|
+
img,
|
|
269
|
+
svg {
|
|
270
|
+
margin: 0 15px 0 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
a {
|
|
274
|
+
box-sizing: border-box;
|
|
275
|
+
display: block;
|
|
276
|
+
width: 100%;
|
|
277
|
+
padding: 10px 0;
|
|
278
|
+
|
|
279
|
+
> span {
|
|
280
|
+
display: flex;
|
|
281
|
+
height: 100%;
|
|
282
|
+
padding: 0 15px;
|
|
283
|
+
border-left: 1px solid govuk-colour("white");
|
|
284
|
+
align-items: center;
|
|
285
|
+
justify-content: center;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&:hover {
|
|
289
|
+
color: govuk-colour("mid-grey");
|
|
290
|
+
text-decoration: none;
|
|
291
|
+
|
|
292
|
+
&::after {
|
|
293
|
+
content: "";
|
|
294
|
+
position: absolute;
|
|
295
|
+
top: auto;
|
|
296
|
+
right: 15px;
|
|
297
|
+
bottom: 0;
|
|
298
|
+
left: 15px;
|
|
299
|
+
height: 3px;
|
|
300
|
+
background: govuk-colour("mid-grey");
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&__services-menu {
|
|
307
|
+
ul {
|
|
308
|
+
display: grid;
|
|
309
|
+
width: 100%;
|
|
310
|
+
margin-bottom: 0;
|
|
311
|
+
font-weight: bold;
|
|
312
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
313
|
+
gap: 15px;
|
|
314
|
+
justify-items: start;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&__user-menu-link {
|
|
319
|
+
width: 181px;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&__services-menu-link {
|
|
323
|
+
width: 107px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&__menu-toggle-label {
|
|
327
|
+
display: block;
|
|
328
|
+
text-align: left;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
@media print {
|
|
332
|
+
display: none;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/*# sourceMappingURL=_header.scss.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/moj/components/domain-specific/probation/header/_header.scss"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,6CAA6C;;AAE7C;;+EAE+E;;AAE/E;EACE;IACE,aAAa;EACf;EACA,4BAA4B;;EAE5B,uCAAuC;;EAEvC;IACE,4CAA4C;IAC5C,k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;;EAEA;IACE;MACE,aAAa;MACb,WAAW;MACX,gBAAgB;MAChB,iBAAiB;MACjB,kCAAkC;MAClC,SAAS;MACT,oBAAoB;IACtB;EACF;;EAEA;IACE,YAAY;EACd;;EAEA;IACE,YAAY;EACd;;EAEA;IACE,cAAc;IACd,gBAAgB;EAClB;;EAEA;IACE,aAAa;EACf;AACF","file":"_header.scss","sourcesContent":["/* stylelint-disable max-nesting-depth, selector-no-qualifying-type */\n@use \"../../../../vendor/govuk-frontend\" as *;\n\n/* ==========================================================================\n PROBATION#HEADER\n ========================================================================== */\n\n.probation-common-header {\n [hidden] {\n display: none;\n }\n color: govuk-colour(\"white\");\n\n background-color: govuk-colour(\"black\");\n\n &__logo {\n @include govuk-responsive-margin(3, \"right\");\n position: relative;\n top: -2px;\n padding: 15px 0;\n fill: govuk-colour(\"white\");\n }\n\n &__title {\n display: flex;\n\n &__organisation-name {\n @include govuk-responsive-margin(2, \"right\");\n @include govuk-font($size: 24, $weight: \"bold\");\n display: flex;\n align-items: center;\n }\n\n .govuk-tag {\n margin: auto 0;\n\n @include govuk-media-query($until: 985px) {\n display: none;\n }\n }\n }\n\n &__submenu-link {\n @include govuk-link-common;\n @include govuk-link-style-no-visited-state;\n }\n\n &__link {\n @include govuk-link-common;\n @include govuk-link-style-default;\n\n &:link,\n &:visited,\n &:active {\n color: govuk-colour(\"white\");\n font-weight: normal;\n text-decoration: none;\n }\n\n &:focus {\n color: govuk-colour(\"black\");\n box-shadow: none;\n\n &::after {\n content: \"\";\n position: absolute;\n top: auto;\n right: 15px;\n bottom: 0;\n left: 15px;\n height: 3px;\n background: govuk-colour(\"black\");\n }\n\n svg {\n fill: govuk-colour(\"black\");\n }\n }\n\n &:hover {\n text-decoration: underline;\n }\n }\n\n &__button-width-container {\n position: relative;\n }\n\n &__button-container {\n @include govuk-media-query(925px) {\n position: absolute;\n top: -70px;\n right: 0;\n background-color: govuk-colour(\"black\");\n }\n }\n\n &__navigation {\n display: flex;\n height: 70px;\n margin: 0;\n padding: 0;\n list-style: none;\n flex-direction: row;\n align-items: center;\n\n &__item {\n position: relative;\n height: 100%;\n\n > button,\n > a {\n display: flex;\n height: 100%;\n padding: 0;\n overflow: hidden;\n border: none;\n color: govuk-colour(\"white\");\n background: govuk-colour(\"black\");\n cursor: pointer;\n align-items: center;\n justify-content: center;\n @include govuk-font(16);\n\n &:hover {\n color: govuk-colour(\"mid-grey\");\n\n &::after {\n content: \"\";\n position: absolute;\n top: auto;\n right: 15px;\n bottom: 0;\n left: 15px;\n height: 3px;\n background: govuk-colour(\"mid-grey\");\n }\n }\n\n &.probation-common-header__menu-toggle {\n padding: 10px 0;\n\n > span {\n display: flex;\n height: 100%;\n padding: 0 15px;\n border-left: 1px solid govuk-colour(\"white\");\n align-items: center;\n\n &::before {\n content: \"\";\n display: inline-block;\n width: 8px;\n height: 8px;\n margin: 3px 15px 0 3px;\n -ms-transform: translateY(-35%) rotate(45deg) scale(1);\n -webkit-transform: translateY(-35%) rotate(45deg) scale(1);\n transform: translateY(-35%) rotate(45deg) scale(1);\n border-right: 2px solid govuk-colour(\"white\");\n border-bottom: 2px solid govuk-colour(\"white\");\n vertical-align: middle;\n }\n }\n\n svg {\n margin: 0 15px 0 0;\n }\n\n &:hover {\n > span {\n &::before {\n border-right: 2px solid govuk-colour(\"mid-grey\");\n border-bottom: 2px solid govuk-colour(\"mid-grey\");\n }\n }\n }\n }\n\n &.probation-common-header__toggle-open {\n color: govuk-colour(\"blue\");\n background: govuk-colour(\"light-grey\");\n\n > span {\n &::before {\n -ms-transform: translateY(-0%) rotate(225deg) scale(1);\n -webkit-transform: translateY(-0%) rotate(225deg) scale(1);\n transform: translateY(-0%) rotate(225deg) scale(1);\n border-right: 2px solid govuk-colour(\"blue\");\n border-bottom: 2px solid govuk-colour(\"blue\");\n }\n\n &::after {\n content: \"\";\n position: absolute;\n top: auto;\n right: 15px;\n bottom: 0;\n left: 15px;\n height: 3px;\n background: govuk-colour(\"blue\");\n }\n }\n\n &:hover {\n color: govuk-colour(\"dark-grey\");\n }\n }\n\n &:focus-visible {\n outline: 3px solid transparent;\n color: govuk-colour(\"black\");\n background-color: govuk-colour(\"yellow\");\n box-shadow: none;\n text-decoration: none;\n\n &::after {\n content: \"\";\n position: absolute;\n top: auto;\n right: 15px;\n bottom: 0;\n left: 15px;\n height: 3px;\n background: govuk-colour(\"black\");\n }\n\n > span {\n &::before {\n border-right: 2px solid govuk-colour(\"black\");\n border-bottom: 2px solid govuk-colour(\"black\");\n }\n }\n }\n }\n\n &.item-open {\n + div {\n > button,\n > a {\n > span {\n border-left: 1px solid transparent;\n }\n }\n }\n }\n }\n }\n\n .probation-common-header__user-menu {\n position: relative;\n z-index: 10000000;\n padding: 15px;\n background: govuk-colour(\"light-grey\");\n\n a {\n display: block;\n margin-bottom: 15px;\n font-weight: 700;\n }\n }\n\n &__pushdown-menu {\n padding: 30px 0 60px;\n background: govuk-colour(\"light-grey\");\n }\n\n &__icon-link-wrapper {\n display: flex;\n position: relative;\n height: 100%;\n\n img,\n svg {\n margin: 0 15px 0 0;\n }\n\n a {\n box-sizing: border-box;\n display: block;\n width: 100%;\n padding: 10px 0;\n\n > span {\n display: flex;\n height: 100%;\n padding: 0 15px;\n border-left: 1px solid govuk-colour(\"white\");\n align-items: center;\n justify-content: center;\n }\n\n &:hover {\n color: govuk-colour(\"mid-grey\");\n text-decoration: none;\n\n &::after {\n content: \"\";\n position: absolute;\n top: auto;\n right: 15px;\n bottom: 0;\n left: 15px;\n height: 3px;\n background: govuk-colour(\"mid-grey\");\n }\n }\n }\n }\n\n &__services-menu {\n ul {\n display: grid;\n width: 100%;\n margin-bottom: 0;\n font-weight: bold;\n grid-template-columns: 1fr 1fr 1fr;\n gap: 15px;\n justify-items: start;\n }\n }\n\n &__user-menu-link {\n width: 181px;\n }\n\n &__services-menu-link {\n width: 107px;\n }\n\n &__menu-toggle-label {\n display: block;\n text-align: left;\n }\n\n @media print {\n display: none;\n }\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('govuk-frontend')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'govuk-frontend'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MOJFrontend = global.MOJFrontend || {}, global.GOVUKFrontend));
|
|
5
|
+
})(this, (function (exports, govukFrontend) { 'use strict';
|
|
6
|
+
|
|
7
|
+
class PdsHeader extends govukFrontend.Component {
|
|
8
|
+
/**
|
|
9
|
+
* @param {Element | null} $root - HTML element to use for PDS header
|
|
10
|
+
*/
|
|
11
|
+
constructor($root) {
|
|
12
|
+
super($root);
|
|
13
|
+
this.initHeader();
|
|
14
|
+
}
|
|
15
|
+
initHeader() {
|
|
16
|
+
this.$tabOpenClass = 'probation-common-header__toggle-open';
|
|
17
|
+
const $userToggle = this.$root.querySelector('.probation-common-header__user-menu-toggle');
|
|
18
|
+
const $userMenu = this.$root.querySelector('#probation-common-header-user-menu');
|
|
19
|
+
if (!$userToggle || !$userMenu || !($userToggle instanceof HTMLElement) || !($userMenu instanceof HTMLElement)) {
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
this.hideFallbackLinks();
|
|
23
|
+
$userToggle.removeAttribute('hidden');
|
|
24
|
+
this.closeTabs([[$userToggle, $userMenu]]);
|
|
25
|
+
$userToggle.addEventListener('click', _event => {
|
|
26
|
+
this.toggleMenu($userToggle, $userMenu);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @param {[any, any][]} tabTuples
|
|
32
|
+
*/
|
|
33
|
+
closeTabs(tabTuples) {
|
|
34
|
+
tabTuples.forEach(([toggle, menu]) => {
|
|
35
|
+
if (menu && toggle) {
|
|
36
|
+
menu.setAttribute('hidden', 'hidden');
|
|
37
|
+
toggle.classList.remove(this.$tabOpenClass);
|
|
38
|
+
toggle.parentElement.classList.remove('item-open');
|
|
39
|
+
toggle.setAttribute('aria-expanded', 'false');
|
|
40
|
+
if (toggle.dataset.textForShow) toggle.setAttribute('aria-label', toggle.dataset.textForShow);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {HTMLElement} toggle
|
|
47
|
+
* @param {HTMLElement} menu
|
|
48
|
+
*/
|
|
49
|
+
toggleMenu(toggle, menu) {
|
|
50
|
+
const isOpen = !menu.getAttribute('hidden');
|
|
51
|
+
if (isOpen) {
|
|
52
|
+
this.closeTabs([[toggle, menu]]);
|
|
53
|
+
} else if (menu && toggle) {
|
|
54
|
+
menu.removeAttribute('hidden');
|
|
55
|
+
toggle.classList.add(this.$tabOpenClass);
|
|
56
|
+
toggle.parentElement.classList.add('item-open');
|
|
57
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
58
|
+
if (toggle.dataset.textForHide) toggle.setAttribute('aria-label', toggle.dataset.textForHide);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
hideFallbackLinks() {
|
|
62
|
+
const $userLink = this.$root.querySelector('.probation-common-header__user-menu-link');
|
|
63
|
+
if ($userLink) $userLink.setAttribute('hidden', 'hidden');
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Name for the component used when initialising using data-module attributes.
|
|
68
|
+
*/
|
|
69
|
+
}
|
|
70
|
+
PdsHeader.moduleName = 'pds-header';
|
|
71
|
+
|
|
72
|
+
exports.PdsHeader = PdsHeader;
|
|
73
|
+
|
|
74
|
+
}));
|
|
75
|
+
//# sourceMappingURL=header.bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.bundle.js","sources":["../../../../../../src/moj/components/domain-specific/probation/header/header.mjs"],"sourcesContent":["import { Component } from 'govuk-frontend'\n\nexport class PdsHeader extends Component {\n /**\n * @param {Element | null} $root - HTML element to use for PDS header\n */\n constructor($root) {\n super($root)\n this.initHeader()\n }\n\n initHeader() {\n this.$tabOpenClass = 'probation-common-header__toggle-open'\n const $userToggle = this.$root.querySelector(\n '.probation-common-header__user-menu-toggle'\n )\n const $userMenu = this.$root.querySelector(\n '#probation-common-header-user-menu'\n )\n\n if (\n !$userToggle ||\n !$userMenu ||\n !($userToggle instanceof HTMLElement) ||\n !($userMenu instanceof HTMLElement)\n ) {\n return 0\n }\n\n this.hideFallbackLinks()\n $userToggle.removeAttribute('hidden')\n\n this.closeTabs([[$userToggle, $userMenu]])\n\n $userToggle.addEventListener('click', (_event) => {\n this.toggleMenu($userToggle, $userMenu)\n })\n }\n\n /**\n * @param {[any, any][]} tabTuples\n */\n closeTabs(tabTuples) {\n tabTuples.forEach(([toggle, menu]) => {\n if (menu && toggle) {\n menu.setAttribute('hidden', 'hidden')\n toggle.classList.remove(this.$tabOpenClass)\n toggle.parentElement.classList.remove('item-open')\n toggle.setAttribute('aria-expanded', 'false')\n if (toggle.dataset.textForShow)\n toggle.setAttribute('aria-label', toggle.dataset.textForShow)\n }\n })\n }\n\n /**\n * @param {HTMLElement} toggle\n * @param {HTMLElement} menu\n */\n toggleMenu(toggle, menu) {\n const isOpen = !menu.getAttribute('hidden')\n\n if (isOpen) {\n this.closeTabs([[toggle, menu]])\n } else if (menu && toggle) {\n menu.removeAttribute('hidden')\n toggle.classList.add(this.$tabOpenClass)\n toggle.parentElement.classList.add('item-open')\n toggle.setAttribute('aria-expanded', 'true')\n if (toggle.dataset.textForHide)\n toggle.setAttribute('aria-label', toggle.dataset.textForHide)\n }\n }\n\n hideFallbackLinks() {\n const $userLink = this.$root.querySelector(\n '.probation-common-header__user-menu-link'\n )\n if ($userLink) $userLink.setAttribute('hidden', 'hidden')\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'pds-header'\n}\n"],"names":["PdsHeader","Component","constructor","$root","initHeader","$tabOpenClass","$userToggle","querySelector","$userMenu","HTMLElement","hideFallbackLinks","removeAttribute","closeTabs","addEventListener","_event","toggleMenu","tabTuples","forEach","toggle","menu","setAttribute","classList","remove","parentElement","dataset","textForShow","isOpen","getAttribute","add","textForHide","$userLink","moduleName"],"mappings":";;;;;;EAEO,MAAMA,SAAS,SAASC,uBAAS,CAAC;EACvC;EACF;EACA;IACEC,WAAWA,CAACC,KAAK,EAAE;MACjB,KAAK,CAACA,KAAK,CAAC;MACZ,IAAI,CAACC,UAAU,EAAE;EACnB;EAEAA,EAAAA,UAAUA,GAAG;MACX,IAAI,CAACC,aAAa,GAAG,sCAAsC;MAC3D,MAAMC,WAAW,GAAG,IAAI,CAACH,KAAK,CAACI,aAAa,CAC1C,4CACF,CAAC;MACD,MAAMC,SAAS,GAAG,IAAI,CAACL,KAAK,CAACI,aAAa,CACxC,oCACF,CAAC;EAED,IAAA,IACE,CAACD,WAAW,IACZ,CAACE,SAAS,IACV,EAAEF,WAAW,YAAYG,WAAW,CAAC,IACrC,EAAED,SAAS,YAAYC,WAAW,CAAC,EACnC;EACA,MAAA,OAAO,CAAC;EACV;MAEA,IAAI,CAACC,iBAAiB,EAAE;EACxBJ,IAAAA,WAAW,CAACK,eAAe,CAAC,QAAQ,CAAC;MAErC,IAAI,CAACC,SAAS,CAAC,CAAC,CAACN,WAAW,EAAEE,SAAS,CAAC,CAAC,CAAC;EAE1CF,IAAAA,WAAW,CAACO,gBAAgB,CAAC,OAAO,EAAGC,MAAM,IAAK;EAChD,MAAA,IAAI,CAACC,UAAU,CAACT,WAAW,EAAEE,SAAS,CAAC;EACzC,KAAC,CAAC;EACJ;;EAEA;EACF;EACA;IACEI,SAASA,CAACI,SAAS,EAAE;MACnBA,SAAS,CAACC,OAAO,CAAC,CAAC,CAACC,MAAM,EAAEC,IAAI,CAAC,KAAK;QACpC,IAAIA,IAAI,IAAID,MAAM,EAAE;EAClBC,QAAAA,IAAI,CAACC,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC;UACrCF,MAAM,CAACG,SAAS,CAACC,MAAM,CAAC,IAAI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FapB,SAAS,CAkFb+B,UAAU,GAAG,YAAY;;;;;;;;"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
function isInitialised($root, moduleName) {
|
|
2
|
+
return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Checks if GOV.UK Frontend is supported on this page
|
|
7
|
+
*
|
|
8
|
+
* Some browsers will load and run our JavaScript but GOV.UK Frontend
|
|
9
|
+
* won't be supported.
|
|
10
|
+
*
|
|
11
|
+
* @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support
|
|
12
|
+
* @returns {boolean} Whether GOV.UK Frontend is supported on this page
|
|
13
|
+
*/
|
|
14
|
+
function isSupported($scope = document.body) {
|
|
15
|
+
if (!$scope) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return $scope.classList.contains('govuk-frontend-supported');
|
|
19
|
+
}
|
|
20
|
+
function formatErrorMessage(Component, message) {
|
|
21
|
+
return `${Component.moduleName}: ${message}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
class GOVUKFrontendError extends Error {
|
|
25
|
+
constructor(...args) {
|
|
26
|
+
super(...args);
|
|
27
|
+
this.name = 'GOVUKFrontendError';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class SupportError extends GOVUKFrontendError {
|
|
31
|
+
/**
|
|
32
|
+
* Checks if GOV.UK Frontend is supported on this page
|
|
33
|
+
*
|
|
34
|
+
* @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support
|
|
35
|
+
*/
|
|
36
|
+
constructor($scope = document.body) {
|
|
37
|
+
const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';
|
|
38
|
+
super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type="module">`');
|
|
39
|
+
this.name = 'SupportError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class ElementError extends GOVUKFrontendError {
|
|
43
|
+
constructor(messageOrOptions) {
|
|
44
|
+
let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
|
|
45
|
+
if (typeof messageOrOptions === 'object') {
|
|
46
|
+
const {
|
|
47
|
+
component,
|
|
48
|
+
identifier,
|
|
49
|
+
element,
|
|
50
|
+
expectedType
|
|
51
|
+
} = messageOrOptions;
|
|
52
|
+
message = identifier;
|
|
53
|
+
message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
|
|
54
|
+
message = formatErrorMessage(component, message);
|
|
55
|
+
}
|
|
56
|
+
super(message);
|
|
57
|
+
this.name = 'ElementError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class InitError extends GOVUKFrontendError {
|
|
61
|
+
constructor(componentOrMessage) {
|
|
62
|
+
const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\`$root\`) already initialised`);
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = 'InitError';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
class Component {
|
|
69
|
+
/**
|
|
70
|
+
* Returns the root element of the component
|
|
71
|
+
*
|
|
72
|
+
* @protected
|
|
73
|
+
* @returns {RootElementType} - the root element of component
|
|
74
|
+
*/
|
|
75
|
+
get $root() {
|
|
76
|
+
return this._$root;
|
|
77
|
+
}
|
|
78
|
+
constructor($root) {
|
|
79
|
+
this._$root = void 0;
|
|
80
|
+
const childConstructor = this.constructor;
|
|
81
|
+
if (typeof childConstructor.moduleName !== 'string') {
|
|
82
|
+
throw new InitError(`\`moduleName\` not defined in component`);
|
|
83
|
+
}
|
|
84
|
+
if (!($root instanceof childConstructor.elementType)) {
|
|
85
|
+
throw new ElementError({
|
|
86
|
+
element: $root,
|
|
87
|
+
component: childConstructor,
|
|
88
|
+
identifier: 'Root element (`$root`)',
|
|
89
|
+
expectedType: childConstructor.elementType.name
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
this._$root = $root;
|
|
93
|
+
}
|
|
94
|
+
childConstructor.checkSupport();
|
|
95
|
+
this.checkInitialised();
|
|
96
|
+
const moduleName = childConstructor.moduleName;
|
|
97
|
+
this.$root.setAttribute(`data-${moduleName}-init`, '');
|
|
98
|
+
}
|
|
99
|
+
checkInitialised() {
|
|
100
|
+
const constructor = this.constructor;
|
|
101
|
+
const moduleName = constructor.moduleName;
|
|
102
|
+
if (moduleName && isInitialised(this.$root, moduleName)) {
|
|
103
|
+
throw new InitError(constructor);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
static checkSupport() {
|
|
107
|
+
if (!isSupported()) {
|
|
108
|
+
throw new SupportError();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @typedef ChildClass
|
|
115
|
+
* @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component
|
|
116
|
+
*/
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {typeof Component & ChildClass} ChildClassConstructor
|
|
120
|
+
*/
|
|
121
|
+
Component.elementType = HTMLElement;
|
|
122
|
+
|
|
123
|
+
class PdsHeader extends Component {
|
|
124
|
+
/**
|
|
125
|
+
* @param {Element | null} $root - HTML element to use for PDS header
|
|
126
|
+
*/
|
|
127
|
+
constructor($root) {
|
|
128
|
+
super($root);
|
|
129
|
+
this.initHeader();
|
|
130
|
+
}
|
|
131
|
+
initHeader() {
|
|
132
|
+
this.$tabOpenClass = 'probation-common-header__toggle-open';
|
|
133
|
+
const $userToggle = this.$root.querySelector('.probation-common-header__user-menu-toggle');
|
|
134
|
+
const $userMenu = this.$root.querySelector('#probation-common-header-user-menu');
|
|
135
|
+
if (!$userToggle || !$userMenu || !($userToggle instanceof HTMLElement) || !($userMenu instanceof HTMLElement)) {
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
this.hideFallbackLinks();
|
|
139
|
+
$userToggle.removeAttribute('hidden');
|
|
140
|
+
this.closeTabs([[$userToggle, $userMenu]]);
|
|
141
|
+
$userToggle.addEventListener('click', _event => {
|
|
142
|
+
this.toggleMenu($userToggle, $userMenu);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @param {[any, any][]} tabTuples
|
|
148
|
+
*/
|
|
149
|
+
closeTabs(tabTuples) {
|
|
150
|
+
tabTuples.forEach(([toggle, menu]) => {
|
|
151
|
+
if (menu && toggle) {
|
|
152
|
+
menu.setAttribute('hidden', 'hidden');
|
|
153
|
+
toggle.classList.remove(this.$tabOpenClass);
|
|
154
|
+
toggle.parentElement.classList.remove('item-open');
|
|
155
|
+
toggle.setAttribute('aria-expanded', 'false');
|
|
156
|
+
if (toggle.dataset.textForShow) toggle.setAttribute('aria-label', toggle.dataset.textForShow);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {HTMLElement} toggle
|
|
163
|
+
* @param {HTMLElement} menu
|
|
164
|
+
*/
|
|
165
|
+
toggleMenu(toggle, menu) {
|
|
166
|
+
const isOpen = !menu.getAttribute('hidden');
|
|
167
|
+
if (isOpen) {
|
|
168
|
+
this.closeTabs([[toggle, menu]]);
|
|
169
|
+
} else if (menu && toggle) {
|
|
170
|
+
menu.removeAttribute('hidden');
|
|
171
|
+
toggle.classList.add(this.$tabOpenClass);
|
|
172
|
+
toggle.parentElement.classList.add('item-open');
|
|
173
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
174
|
+
if (toggle.dataset.textForHide) toggle.setAttribute('aria-label', toggle.dataset.textForHide);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
hideFallbackLinks() {
|
|
178
|
+
const $userLink = this.$root.querySelector('.probation-common-header__user-menu-link');
|
|
179
|
+
if ($userLink) $userLink.setAttribute('hidden', 'hidden');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Name for the component used when initialising using data-module attributes.
|
|
184
|
+
*/
|
|
185
|
+
}
|
|
186
|
+
PdsHeader.moduleName = 'pds-header';
|
|
187
|
+
|
|
188
|
+
export { PdsHeader };
|
|
189
|
+
//# sourceMappingURL=header.bundle.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.bundle.mjs","sources":["../../../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../../../src/moj/components/domain-specific/probation/header/header.mjs"],"sourcesContent":["function getFragmentFromUrl(url) {\n if (!url.includes('#')) {\n return undefined;\n }\n return url.split('#').pop();\n}\nfunction getBreakpoint(name) {\n const property = `--govuk-frontend-breakpoint-${name}`;\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n return {\n property,\n value: value || undefined\n };\n}\nfunction setFocus($element, options = {}) {\n var _options$onBeforeFocu;\n const isFocusable = $element.getAttribute('tabindex');\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1');\n }\n function onFocus() {\n $element.addEventListener('blur', onBlur, {\n once: true\n });\n }\n function onBlur() {\n var _options$onBlur;\n (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n if (!isFocusable) {\n $element.removeAttribute('tabindex');\n }\n }\n $element.addEventListener('focus', onFocus, {\n once: true\n });\n (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n if (!$scope) {\n return false;\n }\n return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n return Array.isArray(option);\n}\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n/**\n * @import { ObjectNested } from './configuration.mjs'\n */\n\nexport { formatErrorMessage, getBreakpoint, getFragmentFromUrl, isInitialised, isObject, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n constructor(...args) {\n super(...args);\n this.name = 'GOVUKFrontendError';\n }\n}\nclass SupportError extends GOVUKFrontendError {\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage = 'noModule' in HTMLScriptElement.prototype ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet' : 'GOV.UK Frontend is not supported in this browser';\n super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n this.name = 'SupportError';\n }\n}\nclass ConfigError extends GOVUKFrontendError {\n constructor(...args) {\n super(...args);\n this.name = 'ConfigError';\n }\n}\nclass ElementError extends GOVUKFrontendError {\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n if (typeof messageOrOptions === 'object') {\n const {\n component,\n identifier,\n element,\n expectedType\n } = messageOrOptions;\n message = identifier;\n message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n message = formatErrorMessage(component, message);\n }\n super(message);\n this.name = 'ElementError';\n }\n}\nclass InitError extends GOVUKFrontendError {\n constructor(componentOrMessage) {\n const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n super(message);\n this.name = 'InitError';\n }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root;\n }\n constructor($root) {\n this._$root = void 0;\n const childConstructor = this.constructor;\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`);\n }\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n });\n } else {\n this._$root = $root;\n }\n childConstructor.checkSupport();\n this.checkInitialised();\n const moduleName = childConstructor.moduleName;\n this.$root.setAttribute(`data-${moduleName}-init`, '');\n }\n checkInitialised() {\n const constructor = this.constructor;\n const moduleName = constructor.moduleName;\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor);\n }\n }\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError();\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from 'govuk-frontend'\n\nexport class PdsHeader extends Component {\n /**\n * @param {Element | null} $root - HTML element to use for PDS header\n */\n constructor($root) {\n super($root)\n this.initHeader()\n }\n\n initHeader() {\n this.$tabOpenClass = 'probation-common-header__toggle-open'\n const $userToggle = this.$root.querySelector(\n '.probation-common-header__user-menu-toggle'\n )\n const $userMenu = this.$root.querySelector(\n '#probation-common-header-user-menu'\n )\n\n if (\n !$userToggle ||\n !$userMenu ||\n !($userToggle instanceof HTMLElement) ||\n !($userMenu instanceof HTMLElement)\n ) {\n return 0\n }\n\n this.hideFallbackLinks()\n $userToggle.removeAttribute('hidden')\n\n this.closeTabs([[$userToggle, $userMenu]])\n\n $userToggle.addEventListener('click', (_event) => {\n this.toggleMenu($userToggle, $userMenu)\n })\n }\n\n /**\n * @param {[any, any][]} tabTuples\n */\n closeTabs(tabTuples) {\n tabTuples.forEach(([toggle, menu]) => {\n if (menu && toggle) {\n menu.setAttribute('hidden', 'hidden')\n toggle.classList.remove(this.$tabOpenClass)\n toggle.parentElement.classList.remove('item-open')\n toggle.setAttribute('aria-expanded', 'false')\n if (toggle.dataset.textForShow)\n toggle.setAttribute('aria-label', toggle.dataset.textForShow)\n }\n })\n }\n\n /**\n * @param {HTMLElement} toggle\n * @param {HTMLElement} menu\n */\n toggleMenu(toggle, menu) {\n const isOpen = !menu.getAttribute('hidden')\n\n if (isOpen) {\n this.closeTabs([[toggle, menu]])\n } else if (menu && toggle) {\n menu.removeAttribute('hidden')\n toggle.classList.add(this.$tabOpenClass)\n toggle.parentElement.classList.add('item-open')\n toggle.setAttribute('aria-expanded', 'true')\n if (toggle.dataset.textForHide)\n toggle.setAttribute('aria-label', toggle.dataset.textForHide)\n }\n }\n\n hideFallbackLinks() {\n const $userLink = this.$root.querySelector(\n '.probation-common-header__user-menu-link'\n )\n if ($userLink) $userLink.setAttribute('hidden', 'hidden')\n }\n\n /**\n * Name for the component used when initialising using data-module attributes.\n */\n static moduleName = 'pds-header'\n}\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","PdsHeader","initHeader","$tabOpenClass","$userToggle","querySelector","$userMenu","hideFallbackLinks","removeAttribute","closeTabs","addEventListener","_event","toggleMenu","tabTuples","forEach","toggle","menu","remove","parentElement","dataset","textForShow","isOpen","getAttribute","add","textForHide","$userLink"],"mappings":"AAqGO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;EAClD,IAAI,CAACF,MAAM,EAAE;AACX,IAAA,OAAO,KAAK;AACd;AAEA,EAAA,OAAOA,MAAM,CAACG,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC;AAC9D;AAiCO,SAASC,kBAAkBA,CAACC,SAAS,EAAEC,OAAO,EAAE;AACrD,EAAA,OAAO,GAAGD,SAAS,CAACV,UAAU,CAAA,EAAA,EAAKW,OAAO,CAAE,CAAA;AAC9C;;ACxIO,MAAMC,kBAAkB,SAASC,KAAK,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA;IAAA,IAC5C,CAAAC,IAAI,GAAG,oBAAoB;AAAA;AAC7B;AAKO,MAAMC,YAAY,SAASL,kBAAkB,CAAC;AAGnD;AACF;AACA;AACA;AACA;AACEE,EAAAA,WAAWA,CAACV,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;IAClC,MAAMY,cAAc,GAClB,UAAU,IAAIC,iBAAiB,CAACC,SAAS,GACrC,gHAAgH,GAChH,kDAAkD;AAExD,IAAA,KAAK,CACHhB,MAAM,GACFc,cAAc,GACd,8DACN,CAAC;IAAA,IAjBH,CAAA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