@thecb/components 9.2.0-beta.10 → 9.2.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +634 -624
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +54 -0
- package/dist/index.esm.js +633 -624
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/popover/Popover.js +1 -1
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +1 -1
- package/src/components/molecules/toast-notification/ToastNotification.stories.js +4 -4
- package/src/hooks/index.js +3 -0
- package/src/{util/hooks → hooks}/use-toast-notification/index.d.ts +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/util/index.js +2 -2
- package/src/util/hooks/index.js +0 -1
- /package/src/{util/useOutsideClick.js → hooks/use-outside-click/index.js} +0 -0
- /package/src/{util/useScrollTo.js → hooks/use-scroll-to/index.js} +0 -0
- /package/src/{util/hooks → hooks}/use-toast-notification/index.js +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -25211,668 +25211,622 @@ var DisplayBox = function DisplayBox(_ref) {
|
|
|
25211
25211
|
|
|
25212
25212
|
var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$i);
|
|
25213
25213
|
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
for (var key in source) {
|
|
25220
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25221
|
-
target[key] = source[key];
|
|
25222
|
-
}
|
|
25223
|
-
}
|
|
25224
|
-
}
|
|
25225
|
-
|
|
25226
|
-
return target;
|
|
25227
|
-
};
|
|
25228
|
-
|
|
25229
|
-
return _extends$2.apply(this, arguments);
|
|
25230
|
-
}
|
|
25231
|
-
|
|
25232
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
25233
|
-
if (source == null) return {};
|
|
25234
|
-
var target = {};
|
|
25235
|
-
var sourceKeys = Object.keys(source);
|
|
25236
|
-
var key, i;
|
|
25237
|
-
|
|
25238
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
25239
|
-
key = sourceKeys[i];
|
|
25240
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
25241
|
-
target[key] = source[key];
|
|
25242
|
-
}
|
|
25243
|
-
|
|
25244
|
-
return target;
|
|
25245
|
-
}
|
|
25246
|
-
|
|
25247
|
-
function _objectWithoutProperties$1(source, excluded) {
|
|
25248
|
-
if (source == null) return {};
|
|
25249
|
-
|
|
25250
|
-
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
25214
|
+
/*
|
|
25215
|
+
Hook that assigns a click event listener to the main document element
|
|
25216
|
+
Returns a ref to attach to another element (like an icon/button that triggers a popover)
|
|
25217
|
+
If a click event gets captured by the document and the assigned element isn't the target
|
|
25218
|
+
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25251
25219
|
|
|
25252
|
-
|
|
25220
|
+
See popover component for implementation
|
|
25253
25221
|
|
|
25254
|
-
|
|
25255
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
25222
|
+
*/
|
|
25256
25223
|
|
|
25257
|
-
|
|
25258
|
-
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
}
|
|
25224
|
+
var useOutsideClickHook = function useOutsideClickHook(handler) {
|
|
25225
|
+
var ref = React.useRef();
|
|
25226
|
+
React.useEffect(function () {
|
|
25227
|
+
}, [ref]);
|
|
25228
|
+
return ref;
|
|
25229
|
+
};
|
|
25264
25230
|
|
|
25265
|
-
|
|
25266
|
-
|
|
25231
|
+
/*
|
|
25232
|
+
Hook that takes an ID selector for an element on the screen
|
|
25233
|
+
And optionally values for top position, left position, smooth behavior
|
|
25234
|
+
Finds element on screen and scrolls it to the provided coordinates
|
|
25267
25235
|
|
|
25268
|
-
|
|
25269
|
-
|
|
25270
|
-
|
|
25236
|
+
(string, number, number, string, number) => undefined;
|
|
25237
|
+
*/
|
|
25238
|
+
var useScrollTo = function useScrollTo(id) {
|
|
25239
|
+
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
25240
|
+
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
25241
|
+
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
25242
|
+
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
25243
|
+
var scrollItem;
|
|
25271
25244
|
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25245
|
+
if (delay) {
|
|
25246
|
+
setTimeout(function () {
|
|
25247
|
+
var _scrollItem;
|
|
25275
25248
|
|
|
25276
|
-
|
|
25277
|
-
|
|
25278
|
-
|
|
25249
|
+
scrollItem = document.getElementById(id);
|
|
25250
|
+
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
25251
|
+
top: top,
|
|
25252
|
+
left: left,
|
|
25253
|
+
behavior: behavior
|
|
25254
|
+
});
|
|
25255
|
+
}, delay);
|
|
25256
|
+
} else {
|
|
25257
|
+
var _scrollItem2;
|
|
25279
25258
|
|
|
25280
|
-
|
|
25259
|
+
scrollItem = document.getElementById(id);
|
|
25260
|
+
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
25261
|
+
top: top,
|
|
25262
|
+
left: left,
|
|
25263
|
+
behavior: behavior
|
|
25264
|
+
});
|
|
25281
25265
|
}
|
|
25282
|
-
}
|
|
25283
|
-
|
|
25284
|
-
function _arrayWithHoles$1(arr) {
|
|
25285
|
-
if (Array.isArray(arr)) return arr;
|
|
25286
|
-
}
|
|
25287
|
-
|
|
25288
|
-
function _iterableToArray$1(iter) {
|
|
25289
|
-
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
25290
|
-
}
|
|
25266
|
+
};
|
|
25291
25267
|
|
|
25292
|
-
|
|
25293
|
-
|
|
25294
|
-
|
|
25295
|
-
|
|
25268
|
+
var initialToastState = {
|
|
25269
|
+
isOpen: false,
|
|
25270
|
+
variant: "",
|
|
25271
|
+
message: ""
|
|
25272
|
+
};
|
|
25296
25273
|
|
|
25297
|
-
|
|
25298
|
-
var
|
|
25299
|
-
|
|
25300
|
-
|
|
25274
|
+
var useToastNotification = function useToastNotification() {
|
|
25275
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
25276
|
+
_ref$timeout = _ref.timeout,
|
|
25277
|
+
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25301
25278
|
|
|
25302
|
-
|
|
25303
|
-
|
|
25304
|
-
|
|
25279
|
+
var _useState = React.useState(initialToastState),
|
|
25280
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25281
|
+
toastState = _useState2[0],
|
|
25282
|
+
setToastState = _useState2[1];
|
|
25305
25283
|
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
} finally {
|
|
25312
|
-
try {
|
|
25313
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
25314
|
-
} finally {
|
|
25315
|
-
if (_d) throw _e;
|
|
25284
|
+
React.useEffect(function () {
|
|
25285
|
+
if (toastState.isOpen) {
|
|
25286
|
+
setTimeout(function () {
|
|
25287
|
+
setToastState(initialToastState);
|
|
25288
|
+
}, timeout);
|
|
25316
25289
|
}
|
|
25317
|
-
}
|
|
25318
|
-
|
|
25319
|
-
return _arr;
|
|
25320
|
-
}
|
|
25290
|
+
}, [timeout, toastState.isOpen]);
|
|
25321
25291
|
|
|
25322
|
-
function
|
|
25323
|
-
|
|
25324
|
-
|
|
25292
|
+
var showToast = function showToast(_ref2) {
|
|
25293
|
+
var message = _ref2.message,
|
|
25294
|
+
variant = _ref2.variant;
|
|
25295
|
+
return setToastState({
|
|
25296
|
+
isOpen: true,
|
|
25297
|
+
variant: variant,
|
|
25298
|
+
message: message
|
|
25299
|
+
});
|
|
25300
|
+
};
|
|
25325
25301
|
|
|
25326
|
-
function
|
|
25327
|
-
|
|
25328
|
-
}
|
|
25302
|
+
var hideToast = function hideToast() {
|
|
25303
|
+
return setToastState(initialToastState);
|
|
25304
|
+
};
|
|
25329
25305
|
|
|
25330
|
-
|
|
25331
|
-
|
|
25306
|
+
return {
|
|
25307
|
+
isToastOpen: toastState.isOpen,
|
|
25308
|
+
toastVariant: toastState.variant,
|
|
25309
|
+
toastMessage: toastState.message,
|
|
25310
|
+
showToast: showToast,
|
|
25311
|
+
hideToast: hideToast
|
|
25312
|
+
};
|
|
25332
25313
|
};
|
|
25333
|
-
var format$1 = function format(formatter) {
|
|
25334
|
-
return function (value) {
|
|
25335
|
-
var usedFormat = formatter.formats[value.length];
|
|
25336
25314
|
|
|
25337
|
-
if (!usedFormat) {
|
|
25338
|
-
return value;
|
|
25339
|
-
}
|
|
25340
25315
|
|
|
25341
|
-
var formatPieces = usedFormat.split(formatter.formatChar);
|
|
25342
|
-
var valuePieces = value.split("");
|
|
25343
|
-
var zipped = formatPieces.map(function (v, i) {
|
|
25344
|
-
return v + (valuePieces[i] || "");
|
|
25345
|
-
});
|
|
25346
|
-
return zipped.join("");
|
|
25347
|
-
};
|
|
25348
|
-
};
|
|
25349
25316
|
|
|
25350
|
-
var
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25317
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
25318
|
+
__proto__: null,
|
|
25319
|
+
useOutsideClick: useOutsideClickHook,
|
|
25320
|
+
useScrollTo: useScrollTo,
|
|
25321
|
+
useToastNotification: useToastNotification
|
|
25322
|
+
});
|
|
25323
|
+
|
|
25324
|
+
var hoverColor$4 = "#116285";
|
|
25325
|
+
var activeColor$4 = "#0E506D";
|
|
25326
|
+
var popoverTriggerColor = "#15749D";
|
|
25327
|
+
var fallbackValues$j = {
|
|
25328
|
+
hoverColor: hoverColor$4,
|
|
25329
|
+
activeColor: activeColor$4,
|
|
25330
|
+
popoverTriggerColor: popoverTriggerColor
|
|
25358
25331
|
};
|
|
25359
25332
|
|
|
25360
|
-
var
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
}
|
|
25333
|
+
var arrowBorder = function arrowBorder(borderColor, direction) {
|
|
25334
|
+
var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
|
|
25335
|
+
var angle = "".concat(width, " solid transparent");
|
|
25336
|
+
var straight = "".concat(width, " solid ").concat(borderColor);
|
|
25365
25337
|
|
|
25366
|
-
|
|
25367
|
-
return
|
|
25368
|
-
|
|
25369
|
-
|
|
25370
|
-
}
|
|
25371
|
-
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
};
|
|
25338
|
+
if (direction == "down") {
|
|
25339
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
|
|
25340
|
+
} else if (direction == "up") {
|
|
25341
|
+
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25342
|
+
} else if (direction == "left") {
|
|
25343
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25344
|
+
} else if (direction == "right") {
|
|
25345
|
+
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25346
|
+
}
|
|
25376
25347
|
};
|
|
25377
|
-
var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
|
|
25378
|
-
var maxFormatExceeded = rawValue.length >= formatter.formats.length;
|
|
25379
25348
|
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25349
|
+
var Popover = function Popover(_ref) {
|
|
25350
|
+
var themeValues = _ref.themeValues,
|
|
25351
|
+
_ref$triggerText = _ref.triggerText,
|
|
25352
|
+
triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
|
|
25353
|
+
_ref$content = _ref.content,
|
|
25354
|
+
content = _ref$content === void 0 ? "" : _ref$content,
|
|
25355
|
+
_ref$hasIcon = _ref.hasIcon,
|
|
25356
|
+
hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
|
|
25357
|
+
Icon = _ref.icon,
|
|
25358
|
+
_ref$iconHelpText = _ref.iconHelpText,
|
|
25359
|
+
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25360
|
+
_ref$popoverID = _ref.popoverID,
|
|
25361
|
+
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25362
|
+
_ref$popoverFocus = _ref.popoverFocus,
|
|
25363
|
+
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25364
|
+
extraStyles = _ref.extraStyles,
|
|
25365
|
+
textExtraStyles = _ref.textExtraStyles,
|
|
25366
|
+
_ref$minWidth = _ref.minWidth,
|
|
25367
|
+
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25368
|
+
_ref$maxWidth = _ref.maxWidth,
|
|
25369
|
+
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25370
|
+
_ref$height = _ref.height,
|
|
25371
|
+
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25372
|
+
position = _ref.position,
|
|
25373
|
+
arrowPosition = _ref.arrowPosition,
|
|
25374
|
+
_ref$arrowDirection = _ref.arrowDirection,
|
|
25375
|
+
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25376
|
+
_ref$transform = _ref.transform,
|
|
25377
|
+
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25378
|
+
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25379
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
25380
|
+
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25381
|
+
_ref$borderColor = _ref.borderColor,
|
|
25382
|
+
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25383
|
+
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25384
|
+
var hoverColor = themeValues.hoverColor,
|
|
25385
|
+
activeColor = themeValues.activeColor,
|
|
25386
|
+
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25394
25387
|
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25388
|
+
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25389
|
+
_ref2$top = _ref2.top,
|
|
25390
|
+
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25391
|
+
_ref2$right = _ref2.right,
|
|
25392
|
+
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25393
|
+
_ref2$bottom = _ref2.bottom,
|
|
25394
|
+
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25395
|
+
_ref2$left = _ref2.left,
|
|
25396
|
+
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25404
25397
|
|
|
25405
|
-
var
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25398
|
+
var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
|
|
25399
|
+
_ref3$arrowTop = _ref3.arrowTop,
|
|
25400
|
+
arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
|
|
25401
|
+
_ref3$arrowRight = _ref3.arrowRight,
|
|
25402
|
+
arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
|
|
25403
|
+
_ref3$arrowBottom = _ref3.arrowBottom,
|
|
25404
|
+
arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
|
|
25405
|
+
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25406
|
+
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25407
|
+
|
|
25408
|
+
var _useState = React.useState(false),
|
|
25409
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25410
|
+
popoverOpen = _useState2[0],
|
|
25411
|
+
togglePopover = _useState2[1];
|
|
25412
|
+
|
|
25413
|
+
var handleTogglePopover = function handleTogglePopover(popoverState) {
|
|
25414
|
+
if (popoverOpen !== popoverState) {
|
|
25415
|
+
togglePopover(popoverState);
|
|
25416
|
+
}
|
|
25410
25417
|
};
|
|
25418
|
+
|
|
25419
|
+
var triggerRef = useOutsideClickHook();
|
|
25420
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25421
|
+
padding: "0",
|
|
25422
|
+
extraStyles: "position: relative; ".concat(extraStyles)
|
|
25423
|
+
}, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25424
|
+
action: function action() {
|
|
25425
|
+
return noop;
|
|
25426
|
+
},
|
|
25427
|
+
onFocus: function onFocus() {
|
|
25428
|
+
handleTogglePopover(true);
|
|
25429
|
+
},
|
|
25430
|
+
onBlur: function onBlur() {
|
|
25431
|
+
handleTogglePopover(false);
|
|
25432
|
+
},
|
|
25433
|
+
onKeyDown: function onKeyDown(e) {
|
|
25434
|
+
if (e.keyCode === 27) {
|
|
25435
|
+
handleTogglePopover(false);
|
|
25436
|
+
}
|
|
25437
|
+
},
|
|
25438
|
+
onTouchStart: function onTouchStart() {
|
|
25439
|
+
return handleTogglePopover(true);
|
|
25440
|
+
},
|
|
25441
|
+
onTouchEnd: function onTouchEnd() {
|
|
25442
|
+
return handleTogglePopover(false);
|
|
25443
|
+
},
|
|
25444
|
+
onMouseEnter: function onMouseEnter() {
|
|
25445
|
+
return handleTogglePopover(true);
|
|
25446
|
+
},
|
|
25447
|
+
onMouseLeave: function onMouseLeave() {
|
|
25448
|
+
return handleTogglePopover(false);
|
|
25449
|
+
},
|
|
25450
|
+
contentOverride: true,
|
|
25451
|
+
variant: "smallGhost",
|
|
25452
|
+
tabIndex: "0",
|
|
25453
|
+
id: "btnPopover".concat(popoverID),
|
|
25454
|
+
"aria-expanded": popoverOpen,
|
|
25455
|
+
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25456
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25457
|
+
"aria-controls": "Disclosed".concat(popoverID),
|
|
25458
|
+
ref: triggerRef,
|
|
25459
|
+
extraStyles: buttonExtraStyles
|
|
25460
|
+
}, hasIcon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Box, {
|
|
25461
|
+
padding: "0",
|
|
25462
|
+
srOnly: true
|
|
25463
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25464
|
+
id: "btnPopover".concat(popoverID, "_info")
|
|
25465
|
+
}, iconHelpText))), !hasIcon && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25466
|
+
color: popoverTriggerColor,
|
|
25467
|
+
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25468
|
+
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
25469
|
+
background: backgroundColor,
|
|
25470
|
+
borderRadius: "4px",
|
|
25471
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25472
|
+
id: "Disclosed".concat(popoverID),
|
|
25473
|
+
role: "region",
|
|
25474
|
+
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25475
|
+
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25476
|
+
minWidth: minWidth,
|
|
25477
|
+
maxWidth: maxWidth,
|
|
25478
|
+
extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, ";\n transform: ").concat(transform, ";\n ").concat(popoverExtraStyles, ";\n ")
|
|
25479
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, content), /*#__PURE__*/React__default.createElement(Box, {
|
|
25480
|
+
padding: "0",
|
|
25481
|
+
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
|
|
25482
|
+
})));
|
|
25411
25483
|
};
|
|
25412
25484
|
|
|
25413
|
-
var
|
|
25414
|
-
var value = _ref.value,
|
|
25415
|
-
formatter = _ref.formatter,
|
|
25416
|
-
_onChange = _ref.onChange,
|
|
25417
|
-
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
25485
|
+
var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
|
|
25418
25486
|
|
|
25419
|
-
|
|
25487
|
+
var DisplayCard = function DisplayCard(_ref) {
|
|
25488
|
+
var title = _ref.title,
|
|
25489
|
+
item = _ref.item,
|
|
25490
|
+
buttonText = _ref.buttonText,
|
|
25491
|
+
buttonAction = _ref.buttonAction,
|
|
25492
|
+
url = _ref.url,
|
|
25493
|
+
_ref$link = _ref.link,
|
|
25494
|
+
link = _ref$link === void 0 ? false : _ref$link,
|
|
25495
|
+
helpText = _ref.helpText,
|
|
25496
|
+
_ref$hasPopover = _ref.hasPopover,
|
|
25497
|
+
hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
|
|
25498
|
+
_ref$popoverTriggerTe = _ref.popoverTriggerText,
|
|
25499
|
+
popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
|
|
25500
|
+
_ref$popoverContent = _ref.popoverContent,
|
|
25501
|
+
popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
|
|
25502
|
+
popoverExtraStyles = _ref.popoverExtraStyles,
|
|
25503
|
+
popoverTextExtraStyles = _ref.popoverTextExtraStyles;
|
|
25504
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
25505
|
+
padding: "0 0 16px"
|
|
25506
|
+
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
25507
|
+
childGap: "0rem"
|
|
25508
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25509
|
+
padding: "0 0 8px 0"
|
|
25510
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25511
|
+
justify: "space-between",
|
|
25512
|
+
align: "center",
|
|
25513
|
+
overflow: true
|
|
25514
|
+
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
25515
|
+
variant: "pL",
|
|
25516
|
+
color: CHARADE_GREY,
|
|
25517
|
+
extraStyles: "letter-spacing: 0.29px"
|
|
25518
|
+
}, title), hasPopover && /*#__PURE__*/React__default.createElement(Popover$1, {
|
|
25519
|
+
triggerText: popoverTriggerText,
|
|
25520
|
+
content: popoverContent,
|
|
25521
|
+
popoverExtraStyles: popoverExtraStyles,
|
|
25522
|
+
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25523
|
+
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25524
|
+
padding: "0"
|
|
25525
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25526
|
+
padding: "24px",
|
|
25527
|
+
borderSize: "1px",
|
|
25528
|
+
borderRadius: "4px",
|
|
25529
|
+
background: WHITE,
|
|
25530
|
+
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25531
|
+
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25532
|
+
justify: "space-between",
|
|
25533
|
+
align: "center"
|
|
25534
|
+
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25535
|
+
color: CHARADE_GREY
|
|
25536
|
+
}, item), link ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
25537
|
+
text: buttonText,
|
|
25538
|
+
url: url,
|
|
25539
|
+
variant: "smallGhost",
|
|
25540
|
+
dataQa: buttonText,
|
|
25541
|
+
extraStyles: "min-width: 0;"
|
|
25542
|
+
}) : buttonAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25543
|
+
text: buttonText,
|
|
25544
|
+
action: buttonAction,
|
|
25545
|
+
variant: "smallGhost",
|
|
25546
|
+
dataQa: buttonText,
|
|
25547
|
+
extraStyles: "min-width: 0;"
|
|
25548
|
+
}) : helpText ? /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25549
|
+
color: STORM_GREY,
|
|
25550
|
+
extraStyles: "font-style: italic;"
|
|
25551
|
+
}, helpText) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
|
|
25552
|
+
};
|
|
25420
25553
|
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
|
|
25424
|
-
|
|
25425
|
-
"delete": false,
|
|
25426
|
-
formattedValue: format$1(formatter)(value)
|
|
25427
|
-
}),
|
|
25428
|
-
_useState2 = _slicedToArray$1(_useState, 2),
|
|
25429
|
-
state = _useState2[0],
|
|
25430
|
-
setState = _useState2[1];
|
|
25554
|
+
function _extends$2() {
|
|
25555
|
+
_extends$2 = Object.assign || function (target) {
|
|
25556
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
25557
|
+
var source = arguments[i];
|
|
25431
25558
|
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25559
|
+
for (var key in source) {
|
|
25560
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
25561
|
+
target[key] = source[key];
|
|
25562
|
+
}
|
|
25563
|
+
}
|
|
25436
25564
|
}
|
|
25437
|
-
});
|
|
25438
|
-
return React__default.createElement("input", _extends$2({}, props, {
|
|
25439
|
-
ref: inputEl,
|
|
25440
|
-
value: format$1(formatter)(value),
|
|
25441
|
-
onKeyDown: function onKeyDown(event) {
|
|
25442
|
-
// Keep track of the state of the input before onChange, including if user is hitting delete
|
|
25443
|
-
setState({
|
|
25444
|
-
rawValue: value,
|
|
25445
|
-
selectionStart: event.target.selectionStart,
|
|
25446
|
-
selectionEnd: event.target.selectionEnd,
|
|
25447
|
-
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
25448
|
-
formattedValue: event.target.value
|
|
25449
|
-
});
|
|
25450
|
-
},
|
|
25451
|
-
onChange: function onChange(event) {
|
|
25452
|
-
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
25453
|
-
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
25454
|
-
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
25455
|
-
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
25456
|
-
* old unformatted value.
|
|
25457
|
-
*/
|
|
25458
|
-
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
25459
|
-
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
25460
|
-
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
25461
|
-
// Need to find where to put it
|
|
25462
25565
|
|
|
25463
|
-
|
|
25464
|
-
|
|
25465
|
-
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
25566
|
+
return target;
|
|
25567
|
+
};
|
|
25466
25568
|
|
|
25467
|
-
|
|
25569
|
+
return _extends$2.apply(this, arguments);
|
|
25570
|
+
}
|
|
25468
25571
|
|
|
25469
|
-
|
|
25470
|
-
|
|
25471
|
-
|
|
25472
|
-
|
|
25473
|
-
|
|
25572
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
25573
|
+
if (source == null) return {};
|
|
25574
|
+
var target = {};
|
|
25575
|
+
var sourceKeys = Object.keys(source);
|
|
25576
|
+
var key, i;
|
|
25474
25577
|
|
|
25475
|
-
|
|
25476
|
-
|
|
25477
|
-
|
|
25478
|
-
|
|
25479
|
-
|
|
25480
|
-
"delete": false,
|
|
25481
|
-
formattedValue: state.formattedValue
|
|
25482
|
-
}); // Apply the external onChange function to the raw underlying string
|
|
25483
|
-
// This is where the user generally updates the input value
|
|
25578
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
25579
|
+
key = sourceKeys[i];
|
|
25580
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
25581
|
+
target[key] = source[key];
|
|
25582
|
+
}
|
|
25484
25583
|
|
|
25485
|
-
|
|
25486
|
-
|
|
25487
|
-
}
|
|
25488
|
-
}
|
|
25489
|
-
}));
|
|
25490
|
-
};
|
|
25584
|
+
return target;
|
|
25585
|
+
}
|
|
25491
25586
|
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
25495
|
-
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
25496
|
-
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
25497
|
-
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
25498
|
-
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
25499
|
-
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
25500
|
-
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
25501
|
-
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
25502
|
-
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
25503
|
-
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
25504
|
-
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
25505
|
-
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
25506
|
-
var ACTIVE = "ACTIVE";
|
|
25507
|
-
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
25508
|
-
var EXPIRED = "EXPIRED";
|
|
25509
|
-
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
25587
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
25588
|
+
if (source == null) return {};
|
|
25510
25589
|
|
|
25511
|
-
|
|
25512
|
-
case ACTIVE:
|
|
25513
|
-
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25514
|
-
as: as,
|
|
25515
|
-
variant: "pXS",
|
|
25516
|
-
color: ASH_GREY,
|
|
25517
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25518
|
-
}, "Exp Date ", expireDate);
|
|
25590
|
+
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
25519
25591
|
|
|
25520
|
-
|
|
25521
|
-
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25522
|
-
as: as,
|
|
25523
|
-
variant: "pXS",
|
|
25524
|
-
color: FIRE_YELLOW,
|
|
25525
|
-
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
25526
|
-
}, "Expiring Soon ", expireDate);
|
|
25592
|
+
var key, i;
|
|
25527
25593
|
|
|
25528
|
-
|
|
25529
|
-
|
|
25530
|
-
|
|
25531
|
-
|
|
25532
|
-
|
|
25533
|
-
|
|
25534
|
-
|
|
25594
|
+
if (Object.getOwnPropertySymbols) {
|
|
25595
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
25596
|
+
|
|
25597
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
25598
|
+
key = sourceSymbolKeys[i];
|
|
25599
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
25600
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
25601
|
+
target[key] = source[key];
|
|
25602
|
+
}
|
|
25535
25603
|
}
|
|
25536
|
-
};
|
|
25537
25604
|
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
formatDelimiter: formatDelimiter,
|
|
25541
|
-
phoneFormats: phoneFormats,
|
|
25542
|
-
moneyFormats: moneyFormats,
|
|
25543
|
-
expirationDateFormats: expirationDateFormats,
|
|
25544
|
-
zipFormat: zipFormat,
|
|
25545
|
-
creditCardFormat: creditCardFormat,
|
|
25546
|
-
expirationDateFormat: expirationDateFormat,
|
|
25547
|
-
phoneFormat: phoneFormat,
|
|
25548
|
-
moneyFormat: moneyFormat,
|
|
25549
|
-
renderCardStatus: renderCardStatus
|
|
25550
|
-
});
|
|
25605
|
+
return target;
|
|
25606
|
+
}
|
|
25551
25607
|
|
|
25552
|
-
|
|
25553
|
-
|
|
25554
|
-
|
|
25555
|
-
// "hasErrors" is managed by container page of form
|
|
25556
|
-
// typically set to "true" on attempted form submission, if errors exist
|
|
25557
|
-
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
25558
|
-
React.useEffect(function () {
|
|
25559
|
-
if (hasErrors) {
|
|
25560
|
-
var _inputsWithErrors$;
|
|
25608
|
+
function _slicedToArray$1(arr, i) {
|
|
25609
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _nonIterableRest$1();
|
|
25610
|
+
}
|
|
25561
25611
|
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
|
|
25612
|
+
function _toConsumableArray$1(arr) {
|
|
25613
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _nonIterableSpread$1();
|
|
25614
|
+
}
|
|
25565
25615
|
|
|
25566
|
-
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
});
|
|
25570
|
-
};
|
|
25616
|
+
function _arrayWithoutHoles$1(arr) {
|
|
25617
|
+
if (Array.isArray(arr)) {
|
|
25618
|
+
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
25571
25619
|
|
|
25572
|
-
|
|
25573
|
-
|
|
25574
|
-
|
|
25575
|
-
If a click event gets captured by the document and the assigned element isn't the target
|
|
25576
|
-
hook will run whatever handler is passed (eg a function that closes a popover)
|
|
25620
|
+
return arr2;
|
|
25621
|
+
}
|
|
25622
|
+
}
|
|
25577
25623
|
|
|
25578
|
-
|
|
25624
|
+
function _arrayWithHoles$1(arr) {
|
|
25625
|
+
if (Array.isArray(arr)) return arr;
|
|
25626
|
+
}
|
|
25579
25627
|
|
|
25580
|
-
|
|
25628
|
+
function _iterableToArray$1(iter) {
|
|
25629
|
+
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
25630
|
+
}
|
|
25581
25631
|
|
|
25582
|
-
|
|
25583
|
-
|
|
25584
|
-
|
|
25585
|
-
}
|
|
25586
|
-
return ref;
|
|
25587
|
-
};
|
|
25632
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
25633
|
+
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
|
|
25634
|
+
return;
|
|
25635
|
+
}
|
|
25588
25636
|
|
|
25589
|
-
var
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
};
|
|
25637
|
+
var _arr = [];
|
|
25638
|
+
var _n = true;
|
|
25639
|
+
var _d = false;
|
|
25640
|
+
var _e = undefined;
|
|
25594
25641
|
|
|
25595
|
-
|
|
25596
|
-
|
|
25597
|
-
|
|
25598
|
-
timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
|
|
25642
|
+
try {
|
|
25643
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
25644
|
+
_arr.push(_s.value);
|
|
25599
25645
|
|
|
25600
|
-
|
|
25601
|
-
|
|
25602
|
-
|
|
25603
|
-
|
|
25646
|
+
if (i && _arr.length === i) break;
|
|
25647
|
+
}
|
|
25648
|
+
} catch (err) {
|
|
25649
|
+
_d = true;
|
|
25650
|
+
_e = err;
|
|
25651
|
+
} finally {
|
|
25652
|
+
try {
|
|
25653
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
25654
|
+
} finally {
|
|
25655
|
+
if (_d) throw _e;
|
|
25656
|
+
}
|
|
25657
|
+
}
|
|
25604
25658
|
|
|
25605
|
-
|
|
25606
|
-
|
|
25607
|
-
|
|
25608
|
-
|
|
25609
|
-
|
|
25659
|
+
return _arr;
|
|
25660
|
+
}
|
|
25661
|
+
|
|
25662
|
+
function _nonIterableSpread$1() {
|
|
25663
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
25664
|
+
}
|
|
25665
|
+
|
|
25666
|
+
function _nonIterableRest$1() {
|
|
25667
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
25668
|
+
}
|
|
25669
|
+
|
|
25670
|
+
var getUniqueFormatDelimiters = function getUniqueFormatDelimiters(formats, formatChar) {
|
|
25671
|
+
return _toConsumableArray$1(new Set(formats.join("").split(formatChar).join("").split("")));
|
|
25672
|
+
};
|
|
25673
|
+
var format$1 = function format(formatter) {
|
|
25674
|
+
return function (value) {
|
|
25675
|
+
var usedFormat = formatter.formats[value.length];
|
|
25676
|
+
|
|
25677
|
+
if (!usedFormat) {
|
|
25678
|
+
return value;
|
|
25610
25679
|
}
|
|
25611
|
-
}, [timeout, toastState.isOpen]);
|
|
25612
25680
|
|
|
25613
|
-
|
|
25614
|
-
var
|
|
25615
|
-
|
|
25616
|
-
|
|
25617
|
-
isOpen: true,
|
|
25618
|
-
variant: variant,
|
|
25619
|
-
message: message
|
|
25681
|
+
var formatPieces = usedFormat.split(formatter.formatChar);
|
|
25682
|
+
var valuePieces = value.split("");
|
|
25683
|
+
var zipped = formatPieces.map(function (v, i) {
|
|
25684
|
+
return v + (valuePieces[i] || "");
|
|
25620
25685
|
});
|
|
25621
|
-
|
|
25622
|
-
|
|
25623
|
-
var hideToast = function hideToast() {
|
|
25624
|
-
return setToastState(initialToastState);
|
|
25625
|
-
};
|
|
25626
|
-
|
|
25627
|
-
return {
|
|
25628
|
-
isToastOpen: toastState.isOpen,
|
|
25629
|
-
toastVariant: toastState.variant,
|
|
25630
|
-
toastMessage: toastState.message,
|
|
25631
|
-
showToast: showToast,
|
|
25632
|
-
hideToast: hideToast
|
|
25686
|
+
return zipped.join("");
|
|
25633
25687
|
};
|
|
25634
25688
|
};
|
|
25635
25689
|
|
|
25690
|
+
var countDelims = function countDelims(formatter, index) {
|
|
25691
|
+
var count = 0;
|
|
25692
|
+
var format = formatter.formats[index];
|
|
25693
|
+
if (!format) return 0;
|
|
25694
|
+
formatter.uniqueDelimiters.forEach(function (delim) {
|
|
25695
|
+
return count += format.split(delim).length - 1;
|
|
25696
|
+
});
|
|
25697
|
+
return count;
|
|
25698
|
+
};
|
|
25636
25699
|
|
|
25700
|
+
var unformat = function unformat(formatter) {
|
|
25701
|
+
return function (formattedValue, formatIndex) {
|
|
25702
|
+
if (formatIndex >= formatter.formats.length) {
|
|
25703
|
+
return formattedValue;
|
|
25704
|
+
}
|
|
25637
25705
|
|
|
25638
|
-
var
|
|
25639
|
-
|
|
25640
|
-
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
useFocusInvalidInput: useFocusInvalidInput,
|
|
25644
|
-
useOutsideClick: useOutsideClickHook,
|
|
25645
|
-
useToastNotification: useToastNotification
|
|
25646
|
-
});
|
|
25647
|
-
|
|
25648
|
-
var hoverColor$4 = "#116285";
|
|
25649
|
-
var activeColor$4 = "#0E506D";
|
|
25650
|
-
var popoverTriggerColor = "#15749D";
|
|
25651
|
-
var fallbackValues$j = {
|
|
25652
|
-
hoverColor: hoverColor$4,
|
|
25653
|
-
activeColor: activeColor$4,
|
|
25654
|
-
popoverTriggerColor: popoverTriggerColor
|
|
25706
|
+
var format = formatter.formats[formatIndex];
|
|
25707
|
+
return formattedValue.split("").filter(function (_, i) {
|
|
25708
|
+
return !(format[i] != formatter.formatChar);
|
|
25709
|
+
}).join("");
|
|
25710
|
+
};
|
|
25655
25711
|
};
|
|
25712
|
+
var inject = function inject(baseString) {
|
|
25713
|
+
return function (start, end, newString) {
|
|
25714
|
+
return baseString.substring(0, start) + newString + baseString.substring(end);
|
|
25715
|
+
};
|
|
25716
|
+
};
|
|
25717
|
+
var formattedToUnformattedIndex = function formattedToUnformattedIndex(formattedIndex, rawValue, formatter) {
|
|
25718
|
+
var maxFormatExceeded = rawValue.length >= formatter.formats.length;
|
|
25656
25719
|
|
|
25657
|
-
|
|
25658
|
-
|
|
25659
|
-
|
|
25660
|
-
|
|
25661
|
-
|
|
25662
|
-
|
|
25663
|
-
|
|
25664
|
-
|
|
25665
|
-
return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
|
|
25666
|
-
} else if (direction == "left") {
|
|
25667
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
|
|
25668
|
-
} else if (direction == "right") {
|
|
25669
|
-
return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
|
|
25720
|
+
if (maxFormatExceeded) {
|
|
25721
|
+
return formattedIndex;
|
|
25722
|
+
} else {
|
|
25723
|
+
var formatString = formatter.formats[rawValue.length];
|
|
25724
|
+
var beforeString = formatString.slice(0, formattedIndex);
|
|
25725
|
+
return beforeString.split("").filter(function (c) {
|
|
25726
|
+
return c === formatter.formatChar;
|
|
25727
|
+
}).length;
|
|
25670
25728
|
}
|
|
25671
25729
|
};
|
|
25730
|
+
var unformattedToFormattedIndex = function unformattedToFormattedIndex(rawIndex, rawValue, formatter, del) {
|
|
25731
|
+
var maxFormatExceeded = rawValue.length >= formatter.formats.length; // If forced to stay formatted, offset by delims - 1
|
|
25732
|
+
// This is done so the component doesn't assume that any added chars will be kept
|
|
25733
|
+
// (i.e. if an external constraint is applied)
|
|
25672
25734
|
|
|
25673
|
-
|
|
25674
|
-
|
|
25675
|
-
|
|
25676
|
-
|
|
25677
|
-
|
|
25678
|
-
|
|
25679
|
-
|
|
25680
|
-
|
|
25681
|
-
|
|
25682
|
-
_ref$iconHelpText = _ref.iconHelpText,
|
|
25683
|
-
iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
|
|
25684
|
-
_ref$popoverID = _ref.popoverID,
|
|
25685
|
-
popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
|
|
25686
|
-
_ref$popoverFocus = _ref.popoverFocus,
|
|
25687
|
-
popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
|
|
25688
|
-
extraStyles = _ref.extraStyles,
|
|
25689
|
-
textExtraStyles = _ref.textExtraStyles,
|
|
25690
|
-
_ref$minWidth = _ref.minWidth,
|
|
25691
|
-
minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
|
|
25692
|
-
_ref$maxWidth = _ref.maxWidth,
|
|
25693
|
-
maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
|
|
25694
|
-
_ref$height = _ref.height,
|
|
25695
|
-
height = _ref$height === void 0 ? "auto" : _ref$height,
|
|
25696
|
-
position = _ref.position,
|
|
25697
|
-
arrowPosition = _ref.arrowPosition,
|
|
25698
|
-
_ref$arrowDirection = _ref.arrowDirection,
|
|
25699
|
-
arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
|
|
25700
|
-
_ref$transform = _ref.transform,
|
|
25701
|
-
transform = _ref$transform === void 0 ? "none" : _ref$transform,
|
|
25702
|
-
buttonExtraStyles = _ref.buttonExtraStyles,
|
|
25703
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
25704
|
-
backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
|
|
25705
|
-
_ref$borderColor = _ref.borderColor,
|
|
25706
|
-
borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
|
|
25707
|
-
popoverExtraStyles = _ref.popoverExtraStyles;
|
|
25708
|
-
var hoverColor = themeValues.hoverColor,
|
|
25709
|
-
activeColor = themeValues.activeColor,
|
|
25710
|
-
popoverTriggerColor = themeValues.popoverTriggerColor;
|
|
25711
|
-
|
|
25712
|
-
var _ref2 = position !== null && position !== void 0 ? position : {},
|
|
25713
|
-
_ref2$top = _ref2.top,
|
|
25714
|
-
top = _ref2$top === void 0 ? "-110px" : _ref2$top,
|
|
25715
|
-
_ref2$right = _ref2.right,
|
|
25716
|
-
right = _ref2$right === void 0 ? "auto" : _ref2$right,
|
|
25717
|
-
_ref2$bottom = _ref2.bottom,
|
|
25718
|
-
bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
|
|
25719
|
-
_ref2$left = _ref2.left,
|
|
25720
|
-
left = _ref2$left === void 0 ? "-225px" : _ref2$left;
|
|
25735
|
+
if (maxFormatExceeded) {
|
|
25736
|
+
var delims = countDelims(formatter, rawValue.length - 1);
|
|
25737
|
+
return delims > 0 && !del ? rawIndex + delims - 1 : rawIndex;
|
|
25738
|
+
} else {
|
|
25739
|
+
return formatter.formats[rawValue.length].split(formatter.formatChar).slice(0, rawIndex).reduce(function (acc, curr) {
|
|
25740
|
+
return curr.length + acc;
|
|
25741
|
+
}, 0) + rawIndex;
|
|
25742
|
+
}
|
|
25743
|
+
};
|
|
25721
25744
|
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
_ref3$arrowLeft = _ref3.arrowLeft,
|
|
25730
|
-
arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
|
|
25745
|
+
var createFormat = function createFormat(formats, formatChar) {
|
|
25746
|
+
return {
|
|
25747
|
+
uniqueDelimiters: getUniqueFormatDelimiters(formats, formatChar),
|
|
25748
|
+
formats: formats,
|
|
25749
|
+
formatChar: formatChar
|
|
25750
|
+
};
|
|
25751
|
+
};
|
|
25731
25752
|
|
|
25732
|
-
|
|
25733
|
-
|
|
25734
|
-
|
|
25735
|
-
|
|
25753
|
+
var FormattedInput = function FormattedInput(_ref) {
|
|
25754
|
+
var value = _ref.value,
|
|
25755
|
+
formatter = _ref.formatter,
|
|
25756
|
+
_onChange = _ref.onChange,
|
|
25757
|
+
props = _objectWithoutProperties$1(_ref, ["value", "formatter", "onChange"]);
|
|
25736
25758
|
|
|
25737
|
-
var
|
|
25738
|
-
if (popoverOpen !== popoverState) {
|
|
25739
|
-
togglePopover(popoverState);
|
|
25740
|
-
}
|
|
25741
|
-
};
|
|
25759
|
+
var inputEl = React.useRef(null);
|
|
25742
25760
|
|
|
25743
|
-
var
|
|
25744
|
-
|
|
25745
|
-
|
|
25746
|
-
|
|
25747
|
-
|
|
25748
|
-
|
|
25749
|
-
|
|
25750
|
-
|
|
25751
|
-
|
|
25752
|
-
|
|
25753
|
-
},
|
|
25754
|
-
onBlur: function onBlur() {
|
|
25755
|
-
handleTogglePopover(false);
|
|
25756
|
-
},
|
|
25757
|
-
onKeyDown: function onKeyDown(e) {
|
|
25758
|
-
if (e.keyCode === 27) {
|
|
25759
|
-
handleTogglePopover(false);
|
|
25760
|
-
}
|
|
25761
|
-
},
|
|
25762
|
-
onTouchStart: function onTouchStart() {
|
|
25763
|
-
return handleTogglePopover(true);
|
|
25764
|
-
},
|
|
25765
|
-
onTouchEnd: function onTouchEnd() {
|
|
25766
|
-
return handleTogglePopover(false);
|
|
25767
|
-
},
|
|
25768
|
-
onMouseEnter: function onMouseEnter() {
|
|
25769
|
-
return handleTogglePopover(true);
|
|
25770
|
-
},
|
|
25771
|
-
onMouseLeave: function onMouseLeave() {
|
|
25772
|
-
return handleTogglePopover(false);
|
|
25773
|
-
},
|
|
25774
|
-
contentOverride: true,
|
|
25775
|
-
variant: "smallGhost",
|
|
25776
|
-
tabIndex: "0",
|
|
25777
|
-
id: "btnPopover".concat(popoverID),
|
|
25778
|
-
"aria-expanded": popoverOpen,
|
|
25779
|
-
"aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
|
|
25780
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25781
|
-
"aria-controls": "Disclosed".concat(popoverID),
|
|
25782
|
-
ref: triggerRef,
|
|
25783
|
-
extraStyles: buttonExtraStyles
|
|
25784
|
-
}, hasIcon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Box, {
|
|
25785
|
-
padding: "0",
|
|
25786
|
-
srOnly: true
|
|
25787
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25788
|
-
id: "btnPopover".concat(popoverID, "_info")
|
|
25789
|
-
}, iconHelpText))), !hasIcon && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25790
|
-
color: popoverTriggerColor,
|
|
25791
|
-
extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
|
|
25792
|
-
}, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
|
|
25793
|
-
background: backgroundColor,
|
|
25794
|
-
borderRadius: "4px",
|
|
25795
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
|
|
25796
|
-
id: "Disclosed".concat(popoverID),
|
|
25797
|
-
role: "region",
|
|
25798
|
-
"aria-describedby": "Disclosure".concat(popoverID),
|
|
25799
|
-
tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
|
|
25800
|
-
minWidth: minWidth,
|
|
25801
|
-
maxWidth: maxWidth,
|
|
25802
|
-
extraStyles: "\n display: ".concat(popoverOpen ? "block" : "none", "; \n position: absolute; \n top: ").concat(top, "; \n right: ").concat(right, "; \n bottom: ").concat(bottom, "; \n left: ").concat(left, ";\n height: ").concat(height, ";\n transform: ").concat(transform, ";\n ").concat(popoverExtraStyles, ";\n ")
|
|
25803
|
-
}, /*#__PURE__*/React__default.createElement(Paragraph$1, null, content), /*#__PURE__*/React__default.createElement(Box, {
|
|
25804
|
-
padding: "0",
|
|
25805
|
-
extraStyles: "\n position: absolute;\n content: \"\";\n width: 0;\n height: 0;\n ".concat(arrowBorder(borderColor, arrowDirection, "8px"), ";\n filter: drop-shadow(2px 8px 14px black);\n bottom: ").concat(arrowBottom, ";\n right: ").concat(arrowRight, ";\n top: ").concat(arrowTop, ";\n left: ").concat(arrowLeft, ";\n ")
|
|
25806
|
-
})));
|
|
25807
|
-
};
|
|
25761
|
+
var _useState = React.useState({
|
|
25762
|
+
selectionStart: 0,
|
|
25763
|
+
selectionEnd: 0,
|
|
25764
|
+
rawValue: value,
|
|
25765
|
+
"delete": false,
|
|
25766
|
+
formattedValue: format$1(formatter)(value)
|
|
25767
|
+
}),
|
|
25768
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
25769
|
+
state = _useState2[0],
|
|
25770
|
+
setState = _useState2[1];
|
|
25808
25771
|
|
|
25809
|
-
|
|
25772
|
+
React.useLayoutEffect(function () {
|
|
25773
|
+
// A lot of the work here is cursor manipulation
|
|
25774
|
+
if (inputEl.current && inputEl.current === document.activeElement) {
|
|
25775
|
+
inputEl.current.setSelectionRange(state.selectionStart, state.selectionEnd);
|
|
25776
|
+
}
|
|
25777
|
+
});
|
|
25778
|
+
return React__default.createElement("input", _extends$2({}, props, {
|
|
25779
|
+
ref: inputEl,
|
|
25780
|
+
value: format$1(formatter)(value),
|
|
25781
|
+
onKeyDown: function onKeyDown(event) {
|
|
25782
|
+
// Keep track of the state of the input before onChange, including if user is hitting delete
|
|
25783
|
+
setState({
|
|
25784
|
+
rawValue: value,
|
|
25785
|
+
selectionStart: event.target.selectionStart,
|
|
25786
|
+
selectionEnd: event.target.selectionEnd,
|
|
25787
|
+
"delete": event.key === "Backspace" || event.key === "Delete",
|
|
25788
|
+
formattedValue: event.target.value
|
|
25789
|
+
});
|
|
25790
|
+
},
|
|
25791
|
+
onChange: function onChange(event) {
|
|
25792
|
+
/* At the beginning of onChange, event.target.value is a concat of the previous formatted value
|
|
25793
|
+
* and an unformatted injection at the start, end, or in the middle (maybe a deletion). To prepare
|
|
25794
|
+
* the unformatted value for the user's onChange, the formatted string and unformatted injection need
|
|
25795
|
+
* to be separated, then unformat the formatted string, then insert (or delete) the injection from the
|
|
25796
|
+
* old unformatted value.
|
|
25797
|
+
*/
|
|
25798
|
+
var injectionLength = event.target.value.length - state.formattedValue.length;
|
|
25799
|
+
var end = state.selectionStart === state.selectionEnd ? state.selectionStart + injectionLength : state.selectionEnd - 1;
|
|
25800
|
+
var injection = event.target.value.substring(state.selectionStart, end); // Injection is the new unformatted piece of the input
|
|
25801
|
+
// Need to find where to put it
|
|
25810
25802
|
|
|
25811
|
-
var
|
|
25812
|
-
|
|
25813
|
-
|
|
25814
|
-
|
|
25815
|
-
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
|
|
25830
|
-
|
|
25831
|
-
|
|
25832
|
-
|
|
25833
|
-
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
}, /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
25839
|
-
variant: "pL",
|
|
25840
|
-
color: CHARADE_GREY,
|
|
25841
|
-
extraStyles: "letter-spacing: 0.29px"
|
|
25842
|
-
}, title), hasPopover && /*#__PURE__*/React__default.createElement(Popover$1, {
|
|
25843
|
-
triggerText: popoverTriggerText,
|
|
25844
|
-
content: popoverContent,
|
|
25845
|
-
popoverExtraStyles: popoverExtraStyles,
|
|
25846
|
-
popoverTextExtraStyles: popoverTextExtraStyles
|
|
25847
|
-
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
25848
|
-
padding: "0"
|
|
25849
|
-
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
25850
|
-
padding: "24px",
|
|
25851
|
-
borderSize: "1px",
|
|
25852
|
-
borderRadius: "4px",
|
|
25853
|
-
background: WHITE,
|
|
25854
|
-
boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
|
|
25855
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
25856
|
-
justify: "space-between",
|
|
25857
|
-
align: "center"
|
|
25858
|
-
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25859
|
-
color: CHARADE_GREY
|
|
25860
|
-
}, item), link ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
|
|
25861
|
-
text: buttonText,
|
|
25862
|
-
url: url,
|
|
25863
|
-
variant: "smallGhost",
|
|
25864
|
-
dataQa: buttonText,
|
|
25865
|
-
extraStyles: "min-width: 0;"
|
|
25866
|
-
}) : buttonAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
|
|
25867
|
-
text: buttonText,
|
|
25868
|
-
action: buttonAction,
|
|
25869
|
-
variant: "smallGhost",
|
|
25870
|
-
dataQa: buttonText,
|
|
25871
|
-
extraStyles: "min-width: 0;"
|
|
25872
|
-
}) : helpText ? /*#__PURE__*/React__default.createElement(Text$1, {
|
|
25873
|
-
color: STORM_GREY,
|
|
25874
|
-
extraStyles: "font-style: italic;"
|
|
25875
|
-
}, helpText) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
|
|
25803
|
+
var rawInjectionPointStart = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter);
|
|
25804
|
+
var rawInjectionPointEnd = formattedToUnformattedIndex(state.selectionEnd, state.rawValue, formatter); // Unformat the previous formatted value for injection
|
|
25805
|
+
// Using the relevant format string, strips away chars not marked with the formatChar
|
|
25806
|
+
|
|
25807
|
+
var unformattedOldValue = unformat(formatter)(state.formattedValue, state.rawValue.length); // Edit the previous unformatted value (either add, update or delete)
|
|
25808
|
+
|
|
25809
|
+
var injectIntoOldValue = inject(unformattedOldValue);
|
|
25810
|
+
var unformattedNewValue = state["delete"] ? rawInjectionPointStart === rawInjectionPointEnd ? injectIntoOldValue(rawInjectionPointStart - 1, rawInjectionPointStart, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, "") : injectIntoOldValue(rawInjectionPointStart, rawInjectionPointEnd, injection);
|
|
25811
|
+
var lengthDifference = unformattedNewValue.length - state.rawValue.length;
|
|
25812
|
+
var rawIndex = formattedToUnformattedIndex(state.selectionStart, state.rawValue, formatter) + lengthDifference; // Find the new cursor position for the potential formatted value
|
|
25813
|
+
// Applied by useLayoutEffect
|
|
25814
|
+
|
|
25815
|
+
var newFormattedCursorPosition = state.selectionStart == state.selectionEnd ? unformattedToFormattedIndex(rawIndex, unformattedNewValue, formatter, state["delete"]) : state["delete"] ? state.selectionStart : state.selectionEnd;
|
|
25816
|
+
setState({
|
|
25817
|
+
selectionStart: newFormattedCursorPosition,
|
|
25818
|
+
selectionEnd: newFormattedCursorPosition,
|
|
25819
|
+
rawValue: state.rawValue,
|
|
25820
|
+
"delete": false,
|
|
25821
|
+
formattedValue: state.formattedValue
|
|
25822
|
+
}); // Apply the external onChange function to the raw underlying string
|
|
25823
|
+
// This is where the user generally updates the input value
|
|
25824
|
+
|
|
25825
|
+
if (_onChange) {
|
|
25826
|
+
_onChange(unformattedNewValue);
|
|
25827
|
+
}
|
|
25828
|
+
}
|
|
25829
|
+
}));
|
|
25876
25830
|
};
|
|
25877
25831
|
|
|
25878
25832
|
var linkColor$2 = {
|
|
@@ -26341,6 +26295,66 @@ var fallbackValues$n = {
|
|
|
26341
26295
|
autopayTextColor: autopayTextColor$1
|
|
26342
26296
|
};
|
|
26343
26297
|
|
|
26298
|
+
var formatDelimiter = "_";
|
|
26299
|
+
var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
|
|
26300
|
+
var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
|
|
26301
|
+
var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
|
|
26302
|
+
var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
|
|
26303
|
+
var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
|
|
26304
|
+
var zipFormat = createFormat(zipFormats, formatDelimiter);
|
|
26305
|
+
var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
|
|
26306
|
+
var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
|
|
26307
|
+
var phoneFormat = createFormat(phoneFormats, formatDelimiter);
|
|
26308
|
+
var moneyFormat = createFormat(moneyFormats, formatDelimiter);
|
|
26309
|
+
var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
|
|
26310
|
+
var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
|
|
26311
|
+
var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
|
|
26312
|
+
var ACTIVE = "ACTIVE";
|
|
26313
|
+
var EXPIRING_SOON = "EXPIRING_SOON";
|
|
26314
|
+
var EXPIRED = "EXPIRED";
|
|
26315
|
+
var textMargin = textAlign === "right" ? "auto" : "0";
|
|
26316
|
+
|
|
26317
|
+
switch (expirationStatus) {
|
|
26318
|
+
case ACTIVE:
|
|
26319
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26320
|
+
as: as,
|
|
26321
|
+
variant: "pXS",
|
|
26322
|
+
color: ASH_GREY,
|
|
26323
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26324
|
+
}, "Exp Date ", expireDate);
|
|
26325
|
+
|
|
26326
|
+
case EXPIRING_SOON:
|
|
26327
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26328
|
+
as: as,
|
|
26329
|
+
variant: "pXS",
|
|
26330
|
+
color: FIRE_YELLOW,
|
|
26331
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26332
|
+
}, "Expiring Soon ", expireDate);
|
|
26333
|
+
|
|
26334
|
+
case EXPIRED:
|
|
26335
|
+
return /*#__PURE__*/React__default.createElement(Text$1, {
|
|
26336
|
+
as: as,
|
|
26337
|
+
variant: "pXS",
|
|
26338
|
+
color: ASH_GREY,
|
|
26339
|
+
extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
|
|
26340
|
+
}, "Expired");
|
|
26341
|
+
}
|
|
26342
|
+
};
|
|
26343
|
+
|
|
26344
|
+
var formats = /*#__PURE__*/Object.freeze({
|
|
26345
|
+
__proto__: null,
|
|
26346
|
+
formatDelimiter: formatDelimiter,
|
|
26347
|
+
phoneFormats: phoneFormats,
|
|
26348
|
+
moneyFormats: moneyFormats,
|
|
26349
|
+
expirationDateFormats: expirationDateFormats,
|
|
26350
|
+
zipFormat: zipFormat,
|
|
26351
|
+
creditCardFormat: creditCardFormat,
|
|
26352
|
+
expirationDateFormat: expirationDateFormat,
|
|
26353
|
+
phoneFormat: phoneFormat,
|
|
26354
|
+
moneyFormat: moneyFormat,
|
|
26355
|
+
renderCardStatus: renderCardStatus
|
|
26356
|
+
});
|
|
26357
|
+
|
|
26344
26358
|
var CreditCardWrapper = styled__default.div.withConfig({
|
|
26345
26359
|
displayName: "FormattedCreditCard__CreditCardWrapper",
|
|
26346
26360
|
componentId: "sc-s0ta5l-0"
|
|
@@ -48866,43 +48880,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
|
48866
48880
|
})))));
|
|
48867
48881
|
};
|
|
48868
48882
|
|
|
48869
|
-
/*
|
|
48870
|
-
Hook that takes an ID selector for an element on the screen
|
|
48871
|
-
And optionally values for top position, left position, smooth behavior
|
|
48872
|
-
Finds element on screen and scrolls it to the provided coordinates
|
|
48873
|
-
|
|
48874
|
-
(string, number, number, string, number) => undefined;
|
|
48875
|
-
*/
|
|
48876
|
-
var useScrollTo = function useScrollTo(id) {
|
|
48877
|
-
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48878
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48879
|
-
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48880
|
-
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48881
|
-
var scrollItem;
|
|
48882
|
-
|
|
48883
|
-
if (delay) {
|
|
48884
|
-
setTimeout(function () {
|
|
48885
|
-
var _scrollItem;
|
|
48886
|
-
|
|
48887
|
-
scrollItem = document.getElementById(id);
|
|
48888
|
-
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48889
|
-
top: top,
|
|
48890
|
-
left: left,
|
|
48891
|
-
behavior: behavior
|
|
48892
|
-
});
|
|
48893
|
-
}, delay);
|
|
48894
|
-
} else {
|
|
48895
|
-
var _scrollItem2;
|
|
48896
|
-
|
|
48897
|
-
scrollItem = document.getElementById(id);
|
|
48898
|
-
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48899
|
-
top: top,
|
|
48900
|
-
left: left,
|
|
48901
|
-
behavior: behavior
|
|
48902
|
-
});
|
|
48903
|
-
}
|
|
48904
|
-
};
|
|
48905
|
-
|
|
48906
48883
|
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48907
48884
|
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48908
48885
|
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
@@ -50757,6 +50734,38 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
|
|
|
50757
50734
|
|
|
50758
50735
|
var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$U));
|
|
50759
50736
|
|
|
50737
|
+
var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
|
|
50738
|
+
var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
50739
|
+
// Only move focus when "hasErrors" is true
|
|
50740
|
+
// "hasErrors" is managed by container page of form
|
|
50741
|
+
// typically set to "true" on attempted form submission, if errors exist
|
|
50742
|
+
// Reset errors, if provided, resets the error state tracking in order to properly re-run
|
|
50743
|
+
React.useEffect(function () {
|
|
50744
|
+
if (hasErrors) {
|
|
50745
|
+
var _inputsWithErrors$;
|
|
50746
|
+
|
|
50747
|
+
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
50748
|
+
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
50749
|
+
}
|
|
50750
|
+
|
|
50751
|
+
return function () {
|
|
50752
|
+
return resetHasErrors(false);
|
|
50753
|
+
};
|
|
50754
|
+
});
|
|
50755
|
+
};
|
|
50756
|
+
|
|
50757
|
+
|
|
50758
|
+
|
|
50759
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
50760
|
+
__proto__: null,
|
|
50761
|
+
formats: formats,
|
|
50762
|
+
general: general,
|
|
50763
|
+
theme: themeUtils,
|
|
50764
|
+
useFocusInvalidInput: useFocusInvalidInput,
|
|
50765
|
+
useOutsideClick: useOutsideClickHook,
|
|
50766
|
+
useToastNotification: useToastNotification
|
|
50767
|
+
});
|
|
50768
|
+
|
|
50760
50769
|
exports.AccountNumberImage = AccountNumberImage;
|
|
50761
50770
|
exports.AccountsAddIcon = AccountsAddIcon$1;
|
|
50762
50771
|
exports.AccountsIcon = AccountsIcon$1;
|
|
@@ -50968,6 +50977,7 @@ exports.cardRegistry = cardRegistry;
|
|
|
50968
50977
|
exports.constants = index$5;
|
|
50969
50978
|
exports.createPartialAmountFormState = createPartialAmountFormState;
|
|
50970
50979
|
exports.createPartialAmountFormValidators = createPartialAmountFormValidators;
|
|
50971
|
-
exports.
|
|
50980
|
+
exports.hooks = index$4;
|
|
50981
|
+
exports.util = index$6;
|
|
50972
50982
|
exports.withWindowSize = withWindowSize;
|
|
50973
50983
|
//# sourceMappingURL=index.cjs.js.map
|