@thecb/components 7.10.2 → 7.10.4-beta.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
@@ -39957,13 +39957,16 @@ var EditableList = function EditableList(_ref) {
39957
39957
  autoPayMethods = _ref.autoPayMethods,
39958
39958
  _ref$as = _ref.as,
39959
39959
  as = _ref$as === void 0 ? "p" : _ref$as,
39960
+ _ref$listPadding = _ref.listPadding,
39961
+ listPadding = _ref$listPadding === void 0 ? "0rem 0rem 1.5rem 0rem" : _ref$listPadding,
39960
39962
  qaPrefix = _ref.qaPrefix,
39961
39963
  ariaLabel = _ref.ariaLabel;
39962
39964
  var addText = "Add a".concat(itemName[0].match(/[aieouAIEOU]/) ? "n" : "", " ").concat(itemName);
39963
39965
  return /*#__PURE__*/React__default.createElement(Box, {
39964
- padding: "0rem 0rem 1.5rem 0rem",
39966
+ padding: listPadding,
39965
39967
  as: "section",
39966
- "aria-labelledby": "li"
39968
+ "aria-labelledby": typeof title === "string" ? "editable-list-".concat(createIdFromString(title)) : "",
39969
+ "aria-label": !title && typeof itemName === "string" ? "editable-list-".concat(createIdFromString(itemName)) : ""
39967
39970
  }, /*#__PURE__*/React__default.createElement(Stack, {
39968
39971
  childGap: "0rem"
39969
39972
  }, title !== "" && /*#__PURE__*/React__default.createElement(Box, {
@@ -39972,7 +39975,8 @@ var EditableList = function EditableList(_ref) {
39972
39975
  as: as,
39973
39976
  weight: titleWeight,
39974
39977
  color: CHARADE_GREY,
39975
- extraStyles: "letter-spacing: 0.29px; font-size: 1.125rem;"
39978
+ extraStyles: "letter-spacing: 0.29px; font-size: 1.125rem;",
39979
+ id: typeof title === "string" ? "editable-list-".concat(createIdFromString(title)) : ""
39976
39980
  }, title)), /*#__PURE__*/React__default.createElement(Box, {
39977
39981
  padding: "0",
39978
39982
  borderRadius: "4px",
@@ -47284,6 +47288,227 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47284
47288
 
47285
47289
  var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$M, "default");
47286
47290
 
47291
+ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
47292
+ var onCheck = _ref.onCheck,
47293
+ isChecked = _ref.isChecked,
47294
+ html = _ref.html,
47295
+ terms = _ref.terms,
47296
+ _ref$error = _ref.error,
47297
+ error = _ref$error === void 0 ? false : _ref$error,
47298
+ linkVariant = _ref.linkVariant;
47299
+
47300
+ var _useState = React.useState(false),
47301
+ _useState2 = _slicedToArray(_useState, 2),
47302
+ showTerms = _useState2[0],
47303
+ toggleShowTerms = _useState2[1];
47304
+
47305
+ return /*#__PURE__*/React__default.createElement(DisplayBox$1, null, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Checkbox$1, {
47306
+ name: "terms",
47307
+ title: "Terms and Conditions",
47308
+ error: error,
47309
+ checked: isChecked,
47310
+ onChange: onCheck
47311
+ }), /*#__PURE__*/React__default.createElement(Box, {
47312
+ padding: "0 0 0 58px"
47313
+ }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
47314
+ padding: "0"
47315
+ }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47316
+ link: "Learn More",
47317
+ terms: terms,
47318
+ isOpen: showTerms,
47319
+ toggleOpen: toggleShowTerms,
47320
+ linkVariant: linkVariant
47321
+ })))));
47322
+ };
47323
+
47324
+ /*
47325
+
47326
+ A utility function that can generate box-shadow values for components
47327
+ Takes a string representing an rgb color value and returns an object
47328
+ with values for standard, inset, and overlay shadows.
47329
+
47330
+ The objects for standard and inset shadows contain versions approiate
47331
+ for base, hover, and active interaction states.
47332
+
47333
+ */
47334
+
47335
+ /*
47336
+ Function to convert string representing rgb color to rgba value with provided opacity
47337
+ ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
47338
+
47339
+ */
47340
+ var rgbToRgba = function rgbToRgba() {
47341
+ var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
47342
+ var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
47343
+
47344
+ if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
47345
+ return "";
47346
+ }
47347
+
47348
+ return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
47349
+ };
47350
+
47351
+ var generateShadows = function generateShadows(baseColorRGB) {
47352
+ var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
47353
+ var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
47354
+ var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
47355
+ var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
47356
+ var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
47357
+ var standard = {
47358
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
47359
+ hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
47360
+ active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
47361
+ };
47362
+ var inset = {
47363
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
47364
+ hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
47365
+ active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
47366
+ };
47367
+ var overlay = {
47368
+ base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
47369
+ };
47370
+ return {
47371
+ standard: standard,
47372
+ inset: inset,
47373
+ overlay: overlay
47374
+ };
47375
+ };
47376
+
47377
+ /*
47378
+ Hook that takes an ID selector for an element on the screen
47379
+ And optionally values for top position, left position, smooth behavior
47380
+ Finds element on screen and scrolls it to the provided coordinates
47381
+
47382
+ (string, number, number, string, number) => undefined;
47383
+ */
47384
+ var useScrollTo = function useScrollTo(id) {
47385
+ var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
47386
+ var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
47387
+ var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
47388
+ var delay = arguments.length > 4 ? arguments[4] : undefined;
47389
+ var scrollItem;
47390
+
47391
+ if (delay) {
47392
+ setTimeout(function () {
47393
+ var _scrollItem;
47394
+
47395
+ scrollItem = document.getElementById(id);
47396
+ (_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
47397
+ top: top,
47398
+ left: left,
47399
+ behavior: behavior
47400
+ });
47401
+ }, delay);
47402
+ } else {
47403
+ var _scrollItem2;
47404
+
47405
+ scrollItem = document.getElementById(id);
47406
+ (_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
47407
+ top: top,
47408
+ left: left,
47409
+ behavior: behavior
47410
+ });
47411
+ }
47412
+ };
47413
+
47414
+ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
47415
+ var _ref$showCheckbox = _ref.showCheckbox,
47416
+ showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
47417
+ onCheck = _ref.onCheck,
47418
+ isChecked = _ref.isChecked,
47419
+ hasError = _ref.hasError,
47420
+ _ref$errorMessage = _ref.errorMessage,
47421
+ errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
47422
+ _ref$description = _ref.description,
47423
+ description = _ref$description === void 0 ? "" : _ref$description,
47424
+ _ref$linkText = _ref.linkText,
47425
+ linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
47426
+ html = _ref.html,
47427
+ terms = _ref.terms,
47428
+ _ref$id = _ref.id,
47429
+ id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
47430
+ _ref$displayInline = _ref.displayInline,
47431
+ displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
47432
+ _ref$modalVariant = _ref.modalVariant,
47433
+ modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
47434
+ _ref$containerBackgro = _ref.containerBackground,
47435
+ containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro,
47436
+ _ref$checkboxMargin = _ref.checkboxMargin,
47437
+ checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
47438
+ _ref$modalTitle = _ref.modalTitle,
47439
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
47440
+
47441
+ var _useState = React.useState(false),
47442
+ _useState2 = _slicedToArray(_useState, 2),
47443
+ showTerms = _useState2[0],
47444
+ toggleShowTerms = _useState2[1];
47445
+
47446
+ var standardBoxShadow = generateShadows().standard.base;
47447
+
47448
+ var toggleTerms = function toggleTerms(termsOpen) {
47449
+ toggleShowTerms(termsOpen);
47450
+
47451
+ if (termsOpen) {
47452
+ useScrollTo("terms-body-text", 0, 0, "smooth", 100);
47453
+ }
47454
+ };
47455
+
47456
+ return /*#__PURE__*/React__default.createElement(Box, {
47457
+ padding: displayInline ? "0" : "1.5rem",
47458
+ minWidth: displayInline ? "0" : "100%",
47459
+ background: displayInline ? "transparent" : containerBackground,
47460
+ boxShadow: displayInline ? "none" : standardBoxShadow,
47461
+ borderRadius: displayInline ? "0" : "4px"
47462
+ }, /*#__PURE__*/React__default.createElement(Stack, {
47463
+ childGap: "0"
47464
+ }, html && /*#__PURE__*/React__default.createElement(Box, {
47465
+ padding: "0"
47466
+ }, html), /*#__PURE__*/React__default.createElement(Cluster, {
47467
+ justify: "flex-start",
47468
+ align: "center",
47469
+ nowrap: true
47470
+ }, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
47471
+ name: id,
47472
+ error: hasError,
47473
+ checked: isChecked,
47474
+ onChange: onCheck,
47475
+ checkboxMargin: checkboxMargin,
47476
+ extraStyles: "align-self: flex-start;"
47477
+ }), /*#__PURE__*/React__default.createElement(Stack, {
47478
+ childGap: "0.25rem",
47479
+ fullHeight: true
47480
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
47481
+ justify: "flex-start",
47482
+ align: "center",
47483
+ nowrap: true,
47484
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
47485
+ }, description && /*#__PURE__*/React__default.createElement(Text$1, {
47486
+ color: CHARADE_GREY
47487
+ }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47488
+ link: linkText,
47489
+ terms: terms,
47490
+ isOpen: showTerms,
47491
+ toggleOpen: toggleTerms,
47492
+ linkVariant: modalVariant,
47493
+ title: modalTitle
47494
+ })), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
47495
+ variant: "pXS",
47496
+ color: ERROR_COLOR,
47497
+ id: "".concat(id, "-error-message")
47498
+ }, errorMessage)))));
47499
+ };
47500
+
47501
+ var _excluded$y = ["version"];
47502
+
47503
+ var TermsAndConditions = function TermsAndConditions(_ref) {
47504
+ var _ref$version = _ref.version,
47505
+ version = _ref$version === void 0 ? "v1" : _ref$version,
47506
+ rest = _objectWithoutProperties(_ref, _excluded$y);
47507
+
47508
+ var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
47509
+ return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
47510
+ };
47511
+
47287
47512
  var PaymentFormACH = function PaymentFormACH(_ref) {
47288
47513
  var _routingNumberErrors, _accountNumberErrors;
47289
47514
 
@@ -47303,9 +47528,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47303
47528
  showWalletCheckbox = _ref.showWalletCheckbox,
47304
47529
  saveToWallet = _ref.saveToWallet,
47305
47530
  walletCheckboxMarked = _ref.walletCheckboxMarked,
47306
- termsContent = _ref.termsContent,
47307
- _ref$termsTitle = _ref.termsTitle,
47308
- termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
47531
+ termsContent = _ref.termsContent;
47309
47532
 
47310
47533
  if (clearOnDismount) {
47311
47534
  React.useEffect(function () {
@@ -47325,13 +47548,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47325
47548
  showAccount = _useState4[0],
47326
47549
  toggleShowAccount = _useState4[1];
47327
47550
 
47328
- var _useState5 = React.useState(false),
47329
- _useState6 = _slicedToArray(_useState5, 2),
47330
- termsModalOpen = _useState6[0],
47331
- setTermsModalOpen = _useState6[1];
47332
-
47333
47551
  var showTerms = !!termsContent;
47334
- var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
47335
47552
 
47336
47553
  var nameErrors = _defineProperty({}, required.error, "Name is required");
47337
47554
 
@@ -47450,18 +47667,12 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47450
47667
  onChange: saveToWallet
47451
47668
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
47452
47669
  singleChild: true
47453
- }, /*#__PURE__*/React__default.createElement(Cluster, {
47454
- childGap: 0
47455
- }, /*#__PURE__*/React__default.createElement(Text$1, {
47456
- variant: showTermsLinkVariant
47457
- }, "View\xA0"), /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47458
- link: termsTitle,
47459
- linkVariant: showTermsLinkVariant,
47460
- terms: termsContent,
47461
- title: termsTitle,
47462
- isOpen: termsModalOpen,
47463
- toggleOpen: setTermsModalOpen
47464
- }))))));
47670
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
47671
+ version: "v2",
47672
+ showCheckbox: false,
47673
+ description: "View",
47674
+ terms: termsContent
47675
+ })))));
47465
47676
  };
