@elliemae/ds-global-header 2.0.0-rc.9 → 2.0.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/{index.d.js → GlobalHeaderTypes.js} +0 -0
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js +28 -18
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +31 -8
- package/cjs/components/Breadcrumb/styles.js +9 -14
- package/cjs/components/Toolbar/ToolbarItems.js +49 -26
- package/cjs/components/Toolbar/styles.js +1 -6
- package/cjs/config/useGetPropsWithDefaults.js +2 -2
- package/cjs/config/useGlobalHeader.js +10 -4
- package/cjs/config/useValidateProps.js +5 -20
- package/cjs/config/validateHelpers.js +2 -2
- package/cjs/defaultProps.js +4 -2
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +59 -27
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +64 -49
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +36 -16
- package/cjs/outOfTheBox/PopupMenu/styles.js +1 -1
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js +113 -0
- package/cjs/outOfTheBox/SearchToggle/styles.js +15 -0
- package/cjs/outOfTheBox/index.js +2 -0
- package/cjs/propTypes.js +1 -1
- package/esm/{index.d.js → GlobalHeaderTypes.js} +0 -0
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +26 -18
- package/esm/components/Breadcrumb/PureBreadcrumb.js +29 -8
- package/esm/components/Breadcrumb/styles.js +9 -14
- package/esm/components/Toolbar/ToolbarItems.js +48 -26
- package/esm/components/Toolbar/styles.js +1 -6
- package/esm/config/useGetPropsWithDefaults.js +2 -2
- package/esm/config/useGlobalHeader.js +10 -4
- package/esm/config/useValidateProps.js +5 -20
- package/esm/config/validateHelpers.js +2 -2
- package/esm/defaultProps.js +4 -2
- package/esm/outOfTheBox/AppPicker/AppPicker.js +57 -27
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +63 -49
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +37 -18
- package/esm/outOfTheBox/PopupMenu/styles.js +1 -1
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js +103 -0
- package/esm/outOfTheBox/SearchToggle/styles.js +7 -0
- package/esm/outOfTheBox/index.js +1 -0
- package/esm/propTypes.js +1 -1
- package/package.json +19 -5
- package/types/GlobalHeader.d.ts +1 -1
- package/types/GlobalHeaderContainer.d.ts +1 -1
- package/types/GlobalHeaderContext.d.ts +1 -1
- package/types/{index.d.d.ts → GlobalHeaderTypes.d.ts} +28 -17
- package/types/components/Breadcrumb/PureBreadcrumb.d.ts +2 -2
- package/types/components/Breadcrumb/styles.d.ts +1 -1
- package/types/config/useGetPropsWithDefaults.d.ts +1 -1
- package/types/config/useGlobalHeader.d.ts +1 -1
- package/types/config/useValidateProps.d.ts +1 -1
- package/types/config/validateHelpers.d.ts +4 -4
- package/types/defaultProps.d.ts +1 -1
- package/types/outOfTheBox/AppPicker/AppPicker.d.ts +8 -3
- package/types/outOfTheBox/PopupMenu/PopupMenu.d.ts +2 -2
- package/types/outOfTheBox/PopupMenu/PopupMenuContent.d.ts +2 -2
- package/types/outOfTheBox/SearchToggle/SearchToggle.d.ts +2 -0
- package/types/outOfTheBox/SearchToggle/styles.d.ts +1 -0
- package/types/outOfTheBox/index.d.ts +1 -0
|
@@ -2,85 +2,100 @@
|
|
|
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
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
8
|
require('core-js/modules/web.dom-collections.iterator.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');
|
|
7
14
|
var React = require('react');
|
|
8
|
-
var
|
|
15
|
+
var dsPopperjs = require('@elliemae/ds-popperjs');
|
|
9
16
|
var PopupMenuContent = require('./PopupMenuContent.js');
|
|
10
17
|
var styles = require('../../components/Toolbar/styles.js');
|
|
18
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
11
19
|
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
|
-
var
|
|
25
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
17
26
|
|
|
27
|
+
const _excluded = ["Icon", "title", "onClick", "id", "componentProps"];
|
|
28
|
+
|
|
29
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
30
|
+
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
32
|
const PopupMenu = _ref => {
|
|
19
33
|
var _PopupMenuContent;
|
|
20
34
|
|
|
21
35
|
let {
|
|
22
36
|
Icon,
|
|
23
|
-
options,
|
|
24
|
-
closeOnClick,
|
|
25
37
|
title,
|
|
26
|
-
onClick
|
|
27
|
-
|
|
38
|
+
onClick,
|
|
39
|
+
id,
|
|
40
|
+
componentProps
|
|
41
|
+
} = _ref,
|
|
42
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
43
|
+
|
|
28
44
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
29
|
-
const buttonRef = React.
|
|
45
|
+
const [buttonRef, setButtonRef] = React.useState(null);
|
|
46
|
+
const {
|
|
47
|
+
onClickOutside = () => null,
|
|
48
|
+
onKeyPress,
|
|
49
|
+
popupOnKeyPress,
|
|
50
|
+
isOpen: userIsOpen,
|
|
51
|
+
options,
|
|
52
|
+
closeOnClick
|
|
53
|
+
} = componentProps;
|
|
30
54
|
const handleKeyPress = React.useCallback(e => {
|
|
31
55
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
32
56
|
setIsOpen(true);
|
|
33
57
|
}
|
|
34
|
-
|
|
58
|
+
|
|
59
|
+
if (onKeyPress) onKeyPress(e);
|
|
60
|
+
}, [onKeyPress]);
|
|
35
61
|
const handleOnClose = React.useCallback(() => {
|
|
36
|
-
|
|
62
|
+
if (userIsOpen === undefined) {
|
|
63
|
+
setIsOpen(false);
|
|
64
|
+
}
|
|
37
65
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, []);
|
|
66
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.focus();
|
|
67
|
+
}, [buttonRef, userIsOpen]);
|
|
41
68
|
const handleTriggerOnClick = React.useCallback(e => {
|
|
42
|
-
setIsOpen(true);
|
|
69
|
+
if (userIsOpen === undefined) setIsOpen(true);
|
|
43
70
|
onClick(e);
|
|
44
|
-
}, [onClick]);
|
|
71
|
+
}, [onClick, userIsOpen]);
|
|
45
72
|
const handleItemClick = React.useCallback(() => {
|
|
46
|
-
if (closeOnClick) handleOnClose();
|
|
47
|
-
}, [closeOnClick, handleOnClose]);
|
|
48
|
-
const handleClickOutside = React.useCallback(() => setIsOpen(false), []);
|
|
73
|
+
if (closeOnClick && userIsOpen === undefined) handleOnClose();
|
|
74
|
+
}, [closeOnClick, handleOnClose, userIsOpen]);
|
|
49
75
|
const content = React.useMemo(() => _PopupMenuContent || (_PopupMenuContent = /*#__PURE__*/_jsx__default["default"](PopupMenuContent.PopupMenuContent, {
|
|
50
76
|
options: options,
|
|
51
77
|
onItemClick: handleItemClick,
|
|
52
|
-
onClose: handleOnClose
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
content: content,
|
|
74
|
-
onClickOutside: handleClickOutside,
|
|
75
|
-
placement: "bottom",
|
|
76
|
-
interactionType: "click",
|
|
77
|
-
showArrow: true,
|
|
78
|
-
style: {
|
|
79
|
-
padding: '0',
|
|
80
|
-
width: 'fit-content'
|
|
81
|
-
},
|
|
82
|
-
renderTrigger: trigger
|
|
83
|
-
}), [content, handleClickOutside, isOpen, trigger]);
|
|
78
|
+
onClose: handleOnClose,
|
|
79
|
+
popupOnKeyPress: popupOnKeyPress
|
|
80
|
+
})), [options, handleItemClick, handleOnClose, popupOnKeyPress]);
|
|
81
|
+
return /*#__PURE__*/_jsx__default["default"]("div", {}, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.Button, _objectSpread(_objectSpread({
|
|
82
|
+
onClick: handleTriggerOnClick,
|
|
83
|
+
onKeyPress: handleKeyPress,
|
|
84
|
+
title: title,
|
|
85
|
+
ref: setButtonRef,
|
|
86
|
+
"data-testid": "gh-toolbar-item",
|
|
87
|
+
id: id
|
|
88
|
+
}, dsPropsHelpers.getDataProps(otherProps)), {}, {
|
|
89
|
+
children: Icon && /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
90
|
+
fill: "#FFF",
|
|
91
|
+
size: "m"
|
|
92
|
+
})
|
|
93
|
+
})), /*#__PURE__*/_jsx__default["default"](dsPopperjs.DSPopperJS, {
|
|
94
|
+
referenceElement: buttonRef,
|
|
95
|
+
showPopover: userIsOpen !== null && userIsOpen !== void 0 ? userIsOpen : isOpen,
|
|
96
|
+
closeContextMenu: handleOnClose,
|
|
97
|
+
onClickOutside: onClickOutside
|
|
98
|
+
}, void 0, content));
|
|
84
99
|
};
|
|
85
100
|
|
|
86
101
|
exports.PopupMenu = PopupMenu;
|
|
@@ -3,9 +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');
|
|
6
7
|
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
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');
|
|
8
14
|
var React = require('react');
|
|
15
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
9
16
|
var styles = require('./styles.js');
|
|
10
17
|
var GlobalHeaderContext = require('../../GlobalHeaderContext.js');
|
|
11
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -13,60 +20,73 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
13
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
21
|
|
|
15
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
23
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
16
24
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
25
|
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
29
|
const PopupMenuContent = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
19
30
|
let {
|
|
20
31
|
options,
|
|
21
32
|
onItemClick,
|
|
22
|
-
onClose
|
|
33
|
+
onClose,
|
|
34
|
+
popupOnKeyPress
|
|
23
35
|
} = _ref;
|
|
24
36
|
const {
|
|
25
37
|
instanceUID
|
|
26
38
|
} = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
|
|
27
|
-
const menuRef = React.useRef();
|
|
39
|
+
const menuRef = React.useRef(null);
|
|
28
40
|
React.useEffect(() => {
|
|
29
41
|
var _menuRef$current, _menuRef$current$firs;
|
|
30
42
|
|
|
31
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();
|
|
32
44
|
}, []);
|
|
33
45
|
const content = React.useMemo(() => options.map(option => {
|
|
34
|
-
var _Content;
|
|
35
|
-
|
|
36
46
|
const {
|
|
37
47
|
type,
|
|
38
|
-
|
|
39
|
-
label,
|
|
48
|
+
Icon,
|
|
49
|
+
label = '',
|
|
40
50
|
onClick,
|
|
41
|
-
Content
|
|
51
|
+
Content,
|
|
52
|
+
id
|
|
42
53
|
} = option;
|
|
43
54
|
|
|
55
|
+
const ariaAndDataProps = _objectSpread(_objectSpread({}, dsPropsHelpers.getAriaProps(option)), dsPropsHelpers.getDataProps(option));
|
|
56
|
+
|
|
44
57
|
const handleClick = e => {
|
|
45
58
|
onItemClick(e);
|
|
46
|
-
onClick(e);
|
|
59
|
+
if (onClick) onClick(e);
|
|
47
60
|
};
|
|
48
61
|
|
|
49
62
|
const handleKeyDown = e => {
|
|
50
63
|
if (e.code === 'Escape') onClose();
|
|
64
|
+
if (popupOnKeyPress) popupOnKeyPress(e);
|
|
51
65
|
};
|
|
52
66
|
|
|
53
67
|
switch (type) {
|
|
54
68
|
case 'separator':
|
|
55
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/jsxRuntime.jsx(styles.Separator, _objectSpread({}, ariaAndDataProps), "".concat(instanceUID, "-separator-").concat(label));
|
|
56
70
|
|
|
57
71
|
case 'custom':
|
|
58
|
-
return /*#__PURE__*/
|
|
72
|
+
return /*#__PURE__*/jsxRuntime.jsx(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
59
73
|
onClick: handleClick,
|
|
60
|
-
onKeyDown: handleKeyDown
|
|
61
|
-
|
|
74
|
+
onKeyDown: handleKeyDown,
|
|
75
|
+
id: id
|
|
76
|
+
}, ariaAndDataProps), {}, {
|
|
77
|
+
children: Content && /*#__PURE__*/_jsx__default["default"](Content, {})
|
|
78
|
+
}), "".concat(instanceUID, "-popup-").concat(label));
|
|
62
79
|
|
|
63
80
|
default:
|
|
64
|
-
return /*#__PURE__*/
|
|
81
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styles.ItemWrapper, _objectSpread(_objectSpread({
|
|
65
82
|
onClick: handleClick,
|
|
66
|
-
onKeyDown: handleKeyDown
|
|
67
|
-
|
|
83
|
+
onKeyDown: handleKeyDown,
|
|
84
|
+
id: id
|
|
85
|
+
}, ariaAndDataProps), {}, {
|
|
86
|
+
children: [Icon && /*#__PURE__*/_jsx__default["default"](Icon, {}), styles.Label && /*#__PURE__*/_jsx__default["default"](styles.Label, {}, void 0, label)]
|
|
87
|
+
}), "".concat(instanceUID, "-popup-").concat(label));
|
|
68
88
|
}
|
|
69
|
-
}), [
|
|
89
|
+
}), [options, onItemClick, onClose, popupOnKeyPress, instanceUID]);
|
|
70
90
|
return /*#__PURE__*/jsxRuntime.jsx(styles.List, {
|
|
71
91
|
ref: menuRef,
|
|
72
92
|
children: content
|
|
@@ -10,7 +10,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
10
10
|
|
|
11
11
|
const List = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
12
12
|
componentId: "sc-snqcgs-0"
|
|
13
|
-
})(["padding:5px 0px;"]);
|
|
13
|
+
})(["padding:5px 0px;background:white;"]);
|
|
14
14
|
const ItemWrapper = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
15
15
|
componentId: "sc-snqcgs-1"
|
|
16
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 => {
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
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
|
+
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');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
16
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
17
|
+
var dsIcon = require('@elliemae/ds-icon');
|
|
18
|
+
var dsForm = require('@elliemae/ds-form');
|
|
19
|
+
var styles = require('./styles.js');
|
|
20
|
+
var styles$1 = require('../../components/Toolbar/styles.js');
|
|
21
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
22
|
+
|
|
23
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
+
|
|
25
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
26
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
27
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
28
|
+
|
|
29
|
+
const _excluded = ["id", "componentProps"];
|
|
30
|
+
|
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
const SearchToggle = _ref => {
|
|
35
|
+
let {
|
|
36
|
+
id,
|
|
37
|
+
componentProps
|
|
38
|
+
} = _ref,
|
|
39
|
+
otherProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
40
|
+
|
|
41
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
42
|
+
const inputRef = React.useRef(null);
|
|
43
|
+
const triggerRef = React.useRef(null);
|
|
44
|
+
const containerRef = React.useRef(null);
|
|
45
|
+
const {
|
|
46
|
+
onNext,
|
|
47
|
+
onPrevious,
|
|
48
|
+
currentResultIndex,
|
|
49
|
+
totalResults,
|
|
50
|
+
placeholder,
|
|
51
|
+
value,
|
|
52
|
+
onChange,
|
|
53
|
+
onBlur,
|
|
54
|
+
onClear,
|
|
55
|
+
isOpen: userIsOpen,
|
|
56
|
+
onKeyDown,
|
|
57
|
+
onClick
|
|
58
|
+
} = componentProps;
|
|
59
|
+
const handleOnClick = React.useCallback(e => {
|
|
60
|
+
if (userIsOpen === undefined) setIsOpen(true);
|
|
61
|
+
if (onClick) onClick(e);
|
|
62
|
+
}, [onClick, userIsOpen]);
|
|
63
|
+
const handleOnKeyDown = React.useCallback(e => {
|
|
64
|
+
if (userIsOpen === undefined) {
|
|
65
|
+
if (e.code === 'Escape') {
|
|
66
|
+
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
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (onKeyDown) onKeyDown(e);
|
|
76
|
+
}, [onKeyDown, userIsOpen]);
|
|
77
|
+
const handleOnBlur = React.useCallback(() => {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
var _containerRef$current;
|
|
80
|
+
|
|
81
|
+
const contains = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.contains(document.activeElement);
|
|
82
|
+
if (value === '' && !contains) setIsOpen(false);
|
|
83
|
+
});
|
|
84
|
+
}, [value]);
|
|
85
|
+
return userIsOpen || isOpen ? /*#__PURE__*/jsxRuntime.jsx(styles.StyledNavSearchBoxContainer, {
|
|
86
|
+
onKeyDown: handleOnKeyDown,
|
|
87
|
+
ref: containerRef,
|
|
88
|
+
onBlur: handleOnBlur,
|
|
89
|
+
children: /*#__PURE__*/_jsx__default["default"](dsForm.DSNavSearchBox, {
|
|
90
|
+
onNext: onNext,
|
|
91
|
+
onPrevious: onPrevious,
|
|
92
|
+
currentResultIndex: currentResultIndex,
|
|
93
|
+
totalResults: totalResults,
|
|
94
|
+
onClear: onClear,
|
|
95
|
+
placeholder: placeholder,
|
|
96
|
+
onChange: onChange,
|
|
97
|
+
value: value,
|
|
98
|
+
onBlur: onBlur,
|
|
99
|
+
innerRef: inputRef,
|
|
100
|
+
autoFocus: true
|
|
101
|
+
})
|
|
102
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(styles$1.Button, _objectSpread(_objectSpread({
|
|
103
|
+
onClick: handleOnClick,
|
|
104
|
+
ref: triggerRef,
|
|
105
|
+
id: id
|
|
106
|
+
}, dsPropsHelpers.getDataProps(otherProps)), {}, {
|
|
107
|
+
children: /*#__PURE__*/_jsx__default["default"](dsIcons.Search, {
|
|
108
|
+
color: dsIcon.DSIconColors.WHITE
|
|
109
|
+
})
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
exports.SearchToggle = SearchToggle;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var styled = require('styled-components');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
10
|
+
|
|
11
|
+
const StyledNavSearchBoxContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
12
|
+
componentId: "sc-1dlcqwh-0"
|
|
13
|
+
})(["background:white;position:relative;min-width:260px;& .em-ds-button{margin-right:2px;height:24px;width:24px;}& .em-ds-input{border:none;outline:none;box-shadow:none;}& .em-ds-input:focus{border:none;box-shadow:none;}& .em-ds-input.em-ds-input--clearable:hover{border:none;outline:none;box-shadow:none;}& .em-ds-input-addon-wrapper{box-shadow:none;}& .em-ds-input-addon-wrapper:hover{outline:none;}& .em-ds-input-addon-wrapper__addon:hover{outline:none;}& .em-ds-input:not(.floating-label-input-controller):hover:active{border:none;outline:none;box-shadow:none;}"]);
|
|
14
|
+
|
|
15
|
+
exports.StyledNavSearchBoxContainer = StyledNavSearchBoxContainer;
|
package/cjs/outOfTheBox/index.js
CHANGED
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var AppPicker = require('./AppPicker/AppPicker.js');
|
|
6
6
|
var PopupMenu = require('./PopupMenu/PopupMenu.js');
|
|
7
|
+
var SearchToggle = require('./SearchToggle/SearchToggle.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
exports.AppPicker = AppPicker.AppPicker;
|
|
11
12
|
exports.PopupMenu = PopupMenu.PopupMenu;
|
|
13
|
+
exports.SearchToggle = SearchToggle.SearchToggle;
|
package/cjs/propTypes.js
CHANGED
|
@@ -12,7 +12,7 @@ const breadcrumbItem = reactDesc.PropTypes.shape({
|
|
|
12
12
|
});
|
|
13
13
|
const toolbarItem = reactDesc.PropTypes.shape({
|
|
14
14
|
label: reactDesc.PropTypes.string.description('title tag description'),
|
|
15
|
-
type: reactDesc.PropTypes.oneOf(['ds-app-picker', 'ds-popup-menu']).description('use to select one of the out-of-the-box types of items'),
|
|
15
|
+
type: reactDesc.PropTypes.oneOf(['ds-app-picker', 'ds-popup-menu', 'ds-search-toggle', 'custom']).description('use to select one of the out-of-the-box types of items'),
|
|
16
16
|
componentProps: reactDesc.PropTypes.object.description('props of out-of-the-box component'),
|
|
17
17
|
Icon: reactDesc.PropTypes.func.description('Icon to display'),
|
|
18
18
|
onClick: reactDesc.PropTypes.func.description('Callback executed on click')
|
|
File without changes
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
1
3
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
4
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
5
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
6
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
11
|
import { useContext, useRef, useEffect } from 'react';
|
|
5
12
|
import { Grid } from '@elliemae/ds-grid';
|
|
6
13
|
import { Pipe } from './styles.js';
|
|
@@ -8,6 +15,11 @@ import { GlobalHeaderContext } from '../../GlobalHeaderContext.js';
|
|
|
8
15
|
import { PureBreadcrumb } from './PureBreadcrumb.js';
|
|
9
16
|
import { jsx } from 'react/jsx-runtime';
|
|
10
17
|
|
|
18
|
+
const _excluded = ["label"];
|
|
19
|
+
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
|
|
22
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
23
|
const GlobalHeaderBreadcrumb = () => {
|
|
12
24
|
const {
|
|
13
25
|
props: {
|
|
@@ -18,14 +30,14 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
18
30
|
setShowIconOnly,
|
|
19
31
|
globalHeaderBreadcrumbGrid
|
|
20
32
|
} = useContext(GlobalHeaderContext);
|
|
21
|
-
const breakpoint = useRef();
|
|
22
|
-
const flexRegion = useRef();
|
|
33
|
+
const breakpoint = useRef(null);
|
|
34
|
+
const flexRegion = useRef(null);
|
|
23
35
|
useEffect(() => {
|
|
24
36
|
const evaluateShowIconOnly = () => {
|
|
25
|
-
if ((flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
37
|
+
if (flexRegion && flexRegion.current && (flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
|
|
26
38
|
setShowIconOnly(true);
|
|
27
39
|
breakpoint.current = window.innerWidth;
|
|
28
|
-
} else if (window.innerWidth >= breakpoint.current) {
|
|
40
|
+
} else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
|
|
29
41
|
setShowIconOnly(false);
|
|
30
42
|
breakpoint.current = null;
|
|
31
43
|
}
|
|
@@ -38,26 +50,22 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
38
50
|
return /*#__PURE__*/_jsx(Grid, {
|
|
39
51
|
height: "100%",
|
|
40
52
|
alignItems: "center",
|
|
41
|
-
justifyContent: "
|
|
42
|
-
role: "navigation",
|
|
53
|
+
justifyContent: "flex-start",
|
|
43
54
|
"aria-label": "breadcrumbs",
|
|
44
|
-
cols: globalHeaderBreadcrumbGrid
|
|
55
|
+
cols: globalHeaderBreadcrumbGrid,
|
|
56
|
+
role: "navigation"
|
|
45
57
|
}, void 0, /*#__PURE__*/_jsx(Pipe, {
|
|
46
58
|
showIconOnly: showIconOnly
|
|
47
|
-
}), breadcrumb.map(item => {
|
|
59
|
+
}), breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.map(item => {
|
|
48
60
|
const {
|
|
49
|
-
label
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return /*#__PURE__*/_jsx(PureBreadcrumb, {
|
|
61
|
+
label
|
|
62
|
+
} = item,
|
|
63
|
+
rest = _objectWithoutProperties(item, _excluded);
|
|
64
|
+
|
|
65
|
+
return /*#__PURE__*/jsx(PureBreadcrumb, _objectSpread({
|
|
55
66
|
label: label,
|
|
56
|
-
hasNext: hasNext,
|
|
57
|
-
isSelected: isSelected,
|
|
58
|
-
onClick: onClick,
|
|
59
67
|
length: breadcrumb.length
|
|
60
|
-
}, "".concat(instanceUID, "-breadcrumb-item-").concat(label));
|
|
68
|
+
}, rest), "".concat(instanceUID, "-breadcrumb-item-").concat(label));
|
|
61
69
|
}), /*#__PURE__*/jsx("div", {
|
|
62
70
|
id: "global-header-flex-region",
|
|
63
71
|
ref: flexRegion
|
|
@@ -1,25 +1,46 @@
|
|
|
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';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
1
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
2
9
|
import React from 'react';
|
|
3
10
|
import { ChevronSmallRight } from '@elliemae/ds-icons';
|
|
11
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
4
12
|
import { BreadcrumbItem, LabelButton, Label } from './styles.js';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
14
|
|
|
6
15
|
var _ChevronSmallRight;
|
|
16
|
+
|
|
17
|
+
const _excluded = ["onClick", "isSelected", "length", "label", "hasNext", "id"];
|
|
18
|
+
|
|
19
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
20
|
+
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
22
|
const PureBreadcrumb = /*#__PURE__*/React.memo(_ref => {
|
|
8
23
|
let {
|
|
9
24
|
onClick,
|
|
10
25
|
isSelected,
|
|
11
26
|
length,
|
|
12
27
|
label,
|
|
13
|
-
hasNext
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
hasNext,
|
|
29
|
+
id
|
|
30
|
+
} = _ref,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
return /*#__PURE__*/_jsx(BreadcrumbItem, {}, void 0, /*#__PURE__*/jsx(LabelButton, _objectSpread(_objectSpread({
|
|
16
34
|
onClick: onClick,
|
|
17
35
|
"aria-selected": isSelected,
|
|
18
|
-
"data-testid": "gh-breadcrumb-btn"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
36
|
+
"data-testid": "gh-breadcrumb-btn",
|
|
37
|
+
id: id
|
|
38
|
+
}, getDataProps(rest)), {}, {
|
|
39
|
+
children: /*#__PURE__*/_jsx(Label, {
|
|
40
|
+
isSelected: !!isSelected,
|
|
41
|
+
isOnlyItem: length === 1
|
|
42
|
+
}, void 0, label)
|
|
43
|
+
})), hasNext && (_ChevronSmallRight || (_ChevronSmallRight = /*#__PURE__*/_jsx(ChevronSmallRight, {
|
|
23
44
|
size: "m",
|
|
24
45
|
fill: "#FFF"
|
|
25
46
|
}))));
|
|
@@ -13,40 +13,35 @@ const BreadcrumbItem = /*#__PURE__*/styled.div.withConfig({
|
|
|
13
13
|
})(["display:flex;align-items:center;height:100%;"]);
|
|
14
14
|
const LabelButton = /*#__PURE__*/styled.button.withConfig({
|
|
15
15
|
componentId: "sc-1n5l527-2"
|
|
16
|
-
})(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{:
|
|
16
|
+
})(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{: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
17
|
let {
|
|
18
18
|
theme
|
|
19
19
|
} = _ref2;
|
|
20
|
-
return theme.colors.brand[700];
|
|
21
|
-
}, _ref3 => {
|
|
22
|
-
let {
|
|
23
|
-
theme
|
|
24
|
-
} = _ref3;
|
|
25
20
|
return theme.colors.neutral['000'];
|
|
26
21
|
});
|
|
27
22
|
const Label = /*#__PURE__*/styled.p.withConfig({
|
|
28
23
|
componentId: "sc-1n5l527-3"
|
|
29
|
-
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"],
|
|
24
|
+
})(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"], _ref3 => {
|
|
30
25
|
let {
|
|
31
26
|
theme
|
|
32
|
-
} =
|
|
27
|
+
} = _ref3;
|
|
33
28
|
return theme.colors.neutral['000'];
|
|
34
|
-
},
|
|
29
|
+
}, _ref4 => {
|
|
35
30
|
let {
|
|
36
31
|
theme,
|
|
37
32
|
isSelected
|
|
38
|
-
} =
|
|
33
|
+
} = _ref4;
|
|
39
34
|
return "-webkit-text-stroke: 0.4px ".concat(isSelected ? theme.colors.neutral['000'] : 'transparent');
|
|
40
|
-
},
|
|
35
|
+
}, _ref5 => {
|
|
41
36
|
let {
|
|
42
37
|
isSelected,
|
|
43
38
|
isOnlyItem
|
|
44
|
-
} =
|
|
39
|
+
} = _ref5;
|
|
45
40
|
return "2px solid ".concat(isSelected && !isOnlyItem ? '#FFF' : 'transparent');
|
|
46
|
-
},
|
|
41
|
+
}, _ref6 => {
|
|
47
42
|
let {
|
|
48
43
|
theme
|
|
49
|
-
} =
|
|
44
|
+
} = _ref6;
|
|
50
45
|
return "-webkit-text-stroke: 0.4px ".concat(theme.colors.neutral['000']);
|
|
51
46
|
});
|
|
52
47
|
|