@elliemae/ds-global-header 2.2.0-alpha.2 → 2.2.0-beta.0
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/GlobalHeader.js +35 -55
- package/cjs/GlobalHeaderContainer.js +23 -40
- package/cjs/GlobalHeaderContext.js +13 -39
- package/cjs/GlobalHeaderTypes.js +2 -27
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js +59 -59
- package/cjs/components/Breadcrumb/PureBreadcrumb.js +59 -50
- package/cjs/components/Breadcrumb/styles.js +58 -82
- package/cjs/components/Title/GlobalHeaderTitle.js +24 -43
- package/cjs/components/Toolbar/GlobalHeaderToolbar.js +22 -41
- package/cjs/components/Toolbar/ToolbarItems.js +94 -83
- package/cjs/components/Toolbar/styles.js +24 -60
- package/cjs/config/useGetPropsWithDefaults.js +30 -42
- package/cjs/config/useGlobalHeader.js +30 -44
- package/cjs/config/useValidateProps.js +64 -81
- package/cjs/config/validateHelpers.js +41 -95
- package/cjs/defaultProps.js +7 -34
- package/cjs/index.js +11 -36
- package/cjs/outOfTheBox/AppPicker/AppPicker.js +90 -83
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +75 -70
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +83 -76
- package/cjs/outOfTheBox/PopupMenu/styles.js +31 -66
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js +85 -80
- package/cjs/outOfTheBox/SearchToggle/styles.js +9 -76
- package/cjs/outOfTheBox/index.js +13 -30
- package/cjs/propTypes.js +25 -52
- package/cjs/styles.js +20 -42
- package/esm/GlobalHeader.js +21 -21
- package/esm/GlobalHeaderContainer.js +15 -11
- package/esm/GlobalHeaderContext.js +8 -9
- package/esm/GlobalHeaderTypes.js +1 -2
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +45 -26
- package/esm/components/Breadcrumb/PureBreadcrumb.js +49 -22
- package/esm/components/Breadcrumb/styles.js +48 -54
- package/esm/components/Title/GlobalHeaderTitle.js +15 -13
- package/esm/components/Toolbar/GlobalHeaderToolbar.js +14 -12
- package/esm/components/Toolbar/ToolbarItems.js +83 -53
- package/esm/components/Toolbar/styles.js +17 -32
- package/esm/config/useGetPropsWithDefaults.js +22 -13
- package/esm/config/useGlobalHeader.js +19 -12
- package/esm/config/useValidateProps.js +58 -58
- package/esm/config/validateHelpers.js +28 -66
- package/esm/defaultProps.js +3 -5
- package/esm/index.js +1 -7
- package/esm/outOfTheBox/AppPicker/AppPicker.js +76 -50
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js +61 -37
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +71 -45
- package/esm/outOfTheBox/PopupMenu/styles.js +21 -38
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js +70 -46
- package/esm/outOfTheBox/SearchToggle/styles.js +5 -51
- package/esm/outOfTheBox/index.js +3 -5
- package/esm/propTypes.js +17 -21
- package/esm/styles.js +13 -14
- package/package.json +7 -7
- package/types/GlobalHeader.d.ts +1 -1
- package/cjs/GlobalHeader.js.map +0 -7
- package/cjs/GlobalHeaderContainer.js.map +0 -7
- package/cjs/GlobalHeaderContext.js.map +0 -7
- package/cjs/GlobalHeaderTypes.js.map +0 -7
- package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js.map +0 -7
- package/cjs/components/Breadcrumb/PureBreadcrumb.js.map +0 -7
- package/cjs/components/Breadcrumb/styles.js.map +0 -7
- package/cjs/components/Title/GlobalHeaderTitle.js.map +0 -7
- package/cjs/components/Toolbar/GlobalHeaderToolbar.js.map +0 -7
- package/cjs/components/Toolbar/ToolbarItems.js.map +0 -7
- package/cjs/components/Toolbar/styles.js.map +0 -7
- package/cjs/config/useGetPropsWithDefaults.js.map +0 -7
- package/cjs/config/useGlobalHeader.js.map +0 -7
- package/cjs/config/useValidateProps.js.map +0 -7
- package/cjs/config/validateHelpers.js.map +0 -7
- package/cjs/defaultProps.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/outOfTheBox/AppPicker/AppPicker.js.map +0 -7
- package/cjs/outOfTheBox/PopupMenu/PopupMenu.js.map +0 -7
- package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js.map +0 -7
- package/cjs/outOfTheBox/PopupMenu/styles.js.map +0 -7
- package/cjs/outOfTheBox/SearchToggle/SearchToggle.js.map +0 -7
- package/cjs/outOfTheBox/SearchToggle/styles.js.map +0 -7
- package/cjs/outOfTheBox/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/cjs/styles.js.map +0 -7
- package/esm/GlobalHeader.js.map +0 -7
- package/esm/GlobalHeaderContainer.js.map +0 -7
- package/esm/GlobalHeaderContext.js.map +0 -7
- package/esm/GlobalHeaderTypes.js.map +0 -7
- package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js.map +0 -7
- package/esm/components/Breadcrumb/PureBreadcrumb.js.map +0 -7
- package/esm/components/Breadcrumb/styles.js.map +0 -7
- package/esm/components/Title/GlobalHeaderTitle.js.map +0 -7
- package/esm/components/Toolbar/GlobalHeaderToolbar.js.map +0 -7
- package/esm/components/Toolbar/ToolbarItems.js.map +0 -7
- package/esm/components/Toolbar/styles.js.map +0 -7
- package/esm/config/useGetPropsWithDefaults.js.map +0 -7
- package/esm/config/useGlobalHeader.js.map +0 -7
- package/esm/config/useValidateProps.js.map +0 -7
- package/esm/config/validateHelpers.js.map +0 -7
- package/esm/defaultProps.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/outOfTheBox/AppPicker/AppPicker.js.map +0 -7
- package/esm/outOfTheBox/PopupMenu/PopupMenu.js.map +0 -7
- package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js.map +0 -7
- package/esm/outOfTheBox/PopupMenu/styles.js.map +0 -7
- package/esm/outOfTheBox/SearchToggle/SearchToggle.js.map +0 -7
- package/esm/outOfTheBox/SearchToggle/styles.js.map +0 -7
- package/esm/outOfTheBox/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
- package/esm/styles.js.map +0 -7
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { defaultProps } from '../defaultProps.js';
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
const useGetPropsWithDefaults = props => {
|
|
14
|
+
const {
|
|
15
|
+
toolbar,
|
|
16
|
+
breadcrumb,
|
|
17
|
+
Logo,
|
|
18
|
+
LogoWithBrand
|
|
19
|
+
} = props;
|
|
20
|
+
return useMemo(() => _objectSpread(_objectSpread({}, defaultProps), props), [toolbar, breadcrumb, Logo, LogoWithBrand]);
|
|
10
21
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=useGetPropsWithDefaults.js.map
|
|
22
|
+
|
|
23
|
+
export { useGetPropsWithDefaults };
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { uid } from
|
|
4
|
-
import { useGetPropsWithDefaults } from
|
|
5
|
-
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import React, { useState, useMemo } from 'react';
|
|
3
|
+
import { uid } from 'uid';
|
|
4
|
+
import { useGetPropsWithDefaults } from './useGetPropsWithDefaults.js';
|
|
5
|
+
|
|
6
|
+
const useGlobalHeader = props => {
|
|
6
7
|
const [showIconOnly, setShowIconOnly] = useState(false);
|
|
7
8
|
const instanceUID = useMemo(() => uid(5), []);
|
|
8
|
-
const globalHeaderToolbarGrid = useMemo(() =>
|
|
9
|
-
|
|
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('auto');
|
|
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]);
|
|
10
19
|
const propsWithDefaults = useGetPropsWithDefaults(props);
|
|
11
|
-
const ctx =
|
|
20
|
+
const ctx = React.useMemo(() => ({
|
|
12
21
|
props: propsWithDefaults,
|
|
13
22
|
showIconOnly,
|
|
14
23
|
setShowIconOnly,
|
|
@@ -18,7 +27,5 @@ const useGlobalHeader = (props) => {
|
|
|
18
27
|
}), [propsWithDefaults, showIconOnly, instanceUID, globalHeaderToolbarGrid, globalHeaderBreadcrumbGrid]);
|
|
19
28
|
return ctx;
|
|
20
29
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=useGlobalHeader.js.map
|
|
30
|
+
|
|
31
|
+
export { useGlobalHeader };
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
throwBreadcrumbItemError,
|
|
8
|
-
isValidToolbarType,
|
|
9
|
-
isObject
|
|
10
|
-
} from "./validateHelpers";
|
|
11
|
-
const validatePopupItem = (componentProps) => {
|
|
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';
|
|
4
|
+
import { throwLogoError, throwBreadcrumbItemError, isValidToolbarType, throwToolbarItemGenericError, isObject, throwToolbarPopupItemError, throwToolbarAppPickerItemError } from './validateHelpers.js';
|
|
5
|
+
|
|
6
|
+
const validatePopupItem = componentProps => {
|
|
12
7
|
if (componentProps.options && !Array.isArray(componentProps.options)) {
|
|
13
|
-
throwToolbarPopupItemError(
|
|
8
|
+
throwToolbarPopupItemError('options', componentProps.options);
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
|
|
11
|
+
if (componentProps.closeOnClick && typeof componentProps.closeOnClick !== 'boolean') {
|
|
12
|
+
throwToolbarPopupItemError('closeOnClick', componentProps.closeOnClick);
|
|
17
13
|
}
|
|
18
14
|
};
|
|
19
|
-
|
|
15
|
+
|
|
16
|
+
const validateAppPickerItem = componentProps => {
|
|
20
17
|
if (componentProps.apps && !Array.isArray(componentProps.apps)) {
|
|
21
|
-
throwToolbarAppPickerItemError(
|
|
18
|
+
throwToolbarAppPickerItemError('apps', componentProps.apps);
|
|
22
19
|
}
|
|
20
|
+
|
|
23
21
|
if (componentProps.customApps && !Array.isArray(componentProps.customApps)) {
|
|
24
|
-
throwToolbarAppPickerItemError(
|
|
22
|
+
throwToolbarAppPickerItemError('customApps', componentProps.customApps);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
if (componentProps.sectionTitle && typeof componentProps.sectionTitle !== 'string') {
|
|
26
|
+
throwToolbarAppPickerItemError('sectionTitle', componentProps.sectionTitle);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
|
|
29
|
+
if (componentProps.customSectionTitle && typeof componentProps.customSectionTitle !== 'string') {
|
|
30
|
+
throwToolbarAppPickerItemError('customSectionTitle', componentProps.customSectionTitle);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
const useValidateProps = props => {
|
|
35
|
+
const {
|
|
36
|
+
breadcrumb,
|
|
37
|
+
toolbar,
|
|
38
|
+
Logo,
|
|
39
|
+
LogoWithBrand
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
42
|
+
if (Logo && typeof Logo !== 'function') {
|
|
43
|
+
throwLogoError('Logo', Logo);
|
|
36
44
|
}
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
|
|
46
|
+
if (LogoWithBrand && typeof LogoWithBrand !== 'function') {
|
|
47
|
+
throwLogoError('LogoWithBrand', LogoWithBrand);
|
|
39
48
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const useValidateProps = (props) => {
|
|
47
|
-
const { breadcrumb, toolbar, Logo, LogoWithBrand } = props;
|
|
48
|
-
if (Logo && typeof Logo !== "function") {
|
|
49
|
-
throwLogoError("Logo", Logo);
|
|
50
|
-
}
|
|
51
|
-
if (LogoWithBrand && typeof LogoWithBrand !== "function") {
|
|
52
|
-
throwLogoError("LogoWithBrand", LogoWithBrand);
|
|
53
|
-
}
|
|
54
|
-
breadcrumb?.forEach((breadcrumbItem) => {
|
|
55
|
-
if (breadcrumbItem.label && typeof breadcrumbItem.label !== "string") {
|
|
56
|
-
throwBreadcrumbItemError("label", breadcrumbItem.label);
|
|
49
|
+
|
|
50
|
+
breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.forEach(breadcrumbItem => {
|
|
51
|
+
if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
|
|
52
|
+
throwBreadcrumbItemError('label', breadcrumbItem.label);
|
|
57
53
|
}
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
|
|
55
|
+
if (breadcrumbItem.onClick && typeof breadcrumbItem.onClick !== 'function') {
|
|
56
|
+
throwBreadcrumbItemError('onClick', breadcrumbItem.onClick);
|
|
60
57
|
}
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
|
|
59
|
+
if (breadcrumbItem.hasNext && typeof breadcrumbItem.hasNext !== 'boolean') {
|
|
60
|
+
throwBreadcrumbItemError('hasNext', breadcrumbItem.hasNext);
|
|
63
61
|
}
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
|
|
63
|
+
if (breadcrumbItem.isSelected && typeof breadcrumbItem.isSelected !== 'boolean') {
|
|
64
|
+
throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
|
-
toolbar
|
|
67
|
+
toolbar === null || toolbar === void 0 ? void 0 : toolbar.forEach(toolbarItem => {
|
|
69
68
|
if (toolbarItem.type) {
|
|
70
69
|
if (!isValidToolbarType(toolbarItem.type)) {
|
|
71
|
-
throwToolbarItemGenericError(
|
|
70
|
+
throwToolbarItemGenericError('type', toolbarItem.type);
|
|
72
71
|
}
|
|
72
|
+
|
|
73
73
|
if (toolbarItem.componentProps && !isObject(toolbarItem.componentProps)) {
|
|
74
|
-
throwToolbarItemGenericError(
|
|
74
|
+
throwToolbarItemGenericError('componentProps', toolbarItem.componentProps);
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
if (toolbarItem.type === 'ds-popup-menu') {
|
|
77
78
|
validatePopupItem(toolbarItem.componentProps);
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
|
|
81
|
+
if (toolbarItem.type === 'ds-app-picker') {
|
|
80
82
|
validateAppPickerItem(toolbarItem.componentProps);
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=useValidateProps.js.map
|
|
87
|
+
|
|
88
|
+
export { useValidateProps };
|
|
@@ -1,82 +1,44 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const breadcrumbProps = {
|
|
3
|
-
label:
|
|
4
|
-
onClick:
|
|
5
|
-
hasNext:
|
|
6
|
-
isSelected:
|
|
2
|
+
label: 'string',
|
|
3
|
+
onClick: 'function',
|
|
4
|
+
hasNext: 'boolean',
|
|
5
|
+
isSelected: 'boolean'
|
|
7
6
|
};
|
|
8
7
|
const toolbarProps = {
|
|
9
|
-
label:
|
|
8
|
+
label: 'string',
|
|
10
9
|
type: '"ds-app-picker" or "ds-popup-menu" or "ds-search-toggle"',
|
|
11
|
-
componentProps:
|
|
12
|
-
Icon:
|
|
13
|
-
onClick:
|
|
14
|
-
options:
|
|
15
|
-
closeOnClick:
|
|
16
|
-
apps:
|
|
17
|
-
customApps:
|
|
18
|
-
sectionTitle:
|
|
19
|
-
customSectionTitle:
|
|
20
|
-
};
|
|
21
|
-
const isObject =
|
|
22
|
-
const getVariableType =
|
|
23
|
-
if (Array.isArray(arg))
|
|
24
|
-
|
|
25
|
-
if (arg ===
|
|
26
|
-
return "null";
|
|
27
|
-
if (arg === void 0)
|
|
28
|
-
return "undefined";
|
|
10
|
+
componentProps: 'object',
|
|
11
|
+
Icon: 'react component',
|
|
12
|
+
onClick: 'function',
|
|
13
|
+
options: 'array',
|
|
14
|
+
closeOnClick: 'boolean',
|
|
15
|
+
apps: 'array',
|
|
16
|
+
customApps: 'array',
|
|
17
|
+
sectionTitle: 'string',
|
|
18
|
+
customSectionTitle: 'string'
|
|
19
|
+
};
|
|
20
|
+
const isObject = obj => typeof obj === 'object' && !!obj && !Array.isArray(obj);
|
|
21
|
+
const getVariableType = arg => {
|
|
22
|
+
if (Array.isArray(arg)) return 'array';
|
|
23
|
+
if (arg === null) return 'null';
|
|
24
|
+
if (arg === undefined) return 'undefined';
|
|
29
25
|
return typeof arg;
|
|
30
26
|
};
|
|
31
|
-
const isValidToolbarType =
|
|
27
|
+
const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';
|
|
32
28
|
const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
|
|
33
|
-
throw new Error(
|
|
34
|
-
|
|
35
|
-
Received: ${invalidProp} (${typeof invalidProp})
|
|
36
|
-
Expected: (${breadcrumbProps[validPropKey]})
|
|
37
|
-
`);
|
|
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 "));
|
|
38
30
|
};
|
|
39
31
|
const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
|
|
40
|
-
throw new Error(
|
|
41
|
-
toolbar item, please provide a valid type.
|
|
42
|
-
|
|
43
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
44
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
45
|
-
`);
|
|
32
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property inside componentProps for a ds-popup-menu \n toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
46
33
|
};
|
|
47
34
|
const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
|
|
48
|
-
throw new Error(
|
|
49
|
-
toolbar item, please provide a valid type.
|
|
50
|
-
|
|
51
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
52
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
53
|
-
`);
|
|
35
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property inside componentProps for a ds-app-picker \n toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
54
36
|
};
|
|
55
37
|
const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
|
|
56
|
-
throw new Error(
|
|
57
|
-
|
|
58
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)})
|
|
59
|
-
Expected: (${toolbarProps[validPropKey]})
|
|
60
|
-
`);
|
|
38
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a toolbar item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ")\n Expected: (").concat(toolbarProps[validPropKey], ")\n "));
|
|
61
39
|
};
|
|
62
40
|
const throwLogoError = (validPropKey, invalidProp) => {
|
|
63
|
-
throw new Error(
|
|
64
|
-
remember to provide both Logo and LogoWithBrand properties with a valid type.
|
|
65
|
-
|
|
66
|
-
Received: ${invalidProp} (${getVariableType(invalidProp)}).
|
|
67
|
-
Expected: (react component).
|
|
68
|
-
`);
|
|
41
|
+
throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a global header, \n remember to provide both Logo and LogoWithBrand properties with a valid type.\n\n Received: ").concat(invalidProp, " (").concat(getVariableType(invalidProp), ").\n Expected: (react component).\n "));
|
|
69
42
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
getVariableType,
|
|
73
|
-
isObject,
|
|
74
|
-
isValidToolbarType,
|
|
75
|
-
throwBreadcrumbItemError,
|
|
76
|
-
throwLogoError,
|
|
77
|
-
throwToolbarAppPickerItemError,
|
|
78
|
-
throwToolbarItemGenericError,
|
|
79
|
-
throwToolbarPopupItemError,
|
|
80
|
-
toolbarProps
|
|
81
|
-
};
|
|
82
|
-
//# sourceMappingURL=validateHelpers.js.map
|
|
43
|
+
|
|
44
|
+
export { breadcrumbProps, getVariableType, isObject, isValidToolbarType, throwBreadcrumbItemError, throwLogoError, throwToolbarAppPickerItemError, throwToolbarItemGenericError, throwToolbarPopupItemError, toolbarProps };
|
package/esm/defaultProps.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
const emptyComp = () => null;
|
|
2
|
+
|
|
3
3
|
const defaultProps = {
|
|
4
4
|
breadcrumb: [],
|
|
5
5
|
toolbar: [],
|
|
6
6
|
LogoWithBrand: emptyComp,
|
|
7
7
|
Logo: emptyComp
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=defaultProps.js.map
|
|
9
|
+
|
|
10
|
+
export { defaultProps };
|
package/esm/index.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export * from "./GlobalHeader";
|
|
3
|
-
import { GlobalHeader } from "./GlobalHeader";
|
|
4
|
-
export {
|
|
5
|
-
GlobalHeader as default
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { GlobalHeader, GlobalHeaderWithSchema, GlobalHeader as default } from './GlobalHeader.js';
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
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';
|
|
10
|
+
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
|
+
import { DSAppPicker } from '@elliemae/ds-app-picker';
|
|
12
|
+
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
13
|
+
import { MenuPicker } from '@elliemae/ds-icons';
|
|
14
|
+
import { Button } from '../../components/Toolbar/styles.js';
|
|
15
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
16
|
+
import { jsx } from 'react/jsx-runtime';
|
|
17
|
+
|
|
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); 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 = 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; }
|
|
25
|
+
const AppPicker = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
label,
|
|
28
|
+
id,
|
|
29
|
+
componentProps
|
|
30
|
+
} = _ref,
|
|
31
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
14
33
|
const [isOpen, setIsOpen] = useState(false);
|
|
15
34
|
const buttonRef = useRef(null);
|
|
16
35
|
const {
|
|
@@ -28,15 +47,17 @@ const AppPicker = ({
|
|
|
28
47
|
triggerRef,
|
|
29
48
|
triggerOnClick
|
|
30
49
|
} = componentProps;
|
|
31
|
-
const handleTriggerKeyDown = useCallback(
|
|
32
|
-
if (e.code ===
|
|
50
|
+
const handleTriggerKeyDown = useCallback(e => {
|
|
51
|
+
if (e.code === 'Enter' || e.code === 'Space') {
|
|
33
52
|
setIsOpen(true);
|
|
34
53
|
}
|
|
35
54
|
}, []);
|
|
36
|
-
const handleAppPickerOnKeyDown = useCallback(
|
|
37
|
-
if (e.code ===
|
|
55
|
+
const handleAppPickerOnKeyDown = useCallback(e => {
|
|
56
|
+
if (e.code === 'Escape') {
|
|
57
|
+
var _buttonRef$current;
|
|
58
|
+
|
|
38
59
|
setIsOpen(false);
|
|
39
|
-
buttonRef
|
|
60
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
40
61
|
}
|
|
41
62
|
}, []);
|
|
42
63
|
const handleOnClickOutside = useCallback(() => {
|
|
@@ -45,37 +66,42 @@ const AppPicker = ({
|
|
|
45
66
|
const handleOnClick = useCallback(() => {
|
|
46
67
|
setIsOpen(true);
|
|
47
68
|
}, []);
|
|
48
|
-
const renderTrigger = useMemo(() =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
const renderTrigger = useMemo(() => _ref2 => {
|
|
70
|
+
let {
|
|
71
|
+
ref
|
|
72
|
+
} = _ref2;
|
|
73
|
+
return /*#__PURE__*/jsx("div", {
|
|
74
|
+
ref: ref,
|
|
75
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
76
|
+
onClick: triggerOnClick !== null && triggerOnClick !== void 0 ? triggerOnClick : handleOnClick,
|
|
77
|
+
onKeyDown: handleTriggerKeyDown,
|
|
78
|
+
ref: mergeRefs(buttonRef, triggerRef),
|
|
79
|
+
title: label,
|
|
80
|
+
"data-testid": "gh-toolbar-item",
|
|
81
|
+
id: id
|
|
82
|
+
}, getDataProps(otherProps)), {}, {
|
|
83
|
+
children: _MenuPicker || (_MenuPicker = /*#__PURE__*/_jsx(MenuPicker, {
|
|
84
|
+
fill: "#FFF",
|
|
85
|
+
width: 20.73,
|
|
86
|
+
height: 20.73
|
|
87
|
+
}))
|
|
88
|
+
}))
|
|
89
|
+
});
|
|
90
|
+
}, [triggerOnClick, handleOnClick, handleTriggerKeyDown, triggerRef, label, id, otherProps]);
|
|
91
|
+
return /*#__PURE__*/_jsx(DSAppPicker, {
|
|
92
|
+
apps: apps,
|
|
93
|
+
customApps: customApps,
|
|
94
|
+
sectionTitle: sectionTitle,
|
|
95
|
+
customSectionTitle: customSectionTitle,
|
|
96
|
+
icon: icon,
|
|
97
|
+
onKeyDown: userOnKeyDown !== null && userOnKeyDown !== void 0 ? userOnKeyDown : handleAppPickerOnKeyDown,
|
|
98
|
+
actionRef: actionRef,
|
|
99
|
+
onClickOutside: userOnClickOutside !== null && userOnClickOutside !== void 0 ? userOnClickOutside : handleOnClickOutside,
|
|
100
|
+
renderTrigger: userRenderTrigger !== null && userRenderTrigger !== void 0 ? userRenderTrigger : renderTrigger,
|
|
101
|
+
isOpen: userIsOpen !== null && userIsOpen !== void 0 ? userIsOpen : isOpen,
|
|
102
|
+
onClose: onClose,
|
|
103
|
+
triggerRef: triggerRef
|
|
76
104
|
});
|
|
77
105
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=AppPicker.js.map
|
|
106
|
+
|
|
107
|
+
export { AppPicker };
|
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
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';
|
|
10
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
11
|
+
import { DSPopperJS } from '@elliemae/ds-popperjs';
|
|
12
|
+
import { PopupMenuContent } from './PopupMenuContent.js';
|
|
13
|
+
import { Button } from '../../components/Toolbar/styles.js';
|
|
14
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
15
|
+
import { jsx } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
const _excluded = ["Icon", "title", "onClick", "id", "componentProps"];
|
|
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; }
|
|
22
|
+
const PopupMenu = _ref => {
|
|
23
|
+
var _PopupMenuContent;
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
Icon,
|
|
27
|
+
title,
|
|
28
|
+
onClick,
|
|
29
|
+
id,
|
|
30
|
+
componentProps
|
|
31
|
+
} = _ref,
|
|
32
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
|
|
8
34
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
35
|
const [buttonRef, setButtonRef] = useState(null);
|
|
10
36
|
const {
|
|
@@ -15,53 +41,51 @@ const PopupMenu = ({ Icon, title, onClick, id, componentProps, ...otherProps })
|
|
|
15
41
|
options,
|
|
16
42
|
closeOnClick
|
|
17
43
|
} = componentProps;
|
|
18
|
-
const handleKeyPress = useCallback(
|
|
19
|
-
if (e.code ===
|
|
44
|
+
const handleKeyPress = useCallback(e => {
|
|
45
|
+
if (e.code === 'Enter' || e.code === 'Space') {
|
|
20
46
|
setIsOpen(true);
|
|
21
47
|
}
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
|
|
49
|
+
if (onKeyPress) onKeyPress(e);
|
|
24
50
|
}, [onKeyPress]);
|
|
25
51
|
const handleOnClose = useCallback(() => {
|
|
26
|
-
if (userIsOpen ===
|
|
52
|
+
if (userIsOpen === undefined) {
|
|
27
53
|
setIsOpen(false);
|
|
28
54
|
}
|
|
29
|
-
|
|
55
|
+
|
|
56
|
+
buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.focus();
|
|
30
57
|
}, [buttonRef, userIsOpen]);
|
|
31
|
-
const handleTriggerOnClick = useCallback(
|
|
32
|
-
if (userIsOpen ===
|
|
33
|
-
setIsOpen(true);
|
|
58
|
+
const handleTriggerOnClick = useCallback(e => {
|
|
59
|
+
if (userIsOpen === undefined) setIsOpen(true);
|
|
34
60
|
onClick(e);
|
|
35
61
|
}, [onClick, userIsOpen]);
|
|
36
62
|
const handleItemClick = useCallback(() => {
|
|
37
|
-
if (closeOnClick && userIsOpen ===
|
|
38
|
-
handleOnClose();
|
|
63
|
+
if (closeOnClick && userIsOpen === undefined) handleOnClose();
|
|
39
64
|
}, [closeOnClick, handleOnClose, userIsOpen]);
|
|
40
|
-
const content = useMemo(() =>
|
|
41
|
-
options,
|
|
65
|
+
const content = useMemo(() => _PopupMenuContent || (_PopupMenuContent = /*#__PURE__*/_jsx(PopupMenuContent, {
|
|
66
|
+
options: options,
|
|
42
67
|
onItemClick: handleItemClick,
|
|
43
68
|
onClose: handleOnClose,
|
|
44
|
-
popupOnKeyPress
|
|
45
|
-
}), [options, handleItemClick, handleOnClose, popupOnKeyPress]);
|
|
46
|
-
return
|
|
69
|
+
popupOnKeyPress: popupOnKeyPress
|
|
70
|
+
})), [options, handleItemClick, handleOnClose, popupOnKeyPress]);
|
|
71
|
+
return /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
|
|
47
72
|
onClick: handleTriggerOnClick,
|
|
48
73
|
onKeyPress: handleKeyPress,
|
|
49
|
-
title,
|
|
74
|
+
title: title,
|
|
50
75
|
ref: setButtonRef,
|
|
51
76
|
"data-testid": "gh-toolbar-item",
|
|
52
|
-
id
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
id: id
|
|
78
|
+
}, getDataProps(otherProps)), {}, {
|
|
79
|
+
children: Icon && /*#__PURE__*/_jsx(Icon, {
|
|
80
|
+
fill: "#FFF",
|
|
81
|
+
size: "m"
|
|
82
|
+
})
|
|
83
|
+
})), /*#__PURE__*/_jsx(DSPopperJS, {
|
|
58
84
|
referenceElement: buttonRef,
|
|
59
|
-
showPopover: userIsOpen
|
|
85
|
+
showPopover: userIsOpen !== null && userIsOpen !== void 0 ? userIsOpen : isOpen,
|
|
60
86
|
closeContextMenu: handleOnClose,
|
|
61
|
-
onClickOutside
|
|
62
|
-
}, content));
|
|
63
|
-
};
|
|
64
|
-
export {
|
|
65
|
-
PopupMenu
|
|
87
|
+
onClickOutside: onClickOutside
|
|
88
|
+
}, void 0, content));
|
|
66
89
|
};
|
|
67
|
-
|
|
90
|
+
|
|
91
|
+
export { PopupMenu };
|