@iamproperty/components 3.2.0 → 3.4.4
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/core.min.css.map +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/js/main.js +9 -9
- package/assets/js/modules/accordion.js +1 -0
- package/assets/js/modules/alert.js +37 -53
- package/assets/js/modules/carousel.js +74 -100
- package/assets/js/modules/chart.js +142 -209
- package/assets/js/modules/drawer.js +9 -15
- package/assets/js/modules/file-upload.js +30 -45
- package/assets/js/modules/form.js +111 -157
- package/assets/js/modules/helpers.js +64 -93
- package/assets/js/modules/modal.js +67 -88
- package/assets/js/modules/nav.js +17 -27
- package/assets/js/modules/orderablelist.js +84 -115
- package/assets/js/modules/table.js +387 -521
- package/assets/js/modules/testimonial.js +61 -80
- package/assets/js/modules/youtubevideo.js +104 -135
- package/assets/js/scripts.bundle.js +870 -936
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +3 -3
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/sass/_corefiles.scss +9 -9
- package/assets/sass/_forms.scss +1 -1
- package/assets/sass/_tests/{sass.spec.js → colours.spec.js} +2 -2
- package/assets/sass/_tests/func.spec.js +9 -0
- package/assets/sass/_tests/mixins.spec.js +9 -0
- package/assets/sass/_tests/typography.spec.js +9 -0
- package/assets/ts/main.ts +9 -9
- package/assets/ts/modules/accordion.ts +1 -0
- package/assets/ts/modules/alert.ts +58 -0
- package/assets/ts/modules/carousel.ts +103 -0
- package/assets/ts/modules/chart.ts +219 -0
- package/assets/ts/modules/drawer.ts +17 -0
- package/assets/ts/modules/file-upload.ts +49 -0
- package/assets/ts/modules/form.ts +169 -0
- package/assets/ts/modules/helpers.ts +120 -0
- package/assets/ts/modules/modal.ts +91 -0
- package/assets/ts/modules/nav.ts +29 -0
- package/assets/ts/modules/orderablelist.ts +123 -0
- package/assets/ts/modules/table.ts +586 -0
- package/assets/ts/modules/testimonial.ts +84 -0
- package/assets/ts/modules/youtubevideo.ts +146 -0
- package/dist/components.es.js +405 -421
- package/dist/components.umd.js +8 -8
- package/package.json +48 -35
- package/src/components/Accordion/Accordion.vue +1 -1
- package/src/components/Alert/Alert.vue +1 -1
- package/src/{elements → components}/Card/Card.vue +1 -1
- package/src/components/CardDeck/CardDeck.spec.js +1 -1
- package/src/components/CardDeck/CardDeck.vue +1 -1
- package/src/components/Carousel/Carousel.vue +2 -2
- package/src/components/Chart/Chart.vue +2 -2
- package/src/components/Drawer/Drawer.vue +1 -1
- package/src/{elements → components}/FileUploads/FileUploads.vue +1 -1
- package/src/components/Modal/Modal.vue +1 -1
- package/src/components/Nav/Nav.vue +2 -2
- package/src/components/NoteFeed/NoteFeed.vue +2 -2
- package/src/components/PropertySearchbar/PropertySearchbar.vue +1 -1
- package/src/{elements → components}/Table/Table.vue +1 -1
- package/src/components/Testimonial/Testimonial.vue +1 -1
- package/src/foundations/YoutubeVideo/YoutubeVideo.vue +1 -1
- package/src/index.js +4 -4
- package/assets/.DS_Store +0 -0
- package/assets/css/email.min.css +0 -1
- package/assets/css/email.min.css.map +0 -1
- package/assets/css/error.min.css +0 -1
- package/assets/css/error.min.css.map +0 -1
- package/assets/ts/main.js +0 -57
- package/assets/ts/main.js.map +0 -1
- package/assets/ts/modules/accordion.js +0 -33
- package/assets/ts/modules/accordion.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/components/Accordion/Accordion.screenshot.vue +0 -57
- package/src/components/Accordion/__screenshots__/win32/laptop/Accordion.png +0 -0
- package/src/components/Accordion/__screenshots__/win32/mobile/Accordion.png +0 -0
- package/src/components/Accordion/__screenshots__/win32/tablet/Accordion.png +0 -0
- /package/assets/sass/{elements → components}/buttons.scss +0 -0
- /package/assets/sass/{elements → components}/card.scss +0 -0
- /package/assets/sass/{elements → components}/container.scss +0 -0
- /package/assets/sass/{elements → components}/forms.scss +0 -0
- /package/assets/sass/{elements → components}/links.scss +0 -0
- /package/assets/sass/{elements → components}/lists.scss +0 -0
- /package/assets/sass/{elements → components}/panel.scss +0 -0
- /package/assets/sass/{elements → components}/tables.scss +0 -0
- /package/assets/sass/{elements → components}/tooltips.scss +0 -0
- /package/assets/sass/{elements → foundations}/type.scss +0 -0
- /package/src/{elements → components}/Card/README.md +0 -0
- /package/src/{elements → components}/FileUploads/README.md +0 -0
- /package/src/{elements → components}/Input/Input.vue +0 -0
- /package/src/{elements → components}/Input/README.md +0 -0
- /package/src/{elements → components}/Table/README.md +0 -0
- /package/src/{elements → components}/Table/Table.spec.js +0 -0
|
@@ -1,90 +1,69 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
const modal = (element) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
const links = element.querySelectorAll('.modal__outer a, .modal__outer button');
|
|
4
|
+
const firstLink = links[0];
|
|
5
|
+
const lastLink = links[links.length - 1];
|
|
6
|
+
const modalID = element.getAttribute('id');
|
|
7
|
+
const closeModal = function () {
|
|
8
|
+
const button = document.querySelector('[href="' + window.location.hash + '"]');
|
|
9
|
+
button.focus();
|
|
10
|
+
window.location.hash = "close";
|
|
11
|
+
history.replaceState("", document.title, window.location.pathname + window.location.search);
|
|
12
|
+
// If there is more than one video lets make sure there is only one playing at a time.
|
|
13
|
+
if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function")
|
|
14
|
+
window.player.pauseVideo();
|
|
15
|
+
};
|
|
16
|
+
// Trap the tab focus inside
|
|
17
|
+
element.addEventListener('keydown', function (e) {
|
|
18
|
+
if (e.key === "Tab" && e.shiftKey && document.activeElement == firstLink) {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
lastLink.focus();
|
|
21
|
+
}
|
|
22
|
+
else if (e.key === "Tab" && !e.shiftKey && document.activeElement == lastLink) {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
firstLink.focus();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// ESC will close the open modal
|
|
28
|
+
document.addEventListener("keydown", function (e) {
|
|
29
|
+
if (e.key === "Escape" && document.querySelector('.modal:target'))
|
|
30
|
+
closeModal();
|
|
31
|
+
});
|
|
32
|
+
element.addEventListener('click', function (e) {
|
|
33
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
34
|
+
// Close links will close the model by default but we want to remove the hash link also
|
|
35
|
+
if (target.matches('[href="#close"]')) {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
closeModal();
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
// Dock the modal to the right or left to make the content behind readable
|
|
41
|
+
else if (target.matches('.modal__dock--right')) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
if (!element.classList.contains('modal--left'))
|
|
44
|
+
element.classList.add('modal--right');
|
|
45
|
+
element.classList.remove('modal--left');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
else if (target.matches('.modal__dock--left')) {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
if (!element.classList.contains('modal--right'))
|
|
51
|
+
element.classList.add('modal--left');
|
|
52
|
+
element.classList.remove('modal--right');
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function locationHashChanged() {
|
|
58
|
+
if (location.hash === '#' + modalID) {
|
|
59
|
+
console.log("Modal is now open");
|
|
60
|
+
const videoButton = document.querySelector('.modal:target .modal__inner > .youtube-embed:first-child:last-child a');
|
|
61
|
+
console.log(videoButton);
|
|
62
|
+
if (videoButton) {
|
|
63
|
+
videoButton.click();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
26
66
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
firstLink.focus();
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// ESC will close the open modal
|
|
35
|
-
document.addEventListener("keydown", function(e){
|
|
36
|
-
if (e.key === "Escape" && document.querySelector('.modal:target'))
|
|
37
|
-
closeModal();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
element.addEventListener('click', function(e){
|
|
41
|
-
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
42
|
-
|
|
43
|
-
// Close links will close the model by default but we want to remove the hash link also
|
|
44
|
-
if (target.matches('[href="#close"]')) {
|
|
45
|
-
|
|
46
|
-
e.preventDefault();
|
|
47
|
-
closeModal();
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
// Dock the modal to the right or left to make the content behind readable
|
|
51
|
-
else if (target.matches('.modal__dock--right')) {
|
|
52
|
-
|
|
53
|
-
e.preventDefault();
|
|
54
|
-
if(!element.classList.contains('modal--left'))
|
|
55
|
-
element.classList.add('modal--right');
|
|
56
|
-
|
|
57
|
-
element.classList.remove('modal--left');
|
|
58
|
-
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
else if (target.matches('.modal__dock--left')) {
|
|
62
|
-
|
|
63
|
-
e.preventDefault();
|
|
64
|
-
|
|
65
|
-
if(!element.classList.contains('modal--right'))
|
|
66
|
-
element.classList.add('modal--left');
|
|
67
|
-
|
|
68
|
-
element.classList.remove('modal--right');
|
|
69
|
-
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
function locationHashChanged() {
|
|
76
|
-
if (location.hash === '#'+modalID) {
|
|
77
|
-
console.log("Modal is now open");
|
|
78
|
-
const videoButton = document.querySelector('.modal:target .modal__inner > .youtube-embed:first-child:last-child a');
|
|
79
|
-
|
|
80
|
-
console.log(videoButton)
|
|
81
|
-
if (videoButton){
|
|
82
|
-
videoButton.click();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
window.onhashchange = locationHashChanged;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default modal
|
|
67
|
+
window.onhashchange = locationHashChanged;
|
|
68
|
+
};
|
|
69
|
+
export default modal;
|
package/assets/js/modules/nav.js
CHANGED
|
@@ -1,28 +1,18 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
const navbar = (element) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if ('IntersectionObserver' in window) {
|
|
19
|
-
const observer = new IntersectionObserver(
|
|
20
|
-
([e]) => e.target.classList.toggle("is-stuck", e.intersectionRatio < 1),
|
|
21
|
-
{ threshold: [1] }
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
observer.observe(element);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default navbar
|
|
3
|
+
Array.from(element.querySelectorAll('details')).forEach((detail, index) => {
|
|
4
|
+
detail.addEventListener('mouseenter', function (e) {
|
|
5
|
+
if (window.matchMedia('(min-width: 62em)').matches)
|
|
6
|
+
detail.setAttribute('open', 'true');
|
|
7
|
+
}, false);
|
|
8
|
+
detail.addEventListener('mouseleave', function (e) {
|
|
9
|
+
if (window.matchMedia('(min-width: 62em)').matches)
|
|
10
|
+
detail.removeAttribute('open');
|
|
11
|
+
}, false);
|
|
12
|
+
});
|
|
13
|
+
if ('IntersectionObserver' in window) {
|
|
14
|
+
const observer = new IntersectionObserver(([e]) => e.target.classList.toggle("is-stuck", e.intersectionRatio < 1), { threshold: [1] });
|
|
15
|
+
observer.observe(element);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default navbar;
|
|
@@ -1,122 +1,91 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
function orderlist(list) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
item.setAttribute('tabindex',0);
|
|
19
|
-
item.setAttribute('role','listitem');
|
|
20
|
-
item.setAttribute('aria-label',`${item.innerText}: ${index+1} of ${listCount} moveable items`);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
function setDraggedRow(e) {
|
|
24
|
-
e.dataTransfer.setData("text/plain", e.target.id);
|
|
25
|
-
draggedRow = e.target;
|
|
26
|
-
e.target.classList.add('li--dragging');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function resetItems(){
|
|
30
|
-
|
|
31
|
-
// Re label the rows
|
|
32
|
-
Array.from(list.querySelectorAll('li')).forEach((item, index) => {
|
|
33
|
-
item.classList.remove('li--dragging')
|
|
34
|
-
item.classList.remove('li--dropable')
|
|
35
|
-
item.setAttribute('data-order',index+1);
|
|
36
|
-
item.setAttribute('aria-label',`${item.innerText}: ${index+1} of ${listCount} moveable items`);
|
|
3
|
+
const randID = 'list_' + Math.random().toString(36).substr(2, 9);
|
|
4
|
+
const listItems = list.querySelectorAll('li');
|
|
5
|
+
const listCount = listItems.length;
|
|
6
|
+
let draggedRow;
|
|
7
|
+
list.setAttribute('role', 'list');
|
|
8
|
+
list.setAttribute('tabindex', 0);
|
|
9
|
+
list.setAttribute('aria-label', 'Use the key tab to buttons to move between list items, once you have selected a list item you can move it up and down using the arrow keys.');
|
|
10
|
+
list.querySelectorAll('li').forEach((item, index) => {
|
|
11
|
+
// Make draggable
|
|
12
|
+
item.setAttribute('id', randID + '_row_' + (index + 1));
|
|
13
|
+
item.setAttribute('data-order', index + 1);
|
|
14
|
+
item.setAttribute('draggable', 'true');
|
|
15
|
+
item.addEventListener("dragstart", setDraggedRow);
|
|
16
|
+
item.setAttribute('tabindex', 0);
|
|
17
|
+
item.setAttribute('role', 'listitem');
|
|
18
|
+
item.setAttribute('aria-label', `${item.innerText}: ${index + 1} of ${listCount} moveable items`);
|
|
37
19
|
});
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
e.preventDefault();
|
|
43
|
-
}, false);
|
|
44
|
-
|
|
45
|
-
list.addEventListener("dragenter", function( e ) {
|
|
46
|
-
// prevent default to allow drop
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
e.dataTransfer.dropEffect = "move";
|
|
49
|
-
|
|
50
|
-
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
51
|
-
if (target.matches('li')) {
|
|
52
|
-
|
|
53
|
-
target.classList.add('li--dropable')
|
|
54
|
-
}
|
|
20
|
+
function setDraggedRow(e) {
|
|
21
|
+
e.dataTransfer.setData("text/plain", e.target.id);
|
|
22
|
+
draggedRow = e.target;
|
|
23
|
+
e.target.classList.add('li--dragging');
|
|
55
24
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
target.classList.remove('li--dropable')
|
|
65
|
-
}
|
|
25
|
+
function resetItems() {
|
|
26
|
+
// Re label the rows
|
|
27
|
+
Array.from(list.querySelectorAll('li')).forEach((item, index) => {
|
|
28
|
+
item.classList.remove('li--dragging');
|
|
29
|
+
item.classList.remove('li--dropable');
|
|
30
|
+
item.setAttribute('data-order', index + 1);
|
|
31
|
+
item.setAttribute('aria-label', `${item.innerText}: ${index + 1} of ${listCount} moveable items`);
|
|
32
|
+
});
|
|
66
33
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if(draggedRow.getAttribute('data-order') > target.getAttribute('data-order'))
|
|
81
|
-
target.parentNode.insertBefore(draggedRow, target);
|
|
82
|
-
else
|
|
83
|
-
target.parentNode.insertBefore(draggedRow, target.nextElementSibling);
|
|
84
|
-
|
|
85
|
-
resetItems();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
//tableElement.dispatchEvent(reorderedEvent);
|
|
34
|
+
list.addEventListener("dragover", function (e) {
|
|
35
|
+
// prevent default to allow drop
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
}, false);
|
|
38
|
+
list.addEventListener("dragenter", function (e) {
|
|
39
|
+
// prevent default to allow drop
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
e.dataTransfer.dropEffect = "move";
|
|
42
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
43
|
+
if (target.matches('li')) {
|
|
44
|
+
target.classList.add('li--dropable');
|
|
45
|
+
}
|
|
89
46
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
47
|
+
}, false);
|
|
48
|
+
list.addEventListener("dragleave", function (e) {
|
|
49
|
+
// prevent default to allow drop
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
52
|
+
if (target.matches('li')) {
|
|
53
|
+
target.classList.remove('li--dropable');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, false);
|
|
57
|
+
list.addEventListener("drop", function (e) {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
for (var target = e.target; target && target != this; target = target.parentNode) {
|
|
60
|
+
if (target.matches('li')) {
|
|
61
|
+
if (target.parentNode != null && draggedRow.parentNode != null && target != draggedRow) {
|
|
62
|
+
draggedRow.parentNode.removeChild(draggedRow);
|
|
63
|
+
if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order'))
|
|
64
|
+
target.parentNode.insertBefore(draggedRow, target);
|
|
65
|
+
else
|
|
66
|
+
target.parentNode.insertBefore(draggedRow, target.nextElementSibling);
|
|
67
|
+
resetItems();
|
|
68
|
+
//tableElement.dispatchEvent(reorderedEvent);
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, false);
|
|
74
|
+
list.addEventListener("keydown", function (e) {
|
|
75
|
+
let item = e.target;
|
|
76
|
+
if (e.keyCode == 38) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
if (item.previousElementSibling)
|
|
79
|
+
item.parentNode.insertBefore(item, item.previousElementSibling);
|
|
80
|
+
item.focus();
|
|
81
|
+
}
|
|
82
|
+
else if (e.keyCode == 40) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
if (item.nextElementSibling)
|
|
85
|
+
item.parentNode.insertBefore(item.nextElementSibling, item);
|
|
86
|
+
item.focus();
|
|
87
|
+
}
|
|
88
|
+
resetItems();
|
|
89
|
+
}, false);
|
|
120
90
|
}
|
|
121
|
-
|
|
122
91
|
export default orderlist;
|