@thecb/components 7.10.3 → 7.10.4-beta.1

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
@@ -47280,6 +47280,227 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47280
47280
 
47281
47281
  var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$M, "default");
47282
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
+
47283
47504
  var PaymentFormACH = function PaymentFormACH(_ref) {
47284
47505
  var _routingNumberErrors, _accountNumberErrors;
47285
47506
 
@@ -47299,9 +47520,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47299
47520
  showWalletCheckbox = _ref.showWalletCheckbox,
47300
47521
  saveToWallet = _ref.saveToWallet,
47301
47522
  walletCheckboxMarked = _ref.walletCheckboxMarked,
47302
- termsContent = _ref.termsContent,
47303
- _ref$termsTitle = _ref.termsTitle,
47304
- termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
47523
+ termsContent = _ref.termsContent;
47305
47524
 
47306
47525
  if (clearOnDismount) {
47307
47526
  useEffect$1(function () {
@@ -47321,13 +47540,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47321
47540
  showAccount = _useState4[0],
47322
47541
  toggleShowAccount = _useState4[1];
47323
47542
 
47324
- var _useState5 = useState(false),
47325
- _useState6 = _slicedToArray(_useState5, 2),
47326
- termsModalOpen = _useState6[0],
47327
- setTermsModalOpen = _useState6[1];
47328
-
47329
47543
  var showTerms = !!termsContent;
47330
- var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
47331
47544
 
47332
47545
  var nameErrors = _defineProperty({}, required.error, "Name is required");
47333
47546
 
@@ -47438,7 +47651,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47438
47651
  checked: defaultMethod.value,
47439
47652
  hidden: hideDefaultPayment
47440
47653
  }), (showWalletCheckbox || showTerms) && /*#__PURE__*/React.createElement(Cluster, {
47441
- childGap: "4px"
47654
+ childGap: "4px",
47655
+ align: "center"
47442
47656
  }, showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
47443
47657
  name: "bank checkbox",
47444
47658
  title: "Save checking account to wallet.",
@@ -47446,18 +47660,12 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
47446
47660
  onChange: saveToWallet
47447
47661
  }), showTerms && /*#__PURE__*/React.createElement(Cover, {
47448
47662
  singleChild: true
47449
- }, /*#__PURE__*/React.createElement(Cluster, {
47450
- childGap: 0
47451
- }, /*#__PURE__*/React.createElement(Text$1, {
47452
- variant: showTermsLinkVariant
47453
- }, "View\xA0"), /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
47454
- link: termsTitle,
47455
- linkVariant: showTermsLinkVariant,
47456
- terms: termsContent,
47457
- title: termsTitle,
47458
- isOpen: termsModalOpen,
47459
- toggleOpen: setTermsModalOpen
47460
- }))))));
47663
+ }, /*#__PURE__*/React.createElement(TermsAndConditions, {
47664
+ version: "v2",
47665
+ showCheckbox: false,
47666
+ description: "View",
47667
+ terms: termsContent
47668
+ })))));
47461
47669
  };
47462
47670
 
47463
47671
  var formConfig$6 = {
@@ -47512,20 +47720,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
47512
47720
  saveToWallet = _ref.saveToWallet,
47513
47721
  walletCheckboxMarked = _ref.walletCheckboxMarked,
47514
47722
  deniedCards = _ref.deniedCards,
47515
- termsContent = _ref.termsContent,
47516
- _ref$termsTitle = _ref.termsTitle,
47517
- termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
47723
+ termsContent = _ref.termsContent;
47518
47724
 
47519
47725
  var _useContext = useContext(ThemeContext),
47520
47726
  isMobile = _useContext.isMobile;
47521
47727
 
47522
- var _useState = useState(false),
47523
- _useState2 = _slicedToArray(_useState, 2),
47524
- termsModalOpen = _useState2[0],
47525
- setTermsModalOpen = _useState2[1];
47526
-
47527
47728
  var showTerms = !!termsContent;
47528
- var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
47529
47729
  useEffect$1(function () {
47530
47730
  if (deniedCards) {
47531
47731
  deniedCards.map(function (card) {
@@ -47635,7 +47835,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
47635
47835
  },
47636
47836
  autocomplete: "billing postal-code"
47637
47837
  })), (showWalletCheckbox || showTerms) && /*#__PURE__*/React.createElement(Cluster, {
47638
- childGap: "4px"
47838
+ childGap: "4px",
47839
+ align: "center"
47639
47840
  }, showWalletCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
47640
47841
  name: "credit card checkbox",
47641
47842
  title: "Save credit card to wallet.",
@@ -47643,18 +47844,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
47643
47844
  onChange: saveToWallet
47644
47845
  }), showTerms && /*#__PURE__*/React.createElement(Cover, {
47645
47846
  singleChild: true
47646
- }, /*#__PURE__*/React.createElement(Cluster, {
47647
- childGap: 0
47648
- }, /*#__PURE__*/React.createElement(Text$1, {
47649
- variant: showTermsLinkVariant
47650
- }, "View\xA0"), /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
47651
- link: termsTitle,
47652
- linkVariant: showTermsLinkVariant,
47653
- terms: termsContent,
47654
- title: termsTitle,
47655
- isOpen: termsModalOpen,
47656
- toggleOpen: setTermsModalOpen
47657
- }))))));
47847
+ }, /*#__PURE__*/React.createElement(TermsAndConditions, {
47848
+ version: "v2",
47849
+ showCheckbox: false,
47850
+ description: "View",
47851
+ terms: termsContent
47852
+ })))));
47658
47853
  };
