@nulogy/components 6.1.6 → 6.1.7

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/main.js CHANGED
@@ -27921,36 +27921,39 @@
27921
27921
  children = _this$props.children,
27922
27922
  onTabClick = _this$props.onTabClick;
27923
27923
  var selectedIndex = this.getSelectedIndex();
27924
- var tabs = React__default['default'].Children.map(children, function (tab, index) {
27925
- return /*#__PURE__*/React__default['default'].cloneElement(tab, {
27926
- onClick: function onClick(e) {
27927
- setFocusToTab(index);
27924
+ return React__default['default'].Children.map(children, function (tab, index) {
27925
+ if (tab) {
27926
+ return /*#__PURE__*/React__default['default'].cloneElement(tab, {
27927
+ onClick: function onClick(e) {
27928
+ var _a, _b;
27928
27929
 
27929
- if (tab.props.onClick) {
27930
- tab.props.onClick(e);
27931
- }
27930
+ setFocusToTab(index);
27932
27931
 
27933
- if (onTabClick) {
27934
- onTabClick(e, index);
27935
- } else {
27936
- _this2.handleTabClick(index);
27932
+ if ((_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.onClick) {
27933
+ (_b = tab === null || tab === void 0 ? void 0 : tab.props) === null || _b === void 0 ? void 0 : _b.onClick(e);
27934
+ }
27935
+
27936
+ if (onTabClick) {
27937
+ onTabClick(e, index);
27938
+ } else {
27939
+ _this2.handleTabClick(index);
27940
+ }
27941
+ },
27942
+ onFocus: function onFocus(e) {
27943
+ e.stopPropagation();
27944
+ },
27945
+ onKeyDown: handleArrowNavigation,
27946
+ index: index,
27947
+ tabIndex: index === focusedIndex ? 0 : -1,
27948
+ selected: index === selectedIndex,
27949
+ "aria-selected": index === selectedIndex,
27950
+ fullWidth: fitted,
27951
+ ref: function ref(_ref2) {
27952
+ _this2.tabRefs[index] = _ref2;
27937
27953
  }
27938
- },
27939
- onFocus: function onFocus(e) {
27940
- e.stopPropagation();
27941
- },
27942
- onKeyDown: handleArrowNavigation,
27943
- index: index,
27944
- tabIndex: index === focusedIndex ? 0 : -1,
27945
- selected: index === selectedIndex,
27946
- "aria-selected": index === selectedIndex,
27947
- fullWidth: fitted,
27948
- ref: function ref(_ref2) {
27949
- _this2.tabRefs[index] = _ref2;
27950
- }
27951
- });
27954
+ });
27955
+ }
27952
27956
  });
27953
- return tabs;
27954
27957
  };
27955
27958
 
27956
27959
  _proto.getTabContent = function getTabContent() {
@@ -27959,6 +27962,8 @@
27959
27962
  renderTabContentOnlyWhenSelected = _this$props2.renderTabContentOnlyWhenSelected;
27960
27963
  var selectedIndex = this.getSelectedIndex();
27961
27964
  var tabContent = React__default['default'].Children.map(children, function (tab, index) {
27965
+ var _a;
27966
+
27962
27967
  var selected = index === selectedIndex;
27963
27968
 
27964
27969
  if (renderTabContentOnlyWhenSelected && !selected) {
@@ -27968,7 +27973,7 @@
27968
27973
  "aria-hidden": !selected,
27969
27974
  hidden: !selected,
27970
27975
  selected: selected
27971
- }, tab.props.children);
27976
+ }, (_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.children);
27972
27977
  }
27973
27978
  });
27974
27979
  return tabContent;
@@ -27895,36 +27895,39 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27895
27895
  children = _this$props.children,
27896
27896
  onTabClick = _this$props.onTabClick;
27897
27897
  var selectedIndex = this.getSelectedIndex();
27898
- var tabs = React__default.Children.map(children, function (tab, index) {
27899
- return /*#__PURE__*/React__default.cloneElement(tab, {
27900
- onClick: function onClick(e) {
27901
- setFocusToTab(index);
27898
+ return React__default.Children.map(children, function (tab, index) {
27899
+ if (tab) {
27900
+ return /*#__PURE__*/React__default.cloneElement(tab, {
27901
+ onClick: function onClick(e) {
27902
+ var _a, _b;
27902
27903
 
27903
- if (tab.props.onClick) {
27904
- tab.props.onClick(e);
27905
- }
27904
+ setFocusToTab(index);
27906
27905
 
27907
- if (onTabClick) {
27908
- onTabClick(e, index);
27909
- } else {
27910
- _this2.handleTabClick(index);
27906
+ if ((_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.onClick) {
27907
+ (_b = tab === null || tab === void 0 ? void 0 : tab.props) === null || _b === void 0 ? void 0 : _b.onClick(e);
27908
+ }
27909
+
27910
+ if (onTabClick) {
27911
+ onTabClick(e, index);
27912
+ } else {
27913
+ _this2.handleTabClick(index);
27914
+ }
27915
+ },
27916
+ onFocus: function onFocus(e) {
27917
+ e.stopPropagation();
27918
+ },
27919
+ onKeyDown: handleArrowNavigation,
27920
+ index: index,
27921
+ tabIndex: index === focusedIndex ? 0 : -1,
27922
+ selected: index === selectedIndex,
27923
+ "aria-selected": index === selectedIndex,
27924
+ fullWidth: fitted,
27925
+ ref: function ref(_ref2) {
27926
+ _this2.tabRefs[index] = _ref2;
27911
27927
  }
27912
- },
27913
- onFocus: function onFocus(e) {
27914
- e.stopPropagation();
27915
- },
27916
- onKeyDown: handleArrowNavigation,
27917
- index: index,
27918
- tabIndex: index === focusedIndex ? 0 : -1,
27919
- selected: index === selectedIndex,
27920
- "aria-selected": index === selectedIndex,
27921
- fullWidth: fitted,
27922
- ref: function ref(_ref2) {
27923
- _this2.tabRefs[index] = _ref2;
27924
- }
27925
- });
27928
+ });
27929
+ }
27926
27930
  });
27927
- return tabs;
27928
27931
  };
27929
27932
 
27930
27933
  _proto.getTabContent = function getTabContent() {
@@ -27933,6 +27936,8 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27933
27936
  renderTabContentOnlyWhenSelected = _this$props2.renderTabContentOnlyWhenSelected;
27934
27937
  var selectedIndex = this.getSelectedIndex();
27935
27938
  var tabContent = React__default.Children.map(children, function (tab, index) {
27939
+ var _a;
27940
+
27936
27941
  var selected = index === selectedIndex;
27937
27942
 
27938
27943
  if (renderTabContentOnlyWhenSelected && !selected) {
@@ -27942,7 +27947,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27942
27947
  "aria-hidden": !selected,
27943
27948
  hidden: !selected,
27944
27949
  selected: selected
27945
- }, tab.props.children);
27950
+ }, (_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.children);
27946
27951
  }
27947
27952
  });
27948
27953
  return tabContent;
@@ -11,10 +11,6 @@ declare type TabScrollIndicatorsProps = {
11
11
  declare type TabScrollIndicatorsState = {
12
12
  contentHiddenLeft: boolean;
13
13
  contentHiddenRight: boolean;
14
- contentHiddenLeft: boolean;
15
- contentHiddenRight: boolean;
16
- contentHiddenLeft: boolean;
17
- contentHiddenRight: boolean;
18
14
  };
19
15
  declare class TabScrollIndicators extends React.Component<TabScrollIndicatorsProps, TabScrollIndicatorsState> {
20
16
  constructor(props: any);
@@ -9,7 +9,6 @@ export declare type TabsProps = {
9
9
  };
10
10
  export declare type TabsState = {
11
11
  selectedIndex: any;
12
- selectedIndex: any;
13
12
  };
14
13
  declare class Tabs extends React.Component<TabsProps, TabsState> {
15
14
  constructor(props: any);
@@ -51,3 +51,9 @@ export declare const WithContentLoadedOnSelection: {
51
51
  name: string;
52
52
  };
53
53
  };
54
+ export declare const WithConditionallyRenderedTabs: {
55
+ (): JSX.Element;
56
+ story: {
57
+ name: string;
58
+ };
59
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "6.1.6",
3
+ "version": "6.1.7",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {