@thecb/components 11.4.0-beta.0 → 11.4.1-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
@@ -48422,14 +48422,27 @@ var Tab = function Tab(_ref) {
48422
48422
  }, /*#__PURE__*/React__default.createElement(Text$1, null, label));
48423
48423
  };
48424
48424
 
48425
+ var _excluded$N = ["tabsConfig", "tabsDisplayMode"];
48425
48426
  var HORIZONTAL = "horizontal";
48426
48427
  var Tabs = function Tabs(_ref) {
48428
+ var _tabsConfig$tabs$;
48427
48429
  var tabsConfig = _ref.tabsConfig,
48428
- tabsDisplayMode = _ref.tabsDisplayMode;
48429
- var _useState = React.useState(tabsConfig.tabs[0].label),
48430
+ _ref$tabsDisplayMode = _ref.tabsDisplayMode,
48431
+ tabsDisplayMode = _ref$tabsDisplayMode === void 0 ? HORIZONTAL : _ref$tabsDisplayMode,
48432
+ props = _objectWithoutProperties(_ref, _excluded$N);
48433
+ var _useState = React.useState(((_tabsConfig$tabs$ = tabsConfig.tabs[0]) === null || _tabsConfig$tabs$ === void 0 ? void 0 : _tabsConfig$tabs$.label) || null),
48430
48434
  _useState2 = _slicedToArray(_useState, 2),
48431
48435
  activeTab = _useState2[0],
48432
48436
  toggleActiveTab = _useState2[1];
48437
+ React.useEffect(function () {
48438
+ var currentTabExists = tabsConfig.tabs.some(function (tab) {
48439
+ return tab.label === activeTab;
48440
+ });
48441
+ if (!activeTab || !currentTabExists) {
48442
+ var _tabsConfig$tabs$2;
48443
+ toggleActiveTab(((_tabsConfig$tabs$2 = tabsConfig.tabs[0]) === null || _tabsConfig$tabs$2 === void 0 ? void 0 : _tabsConfig$tabs$2.label) || null);
48444
+ }
48445
+ }, [tabsConfig, activeTab]);
48433
48446
  var createTabs = function createTabs(tabConfig, activeTab) {
48434
48447
  return tabConfig.tabs.map(function (tab) {
48435
48448
  return /*#__PURE__*/React__default.createElement(Tab, {
@@ -48442,7 +48455,7 @@ var Tabs = function Tabs(_ref) {
48442
48455
  });
48443
48456
  });
48444
48457
  };
48445
- var showHorozontal = function showHorozontal(tabsConfig, activeTab) {
48458
+ var showHorizontal = function showHorizontal(tabsConfig, activeTab) {
48446
48459
  return /*#__PURE__*/React__default.createElement(Cluster, {
48447
48460
  justify: "space-around"
48448
48461
  }, createTabs(tabsConfig, activeTab));
@@ -48450,11 +48463,11 @@ var Tabs = function Tabs(_ref) {
48450
48463
  var showVertical = function showVertical(tabsConfig, activeTab) {
48451
48464
  return /*#__PURE__*/React__default.createElement(Stack, null, createTabs(tabsConfig, activeTab));
48452
48465
  };
48453
- return /*#__PURE__*/React__default.createElement(Box, {
48466
+ return /*#__PURE__*/React__default.createElement(Box, _extends({
48454
48467
  className: "tabs"
48455
- }, /*#__PURE__*/React__default.createElement(Box, {
48468
+ }, props), /*#__PURE__*/React__default.createElement(Box, {
48456
48469
  className: "tab-list"
48457
- }, tabsDisplayMode == HORIZONTAL ? showHorozontal(tabsConfig, activeTab) : showVertical(tabsConfig, activeTab)), /*#__PURE__*/React__default.createElement(Box, {
48470
+ }, tabsDisplayMode == HORIZONTAL ? showHorizontal(tabsConfig, activeTab) : showVertical(tabsConfig, activeTab)), /*#__PURE__*/React__default.createElement(Box, {
48458
48471
  className: "tab-content"
48459
48472
  }, /*#__PURE__*/React__default.createElement(Box, null, tabsConfig.tabs.map(function (tab, idx) {
48460
48473
  if (tab.label !== activeTab) return undefined;
@@ -48563,7 +48576,7 @@ var Timeout = function Timeout(_ref) {
48563
48576
  };
48564
48577
  var Timeout$1 = withWindowSize(Timeout);
48565
48578
 
48566
- var _excluded$N = ["variant", "message", "toastOpen", "closeToastNotification", "extraStyles", "minWidth", "maxWidth", "height", "childGap", "backgroundColor", "role", "ariaLive", "screenReaderMessage", "showScreenReaderMessage"];
48579
+ var _excluded$O = ["variant", "message", "toastOpen", "closeToastNotification", "extraStyles", "minWidth", "maxWidth", "height", "childGap", "backgroundColor", "role", "ariaLive", "screenReaderMessage", "showScreenReaderMessage"];
48567
48580
  var VARIANTS = {
48568
48581
  SUCCESS: "success",
48569
48582
  ERROR: "error"
@@ -48592,7 +48605,7 @@ var ToastNotification = function ToastNotification(_ref) {
48592
48605
  screenReaderMessage = _ref.screenReaderMessage,
48593
48606
  _ref$showScreenReader = _ref.showScreenReaderMessage,
48594
48607
  showScreenReaderMessage = _ref$showScreenReader === void 0 ? true : _ref$showScreenReader,
48595
- rest = _objectWithoutProperties(_ref, _excluded$N);
48608
+ rest = _objectWithoutProperties(_ref, _excluded$O);
48596
48609
  var screenReaderMessageRef = React.useRef();
48597
48610
  var LIVEREGION_TRANSITION_DELAY = 1000;
48598
48611
  React.useEffect(function () {
@@ -48775,7 +48788,7 @@ var PopupMenuItemContainer = styled__default(ButtonWithAction).withConfig({
48775
48788
  return "\n background-color: ".concat(isDeleteAction ? theme.menuItemHoverBackgroundColorDelete : theme.menuItemHoverBackgroundColor, ";\n ");
48776
48789
  });
48777
48790
 
48778
- var _excluded$O = ["id", "closeMenuCallback", "action", "themeValues", "text", "hasIcon", "isDeleteAction", "icon", "textExtraStyles", "hoverStyles", "activeStyles", "extraStyles"];
48791
+ var _excluded$P = ["id", "closeMenuCallback", "action", "themeValues", "text", "hasIcon", "isDeleteAction", "icon", "textExtraStyles", "hoverStyles", "activeStyles", "extraStyles"];
48779
48792
  var PopupMenuItem = function PopupMenuItem(_ref) {
48780
48793
  var id = _ref.id,
48781
48794
  closeMenuCallback = _ref.closeMenuCallback,
@@ -48791,7 +48804,7 @@ var PopupMenuItem = function PopupMenuItem(_ref) {
48791
48804
  hoverStyles = _ref.hoverStyles,
48792
48805
  activeStyles = _ref.activeStyles,
48793
48806
  extraStyles = _ref.extraStyles,
48794
- rest = _objectWithoutProperties(_ref, _excluded$O);
48807
+ rest = _objectWithoutProperties(_ref, _excluded$P);
48795
48808
  return /*#__PURE__*/React__default.createElement(PopupMenuItemContainer, _extends({
48796
48809
  id: id,
48797
48810
  role: "menuItem",
@@ -49030,7 +49043,7 @@ var ActionLinkButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
49030
49043
  });
49031
49044
  });
49032
49045
 
49033
- var _excluded$P = ["width", "height", "color"];
49046
+ var _excluded$Q = ["width", "height", "color"];
49034
49047
  var DropdownIconV2 = function DropdownIconV2(_ref) {
49035
49048
  var _ref$width = _ref.width,
49036
49049
  width = _ref$width === void 0 ? "18" : _ref$width,
@@ -49038,7 +49051,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
49038
49051
  height = _ref$height === void 0 ? "19" : _ref$height,
49039
49052
  _ref$color = _ref.color,
49040
49053
  color = _ref$color === void 0 ? "#292A33" : _ref$color,
49041
- props = _objectWithoutProperties(_ref, _excluded$P);
49054
+ props = _objectWithoutProperties(_ref, _excluded$Q);
49042
49055
  return /*#__PURE__*/React__default.createElement("svg", _extends({
49043
49056
  width: width,
49044
49057
  height: height,
@@ -49185,7 +49198,7 @@ var SearchBox = function SearchBox(_ref) {
49185
49198
  }));
49186
49199
  };
49187
49200
 
49188
- var _excluded$Q = ["width", "height", "color"];
49201
+ var _excluded$R = ["width", "height", "color"];
49189
49202
  var CheckboxCheckmarkIcon = function CheckboxCheckmarkIcon(_ref) {
49190
49203
  var _ref$width = _ref.width,
49191
49204
  width = _ref$width === void 0 ? "18" : _ref$width,
@@ -49193,7 +49206,7 @@ var CheckboxCheckmarkIcon = function CheckboxCheckmarkIcon(_ref) {
49193
49206
  height = _ref$height === void 0 ? "18" : _ref$height,
49194
49207
  _ref$color = _ref.color,
49195
49208
  color = _ref$color === void 0 ? "#FEFEFE" : _ref$color,
49196
- props = _objectWithoutProperties(_ref, _excluded$Q);
49209
+ props = _objectWithoutProperties(_ref, _excluded$R);
49197
49210
  return /*#__PURE__*/React__default.createElement("svg", _extends({
49198
49211
  xmlns: "http://www.w3.org/2000/svg",
49199
49212
  width: width,
@@ -49889,7 +49902,7 @@ var fallbackValues$11 = {
49889
49902
  justifyContent: justifyContent
49890
49903
  };
49891
49904
 
49892
- var _excluded$R = ["variant", "imageUrl", "isMobile", "theme", "extraStyles"],
49905
+ var _excluded$S = ["variant", "imageUrl", "isMobile", "theme", "extraStyles"],
49893
49906
  _excluded2$2 = ["theme", "isMobile"],
49894
49907
  _excluded3 = ["theme", "isMobile"],
49895
49908
  _excluded4 = ["theme", "isMobile"];
@@ -49912,7 +49925,7 @@ var HeroContainer = styled__default(function (_ref2) {
49912
49925
  isMobile = _ref2.isMobile,
49913
49926
  theme = _ref2.theme,
49914
49927
  extraStyles = _ref2.extraStyles,
49915
- props = _objectWithoutProperties(_ref2, _excluded$R);
49928
+ props = _objectWithoutProperties(_ref2, _excluded$S);
49916
49929
  return /*#__PURE__*/React__default.createElement(Box, props);
49917
49930
  }).withConfig({
49918
49931
  displayName: "HeroImagestyled__HeroContainer",