@ministryofjustice/frontend 4.0.0 → 5.0.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/govuk-prototype-kit.config.json +19 -4
- package/moj/_base.scss +2 -0
- package/moj/_base.scss.map +1 -0
- package/moj/all.bundle.js +2523 -0
- package/moj/all.bundle.js.map +1 -0
- package/moj/all.bundle.mjs +2502 -0
- package/moj/all.bundle.mjs.map +1 -0
- package/moj/all.mjs +59 -69
- package/moj/all.mjs.map +1 -1
- package/moj/all.scss +2 -0
- package/moj/all.scss.map +1 -0
- package/moj/components/_all.scss +2 -0
- package/moj/components/_all.scss.map +1 -0
- package/moj/components/action-bar/_action-bar.scss +2 -0
- package/moj/components/action-bar/_action-bar.scss.map +1 -0
- package/moj/components/add-another/_add-another.scss +2 -0
- package/moj/components/add-another/_add-another.scss.map +1 -0
- package/moj/components/add-another/add-another.bundle.js +128 -0
- package/moj/components/add-another/add-another.bundle.js.map +1 -0
- package/moj/components/add-another/add-another.bundle.mjs +120 -0
- package/moj/components/add-another/add-another.bundle.mjs.map +1 -0
- package/moj/components/add-another/add-another.mjs +112 -99
- package/moj/components/add-another/add-another.mjs.map +1 -1
- package/moj/components/alert/_alert.scss +4 -0
- package/moj/components/alert/_alert.scss.map +1 -0
- package/moj/components/alert/alert.bundle.js +330 -0
- package/moj/components/alert/alert.bundle.js.map +1 -0
- package/moj/components/alert/alert.bundle.mjs +322 -0
- package/moj/components/alert/alert.bundle.mjs.map +1 -0
- package/moj/components/alert/alert.mjs +181 -217
- package/moj/components/alert/alert.mjs.map +1 -1
- package/moj/components/alert/{alert.spec.helper.js → alert.spec.helper.bundle.js} +1 -1
- package/moj/components/alert/alert.spec.helper.bundle.js.map +1 -0
- package/moj/components/alert/alert.spec.helper.bundle.mjs +67 -0
- package/moj/components/alert/alert.spec.helper.bundle.mjs.map +1 -0
- package/moj/components/alert/alert.spec.helper.mjs.map +1 -1
- package/moj/components/badge/_badge.scss +2 -0
- package/moj/components/badge/_badge.scss.map +1 -0
- package/moj/components/banner/_banner.scss +2 -0
- package/moj/components/banner/_banner.scss.map +1 -0
- package/moj/components/button-menu/README.md +10 -6
- package/moj/components/button-menu/_button-menu.scss +10 -3
- package/moj/components/button-menu/_button-menu.scss.map +1 -0
- package/moj/components/button-menu/button-menu.bundle.js +299 -0
- package/moj/components/button-menu/button-menu.bundle.js.map +1 -0
- package/moj/components/button-menu/{button-menu.js → button-menu.bundle.mjs} +74 -121
- package/moj/components/button-menu/button-menu.bundle.mjs.map +1 -0
- package/moj/components/button-menu/button-menu.mjs +246 -285
- package/moj/components/button-menu/button-menu.mjs.map +1 -1
- package/moj/components/cookie-banner/_cookie-banner.scss +2 -0
- package/moj/components/cookie-banner/_cookie-banner.scss.map +1 -0
- package/moj/components/currency-input/_currency-input.scss +2 -0
- package/moj/components/currency-input/_currency-input.scss.map +1 -0
- package/moj/components/date-picker/_date-picker.scss +2 -0
- package/moj/components/date-picker/_date-picker.scss.map +1 -0
- package/moj/components/date-picker/date-picker.bundle.js +784 -0
- package/moj/components/date-picker/date-picker.bundle.js.map +1 -0
- package/moj/components/date-picker/{date-picker.js → date-picker.bundle.mjs} +245 -439
- package/moj/components/date-picker/date-picker.bundle.mjs.map +1 -0
- package/moj/components/date-picker/date-picker.mjs +654 -840
- package/moj/components/date-picker/date-picker.mjs.map +1 -1
- package/moj/components/filter/_filter.scss +2 -0
- package/moj/components/filter/_filter.scss.map +1 -0
- package/moj/components/filter-toggle-button/filter-toggle-button.bundle.js +96 -0
- package/moj/components/filter-toggle-button/filter-toggle-button.bundle.js.map +1 -0
- package/moj/components/filter-toggle-button/filter-toggle-button.bundle.mjs +88 -0
- package/moj/components/filter-toggle-button/filter-toggle-button.bundle.mjs.map +1 -0
- package/moj/components/filter-toggle-button/filter-toggle-button.mjs +78 -84
- package/moj/components/filter-toggle-button/filter-toggle-button.mjs.map +1 -1
- package/moj/components/form-validator/form-validator.bundle.js +198 -0
- package/moj/components/form-validator/form-validator.bundle.js.map +1 -0
- package/moj/components/form-validator/form-validator.bundle.mjs +190 -0
- package/moj/components/form-validator/form-validator.bundle.mjs.map +1 -0
- package/moj/components/form-validator/form-validator.mjs +149 -152
- package/moj/components/form-validator/form-validator.mjs.map +1 -1
- package/moj/components/header/_header.scss +2 -0
- package/moj/components/header/_header.scss.map +1 -0
- package/moj/components/identity-bar/_identity-bar.scss +2 -0
- package/moj/components/identity-bar/_identity-bar.scss.map +1 -0
- package/moj/components/interruption-card/_interruption-card.scss +2 -0
- package/moj/components/interruption-card/_interruption-card.scss.map +1 -0
- package/moj/components/messages/_messages.scss +2 -0
- package/moj/components/messages/_messages.scss.map +1 -0
- package/moj/components/multi-file-upload/_multi-file-upload.scss +2 -0
- package/moj/components/multi-file-upload/_multi-file-upload.scss.map +1 -0
- package/moj/components/multi-file-upload/multi-file-upload.bundle.js +223 -0
- package/moj/components/multi-file-upload/multi-file-upload.bundle.js.map +1 -0
- package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs +215 -0
- package/moj/components/multi-file-upload/multi-file-upload.bundle.mjs.map +1 -0
- package/moj/components/multi-file-upload/multi-file-upload.mjs +193 -209
- package/moj/components/multi-file-upload/multi-file-upload.mjs.map +1 -1
- package/moj/components/multi-select/_multi-select.scss +2 -0
- package/moj/components/multi-select/_multi-select.scss.map +1 -0
- package/moj/components/multi-select/multi-select.bundle.js +78 -0
- package/moj/components/multi-select/multi-select.bundle.js.map +1 -0
- package/moj/components/multi-select/multi-select.bundle.mjs +70 -0
- package/moj/components/multi-select/multi-select.bundle.mjs.map +1 -0
- package/moj/components/multi-select/multi-select.mjs +59 -67
- package/moj/components/multi-select/multi-select.mjs.map +1 -1
- package/moj/components/notification-badge/_notification-badge.scss +2 -0
- package/moj/components/notification-badge/_notification-badge.scss.map +1 -0
- package/moj/components/organisation-switcher/_organisation-switcher.scss +2 -0
- package/moj/components/organisation-switcher/_organisation-switcher.scss.map +1 -0
- package/moj/components/page-header-actions/_page-header-actions.scss +2 -0
- package/moj/components/page-header-actions/_page-header-actions.scss.map +1 -0
- package/moj/components/page-header-actions/template.njk +1 -1
- package/moj/components/pagination/_pagination.scss +2 -2
- package/moj/components/pagination/_pagination.scss.map +1 -0
- package/moj/components/password-reveal/_password-reveal.scss +2 -0
- package/moj/components/password-reveal/_password-reveal.scss.map +1 -0
- package/moj/components/password-reveal/password-reveal.bundle.js +49 -0
- package/moj/components/password-reveal/password-reveal.bundle.js.map +1 -0
- package/moj/components/password-reveal/password-reveal.bundle.mjs +41 -0
- package/moj/components/password-reveal/password-reveal.bundle.mjs.map +1 -0
- package/moj/components/password-reveal/password-reveal.mjs +36 -31
- package/moj/components/password-reveal/password-reveal.mjs.map +1 -1
- package/moj/components/primary-navigation/_primary-navigation.scss +2 -0
- package/moj/components/primary-navigation/_primary-navigation.scss.map +1 -0
- package/moj/components/progress-bar/_progress-bar.scss +2 -0
- package/moj/components/progress-bar/_progress-bar.scss.map +1 -0
- package/moj/components/rich-text-editor/README.md +15 -9
- package/moj/components/rich-text-editor/_rich-text-editor.scss +2 -0
- package/moj/components/rich-text-editor/_rich-text-editor.scss.map +1 -0
- package/moj/components/rich-text-editor/rich-text-editor.bundle.js +145 -0
- package/moj/components/rich-text-editor/rich-text-editor.bundle.js.map +1 -0
- package/moj/components/rich-text-editor/rich-text-editor.bundle.mjs +137 -0
- package/moj/components/rich-text-editor/rich-text-editor.bundle.mjs.map +1 -0
- package/moj/components/rich-text-editor/rich-text-editor.mjs +124 -145
- package/moj/components/rich-text-editor/rich-text-editor.mjs.map +1 -1
- package/moj/components/search/_search.scss +2 -0
- package/moj/components/search/_search.scss.map +1 -0
- package/moj/components/search-toggle/{search-toggle.scss → _search-toggle.scss} +2 -0
- package/moj/components/search-toggle/_search-toggle.scss.map +1 -0
- package/moj/components/search-toggle/search-toggle.bundle.js +54 -0
- package/moj/components/search-toggle/search-toggle.bundle.js.map +1 -0
- package/moj/components/search-toggle/search-toggle.bundle.mjs +46 -0
- package/moj/components/search-toggle/search-toggle.bundle.mjs.map +1 -0
- package/moj/components/search-toggle/search-toggle.mjs +40 -49
- package/moj/components/search-toggle/search-toggle.mjs.map +1 -1
- package/moj/components/side-navigation/_side-navigation.scss +2 -0
- package/moj/components/side-navigation/_side-navigation.scss.map +1 -0
- package/moj/components/sortable-table/_sortable-table.scss +2 -2
- package/moj/components/sortable-table/_sortable-table.scss.map +1 -0
- package/moj/components/sortable-table/sortable-table.bundle.js +134 -0
- package/moj/components/sortable-table/sortable-table.bundle.js.map +1 -0
- package/moj/components/sortable-table/sortable-table.bundle.mjs +126 -0
- package/moj/components/sortable-table/sortable-table.bundle.mjs.map +1 -0
- package/moj/components/sortable-table/sortable-table.mjs +117 -130
- package/moj/components/sortable-table/sortable-table.mjs.map +1 -1
- package/moj/components/sub-navigation/_sub-navigation.scss +2 -0
- package/moj/components/sub-navigation/_sub-navigation.scss.map +1 -0
- package/moj/components/tag/_tag.scss +2 -0
- package/moj/components/tag/_tag.scss.map +1 -0
- package/moj/components/task-list/_task-list.scss +2 -0
- package/moj/components/task-list/_task-list.scss.map +1 -0
- package/moj/components/ticket-panel/_ticket-panel.scss +2 -0
- package/moj/components/ticket-panel/_ticket-panel.scss.map +1 -0
- package/moj/components/timeline/_timeline.scss +2 -0
- package/moj/components/timeline/_timeline.scss.map +1 -0
- package/moj/filters/all.js +44 -22
- package/moj/helpers/_all.scss +2 -0
- package/moj/helpers/_all.scss.map +1 -0
- package/moj/helpers/_hidden.scss +2 -0
- package/moj/helpers/_hidden.scss.map +1 -0
- package/moj/helpers/_links.scss +2 -0
- package/moj/helpers/_links.scss.map +1 -0
- package/moj/{helpers.js → helpers.bundle.js} +37 -42
- package/moj/helpers.bundle.js.map +1 -0
- package/moj/helpers.bundle.mjs +179 -0
- package/moj/helpers.bundle.mjs.map +1 -0
- package/moj/helpers.mjs +52 -28
- package/moj/helpers.mjs.map +1 -1
- package/moj/init.js +11 -2
- 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/moj/objects/_all.scss +2 -0
- package/moj/objects/_all.scss.map +1 -0
- package/moj/objects/_button-group.scss +17 -1
- package/moj/objects/_button-group.scss.map +1 -0
- package/moj/objects/_filter-layout.scss +2 -0
- package/moj/objects/_filter-layout.scss.map +1 -0
- package/moj/objects/_scrollable-pane.scss +2 -0
- package/moj/objects/_scrollable-pane.scss.map +1 -0
- package/moj/objects/_width-container.scss +2 -0
- package/moj/objects/_width-container.scss.map +1 -0
- package/moj/settings/_all.scss +2 -0
- package/moj/settings/_all.scss.map +1 -0
- package/moj/settings/_assets.scss +2 -0
- package/moj/settings/_assets.scss.map +1 -0
- package/moj/settings/_colours.scss +2 -0
- package/moj/settings/_colours.scss.map +1 -0
- package/moj/settings/_measurements.scss +2 -0
- package/moj/settings/_measurements.scss.map +1 -0
- package/moj/settings/_typography.scss +2 -0
- package/moj/settings/_typography.scss.map +1 -0
- package/moj/template.njk +13 -0
- package/moj/utilities/_all.scss +2 -0
- package/moj/utilities/_all.scss.map +1 -0
- package/moj/utilities/_hidden.scss +2 -0
- package/moj/utilities/_hidden.scss.map +1 -0
- package/moj/utilities/_width-container.scss +2 -0
- package/moj/utilities/_width-container.scss.map +1 -0
- package/moj/vendor/govuk-frontend/_base.scss +2 -0
- package/moj/vendor/govuk-frontend/_base.scss.map +1 -0
- package/moj/vendor/govuk-frontend/_index.scss +2 -0
- package/moj/vendor/govuk-frontend/_index.scss.map +1 -0
- package/moj/{version.js → version.bundle.js} +1 -1
- package/moj/version.bundle.js.map +1 -0
- package/moj/version.bundle.mjs +4 -0
- package/moj/version.bundle.mjs.map +1 -0
- package/moj/version.mjs.map +1 -1
- package/package.json +5 -6
- package/moj/all.jquery.min.js +0 -1
- package/moj/all.jquery.min.js.map +0 -1
- package/moj/all.js +0 -2662
- package/moj/all.js.map +0 -1
- package/moj/components/add-another/add-another.js +0 -115
- package/moj/components/add-another/add-another.js.map +0 -1
- package/moj/components/alert/alert.js +0 -356
- package/moj/components/alert/alert.js.map +0 -1
- package/moj/components/alert/alert.spec.helper.js.map +0 -1
- package/moj/components/button-menu/button-menu.js.map +0 -1
- package/moj/components/date-picker/date-picker.js.map +0 -1
- package/moj/components/filter-toggle-button/filter-toggle-button.js +0 -102
- package/moj/components/filter-toggle-button/filter-toggle-button.js.map +0 -1
- package/moj/components/form-validator/form-validator.js +0 -205
- package/moj/components/form-validator/form-validator.js.map +0 -1
- package/moj/components/multi-file-upload/multi-file-upload.js +0 -241
- package/moj/components/multi-file-upload/multi-file-upload.js.map +0 -1
- package/moj/components/multi-select/multi-select.js +0 -86
- package/moj/components/multi-select/multi-select.js.map +0 -1
- package/moj/components/password-reveal/password-reveal.js +0 -44
- package/moj/components/password-reveal/password-reveal.js.map +0 -1
- package/moj/components/rich-text-editor/rich-text-editor.js +0 -166
- package/moj/components/rich-text-editor/rich-text-editor.js.map +0 -1
- package/moj/components/search-toggle/search-toggle.js +0 -63
- package/moj/components/search-toggle/search-toggle.js.map +0 -1
- package/moj/components/sortable-table/sortable-table.js +0 -147
- package/moj/components/sortable-table/sortable-table.js.map +0 -1
- package/moj/helpers.js.map +0 -1
- package/moj/vendor/html5shiv.js +0 -326
- package/moj/vendor/jquery.js +0 -9300
- package/moj/version.js.map +0 -1
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MOJFrontend = global.MOJFrontend || {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function FilterToggleButton(options) {
|
|
8
|
-
this.options = options;
|
|
9
|
-
this.container = $(this.options.toggleButton.container);
|
|
10
|
-
this.filterContainer = $(this.options.filter.container);
|
|
11
|
-
|
|
12
|
-
this.createToggleButton();
|
|
13
|
-
this.setupResponsiveChecks();
|
|
14
|
-
this.filterContainer.attr('tabindex', '-1');
|
|
15
|
-
if (this.options.startHidden) {
|
|
16
|
-
this.hideMenu();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
FilterToggleButton.prototype.setupResponsiveChecks = function () {
|
|
21
|
-
this.mq = window.matchMedia(this.options.bigModeMediaQuery);
|
|
22
|
-
this.mq.addListener($.proxy(this, 'checkMode'));
|
|
23
|
-
this.checkMode(this.mq);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
FilterToggleButton.prototype.createToggleButton = function () {
|
|
27
|
-
this.menuButton = $(
|
|
28
|
-
`<button class="govuk-button ${this.options.toggleButton.classes}" type="button" aria-haspopup="true" aria-expanded="false">${this.options.toggleButton.showText}</button>`
|
|
29
|
-
);
|
|
30
|
-
this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
|
|
31
|
-
this.container.append(this.menuButton);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
FilterToggleButton.prototype.checkMode = function (mq) {
|
|
35
|
-
if (mq.matches) {
|
|
36
|
-
this.enableBigMode();
|
|
37
|
-
} else {
|
|
38
|
-
this.enableSmallMode();
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
FilterToggleButton.prototype.enableBigMode = function () {
|
|
43
|
-
this.showMenu();
|
|
44
|
-
this.removeCloseButton();
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
FilterToggleButton.prototype.enableSmallMode = function () {
|
|
48
|
-
this.hideMenu();
|
|
49
|
-
this.addCloseButton();
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
FilterToggleButton.prototype.addCloseButton = function () {
|
|
53
|
-
if (this.options.closeButton) {
|
|
54
|
-
this.closeButton = $(
|
|
55
|
-
`<button class="moj-filter__close" type="button">${this.options.closeButton.text}</button>`
|
|
56
|
-
);
|
|
57
|
-
this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
|
|
58
|
-
$(this.options.closeButton.container).append(this.closeButton);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
FilterToggleButton.prototype.onCloseClick = function () {
|
|
63
|
-
this.hideMenu();
|
|
64
|
-
this.menuButton.focus();
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
FilterToggleButton.prototype.removeCloseButton = function () {
|
|
68
|
-
if (this.closeButton) {
|
|
69
|
-
this.closeButton.remove();
|
|
70
|
-
this.closeButton = null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
FilterToggleButton.prototype.hideMenu = function () {
|
|
75
|
-
this.menuButton.attr('aria-expanded', 'false');
|
|
76
|
-
this.filterContainer.addClass('moj-js-hidden');
|
|
77
|
-
this.menuButton.text(this.options.toggleButton.showText);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
FilterToggleButton.prototype.showMenu = function () {
|
|
81
|
-
this.menuButton.attr('aria-expanded', 'true');
|
|
82
|
-
this.filterContainer.removeClass('moj-js-hidden');
|
|
83
|
-
this.menuButton.text(this.options.toggleButton.hideText);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
FilterToggleButton.prototype.onMenuButtonClick = function () {
|
|
87
|
-
this.toggle();
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
FilterToggleButton.prototype.toggle = function () {
|
|
91
|
-
if (this.menuButton.attr('aria-expanded') === 'false') {
|
|
92
|
-
this.showMenu();
|
|
93
|
-
this.filterContainer.get(0).focus();
|
|
94
|
-
} else {
|
|
95
|
-
this.hideMenu();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
exports.FilterToggleButton = FilterToggleButton;
|
|
100
|
-
|
|
101
|
-
}));
|
|
102
|
-
//# sourceMappingURL=filter-toggle-button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter-toggle-button.js","sources":["../../../../src/moj/components/filter-toggle-button/filter-toggle-button.mjs"],"sourcesContent":["import $ from 'jquery'\n\nexport function FilterToggleButton(options) {\n this.options = options\n this.container = $(this.options.toggleButton.container)\n this.filterContainer = $(this.options.filter.container)\n\n this.createToggleButton()\n this.setupResponsiveChecks()\n this.filterContainer.attr('tabindex', '-1')\n if (this.options.startHidden) {\n this.hideMenu()\n }\n}\n\nFilterToggleButton.prototype.setupResponsiveChecks = function () {\n this.mq = window.matchMedia(this.options.bigModeMediaQuery)\n this.mq.addListener($.proxy(this, 'checkMode'))\n this.checkMode(this.mq)\n}\n\nFilterToggleButton.prototype.createToggleButton = function () {\n this.menuButton = $(\n `<button class=\"govuk-button ${this.options.toggleButton.classes}\" type=\"button\" aria-haspopup=\"true\" aria-expanded=\"false\">${this.options.toggleButton.showText}</button>`\n )\n this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'))\n this.container.append(this.menuButton)\n}\n\nFilterToggleButton.prototype.checkMode = function (mq) {\n if (mq.matches) {\n this.enableBigMode()\n } else {\n this.enableSmallMode()\n }\n}\n\nFilterToggleButton.prototype.enableBigMode = function () {\n this.showMenu()\n this.removeCloseButton()\n}\n\nFilterToggleButton.prototype.enableSmallMode = function () {\n this.hideMenu()\n this.addCloseButton()\n}\n\nFilterToggleButton.prototype.addCloseButton = function () {\n if (this.options.closeButton) {\n this.closeButton = $(\n `<button class=\"moj-filter__close\" type=\"button\">${this.options.closeButton.text}</button>`\n )\n this.closeButton.on('click', $.proxy(this, 'onCloseClick'))\n $(this.options.closeButton.container).append(this.closeButton)\n }\n}\n\nFilterToggleButton.prototype.onCloseClick = function () {\n this.hideMenu()\n this.menuButton.focus()\n}\n\nFilterToggleButton.prototype.removeCloseButton = function () {\n if (this.closeButton) {\n this.closeButton.remove()\n this.closeButton = null\n }\n}\n\nFilterToggleButton.prototype.hideMenu = function () {\n this.menuButton.attr('aria-expanded', 'false')\n this.filterContainer.addClass('moj-js-hidden')\n this.menuButton.text(this.options.toggleButton.showText)\n}\n\nFilterToggleButton.prototype.showMenu = function () {\n this.menuButton.attr('aria-expanded', 'true')\n this.filterContainer.removeClass('moj-js-hidden')\n this.menuButton.text(this.options.toggleButton.hideText)\n}\n\nFilterToggleButton.prototype.onMenuButtonClick = function () {\n this.toggle()\n}\n\nFilterToggleButton.prototype.toggle = function () {\n if (this.menuButton.attr('aria-expanded') === 'false') {\n this.showMenu()\n this.filterContainer.get(0).focus()\n } else {\n this.hideMenu()\n }\n}\n"],"names":[],"mappings":";;;;;;EAEA,SAAA,kBAAA,CAAA,OAAA,EAAA;EACA,EAAA,IAAA,CAAA,OAAA,GAAA;EACA,EAAA,IAAA,CAAA,SAAA,GAAA,CAAA,CAAA,IAAA,CAAA,OAAA,CAAA,YAAA,CAAA,SAAA;EACA,EAAA,IAAA,CAAA,eAAA,GAAA,CAAA,CAAA,IAAA,CAAA,OAAA,CAAA,MAAA,CAAA,SAAA;;EAEA,EAAA,IAAA,CAAA,kBAAA;EACA,EAAA,IAAA,CAAA,qBAAA;EACA,EAAA,IAAA,CAAA,eAAA,CAAA,IAAA,CAAA,UAAA,EAAA,IAAA;EACA,EAAA,IAAA,IAAA,CAAA,OAAA,CAAA,WAAA,EAAA;EACA,IAAA,IAAA,CAAA,QAAA;EACA;EACA;;EAEA,kBAAA,CAAA,SAAA,CAAA,qBAAA,GAAA,YAAA;EACA,EAAA,IAAA,CAAA,EAAA,GAAA,MAAA,CAAA,UAAA,CAAA,IAAA,CAAA,OAAA,CAAA,iBAAA;EACA,EAAA,IAAA,CAAA,EAAA,CAAA,WAAA,CAAA,CAAA,CAAA,KAAA,CAAA,IAAA,EAAA,WAAA,CAAA;EACA,EAAA,IAAA,CAAA,SAAA,CAAA,IAAA,CAAA,EAAA;EACA;;EAEA,kBAAA,CAAA,SAAA,CAAA,kBAAA,GAAA,YAAA;EACA,EAAA,IAAA,CAAA,UAAA,GAAA,CAAA;EACA,IAAA,CAAA,4BAAA,EAAA,IAAA,CAAA,OAAA,CAAA,YAAA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
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MOJFrontend = global.MOJFrontend || {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function removeAttributeValue(el, attr, value) {
|
|
8
|
-
let re, m;
|
|
9
|
-
if (el.getAttribute(attr)) {
|
|
10
|
-
if (el.getAttribute(attr) === value) {
|
|
11
|
-
el.removeAttribute(attr);
|
|
12
|
-
} else {
|
|
13
|
-
re = new RegExp(`(^|\\s)${value}(\\s|$)`);
|
|
14
|
-
m = el.getAttribute(attr).match(re);
|
|
15
|
-
if (m && m.length === 3) {
|
|
16
|
-
el.setAttribute(
|
|
17
|
-
attr,
|
|
18
|
-
el.getAttribute(attr).replace(re, m[1] && m[2] ? ' ' : '')
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function addAttributeValue(el, attr, value) {
|
|
26
|
-
let re;
|
|
27
|
-
if (!el.getAttribute(attr)) {
|
|
28
|
-
el.setAttribute(attr, value);
|
|
29
|
-
} else {
|
|
30
|
-
re = new RegExp(`(^|\\s)${value}(\\s|$)`);
|
|
31
|
-
if (!re.test(el.getAttribute(attr))) {
|
|
32
|
-
el.setAttribute(attr, `${el.getAttribute(attr)} ${value}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function FormValidator(form, options) {
|
|
38
|
-
this.form = form;
|
|
39
|
-
this.errors = [];
|
|
40
|
-
this.validators = [];
|
|
41
|
-
$(this.form).on('submit', $.proxy(this, 'onSubmit'));
|
|
42
|
-
this.summary =
|
|
43
|
-
options && options.summary ? $(options.summary) : $('.govuk-error-summary');
|
|
44
|
-
this.originalTitle = document.title;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
FormValidator.entityMap = {
|
|
48
|
-
'&': '&',
|
|
49
|
-
'<': '<',
|
|
50
|
-
'>': '>',
|
|
51
|
-
'"': '"',
|
|
52
|
-
"'": ''',
|
|
53
|
-
'/': '/',
|
|
54
|
-
'`': '`',
|
|
55
|
-
'=': '='
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
FormValidator.prototype.escapeHtml = function (string) {
|
|
59
|
-
return String(string).replace(/[&<>"'`=/]/g, function fromEntityMap(s) {
|
|
60
|
-
return FormValidator.entityMap[s]
|
|
61
|
-
})
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
FormValidator.prototype.resetTitle = function () {
|
|
65
|
-
document.title = this.originalTitle;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
FormValidator.prototype.updateTitle = function () {
|
|
69
|
-
document.title = `${this.errors.length} errors - ${document.title}`;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
FormValidator.prototype.showSummary = function () {
|
|
73
|
-
this.summary.html(this.getSummaryHtml());
|
|
74
|
-
this.summary.removeClass('moj-hidden');
|
|
75
|
-
this.summary.attr('aria-labelledby', 'errorSummary-heading');
|
|
76
|
-
this.summary.focus();
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
FormValidator.prototype.getSummaryHtml = function () {
|
|
80
|
-
let html =
|
|
81
|
-
'<h2 id="error-summary-title" class="govuk-error-summary__title">There is a problem</h2>';
|
|
82
|
-
html += '<div class="govuk-error-summary__body">';
|
|
83
|
-
html += '<ul class="govuk-list govuk-error-summary__list">';
|
|
84
|
-
for (let i = 0, j = this.errors.length; i < j; i++) {
|
|
85
|
-
const error = this.errors[i];
|
|
86
|
-
html += '<li>';
|
|
87
|
-
html += `<a href="#${this.escapeHtml(error.fieldName)}">`;
|
|
88
|
-
html += this.escapeHtml(error.message);
|
|
89
|
-
html += '</a>';
|
|
90
|
-
html += '</li>';
|
|
91
|
-
}
|
|
92
|
-
html += '</ul>';
|
|
93
|
-
html += '</div>';
|
|
94
|
-
return html
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
FormValidator.prototype.hideSummary = function () {
|
|
98
|
-
this.summary.addClass('moj-hidden');
|
|
99
|
-
this.summary.removeAttr('aria-labelledby');
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
FormValidator.prototype.onSubmit = function (e) {
|
|
103
|
-
this.removeInlineErrors();
|
|
104
|
-
this.hideSummary();
|
|
105
|
-
this.resetTitle();
|
|
106
|
-
if (!this.validate()) {
|
|
107
|
-
e.preventDefault();
|
|
108
|
-
this.updateTitle();
|
|
109
|
-
this.showSummary();
|
|
110
|
-
this.showInlineErrors();
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
FormValidator.prototype.showInlineErrors = function () {
|
|
115
|
-
for (let i = 0, j = this.errors.length; i < j; i++) {
|
|
116
|
-
this.showInlineError(this.errors[i]);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
FormValidator.prototype.showInlineError = function (error) {
|
|
121
|
-
const errorSpanId = `${error.fieldName}-error`;
|
|
122
|
-
const errorSpan = `<span class="govuk-error-message" id="${
|
|
123
|
-
errorSpanId
|
|
124
|
-
}">${this.escapeHtml(error.message)}</span>`;
|
|
125
|
-
const control = $(`#${error.fieldName}`);
|
|
126
|
-
const fieldContainer = control.parents('.govuk-form-group');
|
|
127
|
-
const label = fieldContainer.find('label');
|
|
128
|
-
const legend = fieldContainer.find('legend');
|
|
129
|
-
const fieldset = fieldContainer.find('fieldset');
|
|
130
|
-
fieldContainer.addClass('govuk-form-group--error');
|
|
131
|
-
if (legend.length) {
|
|
132
|
-
legend.after(errorSpan);
|
|
133
|
-
fieldContainer.attr('aria-invalid', 'true');
|
|
134
|
-
addAttributeValue(fieldset[0], 'aria-describedby', errorSpanId);
|
|
135
|
-
} else {
|
|
136
|
-
label.after(errorSpan);
|
|
137
|
-
control.attr('aria-invalid', 'true');
|
|
138
|
-
addAttributeValue(control[0], 'aria-describedby', errorSpanId);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
FormValidator.prototype.removeInlineErrors = function () {
|
|
143
|
-
for (let i = 0; i < this.errors.length; i++) {
|
|
144
|
-
this.removeInlineError(this.errors[i]);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
FormValidator.prototype.removeInlineError = function (error) {
|
|
149
|
-
const control = $(`#${error.fieldName}`);
|
|
150
|
-
const fieldContainer = control.parents('.govuk-form-group');
|
|
151
|
-
fieldContainer.find('.govuk-error-message').remove();
|
|
152
|
-
fieldContainer.removeClass('govuk-form-group--error');
|
|
153
|
-
fieldContainer.find('[aria-invalid]').attr('aria-invalid', 'false');
|
|
154
|
-
const errorSpanId = `${error.fieldName}-error`;
|
|
155
|
-
removeAttributeValue(
|
|
156
|
-
fieldContainer.find('[aria-describedby]')[0],
|
|
157
|
-
'aria-describedby',
|
|
158
|
-
errorSpanId
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
FormValidator.prototype.addValidator = function (fieldName, rules) {
|
|
163
|
-
this.validators.push({
|
|
164
|
-
fieldName,
|
|
165
|
-
rules,
|
|
166
|
-
field: this.form.elements[fieldName]
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
FormValidator.prototype.validate = function () {
|
|
171
|
-
this.errors = [];
|
|
172
|
-
let validator = null;
|
|
173
|
-
let validatorReturnValue = true;
|
|
174
|
-
let i;
|
|
175
|
-
let j;
|
|
176
|
-
for (i = 0; i < this.validators.length; i++) {
|
|
177
|
-
validator = this.validators[i];
|
|
178
|
-
for (j = 0; j < validator.rules.length; j++) {
|
|
179
|
-
validatorReturnValue = validator.rules[j].method(
|
|
180
|
-
validator.field,
|
|
181
|
-
validator.rules[j].params
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
if (typeof validatorReturnValue === 'boolean' && !validatorReturnValue) {
|
|
185
|
-
this.errors.push({
|
|
186
|
-
fieldName: validator.fieldName,
|
|
187
|
-
message: validator.rules[j].message
|
|
188
|
-
});
|
|
189
|
-
break
|
|
190
|
-
} else if (typeof validatorReturnValue === 'string') {
|
|
191
|
-
this.errors.push({
|
|
192
|
-
fieldName: validatorReturnValue,
|
|
193
|
-
message: validator.rules[j].message
|
|
194
|
-
});
|
|
195
|
-
break
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return this.errors.length === 0
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
exports.FormValidator = FormValidator;
|
|
203
|
-
|
|
204
|
-
}));
|
|
205
|
-
//# sourceMappingURL=form-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-validator.js","sources":["../../../../src/moj/helpers.mjs","../../../../src/moj/components/form-validator/form-validator.mjs"],"sourcesContent":["export function removeAttributeValue(el, attr, value) {\n let re, m\n if (el.getAttribute(attr)) {\n if (el.getAttribute(attr) === value) {\n el.removeAttribute(attr)\n } else {\n re = new RegExp(`(^|\\\\s)${value}(\\\\s|$)`)\n m = el.getAttribute(attr).match(re)\n if (m && m.length === 3) {\n el.setAttribute(\n attr,\n el.getAttribute(attr).replace(re, m[1] && m[2] ? ' ' : '')\n )\n }\n }\n }\n}\n\nexport function addAttributeValue(el, attr, value) {\n let re\n if (!el.getAttribute(attr)) {\n el.setAttribute(attr, value)\n } else {\n re = new RegExp(`(^|\\\\s)${value}(\\\\s|$)`)\n if (!re.test(el.getAttribute(attr))) {\n el.setAttribute(attr, `${el.getAttribute(attr)} ${value}`)\n }\n }\n}\n\nexport function dragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n}\n\nexport function formDataSupported() {\n return typeof FormData === 'function'\n}\n\nexport function fileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n}\n\nexport function nodeListForEach(nodes, callback) {\n if (window.NodeList.prototype.forEach) {\n return nodes.forEach(callback)\n }\n for (let i = 0; i < nodes.length; i++) {\n callback.call(window, nodes[i], i, nodes)\n }\n}\n\n/**\n * Find an elements next sibling\n *\n * Utility function to find an elements next sibling matching the provided\n * selector.\n *\n * @param {HTMLElement} $element - Element to find siblings for\n * @param {string} selector - selector for required sibling\n */\nexport function getNextSibling($element, selector) {\n if (!$element) return\n // Get the next sibling element\n let $sibling = $element.nextElementSibling\n\n // If there's no selector, return the first sibling\n if (!selector) return $sibling\n\n // If the sibling matches our selector, use it\n // If not, jump to the next sibling and continue the loop\n while ($sibling) {\n if ($sibling.matches(selector)) return $sibling\n $sibling = $sibling.nextElementSibling\n }\n}\n\n/**\n * Find an elements preceding sibling\n *\n * Utility function to find an elements previous sibling matching the provided\n * selector.\n *\n * @param {HTMLElement} $element - Element to find siblings for\n * @param {string} selector - selector for required sibling\n */\nexport function getPreviousSibling($element, selector) {\n if (!$element) return\n // Get the previous sibling element\n let $sibling = $element.previousElementSibling\n\n // If there's no selector, return the first sibling\n if (!selector) return $sibling\n\n // If the sibling matches our selector, use it\n // If not, jump to the next sibling and continue the loop\n while ($sibling) {\n if ($sibling.matches(selector)) return $sibling\n $sibling = $sibling.previousElementSibling\n }\n}\n\nexport function findNearestMatchingElement($element, selector) {\n // If no element or selector is provided, return null\n if (!$element) return\n if (!selector) return\n\n // Start with the current element\n let $currentElement = $element\n\n while ($currentElement) {\n // First check the current element\n if ($currentElement.matches(selector)) {\n return $currentElement\n }\n\n // Check all previous siblings\n let $sibling = $currentElement.previousElementSibling\n while ($sibling) {\n // Check if the sibling itself is a heading\n if ($sibling.matches(selector)) {\n return $sibling\n }\n $sibling = $sibling.previousElementSibling\n }\n\n // If no match found in siblings, move up to parent\n $currentElement = $currentElement.parentElement\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @param {HTMLElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: HTMLElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: HTMLElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n if (options.onBlur) {\n options.onBlur.call($element)\n }\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n if (options.onBeforeFocus) {\n options.onBeforeFocus.call($element)\n }\n $element.focus()\n}\n","import $ from 'jquery'\n\nimport { addAttributeValue, removeAttributeValue } from '../../helpers.mjs'\n\nexport function FormValidator(form, options) {\n this.form = form\n this.errors = []\n this.validators = []\n $(this.form).on('submit', $.proxy(this, 'onSubmit'))\n this.summary =\n options && options.summary ? $(options.summary) : $('.govuk-error-summary')\n this.originalTitle = document.title\n}\n\nFormValidator.entityMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '/': '/',\n '`': '`',\n '=': '='\n}\n\nFormValidator.prototype.escapeHtml = function (string) {\n return String(string).replace(/[&<>\"'`=/]/g, function fromEntityMap(s) {\n return FormValidator.entityMap[s]\n })\n}\n\nFormValidator.prototype.resetTitle = function () {\n document.title = this.originalTitle\n}\n\nFormValidator.prototype.updateTitle = function () {\n document.title = `${this.errors.length} errors - ${document.title}`\n}\n\nFormValidator.prototype.showSummary = function () {\n this.summary.html(this.getSummaryHtml())\n this.summary.removeClass('moj-hidden')\n this.summary.attr('aria-labelledby', 'errorSummary-heading')\n this.summary.focus()\n}\n\nFormValidator.prototype.getSummaryHtml = function () {\n let html =\n '<h2 id=\"error-summary-title\" class=\"govuk-error-summary__title\">There is a problem</h2>'\n html += '<div class=\"govuk-error-summary__body\">'\n html += '<ul class=\"govuk-list govuk-error-summary__list\">'\n for (let i = 0, j = this.errors.length; i < j; i++) {\n const error = this.errors[i]\n html += '<li>'\n html += `<a href=\"#${this.escapeHtml(error.fieldName)}\">`\n html += this.escapeHtml(error.message)\n html += '</a>'\n html += '</li>'\n }\n html += '</ul>'\n html += '</div>'\n return html\n}\n\nFormValidator.prototype.hideSummary = function () {\n this.summary.addClass('moj-hidden')\n this.summary.removeAttr('aria-labelledby')\n}\n\nFormValidator.prototype.onSubmit = function (e) {\n this.removeInlineErrors()\n this.hideSummary()\n this.resetTitle()\n if (!this.validate()) {\n e.preventDefault()\n this.updateTitle()\n this.showSummary()\n this.showInlineErrors()\n }\n}\n\nFormValidator.prototype.showInlineErrors = function () {\n for (let i = 0, j = this.errors.length; i < j; i++) {\n this.showInlineError(this.errors[i])\n }\n}\n\nFormValidator.prototype.showInlineError = function (error) {\n const errorSpanId = `${error.fieldName}-error`\n const errorSpan = `<span class=\"govuk-error-message\" id=\"${\n errorSpanId\n }\">${this.escapeHtml(error.message)}</span>`\n const control = $(`#${error.fieldName}`)\n const fieldContainer = control.parents('.govuk-form-group')\n const label = fieldContainer.find('label')\n const legend = fieldContainer.find('legend')\n const fieldset = fieldContainer.find('fieldset')\n fieldContainer.addClass('govuk-form-group--error')\n if (legend.length) {\n legend.after(errorSpan)\n fieldContainer.attr('aria-invalid', 'true')\n addAttributeValue(fieldset[0], 'aria-describedby', errorSpanId)\n } else {\n label.after(errorSpan)\n control.attr('aria-invalid', 'true')\n addAttributeValue(control[0], 'aria-describedby', errorSpanId)\n }\n}\n\nFormValidator.prototype.removeInlineErrors = function () {\n for (let i = 0; i < this.errors.length; i++) {\n this.removeInlineError(this.errors[i])\n }\n}\n\nFormValidator.prototype.removeInlineError = function (error) {\n const control = $(`#${error.fieldName}`)\n const fieldContainer = control.parents('.govuk-form-group')\n fieldContainer.find('.govuk-error-message').remove()\n fieldContainer.removeClass('govuk-form-group--error')\n fieldContainer.find('[aria-invalid]').attr('aria-invalid', 'false')\n const errorSpanId = `${error.fieldName}-error`\n removeAttributeValue(\n fieldContainer.find('[aria-describedby]')[0],\n 'aria-describedby',\n errorSpanId\n )\n}\n\nFormValidator.prototype.addValidator = function (fieldName, rules) {\n this.validators.push({\n fieldName,\n rules,\n field: this.form.elements[fieldName]\n })\n}\n\nFormValidator.prototype.validate = function () {\n this.errors = []\n let validator = null\n let validatorReturnValue = true\n let i\n let j\n for (i = 0; i < this.validators.length; i++) {\n validator = this.validators[i]\n for (j = 0; j < validator.rules.length; j++) {\n validatorReturnValue = validator.rules[j].method(\n validator.field,\n validator.rules[j].params\n )\n\n if (typeof validatorReturnValue === 'boolean' && !validatorReturnValue) {\n this.errors.push({\n fieldName: validator.fieldName,\n message: validator.rules[j].message\n })\n break\n } else if (typeof validatorReturnValue === 'string') {\n this.errors.push({\n fieldName: validatorReturnValue,\n message: validator.rules[j].message\n })\n break\n }\n }\n }\n return this.errors.length === 0\n}\n"],"names":[],"mappings":";;;;;;EAAO,SAAS,oBAAoB,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;EACtD,EAAE,IAAI,EAAE,EAAE;EACV,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;EAC7B,IAAI,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE;EACzC,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI;EAC7B,KAAK,MAAM;EACX,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC;EAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE;EACxC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;EAC/B,QAAQ,EAAE,CAAC,YAAY;EACvB,UAAU,IAAI;EACd,UAAU,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,C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,CAAA,MAAA;EACA,QAAA,SAAA,CAAA,KAAA;EACA,QAAA,SAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;EACA;;EAEA,MAAA,IAAA,OAAA,oBAAA,KAAA,SAAA,IAAA,CAAA,oBAAA,EAAA;EACA,QAAA,IAAA,CAAA,MAAA,CAAA,IAAA,CAAA;EACA,UAAA,SAAA,EAAA,SAAA,CAAA,SAAA;EACA,UAAA,OAAA,EAAA,SAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;EACA,SAAA;EACA,QAAA;EACA,OAAA,MAAA,IAAA,OAAA,oBAAA,KAAA,QAAA,EAAA;EACA,QAAA,IAAA,CAAA,MAAA,CAAA,IAAA,CAAA;EACA,UAAA,SAAA,EAAA,oBAAA;EACA,UAAA,OAAA,EAAA,SAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;EACA,SAAA;EACA,QAAA;EACA;EACA;EACA;EACA,EAAA,OAAA,IAAA,CAAA,MAAA,CAAA,MAAA,KAAA;EACA;;;;;;;;"}
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MOJFrontend = global.MOJFrontend || {}));
|
|
5
|
-
})(this, (function (exports) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function dragAndDropSupported() {
|
|
8
|
-
const div = document.createElement('div');
|
|
9
|
-
return typeof div.ondrop !== 'undefined'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function formDataSupported() {
|
|
13
|
-
return typeof FormData === 'function'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function fileApiSupported() {
|
|
17
|
-
const input = document.createElement('input');
|
|
18
|
-
input.type = 'file';
|
|
19
|
-
return typeof input.files !== 'undefined'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function MultiFileUpload(params) {
|
|
23
|
-
if (!(dragAndDropSupported() && formDataSupported() && fileApiSupported())) {
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
this.defaultParams = {
|
|
28
|
-
uploadFileEntryHook: $.noop,
|
|
29
|
-
uploadFileExitHook: $.noop,
|
|
30
|
-
uploadFileErrorHook: $.noop,
|
|
31
|
-
fileDeleteHook: $.noop,
|
|
32
|
-
uploadStatusText: 'Uploading files, please wait',
|
|
33
|
-
dropzoneHintText: 'Drag and drop files here or',
|
|
34
|
-
dropzoneButtonText: 'Choose files'
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
this.params = $.extend({}, this.defaultParams, params);
|
|
38
|
-
this.container = $(this.params.container);
|
|
39
|
-
|
|
40
|
-
this.container.addClass('moj-multi-file-upload--enhanced');
|
|
41
|
-
|
|
42
|
-
this.feedbackContainer = this.container.find(
|
|
43
|
-
'.moj-multi-file__uploaded-files'
|
|
44
|
-
);
|
|
45
|
-
this.setupFileInput();
|
|
46
|
-
this.setupDropzone();
|
|
47
|
-
this.setupLabel();
|
|
48
|
-
this.setupStatusBox();
|
|
49
|
-
this.container.on(
|
|
50
|
-
'click',
|
|
51
|
-
'.moj-multi-file-upload__delete',
|
|
52
|
-
$.proxy(this, 'onFileDeleteClick')
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
MultiFileUpload.prototype.setupDropzone = function () {
|
|
57
|
-
this.fileInput.wrap('<div class="moj-multi-file-upload__dropzone" />');
|
|
58
|
-
this.dropzone = this.container.find('.moj-multi-file-upload__dropzone');
|
|
59
|
-
this.dropzone.on('dragover', $.proxy(this, 'onDragOver'));
|
|
60
|
-
this.dropzone.on('dragleave', $.proxy(this, 'onDragLeave'));
|
|
61
|
-
this.dropzone.on('drop', $.proxy(this, 'onDrop'));
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
MultiFileUpload.prototype.setupLabel = function () {
|
|
65
|
-
this.label = $(
|
|
66
|
-
`<label for="${this.fileInput[0].id}" class="govuk-button govuk-button--secondary">${this.params.dropzoneButtonText}</label>`
|
|
67
|
-
);
|
|
68
|
-
this.dropzone.append(
|
|
69
|
-
`<p class="govuk-body">${this.params.dropzoneHintText}</p>`
|
|
70
|
-
);
|
|
71
|
-
this.dropzone.append(this.label);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
MultiFileUpload.prototype.setupFileInput = function () {
|
|
75
|
-
this.fileInput = this.container.find('.moj-multi-file-upload__input');
|
|
76
|
-
this.fileInput.on('change', $.proxy(this, 'onFileChange'));
|
|
77
|
-
this.fileInput.on('focus', $.proxy(this, 'onFileFocus'));
|
|
78
|
-
this.fileInput.on('blur', $.proxy(this, 'onFileBlur'));
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
MultiFileUpload.prototype.setupStatusBox = function () {
|
|
82
|
-
this.status = $(
|
|
83
|
-
'<div aria-live="polite" role="status" class="govuk-visually-hidden" />'
|
|
84
|
-
);
|
|
85
|
-
this.dropzone.append(this.status);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
MultiFileUpload.prototype.onDragOver = function (e) {
|
|
89
|
-
e.preventDefault();
|
|
90
|
-
this.dropzone.addClass('moj-multi-file-upload--dragover');
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
MultiFileUpload.prototype.onDragLeave = function () {
|
|
94
|
-
this.dropzone.removeClass('moj-multi-file-upload--dragover');
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
MultiFileUpload.prototype.onDrop = function (e) {
|
|
98
|
-
e.preventDefault();
|
|
99
|
-
this.dropzone.removeClass('moj-multi-file-upload--dragover');
|
|
100
|
-
this.feedbackContainer.removeClass('moj-hidden');
|
|
101
|
-
this.status.html(this.params.uploadStatusText);
|
|
102
|
-
this.uploadFiles(e.originalEvent.dataTransfer.files);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
MultiFileUpload.prototype.uploadFiles = function (files) {
|
|
106
|
-
for (let i = 0; i < files.length; i++) {
|
|
107
|
-
this.uploadFile(files[i]);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
MultiFileUpload.prototype.onFileChange = function (e) {
|
|
112
|
-
this.feedbackContainer.removeClass('moj-hidden');
|
|
113
|
-
this.status.html(this.params.uploadStatusText);
|
|
114
|
-
this.uploadFiles(e.currentTarget.files);
|
|
115
|
-
this.fileInput.replaceWith($(e.currentTarget).val('').clone(true));
|
|
116
|
-
this.setupFileInput();
|
|
117
|
-
this.fileInput.get(0).focus();
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
MultiFileUpload.prototype.onFileFocus = function (e) {
|
|
121
|
-
this.label.addClass('moj-multi-file-upload--focused');
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
MultiFileUpload.prototype.onFileBlur = function (e) {
|
|
125
|
-
this.label.removeClass('moj-multi-file-upload--focused');
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
MultiFileUpload.prototype.getSuccessHtml = function (success) {
|
|
129
|
-
return `<span class="moj-multi-file-upload__success"> <svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z"/></svg>${success.messageHtml}</span>`
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
MultiFileUpload.prototype.getErrorHtml = function (error) {
|
|
133
|
-
return `<span class="moj-multi-file-upload__error"> <svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z"/></svg>${error.message}</span>`
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
MultiFileUpload.prototype.getFileRowHtml = function (file) {
|
|
137
|
-
const html = `
|
|
138
|
-
<div class="govuk-summary-list__row moj-multi-file-upload__row">
|
|
139
|
-
<div class="govuk-summary-list__value moj-multi-file-upload__message">
|
|
140
|
-
<span class="moj-multi-file-upload__filename">${file.name}</span>
|
|
141
|
-
<span class="moj-multi-file-upload__progress">0%</span>
|
|
142
|
-
</div>
|
|
143
|
-
<div class="govuk-summary-list__actions moj-multi-file-upload__actions"></div>
|
|
144
|
-
</div>`;
|
|
145
|
-
return html
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
MultiFileUpload.prototype.getDeleteButtonHtml = function (file) {
|
|
149
|
-
return `<button class="moj-multi-file-upload__delete govuk-button govuk-button--secondary govuk-!-margin-bottom-0" type="button" name="delete" value="${file.filename}">
|
|
150
|
-
Delete <span class="govuk-visually-hidden">${file.originalname}</span>
|
|
151
|
-
</button>`
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
MultiFileUpload.prototype.uploadFile = function (file) {
|
|
155
|
-
this.params.uploadFileEntryHook(this, file);
|
|
156
|
-
const item = $(this.getFileRowHtml(file));
|
|
157
|
-
const formData = new FormData();
|
|
158
|
-
formData.append('documents', file);
|
|
159
|
-
this.feedbackContainer.find('.moj-multi-file-upload__list').append(item);
|
|
160
|
-
|
|
161
|
-
$.ajax({
|
|
162
|
-
url: this.params.uploadUrl,
|
|
163
|
-
type: 'post',
|
|
164
|
-
data: formData,
|
|
165
|
-
processData: false,
|
|
166
|
-
contentType: false,
|
|
167
|
-
success: $.proxy(function (response) {
|
|
168
|
-
if (response.error) {
|
|
169
|
-
item
|
|
170
|
-
.find('.moj-multi-file-upload__message')
|
|
171
|
-
.html(this.getErrorHtml(response.error));
|
|
172
|
-
this.status.html(response.error.message);
|
|
173
|
-
} else {
|
|
174
|
-
item
|
|
175
|
-
.find('.moj-multi-file-upload__message')
|
|
176
|
-
.html(this.getSuccessHtml(response.success));
|
|
177
|
-
this.status.html(response.success.messageText);
|
|
178
|
-
}
|
|
179
|
-
item
|
|
180
|
-
.find('.moj-multi-file-upload__actions')
|
|
181
|
-
.append(this.getDeleteButtonHtml(response.file));
|
|
182
|
-
this.params.uploadFileExitHook(this, file, response);
|
|
183
|
-
}, this),
|
|
184
|
-
error: $.proxy(function (jqXHR, textStatus, errorThrown) {
|
|
185
|
-
this.params.uploadFileErrorHook(
|
|
186
|
-
this,
|
|
187
|
-
file,
|
|
188
|
-
jqXHR,
|
|
189
|
-
textStatus,
|
|
190
|
-
errorThrown
|
|
191
|
-
);
|
|
192
|
-
}, this),
|
|
193
|
-
xhr: function () {
|
|
194
|
-
const xhr = new XMLHttpRequest();
|
|
195
|
-
xhr.upload.addEventListener(
|
|
196
|
-
'progress',
|
|
197
|
-
function (e) {
|
|
198
|
-
if (e.lengthComputable) {
|
|
199
|
-
let percentComplete = e.loaded / e.total;
|
|
200
|
-
percentComplete = parseInt(percentComplete * 100, 10);
|
|
201
|
-
item
|
|
202
|
-
.find('.moj-multi-file-upload__progress')
|
|
203
|
-
.text(` ${percentComplete}%`);
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
false
|
|
207
|
-
);
|
|
208
|
-
return xhr
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
MultiFileUpload.prototype.onFileDeleteClick = function (e) {
|
|
214
|
-
e.preventDefault(); // if user refreshes page and then deletes
|
|
215
|
-
const button = $(e.currentTarget);
|
|
216
|
-
const data = {};
|
|
217
|
-
data[button[0].name] = button[0].value;
|
|
218
|
-
$.ajax({
|
|
219
|
-
url: this.params.deleteUrl,
|
|
220
|
-
type: 'post',
|
|
221
|
-
dataType: 'json',
|
|
222
|
-
data,
|
|
223
|
-
success: $.proxy(function (response) {
|
|
224
|
-
if (response.error) ; else {
|
|
225
|
-
button.parents('.moj-multi-file-upload__row').remove();
|
|
226
|
-
if (
|
|
227
|
-
this.feedbackContainer.find('.moj-multi-file-upload__row').length ===
|
|
228
|
-
0
|
|
229
|
-
) {
|
|
230
|
-
this.feedbackContainer.addClass('moj-hidden');
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
this.params.fileDeleteHook(this, response);
|
|
234
|
-
}, this)
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
exports.MultiFileUpload = MultiFileUpload;
|
|
239
|
-
|
|
240
|
-
}));
|
|
241
|
-
//# sourceMappingURL=multi-file-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"multi-file-upload.js","sources":["../../../../src/moj/helpers.mjs","../../../../src/moj/components/multi-file-upload/multi-file-upload.mjs"],"sourcesContent":["export function removeAttributeValue(el, attr, value) {\n let re, m\n if (el.getAttribute(attr)) {\n if (el.getAttribute(attr) === value) {\n el.removeAttribute(attr)\n } else {\n re = new RegExp(`(^|\\\\s)${value}(\\\\s|$)`)\n m = el.getAttribute(attr).match(re)\n if (m && m.length === 3) {\n el.setAttribute(\n attr,\n el.getAttribute(attr).replace(re, m[1] && m[2] ? ' ' : '')\n )\n }\n }\n }\n}\n\nexport function addAttributeValue(el, attr, value) {\n let re\n if (!el.getAttribute(attr)) {\n el.setAttribute(attr, value)\n } else {\n re = new RegExp(`(^|\\\\s)${value}(\\\\s|$)`)\n if (!re.test(el.getAttribute(attr))) {\n el.setAttribute(attr, `${el.getAttribute(attr)} ${value}`)\n }\n }\n}\n\nexport function dragAndDropSupported() {\n const div = document.createElement('div')\n return typeof div.ondrop !== 'undefined'\n}\n\nexport function formDataSupported() {\n return typeof FormData === 'function'\n}\n\nexport function fileApiSupported() {\n const input = document.createElement('input')\n input.type = 'file'\n return typeof input.files !== 'undefined'\n}\n\nexport function nodeListForEach(nodes, callback) {\n if (window.NodeList.prototype.forEach) {\n return nodes.forEach(callback)\n }\n for (let i = 0; i < nodes.length; i++) {\n callback.call(window, nodes[i], i, nodes)\n }\n}\n\n/**\n * Find an elements next sibling\n *\n * Utility function to find an elements next sibling matching the provided\n * selector.\n *\n * @param {HTMLElement} $element - Element to find siblings for\n * @param {string} selector - selector for required sibling\n */\nexport function getNextSibling($element, selector) {\n if (!$element) return\n // Get the next sibling element\n let $sibling = $element.nextElementSibling\n\n // If there's no selector, return the first sibling\n if (!selector) return $sibling\n\n // If the sibling matches our selector, use it\n // If not, jump to the next sibling and continue the loop\n while ($sibling) {\n if ($sibling.matches(selector)) return $sibling\n $sibling = $sibling.nextElementSibling\n }\n}\n\n/**\n * Find an elements preceding sibling\n *\n * Utility function to find an elements previous sibling matching the provided\n * selector.\n *\n * @param {HTMLElement} $element - Element to find siblings for\n * @param {string} selector - selector for required sibling\n */\nexport function getPreviousSibling($element, selector) {\n if (!$element) return\n // Get the previous sibling element\n let $sibling = $element.previousElementSibling\n\n // If there's no selector, return the first sibling\n if (!selector) return $sibling\n\n // If the sibling matches our selector, use it\n // If not, jump to the next sibling and continue the loop\n while ($sibling) {\n if ($sibling.matches(selector)) return $sibling\n $sibling = $sibling.previousElementSibling\n }\n}\n\nexport function findNearestMatchingElement($element, selector) {\n // If no element or selector is provided, return null\n if (!$element) return\n if (!selector) return\n\n // Start with the current element\n let $currentElement = $element\n\n while ($currentElement) {\n // First check the current element\n if ($currentElement.matches(selector)) {\n return $currentElement\n }\n\n // Check all previous siblings\n let $sibling = $currentElement.previousElementSibling\n while ($sibling) {\n // Check if the sibling itself is a heading\n if ($sibling.matches(selector)) {\n return $sibling\n }\n $sibling = $sibling.previousElementSibling\n }\n\n // If no match found in siblings, move up to parent\n $currentElement = $currentElement.parentElement\n }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @param {HTMLElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: HTMLElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: HTMLElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n const isFocusable = $element.getAttribute('tabindex')\n\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1')\n }\n\n /**\n * Handle element focus\n */\n function onFocus() {\n $element.addEventListener('blur', onBlur, { once: true })\n }\n\n /**\n * Handle element blur\n */\n function onBlur() {\n if (options.onBlur) {\n options.onBlur.call($element)\n }\n\n if (!isFocusable) {\n $element.removeAttribute('tabindex')\n }\n }\n\n // Add listener to reset element on blur, after focus\n $element.addEventListener('focus', onFocus, { once: true })\n\n // Focus element\n if (options.onBeforeFocus) {\n options.onBeforeFocus.call($element)\n }\n $element.focus()\n}\n","import $ from 'jquery'\n\nimport {\n dragAndDropSupported,\n fileApiSupported,\n formDataSupported\n} from '../../helpers.mjs'\n\nexport function MultiFileUpload(params) {\n if (!(dragAndDropSupported() && formDataSupported() && fileApiSupported())) {\n return\n }\n\n this.defaultParams = {\n uploadFileEntryHook: $.noop,\n uploadFileExitHook: $.noop,\n uploadFileErrorHook: $.noop,\n fileDeleteHook: $.noop,\n uploadStatusText: 'Uploading files, please wait',\n dropzoneHintText: 'Drag and drop files here or',\n dropzoneButtonText: 'Choose files'\n }\n\n this.params = $.extend({}, this.defaultParams, params)\n this.container = $(this.params.container)\n\n this.container.addClass('moj-multi-file-upload--enhanced')\n\n this.feedbackContainer = this.container.find(\n '.moj-multi-file__uploaded-files'\n )\n this.setupFileInput()\n this.setupDropzone()\n this.setupLabel()\n this.setupStatusBox()\n this.container.on(\n 'click',\n '.moj-multi-file-upload__delete',\n $.proxy(this, 'onFileDeleteClick')\n )\n}\n\nMultiFileUpload.prototype.setupDropzone = function () {\n this.fileInput.wrap('<div class=\"moj-multi-file-upload__dropzone\" />')\n this.dropzone = this.container.find('.moj-multi-file-upload__dropzone')\n this.dropzone.on('dragover', $.proxy(this, 'onDragOver'))\n this.dropzone.on('dragleave', $.proxy(this, 'onDragLeave'))\n this.dropzone.on('drop', $.proxy(this, 'onDrop'))\n}\n\nMultiFileUpload.prototype.setupLabel = function () {\n this.label = $(\n `<label for=\"${this.fileInput[0].id}\" class=\"govuk-button govuk-button--secondary\">${this.params.dropzoneButtonText}</label>`\n )\n this.dropzone.append(\n `<p class=\"govuk-body\">${this.params.dropzoneHintText}</p>`\n )\n this.dropzone.append(this.label)\n}\n\nMultiFileUpload.prototype.setupFileInput = function () {\n this.fileInput = this.container.find('.moj-multi-file-upload__input')\n this.fileInput.on('change', $.proxy(this, 'onFileChange'))\n this.fileInput.on('focus', $.proxy(this, 'onFileFocus'))\n this.fileInput.on('blur', $.proxy(this, 'onFileBlur'))\n}\n\nMultiFileUpload.prototype.setupStatusBox = function () {\n this.status = $(\n '<div aria-live=\"polite\" role=\"status\" class=\"govuk-visually-hidden\" />'\n )\n this.dropzone.append(this.status)\n}\n\nMultiFileUpload.prototype.onDragOver = function (e) {\n e.preventDefault()\n this.dropzone.addClass('moj-multi-file-upload--dragover')\n}\n\nMultiFileUpload.prototype.onDragLeave = function () {\n this.dropzone.removeClass('moj-multi-file-upload--dragover')\n}\n\nMultiFileUpload.prototype.onDrop = function (e) {\n e.preventDefault()\n this.dropzone.removeClass('moj-multi-file-upload--dragover')\n this.feedbackContainer.removeClass('moj-hidden')\n this.status.html(this.params.uploadStatusText)\n this.uploadFiles(e.originalEvent.dataTransfer.files)\n}\n\nMultiFileUpload.prototype.uploadFiles = function (files) {\n for (let i = 0; i < files.length; i++) {\n this.uploadFile(files[i])\n }\n}\n\nMultiFileUpload.prototype.onFileChange = function (e) {\n this.feedbackContainer.removeClass('moj-hidden')\n this.status.html(this.params.uploadStatusText)\n this.uploadFiles(e.currentTarget.files)\n this.fileInput.replaceWith($(e.currentTarget).val('').clone(true))\n this.setupFileInput()\n this.fileInput.get(0).focus()\n}\n\nMultiFileUpload.prototype.onFileFocus = function (e) {\n this.label.addClass('moj-multi-file-upload--focused')\n}\n\nMultiFileUpload.prototype.onFileBlur = function (e) {\n this.label.removeClass('moj-multi-file-upload--focused')\n}\n\nMultiFileUpload.prototype.getSuccessHtml = function (success) {\n return `<span class=\"moj-multi-file-upload__success\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z\"/></svg>${success.messageHtml}</span>`\n}\n\nMultiFileUpload.prototype.getErrorHtml = function (error) {\n return `<span class=\"moj-multi-file-upload__error\"> <svg class=\"moj-banner__icon\" fill=\"currentColor\" role=\"presentation\" focusable=\"false\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 25 25\" height=\"25\" width=\"25\"><path d=\"M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z\"/></svg>${error.message}</span>`\n}\n\nMultiFileUpload.prototype.getFileRowHtml = function (file) {\n const html = `\n <div class=\"govuk-summary-list__row moj-multi-file-upload__row\">\n <div class=\"govuk-summary-list__value moj-multi-file-upload__message\">\n <span class=\"moj-multi-file-upload__filename\">${file.name}</span>\n <span class=\"moj-multi-file-upload__progress\">0%</span>\n </div>\n <div class=\"govuk-summary-list__actions moj-multi-file-upload__actions\"></div>\n </div>`\n return html\n}\n\nMultiFileUpload.prototype.getDeleteButtonHtml = function (file) {\n return `<button class=\"moj-multi-file-upload__delete govuk-button govuk-button--secondary govuk-!-margin-bottom-0\" type=\"button\" name=\"delete\" value=\"${file.filename}\">\n Delete <span class=\"govuk-visually-hidden\">${file.originalname}</span>\n </button>`\n}\n\nMultiFileUpload.prototype.uploadFile = function (file) {\n this.params.uploadFileEntryHook(this, file)\n const item = $(this.getFileRowHtml(file))\n const formData = new FormData()\n formData.append('documents', file)\n this.feedbackContainer.find('.moj-multi-file-upload__list').append(item)\n\n $.ajax({\n url: this.params.uploadUrl,\n type: 'post',\n data: formData,\n processData: false,\n contentType: false,\n success: $.proxy(function (response) {\n if (response.error) {\n item\n .find('.moj-multi-file-upload__message')\n .html(this.getErrorHtml(response.error))\n this.status.html(response.error.message)\n } else {\n item\n .find('.moj-multi-file-upload__message')\n .html(this.getSuccessHtml(response.success))\n this.status.html(response.success.messageText)\n }\n item\n .find('.moj-multi-file-upload__actions')\n .append(this.getDeleteButtonHtml(response.file))\n this.params.uploadFileExitHook(this, file, response)\n }, this),\n error: $.proxy(function (jqXHR, textStatus, errorThrown) {\n this.params.uploadFileErrorHook(\n this,\n file,\n jqXHR,\n textStatus,\n errorThrown\n )\n }, this),\n xhr: function () {\n const xhr = new XMLHttpRequest()\n xhr.upload.addEventListener(\n 'progress',\n function (e) {\n if (e.lengthComputable) {\n let percentComplete = e.loaded / e.total\n percentComplete = parseInt(percentComplete * 100, 10)\n item\n .find('.moj-multi-file-upload__progress')\n .text(` ${percentComplete}%`)\n }\n },\n false\n )\n return xhr\n }\n })\n}\n\nMultiFileUpload.prototype.onFileDeleteClick = function (e) {\n e.preventDefault() // if user refreshes page and then deletes\n const button = $(e.currentTarget)\n const data = {}\n data[button[0].name] = button[0].value\n $.ajax({\n url: this.params.deleteUrl,\n type: 'post',\n dataType: 'json',\n data,\n success: $.proxy(function (response) {\n if (response.error) {\n // handle error\n } else {\n button.parents('.moj-multi-file-upload__row').remove()\n if (\n this.feedbackContainer.find('.moj-multi-file-upload__row').length ===\n 0\n ) {\n this.feedbackContainer.addClass('moj-hidden')\n }\n }\n this.params.fileDeleteHook(this, response)\n }, this)\n })\n}\n"],"names":[],"mappings":";;;;;;EA8BO,SAAS,oBAAoB,GAAG;EACvC,EAAE,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK;EAC1C,EAAE,OAAO,OAAO,GAAG,CAAC,MAAM,KAAK;EAC/B;;EAEO,SAAS,iBAAiB,GAAG;EACpC,EAAE,OAAO,OAAO,QAAQ,KAAK;EAC7B;;EAEO,SAAS,gBAAgB,GAAG;EACnC,EAAE,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO;EAC9C,EAAE,KAAK,C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