@internetstiftelsen/styleguide 2.21.22 → 2.21.24

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.
@@ -11,6 +11,7 @@ var megaMenu = document.getElementById('megaMenu');
11
11
  var content = document.getElementById('siteMain');
12
12
  var header = document.getElementById('siteHeader');
13
13
  var footer = document.getElementById('siteFooter');
14
+ var alert = document.querySelector('.js-dismiss-alert');
14
15
  var isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
15
16
  var focusTrap = null;
16
17
 
@@ -92,7 +93,16 @@ function prepareOutAnimation() {
92
93
  var headerRect = megaMenu.getBoundingClientRect();
93
94
  var initialFooterTop = footer.getBoundingClientRect().top;
94
95
 
95
- megaMenu.style.cssText = '\n position: absolute;\n top: ' + headerRect.top + 'px;\n left: 0;\n right: 0;\n display: block;\n\t';
96
+ /* Take into account it the site has an alert message at the top */
97
+ var alertHeight = void 0;
98
+
99
+ if (alert) {
100
+ alertHeight = alert.offsetHeight;
101
+ } else {
102
+ alertHeight = 0;
103
+ }
104
+
105
+ megaMenu.style.cssText = '\n position: absolute;\n top: ' + (headerRect.top - alertHeight) + 'px;\n left: 0;\n right: 0;\n display: block;\n\t';
96
106
 
97
107
  content.removeAttribute('style');
98
108
  header.removeAttribute('style');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetstiftelsen/styleguide",
3
- "version": "2.21.22",
3
+ "version": "2.21.24",
4
4
  "main": "dist/components.js",
5
5
  "ports": {
6
6
  "fractal": "3000"
@@ -4,7 +4,8 @@ module.exports = {
4
4
  context: {
5
5
  name: 'Information',
6
6
  type: 'info',
7
- text: 'Meddelanderuta med vanlig information, t.ex information om öppettider. <a href="https://internetstiftelsen.se">Dessa meddelanden</a> är fasta dv.s inget dom dyker upp tillfälligt när användaren interagerar med tjänsten.'
7
+ text: 'Meddelanderuta med vanlig information, t.ex information om öppettider. <a href="https://internetstiftelsen.se">Dessa meddelanden</a> är fasta dv.s inget dom dyker upp tillfälligt när användaren interagerar med tjänsten.',
8
+ additional_classes: false,
8
9
  },
9
10
  variants: [
10
11
  {
@@ -1,4 +1,4 @@
1
- <div{{#if role}} id="alert-1" role="{{role}}"{{/if}} class="m-alert m-alert--{{type}}{{#if is_dismissable}} m-alert--dismissable{{/if}}{{#if js_class}} {{js_class}}{{/if}}" {{#if is_dismissable}} aria-hidden="true"{{/if}}>
1
+ <div{{#if role}} id="alert-1" role="{{role}}"{{/if}} class="m-alert m-alert--{{type}}{{#if additional_classes}} {{additional_classes}}{{/if}}{{#if is_dismissable}} m-alert--dismissable{{/if}}{{#if js_class}} {{js_class}}{{/if}}" {{#if is_dismissable}} aria-hidden="true"{{/if}}>
2
2
  {{#if is_dismissable}}
3
3
  <button class="a-button a-button--icon a-button--standalone-icon a-button--icon" data-a11y-toggle="alert-1">
4
4
  <span class="a-button__text">Stäng</span>
@@ -63,7 +63,7 @@
63
63
 
64
64
  @include m(sliding) {
65
65
  position: fixed;
66
- z-index: z_index(foreground);
66
+ z-index: z_index(middleground);
67
67
  top: rhythm(1);
68
68
  right: -500px;
69
69
  bottom: rhythm(1);
@@ -114,6 +114,8 @@
114
114
  max-width: 100%;
115
115
  padding-right: rhythm(3);
116
116
  padding-bottom: rhythm(2);
117
+ overflow-y: auto;
118
+ max-height: calc(100vh - 77px);
117
119
  }
118
120
 
119
121
  @include b(m-form__row) {
@@ -8,6 +8,7 @@ const megaMenu = document.getElementById('megaMenu');
8
8
  const content = document.getElementById('siteMain');
9
9
  const header = document.getElementById('siteHeader');
10
10
  const footer = document.getElementById('siteFooter');
11
+ const alert = document.querySelector('.js-dismiss-alert');
11
12
  const isIE11 = !!window.MSInputMethodContext && !!document.documentMode;
12
13
  let focusTrap = null;
13
14
 
@@ -98,9 +99,18 @@ function prepareOutAnimation() {
98
99
  const headerRect = megaMenu.getBoundingClientRect();
99
100
  const initialFooterTop = footer.getBoundingClientRect().top;
100
101
 
102
+ /* Take into account it the site has an alert message at the top */
103
+ let alertHeight;
104
+
105
+ if (alert) {
106
+ alertHeight = alert.offsetHeight;
107
+ } else {
108
+ alertHeight = 0;
109
+ }
110
+
101
111
  megaMenu.style.cssText = `
102
112
  position: absolute;
103
- top: ${headerRect.top}px;
113
+ top: ${headerRect.top - alertHeight}px;
104
114
  left: 0;
105
115
  right: 0;
106
116
  display: block;