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