@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
|
@@ -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,
|
|
@@ -63,7 +65,7 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
63
65
|
isSelected: isSelected,
|
|
64
66
|
onClick: onClick,
|
|
65
67
|
length: breadcrumb.length
|
|
66
|
-
},
|
|
68
|
+
}, "".concat(instanceUID, "-breadcrumb-item-").concat(label));
|
|
67
69
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
68
70
|
id: "global-header-flex-region",
|
|
69
71
|
ref: flexRegion
|
|
@@ -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 {
|
|
@@ -44,34 +56,19 @@ const ToolbarItems = () => {
|
|
|
44
56
|
Icon: Icon,
|
|
45
57
|
options: options,
|
|
46
58
|
closeOnClick: closeOnClick
|
|
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
|
-
}, `${instanceUID}-ds-app-picker-${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, {
|
|
71
68
|
onClick: onClick,
|
|
72
69
|
title: label,
|
|
73
70
|
"data-testid": "gh-toolbar-item"
|
|
74
|
-
},
|
|
71
|
+
}, "".concat(instanceUID, "-ds-toolbar-button-").concat(label), _Icon || (_Icon = /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
75
72
|
fill: "#FFF",
|
|
76
73
|
size: "m"
|
|
77
74
|
})));
|
|
@@ -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');
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var uid = require('uid');
|
|
7
8
|
var useGetPropsWithDefaults = require('./useGetPropsWithDefaults.js');
|
|
@@ -13,8 +14,16 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
13
14
|
const useGlobalHeader = props => {
|
|
14
15
|
const [showIconOnly, setShowIconOnly] = React.useState(false);
|
|
15
16
|
const instanceUID = React.useMemo(() => uid.uid(5), []);
|
|
16
|
-
const globalHeaderToolbarGrid = React.useMemo(() =>
|
|
17
|
-
|
|
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]);
|
|
18
27
|
const propsWithDefaults = useGetPropsWithDefaults.useGetPropsWithDefaults(props);
|
|
19
28
|
const ctx = React__default["default"].useMemo(() => ({
|
|
20
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) {
|
|
@@ -30,42 +30,19 @@ const getVariableType = arg => {
|
|
|
30
30
|
};
|
|
31
31
|
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu';
|
|
32
32
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
33
|
-
throw new Error(
|
|
34
|
-
|
|
35
|
-
Received: ${invalidProp} (${typeof invalidProp})
|
|
36
|
-
Expected: (${breadcrumbProps[validPropKey]})
|
|
37
|
-
`);
|
|
33
|
+
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 "));
|
|
38
34
|
};
|
|
39
35
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
40
|
-
throw new Error(
|
|
41
|
-
toolbar item, please provide a valid type.
|
|
42
|
-
|
|
43
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
44
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
45
|
-
`);
|
|
36
|
+
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 "));
|
|
46
37
|
};
|
|
47
38
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
48
|
-
throw new Error(
|
|
49
|
-
toolbar item, please provide a valid type.
|
|
50
|
-
|
|
51
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
52
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
53
|
-
`);
|
|
39
|
+
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 "));
|
|
54
40
|
};
|
|
55
41
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
56
|
-
throw new Error(
|
|
57
|
-
|
|
58
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
59
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
60
|
-
`);
|
|
42
|
+
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 "));
|
|
61
43
|
};
|
|
62
44
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
63
|
-
throw new Error(
|
|
64
|
-
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
65
|
-
|
|
66
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
67
|
-
Expected: (react component).
|
|
68
|
-
`);
|
|
45
|
+
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 "));
|
|
69
46
|
};
|
|
70
47
|
|
|
71
48
|
exports.breadcrumbProps = breadcrumbProps;
|
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;
|
|
@@ -3,79 +3,91 @@
|
|
|
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
8
|
var dsAppPicker = require('@elliemae/ds-app-picker');
|
|
8
|
-
var
|
|
9
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
9
11
|
var styles = require('../../components/Toolbar/styles.js');
|
|
10
12
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
13
|
|
|
12
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
15
|
|
|
14
16
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var MenuPicker__default = /*#__PURE__*/_interopDefaultLegacy(MenuPicker);
|
|
16
17
|
|
|
17
18
|
var _MenuPicker;
|
|
18
|
-
const AppPicker =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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;
|
|
30
36
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
31
|
-
const buttonRef = React.useRef();
|
|
37
|
+
const buttonRef = React.useRef(null);
|
|
32
38
|
const handleTriggerKeyDown = React.useCallback(e => {
|
|
33
39
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
34
40
|
setIsOpen(true);
|
|
35
41
|
}
|
|
36
42
|
}, []);
|
|
37
43
|
const handleAppPickerOnKeyDown = React.useCallback(e => {
|
|
38
|
-
customHandleOnKeyDown(e);
|
|
39
|
-
|
|
40
44
|
if (e.code === 'Escape') {
|
|
45
|
+
var _buttonRef$current;
|
|
46
|
+
|
|
41
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();
|
|
42
49
|
}
|
|
43
|
-
}, [
|
|
50
|
+
}, []);
|
|
44
51
|
const handleOnClickOutside = React.useCallback(() => {
|
|
45
52
|
setIsOpen(false);
|
|
46
53
|
}, []);
|
|
47
|
-
const handleOnClick = React.useCallback(
|
|
54
|
+
const handleOnClick = React.useCallback(() => {
|
|
48
55
|
setIsOpen(true);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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, {
|
|
69
78
|
apps: apps,
|
|
70
79
|
customApps: customApps,
|
|
71
80
|
sectionTitle: sectionTitle,
|
|
72
81
|
customSectionTitle: customSectionTitle,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
triggerRef: buttonRef,
|
|
82
|
+
icon: icon,
|
|
83
|
+
onKeyDown: userOnKeyDown !== null && userOnKeyDown !== void 0 ? userOnKeyDown : handleAppPickerOnKeyDown,
|
|
76
84
|
actionRef: actionRef,
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
});
|
|
79
91
|
};
|
|
80
92
|
|
|
81
93
|
exports.AppPicker = AppPicker;
|