@ministryofjustice/frontend 3.4.0 → 3.5.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.jquery.min.js +7 -70
- package/moj/all.js +2856 -2865
- package/moj/components/add-another/add-another.js +135 -104
- package/moj/components/alert/alert.js +482 -247
- package/moj/components/alert/alert.spec.helper.js +30 -5
- package/moj/components/button-menu/button-menu.js +346 -319
- package/moj/components/date-picker/date-picker.js +925 -900
- package/moj/components/filter-toggle-button/filter-toggle-button.js +122 -91
- package/moj/components/form-validator/form-validator.js +399 -164
- package/moj/components/multi-file-upload/multi-file-upload.js +445 -210
- package/moj/components/multi-select/multi-select.js +106 -75
- package/moj/components/password-reveal/password-reveal.js +64 -33
- package/moj/components/rich-text-editor/rich-text-editor.js +186 -153
- package/moj/components/search-toggle/search-toggle.js +77 -46
- package/moj/components/sortable-table/sortable-table.js +167 -146
- package/moj/helpers/_links.scss +1 -1
- package/moj/helpers.js +218 -180
- package/moj/moj-frontend.min.js +7 -70
- package/moj/version.js +28 -1
- package/package.json +1 -1
- package/moj/all.spec.js +0 -24
- package/moj/components/add-another/add-another.spec.js +0 -165
- package/moj/components/alert/alert.spec.js +0 -229
- package/moj/components/button-menu/button-menu.spec.js +0 -360
- package/moj/components/date-picker/date-picker.spec.js +0 -1178
- package/moj/components/filter-toggle-button/filter-toggle-button.spec.js +0 -302
- package/moj/components/multi-file-upload/multi-file-upload.spec.js +0 -510
- package/moj/components/multi-select/multi-select.spec.js +0 -128
- package/moj/components/password-reveal/password-reveal.spec.js +0 -57
- package/moj/components/search-toggle/search-toggle.spec.js +0 -129
- package/moj/components/sortable-table/sortable-table.spec.js +0 -362
- package/moj/helpers.spec.js +0 -235
- package/moj/namespace.js +0 -2
|
@@ -1,91 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MOJFrontend = factory());
|
|
5
|
+
})(this, (function () { 'use strict';
|
|
6
|
+
|
|
7
|
+
function getDefaultExportFromCjs (x) {
|
|
8
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var _global_window_jQuery = window.jQuery;
|
|
12
|
+
|
|
13
|
+
var filterToggleButton$1;
|
|
14
|
+
var hasRequiredFilterToggleButton;
|
|
15
|
+
|
|
16
|
+
function requireFilterToggleButton () {
|
|
17
|
+
if (hasRequiredFilterToggleButton) return filterToggleButton$1;
|
|
18
|
+
hasRequiredFilterToggleButton = 1;
|
|
19
|
+
const $ = _global_window_jQuery;
|
|
20
|
+
|
|
21
|
+
function FilterToggleButton(options) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
this.container = $(this.options.toggleButton.container);
|
|
24
|
+
this.filterContainer = $(this.options.filter.container);
|
|
25
|
+
|
|
26
|
+
this.createToggleButton();
|
|
27
|
+
this.setupResponsiveChecks();
|
|
28
|
+
this.filterContainer.attr('tabindex', '-1');
|
|
29
|
+
if (this.options.startHidden) {
|
|
30
|
+
this.hideMenu();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
FilterToggleButton.prototype.setupResponsiveChecks = function () {
|
|
35
|
+
this.mq = window.matchMedia(this.options.bigModeMediaQuery);
|
|
36
|
+
this.mq.addListener($.proxy(this, 'checkMode'));
|
|
37
|
+
this.checkMode(this.mq);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
FilterToggleButton.prototype.createToggleButton = function () {
|
|
41
|
+
this.menuButton = $(
|
|
42
|
+
`<button class="govuk-button ${this.options.toggleButton.classes}" type="button" aria-haspopup="true" aria-expanded="false">${this.options.toggleButton.showText}</button>`
|
|
43
|
+
);
|
|
44
|
+
this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
|
|
45
|
+
this.container.append(this.menuButton);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
FilterToggleButton.prototype.checkMode = function (mq) {
|
|
49
|
+
if (mq.matches) {
|
|
50
|
+
this.enableBigMode();
|
|
51
|
+
} else {
|
|
52
|
+
this.enableSmallMode();
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
FilterToggleButton.prototype.enableBigMode = function () {
|
|
57
|
+
this.showMenu();
|
|
58
|
+
this.removeCloseButton();
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
FilterToggleButton.prototype.enableSmallMode = function () {
|
|
62
|
+
this.hideMenu();
|
|
63
|
+
this.addCloseButton();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
FilterToggleButton.prototype.addCloseButton = function () {
|
|
67
|
+
if (this.options.closeButton) {
|
|
68
|
+
this.closeButton = $(
|
|
69
|
+
`<button class="moj-filter__close" type="button">${this.options.closeButton.text}</button>`
|
|
70
|
+
);
|
|
71
|
+
this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
|
|
72
|
+
$(this.options.closeButton.container).append(this.closeButton);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
FilterToggleButton.prototype.onCloseClick = function () {
|
|
77
|
+
this.hideMenu();
|
|
78
|
+
this.menuButton.focus();
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
FilterToggleButton.prototype.removeCloseButton = function () {
|
|
82
|
+
if (this.closeButton) {
|
|
83
|
+
this.closeButton.remove();
|
|
84
|
+
this.closeButton = null;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
FilterToggleButton.prototype.hideMenu = function () {
|
|
89
|
+
this.menuButton.attr('aria-expanded', 'false');
|
|
90
|
+
this.filterContainer.addClass('moj-js-hidden');
|
|
91
|
+
this.menuButton.text(this.options.toggleButton.showText);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
FilterToggleButton.prototype.showMenu = function () {
|
|
95
|
+
this.menuButton.attr('aria-expanded', 'true');
|
|
96
|
+
this.filterContainer.removeClass('moj-js-hidden');
|
|
97
|
+
this.menuButton.text(this.options.toggleButton.hideText);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
FilterToggleButton.prototype.onMenuButtonClick = function () {
|
|
101
|
+
this.toggle();
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
FilterToggleButton.prototype.toggle = function () {
|
|
105
|
+
if (this.menuButton.attr('aria-expanded') === 'false') {
|
|
106
|
+
this.showMenu();
|
|
107
|
+
this.filterContainer.get(0).focus();
|
|
108
|
+
} else {
|
|
109
|
+
this.hideMenu();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
filterToggleButton$1 = { FilterToggleButton };
|
|
114
|
+
return filterToggleButton$1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var filterToggleButtonExports = requireFilterToggleButton();
|
|
118
|
+
var filterToggleButton = /*@__PURE__*/getDefaultExportFromCjs(filterToggleButtonExports);
|
|
119
|
+
|
|
120
|
+
return filterToggleButton;
|
|
121
|
+
|
|
122
|
+
}));
|