@kaizen/components 0.0.0-canary-guidance-block-codemod-20251215033932 → 0.0.0-canary-01-titleblock-20251216220648

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 (40) hide show
  1. package/codemods/migrateGuidanceBlockActionsToActionsSlot/transformActionsToActionsSlot.spec.ts +105 -0
  2. package/codemods/utils/transformV1ButtonPropsToButtonOrLinkButton.ts +4 -14
  3. package/dist/cjs/src/MenuV1/index.cjs +4 -3
  4. package/dist/cjs/src/TitleBlock/TitleBlock.cjs +32 -36
  5. package/dist/cjs/src/TitleBlock/TitleBlock.module.scss.cjs +5 -1
  6. package/dist/cjs/src/TitleBlock/subcomponents/MainActions.cjs +90 -45
  7. package/dist/cjs/src/TitleBlock/subcomponents/MainActions.module.scss.cjs +3 -1
  8. package/dist/cjs/src/TitleBlock/subcomponents/SecondaryActions.cjs +51 -14
  9. package/dist/esm/src/MenuV1/index.mjs +5 -3
  10. package/dist/esm/src/TitleBlock/TitleBlock.mjs +33 -37
  11. package/dist/esm/src/TitleBlock/TitleBlock.module.scss.mjs +5 -1
  12. package/dist/esm/src/TitleBlock/subcomponents/MainActions.mjs +92 -47
  13. package/dist/esm/src/TitleBlock/subcomponents/MainActions.module.scss.mjs +3 -1
  14. package/dist/esm/src/TitleBlock/subcomponents/SecondaryActions.mjs +51 -14
  15. package/dist/styles.css +89 -210
  16. package/dist/types/TitleBlock/TitleBlock.d.ts +1 -1
  17. package/dist/types/TitleBlock/subcomponents/MainActions.d.ts +4 -3
  18. package/package.json +1 -1
  19. package/src/Avatar/Avatar.module.css +1 -0
  20. package/src/TitleBlock/TitleBlock.module.scss +63 -19
  21. package/src/TitleBlock/TitleBlock.spec.tsx +33 -461
  22. package/src/TitleBlock/TitleBlock.tsx +7 -24
  23. package/src/TitleBlock/_docs/TitleBlock.stories.tsx +59 -12
  24. package/src/TitleBlock/_mixins.scss +6 -0
  25. package/src/TitleBlock/subcomponents/MainActions.module.scss +20 -2
  26. package/src/TitleBlock/subcomponents/MainActions.tsx +127 -70
  27. package/src/TitleBlock/subcomponents/SecondaryActions.tsx +105 -45
  28. package/src/TitleBlock/subcomponents/Toolbar.tsx +1 -0
  29. package/dist/cjs/src/MenuV1/subcomponents/MenuHeading/MenuHeading.cjs +0 -27
  30. package/dist/cjs/src/MenuV1/subcomponents/MenuHeading/MenuHeading.module.scss.cjs +0 -6
  31. package/dist/cjs/src/TitleBlock/subcomponents/MobileActions.cjs +0 -306
  32. package/dist/cjs/src/TitleBlock/subcomponents/MobileActions.module.scss.cjs +0 -16
  33. package/dist/esm/src/MenuV1/subcomponents/MenuHeading/MenuHeading.mjs +0 -21
  34. package/dist/esm/src/MenuV1/subcomponents/MenuHeading/MenuHeading.module.scss.mjs +0 -4
  35. package/dist/esm/src/TitleBlock/subcomponents/MobileActions.mjs +0 -300
  36. package/dist/esm/src/TitleBlock/subcomponents/MobileActions.module.scss.mjs +0 -14
  37. package/dist/types/TitleBlock/subcomponents/MobileActions.d.ts +0 -14
  38. package/src/TitleBlock/subcomponents/MobileActions.module.scss +0 -208
  39. package/src/TitleBlock/subcomponents/MobileActions.spec.tsx +0 -210
  40. package/src/TitleBlock/subcomponents/MobileActions.tsx +0 -472
