@zohodesk/components 1.0.0-temp-262.1 → 1.0.0-temp-262.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ - **v1 Tab** - Data-driven `TabList` items accept a per-item `customClass`.
6
+ - **v1 Tab** - A data-driven `TabList` no longer clips its overflow when `customProps.popup.isAbsolutePositioningNeeded` is `true`, so the inline more menu is no longer hidden.
7
+
3
8
  ## 1.6.34
4
9
 
5
10
  - **CheckBox** - Fixed the CSS Utility class ordering to resolve the position property conflict between the disabled and tick classes.
package/es/v1/Tab/Tab.js CHANGED
@@ -24,6 +24,8 @@ const Tab = props => {
24
24
  iconName,
25
25
  iconSize,
26
26
  tourId,
27
+ tagName,
28
+ isAnchor: isAnchorFromProps,
27
29
  href,
28
30
  target,
29
31
  rel,
@@ -85,7 +87,7 @@ const Tab = props => {
85
87
  }
86
88
 
87
89
  const classes = getClasses(styleOverrides);
88
- const isAnchor = !!href;
90
+ const isAnchor = isAnchorFromProps ?? !!href;
89
91
  const elementProps = mergeProps({
90
92
  className: classes.tab,
91
93
  href: isAnchor && !isDisabled ? href : undefined,
@@ -96,11 +98,13 @@ const Tab = props => {
96
98
  'data-title': title
97
99
  }, {
98
100
  onClick
99
- }, tabAttributes, a11yAttributes);
101
+ }, tabAttributes);
100
102
  return /*#__PURE__*/React.createElement(TabCore, _extends({
101
103
  value: value,
102
104
  isDisabled: isDisabled,
103
105
  isAnchor: isAnchor,
106
+ tagName: tagName,
107
+ a11yAttributes: a11yAttributes,
104
108
  getRef: getRef,
105
109
  displayMode: "inlineFlex",
106
110
  alignItems: "center",
@@ -65,8 +65,12 @@ const TabList = props => {
65
65
  const styleValue = useMemo(() => ({ ...styleContext,
66
66
  hasOverflow: isDataDriven
67
67
  }), [styleContext, isDataDriven]);
68
- const scroll = hasScroll ? orientation === ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven ? 'hidden' : undefined;
69
- const itemsSignature = `${labelStyle || ''}\u0001${position || ''}\u0001` + (items || DUMMY_ARRAY).map(item => `${item.value}|${item.text || ''}|${item.iconName || ''}|${item.isDisabled ? 1 : 0}|${item.renderBefore ? 1 : 0}|${item.renderAfter ? 1 : 0}`).join('\u0000');
68
+ const isMoreMenuInline = !!popupOptions.isAbsolutePositioningNeeded;
69
+ const scroll = hasScroll ? orientation === ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven && !isMoreMenuInline ? 'hidden' : undefined;
70
+
71
+ const getClassSignature = itemClass => itemClass ? Object.keys(itemClass).map(slot => `${slot}:${itemClass[slot] || ''}`).join(',') : '';
72
+
73
+ const itemsSignature = `${labelStyle || ''}\u0001${position || ''}\u0001` + (items || DUMMY_ARRAY).map(item => `${item.value}|${item.text || ''}|${item.iconName || ''}|${item.isDisabled ? 1 : 0}|${item.renderBefore ? 1 : 0}|${item.renderAfter ? 1 : 0}|${getClassSignature(item.customClass)}`).join('\u0000');
70
74
  const dataList = useMemo(() => items || DUMMY_ARRAY, [itemsSignature]);
71
75
  const {
72
76
  parentRef,
@@ -115,12 +119,16 @@ const TabList = props => {
115
119
  ariaLabel: item.ariaLabel,
116
120
  title: item.title,
117
121
  tourId: item.tourId,
122
+ tagName: item.tagName,
123
+ isAnchor: item.isAnchor,
124
+ a11yAttributes: item.a11yAttributes,
118
125
  href: item.href,
119
126
  target: item.target,
120
127
  rel: item.rel,
121
128
  renderIcon: item.renderIcon,
122
129
  renderBefore: item.renderBefore,
123
130
  renderAfter: item.renderAfter,
131
+ customClass: item.customClass,
124
132
  customId: item.customId,
125
133
  testId: item.testId,
126
134
  dataSelectorId: item.dataSelectorId
@@ -1099,4 +1099,82 @@ describe('Tab - Behaviour', () => {
1099
1099
 
1100
1100
  expect(document.querySelector('input[name="search"]')).toBeNull();
1101
1101
  });
1102
+ });
1103
+ /*
1104
+ * Per-item customClass exists for the ticket detail-view subtab strip, where a
1105
+ * custom-lookup tab caps its own width.
1106
+ */
1107
+
1108
+ describe('Tab - Item customClass and an inline more menu', () => {
1109
+ test('a data-driven item customClass lands on that tab only', () => {
1110
+ render( /*#__PURE__*/React.createElement(Tabs, {
1111
+ uniqueId: "tabs"
1112
+ }, /*#__PURE__*/React.createElement(TabList, {
1113
+ ariaLabel: "Cities",
1114
+ minVisibleTabs: ITEMS.length,
1115
+ items: ITEMS.map(item => item.value === 'b' ? { ...item,
1116
+ customClass: {
1117
+ tab: 'capped-tab'
1118
+ }
1119
+ } : item)
1120
+ })));
1121
+ expect(screen.getByRole('tab', {
1122
+ name: 'Bravo'
1123
+ }).className).toContain('capped-tab');
1124
+ expect(screen.getByRole('tab', {
1125
+ name: 'Alpha'
1126
+ }).className).not.toContain('capped-tab');
1127
+ expect(screen.getByRole('tab', {
1128
+ name: 'Charlie'
1129
+ }).className).not.toContain('capped-tab');
1130
+ });
1131
+ test('changing only an item customClass re-renders that tab', () => {
1132
+ const renderList = tabClass => /*#__PURE__*/React.createElement(Tabs, {
1133
+ uniqueId: "tabs"
1134
+ }, /*#__PURE__*/React.createElement(TabList, {
1135
+ ariaLabel: "Cities",
1136
+ minVisibleTabs: ITEMS.length,
1137
+ items: ITEMS.map(item => item.value === 'a' ? { ...item,
1138
+ customClass: {
1139
+ tab: tabClass
1140
+ }
1141
+ } : item)
1142
+ }));
1143
+
1144
+ const {
1145
+ rerender
1146
+ } = render(renderList('first-class'));
1147
+ rerender(renderList('second-class'));
1148
+ const tab = screen.getByRole('tab', {
1149
+ name: 'Alpha'
1150
+ });
1151
+ expect(tab.className).toContain('second-class');
1152
+ expect(tab.className).not.toContain('first-class');
1153
+ });
1154
+ test('the data-driven list clips overflow only while the more menu is portalled', () => {
1155
+ const {
1156
+ rerender
1157
+ } = render( /*#__PURE__*/React.createElement(Tabs, {
1158
+ uniqueId: "tabs"
1159
+ }, /*#__PURE__*/React.createElement(TabList, {
1160
+ ariaLabel: "Cities",
1161
+ items: ITEMS
1162
+ })));
1163
+ expect(screen.getByRole('tablist').className).toContain('d-overflow-hidden');
1164
+ /* An inline (absolutely positioned) menu renders inside the list, so a
1165
+ * clipping list would hide it. */
1166
+
1167
+ rerender( /*#__PURE__*/React.createElement(Tabs, {
1168
+ uniqueId: "tabs"
1169
+ }, /*#__PURE__*/React.createElement(TabList, {
1170
+ ariaLabel: "Cities",
1171
+ items: ITEMS,
1172
+ customProps: {
1173
+ popup: {
1174
+ isAbsolutePositioningNeeded: true
1175
+ }
1176
+ }
1177
+ })));
1178
+ expect(screen.getByRole('tablist').className).not.toContain('d-overflow-hidden');
1179
+ });
1102
1180
  });
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`Tab - Snapshot Presets Should render preset INFO_BAR_RAIL 1`] = `
4
4
  <DocumentFragment>
@@ -335,7 +335,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
335
335
  <div
336
336
  aria-label="Cities"
337
337
  aria-orientation="horizontal"
338
- class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 listDotted d-border-dotted listTop"
338
+ class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 d-border-solid listTop"
339
339
  data-a11y-focus-scope="true"
340
340
  data-id="dotTabList"
341
341
  data-test-id="dotTabList"
@@ -344,7 +344,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
344
344
  <button
345
345
  aria-controls="tabs_tabpanel_one"
346
346
  aria-selected="true"
347
- class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabDotted tabTop"
347
+ class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabTop"
348
348
  data-id="dotTab"
349
349
  data-test-id="dotTab"
350
350
  id="tabs_tab_one"
@@ -365,7 +365,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
365
365
  </button>
366
366
  <button
367
367
  aria-selected="false"
368
- class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabDotted tabTop"
368
+ class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabTop"
369
369
  data-id="dotTab"
370
370
  data-test-id="dotTab"
371
371
  id="tabs_tab_two"
@@ -387,7 +387,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
387
387
  </div>
388
388
  <div
389
389
  aria-labelledby="tabs_tab_one"
390
- class="d-flex-shrink d-overflow-hidden panel d-relative d-min-w-0 panelDotted"
390
+ class="d-flex-shrink d-overflow-hidden panel d-relative d-min-w-0"
391
391
  data-id="dotTabPanel"
392
392
  data-test-id="dotTabPanel"
393
393
  id="tabs_tabpanel_one"
@@ -1880,7 +1880,7 @@ exports[`Tab - Snapshot Render the open more menu with Popup HOC options forward
1880
1880
  <div
1881
1881
  aria-label="Cities"
1882
1882
  aria-orientation="horizontal"
1883
- class="d-flex d-flex-row d-items-stretch d-flex-nowrap d-overflow-hidden list d-relative d-min-w-0 d-border-solid listTop"
1883
+ class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 d-border-solid listTop"
1884
1884
  data-a11y-focus-scope="true"
1885
1885
  data-id="dotTabList"
1886
1886
  data-test-id="dotTabList"
@@ -1,4 +1,4 @@
1
- import { POSITION, SIZE, LABEL_STYLE, ICON_PLACEMENT, TEXT_TRANSFORM, TEXT_TRUNCATE, VARIANT } from "./index";
1
+ import { POSITION, SIZE, LABEL_STYLE, ICON_PLACEMENT, TEXT_TRANSFORM, TEXT_TRUNCATE } from "./index";
2
2
  const INFO_BAR_RAIL_BASE = {
3
3
  position: POSITION.LEFT,
4
4
  hasSurface: true,
@@ -28,7 +28,6 @@ export const INFO_BAR_RAIL_ICON_TOP = { ...INFO_BAR_RAIL_LABELLED,
28
28
  export const SUBTAB_STRIP = {
29
29
  position: POSITION.TOP,
30
30
  size: SIZE.SMALL,
31
- variant: VARIANT.DOTTED,
32
31
  labelStyle: LABEL_STYLE.TEXT,
33
32
  hasListBorder: true,
34
33
  hasListPadding: true,
@@ -8,6 +8,8 @@ export default function Tab(props) {
8
8
  value,
9
9
  isDisabled = false,
10
10
  isAnchor = false,
11
+ tagName: tagNameFromProps,
12
+ a11yAttributes,
11
13
  getRef,
12
14
  displayMode,
13
15
  alignItems,
@@ -30,22 +32,20 @@ export default function Tab(props) {
30
32
  isDisabled
31
33
  };
32
34
  const content = isRenderable(children) ? renderNode(children, slot) : children;
35
+ const tagName = tagNameFromProps || (isAnchor ? 'a' : 'button');
33
36
  const ownedAria = {
34
37
  id: tabProps.id,
35
38
  role: tabProps.role,
36
- type: tabProps.type,
39
+ type: tagName === 'button' ? tabProps.type : undefined,
37
40
  'aria-selected': tabProps['aria-selected'],
38
41
  'aria-controls': tabProps['aria-controls'],
39
42
  'aria-disabled': tabProps['aria-disabled'],
40
43
  tabIndex: tabProps.tabIndex
41
- }; // mergeProps already resolves precedence with ownedAria last, so the result
42
- // goes straight into customAttributes.
43
-
44
+ };
44
45
  const {
45
46
  className,
46
47
  ...mergedProps
47
- } = mergeProps(tabProps, elementProps, ownedAria);
48
- const tagName = isAnchor ? 'a' : 'button';
48
+ } = mergeProps(tabProps, elementProps, ownedAria, a11yAttributes);
49
49
  return /*#__PURE__*/React.createElement(FlexContainer, {
50
50
  as: tagName,
51
51
  display: displayMode,
@@ -119,7 +119,7 @@
119
119
  }
120
120
 
121
121
  .tabSmall {
122
- font-size: var(--zd_font_size12);
122
+ font-size: var(--zd_font_size12) ;
123
123
  padding-block: var(--zd_size6) ;
124
124
  }
125
125
 
@@ -130,7 +130,7 @@
130
130
  }
131
131
 
132
132
  .tabMedium {
133
- font-size: var(--zd_font_size13);
133
+ font-size: var(--zd_font_size13) ;
134
134
  padding-block: var(--zd_size8) ;
135
135
  }
136
136
 
@@ -141,7 +141,7 @@
141
141
  }
142
142
 
143
143
  .tabLarge {
144
- font-size: var(--zd_font_size14);
144
+ font-size: var(--zd_font_size14) ;
145
145
  padding-block: var(--zd_size10) ;
146
146
  }
147
147
 
@@ -96,12 +96,16 @@ const tabItemShape = PropTypes.shape({
96
96
  ariaLabel: PropTypes.string,
97
97
  title: PropTypes.string,
98
98
  tourId: PropTypes.string,
99
+ tagName: PropTypes.string,
100
+ isAnchor: PropTypes.bool,
101
+ a11yAttributes: PropTypes.object,
99
102
  href: PropTypes.string,
100
103
  target: PropTypes.string,
101
104
  rel: PropTypes.string,
102
105
  renderIcon: renderableType,
103
106
  renderBefore: renderableType,
104
107
  renderAfter: renderableType,
108
+ customClass: PropTypes.shape(tabSlotClasses),
105
109
  customId: PropTypes.string,
106
110
  testId: PropTypes.string,
107
111
  dataSelectorId: PropTypes.string
@@ -140,6 +144,8 @@ export const Tab_propTypes = {
140
144
  ariaLabel: PropTypes.string,
141
145
  title: PropTypes.string,
142
146
  tourId: PropTypes.string,
147
+ tagName: PropTypes.string,
148
+ isAnchor: PropTypes.bool,
143
149
  href: PropTypes.string,
144
150
  target: PropTypes.string,
145
151
  rel: PropTypes.string,
package/lib/v1/Tab/Tab.js CHANGED
@@ -49,6 +49,8 @@ var Tab = function Tab(props) {
49
49
  iconName = props.iconName,
50
50
  iconSize = props.iconSize,
51
51
  tourId = props.tourId,
52
+ tagName = props.tagName,
53
+ isAnchorFromProps = props.isAnchor,
52
54
  href = props.href,
53
55
  target = props.target,
54
56
  rel = props.rel,
@@ -106,7 +108,7 @@ var Tab = function Tab(props) {
106
108
  }
107
109
 
108
110
  var classes = getClasses(styleOverrides);
109
- var isAnchor = !!href;
111
+ var isAnchor = isAnchorFromProps !== null && isAnchorFromProps !== void 0 ? isAnchorFromProps : !!href;
110
112
  var elementProps = (0, _mergeProps["default"])({
111
113
  className: classes.tab,
112
114
  href: isAnchor && !isDisabled ? href : undefined,
@@ -117,11 +119,13 @@ var Tab = function Tab(props) {
117
119
  'data-title': title
118
120
  }, {
119
121
  onClick: onClick
120
- }, tabAttributes, a11yAttributes);
122
+ }, tabAttributes);
121
123
  return /*#__PURE__*/_react["default"].createElement(_core.Tab, _extends({
122
124
  value: value,
123
125
  isDisabled: isDisabled,
124
126
  isAnchor: isAnchor,
127
+ tagName: tagName,
128
+ a11yAttributes: a11yAttributes,
125
129
  getRef: getRef,
126
130
  displayMode: "inlineFlex",
127
131
  alignItems: "center",
@@ -90,10 +90,17 @@ var TabList = function TabList(props) {
90
90
  hasOverflow: isDataDriven
91
91
  });
92
92
  }, [styleContext, isDataDriven]);
93
- var scroll = hasScroll ? orientation === _constants2.ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven ? 'hidden' : undefined;
93
+ var isMoreMenuInline = !!popupOptions.isAbsolutePositioningNeeded;
94
+ var scroll = hasScroll ? orientation === _constants2.ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven && !isMoreMenuInline ? 'hidden' : undefined;
95
+
96
+ var getClassSignature = function getClassSignature(itemClass) {
97
+ return itemClass ? Object.keys(itemClass).map(function (slot) {
98
+ return "".concat(slot, ":").concat(itemClass[slot] || '');
99
+ }).join(',') : '';
100
+ };
94
101
 
95
102
  var itemsSignature = "".concat(labelStyle || '', "\x01").concat(position || '', "\x01") + (items || _constants.DUMMY_ARRAY).map(function (item) {
96
- return "".concat(item.value, "|").concat(item.text || '', "|").concat(item.iconName || '', "|").concat(item.isDisabled ? 1 : 0, "|").concat(item.renderBefore ? 1 : 0, "|").concat(item.renderAfter ? 1 : 0);
103
+ return "".concat(item.value, "|").concat(item.text || '', "|").concat(item.iconName || '', "|").concat(item.isDisabled ? 1 : 0, "|").concat(item.renderBefore ? 1 : 0, "|").concat(item.renderAfter ? 1 : 0, "|").concat(getClassSignature(item.customClass));
97
104
  }).join("\0");
98
105
 
99
106
  var dataList = (0, _react.useMemo)(function () {
@@ -148,12 +155,16 @@ var TabList = function TabList(props) {
148
155
  ariaLabel: item.ariaLabel,
149
156
  title: item.title,
150
157
  tourId: item.tourId,
158
+ tagName: item.tagName,
159
+ isAnchor: item.isAnchor,
160
+ a11yAttributes: item.a11yAttributes,
151
161
  href: item.href,
152
162
  target: item.target,
153
163
  rel: item.rel,
154
164
  renderIcon: item.renderIcon,
155
165
  renderBefore: item.renderBefore,
156
166
  renderAfter: item.renderAfter,
167
+ customClass: item.customClass,
157
168
  customId: item.customId,
158
169
  testId: item.testId,
159
170
  dataSelectorId: item.dataSelectorId
@@ -1203,4 +1203,90 @@ describe('Tab - Behaviour', function () {
1203
1203
 
1204
1204
  expect(document.querySelector('input[name="search"]')).toBeNull();
1205
1205
  });
1206
+ });
1207
+ /*
1208
+ * Per-item customClass exists for the ticket detail-view subtab strip, where a
1209
+ * custom-lookup tab caps its own width.
1210
+ */
1211
+
1212
+ describe('Tab - Item customClass and an inline more menu', function () {
1213
+ test('a data-driven item customClass lands on that tab only', function () {
1214
+ (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1215
+ uniqueId: "tabs"
1216
+ }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1217
+ ariaLabel: "Cities",
1218
+ minVisibleTabs: ITEMS.length,
1219
+ items: ITEMS.map(function (item) {
1220
+ return item.value === 'b' ? _objectSpread(_objectSpread({}, item), {}, {
1221
+ customClass: {
1222
+ tab: 'capped-tab'
1223
+ }
1224
+ }) : item;
1225
+ })
1226
+ })));
1227
+ expect(_react2.screen.getByRole('tab', {
1228
+ name: 'Bravo'
1229
+ }).className).toContain('capped-tab');
1230
+ expect(_react2.screen.getByRole('tab', {
1231
+ name: 'Alpha'
1232
+ }).className).not.toContain('capped-tab');
1233
+ expect(_react2.screen.getByRole('tab', {
1234
+ name: 'Charlie'
1235
+ }).className).not.toContain('capped-tab');
1236
+ });
1237
+ test('changing only an item customClass re-renders that tab', function () {
1238
+ var renderList = function renderList(tabClass) {
1239
+ return /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1240
+ uniqueId: "tabs"
1241
+ }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1242
+ ariaLabel: "Cities",
1243
+ minVisibleTabs: ITEMS.length,
1244
+ items: ITEMS.map(function (item) {
1245
+ return item.value === 'a' ? _objectSpread(_objectSpread({}, item), {}, {
1246
+ customClass: {
1247
+ tab: tabClass
1248
+ }
1249
+ }) : item;
1250
+ })
1251
+ }));
1252
+ };
1253
+
1254
+ var _render54 = (0, _react2.render)(renderList('first-class')),
1255
+ rerender = _render54.rerender;
1256
+
1257
+ rerender(renderList('second-class'));
1258
+
1259
+ var tab = _react2.screen.getByRole('tab', {
1260
+ name: 'Alpha'
1261
+ });
1262
+
1263
+ expect(tab.className).toContain('second-class');
1264
+ expect(tab.className).not.toContain('first-class');
1265
+ });
1266
+ test('the data-driven list clips overflow only while the more menu is portalled', function () {
1267
+ var _render55 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1268
+ uniqueId: "tabs"
1269
+ }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1270
+ ariaLabel: "Cities",
1271
+ items: ITEMS
1272
+ }))),
1273
+ rerender = _render55.rerender;
1274
+
1275
+ expect(_react2.screen.getByRole('tablist').className).toContain('d-overflow-hidden');
1276
+ /* An inline (absolutely positioned) menu renders inside the list, so a
1277
+ * clipping list would hide it. */
1278
+
1279
+ rerender( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1280
+ uniqueId: "tabs"
1281
+ }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1282
+ ariaLabel: "Cities",
1283
+ items: ITEMS,
1284
+ customProps: {
1285
+ popup: {
1286
+ isAbsolutePositioningNeeded: true
1287
+ }
1288
+ }
1289
+ })));
1290
+ expect(_react2.screen.getByRole('tablist').className).not.toContain('d-overflow-hidden');
1291
+ });
1206
1292
  });
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`Tab - Snapshot Presets Should render preset INFO_BAR_RAIL 1`] = `
4
4
  <DocumentFragment>
@@ -335,7 +335,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
335
335
  <div
336
336
  aria-label="Cities"
337
337
  aria-orientation="horizontal"
338
- class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 listDotted d-border-dotted listTop"
338
+ class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 d-border-solid listTop"
339
339
  data-a11y-focus-scope="true"
340
340
  data-id="dotTabList"
341
341
  data-test-id="dotTabList"
@@ -344,7 +344,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
344
344
  <button
345
345
  aria-controls="tabs_tabpanel_one"
346
346
  aria-selected="true"
347
- class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabDotted tabTop"
347
+ class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabTop"
348
348
  data-id="dotTab"
349
349
  data-test-id="dotTab"
350
350
  id="tabs_tab_one"
@@ -365,7 +365,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
365
365
  </button>
366
366
  <button
367
367
  aria-selected="false"
368
- class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabDotted tabTop"
368
+ class="d-inline-flex d-flex-row d-items-center d-justify-center d-flex-nowrap tab d-relative d-no-underline d-border-solid d-select-none d-cursor-pointer d-min-w-0 d-flex-shrink tabSmall tabTop"
369
369
  data-id="dotTab"
370
370
  data-test-id="dotTab"
371
371
  id="tabs_tab_two"
@@ -387,7 +387,7 @@ exports[`Tab - Snapshot Presets Should render preset SUBTAB_STRIP 1`] = `
387
387
  </div>
