mp-design-system 1.0.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mp-design-system",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "npm-run-all --parallel bundle:*",
@@ -39,7 +39,7 @@ module.exports = {
39
39
  {
40
40
  title: 'Disabled',
41
41
  context: {
42
- disabled: true
42
+ disabled: false
43
43
  }
44
44
  }
45
45
  ],
@@ -1,4 +1,5 @@
1
1
  {% inputWrapper params.error %}
2
+ <div class="c-form-row u-disabled">
2
3
  <label class="{{ 'u-hidden' if params.hideLabel else 'c-label' }}" for="{{ params.id }}">{{ params.label }}</label>
3
4
  {% if params.button %}
4
5
  <div class="u-flex u-border">
@@ -10,4 +11,5 @@
10
11
  {% if params.button %}
11
12
  </div>
12
13
  {% endif %}
14
+ </div>
13
15
  {% endinputWrapper %}
@@ -85,7 +85,8 @@
85
85
  }
86
86
 
87
87
  &[disabled],
88
- [disabled] & {
88
+ [disabled],
89
+ &--disabled {
89
90
  background-color: color('petrol', 'step-2');
90
91
  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
92
  background-position: right var(--space-2xs) center;
@@ -96,6 +97,10 @@
96
97
  }
97
98
  }
98
99
 
100
+ .u-disabled > .c-input {
101
+ @extend .c-input--disabled;
102
+ }
103
+
99
104
  .c-input--with-button {
100
105
  // padding-right: 44px;
101
106
  border: 0;
@@ -37,6 +37,9 @@ function openOffCanvas(offCanvas) {
37
37
 
38
38
  // Add keydown event listener to close the off-canvas drawer with the Esc key
39
39
  document.addEventListener('keydown', handleKeyDown);
40
+
41
+ // Prevent background scroll
42
+ document.body.style.overflowY = 'hidden';
40
43
  }
41
44
 
42
45
  // Function to handle the backdrop click
@@ -66,6 +69,9 @@ function closeOffCanvas(offCanvas) {
66
69
 
67
70
  // Remove keydown event listener when closing the off-canvas drawer
68
71
  document.removeEventListener('keydown', handleKeyDown);
72
+
73
+ // Allow background scroll
74
+ document.body.style.overflowY = '';
69
75
  }
70
76
 
71
77
  // Update button functionality
@@ -50,7 +50,7 @@
50
50
 
51
51
  &__main {
52
52
  @include margin-bottom('m');
53
- @include padding(0, 's');
53
+ @include padding('3xs', 's');
54
54
  overflow-y: scroll;
55
55
  }
56
56
 
@@ -0,0 +1,8 @@
1
+ .u-disabled {
2
+ cursor: not-allowed;
3
+
4
+ input,
5
+ button {
6
+ pointer-events: none;
7
+ }
8
+ }
@@ -3,6 +3,7 @@ html body {
3
3
  @import './typography.scss';
4
4
  @import './link.scss';
5
5
  @import './colour.scss';
6
+ @import './disabled.scss';
6
7
  @import './wrap.scss';
7
8
  @import './flex.scss';
8
9
  @import './display.scss';
@@ -50,6 +50,14 @@ More typography utility classes are documented on the [typography page](/compone
50
50
  <div class="u-revealed">The opposite of u-hidden, useful for e.g. accordions</div>
51
51
  ```
52
52
 
53
+ ```html
54
+ <div class="u-disabled">
55
+ <label class="c-label" for="text_input">
56
+ Disabled input, without using the [disabled] attribute</label>
57
+ <input type="text" class="c-input">
58
+ </div>
59
+ ```
60
+
53
61
  ---
54
62
 
55
63
  ## Layout