47466
47677
 
47467
47678
  var formConfig$6 = {
@@ -47516,20 +47727,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
47516
47727
  saveToWallet = _ref.saveToWallet,
47517
47728
  walletCheckboxMarked = _ref.walletCheckboxMarked,
47518
47729
  deniedCards = _ref.deniedCards,
47519
- termsContent = _ref.termsContent,
47520
- _ref$termsTitle = _ref.termsTitle,
47521
- termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
47730
+ termsContent = _ref.termsContent;
47522
47731
 
47523
47732
  var _useContext = React.useContext(styled.ThemeContext),
47524
47733
  isMobile = _useContext.isMobile;
47525
47734
 
47526
- var _useState = React.useState(false),
47527
- _useState2 = _slicedToArray(_useState, 2),
47528
- termsModalOpen = _useState2[0],
47529
- setTermsModalOpen = _useState2[1];
47530
-
47531
47735
  var showTerms = !!termsContent;
47532
- var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
47533
47736
  React.useEffect(function () {
47534
47737
  if (deniedCards) {
47535
47738
  deniedCards.map(function (card) {
@@ -47647,18 +47850,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
47647
47850
  onChange: saveToWallet
47648
47851
  }), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
47649
47852
  singleChild: true
47650
- }, /*#__PURE__*/React__default.createElement(Cluster, {
47651
- childGap: 0
47652
- }, /*#__PURE__*/React__default.createElement(Text$1, {
47653
- variant: showTermsLinkVariant
47654
- }, "View\xA0"), /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
47655
- link: termsTitle,
47656
- linkVariant: showTermsLinkVariant,
47657
- terms: termsContent,
47658
- title: termsTitle,
47659
- isOpen: termsModalOpen,
47660
- toggleOpen: setTermsModalOpen
47661
- }))))));
47853
+ }, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
47854
+ version: "v2",
47855
+ showCheckbox: false,
47856
+ description: "View",
47857
+ terms: termsContent
47858
+ })))));
47662
47859
  };
