@elliemae/ds-global-header 2.4.2-rc.9 → 2.4.2
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/components/Breadcrumb/GlobalHeaderBreadcrumb.js +6 -8
- package/cjs/components/Breadcrumb/styles.js +3 -3
- package/cjs/components/Toolbar/ToolbarItems.js +8 -10
- package/cjs/config/useGlobalHeader.js +2 -11
- package/cjs/config/useValidateProps.js +2 -5
- package/cjs/config/validateHelpers.js +30 -5
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +9 -12
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +5 -6
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +4 -6
- package/cjs/outOfTheBox/PopupMenu/styles.js +1 -1
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js +5 -12
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +6 -8
- package/esm/components/Breadcrumb/styles.js +3 -3
- package/esm/components/Toolbar/ToolbarItems.js +8 -10
- package/esm/config/useGlobalHeader.js +2 -11
- package/esm/config/useValidateProps.js +2 -5
- package/esm/config/validateHelpers.js +30 -5
- package/esm/outOfTheBox/AppPicker/AppPicker.js +9 -12
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +5 -6
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +4 -6
- package/esm/outOfTheBox/PopupMenu/styles.js +1 -1
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js +5 -12
- package/package.json +9 -9
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.map.js');
|
|
10
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
11
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
12
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
14
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
12
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
15
13
|
var React = require('react');
|
|
16
14
|
var dsGrid = require('@elliemae/ds-grid');
|
|
17
15
|
var styles = require('./styles.js');
|
|
@@ -44,7 +42,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
44
42
|
const flexRegion = React.useRef(null);
|
|
45
43
|
React.useEffect(() => {
|
|
46
44
|
const evaluateShowIconOnly = () => {
|
|
47
|
-
if (flexRegion && flexRegion.current &&
|
|
45
|
+
if (flexRegion && flexRegion.current && flexRegion?.current.offsetWidth <= 0 && !breakpoint.current) {
|
|
48
46
|
setShowIconOnly(true);
|
|
49
47
|
breakpoint.current = window.innerWidth;
|
|
50
48
|
} else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
|
|
@@ -66,7 +64,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
66
64
|
role: "navigation"
|
|
67
65
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styles.Pipe, {
|
|
68
66
|
showIconOnly: showIconOnly
|
|
69
|
-
}), breadcrumb
|
|
67
|
+
}), breadcrumb?.map(item => {
|
|
70
68
|
const {
|
|
71
69
|
label
|
|
72
70
|
} = item,
|
|
@@ -75,7 +73,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
75
73
|
return /*#__PURE__*/jsxRuntime.jsx(PureBreadcrumb.PureBreadcrumb, _objectSpread({
|
|
76
74
|
label: label,
|
|
77
75
|
length: breadcrumb.length
|
|
78
|
-
}, rest),
|
|
76
|
+
}, rest), `${instanceUID}-breadcrumb-item-${label}`);
|
|
79
77
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
80
78
|
id: "global-header-flex-region",
|
|
81
79
|
ref: flexRegion
|
|
@@ -39,18 +39,18 @@ const Label = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
|
39
39
|
theme,
|
|
40
40
|
isSelected
|
|
41
41
|
} = _ref4;
|
|
42
|
-
return
|
|
42
|
+
return `-webkit-text-stroke: 0.4px ${isSelected ? theme.colors.neutral['000'] : 'transparent'}`;
|
|
43
43
|
}, _ref5 => {
|
|
44
44
|
let {
|
|
45
45
|
isSelected,
|
|
46
46
|
isOnlyItem
|
|
47
47
|
} = _ref5;
|
|
48
|
-
return
|
|
48
|
+
return `2px solid ${isSelected && !isOnlyItem ? '#FFF' : 'transparent'}`;
|
|
49
49
|
}, _ref6 => {
|
|
50
50
|
let {
|
|
51
51
|
theme
|
|
52
52
|
} = _ref6;
|
|
53
|
-
return
|
|
53
|
+
return `-webkit-text-stroke: 0.4px ${theme.colors.neutral['000']}`;
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
exports.BreadcrumbItem = BreadcrumbItem;
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
require('core-js/modules/esnext.async-iterator.map.js');
|
|
9
|
-
require('core-js/modules/esnext.iterator.map.js');
|
|
10
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
11
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
12
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
14
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
11
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
15
13
|
var React = require('react');
|
|
16
14
|
var AppPicker = require('../../outOfTheBox/AppPicker/AppPicker.js');
|
|
17
15
|
var PopupMenu = require('../../outOfTheBox/PopupMenu/PopupMenu.js');
|
|
@@ -39,7 +37,7 @@ const ToolbarItems = () => {
|
|
|
39
37
|
},
|
|
40
38
|
instanceUID
|
|
41
39
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
42
|
-
const itemsList = React.useMemo(() => toolbar
|
|
40
|
+
const itemsList = React.useMemo(() => toolbar?.map(item => {
|
|
43
41
|
var _Icon;
|
|
44
42
|
|
|
45
43
|
const {
|
|
@@ -64,20 +62,20 @@ const ToolbarItems = () => {
|
|
|
64
62
|
id: id
|
|
65
63
|
}, otherProps), {}, {
|
|
66
64
|
componentProps: componentProps
|
|
67
|
-
}),
|
|
65
|
+
}), `${instanceUID}-ds-popup-menu-${label}`);
|
|
68
66
|
|
|
69
67
|
case 'ds-app-picker':
|
|
70
68
|
return /*#__PURE__*/jsxRuntime.jsx(AppPicker.AppPicker, _objectSpread({
|
|
71
69
|
label: label,
|
|
72
70
|
id: id,
|
|
73
71
|
componentProps: componentProps
|
|
74
|
-
}, otherProps),
|
|
72
|
+
}, otherProps), `${instanceUID}-ds-app-picker-${label}`);
|
|
75
73
|
|
|
76
74
|
case 'ds-search-toggle':
|
|
77
75
|
return /*#__PURE__*/jsxRuntime.jsx(SearchToggle.SearchToggle, _objectSpread({
|
|
78
76
|
id: id,
|
|
79
77
|
componentProps: componentProps
|
|
80
|
-
}, otherProps),
|
|
78
|
+
}, otherProps), `${instanceUID}-ds-search-toggle-${id}`);
|
|
81
79
|
|
|
82
80
|
case 'custom':
|
|
83
81
|
if (CustomComponent) return /*#__PURE__*/_jsx__default["default"](CustomComponent, {
|
|
@@ -96,7 +94,7 @@ const ToolbarItems = () => {
|
|
|
96
94
|
fill: "#FFF",
|
|
97
95
|
size: "m"
|
|
98
96
|
}))
|
|
99
|
-
}),
|
|
97
|
+
}), `${instanceUID}-ds-toolbar-button-${label}`);
|
|
100
98
|
}
|
|
101
99
|
}), [toolbar, instanceUID]);
|
|
102
100
|
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var uid = require('uid');
|
|
8
7
|
var useGetPropsWithDefaults = require('./useGetPropsWithDefaults.js');
|
|
@@ -14,16 +13,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
13
|
const useGlobalHeader = props => {
|
|
15
14
|
const [showIconOnly, setShowIconOnly] = React.useState(false);
|
|
16
15
|
const instanceUID = React.useMemo(() => uid.uid(5), []);
|
|
17
|
-
const globalHeaderToolbarGrid = React.useMemo(() =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
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('auto');
|
|
21
|
-
}, [props.toolbar]);
|
|
22
|
-
const globalHeaderBreadcrumbGrid = React.useMemo(() => {
|
|
23
|
-
var _props$breadcrumb$len, _props$breadcrumb;
|
|
24
|
-
|
|
25
|
-
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'];
|
|
26
|
-
}, [props.breadcrumb]);
|
|
16
|
+
const globalHeaderToolbarGrid = React.useMemo(() => new Array(props?.toolbar?.length ?? 0).fill('auto'), [props.toolbar]);
|
|
17
|
+
const globalHeaderBreadcrumbGrid = React.useMemo(() => ['auto', ...new Array(props?.breadcrumb?.length ?? 0).fill('auto'), '1fr'], [props.breadcrumb]);
|
|
27
18
|
const propsWithDefaults = useGetPropsWithDefaults.useGetPropsWithDefaults(props);
|
|
28
19
|
const ctx = React__default["default"].useMemo(() => ({
|
|
29
20
|
props: propsWithDefaults,
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
5
|
var validateHelpers = require('./validateHelpers.js');
|
|
9
6
|
|
|
10
7
|
const validatePopupItem = componentProps => {
|
|
@@ -51,7 +48,7 @@ const useValidateProps = props => {
|
|
|
51
48
|
validateHelpers.throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
52
49
|
}
|
|
53
50
|
|
|
54
|
-
breadcrumb
|
|
51
|
+
breadcrumb?.forEach(breadcrumbItem => {
|
|
55
52
|
if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
|
|
56
53
|
validateHelpers.throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
57
54
|
}
|
|
@@ -68,7 +65,7 @@ const useValidateProps = props => {
|
|
|
68
65
|
validateHelpers.throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
69
66
|
}
|
|
70
67
|
});
|
|
71
|
-
toolbar
|
|
68
|
+
toolbar?.forEach(toolbarItem => {
|
|
72
69
|
if (toolbarItem.type) {
|
|
73
70
|
if (!validateHelpers.isValidToolbarType(toolbarItem.type)) {
|
|
74
71
|
validateHelpers.throwToolbarItemGenericError('type', toolbarItem.type);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/es.error.cause.js');
|
|
6
|
+
|
|
5
7
|
const breadcrumbProps = {
|
|
6
8
|
label: 'string',
|
|
7
9
|
onClick: 'function',
|
|
@@ -30,19 +32,42 @@ const getVariableType = arg => {
|
|
|
30
32
|
};
|
|
31
33
|
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';
|
|
32
34
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
33
|
-
throw new Error(
|
|
35
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a breadcrumb item, please provide a valid type.
|
|
36
|
+
|
|
37
|
+
Received: ${invalidProp} (${typeof invalidProp})
|
|
38
|
+
Expected: (${breadcrumbProps[validPropKey]})
|
|
39
|
+
`);
|
|
34
40
|
};
|
|
35
41
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
36
|
-
throw new Error(
|
|
42
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-popup-menu
|
|
43
|
+
toolbar item, please provide a valid type.
|
|
44
|
+
|
|
45
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
46
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
47
|
+
`);
|
|
37
48
|
};
|
|
38
49
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
39
|
-
throw new Error(
|
|
50
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-app-picker
|
|
51
|
+
toolbar item, please provide a valid type.
|
|
52
|
+
|
|
53
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
54
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
55
|
+
`);
|
|
40
56
|
};
|
|
41
57
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
42
|
-
throw new Error(
|
|
58
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a toolbar item, please provide a valid type.
|
|
59
|
+
|
|
60
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
61
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
62
|
+
`);
|
|
43
63
|
};
|
|
44
64
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
45
|
-
throw new Error(
|
|
65
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a global header,
|
|
66
|
+
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
67
|
+
|
|
68
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
69
|
+
Expected: (react component).
|
|
70
|
+
`);
|
|
46
71
|
};
|
|
47
72
|
|
|
48
73
|
exports.breadcrumbProps = breadcrumbProps;
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
14
13
|
var React = require('react');
|
|
15
14
|
var dsAppPicker = require('@elliemae/ds-app-picker');
|
|
16
15
|
var dsUtilities = require('@elliemae/ds-utilities');
|
|
@@ -64,10 +63,8 @@ const AppPicker = _ref => {
|
|
|
64
63
|
}, []);
|
|
65
64
|
const handleAppPickerOnKeyDown = React.useCallback(e => {
|
|
66
65
|
if (e.code === 'Escape') {
|
|
67
|
-
var _buttonRef$current;
|
|
68
|
-
|
|
69
66
|
setIsOpen(false);
|
|
70
|
-
buttonRef
|
|
67
|
+
buttonRef?.current?.focus();
|
|
71
68
|
}
|
|
72
69
|
}, []);
|
|
73
70
|
const handleOnClickOutside = React.useCallback(() => {
|
|
@@ -83,7 +80,7 @@ const AppPicker = _ref => {
|
|
|
83
80
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
84
81
|
ref: ref,
|
|
85
82
|
children: /*#__PURE__*/jsxRuntime.jsx(styles.Button, _objectSpread(_objectSpread({
|
|
86
|
-
onClick: triggerOnClick
|
|
83
|
+
onClick: triggerOnClick ?? handleOnClick,
|
|
87
84
|
onKeyDown: handleTriggerKeyDown,
|
|
88
85
|
ref: dsUtilities.mergeRefs(buttonRef, triggerRef),
|
|
89
86
|
title: label,
|
|
@@ -104,11 +101,11 @@ const AppPicker = _ref => {
|
|
|
104
101
|
sectionTitle: sectionTitle,
|
|
105
102
|
customSectionTitle: customSectionTitle,
|
|
106
103
|
icon: icon,
|
|
107
|
-
onKeyDown: userOnKeyDown
|
|
104
|
+
onKeyDown: userOnKeyDown ?? handleAppPickerOnKeyDown,
|
|
108
105
|
actionRef: actionRef,
|
|
109
|
-
onClickOutside: userOnClickOutside
|
|
110
|
-
renderTrigger: userRenderTrigger
|
|
111
|
-
isOpen: userIsOpen
|
|
106
|
+
onClickOutside: userOnClickOutside ?? handleOnClickOutside,
|
|
107
|
+
renderTrigger: userRenderTrigger ?? renderTrigger,
|
|
108
|
+
isOpen: userIsOpen ?? isOpen,
|
|
112
109
|
onClose: onClose,
|
|
113
110
|
triggerRef: triggerRef
|
|
114
111
|
});
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
14
13
|
var React = require('react');
|
|
15
14
|
var dsPopperjs = require('@elliemae/ds-popperjs');
|
|
16
15
|
var PopupMenuContent = require('./PopupMenuContent.js');
|
|
@@ -63,7 +62,7 @@ const PopupMenu = _ref => {
|
|
|
63
62
|
setIsOpen(false);
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
buttonRef
|
|
65
|
+
buttonRef?.focus();
|
|
67
66
|
}, [buttonRef, userIsOpen]);
|
|
68
67
|
const handleTriggerOnClick = React.useCallback(e => {
|
|
69
68
|
if (userIsOpen === undefined) setIsOpen(true);
|
|
@@ -92,7 +91,7 @@ const PopupMenu = _ref => {
|
|
|
92
91
|
})
|
|
93
92
|
})), /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
94
93
|
referenceElement: buttonRef,
|
|
95
|
-
showPopover: userIsOpen
|
|
94
|
+
showPopover: userIsOpen ?? isOpen,
|
|
96
95
|
closeContextMenu: handleOnClose,
|
|
97
96
|
onClickOutside: onClickOutside
|
|
98
97
|
}, void 0, content));
|
|
@@ -38,9 +38,7 @@ const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
38
38
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
39
39
|
const menuRef = React.useRef(null);
|
|
40
40
|
React.useEffect(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(_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();
|
|
41
|
+
menuRef.current?.firstChild?.focus();
|
|
44
42
|
}, []);
|
|
45
43
|
const content = React.useMemo(() => options.map(option => {
|
|
46
44
|
const {
|
|
@@ -66,7 +64,7 @@ const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
66
64
|
|
|
67
65
|
switch (type) {
|
|
68
66
|
case 'separator':
|
|
69
|
-
return /*#__PURE__*/jsxRuntime.jsx(styles.Separator, _objectSpread({}, ariaAndDataProps),
|
|
67
|
+
return /*#__PURE__*/jsxRuntime.jsx(styles.Separator, _objectSpread({}, ariaAndDataProps), `${instanceUID}-separator-${label}`);
|
|
70
68
|
|
|
71
69
|
case 'custom':
|
|
72
70
|
return /*#__PURE__*/jsxRuntime.jsx(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
@@ -75,7 +73,7 @@ const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
75
73
|
id: id
|
|
76
74
|
}, ariaAndDataProps), {}, {
|
|
77
75
|
children: Content && /*#__PURE__*/_jsx__default["default"](Content, {})
|
|
78
|
-
}),
|
|
76
|
+
}), `${instanceUID}-popup-${label}`);
|
|
79
77
|
|
|
80
78
|
default:
|
|
81
79
|
return /*#__PURE__*/jsxRuntime.jsxs(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
@@ -84,7 +82,7 @@ const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
84
82
|
id: id
|
|
85
83
|
}, ariaAndDataProps), {}, {
|
|
86
84
|
children: [Icon && /*#__PURE__*/_jsx__default["default"](Icon, {}), styles.Label && /*#__PURE__*/_jsx__default["default"](styles.Label, {}, void 0, label)]
|
|
87
|
-
}),
|
|
85
|
+
}), `${instanceUID}-popup-${label}`);
|
|
88
86
|
}
|
|
89
87
|
}), [options, onItemClick, onClose, popupOnKeyPress, instanceUID]);
|
|
90
88
|
return /*#__PURE__*/jsxRuntime.jsx(styles.List, {
|
|
@@ -17,7 +17,7 @@ const ItemWrapper = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
|
17
17
|
let {
|
|
18
18
|
theme
|
|
19
19
|
} = _ref;
|
|
20
|
-
return
|
|
20
|
+
return `1px solid ${theme.colors.brand[600]}`;
|
|
21
21
|
});
|
|
22
22
|
const Label = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
23
23
|
componentId: "sc-snqcgs-2"
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
5
|
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
6
|
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
7
|
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
8
|
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
9
|
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
11
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
12
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
14
13
|
var React = require('react');
|
|
15
14
|
var dsIcons = require('@elliemae/ds-icons');
|
|
16
15
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
@@ -64,11 +63,7 @@ const SearchToggle = _ref => {
|
|
|
64
63
|
if (userIsOpen === undefined) {
|
|
65
64
|
if (e.code === 'Escape') {
|
|
66
65
|
setIsOpen(false);
|
|
67
|
-
setTimeout(() =>
|
|
68
|
-
var _triggerRef$current;
|
|
69
|
-
|
|
70
|
-
return (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
71
|
-
});
|
|
66
|
+
setTimeout(() => triggerRef.current?.focus());
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
|
|
@@ -76,9 +71,7 @@ const SearchToggle = _ref => {
|
|
|
76
71
|
}, [onKeyDown, userIsOpen]);
|
|
77
72
|
const handleOnBlur = React.useCallback(() => {
|
|
78
73
|
setTimeout(() => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const contains = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.contains(document.activeElement);
|
|
74
|
+
const contains = containerRef.current?.contains(document.activeElement);
|
|
82
75
|
if (value === '' && !contains) setIsOpen(false);
|
|
83
76
|
});
|
|
84
77
|
}, [value]);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
11
9
|
import { useContext, useRef, useEffect } from 'react';
|
|
12
10
|
import { Grid } from '@elliemae/ds-grid';
|
|
13
11
|
import { Pipe } from './styles.js';
|
|
@@ -34,7 +32,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
34
32
|
const flexRegion = useRef(null);
|
|
35
33
|
useEffect(() => {
|
|
36
34
|
const evaluateShowIconOnly = () => {
|
|
37
|
-
if (flexRegion && flexRegion.current &&
|
|
35
|
+
if (flexRegion && flexRegion.current && flexRegion?.current.offsetWidth <= 0 && !breakpoint.current) {
|
|
38
36
|
setShowIconOnly(true);
|
|
39
37
|
breakpoint.current = window.innerWidth;
|
|
40
38
|
} else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
|
|
@@ -56,7 +54,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
56
54
|
role: "navigation"
|
|
57
55
|
}, void 0, /*#__PURE__*/_jsx(Pipe, {
|
|
58
56
|
showIconOnly: showIconOnly
|
|
59
|
-
}), breadcrumb
|
|
57
|
+
}), breadcrumb?.map(item => {
|
|
60
58
|
const {
|
|
61
59
|
label
|
|
62
60
|
} = item,
|
|
@@ -65,7 +63,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
65
63
|
return /*#__PURE__*/jsx(PureBreadcrumb, _objectSpread({
|
|
66
64
|
label: label,
|
|
67
65
|
length: breadcrumb.length
|
|
68
|
-
}, rest),
|
|
66
|
+
}, rest), `${instanceUID}-breadcrumb-item-${label}`);
|
|
69
67
|
}), /*#__PURE__*/jsx("div", {
|
|
70
68
|
id: "global-header-flex-region",
|
|
71
69
|
ref: flexRegion
|
|
@@ -31,18 +31,18 @@ const Label = /*#__PURE__*/styled.p.withConfig({
|
|
|
31
31
|
theme,
|
|
32
32
|
isSelected
|
|
33
33
|
} = _ref4;
|
|
34
|
-
return
|
|
34
|
+
return `-webkit-text-stroke: 0.4px ${isSelected ? theme.colors.neutral['000'] : 'transparent'}`;
|
|
35
35
|
}, _ref5 => {
|
|
36
36
|
let {
|
|
37
37
|
isSelected,
|
|
38
38
|
isOnlyItem
|
|
39
39
|
} = _ref5;
|
|
40
|
-
return
|
|
40
|
+
return `2px solid ${isSelected && !isOnlyItem ? '#FFF' : 'transparent'}`;
|
|
41
41
|
}, _ref6 => {
|
|
42
42
|
let {
|
|
43
43
|
theme
|
|
44
44
|
} = _ref6;
|
|
45
|
-
return
|
|
45
|
+
return `-webkit-text-stroke: 0.4px ${theme.colors.neutral['000']}`;
|
|
46
46
|
});
|
|
47
47
|
|
|
48
48
|
export { BreadcrumbItem, Label, LabelButton, Pipe };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
11
9
|
import { useContext, useMemo } from 'react';
|
|
12
10
|
import { AppPicker } from '../../outOfTheBox/AppPicker/AppPicker.js';
|
|
13
11
|
import { PopupMenu } from '../../outOfTheBox/PopupMenu/PopupMenu.js';
|
|
@@ -29,7 +27,7 @@ const ToolbarItems = () => {
|
|
|
29
27
|
},
|
|
30
28
|
instanceUID
|
|
31
29
|
} = useContext(GlobalHeaderContext);
|
|
32
|
-
const itemsList = useMemo(() => toolbar
|
|
30
|
+
const itemsList = useMemo(() => toolbar?.map(item => {
|
|
33
31
|
var _Icon;
|
|
34
32
|
|
|
35
33
|
const {
|
|
@@ -54,20 +52,20 @@ const ToolbarItems = () => {
|
|
|
54
52
|
id: id
|
|
55
53
|
}, otherProps), {}, {
|
|
56
54
|
componentProps: componentProps
|
|
57
|
-
}),
|
|
55
|
+
}), `${instanceUID}-ds-popup-menu-${label}`);
|
|
58
56
|
|
|
59
57
|
case 'ds-app-picker':
|
|
60
58
|
return /*#__PURE__*/jsx(AppPicker, _objectSpread({
|
|
61
59
|
label: label,
|
|
62
60
|
id: id,
|
|
63
61
|
componentProps: componentProps
|
|
64
|
-
}, otherProps),
|
|
62
|
+
}, otherProps), `${instanceUID}-ds-app-picker-${label}`);
|
|
65
63
|
|
|
66
64
|
case 'ds-search-toggle':
|
|
67
65
|
return /*#__PURE__*/jsx(SearchToggle, _objectSpread({
|
|
68
66
|
id: id,
|
|
69
67
|
componentProps: componentProps
|
|
70
|
-
}, otherProps),
|
|
68
|
+
}, otherProps), `${instanceUID}-ds-search-toggle-${id}`);
|
|
71
69
|
|
|
72
70
|
case 'custom':
|
|
73
71
|
if (CustomComponent) return /*#__PURE__*/_jsx(CustomComponent, {
|
|
@@ -86,7 +84,7 @@ const ToolbarItems = () => {
|
|
|
86
84
|
fill: "#FFF",
|
|
87
85
|
size: "m"
|
|
88
86
|
}))
|
|
89
|
-
}),
|
|
87
|
+
}), `${instanceUID}-ds-toolbar-button-${label}`);
|
|
90
88
|
}
|
|
91
89
|
}), [toolbar, instanceUID]);
|
|
92
90
|
return /*#__PURE__*/jsx(Fragment, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
1
|
import React, { useState, useMemo } from 'react';
|
|
3
2
|
import { uid } from 'uid';
|
|
4
3
|
import { useGetPropsWithDefaults } from './useGetPropsWithDefaults.js';
|
|
@@ -6,16 +5,8 @@ import { useGetPropsWithDefaults } from './useGetPropsWithDefaults.js';
|
|
|
6
5
|
const useGlobalHeader = props => {
|
|
7
6
|
const [showIconOnly, setShowIconOnly] = useState(false);
|
|
8
7
|
const instanceUID = useMemo(() => uid(5), []);
|
|
9
|
-
const globalHeaderToolbarGrid = useMemo(() =>
|
|
10
|
-
|
|
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('auto');
|
|
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]);
|
|
8
|
+
const globalHeaderToolbarGrid = useMemo(() => new Array(props?.toolbar?.length ?? 0).fill('auto'), [props.toolbar]);
|
|
9
|
+
const globalHeaderBreadcrumbGrid = useMemo(() => ['auto', ...new Array(props?.breadcrumb?.length ?? 0).fill('auto'), '1fr'], [props.breadcrumb]);
|
|
19
10
|
const propsWithDefaults = useGetPropsWithDefaults(props);
|
|
20
11
|
const ctx = React.useMemo(() => ({
|
|
21
12
|
props: propsWithDefaults,
|
|
@@ -1,6 +1,3 @@
|
|
|
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';
|
|
4
1
|
import { throwLogoError, throwBreadcrumbItemError, isValidToolbarType, throwToolbarItemGenericError, isObject, throwToolbarPopupItemError, throwToolbarAppPickerItemError } from './validateHelpers.js';
|
|
5
2
|
|
|
6
3
|
const validatePopupItem = componentProps => {
|
|
@@ -47,7 +44,7 @@ const useValidateProps = props => {
|
|
|
47
44
|
throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
breadcrumb
|
|
47
|
+
breadcrumb?.forEach(breadcrumbItem => {
|
|
51
48
|
if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
|
|
52
49
|
throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
53
50
|
}
|
|
@@ -64,7 +61,7 @@ const useValidateProps = props => {
|
|
|
64
61
|
throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
|
-
toolbar
|
|
64
|
+
toolbar?.forEach(toolbarItem => {
|
|
68
65
|
if (toolbarItem.type) {
|
|
69
66
|
if (!isValidToolbarType(toolbarItem.type)) {
|
|
70
67
|
throwToolbarItemGenericError('type', toolbarItem.type);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import 'core-js/modules/es.error.cause.js';
|
|
2
|
+
|
|
1
3
|
const breadcrumbProps = {
|
|
2
4
|
label: 'string',
|
|
3
5
|
onClick: 'function',
|
|
@@ -26,19 +28,42 @@ const getVariableType = arg => {
|
|
|
26
28
|
};
|
|
27
29
|
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';
|
|
28
30
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
29
|
-
throw new Error(
|
|
31
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a breadcrumb item, please provide a valid type.
|
|
32
|
+
|
|
33
|
+
Received: ${invalidProp} (${typeof invalidProp})
|
|
34
|
+
Expected: (${breadcrumbProps[validPropKey]})
|
|
35
|
+
`);
|
|
30
36
|
};
|
|
31
37
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
32
|
-
throw new Error(
|
|
38
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-popup-menu
|
|
39
|
+
toolbar item, please provide a valid type.
|
|
40
|
+
|
|
41
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
42
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
43
|
+
`);
|
|
33
44
|
};
|
|
34
45
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
35
|
-
throw new Error(
|
|
46
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-app-picker
|
|
47
|
+
toolbar item, please provide a valid type.
|
|
48
|
+
|
|
49
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
50
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
51
|
+
`);
|
|
36
52
|
};
|
|
37
53
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
38
|
-
throw new Error(
|
|
54
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a toolbar item, please provide a valid type.
|
|
55
|
+
|
|
56
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
57
|
+
Expected: (${toolbarProps[validPropKey]})
|
|
58
|
+
`);
|
|
39
59
|
};
|
|
40
60
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
41
|
-
throw new Error(
|
|
61
|
+
throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a global header,
|
|
62
|
+
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
63
|
+
|
|
64
|
+
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
65
|
+
Expected: (react component).
|
|
66
|
+
`);
|
|
42
67
|
};
|
|
43
68
|
|
|
44
69
|
export { breadcrumbProps, getVariableType, isObject, isValidToolbarType, throwBreadcrumbItemError, throwLogoError, throwToolbarAppPickerItemError, throwToolbarItemGenericError, throwToolbarPopupItemError, toolbarProps };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
10
9
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
10
|
import { DSAppPicker } from '@elliemae/ds-app-picker';
|
|
12
11
|
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
@@ -54,10 +53,8 @@ const AppPicker = _ref => {
|
|
|
54
53
|
}, []);
|
|
55
54
|
const handleAppPickerOnKeyDown = useCallback(e => {
|
|
56
55
|
if (e.code === 'Escape') {
|
|
57
|
-
var _buttonRef$current;
|
|
58
|
-
|
|
59
56
|
setIsOpen(false);
|
|
60
|
-
buttonRef
|
|
57
|
+
buttonRef?.current?.focus();
|
|
61
58
|
}
|
|
62
59
|
}, []);
|
|
63
60
|
const handleOnClickOutside = useCallback(() => {
|
|
@@ -73,7 +70,7 @@ const AppPicker = _ref => {
|
|
|
73
70
|
return /*#__PURE__*/jsx("div", {
|
|
74
71
|
ref: ref,
|
|
75
72
|
children: /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
76
|
-
onClick: triggerOnClick
|
|
73
|
+
onClick: triggerOnClick ?? handleOnClick,
|
|
77
74
|
onKeyDown: handleTriggerKeyDown,
|
|
78
75
|
ref: mergeRefs(buttonRef, triggerRef),
|
|
79
76
|
title: label,
|
|
@@ -94,11 +91,11 @@ const AppPicker = _ref => {
|
|
|
94
91
|
sectionTitle: sectionTitle,
|
|
95
92
|
customSectionTitle: customSectionTitle,
|
|
96
93
|
icon: icon,
|
|
97
|
-
onKeyDown: userOnKeyDown
|
|
94
|
+
onKeyDown: userOnKeyDown ?? handleAppPickerOnKeyDown,
|
|
98
95
|
actionRef: actionRef,
|
|
99
|
-
onClickOutside: userOnClickOutside
|
|
100
|
-
renderTrigger: userRenderTrigger
|
|
101
|
-
isOpen: userIsOpen
|
|
96
|
+
onClickOutside: userOnClickOutside ?? handleOnClickOutside,
|
|
97
|
+
renderTrigger: userRenderTrigger ?? renderTrigger,
|
|
98
|
+
isOpen: userIsOpen ?? isOpen,
|
|
102
99
|
onClose: onClose,
|
|
103
100
|
triggerRef: triggerRef
|
|
104
101
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
10
9
|
import { useState, useCallback, useMemo } from 'react';
|
|
11
10
|
import { DSPopperJS } from '@elliemae/ds-popperjs';
|
|
12
11
|
import { PopupMenuContent } from './PopupMenuContent.js';
|
|
@@ -53,7 +52,7 @@ const PopupMenu = _ref => {
|
|
|
53
52
|
setIsOpen(false);
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
buttonRef
|
|
55
|
+
buttonRef?.focus();
|
|
57
56
|
}, [buttonRef, userIsOpen]);
|
|
58
57
|
const handleTriggerOnClick = useCallback(e => {
|
|
59
58
|
if (userIsOpen === undefined) setIsOpen(true);
|
|
@@ -82,7 +81,7 @@ const PopupMenu = _ref => {
|
|
|
82
81
|
})
|
|
83
82
|
})), /*#__PURE__*/_jsx(DSPopperJS, {
|
|
84
83
|
referenceElement: buttonRef,
|
|
85
|
-
showPopover: userIsOpen
|
|
84
|
+
showPopover: userIsOpen ?? isOpen,
|
|
86
85
|
closeContextMenu: handleOnClose,
|
|
87
86
|
onClickOutside: onClickOutside
|
|
88
87
|
}, void 0, content));
|
|
@@ -28,9 +28,7 @@ const PopupMenuContent = /*#__PURE__*/React.memo(_ref => {
|
|
|
28
28
|
} = useContext(GlobalHeaderContext);
|
|
29
29
|
const menuRef = useRef(null);
|
|
30
30
|
useEffect(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(_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();
|
|
31
|
+
menuRef.current?.firstChild?.focus();
|
|
34
32
|
}, []);
|
|
35
33
|
const content = useMemo(() => options.map(option => {
|
|
36
34
|
const {
|
|
@@ -56,7 +54,7 @@ const PopupMenuContent = /*#__PURE__*/React.memo(_ref => {
|
|
|
56
54
|
|
|
57
55
|
switch (type) {
|
|
58
56
|
case 'separator':
|
|
59
|
-
return /*#__PURE__*/jsx(Separator, _objectSpread({}, ariaAndDataProps),
|
|
57
|
+
return /*#__PURE__*/jsx(Separator, _objectSpread({}, ariaAndDataProps), `${instanceUID}-separator-${label}`);
|
|
60
58
|
|
|
61
59
|
case 'custom':
|
|
62
60
|
return /*#__PURE__*/jsx(ItemWrapper, _objectSpread(_objectSpread({
|
|
@@ -65,7 +63,7 @@ const PopupMenuContent = /*#__PURE__*/React.memo(_ref => {
|
|
|
65
63
|
id: id
|
|
66
64
|
}, ariaAndDataProps), {}, {
|
|
67
65
|
children: Content && /*#__PURE__*/_jsx(Content, {})
|
|
68
|
-
}),
|
|
66
|
+
}), `${instanceUID}-popup-${label}`);
|
|
69
67
|
|
|
70
68
|
default:
|
|
71
69
|
return /*#__PURE__*/jsxs(ItemWrapper, _objectSpread(_objectSpread({
|
|
@@ -74,7 +72,7 @@ const PopupMenuContent = /*#__PURE__*/React.memo(_ref => {
|
|
|
74
72
|
id: id
|
|
75
73
|
}, ariaAndDataProps), {}, {
|
|
76
74
|
children: [Icon && /*#__PURE__*/_jsx(Icon, {}), Label && /*#__PURE__*/_jsx(Label, {}, void 0, label)]
|
|
77
|
-
}),
|
|
75
|
+
}), `${instanceUID}-popup-${label}`);
|
|
78
76
|
}
|
|
79
77
|
}), [options, onItemClick, onClose, popupOnKeyPress, instanceUID]);
|
|
80
78
|
return /*#__PURE__*/jsx(List, {
|
|
@@ -9,7 +9,7 @@ const ItemWrapper = /*#__PURE__*/styled.button.withConfig({
|
|
|
9
9
|
let {
|
|
10
10
|
theme
|
|
11
11
|
} = _ref;
|
|
12
|
-
return
|
|
12
|
+
return `1px solid ${theme.colors.brand[600]}`;
|
|
13
13
|
});
|
|
14
14
|
const Label = /*#__PURE__*/styled.p.withConfig({
|
|
15
15
|
componentId: "sc-snqcgs-2"
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
1
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
2
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
3
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
4
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
10
9
|
import { useState, useRef, useCallback } from 'react';
|
|
11
10
|
import { Search } from '@elliemae/ds-icons';
|
|
12
11
|
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
@@ -54,11 +53,7 @@ const SearchToggle = _ref => {
|
|
|
54
53
|
if (userIsOpen === undefined) {
|
|
55
54
|
if (e.code === 'Escape') {
|
|
56
55
|
setIsOpen(false);
|
|
57
|
-
setTimeout(() =>
|
|
58
|
-
var _triggerRef$current;
|
|
59
|
-
|
|
60
|
-
return (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
61
|
-
});
|
|
56
|
+
setTimeout(() => triggerRef.current?.focus());
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
59
|
|
|
@@ -66,9 +61,7 @@ const SearchToggle = _ref => {
|
|
|
66
61
|
}, [onKeyDown, userIsOpen]);
|
|
67
62
|
const handleOnBlur = useCallback(() => {
|
|
68
63
|
setTimeout(() => {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const contains = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.contains(document.activeElement);
|
|
64
|
+
const contains = containerRef.current?.contains(document.activeElement);
|
|
72
65
|
if (value === '' && !contains) setIsOpen(false);
|
|
73
66
|
});
|
|
74
67
|
}, [value]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-global-header",
|
|
3
|
-
"version": "2.4.2
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Global Header",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -132,14 +132,14 @@
|
|
|
132
132
|
"build": "node ../../scripts/build/build.js"
|
|
133
133
|
},
|
|
134
134
|
"dependencies": {
|
|
135
|
-
"@elliemae/ds-app-picker": "2.4.2
|
|
136
|
-
"@elliemae/ds-form": "2.4.2
|
|
137
|
-
"@elliemae/ds-grid": "2.4.2
|
|
138
|
-
"@elliemae/ds-icon": "2.4.2
|
|
139
|
-
"@elliemae/ds-icons": "2.4.2
|
|
140
|
-
"@elliemae/ds-popperjs": "2.4.2
|
|
141
|
-
"@elliemae/ds-props-helpers": "2.4.2
|
|
142
|
-
"@elliemae/ds-utilities": "2.4.2
|
|
135
|
+
"@elliemae/ds-app-picker": "2.4.2",
|
|
136
|
+
"@elliemae/ds-form": "2.4.2",
|
|
137
|
+
"@elliemae/ds-grid": "2.4.2",
|
|
138
|
+
"@elliemae/ds-icon": "2.4.2",
|
|
139
|
+
"@elliemae/ds-icons": "2.4.2",
|
|
140
|
+
"@elliemae/ds-popperjs": "2.4.2",
|
|
141
|
+
"@elliemae/ds-props-helpers": "2.4.2",
|
|
142
|
+
"@elliemae/ds-utilities": "2.4.2",
|
|
143
143
|
"react-desc": "~4.1.3",
|
|
144
144
|
"uid": "~2.0.0"
|
|
145
145
|
},
|