@@ -10,9 +10,8 @@ import { Select } from '../Select/Select.mjs';
10
10
  import { Tag } from '../Tag/Tag.mjs';
11
11
  import { useMediaQueries } from '../utils/useMediaQueries.mjs';
12
12
  import { MainActions } from './subcomponents/MainActions.mjs';
13
- import { MobileActions } from './subcomponents/MobileActions.mjs';
14
13
  import { SecondaryActions } from './subcomponents/SecondaryActions.mjs';
15
- import { isReversed, createTabletOverflowMenuItems } from './utils.mjs';
14
+ import { isReversed } from './utils.mjs';
16
15
  import styles from './TitleBlock.module.scss.mjs';
17
16
  var renderTag = function (surveyStatus) {
18
17
  var tagVariant;
@@ -108,6 +107,12 @@ var Breadcrumb = function (_a) {
108
107
  name: "arrow_back",
109
108
  isPresentational: true,
110
109
  shouldMirrorInRTL: true
110
+ })), /*#__PURE__*/React.createElement("div", {
111
+ className: styles.staticIcon
112
+ }, /*#__PURE__*/React.createElement(Icon, {
113
+ name: "arrow_back",
114
+ isPresentational: true,
115
+ shouldMirrorInRTL: true
111
116
  })), /*#__PURE__*/React.createElement("span", {
112
117
  className: styles.breadcrumbTextLink,
113
118
  "data-automation-id": textAutomationId,
@@ -164,7 +169,7 @@ var renderNavigationTabs = function (navigationTabs, collapse, ariaLabel) {
164
169
  */
165
170
  const TitleBlock = /*#__PURE__*/function () {
166
171
  const TitleBlock = function (_a) {
167
- var _b, _c, _d, _e;
172
+ var _b, _c, _d;
168
173
  var title = _a.title,
169
174
  variant = _a.variant,
170
175
  breadcrumb = _a.breadcrumb,
@@ -180,32 +185,30 @@ const TitleBlock = /*#__PURE__*/function () {
180
185
  secondaryActions = _a.secondaryActions,
181
186
  secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
182
187
  navigationTabs = _a.navigationTabs,
183
- _f = _a.collapseNavigationAreaWhenPossible,
184
- collapseNavigationAreaWhenPossible = _f === void 0 ? false : _f,
188
+ _e = _a.collapseNavigationAreaWhenPossible,
189
+ collapseNavigationAreaWhenPossible = _e === void 0 ? false : _e,
185
190
  textDirection = _a.textDirection,
186
191
  surveyStatus = _a.surveyStatus,
187
192
  id = _a.id,
188
- _g = _a.titleAutomationId,
189
- titleAutomationId = _g === void 0 ? 'TitleBlock__Title' : _g,
190
- _h = _a.avatarAutomationId,
191
- avatarAutomationId = _h === void 0 ? 'TitleBlock__Avatar' : _h,
192
- _j = _a.subtitleAutomationId,
193
- subtitleAutomationId = _j === void 0 ? 'TitleBlock__Subtitle' : _j,
194
- _k = _a.sectionTitleAutomationId,
195
- sectionTitleAutomationId = _k === void 0 ? 'TitleBlock__SectionTitle' : _k,
196
- _l = _a.sectionTitleDescriptionAutomationId,
197
- sectionTitleDescriptionAutomationId = _l === void 0 ? 'TitleBlock__SectionTitleDescription' : _l,
198
- _m = _a.breadcrumbAutomationId,
199
- breadcrumbAutomationId = _m === void 0 ? 'TitleBlock__Breadcrumb' : _m,
200
- _o = _a.breadcrumbTextAutomationId,
201
- breadcrumbTextAutomationId = _o === void 0 ? 'TitleBlock__BreadcrumbText' : _o,
202
- _p = _a.autoHideMobileActionsMenu,
203
- autoHideMobileActionsMenu = _p === void 0 ? false : _p;
193
+ _f = _a.titleAutomationId,
194
+ titleAutomationId = _f === void 0 ? 'TitleBlock__Title' : _f,
195
+ _g = _a.avatarAutomationId,
196
+ avatarAutomationId = _g === void 0 ? 'TitleBlock__Avatar' : _g,
197
+ _h = _a.subtitleAutomationId,
198
+ subtitleAutomationId = _h === void 0 ? 'TitleBlock__Subtitle' : _h,
199
+ _j = _a.sectionTitleAutomationId,
200
+ sectionTitleAutomationId = _j === void 0 ? 'TitleBlock__SectionTitle' : _j,
201
+ _k = _a.sectionTitleDescriptionAutomationId,
202
+ sectionTitleDescriptionAutomationId = _k === void 0 ? 'TitleBlock__SectionTitleDescription' : _k,
203
+ _l = _a.breadcrumbAutomationId,
204
+ breadcrumbAutomationId = _l === void 0 ? 'TitleBlock__Breadcrumb' : _l,
205
+ _m = _a.breadcrumbTextAutomationId,
206
+ breadcrumbTextAutomationId = _m === void 0 ? 'TitleBlock__BreadcrumbText' : _m;
204
207
  var hasNavigationTabs = navigationTabs && navigationTabs.length > 0;
205
208
  var collapseNavigationArea = collapseNavigationAreaWhenPossible && !hasNavigationTabs && secondaryActions === undefined;
206
- var _q = useMediaQueries().queries,
207
- isSmall = _q.isSmall,
208
- isMedium = _q.isMedium;
209
+ var _o = useMediaQueries().queries,
210
+ isSmall = _o.isSmall,
211
+ isMedium = _o.isMedium;
209
212
  var isSmallOrMediumViewport = isMedium || isSmall;
210
213
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
211
214
  id: id,
@@ -258,19 +261,19 @@ const TitleBlock = /*#__PURE__*/function () {
258
261
  variant: "secondary",
259
262
  reversed: true,
260
263
  fullWidth: true
261
- }))))))), ((_d = (_c = primaryAction !== null && primaryAction !== void 0 ? primaryAction : defaultAction) !== null && _c !== void 0 ? _c : secondaryActions) !== null && _d !== void 0 ? _d : secondaryOverflowMenuItems) && (/*#__PURE__*/React.createElement(MainActions, {
264
+ }))))))), ((_c = primaryAction !== null && primaryAction !== void 0 ? primaryAction : defaultAction) !== null && _c !== void 0 ? _c : secondaryActions) && (/*#__PURE__*/React.createElement(MainActions, {
262
265
  primaryAction: primaryAction,
263
266
  defaultAction: defaultAction,
264
- reversed: isReversed(variant),
265
- overflowMenuItems: createTabletOverflowMenuItems(secondaryActions, secondaryOverflowMenuItems),
266
- showOverflowMenu: isSmallOrMediumViewport
267
+ secondaryActions: secondaryActions,
268
+ secondaryOverflowMenuItems: secondaryOverflowMenuItems,
269
+ reversed: isReversed(variant)
267
270
  }))))), /*#__PURE__*/React.createElement("div", {
268
271
  className: styles.rowBelowSeparator
269
272
  }, /*#__PURE__*/React.createElement("div", {
270
273
  className: styles.rowBelowSeparatorInner
271
274
  }, /*#__PURE__*/React.createElement("div", {
272
275
  className: styles.rowBelowSeparatorInnerContent
273
- }, ((_e = sectionTitle !== null && sectionTitle !== void 0 ? sectionTitle : sectionTitleDescription) !== null && _e !== void 0 ? _e : renderSectionTitle) && (/*#__PURE__*/React.createElement("div", {
276
+ }, ((_d = sectionTitle !== null && sectionTitle !== void 0 ? sectionTitle : sectionTitleDescription) !== null && _d !== void 0 ? _d : renderSectionTitle) && (/*#__PURE__*/React.createElement("div", {
274
277
  className: styles.sectionTitleContainer
275
278
  }, /*#__PURE__*/React.createElement("div", {
276
279
  className: styles.sectionTitleInner
@@ -283,14 +286,7 @@ const TitleBlock = /*#__PURE__*/function () {
283
286
  secondaryActions: secondaryActions,
284
287
  secondaryOverflowMenuItems: secondaryOverflowMenuItems,
285
288
  reversed: isReversed(variant)
286
- }))))), /*#__PURE__*/React.createElement(MobileActions, {
287
- primaryAction: primaryAction,
288
- defaultAction: defaultAction,
289
- secondaryActions: secondaryActions,
290
- secondaryOverflowMenuItems: secondaryOverflowMenuItems,
291
- drawerHandleLabelIconPosition: primaryAction && 'iconPosition' in primaryAction ? primaryAction.iconPosition : undefined,
292
- autoHide: autoHideMobileActionsMenu
293
- })));
289
+ })))))));
294
290
  };
