@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.cjs.js +239 -265
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +239 -265
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/payment-form-ach/PaymentFormACH.js +9 -18
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +9 -18
package/dist/index.cjs.js
CHANGED
|
@@ -47288,6 +47288,227 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
|
|
|
47288
47288
|
|
|
47289
47289
|
var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$M, "default");
|
|
47290
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
|
+
|
|
47291
47512
|
var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
47292
47513
|
var _routingNumberErrors, _accountNumberErrors;
|
|
47293
47514
|
|
|
@@ -47307,9 +47528,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47307
47528
|
showWalletCheckbox = _ref.showWalletCheckbox,
|
|
47308
47529
|
saveToWallet = _ref.saveToWallet,
|
|
47309
47530
|
walletCheckboxMarked = _ref.walletCheckboxMarked,
|
|
47310
|
-
termsContent = _ref.termsContent
|
|
47311
|
-
_ref$termsTitle = _ref.termsTitle,
|
|
47312
|
-
termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
|
|
47531
|
+
termsContent = _ref.termsContent;
|
|
47313
47532
|
|
|
47314
47533
|
if (clearOnDismount) {
|
|
47315
47534
|
React.useEffect(function () {
|
|
@@ -47329,13 +47548,7 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47329
47548
|
showAccount = _useState4[0],
|
|
47330
47549
|
toggleShowAccount = _useState4[1];
|
|
47331
47550
|
|
|
47332
|
-
var _useState5 = React.useState(false),
|
|
47333
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
47334
|
-
termsModalOpen = _useState6[0],
|
|
47335
|
-
setTermsModalOpen = _useState6[1];
|
|
47336
|
-
|
|
47337
47551
|
var showTerms = !!termsContent;
|
|
47338
|
-
var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
|
|
47339
47552
|
|
|
47340
47553
|
var nameErrors = _defineProperty({}, required.error, "Name is required");
|
|
47341
47554
|
|
|
@@ -47446,7 +47659,8 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47446
47659
|
checked: defaultMethod.value,
|
|
47447
47660
|
hidden: hideDefaultPayment
|
|
47448
47661
|
}), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
47449
|
-
childGap: "4px"
|
|
47662
|
+
childGap: "4px",
|
|
47663
|
+
align: "center"
|
|
47450
47664
|
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
47451
47665
|
name: "bank checkbox",
|
|
47452
47666
|
title: "Save checking account to wallet.",
|
|
@@ -47454,18 +47668,12 @@ var PaymentFormACH = function PaymentFormACH(_ref) {
|
|
|
47454
47668
|
onChange: saveToWallet
|
|
47455
47669
|
}), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
|
|
47456
47670
|
singleChild: true
|
|
47457
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
47458
|
-
|
|
47459
|
-
|
|
47460
|
-
|
|
47461
|
-
|
|
47462
|
-
|
|
47463
|
-
linkVariant: showTermsLinkVariant,
|
|
47464
|
-
terms: termsContent,
|
|
47465
|
-
title: termsTitle,
|
|
47466
|
-
isOpen: termsModalOpen,
|
|
47467
|
-
toggleOpen: setTermsModalOpen
|
|
47468
|
-
}))))));
|
|
47671
|
+
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
47672
|
+
version: "v2",
|
|
47673
|
+
showCheckbox: false,
|
|
47674
|
+
description: "View",
|
|
47675
|
+
terms: termsContent
|
|
47676
|
+
})))));
|
|
47469
47677
|
};
|
|
47470
47678
|
|
|
47471
47679
|
var formConfig$6 = {
|
|
@@ -47520,20 +47728,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
47520
47728
|
saveToWallet = _ref.saveToWallet,
|
|
47521
47729
|
walletCheckboxMarked = _ref.walletCheckboxMarked,
|
|
47522
47730
|
deniedCards = _ref.deniedCards,
|
|
47523
|
-
termsContent = _ref.termsContent
|
|
47524
|
-
_ref$termsTitle = _ref.termsTitle,
|
|
47525
|
-
termsTitle = _ref$termsTitle === void 0 ? "Terms & Conditions" : _ref$termsTitle;
|
|
47731
|
+
termsContent = _ref.termsContent;
|
|
47526
47732
|
|
|
47527
47733
|
var _useContext = React.useContext(styled.ThemeContext),
|
|
47528
47734
|
isMobile = _useContext.isMobile;
|
|
47529
47735
|
|
|
47530
|
-
var _useState = React.useState(false),
|
|
47531
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
47532
|
-
termsModalOpen = _useState2[0],
|
|
47533
|
-
setTermsModalOpen = _useState2[1];
|
|
47534
|
-
|
|
47535
47736
|
var showTerms = !!termsContent;
|
|
47536
|
-
var showTermsLinkVariant = showWalletCheckbox ? "p" : "pS";
|
|
47537
47737
|
React.useEffect(function () {
|
|
47538
47738
|
if (deniedCards) {
|
|
47539
47739
|
deniedCards.map(function (card) {
|
|
@@ -47643,7 +47843,8 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
47643
47843
|
},
|
|
47644
47844
|
autocomplete: "billing postal-code"
|
|
47645
47845
|
})), (showWalletCheckbox || showTerms) && /*#__PURE__*/React__default.createElement(Cluster, {
|
|
47646
|
-
childGap: "4px"
|
|
47846
|
+
childGap: "4px",
|
|
47847
|
+
align: "center"
|
|
47647
47848
|
}, showWalletCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
47648
47849
|
name: "credit card checkbox",
|
|
47649
47850
|
title: "Save credit card to wallet.",
|
|
@@ -47651,18 +47852,12 @@ var PaymentFormCard = function PaymentFormCard(_ref) {
|
|
|
47651
47852
|
onChange: saveToWallet
|
|
47652
47853
|
}), showTerms && /*#__PURE__*/React__default.createElement(Cover, {
|
|
47653
47854
|
singleChild: true
|
|
47654
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
47655
|
-
|
|
47656
|
-
|
|
47657
|
-
|
|
47658
|
-
|
|
47659
|
-
|
|
47660
|
-
linkVariant: showTermsLinkVariant,
|
|
47661
|
-
terms: termsContent,
|
|
47662
|
-
title: termsTitle,
|
|
47663
|
-
isOpen: termsModalOpen,
|
|
47664
|
-
toggleOpen: setTermsModalOpen
|
|
47665
|
-
}))))));
|
|
47855
|
+
}, /*#__PURE__*/React__default.createElement(TermsAndConditions, {
|
|
47856
|
+
version: "v2",
|
|
47857
|
+
showCheckbox: false,
|
|
47858
|
+
description: "View",
|
|
47859
|
+
terms: termsContent
|
|
47860
|
+
})))));
|
|
47666
47861
|
};
|
|
47667
47862
|
|
|
47668
47863
|
var PaymentFormCard$1 = withWindowSize(PaymentFormCard);
|
|
@@ -48572,227 +48767,6 @@ var TabSidebar = function TabSidebar(_ref) {
|
|
|
48572
48767
|
|
|
48573
48768
|
var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$P);
|
|
48574
48769
|
|
|
48575
|
-
var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
48576
|
-
var onCheck = _ref.onCheck,
|
|
48577
|
-
isChecked = _ref.isChecked,
|
|
48578
|
-
html = _ref.html,
|
|
48579
|
-
terms = _ref.terms,
|
|
48580
|
-
_ref$error = _ref.error,
|
|
48581
|
-
error = _ref$error === void 0 ? false : _ref$error,
|
|
48582
|
-
linkVariant = _ref.linkVariant;
|
|
48583
|
-
|
|
48584
|
-
var _useState = React.useState(false),
|
|
48585
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48586
|
-
showTerms = _useState2[0],
|
|
48587
|
-
toggleShowTerms = _useState2[1];
|
|
48588
|
-
|
|
48589
|
-
return /*#__PURE__*/React__default.createElement(DisplayBox$1, null, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48590
|
-
name: "terms",
|
|
48591
|
-
title: "Terms and Conditions",
|
|
48592
|
-
error: error,
|
|
48593
|
-
checked: isChecked,
|
|
48594
|
-
onChange: onCheck
|
|
48595
|
-
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
48596
|
-
padding: "0 0 0 58px"
|
|
48597
|
-
}, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
48598
|
-
padding: "0"
|
|
48599
|
-
}, html), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
48600
|
-
link: "Learn More",
|
|
48601
|
-
terms: terms,
|
|
48602
|
-
isOpen: showTerms,
|
|
48603
|
-
toggleOpen: toggleShowTerms,
|
|
48604
|
-
linkVariant: linkVariant
|
|
48605
|
-
})))));
|
|
48606
|
-
};
|
|
48607
|
-
|
|
48608
|
-
/*
|
|
48609
|
-
|
|
48610
|
-
A utility function that can generate box-shadow values for components
|
|
48611
|
-
Takes a string representing an rgb color value and returns an object
|
|
48612
|
-
with values for standard, inset, and overlay shadows.
|
|
48613
|
-
|
|
48614
|
-
The objects for standard and inset shadows contain versions approiate
|
|
48615
|
-
for base, hover, and active interaction states.
|
|
48616
|
-
|
|
48617
|
-
*/
|
|
48618
|
-
|
|
48619
|
-
/*
|
|
48620
|
-
Function to convert string representing rgb color to rgba value with provided opacity
|
|
48621
|
-
("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
|
|
48622
|
-
|
|
48623
|
-
*/
|
|
48624
|
-
var rgbToRgba = function rgbToRgba() {
|
|
48625
|
-
var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
48626
|
-
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
48627
|
-
|
|
48628
|
-
if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
|
|
48629
|
-
return "";
|
|
48630
|
-
}
|
|
48631
|
-
|
|
48632
|
-
return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
|
|
48633
|
-
};
|
|
48634
|
-
|
|
48635
|
-
var generateShadows = function generateShadows(baseColorRGB) {
|
|
48636
|
-
var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
|
|
48637
|
-
var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
|
|
48638
|
-
var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
|
|
48639
|
-
var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
|
|
48640
|
-
var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
|
|
48641
|
-
var standard = {
|
|
48642
|
-
base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
|
|
48643
|
-
hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
|
|
48644
|
-
active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
|
|
48645
|
-
};
|
|
48646
|
-
var inset = {
|
|
48647
|
-
base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
|
|
48648
|
-
hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
|
|
48649
|
-
active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
|
|
48650
|
-
};
|
|
48651
|
-
var overlay = {
|
|
48652
|
-
base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
|
|
48653
|
-
};
|
|
48654
|
-
return {
|
|
48655
|
-
standard: standard,
|
|
48656
|
-
inset: inset,
|
|
48657
|
-
overlay: overlay
|
|
48658
|
-
};
|
|
48659
|
-
};
|
|
48660
|
-
|
|
48661
|
-
/*
|
|
48662
|
-
Hook that takes an ID selector for an element on the screen
|
|
48663
|
-
And optionally values for top position, left position, smooth behavior
|
|
48664
|
-
Finds element on screen and scrolls it to the provided coordinates
|
|
48665
|
-
|
|
48666
|
-
(string, number, number, string, number) => undefined;
|
|
48667
|
-
*/
|
|
48668
|
-
var useScrollTo = function useScrollTo(id) {
|
|
48669
|
-
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48670
|
-
var left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
48671
|
-
var behavior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "auto";
|
|
48672
|
-
var delay = arguments.length > 4 ? arguments[4] : undefined;
|
|
48673
|
-
var scrollItem;
|
|
48674
|
-
|
|
48675
|
-
if (delay) {
|
|
48676
|
-
setTimeout(function () {
|
|
48677
|
-
var _scrollItem;
|
|
48678
|
-
|
|
48679
|
-
scrollItem = document.getElementById(id);
|
|
48680
|
-
(_scrollItem = scrollItem) === null || _scrollItem === void 0 ? void 0 : _scrollItem.scrollTo({
|
|
48681
|
-
top: top,
|
|
48682
|
-
left: left,
|
|
48683
|
-
behavior: behavior
|
|
48684
|
-
});
|
|
48685
|
-
}, delay);
|
|
48686
|
-
} else {
|
|
48687
|
-
var _scrollItem2;
|
|
48688
|
-
|
|
48689
|
-
scrollItem = document.getElementById(id);
|
|
48690
|
-
(_scrollItem2 = scrollItem) === null || _scrollItem2 === void 0 ? void 0 : _scrollItem2.scrollTo({
|
|
48691
|
-
top: top,
|
|
48692
|
-
left: left,
|
|
48693
|
-
behavior: behavior
|
|
48694
|
-
});
|
|
48695
|
-
}
|
|
48696
|
-
};
|
|
48697
|
-
|
|
48698
|
-
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48699
|
-
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48700
|
-
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
48701
|
-
onCheck = _ref.onCheck,
|
|
48702
|
-
isChecked = _ref.isChecked,
|
|
48703
|
-
hasError = _ref.hasError,
|
|
48704
|
-
_ref$errorMessage = _ref.errorMessage,
|
|
48705
|
-
errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
|
|
48706
|
-
_ref$description = _ref.description,
|
|
48707
|
-
description = _ref$description === void 0 ? "" : _ref$description,
|
|
48708
|
-
_ref$linkText = _ref.linkText,
|
|
48709
|
-
linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
|
|
48710
|
-
html = _ref.html,
|
|
48711
|
-
terms = _ref.terms,
|
|
48712
|
-
_ref$id = _ref.id,
|
|
48713
|
-
id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
|
|
48714
|
-
_ref$displayInline = _ref.displayInline,
|
|
48715
|
-
displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
|
|
48716
|
-
_ref$modalVariant = _ref.modalVariant,
|
|
48717
|
-
modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
|
|
48718
|
-
_ref$containerBackgro = _ref.containerBackground,
|
|
48719
|
-
containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro,
|
|
48720
|
-
_ref$checkboxMargin = _ref.checkboxMargin,
|
|
48721
|
-
checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
|
|
48722
|
-
_ref$modalTitle = _ref.modalTitle,
|
|
48723
|
-
modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
|
|
48724
|
-
|
|
48725
|
-
var _useState = React.useState(false),
|
|
48726
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
48727
|
-
showTerms = _useState2[0],
|
|
48728
|
-
toggleShowTerms = _useState2[1];
|
|
48729
|
-
|
|
48730
|
-
var standardBoxShadow = generateShadows().standard.base;
|
|
48731
|
-
|
|
48732
|
-
var toggleTerms = function toggleTerms(termsOpen) {
|
|
48733
|
-
toggleShowTerms(termsOpen);
|
|
48734
|
-
|
|
48735
|
-
if (termsOpen) {
|
|
48736
|
-
useScrollTo("terms-body-text", 0, 0, "smooth", 100);
|
|
48737
|
-
}
|
|
48738
|
-
};
|
|
48739
|
-
|
|
48740
|
-
return /*#__PURE__*/React__default.createElement(Box, {
|
|
48741
|
-
padding: displayInline ? "0" : "1.5rem",
|
|
48742
|
-
minWidth: displayInline ? "0" : "100%",
|
|
48743
|
-
background: displayInline ? "transparent" : containerBackground,
|
|
48744
|
-
boxShadow: displayInline ? "none" : standardBoxShadow,
|
|
48745
|
-
borderRadius: displayInline ? "0" : "4px"
|
|
48746
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
48747
|
-
childGap: "0"
|
|
48748
|
-
}, html && /*#__PURE__*/React__default.createElement(Box, {
|
|
48749
|
-
padding: "0"
|
|
48750
|
-
}, html), /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48751
|
-
justify: "flex-start",
|
|
48752
|
-
align: "center",
|
|
48753
|
-
nowrap: true
|
|
48754
|
-
}, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
|
|
48755
|
-
name: id,
|
|
48756
|
-
error: hasError,
|
|
48757
|
-
checked: isChecked,
|
|
48758
|
-
onChange: onCheck,
|
|
48759
|
-
checkboxMargin: checkboxMargin,
|
|
48760
|
-
extraStyles: "align-self: flex-start;"
|
|
48761
|
-
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
48762
|
-
childGap: "0.25rem",
|
|
48763
|
-
fullHeight: true
|
|
48764
|
-
}, /*#__PURE__*/React__default.createElement(Cluster, {
|
|
48765
|
-
justify: "flex-start",
|
|
48766
|
-
align: "center",
|
|
48767
|
-
nowrap: true,
|
|
48768
|
-
extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
|
|
48769
|
-
}, description && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48770
|
-
color: CHARADE_GREY
|
|
48771
|
-
}, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
|
|
48772
|
-
link: linkText,
|
|
48773
|
-
terms: terms,
|
|
48774
|
-
isOpen: showTerms,
|
|
48775
|
-
toggleOpen: toggleTerms,
|
|
48776
|
-
linkVariant: modalVariant,
|
|
48777
|
-
title: modalTitle
|
|
48778
|
-
})), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
|
|
48779
|
-
variant: "pXS",
|
|
48780
|
-
color: ERROR_COLOR,
|
|
48781
|
-
id: "".concat(id, "-error-message")
|
|
48782
|
-
}, errorMessage)))));
|
|
48783
|
-
};
|
|
48784
|
-
|
|
48785
|
-
var _excluded$y = ["version"];
|
|
48786
|
-
|
|
48787
|
-
var TermsAndConditions = function TermsAndConditions(_ref) {
|
|
48788
|
-
var _ref$version = _ref.version,
|
|
48789
|
-
version = _ref$version === void 0 ? "v1" : _ref$version,
|
|
48790
|
-
rest = _objectWithoutProperties(_ref, _excluded$y);
|
|
48791
|
-
|
|
48792
|
-
var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
|
|
48793
|
-
return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
|
|
48794
|
-
};
|
|
48795
|
-
|
|
48796
48770
|
var Timeout = function Timeout(_ref) {
|
|
48797
48771
|
var onLogout = _ref.onLogout;
|
|
48798
48772
|
|