388
388
  <div
389
389
  aria-labelledby="tabs_tab_one"
390
- class="d-flex-shrink d-overflow-hidden panel d-relative d-min-w-0 panelDotted"
390
+ class="d-flex-shrink d-overflow-hidden panel d-relative d-min-w-0"
391
391
  data-id="dotTabPanel"
392
392
  data-test-id="dotTabPanel"
393
393
  id="tabs_tabpanel_one"
@@ -1880,7 +1880,7 @@ exports[`Tab - Snapshot Render the open more menu with Popup HOC options forward
1880
1880
  <div
1881
1881
  aria-label="Cities"
1882
1882
  aria-orientation="horizontal"
1883
- class="d-flex d-flex-row d-items-stretch d-flex-nowrap d-overflow-hidden list d-relative d-min-w-0 d-border-solid listTop"
1883
+ class="d-flex d-flex-row d-items-stretch d-flex-nowrap list d-relative d-min-w-0 d-border-solid listTop"
1884
1884
  data-a11y-focus-scope="true"
1885
1885
  data-id="dotTabList"
1886
1886
  data-test-id="dotTabList"
@@ -55,7 +55,6 @@ exports.INFO_BAR_RAIL_ICON_TOP = INFO_BAR_RAIL_ICON_TOP;
55
55
  var SUBTAB_STRIP = {
56
56
  position: _index.POSITION.TOP,
57
57
  size: _index.SIZE.SMALL,
58
- variant: _index.VARIANT.DOTTED,
59
58
  labelStyle: _index.LABEL_STYLE.TEXT,
60
59
  hasListBorder: true,
61
60
  hasListPadding: true,
@@ -17,7 +17,7 @@ var _mergeProps2 = _interopRequireDefault(require("@zohodesk/utils/es/mergeProps
17
17
 
18
18
  var _renderNode = _interopRequireWildcard(require("@zohodesk/utils/es/renderNode"));
19
19
 
20
- var _excluded = ["value", "isDisabled", "isAnchor", "getRef", "displayMode", "alignItems", "justifyContent", "customId", "testId", "children"],
20
+ var _excluded = ["value", "isDisabled", "isAnchor", "tagName", "a11yAttributes", "getRef", "displayMode", "alignItems", "justifyContent", "customId", "testId", "children"],
21
21
  _excluded2 = ["className"];
22
22
 
23
23
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -36,6 +36,8 @@ function Tab(props) {
36
36
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
37
37
  _props$isAnchor = props.isAnchor,
38
38
  isAnchor = _props$isAnchor === void 0 ? false : _props$isAnchor,
39
+ tagNameFromProps = props.tagName,
40
+ a11yAttributes = props.a11yAttributes,
39
41
  getRef = props.getRef,
40
42
  displayMode = props.displayMode,
41
43
  alignItems = props.alignItems,
@@ -58,22 +60,21 @@ function Tab(props) {
58
60
  isDisabled: isDisabled
59
61
  };
60
62
  var content = (0, _renderNode.isRenderable)(children) ? (0, _renderNode["default"])(children, slot) : children;
63
+ var tagName = tagNameFromProps || (isAnchor ? 'a' : 'button');
61
64
  var ownedAria = {
62
65
  id: tabProps.id,
63
66
  role: tabProps.role,
64
- type: tabProps.type,
67
+ type: tagName === 'button' ? tabProps.type : undefined,
65
68
  'aria-selected': tabProps['aria-selected'],
66
69
  'aria-controls': tabProps['aria-controls'],
67
70
  'aria-disabled': tabProps['aria-disabled'],
68
71
  tabIndex: tabProps.tabIndex
69
- }; // mergeProps already resolves precedence with ownedAria last, so the result
70
- // goes straight into customAttributes.
72
+ };
71
73
 
72
- var _mergeProps = (0, _mergeProps2["default"])(tabProps, elementProps, ownedAria),
74
+ var _mergeProps = (0, _mergeProps2["default"])(tabProps, elementProps, ownedAria, a11yAttributes),
73
75
  className = _mergeProps.className,
74
76
  mergedProps = _objectWithoutProperties(_mergeProps, _excluded2);
75
77
 
76
- var tagName = isAnchor ? 'a' : 'button';
77
78
  return /*#__PURE__*/_react["default"].createElement(_FlexContainer["default"], {
78
79
  as: tagName,
79
80
  display: displayMode,
@@ -119,7 +119,7 @@
119
119
  }
120
120
 
121
121
  .tabSmall {
122
- font-size: var(--zd_font_size12);
122
+ font-size: var(--zd_font_size12) ;
123
123
  padding-block: var(--zd_size6) ;
124
124
  }
125
125
 
@@ -130,7 +130,7 @@
130
130
  }
131
131
 
132
132
  .tabMedium {
133
- font-size: var(--zd_font_size13);
133
+ font-size: var(--zd_font_size13) ;
134
134
  padding-block: var(--zd_size8) ;
135
135
  }
136
136
 
@@ -141,7 +141,7 @@
141
141
  }
142
142
 
143
143
  .tabLarge {
144
- font-size: var(--zd_font_size14);
144
+ font-size: var(--zd_font_size14) ;
145
145
  padding-block: var(--zd_size10) ;
146
146
  }
147
147
 
@@ -118,12 +118,16 @@ var tabItemShape = _propTypes["default"].shape({
118
118
  ariaLabel: _propTypes["default"].string,
119
119
  title: _propTypes["default"].string,
120
120
  tourId: _propTypes["default"].string,
121
+ tagName: _propTypes["default"].string,
122
+ isAnchor: _propTypes["default"].bool,
123
+ a11yAttributes: _propTypes["default"].object,
121
124
  href: _propTypes["default"].string,
122
125
  target: _propTypes["default"].string,
123
126
  rel: _propTypes["default"].string,
124
127
  renderIcon: renderableType,
125
128
  renderBefore: renderableType,
126
129
  renderAfter: renderableType,
130
+ customClass: _propTypes["default"].shape(tabSlotClasses),
127
131
  customId: _propTypes["default"].string,
128
132
  testId: _propTypes["default"].string,
129
133
  dataSelectorId: _propTypes["default"].string
@@ -163,6 +167,8 @@ var Tab_propTypes = {
163
167
  ariaLabel: _propTypes["default"].string,
164
168
  title: _propTypes["default"].string,
165
169
  tourId: _propTypes["default"].string,
170
+ tagName: _propTypes["default"].string,
171
+ isAnchor: _propTypes["default"].bool,
166
172
  href: _propTypes["default"].string,
167
173
  target: _propTypes["default"].string,
168
174
  rel: _propTypes["default"].string,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-temp-262.1",
3
+ "version": "1.0.0-temp-262.3",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "types": "lib/index.d.ts",