@thecb/components 9.2.0-beta.8 → 9.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -5019,6 +5019,7 @@ var INFO_BLUE = "#E4F4FD";
5019
5019
  var CORNFLOWER_BLUE = "#EBEFFB";
5020
5020
  var HOVER_LIGHT_BLUE = "#EFFAFF";
5021
5021
  var MATISSE_BLUE = "#15749D";
5022
+ var MATISSE_BLUE_DARK = "#105C7D";
5022
5023
  var ROYAL_BLUE = "#3181E3";
5023
5024
  var ROYAL_BLUE_VIVID = "#3B5BDB";
5024
5025
  var ASTRAL_BLUE = "#3176AA";
@@ -5154,6 +5155,7 @@ var colors = /*#__PURE__*/Object.freeze({
5154
5155
  BOSTON_BLUE: BOSTON_BLUE,
5155
5156
  HOVER_LIGHT_BLUE: HOVER_LIGHT_BLUE,
5156
5157
  MATISSE_BLUE: MATISSE_BLUE,
5158
+ MATISSE_BLUE_DARK: MATISSE_BLUE_DARK,
5157
5159
  ROYAL_BLUE: ROYAL_BLUE,
5158
5160
  ROYAL_BLUE_VIVID: ROYAL_BLUE_VIVID,
5159
5161
  ASTRAL_BLUE: ASTRAL_BLUE,
@@ -23700,9 +23702,11 @@ exportTypedArrayMethod$1('at', function at(index) {
23700
23702
 
23701
23703
  var selectedColor = "".concat(MATISSE_BLUE);
23702
23704
  var hoverColor$3 = "".concat(HOVER_LIGHT_BLUE);
23705
+ var focusColor = "".concat(MATISSE_BLUE_DARK);
23703
23706
  var fallbackValues$f = {
23704
23707
  selectedColor: selectedColor,
23705
- hoverColor: hoverColor$3
23708
+ hoverColor: hoverColor$3,
23709
+ focusColor: focusColor
23706
23710
  };
23707
23711
 
23708
23712
  var IconWrapper = styled__default.div.withConfig({
@@ -23725,7 +23729,7 @@ var DropdownContentWrapper = styled__default.div.withConfig({
23725
23729
  var DropdownItemWrapper = styled__default.li.withConfig({
23726
23730
  displayName: "Dropdown__DropdownItemWrapper",
23727
23731
  componentId: "sc-pn6m0h-2"
23728
- })(["background-color:", ";text-align:start;border-width:0px;border-color:transparent;box-shadow:none;padding:1rem;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{background-color:", ";}&:focus{background-color:", ";outline:none;}"], function (_ref4) {
23732
+ })(["text-align:start;border-width:2px;border-style:solid;border-color:", ";box-shadow:none;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{border-color:", ";> *{background:", ";border-color:", ";}}&:focus{outline:none;border-color:", ";> *{background:", ";border-color:white;outline:none;}}"], function (_ref4) {
23729
23733
  var selected = _ref4.selected,
23730
23734
  themeValues = _ref4.themeValues;
23731
23735
  return selected ? themeValues.selectedColor : WHITE;
@@ -23733,44 +23737,69 @@ var DropdownItemWrapper = styled__default.li.withConfig({
23733
23737
  var disabled = _ref5.disabled;
23734
23738
  return disabled ? "default" : "pointer";
23735
23739
  }, function (_ref6) {
23736
- var selected = _ref6.selected,
23737
- disabled = _ref6.disabled,
23740
+ var disabled = _ref6.disabled,
23741
+ selected = _ref6.selected,
23738
23742
  themeValues = _ref6.themeValues;
23739
- return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
23743
+ return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
23740
23744
  }, function (_ref7) {
23741
23745
  var selected = _ref7.selected,
23742
23746
  disabled = _ref7.disabled,
23743
23747
  themeValues = _ref7.themeValues;
23744
- return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
23748
+ return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
23749
+ }, function (_ref8) {
23750
+ var selected = _ref8.selected,
23751
+ disabled = _ref8.disabled,
23752
+ themeValues = _ref8.themeValues;
23753
+ return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
23754
+ }, function (_ref9) {
23755
+ var themeValues = _ref9.themeValues;
23756
+ return themeValues.selectedColor;
23757
+ }, function (_ref10) {
23758
+ var selected = _ref10.selected,
23759
+ disabled = _ref10.disabled,
23760
+ themeValues = _ref10.themeValues;
23761
+ return selected ? themeValues.focusColor : disabled ? WHITE : themeValues.hoverColor;
23762
+ });
23763
+ var DropdownItemBorder = styled__default.div.withConfig({
23764
+ displayName: "Dropdown__DropdownItemBorder",
23765
+ componentId: "sc-pn6m0h-3"
23766
+ })(["background:", ";border-color:", ";border-width:2px;border-style:solid;padding:12px;"], function (_ref11) {
23767
+ var selected = _ref11.selected,
23768
+ themeValues = _ref11.themeValues;
23769
+ return selected ? themeValues.selectedColor : WHITE;
23770
+ }, function (_ref12) {
23771
+ var selected = _ref12.selected,
23772
+ themeValues = _ref12.themeValues;
23773
+ return selected ? themeValues.selectedColor : WHITE;
23745
23774
  });
23746
23775
 
23747
- var Dropdown = function Dropdown(_ref8) {
23748
- var placeholder = _ref8.placeholder,
23749
- options = _ref8.options,
23750
- value = _ref8.value,
23751
- isOpen = _ref8.isOpen,
23752
- isError = _ref8.isError,
23753
- onSelect = _ref8.onSelect,
23754
- _ref8$disabledValues = _ref8.disabledValues,
23755
- disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
23756
- _ref8$onClick = _ref8.onClick,
23757
- _onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
23758
- themeValues = _ref8.themeValues,
23759
- maxHeight = _ref8.maxHeight,
23760
- _ref8$widthFitOptions = _ref8.widthFitOptions,
23761
- widthFitOptions = _ref8$widthFitOptions === void 0 ? false : _ref8$widthFitOptions,
23762
- disabled = _ref8.disabled,
23763
- _ref8$hasTitles = _ref8.hasTitles,
23764
- hasTitles = _ref8$hasTitles === void 0 ? false : _ref8$hasTitles,
23765
- _ref8$autoEraseTypeAh = _ref8.autoEraseTypeAhead,
23766
- autoEraseTypeAhead = _ref8$autoEraseTypeAh === void 0 ? true : _ref8$autoEraseTypeAh,
23767
- ariaLabelledby = _ref8.ariaLabelledby,
23768
- ariaDescribedby = _ref8.ariaDescribedby,
23769
- autocompleteValue = _ref8.autocompleteValue,
23770
- _ref8$smoothScroll = _ref8.smoothScroll,
23771
- smoothScroll = _ref8$smoothScroll === void 0 ? true : _ref8$smoothScroll,
23772
- _ref8$ariaInvalid = _ref8.ariaInvalid,
23773
- ariaInvalid = _ref8$ariaInvalid === void 0 ? false : _ref8$ariaInvalid;
23776
+ var Dropdown = function Dropdown(_ref13) {
23777
+ var placeholder = _ref13.placeholder,
23778
+ options = _ref13.options,
23779
+ value = _ref13.value,
23780
+ isOpen = _ref13.isOpen,
23781
+ isError = _ref13.isError,
23782
+ onSelect = _ref13.onSelect,
23783
+ _ref13$disabledValues = _ref13.disabledValues,
23784
+ disabledValues = _ref13$disabledValues === void 0 ? [] : _ref13$disabledValues,
23785
+ _ref13$onClick = _ref13.onClick,
23786
+ _onClick = _ref13$onClick === void 0 ? noop : _ref13$onClick,
23787
+ themeValues = _ref13.themeValues,
23788
+ maxHeight = _ref13.maxHeight,
23789
+ _ref13$widthFitOption = _ref13.widthFitOptions,
23790
+ widthFitOptions = _ref13$widthFitOption === void 0 ? false : _ref13$widthFitOption,
23791
+ disabled = _ref13.disabled,
23792
+ _ref13$hasTitles = _ref13.hasTitles,
23793
+ hasTitles = _ref13$hasTitles === void 0 ? false : _ref13$hasTitles,
23794
+ _ref13$autoEraseTypeA = _ref13.autoEraseTypeAhead,
23795
+ autoEraseTypeAhead = _ref13$autoEraseTypeA === void 0 ? true : _ref13$autoEraseTypeA,
23796
+ ariaLabelledby = _ref13.ariaLabelledby,
23797
+ ariaDescribedby = _ref13.ariaDescribedby,
23798
+ autocompleteValue = _ref13.autocompleteValue,
23799
+ _ref13$smoothScroll = _ref13.smoothScroll,
23800
+ smoothScroll = _ref13$smoothScroll === void 0 ? true : _ref13$smoothScroll,
23801
+ _ref13$ariaInvalid = _ref13.ariaInvalid,
23802
+ ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid;
23774
23803
 
23775
23804
  var _useState = React.useState(""),
23776
23805
  _useState2 = _slicedToArray(_useState, 2),
@@ -24092,11 +24121,15 @@ var Dropdown = function Dropdown(_ref8) {
24092
24121
  onFocus: function onFocus() {
24093
24122
  return setFocusedRef(optionRefs.current[i]);
24094
24123
  }
24124
+ }, /*#__PURE__*/React__default.createElement(DropdownItemBorder, {
24125
+ disabled: disabledValues.includes(choice.value),
24126
+ selected: choice.value === value,
24127
+ themeValues: themeValues
24095
24128
  }, /*#__PURE__*/React__default.createElement(Text$1, {
24096
24129
  variant: "p",
24097
24130
  color: choice.value === value ? WHITE : disabledValues.includes(choice.value) ? STORM_GREY : MINESHAFT_GREY,
24098
- extraStyles: "padding-left: 16px;\n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;")
24099
- }, choice.text));
24131
+ extraStyles: "padding-left: 16px;\n cursor: ".concat(disabledValues.includes(choice.value) ? "default" : "pointer", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;")
24132
+ }, choice.text)));
24100
24133
  }))) : /*#__PURE__*/React__default.createElement(React.Fragment, null)));
24101
24134
  };
24102
24135
 
@@ -25211,6 +25244,346 @@ var DisplayBox = function DisplayBox(_ref) {
25211
25244
 
25212
25245
  var DisplayBox$1 = themeComponent(DisplayBox, "DisplayBox", fallbackValues$i);
25213
25246
 
25247
+ /*
25248
+ Hook that assigns a click event listener to the main document element
25249
+ Returns a ref to attach to another element (like an icon/button that triggers a popover)
25250
+ If a click event gets captured by the document and the assigned element isn't the target
25251
+ hook will run whatever handler is passed (eg a function that closes a popover)
25252
+
25253
+ See popover component for implementation
25254
+
25255
+ */
25256
+
25257
+ var useOutsideClickHook = function useOutsideClickHook(handler) {
25258
+ var ref = React.useRef();
25259
+ React.useEffect(function () {
25260
+ }, [ref]);
25261
+ return ref;
25262
+ };
25263
+
25264
+ /*
25265
+ Hook that takes an ID selector for an element on the screen
25266
+ And optionally values for top position, left position, smooth behavior
25267
+ Finds element on screen and scrolls it to the provided coordinates
25268
+
25269
+ (string, number, number, string, number) => undefined;
25270
+ */
25271
+ var useScrollTo = function useScrollTo(id) {
25272
+ var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
25273
+ var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
25274
+ var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
25275
+ var delay = arguments.length > 4 ? arguments[4] : undefined;
25276
+ var scrollItem;
25277
+
25278
+ if (delay) {
25279
+ setTimeout(function () {
25280
+ var _scrollItem;
25281
+
25282
+ scrollItem = document.getElementById(id);
25283
+ (_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
25284
+ top: top,
25285
+ left: left,
25286
+ behavior: behavior
25287
+ });
25288
+ }, delay);
25289
+ } else {
25290
+ var _scrollItem2;
25291
+
25292
+ scrollItem = document.getElementById(id);
25293
+ (_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
25294
+ top: top,
25295
+ left: left,
25296
+ behavior: behavior
25297
+ });
25298
+ }
25299
+ };
25300
+
25301
+ var initialToastState = {
25302
+ isOpen: false,
25303
+ variant: "",
25304
+ message: ""
25305
+ };
25306
+
25307
+ var useToastNotification = function useToastNotification() {
25308
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25309
+ _ref$timeout = _ref.timeout,
25310
+ timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
25311
+
25312
+ var _useState = React.useState(initialToastState),
25313
+ _useState2 = _slicedToArray(_useState, 2),
25314
+ toastState = _useState2[0],
25315
+ setToastState = _useState2[1];
25316
+
25317
+ React.useEffect(function () {
25318
+ if (toastState.isOpen) {
25319
+ setTimeout(function () {
25320
+ setToastState(initialToastState);
25321
+ }, timeout);
25322
+ }
25323
+ }, [timeout, toastState.isOpen]);
25324
+
25325
+ var showToast = function showToast(_ref2) {
25326
+ var message = _ref2.message,
25327
+ variant = _ref2.variant;
25328
+ return setToastState({
25329
+ isOpen: true,
25330
+ variant: variant,
25331
+ message: message
25332
+ });
25333
+ };
25334
+
25335
+ var hideToast = function hideToast() {
25336
+ return setToastState(initialToastState);
25337
+ };
25338
+
25339
+ return {
25340
+ isToastOpen: toastState.isOpen,
25341
+ toastVariant: toastState.variant,
25342
+ toastMessage: toastState.message,
25343
+ showToast: showToast,
25344
+ hideToast: hideToast
25345
+ };
25346
+ };
25347
+
25348
+
25349
+
25350
+ var index$4 = /*#__PURE__*/Object.freeze({
25351
+ __proto__: null,
25352
+ useOutsideClick: useOutsideClickHook,
25353
+ useScrollTo: useScrollTo,
25354
+ useToastNotification: useToastNotification
25355
+ });
25356
+
25357
+ var hoverColor$4 = "#116285";
25358
+ var activeColor$4 = "#0E506D";
25359
+ var popoverTriggerColor = "#15749D";
25360
+ var fallbackValues$j = {
25361
+ hoverColor: hoverColor$4,
25362
+ activeColor: activeColor$4,
25363
+ popoverTriggerColor: popoverTriggerColor
25364
+ };
25365
+
25366
+ var arrowBorder = function arrowBorder(borderColor, direction) {
25367
+ var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
25368
+ var angle = "".concat(width, " solid transparent");
25369
+ var straight = "".concat(width, " solid ").concat(borderColor);
25370
+
25371
+ if (direction == "down") {
25372
+ return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
25373
+ } else if (direction == "up") {
25374
+ return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-bottom: ").concat(straight);
25375
+ } else if (direction == "left") {
25376
+ return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-right: ").concat(straight);
25377
+ } else if (direction == "right") {
25378
+ return "border-top: ".concat(angle, "; border-bottom: ").concat(angle, "; border-left: ").concat(straight);
25379
+ }
25380
+ };
25381
+
25382
+ var Popover = function Popover(_ref) {
25383
+ var themeValues = _ref.themeValues,
25384
+ _ref$triggerText = _ref.triggerText,
25385
+ triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
25386
+ _ref$content = _ref.content,
25387
+ content = _ref$content === void 0 ? "" : _ref$content,
25388
+ _ref$hasIcon = _ref.hasIcon,
25389
+ hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
25390
+ Icon = _ref.icon,
25391
+ _ref$iconHelpText = _ref.iconHelpText,
25392
+ iconHelpText = _ref$iconHelpText === void 0 ? "" : _ref$iconHelpText,
25393
+ _ref$popoverID = _ref.popoverID,
25394
+ popoverID = _ref$popoverID === void 0 ? 0 : _ref$popoverID,
25395
+ _ref$popoverFocus = _ref.popoverFocus,
25396
+ popoverFocus = _ref$popoverFocus === void 0 ? false : _ref$popoverFocus,
25397
+ extraStyles = _ref.extraStyles,
25398
+ textExtraStyles = _ref.textExtraStyles,
25399
+ _ref$minWidth = _ref.minWidth,
25400
+ minWidth = _ref$minWidth === void 0 ? "250px" : _ref$minWidth,
25401
+ _ref$maxWidth = _ref.maxWidth,
25402
+ maxWidth = _ref$maxWidth === void 0 ? "300px" : _ref$maxWidth,
25403
+ _ref$height = _ref.height,
25404
+ height = _ref$height === void 0 ? "auto" : _ref$height,
25405
+ position = _ref.position,
25406
+ arrowPosition = _ref.arrowPosition,
25407
+ _ref$arrowDirection = _ref.arrowDirection,
25408
+ arrowDirection = _ref$arrowDirection === void 0 ? "down" : _ref$arrowDirection,
25409
+ _ref$transform = _ref.transform,
25410
+ transform = _ref$transform === void 0 ? "none" : _ref$transform,
25411
+ buttonExtraStyles = _ref.buttonExtraStyles,
25412
+ _ref$backgroundColor = _ref.backgroundColor,
25413
+ backgroundColor = _ref$backgroundColor === void 0 ? "white" : _ref$backgroundColor,
25414
+ _ref$borderColor = _ref.borderColor,
25415
+ borderColor = _ref$borderColor === void 0 ? "rgba(255, 255, 255, 0.85)" : _ref$borderColor,
25416
+ popoverExtraStyles = _ref.popoverExtraStyles;
25417
+ var hoverColor = themeValues.hoverColor,
25418
+ activeColor = themeValues.activeColor,
25419
+ popoverTriggerColor = themeValues.popoverTriggerColor;
25420
+
25421
+ var _ref2 = position !== null && position !== void 0 ? position : {},
25422
+ _ref2$top = _ref2.top,
25423
+ top = _ref2$top === void 0 ? "-110px" : _ref2$top,
25424
+ _ref2$right = _ref2.right,
25425
+ right = _ref2$right === void 0 ? "auto" : _ref2$right,
25426
+ _ref2$bottom = _ref2.bottom,
25427
+ bottom = _ref2$bottom === void 0 ? "auto" : _ref2$bottom,
25428
+ _ref2$left = _ref2.left,
25429
+ left = _ref2$left === void 0 ? "-225px" : _ref2$left;
25430
+
25431
+ var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
25432
+ _ref3$arrowTop = _ref3.arrowTop,
25433
+ arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
25434
+ _ref3$arrowRight = _ref3.arrowRight,
25435
+ arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
25436
+ _ref3$arrowBottom = _ref3.arrowBottom,
25437
+ arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
25438
+ _ref3$arrowLeft = _ref3.arrowLeft,
25439
+ arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
25440
+
25441
+ var _useState = React.useState(false),
25442
+ _useState2 = _slicedToArray(_useState, 2),
25443
+ popoverOpen = _useState2[0],
25444
+ togglePopover = _useState2[1];
25445
+
25446
+ var handleTogglePopover = function handleTogglePopover(popoverState) {
25447
+ if (popoverOpen !== popoverState) {
25448
+ togglePopover(popoverState);
25449
+ }
25450
+ };
25451
+
25452
+ var triggerRef = useOutsideClickHook();
25453
+ return /*#__PURE__*/React__default.createElement(Box, {
25454
+ padding: "0",
25455
+ extraStyles: "position: relative; ".concat(extraStyles)
25456
+ }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
25457
+ action: function action() {
25458
+ return noop;
25459
+ },
25460
+ onFocus: function onFocus() {
25461
+ handleTogglePopover(true);
25462
+ },
25463
+ onBlur: function onBlur() {
25464
+ handleTogglePopover(false);
25465
+ },
25466
+ onKeyDown: function onKeyDown(e) {
25467
+ if (e.keyCode === 27) {
25468
+ handleTogglePopover(false);
25469
+ }
25470
+ },
25471
+ onTouchStart: function onTouchStart() {
25472
+ return handleTogglePopover(true);
25473
+ },
25474
+ onTouchEnd: function onTouchEnd() {
25475
+ return handleTogglePopover(false);
25476
+ },
25477
+ onMouseEnter: function onMouseEnter() {
25478
+ return handleTogglePopover(true);
25479
+ },
25480
+ onMouseLeave: function onMouseLeave() {
25481
+ return handleTogglePopover(false);
25482
+ },
25483
+ contentOverride: true,
25484
+ variant: "smallGhost",
25485
+ tabIndex: "0",
25486
+ id: "btnPopover".concat(popoverID),
25487
+ "aria-expanded": popoverOpen,
25488
+ "aria-labelledby": "btnPopover".concat(popoverID, "_info Disclosure").concat(popoverID),
25489
+ "aria-describedby": "Disclosure".concat(popoverID),
25490
+ "aria-controls": "Disclosed".concat(popoverID),
25491
+ ref: triggerRef,
25492
+ extraStyles: buttonExtraStyles
25493
+ }, hasIcon && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Box, {
25494
+ padding: "0",
25495
+ srOnly: true
25496
+ }, /*#__PURE__*/React__default.createElement(Text$1, {
25497
+ id: "btnPopover".concat(popoverID, "_info")
25498
+ }, iconHelpText))), !hasIcon && /*#__PURE__*/React__default.createElement(Text$1, {
25499
+ color: popoverTriggerColor,
25500
+ extraStyles: "&:active { color: ".concat(activeColor, "; } &:hover { color: ").concat(hoverColor, " }; ").concat(textExtraStyles)
25501
+ }, triggerText)), /*#__PURE__*/React__default.createElement(Box, {
25502
+ background: backgroundColor,
25503
+ borderRadius: "4px",
25504
+ boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)",
25505
+ id: "Disclosed".concat(popoverID),
25506
+ role: "region",
25507
+ "aria-describedby": "Disclosure".concat(popoverID),
25508
+ tabIndex: popoverFocus && popoverOpen ? "0" : "-1",
25509
+ minWidth: minWidth,
25510
+ maxWidth: maxWidth,
25511
+ 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 ")
25512
+ }, /*#__PURE__*/React__default.createElement(Paragraph$1, null, content), /*#__PURE__*/React__default.createElement(Box, {
25513
+ padding: "0",
25514
+ 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 ")
25515
+ })));
25516
+ };
25517
+
25518
+ var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
25519
+
25520
+ var DisplayCard = function DisplayCard(_ref) {
25521
+ var title = _ref.title,
25522
+ item = _ref.item,
25523
+ buttonText = _ref.buttonText,
25524
+ buttonAction = _ref.buttonAction,
25525
+ url = _ref.url,
25526
+ _ref$link = _ref.link,
25527
+ link = _ref$link === void 0 ? false : _ref$link,
25528
+ helpText = _ref.helpText,
25529
+ _ref$hasPopover = _ref.hasPopover,
25530
+ hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
25531
+ _ref$popoverTriggerTe = _ref.popoverTriggerText,
25532
+ popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
25533
+ _ref$popoverContent = _ref.popoverContent,
25534
+ popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
25535
+ popoverExtraStyles = _ref.popoverExtraStyles,
25536
+ popoverTextExtraStyles = _ref.popoverTextExtraStyles;
25537
+ return /*#__PURE__*/React__default.createElement(Box, {
25538
+ padding: "0 0 16px"
25539
+ }, /*#__PURE__*/React__default.createElement(Stack, {
25540
+ childGap: "0rem"
25541
+ }, /*#__PURE__*/React__default.createElement(Box, {
25542
+ padding: "0 0 8px 0"
25543
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
25544
+ justify: "space-between",
25545
+ align: "center",
25546
+ overflow: true
25547
+ }, /*#__PURE__*/React__default.createElement(Paragraph$1, {
25548
+ variant: "pL",
25549
+ color: CHARADE_GREY,
25550
+ extraStyles: "letter-spacing: 0.29px"
25551
+ }, title), hasPopover && /*#__PURE__*/React__default.createElement(Popover$1, {
25552
+ triggerText: popoverTriggerText,
25553
+ content: popoverContent,
25554
+ popoverExtraStyles: popoverExtraStyles,
25555
+ popoverTextExtraStyles: popoverTextExtraStyles
25556
+ }))), /*#__PURE__*/React__default.createElement(Box, {
25557
+ padding: "0"
25558
+ }, /*#__PURE__*/React__default.createElement(Box, {
25559
+ padding: "24px",
25560
+ borderSize: "1px",
25561
+ borderRadius: "4px",
25562
+ background: WHITE,
25563
+ boxShadow: "0px 2px 14px 0px rgb(246, 246, 249), 0px 3px 8px 0px rgb(202, 206, 216)"
25564
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
25565
+ justify: "space-between",
25566
+ align: "center"
25567
+ }, /*#__PURE__*/React__default.createElement(Text$1, {
25568
+ color: CHARADE_GREY
25569
+ }, item), link ? /*#__PURE__*/React__default.createElement(ButtonWithLink, {
25570
+ text: buttonText,
25571
+ url: url,
25572
+ variant: "smallGhost",
25573
+ dataQa: buttonText,
25574
+ extraStyles: "min-width: 0;"
25575
+ }) : buttonAction ? /*#__PURE__*/React__default.createElement(ButtonWithAction, {
25576
+ text: buttonText,
25577
+ action: buttonAction,
25578
+ variant: "smallGhost",
25579
+ dataQa: buttonText,
25580
+ extraStyles: "min-width: 0;"
25581
+ }) : helpText ? /*#__PURE__*/React__default.createElement(Text$1, {
25582
+ color: STORM_GREY,
25583
+ extraStyles: "font-style: italic;"
25584
+ }, helpText) : /*#__PURE__*/React__default.createElement(React.Fragment, null))))));
25585
+ };
25586
+
25214
25587
  function _extends$2() {
25215
25588
  _extends$2 = Object.assign || function (target) {
25216
25589
  for (var i = 1; i < arguments.length; i++) {
@@ -25489,392 +25862,6 @@ var FormattedInput = function FormattedInput(_ref) {
25489
25862
  }));
25490
25863
  };
