@thecb/components 7.9.2 → 7.9.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 +135 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +135 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/checkbox/Checkbox.js +1 -1
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditions.js +10 -41
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV1.js +45 -0
- package/src/components/molecules/terms-and-conditions/TermsAndConditionsControlV2.js +82 -0
- package/src/util/generateShadows.js +60 -0
package/dist/index.esm.js
CHANGED
|
@@ -21070,7 +21070,7 @@ var Checkbox = function Checkbox(_ref4) {
|
|
|
21070
21070
|
onChange: onChange,
|
|
21071
21071
|
tabIndex: "-1",
|
|
21072
21072
|
"aria-invalid": error,
|
|
21073
|
-
"aria-describedby": "".concat(name, "-error-message")
|
|
21073
|
+
"aria-describedby": error ? "".concat(name, "-error-message") : ""
|
|
21074
21074
|
}), /*#__PURE__*/React.createElement(StyledCheckbox, {
|
|
21075
21075
|
error: error,
|
|
21076
21076
|
disabled: disabled,
|
|
@@ -48532,7 +48532,7 @@ var TabSidebar = function TabSidebar(_ref) {
|
|
|
48532
48532
|
|
|
48533
48533
|
var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$P);
|
|
48534
48534
|
|
|
48535
|
-
var
|
|
48535
|
+
var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
|
|
48536
48536
|
var onCheck = _ref.onCheck,
|
|
48537
48537
|
isChecked = _ref.isChecked,
|
|
48538
48538
|
html = _ref.html,
|
|
@@ -48565,6 +48565,139 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
|
|
|
48565
48565
|
})))));
|
|
48566
48566
|
};
|
|
48567
48567
|
|
|
48568
|
+
/*
|
|
48569
|
+
|
|
48570
|
+
A utility function that can generate box-shadow values for components
|
|
48571
|
+
Takes a string representing an rgb color value and returns an object
|
|
48572
|
+
with values for standard, inset, and overlay shadows.
|
|
48573
|
+
|
|
48574
|
+
The objects for standard and inset shadows contain versions approiate
|
|
48575
|
+
for base, hover, and active interaction states.
|
|
48576
|
+
|
|
48577
|
+
*/
|
|
48578
|
+
|
|
48579
|
+
/*
|
|
48580
|
+
Function to convert string representing rgb color to rgba value with provided opacity
|
|
48581
|
+
("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
|
|
48582
|
+
|
|
48583
|
+
*/
|
|
48584
|
+
var rgbToRgba = function rgbToRgba() {
|
|
48585
|
+
var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
48586
|
+
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
48587
|
+
|
|
48588
|
+
if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
|
|
48589
|
+
return "";
|
|
48590
|
+
}
|
|
48591
|
+
|
|
48592
|
+
return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
|
|
48593
|
+
};
|
|
48594
|
+
|
|
48595
|
+
var generateShadows = function generateShadows(baseColorRGB) {
|
|
48596
|
+
var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
|
|
48597
|
+
var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
|
|
48598
|
+
var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
|
|
48599
|
+
var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
|
|
48600
|
+
var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
|
|
48601
|
+
var standard = {
|
|
48602
|
+
base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
|
|
48603
|
+
hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
|
|
48604
|
+
active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
|
|
48605
|
+
};
|
|
48606
|
+
var inset = {
|
|
48607
|
+
base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
|
|
48608
|
+
hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
|
|
48609
|
+
active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
|
|
48610
|
+
};
|
|
48611
|
+
var overlay = {
|
|
48612
|
+
base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
|
|
48613
|
+
};
|
|
48614
|
+
return {
|
|
48615
|
+
standard: standard,
|
|
48616
|
+
inset: inset,
|
|
48617
|
+
overlay: overlay
|
|
48618
|
+
};
|
|
48619
|
+
};
|
|
48620
|
+
|
|
48621
|
+
var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
|
|
48622
|
+
var _ref$showCheckbox = _ref.showCheckbox,
|
|
48623
|
+
showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
|
|
48624
|
+
onCheck = _ref.onCheck,
|
|
48625
|
+
isChecked = _ref.isChecked,
|
|
48626
|
+
hasError = _ref.hasError,
|
|
48627
|
+
_ref$errorMessage = _ref.errorMessage,
|
|
48628
|
+
errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
|
|
48629
|
+
_ref$description = _ref.description,
|
|
48630
|
+
description = _ref$description === void 0 ? "" : _ref$description,
|
|
48631
|
+
_ref$linkText = _ref.linkText,
|
|
48632
|
+
linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
|
|
48633
|
+
html = _ref.html,
|
|
48634
|
+
terms = _ref.terms,
|
|
48635
|
+
_ref$id = _ref.id,
|
|
48636
|
+
id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
|
|
48637
|
+
_ref$displayInline = _ref.displayInline,
|
|
48638
|
+
displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
|
|
48639
|
+
_ref$modalVariant = _ref.modalVariant,
|
|
48640
|
+
modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
|
|
48641
|
+
_ref$containerBackgro = _ref.containerBackground,
|
|
48642
|
+
containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro;
|
|
48643
|
+
|
|
48644
|
+
var _useState = useState(false),
|
|
48645
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
48646
|
+
showTerms = _useState2[0],
|
|
48647
|
+
toggleShowTerms = _useState2[1];
|
|
48648
|
+
|
|
48649
|
+
var standardBoxShadow = generateShadows().standard.base;
|
|
48650
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
48651
|
+
padding: displayInline ? "0" : "1.5rem",
|
|
48652
|
+
minWidth: displayInline ? "0" : "100%",
|
|
48653
|
+
background: displayInline ? "transparent" : containerBackground,
|
|
48654
|
+
boxShadow: displayInline ? "none" : standardBoxShadow,
|
|
48655
|
+
borderRadius: displayInline ? "0" : "4px"
|
|
48656
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
48657
|
+
childGap: "0.25rem"
|
|
48658
|
+
}, html && /*#__PURE__*/React.createElement(Box, {
|
|
48659
|
+
padding: "0"
|
|
48660
|
+
}, html), /*#__PURE__*/React.createElement(Cluster, {
|
|
48661
|
+
justify: "flex-start",
|
|
48662
|
+
align: "center",
|
|
48663
|
+
nowrap: true
|
|
48664
|
+
}, showCheckbox && /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
48665
|
+
name: id,
|
|
48666
|
+
error: hasError,
|
|
48667
|
+
checked: isChecked,
|
|
48668
|
+
onChange: onCheck
|
|
48669
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
48670
|
+
childGap: "0.25rem"
|
|
48671
|
+
}, /*#__PURE__*/React.createElement(Cluster, {
|
|
48672
|
+
justify: "flex-start",
|
|
48673
|
+
align: "center",
|
|
48674
|
+
nowrap: true
|
|
48675
|
+
}, description && /*#__PURE__*/React.createElement(Text$1, {
|
|
48676
|
+
color: CHARADE_GREY
|
|
48677
|
+
}, description, "\xA0"), terms && /*#__PURE__*/React.createElement(TermsAndConditionsModal$1, {
|
|
48678
|
+
link: linkText,
|
|
48679
|
+
terms: terms,
|
|
48680
|
+
isOpen: showTerms,
|
|
48681
|
+
toggleOpen: toggleShowTerms,
|
|
48682
|
+
linkVariant: modalVariant
|
|
48683
|
+
})), showCheckbox && hasError && /*#__PURE__*/React.createElement(Text$1, {
|
|
48684
|
+
variant: "pXS",
|
|
48685
|
+
color: ERROR_COLOR,
|
|
48686
|
+
id: "".concat(id, "-error-message")
|
|
48687
|
+
}, errorMessage)))));
|
|
48688
|
+
};
|
|
48689
|
+
|
|
48690
|
+
var _excluded$y = ["version"];
|
|
48691
|
+
|
|
48692
|
+
var TermsAndConditions = function TermsAndConditions(_ref) {
|
|
48693
|
+
var _ref$version = _ref.version,
|
|
48694
|
+
version = _ref$version === void 0 ? "v1" : _ref$version,
|
|
48695
|
+
rest = _objectWithoutProperties(_ref, _excluded$y);
|
|
48696
|
+
|
|
48697
|
+
var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
|
|
48698
|
+
return /*#__PURE__*/React.createElement(TermsAndConditionsControl, rest);
|
|
48699
|
+
};
|
|
48700
|
+
|
|
48568
48701
|
var Timeout = function Timeout(_ref) {
|
|
48569
48702
|
var onLogout = _ref.onLogout;
|
|
48570
48703
|
|