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