295
291
  TitleBlock.displayName = 'TitleBlock';
296
292
  return TitleBlock;
@@ -45,9 +45,13 @@ var styles = {
45
45
  "navigationTabEdgeShadowRight": "TitleBlock-module_navigationTabEdgeShadowRight__xkIWc",
46
46
  "navigationTabEdgeShadowLeft": "TitleBlock-module_navigationTabEdgeShadowLeft__9pGhR",
47
47
  "secondaryActionsContainer": "TitleBlock-module_secondaryActionsContainer__-4q0l",
48
+ "secondaryOverflowCombinedMenu": "TitleBlock-module_secondaryOverflowCombinedMenu__CTddK",
49
+ "secondaryButtonContainer": "TitleBlock-module_secondaryButtonContainer__xFL9X",
50
+ "secondaryOverflowMenu": "TitleBlock-module_secondaryOverflowMenu__gvmgW",
48
51
  "slide-fade": "TitleBlock-module_slide-fade__o5TnP",
49
52
  "reverse-slide-fade": "TitleBlock-module_reverse-slide-fade__LZZ98",
50
53
  "breadcrumbText": "TitleBlock-module_breadcrumbText__vDi0k",
51
- "circle": "TitleBlock-module_circle__68z-T"
54
+ "circle": "TitleBlock-module_circle__68z-T",
55
+ "staticIcon": "TitleBlock-module_staticIcon__5jeBS"
52
56
  };
