@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.esm.js CHANGED
@@ -48414,14 +48414,27 @@ var Tab = function Tab(_ref) {
48414
48414
  }, /*#__PURE__*/React__default.createElement(Text$1, null, label));
48415
48415
  };
48416
48416
 
48417
+ var _excluded$N = ["tabsConfig", "tabsDisplayMode"];
48417
48418
  var HORIZONTAL = "horizontal";
48418
48419
  var Tabs = function Tabs(_ref) {
48420
+ var _tabsConfig$tabs$;
48419
48421
  var tabsConfig = _ref.tabsConfig,
48420
- tabsDisplayMode = _ref.tabsDisplayMode;
48421
- var _useState = useState(tabsConfig.tabs[0].label),
48422
+ _ref$tabsDisplayMode = _ref.tabsDisplayMode,
48423
+ tabsDisplayMode = _ref$tabsDisplayMode === void 0 ? HORIZONTAL : _ref$tabsDisplayMode,
48424
+ props = _objectWithoutProperties(_ref, _excluded$N);
48425
+ var _useState = useState(((_tabsConfig$tabs$ = tabsConfig.tabs[0]) === null || _tabsConfig$tabs$ === void 0 ? void 0 : _tabsConfig$tabs$.label) || null),
48422
48426
  _useState2 = _slicedToArray(_useState, 2),
48423
48427
  activeTab = _useState2[0],
48424
48428
  toggleActiveTab = _useState2[1];
48429
+ useEffect$1(function () {
48430
+ var currentTabExists = tabsConfig.tabs.some(function (tab) {
48431
+ return tab.label === activeTab;
48432
+ });
48433
+ if (!activeTab || !currentTabExists) {
48434
+ var _tabsConfig$tabs$2;
48435
+ toggleActiveTab(((_tabsConfig$tabs$2 = tabsConfig.tabs[0]) === null || _tabsConfig$tabs$2 === void 0 ? void 0 : _tabsConfig$tabs$2.label) || null);
48436
+ }
48437
+ }, [tabsConfig, activeTab]);
48425
48438
  var createTabs = function createTabs(tabConfig, activeTab) {
48426
48439
  return tabConfig.tabs.map(function (tab) {
48427
48440
  return /*#__PURE__*/React__default.createElement(Tab, {
@@ -48434,7 +48447,7 @@ var Tabs = function Tabs(_ref) {
48434
48447
  });
48435
48448
  });
48436
48449
  };
48437
- var showHorozontal = function showHorozontal(tabsConfig, activeTab) {
48450
+ var showHorizontal = function showHorizontal(tabsConfig, activeTab) {
48438
48451
  return /*#__PURE__*/React__default.createElement(Cluster, {
48439
48452
  justify: "space-around"
48440
48453
  }, createTabs(tabsConfig, activeTab));
@@ -48442,11 +48455,11 @@ var Tabs = function Tabs(_ref) {
48442
48455
  var showVertical = function showVertical(tabsConfig, activeTab) {
48443
48456
  return /*#__PURE__*/React__default.createElement(Stack, null, createTabs(tabsConfig, activeTab));
48444
48457
  };
48445
- return /*#__PURE__*/React__default.createElement(Box, {
48458
+ return /*#__PURE__*/React__default.createElement(Box, _extends({
48446
48459
  className: "tabs"
48447
- }, /*#__PURE__*/React__default.createElement(Box, {
48460
+ }, props), /*#__PURE__*/React__default.createElement(Box, {
48448
48461
  className: "tab-list"
48449
- }, tabsDisplayMode == HORIZONTAL ? showHorozontal(tabsConfig, activeTab) : showVertical(tabsConfig, activeTab)), /*#__PURE__*/React__default.createElement(Box, {
48462
+ }, tabsDisplayMode == HORIZONTAL ? showHorizontal(tabsConfig, activeTab) : showVertical(tabsConfig, activeTab)), /*#__PURE__*/React__default.createElement(Box, {
48450
48463
  className: "tab-content"
48451
48464
  }, /*#__PURE__*/React__default.createElement(Box, null, tabsConfig.tabs.map(function (tab, idx) {
48452
48465
  if (tab.label !== activeTab) return undefined;
@@ -48555,7 +48568,7 @@ var Timeout = function Timeout(_ref) {
48555
48568
  };
48556
48569
  var Timeout$1 = withWindowSize(Timeout);
48557
48570
 
48558
- var _excluded$N = ["variant", "message", "toastOpen", "closeToastNotification", "extraStyles", "minWidth", "maxWidth", "height", "childGap", "backgroundColor", "role", "ariaLive", "screenReaderMessage", "showScreenReaderMessage"];
48571
+ var _excluded$O = ["variant", "message", "toastOpen", "closeToastNotification", "extraStyles", "minWidth", "maxWidth", "height", "childGap", "backgroundColor", "role", "ariaLive", "screenReaderMessage", "showScreenReaderMessage"];
48559
48572
  var VARIANTS = {
48560
48573
  SUCCESS: "success",
48561
48574
  ERROR: "error"
@@ -48584,7 +48597,7 @@ var ToastNotification = function ToastNotification(_ref) {
48584
48597
  screenReaderMessage = _ref.screenReaderMessage,
48585
48598
  _ref$showScreenReader = _ref.showScreenReaderMessage,
48586
48599
  showScreenReaderMessage = _ref$showScreenReader === void 0 ? true : _ref$showScreenReader,
48587
- rest = _objectWithoutProperties(_ref, _excluded$N);
48600
+ rest = _objectWithoutProperties(_ref, _excluded$O);
48588
48601
  var screenReaderMessageRef = useRef();
48589
48602
  var LIVEREGION_TRANSITION_DELAY = 1000;
48590
48603
  useEffect$1(function () {
@@ -48767,7 +48780,7 @@ var PopupMenuItemContainer = styled(ButtonWithAction).withConfig({
48767
48780
  return "\n background-color: ".concat(isDeleteAction ? theme.menuItemHoverBackgroundColorDelete : theme.menuItemHoverBackgroundColor, ";\n ");
48768
48781
  });
48769
48782
 
48770
- var _excluded$O = ["id", "closeMenuCallback", "action", "themeValues", "text", "hasIcon", "isDeleteAction", "icon", "textExtraStyles", "hoverStyles", "activeStyles", "extraStyles"];
48783
+ var _excluded$P = ["id", "closeMenuCallback", "action", "themeValues", "text", "hasIcon", "isDeleteAction", "icon", "textExtraStyles", "hoverStyles", "activeStyles", "extraStyles"];
48771
48784
  var PopupMenuItem = function PopupMenuItem(_ref) {
48772
48785
  var id = _ref.id,
48773
48786
  closeMenuCallback = _ref.closeMenuCallback,
@@ -48783,7 +48796,7 @@ var PopupMenuItem = function PopupMenuItem(_ref) {
48783
48796
  hoverStyles = _ref.hoverStyles,
48784
48797
  activeStyles = _ref.activeStyles,
48785
48798
  extraStyles = _ref.extraStyles,
48786
- rest = _objectWithoutProperties(_ref, _excluded$O);
48799
+ rest = _objectWithoutProperties(_ref, _excluded$P);
48787
48800
  return /*#__PURE__*/React__default.createElement(PopupMenuItemContainer, _extends({
48788
48801
  id: id,
48789
48802
  role: "menuItem",
@@ -49022,7 +49035,7 @@ var ActionLinkButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
49022
49035
  });
49023
49036
  });
49024
49037
 
49025
- var _excluded$P = ["width", "height", "color"];
49038
+ var _excluded$Q = ["width", "height", "color"];
49026
49039
  var DropdownIconV2 = function DropdownIconV2(_ref) {
49027
49040
  var _ref$width = _ref.width,
49028
49041
  width = _ref$width === void 0 ? "18" : _ref$width,
@@ -49030,7 +49043,7 @@ var DropdownIconV2 = function DropdownIconV2(_ref) {
49030
49043
  height = _ref$height === void 0 ? "19" : _ref$height,
49031
49044
  _ref$color = _ref.color,
49032
49045
  color = _ref$color === void 0 ? "#292A33" : _ref$color,
49033
- props = _objectWithoutProperties(_ref, _excluded$P);
49046
+ props = _objectWithoutProperties(_ref, _excluded$Q);
49034
49047
  return /*#__PURE__*/React__default.createElement("svg", _extends({
49035
49048
  width: width,
49036
49049
  height: height,
@@ -49177,7 +49190,7 @@ var SearchBox = function SearchBox(_ref) {
49177
49190
  }));
49178
49191
  };
49179
49192
 
49180
- var _excluded$Q = ["width", "height", "color"];
49193
+ var _excluded$R = ["width", "height", "color"];
49181
49194
  var CheckboxCheckmarkIcon = function CheckboxCheckmarkIcon(_ref) {
49182
49195
  var _ref$width = _ref.width,
49183
49196
  width = _ref$width === void 0 ? "18" : _ref$width,
@@ -49185,7 +49198,7 @@ var CheckboxCheckmarkIcon = function CheckboxCheckmarkIcon(_ref) {
49185
49198
  height = _ref$height === void 0 ? "18" : _ref$height,
49186
49199
  _ref$color = _ref.color,
49187
49200
  color = _ref$color === void 0 ? "#FEFEFE" : _ref$color,
49188
- props = _objectWithoutProperties(_ref, _excluded$Q);
49201
+ props = _objectWithoutProperties(_ref, _excluded$R);
49189
49202
  return /*#__PURE__*/React__default.createElement("svg", _extends({
49190
49203
  xmlns: "http://www.w3.org/2000/svg",
49191
49204
  width: width,
@@ -49881,7 +49894,7 @@ var fallbackValues$11 = {
49881
49894
  justifyContent: justifyContent
49882
49895
  };
49883
49896
 
49884
- var _excluded$R = ["variant", "imageUrl", "isMobile", "theme", "extraStyles"],
49897
+ var _excluded$S = ["variant", "imageUrl", "isMobile", "theme", "extraStyles"],
49885
49898
  _excluded2$2 = ["theme", "isMobile"],
49886
49899
  _excluded3 = ["theme", "isMobile"],
49887
49900
  _excluded4 = ["theme", "isMobile"];
@@ -49904,7 +49917,7 @@ var HeroContainer = styled(function (_ref2) {
49904
49917
  isMobile = _ref2.isMobile,
49905
49918
  theme = _ref2.theme,
49906
49919
  extraStyles = _ref2.extraStyles,
49907
- props = _objectWithoutProperties(_ref2, _excluded$R);
49920
+ props = _objectWithoutProperties(_ref2, _excluded$S);
49908
49921
  return /*#__PURE__*/React__default.createElement(Box, props);
49909
49922
  }).withConfig({
49910
49923
  displayName: "HeroImagestyled__HeroContainer",