mp-design-system 0.9.29 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/build/js/app.js +1 -1
  2. package/dist/build/js/app.js.map +1 -1
  3. package/dist/build/scss/library.css +1 -1
  4. package/dist/build/scss/library.css.map +1 -1
  5. package/dist/build/scss/main.css +1 -1
  6. package/dist/build/scss/main.css.map +1 -1
  7. package/package.json +1 -1
  8. package/src/_includes/components/button/button.config.js +6 -0
  9. package/src/_includes/components/button/button.scss +7 -0
  10. package/src/_includes/components/card/card.config.js +143 -1
  11. package/src/_includes/components/card/card.scss +13 -0
  12. package/src/_includes/components/input/checkbox.config.js +6 -0
  13. package/src/_includes/components/input/checkbox.njk +2 -2
  14. package/src/_includes/components/input/input.config.js +6 -0
  15. package/src/_includes/components/input/input.njk +1 -1
  16. package/src/_includes/components/input/input.scss +11 -0
  17. package/src/_includes/components/input/radio.config.js +6 -0
  18. package/src/_includes/components/input/radio.njk +2 -2
  19. package/src/_includes/components/input/radio.scss +13 -0
  20. package/src/_includes/components/input/select.config.js +6 -0
  21. package/src/_includes/components/input/select.njk +1 -1
  22. package/src/_includes/components/input/textarea.config.js +6 -0
  23. package/src/_includes/components/input/textarea.njk +1 -1
  24. package/src/_includes/components/input/toggle.config.js +6 -0
  25. package/src/_includes/components/input/toggle.njk +2 -2
  26. package/src/_includes/components/input/toggle.scss +16 -0
  27. package/src/_includes/components/tabs/tabs.config.js +5 -5
  28. package/src/_includes/components/tabs/tabs.njk +1 -1
  29. package/src/_includes/components/tabs/tabs.scss +4 -0
  30. package/src/_includes/components/twi/twi.njk +1 -1
  31. package/src/_includes/includes/system-scripts.njk +1 -1
  32. package/src/_includes/layout.njk +1 -0
  33. package/src/_includes/system-home-page.njk +1 -0
  34. package/src/assets/js/app.js +2 -0
  35. package/src/assets/js/imports/off-canvas.js +97 -0
  36. package/src/assets/scss/elements/reset.scss +0 -7
  37. package/src/assets/scss/objects/index.scss +1 -0
  38. package/src/assets/scss/objects/off-canvas.scss +85 -0
  39. package/src/assets/scss/utilities/link.scss +1 -0
  40. package/src/components/iconography.njk +3 -0
  41. package/src/index.njk +14 -7
  42. package/src/patterns/form.njk +324 -151
  43. package/src/patterns/off-canvas.njk +42 -0
  44. package/src/prototype/index.njk +2 -2
  45. package/src/static/svg/sprite.svg +41 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-design-system",
3
- "version": "0.9.29",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm-run-all --parallel bundle:*",
@@ -55,6 +55,12 @@ module.exports = {
55
55
  context: {
56
56
  classes: 'c-button--loading'
57
57
  }
58
+ },
59
+ {
60
+ title: 'Disabled',
61
+ context: {
62
+ attrs: 'disabled'
63
+ }
58
64
  }
59
65
  ],
60
66
  props: [
@@ -44,6 +44,13 @@
44
44
  text-decoration: none;
45
45
  color: color("white");
46
46
  }
47
+
48
+ &[disabled],
49
+ [disabled] & {
50
+ filter: saturate( 0.4 );
51
+ cursor: not-allowed;
52
+ opacity: 0.6;
53
+ }
47
54
  }
48
55
 
49
56
  .mp.c-button,
@@ -737,7 +737,45 @@ module.exports = {
737
737
  }
738
738
  },
