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,191 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
var utils = _interopRequireWildcard(require("../../src/utils"));
|
8
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
14
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
15
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
var validateSettings = [{
|
19
|
+
setting: "content",
|
20
|
+
isRequired: true,
|
21
|
+
validate: "type",
|
22
|
+
possibleValues: ["string", "object"],
|
23
|
+
errorMessage: ["GDK ViewMoreLess : Content must be defined and set to a DOM selector or Node"]
|
24
|
+
}, {
|
25
|
+
setting: "viewMoreLinkClicked",
|
26
|
+
isRequired: false,
|
27
|
+
validate: "type",
|
28
|
+
possibleValues: ["function"],
|
29
|
+
errorMessage: ["GDK ViewMoreLess : viewMoreLinkClicked must be defined and set function"]
|
30
|
+
}, {
|
31
|
+
setting: "collapsedTextValue",
|
32
|
+
isRequired: false,
|
33
|
+
validate: "type",
|
34
|
+
possibleValues: ["string"],
|
35
|
+
errorMessage: ["GDK ViewMoreLess : collapsedTextValue must be defined as a text string"]
|
36
|
+
}, {
|
37
|
+
setting: "expandedTextValue",
|
38
|
+
isRequired: false,
|
39
|
+
validate: "type",
|
40
|
+
possibleValues: ["string"],
|
41
|
+
errorMessage: ["GDK ViewMoreLess : expandedTextValue must be defined as a text string"]
|
42
|
+
}];
|
43
|
+
|
44
|
+
/**
|
45
|
+
* View More/Less Class
|
46
|
+
*/
|
47
|
+
var ViewMoreLess = /*#__PURE__*/function () {
|
48
|
+
/**
|
49
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
50
|
+
* @param {string|Object} content
|
51
|
+
* A reference to the component node to toggle
|
52
|
+
*
|
53
|
+
* @param {function} [viewMoreLinkClicked]
|
54
|
+
* A callback function that gets fired when the View link is clicked
|
55
|
+
*
|
56
|
+
* @param {string} [collapsedTextValue="View More"]
|
57
|
+
* A string representing the link text when collapsed
|
58
|
+
*
|
59
|
+
* @param {string} [expandedTextValue="View Less"]
|
60
|
+
* A string representing the link text when expanded
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
function ViewMoreLess(options) {
|
64
|
+
_classCallCheck(this, ViewMoreLess);
|
65
|
+
console.log('ViewMoreLess initialized');
|
66
|
+
this._internalVars = {
|
67
|
+
node: null //used for current node
|
68
|
+
};
|
69
|
+
|
70
|
+
//options with defaults set
|
71
|
+
this._defaults = {
|
72
|
+
collapsedTextValue: 'View More',
|
73
|
+
expandedTextValue: 'View Less'
|
74
|
+
};
|
75
|
+
|
76
|
+
// Create options by extending defaults with the passed in arugments
|
77
|
+
if (options && _typeof(options) === "object") {
|
78
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
79
|
+
}
|
80
|
+
|
81
|
+
//if the required options are valid set up the environment
|
82
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
83
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
84
|
+
setLocalVars.call(this);
|
85
|
+
init.call(this);
|
86
|
+
setEvents.call(this);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
//Public Methods
|
91
|
+
|
92
|
+
/**
|
93
|
+
* removes the node from the dom and any events attached
|
94
|
+
*/
|
95
|
+
return _createClass(ViewMoreLess, [{
|
96
|
+
key: "destroy",
|
97
|
+
value: function destroy() {
|
98
|
+
removeEvents.call(this);
|
99
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
100
|
+
|
101
|
+
//a little garbage collection
|
102
|
+
for (var variableKey in this) {
|
103
|
+
if (this.hasOwnProperty(variableKey)) {
|
104
|
+
delete this[variableKey];
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}]);
|
109
|
+
}(); // Private Methods
|
110
|
+
/**
|
111
|
+
* setEvents()
|
112
|
+
* Sets all the events needed for the component
|
113
|
+
*/
|
114
|
+
function setEvents() {
|
115
|
+
this._internalVars.vmlLinkObject.addEventListener("click", this._internalVars.handler);
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* removeEvents()
|
120
|
+
* removes all events from the component
|
121
|
+
*/
|
122
|
+
function removeEvents() {
|
123
|
+
this._internalVars.vmlLinkObject.removeEventListener("click", this._internalVars.handler);
|
124
|
+
}
|
125
|
+
function init() {
|
126
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* toggleView()
|
131
|
+
* instantiate View More/Less
|
132
|
+
*/
|
133
|
+
function toggleView(e) {
|
134
|
+
e.preventDefault();
|
135
|
+
this._internalVars.vmlIconObject.classList.toggle('view-less-link-icon');
|
136
|
+
this._internalVars.vmlObject.querySelector('.' + this._internalVars.vmlContentClass).classList.toggle('expanded');
|
137
|
+
if (this._internalVars.vmlContentObject.classList.contains('expanded')) {
|
138
|
+
$(this._internalVars.vmlContentObject).slideDown();
|
139
|
+
} else {
|
140
|
+
$(this._internalVars.vmlContentObject).slideUp();
|
141
|
+
}
|
142
|
+
if (utils.hasClass(this._internalVars.vmlIconObject, 'view-less-link-icon')) {
|
143
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.expandedTextValue;
|
144
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
145
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
146
|
+
this._internalVars.vmlState = true;
|
147
|
+
} else {
|
148
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
149
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
150
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
151
|
+
this._internalVars.vmlState = false;
|
152
|
+
}
|
153
|
+
if (this._options.viewMoreLinkClicked) {
|
154
|
+
this._options.viewMoreLinkClicked(this._internalVars.vmlState);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* setLocalVars()
|
160
|
+
* set local vars to the ones passed in options
|
161
|
+
*/
|
162
|
+
function setLocalVars() {
|
163
|
+
if (this._internalVars.contentType === 'string') {
|
164
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
165
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
166
|
+
this._internalVars.node = this._options.content;
|
167
|
+
}
|
168
|
+
this._internalVars.collapsedTextValue = this._options.collapsedTextValue;
|
169
|
+
this._internalVars.expandedTextValue = this._options.expandedTextValue;
|
170
|
+
this._internalVars.vmlLinkClass = 'view-more-less-link';
|
171
|
+
this._internalVars.vmlLinkTitle = 'view-more-link-title';
|
172
|
+
this._internalVars.vmlIconClass = 'view-more-link-icon';
|
173
|
+
this._internalVars.vmlContentClass = 'view-more-less-content';
|
174
|
+
this._internalVars.vmlObject = this._internalVars.node;
|
175
|
+
this._internalVars.vmlLinkObject = this._internalVars.node.querySelector('a.' + this._internalVars.vmlLinkClass);
|
176
|
+
this._internalVars.vmlTitleObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlLinkTitle);
|
177
|
+
this._internalVars.vmlIconObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlIconClass);
|
178
|
+
this._internalVars.vmlContentObject = this._internalVars.node.querySelector('div.' + this._internalVars.vmlContentClass);
|
179
|
+
this._internalVars.vmlState = false;
|
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
|
+
this._internalVars.handler = toggleView.bind(this);
|
190
|
+
}
|
191
|
+
var _default = exports["default"] = ViewMoreLess;
|
@@ -0,0 +1,191 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
var utils = _interopRequireWildcard(require("../../src/utils"));
|
8
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
13
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
14
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
15
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
18
|
+
var validateSettings = [{
|
19
|
+
setting: "content",
|
20
|
+
isRequired: true,
|
21
|
+
validate: "type",
|
22
|
+
possibleValues: ["string", "object"],
|
23
|
+
errorMessage: ["GDK ViewMoreLess : Content must be defined and set to a DOM selector or Node"]
|
24
|
+
}, {
|
25
|
+
setting: "viewMoreLinkClicked",
|
26
|
+
isRequired: false,
|
27
|
+
validate: "type",
|
28
|
+
possibleValues: ["function"],
|
29
|
+
errorMessage: ["GDK ViewMoreLess : viewMoreLinkClicked must be defined and set function"]
|
30
|
+
}, {
|
31
|
+
setting: "collapsedTextValue",
|
32
|
+
isRequired: false,
|
33
|
+
validate: "type",
|
34
|
+
possibleValues: ["string"],
|
35
|
+
errorMessage: ["GDK ViewMoreLess : collapsedTextValue must be defined as a text string"]
|
36
|
+
}, {
|
37
|
+
setting: "expandedTextValue",
|
38
|
+
isRequired: false,
|
39
|
+
validate: "type",
|
40
|
+
possibleValues: ["string"],
|
41
|
+
errorMessage: ["GDK ViewMoreLess : expandedTextValue must be defined as a text string"]
|
42
|
+
}];
|
43
|
+
|
44
|
+
/**
|
45
|
+
* View More/Less Class
|
46
|
+
*/
|
47
|
+
var ViewMoreLess = /*#__PURE__*/function () {
|
48
|
+
/**
|
49
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
50
|
+
* @param {string|Object} content
|
51
|
+
* A reference to the component node to toggle
|
52
|
+
*
|
53
|
+
* @param {function} [viewMoreLinkClicked]
|
54
|
+
* A callback function that gets fired when the View link is clicked
|
55
|
+
*
|
56
|
+
* @param {string} [collapsedTextValue="View More"]
|
57
|
+
* A string representing the link text when collapsed
|
58
|
+
*
|
59
|
+
* @param {string} [expandedTextValue="View Less"]
|
60
|
+
* A string representing the link text when expanded
|
61
|
+
*
|
62
|
+
*/
|
63
|
+
function ViewMoreLess(options) {
|
64
|
+
_classCallCheck(this, ViewMoreLess);
|
65
|
+
console.log('ViewMoreLess initialized');
|
66
|
+
this._internalVars = {
|
67
|
+
node: null //used for current node
|
68
|
+
};
|
69
|
+
|
70
|
+
//options with defaults set
|
71
|
+
this._defaults = {
|
72
|
+
collapsedTextValue: 'View More',
|
73
|
+
expandedTextValue: 'View Less'
|
74
|
+
};
|
75
|
+
|
76
|
+
// Create options by extending defaults with the passed in arugments
|
77
|
+
if (options && _typeof(options) === "object") {
|
78
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
79
|
+
}
|
80
|
+
|
81
|
+
//if the required options are valid set up the environment
|
82
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
83
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
84
|
+
setLocalVars.call(this);
|
85
|
+
init.call(this);
|
86
|
+
setEvents.call(this);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
//Public Methods
|
91
|
+
|
92
|
+
/**
|
93
|
+
* removes the node from the dom and any events attached
|
94
|
+
*/
|
95
|
+
return _createClass(ViewMoreLess, [{
|
96
|
+
key: "destroy",
|
97
|
+
value: function destroy() {
|
98
|
+
removeEvents.call(this);
|
99
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
100
|
+
|
101
|
+
//a little garbage collection
|
102
|
+
for (var variableKey in this) {
|
103
|
+
if (this.hasOwnProperty(variableKey)) {
|
104
|
+
delete this[variableKey];
|
105
|
+
}
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}]);
|
109
|
+
}(); // Private Methods
|
110
|
+
/**
|
111
|
+
* setEvents()
|
112
|
+
* Sets all the events needed for the component
|
113
|
+
*/
|
114
|
+
function setEvents() {
|
115
|
+
this._internalVars.vmlLinkObject.addEventListener("click", this._internalVars.handler);
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* removeEvents()
|
120
|
+
* removes all events from the component
|
121
|
+
*/
|
122
|
+
function removeEvents() {
|
123
|
+
this._internalVars.vmlLinkObject.removeEventListener("click", this._internalVars.handler);
|
124
|
+
}
|
125
|
+
function init() {
|
126
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* toggleView()
|
131
|
+
* instantiate View More/Less
|
132
|
+
*/
|
133
|
+
function toggleView(e) {
|
134
|
+
e.preventDefault();
|
135
|
+
this._internalVars.vmlIconObject.classList.toggle('view-less-link-icon');
|
136
|
+
this._internalVars.vmlObject.querySelector('.' + this._internalVars.vmlContentClass).classList.toggle('expanded');
|
137
|
+
if (this._internalVars.vmlContentObject.classList.contains('expanded')) {
|
138
|
+
$(this._internalVars.vmlContentObject).slideDown();
|
139
|
+
} else {
|
140
|
+
$(this._internalVars.vmlContentObject).slideUp();
|
141
|
+
}
|
142
|
+
if (utils.hasClass(this._internalVars.vmlIconObject, 'view-less-link-icon')) {
|
143
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.expandedTextValue;
|
144
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'true');
|
145
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'false');
|
146
|
+
this._internalVars.vmlState = true;
|
147
|
+
} else {
|
148
|
+
this._internalVars.vmlTitleObject.innerHTML = this._internalVars.collapsedTextValue;
|
149
|
+
this._internalVars.vmlLinkObject.setAttribute('aria-expanded', 'false');
|
150
|
+
this._internalVars.vmlContentObject.setAttribute('aria-hidden', 'true');
|
151
|
+
this._internalVars.vmlState = false;
|
152
|
+
}
|
153
|
+
if (this._options.viewMoreLinkClicked) {
|
154
|
+
this._options.viewMoreLinkClicked(this._internalVars.vmlState);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* setLocalVars()
|
160
|
+
* set local vars to the ones passed in options
|
161
|
+
*/
|
162
|
+
function setLocalVars() {
|
163
|
+
if (this._internalVars.contentType === 'string') {
|
164
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
165
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
166
|
+
this._internalVars.node = this._options.content;
|
167
|
+
}
|
168
|
+
this._internalVars.collapsedTextValue = this._options.collapsedTextValue;
|
169
|
+
this._internalVars.expandedTextValue = this._options.expandedTextValue;
|
170
|
+
this._internalVars.vmlLinkClass = 'view-more-less-link';
|
171
|
+
this._internalVars.vmlLinkTitle = 'view-more-link-title';
|
172
|
+
this._internalVars.vmlIconClass = 'view-more-link-icon';
|
173
|
+
this._internalVars.vmlContentClass = 'view-more-less-content';
|
174
|
+
this._internalVars.vmlObject = this._internalVars.node;
|
175
|
+
this._internalVars.vmlLinkObject = this._internalVars.node.querySelector('a.' + this._internalVars.vmlLinkClass);
|
176
|
+
this._internalVars.vmlTitleObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlLinkTitle);
|
177
|
+
this._internalVars.vmlIconObject = this._internalVars.node.querySelector('span.' + this._internalVars.vmlIconClass);
|
178
|
+
this._internalVars.vmlContentObject = this._internalVars.node.querySelector('div.' + this._internalVars.vmlContentClass);
|
179
|
+
this._internalVars.vmlState = false;
|
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
|
+
this._internalVars.handler = toggleView.bind(this);
|
190
|
+
}
|
191
|
+
var _default = exports["default"] = ViewMoreLess;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
var utils = _interopRequireWildcard(require("../../src/utils"));
|
8
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
12
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
13
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
14
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
17
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
18
|
+
var validateSettings = [{
|
19
|
+
setting: "content",
|
20
|
+
isRequired: true,
|
21
|
+
validate: "type",
|
22
|
+
possibleValues: ["string", "object"],
|
23
|
+
errorMessage: ["GDK Portfolio : Content must be defined and set to a DOM selector or Node"]
|
24
|
+
}];
|
25
|
+
var Portfolio = /*#__PURE__*/_createClass(function Portfolio(options) {
|
26
|
+
_classCallCheck(this, Portfolio);
|
27
|
+
console.log('Portfolio initialized');
|
28
|
+
this._internalVars = {
|
29
|
+
node: null
|
30
|
+
};
|
31
|
+
|
32
|
+
//options with defaults set
|
33
|
+
this._defaults = {};
|
34
|
+
|
35
|
+
// Create options by extending defaults with the passed in arugments
|
36
|
+
if (options && _typeof(options) === "object") {
|
37
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
38
|
+
}
|
39
|
+
|
40
|
+
//if the required options are valid set up the environment
|
41
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
42
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
43
|
+
setLocalVars.call(this);
|
44
|
+
setEvents.call(this);
|
45
|
+
setContainerHeight.call(this);
|
46
|
+
}
|
47
|
+
}); // Private Methods
|
48
|
+
/**
|
49
|
+
* setEvents()
|
50
|
+
* Sets all the events needed for the component
|
51
|
+
*/
|
52
|
+
function setEvents() {
|
53
|
+
window.onresize = setContainerHeight.bind(this);
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* removeEvents()
|
58
|
+
* removes all events from the component
|
59
|
+
*/
|
60
|
+
function removeEvents() {}
|
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
|
+
var arrHeight = [];
|
71
|
+
var leftHeight = this._internalVars.portfolioLeft.clientHeight;
|
72
|
+
var rightHeight = this._internalVars.portfolioRight.clientHeight;
|
73
|
+
arrHeight.push(leftHeight, rightHeight);
|
74
|
+
var containerHeight = Math.max.apply(Math, arrHeight);
|
75
|
+
this._internalVars.portfolioLeft.style.height = containerHeight + 'px';
|
76
|
+
this._internalVars.portfolioRight.style.height = containerHeight + 'px';
|
77
|
+
} else {
|
78
|
+
this._internalVars.portfolioLeft.removeAttribute('style');
|
79
|
+
this._internalVars.portfolioRight.removeAttribute('style');
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* setLocalVars()
|
85
|
+
* set local vars to the ones passed in options
|
86
|
+
*/
|
87
|
+
function setLocalVars() {
|
88
|
+
if (this._internalVars.contentType === 'string') {
|
89
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
90
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
91
|
+
this._internalVars.node = this._options.content;
|
92
|
+
}
|
93
|
+
this._internalVars.portfolioLeftClass = 'left-portfolio-container';
|
94
|
+
this._internalVars.portfolioRightClass = 'right-portfolio-container';
|
95
|
+
this._internalVars.portfolioObject = this._internalVars.node;
|
96
|
+
this._internalVars.portfolioLeft = this._internalVars.portfolioObject.querySelector('.' + this._internalVars.portfolioLeftClass);
|
97
|
+
this._internalVars.portfolioRight = this._internalVars.portfolioObject.querySelector('.' + this._internalVars.portfolioRightClass);
|
98
|
+
}
|
99
|
+
var _default = exports["default"] = Portfolio;
|
@@ -0,0 +1,141 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.GDK = void 0;
|
8
|
+
var _appState = _interopRequireDefault(require("./appState"));
|
9
|
+
var nav = _interopRequireWildcard(require("../dist/global/nav"));
|
10
|
+
var footer = _interopRequireWildcard(require("../dist/global/footer"));
|
11
|
+
var components = _interopRequireWildcard(require("../dist/global/components"));
|
12
|
+
var _jquery = _interopRequireDefault(require("jquery"));
|
13
|
+
var _Modal = _interopRequireDefault(require("../dist/components/Modal"));
|
14
|
+
var _Tooltip = _interopRequireDefault(require("../dist/components/Tooltip"));
|
15
|
+
var _Loader = _interopRequireDefault(require("../dist/components/Loader"));
|
16
|
+
var _ButtonSwitch = _interopRequireDefault(require("../dist/components/ButtonSwitch"));
|
17
|
+
var _TextareaCountdown = _interopRequireDefault(require("./components/TextareaCountdown"));
|
18
|
+
var _AddressAutoComplete = _interopRequireDefault(require("../dist/components/AddressAutoComplete"));
|
19
|
+
var _DatePicker = _interopRequireDefault(require("../dist/components/DatePicker"));
|
20
|
+
var _Tabs = _interopRequireDefault(require("../dist/components/Tabs"));
|
21
|
+
var _SortableTable = _interopRequireDefault(require("../dist/components/SortableTable"));
|
22
|
+
var _ViewMoreLess = _interopRequireDefault(require("../dist/components/ViewMoreLess"));
|
23
|
+
var _ToTopArrow = _interopRequireDefault(require("../dist/components/ToTopArrow"));
|
24
|
+
var _ValidateForm = _interopRequireDefault(require("../dist/components/ValidateForm"));
|
25
|
+
var _InPageNavigation = _interopRequireDefault(require("../dist/components/InPageNavigation"));
|
26
|
+
var _TimelineFilter = _interopRequireDefault(require("../dist/components/TimelineFilter"));
|
27
|
+
var _Timeline = _interopRequireDefault(require("../dist/components/Timeline"));
|
28
|
+
var _Accordion = _interopRequireDefault(require("../dist/components/Accordion"));
|
29
|
+
var _Alert = _interopRequireDefault(require("../dist/components/Alert"));
|
30
|
+
var _MoreInfoButton = _interopRequireDefault(require("../dist/components/MoreInfoButton"));
|
31
|
+
var _BackgroundPattern = _interopRequireDefault(require("../dist/components/BackgroundPattern"));
|
32
|
+
var _BackgroundPatternPortfolioPage = _interopRequireDefault(require("./components/BackgroundPatternPortfolioPage"));
|
33
|
+
var _DotNavigation = _interopRequireDefault(require("../dist/components/DotNavigation"));
|
34
|
+
var _EditableTable = _interopRequireDefault(require("../dist/components/EditableTable"));
|
35
|
+
var _CoverageGraph = _interopRequireDefault(require("../dist/components/CoverageGraph"));
|
36
|
+
var _CommonQuestionsSquares = _interopRequireDefault(require("../dist/components/CommonQuestionsSquares"));
|
37
|
+
var _Upsell = _interopRequireDefault(require("../dist/components/Upsell"));
|
38
|
+
var _portfolio = _interopRequireDefault(require("../dist/components/portfolio"));
|
39
|
+
var _PayPlans = _interopRequireDefault(require("../dist/components/PayPlans"));
|
40
|
+
var _ConsolidatedSummary = _interopRequireDefault(require("../dist/components/ConsolidatedSummary"));
|
41
|
+
var _EditComponent = _interopRequireDefault(require("../dist/components/EditComponent"));
|
42
|
+
var _DockedMessage = _interopRequireDefault(require("../dist/components/DockedMessage"));
|
43
|
+
var _SegmentedControl = _interopRequireDefault(require("../dist/components/SegmentedControl"));
|
44
|
+
var _MultipleSelectBox = _interopRequireDefault(require("../dist/components/MultipleSelectBox"));
|
45
|
+
var _CardSelections = _interopRequireDefault(require("../dist/components/CardSelections"));
|
46
|
+
var _TimeInput = _interopRequireDefault(require("./components/TimeInput"));
|
47
|
+
var _NavigationalBox = _interopRequireDefault(require("../dist/components/NavigationalBox"));
|
48
|
+
var _PasswordMeter = _interopRequireDefault(require("../dist/components/PasswordMeter"));
|
49
|
+
var _CreditCard = _interopRequireDefault(require("../dist/components/CreditCard"));
|
50
|
+
var _CurrencyInput = _interopRequireDefault(require("../dist/components/CurrencyInput"));
|
51
|
+
var _MakePayment = _interopRequireDefault(require("../dist/components/MakePayment"));
|
52
|
+
var _Navigator = _interopRequireDefault(require("../dist/components/Navigator"));
|
53
|
+
var _VIN = _interopRequireDefault(require("../dist/components/VIN"));
|
54
|
+
var _ZipCode = _interopRequireDefault(require("../dist/components/ZipCode"));
|
55
|
+
var _Confirmation = _interopRequireDefault(require("../dist/components/Confirmation"));
|
56
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
57
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
58
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
59
|
+
window.$ = window.jQuery = _jquery["default"];
|
60
|
+
var Chosen = require('chosen-js');
|
61
|
+
require('../../sass-kit/geico-design-kit.scss');
|
62
|
+
|
63
|
+
// import QuoteComparisonTable from './components/QuoteComparisonTable';
|
64
|
+
|
65
|
+
var GDK = exports.GDK = GDK || {};
|
66
|
+
function init() {
|
67
|
+
var pjson = require("../../../package");
|
68
|
+
var version = pjson.version;
|
69
|
+
var about = {
|
70
|
+
_comment: "This is a generated version.json file. Do not attempt to modify. Modify Version from package.json file.",
|
71
|
+
version: version
|
72
|
+
};
|
73
|
+
var ProtoGDK = {
|
74
|
+
about: about,
|
75
|
+
navigation: nav,
|
76
|
+
Modal: _Modal["default"],
|
77
|
+
Tooltip: _Tooltip["default"],
|
78
|
+
Loader: _Loader["default"],
|
79
|
+
ButtonSwitch: _ButtonSwitch["default"],
|
80
|
+
TextareaCountdown: _TextareaCountdown["default"],
|
81
|
+
DatePicker: _DatePicker["default"],
|
82
|
+
AddressAutoComplete: _AddressAutoComplete["default"],
|
83
|
+
Tabs: _Tabs["default"],
|
84
|
+
SortableTable: _SortableTable["default"],
|
85
|
+
// QuoteComparisonTable : QuoteComparisonTable,
|
86
|
+
ViewMoreLess: _ViewMoreLess["default"],
|
87
|
+
ValidateForm: _ValidateForm["default"],
|
88
|
+
InPageNavigation: _InPageNavigation["default"],
|
89
|
+
TimelineFilter: _TimelineFilter["default"],
|
90
|
+
Timeline: _Timeline["default"],
|
91
|
+
Accordion: _Accordion["default"],
|
92
|
+
ToTopArrow: _ToTopArrow["default"],
|
93
|
+
Alert: _Alert["default"],
|
94
|
+
MoreInfoButton: _MoreInfoButton["default"],
|
95
|
+
BackgroundPattern: _BackgroundPattern["default"],
|
96
|
+
BackgroundPatternPortfolioPage: _BackgroundPatternPortfolioPage["default"],
|
97
|
+
DotNavigation: _DotNavigation["default"],
|
98
|
+
EditableTable: _EditableTable["default"],
|
99
|
+
CoverageGraph: _CoverageGraph["default"],
|
100
|
+
CommonQuestionsSquares: _CommonQuestionsSquares["default"],
|
101
|
+
ConsolidatedSummary: _ConsolidatedSummary["default"],
|
102
|
+
UpsellCarousel: _Upsell["default"],
|
103
|
+
footer: footer,
|
104
|
+
PayPlans: _PayPlans["default"],
|
105
|
+
Chosen: Chosen,
|
106
|
+
MultipleSelectBox: _MultipleSelectBox["default"],
|
107
|
+
Portfolio: _portfolio["default"],
|
108
|
+
EditComponent: _EditComponent["default"],
|
109
|
+
DockedMessage: _DockedMessage["default"],
|
110
|
+
SegmentedControl: _SegmentedControl["default"],
|
111
|
+
CardSelections: _CardSelections["default"],
|
112
|
+
TimeInput: _TimeInput["default"],
|
113
|
+
NavigationalBox: _NavigationalBox["default"],
|
114
|
+
components: components,
|
115
|
+
PasswordMeter: _PasswordMeter["default"],
|
116
|
+
CurrencyInput: _CurrencyInput["default"],
|
117
|
+
CreditCard: _CreditCard["default"],
|
118
|
+
MakePayment: _MakePayment["default"],
|
119
|
+
Navigator: _Navigator["default"],
|
120
|
+
VIN: _VIN["default"],
|
121
|
+
ZipCode: _ZipCode["default"],
|
122
|
+
Confirmation: _Confirmation["default"]
|
123
|
+
};
|
124
|
+
for (var property in ProtoGDK) {
|
125
|
+
if (!GDK.hasOwnProperty(property)) {
|
126
|
+
GDK[property] = ProtoGDK[property];
|
127
|
+
}
|
128
|
+
}
|
129
|
+
window.addEventListener('resize', function () {
|
130
|
+
handleResize();
|
131
|
+
});
|
132
|
+
handleResize();
|
133
|
+
}
|
134
|
+
function handleResize() {
|
135
|
+
_appState["default"].windowSize = {
|
136
|
+
width: window.innerWidth || document.documentElement.clientWidth,
|
137
|
+
height: window.innerHeight || document.documentElement.clientHeight
|
138
|
+
};
|
139
|
+
}
|
140
|
+
init();
|
141
|
+
window.GDK = GDK;
|