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