@ministryofjustice/frontend 1.8.0 → 2.0.0-beta.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 (93) hide show
  1. package/govuk-prototype-kit.config.json +8 -0
  2. package/moj/all-ie8.scss +0 -0
  3. package/moj/all.jquery.min.js +1 -1
  4. package/moj/all.js +86 -86
  5. package/moj/all.scss +0 -2
  6. package/moj/assets/images/icon-alert-information.svg +0 -0
  7. package/moj/assets/images/icon-alert-success.svg +0 -0
  8. package/moj/assets/images/icon-alert-warning.svg +0 -0
  9. package/moj/assets/images/icon-arrow-black-down.svg +0 -0
  10. package/moj/assets/images/icon-arrow-black-up.svg +0 -0
  11. package/moj/assets/images/icon-arrow-white-down.svg +0 -0
  12. package/moj/assets/images/icon-arrow-white-up.svg +0 -0
  13. package/moj/assets/images/icon-close-cross-black.svg +0 -0
  14. package/moj/assets/images/icon-document.png +0 -0
  15. package/moj/assets/images/icon-document.svg +0 -0
  16. package/moj/assets/images/icon-progress-tick.png +0 -0
  17. package/moj/assets/images/icon-progress-tick.svg +0 -0
  18. package/moj/assets/images/icon-search-white.svg +0 -0
  19. package/moj/assets/images/icon-tag-remove-cross-white.svg +0 -0
  20. package/moj/assets/images/icon-tag-remove-cross.svg +0 -0
  21. package/moj/assets/images/icon-toggle-plus-minus.svg +0 -0
  22. package/moj/assets/images/icon-wysiwyg-bold.svg +0 -0
  23. package/moj/assets/images/icon-wysiwyg-italic.svg +0 -0
  24. package/moj/assets/images/icon-wysiwyg-ordered-list.svg +0 -0
  25. package/moj/assets/images/icon-wysiwyg-underline.svg +0 -0
  26. package/moj/assets/images/icon-wysiwyg-unordered-list.svg +0 -0
  27. package/moj/assets/images/moj-apple-touch-icon-152x152.png +0 -0
  28. package/moj/assets/images/moj-apple-touch-icon-167x167.png +0 -0
  29. package/moj/assets/images/moj-apple-touch-icon-180x180.png +0 -0
  30. package/moj/assets/images/moj-apple-touch-icon.png +0 -0
  31. package/moj/assets/images/moj-logotype-crest.png +0 -0
  32. package/moj/assets/images/moj-logotype-crest.svg +0 -0
  33. package/moj/assets/images/moj-opengraph-image.png +0 -0
  34. package/moj/components/_all.scss +0 -0
  35. package/moj/components/add-another/README.md +0 -0
  36. package/moj/components/add-another/_add-another.scss +0 -0
  37. package/moj/components/add-another/add-another.js +0 -0
  38. package/moj/components/cookie-banner/README.md +0 -0
  39. package/moj/components/cookie-banner/_cookie-banner.scss +0 -2
  40. package/moj/components/form-validator/README.md +0 -0
  41. package/moj/components/form-validator/form-validator.js +0 -0
  42. package/moj/components/pagination/README.md +0 -0
  43. package/moj/components/pagination/_pagination.scss +0 -0
  44. package/moj/components/pagination/macro.njk +0 -0
  45. package/moj/components/pagination/template.njk +0 -0
  46. package/moj/components/password-reveal/password-reveal.js +1 -1
  47. package/moj/components/progress-bar/README.md +0 -0
  48. package/moj/components/progress-bar/_progress-bar.scss +0 -0
  49. package/moj/components/progress-bar/macro.njk +0 -0
  50. package/moj/components/progress-bar/template.njk +0 -0
  51. package/moj/components/rich-text-editor/README.md +0 -0
  52. package/moj/components/rich-text-editor/_rich-text-editor.scss +0 -0
  53. package/moj/components/rich-text-editor/rich-text-editor.js +0 -0
  54. package/moj/components/search/README.md +0 -0
  55. package/moj/components/search/_search.scss +0 -0
  56. package/moj/components/search/macro.njk +0 -0
  57. package/moj/components/search/template.njk +0 -0
  58. package/moj/components/search-toggle/README.md +0 -0
  59. package/moj/components/sortable-table/README.md +0 -0
  60. package/moj/components/sortable-table/_sortable-table.scss +0 -0
  61. package/moj/components/sortable-table/sortable-table.js +0 -0
  62. package/moj/components/sub-navigation/README.md +0 -0
  63. package/moj/components/sub-navigation/_sub-navigation.scss +0 -0
  64. package/moj/components/sub-navigation/macro.njk +0 -0
  65. package/moj/components/sub-navigation/template.njk +0 -0
  66. package/moj/components/ticket-panel/README.md +0 -0
  67. package/moj/components/ticket-panel/_ticket-panel.scss +0 -0
  68. package/moj/components/ticket-panel/macro.njk +0 -0
  69. package/moj/components/ticket-panel/template.njk +0 -0
  70. package/moj/components/timeline/README.md +0 -0
  71. package/moj/components/timeline/_timeline.scss +0 -0
  72. package/moj/components/timeline/macro.njk +0 -0
  73. package/moj/components/timeline/template.njk +0 -0
  74. package/moj/helpers/_all.scss +1 -0
  75. package/moj/helpers/_hidden.scss +0 -0
  76. package/moj/helpers/_ie8.scss +5 -0
  77. package/moj/helpers.js +0 -0
  78. package/moj/namespace.js +0 -0
  79. package/moj/objects/_all.scss +0 -0
  80. package/moj/objects/_filter-layout.scss +0 -0
  81. package/moj/objects/_scrollable-pane.scss +0 -0
  82. package/moj/objects/_width-container.scss +0 -0
  83. package/moj/settings/_all.scss +1 -0
  84. package/moj/settings/_assets.scss +0 -0
  85. package/moj/settings/_colours.scss +0 -0
  86. package/moj/settings/_ie8.scss +1 -0
  87. package/moj/settings/_measurements.scss +0 -0
  88. package/moj/utilities/_all.scss +0 -0
  89. package/moj/utilities/_hidden.scss +0 -0
  90. package/moj/utilities/_width-container.scss +0 -0
  91. package/moj/vendor/html5shiv.js +0 -0
  92. package/moj/vendor/jquery.js +0 -0
  93. package/package.json +2 -2
