@kaizen/components 2.3.3 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/TitleBlock/TitleBlock.cjs +7 -1
- package/dist/cjs/src/TitleBlock/subcomponents/MainActions.cjs +15 -4
- package/dist/cjs/src/TitleBlock/subcomponents/SecondaryActions.cjs +24 -6
- package/dist/esm/src/TitleBlock/TitleBlock.mjs +7 -1
- package/dist/esm/src/TitleBlock/subcomponents/MainActions.mjs +15 -4
- package/dist/esm/src/TitleBlock/subcomponents/SecondaryActions.mjs +24 -6
- package/dist/styles.css +1 -1
- package/locales/en.json +24 -4
- package/package.json +1 -1
- package/src/TitleBlock/TitleBlock.module.scss +1 -1
- package/src/TitleBlock/TitleBlock.tsx +8 -1
- package/src/TitleBlock/_docs/TitleBlock.stories.tsx +24 -0
- package/src/TitleBlock/subcomponents/MainActions.tsx +17 -3
- package/src/TitleBlock/subcomponents/SecondaryActions.tsx +35 -3
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18nReactIntl = require('@cultureamp/i18n-react-intl');
|
|
5
6
|
var classnames = require('classnames');
|
|
6
7
|
var Avatar = require('../Avatar/Avatar.cjs');
|
|
7
8
|
require('../ButtonV1/Button/Button.cjs');
|
|
@@ -212,6 +213,7 @@ var TitleBlock = function (_a) {
|
|
|
212
213
|
isSmall = _o.isSmall,
|
|
213
214
|
isMedium = _o.isMedium;
|
|
214
215
|
var isSmallOrMediumViewport = isMedium || isSmall;
|
|
216
|
+
var formatMessage = i18nReactIntl.useIntl().formatMessage;
|
|
215
217
|
return React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement("div", {
|
|
216
218
|
id: id,
|
|
217
219
|
className: classnames__default.default(TitleBlock_module.titleBlock, TitleBlock_module["".concat(variant, "Variant")], Boolean(subtitle) && TitleBlock_module.hasSubtitle, Boolean(pageSwitcherSelect) && TitleBlock_module.hasPageSwitcherSelect, collapseNavigationArea && !((_b = sectionTitle !== null && sectionTitle !== void 0 ? sectionTitle : sectionTitleDescription) !== null && _b !== void 0 ? _b : renderSectionTitle) && TitleBlock_module.collapseNavigationArea, title && title.length >= 30 && TitleBlock_module.hasLongTitle, subtitle && typeof subtitle === 'string' && subtitle.length >= 18 && TitleBlock_module.hasLongSubtitle, hasNavigationTabs && TitleBlock_module.hasNavigationTabs)
|
|
@@ -238,7 +240,11 @@ var TitleBlock = function (_a) {
|
|
|
238
240
|
name: "menu",
|
|
239
241
|
isPresentational: true
|
|
240
242
|
}),
|
|
241
|
-
label:
|
|
243
|
+
label: formatMessage({
|
|
244
|
+
id: 'kzTitleBlock.hamburgerMenuLabel',
|
|
245
|
+
defaultMessage: 'Open menu',
|
|
246
|
+
description: 'Label for the dropdown menu which displays navigation items'
|
|
247
|
+
}),
|
|
242
248
|
reversed: utils.isReversed(variant)
|
|
243
249
|
})), avatar && renderAvatar(avatar, avatarAutomationId), React__default.default.createElement("div", {
|
|
244
250
|
className: TitleBlock_module.titleAndSubtitle
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18nReactIntl = require('@cultureamp/i18n-react-intl');
|
|
5
6
|
var Button = require('../../ButtonV1/Button/Button.cjs');
|
|
6
7
|
var IconButton = require('../../ButtonV1/IconButton/IconButton.cjs');
|
|
7
8
|
var Icon = require('../../Icon/Icon.cjs');
|
|
@@ -19,12 +20,12 @@ function _interopDefault(e) {
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
22
|
-
var renderSecondaryAndOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
|
|
23
|
+
var renderSecondaryAndOverflowMenu = function (secondaryAndOverflowMenuLabel, secondaryOverflowMenuItems, reversed) {
|
|
23
24
|
if (!secondaryOverflowMenuItems) return undefined;
|
|
24
25
|
return React__default.default.createElement(index.Menu, {
|
|
25
26
|
align: "right",
|
|
26
27
|
button: React__default.default.createElement(IconButton.IconButton, {
|
|
27
|
-
label:
|
|
28
|
+
label: secondaryAndOverflowMenuLabel,
|
|
28
29
|
reversed: reversed,
|
|
29
30
|
icon: React__default.default.createElement(Icon.Icon, {
|
|
30
31
|
name: "more_horiz",
|
|
@@ -47,6 +48,12 @@ var MainActions = function (_a) {
|
|
|
47
48
|
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
48
49
|
_e = _a.reversed,
|
|
49
50
|
reversed = _e === void 0 ? false : _e;
|
|
51
|
+
var formatMessage = i18nReactIntl.useIntl().formatMessage;
|
|
52
|
+
var secondaryAndOverflowMenuLabel = formatMessage({
|
|
53
|
+
id: 'kzTitleBlock.secondaryAndOverflowMenuLabel',
|
|
54
|
+
defaultMessage: 'Open secondary and overflow menu',
|
|
55
|
+
description: 'Label for the dropdown menu which displays additional actions'
|
|
56
|
+
});
|
|
50
57
|
var items;
|
|
51
58
|
// Build combined secondary + overflow menu items once, to be spread into the toolbar items
|
|
52
59
|
var secondaryAndOverflowMenu = [];
|
|
@@ -77,7 +84,7 @@ var MainActions = function (_a) {
|
|
|
77
84
|
if (allMenuItems.length > 0) {
|
|
78
85
|
secondaryAndOverflowMenu.push({
|
|
79
86
|
key: 'overflowMenu',
|
|
80
|
-
node: renderSecondaryAndOverflowMenu(allMenuItems, reversed)
|
|
87
|
+
node: renderSecondaryAndOverflowMenu(secondaryAndOverflowMenuLabel, allMenuItems, reversed)
|
|
81
88
|
});
|
|
82
89
|
}
|
|
83
90
|
var defaultActionItem = defaultAction ? [{
|
|
@@ -97,7 +104,11 @@ var MainActions = function (_a) {
|
|
|
97
104
|
}, React__default.default.createElement(index.Menu, {
|
|
98
105
|
align: "right",
|
|
99
106
|
button: React__default.default.createElement(IconButton.IconButton, {
|
|
100
|
-
label:
|
|
107
|
+
label: formatMessage({
|
|
108
|
+
id: 'kzTitleBlock.defaultActionMinimizedOverflowMenuLabel',
|
|
109
|
+
defaultMessage: 'Open default action overflow menu',
|
|
110
|
+
description: 'Label for the dropdown menu which displays the default action item'
|
|
111
|
+
}),
|
|
101
112
|
reversed: reversed,
|
|
102
113
|
icon: React__default.default.createElement(Icon.Icon, {
|
|
103
114
|
name: "more_horiz",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var i18nReactIntl = require('@cultureamp/i18n-react-intl');
|
|
5
6
|
var Button = require('../../ButtonV1/Button/Button.cjs');
|
|
6
7
|
var IconButton = require('../../ButtonV1/IconButton/IconButton.cjs');
|
|
7
8
|
var Icon = require('../../Icon/Icon.cjs');
|
|
@@ -17,7 +18,7 @@ function _interopDefault(e) {
|
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
20
|
-
var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
|
|
21
|
+
var renderSecondaryOverflowMenu = function (menuAriaLabel, menuLabel, secondaryOverflowMenuItems, reversed) {
|
|
21
22
|
if (!secondaryOverflowMenuItems || secondaryOverflowMenuItems.length === 0) return undefined;
|
|
22
23
|
return React__default.default.createElement("div", {
|
|
23
24
|
className: TitleBlock_module.secondaryOverflowMenu
|
|
@@ -26,7 +27,8 @@ var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed
|
|
|
26
27
|
button: React__default.default.createElement(Button.Button, {
|
|
27
28
|
secondary: true,
|
|
28
29
|
reversed: reversed,
|
|
29
|
-
label:
|
|
30
|
+
label: menuLabel,
|
|
31
|
+
"aria-label": menuAriaLabel,
|
|
30
32
|
"data-automation-id": constants.TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
|
|
31
33
|
"data-testid": constants.TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
|
|
32
34
|
icon: React__default.default.createElement(Icon.Icon, {
|
|
@@ -42,7 +44,7 @@ var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed
|
|
|
42
44
|
}))));
|
|
43
45
|
};
|
|
44
46
|
// New: combined overflow menu (secondary actions converted + overflow menu items)
|
|
45
|
-
var renderCombinedSecondaryOverflowMenu = function (secondaryActions, secondaryOverflowMenuItems, reversed) {
|
|
47
|
+
var renderCombinedSecondaryOverflowMenu = function (combinedMenuLabel, secondaryActions, secondaryOverflowMenuItems, reversed) {
|
|
46
48
|
var secondaryConverted = secondaryActions ? utils.convertSecondaryActionsToMenuItems(secondaryActions) : [];
|
|
47
49
|
var overflowItems = secondaryOverflowMenuItems !== null && secondaryOverflowMenuItems !== void 0 ? secondaryOverflowMenuItems : [];
|
|
48
50
|
if (secondaryConverted.length === 0 && overflowItems.length === 0) return undefined;
|
|
@@ -52,7 +54,7 @@ var renderCombinedSecondaryOverflowMenu = function (secondaryActions, secondaryO
|
|
|
52
54
|
}, React__default.default.createElement(index.Menu, {
|
|
53
55
|
align: "right",
|
|
54
56
|
button: React__default.default.createElement(IconButton.IconButton, {
|
|
55
|
-
label:
|
|
57
|
+
label: combinedMenuLabel,
|
|
56
58
|
reversed: reversed,
|
|
57
59
|
icon: React__default.default.createElement(Icon.Icon, {
|
|
58
60
|
name: "more_horiz",
|
|
@@ -74,7 +76,23 @@ var SecondaryActions = function (_a) {
|
|
|
74
76
|
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
75
77
|
_b = _a.reversed,
|
|
76
78
|
reversed = _b === void 0 ? false : _b;
|
|
79
|
+
var formatMessage = i18nReactIntl.useIntl().formatMessage;
|
|
77
80
|
if (!secondaryActions && !secondaryOverflowMenuItems) return null;
|
|
81
|
+
var menuLabel = formatMessage({
|
|
82
|
+
id: 'kzTitleBlock.overflowMenuLabel',
|
|
83
|
+
defaultMessage: 'Menu',
|
|
84
|
+
description: 'Label for the dropdown menu which displays additional action items'
|
|
85
|
+
});
|
|
86
|
+
var menuAriaLabel = formatMessage({
|
|
87
|
+
id: 'kzTitleBlock.overflowMenuAriaLabel',
|
|
88
|
+
defaultMessage: 'Opens overflow menu',
|
|
89
|
+
description: 'Aria Label for the dropdown menu which displays additional action items'
|
|
90
|
+
});
|
|
91
|
+
var combinedMenuLabel = formatMessage({
|
|
92
|
+
id: 'kzTitleBlock.combinedOverflowMenuLabel',
|
|
93
|
+
defaultMessage: 'Open combined secondary and overflow menu',
|
|
94
|
+
description: 'Label for the dropdown menu which displays additional action items and secondary actions'
|
|
95
|
+
});
|
|
78
96
|
var secondaryActionsAsToolbarItems = secondaryActions ? secondaryActions.map(function (action, i) {
|
|
79
97
|
if ('menuItems' in action) {
|
|
80
98
|
return {
|
|
@@ -118,8 +136,8 @@ var SecondaryActions = function (_a) {
|
|
|
118
136
|
};
|
|
119
137
|
}
|
|
120
138
|
}) : [];
|
|
121
|
-
var overflowMenu = renderSecondaryOverflowMenu(secondaryOverflowMenuItems, reversed);
|
|
122
|
-
var combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(secondaryActions, secondaryOverflowMenuItems, reversed);
|
|
139
|
+
var overflowMenu = renderSecondaryOverflowMenu(menuAriaLabel, menuLabel, secondaryOverflowMenuItems, reversed);
|
|
140
|
+
var combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(combinedMenuLabel, secondaryActions, secondaryOverflowMenuItems, reversed);
|
|
123
141
|
var toolbarItems = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], secondaryActionsAsToolbarItems, true), overflowMenu ? [{
|
|
124
142
|
key: 'overflowMenu',
|
|
125
143
|
node: overflowMenu
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useIntl } from '@cultureamp/i18n-react-intl';
|
|
3
4
|
import classnames from 'classnames';
|
|
4
5
|
import { Avatar } from '../Avatar/Avatar.mjs';
|
|
5
6
|
import '../ButtonV1/Button/Button.mjs';
|
|
@@ -204,6 +205,7 @@ const TitleBlock = /*#__PURE__*/function () {
|
|
|
204
205
|
isSmall = _o.isSmall,
|
|
205
206
|
isMedium = _o.isMedium;
|
|
206
207
|
var isSmallOrMediumViewport = isMedium || isSmall;
|
|
208
|
+
var formatMessage = useIntl().formatMessage;
|
|
207
209
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
208
210
|
id: id,
|
|
209
211
|
className: classnames(styles.titleBlock, styles["".concat(variant, "Variant")], Boolean(subtitle) && styles.hasSubtitle, Boolean(pageSwitcherSelect) && styles.hasPageSwitcherSelect, collapseNavigationArea && !((_b = sectionTitle !== null && sectionTitle !== void 0 ? sectionTitle : sectionTitleDescription) !== null && _b !== void 0 ? _b : renderSectionTitle) && styles.collapseNavigationArea, title && title.length >= 30 && styles.hasLongTitle, subtitle && typeof subtitle === 'string' && subtitle.length >= 18 && styles.hasLongSubtitle, hasNavigationTabs && styles.hasNavigationTabs)
|
|
@@ -230,7 +232,11 @@ const TitleBlock = /*#__PURE__*/function () {
|
|
|
230
232
|
name: "menu",
|
|
231
233
|
isPresentational: true
|
|
232
234
|
}),
|
|
233
|
-
label:
|
|
235
|
+
label: formatMessage({
|
|
236
|
+
id: 'kzTitleBlock.hamburgerMenuLabel',
|
|
237
|
+
defaultMessage: 'Open menu',
|
|
238
|
+
description: 'Label for the dropdown menu which displays navigation items'
|
|
239
|
+
}),
|
|
234
240
|
reversed: isReversed(variant)
|
|
235
241
|
}))), avatar && renderAvatar(avatar, avatarAutomationId), /*#__PURE__*/React.createElement("div", {
|
|
236
242
|
className: styles.titleAndSubtitle
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __spreadArray, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useIntl } from '@cultureamp/i18n-react-intl';
|
|
3
4
|
import { Button } from '../../ButtonV1/Button/Button.mjs';
|
|
4
5
|
import { IconButton } from '../../ButtonV1/IconButton/IconButton.mjs';
|
|
5
6
|
import { Icon } from '../../Icon/Icon.mjs';
|
|
@@ -11,12 +12,12 @@ import { createTabletOverflowMenuItems, isMenuGroupNotButton } from '../utils.mj
|
|
|
11
12
|
import { TitleBlockMenuItem } from './TitleBlockMenuItem.mjs';
|
|
12
13
|
import { Toolbar } from './Toolbar.mjs';
|
|
13
14
|
import styles from './MainActions.module.scss.mjs';
|
|
14
|
-
var renderSecondaryAndOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
|
|
15
|
+
var renderSecondaryAndOverflowMenu = function (secondaryAndOverflowMenuLabel, secondaryOverflowMenuItems, reversed) {
|
|
15
16
|
if (!secondaryOverflowMenuItems) return undefined;
|
|
16
17
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
17
18
|
align: "right",
|
|
18
19
|
button: /*#__PURE__*/React.createElement(IconButton, {
|
|
19
|
-
label:
|
|
20
|
+
label: secondaryAndOverflowMenuLabel,
|
|
20
21
|
reversed: reversed,
|
|
21
22
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
22
23
|
name: "more_horiz",
|
|
@@ -40,6 +41,12 @@ const MainActions = /*#__PURE__*/function () {
|
|
|
40
41
|
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
41
42
|
_e = _a.reversed,
|
|
42
43
|
reversed = _e === void 0 ? false : _e;
|
|
44
|
+
var formatMessage = useIntl().formatMessage;
|
|
45
|
+
var secondaryAndOverflowMenuLabel = formatMessage({
|
|
46
|
+
id: 'kzTitleBlock.secondaryAndOverflowMenuLabel',
|
|
47
|
+
defaultMessage: 'Open secondary and overflow menu',
|
|
48
|
+
description: 'Label for the dropdown menu which displays additional actions'
|
|
49
|
+
});
|
|
43
50
|
var items;
|
|
44
51
|
// Build combined secondary + overflow menu items once, to be spread into the toolbar items
|
|
45
52
|
var secondaryAndOverflowMenu = [];
|
|
@@ -70,7 +77,7 @@ const MainActions = /*#__PURE__*/function () {
|
|
|
70
77
|
if (allMenuItems.length > 0) {
|
|
71
78
|
secondaryAndOverflowMenu.push({
|
|
72
79
|
key: 'overflowMenu',
|
|
73
|
-
node: renderSecondaryAndOverflowMenu(allMenuItems, reversed)
|
|
80
|
+
node: renderSecondaryAndOverflowMenu(secondaryAndOverflowMenuLabel, allMenuItems, reversed)
|
|
74
81
|
});
|
|
75
82
|
}
|
|
76
83
|
var defaultActionItem = defaultAction ? [{
|
|
@@ -90,7 +97,11 @@ const MainActions = /*#__PURE__*/function () {
|
|
|
90
97
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
91
98
|
align: "right",
|
|
92
99
|
button: /*#__PURE__*/React.createElement(IconButton, {
|
|
93
|
-
label:
|
|
100
|
+
label: formatMessage({
|
|
101
|
+
id: 'kzTitleBlock.defaultActionMinimizedOverflowMenuLabel',
|
|
102
|
+
defaultMessage: 'Open default action overflow menu',
|
|
103
|
+
description: 'Label for the dropdown menu which displays the default action item'
|
|
104
|
+
}),
|
|
94
105
|
reversed: reversed,
|
|
95
106
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
96
107
|
name: "more_horiz",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __assign, __spreadArray } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { useIntl } from '@cultureamp/i18n-react-intl';
|
|
3
4
|
import { Button } from '../../ButtonV1/Button/Button.mjs';
|
|
4
5
|
import { IconButton } from '../../ButtonV1/IconButton/IconButton.mjs';
|
|
5
6
|
import { Icon } from '../../Icon/Icon.mjs';
|
|
@@ -9,7 +10,7 @@ import { TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID } from '../constants.mjs';
|
|
|
9
10
|
import { convertSecondaryActionsToMenuItems } from '../utils.mjs';
|
|
10
11
|
import { TitleBlockMenuItem } from './TitleBlockMenuItem.mjs';
|
|
11
12
|
import { Toolbar } from './Toolbar.mjs';
|
|
12
|
-
var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed) {
|
|
13
|
+
var renderSecondaryOverflowMenu = function (menuAriaLabel, menuLabel, secondaryOverflowMenuItems, reversed) {
|
|
13
14
|
if (!secondaryOverflowMenuItems || secondaryOverflowMenuItems.length === 0) return undefined;
|
|
14
15
|
return /*#__PURE__*/React.createElement("div", {
|
|
15
16
|
className: styles.secondaryOverflowMenu
|
|
@@ -18,7 +19,8 @@ var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed
|
|
|
18
19
|
button: /*#__PURE__*/React.createElement(Button, {
|
|
19
20
|
secondary: true,
|
|
20
21
|
reversed: reversed,
|
|
21
|
-
label:
|
|
22
|
+
label: menuLabel,
|
|
23
|
+
"aria-label": menuAriaLabel,
|
|
22
24
|
"data-automation-id": TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
|
|
23
25
|
"data-testid": TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID,
|
|
24
26
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -34,7 +36,7 @@ var renderSecondaryOverflowMenu = function (secondaryOverflowMenuItems, reversed
|
|
|
34
36
|
}))));
|
|
35
37
|
};
|
|
36
38
|
// New: combined overflow menu (secondary actions converted + overflow menu items)
|
|
37
|
-
var renderCombinedSecondaryOverflowMenu = function (secondaryActions, secondaryOverflowMenuItems, reversed) {
|
|
39
|
+
var renderCombinedSecondaryOverflowMenu = function (combinedMenuLabel, secondaryActions, secondaryOverflowMenuItems, reversed) {
|
|
38
40
|
var secondaryConverted = secondaryActions ? convertSecondaryActionsToMenuItems(secondaryActions) : [];
|
|
39
41
|
var overflowItems = secondaryOverflowMenuItems !== null && secondaryOverflowMenuItems !== void 0 ? secondaryOverflowMenuItems : [];
|
|
40
42
|
if (secondaryConverted.length === 0 && overflowItems.length === 0) return undefined;
|
|
@@ -44,7 +46,7 @@ var renderCombinedSecondaryOverflowMenu = function (secondaryActions, secondaryO
|
|
|
44
46
|
}, /*#__PURE__*/React.createElement(Menu, {
|
|
45
47
|
align: "right",
|
|
46
48
|
button: /*#__PURE__*/React.createElement(IconButton, {
|
|
47
|
-
label:
|
|
49
|
+
label: combinedMenuLabel,
|
|
48
50
|
reversed: reversed,
|
|
49
51
|
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
50
52
|
name: "more_horiz",
|
|
@@ -67,7 +69,23 @@ const SecondaryActions = /*#__PURE__*/function () {
|
|
|
67
69
|
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
68
70
|
_b = _a.reversed,
|
|
69
71
|
reversed = _b === void 0 ? false : _b;
|
|
72
|
+
var formatMessage = useIntl().formatMessage;
|
|
70
73
|
if (!secondaryActions && !secondaryOverflowMenuItems) return null;
|
|
74
|
+
var menuLabel = formatMessage({
|
|
75
|
+
id: 'kzTitleBlock.overflowMenuLabel',
|
|
76
|
+
defaultMessage: 'Menu',
|
|
77
|
+
description: 'Label for the dropdown menu which displays additional action items'
|
|
78
|
+
});
|
|
79
|
+
var menuAriaLabel = formatMessage({
|
|
80
|
+
id: 'kzTitleBlock.overflowMenuAriaLabel',
|
|
81
|
+
defaultMessage: 'Opens overflow menu',
|
|
82
|
+
description: 'Aria Label for the dropdown menu which displays additional action items'
|
|
83
|
+
});
|
|
84
|
+
var combinedMenuLabel = formatMessage({
|
|
85
|
+
id: 'kzTitleBlock.combinedOverflowMenuLabel',
|
|
86
|
+
defaultMessage: 'Open combined secondary and overflow menu',
|
|
87
|
+
description: 'Label for the dropdown menu which displays additional action items and secondary actions'
|
|
88
|
+
});
|
|
71
89
|
var secondaryActionsAsToolbarItems = secondaryActions ? secondaryActions.map(function (action, i) {
|
|
72
90
|
if ('menuItems' in action) {
|
|
73
91
|
return {
|
|
@@ -111,8 +129,8 @@ const SecondaryActions = /*#__PURE__*/function () {
|
|
|
111
129
|
};
|
|
112
130
|
}
|
|
113
131
|
}) : [];
|
|
114
|
-
var overflowMenu = renderSecondaryOverflowMenu(secondaryOverflowMenuItems, reversed);
|
|
115
|
-
var combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(secondaryActions, secondaryOverflowMenuItems, reversed);
|
|
132
|
+
var overflowMenu = renderSecondaryOverflowMenu(menuAriaLabel, menuLabel, secondaryOverflowMenuItems, reversed);
|
|
133
|
+
var combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(combinedMenuLabel, secondaryActions, secondaryOverflowMenuItems, reversed);
|
|
116
134
|
var toolbarItems = __spreadArray(__spreadArray(__spreadArray([], secondaryActionsAsToolbarItems, true), overflowMenu ? [{
|
|
117
135
|
key: 'overflowMenu',
|
|
118
136
|
node: overflowMenu
|
package/dist/styles.css
CHANGED
|
@@ -10248,7 +10248,6 @@
|
|
|
10248
10248
|
display: none;
|
|
10249
10249
|
align-self: self-start;
|
|
10250
10250
|
box-sizing: border-box;
|
|
10251
|
-
overflow: hidden;
|
|
10252
10251
|
height: 3rem;
|
|
10253
10252
|
width: 3rem;
|
|
10254
10253
|
margin-inline-end: calc(1.5rem / 2);
|
|
@@ -10258,6 +10257,7 @@
|
|
|
10258
10257
|
max-width: 100%;
|
|
10259
10258
|
}
|
|
10260
10259
|
.TitleBlock-module_avatar__mEjJ8.TitleBlock-module_withBorder__D8Mz2 {
|
|
10260
|
+
overflow: hidden;
|
|
10261
10261
|
border: 3px solid var(--color-white, #ffffff);
|
|
10262
10262
|
border-radius: 50%;
|
|
10263
10263
|
}
|
package/locales/en.json
CHANGED
|
@@ -221,6 +221,30 @@
|
|
|
221
221
|
"description": "Prompts user to interact with button to hide information",
|
|
222
222
|
"message": "Hide information:"
|
|
223
223
|
},
|
|
224
|
+
"kzTitleBlock.combinedOverflowMenuLabel": {
|
|
225
|
+
"description": "Label for the dropdown menu which displays additional action items and secondary actions",
|
|
226
|
+
"message": "Open combined secondary and overflow menu"
|
|
227
|
+
},
|
|
228
|
+
"kzTitleBlock.defaultActionMinimizedOverflowMenuLabel": {
|
|
229
|
+
"description": "Label for the dropdown menu which displays the default action item",
|
|
230
|
+
"message": "Open default action overflow menu"
|
|
231
|
+
},
|
|
232
|
+
"kzTitleBlock.hamburgerMenuLabel": {
|
|
233
|
+
"description": "Label for the dropdown menu which displays navigation items",
|
|
234
|
+
"message": "Open menu"
|
|
235
|
+
},
|
|
236
|
+
"kzTitleBlock.overflowMenuAriaLabel": {
|
|
237
|
+
"description": "Aria Label for the dropdown menu which displays additional action items",
|
|
238
|
+
"message": "Opens overflow menu"
|
|
239
|
+
},
|
|
240
|
+
"kzTitleBlock.overflowMenuLabel": {
|
|
241
|
+
"description": "Label for the dropdown menu which displays additional action items",
|
|
242
|
+
"message": "Menu"
|
|
243
|
+
},
|
|
244
|
+
"kzTitleBlock.secondaryAndOverflowMenuLabel": {
|
|
245
|
+
"description": "Label for the dropdown menu which displays additional actions",
|
|
246
|
+
"message": "Open secondary and overflow menu"
|
|
247
|
+
},
|
|
224
248
|
"singleSelect.chevronButton": {
|
|
225
249
|
"description": "Aria label text for the SingleSelect button to open and close suggestions list",
|
|
226
250
|
"message": "Show suggestions for {field}"
|
|
@@ -228,9 +252,5 @@
|
|
|
228
252
|
"singleSelect.clearButtonAlt_v2": {
|
|
229
253
|
"description": "Alt text for the clear selection button. The button clears the selection the user has made via a dropdown. The field placeholder is the label of the dropdown.",
|
|
230
254
|
"message": "Clear selection: {field}"
|
|
231
|
-
},
|
|
232
|
-
"splitButton.dropdownButton.label": {
|
|
233
|
-
"description": "Label for a dropdown menu holding additional actions",
|
|
234
|
-
"message": "Additional actions"
|
|
235
255
|
}
|
|
236
256
|
}
|
package/package.json
CHANGED
|
@@ -277,7 +277,6 @@
|
|
|
277
277
|
display: none;
|
|
278
278
|
align-self: self-start;
|
|
279
279
|
box-sizing: border-box;
|
|
280
|
-
overflow: hidden;
|
|
281
280
|
height: $ca-grid * 2;
|
|
282
281
|
width: $ca-grid * 2;
|
|
283
282
|
|
|
@@ -288,6 +287,7 @@
|
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
&.withBorder {
|
|
290
|
+
overflow: hidden;
|
|
291
291
|
border: 3px solid $color-white;
|
|
292
292
|
border-radius: 50%;
|
|
293
293
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react'
|
|
2
|
+
import { useIntl } from '@cultureamp/i18n-react-intl'
|
|
2
3
|
import classnames from 'classnames'
|
|
3
4
|
import { Avatar } from '~components/Avatar'
|
|
4
5
|
import { IconButton } from '~components/ButtonV1'
|
|
@@ -266,6 +267,7 @@ export const TitleBlock = ({
|
|
|
266
267
|
queries: { isSmall, isMedium },
|
|
267
268
|
} = useMediaQueries()
|
|
268
269
|
const isSmallOrMediumViewport = isMedium || isSmall
|
|
270
|
+
const { formatMessage } = useIntl()
|
|
269
271
|
return (
|
|
270
272
|
<>
|
|
271
273
|
<div
|
|
@@ -305,7 +307,12 @@ export const TitleBlock = ({
|
|
|
305
307
|
<IconButton
|
|
306
308
|
onClick={handleHamburgerClick}
|
|
307
309
|
icon={<Icon name="menu" isPresentational />}
|
|
308
|
-
label=
|
|
310
|
+
label={formatMessage({
|
|
311
|
+
id: 'kzTitleBlock.hamburgerMenuLabel',
|
|
312
|
+
defaultMessage: 'Open menu',
|
|
313
|
+
description:
|
|
314
|
+
'Label for the dropdown menu which displays navigation items',
|
|
315
|
+
})}
|
|
309
316
|
reversed={isReversed(variant)}
|
|
310
317
|
/>
|
|
311
318
|
</div>
|
|
@@ -302,6 +302,29 @@ export const StickerSheetVariants: Story = {
|
|
|
302
302
|
</StickerSheet>
|
|
303
303
|
),
|
|
304
304
|
}
|
|
305
|
+
export const StickerSheetWithDefaultAvatar: Story = {
|
|
306
|
+
name: 'Sticker Sheet (DefaultAvatar)',
|
|
307
|
+
render: () => (
|
|
308
|
+
<StickerSheet title="TitleBlock Variants With Default Avatar">
|
|
309
|
+
<StickerSheet.Row header="Default (Purple background)">
|
|
310
|
+
<TitleBlock title="Default Variant" avatar={{ fullName: 'Blanca Wheeler' }} />
|
|
311
|
+
</StickerSheet.Row>
|
|
312
|
+
<StickerSheet.Row header="Education (Blue background)">
|
|
313
|
+
<TitleBlock
|
|
314
|
+
variant="education"
|
|
315
|
+
title="Education Variant"
|
|
316
|
+
avatar={{ fullName: 'Blanca Wheeler' }}
|
|
317
|
+
/>
|
|
318
|
+
</StickerSheet.Row>
|
|
319
|
+
<StickerSheet.Row header="Admin (White background)">
|
|
320
|
+
<TitleBlock variant="admin" title="Admin Variant" avatar={{ fullName: 'Blanca Wheeler' }} />
|
|
321
|
+
</StickerSheet.Row>
|
|
322
|
+
<StickerSheet.Row header="Light (White background)">
|
|
323
|
+
<TitleBlock variant="light" title="Light Variant" avatar={{ fullName: 'Blanca Wheeler' }} />
|
|
324
|
+
</StickerSheet.Row>
|
|
325
|
+
</StickerSheet>
|
|
326
|
+
),
|
|
327
|
+
}
|
|
305
328
|
export const StickerSheetVariantsWithSection: Story = {
|
|
306
329
|
name: 'Sticker Sheet (Variants With Section)',
|
|
307
330
|
render: () => (
|
|
@@ -651,6 +674,7 @@ export const WithTitleCollapseNavigationAreaWhenPossible: Story = {
|
|
|
651
674
|
collapseNavigationAreaWhenPossible: true,
|
|
652
675
|
},
|
|
653
676
|
}
|
|
677
|
+
|
|
654
678
|
export const WithOnlySecondaryActions: Story = {
|
|
655
679
|
parameters: {
|
|
656
680
|
viewport: viewports,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { useIntl } from '@cultureamp/i18n-react-intl'
|
|
2
3
|
import { Button, IconButton } from '~components/ButtonV1'
|
|
3
4
|
import { Icon } from '~components/Icon'
|
|
4
5
|
import { Menu, MenuList } from '~components/MenuV1'
|
|
@@ -24,6 +25,7 @@ type MainActionsProps = {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const renderSecondaryAndOverflowMenu = (
|
|
28
|
+
secondaryAndOverflowMenuLabel: string,
|
|
27
29
|
secondaryOverflowMenuItems?: TitleBlockMenuItemProps[],
|
|
28
30
|
reversed?: boolean,
|
|
29
31
|
): JSX.Element | undefined => {
|
|
@@ -33,7 +35,7 @@ const renderSecondaryAndOverflowMenu = (
|
|
|
33
35
|
align="right"
|
|
34
36
|
button={
|
|
35
37
|
<IconButton
|
|
36
|
-
label={
|
|
38
|
+
label={secondaryAndOverflowMenuLabel}
|
|
37
39
|
reversed={reversed}
|
|
38
40
|
icon={<Icon name="more_horiz" isPresentational />}
|
|
39
41
|
id={TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID}
|
|
@@ -57,6 +59,13 @@ export const MainActions = ({
|
|
|
57
59
|
secondaryOverflowMenuItems,
|
|
58
60
|
reversed = false,
|
|
59
61
|
}: MainActionsProps): JSX.Element => {
|
|
62
|
+
const { formatMessage } = useIntl()
|
|
63
|
+
|
|
64
|
+
const secondaryAndOverflowMenuLabel = formatMessage({
|
|
65
|
+
id: 'kzTitleBlock.secondaryAndOverflowMenuLabel',
|
|
66
|
+
defaultMessage: 'Open secondary and overflow menu',
|
|
67
|
+
description: 'Label for the dropdown menu which displays additional actions',
|
|
68
|
+
})
|
|
60
69
|
let items
|
|
61
70
|
|
|
62
71
|
// Build combined secondary + overflow menu items once, to be spread into the toolbar items
|
|
@@ -97,7 +106,7 @@ export const MainActions = ({
|
|
|
97
106
|
if (allMenuItems.length > 0) {
|
|
98
107
|
secondaryAndOverflowMenu.push({
|
|
99
108
|
key: 'overflowMenu',
|
|
100
|
-
node: renderSecondaryAndOverflowMenu(allMenuItems, reversed)!,
|
|
109
|
+
node: renderSecondaryAndOverflowMenu(secondaryAndOverflowMenuLabel, allMenuItems, reversed)!,
|
|
101
110
|
})
|
|
102
111
|
}
|
|
103
112
|
|
|
@@ -130,7 +139,12 @@ export const MainActions = ({
|
|
|
130
139
|
align="right"
|
|
131
140
|
button={
|
|
132
141
|
<IconButton
|
|
133
|
-
label={
|
|
142
|
+
label={formatMessage({
|
|
143
|
+
id: 'kzTitleBlock.defaultActionMinimizedOverflowMenuLabel',
|
|
144
|
+
defaultMessage: 'Open default action overflow menu',
|
|
145
|
+
description:
|
|
146
|
+
'Label for the dropdown menu which displays the default action item',
|
|
147
|
+
})}
|
|
134
148
|
reversed={reversed}
|
|
135
149
|
icon={<Icon name="more_horiz" isPresentational />}
|
|
136
150
|
id={TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import { useIntl } from '@cultureamp/i18n-react-intl'
|
|
2
3
|
import { Button, IconButton } from '~components/ButtonV1'
|
|
3
4
|
import { Icon } from '~components/Icon'
|
|
4
5
|
import { Menu, MenuList } from '~components/MenuV1'
|
|
@@ -16,6 +17,8 @@ type Props = {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const renderSecondaryOverflowMenu = (
|
|
20
|
+
menuAriaLabel: string,
|
|
21
|
+
menuLabel: string,
|
|
19
22
|
secondaryOverflowMenuItems?: TitleBlockMenuItemProps[],
|
|
20
23
|
reversed?: boolean,
|
|
21
24
|
): JSX.Element | undefined => {
|
|
@@ -28,7 +31,8 @@ const renderSecondaryOverflowMenu = (
|
|
|
28
31
|
<Button
|
|
29
32
|
secondary
|
|
30
33
|
reversed={reversed}
|
|
31
|
-
label=
|
|
34
|
+
label={menuLabel}
|
|
35
|
+
aria-label={menuAriaLabel}
|
|
32
36
|
data-automation-id={TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID}
|
|
33
37
|
data-testid={TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID}
|
|
34
38
|
icon={<Icon name="keyboard_arrow_down" isPresentational />}
|
|
@@ -48,6 +52,7 @@ const renderSecondaryOverflowMenu = (
|
|
|
48
52
|
|
|
49
53
|
// New: combined overflow menu (secondary actions converted + overflow menu items)
|
|
50
54
|
const renderCombinedSecondaryOverflowMenu = (
|
|
55
|
+
combinedMenuLabel: string,
|
|
51
56
|
secondaryActions?: SecondaryActionsProps,
|
|
52
57
|
secondaryOverflowMenuItems?: TitleBlockMenuItemProps[],
|
|
53
58
|
reversed?: boolean,
|
|
@@ -66,7 +71,7 @@ const renderCombinedSecondaryOverflowMenu = (
|
|
|
66
71
|
align="right"
|
|
67
72
|
button={
|
|
68
73
|
<IconButton
|
|
69
|
-
label=
|
|
74
|
+
label={combinedMenuLabel}
|
|
70
75
|
reversed={reversed}
|
|
71
76
|
icon={<Icon name="more_horiz" isPresentational />}
|
|
72
77
|
id={`${TITLE_BLOCK_ZEN_SECONDARY_MENU_HTML_ID}__combined`}
|
|
@@ -92,8 +97,29 @@ export const SecondaryActions = ({
|
|
|
92
97
|
secondaryOverflowMenuItems,
|
|
93
98
|
reversed = false,
|
|
94
99
|
}: Props): JSX.Element | null => {
|
|
100
|
+
const { formatMessage } = useIntl()
|
|
101
|
+
|
|
95
102
|
if (!secondaryActions && !secondaryOverflowMenuItems) return null
|
|
96
103
|
|
|
104
|
+
const menuLabel = formatMessage({
|
|
105
|
+
id: 'kzTitleBlock.overflowMenuLabel',
|
|
106
|
+
defaultMessage: 'Menu',
|
|
107
|
+
description: 'Label for the dropdown menu which displays additional action items',
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
const menuAriaLabel = formatMessage({
|
|
111
|
+
id: 'kzTitleBlock.overflowMenuAriaLabel',
|
|
112
|
+
defaultMessage: 'Opens overflow menu',
|
|
113
|
+
description: 'Aria Label for the dropdown menu which displays additional action items',
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const combinedMenuLabel = formatMessage({
|
|
117
|
+
id: 'kzTitleBlock.combinedOverflowMenuLabel',
|
|
118
|
+
defaultMessage: 'Open combined secondary and overflow menu',
|
|
119
|
+
description:
|
|
120
|
+
'Label for the dropdown menu which displays additional action items and secondary actions',
|
|
121
|
+
})
|
|
122
|
+
|
|
97
123
|
const secondaryActionsAsToolbarItems = secondaryActions
|
|
98
124
|
? secondaryActions.map((action, i) => {
|
|
99
125
|
if ('menuItems' in action) {
|
|
@@ -148,8 +174,14 @@ export const SecondaryActions = ({
|
|
|
148
174
|
})
|
|
149
175
|
: []
|
|
150
176
|
|
|
151
|
-
const overflowMenu = renderSecondaryOverflowMenu(
|
|
177
|
+
const overflowMenu = renderSecondaryOverflowMenu(
|
|
178
|
+
menuAriaLabel,
|
|
179
|
+
menuLabel,
|
|
180
|
+
secondaryOverflowMenuItems,
|
|
181
|
+
reversed,
|
|
182
|
+
)
|
|
152
183
|
const combinedOverflowMenu = renderCombinedSecondaryOverflowMenu(
|
|
184
|
+
combinedMenuLabel,
|
|
153
185
|
secondaryActions,
|
|
154
186
|
secondaryOverflowMenuItems,
|
|
155
187
|
reversed,
|