@ministryofjustice/frontend 3.3.1 → 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.
Files changed (83) hide show
  1. package/README.md +4 -10
  2. package/govuk-prototype-kit.config.json +5 -16
  3. package/moj/all.jquery.min.js +15 -4
  4. package/moj/all.js +2856 -2280
  5. package/moj/all.scss +2 -0
  6. package/moj/components/_all.scss +1 -0
  7. package/moj/components/action-bar/_action-bar.scss +4 -6
  8. package/moj/components/add-another/_add-another.scss +9 -7
  9. package/moj/components/add-another/add-another.js +128 -76
  10. package/moj/components/alert/README.md +0 -0
  11. package/moj/components/alert/_alert.scss +142 -0
  12. package/moj/components/alert/alert.js +482 -0
  13. package/moj/components/alert/alert.spec.helper.js +92 -0
  14. package/moj/components/alert/macro.njk +3 -0
  15. package/moj/components/alert/template.njk +83 -0
  16. package/moj/components/badge/_badge.scss +3 -4
  17. package/moj/components/banner/_banner.scss +5 -10
  18. package/moj/components/button-menu/_button-menu.scss +10 -9
  19. package/moj/components/button-menu/button-menu.js +348 -318
  20. package/moj/components/cookie-banner/_cookie-banner.scss +6 -5
  21. package/moj/components/currency-input/_currency-input.scss +4 -4
  22. package/moj/components/date-picker/README.md +14 -17
  23. package/moj/components/date-picker/_date-picker.scss +122 -106
  24. package/moj/components/date-picker/date-picker.js +927 -900
  25. package/moj/components/filter/README.md +1 -1
  26. package/moj/components/filter/_filter.scss +53 -75
  27. package/moj/components/filter-toggle-button/filter-toggle-button.js +122 -87
  28. package/moj/components/form-validator/form-validator.js +399 -156
  29. package/moj/components/header/_header.scss +17 -19
  30. package/moj/components/identity-bar/_identity-bar.scss +5 -5
  31. package/moj/components/interruption-card/_interruption-card.scss +2 -2
  32. package/moj/components/messages/_messages.scss +12 -19
  33. package/moj/components/multi-file-upload/README.md +1 -1
  34. package/moj/components/multi-file-upload/_multi-file-upload.scss +34 -30
  35. package/moj/components/multi-file-upload/multi-file-upload.js +454 -183
  36. package/moj/components/multi-select/_multi-select.scss +4 -3
  37. package/moj/components/multi-select/multi-select.js +106 -70
  38. package/moj/components/notification-badge/_notification-badge.scss +12 -12
  39. package/moj/components/organisation-switcher/_organisation-switcher.scss +1 -1
  40. package/moj/components/page-header-actions/_page-header-actions.scss +3 -2
  41. package/moj/components/pagination/_pagination.scss +26 -31
  42. package/moj/components/password-reveal/_password-reveal.scss +1 -2
  43. package/moj/components/password-reveal/password-reveal.js +63 -31
  44. package/moj/components/primary-navigation/_primary-navigation.scss +26 -29
  45. package/moj/components/progress-bar/_progress-bar.scss +21 -26
  46. package/moj/components/rich-text-editor/_rich-text-editor.scss +17 -16
  47. package/moj/components/rich-text-editor/rich-text-editor.js +186 -139
  48. package/moj/components/search/_search.scss +6 -4
  49. package/moj/components/search-toggle/search-toggle.js +83 -53
  50. package/moj/components/search-toggle/search-toggle.scss +21 -15
  51. package/moj/components/side-navigation/_side-navigation.scss +12 -21
  52. package/moj/components/sortable-table/_sortable-table.scss +25 -23
  53. package/moj/components/sortable-table/sortable-table.js +162 -119
  54. package/moj/components/sub-navigation/_sub-navigation.scss +24 -28
  55. package/moj/components/tag/_tag.scss +8 -9
  56. package/moj/components/task-list/_task-list.scss +8 -7
  57. package/moj/components/ticket-panel/_ticket-panel.scss +14 -6
  58. package/moj/components/timeline/_timeline.scss +18 -20
  59. package/moj/filters/all.js +28 -30
  60. package/moj/filters/prototype-kit-13-filters.js +2 -1
  61. package/moj/helpers/_all.scss +1 -0
  62. package/moj/helpers/_hidden.scss +1 -1
  63. package/moj/helpers/_links.scss +20 -0
  64. package/moj/helpers.js +218 -51
  65. package/moj/init.js +2 -2
  66. package/moj/moj-frontend.min.css +2 -2
  67. package/moj/moj-frontend.min.js +15 -4
  68. package/moj/objects/_filter-layout.scss +11 -10
  69. package/moj/objects/_scrollable-pane.scss +11 -14
  70. package/moj/settings/_colours.scss +5 -0
  71. package/moj/settings/_measurements.scss +0 -2
  72. package/moj/utilities/_hidden.scss +3 -3
  73. package/moj/utilities/_width-container.scss +1 -1
  74. package/moj/version.js +28 -1
  75. package/package.json +1 -1
  76. package/moj/all.spec.js +0 -22
  77. package/moj/components/button-menu/button-menu.spec.js +0 -361
  78. package/moj/components/date-picker/date-picker.spec.js +0 -1130
  79. package/moj/components/filter-toggle-button/filter-toggle-button.spec.js +0 -304
  80. package/moj/components/multi-select/multi-select.spec.js +0 -135
  81. package/moj/components/password-reveal/password-reveal.spec.js +0 -55
  82. package/moj/components/search-toggle/search-toggle.spec.js +0 -134
  83. package/moj/namespace.js +0 -1
