@elliemae/ds-global-header 2.0.0-alpha.10 → 2.0.0-alpha.14
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/cjs/GlobalHeaderContainer.js +10 -7
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js +11 -9
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +22 -20
- package/cjs/components/Breadcrumb/styles.js +40 -19
- package/cjs/components/Toolbar/ToolbarItems.js +18 -21
- package/cjs/components/Toolbar/styles.js +16 -7
- package/cjs/config/useGetPropsWithDefaults.js +5 -0
- package/cjs/config/useGlobalHeader.js +11 -2
- package/cjs/config/useValidateProps.js +5 -2
- package/cjs/config/validateHelpers.js +5 -28
- package/cjs/defaultProps.js +4 -2
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +56 -44
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +21 -35
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +34 -16
- package/cjs/outOfTheBox/PopupMenu/styles.js +6 -3
- package/cjs/styles.js +6 -3
- package/esm/GlobalHeaderContainer.js +10 -7
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +11 -9
- package/esm/components/Breadcrumb/PureBreadcrumb.js +22 -19
- package/esm/components/Breadcrumb/styles.js +40 -19
- package/esm/components/Toolbar/ToolbarItems.js +17 -21
- package/esm/components/Toolbar/styles.js +16 -7
- package/esm/config/useGetPropsWithDefaults.js +5 -0
- package/esm/config/useGlobalHeader.js +11 -2
- package/esm/config/useValidateProps.js +5 -2
- package/esm/config/validateHelpers.js +5 -28
- package/esm/defaultProps.js +4 -2
- package/esm/outOfTheBox/AppPicker/AppPicker.js +56 -43
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +22 -35
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +35 -18
- package/esm/outOfTheBox/PopupMenu/styles.js +6 -3
- package/esm/styles.js +6 -3
- package/package.json +9 -9
- package/types/GlobalHeader.d.ts +30 -5
- package/types/components/Breadcrumb/styles.d.ts +4 -4
- package/types/components/Toolbar/styles.d.ts +1 -1
- package/types/config/validateHelpers.d.ts +4 -4
- package/types/index.d.d.ts +10 -16
- package/types/outOfTheBox/AppPicker/AppPicker.d.ts +8 -3
- package/types/outOfTheBox/PopupMenu/styles.d.ts +4 -4
- package/types/propTypes.d.ts +27 -6
- package/types/styles.d.ts +1 -1
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
7
|
var React = require('react');
|
|
7
|
-
var
|
|
8
|
+
var dsPopperjs = require('@elliemae/ds-popperjs');
|
|
8
9
|
var PopupMenuContent = require('./PopupMenuContent.js');
|
|
9
10
|
var styles = require('../../components/Toolbar/styles.js');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -12,30 +13,28 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
12
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
14
|
|
|
14
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
16
16
|
|
|
17
|
-
const PopupMenu =
|
|
18
|
-
Icon,
|
|
19
|
-
options,
|
|
20
|
-
closeOnClick,
|
|
21
|
-
title,
|
|
22
|
-
onClick
|
|
23
|
-
}) => {
|
|
17
|
+
const PopupMenu = _ref => {
|
|
24
18
|
var _PopupMenuContent;
|
|
25
19
|
|
|
20
|
+
let {
|
|
21
|
+
Icon,
|
|
22
|
+
options,
|
|
23
|
+
closeOnClick,
|
|
24
|
+
title,
|
|
25
|
+
onClick
|
|
26
|
+
} = _ref;
|
|
26
27
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
27
|
-
const buttonRef = React.
|
|
28
|
+
const [buttonRef, setButtonRef] = React.useState(null);
|
|
28
29
|
const handleKeyPress = React.useCallback(e => {
|
|
29
30
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
30
31
|
setIsOpen(true);
|
|
31
32
|
}
|
|
32
33
|
}, []);
|
|
33
34
|
const handleOnClose = React.useCallback(() => {
|
|
34
|
-
var _buttonRef$current;
|
|
35
|
-
|
|
36
35
|
setIsOpen(false);
|
|
37
|
-
|
|
38
|
-
}, []);
|
|
36
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.focus();
|
|
37
|
+
}, [buttonRef]);
|
|
39
38
|
const handleTriggerOnClick = React.useCallback(e => {
|
|
40
39
|
setIsOpen(true);
|
|
41
40
|
onClick(e);
|
|
@@ -43,39 +42,26 @@ const PopupMenu = ({
|
|
|
43
42
|
const handleItemClick = React.useCallback(() => {
|
|
44
43
|
if (closeOnClick) handleOnClose();
|
|
45
44
|
}, [closeOnClick, handleOnClose]);
|
|
46
|
-
const handleClickOutside = React.useCallback(() => setIsOpen(false), []);
|
|
47
45
|
const content = React.useMemo(() => _PopupMenuContent || (_PopupMenuContent = /*#__PURE__*/_jsx__default["default"](PopupMenuContent.PopupMenuContent, {
|
|
48
46
|
options: options,
|
|
49
47
|
onItemClick: handleItemClick,
|
|
50
48
|
onClose: handleOnClose
|
|
51
49
|
})), [options, handleItemClick, handleOnClose]);
|
|
52
|
-
|
|
53
|
-
ref
|
|
54
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(styles.Button, {
|
|
50
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.Button, {
|
|
55
51
|
onClick: handleTriggerOnClick,
|
|
56
52
|
onKeyPress: handleKeyPress,
|
|
57
53
|
title: title,
|
|
58
|
-
ref:
|
|
54
|
+
ref: setButtonRef,
|
|
59
55
|
"data-testid": "gh-toolbar-item",
|
|
60
|
-
children: /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
61
|
-
innerRef: ref,
|
|
56
|
+
children: Icon && /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
62
57
|
fill: "#FFF",
|
|
63
58
|
size: "m"
|
|
64
59
|
})
|
|
65
|
-
}), [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
placement: "bottom",
|
|
71
|
-
interactionType: "click",
|
|
72
|
-
showArrow: true,
|
|
73
|
-
style: {
|
|
74
|
-
padding: '0',
|
|
75
|
-
width: 'fit-content'
|
|
76
|
-
},
|
|
77
|
-
renderTrigger: trigger
|
|
78
|
-
}), [content, handleClickOutside, isOpen, trigger]);
|
|
60
|
+
}), /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
61
|
+
referenceElement: buttonRef,
|
|
62
|
+
showPopover: isOpen,
|
|
63
|
+
closeContextMenu: handleOnClose
|
|
64
|
+
}, void 0, content));
|
|
79
65
|
};
|
|
80
66
|
|
|
81
67
|
exports.PopupMenu = PopupMenu;
|
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
6
14
|
var React = require('react');
|
|
15
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
7
16
|
var styles = require('./styles.js');
|
|
8
17
|
var GlobalHeaderContext = require('../../GlobalHeaderContext.js');
|
|
9
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -11,36 +20,41 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
11
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
21
|
|
|
13
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
23
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
+
const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
30
|
+
let {
|
|
31
|
+
options,
|
|
32
|
+
onItemClick,
|
|
33
|
+
onClose
|
|
34
|
+
} = _ref;
|
|
21
35
|
const {
|
|
22
36
|
instanceUID
|
|
23
37
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
24
|
-
const menuRef = React.useRef();
|
|
38
|
+
const menuRef = React.useRef(null);
|
|
25
39
|
React.useEffect(() => {
|
|
26
40
|
var _menuRef$current, _menuRef$current$firs;
|
|
27
41
|
|
|
28
42
|
(_menuRef$current = menuRef.current) === null || _menuRef$current === void 0 ? void 0 : (_menuRef$current$firs = _menuRef$current.firstChild) === null || _menuRef$current$firs === void 0 ? void 0 : _menuRef$current$firs.focus();
|
|
29
43
|
}, []);
|
|
30
44
|
const content = React.useMemo(() => options.map(option => {
|
|
31
|
-
var _Content;
|
|
32
|
-
|
|
33
45
|
const {
|
|
34
46
|
type,
|
|
35
|
-
|
|
36
|
-
label,
|
|
47
|
+
Icon,
|
|
48
|
+
label = '',
|
|
37
49
|
onClick,
|
|
38
50
|
Content
|
|
39
51
|
} = option;
|
|
40
52
|
|
|
53
|
+
const ariaAndDataProps = _objectSpread(_objectSpread({}, dsPropsHelpers.getAriaProps(option)), dsPropsHelpers.getDataProps(option));
|
|
54
|
+
|
|
41
55
|
const handleClick = e => {
|
|
42
56
|
onItemClick(e);
|
|
43
|
-
onClick(e);
|
|
57
|
+
if (onClick) onClick(e);
|
|
44
58
|
};
|
|
45
59
|
|
|
46
60
|
const handleKeyDown = e => {
|
|
@@ -49,19 +63,23 @@ const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(({
|
|
|
49
63
|
|
|
50
64
|
switch (type) {
|
|
51
65
|
case 'separator':
|
|
52
|
-
return /*#__PURE__*/
|
|
66
|
+
return /*#__PURE__*/jsxRuntime.jsx(styles.Separator, _objectSpread({}, ariaAndDataProps), "".concat(instanceUID, "-separator-").concat(label));
|
|
53
67
|
|
|
54
68
|
case 'custom':
|
|
55
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/jsxRuntime.jsx(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
56
70
|
onClick: handleClick,
|
|
57
71
|
onKeyDown: handleKeyDown
|
|
58
|
-
},
|
|
72
|
+
}, ariaAndDataProps), {}, {
|
|
73
|
+
children: Content && /*#__PURE__*/_jsx__default["default"](Content, {})
|
|
74
|
+
}), "".concat(instanceUID, "-popup-").concat(label));
|
|
59
75
|
|
|
60
76
|
default:
|
|
61
|
-
return /*#__PURE__*/
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
62
78
|
onClick: handleClick,
|
|
63
79
|
onKeyDown: handleKeyDown
|
|
64
|
-
},
|
|
80
|
+
}, ariaAndDataProps), {}, {
|
|
81
|
+
children: [Icon && /*#__PURE__*/_jsx__default["default"](Icon, {}), styles.Label && /*#__PURE__*/_jsx__default["default"](styles.Label, {}, void 0, label)]
|
|
82
|
+
}), "".concat(instanceUID, "-popup-").concat(label));
|
|
65
83
|
}
|
|
66
84
|
}), [onClose, onItemClick, options, instanceUID]);
|
|
67
85
|
return /*#__PURE__*/jsxRuntime.jsx(styles.List, {
|
|
@@ -13,9 +13,12 @@ const List = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
|
13
13
|
})(["padding:5px 0px;"]);
|
|
14
14
|
const ItemWrapper = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
15
15
|
componentId: "sc-snqcgs-1"
|
|
16
|
-
})(["display:flex;align-items:center;justify-content:center;width:100%;padding:0 20px;cursor:pointer;border:1px solid transparent;background-color:transparent;outline:none;:hover,:focus{border:", ";}"],
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
})(["display:flex;align-items:center;justify-content:center;width:100%;padding:0 20px;cursor:pointer;border:1px solid transparent;background-color:transparent;outline:none;:hover,:focus{border:", ";}"], _ref => {
|
|
17
|
+
let {
|
|
18
|
+
theme
|
|
19
|
+
} = _ref;
|
|
20
|
+
return "1px solid ".concat(theme.colors.brand[600]);
|
|
21
|
+
});
|
|
19
22
|
const Label = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
20
23
|
componentId: "sc-snqcgs-2"
|
|
21
24
|
})(["width:100%;font-size:14px;margin:10px;"]);
|
package/cjs/styles.js
CHANGED
|
@@ -11,8 +11,11 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
11
11
|
|
|
12
12
|
const Wrapper = /*#__PURE__*/styled__default["default"](dsGrid.GridContainer).withConfig({
|
|
13
13
|
componentId: "sc-1v5zxxm-0"
|
|
14
|
-
})(["background-image:linear-gradient(45deg,#0f364a 0%,#1b6392 54%,#164566 100%);color:", ";width:100%;height:40px;padding:0 24px 0 12px;"],
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
})(["background-image:linear-gradient(45deg,#0f364a 0%,#1b6392 54%,#164566 100%);color:", ";width:100%;height:40px;padding:0 24px 0 12px;"], _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme
|
|
17
|
+
} = _ref;
|
|
18
|
+
return theme.colors.neutral['000'];
|
|
19
|
+
});
|
|
17
20
|
|
|
18
21
|
exports.Wrapper = Wrapper;
|
|
@@ -2,12 +2,15 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import { Wrapper } from './styles.js';
|
|
4
4
|
|
|
5
|
-
const GlobalHeaderContainer =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, void 0,
|
|
5
|
+
const GlobalHeaderContainer = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children
|
|
8
|
+
} = _ref;
|
|
9
|
+
return /*#__PURE__*/_jsx("header", {
|
|
10
|
+
"data-testid": "ds-global-header"
|
|
11
|
+
}, void 0, /*#__PURE__*/_jsx(Wrapper, {
|
|
12
|
+
cols: ['auto', '1fr', 'auto']
|
|
13
|
+
}, void 0, children));
|
|
14
|
+
};
|
|
12
15
|
|
|
13
16
|
export { GlobalHeaderContainer };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
2
4
|
import { useContext, useRef, useEffect } from 'react';
|
|
3
5
|
import { Grid } from '@elliemae/ds-grid';
|
|
4
6
|
import { Pipe } from './styles.js';
|
|
@@ -16,14 +18,14 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
16
18
|
setShowIconOnly,
|
|
17
19
|
globalHeaderBreadcrumbGrid
|
|
18
20
|
} = useContext(GlobalHeaderContext);
|
|
19
|
-
const breakpoint = useRef();
|
|
20
|
-
const flexRegion = useRef();
|
|
21
|
+
const breakpoint = useRef(null);
|
|
22
|
+
const flexRegion = useRef(null);
|
|
21
23
|
useEffect(() => {
|
|
22
24
|
const evaluateShowIconOnly = () => {
|
|
23
|
-
if ((flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
25
|
+
if (flexRegion && flexRegion.current && (flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
24
26
|
setShowIconOnly(true);
|
|
25
27
|
breakpoint.current = window.innerWidth;
|
|
26
|
-
} else if (window.innerWidth >= breakpoint.current) {
|
|
28
|
+
} else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
|
|
27
29
|
setShowIconOnly(false);
|
|
28
30
|
breakpoint.current = null;
|
|
29
31
|
}
|
|
@@ -36,13 +38,13 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
36
38
|
return /*#__PURE__*/_jsx(Grid, {
|
|
37
39
|
height: "100%",
|
|
38
40
|
alignItems: "center",
|
|
39
|
-
justifyContent: "
|
|
40
|
-
role: "navigation",
|
|
41
|
+
justifyContent: "flex-start",
|
|
41
42
|
"aria-label": "breadcrumbs",
|
|
42
|
-
cols: globalHeaderBreadcrumbGrid
|
|
43
|
+
cols: globalHeaderBreadcrumbGrid,
|
|
44
|
+
role: "navigation"
|
|
43
45
|
}, void 0, /*#__PURE__*/_jsx(Pipe, {
|
|
44
46
|
showIconOnly: showIconOnly
|
|
45
|
-
}), breadcrumb.map(item => {
|
|
47
|
+
}), breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.map(item => {
|
|
46
48
|
const {
|
|
47
49
|
label,
|
|
48
50
|
hasNext,
|
|
@@ -55,7 +57,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
55
57
|
isSelected: isSelected,
|
|
56
58
|
onClick: onClick,
|
|
57
59
|
length: breadcrumb.length
|
|
58
|
-
},
|
|
60
|
+
}, "".concat(instanceUID, "-breadcrumb-item-").concat(label));
|
|
59
61
|
}), /*#__PURE__*/jsx("div", {
|
|
60
62
|
id: "global-header-flex-region",
|
|
61
63
|
ref: flexRegion
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { ChevronSmallRight } from '@elliemae/ds-icons';
|
|
4
4
|
import { BreadcrumbItem, LabelButton, Label } from './styles.js';
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
const PureBreadcrumb = /*#__PURE__*/React.memo(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
var _ChevronSmallRight;
|
|
7
|
+
const PureBreadcrumb = /*#__PURE__*/React.memo(_ref => {
|
|
8
|
+
let {
|
|
9
|
+
onClick,
|
|
10
|
+
isSelected,
|
|
11
|
+
length,
|
|
12
|
+
label,
|
|
13
|
+
hasNext
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_jsx(BreadcrumbItem, {}, void 0, /*#__PURE__*/_jsx(LabelButton, {
|
|
16
|
+
onClick: onClick,
|
|
17
|
+
"aria-selected": isSelected,
|
|
18
|
+
"data-testid": "gh-breadcrumb-btn"
|
|
19
|
+
}, void 0, /*#__PURE__*/_jsx(Label, {
|
|
20
|
+
isSelected: !!isSelected,
|
|
21
|
+
isOnlyItem: length === 1
|
|
22
|
+
}, void 0, label)), hasNext && (_ChevronSmallRight || (_ChevronSmallRight = /*#__PURE__*/_jsx(ChevronSmallRight, {
|
|
23
|
+
size: "m",
|
|
24
|
+
fill: "#FFF"
|
|
25
|
+
}))));
|
|
26
|
+
});
|
|
24
27
|
|
|
25
28
|
export { PureBreadcrumb };
|
|
@@ -2,31 +2,52 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
const Pipe = /*#__PURE__*/styled.span.withConfig({
|
|
4
4
|
componentId: "sc-1n5l527-0"
|
|
5
|
-
})(["margin:0 7px 0 0;border-left:", ";height:20px;"],
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
})(["margin:0 7px 0 0;border-left:", ";height:20px;"], _ref => {
|
|
6
|
+
let {
|
|
7
|
+
showIconOnly
|
|
8
|
+
} = _ref;
|
|
9
|
+
return showIconOnly ? 'none' : '1px solid #fff';
|
|
10
|
+
});
|
|
8
11
|
const BreadcrumbItem = /*#__PURE__*/styled.div.withConfig({
|
|
9
12
|
componentId: "sc-1n5l527-1"
|
|
10
13
|
})(["display:flex;align-items:center;height:100%;"]);
|
|
11
14
|
const LabelButton = /*#__PURE__*/styled.button.withConfig({
|
|
12
15
|
componentId: "sc-1n5l527-2"
|
|
13
|
-
})(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{:after{content:'';position:absolute;top:0;left:-7px;width:calc(100% + 14px);height:100%;border:4px solid ", ";border-radius:6px;}:before{content:'';position:absolute;z-index:2;top:2px;left:-5px;width:calc(100% + 10px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
})(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{:after{content:'';position:absolute;top:0;left:-7px;width:calc(100% + 14px);height:100%;border:4px solid ", ";border-radius:6px;}:before{content:'';position:absolute;z-index:2;top:2px;left:-5px;width:calc(100% + 10px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
theme
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return theme.colors.brand[700];
|
|
21
|
+
}, _ref3 => {
|
|
22
|
+
let {
|
|
23
|
+
theme
|
|
24
|
+
} = _ref3;
|
|
25
|
+
return theme.colors.neutral['000'];
|
|
26
|
+
});
|
|
18
27
|
const Label = /*#__PURE__*/styled.p.withConfig({
|
|
19
28
|
componentId: "sc-1n5l527-3"
|
|
20
|
-
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"],
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"], _ref4 => {
|
|
30
|
+
let {
|
|
31
|
+
theme
|
|
32
|
+
} = _ref4;
|
|
33
|
+
return theme.colors.neutral['000'];
|
|
34
|
+
}, _ref5 => {
|
|
35
|
+
let {
|
|
36
|
+
theme,
|
|
37
|
+
isSelected
|
|
38
|
+
} = _ref5;
|
|
39
|
+
return "-webkit-text-stroke: 0.4px ".concat(isSelected ? theme.colors.neutral['000'] : 'transparent');
|
|
40
|
+
}, _ref6 => {
|
|
41
|
+
let {
|
|
42
|
+
isSelected,
|
|
43
|
+
isOnlyItem
|
|
44
|
+
} = _ref6;
|
|
45
|
+
return "2px solid ".concat(isSelected && !isOnlyItem ? '#FFF' : 'transparent');
|
|
46
|
+
}, _ref7 => {
|
|
47
|
+
let {
|
|
48
|
+
theme
|
|
49
|
+
} = _ref7;
|
|
50
|
+
return "-webkit-text-stroke: 0.4px ".concat(theme.colors.neutral['000']);
|
|
51
|
+
});
|
|
31
52
|
|
|
32
53
|
export { BreadcrumbItem, Label, LabelButton, Pipe };
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
1
2
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
10
|
import { useContext, useMemo } from 'react';
|
|
3
11
|
import { AppPicker } from '../../outOfTheBox/AppPicker/AppPicker.js';
|
|
4
12
|
import { PopupMenu } from '../../outOfTheBox/PopupMenu/PopupMenu.js';
|
|
@@ -6,6 +14,9 @@ import { Button } from './styles.js';
|
|
|
6
14
|
import { GlobalHeaderContext } from '../../GlobalHeaderContext.js';
|
|
7
15
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
8
16
|
|
|
17
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
+
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9
20
|
const ToolbarItems = () => {
|
|
10
21
|
const {
|
|
11
22
|
props: {
|
|
@@ -13,7 +24,7 @@ const ToolbarItems = () => {
|
|
|
13
24
|
},
|
|
14
25
|
instanceUID
|
|
15
26
|
} = useContext(GlobalHeaderContext);
|
|
16
|
-
const itemsList = useMemo(() => toolbar.map(item => {
|
|
27
|
+
const itemsList = useMemo(() => toolbar === null || toolbar === void 0 ? void 0 : toolbar.map(item => {
|
|
17
28
|
var _Icon;
|
|
18
29
|
|
|
19
30
|
const {
|
|
@@ -36,34 +47,19 @@ const ToolbarItems = () => {
|
|
|
36
47
|
Icon: Icon,
|
|
37
48
|
options: options,
|
|
38
49
|
closeOnClick: closeOnClick
|
|
39
|
-
},
|
|
50
|
+
}, "".concat(instanceUID, "-ds-popup-menu-").concat(label));
|
|
40
51
|
|
|
41
52
|
case 'ds-app-picker':
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
sectionTitle,
|
|
46
|
-
customSectionTitle,
|
|
47
|
-
actionRef,
|
|
48
|
-
onKeyDown
|
|
49
|
-
} = componentProps;
|
|
50
|
-
return /*#__PURE__*/_jsx(AppPicker, {
|
|
51
|
-
onClick: onClick,
|
|
52
|
-
label: label,
|
|
53
|
-
apps: apps,
|
|
54
|
-
customApps: customApps,
|
|
55
|
-
sectionTitle: sectionTitle,
|
|
56
|
-
customSectionTitle: customSectionTitle,
|
|
57
|
-
actionRef: actionRef,
|
|
58
|
-
onKeyDown: onKeyDown
|
|
59
|
-
}, `${instanceUID}-ds-app-picker-${label}`);
|
|
53
|
+
return /*#__PURE__*/jsx(AppPicker, _objectSpread({
|
|
54
|
+
label: label
|
|
55
|
+
}, componentProps), "".concat(instanceUID, "-ds-app-picker-").concat(label));
|
|
60
56
|
|
|
61
57
|
default:
|
|
62
58
|
return /*#__PURE__*/_jsx(Button, {
|
|
63
59
|
onClick: onClick,
|
|
64
60
|
title: label,
|
|
65
61
|
"data-testid": "gh-toolbar-item"
|
|
66
|
-
},
|
|
62
|
+
}, "".concat(instanceUID, "-ds-toolbar-button-").concat(label), _Icon || (_Icon = /*#__PURE__*/_jsx(Icon, {
|
|
67
63
|
fill: "#FFF",
|
|
68
64
|
size: "m"
|
|
69
65
|
})));
|
|
@@ -2,12 +2,21 @@ import styled from 'styled-components';
|
|
|
2
2
|
|
|
3
3
|
const Button = /*#__PURE__*/styled.button.withConfig({
|
|
4
4
|
componentId: "sc-1gqj0i3-0"
|
|
5
|
-
})(["height:40px;width:40px;border:none;background-color:transparent;cursor:pointer;position:relative;outline:none;&:hover:not(:focus){background-color:", ";outline:none;}&:focus{:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;border:4px solid ", ";border-radius:4px;}:before{content:'';position:absolute;z-index:2;top:2px;left:2px;width:calc(100% - 4px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"],
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
})(["height:40px;width:40px;border:none;background-color:transparent;cursor:pointer;position:relative;outline:none;&:hover:not(:focus){background-color:", ";outline:none;}&:focus{:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;border:4px solid ", ";border-radius:4px;}:before{content:'';position:absolute;z-index:2;top:2px;left:2px;width:calc(100% - 4px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], _ref => {
|
|
6
|
+
let {
|
|
7
|
+
theme
|
|
8
|
+
} = _ref;
|
|
9
|
+
return theme.colors.brand[700];
|
|
10
|
+
}, _ref2 => {
|
|
11
|
+
let {
|
|
12
|
+
theme
|
|
13
|
+
} = _ref2;
|
|
14
|
+
return theme.colors.brand[700];
|
|
15
|
+
}, _ref3 => {
|
|
16
|
+
let {
|
|
17
|
+
theme
|
|
18
|
+
} = _ref3;
|
|
19
|
+
return theme.colors.neutral['000'];
|
|
20
|
+
});
|
|
12
21
|
|
|
13
22
|
export { Button };
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import { useMemo } from 'react';
|
|
3
8
|
import { defaultProps } from '../defaultProps.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import React, { useState, useMemo } from 'react';
|
|
2
3
|
import { uid } from 'uid';
|
|
3
4
|
import { useGetPropsWithDefaults } from './useGetPropsWithDefaults.js';
|
|
@@ -5,8 +6,16 @@ import { useGetPropsWithDefaults } from './useGetPropsWithDefaults.js';
|
|
|
5
6
|
const useGlobalHeader = props => {
|
|
6
7
|
const [showIconOnly, setShowIconOnly] = useState(false);
|
|
7
8
|
const instanceUID = useMemo(() => uid(5), []);
|
|
8
|
-
const globalHeaderToolbarGrid = useMemo(() =>
|
|
9
|
-
|
|
9
|
+
const globalHeaderToolbarGrid = useMemo(() => {
|
|
10
|
+
var _props$toolbar$length, _props$toolbar;
|
|
11
|
+
|
|
12
|
+
return new Array((_props$toolbar$length = props === null || props === void 0 ? void 0 : (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.length) !== null && _props$toolbar$length !== void 0 ? _props$toolbar$length : 0).fill('1fr');
|
|
13
|
+
}, [props.toolbar]);
|
|
14
|
+
const globalHeaderBreadcrumbGrid = useMemo(() => {
|
|
15
|
+
var _props$breadcrumb$len, _props$breadcrumb;
|
|
16
|
+
|
|
17
|
+
return ['auto', ...new Array((_props$breadcrumb$len = props === null || props === void 0 ? void 0 : (_props$breadcrumb = props.breadcrumb) === null || _props$breadcrumb === void 0 ? void 0 : _props$breadcrumb.length) !== null && _props$breadcrumb$len !== void 0 ? _props$breadcrumb$len : 0).fill('auto'), '1fr'];
|
|
18
|
+
}, [props.breadcrumb]);
|
|
10
19
|
const propsWithDefaults = useGetPropsWithDefaults(props);
|
|
11
20
|
const ctx = React.useMemo(() => ({
|
|
12
21
|
props: propsWithDefaults,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
1
4
|
import { throwLogoError, throwBreadcrumbItemError, isValidToolbarType, throwToolbarItemGenericError, isObject, throwToolbarPopupItemError, throwToolbarAppPickerItemError } from './validateHelpers.js';
|
|
2
5
|
|
|
3
6
|
const validatePopupItem = componentProps => {
|
|
@@ -59,7 +62,7 @@ const useValidateProps = props => {
|
|
|
59
62
|
throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
60
63
|
}
|
|
61
64
|
|
|
62
|
-
breadcrumb.forEach(breadcrumbItem => {
|
|
65
|
+
breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.forEach(breadcrumbItem => {
|
|
63
66
|
if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
|
|
64
67
|
throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
65
68
|
}
|
|
@@ -76,7 +79,7 @@ const useValidateProps = props => {
|
|
|
76
79
|
throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
77
80
|
}
|
|
78
81
|
});
|
|
79
|
-
toolbar.forEach(toolbarItem => {
|
|
82
|
+
toolbar === null || toolbar === void 0 ? void 0 : toolbar.forEach(toolbarItem => {
|
|
80
83
|
validateGenericToolbarItem(toolbarItem);
|
|
81
84
|
|
|
82
85
|
if (toolbarItem.type) {
|
|
@@ -26,42 +26,19 @@ const getVariableType = arg => {
|
|
|
26
26
|
};
|
|
27
27
|
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu';
|
|
28
28
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
29
|
-
throw new Error(
|
|
30
|
-
|
|
31
|
-
Received: ${invalidProp} (${typeof invalidProp})
|
|
32
|
-
Expected: (${breadcrumbProps[validPropKey]})
|
|
33
|
-
`);
|
|
29
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a breadcrumb item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(typeof invalidProp, ")\n Expected: (").concat(breadcrumbProps[validPropKey], ")\n "));
|
|
34
30
|
};
|
|
35
31
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
36
|
-
throw new Error(
|
|
37
|
-
toolbar item, please provide a valid type.
|
|
38
|
-
|
|
39
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
40
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
41
|
-
`);
|
|
32
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property inside componentProps for a ds-popup-menu \n toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
42
33
|
};
|
|
43
34
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
44
|
-
throw new Error(
|
|
45
|
-
toolbar item, please provide a valid type.
|
|
46
|
-
|
|
47
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
48
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
49
|
-
`);
|
|
35
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property inside componentProps for a ds-app-picker \n toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
50
36
|
};
|
|
51
37
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
52
|
-
throw new Error(
|
|
53
|
-
|
|
54
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
55
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
56
|
-
`);
|
|
38
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
57
39
|
};
|
|
58
40
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
59
|
-
throw new Error(
|
|
60
|
-
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
61
|
-
|
|
62
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
63
|
-
Expected: (react component).
|
|
64
|
-
`);
|
|
41
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a global header, \n remember to provide both Logo and LogoWithBrand properties with a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ").\n Expected: (react component).\n "));
|
|
65
42
|
};
|
|
66
43
|
|
|
67
44
|
export { breadcrumbProps, getVariableType, isObject, isValidToolbarType, throwBreadcrumbItemError, throwLogoError, throwToolbarAppPickerItemError, throwToolbarItemGenericError, throwToolbarPopupItemError, toolbarProps };
|