@elliemae/ds-global-header 2.0.0-rc.13 → 2.0.0-rc.17
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 +20 -10
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +31 -8
- package/cjs/components/Breadcrumb/styles.js +9 -14
- package/cjs/components/Toolbar/ToolbarItems.js +39 -21
- package/cjs/components/Toolbar/styles.js +1 -6
- package/cjs/config/useGlobalHeader.js +1 -1
- package/cjs/config/useValidateProps.js +0 -17
- package/cjs/config/validateHelpers.js +2 -2
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +32 -7
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +51 -17
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +10 -5
- 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/esm/{index.d.js → GlobalHeaderTypes.js} +0 -0
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +18 -10
- package/esm/components/Breadcrumb/PureBreadcrumb.js +29 -8
- package/esm/components/Breadcrumb/styles.js +9 -14
- package/esm/components/Toolbar/ToolbarItems.js +37 -20
- package/esm/components/Toolbar/styles.js +1 -6
- package/esm/config/useGlobalHeader.js +1 -1
- package/esm/config/useValidateProps.js +0 -17
- package/esm/config/validateHelpers.js +2 -2
- package/esm/outOfTheBox/AppPicker/AppPicker.js +30 -7
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +49 -17
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +10 -5
- 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/package.json +19 -7
- 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} +16 -2
- 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/defaultProps.d.ts +1 -1
- package/types/outOfTheBox/AppPicker/AppPicker.d.ts +1 -1
- 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
|
@@ -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); if (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 = 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; }
|
|
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;
|
|
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); if (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 = 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; }
|
|
11
23
|
const GlobalHeaderBreadcrumb = () => {
|
|
12
24
|
const {
|
|
13
25
|
props: {
|
|
@@ -46,18 +58,14 @@ const GlobalHeaderBreadcrumb = () => {
|
|
|
46
58
|
showIconOnly: showIconOnly
|
|
47
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); if (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 = 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; }
|
|
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
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
4
|
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
4
5
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
5
6
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
@@ -10,10 +11,14 @@ import 'core-js/modules/esnext.iterator.for-each.js';
|
|
|
10
11
|
import { useContext, useMemo } from 'react';
|
|
11
12
|
import { AppPicker } from '../../outOfTheBox/AppPicker/AppPicker.js';
|
|
12
13
|
import { PopupMenu } from '../../outOfTheBox/PopupMenu/PopupMenu.js';
|
|
14
|
+
import { SearchToggle } from '../../outOfTheBox/SearchToggle/SearchToggle.js';
|
|
13
15
|
import { Button } from './styles.js';
|
|
14
16
|
import { GlobalHeaderContext } from '../../GlobalHeaderContext.js';
|
|
17
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
15
18
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
16
19
|
|
|
20
|
+
const _excluded = ["Icon", "type", "onClick", "componentProps", "label", "onKeyPress", "id"];
|
|
21
|
+
|
|
17
22
|
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
23
|
|
|
19
24
|
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; }
|
|
@@ -32,37 +37,49 @@ const ToolbarItems = () => {
|
|
|
32
37
|
type,
|
|
33
38
|
onClick,
|
|
34
39
|
componentProps,
|
|
35
|
-
label
|
|
36
|
-
|
|
40
|
+
label,
|
|
41
|
+
onKeyPress,
|
|
42
|
+
id
|
|
43
|
+
} = item,
|
|
44
|
+
otherProps = _objectWithoutProperties(item, _excluded);
|
|
37
45
|
|
|
38
46
|
switch (type) {
|
|
39
47
|
case 'ds-popup-menu':
|
|
40
|
-
|
|
41
|
-
options,
|
|
42
|
-
closeOnClick
|
|
43
|
-
} = componentProps;
|
|
44
|
-
return /*#__PURE__*/_jsx(PopupMenu, {
|
|
45
|
-
onClick: onClick,
|
|
48
|
+
return /*#__PURE__*/jsx(PopupMenu, _objectSpread(_objectSpread({
|
|
46
49
|
title: label,
|
|
47
50
|
Icon: Icon,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
onClick: onClick,
|
|
52
|
+
onKeyPress: onKeyPress,
|
|
53
|
+
id: id
|
|
54
|
+
}, otherProps), {}, {
|
|
55
|
+
componentProps: componentProps
|
|
56
|
+
}), "".concat(instanceUID, "-ds-popup-menu-").concat(label));
|
|
51
57
|
|
|
52
58
|
case 'ds-app-picker':
|
|
53
59
|
return /*#__PURE__*/jsx(AppPicker, _objectSpread({
|
|
54
|
-
label: label
|
|
55
|
-
|
|
60
|
+
label: label,
|
|
61
|
+
id: id,
|
|
62
|
+
componentProps: componentProps
|
|
63
|
+
}, otherProps), "".concat(instanceUID, "-ds-app-picker-").concat(label));
|
|
64
|
+
|
|
65
|
+
case 'ds-search-toggle':
|
|
66
|
+
return /*#__PURE__*/jsx(SearchToggle, _objectSpread({
|
|
67
|
+
id: id,
|
|
68
|
+
componentProps: componentProps
|
|
69
|
+
}, otherProps), "".concat(instanceUID, "-ds-search-toggle-").concat(id));
|
|
56
70
|
|
|
57
71
|
default:
|
|
58
|
-
return /*#__PURE__*/
|
|
72
|
+
return /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
59
73
|
onClick: onClick,
|
|
60
74
|
title: label,
|
|
61
|
-
"data-testid": "gh-toolbar-item"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
"data-testid": "gh-toolbar-item",
|
|
76
|
+
id: id
|
|
77
|
+
}, getDataProps(otherProps)), {}, {
|
|
78
|
+
children: _Icon || (_Icon = /*#__PURE__*/_jsx(Icon, {
|
|
79
|
+
fill: "#FFF",
|
|
80
|
+
size: "m"
|
|
81
|
+
}))
|
|
82
|
+
}), "".concat(instanceUID, "-ds-toolbar-button-").concat(label));
|
|
66
83
|
}
|
|
67
84
|
}), [toolbar, instanceUID]);
|
|
68
85
|
return /*#__PURE__*/jsx(Fragment, {
|
|
@@ -2,7 +2,7 @@ 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{:
|
|
5
|
+
})(["height:40px;width:40px;border:none;background-color:transparent;cursor:pointer;position:relative;outline:none;&:hover:not(:focus){background-color:", ";outline:none;}&:focus{: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
6
|
let {
|
|
7
7
|
theme
|
|
8
8
|
} = _ref;
|
|
@@ -11,11 +11,6 @@ const Button = /*#__PURE__*/styled.button.withConfig({
|
|
|
11
11
|
let {
|
|
12
12
|
theme
|
|
13
13
|
} = _ref2;
|
|
14
|
-
return theme.colors.brand[700];
|
|
15
|
-
}, _ref3 => {
|
|
16
|
-
let {
|
|
17
|
-
theme
|
|
18
|
-
} = _ref3;
|
|
19
14
|
return theme.colors.neutral['000'];
|
|
20
15
|
});
|
|
21
16
|
|
|
@@ -9,7 +9,7 @@ const useGlobalHeader = props => {
|
|
|
9
9
|
const globalHeaderToolbarGrid = useMemo(() => {
|
|
10
10
|
var _props$toolbar$length, _props$toolbar;
|
|
11
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('
|
|
12
|
+
return new Array((_props$toolbar$length = props === null || props === void 0 ? void 0 : (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.length) !== null && _props$toolbar$length !== void 0 ? _props$toolbar$length : 0).fill('auto');
|
|
13
13
|
}, [props.toolbar]);
|
|
14
14
|
const globalHeaderBreadcrumbGrid = useMemo(() => {
|
|
15
15
|
var _props$breadcrumb$len, _props$breadcrumb;
|
|
@@ -31,21 +31,6 @@ const validateAppPickerItem = componentProps => {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
const validateGenericToolbarItem = item => {
|
|
35
|
-
if (item.label && typeof item.label !== 'string') {
|
|
36
|
-
throwToolbarItemGenericError('label', item.label);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (item.onClick && typeof item.onClick !== 'function') {
|
|
40
|
-
throwToolbarItemGenericError('onClick', item.onClick);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (item.Icon && typeof item.Icon !== 'function') {
|
|
44
|
-
if (item.type === 'ds-app-picker') return;
|
|
45
|
-
throwToolbarItemGenericError('Icon', item.Icon);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
34
|
const useValidateProps = props => {
|
|
50
35
|
const {
|
|
51
36
|
breadcrumb,
|
|
@@ -80,8 +65,6 @@ const useValidateProps = props => {
|
|
|
80
65
|
}
|
|
81
66
|
});
|
|
82
67
|
toolbar === null || toolbar === void 0 ? void 0 : toolbar.forEach(toolbarItem => {
|
|
83
|
-
validateGenericToolbarItem(toolbarItem);
|
|
84
|
-
|
|
85
68
|
if (toolbarItem.type) {
|
|
86
69
|
if (!isValidToolbarType(toolbarItem.type)) {
|
|
87
70
|
throwToolbarItemGenericError('type', toolbarItem.type);
|
|
@@ -6,7 +6,7 @@ const breadcrumbProps = {
|
|
|
6
6
|
};
|
|
7
7
|
const toolbarProps = {
|
|
8
8
|
label: 'string',
|
|
9
|
-
type: '"ds-app-picker" or "ds-popup-menu"',
|
|
9
|
+
type: '"ds-app-picker" or "ds-popup-menu" or "ds-search-toggle"',
|
|
10
10
|
componentProps: 'object',
|
|
11
11
|
Icon: 'react component',
|
|
12
12
|
onClick: 'function',
|
|
@@ -24,7 +24,7 @@ const getVariableType = arg => {
|
|
|
24
24
|
if (arg === undefined) return 'undefined';
|
|
25
25
|
return typeof arg;
|
|
26
26
|
};
|
|
27
|
-
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu';
|
|
27
|
+
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle';
|
|
28
28
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
29
29
|
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 "));
|
|
30
30
|
};
|
|
@@ -1,16 +1,38 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
1
2
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
2
4
|
import 'core-js/modules/web.dom-collections.iterator.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';
|
|
3
10
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
4
11
|
import { DSAppPicker } from '@elliemae/ds-app-picker';
|
|
5
12
|
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
6
13
|
import { MenuPicker } from '@elliemae/ds-icons';
|
|
7
14
|
import { Button } from '../../components/Toolbar/styles.js';
|
|
15
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
8
16
|
import { jsx } from 'react/jsx-runtime';
|
|
9
17
|
|
|
10
18
|
var _MenuPicker;
|
|
19
|
+
|
|
20
|
+
const _excluded = ["label", "id", "componentProps"];
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
11
25
|
const AppPicker = _ref => {
|
|
12
26
|
let {
|
|
13
27
|
label,
|
|
28
|
+
id,
|
|
29
|
+
componentProps
|
|
30
|
+
} = _ref,
|
|
31
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
34
|
+
const buttonRef = useRef(null);
|
|
35
|
+
const {
|
|
14
36
|
apps,
|
|
15
37
|
icon,
|
|
16
38
|
customApps,
|
|
@@ -24,9 +46,7 @@ const AppPicker = _ref => {
|
|
|
24
46
|
onClose,
|
|
25
47
|
triggerRef,
|
|
26
48
|
triggerOnClick
|
|
27
|
-
} =
|
|
28
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
29
|
-
const buttonRef = useRef(null);
|
|
49
|
+
} = componentProps;
|
|
30
50
|
const handleTriggerKeyDown = useCallback(e => {
|
|
31
51
|
if (e.code === 'Enter' || e.code === 'Space') {
|
|
32
52
|
setIsOpen(true);
|
|
@@ -52,19 +72,22 @@ const AppPicker = _ref => {
|
|
|
52
72
|
} = _ref2;
|
|
53
73
|
return /*#__PURE__*/jsx("div", {
|
|
54
74
|
ref: ref,
|
|
55
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
75
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
56
76
|
onClick: triggerOnClick !== null && triggerOnClick !== void 0 ? triggerOnClick : handleOnClick,
|
|
57
77
|
onKeyDown: handleTriggerKeyDown,
|
|
58
78
|
ref: mergeRefs(buttonRef, triggerRef),
|
|
59
79
|
title: label,
|
|
60
80
|
"data-testid": "gh-toolbar-item",
|
|
81
|
+
id: id
|
|
82
|
+
}, getDataProps(otherProps)), {}, {
|
|
61
83
|
children: _MenuPicker || (_MenuPicker = /*#__PURE__*/_jsx(MenuPicker, {
|
|
62
84
|
fill: "#FFF",
|
|
63
|
-
|
|
85
|
+
width: 20.73,
|
|
86
|
+
height: 20.73
|
|
64
87
|
}))
|
|
65
|
-
})
|
|
88
|
+
}))
|
|
66
89
|
});
|
|
67
|
-
}, [triggerOnClick, handleOnClick, handleTriggerKeyDown, label]);
|
|
90
|
+
}, [triggerOnClick, handleOnClick, handleTriggerKeyDown, triggerRef, label, id, otherProps]);
|
|
68
91
|
return /*#__PURE__*/_jsx(DSAppPicker, {
|
|
69
92
|
apps: apps,
|
|
70
93
|
customApps: customApps,
|