53
57
  export { styles as default };
@@ -1,25 +1,105 @@
1
- import { __assign, __spreadArray } from 'tslib';
1
+ import { __spreadArray, __assign } from 'tslib';
2
2
  import React from 'react';
3
3
  import { Button } from '../../ButtonV1/Button/Button.mjs';
4
4
  import { IconButton } from '../../ButtonV1/IconButton/IconButton.mjs';
5
5
  import { Icon } from '../../Icon/Icon.mjs';
6
6
  import { Menu, MenuList } from '../../MenuV1/index.mjs';
7
+ import '../TitleBlock.mjs';
8
+ import './NavigationTabs.mjs';
7
9
  import { TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID } from '../constants.mjs';
8
- import { isMenuGroupNotButton } from '../utils.mjs';
10
+ import { createTabletOverflowMenuItems, isMenuGroupNotButton } from '../utils.mjs';
9
11
  import { TitleBlockMenuItem } from './TitleBlockMenuItem.mjs';
10
12
  import { Toolbar } from './Toolbar.mjs';
11
13
  import styles from './MainActions.module.scss.mjs';
14
+ var renderSecondaryAndOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
15
+ if (!secondaryOverflowMenuItems) return undefined;
16
+ return /*#__PURE__*/React.createElement(Menu, {
17
+ align: "right",
18
+ button: /*#__PURE__*/React.createElement(IconButton, {
19
+ label: 'Open secondary and overflow menu',
20
+ reversed: reversed,
21
+ icon: /*#__PURE__*/React.createElement(Icon, {
22
+ name: "more_horiz",
23
+ isPresentational: true
24
+ }),
25
+ id: TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
26
+ classNameOverride: styles.overflowMenuButton
27
+ })
28
+ }, /*#__PURE__*/React.createElement(MenuList, null, secondaryOverflowMenuItems.map(function (menuItem, i) {
29
+ return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({
30
+ key: i
31
+ }, menuItem));
32
+ })));
33
+ };
12
34
  const MainActions = /*#__PURE__*/function () {
13
35
  const MainActions = function (_a) {
14
- var _b, _c, _d, _e;
36
+ var _b, _c, _d;
15
37
  var primaryAction = _a.primaryAction,
16
38
  defaultAction = _a.defaultAction,
17
- _f = _a.reversed,
18
- reversed = _f === void 0 ? false : _f,
19
- overflowMenuItems = _a.overflowMenuItems,
20
- _g = _a.showOverflowMenu,
21
- showOverflowMenu = _g === void 0 ? false : _g;
39
+ secondaryActions = _a.secondaryActions,
40
+ secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
41
+ _e = _a.reversed,
42
+ reversed = _e === void 0 ? false : _e;
22
43
  var items;
44
+ // Build combined secondary + overflow menu items once, to be spread into the toolbar items
45
+ var secondaryAndOverflowMenu = [];
46
+ // Convert defaultAction to menu item format and prepend to combined list
47
+ var defaultActionMenuItem;
48
+ if (defaultAction) {
49
+ if ('component' in defaultAction) {
50
+ defaultActionMenuItem = defaultAction;
51
+ } else if ('onClick' in defaultAction) {
52
+ defaultActionMenuItem = {
53
+ label: defaultAction.label,
54
+ icon: defaultAction.icon,
55
+ onClick: defaultAction.onClick,
56
+ disabled: defaultAction.disabled
57
+ };
58
+ } else if ('href' in defaultAction) {
59
+ defaultActionMenuItem = {
60
+ label: defaultAction.label,
61
+ icon: defaultAction.icon,
62
+ href: defaultAction.href,
63
+ disabled: defaultAction.disabled
64
+ };
65
+ }
66
+ }
67
+ var combinedSecondaryOverflowItems = createTabletOverflowMenuItems(secondaryActions, secondaryOverflowMenuItems);
68
+ // Prepend defaultAction to the combined list if it exists
69
+ var allMenuItems = defaultActionMenuItem ? __spreadArray([defaultActionMenuItem], combinedSecondaryOverflowItems, true) : combinedSecondaryOverflowItems;
70
+ if (allMenuItems.length > 0) {
71
+ secondaryAndOverflowMenu.push({
72
+ key: 'overflowMenu',
73
+ node: renderSecondaryAndOverflowMenu(allMenuItems, reversed)
74
+ });
75
+ }
76
+ var defaultActionItem = defaultAction ? [{
77
+ key: 'defaultAction',
78
+ node: (/*#__PURE__*/React.createElement(Button, __assign({
79
+ classNameOverride: styles.defaultActionButton
80
+ }, defaultAction, {
81
+ reversed: (_b = defaultAction.reversed) !== null && _b !== void 0 ? _b : reversed,
82
+ "data-automation-id": "title-block-default-action-button",
83
+ "data-testid": "title-block-default-action-button"
84
+ })))
85
+ }] : [];
86
+ var defaultActionItemMinimized = defaultAction ? [{
87
+ key: 'defaultActionMinimized',
88
+ node: (/*#__PURE__*/React.createElement("div", {
89
+ className: styles.defaultActionButtonMinimized
90
+ }, /*#__PURE__*/React.createElement(Menu, {
91
+ align: "right",
92
+ button: /*#__PURE__*/React.createElement(IconButton, {
93
+ label: 'Open default action overflow menu',
94
+ reversed: reversed,
95
+ icon: /*#__PURE__*/React.createElement(Icon, {
96
+ name: "more_horiz",
97
+ isPresentational: true
98
+ }),
99
+ id: TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID
100
+ })
101
+ }, /*#__PURE__*/React.createElement(MenuList, null, defaultActionMenuItem && /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, defaultActionMenuItem))))))
102
+ }] : [];
23
103
  if (primaryAction && isMenuGroupNotButton(primaryAction)) {
24
104
  var menuContent = primaryAction.menuItems.map(function (item, idx) {
25
105
  return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, item, {
@@ -28,14 +108,7 @@ const MainActions = /*#__PURE__*/function () {
28
108
  "data-testid": "main-action-primary-menu-item-".concat(idx)
29
109
  }));
30
110
  });
