@ministryofjustice/frontend 3.7.0 → 4.0.1

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 (87) hide show
  1. package/govuk-prototype-kit.config.json +44 -32
  2. package/moj/_base.scss +8 -0
  3. package/moj/all.jquery.min.js +1 -1
  4. package/moj/all.jquery.min.js.map +1 -1
  5. package/moj/all.js +7 -7
  6. package/moj/all.js.map +1 -1
  7. package/moj/all.scss +4 -9
  8. package/moj/components/_all.scss +33 -33
  9. package/moj/components/action-bar/_action-bar.scss +2 -0
  10. package/moj/components/add-another/_add-another.scss +2 -0
  11. package/moj/components/alert/_alert.scss +18 -15
  12. package/moj/components/alert/template.njk +1 -1
  13. package/moj/components/badge/README.md +1 -1
  14. package/moj/components/badge/_badge.scss +3 -1
  15. package/moj/components/badge/macro.njk +1 -1
  16. package/moj/components/banner/README.md +3 -0
  17. package/moj/components/banner/_banner.scss +3 -1
  18. package/moj/components/button-menu/README.md +2 -2
  19. package/moj/components/button-menu/_button-menu.scss +15 -18
  20. package/moj/components/button-menu/template.njk +7 -9
  21. package/moj/components/cookie-banner/_cookie-banner.scss +3 -2
  22. package/moj/components/currency-input/README.md +4 -4
  23. package/moj/components/currency-input/_currency-input.scss +3 -1
  24. package/moj/components/date-picker/README.md +1 -1
  25. package/moj/components/date-picker/_date-picker.scss +11 -12
  26. package/moj/components/filter/_filter.scss +7 -4
  27. package/moj/components/form-validator/README.md +2 -4
  28. package/moj/components/header/README.md +1 -1
  29. package/moj/components/header/_header.scss +9 -6
  30. package/moj/components/header/template.njk +2 -2
  31. package/moj/components/identity-bar/_identity-bar.scss +5 -2
  32. package/moj/components/interruption-card/_interruption-card.scss +3 -1
  33. package/moj/components/messages/README.md +15 -10
  34. package/moj/components/messages/_messages.scss +4 -2
  35. package/moj/components/multi-file-upload/_multi-file-upload.scss +2 -0
  36. package/moj/components/multi-file-upload/multi-file-upload.js +6 -6
  37. package/moj/components/multi-file-upload/multi-file-upload.js.map +1 -1
  38. package/moj/components/multi-file-upload/multi-file-upload.mjs +6 -6
  39. package/moj/components/multi-file-upload/multi-file-upload.mjs.map +1 -1
  40. package/moj/components/notification-badge/_notification-badge.scss +3 -2
  41. package/moj/components/organisation-switcher/_organisation-switcher.scss +3 -1
  42. package/moj/components/page-header-actions/_page-header-actions.scss +2 -0
  43. package/moj/components/pagination/_pagination.scss +13 -5
  44. package/moj/components/password-reveal/README.md +2 -2
  45. package/moj/components/password-reveal/_password-reveal.scss +2 -0
  46. package/moj/components/primary-navigation/README.md +1 -1
  47. package/moj/components/primary-navigation/_primary-navigation.scss +14 -5
  48. package/moj/components/progress-bar/_progress-bar.scss +5 -2
  49. package/moj/components/rich-text-editor/README.md +4 -4
  50. package/moj/components/rich-text-editor/_rich-text-editor.scss +3 -0
  51. package/moj/components/search/_search.scss +2 -0
  52. package/moj/components/search-toggle/search-toggle.scss +3 -1
  53. package/moj/components/side-navigation/README.md +1 -1
  54. package/moj/components/side-navigation/_side-navigation.scss +3 -1
  55. package/moj/components/sortable-table/_sortable-table.scss +2 -0
  56. package/moj/components/sub-navigation/README.md +1 -1
  57. package/moj/components/sub-navigation/_sub-navigation.scss +12 -4
  58. package/moj/components/tag/README.md +2 -2
  59. package/moj/components/tag/_tag.scss +2 -0
  60. package/moj/components/task-list/README.md +3 -3
  61. package/moj/components/task-list/_task-list.scss +4 -2
  62. package/moj/components/ticket-panel/README.md +1 -1
  63. package/moj/components/ticket-panel/_ticket-panel.scss +2 -0
  64. package/moj/components/timeline/README.md +15 -10
  65. package/moj/components/timeline/_timeline.scss +7 -4
  66. package/moj/helpers/_all.scss +2 -2
  67. package/moj/helpers/_links.scss +4 -2
  68. package/moj/moj-frontend.min.css +1 -2
  69. package/moj/moj-frontend.min.css.map +1 -1
  70. package/moj/moj-frontend.min.js +1 -1
  71. package/moj/moj-frontend.min.js.map +1 -1
  72. package/moj/objects/_all.scss +4 -4
  73. package/moj/objects/_button-group.scss +94 -13
  74. package/moj/objects/_filter-layout.scss +2 -0
  75. package/moj/objects/_scrollable-pane.scss +2 -0
  76. package/moj/objects/_width-container.scss +3 -0
  77. package/moj/settings/_all.scss +4 -3
  78. package/moj/settings/_assets.scss +5 -2
  79. package/moj/settings/_colours.scss +5 -0
  80. package/moj/settings/_measurements.scss +3 -1
  81. package/moj/settings/_typography.scss +13 -0
  82. package/moj/utilities/_all.scss +2 -2
  83. package/moj/utilities/_hidden.scss +2 -0
  84. package/moj/utilities/_width-container.scss +2 -0
  85. package/moj/vendor/govuk-frontend/_base.scss +5 -0
  86. package/moj/vendor/govuk-frontend/_index.scss +21 -0
  87. package/package.json +3 -1
