@iamproperty/components 3.7.4 → 3.7.6
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.
- package/assets/css/components/card.css +1 -1
- package/assets/css/components/card.css.map +1 -1
- package/assets/css/components/dialog.css +1 -1
- package/assets/css/components/dialog.css.map +1 -1
- package/assets/css/components/notification.css +1 -0
- package/assets/css/components/notification.css.map +1 -0
- package/assets/css/components/table.css +1 -1
- package/assets/css/components/table.css.map +1 -1
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/js/bundle.js +3 -0
- package/assets/js/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
- package/assets/js/components/card/card.component.min.js +2 -2
- package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
- package/assets/js/components/header/header.component.min.js +1 -1
- package/assets/js/components/notification/notification.component.js +71 -0
- package/assets/js/components/notification/notification.component.min.js +18 -0
- package/assets/js/components/notification/notification.component.min.js.map +1 -0
- package/assets/js/components/pagination/pagination.component.js +2 -2
- package/assets/js/components/pagination/pagination.component.min.js +11 -11
- package/assets/js/components/pagination/pagination.component.min.js.map +1 -1
- package/assets/js/components/table/table.component.js +14 -11
- package/assets/js/components/table/table.component.min.js +14 -15
- package/assets/js/components/table/table.component.min.js.map +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +1 -1
- package/assets/js/dynamic.js +3 -0
- package/assets/js/dynamic.min.js +14 -2
- package/assets/js/dynamic.min.js.map +1 -1
- package/assets/js/flat-components.js +6 -0
- package/assets/js/modules/helpers.js +13 -0
- package/assets/js/modules/notification.js +53 -0
- package/assets/js/modules/table.js +1 -1
- package/assets/js/scripts.bundle.js +37 -26
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +2 -2
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/sass/_components.scss +1 -1
- package/assets/sass/components/card.scss +7 -2
- package/assets/sass/components/dialog.scss +14 -10
- package/assets/sass/components/notification.scss +195 -0
- package/assets/sass/components/table.scss +2 -4
- package/assets/sass/foundations/reboot.scss +48 -1
- package/assets/sass/foundations/root.scss +3 -3
- package/assets/ts/bundle.ts +4 -0
- package/assets/ts/components/notification/README.md +32 -0
- package/assets/ts/components/notification/notification.component.ts +90 -0
- package/assets/ts/components/pagination/pagination.component.ts +3 -2
- package/assets/ts/components/table/table.component.ts +20 -14
- package/assets/ts/dynamic.ts +6 -0
- package/assets/ts/flat-components.ts +8 -0
- package/assets/ts/modules/helpers.ts +17 -0
- package/assets/ts/modules/notification.ts +76 -0
- package/assets/ts/modules/table.ts +1 -1
- package/dist/components.es.js +662 -640
- package/dist/components.umd.js +40 -29
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/Notification/Notification.vue +24 -0
- package/src/components/Notification/README.md +32 -0
- package/src/index.js +2 -1
- package/assets/css/components/alert.css +0 -1
- package/assets/css/components/alert.css.map +0 -1
- package/assets/js/modules/alert.js +0 -41
- package/assets/sass/components/alert.scss +0 -121
- package/assets/ts/modules/alert.ts +0 -58
- package/src/components/Alert/Alert.spec.js +0 -49
- package/src/components/Alert/Alert.vue +0 -39
- package/src/components/Alert/README.md +0 -29
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
@use "components/header.scss";
|
|
4
4
|
@use "components/testimonial.scss";
|
|
5
5
|
@use "components/accordion.scss";
|
|
6
|
-
@use "components/
|
|
6
|
+
@use "components/notification";
|
|
7
7
|
@use "components/carousel.scss";
|
|
8
8
|
@use "components/property-searchbar.scss";
|
|
9
9
|
@use "components/tabs.scss";
|
|
@@ -224,12 +224,17 @@
|
|
|
224
224
|
position: absolute;
|
|
225
225
|
top: 0;
|
|
226
226
|
left: 0;
|
|
227
|
-
width:
|
|
228
|
-
height:
|
|
227
|
+
width: 102%;
|
|
228
|
+
height: 102%;
|
|
229
229
|
object-fit: cover;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
+
|
|
234
|
+
.card.card--lg-image:has(.card__head) .card__head{
|
|
235
|
+
|
|
236
|
+
padding-top: 55%;
|
|
237
|
+
}
|
|
233
238
|
// #endregion
|
|
234
239
|
|
|
235
240
|
//#region card with a footer
|
|
@@ -37,6 +37,11 @@ dialog[open] {
|
|
|
37
37
|
// #endregion
|
|
38
38
|
|
|
39
39
|
// #region modal styling
|
|
40
|
+
|
|
41
|
+
*:not(.dialog__wrapper) > dialog[open] {
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
*:not(.dialog__wrapper) > dialog[open] {
|
|
41
46
|
overflow-y: hidden;
|
|
42
47
|
width: 90vw;
|
|
@@ -135,16 +140,9 @@ dialog[open] {
|
|
|
135
140
|
max-width: rem(1112);
|
|
136
141
|
}
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
> .btn:not(.dialog__close),
|
|
143
|
-
> form > .btn:not(.dialog__close),
|
|
144
|
-
> .mh-lg > :is(form,div) > .btn:not(.dialog__close),
|
|
145
|
-
> .mh-lg > .btn:not(.dialog__close),
|
|
146
|
-
> form > fieldset > .btn:not(.dialog__close),
|
|
147
|
-
.btn--wrapper > .btn:not(.dialog__close) {
|
|
143
|
+
@media screen and (max-width: 36em) {
|
|
144
|
+
|
|
145
|
+
:is(form, fieldset, .btn--wrapper):has(> .btn:first-child, > .btn:last-child) .btn:not(.dialog__close) {
|
|
148
146
|
width: 100%;
|
|
149
147
|
max-width: 100%;
|
|
150
148
|
margin: 0;
|
|
@@ -242,6 +240,7 @@ dialog::backdrop {
|
|
|
242
240
|
|
|
243
241
|
&:not(:has(fieldset.active)) fieldset:first-of-type{
|
|
244
242
|
display: flex;
|
|
243
|
+
flex-direction: column;
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
form > *:not(fieldset) {
|
|
@@ -319,6 +318,11 @@ dialog::backdrop {
|
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
320
|
|
|
321
|
+
@include media-breakpoint-up(sm) {
|
|
322
|
+
min-width: rem(452);
|
|
323
|
+
width: rem(452);
|
|
324
|
+
max-width: rem(452);
|
|
325
|
+
}
|
|
322
326
|
@include media-breakpoint-up(md) {
|
|
323
327
|
min-width: rem(924);
|
|
324
328
|
width: rem(924);
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
@use "../_func" as *;
|
|
2
|
+
|
|
3
|
+
:host,
|
|
4
|
+
.iam-notification {
|
|
5
|
+
display: block;
|
|
6
|
+
padding: rem(22) rem(24) rem(22) rem(24 - 8)!important;
|
|
7
|
+
border-radius: rem(8);
|
|
8
|
+
box-shadow: 2px 6px 12px rgba(0,0,0,0.2);
|
|
9
|
+
margin-bottom: 1rem;
|
|
10
|
+
font-size: rem(15);
|
|
11
|
+
border: rem(2) solid var(--colour,var(--colour-info));
|
|
12
|
+
background: #e9f9fd;
|
|
13
|
+
outline: var(--contrast-outline-width, 0px) solid var(--colour-primary);
|
|
14
|
+
|
|
15
|
+
::slotted(i),
|
|
16
|
+
i {
|
|
17
|
+
color: var(--colour,currentColor);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([data-type]),
|
|
22
|
+
.iam-notification[data-type] {
|
|
23
|
+
|
|
24
|
+
border: rem(2) solid transparent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host(.colour-warning),
|
|
28
|
+
.iam-notification.colour-warning {
|
|
29
|
+
|
|
30
|
+
background: #FFF6E6;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host(.colour-danger),
|
|
34
|
+
.iam-notification.colour-danger {
|
|
35
|
+
|
|
36
|
+
background: #fcebec;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host(.colour-success),
|
|
40
|
+
.iam-notification.colour-success {
|
|
41
|
+
|
|
42
|
+
background: #f8fdf6;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host(.bg-white),
|
|
46
|
+
.iam-notification.bg-white{
|
|
47
|
+
|
|
48
|
+
border: none;
|
|
49
|
+
border-left: rem(8) solid var(--colour-info);
|
|
50
|
+
|
|
51
|
+
::slotted(i),
|
|
52
|
+
i {
|
|
53
|
+
color: var(--colour-info);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Alerts
|
|
58
|
+
:host([data-type="alert"]),
|
|
59
|
+
.iam-notification[data-type="alert"] {
|
|
60
|
+
border-radius: 0;
|
|
61
|
+
position: fixed;
|
|
62
|
+
top: var(--nav-height);
|
|
63
|
+
left: 0;
|
|
64
|
+
right: 0;
|
|
65
|
+
z-index: calc(var(--index-menu) - 1);
|
|
66
|
+
margin-bottom: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Toasts
|
|
70
|
+
:host([data-type="toast"]),
|
|
71
|
+
.iam-notification[data-type="toast"] {
|
|
72
|
+
|
|
73
|
+
margin: auto;
|
|
74
|
+
display: block;
|
|
75
|
+
|
|
76
|
+
width: 100%;
|
|
77
|
+
max-width: rem(360);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host([data-type="toast"].notification--dismissable) {
|
|
81
|
+
|
|
82
|
+
max-width: rem(454);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.notification {
|
|
86
|
+
|
|
87
|
+
container-type: inline-size;
|
|
88
|
+
max-width: rem(1112);
|
|
89
|
+
margin-inline: auto;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-wrap: nowrap;
|
|
92
|
+
|
|
93
|
+
@media screen and (prefers-color-scheme: light) {
|
|
94
|
+
color: var(--colour-heading);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.notification__icon {
|
|
98
|
+
|
|
99
|
+
margin-inline-end: rem(16);
|
|
100
|
+
flex-grow: 0;
|
|
101
|
+
|
|
102
|
+
::slotted(i) {
|
|
103
|
+
font-size: rem(18);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.notification__inner {
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-wrap: wrap;
|
|
110
|
+
flex-grow: 1;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@container (width > 23.4375em) {
|
|
114
|
+
|
|
115
|
+
flex-wrap: nowrap;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.notification__text {
|
|
120
|
+
flex-grow: 1;
|
|
121
|
+
flex-shrink: 1;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.notification__btns {
|
|
126
|
+
flex-grow: 0;
|
|
127
|
+
flex-shrink: 0;
|
|
128
|
+
--colour-underline: currentColor;
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
::slotted(a),
|
|
132
|
+
::slotted(button),
|
|
133
|
+
> * {
|
|
134
|
+
margin: rem(16) rem(16) 0 0!important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@container (width > 23.4375em) {
|
|
138
|
+
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
border-left: 1px solid currentColor;
|
|
142
|
+
margin-left: rem(32);
|
|
143
|
+
|
|
144
|
+
::slotted(a),
|
|
145
|
+
::slotted(button),
|
|
146
|
+
> * {
|
|
147
|
+
margin: 0 0 0 rem(32)!important;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.notification__dismiss {
|
|
153
|
+
flex-grow: 0;
|
|
154
|
+
padding-left: 1rem;
|
|
155
|
+
|
|
156
|
+
button {
|
|
157
|
+
text-indent: 300%;
|
|
158
|
+
overflow: hidden;
|
|
159
|
+
border: none;
|
|
160
|
+
height: rem(18);
|
|
161
|
+
width: rem(18);
|
|
162
|
+
background: transparent;
|
|
163
|
+
display: inline-block;
|
|
164
|
+
position: relative;
|
|
165
|
+
color: inherit;
|
|
166
|
+
|
|
167
|
+
&:after {
|
|
168
|
+
content: "";
|
|
169
|
+
top: 0;
|
|
170
|
+
left: 0;
|
|
171
|
+
position: absolute;
|
|
172
|
+
display: block;
|
|
173
|
+
height: rem(18);
|
|
174
|
+
width: rem(18);
|
|
175
|
+
z-index: var(--index-focus);
|
|
176
|
+
background: currentColor;
|
|
177
|
+
mask-image: var(--icon-close);
|
|
178
|
+
mask-size: 100%;
|
|
179
|
+
mask-repeat: no-repeat;
|
|
180
|
+
mask-position: 50% 50%;
|
|
181
|
+
-webkit-mask-image: var(--icon-close);
|
|
182
|
+
-webkit-mask-size: 100%;
|
|
183
|
+
-webkit-mask-repeat: no-repeat;
|
|
184
|
+
-webkit-mask-position: 50% 50%;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@container (width > 23.4375em) {
|
|
189
|
+
|
|
190
|
+
padding-left: rem(32);
|
|
191
|
+
display: flex;
|
|
192
|
+
align-items: center;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -151,13 +151,11 @@ table.border-0 {
|
|
|
151
151
|
// #endregion
|
|
152
152
|
|
|
153
153
|
// #region Tables are only stacked on mobile
|
|
154
|
-
*:has(> iam-table)
|
|
155
|
-
container-type: inline-size;
|
|
156
|
-
}
|
|
154
|
+
*:has(> iam-table),
|
|
157
155
|
*:has(> .iam-table){
|
|
158
156
|
container-type: inline-size;
|
|
159
|
-
|
|
160
157
|
}
|
|
158
|
+
|
|
161
159
|
@container (width < 23.4375em) {
|
|
162
160
|
|
|
163
161
|
.iam-table, iam-table {
|
|
@@ -170,9 +170,56 @@ main > :is(*):not(:defined) {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
iam-card:not(:defined) {
|
|
173
|
+
:is(iam-notification,iam-card):not(:defined) {
|
|
174
174
|
box-shadow: var(--card-box-shadow);
|
|
175
175
|
border-radius: var(--card-border-radius);
|
|
176
176
|
padding: var(--card-top-padding) var(--card-right-padding) var(--card-bottom-padding) var(--card-left-padding);
|
|
177
177
|
}
|
|
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
|
+
}
|
|
178
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-
|
|
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
|
|
package/assets/ts/bundle.ts
CHANGED
|
@@ -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);
|
|
@@ -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;
|
|
@@ -20,6 +20,9 @@ class iamPagination extends HTMLElement {
|
|
|
20
20
|
</div>
|
|
21
21
|
`;
|
|
22
22
|
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
connectedCallback() {
|
|
23
26
|
|
|
24
27
|
// Set default attributes
|
|
25
28
|
const params = new URLSearchParams(window.location.search);
|
|
@@ -38,9 +41,7 @@ class iamPagination extends HTMLElement {
|
|
|
38
41
|
|
|
39
42
|
this.setAttribute('data-pages', Math.ceil(this.getAttribute('data-total') / this.getAttribute('data-show')));
|
|
40
43
|
createPaginationButttons(this,this.shadowRoot.querySelector('.pagination__wrapper'));
|
|
41
|
-
}
|
|
42
44
|
|
|
43
|
-
connectedCallback() {
|
|
44
45
|
this.shadowRoot.querySelector('.pagination__wrapper').classList.remove('d-none');
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -10,14 +10,6 @@ class iamTable extends HTMLElement {
|
|
|
10
10
|
const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
|
|
11
11
|
const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
|
|
12
12
|
|
|
13
|
-
const isCTA = this.classList.contains('table--cta');
|
|
14
|
-
const isExportable = this.classList.contains('table--export');
|
|
15
|
-
|
|
16
|
-
let classList = this.classList.toString();
|
|
17
|
-
|
|
18
|
-
classList = classList.replace('table--cta','');
|
|
19
|
-
classList = classList.replace('table--loading','');
|
|
20
|
-
|
|
21
13
|
const template = document.createElement('template');
|
|
22
14
|
template.innerHTML = `
|
|
23
15
|
<style>
|
|
@@ -35,17 +27,21 @@ class iamTable extends HTMLElement {
|
|
|
35
27
|
|
|
36
28
|
${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
|
|
37
29
|
</style>
|
|
38
|
-
|
|
39
|
-
<div class="table__wrapper
|
|
30
|
+
<div class="table--cta">
|
|
31
|
+
<div class="table__wrapper">
|
|
40
32
|
<slot></slot>
|
|
41
33
|
</div>
|
|
42
|
-
|
|
43
|
-
${isExportable ? '<button class="link" type="button" data-export>Export table as CSV</button>' : ''}
|
|
34
|
+
</div>
|
|
44
35
|
<div class="table__pagination"></div>
|
|
45
36
|
`;
|
|
46
37
|
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
47
38
|
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
|
|
48
43
|
const params = new URLSearchParams(window.location.search)
|
|
44
|
+
|
|
49
45
|
// Set default attributes
|
|
50
46
|
if(!this.hasAttribute('data-total'))
|
|
51
47
|
this.setAttribute('data-total', this.querySelectorAll('table tbody tr').length);
|
|
@@ -60,14 +56,24 @@ class iamTable extends HTMLElement {
|
|
|
60
56
|
this.setAttribute('data-increment', 15);
|
|
61
57
|
|
|
62
58
|
this.setAttribute('data-pages', Math.ceil(this.getAttribute('data-total') / this.getAttribute('data-show')));
|
|
63
|
-
}
|
|
64
59
|
|
|
65
|
-
|
|
60
|
+
// Update table__wrapper class
|
|
61
|
+
let classList = this.classList.toString();
|
|
62
|
+
|
|
63
|
+
classList = classList.replace('table--cta','');
|
|
64
|
+
classList = classList.replace('table--loading','');
|
|
65
|
+
this.shadowRoot.querySelector('.table__wrapper').className += ` ${classList}`;
|
|
66
66
|
|
|
67
67
|
this.table = this.querySelector('table');
|
|
68
68
|
this.savedTableBody = this.table.querySelector('tbody').cloneNode(true);
|
|
69
69
|
this.pagination = this.shadowRoot.querySelector('.table__pagination');
|
|
70
70
|
|
|
71
|
+
// Remove table CTA
|
|
72
|
+
const isCTA = this.classList.contains('table--cta');
|
|
73
|
+
|
|
74
|
+
if(!isCTA)
|
|
75
|
+
this.shadowRoot.querySelector('.table--cta').classList.remove('table--cta');
|
|
76
|
+
|
|
71
77
|
// Set events on the filter table
|
|
72
78
|
this.form = document.createElement('form');
|
|
73
79
|
if(this.hasAttribute('data-filterby')){
|
package/assets/ts/dynamic.ts
CHANGED
|
@@ -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
|
|
|
@@ -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
|
|