47659
47854
 
47660
47855
  var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
@@ -48564,227 +48759,6 @@ var TabSidebar = function TabSidebar(_ref) {
48564
48759
 
48565
48760
  var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$P);
48566
48761
 
48567
- var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48568
- var onCheck = _ref.onCheck,
48569
- isChecked = _ref.isChecked,
48570
- html = _ref.html,
48571
- terms = _ref.terms,
48572
- _ref$error = _ref.error,
48573
- error = _ref$error === void 0 ? false : _ref$error,
48574
- linkVariant = _ref.linkVariant;
48575
-
48576
- var _useState = useState(false),
48577
- _useState2 = _slicedToArray(_useState, 2),
48578
- showTerms = _useState2[0],
48579
- toggleShowTerms = _useState2[1];
48580
-
48581
- return /*#__PURE__*/React.createElement(DisplayBox$1, null, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Checkbox$1, {
48582
- name: "terms",
48583
- title: "Terms and Conditions",
48584
- error: error,
48585
- checked: isChecked,
48586
- onChange: onCheck
48587
- }), /*#__PURE__*/React.createElement(Box, {
48588
- padding: "0 0 0 58px"
48589
- }, /*#__PURE__*/React.createElement(Stack, null, /*#__PURE__*/React.createElement(Box, {
48590
- padding: "0"
48591
- }, html), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
48592
- link: "Learn More",
48593
- terms: terms,
48594
- isOpen: showTerms,
48595
- toggleOpen: toggleShowTerms,
48596
- linkVariant: linkVariant
48597
- })))));
48598
- };
48599
-
48600
- /*
48601
-
48602
- A utility function that can generate box-shadow values for components
48603
- Takes a string representing an rgb color value and returns an object
48604
- with values for standard, inset, and overlay shadows.
48605
-
48606
- The objects for standard and inset shadows contain versions approiate
48607
- for base, hover, and active interaction states.
48608
-
48609
- */
48610
-
48611
- /*
48612
- Function to convert string representing rgb color to rgba value with provided opacity
48613
- ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
48614
-
48615
- */
48616
- var rgbToRgba = function rgbToRgba() {
48617
- var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
48618
- var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
48619
-
48620
- if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
48621
- return "";
48622
- }
48623
-
48624
- return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
48625
- };
48626
-
48627
- var generateShadows = function generateShadows(baseColorRGB) {
48628
- var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
48629
- var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
48630
- var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
48631
- var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
48632
- var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
48633
- var standard = {
48634
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48635
- hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
48636
- active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
48637
- };
48638
- var inset = {
48639
- base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48640
- hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
48641
- active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
48642
- };
48643
- var overlay = {
48644
- base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
48645
- };
48646
- return {
48647
- standard: standard,
48648
- inset: inset,
48649
- overlay: overlay
48650
- };
48651
- };
48652
-
48653
- /*
48654
- Hook that takes an ID selector for an element on the screen
48655
- And optionally values for top position, left position, smooth behavior
48656
- Finds element on screen and scrolls it to the provided coordinates
48657
-
48658
- (string, number, number, string, number) => undefined;
48659
- */
48660
- var useScrollTo = function useScrollTo(id) {
48661
- var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
48662
- var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
48663
- var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
48664
- var delay = arguments.length > 4 ? arguments[4] : undefined;
48665
- var scrollItem;
48666
-
48667
- if (delay) {
48668
- setTimeout(function () {
48669
- var _scrollItem;
48670
-
48671
- scrollItem = document.getElementById(id);
48672
- (_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
48673
- top: top,
48674
- left: left,
48675
- behavior: behavior
48676
- });
48677
- }, delay);
48678
- } else {
48679
- var _scrollItem2;
48680
-
48681
- scrollItem = document.getElementById(id);
48682
- (_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
48683
- top: top,
48684
- left: left,
48685
- behavior: behavior
48686
- });
48687
- }
48688
- };
48689
-
48690
- var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48691
- var _ref$showCheckbox = _ref.showCheckbox,
48692
- showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
48693
- onCheck = _ref.onCheck,
48694
- isChecked = _ref.isChecked,
48695
- hasError = _ref.hasError,
48696
- _ref$errorMessage = _ref.errorMessage,
48697
- errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
48698
- _ref$description = _ref.description,
48699
- description = _ref$description === void 0 ? "" : _ref$description,
48700
- _ref$linkText = _ref.linkText,
48701
- linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
48702
- html = _ref.html,
48703
- terms = _ref.terms,
48704
- _ref$id = _ref.id,
48705
- id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
48706
- _ref$displayInline = _ref.displayInline,
48707
- displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
48708
- _ref$modalVariant = _ref.modalVariant,
48709
- modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
48710
- _ref$containerBackgro = _ref.containerBackground,
48711
- containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro,
48712
- _ref$checkboxMargin = _ref.checkboxMargin,
48713
- checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
48714
- _ref$modalTitle = _ref.modalTitle,
48715
- modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
48716
-
48717
- var _useState = useState(false),
48718
- _useState2 = _slicedToArray(_useState, 2),
48719
- showTerms = _useState2[0],
48720
- toggleShowTerms = _useState2[1];
48721
-
48722
- var standardBoxShadow = generateShadows().standard.base;
48723
-
48724
- var toggleTerms = function toggleTerms(termsOpen) {
48725
- toggleShowTerms(termsOpen);
48726
-
48727
- if (termsOpen) {
48728
- useScrollTo("terms-body-text", 0, 0, "smooth", 100);
48729
- }
48730
- };
48731
-
48732
- return /*#__PURE__*/React.createElement(Box, {
48733
- padding: displayInline ? "0" : "1.5rem",
48734
- minWidth: displayInline ? "0" : "100%",
48735
- background: displayInline ? "transparent" : containerBackground,
48736
- boxShadow: displayInline ? "none" : standardBoxShadow,
48737
- borderRadius: displayInline ? "0" : "4px"
48738
- }, /*#__PURE__*/React.createElement(Stack, {
48739
- childGap: "0"
48740
- }, html && /*#__PURE__*/React.createElement(Box, {
48741
- padding: "0"
48742
- }, html), /*#__PURE__*/React.createElement(Cluster, {
48743
- justify: "flex-start",
48744
- align: "center",
48745
- nowrap: true
48746
- }, showCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
48747
- name: id,
48748
- error: hasError,
48749
- checked: isChecked,
48750
- onChange: onCheck,
48751
- checkboxMargin: checkboxMargin,
48752
- extraStyles: "align-self: flex-start;"
48753
- }), /*#__PURE__*/React.createElement(Stack, {
48754
- childGap: "0.25rem",
48755
- fullHeight: true
48756
- }, /*#__PURE__*/React.createElement(Cluster, {
48757
- justify: "flex-start",
48758
- align: "center",
48759
- nowrap: true,
48760
- extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
48761
- }, description && /*#__PURE__*/React.createElement(Text$1, {
48762
- color: CHARADE_GREY
48763
- }, description), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
48764
- link: linkText,
48765
- terms: terms,
48766
- isOpen: showTerms,
48767
- toggleOpen: toggleTerms,
48768
- linkVariant: modalVariant,
48769
- title: modalTitle
48770
- })), showCheckbox && hasError && /*#__PURE__*/React.createElement(Text$1, {
48771
- variant: "pXS",
48772
- color: ERROR_COLOR,
48773
- id: "".concat(id, "-error-message")
48774
- }, errorMessage)))));
48775
- };
48776
-
48777
- var _excluded$y = ["version"];
48778
-
48779
- var TermsAndConditions = function TermsAndConditions(_ref) {
48780
- var _ref$version = _ref.version,
48781
- version = _ref$version === void 0 ? "v1" : _ref$version,
48782
- rest = _objectWithoutProperties(_ref, _excluded$y);
48783
-
48784
- var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
48785
- return /*#__PURE__*/React.createElement(TermsAndConditionsControl, rest);
48786
- };
48787
-
48788
48762
  var Timeout = function Timeout(_ref) {
48789
48763
  var onLogout = _ref.onLogout;
48790
48764