@@ -1,15 +1,15 @@
1
- # Rich text editor
1
+ # Rich text editor (Archived)
2
2
 
3
- - [Guidance](https://design-patterns.service.justice.gov.uk/components/rich-text-editor)
3
+ - [Guidance](https://design-patterns.service.justice.gov.uk/archive/rich-text-editor)
4
4
 
5
5
  ## Example
6
6
 
7
- ```
7
+ ```html
8
8
  <script>
9
9
  new MOJFrontend.RichTextEditor({
10
10
  textarea: $('.js-editor'),
11
11
  toolbar: { 'bold': true, 'italic': true, 'underline': true, 'bullets': true, 'numbers': true }
12
- });
12
+ })
13
13
  </script>
14
14
  ```
15
15
 
@@ -1,3 +1,6 @@
1
+ @use "../../settings/assets" as *;
2
+ @use "../../vendor/govuk-frontend" as *;
3
+
1
4
  /* ==========================================================================
2
5
  #RICH TEXT EDITOR
3
6
  ========================================================================== */
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  .moj-search {
2
4
  font-size: 0; // Fallback
3
5
  }
@@ -1,5 +1,6 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  .moj-search-toggle__button {
2
- @include govuk-font($size: 19, $weight: bold);
3
4
  display: inline-block;
4
5
  padding-top: 12px;
5
6
  padding-right: 0;
@@ -12,6 +13,7 @@
12
13
  -webkit-font-smoothing: antialiased;
13
14
  -webkit-appearance: none;
14
15
  appearance: none;
16
+ @include govuk-font($size: 19, $weight: bold);
15
17
 
16
18
  &__icon {
17
19
  display: inline-block;
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Example
6
6
 
7
- ```
7
+ ```njk
8
8
  {{ mojSideNavigation({
9
9
  label: 'Side navigation',
10
10
  items: [{
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  /* ==========================================================================
2
4
  #SIDE NAVIGATION
3
5
  ========================================================================== */
@@ -17,12 +19,12 @@
17
19
  }
18
20
 
19
21
  .moj-side-navigation__title {
20
- @include govuk-font($size: 19);
21
22
  margin: 0;
22
23
  padding: govuk-spacing(2);
23
24
  padding-left: govuk-spacing(2) + 4px;
24
25
  color: govuk-colour("dark-grey");
25
26
  font-weight: normal;
27
+ @include govuk-font($size: 19);
26
28
 
27
29
  @include govuk-media-query($until: tablet) {
28
30
  display: none;
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  [aria-sort] button,
2
4
  [aria-sort] button:hover {
3
5
  position: relative;
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Example
6
6
 
7
- ```
7
+ ```njk
8
8
  {{ mojSubNavigation({
9
9
  label: 'Sub navigation',
10
10
  items: [{
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  /* ==========================================================================
2
4
  #SECONDARY NAV
3
5
  ========================================================================== */
@@ -19,10 +21,10 @@
19
21
  }
20
22
 
21
23
  .moj-sub-navigation__item {
22
- @include govuk-font(19);
23
24
  display: block;
24
25
  margin-top: -1px;
25
26
  box-shadow: inset 0 -1px 0 $govuk-border-colour;
27
+ @include govuk-font(19);
26
28
 
27
29
  &:last-child {
28
30
  box-shadow: none;
@@ -37,19 +39,25 @@
37
39
  }
38
40
 
39
41
  .moj-sub-navigation__link {
40
- @include govuk-link-common;
41
- @include govuk-link-style-default;
42
42
  display: block;
43
43
  position: relative;
44
44
  padding-top: 12px;
45
45
  padding-bottom: 12px;
46
46
  padding-left: govuk-spacing(3);
47
- text-decoration: none;
47
+ @include govuk-link-common;
48
+ @include govuk-link-style-default;
48
49
 
49
50
  @include govuk-media-query($from: tablet) {
50
51
  padding-left: 0;
51
52
  }
52
53
 
54
+ &:link,
55
+ &:visited,
56
+ &:hover,
57
+ &:active {
58
+ text-decoration: none;
59
+ }
60
+
53
61
  &:link,
54
62
  &:visited {
55
63
  color: $govuk-link-colour;
@@ -1,6 +1,6 @@
1
- # Badge
1
+ # Badge (Archived)
2
2
 
3
- - [Guidance](https://design-patterns.service.justice.gov.uk/components/tag)
3
+ - [Guidance](https://design-patterns.service.justice.gov.uk/archive/tag)
4
4
 
5
5
  ## Classes
6
6
 
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  /* ==========================================================================
2
4
  #TAG
3
5
  ========================================================================== */
@@ -1,10 +1,10 @@
1
- # Task list
1
+ # Task list (Archived)
2
2
 
3
- - [Guidance](https://design-patterns.service.justice.gov.uk/patterns/task-list)
3
+ - [Guidance](https://design-patterns.service.justice.gov.uk/archive/task-list)
4
4
 
5
5
  ## Example
6
6
 
7
- ```
7
+ ```njk
8
8
  {{ mojTaskList({
9
9
  sections: [
10
10
  {
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  /* ==========================================================================
2
4
  #TASK LIST
3
5
  ========================================================================== */
@@ -27,10 +29,10 @@
27
29
  }
28
30
 
29
31
  .moj-task-list__items {
30
- @include govuk-font($size: 19);
31
- @include govuk-responsive-margin(9, "bottom");
32
32
  padding-left: 0;
33
33
  list-style: none;
34
+ @include govuk-font($size: 19);
35
+ @include govuk-responsive-margin(9, "bottom");
34
36
  @include govuk-media-query($from: tablet) {
35
37
  padding-left: govuk-spacing(6);
36
38
  }
@@ -6,7 +6,7 @@
6
6
 
7
7
  Below is a typical example of the timeline component in use.
8
8
 
9
- ```
9
+ ```njk
10
10
  {{ mojTicketPanel({
11
11
  attributes: {
12
12
  'aria-label': 'Sub navigation 1'
@@ -1,3 +1,5 @@
1
+ @use "../../vendor/govuk-frontend" as *;
2
+
1
3
  /* ==========================================================================
2
4
  #TICKET PANEL
3
5
  ========================================================================== */
@@ -4,22 +4,27 @@
4
4
 
5
5
  ### Installation
6
6
 
7
- You will need to install the following code at the bottom of `server.js`, just above `module.exports = app;`
7
+ You will need to install the MoJ Frontend Nunjucks filters to use the `mojTimeline()` Nunjucks macro:
8
8
 
9
- ```
10
- // Add filters from MOJ Frontend
11
- let mojFilters = require('./node_modules/@ministryofjustice/frontend/filters/all')();
12
- mojFilters = Object.assign(mojFilters);
13
- Object.keys(mojFilters).forEach(function (filterName) {
14
- nunjucksAppEnv.addFilter(filterName, mojFilters[filterName])
15
- });
16
- ```
9
+ 1. Import the filters
10
+
11
+ ```mjs
12
+ import mojFilters from '@ministryofjustice/frontend/moj/filters/all.js'
13
+ ```
14
+
15
+ 2. Add the filters to your Nunjucks environment
16
+
17
+ ```mjs
18
+ for (const [name, filter] of Object.entries(mojFilters())) {
19
+ nunjucksAppEnv.addFilter(name, filter)
20
+ }
21
+ ```
17
22
 
18
23
  ## Example
19
24
 
20
25
  Below is a typical example of the timeline component in use.
21
26
 
22
- ```
27
+ ```njk
23
28
  {{ mojTimeline({
24
29
  items: [
25
30
  {
@@ -1,3 +1,6 @@
1
+ @use "../../settings/assets" as *;
2
+ @use "../../vendor/govuk-frontend" as *;
3
+
1
4
  /* ==========================================================================
2
5
  #TIMELINE
3
6
  ========================================================================== */
@@ -43,26 +46,26 @@
43
46
  }
44
47
 
45
48
  .moj-timeline__title {
46
- @include govuk-font($size: 19, $weight: bold);
47
49
  display: inline;
50
+ @include govuk-font($size: 19, $weight: bold);
48
51
  }
49
52
 
50
53
  .moj-timeline__byline {
51
- @include govuk-font($size: 19);
52
54
  display: inline;
53
55
  margin: 0;
54
56
  color: $govuk-secondary-text-colour;
57
+ @include govuk-font($size: 19);
55
58
  }
56
59
 
57
60
  .moj-timeline__date {
58
- @include govuk-font($size: 16);
59
61
  margin-top: govuk-spacing(1);
60
62
  margin-bottom: 0;
63
+ @include govuk-font($size: 16);
61
64
  }
62
65
 
63
66
  .moj-timeline__description {
64
- @include govuk-font($size: 19);
65
67
  margin-top: govuk-spacing(4);
68
+ @include govuk-font($size: 19);
66
69
  }
67
70
 
68
71
  /* ==========================================================================
@@ -1,2 +1,2 @@
1
- @import "hidden";
2
- @import "links";
1
+ @forward "hidden";
2
+ @forward "links";
@@ -1,4 +1,6 @@
1
- @import "../settings/colours";
1
+ @use "sass:color";
2
+ @use "../settings/colours" as *;
3
+ @use "../vendor/govuk-frontend" as *;
2
4
 
3
5
  @mixin moj-link-style-warning {
4
6
  &:link,
@@ -7,7 +9,7 @@
7
9
  }
8
10
 
9
11
  &:hover {
10
- color: scale-color($moj-warning-link-colour, $lightness: -30%);
12
+ color: color.scale($moj-warning-link-colour, $lightness: -30%);
11
13
  }
12
14
 
13
15
  &:active {