@zohodesk/components 1.0.0-temp-262.2 → 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
@@ -2,7 +2,6 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- - **v1 Tab** - `Tab` (and data-driven `TabList` items) accept `renderAction`: an interactive node rendered beside the `role="tab"` button instead of inside it. The `tab` slot then styles a wrapper (`data-selected` / `data-disabled`) that also carries `customId`, `testId`, `dataSelectorId` and `tourId`; new `tabTrigger` / `tabAction` slots. Not shown in the overflow menu.
6
5
  - **v1 Tab** - Data-driven `TabList` items accept a per-item `customClass`.
7
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.
8
7
 
package/es/v1/Tab/Tab.js CHANGED
@@ -1,7 +1,7 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
- import { Tab as TabCore, useTabsData } from "./core";
4
+ import { Tab as TabCore } from "./core";
5
5
  import mergeProps from '@zohodesk/utils/es/mergeProps';
6
6
  import renderNode, { isRenderable } from '@zohodesk/utils/es/renderNode';
7
7
  import FlexContainer from '@zohodesk/layout/es/Flex/FlexContainer';
@@ -24,13 +24,14 @@ 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,
30
32
  renderIcon,
31
33
  renderBefore,
32
34
  renderAfter,
33
- renderAction,
34
35
  onClick,
35
36
  getRef,
36
37
  customClass,
@@ -62,9 +63,6 @@ const Tab = props => {
62
63
  textTransform: textTransformFromGroup,
63
64
  textTruncate: textTruncateFromGroup
64
65
  } = useTabsStyle('Tab');
65
- const {
66
- selectedValue
67
- } = useTabsData('Tab');
68
66
  const textTransform = textTransformFromGroup || TEXT_TRANSFORM.CAPITAL;
69
67
  const textTruncate = textTruncateFromGroup || TEXT_TRUNCATE.CLAMP;
70
68
  const isTextOnly = labelStyle === LABEL_STYLE.TEXT;
@@ -89,33 +87,32 @@ const Tab = props => {
89
87
  }
90
88
 
91
89
  const classes = getClasses(styleOverrides);
92
- const isAnchor = !!href; // With an action the visual tab becomes a wrapper around the role="tab"
93
- // trigger, so an interactive action never nests inside the <button>.
94
-
95
- const hasAction = isRenderable(renderAction);
90
+ const isAnchor = isAnchorFromProps ?? !!href;
96
91
  const elementProps = mergeProps({
97
- className: hasAction ? classes.tabTrigger : classes.tab,
92
+ className: classes.tab,
98
93
  href: isAnchor && !isDisabled ? href : undefined,
99
94
  target: isAnchor ? target : undefined,
100
95
  rel: isAnchor ? rel : undefined,
101
- 'data-tour': hasAction ? undefined : tourId,
96
+ 'data-tour': tourId,
102
97
  'aria-label': accessibleName,
103
98
  'data-title': title
104
99
  }, {
105
100
  onClick
106
- }, tabAttributes, a11yAttributes);
107
- const trigger = /*#__PURE__*/React.createElement(TabCore, _extends({
101
+ }, tabAttributes);
102
+ return /*#__PURE__*/React.createElement(TabCore, _extends({
108
103
  value: value,
109
104
  isDisabled: isDisabled,
110
105
  isAnchor: isAnchor,
106
+ tagName: tagName,
107
+ a11yAttributes: a11yAttributes,
111
108
  getRef: getRef,
112
109
  displayMode: "inlineFlex",
113
110
  alignItems: "center",
114
111
  justifyContent: justifyContent
115
112
  }, elementProps, {
116
- customId: hasAction ? undefined : customId,
117
- testId: hasAction ? undefined : testId,
118
- "data-selector-id": hasAction ? undefined : dataSelectorId
113
+ customId: customId,
114
+ testId: testId,
115
+ "data-selector-id": dataSelectorId
119
116
  }), ({
120
117
  isSelected
121
118
  }) => {
@@ -154,37 +151,6 @@ const Tab = props => {
154
151
  $tagAttributes_container: tabTextAttributes
155
152
  }), text) : null, children, isRenderable(renderAfter) ? renderNode(renderAfter, slot) : null);
156
153
  });
157
-
158
- if (!hasAction) {
159
- return trigger;
160
- }
161
-
162
- const isSelected = value === selectedValue;
163
- const actionSlot = {
164
- value,
165
- isSelected,
166
- isDisabled
167
- };
168
- return /*#__PURE__*/React.createElement(FlexContainer, {
169
- as: "span",
170
- display: "inlineFlex",
171
- alignItems: "center",
172
- justifyContent: justifyContent,
173
- customClass: classes.tab,
174
- customId: customId,
175
- testId: testId,
176
- customAttributes: {
177
- role: 'presentation',
178
- 'data-selected': String(isSelected),
179
- 'data-disabled': String(!!isDisabled),
180
- 'data-tour': tourId,
181
- 'data-selector-id': dataSelectorId
182
- }
183
- }, trigger, /*#__PURE__*/React.createElement(FlexItem, {
184
- as: "span",
185
- shrink: "0",
186
- customClass: classes.tabAction
187
- }, renderNode(renderAction, actionSlot)));
188
154
  };
189
155
 
190
156
  export default Tab;
@@ -64,15 +64,13 @@ const TabList = props => {
64
64
  });