25491
25864
 
25492
- var formatDelimiter = "_";
25493
- var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
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";
25510
-
25511
- switch (expirationStatus) {
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);
25519
-
25520
- case EXPIRING_SOON:
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);
25527
-
25528
- case EXPIRED:
25529
- return /*#__PURE__*/React__default.createElement(Text$1, {
25530
- as: as,
25531
- variant: "pXS",
25532
- color: ASH_GREY,
25533
- extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
25534
- }, "Expired");
25535
- }
25536
- };
25537
-
25538
- var formats = /*#__PURE__*/Object.freeze({
25539
- __proto__: null,
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
- });
25551
-
25552
- var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
25553
- var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
25554
- // Only move focus when "hasErrors" is true
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$;
25561
-
25562
- var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
25563
- inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
25564
- }
25565
-
25566
- return function () {
25567
- return resetHasErrors(false);
25568
- };
25569
- });
25570
- };
25571
-
25572
- /*
25573
- Hook that assigns a click event listener to the main document element
25574
- Returns a ref to attach to another element (like an icon/button that triggers a popover)
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)
25577
-
25578
- See popover component for implementation
25579
-
25580
- */
25581
-
25582
- var useOutsideClickHook = function useOutsideClickHook(handler) {
25583
- var ref = React.useRef();
25584
- React.useEffect(function () {
25585
- }, [ref]);
25586
- return ref;
25587
- };
25588
-
25589
- var initialToastState = {
25590
- isOpen: false,
25591
- variant: "",
25592
- message: ""
25593
- };
25594
-
25595
- var useToastNotification = function useToastNotification() {
25596
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
25597
- _ref$timeout = _ref.timeout,
25598
- timeout = _ref$timeout === void 0 ? 5000 : _ref$timeout;
25599
-
25600
- var _useState = React.useState(initialToastState),
25601
- _useState2 = _slicedToArray(_useState, 2),
25602
- toastState = _useState2[0],
25603
- setToastState = _useState2[1];
25604
-
25605
- React.useEffect(function () {
25606
- if (toastState.isOpen) {
25607
- setTimeout(function () {
25608
- setToastState(initialToastState);
25609
- }, timeout);
25610
- }
25611
- }, [timeout, toastState.isOpen]);
25612
-
25613
- var showToast = function showToast(_ref2) {
25614
- var message = _ref2.message,
25615
- variant = _ref2.variant;
25616
- return setToastState({
25617
- isOpen: true,
25618
- variant: variant,
25619
- message: message
25620
- });
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
25633
- };
25634
- };
25635
-
25636
-
25637
-
25638
- var index$4 = /*#__PURE__*/Object.freeze({
25639
- __proto__: null,
25640
- formats: formats,
25641
- general: general,
25642
- theme: themeUtils,
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
25655
- };
25656
-
25657
- var arrowBorder = function arrowBorder(borderColor, direction) {
25658
- var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "8px";
25659
- var angle = "".concat(width, " solid transparent");
25660
- var straight = "".concat(width, " solid ").concat(borderColor);
25661
-
25662
- if (direction == "down") {
25663
- return "border-left: ".concat(angle, "; border-right: ").concat(angle, "; border-top: ").concat(straight);
25664
- } else if (direction == "up") {
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);
25670
- }
25671
- };
25672
-
25673
- var Popover = function Popover(_ref) {
25674
- var themeValues = _ref.themeValues,
25675
- _ref$triggerText = _ref.triggerText,
25676
- triggerText = _ref$triggerText === void 0 ? "" : _ref$triggerText,
25677
- _ref$content = _ref.content,
25678
- content = _ref$content === void 0 ? "" : _ref$content,
25679
- _ref$hasIcon = _ref.hasIcon,
25680
- hasIcon = _ref$hasIcon === void 0 ? false : _ref$hasIcon,
25681
- Icon = _ref.icon,
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;
25721
-
25722
- var _ref3 = arrowPosition !== null && arrowPosition !== void 0 ? arrowPosition : {},
25723
- _ref3$arrowTop = _ref3.arrowTop,
25724
- arrowTop = _ref3$arrowTop === void 0 ? "auto" : _ref3$arrowTop,
25725
- _ref3$arrowRight = _ref3.arrowRight,
25726
- arrowRight = _ref3$arrowRight === void 0 ? "10px" : _ref3$arrowRight,
25727
- _ref3$arrowBottom = _ref3.arrowBottom,
25728
- arrowBottom = _ref3$arrowBottom === void 0 ? "-8px" : _ref3$arrowBottom,
25729
- _ref3$arrowLeft = _ref3.arrowLeft,
25730
- arrowLeft = _ref3$arrowLeft === void 0 ? "auto" : _ref3$arrowLeft;
25731
-
25732
- var _useState = React.useState(false),
25733
- _useState2 = _slicedToArray(_useState, 2),
25734
- popoverOpen = _useState2[0],
25735
- togglePopover = _useState2[1];
25736
-
25737
- var handleTogglePopover = function handleTogglePopover(popoverState) {
25738
- if (popoverOpen !== popoverState) {
25739
- togglePopover(popoverState);
25740
- }
25741
- };
25742
-
25743
- var triggerRef = useOutsideClickHook();
25744
- return /*#__PURE__*/React__default.createElement(Box, {
25745
- padding: "0",
25746
- extraStyles: "position: relative; ".concat(extraStyles)
25747
- }, /*#__PURE__*/React__default.createElement(ButtonWithAction, {
25748
- action: function action() {
25749
- return noop;
25750
- },
25751
- onFocus: function onFocus() {
25752
- handleTogglePopover(true);
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
- };
25808
-
25809
- var Popover$1 = themeComponent(Popover, "Popover", fallbackValues$j);
25810
-
25811
- var DisplayCard = function DisplayCard(_ref) {
25812
- var title = _ref.title,
25813
- item = _ref.item,
25814
- buttonText = _ref.buttonText,
25815
- buttonAction = _ref.buttonAction,
25816
- url = _ref.url,
25817
- _ref$link = _ref.link,
25818
- link = _ref$link === void 0 ? false : _ref$link,
25819
- helpText = _ref.helpText,
25820
- _ref$hasPopover = _ref.hasPopover,
25821
- hasPopover = _ref$hasPopover === void 0 ? false : _ref$hasPopover,
25822
- _ref$popoverTriggerTe = _ref.popoverTriggerText,
25823
- popoverTriggerText = _ref$popoverTriggerTe === void 0 ? "" : _ref$popoverTriggerTe,
25824
- _ref$popoverContent = _ref.popoverContent,
25825
- popoverContent = _ref$popoverContent === void 0 ? "" : _ref$popoverContent,
25826
- popoverExtraStyles = _ref.popoverExtraStyles,
25827
- popoverTextExtraStyles = _ref.popoverTextExtraStyles;
25828
- return /*#__PURE__*/React__default.createElement(Box, {
25829
- padding: "0 0 16px"
25830
- }, /*#__PURE__*/React__default.createElement(Stack, {
25831
- childGap: "0rem"
25832
- }, /*#__PURE__*/React__default.createElement(Box, {
25833
- padding: "0 0 8px 0"
25834
- }, /*#__PURE__*/React__default.createElement(Cluster, {
25835
- justify: "space-between",
25836
- align: "center",
25837
- overflow: true
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))))));
25876
- };
25877
-
25878
25865
  var linkColor$2 = {
25879
25866
  "default": "".concat(MATISSE_BLUE),
25880
25867
  disabled: "".concat(MATISSE_BLUE)
@@ -26341,6 +26328,66 @@ var fallbackValues$n = {
26341
26328
  autopayTextColor: autopayTextColor$1
26342
26329
  };
26343
26330
 
26331
+ var formatDelimiter = "_";
26332
+ var phoneFormats = ["", "_", "__", "(___) ", "(___) _", "(___) __", "(___) ___-", "(___) ___-_", "(___) ___-__", "(___) ___-___", "(___) ___-____"];
26333
+ var zipFormats = ["", "_", "__", "___", "____", "_____", "______", "_____-__", "_____-___", "_____-____"];
26334
+ var creditCardFormats = ["", "_", "__", "___", "____", "____ _", "____ __", "____ ___", "____ ____", "____ ____ _", "____ ____ __", "____ ____ ___", "____ ____ ____", "____ ____ ____ _", "____ ____ ____ __", "____ ____ ____ ___", "____ ____ ____ ____"];
26335
+ var moneyFormats = ["", "$0.0_", "$0.__", "$_.__", "$__.__", "$___.__", "$_,___.__", "$__,___.__", "$___,___.__", "$_,___,___.__", "$__,___,___.__", "$___,___,___.__", "$_,___,___,___.__", "$__,___,___,___.__", "$___,___,___,___.__", "$_,___,___,___,___.__"];
26336
+ var expirationDateFormats = ["", "_", "__/", "__/_", "__/__"];
26337
+ var zipFormat = createFormat(zipFormats, formatDelimiter);
26338
+ var creditCardFormat = createFormat(creditCardFormats, formatDelimiter);
26339
+ var expirationDateFormat = createFormat(expirationDateFormats, formatDelimiter);
26340
+ var phoneFormat = createFormat(phoneFormats, formatDelimiter);
26341
+ var moneyFormat = createFormat(moneyFormats, formatDelimiter);
26342
+ var renderCardStatus = function renderCardStatus(expirationStatus, expireDate) {
26343
+ var textAlign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "right";
26344
+ var as = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "span";
26345
+ var ACTIVE = "ACTIVE";
26346
+ var EXPIRING_SOON = "EXPIRING_SOON";
26347
+ var EXPIRED = "EXPIRED";
26348
+ var textMargin = textAlign === "right" ? "auto" : "0";
26349
+
26350
+ switch (expirationStatus) {
26351
+ case ACTIVE:
26352
+ return /*#__PURE__*/React__default.createElement(Text$1, {
26353
+ as: as,
26354
+ variant: "pXS",
26355
+ color: ASH_GREY,
26356
+ extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26357
+ }, "Exp Date ", expireDate);
26358
+
26359
+ case EXPIRING_SOON:
26360
+ return /*#__PURE__*/React__default.createElement(Text$1, {
26361
+ as: as,
26362
+ variant: "pXS",
26363
+ color: FIRE_YELLOW,
26364
+ extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26365
+ }, "Expiring Soon ", expireDate);
26366
+
26367
+ case EXPIRED:
26368
+ return /*#__PURE__*/React__default.createElement(Text$1, {
26369
+ as: as,
26370
+ variant: "pXS",
26371
+ color: ASH_GREY,
26372
+ extraStyles: "text-align: ".concat(textAlign, "; margin: ").concat(textMargin, ";")
26373
+ }, "Expired");
26374
+ }
26375
+ };
26376
+
26377
+ var formats = /*#__PURE__*/Object.freeze({
26378
+ __proto__: null,
26379
+ formatDelimiter: formatDelimiter,
26380
+ phoneFormats: phoneFormats,
26381
+ moneyFormats: moneyFormats,
26382
+ expirationDateFormats: expirationDateFormats,
26383
+ zipFormat: zipFormat,
26384
+ creditCardFormat: creditCardFormat,
26385
+ expirationDateFormat: expirationDateFormat,
26386
+ phoneFormat: phoneFormat,
26387
+ moneyFormat: moneyFormat,
26388
+ renderCardStatus: renderCardStatus
26389
+ });
26390
+
26344
26391
  var CreditCardWrapper = styled__default.div.withConfig({
26345
26392
  displayName: "FormattedCreditCard__CreditCardWrapper",
26346
26393
  componentId: "sc-s0ta5l-0"
@@ -27285,7 +27332,7 @@ var RadioButtonWithLabel = function RadioButtonWithLabel(_ref5) {
27285
27332
  var RadioButtonWithLabel$1 = themeComponent(RadioButtonWithLabel, "RadioButtonWithLabel", fallbackValues$u);
27286
27333
 
27287
27334
  var activeColor$6 = "".concat(MATISSE_BLUE);
27288
- var inactiveColor = "".concat(GREY_CHATEAU);
27335
+ var inactiveColor = "".concat(STORM_GREY);
27289
27336
  var fallbackValues$v = {
27290
27337
  activeColor: activeColor$6,
27291
27338
  inactiveColor: inactiveColor
@@ -27318,19 +27365,21 @@ var RadioButton$1 = function RadioButton(_ref2) {
27318
27365
  var buttonBorder = {
27319
27366
  onFocused: {
27320
27367
  borderColor: themeValues.activeColor,
27321
- boxShadow: "0px 0px 4px 0px ".concat(themeValues.activeColor)
27368
+ outline: "3px solid ".concat(themeValues.activeColor),
27369
+ outlineOffset: "2px"
27322
27370
  },
27323
27371
  offFocused: {
27324
27372
  borderColor: themeValues.activeColor,
27325
- boxShadow: "0px 0px 4px 0px ".concat(themeValues.activeColor)
27373
+ outline: "3px solid ".concat(themeValues.activeColor),
27374
+ outlineOffset: "2px"
27326
27375
  },
27327
27376
  on: {
27328
27377
  borderColor: themeValues.activeColor,
27329
- boxShadow: "0px 0px 0px 0px #FFFFFF"
27378
+ outline: "0"
27330
27379
  },
27331
27380
  off: {
27332
27381
  borderColor: themeValues.inactiveColor,
27333
- boxShadow: "0px 0px 0px 0px #FFFFFF"
27382
+ outline: "0"
27334
27383
  }
27335
27384
  };
27336
27385
  var buttonCenter = {
@@ -27379,7 +27428,7 @@ var RadioButton$1 = function RadioButton(_ref2) {
27379
27428
  borderWidth: "1px",
27380
27429
  borderStyle: "solid",
27381
27430
  borderRadius: "12px",
27382
- margin: "4px 14px 4px 4px",
27431
+ margin: "6px 14px 6px 6px",
27383
27432
  height: "24px",
27384
27433
  width: "24px",
27385
27434
  variants: buttonBorder,
@@ -48866,43 +48915,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48866
48915
  })))));
48867
48916
  };
48868
48917
 
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
48918
  var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48907
48919
  var _ref$showCheckbox = _ref.showCheckbox,
48908
48920
  showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
@@ -50364,19 +50376,19 @@ var ToastNotification = function ToastNotification(_ref) {
50364
50376
  backgroundColor = _ref.backgroundColor;
50365
50377
  return /*#__PURE__*/React__default.createElement(Box, {
50366
50378
  onClick: closeToastNotification,
50367
- background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant === "error" ? ERROR_BACKGROUND_COLOR : WHITE,
50379
+ background: backgroundColor ? backgroundColor : variant === VARIANTS.SUCCESS ? HINT_GREEN : variant === VARIANTS.ERROR ? ERROR_BACKGROUND_COLOR : WHITE,
50368
50380
  minWidth: minWidth,
50369
50381
  minHeight: height && parseInt(height) < 100 ? height : "100px",
50370
50382
  height: height ? height : "auto",
50371
50383
  tabIndex: toastOpen ? "-1" : "0",
50372
50384
  padding: "0rem 1rem",
50373
50385
  borderRadius: "4px",
50374
- boxShadow: "0px 4px 4px rgba(41, 42, 51, 0.15), 0px 1px 7px rgba(41, 42, 51, 0.2), 0px 7px 12px rgba(41, 42, 51, 0.15)",
50386
+ boxShadow: generateShadows().standard.base,
50375
50387
  extraStyles: "\n display: ".concat(toastOpen ? "block" : "none", ";\n position: fixed; bottom: 4rem; left: 4rem;\n ").concat(extraStyles, ";\n cursor: pointer;\n ")
50376
50388
  }, /*#__PURE__*/React__default.createElement(Cluster, {
50377
50389
  align: "center",
50378
50390
  childGap: childGap
50379
- }, variant === "success" && /*#__PURE__*/React__default.createElement(SuccessfulIconMedium, null), variant === "error" && /*#__PURE__*/React__default.createElement(ErroredIcon, null), /*#__PURE__*/React__default.createElement(Box, {
50391
+ }, variant === VARIANTS.SUCCESS && /*#__PURE__*/React__default.createElement(SuccessfulIconMedium, null), variant === VARIANTS.ERROR && /*#__PURE__*/React__default.createElement(ErroredIcon, null), /*#__PURE__*/React__default.createElement(Box, {
50380
50392
  padding: "1rem 0",
50381
50393
  maxWidth: maxWidth
50382
50394
  }, /*#__PURE__*/React__default.createElement(Paragraph$1, {
@@ -50757,6 +50769,38 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
50757
50769
 
50758
50770
  var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$U));
50759
50771
 
50772
+ var useFocusInvalidInput = function useFocusInvalidInput(hasErrors) {
50773
+ var resetHasErrors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
50774
+ // Only move focus when "hasErrors" is true
50775
+ // "hasErrors" is managed by container page of form
50776
+ // typically set to "true" on attempted form submission, if errors exist
50777
+ // Reset errors, if provided, resets the error state tracking in order to properly re-run
50778
+ React.useEffect(function () {
50779
+ if (hasErrors) {
50780
+ var _inputsWithErrors$;
50781
+
50782
+ var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
50783
+ inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
50784
+ }
50785
+
50786
+ return function () {
50787
+ return resetHasErrors(false);
50788
+ };
50789
+ });
50790
+ };
50791
+
50792
+
50793
+
50794
+ var index$6 = /*#__PURE__*/Object.freeze({
50795
+ __proto__: null,
50796
+ formats: formats,
50797
+ general: general,
50798
+ theme: themeUtils,
50799
+ useFocusInvalidInput: useFocusInvalidInput,
50800
+ useOutsideClick: useOutsideClickHook,
50801
+ useToastNotification: useToastNotification
50802
+ });
50803
+
50760
50804
  exports.AccountNumberImage = AccountNumberImage;
50761
50805
  exports.AccountsAddIcon = AccountsAddIcon$1;
50762
50806
  exports.AccountsIcon = AccountsIcon$1;
@@ -50968,6 +51012,7 @@ exports.cardRegistry = cardRegistry;
50968
51012
  exports.constants = index$5;
50969
51013
  exports.createPartialAmountFormState = createPartialAmountFormState;
50970
51014
  exports.createPartialAmountFormValidators = createPartialAmountFormValidators;
50971
- exports.util = index$4;
51015
+ exports.hooks = index$4;
51016
+ exports.util = index$6;
50972
51017
  exports.withWindowSize = withWindowSize;
50973
51018
  //# sourceMappingURL=index.cjs.js.map