geico-design-kit 7.0.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.
Potentially problematic release.
This version of geico-design-kit might be problematic. Click here for more details.
- package/.babelrc +5 -0
- package/LICENSE +0 -0
- package/dist/analytics.js +119 -0
- package/dist/appState.js +56 -0
- package/dist/baseComponent.js +110 -0
- package/dist/components/Accordion.js +312 -0
- package/dist/components/AddressAutoComplete.js +220 -0
- package/dist/components/Alert.js +145 -0
- package/dist/components/BackgroundPattern.js +99 -0
- package/dist/components/BackgroundPatternPortfolio.js +242 -0
- package/dist/components/ButtonSwitch.js +236 -0
- package/dist/components/CardSelections.js +230 -0
- package/dist/components/CommonQuestionsSquares.js +169 -0
- package/dist/components/Confirmation.js +156 -0
- package/dist/components/ConsolidatedSummary.js +489 -0
- package/dist/components/CoverageGraph.js +201 -0
- package/dist/components/CreditCard.js +591 -0
- package/dist/components/CurrencyInput.js +302 -0
- package/dist/components/DatePicker.js +468 -0
- package/dist/components/DockedMessage.js +146 -0
- package/dist/components/DotNavigation.js +200 -0
- package/dist/components/EditComponent.js +128 -0
- package/dist/components/EditableTable.js +113 -0
- package/dist/components/InPageNavigation.js +360 -0
- package/dist/components/Loader.js +232 -0
- package/dist/components/MakePayment.js +361 -0
- package/dist/components/Modal.js +254 -0
- package/dist/components/MoreInfoButton.js +227 -0
- package/dist/components/MultipleSelectBox.js +217 -0
- package/dist/components/NavigationalBox.js +161 -0
- package/dist/components/Navigator.js +294 -0
- package/dist/components/PasswordMeter.js +201 -0
- package/dist/components/PayPlans.js +534 -0
- package/dist/components/SegmentedControl.js +327 -0
- package/dist/components/SortableTable.js +166 -0
- package/dist/components/Tabs.js +1 -0
- package/dist/components/TextAreaCountdown.js +219 -0
- package/dist/components/Timeline.js +498 -0
- package/dist/components/TimelineFilter.js +492 -0
- package/dist/components/ToTopArrow.js +153 -0
- package/dist/components/Tooltip.js +329 -0
- package/dist/components/Upsell.js +168 -0
- package/dist/components/VIN.js +271 -0
- package/dist/components/ValidateForm.js +938 -0
- package/dist/components/ViewMoreLess.js +191 -0
- package/dist/components/ZipCode.js +191 -0
- package/dist/components/portfolio.js +99 -0
- package/dist/geico-design-kit.js +141 -0
- package/dist/global/components.js +98 -0
- package/dist/global/footer.js +26 -0
- package/dist/global/nav.js +1257 -0
- package/dist/services/CharacterTypeService.js +106 -0
- package/dist/services/UserAgentService.js +73 -0
- package/dist/utils.js +79 -0
- package/package.json +32 -0
- package/src/analytics.js +82 -0
- package/src/appState.js +56 -0
- package/src/baseComponent.js +156 -0
- package/src/components/Accordion.js +336 -0
- package/src/components/AddressAutoComplete.js +236 -0
- package/src/components/Alert.js +135 -0
- package/src/components/BackgroundPattern.js +96 -0
- package/src/components/BackgroundPatternPortfolio.js +284 -0
- package/src/components/ButtonSwitch.js +241 -0
- package/src/components/CardSelections.js +240 -0
- package/src/components/CommonQuestionsSquares.js +179 -0
- package/src/components/Confirmation.js +160 -0
- package/src/components/ConsolidatedSummary.js +505 -0
- package/src/components/CoverageGraph.js +203 -0
- package/src/components/CreditCard.js +595 -0
- package/src/components/CurrencyInput.js +321 -0
- package/src/components/DatePicker.js +487 -0
- package/src/components/DockedMessage.js +142 -0
- package/src/components/DotNavigation.js +206 -0
- package/src/components/EditComponent.js +130 -0
- package/src/components/EditableTable.js +106 -0
- package/src/components/InPageNavigation.js +391 -0
- package/src/components/Loader.js +272 -0
- package/src/components/MakePayment.js +397 -0
- package/src/components/Modal.js +279 -0
- package/src/components/MoreInfoButton.js +243 -0
- package/src/components/MultipleSelectBox.js +211 -0
- package/src/components/NavigationalBox.js +163 -0
- package/src/components/Navigator.js +338 -0
- package/src/components/PasswordMeter.js +209 -0
- package/src/components/PayPlans.js +604 -0
- package/src/components/SegmentedControl.js +365 -0
- package/src/components/SortableTable.js +176 -0
- package/src/components/Tabs.js +0 -0
- package/src/components/TextAreaCountdown.js +231 -0
- package/src/components/Timeline.js +532 -0
- package/src/components/TimelineFilter.js +533 -0
- package/src/components/ToTopArrow.js +153 -0
- package/src/components/Tooltip.js +344 -0
- package/src/components/Upsell.js +196 -0
- package/src/components/VIN.js +289 -0
- package/src/components/ValidateForm.js +1030 -0
- package/src/components/ViewMoreLess.js +193 -0
- package/src/components/ZipCode.js +193 -0
- package/src/components/portfolio.js +106 -0
- package/src/geico-design-kit.js +144 -0
- package/src/global/components.js +92 -0
- package/src/global/footer.js +25 -0
- package/src/global/nav.js +1457 -0
- package/src/services/CharacterTypeService.js +107 -0
- package/src/services/UserAgentService.js +59 -0
- package/src/utils.js +82 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
class CharacterTypeService {
|
2
|
+
static _getCharacterType(event) {
|
3
|
+
let keyCode = event.which || event.keyCode;
|
4
|
+
|
5
|
+
if(event) {
|
6
|
+
|
7
|
+
// check if character keyCode is 0-9
|
8
|
+
if(keyCode >= 48 && keyCode <= 57 || keyCode >= 96 && keyCode <= 105) {
|
9
|
+
|
10
|
+
if(event.key) {
|
11
|
+
if (event.key === '1' || event.key === '2' || event.key === '3' || event.key === '4' || event.key === '5' || event.key === '6' || event.key === '7' || event.key === '8' || event.key === '9' || event.key === '0') {
|
12
|
+
return 'number';
|
13
|
+
} else {
|
14
|
+
return 'special character';
|
15
|
+
}
|
16
|
+
} else {
|
17
|
+
return 'n/a';
|
18
|
+
}
|
19
|
+
|
20
|
+
} else {
|
21
|
+
|
22
|
+
// Check if character is backspace
|
23
|
+
if(keyCode === 8) {
|
24
|
+
return 'backspace';
|
25
|
+
} else
|
26
|
+
|
27
|
+
// Check if character is tab
|
28
|
+
if(keyCode === 9) {
|
29
|
+
return 'tab';
|
30
|
+
} else
|
31
|
+
|
32
|
+
// Check if character is enter
|
33
|
+
if(keyCode === 13) {
|
34
|
+
return 'enter';
|
35
|
+
} else
|
36
|
+
|
37
|
+
// Check if character is shift
|
38
|
+
// if (keyCode === 16) {
|
39
|
+
// return 'shift';
|
40
|
+
// }
|
41
|
+
|
42
|
+
// Check for additional special characters
|
43
|
+
if (keyCode >= 186 && keyCode <= 192 || keyCode >= 219 && keyCode <= 222) {
|
44
|
+
return 'special character';
|
45
|
+
} else
|
46
|
+
|
47
|
+
// Check if character is a letter
|
48
|
+
if(keyCode >= 65 && keyCode <= 90) {
|
49
|
+
|
50
|
+
// Check for key functions
|
51
|
+
//
|
52
|
+
// Minimize
|
53
|
+
if (keyCode === 77 && event.ctrlKey === true || keyCode === 77 && event.metaKey === true) {
|
54
|
+
return 'minimize';
|
55
|
+
} else
|
56
|
+
|
57
|
+
// Copy
|
58
|
+
if (keyCode === 67 && event.ctrlKey === true || keyCode === 67 && event.metaKey === true) {
|
59
|
+
return 'copy';
|
60
|
+
} else
|
61
|
+
|
62
|
+
// Paste
|
63
|
+
if (keyCode === 80 && event.ctrlKey === true || keyCode === 80 && event.metaKey === true) {
|
64
|
+
return 'paste';
|
65
|
+
} else {
|
66
|
+
return 'letter';
|
67
|
+
}
|
68
|
+
} else
|
69
|
+
|
70
|
+
// Check if character is delete
|
71
|
+
if(keyCode === 46) {
|
72
|
+
return 'delete';
|
73
|
+
} else
|
74
|
+
|
75
|
+
// Check if character is home
|
76
|
+
if (keyCode === 36) {
|
77
|
+
return 'home';
|
78
|
+
} else
|
79
|
+
|
80
|
+
// Check if character is end
|
81
|
+
if (keyCode === 35) {
|
82
|
+
return 'end';
|
83
|
+
} else
|
84
|
+
|
85
|
+
// Check if character is arrow key
|
86
|
+
if(keyCode >= 37 && keyCode <= 40) {
|
87
|
+
switch (keyCode) {
|
88
|
+
case 37:
|
89
|
+
return 'left arrow';
|
90
|
+
case 38:
|
91
|
+
return 'up arrow';
|
92
|
+
case 39:
|
93
|
+
return 'right arrow';
|
94
|
+
case 40:
|
95
|
+
return 'down arrow';
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
else {
|
100
|
+
//return 'not categorized';
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
export default CharacterTypeService;
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class UserAgentService {
|
2
|
+
|
3
|
+
/**
|
4
|
+
*
|
5
|
+
* @returns {*}
|
6
|
+
* @private
|
7
|
+
*/
|
8
|
+
static _clickEventName () {
|
9
|
+
if ("ontouchstart" in document.documentElement && navigator.userAgent.toLowerCase().indexOf('firefox') === -1)
|
10
|
+
{
|
11
|
+
return (navigator.userAgent.toLowerCase().indexOf('windows') === -1)?"touchend" : "pointerup";
|
12
|
+
} else {
|
13
|
+
return "click";
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
static _detectIE() {
|
18
|
+
const ua = window.navigator.userAgent;
|
19
|
+
|
20
|
+
// Test values; Uncomment to check result …
|
21
|
+
|
22
|
+
// IE 10
|
23
|
+
// ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
|
24
|
+
|
25
|
+
// IE 11
|
26
|
+
// ua = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko';
|
27
|
+
|
28
|
+
// Edge 12 (Spartan)
|
29
|
+
// ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0';
|
30
|
+
|
31
|
+
// Edge 13
|
32
|
+
// ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586';
|
33
|
+
|
34
|
+
const msie = ua.indexOf('MSIE ');
|
35
|
+
if (msie > 0) {
|
36
|
+
// IE 10 or older => return version number
|
37
|
+
return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
|
38
|
+
}
|
39
|
+
|
40
|
+
const trident = ua.indexOf('Trident/');
|
41
|
+
if (trident > 0) {
|
42
|
+
// IE 11 => return version number
|
43
|
+
const rv = ua.indexOf('rv:');
|
44
|
+
return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
|
45
|
+
}
|
46
|
+
|
47
|
+
const edge = ua.indexOf('Edge/');
|
48
|
+
if (edge > 0) {
|
49
|
+
// Edge (IE 12+) => return version number
|
50
|
+
return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
|
51
|
+
}
|
52
|
+
|
53
|
+
// other browser
|
54
|
+
return false;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
export default UserAgentService;
|
59
|
+
|
package/src/utils.js
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
/**
|
2
|
+
* hasClass()
|
3
|
+
* Checks wether element contains a class
|
4
|
+
* This accounts for the fact that element might contain multiple class names separated by space.
|
5
|
+
*
|
6
|
+
* @param {Dom Element} element
|
7
|
+
* @param {String} className we are checking
|
8
|
+
* @return {Boolean}
|
9
|
+
*/
|
10
|
+
|
11
|
+
//TODO check the best way to do this
|
12
|
+
function hasClass(element, className) {
|
13
|
+
return element.classList.contains(className);
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
/**
|
18
|
+
* getParentByTagName()
|
19
|
+
* Get parent node for given tagname
|
20
|
+
*
|
21
|
+
* @param {Object} node DOM node
|
22
|
+
* @param {String} tagname HTML tagName
|
23
|
+
* @return {Object} Parent node
|
24
|
+
*/
|
25
|
+
function getParentByTagName(node, tagname) {
|
26
|
+
var parent;
|
27
|
+
if (node === null || tagname === '') return;
|
28
|
+
parent = node.parentNode;
|
29
|
+
tagname = tagname.toUpperCase();
|
30
|
+
|
31
|
+
while (parent.tagName !== "HTML") {
|
32
|
+
if (parent.tagName === tagname) {
|
33
|
+
return parent;
|
34
|
+
}
|
35
|
+
parent = parent.parentNode;
|
36
|
+
}
|
37
|
+
|
38
|
+
return parent;
|
39
|
+
}
|
40
|
+
|
41
|
+
function isChild(parent, child) {
|
42
|
+
var node = child.parentElement;
|
43
|
+
while (node !== null) {
|
44
|
+
if (node.classList.contains(parent)) {
|
45
|
+
return true;
|
46
|
+
}
|
47
|
+
node = node.parentElement;
|
48
|
+
}
|
49
|
+
return false;
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* scrollToTop()
|
54
|
+
* Used to animate the scroll position back to the top of the page
|
55
|
+
*/
|
56
|
+
function scrollToTop() {
|
57
|
+
|
58
|
+
const scrollHeight = window.scrollY,
|
59
|
+
scrollDuration = 500,
|
60
|
+
scrollStep = Math.PI / ( scrollDuration / 15 ),
|
61
|
+
cosParameter = scrollHeight / 2;
|
62
|
+
|
63
|
+
let scrollCount = 0,
|
64
|
+
scrollMargin;
|
65
|
+
|
66
|
+
requestAnimationFrame(step);
|
67
|
+
|
68
|
+
console.log(scrollStep);
|
69
|
+
|
70
|
+
function step () {
|
71
|
+
setTimeout(function() {
|
72
|
+
if ( window.scrollY !== 0 ) {
|
73
|
+
requestAnimationFrame(step);
|
74
|
+
scrollCount = scrollCount + 1;
|
75
|
+
scrollMargin = cosParameter - cosParameter * Math.cos( scrollCount * scrollStep );
|
76
|
+
window.scrollTo( 0, ( scrollHeight - scrollMargin ) );
|
77
|
+
}
|
78
|
+
}, 15 );
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
export { hasClass, getParentByTagName, isChild };
|