@@ -1,18 +1,18 @@
1
1
  @import "node_modules/govuk-frontend/dist/govuk/objects/width-container";
2
2
 
3
3
  .moj-cookie-banner {
4
- display: none;
5
- @include govuk-font(16);
6
-
7
4
  box-sizing: border-box;
5
+ display: none;
6
+ left: govuk-spacing(3);
8
7
 
9
8
  padding-top: govuk-spacing(3);
10
- padding-bottom: govuk-spacing(3);
11
- left: govuk-spacing(3);
12
9
  padding-right: govuk-spacing(3);
10
+ padding-bottom: govuk-spacing(3);
13
11
  background-color: govuk-colour("white");
12
+ @include govuk-font(16);
14
13
 
15
14
  &--show {
15
+ // stylelint-disable-next-line declaration-no-important
16
16
  display: block !important;
17
17
  }
18
18
 
@@ -36,6 +36,7 @@
36
36
 
37
37
  @include govuk-media-query($media-type: print) {
38
38
  .moj-cookie-banner {
39
+ // stylelint-disable-next-line declaration-no-important
39
40
  display: none !important;
40
41
  }
41
42
  }
@@ -4,25 +4,25 @@
4
4
 
5
5
  .moj-label__currency {
6
6
  @include govuk-font(19);
7
- background-color: govuk-colour("light-grey");
8
7
  position: absolute;
8
+ // stylelint-disable-next-line declaration-no-important
9
9
  margin: 2px 0 0 2px !important;
10
10
  padding: 5.5px 12px;
11
11
  border-right: 2px solid govuk-colour("black");
12
+ background-color: govuk-colour("light-grey");
12
13
 
13
14
  &--error {
14
- background-color: $govuk-error-colour;
15
15
  border-right: 2px solid $govuk-error-colour;
16
16
  color: govuk-colour("white");
17
+ background-color: $govuk-error-colour;
17
18
  }
18
19
 
19
20
  @include govuk-media-query($until: tablet) {
20
21
  padding: 8px 12px;
21
22
  }
22
-
23
23
  }
24
24
 
25
25
  .moj-input__currency {
26
26
  margin: 0;
27
27
  padding-left: 40px;
28
- }
28
+ }
@@ -1,7 +1,6 @@
1
1
  # Date picker
2
2
 
3
- - [Guidance](https://design-patterns.service.justice.gov.uk/components/date-picker
4
- picker)
3
+ - [Guidance](https://design-patterns.service.justice.gov.uk/components/date-picker)
5
4
 
6
5
  ## Example
7
6
 
@@ -18,19 +17,17 @@ picker)
18
17
 
