@bento-core/tab 1.0.0-c3dc.2 → 1.0.0-c3dc.3

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.
Files changed (3) hide show
  1. package/dist/Tabs.js +17 -8
  2. package/package.json +1 -1
  3. package/src/Tabs.js +28 -17
package/dist/Tabs.js CHANGED
@@ -123,18 +123,24 @@ const TabItems = _ref => {
123
123
 
124
124
  // Add tabs after visible range
125
125
  for (let i = visibleEnd; i < tabItems.length; i += 1) {
126
- hiddenTabsWithIndex.push({
127
- tab: tabItems[i],
128
- originalIndex: i
129
- });
126
+ const tab = tabItems[i];
127
+ if (tab) {
128
+ hiddenTabsWithIndex.push({
129
+ tab,
130
+ originalIndex: i
131
+ });
132
+ }
130
133
  }
131
134
 
132
135
  // Add tabs before visible range (wrap-around)
133
136
  for (let i = 0; i < visibleStart; i += 1) {
134
- hiddenTabsWithIndex.push({
135
- tab: tabItems[i],
136
- originalIndex: i
137
- });
137
+ const tab = tabItems[i];
138
+ if (tab) {
139
+ hiddenTabsWithIndex.push({
140
+ tab,
141
+ originalIndex: i
142
+ });
143
+ }
138
144
  }
139
145
  return hiddenTabsWithIndex;
140
146
  }, [enableGrouping, shouldShowMoreButton, currentGroup, tabLimit, tabItems]);
@@ -265,6 +271,9 @@ const TabItems = _ref => {
265
271
  tab,
266
272
  originalIndex
267
273
  } = _ref3;
274
+ if (!tab || !tab.name) {
275
+ return null;
276
+ }
268
277
  return /*#__PURE__*/_react.default.createElement(_core.ListItem, {
269
278
  key: originalIndex,
270
279
  button: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/tab",
3
- "version": "1.0.0-c3dc.2",
3
+ "version": "1.0.0-c3dc.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/Tabs.js CHANGED
@@ -121,12 +121,18 @@ const TabItems = ({
121
121
 
122
122
  // Add tabs after visible range
123
123
  for (let i = visibleEnd; i < tabItems.length; i += 1) {
124
- hiddenTabsWithIndex.push({ tab: tabItems[i], originalIndex: i });
124
+ const tab = tabItems[i];
125
+ if (tab) {
126
+ hiddenTabsWithIndex.push({ tab, originalIndex: i });
127
+ }
125
128
  }
126
129
 
127
130
  // Add tabs before visible range (wrap-around)
128
131
  for (let i = 0; i < visibleStart; i += 1) {
129
- hiddenTabsWithIndex.push({ tab: tabItems[i], originalIndex: i });
132
+ const tab = tabItems[i];
133
+ if (tab) {
134
+ hiddenTabsWithIndex.push({ tab, originalIndex: i });
135
+ }
130
136
  }
131
137
 
132
138
  return hiddenTabsWithIndex;
@@ -257,21 +263,26 @@ const TabItems = ({
257
263
  style={{ marginTop: '10px' }}
258
264
  >
259
265
  <List className="popover-list">
260
- {popupTabs.map(({ tab, originalIndex }) => (
261
- <ListItem
262
- key={originalIndex}
263
- button
264
- onClick={() => handlePopupTabClick(originalIndex)}
265
- className="popover-list-item"
266
- >
267
- <span className="popover-tab-name">
268
- {tab.name}
269
- </span>
270
- <span className="popover-tab-count">
271
- {tab.count || ''}
272
- </span>
273
- </ListItem>
274
- ))}
266
+ {popupTabs.map(({ tab, originalIndex }) => {
267
+ if (!tab || !tab.name) {
268
+ return null;
269
+ }
270
+ return (
271
+ <ListItem
272
+ key={originalIndex}
273
+ button
274
+ onClick={() => handlePopupTabClick(originalIndex)}
275
+ className="popover-list-item"
276
+ >
277
+ <span className="popover-tab-name">
278
+ {tab.name}
279
+ </span>
280
+ <span className="popover-tab-count">
281
+ {tab.count || ''}
282
+ </span>
283
+ </ListItem>
284
+ );
285
+ })}
275
286
  </List>
276
287
  </Popover>
277
288
  )}