@iamproperty/components 3.7.7 → 3.7.8--beta
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/forms.css +1 -1
- package/assets/css/components/forms.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 +2 -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.js +36 -12
- package/assets/js/components/card/card.component.min.js +5 -5
- package/assets/js/components/card/card.component.min.js.map +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/notification/notification.component.min.js +1 -1
- package/assets/js/components/pagination/pagination.component.min.js +1 -1
- package/assets/js/components/table/table.component.min.js +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +1 -1
- package/assets/js/dynamic.js +2 -0
- package/assets/js/dynamic.min.js +5 -5
- package/assets/js/dynamic.min.js.map +1 -1
- package/assets/js/flat-components.js +2 -0
- package/assets/js/modules/dialogs.js +2 -1
- package/assets/js/modules/inputs.js +62 -0
- package/assets/js/scripts.bundle.js +13 -13
- 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/_forms.scss +3 -3
- package/assets/sass/components/card.scss +26 -3
- package/assets/sass/components/forms.scss +497 -113
- package/assets/sass/foundations/links.scss +6 -2
- package/assets/sass/foundations/reboot.scss +3 -3
- package/assets/ts/bundle.ts +2 -0
- package/assets/ts/components/card/card.component.ts +55 -13
- package/assets/ts/dynamic.ts +2 -0
- package/assets/ts/flat-components.ts +2 -0
- package/assets/ts/modules/dialogs.ts +2 -1
- package/assets/ts/modules/inputs.ts +88 -0
- package/dist/components.es.js +853 -848
- package/dist/components.umd.js +30 -27
- package/package.json +1 -1
- package/src/components/Input/Input.vue +11 -7
- package/src/components/Input/README.md +1 -3
- package/src/components/Table/Table.vue +1 -1
package/assets/ts/bundle.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as helpers from '../js/modules/helpers'
|
|
4
4
|
import extendDialogs from '../js/modules/dialogs'
|
|
5
5
|
import createDataLayer from '../js/modules/data-layer'
|
|
6
|
+
import extendInputs from '../js/modules/inputs';
|
|
6
7
|
import nav from '../js/modules/nav'
|
|
7
8
|
//import accordion from './modules/accordion'
|
|
8
9
|
import testimonial from '../js/modules/testimonial'
|
|
@@ -27,6 +28,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
|
27
28
|
helpers.addBodyClasses(document.body);
|
|
28
29
|
helpers.addGlobalEvents(document.body);
|
|
29
30
|
extendDialogs(document.body);
|
|
31
|
+
extendInputs(document.body);
|
|
30
32
|
//helpers.checkElements(document.body);
|
|
31
33
|
|
|
32
34
|
if (!window.customElements.get(`iam-header`))
|
|
@@ -53,30 +53,53 @@ class iamCard extends HTMLElement {
|
|
|
53
53
|
|
|
54
54
|
parentNode.setAttribute('tabindex','-1');
|
|
55
55
|
|
|
56
|
+
|
|
56
57
|
if(parentNode.matches('label[for]')){
|
|
57
58
|
|
|
58
|
-
let isChecked = document.getElementById(parentNode.getAttribute('for')).checked
|
|
59
|
+
let isChecked = document.getElementById(parentNode.getAttribute('for')).checked;
|
|
59
60
|
|
|
60
61
|
if(isChecked)
|
|
61
|
-
card.classList.add('
|
|
62
|
+
card.classList.add('checked');
|
|
63
|
+
else
|
|
64
|
+
card.classList.remove('checked');
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
card.addEventListener('click', (event) => {
|
|
65
68
|
|
|
66
69
|
if(parentNode.matches('label[for]')){
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
|
|
74
|
+
const input = document.getElementById(parentNode.getAttribute('for'))
|
|
75
|
+
|
|
76
|
+
const inputName = input.getAttribute('name');
|
|
77
|
+
const inputID = input.getAttribute('id');
|
|
78
|
+
|
|
79
|
+
const inputs = Array.from(document.querySelectorAll(`[name="${inputName}"]:not([id="${inputID}"])`));
|
|
80
|
+
|
|
81
|
+
inputs.forEach((input, index) => {
|
|
69
82
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
else {
|
|
83
|
+
const otherCard = document.querySelector(`[for="${input.getAttribute('id')}"] iam-card`);
|
|
84
|
+
|
|
85
|
+
otherCard.dispatchEvent(new Event('inactive'));
|
|
86
|
+
});
|
|
87
|
+
|
|
76
88
|
parentNode.click();
|
|
89
|
+
let isChecked = input.checked
|
|
90
|
+
|
|
91
|
+
if(isChecked)
|
|
92
|
+
card.classList.add('checked');
|
|
93
|
+
else
|
|
94
|
+
card.classList.remove('checked');
|
|
95
|
+
|
|
77
96
|
}
|
|
78
97
|
});
|
|
79
98
|
|
|
99
|
+
this.addEventListener('inactive', (event) => {
|
|
100
|
+
card.classList.remove('checked');
|
|
101
|
+
});
|
|
102
|
+
|
|
80
103
|
card.addEventListener('keydown', (event) => {
|
|
81
104
|
|
|
82
105
|
switch(event.keyCode)
|
|
@@ -85,12 +108,31 @@ class iamCard extends HTMLElement {
|
|
|
85
108
|
case 13:
|
|
86
109
|
if(parentNode.matches('label[for]')){
|
|
87
110
|
|
|
88
|
-
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
|
|
114
|
+
const input = document.getElementById(parentNode.getAttribute('for'))
|
|
115
|
+
|
|
116
|
+
const inputName = input.getAttribute('name');
|
|
117
|
+
const inputID = input.getAttribute('id');
|
|
118
|
+
|
|
119
|
+
const inputs = Array.from(document.querySelectorAll(`[name="${inputName}"]:not([id="${inputID}"])`));
|
|
120
|
+
|
|
121
|
+
inputs.forEach((input, index) => {
|
|
122
|
+
|
|
123
|
+
const otherCard = document.querySelector(`[for="${input.getAttribute('id')}"] iam-card`);
|
|
124
|
+
|
|
125
|
+
otherCard.dispatchEvent(new Event('inactive'));
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
parentNode.click();
|
|
129
|
+
let isChecked = input.checked
|
|
89
130
|
|
|
90
|
-
if(
|
|
91
|
-
card.classList.add('
|
|
131
|
+
if(isChecked)
|
|
132
|
+
card.classList.add('checked');
|
|
92
133
|
else
|
|
93
|
-
card.classList.remove('
|
|
134
|
+
card.classList.remove('checked');
|
|
135
|
+
|
|
94
136
|
}
|
|
95
137
|
else {
|
|
96
138
|
parentNode.click();
|
package/assets/ts/dynamic.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as helpers from '../js/modules/helpers'
|
|
4
4
|
import extendDialogs from '../js/modules/dialogs'
|
|
5
5
|
import createDataLayer from '../js/modules/data-layer'
|
|
6
|
+
import extendInputs from '../js/modules/inputs';
|
|
6
7
|
import nav from '../js/modules/nav'
|
|
7
8
|
import table from '../js/modules/table'
|
|
8
9
|
//import accordion from './modules/accordion'
|
|
@@ -63,6 +64,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
|
63
64
|
helpers.addGlobalEvents(document.body);
|
|
64
65
|
//helpers.checkElements(document.body);
|
|
65
66
|
extendDialogs(document.body);
|
|
67
|
+
extendInputs(document.body);
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
if (!window.customElements.get(`iam-notification`))
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as helpers from '../js/modules/helpers'
|
|
4
4
|
import extendDialogs from '../js/modules/dialogs'
|
|
5
5
|
import createDataLayer from '../js/modules/data-layer'
|
|
6
|
+
import extendInputs from '../js/modules/inputs';
|
|
6
7
|
import nav from '../js/modules/nav'
|
|
7
8
|
import * as tableModule from './modules/table'
|
|
8
9
|
import accordion from './modules/accordion'
|
|
@@ -25,6 +26,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
|
25
26
|
helpers.addGlobalEvents(document.body);
|
|
26
27
|
//helpers.checkElements(document.body);
|
|
27
28
|
extendDialogs(document.body);
|
|
29
|
+
extendInputs(document.body);
|
|
28
30
|
|
|
29
31
|
// ANav
|
|
30
32
|
Array.from(document.querySelectorAll('.nav')).forEach((arrayElement) => {
|
|
@@ -86,7 +86,8 @@ const extendDialogs = (body) => {
|
|
|
86
86
|
|
|
87
87
|
if (event.clientX < dialogDimensions.left || event.clientX > dialogDimensions.right || event.clientY < dialogDimensions.top || event.clientY > dialogDimensions.bottom) {
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
if(!event.target.closest('input[type="radio"]')) // Weird bug when interacting with radio input fields within dialogs cuases it to close
|
|
90
|
+
dialog.close()
|
|
90
91
|
|
|
91
92
|
window.dataLayer = window.dataLayer || [];
|
|
92
93
|
window.dataLayer.push({
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
const extendInputs = (body) => {
|
|
3
|
+
|
|
4
|
+
document.addEventListener("load", function() {
|
|
5
|
+
|
|
6
|
+
console.log(Array.from(document.querySelectorAll('input[maxlength]')))
|
|
7
|
+
// maxlength counter init
|
|
8
|
+
Array.from(document.querySelectorAll('input')).forEach((input,index) => {
|
|
9
|
+
let wrapper = input.parentElement;
|
|
10
|
+
setMaxlengthVars(input,wrapper);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
body.addEventListener('input', (event) => {
|
|
15
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('input,textarea,select')){
|
|
16
|
+
|
|
17
|
+
const input = event.target.closest('input,textarea,select');
|
|
18
|
+
const wrapper = input.parentElement;
|
|
19
|
+
|
|
20
|
+
// Output the color hex
|
|
21
|
+
if(input.hasAttribute('type') && input.getAttribute('type') == 'color')
|
|
22
|
+
input.nextElementSibling.value = input.value;
|
|
23
|
+
|
|
24
|
+
if(input.hasAttribute('maxlength') && input.nextElementSibling)
|
|
25
|
+
input.nextElementSibling.setAttribute("data-count", input.value.length);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
body.addEventListener('change', (event) => {
|
|
30
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('select')){
|
|
31
|
+
|
|
32
|
+
const select = event.target.closest('select');
|
|
33
|
+
|
|
34
|
+
console.log(select)
|
|
35
|
+
|
|
36
|
+
if(select.hasAttribute('data-change-type') && select.hasAttribute('data-input')){
|
|
37
|
+
|
|
38
|
+
const input = document.getElementById(select.getAttribute('data-input'));
|
|
39
|
+
const newType = select.value;
|
|
40
|
+
changeType(input,newType);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
body.addEventListener('click', (event) => {
|
|
46
|
+
|
|
47
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('[data-change-type][data-input]:not(select)')){
|
|
48
|
+
|
|
49
|
+
const button = event.target.closest('[data-change-type]');
|
|
50
|
+
const input = document.getElementById(button.getAttribute('data-input'));
|
|
51
|
+
const newType = button.getAttribute('data-change-type');
|
|
52
|
+
button.setAttribute('data-change-type',input.getAttribute('type'));
|
|
53
|
+
|
|
54
|
+
changeType(input,newType);
|
|
55
|
+
|
|
56
|
+
if(button.hasAttribute('data-alt-class')){
|
|
57
|
+
const newClass = button.getAttribute('data-alt-class');
|
|
58
|
+
button.setAttribute('data-alt-class',button.getAttribute('class'));
|
|
59
|
+
button.setAttribute('class',newClass);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const setMaxlengthVars = (input) => {
|
|
66
|
+
let wrapper = input.parentElement;
|
|
67
|
+
let maxlength = input.getAttribute('maxlength')
|
|
68
|
+
|
|
69
|
+
wrapper.style.setProperty("--maxlength", maxlength);
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
let span = input.nextElementSibling;
|
|
73
|
+
|
|
74
|
+
if(!span || (span && span.classList.contains('invalid-feedback'))){
|
|
75
|
+
|
|
76
|
+
span = document.createElement('span');
|
|
77
|
+
wrapper.insertBefore(span, input.nextSibling);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
span.setAttribute('data-count',input.value.length);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export const changeType = (input,type) => {
|
|
84
|
+
|
|
85
|
+
input.setAttribute('type',type);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default extendInputs;
|