@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,4 +1,4 @@
1
- @import "width-container";
2
- @import "filter-layout";
3
- @import "scrollable-pane";
4
- @import "button-group";
1
+ @forward "width-container";
2
+ @forward "filter-layout";
3
+ @forward "scrollable-pane";
4
+ @forward "button-group";
@@ -1,31 +1,112 @@
1
+ @use "../vendor/govuk-frontend" as *;
2
+
3
+ // Button groups can be used to group buttons and links together as a group.
4
+ //
5
+ // Within a button group:
6
+ //
7
+ // - links are styled to line up visually with the buttons, including being
8
+ // centre-aligned on mobile
9
+ // - spacing between the buttons and links is handled automatically, including
10
+ // when they wrap across multiple lines
1
11
  .moj-button-group {
2
12
  $horizontal-gap: govuk-spacing(3);
3
13
  $vertical-gap: govuk-spacing(3);
14
+ $link-spacing: govuk-spacing(1);
15
+
16
+ // These need to be kept in sync with the button component's styles
4
17
  $button-shadow-size: $govuk-border-width-form-element;
5
18
 
6
- @extend .govuk-button-group;
19
+ // Flexbox is used to center-align links on mobile, align everything along
20
+ // the baseline on tablet and above, and to removes extra whitespace that
21
+ // we'd get between the buttons and links because they're inline-blocks.
22
+ //
23
+ // Ideally we'd use `gap` with flexbox rather than having to do it all with
24
+ // margins, but unfortunately the support isn't there (yet) and @supports
25
+ // doesn't play nicely with it
26
+ // (https://github.com/w3c/csswg-drafts/issues/3559)
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+
31
+ @include govuk-responsive-margin(6, "bottom", $adjustment: $vertical-gap * -1);
32
+
33
+ // Give links within the button group the same font-size and line-height
34
+ // as buttons.
35
+ //
36
+ // Because we want the focus state to be tight around the link text, we use
37
+ // margins where the buttons would use padding.
38
+ .govuk-link {
39
+ display: inline-block;
40
+ // Prevent links overflowing their container in IE10/11 because of bug
41
+ // with align-items: center
42
+ max-width: 100%;
43
+ margin-top: $link-spacing;
44
+ margin-bottom: $link-spacing + $vertical-gap;
45
+ text-align: center;
46
+ @include govuk-font($size: 19, $line-height: 19px);
47
+ }
48
+
49
+ // Reduce the bottom margin to the size of the vertical gap (accommodating
50
+ // the button shadow) – the 'lost' margin is moved to the button-group.
51
+ .govuk-button,
52
+ .moj-button-menu__item,
53
+ .js-enabled & .moj-button-menu {
54
+ margin-bottom: $vertical-gap + $button-shadow-size;
55
+ }
56
+
57
+ .moj-button-menu__toggle-button,
58
+ .js-enabled & .moj-button-menu__item {
59
+ margin-bottom: 0;
60
+ }
61
+
62
+ // Set button menu to full width on mobile to match GOV.UK Frontend
63
+ @include govuk-media-query($until: tablet) {
64
+ .moj-button-menu,
65
+ .moj-button-menu__wrapper,
66
+ .moj-button-menu__item {
67
+ width: 100%;
68
+ }
69
+
70
+ .moj-button-menu__wrapper {
71
+ position: relative;
72
+ }
73
+ }
74
+
75
+ // On tablet and above, we also introduce a 'column gap' between the
76
+ // buttons and links in each row and left align links
77
+ @mixin moj-button-group-inline() {
78
+ // Cancel out the column gap for the last item in each row
79
+ margin-right: ($horizontal-gap * -1);
7
80
 
8
- &--inline {
9
81
  flex-direction: row;
10
82
  flex-wrap: wrap;
11
83
  align-items: baseline;
12
- gap: $horizontal-gap;
13
- margin-right: 0;
14
84
 
85
+ .govuk-button,
86
+ .govuk-link,
15
87
  .moj-button-menu {
16
- margin-bottom: $vertical-gap + $button-shadow-size;
88
+ width: auto;
89
+ margin-right: $horizontal-gap;
17
90
  }
18
91
 
19
- .moj-button-menu .moj-button-menu__toggle-button {
20
- vertical-align: baseline;
92
+ .moj-button-menu__toggle-button {
93
+ margin-right: 0;
21
94
  }
22
95
 
23
- > .moj-button-menu,
24
- > .govuk-button,
25
- > .govuk-link {
26
- width: auto;
27
- margin-right: 0;
28
- margin-bottom: 0;
96
+ .govuk-link {
97
+ text-align: left;
29
98
  }
30
99
  }
100
+
101
+ // Inline buttons on mobile (optional)
102
+ &--inline {
103
+ @include govuk-media-query($until: tablet) {
104
+ @include moj-button-group-inline;
105
+ }
106
+ }
107
+
108
+ // Inline buttons on tablet and desktop
109
+ @include govuk-media-query($from: tablet) {
110
+ @include moj-button-group-inline;
111
+ }
31
112
  }
@@ -1,3 +1,5 @@
1
+ @use "../vendor/govuk-frontend" as *;
2
+
1
3
  .moj-filter-layout {
2
4
  @include govuk-clearfix;
3
5
  }
@@ -1,3 +1,5 @@
1
+ @use "../vendor/govuk-frontend" as *;
2
+
1
3
  .moj-scrollable-pane {
2
4
  // stylelint-disable scss/dollar-variable-pattern
3
5
  $scrollableBgColor: govuk-colour("white");
@@ -1,3 +1,6 @@
1
+ @use "../settings/measurements" as *;
2
+ @use "../vendor/govuk-frontend" as *;
3
+
1
4
  @mixin moj-width-container($width: $moj-page-width) {
2
5
  // Limit the width of the container to the page width
3
6
  max-width: $width;
@@ -1,3 +1,4 @@
1
- @import "assets";
2
- @import "measurements";
3
- @import "colours";
1
+ @forward "assets";
2
+ @forward "measurements";
3
+ @forward "colours";
4
+ @forward "typography";
@@ -2,8 +2,11 @@
2
2
  #ASSETS
3
3
  ========================================================================== */
4
4
 
5
- // Assets folder
5
+ // Path to the assets directory, with trailing slash.
6
6
  $moj-assets-path: "/assets/" !default;
7
7
 
8
- // Path the images folder
8
+ // Path to the images folder, with trailing slash.
9
9
  $moj-images-path: "#{$moj-assets-path}images/" !default;
10
+
11
+ // Path to the fonts folder, with trailing slash.
12
+ $moj-fonts-path: "#{$moj-assets-path}fonts/" !default;
@@ -12,3 +12,8 @@ $moj-secondary-link-hover-color: rgb(23, 24, 25);
12
12
  $moj-warning-colour: rgb(235, 97, 28);
13
13
  // Links need higher contrast still so a modified orange for links
14
14
  $moj-warning-link-colour: rgb(199, 82, 40);
15
+
16
+ // Custom colour required for passing WCAG 2.2 AA contrast text/background and
17
+ // background/surrounding
18
+ $moj-button-menu-color: #949494;
19
+ $moj-button-menu-hover-color: #767676;
@@ -1,3 +1,5 @@
1
+ @use "sass:math";
2
+
1
3
  /* ==========================================================================
2
4
  #MEASUREMENTS
3
5
  ========================================================================== */
@@ -9,4 +11,4 @@ $moj-page-width: 960px !default;
9
11
  $moj-gutter: 30px !default;
10
12
 
11
13
  // Width of half the gutter between grid columns
12
- $moj-gutter-half: $moj-gutter / 2;
14
+ $moj-gutter-half: math.div($moj-gutter, 2);
@@ -0,0 +1,13 @@
1
+ @use "sass:list";
2
+
3
+ /* ==========================================================================
4
+ #TYPOGRAPHY
5
+ ========================================================================== */
6
+
7
+ /// Font families to use for all typography on screen media
8
+
9
+ $moj-font-family: "GDS Transport", arial, sans-serif !default;
10
+
11
+ /// Exclude @font-face declarations already included in GOV.UK Frontend
12
+
13
+ $moj-include-default-font-face: false;
@@ -1,2 +1,2 @@
1
- @import "hidden";
2
- @import "width-container";
1
+ @forward "hidden";
2
+ @forward "width-container";
@@ -1,3 +1,5 @@
1
+ @use "../helpers/hidden" as *;
2
+
1
3
  .js-enabled .moj-js-hidden {
2
4
  @include moj-hidden;
3
5
  }
@@ -1,3 +1,5 @@
1
+ @use "../objects/width-container" as *;
2
+
1
3
  .moj-width-container {
2
4
  @include moj-width-container;
3
5
  }
@@ -0,0 +1,5 @@
1
+ @forward "node_modules/govuk-frontend/dist/govuk/base" with (
2
+ $govuk-suppressed-warnings: (
3
+ "govuk-typography-scale-14"
4
+ )
5
+ );
@@ -0,0 +1,21 @@
1
+ // Declare all settings
2
+ @forward "../../settings/all";
3
+
4
+ // Use settings for overrides
5
+ @use "../../settings/all" as *;
6
+
7
+ // GOV.UK Frontend with settings
8
+ @forward "base" with (
9
+ // Assets override
10
+ $govuk-assets-path: $moj-assets-path,
11
+ $govuk-images-path: $moj-images-path,
12
+ $govuk-fonts-path: $moj-fonts-path,
13
+
14
+ // Measurements override
15
+ $govuk-gutter: $moj-gutter,
16
+ $govuk-page-width: $moj-page-width,
17
+
18
+ // Typography override
19
+ $govuk-font-family: $moj-font-family,
20
+ $govuk-include-default-font-face: $moj-include-default-font-face
21
+ );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ministryofjustice/frontend",
3
3
  "description": "The MOJ Frontend contains the code you need to start building user interfaces for UK Ministry of Justice government services.",
4
- "version": "3.7.0",
4
+ "version": "4.0.1",
5
5
  "main": "moj/all.js",
6
6
  "module": "moj/all.mjs",
7
7
  "sass": "moj/all.scss",
@@ -13,6 +13,8 @@
13
13
  "default": "./moj/all.js"
14
14
  },
15
15
  "./*": "./*",
16
+ "./moj/filters/*": "./moj/filters/*.js",
17
+ "./moj/filters/*.js": "./moj/filters/*.js",
16
18
  "./package.json": "./package.json"
17
19
  },
18
20
  "sideEffects": false,