@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
package/moj/all.bundle.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* {@link https://github.com/ministryofjustice/moj-frontend/releases}
|
|
16
16
|
*/
|
|
17
|
-
const version = '5.
|
|
17
|
+
const version = '5.2.0';
|
|
18
18
|
|
|
19
19
|
class AddAnother extends govukFrontend.Component {
|
|
20
20
|
/**
|
|
@@ -801,7 +801,9 @@
|
|
|
801
801
|
event.stopPropagation();
|
|
802
802
|
}
|
|
803
803
|
});
|
|
804
|
-
document.body.addEventListener('mouseup', event =>
|
|
804
|
+
document.body.addEventListener('mouseup', event => {
|
|
805
|
+
this.backgroundClick(event);
|
|
806
|
+
});
|
|
805
807
|
|
|
806
808
|
// populates calendar with initial dates, avoids Wave errors about null buttons
|
|
807
809
|
this.updateCalendar();
|
|
@@ -827,9 +829,10 @@
|
|
|
827
829
|
for (let j = 0; j < 7; j++) {
|
|
828
830
|
// create cell (day)
|
|
829
831
|
const $cell = document.createElement('td');
|
|
832
|
+
$row.appendChild($cell);
|
|
830
833
|
const $dateButton = document.createElement('button');
|
|
834
|
+
$dateButton.setAttribute('type', 'button');
|
|
831
835
|
$cell.appendChild($dateButton);
|
|
832
|
-
$row.appendChild($cell);
|
|
833
836
|
const calendarDay = new DSCalendarDay($dateButton, dayCount, i, j, this);
|
|
834
837
|
this.calendarDays.push(calendarDay);
|
|
835
838
|
dayCount++;
|
|
@@ -861,7 +864,7 @@
|
|
|
861
864
|
dialogTemplate(titleId) {
|
|
862
865
|
return `<div class="moj-datepicker__dialog-header">
|
|
863
866
|
<div class="moj-datepicker__dialog-navbuttons">
|
|
864
|
-
<button class="moj-datepicker__button moj-js-datepicker-prev-year">
|
|
867
|
+
<button type="button" class="moj-datepicker__button moj-js-datepicker-prev-year">
|
|
865
868
|
<span class="govuk-visually-hidden">Previous year</span>
|
|
866
869
|
<svg width="44" height="40" viewBox="0 0 44 40" fill="none" fill="none" focusable="false" aria-hidden="true" role="img">
|
|
867
870
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.1643 20L28.9572 14.2071L27.5429 12.7929L20.3358 20L27.5429 27.2071L28.9572 25.7929L23.1643 20Z" fill="currentColor"/>
|
|
@@ -869,7 +872,7 @@
|
|
|
869
872
|
</svg>
|
|
870
873
|
</button>
|
|
871
874
|
|
|
872
|
-
<button class="moj-datepicker__button moj-js-datepicker-prev-month">
|
|
875
|
+
<button type="button" class="moj-datepicker__button moj-js-datepicker-prev-month">
|
|
873
876
|
<span class="govuk-visually-hidden">Previous month</span>
|
|
874
877
|
<svg width="44" height="40" viewBox="0 0 44 40" fill="none" focusable="false" aria-hidden="true" role="img">
|
|
875
878
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.5729 20L25.7865 14.2071L24.5137 12.7929L18.0273 20L24.5137 27.2071L25.7865 25.7929L20.5729 20Z" fill="currentColor"/>
|
|
@@ -880,14 +883,14 @@
|
|
|
880
883
|
<h2 id="${titleId}" class="moj-datepicker__dialog-title moj-js-datepicker-month-year" aria-live="polite">June 2020</h2>
|
|
881
884
|
|
|
882
885
|
<div class="moj-datepicker__dialog-navbuttons">
|
|
883
|
-
<button class="moj-datepicker__button moj-js-datepicker-next-month">
|
|
886
|
+
<button type="button" class="moj-datepicker__button moj-js-datepicker-next-month">
|
|
884
887
|
<span class="govuk-visually-hidden">Next month</span>
|
|
885
888
|
<svg width="44" height="40" viewBox="0 0 44 40" fill="none" focusable="false" aria-hidden="true" role="img">
|
|
886
889
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M23.4271 20L18.2135 14.2071L19.4863 12.7929L25.9727 20L19.4863 27.2071L18.2135 25.7929L23.4271 20Z" fill="currentColor"/>
|
|
887
890
|
</svg>
|
|
888
891
|
</button>
|
|
889
892
|
|
|
890
|
-
<button class="moj-datepicker__button moj-js-datepicker-next-year">
|
|
893
|
+
<button type="button" class="moj-datepicker__button moj-js-datepicker-next-year">
|
|
891
894
|
<span class="govuk-visually-hidden">Next year</span>
|
|
892
895
|
<svg width="44" height="40" viewBox="0 0 44 40" fill="none" fill="none" focusable="false" aria-hidden="true" role="img">
|
|
893
896
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.8357 20L15.0428 14.2071L16.4571 12.7929L23.6642 20L16.4571 27.2071L15.0428 25.7929L20.8357 20Z" fill="currentColor"/>
|
|
@@ -1509,6 +1512,71 @@
|
|
|
1509
1512
|
* @import { Schema } from 'govuk-frontend/dist/govuk/common/configuration.mjs'
|
|
1510
1513
|
*/
|
|
1511
1514
|
|
|
1515
|
+
class PdsHeader extends govukFrontend.Component {
|
|
1516
|
+
/**
|
|
1517
|
+
* @param {Element | null} $root - HTML element to use for PDS header
|
|
1518
|
+
*/
|
|
1519
|
+
constructor($root) {
|
|
1520
|
+
super($root);
|
|
1521
|
+
this.initHeader();
|
|
1522
|
+
}
|
|
1523
|
+
initHeader() {
|
|
1524
|
+
this.$tabOpenClass = 'probation-common-header__toggle-open';
|
|
1525
|
+
const $userToggle = this.$root.querySelector('.probation-common-header__user-menu-toggle');
|
|
1526
|
+
const $userMenu = this.$root.querySelector('#probation-common-header-user-menu');
|
|
1527
|
+
if (!$userToggle || !$userMenu || !($userToggle instanceof HTMLElement) || !($userMenu instanceof HTMLElement)) {
|
|
1528
|
+
return 0;
|
|
1529
|
+
}
|
|
1530
|
+
this.hideFallbackLinks();
|
|
1531
|
+
$userToggle.removeAttribute('hidden');
|
|
1532
|
+
this.closeTabs([[$userToggle, $userMenu]]);
|
|
1533
|
+
$userToggle.addEventListener('click', _event => {
|
|
1534
|
+
this.toggleMenu($userToggle, $userMenu);
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* @param {[any, any][]} tabTuples
|
|
1540
|
+
*/
|
|
1541
|
+
closeTabs(tabTuples) {
|
|
1542
|
+
tabTuples.forEach(([toggle, menu]) => {
|
|
1543
|
+
if (menu && toggle) {
|
|
1544
|
+
menu.setAttribute('hidden', 'hidden');
|
|
1545
|
+
toggle.classList.remove(this.$tabOpenClass);
|
|
1546
|
+
toggle.parentElement.classList.remove('item-open');
|
|
1547
|
+
toggle.setAttribute('aria-expanded', 'false');
|
|
1548
|
+
if (toggle.dataset.textForShow) toggle.setAttribute('aria-label', toggle.dataset.textForShow);
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* @param {HTMLElement} toggle
|
|
1555
|
+
* @param {HTMLElement} menu
|
|
1556
|
+
*/
|
|
1557
|
+
toggleMenu(toggle, menu) {
|
|
1558
|
+
const isOpen = !menu.getAttribute('hidden');
|
|
1559
|
+
if (isOpen) {
|
|
1560
|
+
this.closeTabs([[toggle, menu]]);
|
|
1561
|
+
} else if (menu && toggle) {
|
|
1562
|
+
menu.removeAttribute('hidden');
|
|
1563
|
+
toggle.classList.add(this.$tabOpenClass);
|
|
1564
|
+
toggle.parentElement.classList.add('item-open');
|
|
1565
|
+
toggle.setAttribute('aria-expanded', 'true');
|
|
1566
|
+
if (toggle.dataset.textForHide) toggle.setAttribute('aria-label', toggle.dataset.textForHide);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
hideFallbackLinks() {
|
|
1570
|
+
const $userLink = this.$root.querySelector('.probation-common-header__user-menu-link');
|
|
1571
|
+
if ($userLink) $userLink.setAttribute('hidden', 'hidden');
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Name for the component used when initialising using data-module attributes.
|
|
1576
|
+
*/
|
|
1577
|
+
}
|
|
1578
|
+
PdsHeader.moduleName = 'pds-header';
|
|
1579
|
+
|
|
1512
1580
|
/**
|
|
1513
1581
|
* @augments {ConfigurableComponent<FilterToggleButtonConfig>}
|
|
1514
1582
|
*/
|
|
@@ -2820,10 +2888,10 @@
|
|
|
2820
2888
|
this.$upArrow = `<svg width="22" height="22" focusable="false" aria-hidden="true" role="img" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2821
2889
|
<path d="M6.5625 15.5L11 6.63125L15.4375 15.5H6.5625Z" fill="currentColor"/>
|
|
2822
2890
|
</svg>`;
|
|
2823
|
-
this.$downArrow = `<svg width="22" height="22" focusable="false" aria-hidden="true" role="img"
|
|
2891
|
+
this.$downArrow = `<svg width="22" height="22" focusable="false" aria-hidden="true" role="img" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2824
2892
|
<path d="M15.4375 7L11 15.8687L6.5625 7L15.4375 7Z" fill="currentColor"/>
|
|
2825
2893
|
</svg>`;
|
|
2826
|
-
this.$upDownArrow = `<svg width="22" height="22" focusable="false" aria-hidden="true" role="img"
|
|
2894
|
+
this.$upDownArrow = `<svg width="22" height="22" focusable="false" aria-hidden="true" role="img" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2827
2895
|
<path d="M8.1875 9.5L10.9609 3.95703L13.7344 9.5H8.1875Z" fill="currentColor"/>
|
|
2828
2896
|
<path d="M13.7344 12.0781L10.9609 17.6211L8.1875 12.0781H13.7344Z" fill="currentColor"/>
|
|
2829
2897
|
</svg>`;
|
|
@@ -3044,7 +3112,7 @@
|
|
|
3044
3112
|
* @param {Config} [config]
|
|
3045
3113
|
*/
|
|
3046
3114
|
function initAll(config) {
|
|
3047
|
-
for (const Component of [AddAnother, Alert, ButtonMenu, DatePicker, MultiSelect, PasswordReveal, RichTextEditor, SearchToggle, SortableTable]) {
|
|
3115
|
+
for (const Component of [AddAnother, Alert, ButtonMenu, DatePicker, MultiSelect, PasswordReveal, RichTextEditor, SearchToggle, SortableTable, PdsHeader]) {
|
|
3048
3116
|
govukFrontend.createAll(Component, undefined, config);
|
|
3049
3117
|
}
|
|
3050
3118
|
}
|
|
@@ -3066,6 +3134,7 @@
|
|
|
3066
3134
|
exports.MultiFileUpload = MultiFileUpload;
|
|
3067
3135
|
exports.MultiSelect = MultiSelect;
|
|
3068
3136
|
exports.PasswordReveal = PasswordReveal;
|
|
3137
|
+
exports.PdsHeader = PdsHeader;
|
|
3069
3138
|
exports.RichTextEditor = RichTextEditor;
|
|
3070
3139
|
exports.SearchToggle = SearchToggle;
|
|
3071
3140
|
exports.SortableTable = SortableTable;
|