@thecb/components 7.13.2-beta.0 → 7.13.2

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.esm.js CHANGED
@@ -18463,7 +18463,63 @@ var fallbackValues$4 = {
18463
18463
  link: link
18464
18464
  };
18465
18465
 
18466
+ /*
18467
+
18468
+ A utility function that can generate box-shadow values for components
18469
+ Takes a string representing an rgb color value and returns an object
18470
+ with values for standard, inset, and overlay shadows.
18471
+
18472
+ The objects for standard and inset shadows contain versions approiate
18473
+ for base, hover, and active interaction states.
18474
+
18475
+ */
18476
+
18477
+ /*
18478
+ Function to convert string representing rgb color to rgba value with provided opacity
18479
+ ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
18480
+
18481
+ */
18482
+ var rgbToRgba = function rgbToRgba() {
18483
+ var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
18484
+ var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
18485
+
18486
+ if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
18487
+ return "";
18488
+ }
18489
+
18490
+ return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
18491
+ };
18492
+
18493
+ var generateShadows = function generateShadows() {
18494
+ var baseColorRGB = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(41, 42, 51)";
18495
+ var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
18496
+ var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
18497
+ var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
18498
+ var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
18499
+ var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
18500
+ var standard = {
18501
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
18502
+ hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
18503
+ active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
18504
+ };
18505
+ var inset = {
18506
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
18507
+ hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
18508
+ active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
18509
+ };
18510
+ var overlay = {
18511
+ base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
18512
+ };
18513
+ return {
18514
+ standard: standard,
18515
+ inset: inset,
18516
+ overlay: overlay
18517
+ };
18518
+ };
18519
+
18466
18520
  var Alert = function Alert(_ref) {
18521
+ var _generateShadows, _generateShadows$inse;
18522
+
18467
18523
  var heading = _ref.heading,
18468
18524
  text = _ref.text,
18469
18525
  textOverride = _ref.textOverride,
@@ -18477,13 +18533,26 @@ var Alert = function Alert(_ref) {
18477
18533
  showQuitLink = _ref$showQuitLink === void 0 ? true : _ref$showQuitLink,
18478
18534
  themeValues = _ref.themeValues,
18479
18535
  extraStyles = _ref.extraStyles,
18480
- maxContentWidth = _ref.maxContentWidth;
18536
+ maxContentWidth = _ref.maxContentWidth,
18537
+ _ref$noBorder = _ref.noBorder,
18538
+ noBorder = _ref$noBorder === void 0 ? false : _ref$noBorder,
18539
+ _ref$enableBoxShadow = _ref.enableBoxShadow,
18540
+ enableBoxShadow = _ref$enableBoxShadow === void 0 ? false : _ref$enableBoxShadow,
18541
+ _ref$enableSmallText = _ref.enableSmallText,
18542
+ enableSmallText = _ref$enableSmallText === void 0 ? false : _ref$enableSmallText,
18543
+ _ref$innerContentPadd = _ref.innerContentPadding,
18544
+ innerContentPadding = _ref$innerContentPadd === void 0 ? "1rem" : _ref$innerContentPadd,
18545
+ _ref$iconPadding = _ref.iconPadding,
18546
+ iconPadding = _ref$iconPadding === void 0 ? "0 0 0 1rem" : _ref$iconPadding,
18547
+ _ref$contentFullHeigh = _ref.contentFullHeight,
18548
+ contentFullHeight = _ref$contentFullHeigh === void 0 ? false : _ref$contentFullHeigh;
18481
18549
  var Icon = AlertIcons[variant];
18550
+ var contentPadding = maxContentWidth ? "".concat(padding, " 1rem") : innerContentPadding;
18482
18551
  var content = /*#__PURE__*/React.createElement(Sidebar, {
18483
18552
  width: "24px",
18484
18553
  childGap: "0rem"
18485
18554
  }, /*#__PURE__*/React.createElement(Box, {
18486
- padding: "0 0 0 1rem",
18555
+ padding: iconPadding,
18487
18556
  minHeight: "100%"
18488
18557
  }, /*#__PURE__*/React.createElement(Cover, {
18489
18558
  minHeight: "100%",
@@ -18497,17 +18566,18 @@ var Alert = function Alert(_ref) {
18497
18566
  }, /*#__PURE__*/React.createElement(Sidebar, {
18498
18567
  sidebarOnRight: true,
18499
18568
  width: "24px",
18500
- childGap: "0rem"
18569
+ childGap: "0rem",
18570
+ fullHeight: contentFullHeight
18501
18571
  }, /*#__PURE__*/React.createElement(Box, {
18502
- padding: maxContentWidth ? "".concat(padding, " 1rem") : "1rem"
18572
+ padding: contentPadding
18503
18573
  }, /*#__PURE__*/React.createElement(Cluster, {
18504
18574
  justify: "flex-start",
18505
18575
  align: "center"
18506
18576
  }, textOverride ? textOverride : /*#__PURE__*/React.createElement(Stack, {
18507
18577
  fullHeight: true,
18508
- childGap: "0.25rem"
18578
+ childGap: "0"
18509
18579
  }, /*#__PURE__*/React.createElement(Text$1, {
18510
- variant: "p",
18580
+ variant: enableSmallText ? "pS" : "p",
18511
18581
  color: themeValues.text,
18512
18582
  weight: "600"
18513
18583
  }, heading), /*#__PURE__*/React.createElement(Text$1, {
@@ -18529,7 +18599,8 @@ var Alert = function Alert(_ref) {
18529
18599
  background: themeValues.background,
18530
18600
  borderRadius: "4px",
18531
18601
  borderColor: themeValues.border,
18532
- borderSize: "1px",
18602
+ borderSize: noBorder ? "0px" : "1px",
18603
+ boxShadow: enableBoxShadow ? (_generateShadows = generateShadows()) === null || _generateShadows === void 0 ? void 0 : (_generateShadows$inse = _generateShadows.inset) === null || _generateShadows$inse === void 0 ? void 0 : _generateShadows$inse.base : "",
18533
18604
  extraStyles: extraStyles
18534
18605
  }, maxContentWidth ? /*#__PURE__*/React.createElement(Center, {
18535
18606
  maxWidth: maxContentWidth
@@ -26274,7 +26345,7 @@ var fallbackValues$q = {
26274
26345
  var SpinnerSvgAnimation = styled.svg.withConfig({
26275
26346
  displayName: "Spinner__SpinnerSvgAnimation",
26276
26347
  componentId: "sc-vhupl9-0"
26277
- })(["animation:rotate 2s linear infinite;margin:-25px 0 0 -25px;width:", "px;height:", "px;& .path{stroke:", ";stroke-linecap:round;animation:dash 1.5s ease-in-out infinite;}@keyframes rotate{100%{transform:rotate(360deg);}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}"], function (_ref) {
26348
+ })(["animation:rotate 2s linear infinite;margin:-25px 0 0 -25px;width:", "px;height:", "px;& .path{stroke:", ";stroke-linecap:round;animation:dash 1.5s ease-in-out infinite;}@keyframes rotate{100%{transform:rotate(360deg);}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0;}50%{stroke-dasharray:90,150;stroke-dashoffset:-35;}100%{stroke-dasharray:90,150;stroke-dashoffset:-124;}}", ""], function (_ref) {
26278
26349
  var size = _ref.size;
26279
26350
  return size;
26280
26351
  }, function (_ref2) {
@@ -26283,19 +26354,36 @@ var SpinnerSvgAnimation = styled.svg.withConfig({
26283
26354
  }, function (_ref3) {
26284
26355
  var color = _ref3.color;
26285
26356
  return color;
26357
+ }, function (_ref4) {
26358
+ var centerSpinner = _ref4.centerSpinner;
26359
+ return centerSpinner ? css(["margin:0;"]) : "";
26286
26360
  });
26287
26361
  var SpinnerContainer$2 = styled.div.withConfig({
26288
26362
  displayName: "Spinner__SpinnerContainer",
26289
26363
  componentId: "sc-vhupl9-1"
26290
- })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:center;line-height:1;"]);
26364
+ })(["width:100%;display:flex;flex-direction:row;align-items:center;justify-content:center;line-height:1;", ""], function (_ref5) {
26365
+ var centerSpinner = _ref5.centerSpinner,
26366
+ size = _ref5.size;
26367
+ return centerSpinner ? css(["width:", "px;height:", "px;"], size, size) : "";
26368
+ });
26369
+ /*
26370
+ `centerSpinner` prop alters existing styling of spinner to allow it to properly center itself within
26371
+ containers. Default is false to preserve legacy behavior for past uses.
26372
+ */
26291
26373
 
26292
- var Spinner$1 = function Spinner(_ref4) {
26293
- var _ref4$size = _ref4.size,
26294
- size = _ref4$size === void 0 ? "24" : _ref4$size,
26295
- themeValues = _ref4.themeValues;
26296
- return /*#__PURE__*/React.createElement(SpinnerContainer$2, null, /*#__PURE__*/React.createElement(SpinnerSvgAnimation, {
26374
+ var Spinner$1 = function Spinner(_ref6) {
26375
+ var _ref6$size = _ref6.size,
26376
+ size = _ref6$size === void 0 ? "24" : _ref6$size,
26377
+ _ref6$centerSpinner = _ref6.centerSpinner,
26378
+ centerSpinner = _ref6$centerSpinner === void 0 ? false : _ref6$centerSpinner,
26379
+ themeValues = _ref6.themeValues;
26380
+ return /*#__PURE__*/React.createElement(SpinnerContainer$2, {
26381
+ centerSpinner: centerSpinner,
26382
+ size: size
26383
+ }, /*#__PURE__*/React.createElement(SpinnerSvgAnimation, {
26297
26384
  size: size,
26298
- color: themeValues.color
26385
+ color: themeValues.color,
26386
+ centerSpinner: centerSpinner
26299
26387
  }, /*#__PURE__*/React.createElement("circle", {
26300
26388
  className: "path",
26301
26389
  cx: "50",
@@ -47653,7 +47741,7 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
47653
47741
  },
47654
47742
  text: "Void",
47655
47743
  padding: "0",
47656
- extraStyles: "\n min-width: 65px; \n margin: 0px;\n min-height: 0px;\n ",
47744
+ extraStyles: "\n min-width: 65px;\n margin: 0px;\n min-height: 0px;\n ",
47657
47745
  textExtraStyles: "font-weight: ".concat(FONT_WEIGHT_REGULAR, "; font-size: 14px;")
47658
47746
  })), /*#__PURE__*/React.createElement(Box, {
47659
47747
  padding: "0",
@@ -47681,12 +47769,69 @@ var PaymentDetailsContent = function PaymentDetailsContent(_ref) {
47681
47769
  }));
47682
47770
  };
47683
47771
 
47772
+ var LoadingDetails = function LoadingDetails() {
47773
+ return /*#__PURE__*/React.createElement(Box, {
47774
+ padding: "0",
47775
+ background: GRECIAN_GREY,
47776
+ borderRadius: "4px",
47777
+ minHeight: "196px"
47778
+ }, /*#__PURE__*/React.createElement(Cover, {
47779
+ minHeight: "196px",
47780
+ singleChild: true,
47781
+ fillCenter: true
47782
+ }, /*#__PURE__*/React.createElement(Center, {
47783
+ intrinsic: true
47784
+ }, /*#__PURE__*/React.createElement(Box, {
47785
+ padding: "0",
47786
+ extraStyles: "flex-grow: 1; display: flex; justify-content: center; align-items: center;"
47787
+ }, /*#__PURE__*/React.createElement(Spinner$2, {
47788
+ size: "100",
47789
+ centerSpinner: true
47790
+ })))));
47791
+ };
47792
+
47793
+ var ErrorDetails = function ErrorDetails() {
47794
+ return /*#__PURE__*/React.createElement(Box, {
47795
+ padding: "0"
47796
+ }, /*#__PURE__*/React.createElement(Alert$1, {
47797
+ variant: "error",
47798
+ heading: "Error Loading Payment",
47799
+ text: "Please go back and try again.",
47800
+ showQuitLink: false,
47801
+ noBorder: true,
47802
+ enableBoxShadow: true,
47803
+ enableSmallText: true,
47804
+ innerContentPadding: "0 0 0 0.75rem",
47805
+ iconPadding: "0 0 0 0",
47806
+ height: "67px",
47807
+ minHeight: "67px",
47808
+ padding: "0.75rem"
47809
+ }));
47810
+ };
47811
+
47812
+ var getLoadingOrErrorContent = function getLoadingOrErrorContent() {
47813
+ var isLoading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
47814
+ var isError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
47815
+
47816
+ if (isLoading) {
47817
+ return /*#__PURE__*/React.createElement(LoadingDetails, null);
47818
+ } else if (isError) {
47819
+ return /*#__PURE__*/React.createElement(ErrorDetails, null);
47820
+ }
47821
+
47822
+ return /*#__PURE__*/React.createElement(Fragment$1, null);
47823
+ };
47824
+
47684
47825
  var Collapsible = function Collapsible(_ref2) {
47685
47826
  var content = _ref2.content,
47686
47827
  title = _ref2.title,
47687
47828
  supportsTouch = _ref2.supportsTouch,
47688
47829
  isOpen = _ref2.isOpen,
47689
- setIsOpen = _ref2.setIsOpen;
47830
+ setIsOpen = _ref2.setIsOpen,
47831
+ _ref2$isLoading = _ref2.isLoading,
47832
+ isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading,
47833
+ _ref2$isError = _ref2.isError,
47834
+ isError = _ref2$isError === void 0 ? false : _ref2$isError;
47690
47835
  return /*#__PURE__*/React.createElement(CollapsibleSection$1, {
47691
47836
  isMobile: true,
47692
47837
  supportsTouch: supportsTouch,
@@ -47709,13 +47854,17 @@ var Collapsible = function Collapsible(_ref2) {
47709
47854
  },
47710
47855
  positionTransition: true,
47711
47856
  initial: "closed"
47712
- }, content));
47857
+ }, isLoading || isError ? getLoadingOrErrorContent(isLoading, isError) : content));
47713
47858
  };
47714
47859
 
47715
47860
  var NonCollapsible = function NonCollapsible(_ref3) {
47716
47861
  var title = _ref3.title,
47717
- content = _ref3.content;
47718
- return /*#__PURE__*/React.createElement(Stack, null, title, content);
47862
+ content = _ref3.content,
47863
+ _ref3$isLoading = _ref3.isLoading,
47864
+ isLoading = _ref3$isLoading === void 0 ? false : _ref3$isLoading,
47865
+ _ref3$isError = _ref3.isError,
47866
+ isError = _ref3$isError === void 0 ? false : _ref3$isError;
47867
+ return /*#__PURE__*/React.createElement(Stack, null, title, isLoading || isError ? getLoadingOrErrorContent(isLoading, isError) : content);
47719
47868
  };
47720
47869
 
47721
47870
  var PaymentDetails = function PaymentDetails(_ref4) {
@@ -47745,7 +47894,11 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47745
47894
  _ref4$voidableAmountP = _ref4.voidableAmountPaid,
47746
47895
  voidableAmountPaid = _ref4$voidableAmountP === void 0 ? 0 : _ref4$voidableAmountP,
47747
47896
  _ref4$remainingBalanc = _ref4.remainingBalance,
47748
- remainingBalance = _ref4$remainingBalanc === void 0 ? false : _ref4$remainingBalanc;
47897
+ remainingBalance = _ref4$remainingBalanc === void 0 ? false : _ref4$remainingBalanc,
47898
+ _ref4$isLoading = _ref4.isLoading,
47899
+ isLoading = _ref4$isLoading === void 0 ? false : _ref4$isLoading,
47900
+ _ref4$isError = _ref4.isError,
47901
+ isError = _ref4$isError === void 0 ? false : _ref4$isError;
47749
47902
 
47750
47903
  var _useState = useState(initiallyOpen),
47751
47904
  _useState2 = _slicedToArray(_useState, 2),
@@ -47848,10 +48001,14 @@ var PaymentDetails = function PaymentDetails(_ref4) {
47848
48001
  isOpen: isOpen,
47849
48002
  setIsOpen: setIsOpen,
47850
48003
  isMobile: isMobile,
47851
- supportsTouch: supportsTouch
48004
+ supportsTouch: supportsTouch,
48005
+ isLoading: isLoading,
48006
+ isError: isError
47852
48007
  }) : /*#__PURE__*/React.createElement(NonCollapsible, {
47853
48008
  title: title,
47854
- content: content
48009
+ content: content,
48010
+ isLoading: isLoading,
48011
+ isError: isError
47855
48012
  });
47856
48013
  };
47857
48014
 
@@ -48062,59 +48219,6 @@ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48062
48219
  })))));
48063
48220
  };
48064
48221
 
48065
- /*
48066
-
48067
- A utility function that can generate box-shadow values for components
48068
- Takes a string representing an rgb color value and returns an object
48069
- with values for standard, inset, and overlay shadows.
48070
-
48071
- The objects for standard and inset shadows contain versions approiate
48072
- for base, hover, and active interaction states.
48073
-
48074
- */
48075
-
48076
- /*
48077
- Function to convert string representing rgb color to rgba value with provided opacity
48078
- ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
48079
-
48080
- */
48081
- var rgbToRgba = function rgbToRgba() {
48082
- var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
48083
- var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
48084
-
48085
- if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
48086
- return "";
48087
- }
48088
-
48089
- return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
48090
- };
48091
-
48092
- var generateShadows = function generateShadows(baseColorRGB) {
48093
- var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
48094
- var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
48095
- var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
48096
- var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
48097
- var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
48098
- var standard = {
48099
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48100
- hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
48101
- active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
48102
- };
48103
- var inset = {
48104
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48105
- hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
48106
- active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
48107
- };
48108
- var overlay = {
48109
- base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
48110
- };
48111
- return {
48112
- standard: standard,
48113
- inset: inset,
48114
- overlay: overlay
48115
- };
48116
- };
48117
-
48118
48222
  /*
48119
48223
  Hook that takes an ID selector for an element on the screen
48120
48224
  And optionally values for top position, left position, smooth behavior