@elliemae/ds-global-header 2.0.0-alpha.11 → 2.0.0-alpha.12
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 +10 -8
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +22 -20
- package/cjs/components/Breadcrumb/styles.js +40 -19
- package/cjs/components/Toolbar/ToolbarItems.js +16 -19
- package/cjs/components/Toolbar/styles.js +16 -7
- package/cjs/config/useGetPropsWithDefaults.js +5 -0
- package/cjs/config/useGlobalHeader.js +10 -2
- package/cjs/config/useValidateProps.js +5 -2
- package/cjs/defaultProps.js +4 -2
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +55 -44
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +20 -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 +10 -8
- package/esm/components/Breadcrumb/PureBreadcrumb.js +22 -19
- package/esm/components/Breadcrumb/styles.js +40 -19
- package/esm/components/Toolbar/ToolbarItems.js +15 -19
- package/esm/components/Toolbar/styles.js +16 -7
- package/esm/config/useGetPropsWithDefaults.js +5 -0
- package/esm/config/useGlobalHeader.js +10 -2
- package/esm/config/useValidateProps.js +5 -2
- package/esm/defaultProps.js +4 -2
- package/esm/outOfTheBox/AppPicker/AppPicker.js +55 -43
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +21 -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
|
@@ -10,12 +10,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
12
|
|
|
13
|
-
const GlobalHeaderContainer =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, void 0,
|
|
13
|
+
const GlobalHeaderContainer = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_jsx__default["default"]("header", {
|
|
18
|
+
"data-testid": "ds-global-header"
|
|
19
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styles.Wrapper, {
|
|
20
|
+
cols: ['auto', '1fr', 'auto']
|
|
21
|
+
}, void 0, children));
|
|
22
|
+
};
|
|
20
23
|
|
|
21
24
|
exports.GlobalHeaderContainer = GlobalHeaderContainer;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
6
8
|
var React = require('react');
|
|
7
9
|
var dsGrid = require('@elliemae/ds-grid');
|
|
8
10
|
var styles = require('./styles.js');
|
|
@@ -24,14 +26,14 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
24
26
|
setShowIconOnly,
|
|
25
27
|
globalHeaderBreadcrumbGrid
|
|
26
28
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
27
|
-
const breakpoint = React.useRef();
|
|
28
|
-
const flexRegion = React.useRef();
|
|
29
|
+
const breakpoint = React.useRef(null);
|
|
30
|
+
const flexRegion = React.useRef(null);
|
|
29
31
|
React.useEffect(() => {
|
|
30
32
|
const evaluateShowIconOnly = () => {
|
|
31
|
-
if ((flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
33
|
+
if (flexRegion && flexRegion.current && (flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
32
34
|
setShowIconOnly(true);
|
|
33
35
|
breakpoint.current = window.innerWidth;
|
|
34
|
-
} else if (window.innerWidth >= breakpoint.current) {
|
|
36
|
+
} else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
|
|
35
37
|
setShowIconOnly(false);
|
|
36
38
|
breakpoint.current = null;
|
|
37
39
|
}
|
|
@@ -44,13 +46,13 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
44
46
|
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
45
47
|
height: "100%",
|
|
46
48
|
alignItems: "center",
|
|
47
|
-
justifyContent: "
|
|
48
|
-
role: "navigation",
|
|
49
|
+
justifyContent: "flex-start",
|
|
49
50
|
"aria-label": "breadcrumbs",
|
|
50
|
-
cols: globalHeaderBreadcrumbGrid
|
|
51
|
+
cols: globalHeaderBreadcrumbGrid,
|
|
52
|
+
role: "navigation"
|
|
51
53
|
}, void 0, /*#__PURE__*/_jsx__default["default"](styles.Pipe, {
|
|
52
54
|
showIconOnly: showIconOnly
|
|
53
|
-
}), breadcrumb.map(item => {
|
|
55
|
+
}), breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.map(item => {
|
|
54
56
|
const {
|
|
55
57
|
label,
|
|
56
58
|
hasNext,
|
|
@@ -4,32 +4,34 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var
|
|
7
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
8
8
|
var styles = require('./styles.js');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
12
12
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
13
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
-
var Chevron__default = /*#__PURE__*/_interopDefaultLegacy(Chevron);
|
|
15
14
|
|
|
16
|
-
var
|
|
17
|
-
const PureBreadcrumb = /*#__PURE__*/React__default["default"].memo(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
15
|
+
var _ChevronSmallRight;
|
|
16
|
+
const PureBreadcrumb = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
17
|
+
let {
|
|
18
|
+
onClick,
|
|
19
|
+
isSelected,
|
|
20
|
+
length,
|
|
21
|
+
label,
|
|
22
|
+
hasNext
|
|
23
|
+
} = _ref;
|
|
24
|
+
return /*#__PURE__*/_jsx__default["default"](styles.BreadcrumbItem, {}, void 0, /*#__PURE__*/_jsx__default["default"](styles.LabelButton, {
|
|
25
|
+
onClick: onClick,
|
|
26
|
+
"aria-selected": isSelected,
|
|
27
|
+
"data-testid": "gh-breadcrumb-btn"
|
|
28
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](styles.Label, {
|
|
29
|
+
isSelected: !!isSelected,
|
|
30
|
+
isOnlyItem: length === 1
|
|
31
|
+
}, void 0, label)), hasNext && (_ChevronSmallRight || (_ChevronSmallRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallRight, {
|
|
32
|
+
size: "m",
|
|
33
|
+
fill: "#FFF"
|
|
34
|
+
}))));
|
|
35
|
+
});
|
|
34
36
|
|
|
35
37
|
exports.PureBreadcrumb = PureBreadcrumb;
|
|
@@ -10,32 +10,53 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
10
10
|
|
|
11
11
|
const Pipe = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
12
12
|
componentId: "sc-1n5l527-0"
|
|
13
|
-
})(["margin:0 7px 0 0;border-left:", ";height:20px;"],
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
})(["margin:0 7px 0 0;border-left:", ";height:20px;"], _ref => {
|
|
14
|
+
let {
|
|
15
|
+
showIconOnly
|
|
16
|
+
} = _ref;
|
|
17
|
+
return showIconOnly ? 'none' : '1px solid #fff';
|
|
18
|
+
});
|
|
16
19
|
const BreadcrumbItem = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
17
20
|
componentId: "sc-1n5l527-1"
|
|
18
21
|
})(["display:flex;align-items:center;height:100%;"]);
|
|
19
22
|
const LabelButton = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
20
23
|
componentId: "sc-1n5l527-2"
|
|
21
|
-
})(["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;}}"],
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
})(["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 => {
|
|
25
|
+
let {
|
|
26
|
+
theme
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return theme.colors.brand[700];
|
|
29
|
+
}, _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
theme
|
|
32
|
+
} = _ref3;
|
|
33
|
+
return theme.colors.neutral['000'];
|
|
34
|
+
});
|
|
26
35
|
const Label = /*#__PURE__*/styled__default["default"].p.withConfig({
|
|
27
36
|
componentId: "sc-1n5l527-3"
|
|
28
|
-
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"],
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"], _ref4 => {
|
|
38
|
+
let {
|
|
39
|
+
theme
|
|
40
|
+
} = _ref4;
|
|
41
|
+
return theme.colors.neutral['000'];
|
|
42
|
+
}, _ref5 => {
|
|
43
|
+
let {
|
|
44
|
+
theme,
|
|
45
|
+
isSelected
|
|
46
|
+
} = _ref5;
|
|
47
|
+
return "-webkit-text-stroke: 0.4px ".concat(isSelected ? theme.colors.neutral['000'] : 'transparent');
|
|
48
|
+
}, _ref6 => {
|
|
49
|
+
let {
|
|
50
|
+
isSelected,
|
|
51
|
+
isOnlyItem
|
|
52
|
+
} = _ref6;
|
|
53
|
+
return "2px solid ".concat(isSelected && !isOnlyItem ? '#FFF' : 'transparent');
|
|
54
|
+
}, _ref7 => {
|
|
55
|
+
let {
|
|
56
|
+
theme
|
|
57
|
+
} = _ref7;
|
|
58
|
+
return "-webkit-text-stroke: 0.4px ".concat(theme.colors.neutral['000']);
|
|
59
|
+
});
|
|
39
60
|
|
|
40
61
|
exports.BreadcrumbItem = BreadcrumbItem;
|
|
41
62
|
exports.Label = Label;
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
6
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
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');
|
|
7
15
|
var AppPicker = require('../../outOfTheBox/AppPicker/AppPicker.js');
|
|
8
16
|
var PopupMenu = require('../../outOfTheBox/PopupMenu/PopupMenu.js');
|
|
@@ -12,8 +20,12 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
12
20
|
|
|
13
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
22
|
|
|
23
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
15
24
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
25
|
|
|
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; }
|
|
17
29
|
const ToolbarItems = () => {
|
|
18
30
|
const {
|
|
19
31
|
props: {
|
|
@@ -21,7 +33,7 @@ const ToolbarItems = () => {
|
|
|
21
33
|
},
|
|
22
34
|
instanceUID
|
|
23
35
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
24
|
-
const itemsList = React.useMemo(() => toolbar.map(item => {
|
|
36
|
+
const itemsList = React.useMemo(() => toolbar === null || toolbar === void 0 ? void 0 : toolbar.map(item => {
|
|
25
37
|
var _Icon;
|
|
26
38
|
|
|
27
39
|
const {
|
|
@@ -47,24 +59,9 @@ const ToolbarItems = () => {
|
|
|
47
59
|
}, "".concat(instanceUID, "-ds-popup-menu-").concat(label));
|
|
48
60
|
|
|
49
61
|
case 'ds-app-picker':
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
sectionTitle,
|
|
54
|
-
customSectionTitle,
|
|
55
|
-
actionRef,
|
|
56
|
-
onKeyDown
|
|
57
|
-
} = componentProps;
|
|
58
|
-
return /*#__PURE__*/_jsx__default["default"](AppPicker.AppPicker, {
|
|
59
|
-
onClick: onClick,
|
|
60
|
-
label: label,
|
|
61
|
-
apps: apps,
|
|
62
|
-
customApps: customApps,
|
|
63
|
-
sectionTitle: sectionTitle,
|
|
64
|
-
customSectionTitle: customSectionTitle,
|
|
65
|
-
actionRef: actionRef,
|
|
66
|
-
onKeyDown: onKeyDown
|
|
67
|
-
}, "".concat(instanceUID, "-ds-app-picker-").concat(label));
|
|
62
|
+
return /*#__PURE__*/jsxRuntime.jsx(AppPicker.AppPicker, _objectSpread({
|
|
63
|
+
label: label
|
|
64
|
+
}, componentProps), "".concat(instanceUID, "-ds-app-picker-").concat(label));
|
|
68
65
|
|
|
69
66
|
default:
|
|
70
67
|
return /*#__PURE__*/_jsx__default["default"](styles.Button, {
|
|
@@ -10,12 +10,21 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
10
10
|
|
|
11
11
|
const Button = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
12
12
|
componentId: "sc-1gqj0i3-0"
|
|
13
|
-
})(["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;}}"],
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
})(["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 => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref;
|
|
17
|
+
return theme.colors.brand[700];
|
|
18
|
+
}, _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
theme
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return theme.colors.brand[700];
|
|
23
|
+
}, _ref3 => {
|
|
24
|
+
let {
|
|
25
|
+
theme
|
|
26
|
+
} = _ref3;
|
|
27
|
+
return theme.colors.neutral['000'];
|
|
28
|
+
});
|
|
20
29
|
|
|
21
30
|
exports.Button = Button;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var React = require('react');
|
|
7
12
|
var defaultProps = require('../defaultProps.js');
|
|
@@ -14,8 +14,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
14
14
|
const useGlobalHeader = props => {
|
|
15
15
|
const [showIconOnly, setShowIconOnly] = React.useState(false);
|
|
16
16
|
const instanceUID = React.useMemo(() => uid.uid(5), []);
|
|
17
|
-
const globalHeaderToolbarGrid = React.useMemo(() =>
|
|
18
|
-
|
|
17
|
+
const globalHeaderToolbarGrid = React.useMemo(() => {
|
|
18
|
+
var _props$toolbar$length, _props$toolbar;
|
|
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('1fr');
|
|
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]);
|
|
19
27
|
const propsWithDefaults = useGetPropsWithDefaults.useGetPropsWithDefaults(props);
|
|
20
28
|
const ctx = React__default["default"].useMemo(() => ({
|
|
21
29
|
props: propsWithDefaults,
|
|
@@ -2,6 +2,9 @@
|
|
|
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');
|
|
5
8
|
var validateHelpers = require('./validateHelpers.js');
|
|
6
9
|
|
|
7
10
|
const validatePopupItem = componentProps => {
|
|
@@ -63,7 +66,7 @@ const useValidateProps = props => {
|
|
|
63
66
|
validateHelpers.throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
64
67
|
}
|
|
65
68
|
|
|
66
|
-
breadcrumb.forEach(breadcrumbItem => {
|
|
69
|
+
breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.forEach(breadcrumbItem => {
|
|
67
70
|
if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
|
|
68
71
|
validateHelpers.throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
69
72
|
}
|
|
@@ -80,7 +83,7 @@ const useValidateProps = props => {
|
|
|
80
83
|
validateHelpers.throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
|
-
toolbar.forEach(toolbarItem => {
|
|
86
|
+
toolbar === null || toolbar === void 0 ? void 0 : toolbar.forEach(toolbarItem => {
|
|
84
87
|
validateGenericToolbarItem(toolbarItem);
|
|
85
88
|
|
|
86
89
|
if (toolbarItem.type) {
|
package/cjs/defaultProps.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const emptyComp = () => null;
|
|
6
|
+
|
|
5
7
|
const defaultProps = {
|
|
6
8
|
breadcrumb: [],
|
|
7
9
|
toolbar: [],
|
|
8
|
-
LogoWithBrand:
|
|
9
|
-
Logo:
|
|
10
|
+
LogoWithBrand: emptyComp,
|
|
11
|
+
Logo: emptyComp
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
exports.defaultProps = defaultProps;
|
|
@@ -6,77 +6,88 @@ var _jsx = require('@babel/runtime/helpers/jsx');
|
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var dsAppPicker = require('@elliemae/ds-app-picker');
|
|
9
|
-
var
|
|
9
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
10
11
|
var styles = require('../../components/Toolbar/styles.js');
|
|
11
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
|
15
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var MenuPicker__default = /*#__PURE__*/_interopDefaultLegacy(MenuPicker);
|
|
17
17
|
|
|
18
18
|
var _MenuPicker;
|
|
19
|
-
const AppPicker =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
const AppPicker = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
label,
|
|
22
|
+
apps,
|
|
23
|
+
icon,
|
|
24
|
+
customApps,
|
|
25
|
+
sectionTitle,
|
|
26
|
+
customSectionTitle,
|
|
27
|
+
actionRef,
|
|
28
|
+
isOpen: userIsOpen,
|
|
29
|
+
onKeyDown: userOnKeyDown,
|
|
30
|
+
onClickOutside: userOnClickOutside,
|
|
31
|
+
renderTrigger: userRenderTrigger,
|
|
32
|
+
onClose,
|
|
33
|
+
triggerRef,
|
|
34
|
+
triggerOnClick
|
|
35
|
+
} = _ref;
|
|
31
36
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
32
|
-
const buttonRef = React.useRef();
|
|
37
|
+
const buttonRef = React.useRef(null);
|
|
33
38
|
const handleTriggerKeyDown = React.useCallback(e => {
|
|
34
39
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
35
40
|
setIsOpen(true);
|
|
36
41
|
}
|
|
37
42
|
}, []);
|
|
38
43
|
const handleAppPickerOnKeyDown = React.useCallback(e => {
|
|
39
|
-
customHandleOnKeyDown(e);
|
|
40
|
-
|
|
41
44
|
if (e.code === 'Escape') {
|
|
45
|
+
var _buttonRef$current;
|
|
46
|
+
|
|
42
47
|
setIsOpen(false);
|
|
48
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
43
49
|
}
|
|
44
|
-
}, [
|
|
50
|
+
}, []);
|
|
45
51
|
const handleOnClickOutside = React.useCallback(() => {
|
|
46
52
|
setIsOpen(false);
|
|
47
53
|
}, []);
|
|
48
|
-
const handleOnClick = React.useCallback(
|
|
54
|
+
const handleOnClick = React.useCallback(() => {
|
|
49
55
|
setIsOpen(true);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
}, []);
|
|
57
|
+
const renderTrigger = React.useMemo(() => _ref2 => {
|
|
58
|
+
let {
|
|
59
|
+
ref
|
|
60
|
+
} = _ref2;
|
|
61
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
62
|
+
ref: ref,
|
|
63
|
+
children: /*#__PURE__*/jsxRuntime.jsx(styles.Button, {
|
|
64
|
+
onClick: triggerOnClick !== null && triggerOnClick !== void 0 ? triggerOnClick : handleOnClick,
|
|
65
|
+
onKeyDown: handleTriggerKeyDown,
|
|
66
|
+
ref: dsUtilities.mergeRefs(buttonRef, triggerRef),
|
|
67
|
+
title: label,
|
|
68
|
+
"data-testid": "gh-toolbar-item",
|
|
69
|
+
children: _MenuPicker || (_MenuPicker = /*#__PURE__*/_jsx__default["default"](dsIcons.MenuPicker, {
|
|
70
|
+
fill: "#FFF",
|
|
71
|
+
width: 20.73,
|
|
72
|
+
height: 20.73
|
|
73
|
+
}))
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}, [triggerOnClick, handleOnClick, handleTriggerKeyDown, label]);
|
|
77
|
+
return /*#__PURE__*/_jsx__default["default"](dsAppPicker.DSAppPicker, {
|
|
70
78
|
apps: apps,
|
|
71
79
|
customApps: customApps,
|
|
72
80
|
sectionTitle: sectionTitle,
|
|
73
81
|
customSectionTitle: customSectionTitle,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
triggerRef: buttonRef,
|
|
82
|
+
icon: icon,
|
|
83
|
+
onKeyDown: userOnKeyDown !== null && userOnKeyDown !== void 0 ? userOnKeyDown : handleAppPickerOnKeyDown,
|
|
77
84
|
actionRef: actionRef,
|
|
78
|
-
|
|
79
|
-
|
|
85
|
+
onClickOutside: userOnClickOutside !== null && userOnClickOutside !== void 0 ? userOnClickOutside : handleOnClickOutside,
|
|
86
|
+
renderTrigger: userRenderTrigger !== null && userRenderTrigger !== void 0 ? userRenderTrigger : renderTrigger,
|
|
87
|
+
isOpen: userIsOpen !== null && userIsOpen !== void 0 ? userIsOpen : isOpen,
|
|
88
|
+
onClose: onClose,
|
|
89
|
+
triggerRef: triggerRef
|
|
90
|
+
});
|
|
80
91
|
};
|
|
81
92
|
|
|
82
93
|
exports.AppPicker = AppPicker;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var
|
|
8
|
+
var dsPopperjs = require('@elliemae/ds-popperjs');
|
|
9
9
|
var PopupMenuContent = require('./PopupMenuContent.js');
|
|
10
10
|
var styles = require('../../components/Toolbar/styles.js');
|
|
11
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -13,30 +13,28 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
17
16
|
|
|
18
|
-
const PopupMenu =
|
|
19
|
-
Icon,
|
|
20
|
-
options,
|
|
21
|
-
closeOnClick,
|
|
22
|
-
title,
|
|
23
|
-
onClick
|
|
24
|
-
}) => {
|
|
17
|
+
const PopupMenu = _ref => {
|
|
25
18
|
var _PopupMenuContent;
|
|
26
19
|
|
|
20
|
+
let {
|
|
21
|
+
Icon,
|
|
22
|
+
options,
|
|
23
|
+
closeOnClick,
|
|
24
|
+
title,
|
|
25
|
+
onClick
|
|
26
|
+
} = _ref;
|
|
27
27
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
28
|
-
const buttonRef = React.
|
|
28
|
+
const [buttonRef, setButtonRef] = React.useState(null);
|
|
29
29
|
const handleKeyPress = React.useCallback(e => {
|
|
30
30
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
31
31
|
setIsOpen(true);
|
|
32
32
|
}
|
|
33
33
|
}, []);
|
|
34
34
|
const handleOnClose = React.useCallback(() => {
|
|
35
|
-
var _buttonRef$current;
|
|
36
|
-
|
|
37
35
|
setIsOpen(false);
|
|
38
|
-
|
|
39
|
-
}, []);
|
|
36
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.focus();
|
|
37
|
+
}, [buttonRef]);
|
|
40
38
|
const handleTriggerOnClick = React.useCallback(e => {
|
|
41
39
|
setIsOpen(true);
|
|
42
40
|
onClick(e);
|
|
@@ -44,39 +42,26 @@ const PopupMenu = ({
|
|
|
44
42
|
const handleItemClick = React.useCallback(() => {
|
|
45
43
|
if (closeOnClick) handleOnClose();
|
|
46
44
|
}, [closeOnClick, handleOnClose]);
|
|
47
|
-
const handleClickOutside = React.useCallback(() => setIsOpen(false), []);
|
|
48
45
|
const content = React.useMemo(() => _PopupMenuContent || (_PopupMenuContent = /*#__PURE__*/_jsx__default["default"](PopupMenuContent.PopupMenuContent, {
|
|
49
46
|
options: options,
|
|
50
47
|
onItemClick: handleItemClick,
|
|
51
48
|
onClose: handleOnClose
|
|
52
49
|
})), [options, handleItemClick, handleOnClose]);
|
|
53
|
-
|
|
54
|
-
ref
|
|
55
|
-
}) => /*#__PURE__*/jsxRuntime.jsx(styles.Button, {
|
|
50
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.Button, {
|
|
56
51
|
onClick: handleTriggerOnClick,
|
|
57
52
|
onKeyPress: handleKeyPress,
|
|
58
53
|
title: title,
|
|
59
|
-
ref:
|
|
54
|
+
ref: setButtonRef,
|
|
60
55
|
"data-testid": "gh-toolbar-item",
|
|
61
|
-
children: /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
62
|
-
innerRef: ref,
|
|
56
|
+
children: Icon && /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
63
57
|
fill: "#FFF",
|
|
64
58
|
size: "m"
|
|
65
59
|
})
|
|
66
|
-
}), [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
placement: "bottom",
|
|
72
|
-
interactionType: "click",
|
|
73
|
-
showArrow: true,
|
|
74
|
-
style: {
|
|
75
|
-
padding: '0',
|
|
76
|
-
width: 'fit-content'
|
|
77
|
-
},
|
|
78
|
-
renderTrigger: trigger
|
|
79
|
-
}), [content, handleClickOutside, isOpen, trigger]);
|
|
60
|
+
}), /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
61
|
+
referenceElement: buttonRef,
|
|
62
|
+
showPopover: isOpen,
|
|
63
|
+
closeContextMenu: handleOnClose
|
|
64
|
+
}, void 0, content));
|
|
80
65
|
};
|
|
81
66
|
|
|
82
67
|
exports.PopupMenu = PopupMenu;
|