@iamproperty/components 3.7.3 → 3.7.5

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 (104) hide show
  1. package/assets/css/components/card.css +1 -1
  2. package/assets/css/components/card.css.map +1 -1
  3. package/assets/css/components/dialog.css +1 -1
  4. package/assets/css/components/dialog.css.map +1 -1
  5. package/assets/css/components/notification.css +1 -0
  6. package/assets/css/components/notification.css.map +1 -0
  7. package/assets/css/components/table.css +1 -1
  8. package/assets/css/components/table.css.map +1 -1
  9. package/assets/css/components/tooltips.css +1 -1
  10. package/assets/css/components/tooltips.css.map +1 -1
  11. package/assets/css/core.min.css +1 -1
  12. package/assets/css/core.min.css.map +1 -1
  13. package/assets/css/style.min.css +1 -1
  14. package/assets/css/style.min.css.map +1 -1
  15. package/assets/js/bundle.js +3 -0
  16. package/assets/js/components/accordion/accordion.component.js +5 -5
  17. package/assets/js/components/accordion/accordion.component.min.js +6 -5
  18. package/assets/js/components/accordion/accordion.component.min.js.map +1 -1
  19. package/assets/js/components/applied-filters/applied-filters.component.js +10 -3
  20. package/assets/js/components/applied-filters/applied-filters.component.min.js +5 -5
  21. package/assets/js/components/applied-filters/applied-filters.component.min.js.map +1 -1
  22. package/assets/js/components/card/card.component.js +11 -3
  23. package/assets/js/components/card/card.component.min.js +6 -6
  24. package/assets/js/components/card/card.component.min.js.map +1 -1
  25. package/assets/js/components/filterlist/filterlist.component.js +2 -1
  26. package/assets/js/components/filterlist/filterlist.component.min.js +4 -4
  27. package/assets/js/components/filterlist/filterlist.component.min.js.map +1 -1
  28. package/assets/js/components/header/header.component.js +3 -5
  29. package/assets/js/components/header/header.component.min.js +4 -8
  30. package/assets/js/components/header/header.component.min.js.map +1 -1
  31. package/assets/js/components/notification/notification.component.js +71 -0
  32. package/assets/js/components/notification/notification.component.min.js +18 -0
  33. package/assets/js/components/notification/notification.component.min.js.map +1 -0
  34. package/assets/js/components/pagination/pagination.component.js +6 -3
  35. package/assets/js/components/pagination/pagination.component.min.js +12 -10
  36. package/assets/js/components/pagination/pagination.component.min.js.map +1 -1
  37. package/assets/js/components/table/table.component.js +6 -3
  38. package/assets/js/components/table/table.component.min.js +14 -12
  39. package/assets/js/components/table/table.component.min.js.map +1 -1
  40. package/assets/js/components/tabs/tabs.component.js +2 -1
  41. package/assets/js/components/tabs/tabs.component.min.js +3 -3
  42. package/assets/js/components/tabs/tabs.component.min.js.map +1 -1
  43. package/assets/js/dynamic.js +3 -0
  44. package/assets/js/dynamic.min.js +14 -2
  45. package/assets/js/dynamic.min.js.map +1 -1
  46. package/assets/js/flat-components.js +6 -0
  47. package/assets/js/modules/dialogs.js +8 -1
  48. package/assets/js/modules/helpers.js +13 -0
  49. package/assets/js/modules/notification.js +53 -0
  50. package/assets/js/modules/table.js +10 -3
  51. package/assets/js/scripts.bundle.js +47 -35
  52. package/assets/js/scripts.bundle.js.map +1 -1
  53. package/assets/js/scripts.bundle.min.js +2 -2
  54. package/assets/js/scripts.bundle.min.js.map +1 -1
  55. package/assets/sass/_components.scss +1 -1
  56. package/assets/sass/_corefiles.scss +1 -0
  57. package/assets/sass/components/card.scss +9 -5
  58. package/assets/sass/components/dialog.scss +52 -14
  59. package/assets/sass/components/notification.scss +195 -0
  60. package/assets/sass/components/table.scss +22 -12
  61. package/assets/sass/components/tooltips.scss +137 -49
  62. package/assets/sass/foundations/buttons.scss +1 -1
  63. package/assets/sass/foundations/reboot.scss +80 -3
  64. package/assets/sass/foundations/root.scss +3 -3
  65. package/assets/ts/bundle.ts +4 -0
  66. package/assets/ts/components/accordion/accordion.component.ts +6 -8
  67. package/assets/ts/components/applied-filters/applied-filters.component.ts +12 -3
  68. package/assets/ts/components/card/card.component.ts +16 -4
  69. package/assets/ts/components/filterlist/filterlist.component.ts +4 -2
  70. package/assets/ts/components/header/header.component.ts +4 -5
  71. package/assets/ts/components/notification/README.md +32 -0
  72. package/assets/ts/components/notification/notification.component.ts +90 -0
  73. package/assets/ts/components/pagination/pagination.component.ts +7 -3
  74. package/assets/ts/components/table/table.component.ts +8 -4
  75. package/assets/ts/components/tabs/tabs.component.ts +3 -1
  76. package/assets/ts/dynamic.ts +6 -0
  77. package/assets/ts/flat-components.ts +8 -0
  78. package/assets/ts/modules/dialogs.ts +11 -4
  79. package/assets/ts/modules/helpers.ts +17 -0
  80. package/assets/ts/modules/notification.ts +76 -0
  81. package/assets/ts/modules/table.ts +13 -4
  82. package/dist/components.es.js +1027 -977
  83. package/dist/components.umd.js +67 -36
  84. package/dist/style.css +1 -1
  85. package/package.json +1 -1
  86. package/src/components/Accordion/Accordion.vue +1 -1
  87. package/src/components/AppliedFilters/AppliedFilters.vue +1 -1
  88. package/src/components/Filterlist/Filterlist.vue +1 -1
  89. package/src/components/Header/Header.vue +9 -5
  90. package/src/components/Notification/Notification.vue +24 -0
  91. package/src/components/Notification/README.md +32 -0
  92. package/src/components/Pagination/Pagination.vue +1 -1
  93. package/src/components/Table/Table.vue +1 -1
  94. package/src/components/Tabs/Tabs.vue +1 -1
  95. package/src/index.js +2 -1
  96. package/assets/css/components/alert.css +0 -1
  97. package/assets/css/components/alert.css.map +0 -1
  98. package/assets/js/modules/alert.js +0 -41
  99. package/assets/sass/components/alert.scss +0 -121
  100. package/assets/ts/modules/alert.ts +0 -58
  101. package/src/components/Alert/Alert.spec.js +0 -49
  102. package/src/components/Alert/Alert.vue +0 -39
  103. package/src/components/Alert/README.md +0 -29
  104. package/src/components/Header/Header.spec.js +0 -34
