geico_design_kit 0.0.1-security.1 → 15.1.0
Sign up to get free protection for your applications and to get access to all the features.
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/alt.json +33 -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 +29 -3
- 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
- package/README.md +0 -5
@@ -0,0 +1,193 @@
|
|
1
|
+
import * as utils from '../../src/utils';
|
2
|
+
import baseComponent from '../../src/baseComponent';
|
3
|
+
|
4
|
+
const validateSettings = [
|
5
|
+
{
|
6
|
+
setting: "content",
|
7
|
+
isRequired: true,
|
8
|
+
validate: "type",
|
9
|
+
possibleValues: ["string", "object"],
|
10
|
+
errorMessage: ["GDK ViewMoreLess : Content must be defined and set to a DOM selector or Node"]
|
11
|
+
},
|
12
|
+
{
|
13
|
+
setting: "viewMoreLinkClicked",
|
14
|
+
isRequired: false,
|
15
|
+
validate: "type",
|
16
|
+
possibleValues: ["function"],
|
17
|
+
errorMessage: ["GDK ViewMoreLess : viewMoreLinkClicked must be defined and set function"]
|
18
|
+
},
|
19
|
+
{
|
20
|
+
setting: "collapsedTextValue",
|
21
|
+
isRequired: false,
|
22
|
+
validate: "type",
|
23
|
+
possibleValues: ["string"],
|
24
|
+
errorMessage: ["GDK ViewMoreLess : collapsedTextValue must be defined as a text string"]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
setting: "expandedTextValue",
|
28
|
+
isRequired: false,
|
29
|
+
validate: "type",
|
30
|
+
possibleValues: ["string"],
|
31
|
+
errorMessage: ["GDK ViewMoreLess : expandedTextValue must be defined as a text string"]
|
32
|
+
}
|
33
|
+
];
|
34
|
+
|
35
|
+
/**
|
36
|
+
* View More/Less Class
|
37
|
+
*/
|
38
|
+
class ViewMoreLess {
|
39
|
+
/**
|
40
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
41
|
+
* @param {string|Object} content
|
42
|
+
* A reference to the component node to toggle
|
43
|
+
*
|
44
|
+
* @param {function} [viewMoreLinkClicked]
|
45
|
+
* A callback function that gets fired when the View link is clicked
|
46
|
+
*
|
47
|
+
* @param {string} [collapsedTextValue="View More"]
|
48
|
+
* A string representing the link text when collapsed
|
49
|
+
*
|
50
|
+
* @param {string} [expandedTextValue="View Less"]
|
51
|
+
* A string representing the link text when expanded
|
52
|
+
*
|
53
|
+
*/
|
54
|
+
constructor(options) {
|
55
|
+
|
56
|
+
console.log('ViewMoreLess initialized');
|
57
|
+
|
58
|
+
this._internalVars = {
|
59
|
+
node: null //used for current node
|
60
|
+
};
|
61
|
+
|
62
|
+
//options with defaults set
|
63
|
+
this._defaults = {
|
64
|
+
collapsedTextValue : 'View More',
|
65
|
+
expandedTextValue : 'View Less'
|
66
|
+
};
|
67
|
+
|
68
|
+
// Create options by extending defaults with the passed in arugments
|
69
|
+
if (options && typeof options === "object") {
|
70
|
+
this._options = baseComponent.extendDefaults(this._defaults, options);
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
//if the required options are valid set up the environment
|
75
|
+
if( baseComponent.validateSettings(this._options, validateSettings) ){
|
76
|
+
this._internalVars.contentType = baseComponent.getContentType(this);
|
77
|
+
setLocalVars.call(this);
|
78
|
+
init.call(this);
|
79
|
+
setEvents.call(this);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
//Public Methods
|
84
|
+
|
85
|
+
/**
|
86
|
+
* removes the node from the dom and any events attached
|
87
|
+
*/
|
88
|
+
destroy(){
|
89
|
+
removeEvents.call(this);
|
90
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
91
|
+
|
92
|
+
//a little garbage collection
|
93
|
+
for (var variableKey in this){
|
94
|
+
if (this.hasOwnProperty(variableKey)){
|
95
|
+
delete this[variableKey];
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
// Private Methods
|
102
|
+
/**
|
103
|
+
* setEvents()
|
104
|
+
* Sets all the events needed for the component
|
105
|
+
*/
|
106
|
+
function setEvents() {
|
107
|
+
this._internalVars.vmlLinkObject.addEventListener("click", this._internalVars.handler);
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
/**
|
112
|
+
* removeEvents()
|
113
|
+
* removes all events from the component
|
114
|
+
*/
|
115
|
+
function removeEvents() {
|
116
|
+
this._internalVars.vmlLinkObject.removeEventListener("click",this._internalVars.handler);
|
117
|
+
}
|
118
|
+
|
119
|
+
function init() {
|
120
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
/**
|
125
|
+
* toggleView()
|
126
|
+
* instantiate View More/Less
|
127
|
+
*/
|
128
|
+
function toggleView(e) {
|
129
|
+
e.preventDefault();
|
130
|
+
this._internalVars.vmlIconObject.classList.toggle('view-less-link-icon');
|
131
|
+
this._internalVars.vmlObject.querySelector('.' + this._internalVars.vmlContentClass).classList.toggle('expanded');
|
132
|
+
|
133
|
+
if( this._internalVars.vmlContentObject.classList.contains('expanded') ) {
|
134
|
+
$(this._internalVars.vmlContentObject).slideDown();
|
135
|
+
} else {
|
136
|
+
$(this._internalVars.vmlContentObject).slideUp();
|
137
|
+
}
|
138
|
+
|
139
|
+
if (utils.hasClass(this._internalVars.vmlIconObject,'view-less-link-icon')) {
|
140
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.expandedTextValue;
|
141
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
142
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
143
|
+
this._internalVars.vmlState = true;
|
144
|
+
}else{
|
145
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
146
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
147
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
148
|
+
this._internalVars.vmlState = false;
|
149
|
+
}
|
150
|
+
|
151
|
+
if(this._options.viewMoreLinkClicked) {
|
152
|
+
this._options.viewMoreLinkClicked(this._internalVars.vmlState);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* setLocalVars()
|
158
|
+
* set local vars to the ones passed in options
|
159
|
+
*/
|
160
|
+
function setLocalVars() {
|
161
|
+
if(this._internalVars.contentType === 'string') {
|
162
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
163
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
164
|
+
this._internalVars.node = this._options.content;
|
165
|
+
}
|
166
|
+
this._internalVars.collapsedTextValue = this._options.collapsedTextValue;
|
167
|
+
this._internalVars.expandedTextValue = this._options.expandedTextValue;
|
168
|
+
|
169
|
+
this._internalVars.vmlLinkClass = 'view-more-less-link';
|
170
|
+
this._internalVars.vmlLinkTitle = 'view-more-link-title';
|
171
|
+
this._internalVars.vmlIconClass = 'view-more-link-icon';
|
172
|
+
this._internalVars.vmlContentClass = 'view-more-less-content';
|
173
|
+
this._internalVars.vmlObject = this._internalVars.node;
|
174
|
+
this._internalVars.vmlLinkObject = this._internalVars.node.querySelector('a.' + this._internalVars.vmlLinkClass);
|
175
|
+
this._internalVars.vmlTitleObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlLinkTitle);
|
176
|
+
this._internalVars.vmlIconObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlIconClass);
|
177
|
+
this._internalVars.vmlContentObject = this._internalVars.node.querySelector('div.' + this._internalVars.vmlContentClass);
|
178
|
+
this._internalVars.vmlState = false;
|
179
|
+
|
180
|
+
if(this._internalVars.vmlContentObject.classList.contains('expanded')){
|
181
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
182
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
183
|
+
this._internalVars.vmlState = true;
|
184
|
+
}else{
|
185
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
186
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
187
|
+
this._internalVars.vmlState = false;
|
188
|
+
}
|
189
|
+
|
190
|
+
this._internalVars.handler = toggleView.bind(this);
|
191
|
+
}
|
192
|
+
|
193
|
+
export default ViewMoreLess;
|
@@ -0,0 +1,193 @@
|
|
1
|
+
import * as utils from '../../src/utils';
|
2
|
+
import baseComponent from '../../src/baseComponent';
|
3
|
+
|
4
|
+
const validateSettings = [
|
5
|
+
{
|
6
|
+
setting: "content",
|
7
|
+
isRequired: true,
|
8
|
+
validate: "type",
|
9
|
+
possibleValues: ["string", "object"],
|
10
|
+
errorMessage: ["GDK ViewMoreLess : Content must be defined and set to a DOM selector or Node"]
|
11
|
+
},
|
12
|
+
{
|
13
|
+
setting: "viewMoreLinkClicked",
|
14
|
+
isRequired: false,
|
15
|
+
validate: "type",
|
16
|
+
possibleValues: ["function"],
|
17
|
+
errorMessage: ["GDK ViewMoreLess : viewMoreLinkClicked must be defined and set function"]
|
18
|
+
},
|
19
|
+
{
|
20
|
+
setting: "collapsedTextValue",
|
21
|
+
isRequired: false,
|
22
|
+
validate: "type",
|
23
|
+
possibleValues: ["string"],
|
24
|
+
errorMessage: ["GDK ViewMoreLess : collapsedTextValue must be defined as a text string"]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
setting: "expandedTextValue",
|
28
|
+
isRequired: false,
|
29
|
+
validate: "type",
|
30
|
+
possibleValues: ["string"],
|
31
|
+
errorMessage: ["GDK ViewMoreLess : expandedTextValue must be defined as a text string"]
|
32
|
+
}
|
33
|
+
];
|
34
|
+
|
35
|
+
/**
|
36
|
+
* View More/Less Class
|
37
|
+
*/
|
38
|
+
class ViewMoreLess {
|
39
|
+
/**
|
40
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
41
|
+
* @param {string|Object} content
|
42
|
+
* A reference to the component node to toggle
|
43
|
+
*
|
44
|
+
* @param {function} [viewMoreLinkClicked]
|
45
|
+
* A callback function that gets fired when the View link is clicked
|
46
|
+
*
|
47
|
+
* @param {string} [collapsedTextValue="View More"]
|
48
|
+
* A string representing the link text when collapsed
|
49
|
+
*
|
50
|
+
* @param {string} [expandedTextValue="View Less"]
|
51
|
+
* A string representing the link text when expanded
|
52
|
+
*
|
53
|
+
*/
|
54
|
+
constructor(options) {
|
55
|
+
|
56
|
+
console.log('ViewMoreLess initialized');
|
57
|
+
|
58
|
+
this._internalVars = {
|
59
|
+
node: null //used for current node
|
60
|
+
};
|
61
|
+
|
62
|
+
//options with defaults set
|
63
|
+
this._defaults = {
|
64
|
+
collapsedTextValue : 'View More',
|
65
|
+
expandedTextValue : 'View Less'
|
66
|
+
};
|
67
|
+
|
68
|
+
// Create options by extending defaults with the passed in arugments
|
69
|
+
if (options && typeof options === "object") {
|
70
|
+
this._options = baseComponent.extendDefaults(this._defaults, options);
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
//if the required options are valid set up the environment
|
75
|
+
if( baseComponent.validateSettings(this._options, validateSettings) ){
|
76
|
+
this._internalVars.contentType = baseComponent.getContentType(this);
|
77
|
+
setLocalVars.call(this);
|
78
|
+
init.call(this);
|
79
|
+
setEvents.call(this);
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
//Public Methods
|
84
|
+
|
85
|
+
/**
|
86
|
+
* removes the node from the dom and any events attached
|
87
|
+
*/
|
88
|
+
destroy(){
|
89
|
+
removeEvents.call(this);
|
90
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
91
|
+
|
92
|
+
//a little garbage collection
|
93
|
+
for (var variableKey in this){
|
94
|
+
if (this.hasOwnProperty(variableKey)){
|
95
|
+
delete this[variableKey];
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
// Private Methods
|
102
|
+
/**
|
103
|
+
* setEvents()
|
104
|
+
* Sets all the events needed for the component
|
105
|
+
*/
|
106
|
+
function setEvents() {
|
107
|
+
this._internalVars.vmlLinkObject.addEventListener("click", this._internalVars.handler);
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
/**
|
112
|
+
* removeEvents()
|
113
|
+
* removes all events from the component
|
114
|
+
*/
|
115
|
+
function removeEvents() {
|
116
|
+
this._internalVars.vmlLinkObject.removeEventListener("click",this._internalVars.handler);
|
117
|
+
}
|
118
|
+
|
119
|
+
function init() {
|
120
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
/**
|
125
|
+
* toggleView()
|
126
|
+
* instantiate View More/Less
|
127
|
+
*/
|
128
|
+
function toggleView(e) {
|
129
|
+
e.preventDefault();
|
130
|
+
this._internalVars.vmlIconObject.classList.toggle('view-less-link-icon');
|
131
|
+
this._internalVars.vmlObject.querySelector('.' + this._internalVars.vmlContentClass).classList.toggle('expanded');
|
132
|
+
|
133
|
+
if( this._internalVars.vmlContentObject.classList.contains('expanded') ) {
|
134
|
+
$(this._internalVars.vmlContentObject).slideDown();
|
135
|
+
} else {
|
136
|
+
$(this._internalVars.vmlContentObject).slideUp();
|
137
|
+
}
|
138
|
+
|
139
|
+
if (utils.hasClass(this._internalVars.vmlIconObject,'view-less-link-icon')) {
|
140
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.expandedTextValue;
|
141
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
142
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
143
|
+
this._internalVars.vmlState = true;
|
144
|
+
}else{
|
145
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
146
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
147
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
148
|
+
this._internalVars.vmlState = false;
|
149
|
+
}
|
150
|
+
|
151
|
+
if(this._options.viewMoreLinkClicked) {
|
152
|
+
this._options.viewMoreLinkClicked(this._internalVars.vmlState);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* setLocalVars()
|
158
|
+
* set local vars to the ones passed in options
|
159
|
+
*/
|
160
|
+
function setLocalVars() {
|
161
|
+
if(this._internalVars.contentType === 'string') {
|
162
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
163
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
164
|
+
this._internalVars.node = this._options.content;
|
165
|
+
}
|
166
|
+
this._internalVars.collapsedTextValue = this._options.collapsedTextValue;
|
167
|
+
this._internalVars.expandedTextValue = this._options.expandedTextValue;
|
168
|
+
|
169
|
+
this._internalVars.vmlLinkClass = 'view-more-less-link';
|
170
|
+
this._internalVars.vmlLinkTitle = 'view-more-link-title';
|
171
|
+
this._internalVars.vmlIconClass = 'view-more-link-icon';
|
172
|
+
this._internalVars.vmlContentClass = 'view-more-less-content';
|
173
|
+
this._internalVars.vmlObject = this._internalVars.node;
|
174
|
+
this._internalVars.vmlLinkObject = this._internalVars.node.querySelector('a.' + this._internalVars.vmlLinkClass);
|
175
|
+
this._internalVars.vmlTitleObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlLinkTitle);
|
176
|
+
this._internalVars.vmlIconObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlIconClass);
|
177
|
+
this._internalVars.vmlContentObject = this._internalVars.node.querySelector('div.' + this._internalVars.vmlContentClass);
|
178
|
+
this._internalVars.vmlState = false;
|
179
|
+
|
180
|
+
if(this._internalVars.vmlContentObject.classList.contains('expanded')){
|
181
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
182
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
183
|
+
this._internalVars.vmlState = true;
|
184
|
+
}else{
|
185
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
186
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
187
|
+
this._internalVars.vmlState = false;
|
188
|
+
}
|
189
|
+
|
190
|
+
this._internalVars.handler = toggleView.bind(this);
|
191
|
+
}
|
192
|
+
|
193
|
+
export default ViewMoreLess;
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import * as utils from '../../src/utils';
|
2
|
+
import baseComponent from '../../src/baseComponent';
|
3
|
+
|
4
|
+
const validateSettings = [
|
5
|
+
{
|
6
|
+
setting: "content",
|
7
|
+
isRequired: true,
|
8
|
+
validate: "type",
|
9
|
+
possibleValues: ["string", "object"],
|
10
|
+
errorMessage: ["GDK Portfolio : Content must be defined and set to a DOM selector or Node"]
|
11
|
+
}
|
12
|
+
];
|
13
|
+
|
14
|
+
class Portfolio {
|
15
|
+
constructor(options) {
|
16
|
+
|
17
|
+
console.log('Portfolio initialized');
|
18
|
+
|
19
|
+
this._internalVars = {
|
20
|
+
node: null
|
21
|
+
};
|
22
|
+
|
23
|
+
//options with defaults set
|
24
|
+
this._defaults = {
|
25
|
+
|
26
|
+
};
|
27
|
+
|
28
|
+
// Create options by extending defaults with the passed in arugments
|
29
|
+
if (options && typeof options === "object") {
|
30
|
+
this._options = baseComponent.extendDefaults(this._defaults, options);
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
//if the required options are valid set up the environment
|
35
|
+
if( baseComponent.validateSettings(this._options, validateSettings) ){
|
36
|
+
this._internalVars.contentType = baseComponent.getContentType(this);
|
37
|
+
setLocalVars.call(this);
|
38
|
+
setEvents.call(this);
|
39
|
+
setContainerHeight.call(this);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
// Private Methods
|
45
|
+
/**
|
46
|
+
* setEvents()
|
47
|
+
* Sets all the events needed for the component
|
48
|
+
*/
|
49
|
+
function setEvents() {
|
50
|
+
window.onresize = setContainerHeight.bind(this);
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
/**
|
55
|
+
* removeEvents()
|
56
|
+
* removes all events from the component
|
57
|
+
*/
|
58
|
+
function removeEvents() {
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
/**
|
63
|
+
* setContainerHeight()
|
64
|
+
* set container height
|
65
|
+
*/
|
66
|
+
function setContainerHeight() {
|
67
|
+
if (window.innerWidth > 550) {
|
68
|
+
this._internalVars.portfolioLeft.removeAttribute('style');
|
69
|
+
this._internalVars.portfolioRight.removeAttribute('style');
|
70
|
+
|
71
|
+
let arrHeight = [];
|
72
|
+
|
73
|
+
let leftHeight = this._internalVars.portfolioLeft.clientHeight;
|
74
|
+
let rightHeight = this._internalVars.portfolioRight.clientHeight;
|
75
|
+
|
76
|
+
arrHeight.push(leftHeight, rightHeight);
|
77
|
+
|
78
|
+
let containerHeight = Math.max(...arrHeight);
|
79
|
+
|
80
|
+
this._internalVars.portfolioLeft.style.height = containerHeight + 'px';
|
81
|
+
this._internalVars.portfolioRight.style.height = containerHeight + 'px';
|
82
|
+
} else {
|
83
|
+
this._internalVars.portfolioLeft.removeAttribute('style');
|
84
|
+
this._internalVars.portfolioRight.removeAttribute('style');
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
/**
|
89
|
+
* setLocalVars()
|
90
|
+
* set local vars to the ones passed in options
|
91
|
+
*/
|
92
|
+
function setLocalVars() {
|
93
|
+
if(this._internalVars.contentType === 'string') {
|
94
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
95
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
96
|
+
this._internalVars.node = this._options.content;
|
97
|
+
}
|
98
|
+
|
99
|
+
this._internalVars.portfolioLeftClass = 'left-portfolio-container';
|
100
|
+
this._internalVars.portfolioRightClass = 'right-portfolio-container';
|
101
|
+
this._internalVars.portfolioObject = this._internalVars.node;
|
102
|
+
this._internalVars.portfolioLeft = this._internalVars.portfolioObject.querySelector('.' + this._internalVars.portfolioLeftClass);
|
103
|
+
this._internalVars.portfolioRight = this._internalVars.portfolioObject.querySelector('.' + this._internalVars.portfolioRightClass);
|
104
|
+
}
|
105
|
+
|
106
|
+
export default Portfolio;
|
@@ -0,0 +1,144 @@
|
|
1
|
+
window.$ = window.jQuery = jQuery;
|
2
|
+
|
3
|
+
let Chosen = require('chosen-js');
|
4
|
+
|
5
|
+
require('../../sass-kit/geico-design-kit.scss');
|
6
|
+
|
7
|
+
import appState from './appState';
|
8
|
+
|
9
|
+
import * as nav from '../dist/global/nav';
|
10
|
+
import * as footer from '../dist/global/footer';
|
11
|
+
import * as components from '../dist/global/components';
|
12
|
+
|
13
|
+
import jQuery from 'jquery';
|
14
|
+
|
15
|
+
import Modal from '../dist/components/Modal';
|
16
|
+
import Tooltip from '../dist/components/Tooltip';
|
17
|
+
import Loader from '../dist/components/Loader';
|
18
|
+
import ButtonSwitch from '../dist/components/ButtonSwitch';
|
19
|
+
import TextareaCountdown from './components/TextareaCountdown';
|
20
|
+
import AddressAutoComplete from '../dist/components/AddressAutoComplete';
|
21
|
+
import DatePicker from '../dist/components/DatePicker';
|
22
|
+
import Tabs from '../dist/components/Tabs';
|
23
|
+
import SortableTable from '../dist/components/SortableTable';
|
24
|
+
// import QuoteComparisonTable from './components/QuoteComparisonTable';
|
25
|
+
import ViewMoreLess from '../dist/components/ViewMoreLess';
|
26
|
+
import ToTopArrow from '../dist/components/ToTopArrow';
|
27
|
+
import ValidateForm from '../dist/components/ValidateForm';
|
28
|
+
import InPageNavigation from '../dist/components/InPageNavigation';
|
29
|
+
import TimelineFilter from '../dist/components/TimelineFilter';
|
30
|
+
import Timeline from '../dist/components/Timeline';
|
31
|
+
import Accordion from '../dist/components/Accordion';
|
32
|
+
import Alert from '../dist/components/Alert';
|
33
|
+
import MoreInfoButton from '../dist/components/MoreInfoButton';
|
34
|
+
import BackgroundPattern from '../dist/components/BackgroundPattern';
|
35
|
+
import BackgroundPatternPortfolioPage from './components/BackgroundPatternPortfolioPage';
|
36
|
+
import DotNavigation from '../dist/components/DotNavigation';
|
37
|
+
import EditableTable from '../dist/components/EditableTable';
|
38
|
+
import CoverageGraph from '../dist/components/CoverageGraph';
|
39
|
+
import CommonQuestionsSquares from '../dist/components/CommonQuestionsSquares';
|
40
|
+
import UpsellCarousel from '../dist/components/Upsell';
|
41
|
+
import Portfolio from '../dist/components/portfolio';
|
42
|
+
import PayPlans from '../dist/components/PayPlans';
|
43
|
+
import ConsolidatedSummary from '../dist/components/ConsolidatedSummary';
|
44
|
+
import EditComponent from '../dist/components/EditComponent';
|
45
|
+
import DockedMessage from '../dist/components/DockedMessage';
|
46
|
+
import SegmentedControl from '../dist/components/SegmentedControl';
|
47
|
+
import MultipleSelectBox from '../dist/components/MultipleSelectBox';
|
48
|
+
import CardSelections from '../dist/components/CardSelections';
|
49
|
+
import TimeInput from './components/TimeInput';
|
50
|
+
import NavigationalBox from '../dist/components/NavigationalBox';
|
51
|
+
import PasswordMeter from '../dist/components/PasswordMeter';
|
52
|
+
import CreditCard from '../dist/components/CreditCard';
|
53
|
+
import CurrencyInput from '../dist/components/CurrencyInput';
|
54
|
+
import MakePayment from '../dist/components/MakePayment';
|
55
|
+
import Navigator from '../dist/components/Navigator';
|
56
|
+
import VIN from '../dist/components/VIN';
|
57
|
+
import ZipCode from "../dist/components/ZipCode";
|
58
|
+
import Confirmation from "../dist/components/Confirmation";
|
59
|
+
|
60
|
+
let GDK = GDK || {};
|
61
|
+
|
62
|
+
function init() {
|
63
|
+
let pjson = require("../../../package");
|
64
|
+
let version = pjson.version;
|
65
|
+
|
66
|
+
let about = {
|
67
|
+
_comment: "This is a generated version.json file. Do not attempt to modify. Modify Version from package.json file.",
|
68
|
+
version: version
|
69
|
+
};
|
70
|
+
|
71
|
+
let ProtoGDK = {
|
72
|
+
about: about,
|
73
|
+
navigation : nav,
|
74
|
+
Modal : Modal,
|
75
|
+
Tooltip : Tooltip,
|
76
|
+
Loader : Loader,
|
77
|
+
ButtonSwitch : ButtonSwitch,
|
78
|
+
TextareaCountdown : TextareaCountdown,
|
79
|
+
DatePicker : DatePicker,
|
80
|
+
AddressAutoComplete : AddressAutoComplete,
|
81
|
+
Tabs : Tabs,
|
82
|
+
SortableTable : SortableTable,
|
83
|
+
// QuoteComparisonTable : QuoteComparisonTable,
|
84
|
+
ViewMoreLess : ViewMoreLess,
|
85
|
+
ValidateForm : ValidateForm,
|
86
|
+
InPageNavigation : InPageNavigation,
|
87
|
+
TimelineFilter : TimelineFilter,
|
88
|
+
Timeline : Timeline,
|
89
|
+
Accordion : Accordion,
|
90
|
+
ToTopArrow : ToTopArrow,
|
91
|
+
Alert: Alert,
|
92
|
+
MoreInfoButton: MoreInfoButton,
|
93
|
+
BackgroundPattern: BackgroundPattern,
|
94
|
+
BackgroundPatternPortfolioPage: BackgroundPatternPortfolioPage,
|
95
|
+
DotNavigation: DotNavigation,
|
96
|
+
EditableTable: EditableTable,
|
97
|
+
CoverageGraph: CoverageGraph,
|
98
|
+
CommonQuestionsSquares: CommonQuestionsSquares,
|
99
|
+
ConsolidatedSummary: ConsolidatedSummary,
|
100
|
+
UpsellCarousel: UpsellCarousel,
|
101
|
+
footer: footer,
|
102
|
+
PayPlans: PayPlans,
|
103
|
+
Chosen: Chosen,
|
104
|
+
MultipleSelectBox: MultipleSelectBox,
|
105
|
+
Portfolio: Portfolio,
|
106
|
+
EditComponent: EditComponent,
|
107
|
+
DockedMessage: DockedMessage,
|
108
|
+
SegmentedControl: SegmentedControl,
|
109
|
+
CardSelections: CardSelections,
|
110
|
+
TimeInput: TimeInput,
|
111
|
+
NavigationalBox: NavigationalBox,
|
112
|
+
components: components,
|
113
|
+
PasswordMeter: PasswordMeter,
|
114
|
+
CurrencyInput: CurrencyInput,
|
115
|
+
CreditCard: CreditCard,
|
116
|
+
MakePayment: MakePayment,
|
117
|
+
Navigator: Navigator,
|
118
|
+
VIN: VIN,
|
119
|
+
ZipCode: ZipCode,
|
120
|
+
Confirmation: Confirmation
|
121
|
+
};
|
122
|
+
|
123
|
+
for(var property in ProtoGDK) {
|
124
|
+
if(!GDK.hasOwnProperty(property)) {
|
125
|
+
GDK[property] = ProtoGDK[property];
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
window.addEventListener('resize', () => {
|
130
|
+
handleResize();
|
131
|
+
});
|
132
|
+
|
133
|
+
handleResize();
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
function handleResize() {
|
139
|
+
appState.windowSize = {width : window.innerWidth || document.documentElement.clientWidth, height : window.innerHeight || document.documentElement.clientHeight};
|
140
|
+
}
|
141
|
+
|
142
|
+
init();
|
143
|
+
window.GDK = GDK;
|
144
|
+
export { GDK };
|