19
18
  This component accepts the following arguments.
20
19
 
21
- | Name | Type | Required | Description |
22
- | ------------ | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
23
- | id | string | Yes | The ID of the input. |
24
- | name | string | Yes | The name of the input, which is submitted with the form data. |
25
- | value | string | No | Optional initial value of the input. |
26
- | formGroup | object | No | Additional options for the form group containing the text input component. See [formGroup](#options-date-picker-form-group). |
27
- | label | object | Yes | The label used by the text input component. See [GOV.UK text input documentation](https://design-system.service.gov.uk/components/text-input/) for label options. |
28
- | hint | object | No | Can be used to add a hint to a text input component. See [GOV.UK text input documentation](https://design-system.service.gov.uk/components/text-input/) for hint options. |
20
+ | Name | Type | Required | Description |
21
+ | ------------ | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
22
+ | id | string | Yes | The ID of the input. |
23
+ | name | string | Yes | The name of the input, which is submitted with the form data. |
24
+ | value | string | No | Optional initial value of the input. |
25
+ | formGroup | object | No | Additional options for the form group containing the text input component. See [formGroup](#options-date-picker-form-group). |
26
+ | label | object | Yes | The label used by the text input component. See [GOV.UK text input documentation](https://design-system.service.gov.uk/components/text-input/) for label options. |
27
+ | hint | object | No | Can be used to add a hint to a text input component. See [GOV.UK text input documentation](https://design-system.service.gov.uk/components/text-input/) for hint options. |
29
28
  | errorMessage | object | No | Can be used to add an error message to the text input component. The error message component will not display if you use a falsy value for `errorMessage`, for example `false` or `null`. See [GOV.UK text input documentation](https://design-system.service.gov.uk/components/text-input/) for errorMessage options. |
30
- | minDate | string | No | Earliest date that can be selected (format dd/mm/yyyy) |
31
- | maxDate | string | No | Latest date that can be selected (format dd/mm/yyyy) |
32
- | exludedDates | string | No | String of pace separated dates that cannot be selected |
33
- | excludedDays | string | No | String of space separated days of the week that cannot be selected |
34
- | weekStartDay | string | No | Day of the week the calendar starts on. Either 'monday' or 'sunday'. Defaults to 'monday' |
35
-
36
-
29
+ | minDate | string | No | Earliest date that can be selected (format dd/mm/yyyy) |
30
+ | maxDate | string | No | Latest date that can be selected (format dd/mm/yyyy) |
31
+ | exludedDates | string | No | String of pace separated dates that cannot be selected |
32
+ | excludedDays | string | No | String of space separated days of the week that cannot be selected |
33
+ | weekStartDay | string | No | Day of the week the calendar starts on. Either 'monday' or 'sunday'. Defaults to 'monday' |
@@ -10,14 +10,16 @@ $moj-datepicker-mid-grey: #949494;
10
10
  .moj-datepicker__dialog {
11
11
  display: none;
12
12
  position: absolute;
13
+ z-index: 2;
13
14
  top: 0;
14
15
  min-width: 280px;
15
16
  padding: govuk-spacing(4);
17
+ transition:
18
+ background-color 0.2s,
19
+ outline-color 0.2s;
16
20
  outline: 2px solid $govuk-text-colour;
17
21
  outline-offset: -2px;
18
- background-color: govuk-colour('white');
19
- transition: background-color 0.2s, outline-color 0.2s;
20
- z-index: 2;
22
+ background-color: govuk-colour("white");
21
23
  }
22
24
 
23
25
  .moj-datepicker__dialog--open {
@@ -25,18 +27,18 @@ $moj-datepicker-mid-grey: #949494;
25
27
  }
26
28
 
27
29
  .moj-datepicker__dialog-header {
28
- position: relative;
29
30
  display: flex;
31
+ position: relative;
32
+ margin-bottom: govuk-spacing(2);
30
33
  align-items: center;
31
34
  justify-content: space-between;
32
- margin-bottom: govuk-spacing(2);
33
35
  }
34
36
 
35
37
  .moj-datepicker__dialog-title {
36
38
  @include govuk-font(16);
37
- font-weight: bold;
38
39
  margin-top: 0;
39
40
  margin-bottom: 0;
41
+ font-weight: bold;
40
42
  }
41
43
 
42
44
  .moj-datepicker__dialog-navbuttons {
@@ -45,30 +47,29 @@ $moj-datepicker-mid-grey: #949494;
45
47
  }
46
48
 
47
49
  .moj-datepicker__calendar {
48
- border-collapse: collapse;
49
50
  margin-bottom: govuk-spacing(4);
51
+ border-collapse: collapse;
50
52
 
51
53
  tbody:focus-within {
52
54
  outline: 2px solid $govuk-focus-colour;
53
55
  }
54
56
 
55
57
  td {
56
- border: 0;
57
58
  margin: 0;
58
- outline: 0;
59
59
  padding: 0;
60
+ border: 0;
61
+ outline: 0;
60
62
  }
61
63
 
62
64
  th {
63
65
  @include govuk-font(16);
64
- font-weight: bold;
65
66
  color: $govuk-text-colour;
67
+ font-weight: bold;
66
68
  }
67
-
68
69
  }
69
70
 
70
71
  .moj-datepicker__dialog > .govuk-button-group {
71
- margin-bottom: 0;
72
+ margin-bottom: 0;
72
73
 
73
74
  > * {
74
75
  margin-bottom: 0;
@@ -77,111 +78,114 @@ $moj-datepicker-mid-grey: #949494;
77
78
 
78
79
  .moj-datepicker__button {
79
80
  @include govuk-font(16);
81
+ position: relative;
82
+ width: 44px;
83
+ height: 40px;
84
+ margin: 0;
85
+ padding: 0;
86
+ border-width: 0;
87
+ outline: 2px solid rgba(0, 0, 0, 0);
88
+ outline-offset: -2px;
89
+ color: $govuk-text-colour;
90
+ background-color: transparent;
91
+
92
+ @media (forced-colors: active) {
93
+ // Don't show the bottom bar in forced-color modes as it blocks the outline
94
+ &::after {
95
+ display: none;
96
+ }
97
+ }
98
+
99
+ &::after {
100
+ content: "";
101
+ position: absolute;
102
+ right: 0;
103
+ bottom: 0;
104
+ left: 0;
105
+ height: 4px;
80
106
  background-color: transparent;
81
- outline: 2px solid rgba(0, 0, 0, 0);
82
- outline-offset: -2px;
83
- border-width: 0;
107
+ }
108
+
109
+ &[aria-disabled="true"],
110
+ &[aria-disabled="true"]:hover {
84
111
  color: $govuk-text-colour;
85
- height: 40px;
86
- margin: 0;
87
- padding: 0;
88
- width: 44px;
89
- position: relative;
112
+ background-color: govuk-colour("light-grey");
113
+ text-decoration: line-through;
114
+ cursor: not-allowed;
115
+ }
90
116
 
91
- @media (forced-colors: active) {
92
- // Don't show the bottom bar in forced-color modes as it blocks the outline
93
- &:after {
94
- display: none
95
- }
96
- }
117
+ &:hover {
118
+ color: $govuk-text-colour;
119
+ background-color: $moj-datepicker-mid-grey;
120
+ text-decoration: none;
121
+ -webkit-box-decoration-break: clone;
122
+ box-decoration-break: clone;
123
+ cursor: pointer;
124
+ }
97
125
 
98
- &:after {
99
- content: "";
100
- position: absolute;
101
- bottom: 0px;
102
- height: 4px;
103
- left: 0;
104
- right: 0;
105
- background-color: transparent;
106
- }
126
+ &:focus {
127
+ outline-color: transparent;
128
+ color: $govuk-text-colour;
129
+ background-color: $govuk-focus-colour;
130
+ -webkit-box-decoration-break: clone;
131
+ box-decoration-break: clone;
107
132
 
108
- &[aria-disabled="true"],
109
- &[aria-disabled="true"]:hover {
110
- background-color: govuk-colour('light-grey');
111
- color: $govuk-text-colour;
112
- cursor: not-allowed;
113
- text-decoration: line-through;
133
+ &::after {
134
+ background-color: $govuk-text-colour;
114
135
  }
136
+ }
115
137
 
116
- &:hover {
117
- color: $govuk-text-colour;
118
- background-color: $moj-datepicker-mid-grey;
119
- text-decoration: none;
120
- -webkit-box-decoration-break: clone;
121
- box-decoration-break: clone;
122
- cursor: pointer;
123
- }
138
+ &:focus:hover {
139
+ outline-color: $govuk-focus-colour;
140
+ background-color: $moj-datepicker-mid-grey;
124
141
 
125
- &:focus {
126
- color: $govuk-text-colour;
127
- background-color: $govuk-focus-colour;
128
- outline-color: transparent;
129
- -webkit-box-decoration-break: clone;
130
- box-decoration-break: clone;
131
- &:after {
132
- background-color: $govuk-text-colour;
133
- }
142
+ &::after {
143
+ background-color: transparent;
134
144
  }
145
+ }
135
146
 
136
- &:focus:hover {
137
- background-color: $moj-datepicker-mid-grey;
138
- outline-color: $govuk-focus-colour;
139
- &:after {
140
- background-color: transparent;
141
- }
142
- }
147
+ &--current:not(:focus) {
148
+ outline-color: $govuk-link-colour;
149
+ color: govuk-colour("white");
150
+ background-color: $govuk-link-colour;
143
151
 
144
- &--current:not(:focus) {
152
+ &::after {
145
153
  background-color: $govuk-link-colour;
146
- color: govuk-colour('white');
147
- outline-color: $govuk-link-colour;
148
- &:after {
149
- background-color: $govuk-link-colour;
150
- }
151
154
  }
155
+ }
152
156
 
153
- &--current[tabindex="-1"] {
154
- background: transparent;
155
- color: currentColor;
156
- outline-color: transparent;
157
- &:after {
158
- background-color: transparent;
159
- }
160
- }
157
+ &--current[tabindex="-1"] {
158
+ outline-color: transparent;
159
+ color: currentcolor;
160
+ background: transparent;
161
161
 
162
- &--today {
163
- border: 2px solid $govuk-text-colour;
162
+ &::after {
163
+ background-color: transparent;
164
164
  }
165
+ }
165
166
 
166
- &--selected:not(:focus) {
167
- background-color: $govuk-link-colour;
168
- color: govuk-colour('white');
167
+ &--today {
168
+ border: 2px solid $govuk-text-colour;
169
+ }
169
170
 
170
- &:after {
171
- background-color: $govuk-link-colour;
172
- }
171
+ &--selected:not(:focus) {
172
+ color: govuk-colour("white");
173
+ background-color: $govuk-link-colour;
173
174
 
174
- &:hover {
175
- outline-color: $govuk-link-colour;
176
- background-color: $moj-datepicker-mid-grey;
177
- color: $govuk-text-colour;
175
+ &::after {
176
+ background-color: $govuk-link-colour;
177
+ }
178
178
 
179
- &:after {
180
- background-color: transparent;
181
- }
179
+ &:hover {
180
+ outline-color: $govuk-link-colour;
181
+ color: $govuk-text-colour;
182
+ background-color: $moj-datepicker-mid-grey;
183
+
184
+ &::after {
185
+ background-color: transparent;
182
186
  }
183
187
  }
184
-
188
+ }
185
189
  }
186
190
 
187
191
  /*
@@ -189,6 +193,7 @@ $moj-datepicker-mid-grey: #949494;
189
193
  Allow that to be overriden by the input width modifiers or global width overrides.
190
194
  Width classes less than 10ch not included as that is narrower than a date.
191
195
  */
196
+ // stylelint-disable selector-no-qualifying-type
192
197
  .moj-datepicker input {
193
198
  max-width: 11.5em; // govuk-input--width-10
194
199
 
@@ -201,61 +206,72 @@ $moj-datepicker-mid-grey: #949494;
201
206
  }
202
207
 
203
208
  &.govuk-\!-width-full {
209
+ // stylelint-disable-next-line declaration-no-important
204
210
  width: 100% !important;
205
211
  max-width: none;
206
212
  }
207
213
 
208
214
  &.govuk-\!-width-three-quarters {
215
+ // stylelint-disable-next-line declaration-no-important
209
216
  width: 100% !important;
210
217
  max-width: none;
211
218
 
212
219
  @include govuk-media-query($from: tablet) {
220
+ // stylelint-disable-next-line declaration-no-important
213
221
  width: 75% !important;
214
222
  }
215
223
  }
216
224
 
217
225
  &.govuk-\!-width-two-thirds {
226
+ // stylelint-disable-next-line declaration-no-important
218
227
  width: 100% !important;
219
228
  max-width: none;
220
229
 
221
230
  @include govuk-media-query($from: tablet) {
231
+ // stylelint-disable-next-line declaration-no-important
222
232
  width: 66.66% !important;
223
233
  }
224
234
  }
225
235
 
226
236
  &.govuk-\!-width-one-half {
237
+ // stylelint-disable-next-line declaration-no-important
227
238
  width: 100% !important;
228
239
  max-width: none;
229
240
 
230
241
  @include govuk-media-query($from: tablet) {
242
+ // stylelint-disable-next-line declaration-no-important
231
243
  width: 50% !important;
232
244
  }
233
245
  }
234
246
 
235
247
  &.govuk-\!-width-one-third {
248
+ // stylelint-disable-next-line declaration-no-important
236
249
  width: 100% !important;
237
250
  max-width: none;
238
251
 
239
252
  @include govuk-media-query($from: tablet) {
253
+ // stylelint-disable-next-line declaration-no-important
240
254
  width: 33.33% !important;
241
255
  }
242
256
  }
243
257
 
244
258
  &.govuk-\!-width-one-quarter {
259
+ // stylelint-disable-next-line declaration-no-important
245
260
  width: 100% !important;
246
261
  max-width: none;
247
262
 
248
263
  @include govuk-media-query($from: tablet) {
264
+ // stylelint-disable-next-line declaration-no-important
249
265
  width: 25% !important;
250
266
  }
251
267
  }
252
268
  }
269
+ // stylelint-enable selector-no-qualifying-type
253
270
 
254
271
  .moj-datepicker__wrapper {
255
272
  position: relative;
256
273
  }
257
274
 
258
-
259
275
  @media (min-width: 768px) {
260
276
  .moj-datepicker__dialog {
261
277
  width: auto;
@@ -263,31 +279,31 @@ $moj-datepicker-mid-grey: #949494;
263
279
  }
264
280
 
265
281
  .moj-datepicker__toggle {
266
- background-color: $govuk-text-colour;
267
- color: govuk-colour('white');
268
- outline: 3px solid rgba(0, 0, 0, 0);
269
- outline-offset: -3px;
270
282
  height: 40px;
271
283
  padding-top: 6px;
272
284
  border: none;
273
285
  border-bottom: 4px solid rgba(0, 0, 0, 0);
286
+ outline: 3px solid rgba(0, 0, 0, 0);
287
+ outline-offset: -3px;
288
+ color: govuk-colour("white");
289
+ background-color: $govuk-text-colour;
274
290
  cursor: pointer;
275
291
 
276
292
  &:focus {
277
- background-color: $govuk-focus-colour;
278
- color: $govuk-text-colour;
279
293
  border-bottom: 4px solid $govuk-text-colour;
294
+ color: $govuk-text-colour;
295
+ background-color: $govuk-focus-colour;
280
296
  }
281
297
 
282
298
  &:hover {
283
- background-color: $moj-datepicker-mid-grey;
284
- color: $govuk-text-colour;
285
299
  border-bottom: 4px solid $moj-datepicker-mid-grey;
300
+ color: $govuk-text-colour;
301
+ background-color: $moj-datepicker-mid-grey;
286
302
  }
287
303
 
288
304
  &:focus:hover {
289
- background-color: $moj-datepicker-mid-grey;
290
- color: $govuk-text-colour;
291
305
  border-bottom: 4px solid $govuk-text-colour;
306
+ color: $govuk-text-colour;
307
+ background-color: $moj-datepicker-mid-grey;
292
308
  }
293
309
  }