@@ -1,3 +1,4 @@
1
+ @use "sass:math";
1
2
  @use "../_func" as *;
2
3
 
3
4
  @import "../../bootstrap/scss/_reboot.scss";
@@ -139,10 +140,86 @@ details {
139
140
  width: 100%;
140
141
  }
141
142
 
143
+
142
144
  // #region Undefined web components
143
- iam-card:not(:defined) {
144
- box-shadow: var(--card-border-radius);
145
+ :is(*):not(:defined) {
146
+ display: block;
147
+ padding: rem(24);
148
+ margin-bottom: rem(24);
149
+ border-radius: rem(8);
150
+ margin-left: auto;
151
+ margin-right: auto;
152
+ max-width: 80rem;
153
+ }
154
+
155
+ main > :is(*):not(:defined) {
156
+
157
+ padding: var(--container-padding);
158
+ padding-top: 1rem;
159
+ }
160
+
161
+ @include media-breakpoint-up(md) {
162
+
163
+ main > :is(*):not(:defined) {
164
+ max-width: 100%!important;
165
+ padding-inline: calc(50% - #{rem(math.div(1112,2))});
166
+ }
167
+
168
+ iam-header:not(:defined) {
169
+ min-height: rem(470);
170
+ }
171
+ }
172
+
173
+ :is(iam-notification,iam-card):not(:defined) {
174
+ box-shadow: var(--card-box-shadow);
145
175
  border-radius: var(--card-border-radius);
146
176
  padding: var(--card-top-padding) var(--card-right-padding) var(--card-bottom-padding) var(--card-left-padding);
147
177
  }
148
- // #endregion
178
+
179
+ main {
180
+ position: relative;
181
+ }
182
+
183
+
184
+ .container.notification__holder {
185
+
186
+ position: fixed;
187
+ top: var(--nav-height);
188
+ left: 50%;
189
+ transform: translate(-50%,0);
190
+
191
+ bottom: 0;
192
+ z-index: 999999;
193
+ pointer-events: none;
194
+ padding-top: 1rem;
195
+ padding-bottom: 1rem;
196
+ display: flex;
197
+ margin: 0;
198
+ width: 100%;
199
+ max-width: rem(454);
200
+ flex-wrap: wrap;
201
+ align-content: flex-start;
202
+ flex-direction: column;
203
+ align-content: flex-end;
204
+ align-items: flex-end;
205
+
206
+ :is(.iam-notification, iam-notification) {
207
+ pointer-events: all;
208
+ margin: 0.5rem 0 0.5rem 0;
209
+ }
210
+
211
+ &.bottom {
212
+ flex-direction: column-reverse;
213
+ }
214
+
215
+ &.left {
216
+ align-content: flex-start;
217
+ align-items: flex-start;
218
+ }
219
+
220
+ &.middle {
221
+ align-content: space-around;
222
+ align-items: center;
223
+ }
224
+ }
225
+ // #endregion
@@ -35,7 +35,7 @@
35
35
  --card-left-padding: 1rem;
36
36
  --card-border-radius: #{rem(8)};
37
37
  --card-box-shadow: 2px 6px 12px rgba(0,0,0,0.2);
38
-
38
+ --nav-height: #{rem(96)};
39
39
  }
40
40
 
41
41
  // Dark mode; functional colours get updated
@@ -63,7 +63,7 @@
63
63
  }