package/moj/all.js CHANGED
@@ -369,91 +369,6 @@ MOJFrontend.ButtonMenu.prototype.focusPrevious = function(currentButton) {
369
369
  this.container.find('[role=menuitem]').last().focus();
370
370
  }
371
371
  };
372
- MOJFrontend.FilterToggleButton = function(options) {
373
- this.options = options;
374
- this.container = this.options.toggleButton.container;
375
- this.createToggleButton();
376
- this.setupResponsiveChecks();
377
- this.options.filter.container.attr('tabindex', '-1');
378
- if(this.options.startHidden) {
379
- this.hideMenu();
380
- }
381
- };
382
-
383
- MOJFrontend.FilterToggleButton.prototype.setupResponsiveChecks = function() {
384
- this.mq = window.matchMedia(this.options.bigModeMediaQuery);
385
- this.mq.addListener($.proxy(this, 'checkMode'));
386
- this.checkMode(this.mq);
387
- };
388
-
389
- MOJFrontend.FilterToggleButton.prototype.createToggleButton = function() {
390
- this.menuButton = $('<button class="govuk-button '+this.options.toggleButton.classes+'" type="button" aria-haspopup="true" aria-expanded="false">'+this.options.toggleButton.showText+'</button>');
391
- this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
392
- this.options.toggleButton.container.append(this.menuButton);
393
- };
394
-
395
- MOJFrontend.FilterToggleButton.prototype.checkMode = function(mq) {
396
- if(mq.matches) {
397
- this.enableBigMode();
398
- } else {
399
- this.enableSmallMode();
400
- }
401
- };
402
-
403
- MOJFrontend.FilterToggleButton.prototype.enableBigMode = function() {
404
- this.showMenu();
405
- this.removeCloseButton();
406
- };
407
-
408
- MOJFrontend.FilterToggleButton.prototype.enableSmallMode = function() {
409
- this.hideMenu();
410
- this.addCloseButton();
411
- };
412
-
413
- MOJFrontend.FilterToggleButton.prototype.addCloseButton = function() {
414
- if(this.options.closeButton) {
415
- this.closeButton = $('<button class="moj-filter__close" type="button">'+this.options.closeButton.text+'</button>');
416
- this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
417
- this.options.closeButton.container.append(this.closeButton);
418
- }
419
- };
420
-
421
- MOJFrontend.FilterToggleButton.prototype.onCloseClick = function() {
422
- this.hideMenu();
423
- this.menuButton.focus();
424
- };
425
-
426
- MOJFrontend.FilterToggleButton.prototype.removeCloseButton = function() {
427
- if(this.closeButton) {
428
- this.closeButton.remove();
429
- this.closeButton = null;
430
- }
431
- };
432
-
433
- MOJFrontend.FilterToggleButton.prototype.hideMenu = function() {
434
- this.menuButton.attr('aria-expanded', 'false');
435
- this.options.filter.container.addClass('moj-js-hidden');
436
- this.menuButton.text(this.options.toggleButton.showText);
437
- };
438
-
439
- MOJFrontend.FilterToggleButton.prototype.showMenu = function() {
440
- this.menuButton.attr('aria-expanded', 'true');
441
- this.options.filter.container.removeClass('moj-js-hidden');
442
- this.menuButton.text(this.options.toggleButton.hideText);
443
- };
444
-
445
- MOJFrontend.FilterToggleButton.prototype.onMenuButtonClick = function() {
446
- this.toggle();
447
- };
448
-
449
- MOJFrontend.FilterToggleButton.prototype.toggle = function() {
450
- if(this.menuButton.attr('aria-expanded') == 'false') {
451
- this.showMenu();
452
- this.options.filter.container.focus();
453
- } else {
454
- this.hideMenu();
455
- }
456
- };
457
372
  MOJFrontend.FormValidator = function(form, options) {
458
373
  this.form = form;
459
374
  this.errors = [];
@@ -610,6 +525,91 @@ MOJFrontend.FormValidator.prototype.validate = function() {
610
525
  }
611
526
  return this.errors.length === 0;
612
527
  };