31
- items = __spreadArray(__spreadArray([], defaultAction ? [{
32
- key: 'defaultAction',
33
- node: (/*#__PURE__*/React.createElement(Button, __assign({}, defaultAction, {
34
- reversed: (_b = defaultAction.reversed) !== null && _b !== void 0 ? _b : reversed,
35
- "data-automation-id": "title-block-default-action-button",
36
- "data-testid": "title-block-default-action-button"
37
- })))
38
- }] : [], true), primaryAction ? [{
111
+ items = __spreadArray(__spreadArray(__spreadArray([], defaultActionItem, true), defaultActionItemMinimized, true), primaryAction ? [{
39
112
  key: 'primaryAction',
40
113
  node: (/*#__PURE__*/React.createElement(Menu, {
41
114
  align: "right",
@@ -57,18 +130,11 @@ const MainActions = /*#__PURE__*/function () {
57
130
  }, /*#__PURE__*/React.createElement(MenuList, null, menuContent)))
58
131
  }] : [], true);
59
132
  } else {
60
- items = __spreadArray(__spreadArray([], defaultAction ? [{
61
- key: 'defaultAction',
62
- node: (/*#__PURE__*/React.createElement(Button, __assign({}, defaultAction, {
63
- reversed: (_c = defaultAction.reversed) !== null && _c !== void 0 ? _c : reversed,
64
- "data-automation-id": "title-block-default-action-button",
65
- "data-testid": "title-block-default-action-button"
66
- })))
67
- }] : [], true), primaryAction ? [{
133
+ items = __spreadArray(__spreadArray(__spreadArray([], defaultActionItem, true), defaultActionItemMinimized, true), primaryAction ? [{
68
134
  key: 'primaryAction',
69
135
  node: (/*#__PURE__*/React.createElement(Button, __assign({}, primaryAction, {
70
- primary: (_d = primaryAction.primary) !== null && _d !== void 0 ? _d : true,
71
- reversed: (_e = primaryAction.reversed) !== null && _e !== void 0 ? _e : reversed,
136
+ primary: (_c = primaryAction.primary) !== null && _c !== void 0 ? _c : true,
137
+ reversed: (_d = primaryAction.reversed) !== null && _d !== void 0 ? _d : reversed,
72
138
  "data-automation-id": "title-block-primary-action-button",
73
139
  "data-testid": "title-block-primary-action-button",
74
140
  badge: primaryAction.badge ? __assign(__assign({}, primaryAction.badge), {
@@ -77,27 +143,6 @@ const MainActions = /*#__PURE__*/function () {
77
143
  })))
78
144
  }] : [], true);
79
145
  }
80
- if (overflowMenuItems && showOverflowMenu && overflowMenuItems.length > 0) {
81
- items = __spreadArray([{
82
- key: 'overflowMenu',
83
- node: (/*#__PURE__*/React.createElement(Menu, {
84
- align: "right",
85
- button: /*#__PURE__*/React.createElement(IconButton, {
86
- id: TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
87
- label: "Open secondary menu",
88
- reversed: reversed,
89
- icon: /*#__PURE__*/React.createElement(Icon, {
90
- name: "more_horiz",
91
- isPresentational: true
92
- })
93
- })
94
- }, /*#__PURE__*/React.createElement(MenuList, null, overflowMenuItems.map(function (menuItem, idx) {
95
- return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, menuItem, {
96
- key: "main-action-overflow-item-menu-item-".concat(idx)
97
- }));
98
- }))))
99
- }], items, true);
100
- }
101
146
  return /*#__PURE__*/React.createElement("div", {
102
147
  className: styles.mainActionsContainer
103
148
  }, /*#__PURE__*/React.createElement(Toolbar, {
@@ -1,4 +1,6 @@
1
1
  var styles = {
2
- "mainActionsContainer": "MainActions-module_mainActionsContainer__pk-78"
2
+ "mainActionsContainer": "MainActions-module_mainActionsContainer__pk-78",
3
+ "defaultActionButtonMinimized": "MainActions-module_defaultActionButtonMinimized__XePRS",
4
+ "defaultActionButton": "MainActions-module_defaultActionButton__VbER1"
3
5
  };
4
6
  export { styles as default };
@@ -6,26 +6,57 @@ import { Icon } from '../../Icon/Icon.mjs';
6
6
  import { Menu, MenuList } from '../../MenuV1/index.mjs';
7
7
  import styles from '../TitleBlock.module.scss.mjs';
8
8
  import { TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID } from '../constants.mjs';
9
+ import { convertSecondaryActionsToMenuItems } from '../utils.mjs';
9
10
  import { TitleBlockMenuItem } from './TitleBlockMenuItem.mjs';
10
11
  import { Toolbar } from './Toolbar.mjs';
11
12
  var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
12
- if (!secondaryOverflowMenuItems) return undefined;
13
- return /*#__PURE__*/React.createElement(Menu, {
13
+ if (!secondaryOverflowMenuItems || secondaryOverflowMenuItems.length === 0) return undefined;
14
+ return /*#__PURE__*/React.createElement("div", {
15
+ className: styles.secondaryOverflowMenu
16
+ }, /*#__PURE__*/React.createElement(Menu, {
17
+ align: "right",
18
+ button: /*#__PURE__*/React.createElement(Button, {
19
+ secondary: true,
20
+ reversed: reversed,
21
+ label: "Menu",
22
+ "data-automation-id": TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
23
+ "data-testid": TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
24
+ icon: /*#__PURE__*/React.createElement(Icon, {
25
+ name: "keyboard_arrow_down",
26
+ isPresentational: true
27
+ }),
28
+ iconPosition: 'end'
29
+ })
30
+ }, /*#__PURE__*/React.createElement(MenuList, null, secondaryOverflowMenuItems.map(function (menuItem, i) {
31
+ return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({
32
+ key: i
33
+ }, menuItem));
34
+ }))));
35
+ };
36
+ // New: combined overflow menu (secondary actions converted + overflow menu items)
37
+ var renderCombinedSecondaryOverflowMenu = function (secondaryActions, secondaryOverflowMenuItems, reversed) {
38
+ var secondaryConverted = secondaryActions ? convertSecondaryActionsToMenuItems(secondaryActions) : [];
39
+ var overflowItems = secondaryOverflowMenuItems !== null && secondaryOverflowMenuItems !== void 0 ? secondaryOverflowMenuItems : [];
40
+ if (secondaryConverted.length === 0 && overflowItems.length === 0) return undefined;
41
+ var combined = __spreadArray(__spreadArray([], secondaryConverted, true), overflowItems, true);
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ className: styles.secondaryOverflowCombinedMenu
44
+ }, /*#__PURE__*/React.createElement(Menu, {
14
45
  align: "right",
15
46
  button: /*#__PURE__*/React.createElement(IconButton, {
16
- label: "Open secondary menu",
47
+ label: "Open combined secondary + overflow menu",
17
48
  reversed: reversed,
18
49
  icon: /*#__PURE__*/React.createElement(Icon, {
19
50
  name: "more_horiz",
20
51
  isPresentational: true
21
52
  }),
22
- id: TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID
53
+ id: "".concat(TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID, "__combined")
23
54
  })
24
- }, /*#__PURE__*/React.createElement(MenuList, null, secondaryOverflowMenuItems.map(function (menuItem, i) {
55
+ }, /*#__PURE__*/React.createElement(MenuList, null, combined.map(function (menuItem, i) {
25
56
  return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({
26
57
  key: i
27
58
  }, menuItem));
28
- })));
59
+ }))));
29
60
  };
30
61
  // Unfortunately, you'll notice below, that I needed to use the array index,
31
62
  // against react best practices (https://reactjs.org/docs/lists-and-keys.html)
@@ -40,9 +71,10 @@ const SecondaryActions = /*#__PURE__*/function () {
40
71
  var secondaryActionsAsToolbarItems = secondaryActions ? secondaryActions.map(function (action, i) {
41
72
  if ('menuItems' in action) {
42
73
  return {
43
- key: "".concat(i),
44
- // We shouldn't use an index here, see note above
45
- node: (/*#__PURE__*/React.createElement(Menu, {
74
+ key: "titleblock_secondary_action_".concat(i),
75
+ node: (/*#__PURE__*/React.createElement("div", {
76
+ className: styles.secondaryButtonContainer
77
+ }, /*#__PURE__*/React.createElement(Menu, {
46
78
  align: "right",
47
79
  button: /*#__PURE__*/React.createElement(Button, {
48
80
  secondary: true,
@@ -58,7 +90,7 @@ const SecondaryActions = /*#__PURE__*/function () {
58
90
  return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({
59
91
  key: i2
60
92
  }, menuItem));
61
- }))))
93
+ })))))
62
94
  };
63
95
  } else {
64
96
  if ('onClick' in action && 'href' in action) {
@@ -67,21 +99,26 @@ const SecondaryActions = /*#__PURE__*/function () {
67
99
  }
68
100
  return {
69
101
  key: "".concat(i),
70
- // We shouldn't use an index here, see note above
71
- node: (/*#__PURE__*/React.createElement(Button, __assign({
102
+ node: (/*#__PURE__*/React.createElement("div", {
103
+ className: styles.secondaryButtonContainer
104
+ }, /*#__PURE__*/React.createElement(Button, __assign({
72
105
  secondary: true,
73
106
  reversed: reversed
74
107
  }, action, {
75
108
  "data-automation-id": "title-block-secondary-actions-button",
76
109
  "data-testid": "title-block-secondary-actions-button"
77
- })))
110
+ }))))
78
111
  };
79
112
  }
80
113
  }) : [];
81
114
  var overflowMenu = renderSecondaryOverflowMenu(secondaryOverflowMenuItems, reversed);
82
- var toolbarItems = __spreadArray(__spreadArray([], secondaryActionsAsToolbarItems, true), overflowMenu ? [{
115
+ var combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(secondaryActions, secondaryOverflowMenuItems, reversed);
116
+ var toolbarItems = __spreadArray(__spreadArray(__spreadArray([], secondaryActionsAsToolbarItems, true), overflowMenu ? [{
83
117
  key: 'overflowMenu',
84
118
  node: overflowMenu
119
+ }] : [], true), combinedOverflowMenu ? [{
120
+ key: 'combinedOverflowMenu',
121
+ node: combinedOverflowMenu
85
122
  }] : [], true);
86
123
  return /*#__PURE__*/React.createElement("div", {
87
124
  className: styles.secondaryActionsContainer