65
65
  const styleValue = useMemo(() => ({ ...styleContext,
66
66
  hasOverflow: isDataDriven
67
- }), [styleContext, isDataDriven]); // An inline (absolutely positioned) more menu renders inside the list, so
68
- // clipping the list would hide it; a portalled menu escapes the clip.
69
-
67
+ }), [styleContext, isDataDriven]);
70
68
  const isMoreMenuInline = !!popupOptions.isAbsolutePositioningNeeded;
71
69
  const scroll = hasScroll ? orientation === ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven && !isMoreMenuInline ? 'hidden' : undefined;
72
70
 
73
71
  const getClassSignature = itemClass => itemClass ? Object.keys(itemClass).map(slot => `${slot}:${itemClass[slot] || ''}`).join(',') : '';
74
72
 
75
- 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}|${item.renderAction ? 1 : 0}|${getClassSignature(item.customClass)}`).join('\u0000');
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');
76
74
  const dataList = useMemo(() => items || DUMMY_ARRAY, [itemsSignature]);
77
75
  const {
78
76
  parentRef,
@@ -121,13 +119,15 @@ const TabList = props => {
121
119
  ariaLabel: item.ariaLabel,
122
120
  title: item.title,
123
121
  tourId: item.tourId,
122
+ tagName: item.tagName,
123
+ isAnchor: item.isAnchor,
124
+ a11yAttributes: item.a11yAttributes,
124
125
  href: item.href,
125
126
  target: item.target,
126
127
  rel: item.rel,
127
128
  renderIcon: item.renderIcon,
128
129
  renderBefore: item.renderBefore,
129
130
  renderAfter: item.renderAfter,
130
- renderAction: item.renderAction,
131
131
  customClass: item.customClass,
132
132
  customId: item.customId,
133
133
  testId: item.testId,
@@ -1101,13 +1101,11 @@ describe('Tab - Behaviour', () => {
1101
1101
  });
1102
1102
  });
1103
1103
  /*
1104
- * Per-item customClass and renderAction exist for the ticket detail-view
1105
- * subtab strip: a custom-lookup tab caps its own width, and the conversation
1106
- * tab carries an interactive view-type menu that must not nest inside the
1107
- * <button role="tab">.
1104
+ * Per-item customClass exists for the ticket detail-view subtab strip, where a
1105
+ * custom-lookup tab caps its own width.
1108
1106
  */
1109
1107
 
1110
- describe('Tab - Item customClass, renderAction and an inline more menu', () => {
1108
+ describe('Tab - Item customClass and an inline more menu', () => {
1111
1109
  test('a data-driven item customClass lands on that tab only', () => {
1112
1110
  render( /*#__PURE__*/React.createElement(Tabs, {
1113
1111
  uniqueId: "tabs"
@@ -1153,113 +1151,6 @@ describe('Tab - Item customClass, renderAction and an inline more menu', () => {
1153
1151
  expect(tab.className).toContain('second-class');
1154
1152
  expect(tab.className).not.toContain('first-class');
1155
1153
  });
1156
- test('renderAction renders beside the tab button, never inside it', () => {
1157
- render( /*#__PURE__*/React.createElement(Tabs, {
1158
- uniqueId: "tabs",
1159
- selectedValue: "one"
1160
- }, /*#__PURE__*/React.createElement(TabList, {
1161
- ariaLabel: "Cities"
1162
- }, /*#__PURE__*/React.createElement(Tab, {
1163
- value: "one",
1164
- text: "one",
1165
- customId: "one_Tab",
1166
- renderAction: () => /*#__PURE__*/React.createElement("button", {
1167
- type: "button"
1168
- }, "view")
1169
- }), /*#__PURE__*/React.createElement(Tab, {
1170
- value: "two",
1171
- text: "two"
1172
- }))));
1173
- const tab = screen.getByRole('tab', {
1174
- name: 'one'
1175
- });
1176
- const action = screen.getByRole('button', {
1177
- name: 'view'
1178
- });
1179
- expect(tab.contains(action)).toBe(false);
1180
- expect(tab.querySelector('button')).toBeNull();
1181
- /* The wrapper is the visual tab: it holds both, carries the state and the ids. */
1182
-
1183
- const wrapper = tab.parentElement;
1184
- expect(wrapper.contains(action)).toBe(true);
1185
- expect(wrapper).toHaveAttribute('data-selected', 'true');
1186
- expect(wrapper).toHaveAttribute('data-id', 'one_Tab');
1187
- expect(tab).not.toHaveAttribute('data-id', 'one_Tab');
1188
- expect(wrapper.className).toContain('tab');
1189
- expect(tab.className).toContain('tabTrigger');
1190
- /* The wrapper is the direct child the adaptive renderer measures. */
1191
-
1192
- expect(wrapper.parentElement).toBe(screen.getByRole('tablist'));
1193
- });
1194
- test('without renderAction the tab DOM is unchanged', () => {
1195
- render( /*#__PURE__*/React.createElement(Tabs, {
1196
- uniqueId: "tabs"
1197
- }, /*#__PURE__*/React.createElement(TabList, {
1198
- ariaLabel: "Cities"
1199
- }, /*#__PURE__*/React.createElement(Tab, {
1200
- value: "one",
1201
- text: "one"
1202
- }))));
1203
- const tab = screen.getByRole('tab', {
1204
- name: 'one'
1205
- });
1206
- expect(tab.parentElement).toBe(screen.getByRole('tablist'));
1207
- expect(tab.className).not.toContain('tabTrigger');
1208
- });
1209
- test('the wrapper follows selection and the trigger still selects on click', () => {
1210
- const onChange = jest.fn();
1211
- render( /*#__PURE__*/React.createElement(Tabs, {
1212
- uniqueId: "tabs",
1213
- defaultValue: "one",
1214
- onChange: onChange
1215
- }, /*#__PURE__*/React.createElement(TabList, {
1216
- ariaLabel: "Cities"
1217
- }, /*#__PURE__*/React.createElement(Tab, {
1218
- value: "one",
1219
- text: "one"
1220
- }), /*#__PURE__*/React.createElement(Tab, {
1221
- value: "two",
1222
- text: "two",
1223
- renderAction: () => /*#__PURE__*/React.createElement("span", null, "action")
1224
- }))));
1225
- const two = screen.getByRole('tab', {
1226
- name: 'two'
1227
- });
1228
- expect(two.parentElement).toHaveAttribute('data-selected', 'false');
1229
- onChange.mockClear();
1230
- fireEvent.click(two);
1231
- expect(onChange).toHaveBeenCalledWith(expect.objectContaining({
1232
- value: 'two'
1233
- }), expect.anything());
1234
- expect(two.parentElement).toHaveAttribute('data-selected', 'true');
1235
- });
1236
- test('a data-driven item forwards renderAction, with the slot state', () => {
1237
- render( /*#__PURE__*/React.createElement(Tabs, {
1238
- uniqueId: "tabs",
1239
- selectedValue: "a"
1240
- }, /*#__PURE__*/React.createElement(TabList, {
1241
- ariaLabel: "Cities",
1242
- minVisibleTabs: ITEMS.length,
1243
- items: ITEMS.map(item => item.value === 'a' ? { ...item,
1244
- renderAction: ({
1245
- isSelected
1246
- }) => /*#__PURE__*/React.createElement("span", null, `action-${isSelected}`)
1247
- } : item)
1248
- })));
1249
- const tab = screen.getByRole('tab', {
1250
- name: 'Alpha'
1251
- });
1252
- const action = screen.getByText('action-true');
1253
- expect(tab.contains(action)).toBe(false);
1254
- expect(tab.parentElement.contains(action)).toBe(true);
1255
- });
1256
- test('selected and disabled styles also target the action wrapper', () => {
1257
- const css = readStylesheet();
1258
- ['tab', 'tabElevated', 'tabSpaced', 'tabDotted'].forEach(selector => {
1259
- expect(css).toMatch(new RegExp(`\\.${selector}\\[data-selected='true'\\]`));
1260
- });
1261
- expect(css).toMatch(/\.tab\[data-disabled='true'\]/);
1262
- });
1263
1154
  test('the data-driven list clips overflow only while the more menu is portalled', () => {
1264
1155
  const {
1265
1156
  rerender
@@ -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"
@@ -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,
@@ -35,30 +35,8 @@
35
35
  background-color var(--zd_transition2) ease;
36
36
  background-color: transparent;
37
37
  }
38
-
39
- /* A trigger inside an action wrapper: the wrapper carries the visual tab. */
40
- .tabTrigger {
41
- appearance: none;
42
- font: inherit;
43
- color: inherit;
44
- margin: 0 ;
45
- padding: 0 ;
46
- border-width: 0;
47
- cursor: inherit;
48
- background-color: transparent;
49
- }
50
38
  /* stylelint-enable @zohodesk/use-common-class */
51
39
 
52
- .tabTrigger::after {
53
- content: '';
54
- position: absolute;
55
- inset: 0 ;
56
- }
57
-
58
- .tabAction {
59
- z-index: 1;
60
- }
61
-
62
40
  .moreBox {
63
41
  min-inline-size: var(--zd_size160) ;
64
42
  }
@@ -98,17 +76,12 @@
98
76
  color: var(--zdt_v1_tab_text_hover);
99
77
  }
100
78
 
101
- .tab[aria-selected='true'],
102
- .tab[data-selected='true'] {
79
+ .tab[aria-selected='true'] {
103
80
  color: var(--zdt_v1_tab_text_active);
104
- }
105
-
106
- .tab[aria-selected='true'], .tab[data-selected='true'] {
107
81
  border-color: var(--zdt_v1_tab_indicator_active);
108
82
  }
109
83
 
110
84
  .tab:focus-visible,
111
- .tabTrigger:focus-visible::after,
112
85
  .more:focus-visible,
113
86
  .panel:focus-visible {
114
87
  outline: 2px solid var(--zdt_v1_tab_indicator_active);
@@ -146,7 +119,7 @@
146
119
  }
147
120
 
148
121
  .tabSmall {
149
- font-size: var(--zd_font_size12);
122
+ font-size: var(--zd_font_size12) ;
150
123
  padding-block: var(--zd_size6) ;
151
124
  }
152
125
 
@@ -157,7 +130,7 @@
157
130
  }
158
131
 
159
132
  .tabMedium {
160
- font-size: var(--zd_font_size13);
133
+ font-size: var(--zd_font_size13) ;
161
134
  padding-block: var(--zd_size8) ;
162
135
  }
163
136
 
@@ -168,7 +141,7 @@
168
141
  }
169
142
 
170
143
  .tabLarge {
171
- font-size: var(--zd_font_size14);
144
+ font-size: var(--zd_font_size14) ;
172
145
  padding-block: var(--zd_size10) ;
173
146
  }
174
147
 
@@ -226,12 +199,8 @@
226
199
  background-color: var(--zdt_v1_tab_preset_bg_hover);
227
200
  }
228
201
 
229
- .tabElevated[aria-selected='true'],
230
- .tabElevated[data-selected='true'] {
202
+ .tabElevated[aria-selected='true'] {
231
203
  color: var(--zdt_v1_tab_preset_text_active);
232
- }
233
-
234
- .tabElevated[aria-selected='true'], .tabElevated[data-selected='true'] {
235
204
  border-color: var(--zdt_v1_tab_preset_indicator_active);
236
205
  }
237
206
 
@@ -276,12 +245,8 @@
276
245
  background-color: transparent;
277
246
  }
278
247
 
279
- .tabSpaced[aria-selected='true'],
280
- .tabSpaced[data-selected='true'] {
248
+ .tabSpaced[aria-selected='true'] {
281
249
  color: var(--zdt_v1_tab_preset_text_hover);
282
- }
283
-
284
- .tabSpaced[aria-selected='true'], .tabSpaced[data-selected='true'] {
285
250
  border-color: var(--zdt_v1_tab_preset_indicator_active);
286
251
  }
287
252
 
@@ -327,12 +292,8 @@
327
292
  background-color: transparent;
328
293
  }
329
294
 
330
- .tabDotted[aria-selected='true'],
331
- .tabDotted[data-selected='true'] {
295
+ .tabDotted[aria-selected='true'] {
332
296
  color: var(--zdt_v1_tab_preset_text_active);
333
- }
334
-
335
- .tabDotted[aria-selected='true'], .tabDotted[data-selected='true'] {
336
297
  border-color: var(--zdt_v1_tab_preset_delta_indicator_active);
337
298
  }
338
299
 
@@ -390,12 +351,10 @@
390
351
  /* ---------- Disabled (always last) ---------- */
391
352
 
392
353
  .tab[aria-disabled='true'],
393
- .tab[aria-disabled='true']:hover,
394
- .tab[data-disabled='true'],
395
- .tab[data-disabled='true']:hover {
354
+ .tab[aria-disabled='true']:hover {
396
355
  color: var(--zdt_v1_tab_text_disabled);
397
356
  }
398
357
 
399
- .tab[aria-disabled='true'], .tab[aria-disabled='true']:hover, .tab[data-disabled='true'], .tab[data-disabled='true']:hover {
358
+ .tab[aria-disabled='true'], .tab[aria-disabled='true']:hover {
400
359
  background-color: transparent;
401
360
  }
@@ -97,15 +97,6 @@ const tabSlots = csv({
97
97
  }
98
98
  }
99
99
  },
100
- // With `renderAction` the `tab` slot styles a wrapper; the role="tab"
101
- // trigger inside it is flush, and its ::after stretches over the wrapper
102
- // so the whole tab stays clickable.
103
- tabTrigger: {
104
- base: [style.tabTrigger, 'd-min-w-0', 'd-max-w-full', 'd-no-underline', 'd-select-none']
105
- },
106
- tabAction: {
107
- base: [style.tabAction, 'd-relative', 'd-inline-flex', 'd-items-center']
108
- },
109
100
  content: {
110
101
  // `d-flex` comes from the FlexContainer that renders this slot.
111
102
  base: ['d-min-w-0', 'd-max-w-full'],
@@ -5,8 +5,6 @@ const renderableType = PropTypes.oneOfType([PropTypes.node, PropTypes.func]);
5
5
  const classType = PropTypes.string;
6
6
  const tabSlotClasses = {
7
7
  tab: classType,
8
- tabTrigger: classType,
9
- tabAction: classType,
10
8
  content: classType,
11
9
  iconBox: classType,
12
10
  tabText: classType
@@ -98,15 +96,15 @@ const tabItemShape = PropTypes.shape({
98
96
  ariaLabel: PropTypes.string,
99
97
  title: PropTypes.string,
100
98
  tourId: PropTypes.string,
99
+ tagName: PropTypes.string,
100
+ isAnchor: PropTypes.bool,
101
+ a11yAttributes: PropTypes.object,
101
102
  href: PropTypes.string,
102
103
  target: PropTypes.string,
103
104
  rel: PropTypes.string,
104
105
  renderIcon: renderableType,
105
106
  renderBefore: renderableType,
106
107
  renderAfter: renderableType,
107
-
108
- /* Rendered beside the tab button, outside it; not shown in the more menu. */
109
- renderAction: renderableType,
110
108
  customClass: PropTypes.shape(tabSlotClasses),
111
109
  customId: PropTypes.string,
112
110
  testId: PropTypes.string,
@@ -146,6 +144,8 @@ export const Tab_propTypes = {
146
144
  ariaLabel: PropTypes.string,
147
145
  title: PropTypes.string,
148
146
  tourId: PropTypes.string,
147
+ tagName: PropTypes.string,
148
+ isAnchor: PropTypes.bool,
149
149
  href: PropTypes.string,
150
150
  target: PropTypes.string,
151
151
  rel: PropTypes.string,
@@ -154,11 +154,6 @@ export const Tab_propTypes = {
154
154
  renderIcon: renderableType,
155
155
  renderBefore: renderableType,
156
156
  renderAfter: renderableType,
157
-
158
- /* Interactive node rendered beside the role="tab" button, outside it. The
159
- * `tab` slot then styles a wrapper that also carries customId, testId,
160
- * dataSelectorId and tourId. */
161
- renderAction: renderableType,
162
157
  onClick: PropTypes.func,
163
158
  getRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
164
159
  customClass: PropTypes.shape(tabSlotClasses),
package/lib/v1/Tab/Tab.js CHANGED
@@ -49,13 +49,14 @@ 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,
55
57
  renderIcon = props.renderIcon,
56
58
  renderBefore = props.renderBefore,
57
59
  renderAfter = props.renderAfter,
58
- renderAction = props.renderAction,
59
60
  onClick = props.onClick,
60
61
  getRef = props.getRef,
61
62
  customClass = props.customClass,
@@ -83,9 +84,6 @@ var Tab = function Tab(props) {
83
84
  textTransformFromGroup = _useTabsStyle.textTransform,
84
85
  textTruncateFromGroup = _useTabsStyle.textTruncate;
85
86
 
86
- var _useTabsData = (0, _core.useTabsData)('Tab'),
87
- selectedValue = _useTabsData.selectedValue;
88
-
89
87
  var textTransform = textTransformFromGroup || _constants.TEXT_TRANSFORM.CAPITAL;
90
88
  var textTruncate = textTruncateFromGroup || _constants.TEXT_TRUNCATE.CLAMP;
91
89
  var isTextOnly = labelStyle === _constants.LABEL_STYLE.TEXT;
@@ -110,34 +108,32 @@ var Tab = function Tab(props) {
110
108
  }
111
109
 
112
110
  var classes = getClasses(styleOverrides);
113
- var isAnchor = !!href; // With an action the visual tab becomes a wrapper around the role="tab"
114
- // trigger, so an interactive action never nests inside the <button>.
115
-
116
- var hasAction = (0, _renderNode.isRenderable)(renderAction);
111
+ var isAnchor = isAnchorFromProps !== null && isAnchorFromProps !== void 0 ? isAnchorFromProps : !!href;
117
112
  var elementProps = (0, _mergeProps["default"])({
118
- className: hasAction ? classes.tabTrigger : classes.tab,
113
+ className: classes.tab,
119
114
  href: isAnchor && !isDisabled ? href : undefined,
120
115
  target: isAnchor ? target : undefined,
121
116
  rel: isAnchor ? rel : undefined,
122
- 'data-tour': hasAction ? undefined : tourId,
117
+ 'data-tour': tourId,
123
118
  'aria-label': accessibleName,
124
119
  'data-title': title
125
120
  }, {
126
121
  onClick: onClick
127
- }, tabAttributes, a11yAttributes);
128
-
129
- var trigger = /*#__PURE__*/_react["default"].createElement(_core.Tab, _extends({
122
+ }, tabAttributes);
123
+ return /*#__PURE__*/_react["default"].createElement(_core.Tab, _extends({
130
124
  value: value,
131
125
  isDisabled: isDisabled,
132
126
  isAnchor: isAnchor,
127
+ tagName: tagName,
128
+ a11yAttributes: a11yAttributes,
133
129
  getRef: getRef,
134
130
  displayMode: "inlineFlex",
135
131
  alignItems: "center",
136
132
  justifyContent: justifyContent
137
133
  }, elementProps, {
138
- customId: hasAction ? undefined : customId,
139
- testId: hasAction ? undefined : testId,
140
- "data-selector-id": hasAction ? undefined : dataSelectorId
134
+ customId: customId,
135
+ testId: testId,
136
+ "data-selector-id": dataSelectorId
141
137
  }), function (_ref) {
142
138
  var isSelected = _ref.isSelected;
143
139
  var slot = {
@@ -175,37 +171,6 @@ var Tab = function Tab(props) {
175
171
  $tagAttributes_container: tabTextAttributes
176
172
  }), text) : null, children, (0, _renderNode.isRenderable)(renderAfter) ? (0, _renderNode["default"])(renderAfter, slot) : null);
177
173
  });
178
-
179
- if (!hasAction) {
180
- return trigger;
181
- }
182
-
183
- var isSelected = value === selectedValue;
184
- var actionSlot = {
185
- value: value,
186
- isSelected: isSelected,
187
- isDisabled: isDisabled
188
- };
189
- return /*#__PURE__*/_react["default"].createElement(_FlexContainer["default"], {
190
- as: "span",
191
- display: "inlineFlex",
192
- alignItems: "center",
193
- justifyContent: justifyContent,
194
- customClass: classes.tab,
195
- customId: customId,
196
- testId: testId,
197
- customAttributes: {
198
- role: 'presentation',
199
- 'data-selected': String(isSelected),
200
- 'data-disabled': String(!!isDisabled),
201
- 'data-tour': tourId,
202
- 'data-selector-id': dataSelectorId
203
- }
204
- }, trigger, /*#__PURE__*/_react["default"].createElement(_FlexItem["default"], {
205
- as: "span",
206
- shrink: "0",
207
- customClass: classes.tabAction
208
- }, (0, _renderNode["default"])(renderAction, actionSlot)));
209
174
  };
210
175
 
211
176
  var _default = Tab;
@@ -89,9 +89,7 @@ var TabList = function TabList(props) {
89
89
  return _objectSpread(_objectSpread({}, styleContext), {}, {
90
90
  hasOverflow: isDataDriven
91
91
  });
92
- }, [styleContext, isDataDriven]); // An inline (absolutely positioned) more menu renders inside the list, so
93
- // clipping the list would hide it; a portalled menu escapes the clip.
94
-
92
+ }, [styleContext, isDataDriven]);
95
93
  var isMoreMenuInline = !!popupOptions.isAbsolutePositioningNeeded;
96
94
  var scroll = hasScroll ? orientation === _constants2.ORIENTATION.VERTICAL ? 'vertical' : 'horizontal' : isDataDriven && !isMoreMenuInline ? 'hidden' : undefined;
97
95
 
@@ -102,7 +100,7 @@ var TabList = function TabList(props) {
102
100
  };
103
101
 
104
102
  var itemsSignature = "".concat(labelStyle || '', "\x01").concat(position || '', "\x01") + (items || _constants.DUMMY_ARRAY).map(function (item) {
105
- 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(item.renderAction ? 1 : 0, "|").concat(getClassSignature(item.customClass));
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));
106
104
  }).join("\0");
107
105
 
108
106
  var dataList = (0, _react.useMemo)(function () {
@@ -157,13 +155,15 @@ var TabList = function TabList(props) {
157
155
  ariaLabel: item.ariaLabel,
158
156
  title: item.title,
159
157
  tourId: item.tourId,
158
+ tagName: item.tagName,
159
+ isAnchor: item.isAnchor,
160
+ a11yAttributes: item.a11yAttributes,
160
161
  href: item.href,
161
162
  target: item.target,
162
163
  rel: item.rel,
163
164
  renderIcon: item.renderIcon,
164
165
  renderBefore: item.renderBefore,
165
166
  renderAfter: item.renderAfter,
166
- renderAction: item.renderAction,
167
167
  customClass: item.customClass,
168
168
  customId: item.customId,
169
169
  testId: item.testId,
@@ -1205,13 +1205,11 @@ describe('Tab - Behaviour', function () {
1205
1205
  });
1206
1206
  });
1207
1207
  /*
1208
- * Per-item customClass and renderAction exist for the ticket detail-view
1209
- * subtab strip: a custom-lookup tab caps its own width, and the conversation
1210
- * tab carries an interactive view-type menu that must not nest inside the
1211
- * <button role="tab">.
1208
+ * Per-item customClass exists for the ticket detail-view subtab strip, where a
1209
+ * custom-lookup tab caps its own width.
1212
1210
  */
1213
1211
 
1214
- describe('Tab - Item customClass, renderAction and an inline more menu', function () {
1212
+ describe('Tab - Item customClass and an inline more menu', function () {
1215
1213
  test('a data-driven item customClass lands on that tab only', function () {
1216
1214
  (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1217
1215
  uniqueId: "tabs"
@@ -1265,132 +1263,6 @@ describe('Tab - Item customClass, renderAction and an inline more menu', functio
1265
1263
  expect(tab.className).toContain('second-class');
1266
1264
  expect(tab.className).not.toContain('first-class');
1267
1265
  });
1268
- test('renderAction renders beside the tab button, never inside it', function () {
1269
- (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1270
- uniqueId: "tabs",
1271
- selectedValue: "one"
1272
- }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1273
- ariaLabel: "Cities"
1274
- }, /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
1275
- value: "one",
1276
- text: "one",
1277
- customId: "one_Tab",
1278
- renderAction: function renderAction() {
1279
- return /*#__PURE__*/_react["default"].createElement("button", {
1280
- type: "button"
1281
- }, "view");
1282
- }
1283
- }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
1284
- value: "two",
1285
- text: "two"
1286
- }))));
1287
-
1288
- var tab = _react2.screen.getByRole('tab', {
1289
- name: 'one'
1290
- });
1291
-
1292
- var action = _react2.screen.getByRole('button', {
1293
- name: 'view'
1294
- });
1295
-
1296
- expect(tab.contains(action)).toBe(false);
1297
- expect(tab.querySelector('button')).toBeNull();
1298
- /* The wrapper is the visual tab: it holds both, carries the state and the ids. */
1299
-
1300
- var wrapper = tab.parentElement;
1301
- expect(wrapper.contains(action)).toBe(true);
1302
- expect(wrapper).toHaveAttribute('data-selected', 'true');
1303
- expect(wrapper).toHaveAttribute('data-id', 'one_Tab');
1304
- expect(tab).not.toHaveAttribute('data-id', 'one_Tab');
1305
- expect(wrapper.className).toContain('tab');
1306
- expect(tab.className).toContain('tabTrigger');
1307
- /* The wrapper is the direct child the adaptive renderer measures. */
1308
-
1309
- expect(wrapper.parentElement).toBe(_react2.screen.getByRole('tablist'));
1310
- });
1311
- test('without renderAction the tab DOM is unchanged', function () {
1312
- (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1313
- uniqueId: "tabs"
1314
- }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1315
- ariaLabel: "Cities"
1316
- }, /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
1317
- value: "one",
1318
- text: "one"
1319
- }))));
1320
-
1321
- var tab = _react2.screen.getByRole('tab', {
1322
- name: 'one'
1323
- });
1324
-
1325
- expect(tab.parentElement).toBe(_react2.screen.getByRole('tablist'));
1326
- expect(tab.className).not.toContain('tabTrigger');
1327
- });
1328
- test('the wrapper follows selection and the trigger still selects on click', function () {
1329
- var onChange = jest.fn();
1330
- (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1331
- uniqueId: "tabs",
1332
- defaultValue: "one",
1333
- onChange: onChange
1334
- }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1335
- ariaLabel: "Cities"
1336
- }, /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
1337
- value: "one",
1338
- text: "one"
1339
- }), /*#__PURE__*/_react["default"].createElement(_Tab["default"], {
1340
- value: "two",
1341
- text: "two",
1342
- renderAction: function renderAction() {
1343
- return /*#__PURE__*/_react["default"].createElement("span", null, "action");
1344
- }
1345
- }))));
1346
-
1347
- var two = _react2.screen.getByRole('tab', {
1348
- name: 'two'
1349
- });
1350
-
1351
- expect(two.parentElement).toHaveAttribute('data-selected', 'false');
1352
- onChange.mockClear();
1353
-
1354
- _react2.fireEvent.click(two);
1355
-
1356
- expect(onChange).toHaveBeenCalledWith(expect.objectContaining({
1357
- value: 'two'
1358
- }), expect.anything());
1359
- expect(two.parentElement).toHaveAttribute('data-selected', 'true');
1360
- });
1361
- test('a data-driven item forwards renderAction, with the slot state', function () {
1362
- (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1363
- uniqueId: "tabs",
1364
- selectedValue: "a"
1365
- }, /*#__PURE__*/_react["default"].createElement(_TabList["default"], {
1366
- ariaLabel: "Cities",
1367
- minVisibleTabs: ITEMS.length,
1368
- items: ITEMS.map(function (item) {
1369
- return item.value === 'a' ? _objectSpread(_objectSpread({}, item), {}, {
1370
- renderAction: function renderAction(_ref6) {
1371
- var isSelected = _ref6.isSelected;
1372
- return /*#__PURE__*/_react["default"].createElement("span", null, "action-".concat(isSelected));
1373
- }
1374
- }) : item;
1375
- })
1376
- })));
1377
-
1378
- var tab = _react2.screen.getByRole('tab', {
1379
- name: 'Alpha'
1380
- });
1381
-
1382
- var action = _react2.screen.getByText('action-true');
1383
-
1384
- expect(tab.contains(action)).toBe(false);
1385
- expect(tab.parentElement.contains(action)).toBe(true);
1386
- });
1387
- test('selected and disabled styles also target the action wrapper', function () {
1388
- var css = readStylesheet();
1389
- ['tab', 'tabElevated', 'tabSpaced', 'tabDotted'].forEach(function (selector) {
1390
- expect(css).toMatch(new RegExp("\\.".concat(selector, "\\[data-selected='true'\\]")));
1391
- });
1392
- expect(css).toMatch(/\.tab\[data-disabled='true'\]/);
1393
- });
1394
1266
  test('the data-driven list clips overflow only while the more menu is portalled', function () {
1395
1267
  var _render55 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
1396
1268
  uniqueId: "tabs"
@@ -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"
@@ -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,
@@ -35,30 +35,8 @@
35
35
  background-color var(--zd_transition2) ease;
36
36
  background-color: transparent;
37
37
  }
38
-
39
- /* A trigger inside an action wrapper: the wrapper carries the visual tab. */
40
- .tabTrigger {
41
- appearance: none;
42
- font: inherit;
43
- color: inherit;
44
- margin: 0 ;
45
- padding: 0 ;
46
- border-width: 0;
47
- cursor: inherit;
48
- background-color: transparent;
49
- }
50
38
  /* stylelint-enable @zohodesk/use-common-class */
51
39
 
52
- .tabTrigger::after {
53
- content: '';
54
- position: absolute;
55
- inset: 0 ;
56
- }
57
-
58
- .tabAction {
59
- z-index: 1;
60
- }
61
-
62
40
  .moreBox {
63
41
  min-inline-size: var(--zd_size160) ;
64
42
  }
@@ -98,17 +76,12 @@
98
76
  color: var(--zdt_v1_tab_text_hover);
99
77
  }
100
78
 
101
- .tab[aria-selected='true'],
102
- .tab[data-selected='true'] {
79
+ .tab[aria-selected='true'] {
103
80
  color: var(--zdt_v1_tab_text_active);
104
- }
105
-
106
- .tab[aria-selected='true'], .tab[data-selected='true'] {
107
81
  border-color: var(--zdt_v1_tab_indicator_active);
108
82
  }
109
83
 
110
84
  .tab:focus-visible,
111
- .tabTrigger:focus-visible::after,
112
85
  .more:focus-visible,
113
86
  .panel:focus-visible {
114
87
  outline: 2px solid var(--zdt_v1_tab_indicator_active);
@@ -146,7 +119,7 @@
146
119
  }
147
120
 
148
121
  .tabSmall {
149
- font-size: var(--zd_font_size12);
122
+ font-size: var(--zd_font_size12) ;
150
123
  padding-block: var(--zd_size6) ;
151
124
  }
152
125
 
@@ -157,7 +130,7 @@
157
130
  }
158
131
 
159
132
  .tabMedium {
160
- font-size: var(--zd_font_size13);
133
+ font-size: var(--zd_font_size13) ;
161
134
  padding-block: var(--zd_size8) ;
162
135
  }
163
136
 
@@ -168,7 +141,7 @@
168
141
  }
169
142
 
170
143
  .tabLarge {
171
- font-size: var(--zd_font_size14);
144
+ font-size: var(--zd_font_size14) ;
172
145
  padding-block: var(--zd_size10) ;
173
146
  }
174
147
 
@@ -226,12 +199,8 @@
226
199
  background-color: var(--zdt_v1_tab_preset_bg_hover);
227
200
  }
228
201
 
229
- .tabElevated[aria-selected='true'],
230
- .tabElevated[data-selected='true'] {
202
+ .tabElevated[aria-selected='true'] {
231
203
  color: var(--zdt_v1_tab_preset_text_active);
232
- }
233
-
234
- .tabElevated[aria-selected='true'], .tabElevated[data-selected='true'] {
235
204
  border-color: var(--zdt_v1_tab_preset_indicator_active);
236
205
  }
237
206
 
@@ -276,12 +245,8 @@
276
245
  background-color: transparent;
277
246
  }
278
247
 
279
- .tabSpaced[aria-selected='true'],
280
- .tabSpaced[data-selected='true'] {
248
+ .tabSpaced[aria-selected='true'] {
281
249
  color: var(--zdt_v1_tab_preset_text_hover);
282
- }
283
-
284
- .tabSpaced[aria-selected='true'], .tabSpaced[data-selected='true'] {
285
250
  border-color: var(--zdt_v1_tab_preset_indicator_active);
286
251
  }
287
252
 
@@ -327,12 +292,8 @@
327
292
  background-color: transparent;
328
293
  }
329
294
 
330
- .tabDotted[aria-selected='true'],
331
- .tabDotted[data-selected='true'] {
295
+ .tabDotted[aria-selected='true'] {
332
296
  color: var(--zdt_v1_tab_preset_text_active);
333
- }
334
-
335
- .tabDotted[aria-selected='true'], .tabDotted[data-selected='true'] {
336
297
  border-color: var(--zdt_v1_tab_preset_delta_indicator_active);
337
298
  }
338
299
 
@@ -390,12 +351,10 @@
390
351
  /* ---------- Disabled (always last) ---------- */
391
352
 
392
353
  .tab[aria-disabled='true'],
393
- .tab[aria-disabled='true']:hover,
394
- .tab[data-disabled='true'],
395
- .tab[data-disabled='true']:hover {
354
+ .tab[aria-disabled='true']:hover {
396
355
  color: var(--zdt_v1_tab_text_disabled);
397
356
  }
398
357
 
399
- .tab[aria-disabled='true'], .tab[aria-disabled='true']:hover, .tab[data-disabled='true'], .tab[data-disabled='true']:hover {
358
+ .tab[aria-disabled='true'], .tab[aria-disabled='true']:hover {
400
359
  background-color: transparent;
401
360
  }
@@ -97,15 +97,6 @@ var tabSlots = (0, _cssUtility.csv)({
97
97
  }
98
98
  }
99
99
  },
100
- // With `renderAction` the `tab` slot styles a wrapper; the role="tab"
101
- // trigger inside it is flush, and its ::after stretches over the wrapper
102
- // so the whole tab stays clickable.
103
- tabTrigger: {
104
- base: [_Tab_v1Module["default"].tabTrigger, 'd-min-w-0', 'd-max-w-full', 'd-no-underline', 'd-select-none']
105
- },
106
- tabAction: {
107
- base: [_Tab_v1Module["default"].tabAction, 'd-relative', 'd-inline-flex', 'd-items-center']
108
- },
109
100
  content: {
110
101
  // `d-flex` comes from the FlexContainer that renders this slot.
111
102
  base: ['d-min-w-0', 'd-max-w-full'],
@@ -24,8 +24,6 @@ var renderableType = _propTypes["default"].oneOfType([_propTypes["default"].node
24
24
  var classType = _propTypes["default"].string;
25
25
  var tabSlotClasses = {
26
26
  tab: classType,
27
- tabTrigger: classType,
28
- tabAction: classType,
29
27
  content: classType,
30
28
  iconBox: classType,
31
29
  tabText: classType
@@ -120,15 +118,15 @@ var tabItemShape = _propTypes["default"].shape({
120
118
  ariaLabel: _propTypes["default"].string,
121
119
  title: _propTypes["default"].string,
122
120
  tourId: _propTypes["default"].string,
121
+ tagName: _propTypes["default"].string,
122
+ isAnchor: _propTypes["default"].bool,
123
+ a11yAttributes: _propTypes["default"].object,
123
124
  href: _propTypes["default"].string,
124
125
  target: _propTypes["default"].string,
125
126
  rel: _propTypes["default"].string,
126
127
  renderIcon: renderableType,
127
128
  renderBefore: renderableType,
128
129
  renderAfter: renderableType,
129
-
130
- /* Rendered beside the tab button, outside it; not shown in the more menu. */
131
- renderAction: renderableType,
132
130
  customClass: _propTypes["default"].shape(tabSlotClasses),
133
131
  customId: _propTypes["default"].string,
134
132
  testId: _propTypes["default"].string,
@@ -169,6 +167,8 @@ var Tab_propTypes = {
169
167
  ariaLabel: _propTypes["default"].string,
170
168
  title: _propTypes["default"].string,
171
169
  tourId: _propTypes["default"].string,
170
+ tagName: _propTypes["default"].string,
171
+ isAnchor: _propTypes["default"].bool,
172
172
  href: _propTypes["default"].string,
173
173
  target: _propTypes["default"].string,
174
174
  rel: _propTypes["default"].string,
@@ -177,11 +177,6 @@ var Tab_propTypes = {
177
177
  renderIcon: renderableType,
178
178
  renderBefore: renderableType,
179
179
  renderAfter: renderableType,
180
-
181
- /* Interactive node rendered beside the role="tab" button, outside it. The
182
- * `tab` slot then styles a wrapper that also carries customId, testId,
183
- * dataSelectorId and tourId. */
184
- renderAction: renderableType,
185
180
  onClick: _propTypes["default"].func,
186
181
  getRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].object]),
187
182
  customClass: _propTypes["default"].shape(tabSlotClasses),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-temp-262.2",
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",