@thecb/components 7.10.0 → 7.10.1-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 CHANGED
@@ -14740,26 +14740,6 @@ var FailedIcon = function FailedIcon() {
14740
14740
  }))));
14741
14741
  };
14742
14742
 
14743
- var PencilIcon = function PencilIcon(_ref) {
14744
- var _ref$ariaLabel = _ref.ariaLabel,
14745
- ariaLabel = _ref$ariaLabel === void 0 ? "Edit" : _ref$ariaLabel,
14746
- themeValues = _ref.themeValues;
14747
- return /*#__PURE__*/React__default.createElement("svg", {
14748
- "aria-label": ariaLabel,
14749
- width: "24px",
14750
- height: "24px",
14751
- fill: "none",
14752
- xmlns: "http://www.w3.org/2000/svg"
14753
- }, /*#__PURE__*/React__default.createElement("path", {
14754
- fillRule: "evenodd",
14755
- clipRule: "evenodd",
14756
- d: "M19.74 6.84a.885.885 0 0 1 0 1.253l-1.626 1.626-3.333-3.333 1.626-1.626a.885.885 0 0 1 1.253 0l2.08 2.08ZM4 20.5v-3.333l9.83-9.83 3.333 3.333-9.83 9.83H4Z",
14757
- fill: themeValues.subIconColor
14758
- }));
14759
- };
14760
-
14761
- var PencilIcon$1 = themeComponent(PencilIcon, "Icons", fallbackValues$2, "info");
14762
-
14763
14743
  var PendingIcon = function PendingIcon() {
14764
14744
  return /*#__PURE__*/React__default.createElement("svg", {
14765
14745
  width: "32px",
@@ -21009,7 +20989,7 @@ var CheckboxContainer = styled__default.div.withConfig({
21009
20989
  var CheckboxLabelContainer = styled__default.label.withConfig({
21010
20990
  displayName: "Checkbox__CheckboxLabelContainer",
21011
20991
  componentId: "sc-36kqbv-1"
21012
- })(["display:flex;align-items:center;"]);
20992
+ })(["display:flex;align-items:center;column-gap:1rem;"]);
21013
20993
  var CheckboxIcon = styled__default.svg.withConfig({
21014
20994
  displayName: "Checkbox__CheckboxIcon",
21015
20995
  componentId: "sc-36kqbv-2"
@@ -21028,7 +21008,7 @@ var HiddenCheckbox = styled__default.input.attrs({
21028
21008
  var StyledCheckbox = styled__default.div.withConfig({
21029
21009
  displayName: "Checkbox__StyledCheckbox",
21030
21010
  componentId: "sc-36kqbv-4"
21031
- })(["display:inline-block;margin-right:16px;width:24px;height:24px;border-radius:2px;transition:all 150ms;", "{visibility:", ";}", ";"], CheckboxIcon, function (_ref2) {
21011
+ })(["display:inline-block;width:24px;height:24px;border-radius:2px;transition:all 150ms;", "{visibility:", ";}", ";"], CheckboxIcon, function (_ref2) {
21032
21012
  var checked = _ref2.checked;
21033
21013
  return checked ? "visible" : "hidden";
21034
21014
  }, function (_ref3) {
@@ -21058,6 +21038,8 @@ var Checkbox = function Checkbox(_ref4) {
21058
21038
  hidden = _ref4$hidden === void 0 ? false : _ref4$hidden,
21059
21039
  _ref4$error = _ref4.error,
21060
21040
  error = _ref4$error === void 0 ? false : _ref4$error,
21041
+ _ref4$checkboxMargin = _ref4.checkboxMargin,
21042
+ checkboxMargin = _ref4$checkboxMargin === void 0 ? "0 16px 0 0" : _ref4$checkboxMargin,
21061
21043
  extraStyles = _ref4.extraStyles,
21062
21044
  textExtraStyles = _ref4.textExtraStyles;
21063
21045
 
@@ -21086,7 +21068,7 @@ var Checkbox = function Checkbox(_ref4) {
21086
21068
  },
21087
21069
  hiddenStyles: hidden,
21088
21070
  background: themeValues.backgroundColor,
21089
- extraStyles: "outline: none; ".concat(extraStyles)
21071
+ extraStyles: "outline: none; ".concat(extraStyles, "; margin: ").concat(checkboxMargin, ";")
21090
21072
  }, /*#__PURE__*/React__default.createElement(CheckboxLabelContainer, null, /*#__PURE__*/React__default.createElement(CheckboxContainer, {
21091
21073
  "data-qa": "Checkbox"
21092
21074
  }, /*#__PURE__*/React__default.createElement(HiddenCheckbox, {
@@ -21098,7 +21080,7 @@ var Checkbox = function Checkbox(_ref4) {
21098
21080
  onChange: onChange,
21099
21081
  tabIndex: "-1",
21100
21082
  "aria-invalid": error,
21101
- "aria-describedby": "".concat(name, "-error-message")
21083
+ "aria-describedby": error ? "".concat(name, "-error-message") : ""
21102
21084
  }), /*#__PURE__*/React__default.createElement(StyledCheckbox, {
21103
21085
  error: error,
21104
21086
  disabled: disabled,
@@ -21117,7 +21099,7 @@ var Checkbox = function Checkbox(_ref4) {
21117
21099
  checkColor: themeValues.checkColor
21118
21100
  }, /*#__PURE__*/React__default.createElement("polyline", {
21119
21101
  points: "20 6 9 17 4 12"
21120
- })))), /*#__PURE__*/React__default.createElement(Text$1, {
21102
+ })))), title && /*#__PURE__*/React__default.createElement(Text$1, {
21121
21103
  variant: "p",
21122
21104
  weight: themeValues.textFontWeight,
21123
21105
  color: themeValues.textColor,
@@ -47250,6 +47232,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
47250
47232
  borderRadius: "3px",
47251
47233
  extraStyles: "overflow: scroll; max-height: 20rem;"
47252
47234
  }, /*#__PURE__*/React__default.createElement(Text$1, {
47235
+ id: "terms-body-text",
47253
47236
  variant: "p",
47254
47237
  extraStyles: "& a { text-decoration: underline; }"
47255
47238
  }, terms)),
@@ -48560,7 +48543,7 @@ var TabSidebar = function TabSidebar(_ref) {
48560
48543
 
48561
48544
  var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$P);
48562
48545
 
48563
- var TermsAndConditions = function TermsAndConditions(_ref) {
48546
+ var TermsAndConditionsControlV1 = function TermsAndConditionsControlV1(_ref) {
48564
48547
  var onCheck = _ref.onCheck,
48565
48548
  isChecked = _ref.isChecked,
48566
48549
  html = _ref.html,
@@ -48593,6 +48576,148 @@ var TermsAndConditions = function TermsAndConditions(_ref) {
48593
48576
  })))));
48594
48577
  };
48595
48578
 
48579
+ /*
48580
+
48581
+ A utility function that can generate box-shadow values for components
48582
+ Takes a string representing an rgb color value and returns an object
48583
+ with values for standard, inset, and overlay shadows.
48584
+
48585
+ The objects for standard and inset shadows contain versions approiate
48586
+ for base, hover, and active interaction states.
48587
+
48588
+ */
48589
+
48590
+ /*
48591
+ Function to convert string representing rgb color to rgba value with provided opacity
48592
+ ("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
48593
+
48594
+ */
48595
+ var rgbToRgba = function rgbToRgba() {
48596
+ var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
48597
+ var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
48598
+
48599
+ if (typeof rgbValue !== "string" || typeof opacity !== "string" || rgbValue.charAt(0) === "#") {
48600
+ return "";
48601
+ }
48602
+
48603
+ return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
48604
+ };
48605
+
48606
+ var generateShadows = function generateShadows(baseColorRGB) {
48607
+ var colorTen = rgbToRgba(baseColorRGB, "0.1") || "rgba(41, 42, 51, 0.1)";
48608
+ var colorTwenty = rgbToRgba(baseColorRGB, "0.2") || "rgba(41, 42, 51, 0.2)";
48609
+ var colorTwentyFive = rgbToRgba(baseColorRGB, "0.25") || "rgba(41, 42, 51, 0.25)";
48610
+ var colorThirty = rgbToRgba(baseColorRGB, "0.3") || "rgba(41, 42, 51, 0.3)";
48611
+ var blackTwentyFive = "rgba(0, 0, 0, 0.25)";
48612
+ var standard = {
48613
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 6px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48614
+ hover: "0px 1px 2px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(blackTwentyFive, ", 0px 6px 12px 0px ").concat(colorTen),
48615
+ active: "0px 2px 8px 0px ".concat(colorTwenty, ", 0px 4px 8px 0px ").concat(colorThirty, ", 0px 6px 12px 0px ").concat(colorTwentyFive)
48616
+ };
48617
+ var inset = {
48618
+ base: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwenty, ", inset 0px 1px 0px 0px ").concat(colorTen),
48619
+ hover: "0px 1px 2px 0px ".concat(colorTen, ", 0px 2px 4px 0px ").concat(colorTwentyFive, ", 0px 4px 8px 0px ").concat(colorTen),
48620
+ active: "0px 1px 2px 2px ".concat(colorTwenty, ", 0px 3px 6px 0px ").concat(colorThirty, ", 0px 4px 8px 0px ").concat(colorTwenty)
48621
+ };
48622
+ var overlay = {
48623
+ base: "0px 7px 32px 0px ".concat(colorTwenty, ", 0px 1px 4px 0px ").concat(colorTwenty, ", 0px 1px 8px -1px ").concat(colorThirty)
48624
+ };
48625
+ return {
48626
+ standard: standard,
48627
+ inset: inset,
48628
+ overlay: overlay
48629
+ };
48630
+ };
48631
+
48632
+ var TermsAndConditionsControlV2 = function TermsAndConditionsControlV2(_ref) {
48633
+ var _ref$showCheckbox = _ref.showCheckbox,
48634
+ showCheckbox = _ref$showCheckbox === void 0 ? true : _ref$showCheckbox,
48635
+ onCheck = _ref.onCheck,
48636
+ isChecked = _ref.isChecked,
48637
+ hasError = _ref.hasError,
48638
+ _ref$errorMessage = _ref.errorMessage,
48639
+ errorMessage = _ref$errorMessage === void 0 ? "Please accept Terms and Conditions" : _ref$errorMessage,
48640
+ _ref$description = _ref.description,
48641
+ description = _ref$description === void 0 ? "" : _ref$description,
48642
+ _ref$linkText = _ref.linkText,
48643
+ linkText = _ref$linkText === void 0 ? "Terms and Conditions" : _ref$linkText,
48644
+ html = _ref.html,
48645
+ terms = _ref.terms,
48646
+ _ref$id = _ref.id,
48647
+ id = _ref$id === void 0 ? "terms-and-conditions" : _ref$id,
48648
+ _ref$displayInline = _ref.displayInline,
48649
+ displayInline = _ref$displayInline === void 0 ? true : _ref$displayInline,
48650
+ _ref$modalVariant = _ref.modalVariant,
48651
+ modalVariant = _ref$modalVariant === void 0 ? "default" : _ref$modalVariant,
48652
+ _ref$containerBackgro = _ref.containerBackground,
48653
+ containerBackground = _ref$containerBackgro === void 0 ? ATHENS_GREY : _ref$containerBackgro,
48654
+ _ref$checkboxMargin = _ref.checkboxMargin,
48655
+ checkboxMargin = _ref$checkboxMargin === void 0 ? "4px 8px 4px 4px" : _ref$checkboxMargin,
48656
+ _ref$modalTitle = _ref.modalTitle,
48657
+ modalTitle = _ref$modalTitle === void 0 ? "Terms and Conditions" : _ref$modalTitle;
48658
+
48659
+ var _useState = React.useState(false),
48660
+ _useState2 = _slicedToArray(_useState, 2),
48661
+ showTerms = _useState2[0],
48662
+ toggleShowTerms = _useState2[1];
48663
+
48664
+ var standardBoxShadow = generateShadows().standard.base;
48665
+ return /*#__PURE__*/React__default.createElement(Box, {
48666
+ padding: displayInline ? "0" : "1.5rem",
48667
+ minWidth: displayInline ? "0" : "100%",
48668
+ background: displayInline ? "transparent" : containerBackground,
48669
+ boxShadow: displayInline ? "none" : standardBoxShadow,
48670
+ borderRadius: displayInline ? "0" : "4px"
48671
+ }, /*#__PURE__*/React__default.createElement(Stack, {
48672
+ childGap: "0"
48673
+ }, html && /*#__PURE__*/React__default.createElement(Box, {
48674
+ padding: "0"
48675
+ }, html), /*#__PURE__*/React__default.createElement(Cluster, {
48676
+ justify: "flex-start",
48677
+ align: "center",
48678
+ nowrap: true
48679
+ }, showCheckbox && /*#__PURE__*/React__default.createElement(Checkbox$1, {
48680
+ name: id,
48681
+ error: hasError,
48682
+ checked: isChecked,
48683
+ onChange: onCheck,
48684
+ checkboxMargin: checkboxMargin,
48685
+ extraStyles: "align-self: flex-start;"
48686
+ }), /*#__PURE__*/React__default.createElement(Stack, {
48687
+ childGap: "0.25rem",
48688
+ fullHeight: true
48689
+ }, /*#__PURE__*/React__default.createElement(Cluster, {
48690
+ justify: "flex-start",
48691
+ align: "center",
48692
+ nowrap: true,
48693
+ extraStyles: "padding-right: 2px; > div > * { margin: 4px 2px; };"
48694
+ }, description && /*#__PURE__*/React__default.createElement(Text$1, {
48695
+ color: CHARADE_GREY
48696
+ }, description), terms && /*#__PURE__*/React__default.createElement(TermsAndConditionsModal$1, {
48697
+ link: linkText,
48698
+ terms: terms,
48699
+ isOpen: showTerms,
48700
+ toggleOpen: toggleShowTerms,
48701
+ linkVariant: modalVariant,
48702
+ title: modalTitle
48703
+ })), showCheckbox && hasError && /*#__PURE__*/React__default.createElement(Text$1, {
48704
+ variant: "pXS",
48705
+ color: ERROR_COLOR,
48706
+ id: "".concat(id, "-error-message")
48707
+ }, errorMessage)))));
48708
+ };
48709
+
48710
+ var _excluded$y = ["version"];
48711
+
48712
+ var TermsAndConditions = function TermsAndConditions(_ref) {
48713
+ var _ref$version = _ref.version,
48714
+ version = _ref$version === void 0 ? "v1" : _ref$version,
48715
+ rest = _objectWithoutProperties(_ref, _excluded$y);
48716
+
48717
+ var TermsAndConditionsControl = version === "v1" ? TermsAndConditionsControlV1 : TermsAndConditionsControlV2;
48718
+ return /*#__PURE__*/React__default.createElement(TermsAndConditionsControl, rest);
48719
+ };
48720
+
48596
48721
  var Timeout = function Timeout(_ref) {
48597
48722
  var onLogout = _ref.onLogout;
48598
48723
 
@@ -49121,7 +49246,6 @@ exports.PaymentMethodAddIcon = PaymentMethodAddIcon$1;
49121
49246
  exports.PaymentMethodIcon = PaymentMethodIcon$1;
49122
49247
  exports.PaymentSearchIcon = PaymentSearchIcon;
49123
49248
  exports.PaymentsIconSmall = PaymentsIconSmall$1;
49124
- exports.PencilIcon = PencilIcon$1;
49125
49249
  exports.PendingIcon = PendingIcon;
49126
49250
  exports.PeriscopeDashboardIframe = PeriscopeDashboardIframe;
49127
49251
  exports.PeriscopeFailedIcon = PeriscopeFailedIcon;