64
64
 
65
65
  // Override the colours when on a dark background, similiar to dark mode but on a module level
66
- [class*="bg-"]:not(.bg-info):not(.bg-success):not(.bg-light):not(.bg-white):not(.bg-canvas):not(.bg-canvas-2):not(.prevent-invert),
66
+ [class*="bg-"]:not(.bg-info):not(.bg-success):not(.bg-light):not(.bg-warning):not(.bg-white):not(.bg-canvas):not(.bg-canvas-2):not(.prevent-invert),
67
67
  .invert-colours {
68
68
 
69
69
  @include invert-colours();
@@ -100,7 +100,7 @@
100
100
  color: var(--colour-body);
101
101
  }
102
102
 
103
- [class*="bg-"][class*="gradient-"]:not(.bg-info):not(.bg-success):not(.bg-light):not(.prevent-invert) {
103
+ [class*="bg-"][class*="gradient-"]:not(.bg-info):not(.bg-success):not(.bg-warning):not(.prevent-invert) {
104
104
 
105
105
  @include invert-colours();
106
106
 
@@ -17,6 +17,7 @@ import iamCard from './components/card/card.component'
17
17
  import iamAppliedFilters from './components/applied-filters/applied-filters.component'
18
18
  import iamPagination from './components/pagination/pagination.component'
19
19
  import iamFilterlist from './components/filterlist/filterlist.component'
20
+ import iamNotification from './components/notification/notification.component'
20
21
 
21
22
  // Attach classes to dom elements
22
23
  document.addEventListener("DOMContentLoaded", function() {
@@ -52,6 +53,9 @@ document.addEventListener("DOMContentLoaded", function() {
52
53
  if (!window.customElements.get(`iam-applied-filters`))
53
54
  window.customElements.define(`iam-applied-filters`, iamAppliedFilters);
54
55
 
56
+ if (!window.customElements.get(`iam-notification`))
57
+ window.customElements.define(`iam-notification`, iamNotification);
58
+
55
59
  // ANav
56
60
  Array.from(document.querySelectorAll('.nav')).forEach((arrayElement) => {
57
61
  nav(arrayElement);
@@ -8,20 +8,21 @@ window.dataLayer.push({
8
8
  "element": "accordion"
9
9
  });
10
10
 
11
- const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
12
-
13
11
  class iamAccordion extends HTMLElement {
14
12
 
15
13
  constructor(){
16
14
  super();
17
15
  this.attachShadow({ mode: 'open'});
18
-
16
+
17
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
18
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
19
+ const loadCSS = `@import "${assetLocation}/css/components/accordion.css";`;
19
20
 
20
21
  const template = document.createElement('template');
21
22
  template.innerHTML = `
22
23
  <style>
23
- @import "${assetLocation}/css/core.min.css";
24
- @import "${assetLocation}/css/components/accordion.css";
24
+ @import "${coreCSS}";
25
+ ${loadCSS}
25
26
  ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
26
27
  </style>
27
28
  <div class="accordion">
@@ -34,9 +35,6 @@ class iamAccordion extends HTMLElement {
34
35
  connectedCallback() {
35
36
 
36
37
  accordion(this);
37
-
38
- // Load in the component CSS into the root so we can style the content of the component
39
- this.insertAdjacentHTML("beforebegin", `<link rel="stylesheet" href="${assetLocation}/css/components/accordion.css">`)
40
38
  }
41
39
  }
42
40
 
@@ -1,20 +1,29 @@
1
1
  // @ts-nocheck
2
2
  import createAppliedFilters from "../../modules/applied-filters";
3
3
 
4
- const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
5
- const loadCSS = `@import "${assetLocation}/css/components/applied-filters.css";`;
4
+ // Data layer Web component created
5
+ window.dataLayer = window.dataLayer || [];
6
+ window.dataLayer.push({
7
+ "event": "customElementRegistered",
8
+ "element": "Applied Filters"
9
+ });
10
+
6
11
 
7
12
  class iamAppliedFilters extends HTMLElement {
8
13
 
9
14
  constructor(){
10
15
  super();
11
16
  this.attachShadow({ mode: 'open'});
17
+
18
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
19
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
20
+ const loadCSS = `@import "${assetLocation}/css/components/applied-filters.css";`;
12
21
 
13
22
  let classList = this.classList.toString();
14
23
  const template = document.createElement('template');
15
24
  template.innerHTML = `
16
25
  <style>
17
- @import "${assetLocation}/css/core.min.css";
26
+ @import "${coreCSS}";
18
27
  ${loadCSS}
19
28
  ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
20
29
  </style>
@@ -1,22 +1,32 @@
1
1
  // @ts-nocheck
2
+
3
+ // Data layer Web component created
4
+ window.dataLayer = window.dataLayer || [];
5
+ window.dataLayer.push({
6
+ "event": "customElementRegistered",
7
+ "element": "Card"
8
+ });
9
+
10
+
2
11
  class iamCard extends HTMLElement {
3
12
 
4
13
  constructor(){
5
14
  super();
6
15
  this.attachShadow({ mode: 'open'});
7
16
 
8
- const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
9
- const loadCSS = `@import "${assetLocation}/css/components/card.css";`;
10
-
11
17
  if(this.querySelector('[class*="fa-"]'))
12
18
  this.classList.add('card--has-icon');
13
19
 
14
20
  let classList = this.classList.toString();
21
+
22
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
23
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
24
+ const loadCSS = `@import "${assetLocation}/css/components/card.css";`;
15
25
 
16
26
  const template = document.createElement('template');
17
27
  template.innerHTML = `
18
28
  <style>
19
- @import "${assetLocation}/css/core.min.css";
29
+ @import "${coreCSS}";
20
30
  ${loadCSS}
21
31
  ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
22
32
  </style>
@@ -35,6 +45,8 @@ class iamCard extends HTMLElement {
35
45
 
36
46
  connectedCallback() {
37
47
 
48
+ this.classList.add('loaded');
49
+
38
50
  // Mimic clicking the parent node so the focus and target events can be on the card
39
51
  const parentNode = this.parentNode.closest('a, button, label')
40
52
  const card = this.shadowRoot.querySelector('.card')
@@ -14,11 +14,13 @@ class iamFilterlist extends HTMLElement {
14
14
  super();
15
15
  this.attachShadow({ mode: 'open'});
16
16
 
17
- const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
17
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
18
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
19
+
18
20
  const template = document.createElement('template');
19
21
  template.innerHTML = `
20
22
  <style>
21
- @import "${assetLocation}/css/core.min.css";
23
+ @import "${coreCSS}";
22
24
  ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
23
25
 
24
26
  :host {
@@ -14,18 +14,15 @@ class iamHeader extends HTMLElement {
14
14
  this.attachShadow({ mode: 'open'});
15
15
 
16
16
  const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
17
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
17
18
  const loadCSS = `@import "${assetLocation}/css/components/header.css";`;
18
19
 
19
20
  const template = document.createElement('template');
20
21
  template.innerHTML = `
21
22
  <style>
22
- @import "${assetLocation}/css/core.min.css";
23
+ @import "${coreCSS}";
23
24
  ${loadCSS}
24
25
  ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
25
- :host {
26
- max-width:100%!important;
27
- padding:0!important;
28
- }
29
26
  </style>
30
27
  <div class="header-banner">
31
28
  <div class="container" part="container">
@@ -47,6 +44,8 @@ class iamHeader extends HTMLElement {
47
44
 
48
45
  connectedCallback() {
49
46
 
47
+ this.classList.add('loaded');
48
+
50
49
  const picture = this.shadowRoot.querySelector('picture');
51
50
  const source = this.shadowRoot.querySelector('picture source');
52
51
 
@@ -0,0 +1,32 @@
1
+ ```
2
+ <!-- Inline -->
3
+ <iam-notification data-status="danger" data-dismiss="">
4
+ <strong>Just an example</strong><br> Alert message will display here <a href="/" data-dismiss-button="" slot="btns" class="link">Retry</a>
5
+ </iam-notification>
6
+
7
+ <!-- Alert -->
8
+ <iam-notification data-type="alert" data-status="danger" data-dismiss="">
9
+ <strong>Just an example</strong><br> Alert message will display here <a href="/" data-dismiss-button="" slot="btns" class="link">Retry</a>
10
+ </iam-notification>
11
+
12
+ <!-- Toast -->
13
+ <iam-notification data-type="toast" data-status="danger" data-dismiss="">
14
+ <strong>Just an example</strong><br> Alert message will display here <a href="/" data-dismiss-button="" slot="btns" class="link">Retry</a>
15
+ </iam-notification>
16
+
17
+ ```
18
+
19
+ **Properties**
20
+
21
+ | Option | Type | Default Value | Description |
22
+ | ------ | ---- | ------------- | ----------- |
23
+ | data-status | String | info | Choose from danger,succes and warning. This will change the colour of the notification box and which icon is shown. |
24
+ | data-type | String | inline | Choose from alert and toast. This will change the behavour of the component. |
25
+ | data-dismiss | Boolean | - | Adds a close button which will remove the alert box after clicking it. |
26
+ | data-timeout | Boolean | - | Adds a timer for how long the notification will appear. |
27
+
28
+ **Slots**
29
+
30
+ | Option | Default Value | Description |
31
+ | ------ | ------------- | ----------- |
32
+ | default | - | This is the content of the notification box |
@@ -0,0 +1,90 @@
1
+ // @ts-nocheck
2
+ import setupNotification, { closeNotification } from "../../modules/notification";
3
+
4
+ // Data layer Web component created
5
+ window.dataLayer = window.dataLayer || [];
6
+ window.dataLayer.push({
7
+ "event": "customElementRegistered",
8
+ "element": "Notification"
9
+ });
10
+
11
+
12
+ class iamNotification extends HTMLElement {
13
+
14
+ constructor(){
15
+ super();
16
+ this.attachShadow({ mode: 'open'});
17
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
18
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
19
+ const loadCSS = `@import "${assetLocation}/css/components/notification.css";`;
20
+
21
+ const buttons = this.querySelectorAll('a,button');
22
+
23
+ Array.from(buttons).forEach((button, index) => {
24
+
25
+ button.setAttribute('slot','btns');
26
+ button.classList.add('link');
27
+ });
28
+
29
+ if(buttons.length || this.hasAttribute('data-dismiss'))
30
+ this.classList.add('notification--dismissable');
31
+
32
+ const template = document.createElement('template');
33
+ template.innerHTML = `
34
+ <style>
35
+ @import "${coreCSS}";
36
+ ${loadCSS}
37
+ ${this.hasAttribute('data-css') ? `${this.getAttribute('data-css')}` : ``}
38
+ </style>
39
+
40
+ <div class="notification">
41
+ <div class="notification__icon"><slot name="icon"></slot></div>
42
+ <div class="notification__inner"><div class="notification__text"><slot></slot></div>${ buttons.length ? `<div class="notification__btns"><slot name="btns"></slot></div>` : '' }</div>
43
+ ${ this.hasAttribute('data-dismiss') ? `<div class="notification__dismiss"><button data-dismiss-button>Dismiss</button></div>` : ''}
44
+ </div>
45
+ `;
46
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
47
+
48
+ }
49
+
50
+ connectedCallback() {
51
+
52
+ const dismissBtn = this.shadowRoot.querySelector('[data-dismiss-button]');
53
+ const statusBG = this.hasAttribute('data-status') ? this.getAttribute('data-status') : 'white'
54
+
55
+ if(this.hasAttribute('data-type'))
56
+ this.classList.add(`bg-${statusBG}`);
57
+ else {
58
+ this.classList.add(`colour-${statusBG}`);
59
+ }
60
+
61
+ const wrapper = this;
62
+
63
+ if(!this.querySelector('i')){
64
+
65
+ switch(statusBG) {
66
+ case 'danger':
67
+ this.innerHTML += '<i class="fa-solid fa-circle-exclamation" aria-hidden="true" slot="icon"></i>';
68
+ break;
69
+ case 'warning':
70
+ this.innerHTML += '<i class="fa-solid fa-triangle-exclamation" aria-hidden="true" slot="icon"></i>';
71
+ break;
72
+ case 'success':
73
+ this.innerHTML += '<i class="fa-solid fa-check-circle" aria-hidden="true" slot="icon"></i>';
74
+ break;
75
+ default:
76
+ this.innerHTML += '<i class="fa-solid fa-circle-info" aria-hidden="true" slot="icon"></i>';
77
+ }
78
+ }
79
+
80
+ setupNotification(wrapper);
81
+
82
+ if(dismissBtn){
83
+ dismissBtn.addEventListener('click', function(e){
84
+ closeNotification(wrapper);
85
+ }, false);
86
+ }
87
+ }
88
+ }
89
+
90
+ export default iamNotification;
@@ -7,16 +7,22 @@ class iamPagination extends HTMLElement {
7
7
  super();
8
8
  this.attachShadow({ mode: 'open'});
9
9
  const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
10
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
10
11
 
11
12
  const template = document.createElement('template');
12
13
  template.innerHTML = `
13
14
  <style>
14
- @import "${assetLocation}/css/core.min.css";
15
+ @import "${coreCSS}";
16
+
17
+ ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
15
18
  </style>
16
19
  <div class="pagination__wrapper d-none">
17
20
  </div>
18
21
  `;
19
22
  this.shadowRoot.appendChild(template.content.cloneNode(true));
23
+ }
24
+
25
+ connectedCallback() {
20
26
 
21
27
  // Set default attributes
22
28
  const params = new URLSearchParams(window.location.search);
@@ -35,9 +41,7 @@ class iamPagination extends HTMLElement {
35
41
 
36
42
  this.setAttribute('data-pages', Math.ceil(this.getAttribute('data-total') / this.getAttribute('data-show')));
37
43
  createPaginationButttons(this,this.shadowRoot.querySelector('.pagination__wrapper'));
38
- }
39
44
 
40
- connectedCallback() {
41
45
  this.shadowRoot.querySelector('.pagination__wrapper').classList.remove('d-none');
42
46
  }
43
47
  }
@@ -8,6 +8,7 @@ class iamTable extends HTMLElement {
8
8
  super();
9
9
  this.attachShadow({ mode: 'open'});
10
10
  const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
11
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
11
12
 
12
13
  const isCTA = this.classList.contains('table--cta');
13
14
  const isExportable = this.classList.contains('table--export');
@@ -20,7 +21,7 @@ class iamTable extends HTMLElement {
20
21
  const template = document.createElement('template');
21
22
  template.innerHTML = `
22
23
  <style>
23
- @import "${assetLocation}/css/core.min.css";
24
+ @import "${coreCSS}";
24
25
 
25
26
  :host(.mh-sm){
26
27
  max-height: none!important;
@@ -31,6 +32,8 @@ class iamTable extends HTMLElement {
31
32
  :host(.mh-lg){
32
33
  max-height: none!important;
33
34
  }
35
+
36
+ ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
34
37
  </style>
35
38
  ${isCTA ? '<div class="table--cta">' : ''}
36
39
  <div class="table__wrapper ${classList}">
@@ -42,6 +45,10 @@ class iamTable extends HTMLElement {
42
45
  `;
43
46
  this.shadowRoot.appendChild(template.content.cloneNode(true));
44
47
 
48
+ }
49
+
50
+ connectedCallback() {
51
+
45
52
  const params = new URLSearchParams(window.location.search)
46
53
  // Set default attributes
47
54
  if(!this.hasAttribute('data-total'))
@@ -57,9 +64,6 @@ class iamTable extends HTMLElement {
57
64
  this.setAttribute('data-increment', 15);
58
65
 
59
66
  this.setAttribute('data-pages', Math.ceil(this.getAttribute('data-total') / this.getAttribute('data-show')));
60
- }
61
-
62
- connectedCallback() {
63
67
 
64
68
  this.table = this.querySelector('table');
65
69
  this.savedTableBody = this.table.querySelector('tbody').cloneNode(true);
@@ -15,10 +15,12 @@ class iamTabs extends HTMLElement {
15
15
  this.attachShadow({ mode: 'open'});
16
16
 
17
17
  const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
18
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
19
+
18
20
  const template = document.createElement('template');
19
21
  template.innerHTML = `
20
22
  <style>
21
- @import "${assetLocation}/css/core.min.css";
23
+ @import "${coreCSS}";
22
24
 
23
25
  :host(.admin-panel){
24
26
  display: contents!important;
@@ -11,6 +11,8 @@ import carousel from '../js/modules/carousel'
11
11
  import form from '../js/modules/form'
12
12
  import youtubeVideo from '../js/modules/youtubevideo'
13
13
 
14
+ import iamNotification from './components/notification/notification.component'
15
+
14
16
  const components = ['accordion','header','tabs', 'table','card','pagination','filterlist', 'applied-filters'];
15
17
  const prefix = "iam"
16
18
  const options = {
@@ -62,6 +64,10 @@ document.addEventListener("DOMContentLoaded", function() {
62
64
  //helpers.checkElements(document.body);
63
65
  extendDialogs(document.body);
64
66
 
67
+
68
+ if (!window.customElements.get(`iam-notification`))
69
+ window.customElements.define(`iam-notification`, iamNotification);
70
+
65
71
  // ANav
66
72
  Array.from(document.querySelectorAll('.nav')).forEach((arrayElement) => {
67
73
  nav(arrayElement);
@@ -13,6 +13,7 @@ import youtubeVideo from '../js/modules/youtubevideo'
13
13
  import tabs from '../js/modules/tabs'
14
14
  import filterlist from '../js/modules/filterlist'
15
15
  import createPaginationButttons from '../js/modules/pagination'
16
+ import setupNotification from '../js/modules/notification'
16
17
 
17
18
  // Attach classes to dom elements
18
19
  document.addEventListener("DOMContentLoaded", function() {
@@ -77,6 +78,13 @@ document.addEventListener("DOMContentLoaded", function() {
77
78
  filterlist(arrayElement.querySelector('ul'),document.querySelector(arrayElement.getAttribute('data-input')));
78
79
  });
79
80
 
81
+
82
+ // notification
83
+ Array.from(document.querySelectorAll('.iam-notification')).forEach((arrayElement) => {
84
+ if(arrayElement.hasAttribute('data-type'))
85
+ setupNotification(arrayElement);
86
+ });
87
+
80
88
  Array.from(document.querySelectorAll('.pagination__wrapper')).forEach((arrayElement) => {
81
89
 
82
90
 
@@ -100,18 +100,14 @@ const extendDialogs = (body) => {
100
100
  // Popover
101
101
  if (event && event.target instanceof HTMLElement && event.target.closest('.dialog__wrapper > button')){
102
102
 
103
- // Close existing open popover
104
-
105
103
  let btn = event.target.closest('.dialog__wrapper > button');
106
104
  let parent = event.target.closest('.dialog__wrapper > button').parentNode;
107
105
  let dataEvent = "openPopover"
108
106
  let popover = parent.querySelector(':scope > dialog');
109
107
 
110
-
111
108
  if(document.querySelector('dialog[open]') && document.querySelector('dialog[open]') != popover)
112
109
  document.querySelector('dialog[open]').close();
113
110
 
114
-
115
111
  // Remove active class from exiting active buttons
116
112
  Array.from(document.querySelectorAll('.dialog__wrapper > button')).forEach((btnElement,index) => {
117
113
  btnElement.classList.remove('active');
@@ -166,6 +162,17 @@ const extendDialogs = (body) => {
166
162
  "id": btn.textContent
167
163
  });
168
164
  };
165
+
166
+ // Close popovers when clicked away
167
+ if (event && event.target instanceof HTMLElement && !event.target.closest('dialog[open]') && !event.target.closest('.dialog__wrapper > button')){
168
+
169
+ if(document.querySelector('.dialog__wrapper:not([data-keep-open]) > dialog[open]'))
170
+ document.querySelector('.dialog__wrapper:not([data-keep-open]) > dialog[open]').close();
171
+
172
+ Array.from(document.querySelectorAll('.dialog__wrapper:not([data-keep-open]) > button')).forEach((btnElement,index) => {
173
+ btnElement.classList.remove('active');
174
+ });
175
+ }
169
176
  });
170
177
 
171
178
  return null
@@ -17,6 +17,23 @@ export const addBodyClasses = (body) => {
17
17
  body.classList.add("ie");
18
18
  }
19
19
 
20
+ let nav = document.querySelector('nav');
21
+ if(nav) {
22
+ let navHeight = nav.offsetHeight;
23
+ document.querySelector('body').style.setProperty("--nav-height", `${navHeight}px`);
24
+
25
+ function outputsize() {
26
+
27
+ navHeight = nav.offsetHeight;
28
+ document.querySelector('body').style.setProperty("--nav-height", `${navHeight}px`);
29
+ }
30
+
31
+ new ResizeObserver(outputsize).observe(nav);
32
+ }
33
+ else {
34
+ document.querySelector('body').style.setProperty("--nav-height", `0px`);
35
+ }
36
+
20
37
  return null
21
38
  }
22
39