528
+ MOJFrontend.FilterToggleButton = function(options) {
529
+ this.options = options;
530
+ this.container = this.options.toggleButton.container;
531
+ this.createToggleButton();
532
+ this.setupResponsiveChecks();
533
+ this.options.filter.container.attr('tabindex', '-1');
534
+ if(this.options.startHidden) {
535
+ this.hideMenu();
536
+ }
537
+ };
538
+
539
+ MOJFrontend.FilterToggleButton.prototype.setupResponsiveChecks = function() {
540
+ this.mq = window.matchMedia(this.options.bigModeMediaQuery);
541
+ this.mq.addListener($.proxy(this, 'checkMode'));
542
+ this.checkMode(this.mq);
543
+ };
544
+
545
+ MOJFrontend.FilterToggleButton.prototype.createToggleButton = function() {
546
+ this.menuButton = $('<button class="govuk-button '+this.options.toggleButton.classes+'" type="button" aria-haspopup="true" aria-expanded="false">'+this.options.toggleButton.showText+'</button>');
547
+ this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
548
+ this.options.toggleButton.container.append(this.menuButton);
549
+ };
550
+
551
+ MOJFrontend.FilterToggleButton.prototype.checkMode = function(mq) {
552
+ if(mq.matches) {
553
+ this.enableBigMode();
554
+ } else {
555
+ this.enableSmallMode();
556
+ }
557
+ };
558
+
559
+ MOJFrontend.FilterToggleButton.prototype.enableBigMode = function() {
560
+ this.showMenu();
561
+ this.removeCloseButton();
562
+ };
563
+
564
+ MOJFrontend.FilterToggleButton.prototype.enableSmallMode = function() {
565
+ this.hideMenu();
566
+ this.addCloseButton();
567
+ };
568
+
569
+ MOJFrontend.FilterToggleButton.prototype.addCloseButton = function() {
570
+ if(this.options.closeButton) {
571
+ this.closeButton = $('<button class="moj-filter__close" type="button">'+this.options.closeButton.text+'</button>');
572
+ this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
573
+ this.options.closeButton.container.append(this.closeButton);
574
+ }
575
+ };
576
+
577
+ MOJFrontend.FilterToggleButton.prototype.onCloseClick = function() {
578
+ this.hideMenu();
579
+ this.menuButton.focus();
580
+ };
581
+
582
+ MOJFrontend.FilterToggleButton.prototype.removeCloseButton = function() {
583
+ if(this.closeButton) {
584
+ this.closeButton.remove();
585
+ this.closeButton = null;
586
+ }
587
+ };
588
+
589
+ MOJFrontend.FilterToggleButton.prototype.hideMenu = function() {
590
+ this.menuButton.attr('aria-expanded', 'false');
591
+ this.options.filter.container.addClass('moj-js-hidden');
592
+ this.menuButton.text(this.options.toggleButton.showText);
593
+ };
594
+
595
+ MOJFrontend.FilterToggleButton.prototype.showMenu = function() {
596
+ this.menuButton.attr('aria-expanded', 'true');
597
+ this.options.filter.container.removeClass('moj-js-hidden');
598
+ this.menuButton.text(this.options.toggleButton.hideText);
599
+ };
600
+
601
+ MOJFrontend.FilterToggleButton.prototype.onMenuButtonClick = function() {
602
+ this.toggle();
603
+ };
604
+
605
+ MOJFrontend.FilterToggleButton.prototype.toggle = function() {
606
+ if(this.menuButton.attr('aria-expanded') == 'false') {
607
+ this.showMenu();
608
+ this.options.filter.container.focus();
609
+ } else {
610
+ this.hideMenu();
611
+ }
612
+ };
613
613
  if(MOJFrontend.dragAndDropSupported() && MOJFrontend.formDataSupported() && MOJFrontend.fileApiSupported()) {
614
614
  MOJFrontend.MultiFileUpload = function(params) {
615
615
  this.defaultParams = {
@@ -860,7 +860,7 @@ MOJFrontend.MultiSelect.prototype.onCheckboxClick = function(e) {
860
860
 
861
861
  MOJFrontend.PasswordReveal = function(element) {
862
862
  this.el = element;
863
- $el = $(this.el)
863
+ var $el = $(this.el)
864
864
 
865
865
  if ($el.data('moj-password-reveal-initialised')) {
866
866
  return
package/moj/all.scss CHANGED
@@ -1,5 +1,3 @@
1
- @import "node_modules/govuk-frontend/govuk/base";
2
-
3
1
  @import "settings/all";
4
2
  @import "helpers/all";
5
3
  @import "objects/all";
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,3 @@
1
- @import "node_modules/govuk-frontend/govuk/objects/width-container";
2
-
3
1
  .moj-cookie-banner {
4
2
  display: none;
5
3
  @include govuk-font(16);
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  MOJFrontend.PasswordReveal = function(element) {
2
2
  this.el = element;
3
- $el = $(this.el)
3
+ var $el = $(this.el)
4
4
 
5
5
  if ($el.data('moj-password-reveal-initialised')) {
6
6
  return
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1 +1,2 @@
1
1
  @import "hidden";
2
+ @import "ie8";
File without changes
@@ -0,0 +1,5 @@
1
+ @mixin govuk-if-ie8 {
2
+ @if $govuk-is-ie8 {
3
+ @content;
4
+ }
5
+ }
package/moj/helpers.js CHANGED
File without changes
package/moj/namespace.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,3 +1,4 @@
1
1
  @import "assets";
2
+ @import "ie8";
2
3
  @import "measurements";
3
4
  @import "colours";
File without changes
File without changes
@@ -0,0 +1 @@
1
+ $govuk-is-ie8: false !default;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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": "1.8.0",
4
+ "version": "2.0.0-beta.0",
5
5
  "main": "moj/all.js",
6
6
  "sass": "moj/all.scss",
7
7
  "engines": {
@@ -27,7 +27,7 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "govuk-frontend": "^3.0.0 || ^4.0.0",
30
+ "govuk-frontend": "^5.0.0",
31
31
  "moment": "^2.27.0"
32
32
  },
33
33
  "peerDependencies": {