@kaizen/components 2.2.4 → 2.3.1
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/MenuV1/index.cjs +4 -3
- package/dist/cjs/src/TitleBlock/TitleBlock.cjs +26 -36
- package/dist/cjs/src/TitleBlock/TitleBlock.module.scss.cjs +3 -0
- package/dist/cjs/src/TitleBlock/subcomponents/MainActions.cjs +90 -45
- package/dist/cjs/src/TitleBlock/subcomponents/MainActions.module.scss.cjs +3 -1
- package/dist/cjs/src/TitleBlock/subcomponents/SecondaryActions.cjs +51 -14
- package/dist/esm/src/MenuV1/index.mjs +5 -3
- package/dist/esm/src/TitleBlock/TitleBlock.mjs +27 -37
- package/dist/esm/src/TitleBlock/TitleBlock.module.scss.mjs +3 -0
- package/dist/esm/src/TitleBlock/subcomponents/MainActions.mjs +92 -47
- package/dist/esm/src/TitleBlock/subcomponents/MainActions.module.scss.mjs +3 -1
- package/dist/esm/src/TitleBlock/subcomponents/SecondaryActions.mjs +51 -14
- package/dist/styles.css +78 -207
- package/dist/types/TitleBlock/TitleBlock.d.ts +1 -1
- package/dist/types/TitleBlock/subcomponents/MainActions.d.ts +4 -3
- package/package.json +1 -1
- package/src/TitleBlock/TitleBlock.module.scss +51 -14
- package/src/TitleBlock/TitleBlock.spec.tsx +33 -461
- package/src/TitleBlock/TitleBlock.tsx +4 -24
- package/src/TitleBlock/_docs/TitleBlock.stories.tsx +78 -100
- package/src/TitleBlock/_mixins.scss +6 -0
- package/src/TitleBlock/subcomponents/MainActions.module.scss +27 -2
- package/src/TitleBlock/subcomponents/MainActions.tsx +127 -70
- package/src/TitleBlock/subcomponents/SecondaryActions.tsx +105 -45
- package/src/TitleBlock/subcomponents/Toolbar.tsx +1 -0
- package/dist/cjs/src/MenuV1/subcomponents/MenuHeading/MenuHeading.cjs +0 -27
- package/dist/cjs/src/MenuV1/subcomponents/MenuHeading/MenuHeading.module.scss.cjs +0 -6
- package/dist/cjs/src/TitleBlock/subcomponents/MobileActions.cjs +0 -306
- package/dist/cjs/src/TitleBlock/subcomponents/MobileActions.module.scss.cjs +0 -16
- package/dist/esm/src/MenuV1/subcomponents/MenuHeading/MenuHeading.mjs +0 -21
- package/dist/esm/src/MenuV1/subcomponents/MenuHeading/MenuHeading.module.scss.mjs +0 -4
- package/dist/esm/src/TitleBlock/subcomponents/MobileActions.mjs +0 -300
- package/dist/esm/src/TitleBlock/subcomponents/MobileActions.module.scss.mjs +0 -14
- package/dist/types/TitleBlock/subcomponents/MobileActions.d.ts +0 -14
- package/src/TitleBlock/subcomponents/MobileActions.module.scss +0 -208
- package/src/TitleBlock/subcomponents/MobileActions.spec.tsx +0 -210
- package/src/TitleBlock/subcomponents/MobileActions.tsx +0 -472
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { __assign } from 'tslib';
|
|
2
|
-
import React, { useState, useCallback, useEffect } from 'react';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
import { FocusOn } from 'react-focus-on';
|
|
5
|
-
import { Icon } from '../../Icon/Icon.mjs';
|
|
6
|
-
import { MenuList, MenuHeading, MenuItem } from '../../MenuV1/index.mjs';
|
|
7
|
-
import { TITLE_BLOCK_ZEN_OTHER_ACTIONS_HTML_ID } from '../constants.mjs';
|
|
8
|
-
import { isMenuGroupNotButton, convertSecondaryActionsToMenuItems } from '../utils.mjs';
|
|
9
|
-
import { TitleBlockMenuItem } from './TitleBlockMenuItem.mjs';
|
|
10
|
-
import styles from './MobileActions.module.scss.mjs';
|
|
11
|
-
var menuItemIsLink = function (item) {
|
|
12
|
-
return 'href' in item;
|
|
13
|
-
};
|
|
14
|
-
var defaultActionIsLink = function (action) {
|
|
15
|
-
return 'href' in action;
|
|
16
|
-
};
|
|
17
|
-
var defaultActionIsButton = function (action) {
|
|
18
|
-
return !('href' in action) && 'onClick' in action || 'component' in action;
|
|
19
|
-
};
|
|
20
|
-
var filterActions = function (menuItems, filterType) {
|
|
21
|
-
return menuItems.filter(function (item) {
|
|
22
|
-
return filterType === 'link' ? menuItemIsLink(item) : !menuItemIsLink(item);
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
/** Returns a filtered array of TitleBlockMenuItem based on actionType
|
|
26
|
-
* This is use to sort a selectively render the action into a specifc order
|
|
27
|
-
*/
|
|
28
|
-
var renderPrimaryActionDrawerContent = function (primaryAction, actionType) {
|
|
29
|
-
if (!primaryAction) return null;
|
|
30
|
-
if (isMenuGroupNotButton(primaryAction)) {
|
|
31
|
-
var filteredActions = filterActions(primaryAction.menuItems, actionType);
|
|
32
|
-
return filteredActions.map(function (item, idx) {
|
|
33
|
-
var itemType = menuItemIsLink(item) ? 'link' : 'action';
|
|
34
|
-
return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, item, {
|
|
35
|
-
key: "title-block-mobile-actions-primary-".concat(itemType, "-").concat(idx),
|
|
36
|
-
"data-automation-id": "title-block-mobile-actions-primary-".concat(itemType, "-").concat(idx),
|
|
37
|
-
"data-testid": "title-block-mobile-actions-primary-".concat(itemType, "-").concat(idx)
|
|
38
|
-
}));
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return null;
|
|
42
|
-
};
|
|
43
|
-
var renderDefaultLink = function (defaultAction) {
|
|
44
|
-
if (!defaultActionIsLink(defaultAction)) return;
|
|
45
|
-
if ('component' in defaultAction) {
|
|
46
|
-
return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, defaultAction, {
|
|
47
|
-
key: "title-block-mobile-actions-default-link",
|
|
48
|
-
"data-automation-id": "title-block-mobile-actions-default-link",
|
|
49
|
-
"data-testid": "title-block-mobile-actions-default-link"
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
53
|
-
href: defaultAction.href,
|
|
54
|
-
label: defaultAction.label,
|
|
55
|
-
icon: defaultAction.icon,
|
|
56
|
-
disabled: defaultAction.disabled,
|
|
57
|
-
key: "title-block-mobile-actions-default-link",
|
|
58
|
-
"data-automation-id": "title-block-mobile-actions-default-link",
|
|
59
|
-
"data-testid": "title-block-mobile-actions-default-link",
|
|
60
|
-
id: defaultAction.id
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
var renderDefaultAction = function (defaultAction) {
|
|
64
|
-
if (!defaultActionIsLink(defaultAction)) {
|
|
65
|
-
return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, defaultAction, {
|
|
66
|
-
key: "title-block-mobile-actions-default-action",
|
|
67
|
-
"data-automation-id": "title-block-mobile-actions-default-action",
|
|
68
|
-
"data-testid": "title-block-mobile-actions-default-action"
|
|
69
|
-
}));
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
};
|
|
73
|
-
var renderSecondaryActions = function (secondaryActions) {
|
|
74
|
-
if (!secondaryActions) return null;
|
|
75
|
-
var secondaryActionMenuItems = convertSecondaryActionsToMenuItems(secondaryActions);
|
|
76
|
-
return secondaryActionMenuItems.map(function (item, idx) {
|
|
77
|
-
return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, item, {
|
|
78
|
-
key: "title-block-mobile-actions-secondary-action-".concat(idx),
|
|
79
|
-
"data-testid": "title-block-mobile-actions-secondary-action"
|
|
80
|
-
}));
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
var renderSecondaryOverflowMenuItems = function (secondaryOverflowMenuItems) {
|
|
84
|
-
return secondaryOverflowMenuItems.map(function (item, idx) {
|
|
85
|
-
return /*#__PURE__*/React.createElement(TitleBlockMenuItem, __assign({}, item, {
|
|
86
|
-
key: "title-block-mobile-actions-overflow-menu-item-".concat(idx),
|
|
87
|
-
"data-testid": "title-block-mobile-actions-overflow-menu-item"
|
|
88
|
-
}));
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
var DrawerMenuContent = function (_a) {
|
|
92
|
-
var _b, _c, _d;
|
|
93
|
-
var primaryAction = _a.primaryAction,
|
|
94
|
-
defaultAction = _a.defaultAction,
|
|
95
|
-
secondaryActions = _a.secondaryActions,
|
|
96
|
-
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems;
|
|
97
|
-
var showOtherActionsHeading = (_c = (_b = defaultAction && defaultActionIsButton(defaultAction)) !== null && _b !== void 0 ? _b : secondaryActions) !== null && _c !== void 0 ? _c : secondaryOverflowMenuItems;
|
|
98
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MenuList, null, primaryAction && renderPrimaryActionDrawerContent(primaryAction, 'link'), defaultAction && renderDefaultLink(defaultAction), primaryAction && renderPrimaryActionDrawerContent(primaryAction, 'action')), ((_d = defaultAction !== null && defaultAction !== void 0 ? defaultAction : secondaryActions) !== null && _d !== void 0 ? _d : secondaryOverflowMenuItems) && (/*#__PURE__*/React.createElement(MenuList, {
|
|
99
|
-
heading: showOtherActionsHeading ? /*#__PURE__*/React.createElement(MenuHeading, null, "Other actions") : undefined
|
|
100
|
-
}, defaultAction && renderDefaultAction(defaultAction), secondaryActions && renderSecondaryActions(secondaryActions), secondaryOverflowMenuItems && renderSecondaryOverflowMenuItems(secondaryOverflowMenuItems))));
|
|
101
|
-
};
|
|
102
|
-
var renderDrawerHandleLabel = function (label, icon, drawerHandleLabelIconPosition) {
|
|
103
|
-
if (drawerHandleLabelIconPosition === 'end') {
|
|
104
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
105
|
-
className: styles.drawerHandleLabelText,
|
|
106
|
-
"data-testid": "drawer-handle-lable-text"
|
|
107
|
-
}, label), /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement("span", {
|
|
108
|
-
className: styles.drawerHandleIcon
|
|
109
|
-
}, icon)));
|
|
110
|
-
} else {
|
|
111
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement("span", {
|
|
112
|
-
className: styles.drawerHandleIcon
|
|
113
|
-
}, icon)), /*#__PURE__*/React.createElement("span", {
|
|
114
|
-
className: styles.drawerHandleLabelText,
|
|
115
|
-
"data-testid": "drawer-handle-lable-text"
|
|
116
|
-
}, label));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
var ButtonOrLink = function (_a) {
|
|
120
|
-
var action = _a.action,
|
|
121
|
-
children = _a.children;
|
|
122
|
-
if (typeof action === 'object' && 'onClick' in action && 'href' in action) {
|
|
123
|
-
return /*#__PURE__*/React.createElement("a", {
|
|
124
|
-
onClick: action.onClick,
|
|
125
|
-
href: action.href,
|
|
126
|
-
className: classnames(styles.mobileActionsPrimaryLabel, styles.mobileActionsPrimaryButton),
|
|
127
|
-
"data-testid": "title-block-mobile-actions-primary-button"
|
|
128
|
-
}, children);
|
|
129
|
-
}
|
|
130
|
-
if (typeof action === 'function') {
|
|
131
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
132
|
-
type: "button",
|
|
133
|
-
onClick: action,
|
|
134
|
-
className: classnames(styles.mobileActionsPrimaryLabel, styles.mobileActionsPrimaryButton),
|
|
135
|
-
"data-testid": "title-block-mobile-actions-primary-button"
|
|
136
|
-
}, children);
|
|
137
|
-
}
|
|
138
|
-
if (typeof action === 'string') {
|
|
139
|
-
return /*#__PURE__*/React.createElement("a", {
|
|
140
|
-
href: action,
|
|
141
|
-
className: classnames(styles.mobileActionsPrimaryLabel, styles.mobileActionsPrimaryButton),
|
|
142
|
-
"data-testid": "title-block-mobile-actions-primary-button"
|
|
143
|
-
}, children);
|
|
144
|
-
}
|
|
145
|
-
// when there's no action (e.g. primary button is disabled)
|
|
146
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
147
|
-
type: "button",
|
|
148
|
-
className: classnames(styles.mobileActionsPrimaryLabel, styles.mobileActionsPrimaryButton),
|
|
149
|
-
"data-testid": "title-block-mobile-actions-primary-button"
|
|
150
|
-
}, children);
|
|
151
|
-
};
|
|
152
|
-
var getAction = function (primaryAction) {
|
|
153
|
-
if (primaryAction && !primaryAction.disabled) {
|
|
154
|
-
if (primaryAction.onClick && primaryAction.href) {
|
|
155
|
-
return {
|
|
156
|
-
href: primaryAction.href,
|
|
157
|
-
onClick: primaryAction.onClick
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
if (primaryAction.onClick) {
|
|
161
|
-
return primaryAction.onClick;
|
|
162
|
-
}
|
|
163
|
-
if (primaryAction.href) {
|
|
164
|
-
return primaryAction.href;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return undefined;
|
|
168
|
-
};
|
|
169
|
-
var DrawerHandle = function (_a) {
|
|
170
|
-
var _b;
|
|
171
|
-
var primaryAction = _a.primaryAction,
|
|
172
|
-
secondaryActions = _a.secondaryActions,
|
|
173
|
-
defaultAction = _a.defaultAction,
|
|
174
|
-
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
175
|
-
drawerHandleLabelIconPosition = _a.drawerHandleLabelIconPosition,
|
|
176
|
-
toggleDisplay = _a.toggleDisplay,
|
|
177
|
-
isOpen = _a.isOpen;
|
|
178
|
-
var showDrawer = (_b = defaultAction !== null && defaultAction !== void 0 ? defaultAction : secondaryActions) !== null && _b !== void 0 ? _b : secondaryOverflowMenuItems;
|
|
179
|
-
if (primaryAction) {
|
|
180
|
-
// If the primary action is a menu
|
|
181
|
-
if (isMenuGroupNotButton(primaryAction)) {
|
|
182
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
183
|
-
className: classnames(styles.mobileActionsTopRow, styles.mobileActionsTopRowSingleButton),
|
|
184
|
-
"data-testid": "title-block-mobile-actions-drawer-handle"
|
|
185
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
186
|
-
type: "button",
|
|
187
|
-
className: classnames(styles.mobileActionsExpandButton, styles.mobileActionsPrimaryLabel),
|
|
188
|
-
onClick: toggleDisplay,
|
|
189
|
-
"aria-expanded": isOpen
|
|
190
|
-
}, primaryAction.label, /*#__PURE__*/React.createElement("span", {
|
|
191
|
-
className: styles.mobileActionsChevronSquare
|
|
192
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
193
|
-
name: isOpen ? 'keyboard_arrow_down' : 'keyboard_arrow_up',
|
|
194
|
-
isPresentational: true
|
|
195
|
-
}))));
|
|
196
|
-
}
|
|
197
|
-
// If the primary action is a button, or has no onClick/href/action
|
|
198
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
199
|
-
className: classnames(styles.mobileActionsTopRow, !showDrawer && styles.mobileActionsTopRowSingleButton),
|
|
200
|
-
"data-testid": "title-block-mobile-actions-drawer-handle"
|
|
201
|
-
}, 'component' in primaryAction ? (/*#__PURE__*/React.createElement(primaryAction.component, __assign({
|
|
202
|
-
className: classnames(styles.mobileActionsPrimaryLabel, styles.mobileActionsPrimaryButton)
|
|
203
|
-
}, primaryAction), primaryAction.label && renderDrawerHandleLabel(primaryAction.label, primaryAction.icon, drawerHandleLabelIconPosition))) : (/*#__PURE__*/React.createElement(ButtonOrLink, {
|
|
204
|
-
action: getAction(primaryAction)
|
|
205
|
-
}, renderDrawerHandleLabel(primaryAction.label, primaryAction.icon, drawerHandleLabelIconPosition))), showDrawer && (/*#__PURE__*/React.createElement("button", {
|
|
206
|
-
type: "button",
|
|
207
|
-
className: styles.mobileActionsExpandButton,
|
|
208
|
-
onClick: toggleDisplay,
|
|
209
|
-
"aria-expanded": isOpen,
|
|
210
|
-
id: TITLE_BLOCK_ZEN_OTHER_ACTIONS_HTML_ID,
|
|
211
|
-
"aria-label": "Other actions"
|
|
212
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
213
|
-
name: isOpen ? 'keyboard_arrow_down' : 'keyboard_arrow_up',
|
|
214
|
-
isPresentational: true
|
|
215
|
-
}))));
|
|
216
|
-
}
|
|
217
|
-
// if there are default/secondary actions but no primary action
|
|
218
|
-
if (showDrawer) {
|
|
219
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
220
|
-
className: classnames(styles.mobileActionsTopRow, styles.mobileActionsTopRowSingleButton),
|
|
221
|
-
"data-testid": "title-block-mobile-actions-drawer-handle"
|
|
222
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
223
|
-
type: "button",
|
|
224
|
-
className: classnames(styles.mobileActionsExpandButton, styles.mobileActionsPrimaryLabel),
|
|
225
|
-
onClick: toggleDisplay,
|
|
226
|
-
"aria-expanded": isOpen,
|
|
227
|
-
id: TITLE_BLOCK_ZEN_OTHER_ACTIONS_HTML_ID
|
|
228
|
-
}, renderDrawerHandleLabel('Other actions'), /*#__PURE__*/React.createElement("span", {
|
|
229
|
-
className: styles.mobileActionsChevronSquare
|
|
230
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
231
|
-
name: isOpen ? 'keyboard_arrow_down' : 'keyboard_arrow_up',
|
|
232
|
-
isPresentational: true
|
|
233
|
-
}))));
|
|
234
|
-
}
|
|
235
|
-
return null;
|
|
236
|
-
};
|
|
237
|
-
const MobileActions = /*#__PURE__*/function () {
|
|
238
|
-
const MobileActions = function (_a) {
|
|
239
|
-
var _b, _c;
|
|
240
|
-
var primaryAction = _a.primaryAction,
|
|
241
|
-
defaultAction = _a.defaultAction,
|
|
242
|
-
secondaryActions = _a.secondaryActions,
|
|
243
|
-
secondaryOverflowMenuItems = _a.secondaryOverflowMenuItems,
|
|
244
|
-
drawerHandleLabelIconPosition = _a.drawerHandleLabelIconPosition,
|
|
245
|
-
_d = _a.autoHide,
|
|
246
|
-
autoHide = _d === void 0 ? false : _d;
|
|
247
|
-
var _e = useState(false),
|
|
248
|
-
isOpen = _e[0],
|
|
249
|
-
setIsOpen = _e[1];
|
|
250
|
-
var menuContent = /*#__PURE__*/React.createRef();
|
|
251
|
-
var toggleDisplay = function () {
|
|
252
|
-
setIsOpen(!isOpen);
|
|
253
|
-
};
|
|
254
|
-
// This callback handler will not run when autoHide === "off"
|
|
255
|
-
var handleDocumentClickForAutoHide = useCallback(function (e) {
|
|
256
|
-
var _a;
|
|
257
|
-
if (isOpen && e.target instanceof Node && ((_a = menuContent.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
258
|
-
setIsOpen(false);
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
// @todo: Fix if possible - avoiding breaking in eslint upgrade
|
|
262
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
263
|
-
[menuContent]);
|
|
264
|
-
useEffect(function () {
|
|
265
|
-
if (autoHide) {
|
|
266
|
-
document.addEventListener('click', handleDocumentClickForAutoHide, true);
|
|
267
|
-
}
|
|
268
|
-
return function () {
|
|
269
|
-
if (autoHide) {
|
|
270
|
-
document.removeEventListener('click', handleDocumentClickForAutoHide, true);
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}, [autoHide, handleDocumentClickForAutoHide]);
|
|
274
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
275
|
-
className: classnames(styles.mobileActionsContainer, isOpen && styles.isOpen)
|
|
276
|
-
}, /*#__PURE__*/React.createElement(FocusOn, {
|
|
277
|
-
enabled: isOpen,
|
|
278
|
-
scrollLock: false
|
|
279
|
-
}, /*#__PURE__*/React.createElement(DrawerHandle, {
|
|
280
|
-
primaryAction: primaryAction,
|
|
281
|
-
secondaryActions: secondaryActions,
|
|
282
|
-
defaultAction: defaultAction,
|
|
283
|
-
secondaryOverflowMenuItems: secondaryOverflowMenuItems,
|
|
284
|
-
drawerHandleLabelIconPosition: drawerHandleLabelIconPosition,
|
|
285
|
-
toggleDisplay: toggleDisplay,
|
|
286
|
-
isOpen: isOpen
|
|
287
|
-
}), ((_c = (_b = defaultAction !== null && defaultAction !== void 0 ? defaultAction : secondaryActions) !== null && _b !== void 0 ? _b : secondaryOverflowMenuItems) !== null && _c !== void 0 ? _c : primaryAction && isMenuGroupNotButton(primaryAction)) && (/*#__PURE__*/React.createElement("div", {
|
|
288
|
-
ref: menuContent,
|
|
289
|
-
className: styles.mobileActionsMenuContainer
|
|
290
|
-
}, /*#__PURE__*/React.createElement(DrawerMenuContent, {
|
|
291
|
-
primaryAction: primaryAction,
|
|
292
|
-
defaultAction: defaultAction,
|
|
293
|
-
secondaryActions: secondaryActions,
|
|
294
|
-
secondaryOverflowMenuItems: secondaryOverflowMenuItems
|
|
295
|
-
})))));
|
|
296
|
-
};
|
|
297
|
-
MobileActions.displayName = 'MobileActions';
|
|
298
|
-
return MobileActions;
|
|
299
|
-
}();
|
|
300
|
-
export { MobileActions };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var styles = {
|
|
2
|
-
"mobileActionsContainer": "MobileActions-module_mobileActionsContainer__XoepA",
|
|
3
|
-
"isOpen": "MobileActions-module_isOpen__D40v5",
|
|
4
|
-
"mobileActionsMenuContainer": "MobileActions-module_mobileActionsMenuContainer__x--Eb",
|
|
5
|
-
"mobileActionsTopRow": "MobileActions-module_mobileActionsTopRow__RXNFZ",
|
|
6
|
-
"mobileActionsTopRowSingleButton": "MobileActions-module_mobileActionsTopRowSingleButton__5EjiI",
|
|
7
|
-
"drawerHandleIcon": "MobileActions-module_drawerHandleIcon__q9ewm",
|
|
8
|
-
"drawerHandleLabelText": "MobileActions-module_drawerHandleLabelText__MwJTA",
|
|
9
|
-
"mobileActionsPrimaryLabel": "MobileActions-module_mobileActionsPrimaryLabel__8yfuH",
|
|
10
|
-
"mobileActionsPrimaryButton": "MobileActions-module_mobileActionsPrimaryButton__Xsvo-",
|
|
11
|
-
"mobileActionsExpandButton": "MobileActions-module_mobileActionsExpandButton__XuHNU",
|
|
12
|
-
"mobileActionsChevronSquare": "MobileActions-module_mobileActionsChevronSquare__SPIsI"
|
|
13
|
-
};
|
|
14
|
-
export { styles as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ButtonProps } from "../../Button";
|
|
2
|
-
import { type DefaultActionProps, type PrimaryActionProps, type SecondaryActionsProps, type TitleBlockMenuItemProps } from '../types';
|
|
3
|
-
export type MobileActionsProps = {
|
|
4
|
-
primaryAction?: PrimaryActionProps;
|
|
5
|
-
defaultAction?: DefaultActionProps;
|
|
6
|
-
secondaryActions?: SecondaryActionsProps;
|
|
7
|
-
secondaryOverflowMenuItems?: TitleBlockMenuItemProps[];
|
|
8
|
-
drawerHandleLabelIconPosition?: ButtonProps['iconPosition'];
|
|
9
|
-
autoHide?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const MobileActions: {
|
|
12
|
-
({ primaryAction, defaultAction, secondaryActions, secondaryOverflowMenuItems, drawerHandleLabelIconPosition, autoHide, }: MobileActionsProps): JSX.Element;
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
@import '~@kaizen/design-tokens/sass/spacing';
|
|
2
|
-
@import '~@kaizen/design-tokens/sass/typography';
|
|
3
|
-
@import '~@kaizen/design-tokens/sass/color';
|
|
4
|
-
@import '~@kaizen/design-tokens/sass/layout';
|
|
5
|
-
@import '~@kaizen/design-tokens/sass/border';
|
|
6
|
-
@import '../../../styles/utils/legacy/layout';
|
|
7
|
-
@import '../../../styles/utils/legacy/grid';
|
|
8
|
-
@import '../../../styles/utils/layers';
|
|
9
|
-
@import '../mixins';
|
|
10
|
-
|
|
11
|
-
@layer kz-components {
|
|
12
|
-
$expand-button-width: 3.75rem;
|
|
13
|
-
$focus-spacing: 2px;
|
|
14
|
-
$focus-ring-border-width: 2px; // should be $border-focus-ring-border-width but CSS vars makes this hard
|
|
15
|
-
$space-for-focus-ring: ($focus-ring-border-width * 2) + ($focus-spacing * 2);
|
|
16
|
-
$slide-up-duration: 0.4s;
|
|
17
|
-
|
|
18
|
-
/* stylelint-disable no-descending-specificity */
|
|
19
|
-
.mobileActionsContainer {
|
|
20
|
-
display: none;
|
|
21
|
-
z-index: $ca-z-index-fixed;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
position: fixed;
|
|
24
|
-
bottom: 0;
|
|
25
|
-
left: 0;
|
|
26
|
-
right: 0;
|
|
27
|
-
border-start-start-radius: $border-solid-border-radius;
|
|
28
|
-
border-start-end-radius: $border-solid-border-radius;
|
|
29
|
-
-webkit-font-smoothing: antialiased;
|
|
30
|
-
-moz-osx-font-smoothing: grayscale;
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
transform: translateY(calc(100% - #{$layout-mobile-actions-drawer-height}));
|
|
33
|
-
transition: $slide-up-duration ease;
|
|
34
|
-
animation: slide-up 1s ease;
|
|
35
|
-
|
|
36
|
-
&.isOpen {
|
|
37
|
-
transform: translateY(0%);
|
|
38
|
-
|
|
39
|
-
.mobileActionsMenuContainer {
|
|
40
|
-
visibility: visible;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@include title-block-small {
|
|
45
|
-
display: flex;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.mobileActionsTopRow {
|
|
50
|
-
display: flex;
|
|
51
|
-
align-items: center;
|
|
52
|
-
justify-content: space-between;
|
|
53
|
-
height: $layout-mobile-actions-drawer-height;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.mobileActionsTopRow.mobileActionsTopRowSingleButton {
|
|
57
|
-
justify-content: center;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.mobileActionsMenuContainer {
|
|
61
|
-
visibility: hidden;
|
|
62
|
-
width: 100%;
|
|
63
|
-
background: $color-white;
|
|
64
|
-
padding: $spacing-xs 0;
|
|
65
|
-
transition: visibility $slide-up-duration;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.drawerHandleIcon {
|
|
69
|
-
display: flex;
|
|
70
|
-
justify-content: center;
|
|
71
|
-
align-items: center;
|
|
72
|
-
|
|
73
|
-
@include ca-margin($end: calc(#{$ca-grid} / 2));
|
|
74
|
-
|
|
75
|
-
.drawerHandleLabelText + & {
|
|
76
|
-
@include ca-margin($start: calc(#{$ca-grid} / 2));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.mobileActionsPrimaryLabel {
|
|
81
|
-
text-align: left;
|
|
82
|
-
text-decoration: none;
|
|
83
|
-
color: $color-white;
|
|
84
|
-
font-family: $typography-button-primary-font-family;
|
|
85
|
-
font-weight: $typography-button-primary-font-weight;
|
|
86
|
-
font-size: $typography-button-primary-font-size;
|
|
87
|
-
line-height: $typography-button-primary-line-height;
|
|
88
|
-
letter-spacing: $typography-button-primary-letter-spacing;
|
|
89
|
-
|
|
90
|
-
@include ca-padding($start: $ca-grid * 0.75);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.mobileActionsPrimaryButton,
|
|
94
|
-
.mobileActionsExpandButton {
|
|
95
|
-
display: flex;
|
|
96
|
-
position: relative;
|
|
97
|
-
justify-content: flex-start;
|
|
98
|
-
align-items: center;
|
|
99
|
-
height: 100%;
|
|
100
|
-
border: 0;
|
|
101
|
-
box-sizing: border-box;
|
|
102
|
-
color: $color-white;
|
|
103
|
-
background-color: $color-blue-500;
|
|
104
|
-
|
|
105
|
-
&:focus {
|
|
106
|
-
background-color: $color-blue-600;
|
|
107
|
-
outline: none;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&:focus-visible {
|
|
111
|
-
height: $layout-mobile-actions-drawer-height - $space-for-focus-ring;
|
|
112
|
-
|
|
113
|
-
&::after {
|
|
114
|
-
$focus-ring-offset: calc((#{$border-focus-ring-border-width} * 2));
|
|
115
|
-
|
|
116
|
-
content: '';
|
|
117
|
-
position: absolute;
|
|
118
|
-
background: transparent;
|
|
119
|
-
border-width: $focus-ring-border-width;
|
|
120
|
-
border-style: $border-focus-ring-border-style;
|
|
121
|
-
border-color: $color-blue-500;
|
|
122
|
-
inset: calc(-1 * #{$focus-ring-offset});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
&:hover {
|
|
127
|
-
text-decoration: none;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Full width versions
|
|
132
|
-
.mobileActionsPrimaryButton:only-child,
|
|
133
|
-
.mobileActionsExpandButton:only-child {
|
|
134
|
-
flex-basis: 100%;
|
|
135
|
-
border-start-start-radius: $border-solid-border-radius;
|
|
136
|
-
border-start-end-radius: $border-solid-border-radius;
|
|
137
|
-
|
|
138
|
-
&:focus-visible {
|
|
139
|
-
flex-basis: calc(100% - #{$space-for-focus-ring});
|
|
140
|
-
|
|
141
|
-
&::after {
|
|
142
|
-
border-start-start-radius: $border-focus-ring-border-radius;
|
|
143
|
-
border-start-end-radius: $border-focus-ring-border-radius;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Non full width versions
|
|
149
|
-
.mobileActionsPrimaryButton:not(:only-child) {
|
|
150
|
-
flex: 0 0 calc(100% - #{$expand-button-width});
|
|
151
|
-
|
|
152
|
-
&:focus-visible {
|
|
153
|
-
flex-basis: calc(100% - #{$expand-button-width} - #{$space-for-focus-ring});
|
|
154
|
-
margin-left: $focus-ring-border-width * 2;
|
|
155
|
-
border-start-start-radius: $border-solid-border-radius;
|
|
156
|
-
|
|
157
|
-
& + .mobileActionsExpandButton {
|
|
158
|
-
border-color: $color-white;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
&::after {
|
|
162
|
-
border-start-start-radius: $border-focus-ring-border-radius;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.mobileActionsExpandButton:not(:only-child) {
|
|
168
|
-
flex: 0 0 $expand-button-width;
|
|
169
|
-
border-left: 2px solid $color-blue-200;
|
|
170
|
-
justify-content: center;
|
|
171
|
-
|
|
172
|
-
&:focus-visible {
|
|
173
|
-
border-color: $color-white;
|
|
174
|
-
flex-basis: calc(#{$expand-button-width} - #{$space-for-focus-ring});
|
|
175
|
-
margin-right: $focus-ring-border-width * 2;
|
|
176
|
-
border-start-end-radius: $border-solid-border-radius;
|
|
177
|
-
|
|
178
|
-
&::after {
|
|
179
|
-
border-start-end-radius: $border-focus-ring-border-radius;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.mobileActionsChevronSquare {
|
|
185
|
-
display: flex;
|
|
186
|
-
justify-content: center;
|
|
187
|
-
align-items: center;
|
|
188
|
-
height: 100%;
|
|
189
|
-
position: absolute;
|
|
190
|
-
|
|
191
|
-
@include ca-position($end: 20px);
|
|
192
|
-
}
|
|
193
|
-
/* stylelint-enable no-descending-specificity */
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
@keyframes slide-up {
|
|
197
|
-
0% {
|
|
198
|
-
transform: translateY(100%);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
50% {
|
|
202
|
-
transform: translateY(100%);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
100% {
|
|
206
|
-
transform: translateY(calc(100% - #{$layout-mobile-actions-drawer-height}));
|
|
207
|
-
}
|
|
208
|
-
}
|