@iamproperty/components 7.2.2--beta2 → 7.3.0
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/actionbar.component.css +1 -1
- package/assets/css/components/actionbar.component.css.map +1 -1
- package/assets/css/components/barchart.component.css.map +1 -1
- package/assets/css/components/bento-grid.global.css.map +1 -1
- package/assets/css/components/card.component.css +1 -1
- package/assets/css/components/card.component.css.map +1 -1
- package/assets/css/components/charts.module.css.map +1 -1
- package/assets/css/components/doughnutchart.component.css.map +1 -1
- package/assets/css/components/fileupload.css +1 -1
- package/assets/css/components/fileupload.css.map +1 -1
- package/assets/css/components/menu.component.css +1 -1
- package/assets/css/components/menu.component.css.map +1 -1
- package/assets/css/components/menu.css +1 -1
- package/assets/css/components/menu.css.map +1 -1
- package/assets/css/components/nav.component.css +1 -1
- package/assets/css/components/nav.component.css.map +1 -1
- package/assets/css/components/rank.component.css +1 -1
- package/assets/css/components/rank.component.css.map +1 -1
- package/assets/css/components/rankings.component.css +1 -1
- package/assets/css/components/rankings.component.css.map +1 -1
- package/assets/css/components/rankings.global.css +1 -1
- package/assets/css/components/rankings.global.css.map +1 -1
- package/assets/css/components/slider.css.map +1 -1
- package/assets/css/components/table-basic.global.css.map +1 -1
- package/assets/css/components/table.global.css.map +1 -1
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/mobile-core.min.css +1 -1
- package/assets/css/mobile-core.min.css.map +1 -1
- package/assets/css/mobile.min.css +1 -1
- package/assets/css/mobile.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/img/thumbnail.png +0 -0
- package/assets/js/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/actionbar/actionbar.component.min.js +2 -2
- package/assets/js/components/address-lookup/address-lookup.component.min.js +1 -1
- package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
- package/assets/js/components/barchart/barchart.component.min.js +1 -1
- package/assets/js/components/bento-grid/bento-grid.component.min.js +1 -1
- package/assets/js/components/card/card.component.min.js +2 -2
- package/assets/js/components/carousel/carousel.component.min.js +1 -1
- package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
- package/assets/js/components/doughnutchart/doughnutchart.component.min.js +1 -1
- package/assets/js/components/fileupload/fileupload.component.min.js +4 -4
- package/assets/js/components/filter-card/filter-card.component.min.js +1 -1
- 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/inline-edit/inline-edit.component.min.js +1 -1
- package/assets/js/components/marketing/marketing.component.min.js +1 -1
- package/assets/js/components/menu/menu.component.js +138 -159
- package/assets/js/components/menu/menu.component.min.js +4 -69
- package/assets/js/components/menu/menu.component.min.js.map +1 -1
- package/assets/js/components/multi-step/multi-step.component.min.js +1 -1
- package/assets/js/components/multiselect/multiselect.component.min.js +1 -1
- package/assets/js/components/nav/nav.component.min.js +2 -2
- package/assets/js/components/notification/notification.component.min.js +1 -1
- package/assets/js/components/pagination/pagination.component.min.js +1 -1
- package/assets/js/components/rank/rank.component.min.js +4 -4
- package/assets/js/components/rankings/rankings.component.min.js +5 -5
- package/assets/js/components/record-card/record-card.component.min.js +1 -1
- package/assets/js/components/search/search.component.min.js +1 -1
- package/assets/js/components/slider/slider.component.min.js +1 -1
- package/assets/js/components/table/table.component.min.js +1 -1
- package/assets/js/components/table-ajax/table-ajax.component.min.js +1 -1
- package/assets/js/components/table-basic/table-basic.component.min.js +1 -1
- package/assets/js/components/table-no-submit/table-no-submit.component.min.js +1 -1
- package/assets/js/components/table-submit/table-submit.component.min.js +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +1 -1
- package/assets/js/components/video-card/video-card.component.js +3 -66
- package/assets/js/components/video-card/video-card.component.min.js +5 -5
- package/assets/js/components/video-card/video-card.component.min.js.map +1 -1
- package/assets/js/modules/videos.js +147 -0
- package/assets/js/scripts.bundle.js +3 -3
- 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/js/scripts.js +13 -2
- package/assets/sass/_elements.scss +6 -0
- package/assets/sass/_functions/functions.scss +6 -6
- package/assets/sass/_functions/variables.scss +24 -33
- package/assets/sass/_utility-mixins.scss +1 -0
- package/assets/sass/components/actionbar.component.scss +2 -3
- package/assets/sass/components/bento-grid.global.scss +0 -1
- package/assets/sass/components/charts.module.scss +0 -2
- package/assets/sass/components/fileupload.scss +3 -3
- package/assets/sass/components/menu.component.scss +123 -31
- package/assets/sass/components/menu.scss +68 -7
- package/assets/sass/components/nav.component.scss +2 -4
- package/assets/sass/components/rank.component.scss +14 -23
- package/assets/sass/components/rankings.component.scss +1 -7
- package/assets/sass/components/rankings.global.scss +6 -12
- package/assets/sass/components/table-basic.global.scss +2 -4
- package/assets/sass/components/table.global.scss +4 -4
- package/assets/sass/elements/buttons--global.scss +1 -1
- package/assets/sass/elements/details.scss +2 -4
- package/assets/sass/elements/dialog.scss +1 -3
- package/assets/sass/elements/forms.scss +28 -18
- package/assets/sass/elements/links.scss +49 -1
- package/assets/sass/elements/toggle-button.scss +55 -0
- package/assets/sass/elements/type.scss +15 -46
- package/assets/sass/error.scss +3 -9
- package/assets/sass/foundations/reboot.scss +3 -3
- package/assets/sass/templates/form.scss +4 -8
- package/assets/ts/components/menu/menu.component.ts +152 -171
- package/assets/ts/components/rank/rank.component.ts +1 -6
- package/assets/ts/components/rankings/rankings.component.ts +1 -7
- package/assets/ts/components/video-card/video-card.component.ts +4 -77
- package/assets/ts/modules/videos.ts +194 -0
- package/assets/ts/scripts.ts +7 -1
- package/dist/components.es.js +19 -19
- package/dist/components.umd.js +78 -143
- package/package.json +1 -1
- package/src/components/Rank/Rank.vue +1 -2
- package/src/components/Rankings/Rankings.vue +9 -10
|
@@ -24,7 +24,6 @@ class iamMenu extends HTMLElement {
|
|
|
24
24
|
const menuID = this.hasAttribute('id') ? this.getAttribute('id') : false;
|
|
25
25
|
const menuButton = document.querySelector(`[popovertarget="${menuID}"]`);
|
|
26
26
|
|
|
27
|
-
const menuInner = this.shadowRoot.querySelector('.menu--inner');
|
|
28
27
|
const topLevelmenuItems = this.querySelectorAll(':scope > a, :scope > button, :scope > details > summary');
|
|
29
28
|
const menuItems = this.querySelectorAll('a, button');
|
|
30
29
|
const subMenus = this.querySelectorAll('details');
|
|
@@ -34,188 +33,170 @@ class iamMenu extends HTMLElement {
|
|
|
34
33
|
|
|
35
34
|
// Set the needed CSS styles to connect the ID attribute to the anchor name
|
|
36
35
|
if (menuID && menuButton) {
|
|
37
|
-
|
|
36
|
+
this.setAttribute('role', 'menu');
|
|
38
37
|
this.style['position-anchor'] = `--${menuID}`;
|
|
39
38
|
|
|
40
39
|
menuButton?.setAttribute('aria-haspopup', 'true');
|
|
41
40
|
menuButton?.style['anchor-name'] = `--${menuID}`;
|
|
42
41
|
menuButton?.setAttribute('aria-controls', menuID);
|
|
42
|
+
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
item.setAttribute('
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
event.keyCode // change to event.key to key to use the above variable
|
|
65
|
-
) {
|
|
66
|
-
case 27: // Esc
|
|
67
|
-
if (activeItem.closest('details')) {
|
|
68
|
-
event.stopPropagation();
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
activeItem.closest('details').removeAttribute('open');
|
|
71
|
-
activeItem.closest('details').querySelector(':scope summary').focus();
|
|
72
|
-
} else {
|
|
73
|
-
event.stopPropagation();
|
|
74
|
-
menuButton.focus();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
break;
|
|
78
|
-
case 32: // Space
|
|
79
|
-
case 13: // Enter
|
|
80
|
-
if (activeItem.matches('summary') && !activeItem.parentElement.matches('details[open]')) {
|
|
81
|
-
activeItem.parentElement.setAttribute('open', true);
|
|
82
|
-
const subMenuItems = activeItem
|
|
83
|
-
.closest('details')
|
|
84
|
-
.querySelectorAll('a, button, :scope details > summary');
|
|
85
|
-
Array.from(subMenuItems)[0].focus();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
break;
|
|
89
|
-
case 35: // end
|
|
90
|
-
event.stopPropagation();
|
|
91
|
-
event.preventDefault();
|
|
92
|
-
|
|
93
|
-
this.querySelector('details[open]').removeAttribute('open');
|
|
94
|
-
Array.from(menuItems)[menuItems.length - 1].focus();
|
|
95
|
-
|
|
96
|
-
break;
|
|
97
|
-
case 36: // home
|
|
98
|
-
event.stopPropagation();
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
|
|
101
|
-
this.querySelector('details[open]').removeAttribute('open');
|
|
102
|
-
Array.from(menuItems)[0].focus();
|
|
103
|
-
|
|
104
|
-
break;
|
|
105
|
-
case 38: // up
|
|
44
|
+
menuItems.forEach((item, index) => {
|
|
45
|
+
item.setAttribute('role', 'menuitem');
|
|
46
|
+
item.setAttribute('tabindex', '0');
|
|
47
|
+
|
|
48
|
+
if (index == 0) {
|
|
49
|
+
item.setAttribute('autofocus', true);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
this.addEventListener('keydown', (event) => {
|
|
54
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('a, button, summary')) {
|
|
55
|
+
const activeItem = document.activeElement;
|
|
56
|
+
const prevIndex = Array.from(topLevelmenuItems).indexOf(activeItem) - 1;
|
|
57
|
+
const nextIndex = Array.from(topLevelmenuItems).indexOf(activeItem) + 1;
|
|
58
|
+
|
|
59
|
+
switch (
|
|
60
|
+
event.keyCode // change to event.key to key to use the above variable
|
|
61
|
+
) {
|
|
62
|
+
case 27: // Esc
|
|
63
|
+
if (activeItem.closest('details')) {
|
|
106
64
|
event.stopPropagation();
|
|
107
65
|
event.preventDefault();
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
Array.from(topLevelmenuItems)[prevIndex].focus();
|
|
112
|
-
else Array.from(topLevelmenuItems)[topLevelmenuItems.length - 1].focus();
|
|
113
|
-
} else if (activeItem.closest('details')) {
|
|
114
|
-
const subMenuItems = activeItem
|
|
115
|
-
.closest('details')
|
|
116
|
-
.querySelectorAll('a, button, :scope details > summary');
|
|
117
|
-
subPrevIndex = Array.from(subMenuItems).indexOf(activeItem) - 1;
|
|
118
|
-
|
|
119
|
-
if (Array.from(subMenuItems)[subPrevIndex] != undefined) Array.from(subMenuItems)[subPrevIndex].focus();
|
|
120
|
-
else Array.from(subMenuItems)[subMenuItems.length - 1].focus();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
break;
|
|
124
|
-
case 40: // down
|
|
66
|
+
activeItem.closest('details').removeAttribute('open');
|
|
67
|
+
activeItem.closest('details').querySelector(':scope summary').focus();
|
|
68
|
+
} else {
|
|
125
69
|
event.stopPropagation();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
70
|
+
menuButton.focus();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
break;
|
|
74
|
+
case 32: // Space
|
|
75
|
+
case 13: // Enter
|
|
76
|
+
break;
|
|
77
|
+
case 35: // end
|
|
78
|
+
event.stopPropagation();
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
|
|
81
|
+
this.querySelector('details[open]').removeAttribute('open');
|
|
82
|
+
Array.from(menuItems)[menuItems.length - 1].focus();
|
|
83
|
+
|
|
84
|
+
break;
|
|
85
|
+
case 36: // home
|
|
86
|
+
event.stopPropagation();
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
|
|
89
|
+
this.querySelector('details[open]').removeAttribute('open');
|
|
90
|
+
Array.from(menuItems)[0].focus();
|
|
91
|
+
|
|
92
|
+
break;
|
|
93
|
+
case 38: // up
|
|
94
|
+
event.stopPropagation();
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
|
|
97
|
+
if (Array.from(topLevelmenuItems).indexOf(activeItem) > -1) {
|
|
98
|
+
if (Array.from(topLevelmenuItems)[prevIndex] != undefined)
|
|
99
|
+
Array.from(topLevelmenuItems)[prevIndex].focus();
|
|
100
|
+
else Array.from(topLevelmenuItems)[topLevelmenuItems.length - 1].focus();
|
|
101
|
+
} else if (activeItem.closest('details')) {
|
|
102
|
+
const subMenuItems = activeItem
|
|
103
|
+
.closest('details')
|
|
104
|
+
.querySelectorAll('a, button, :scope details > summary');
|
|
105
|
+
subPrevIndex = Array.from(subMenuItems).indexOf(activeItem) - 1;
|
|
106
|
+
|
|
107
|
+
if (Array.from(subMenuItems)[subPrevIndex] != undefined) Array.from(subMenuItems)[subPrevIndex].focus();
|
|
108
|
+
else Array.from(subMenuItems)[subMenuItems.length - 1].focus();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
break;
|
|
112
|
+
case 40: // down
|
|
113
|
+
event.stopPropagation();
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
|
|
116
|
+
if (Array.from(topLevelmenuItems).indexOf(activeItem) > -1) {
|
|
117
|
+
if (Array.from(topLevelmenuItems)[nextIndex] != undefined)
|
|
118
|
+
Array.from(topLevelmenuItems)[nextIndex].focus();
|
|
119
|
+
else Array.from(topLevelmenuItems)[0].focus();
|
|
120
|
+
} else if (activeItem.closest('details')) {
|
|
121
|
+
const subMenuItems = activeItem
|
|
122
|
+
.closest('details')
|
|
123
|
+
.querySelectorAll('a, button, :scope details > summary');
|
|
124
|
+
subNextIndex = Array.from(subMenuItems).indexOf(activeItem) + 1;
|
|
125
|
+
|
|
126
|
+
if (Array.from(subMenuItems)[subNextIndex] != undefined) Array.from(subMenuItems)[subNextIndex].focus();
|
|
127
|
+
else Array.from(subMenuItems)[0].focus();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
this.addEventListener('toggle', (e) => {
|
|
136
|
+
const updateEvent = new CustomEvent(e.newState, { detail: { id: this.getAttribute('id'), target: e.target } });
|
|
137
|
+
this.dispatchEvent(updateEvent);
|
|
138
|
+
|
|
139
|
+
if (this.hasAttribute('popover-open')) {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
this.removeAttribute('popover-open');
|
|
142
|
+
this.hidePopover();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if(this.matches(':popover-open') && document.querySelector(`[popovertarget="${this.getAttribute('id')}"]`)){
|
|
146
|
+
|
|
147
|
+
document.querySelector(`[popovertarget="${this.getAttribute('id')}"]`)?.setAttribute('aria-pressed','true');
|
|
148
|
+
document.querySelector(`[popovertarget="${this.getAttribute('id')}"]`)?.classList.add('active');
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
|
|
152
|
+
document.querySelector(`[popovertarget="${this.getAttribute('id')}"]`)?.removeAttribute('aria-pressed');
|
|
153
|
+
document.querySelector(`[popovertarget="${this.getAttribute('id')}"]`)?.classList.remove('active');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
this.addEventListener('click', (event) => {
|
|
158
|
+
if (
|
|
159
|
+
event &&
|
|
160
|
+
event.target instanceof HTMLElement &&
|
|
161
|
+
event.target.closest('button:has(+ iam-menu:not([popover]))')
|
|
162
|
+
) {
|
|
163
|
+
const button = event.target.closest('button:has(+ iam-menu)');
|
|
164
|
+
|
|
165
|
+
button?.classList.toggle('open');
|
|
166
|
+
} else if (event && event.target instanceof HTMLElement && event.target.closest('button.selectable')) {
|
|
167
|
+
const button = event.target.closest('button.selectable');
|
|
168
|
+
if (this.hasAttribute('multiple')) {
|
|
169
|
+
button.classList.toggle('selected');
|
|
170
|
+
} else if (button?.classList.contains('selected')) {
|
|
171
|
+
this.querySelectorAll('.selected').forEach((item) => {
|
|
172
|
+
item.classList.remove('selected');
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
this.querySelectorAll('.selected').forEach((item) => {
|
|
176
|
+
item.classList.remove('selected');
|
|
177
|
+
});
|
|
178
|
+
button.classList.add('selected');
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// safari and firefox anchor fix for cards
|
|
184
|
+
if (!CSS.supports('top', 'anchor(top)')) {
|
|
185
|
+
document.addEventListener('click', (event) => {
|
|
186
|
+
if (event.originalTarget && event.originalTarget.matches('[popovertarget]')) {
|
|
187
|
+
const button = event.originalTarget;
|
|
188
|
+
const popoverID = button.getAttribute('popovertarget');
|
|
189
|
+
const popover = document.getElementById(popoverID);
|
|
190
|
+
|
|
191
|
+
const viewportOffset = button.getBoundingClientRect();
|
|
192
|
+
const top = viewportOffset.top;
|
|
193
|
+
const left = viewportOffset.left;
|
|
194
|
+
|
|
195
|
+
popover.style.setProperty('top', top + 'px');
|
|
196
|
+
popover.style.setProperty('left', left + button.clientWidth + 'px');
|
|
144
197
|
}
|
|
145
198
|
});
|
|
146
199
|
}
|
|
147
|
-
|
|
148
|
-
// insert extra CSS to help style inline details and summary items to allow collapsible sub menus
|
|
149
|
-
if (this.querySelector('details') && !document.getElementById('menuGlobalStyles'))
|
|
150
|
-
document.head.insertAdjacentHTML(
|
|
151
|
-
'beforeend',
|
|
152
|
-
`<style id="menuGlobalStyles">
|
|
153
|
-
iam-menu details > * {
|
|
154
|
-
background: unset !important;
|
|
155
|
-
border: unset !important;
|
|
156
|
-
color: inherit!important;
|
|
157
|
-
font-weight: inherit!important;
|
|
158
|
-
font-family: inherit!important;
|
|
159
|
-
font-size: 1rem!important;
|
|
160
|
-
display: block!important;
|
|
161
|
-
margin: var(--menu-item-margin, 0 0 0.25rem 0)!important;
|
|
162
|
-
padding: var(--menu-item-padding, 0)!important;
|
|
163
|
-
width: var(--menu-item-width, 100%)!important;
|
|
164
|
-
text-align: var(--menu-item-text-align, left)!important;
|
|
165
|
-
cursor: var(--menu-item-cursor, pointer)!important;
|
|
166
|
-
}
|
|
167
|
-
iam-menu details > *:after,
|
|
168
|
-
iam-menu details > *:not(summary):before {
|
|
169
|
-
display: none!important;
|
|
170
|
-
}
|
|
171
|
-
iam-menu details :is(button,a) {
|
|
172
|
-
padding-inline-start: var(--menu-dialog-offset,1rem)!important;
|
|
173
|
-
}
|
|
174
|
-
iam-menu details :is(button,a):last-child {
|
|
175
|
-
margin-block-end: var(--menu-dialog-offset,1rem)!important;
|
|
176
|
-
}
|
|
177
|
-
iam-menu details summary {
|
|
178
|
-
padding: 0 !important;
|
|
179
|
-
margin: var(--menu-item-margin, 0 0 0.25rem 0)!important;
|
|
180
|
-
}
|
|
181
|
-
iam-menu details summary:before {
|
|
182
|
-
text-align: center;
|
|
183
|
-
display: inline-block!important;
|
|
184
|
-
vertical-align: bottom;
|
|
185
|
-
float: right;
|
|
186
|
-
color: inherit;
|
|
187
|
-
height: 1em;
|
|
188
|
-
width: 1em;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
iam-menu details summary[class*="fa-"]:before {
|
|
192
|
-
font-family: var(--fa-font-family, "Font Awesome 6 Pro");
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
iam-menu details summary:not([class*="fa-"]:before {
|
|
196
|
-
--icon-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3e%3cpath d='M6.5,2l9,9-9,9' style='fill:none;stroke:%23000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:3px'/%3e%3c/svg%3e");
|
|
197
|
-
|
|
198
|
-
content: ""!important;
|
|
199
|
-
height: 1.2rem;
|
|
200
|
-
width: 1.2rem;
|
|
201
|
-
background: var(--colour-primary-theme);
|
|
202
|
-
mask-image: var(--icon, var(--icon-arrow));
|
|
203
|
-
mask-size: 50%;
|
|
204
|
-
mask-repeat: no-repeat;
|
|
205
|
-
mask-position: 50% 50%;
|
|
206
|
-
-webkit-mask-image: var(--icon, var(--icon-arrow));
|
|
207
|
-
-webkit-mask-size: 50%;
|
|
208
|
-
-webkit-mask-repeat: no-repeat;
|
|
209
|
-
-webkit-mask-position: 50% 50%;
|
|
210
|
-
z-index: 2;
|
|
211
|
-
display: inline-block;
|
|
212
|
-
vertical-align: bottom;
|
|
213
|
-
float: right;
|
|
214
|
-
rotate: 90deg;
|
|
215
|
-
color: inherit;
|
|
216
|
-
}
|
|
217
|
-
</style>`
|
|
218
|
-
);
|
|
219
200
|
}
|
|
220
201
|
}
|
|
221
202
|
|
|
@@ -247,17 +247,12 @@ class iamRank extends HTMLElement {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
connectedCallback(): void {
|
|
250
|
-
|
|
251
|
-
|
|
252
250
|
const position = this.hasAttribute('data-position') ? this.getAttribute('data-position') : this.textContent?.trim();
|
|
253
|
-
|
|
254
|
-
this.setAttribute('data-position', position);
|
|
255
251
|
|
|
252
|
+
this.setAttribute('data-position', position);
|
|
256
253
|
|
|
257
|
-
|
|
258
254
|
trackComponent(this, 'iam-rank', ['select-card']);
|
|
259
255
|
}
|
|
260
|
-
|
|
261
256
|
}
|
|
262
257
|
|
|
263
258
|
export default iamRank;
|
|
@@ -33,8 +33,6 @@ class iamRankings extends HTMLElement {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
connectedCallback(): void {
|
|
36
|
-
|
|
37
|
-
|
|
38
36
|
const firstText = this.shadowRoot?.querySelector('.first-position');
|
|
39
37
|
const secondText = this.shadowRoot?.querySelector('.second-position');
|
|
40
38
|
const thirdText = this.shadowRoot?.querySelector('.third-position');
|
|
@@ -44,19 +42,15 @@ class iamRankings extends HTMLElement {
|
|
|
44
42
|
secondText?.innerHTML = this.querySelector('tbody tr:nth-child(2) :is(td,th):nth-child(1)')?.textContent;
|
|
45
43
|
thirdText?.innerHTML = this.querySelector('tbody tr:nth-child(3) :is(td,th):nth-child(1)')?.textContent;
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
45
|
this.querySelectorAll('tbody tr').forEach((element) => {
|
|
50
|
-
|
|
51
46
|
const value = element.querySelector('td:last-child')?.textContent?.trim();
|
|
52
47
|
|
|
53
|
-
if(!element.querySelector(':first-child progress'))
|
|
48
|
+
if (!element.querySelector(':first-child progress'))
|
|
54
49
|
element.querySelector(':first-child')?.innerHTML += `<progress max="${max}" value="${value}"></progress>`;
|
|
55
50
|
});
|
|
56
51
|
|
|
57
52
|
trackComponent(this, 'iam-rank', ['select-card']);
|
|
58
53
|
}
|
|
59
|
-
|
|
60
54
|
}
|
|
61
55
|
|
|
62
56
|
export default iamRankings;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { trackComponent, trackComponentRegistered } from '../_global';
|
|
2
2
|
import { cardHTML, setupCard } from '../../modules/card.module';
|
|
3
|
+
import {loadYouTubeScripts,createYoutTubeVideo} from '../../modules/videos';
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
trackComponentRegistered('iam-video-card');
|
|
5
7
|
|
|
@@ -73,7 +75,7 @@ class iamVideoCard extends HTMLElement {
|
|
|
73
75
|
// Load the scripts only once
|
|
74
76
|
if (!document.body.classList.contains('youtubeLoaded')) {
|
|
75
77
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
-
const loaded = await
|
|
78
|
+
const loaded = await loadYouTubeScripts();
|
|
77
79
|
}
|
|
78
80
|
cardHead.addEventListener('click', function () {
|
|
79
81
|
const customEvent = new CustomEvent('play-video', {
|
|
@@ -81,7 +83,7 @@ class iamVideoCard extends HTMLElement {
|
|
|
81
83
|
});
|
|
82
84
|
cardComponent.dispatchEvent(customEvent);
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
createYoutTubeVideo(embed,this.getAttribute('[data-youtbue]'));
|
|
85
87
|
dialog.showModal();
|
|
86
88
|
});
|
|
87
89
|
|
|
@@ -128,81 +130,6 @@ class iamVideoCard extends HTMLElement {
|
|
|
128
130
|
trackComponent(cardComponent, 'iam-video-card', ['play-video', 'close-video']);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
loadYouTubeScripts(): any {
|
|
132
|
-
return new Promise((resolve, reject) => {
|
|
133
|
-
const image = new Image();
|
|
134
|
-
image.onload = function (): any {
|
|
135
|
-
// This code loads the IFrame Player API code asynchronously.
|
|
136
|
-
const tag = document.createElement('script');
|
|
137
|
-
tag.src = 'https://www.youtube.com/iframe_api';
|
|
138
|
-
const firstScriptTag = document.getElementsByTagName('script')[0];
|
|
139
|
-
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
|
140
|
-
document.body.classList.add('youtubeLoaded');
|
|
141
|
-
resolve(true);
|
|
142
|
-
};
|
|
143
|
-
image.onerror = function (): any {
|
|
144
|
-
reject(false);
|
|
145
|
-
};
|
|
146
|
-
image.src = 'https://youtube.com/favicon.ico';
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
createYoutTubeVideo(target): void | boolean {
|
|
151
|
-
if (typeof window.player == 'undefined') {
|
|
152
|
-
window.player = [];
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const link_id = target.getAttribute('id');
|
|
156
|
-
const video_id = this.getAttribute('data-youtube');
|
|
157
|
-
|
|
158
|
-
console.log(window.player);
|
|
159
|
-
|
|
160
|
-
if (typeof window.player[link_id] != 'undefined' && typeof window.player[link_id].pauseVideo == 'function') {
|
|
161
|
-
window.player[link_id].playVideo();
|
|
162
|
-
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// This function creates an <iframe> (and YouTube player) after the API code downloads.
|
|
167
|
-
//function onYouTubeIframeAPIReady() {
|
|
168
|
-
|
|
169
|
-
window.player[link_id] = new YT.Player(link_id, {
|
|
170
|
-
height: '100%',
|
|
171
|
-
width: '100%',
|
|
172
|
-
videoId: video_id,
|
|
173
|
-
playerVars: {
|
|
174
|
-
modestbranding: 1,
|
|
175
|
-
playsinline: 1,
|
|
176
|
-
rel: 0,
|
|
177
|
-
showinfo: 0,
|
|
178
|
-
},
|
|
179
|
-
events: {
|
|
180
|
-
onReady: onPlayerReady,
|
|
181
|
-
onStateChange: onPlayerStateChange,
|
|
182
|
-
},
|
|
183
|
-
});
|
|
184
|
-
//}
|
|
185
|
-
//onYouTubeIframeAPIReady();
|
|
186
|
-
|
|
187
|
-
// The API will call this function when the video player is ready.
|
|
188
|
-
function onPlayerReady(event): void {
|
|
189
|
-
// Play the video straight away
|
|
190
|
-
event.target.playVideo();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// The API calls this function when the player's state changes.
|
|
194
|
-
// The function indicates that when playing a video (state=1)
|
|
195
|
-
let done = false;
|
|
196
|
-
function onPlayerStateChange(event): void {
|
|
197
|
-
if (event.data == YT.PlayerState.PLAYING && !done) {
|
|
198
|
-
const link = document.getElementById(link_id);
|
|
199
|
-
link.classList.add('player-ready');
|
|
200
|
-
|
|
201
|
-
done = true;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
133
|
static get observedAttributes(): any {
|
|
207
134
|
return ['data-image'];
|
|
208
135
|
}
|