47663
47860
 
47664
47861
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
@@ -48568,227 +48765,6 @@ var TabSidebar = function TabSidebar(_ref) {
48568
48765
 
48569
48766
  var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$P);
48570
48767
 
48571
- var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48572
- var onCheck = _ref.onCheck,
48573
- isChecked = _ref.isChecked,
48574
- html = _ref.html,
48575
- terms = _ref.terms,
48576
- _ref$error = _ref.error,
48577
- error = _ref$error === void 0 ? false : _ref$error,
48578
- linkVariant = _ref.linkVariant;
48579
-
48580
- var _useState = React.useState(false),
48581
- _useState2 = _slicedToArray(_useState, 2),
48582
- showTerms = _useState2[0],
48583
- toggleShowTerms = _useState2[1];
48584
-
48585
- return /*#__PURE__*/React__default.createElement(DisplayBox$1, null, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Checkbox$1, {
48586
- name: "terms",
48587
- title: "Terms and Conditions",
48588
- error: error,
48589
- checked: isChecked,
48590
- onChange: onCheck
48591
- }), /*#__PURE__*/React__default.createElement(Box, {
48592
- padding: "0 0 0 58px"
48593
- }, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
48594
- padding: "0"
48595
- }, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48596
- link: "Learn More",
48597
- terms: terms,
48598
- isOpen: showTerms,
48599
- toggleOpen: toggleShowTerms,
48600
- linkVariant: linkVariant
48601
- })))));
48602
- };
48603
-
48604
- /*
48605
-
48606
- A utility function that can generate box-shadow values for components
48607
- Takes a string representing an rgb color value and returns an object
48608
- with values for standard, inset, and overlay shadows.
48609
-
48610
- The objects for standard and inset shadows contain versions approiate
48611
- for base, hover, and active interaction states.
48612
-
48613
- */
48614
-
48615
- /*
48616
- Function to convert string representing rgb color to rgba value with provided opacity
48617
- ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
48618
-
48619
- */
48620
- var rgbToRgba = function rgbToRgba() {
48621
- var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
48622
- var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
48623
-
48624
- if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
48625
- return "";
48626
- }
48627
-
48628
- return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
48629
- };
48630
-
48631
- var generateShadows = function generateShadows(baseColorRGB) {
48632
- var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
48633
- var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
48634
- var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
48635
- var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
48636
- var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
48637
- var standard = {
48638
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48639
- hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
48640
- active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
48641
- };
48642
- var inset = {
48643
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48644
- hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
48645
- active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
48646
- };
48647
- var overlay = {
48648
- base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
48649
- };
48650
- return {
48651
- standard: standard,
48652
- inset: inset,
48653
- overlay: overlay
48654
- };
48655
- };
48656
-
48657
- /*
48658
- Hook that takes an ID selector for an element on the screen
48659
- And optionally values for top position, left position, smooth behavior
48660
- Finds element on screen and scrolls it to the provided coordinates
48661
-
48662
- (string, number, number, string, number) => undefined;
48663
- */
48664
- var useScrollTo = function useScrollTo(id) {
48665
- var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
48666
- var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
48667
- var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
48668
- var delay = arguments.length > 4 ? arguments[4] : undefined;
48669
- var scrollItem;
48670
-
48671
- if (delay) {
48672
- setTimeout(function () {
48673
- var _scrollItem;
48674
-
48675
- scrollItem = document.getElementById(id);
48676
- (_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
48677
- top: top,
48678
- left: left,
48679
- behavior: behavior
48680
- });
48681
- }, delay);
48682
- } else {
48683
- var _scrollItem2;
48684
-
48685
- scrollItem = document.getElementById(id);
48686
- (_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
48687
- top: top,
48688
- left: left,
48689
- behavior: behavior
48690
- });
48691
- }
48692
- };
48693
-
48694
- var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48695
- var _ref$showCheckbox = _ref.showCheckbox,
48696
- showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
48697
- onCheck = _ref.onCheck,
48698
- isChecked = _ref.isChecked,
48699
- hasError = _ref.hasError,
48700
- _ref$errorMessage = _ref.errorMessage,
48701
- errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
48702
- _ref$description = _ref.description,
48703
- description = _ref$description === void 0 ? "" : _ref$description,
48704
- _ref$linkText = _ref.linkText,
48705
- linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
48706
- html = _ref.html,
48707
- terms = _ref.terms,
48708
- _ref$id = _ref.id,
48709
- id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
48710
- _ref$displayInline = _ref.displayInline,
48711
- displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
48712
- _ref$modalVariant = _ref.modalVariant,
48713
- modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
48714
- _ref$containerBackgro = _ref.containerBackground,
48715
- containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro,
48716
- _ref$checkboxMargin = _ref.checkboxMargin,
48717
- checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
48718
- _ref$modalTitle = _ref.modalTitle,
48719
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
48720
-
48721
- var _useState = React.useState(false),
48722
- _useState2 = _slicedToArray(_useState, 2),
48723
- showTerms = _useState2[0],
48724
- toggleShowTerms = _useState2[1];
48725
-
48726
- var standardBoxShadow = generateShadows().standard.base;
48727
-
48728
- var toggleTerms = function toggleTerms(termsOpen) {
48729
- toggleShowTerms(termsOpen);
48730
-
48731
- if (termsOpen) {
48732
- useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48733
- }
48734
- };
48735
-
48736
- return /*#__PURE__*/React__default.createElement(Box, {
48737
- padding: displayInline ? "0" : "1.5rem",
48738
- minWidth: displayInline ? "0" : "100%",
48739
- background: displayInline ? "transparent" : containerBackground,
48740
- boxShadow: displayInline ? "none" : standardBoxShadow,
48741
- borderRadius: displayInline ? "0" : "4px"
48742
- }, /*#__PURE__*/React__default.createElement(Stack, {
48743
- childGap: "0"
48744
- }, html && /*#__PURE__*/React__default.createElement(Box, {
48745
- padding: "0"
48746
- }, html), /*#__PURE__*/React__default.createElement(Cluster, {
48747
- justify: "flex-start",
48748
- align: "center",
48749
- nowrap: true
48750
- }, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48751
- name: id,
48752
- error: hasError,
48753
- checked: isChecked,
48754
- onChange: onCheck,
48755
- checkboxMargin: checkboxMargin,
48756
- extraStyles: "align-self: flex-start;"
48757
- }), /*#__PURE__*/React__default.createElement(Stack, {
48758
- childGap: "0.25rem",
48759
- fullHeight: true
48760
- }, /*#__PURE__*/React__default.createElement(Cluster, {
48761
- justify: "flex-start",
48762
- align: "center",
48763
- nowrap: true,
48764
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
48765
- }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48766
- color: CHARADE_GREY
48767
- }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48768
- link: linkText,
48769
- terms: terms,
48770
- isOpen: showTerms,
48771
- toggleOpen: toggleTerms,
48772
- linkVariant: modalVariant,
48773
- title: modalTitle
48774
- })), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
48775
- variant: "pXS",
48776
- color: ERROR_COLOR,
48777
- id: "".concat(id, "-error-message")
48778
- }, errorMessage)))));
48779
- };
48780
-
48781
- var _excluded$y = ["version"];
48782
-
48783
- var TermsAndConditions = function TermsAndConditions(_ref) {
48784
- var _ref$version = _ref.version,
48785
- version = _ref$version === void 0 ? "v1" : _ref$version,
48786
- rest = _objectWithoutProperties(_ref, _excluded$y);
48787
-
48788
- var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
48789
- return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
48790
- };
48791
-
48792
48768
  var Timeout = function Timeout(_ref) {
48793
48769
  var onLogout = _ref.onLogout;
48794
48770