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,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
|
+
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); }
|
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
|
+
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); } }
|
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
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); }
|
|
15
|
+
var validateSettings = [{
|
|
16
|
+
setting: "content",
|
|
17
|
+
isRequired: true,
|
|
18
|
+
validate: "type",
|
|
19
|
+
possibleValues: ["string", "object"],
|
|
20
|
+
errorMessage: ["GDK CardSelections : Content must be defined and set to a DOM selector or Node"]
|
|
21
|
+
}, {
|
|
22
|
+
setting: "initialActiveCard",
|
|
23
|
+
isRequired: false,
|
|
24
|
+
validate: "type",
|
|
25
|
+
possibleValues: ["number"],
|
|
26
|
+
errorMessage: ["GDK CardSelections : initialActiveCard must be set to a number"]
|
|
27
|
+
}, {
|
|
28
|
+
setting: "cardSelectionSet",
|
|
29
|
+
isRequired: false,
|
|
30
|
+
validate: "type",
|
|
31
|
+
possibleValues: ["function"],
|
|
32
|
+
errorMessage: ["GDK CardSelections : cardSelectionClick must be a function"]
|
|
33
|
+
}];
|
|
34
|
+
var CardSelections = /*#__PURE__*/function () {
|
|
35
|
+
/**
|
|
36
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
|
37
|
+
* @param {string|Object} content
|
|
38
|
+
* A reference to the html More Background Pattern node
|
|
39
|
+
*
|
|
40
|
+
* @param {number} [initialActiveCard=1]
|
|
41
|
+
* The number of the item to set as the active card on initialization. Must be greater than 0 and equal to or less than the number of cards.
|
|
42
|
+
*
|
|
43
|
+
* @param {function} [cardSelectionSet]
|
|
44
|
+
* A callback function that is triggered when any card is set to active.
|
|
45
|
+
*/
|
|
46
|
+
function CardSelections(options) {
|
|
47
|
+
_classCallCheck(this, CardSelections);
|
|
48
|
+
this._internalVars = {
|
|
49
|
+
node: null //used for content item
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
//options with defaults set
|
|
53
|
+
this._defaults = {
|
|
54
|
+
initialActiveCard: 1
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Create options by extending defaults with the passed in arugments
|
|
58
|
+
if (options && _typeof(options) === "object") {
|
|
59
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//if the required options are valid set up the environment
|
|
63
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
|
64
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
|
65
|
+
setLocalVars.call(this);
|
|
66
|
+
setEvents.call(this);
|
|
67
|
+
init.call(this);
|
|
68
|
+
this._internalVars.cardSelectionSection.setAttribute('role', 'radiogroup');
|
|
69
|
+
Array.prototype.forEach.call(this._internalVars.cardSelectionsCards, function (element) {
|
|
70
|
+
if (!element.getAttribute('tabindex')) element.setAttribute('tabindex', '0');
|
|
71
|
+
if (!element.getElementsByTagName('input')[0].getAttribute('tabindex')) element.getElementsByTagName('input')[0].setAttribute('tabindex', '-1');
|
|
72
|
+
element.setAttribute('role', 'radio');
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//Public Methods
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Returns the active selected card
|
|
81
|
+
* @return {Element}
|
|
82
|
+
*/
|
|
83
|
+
return _createClass(CardSelections, [{
|
|
84
|
+
key: "currentActiveCard",
|
|
85
|
+
value: function currentActiveCard() {
|
|
86
|
+
return this._internalVars.selectedCard;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* sets the initial active card using an index parameter
|
|
91
|
+
* @param {Number} index Number indicating what the active card should be set to
|
|
92
|
+
*/
|
|
93
|
+
}, {
|
|
94
|
+
key: "setActiveCard",
|
|
95
|
+
value: function setActiveCard(index) {
|
|
96
|
+
setInitialActiveCard.call(this, index);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* removes the node from the dom and any events attached
|
|
101
|
+
*/
|
|
102
|
+
}, {
|
|
103
|
+
key: "destroy",
|
|
104
|
+
value: function destroy() {
|
|
105
|
+
removeEvents.call(this);
|
|
106
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
|
107
|
+
|
|
108
|
+
//a little garbage collection
|
|
109
|
+
for (var variableKey in this) {
|
|
110
|
+
if (this.hasOwnProperty(variableKey)) {
|
|
111
|
+
delete this[variableKey];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}]);
|
|
116
|
+
}(); // Private Methods
|
|
117
|
+
/**
|
|
118
|
+
* setEvents()
|
|
119
|
+
* Sets all the events needed for the component
|
|
120
|
+
*/
|
|
121
|
+
function setEvents() {
|
|
122
|
+
var _this = this;
|
|
123
|
+
var eventName = "click";
|
|
124
|
+
Array.prototype.forEach.call(this._internalVars.cardSelectionsCards, function (element) {
|
|
125
|
+
element.addEventListener(eventName, _this._internalVars.handler);
|
|
126
|
+
element.addEventListener('keyup', _this._internalVars.handler);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* removeEvents()
|
|
132
|
+
* removes all events from the component
|
|
133
|
+
*/
|
|
134
|
+
function removeEvents() {
|
|
135
|
+
var _this2 = this;
|
|
136
|
+
var eventName = "click";
|
|
137
|
+
Array.prototype.forEach.call(this._internalVars.cardSelectionsCards, function (element) {
|
|
138
|
+
element.removeEventListener(eventName, _this2._internalVars.handler);
|
|
139
|
+
element.removeEventListener('keyup', _this2._internalVars.handler);
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* init()
|
|
145
|
+
* Sets the initial values
|
|
146
|
+
*/
|
|
147
|
+
function init() {
|
|
148
|
+
var index = null;
|
|
149
|
+
if (this._options.initialActiveCard) {
|
|
150
|
+
index = this._options.initialActiveCard;
|
|
151
|
+
} else {
|
|
152
|
+
index = this._defaults.initialActiveCard;
|
|
153
|
+
}
|
|
154
|
+
setInitialActiveCard.call(this, index);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Removes the class and attributes identifying the card as selected
|
|
159
|
+
*/
|
|
160
|
+
function resetSelected() {
|
|
161
|
+
var _this3 = this;
|
|
162
|
+
var selected = this._internalVars.cardSelectionsObject.querySelectorAll('.' + this._internalVars.cardSelectedClass);
|
|
163
|
+
if (selected) {
|
|
164
|
+
Array.prototype.forEach.call(selected, function (el) {
|
|
165
|
+
el.classList.remove(_this3._internalVars.cardSelectedClass);
|
|
166
|
+
el.getElementsByTagName('input')[0].checked = false;
|
|
167
|
+
el.setAttribute('aria-checked', 'false');
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Adds attributes identifying the card as selected
|
|
174
|
+
*/
|
|
175
|
+
function setActiveCardAttributes() {
|
|
176
|
+
this._internalVars.selectedCard = this._internalVars.cardSelectionsObject.querySelector('.' + this._internalVars.cardSelectedClass);
|
|
177
|
+
this._internalVars.selectedCard.getElementsByTagName('input')[0].checked = true;
|
|
178
|
+
this._internalVars.selectedCard.setAttribute('aria-checked', 'true');
|
|
179
|
+
if (this._options.cardSelectionSet) {
|
|
180
|
+
this._options.cardSelectionSet(this._internalVars.selectedCard);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* setInitialActiveCard()
|
|
186
|
+
* Sets the initial active card
|
|
187
|
+
*/
|
|
188
|
+
function setInitialActiveCard(index) {
|
|
189
|
+
resetSelected.call(this);
|
|
190
|
+
if (index <= this._internalVars.cardSelectionsCards.length && index > 0) {
|
|
191
|
+
this._internalVars.cardSelectionsCards[index - 1].classList.add(this._internalVars.cardSelectedClass);
|
|
192
|
+
} else {
|
|
193
|
+
this._internalVars.cardSelectionsCards[0].classList.add(this._internalVars.cardSelectedClass);
|
|
194
|
+
}
|
|
195
|
+
setActiveCardAttributes.call(this);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* setActiveCard()
|
|
200
|
+
* Sets the active card
|
|
201
|
+
*/
|
|
202
|
+
function setActiveCard(event) {
|
|
203
|
+
if (event.type == 'keypress' || event.type == 'keyup' && (event.keyCode || event.which) != 13) {} else {
|
|
204
|
+
resetSelected.call(this);
|
|
205
|
+
event.currentTarget.classList.add(this._internalVars.cardSelectedClass);
|
|
206
|
+
setActiveCardAttributes.call(this);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* setLocalVars()
|
|
212
|
+
* set all the local vars to passed in options
|
|
213
|
+
*/
|
|
214
|
+
function setLocalVars() {
|
|
215
|
+
//determine the type of content passed in
|
|
216
|
+
if (this._internalVars.contentType === 'string') {
|
|
217
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
|
218
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
|
219
|
+
this._internalVars.node = this._options.content;
|
|
220
|
+
}
|
|
221
|
+
this._internalVars.cardSelectionsObject = this._internalVars.node;
|
|
222
|
+
this._internalVars.cardSelectionSectionClass = 'card-selections';
|
|
223
|
+
this._internalVars.cardSelectedClass = 'card-selections-selected';
|
|
224
|
+
this._internalVars.cardSelectionsCardClass = 'card-selections-card';
|
|
225
|
+
this._internalVars.selectedCard = null;
|
|
226
|
+
this._internalVars.cardSelectionSection = this._internalVars.cardSelectionsObject.querySelector('.' + this._internalVars.cardSelectionSectionClass);
|
|
227
|
+
this._internalVars.cardSelectionsCards = this._internalVars.cardSelectionsObject.querySelectorAll('.' + this._internalVars.cardSelectionsCardClass);
|
|
228
|
+
this._internalVars.handler = setActiveCard.bind(this);
|
|
229
|
+
}
|
|
230
|
+
var _default = exports["default"] = CardSelections;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _appState = _interopRequireDefault(require("../../src/appState"));
|
|
8
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
|
9
|
+
var _UserAgentService = _interopRequireDefault(require("../../src/services/UserAgentService"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
|
+
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); }
|
|
12
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
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
|
+
var validateSettings = [{
|
|
18
|
+
setting: "content",
|
|
19
|
+
isRequired: true,
|
|
20
|
+
validate: "type",
|
|
21
|
+
possibleValues: ["string", "object"],
|
|
22
|
+
errorMessage: ["GDK CommonQuestionsSquares : Content must be defined and set to a DOM selector or Node"]
|
|
23
|
+
}];
|
|
24
|
+
var CommonQuestionsSquares = /*#__PURE__*/function () {
|
|
25
|
+
/**
|
|
26
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
|
27
|
+
* @param {string|Object} content
|
|
28
|
+
* A reference to the common questions squares node
|
|
29
|
+
*/
|
|
30
|
+
function CommonQuestionsSquares(options) {
|
|
31
|
+
_classCallCheck(this, CommonQuestionsSquares);
|
|
32
|
+
this._internalVars = {
|
|
33
|
+
node: null,
|
|
34
|
+
//used for content item
|
|
35
|
+
individualBoxes: null
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//options with defaults set
|
|
39
|
+
this._defaults = {};
|
|
40
|
+
|
|
41
|
+
// Create options by extending defaults with the passed in arugments
|
|
42
|
+
if (options && _typeof(options) === "object") {
|
|
43
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//if the required options are valid set up the environment
|
|
47
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
|
48
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
|
49
|
+
setLocalVars.call(this);
|
|
50
|
+
setEvents.call(this);
|
|
51
|
+
var allSquares = this._internalVars.node.querySelectorAll('.square');
|
|
52
|
+
Array.prototype.forEach.call(allSquares, function (el, i) {
|
|
53
|
+
if (!el.classList.contains('square-link')) el.setAttribute('tabindex', '0');
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//Public Methods
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* destroy()
|
|
62
|
+
* removes the node from the dom and any events attached
|
|
63
|
+
*/
|
|
64
|
+
return _createClass(CommonQuestionsSquares, [{
|
|
65
|
+
key: "destroy",
|
|
66
|
+
value: function destroy() {
|
|
67
|
+
removeEvents.call(this);
|
|
68
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
|
69
|
+
|
|
70
|
+
//a little garbage collection
|
|
71
|
+
for (var variableKey in this) {
|
|
72
|
+
if (this.hasOwnProperty(variableKey)) {
|
|
73
|
+
delete this[variableKey];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}]);
|
|
78
|
+
}(); // Private Methods
|
|
79
|
+
/**
|
|
80
|
+
* setEvents()
|
|
81
|
+
* Sets all the events needed for the component
|
|
82
|
+
*/
|
|
83
|
+
function setEvents() {
|
|
84
|
+
var eventName = _UserAgentService["default"]._clickEventName();
|
|
85
|
+
console.log(this._internalVars.individualBoxes);
|
|
86
|
+
for (var j = 0; j < this._internalVars.individualBoxes.length - 1; j++) {
|
|
87
|
+
this._internalVars.individualBoxes[j].addEventListener('mouseover', removeStyleAttr.bind(this, this._internalVars.individualBoxes[j]));
|
|
88
|
+
this._internalVars.individualBoxes[j].addEventListener(eventName, openPanel.bind(this, this._internalVars.individualBoxes[j]));
|
|
89
|
+
}
|
|
90
|
+
for (var h = 0; h < this._internalVars.node.querySelectorAll('a').length; h++) {
|
|
91
|
+
this._internalVars.anchorArray[h].addEventListener('focus', linkFocus.bind(this, this._internalVars.anchorArray[h]));
|
|
92
|
+
this._internalVars.anchorArray[h].addEventListener('blur', linkUnfocus.bind(this, this._internalVars.anchorArray[h]));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function linkFocus(e) {
|
|
96
|
+
var squareParent = e.parentNode.parentNode;
|
|
97
|
+
squareParent.classList.add('flip-back');
|
|
98
|
+
squareParent.previousElementSibling.classList.add('flip-front');
|
|
99
|
+
}
|
|
100
|
+
function linkUnfocus(e) {
|
|
101
|
+
var squareParent = e.parentNode.parentNode;
|
|
102
|
+
squareParent.classList.remove('flip-back');
|
|
103
|
+
squareParent.previousElementSibling.classList.remove('flip-front');
|
|
104
|
+
}
|
|
105
|
+
function removeStyleAttr(e) {
|
|
106
|
+
if (_appState["default"].mode !== "mobile") {
|
|
107
|
+
var el = e.querySelector('.back');
|
|
108
|
+
el.removeAttribute('style');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function openPanel(e) {
|
|
112
|
+
var el = e.querySelector('.back');
|
|
113
|
+
if (_appState["default"].mode === "mobile") {
|
|
114
|
+
e.classList.toggle('open');
|
|
115
|
+
if (e.classList.contains('open')) {
|
|
116
|
+
el.style.display = "block";
|
|
117
|
+
var paragraph = el.querySelector("p");
|
|
118
|
+
el.style.maxHeight = outerHeight.call(this, paragraph) + "px";
|
|
119
|
+
} else {
|
|
120
|
+
el.removeAttribute('style');
|
|
121
|
+
el.style.display = "block";
|
|
122
|
+
el.style.maxHeight = "0px";
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
el.removeAttribute('style');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* removeEvents()
|
|
131
|
+
* removes all events from the component
|
|
132
|
+
*/
|
|
133
|
+
function removeEvents() {
|
|
134
|
+
var eventName = _UserAgentService["default"]._clickEventName();
|
|
135
|
+
for (var j = 0; j < this._internalVars.individualBoxes.length - 1; j++) {
|
|
136
|
+
this._internalVars.individualBoxes[j].removeEventListener('mouseover', removeStyleAttr.bind(this, this._internalVars.individualBoxes[j]));
|
|
137
|
+
this._internalVars.individualBoxes[j].removeEventListener(eventName, openPanel.bind(this, this._internalVars.individualBoxes[j]));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* setLocalVars()
|
|
143
|
+
* set all the local vars to passed in options
|
|
144
|
+
*/
|
|
145
|
+
function setLocalVars() {
|
|
146
|
+
//determine the type of content passed in
|
|
147
|
+
if (this._internalVars.contentType === 'string') {
|
|
148
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
|
149
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
|
150
|
+
this._internalVars.node = this._options.content;
|
|
151
|
+
}
|
|
152
|
+
this._internalVars.individualBoxes = this._internalVars.node.children;
|
|
153
|
+
this._internalVars.anchorArray = this._internalVars.node.querySelectorAll('a');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* outerHeight()
|
|
158
|
+
* used to get the height of an element that is the same across all browsers
|
|
159
|
+
*
|
|
160
|
+
* @param {Object} node DOM node
|
|
161
|
+
* @return {number}
|
|
162
|
+
*/
|
|
163
|
+
function outerHeight(el) {
|
|
164
|
+
var height = el.offsetHeight;
|
|
165
|
+
var style = getComputedStyle(el);
|
|
166
|
+
height += parseInt(style.marginTop) + parseInt(style.marginBottom);
|
|
167
|
+
return height;
|
|
168
|
+
}
|
|
169
|
+
var _default = exports["default"] = CommonQuestionsSquares;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
|
8
|
+
var _appState = _interopRequireDefault(require("../../src/appState"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
+
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); }
|
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
12
|
+
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); } }
|
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
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); }
|
|
16
|
+
var validateSettings = [{
|
|
17
|
+
setting: "content",
|
|
18
|
+
isRequired: true,
|
|
19
|
+
validate: "type",
|
|
20
|
+
possibleValues: ["string", "object"],
|
|
21
|
+
errorMessage: ["GDK Confirmation : Content must be defined and set to a DOM selector or Node"]
|
|
22
|
+
}];
|
|
23
|
+
var Confirmation = /*#__PURE__*/function () {
|
|
24
|
+
/**
|
|
25
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
|
26
|
+
* @param {string|Object} content
|
|
27
|
+
* A reference to the html accordion node
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
function Confirmation(options) {
|
|
31
|
+
_classCallCheck(this, Confirmation);
|
|
32
|
+
this._internalVars = {
|
|
33
|
+
node: null //used for content item
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//options with defaults set
|
|
37
|
+
this._defaults = {
|
|
38
|
+
animateCheckmarkFunction: animateCheckmark.bind(this)
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Create options by extending defaults with the passed in arguments
|
|
42
|
+
if (options && _typeof(options) === "object") {
|
|
43
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//if the required options are valid set up the environment
|
|
47
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
|
48
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
|
49
|
+
setLocalVars.call(this);
|
|
50
|
+
setEvents.call(this);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//Public Methods
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* animateCheckmarkConfirmation()
|
|
58
|
+
* animates the check mark icon
|
|
59
|
+
*/
|
|
60
|
+
return _createClass(Confirmation, [{
|
|
61
|
+
key: "animateCheckmarkConfirmation",
|
|
62
|
+
value: function animateCheckmarkConfirmation() {
|
|
63
|
+
animateCheckmark.call(this);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* destroy()
|
|
68
|
+
* removes the node from the dom and any events attached
|
|
69
|
+
*/
|
|
70
|
+
}, {
|
|
71
|
+
key: "destroy",
|
|
72
|
+
value: function destroy() {
|
|
73
|
+
removeEvents.call(this);
|
|
74
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
|
75
|
+
|
|
76
|
+
//a little garbage collection
|
|
77
|
+
for (var variableKey in this) {
|
|
78
|
+
if (this.hasOwnProperty(variableKey)) {
|
|
79
|
+
delete this[variableKey];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}]);
|
|
84
|
+
}();
|
|
85
|
+
/**
|
|
86
|
+
* setEvents()
|
|
87
|
+
* Sets all the events needed for the component
|
|
88
|
+
*/
|
|
89
|
+
function setEvents() {
|
|
90
|
+
window.addEventListener("load", this._defaults.animateCheckmarkFunction);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* removeEvents()
|
|
95
|
+
* removes all events from the component
|
|
96
|
+
*/
|
|
97
|
+
function removeEvents() {
|
|
98
|
+
window.removeEventListener("load", this._defaults.animateCheckmarkFunction);
|
|
99
|
+
}
|
|
100
|
+
function animateCheckmark() {
|
|
101
|
+
if (this._internalVars.animationComplete !== true) {
|
|
102
|
+
setTimeout(svgAnim.bind(this), 2500);
|
|
103
|
+
this._internalVars.animationComplete = true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var tick = 0;
|
|
107
|
+
function svgAnim() {
|
|
108
|
+
var svgToAnim = this._internalVars.node.querySelector("svg"),
|
|
109
|
+
circleWrapper = this._internalVars.node.querySelector(".confirmation-icon-wrapper"),
|
|
110
|
+
dashArrayComplete = 183,
|
|
111
|
+
//svg animation settings
|
|
112
|
+
tickSpeed = 3.5,
|
|
113
|
+
//svg animation settings
|
|
114
|
+
tickSpeedMobile = 5; //svg animation settings
|
|
115
|
+
|
|
116
|
+
if (_appState["default"].mode === "desktop") {
|
|
117
|
+
tick += tickSpeed;
|
|
118
|
+
} else {
|
|
119
|
+
tick += tickSpeedMobile;
|
|
120
|
+
}
|
|
121
|
+
if (!circleWrapper.classList.contains("circleConfirmation")) {
|
|
122
|
+
circleWrapper.classList.add("circleConfirmation");
|
|
123
|
+
}
|
|
124
|
+
var t = tick / 100;
|
|
125
|
+
var offsetStrokeDasharray = easeInQuad(t, 0, dashArrayComplete, 1);
|
|
126
|
+
svgToAnim.style.strokeDasharray = "".concat(offsetStrokeDasharray, " , ").concat(dashArrayComplete);
|
|
127
|
+
if (tick < 100) {
|
|
128
|
+
requestAnimationFrame(svgAnim.bind(this));
|
|
129
|
+
} else {
|
|
130
|
+
tick = 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* easeInQuad()
|
|
136
|
+
* Quadratic easing
|
|
137
|
+
*/
|
|
138
|
+
function easeInQuad(t, b, c, d) {
|
|
139
|
+
var ts = (t /= d) * t;
|
|
140
|
+
return b + c * ts;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* setLocalVars()
|
|
145
|
+
* set all the local vars to passed in options
|
|
146
|
+
*/
|
|
147
|
+
function setLocalVars() {
|
|
148
|
+
//determine the type of content passed in
|
|
149
|
+
if (this._internalVars.contentType === 'string') {
|
|
150
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
|
151
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
|
152
|
+
this._internalVars.node = this._options.content;
|
|
153
|
+
}
|
|
154
|
+
this._internalVars.animationComplete = false;
|
|
155
|
+
}
|
|
156
|
+
var _default = exports["default"] = Confirmation;
|