739
739
  {
740
- title: 'Event card (with image)',
740
+ title: 'In-person event card',
741
+ preview: 'content-width',
742
+ context: {
743
+ theme: {
744
+ border: false,
745
+ size: 'small',
746
+ layout: 'multi',
747
+ name: 'event',
748
+ inlineSpecs: true,
749
+ corner: true,
750
+ },
751
+ header: {
752
+ title: 'Discover how on-line particle sizing optimises mining analytics.',
753
+ date: {
754
+ date: new Date(),
755
+ time: '11:00 – 12:00',
756
+ timezone: 'EST'
757
+ },
758
+ meta: [
759
+ 'English'
760
+ ],
761
+ },
762
+ body: {
763
+ keySpecs: [
764
+ {
765
+ title: 'Products',
766
+ term: 'Morphologi G3-ID'
767
+ },
768
+ {
769
+ title: 'Technologies',
770
+ term: 'Morphologically-Directed Raman Spectroscopy'
771
+ }
772
+ ]
773
+ },
774
+ link: '#'
775
+ }
776
+ },
777
+ {
778
+ title: 'In-person event card with image',
741
779
  preview: 'content-width',
742
780
  context: {
743
781
  theme: {
@@ -778,9 +816,113 @@ module.exports = {
778
816
  link: '#'
779
817
  }
780
818
  },
819
+ {
820
+ title: 'On-demand event card',
821
+ preview: 'content-width',
822
+ context: {
823
+ theme: {
824
+ border: false,
825
+ size: 'small',
826
+ layout: 'multi',
827
+ name: 'event',
828
+ inlineSpecs: true
829
+ },
830
+ header: {
831
+ title: 'Discover how on-line particle sizing optimises mining analytics.',
832
+ date: {
833
+ date: new Date(),
834
+ duration: '36:01'
835
+ },
836
+ meta: [
837
+ 'English'
838
+ ]
839
+ },
840
+ body: {
841
+ keySpecs: [
842
+ {
843
+ title: 'Products',
844
+ term: 'Morphologi G3-ID'
845
+ },
846
+ {
847
+ title: 'Technologies',
848
+ term: 'Morphologically-Directed Raman Spectroscopy'
849
+ }
850
+ ],
851
+ },
852
+ tag: 'Recorded webinar'
853
+ }
854
+ },
855
+ {
856
+ title: 'On-demand event card with image',
857
+ preview: 'content-width',
858
+ context: {
859
+ theme: {
860
+ border: false,
861
+ size: 'small',
862
+ layout: 'multi',
863
+ name: 'event',
864
+ inlineSpecs: true
865
+ },
866
+ image: {
867
+ src: '/static/img/blog-page-image-1.jpg',
868
+ alt: 'Product image alt'
869
+ },
870
+ header: {
871
+ title: 'Discover how on-line particle sizing optimises mining analytics.',
872
+ date: {
873
+ date: new Date(),
874
+ duration: '36:01'
875
+ },
876
+ meta: [
877
+ 'English'
878
+ ]
879
+ },
880
+ body: {
881
+ keySpecs: [
882
+ {
883
+ title: 'Products',
884
+ term: 'Morphologi G3-ID'
885
+ },
886
+ {
887
+ title: 'Technologies',
888
+ term: 'Morphologically-Directed Raman Spectroscopy'
889
+ }
890
+ ],
891
+ },
892
+ tag: 'Recorded webinar'
893
+ }
894
+ },
781
895
  {
782
896
  title: 'Event series card',
783
897
  preview: 'content-width',
898
+ context: {
899
+ theme: {
900
+ border: false,
901
+ layout: 'single',
902
+ name: 'event-series',
903
+ inlineSpecs: false,
904
+ corner: false,
905
+ },
906
+ header: {
907
+ title: 'Part 1 - The theory of X-Ray Fluorescence (XRF)',
908
+ date: {
909
+ date: (new Date()).toLocaleString('default', { month: 'short', year: 'numeric' }),
910
+ formatted: true,
911
+ },
912
+ },
913
+ footer: {
914
+ cta: {
915
+ link: '#',
916
+ label: 'Watch now',
917
+ icon: 'play',
918
+ }
919
+ },
920
+ link: '#'
921
+ }
922
+ },
923
+ {
924
+ title: 'Event series card with image',
925
+ preview: 'content-width',
784
926
  context: {
785
927
  theme: {
786
928
  border: false,
@@ -408,6 +408,10 @@
408
408
  &--event.c-card--has-image {
409
409
  @extend .c-card--switch;
410
410
 
411
+ &.c-card--has-tag .c-card__tag {
412
+ z-index: 1;
413
+ }
414
+
411
415
  .c-card__wrapper {
412
416
  @include padding(0);
413
417
 
@@ -454,6 +458,15 @@
454
458
  object-fit: cover;
455
459
  }
456
460
 
461
+ .c-card__wrapper,
462
+ .c-card__primary {
463
+ height: 100%;
464
+ }
465
+
466
+ .c-card__primary {
467
+ flex-shrink: 1;
468
+ }
469
+
457
470
  .c-card__header > * + * {
458
471
  @include margin('s', 0, 0, 0);
459
472
  }
@@ -20,6 +20,12 @@ module.exports = {
20
20
  context: {
21
21
  checked: true
22
22
  }
23
+ },
24
+ {
25
+ title: 'Disabled',
26
+ context: {
27
+ disabled: true
28
+ }
23
29
  }
24
30
  ],
25
31
  props: [
@@ -1,2 +1,2 @@
1
- <input type="checkbox" class="c-checkbox" name="{{ params.name or params.id }}" id="{{ params.id }}" value="{{ params.value }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} />
2
- <label for="{{ params.id }}">{{ params.label }}</label>
1
+ <input type="checkbox" class="c-checkbox" name="{{ params.name or params.id }}" id="{{ params.id }}" value="{{ params.value }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} {{ 'disabled' if params.disabled }} />
2
+ <label for="{{ params.id }}">{{ params.label }}</label>
@@ -35,6 +35,12 @@ module.exports = {
35
35
  button: true,
36
36
  buttontext: 'Search'
37
37
  }
38
+ },
39
+ {
40
+ title: 'Disabled',
41
+ context: {
42
+ disabled: true
43
+ }
38
44
  }
39
45
  ],
40
46
  props: [
@@ -3,7 +3,7 @@
3
3
  {% if params.button %}
4
4
  <div class="u-flex u-border">
5
5
  {% endif %}
6
- <input type="{{ params.type or 'text' }}" class="c-input {{ 'c-input--with-button' if params.button }}{{ params.classes }}" name="{{ params.name or params.id }}" placeholder="{{ params.placeholder }}" id="{{ params.id }}" {{ 'required' if params.required }} />
6
+ <input type="{{ params.type or 'text' }}" class="c-input {{ 'c-input--with-button' if params.button }}{{ params.classes }}" name="{{ params.name or params.id }}" placeholder="{{ params.placeholder }}" id="{{ params.id }}" {{ 'required' if params.required }} {{ 'disabled' if params.disabled }} />
7
7
  {% if params.button %}
8
8
  <button type="button" class="mp c-button--white">Search</button>
9
9
  {% endif %}
@@ -83,6 +83,17 @@
83
83
  @include step(-1);
84
84
  color: var(--error-state);
85
85
  }
86
+
87
+ &[disabled],
88
+ [disabled] & {
89
+ background-color: color('petrol', 'step-2');
90
+ background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" id="lock" viewBox="0 0 25 24" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M9.45 4.17A4 4 0 0 1 16.28 7v3h-8V7a4 4 0 0 1 1.17-2.83ZM6.28 10V7a6 6 0 1 1 12 0v3h.22c1.64 0 2.78 1.46 2.78 3v7c0 1.54-1.14 3-2.78 3H6.06c-1.65 0-2.78-1.46-2.78-3v-7c0-1.54 1.13-3 2.78-3h.22Zm1 2H6.06c-.33 0-.78.33-.78 1v7c0 .67.45 1 .78 1H18.5c.32 0 .78-.33.78-1v-7c0-.67-.46-1-.78-1H7.28Zm3 3.35a2 2 0 1 1 3 1.73v1.77a1 1 0 1 1-2 0v-1.77a2 2 0 0 1-1-1.73Z"/></svg>');
91
+ background-position: right var(--space-2xs) center;
92
+ background-repeat: no-repeat;
93
+ @include space('background-size', 's');
94
+ cursor: not-allowed;
95
+ opacity: 0.6;
96
+ }
86
97
  }
87
98
 
88
99
  .c-input--with-button {
@@ -20,6 +20,12 @@ module.exports = {
20
20
  context: {
21
21
  checked: true
22
22
  }
23
+ },
24
+ {
25
+ title: 'Disabled',
26
+ context: {
27
+ disabled: true
28
+ }
23
29
  }
24
30
  ],
25
31
  props: [
@@ -1,2 +1,2 @@
1
- <input type="radio" class="c-radio" name="{{ params.name or params.id }}" id="{{ params.id }}" value="{{ params.value }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} />
2
- <label for="{{ params.id }}">{{ params.label }}</label>
1
+ <input type="radio" class="c-radio" name="{{ params.name or params.id }}" id="{{ params.id }}" value="{{ params.value }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} {{ 'disabled' if params.disabled }} />
2
+ <label for="{{ params.id }}">{{ params.label }}</label>
@@ -25,6 +25,19 @@
25
25
  &:focus + input[type=hidden] + label:before {
26
26
  outline: 2px solid;
27
27
  }
28
+
29
+ &[disabled],
30
+ [disabled] & {
31
+ & + label:before {
32
+ background-color: color('petrol', 'step-2');
33
+ cursor: not-allowed;
34
+ opacity: 0.6;
35
+
36
+ }
37
+ &:hover + label:before {
38
+ background-color: color('petrol', 'step-2');
39
+ }
40
+ }
28
41
  }
29
42
 
30
43
  .c-checkbox {
@@ -39,6 +39,12 @@ module.exports = {
39
39
  context: {
40
40
  error: 'This field is required'
41
41
  }
42
+ },
43
+ {
44
+ title: 'Disabled',
45
+ context: {
46
+ disabled: true
47
+ }
42
48
  }
43
49
  ],
44
50
  props: [
@@ -1,6 +1,6 @@
1
1
  {% inputWrapper params.error %}
2
2
  <label class="{{ 'u-hidden' if params.hideLabel else 'c-label' }}{{ params.classes }}" for="{{ params.id }}">{{ params.label }}</label>
3
- <select class="c-input c-input--select" name="{{ params.name or params.id }}" id="{{ params.id }}" {{ 'required' if params.required }}>
3
+ <select class="c-input c-input--select" name="{{ params.name or params.id }}" id="{{ params.id }}" {{ 'required' if params.required }} {{ 'disabled' if params.disabled }}>
4
4
  {% if params.placeholder %}<option value="">{{ params.placeholder }}</option>{% endif %}
5
5
  {% if params.options | length %}
6
6
  {% for option in params.options %}
@@ -28,6 +28,12 @@ module.exports = {
28
28
  context: {
29
29
  error: 'This field is required'
30
30
  }
31
+ },
32
+ {
33
+ title: 'Disabled',
34
+ context: {
35
+ disabled: true
36
+ }
31
37
  }
32
38
  ],
33
39
  props: [
@@ -1,4 +1,4 @@
1
1
  {% inputWrapper params.error %}
2
2
  <label class="{{ 'u-hidden' if params.hideLabel else 'c-label' }}{{ params.classes }}" for="{{ params.id }}">{{ params.label }}</label>
3
- <textarea class="c-input c-input--textarea" name="{{ params.name or params.id }}" placeholder="{{ params.placeholder }}" id="{{ params.id }}" {{ 'required' if params.required }}></textarea>
3
+ <textarea class="c-input c-input--textarea" name="{{ params.name or params.id }}" placeholder="{{ params.placeholder }}" id="{{ params.id }}" {{ 'required' if params.required }} {{ 'disabled' if params.disabled }}></textarea>
4
4
  {% endinputWrapper %}
@@ -20,6 +20,12 @@ module.exports = {
20
20
  context: {
21
21
  checked: true
22
22
  }
23
+ },
24
+ {
25
+ title: 'Disabled',
26
+ context: {
27
+ disabled: true
28
+ }
23
29
  }
24
30
  ],
25
31
  props: [
@@ -1,5 +1,5 @@
1
1
  <label for="{{ params.id }}" class="c-toggle">
2
- <input type="checkbox" class="c-toggle__checkbox" id="{{ params.id }}" value="{{ params.value }}" role="switch" aria-checked="false" aria-label="{{ params.label }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} />
2
+ <input type="checkbox" class="c-toggle__checkbox" id="{{ params.id }}" value="{{ params.value }}" role="switch" aria-checked="false" aria-label="{{ params.label }}" {{ 'checked' if params.checked }} {{ 'required' if params.required }} {{ 'disabled' if params.disabled }} />
3
3
  <span class="c-toggle__slider"></span>
4
- {{ params.label }}
4
+ <span class="c-toggle__label">{{ params.label }}</span>
5
5
  </label>
@@ -56,4 +56,20 @@
56
56
  &__checkbox:checked + &__slider::before {
57
57
  transform: translateX(1rem);
58
58
  }
59
+
60
+ input[disabled] {
61
+ & + .c-toggle__slider {
62
+ background-color: color('petrol', 'step-2');
63
+ cursor: not-allowed;
64
+ opacity: 0.6;
65
+
66
+ &:before {
67
+ background-color: color('petrol', 'step-3');
68
+ }
69
+ }
70
+ & ~ .c-toggle__label {
71
+ cursor: not-allowed;
72
+ opacity: 0.6;
73
+ }
74
+ }
59
75
  }
@@ -8,11 +8,11 @@ module.exports = {
8
8
  context: {
9
9
  type: 'anchor',
10
10
  tabs: [
11
- { id: 'tab-1', label: 'Primary materials', content: '<h2 class="c-h c-h--step-3">Primary materials</h2>', active: true },
12
- { id: 'tab-2', label: 'Pharmaceuticals', content: '<h2 class="c-h c-h--step-3">Pharmaceuticals</h2>' },
13
- { id: 'tab-3', label: 'Advanced materials', content: '<h2 class="c-h c-h--step-3">Advanced materials</h2>' },
14
- { id: 'tab-4', label: 'Academia', content: '<h2 class="c-h c-h--step-3">Academia</h2>' },
15
- { id: 'tab-5', label: 'Connected world', content: '<h2 class="c-h c-h--step-3">Connected world</h2>' },
11
+ { id: 'tab-1', label: 'Primary materials', content: '<strong>Primary materials</strong> lorem ipsum a maecenas parturient ipsum at nisl id nisi a imperdiet platea dui venenatis sit euismod.', active: true },
12
+ { id: 'tab-2', label: 'Pharmaceuticals', content: '<strong>Pharmaceuticals</strong> lorem ipsum parturient a ullamcorper nisl parturient cum ullamcorper augue arcu a feugiat mus imperdiet curae suspendisse rhoncus sit id parturient cubilia adipiscing ad ullamcorper aliquet mi.' },
13
+ { id: 'tab-3', label: 'Advanced materials', content: '<strong>Advanced materials</strong> lorem ipsum fringilla eros cum facilisis id ullamcorper pretium sociosqu a eu vestibulum cras vivamus inceptos sed potenti a.' },
14
+ { id: 'tab-4', label: 'Academia', content: '<strong>Academia</strong> lorem ipsum augue et vestibulum ut luctus ut vestibulum proin eros mauris sodales penatibus euismod a sem eleifend suspendisse litora fringilla habitasse suspendisse.' },
15
+ { id: 'tab-5', label: 'Connected world', content: '<strong>Connected world</strong> lorem ipsum eros a parturient libero ullamcorper natoque vestibulum turpis egestas suspendisse parturient et adipiscing arcu a.' },
16
16
  ]
17
17
  },
18
18
  props: [
@@ -10,7 +10,7 @@
10
10
  <div class="c-tabs__content">
11
11
  {% for tab in params.tabs %}
12
12
  <div id="{{ tab.id }}" class="c-tab {{ 'c-tab--active' if tab.active }}">
13
- {{ tab.content | safe }}
13
+ <div class="o-prose"><p>{{ tab.content | safe }}</p></div>
14
14
  </div>
15
15
  {% endfor %}
16
16
  </div>
@@ -66,6 +66,10 @@
66
66
  @media screen and (max-width:55em) {
67
67
  white-space: nowrap;
68
68
  }
69
+
70
+ .c-tabs__controls-list > li:last-child & {
71
+ @include margin-right(0);
72
+ }
69
73
 
70
74
  &.c-twi {
71
75
  display: flex;
@@ -21,7 +21,7 @@
21
21
  {%- endif -%}
22
22
 
23
23
  <span>{{ params.label }}</span>
24
- {{ icon({ id: params.icon }) }}
24
+ {{ icon({ id: params.icon or 'arrow-right' }) }}
25
25
 
26
26
  {%- if params.link != null -%}
27
27
  </a>
@@ -67,7 +67,7 @@
67
67
  function toggleBackgroundColour(event) {
68
68
  const iframe = event.currentTarget.parentNode.parentNode.querySelector('iframe');
69
69
  if (iframe) {
70
- iframe.classList.toggle('u-bg-petrol-step-2');
70
+ iframe.classList.toggle('u-bg-petrol-step-3');
71
71
  iframe.classList.toggle('u-pad-s');
72
72
  }
73
73
  }
@@ -6,6 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>{{ fullTitle }}</title>
8
8
  {% if description %} <meta name="description" content="{{ description }}" /> {% endif %}
9
+ {% if not index %}<meta name="robots" content="noindex" />{% endif %}
9
10
  <meta name="theme-color" content="#005461">
10
11
  <meta property="og:type" content="website" />
11
12
  <meta property="og:title" content="{{ fullTitle }}" />
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  sidebar: false
3
+ index: true
3
4
  ---
4
5
 
5
6
  {% extends "library.njk" %}
@@ -5,6 +5,7 @@ import Comparison from './imports/comparison';
5
5
  import Gallery from './imports/gallery';
6
6
  import HeroPattern from './imports/hero-pattern';
7
7
  import HeroVideo from './imports/hero-video';
8
+ import OffCanvas from './imports/off-canvas';
8
9
  import ResponsiveTable from './imports/responsive-table';
9
10
  import ScrollbarWidth from './imports/scrollbar-width';
10
11
  import ScrollSpy from './imports/scroll-spy';
@@ -25,6 +26,7 @@ import Tabs from './imports/tabs';
25
26
  Gallery();
26
27
  HeroPattern();
27
28
  HeroVideo();
29
+ OffCanvas();
28
30
  ResponsiveTable();
29
31
  ScrollbarWidth();
30
32
  ScrollSpy();
@@ -0,0 +1,97 @@
1
+ // Add click event listeners to each toggle button
2
+ function OffCanvas() {
3
+ const toggleButtons = Array.from(document.querySelectorAll('.c-button--off-canvas-toggle'));
4
+ toggleButtons.forEach((button) => {
5
+ button.addEventListener('click', handleToggleClick);
6
+ });
7
+ }
8
+
9
+ // Function to handle the toggle button click
10
+ function handleToggleClick() {
11
+ const target = this.getAttribute('data-target');
12
+ const offCanvas = document.getElementById(target);
13
+ openOffCanvas(offCanvas);
14
+ }
15
+
16
+ // Function to open the off-canvas drawer
17
+ function openOffCanvas(offCanvas) {
18
+ const offCanvasList = document.querySelectorAll('.o-off-canvas');
19
+ const isOpen = offCanvas.classList.contains('o-off-canvas--open');
20
+
21
+ // Close other off-canvas drawers only if the target is not already open
22
+ if (!isOpen) {
23
+ offCanvasList.forEach((drawer) => {
24
+ if (drawer !== offCanvas) {
25
+ closeOffCanvas(drawer);
26
+ }
27
+ });
28
+ }
29
+
30
+ // Open the target off-canvas drawer
31
+ offCanvas.classList.add('o-off-canvas--open');
32
+ offCanvas.setAttribute('aria-hidden', 'false');
33
+
34
+ // Add click event listener to the backdrop to close the off-canvas drawer
35
+ const backdrop = offCanvas.querySelector('.o-off-canvas__backdrop');
36
+ backdrop.addEventListener('click', handleBackdropClick);
37
+
38
+ // Add keydown event listener to close the off-canvas drawer with the Esc key
39
+ document.addEventListener('keydown', handleKeyDown);
40
+ }
41
+
42
+ // Function to handle the backdrop click
43
+ function handleBackdropClick() {
44
+ const offCanvas = this.closest('.o-off-canvas');
45
+ closeOffCanvas(offCanvas);
46
+ }
47
+
48
+ // Function to handle the keydown event
49
+ function handleKeyDown(event) {
50
+ if (event.key === 'Escape') {
51
+ const openDrawer = document.querySelector('.o-off-canvas--open');
52
+ if (openDrawer) {
53
+ closeOffCanvas(openDrawer);
54
+ }
55
+ }
56
+ }
57
+
58
+ // Function to close the off-canvas drawer
59
+ function closeOffCanvas(offCanvas) {
60
+ offCanvas.classList.remove('o-off-canvas--open');
61
+ offCanvas.setAttribute('aria-hidden', 'true');
62
+
63
+ // Remove backdrop click event listener when closing the off-canvas drawer
64
+ const backdrop = offCanvas.querySelector('.o-off-canvas__backdrop');
65
+ backdrop.removeEventListener('click', handleBackdropClick);
66
+
67
+ // Remove keydown event listener when closing the off-canvas drawer
68
+ document.removeEventListener('keydown', handleKeyDown);
69
+ }
70
+
71
+ // Update button functionality
72
+ const updateButton = document.querySelectorAll('.o-off-canvas__update');
73
+ updateButton.forEach((button) => {
74
+ button.addEventListener('click', handleUpdateButtonClick);
75
+ });
76
+
77
+ // Handle the update button click
78
+ function handleUpdateButtonClick() {
79
+ // Save the options somewhere
80
+ const offCanvas = this.closest('.o-off-canvas');
81
+ closeOffCanvas(offCanvas);
82
+ }
83
+
84
+ // Close button functionality
85
+ const closeButton = document.querySelectorAll('.o-off-canvas__close');
86
+ closeButton.forEach((button) => {
87
+ button.addEventListener('click', handleCloseButtonClick);
88
+ });
89
+
90
+ // Handle the close button click
91
+ function handleCloseButtonClick() {
92
+ const offCanvas = this.closest('.o-off-canvas');
93
+ closeOffCanvas(offCanvas);
94
+ };
95
+
96
+
97
+ export default OffCanvas;
@@ -118,13 +118,6 @@ button {
118
118
  font: inherit;
119
119
  }
120
120
 
121
- [disabled],
122
- .mp.c-button[disabled] {
123
- cursor: not-allowed;
124
- filter: saturate(0.4);
125
- opacity: 0.6;
126
- }
127
-
128
121
  label {
129
122
  cursor: pointer;
130
123
  }
@@ -1,2 +1,3 @@
1
+ @import './off-canvas.scss';
1
2
  @import './prose.scss';
2
3
  @import './grid.scss';