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