@elliemae/ds-global-header 2.1.0-rc.4 → 2.2.0-alpha.1

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.
@@ -27,7 +27,7 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
27
27
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
28
28
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
29
29
 
30
- const _excluded = ["Icon", "type", "onClick", "componentProps", "label", "onKeyPress", "id"];
30
+ const _excluded = ["Icon", "type", "onClick", "componentProps", "label", "onKeyPress", "id", "CustomComponent"];
31
31
 
32
32
  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; }
33
33
 
@@ -49,7 +49,8 @@ const ToolbarItems = () => {
49
49
  componentProps,
50
50
  label,
51
51
  onKeyPress,
52
- id
52
+ id,
53
+ CustomComponent
53
54
  } = item,
54
55
  otherProps = _objectWithoutProperties__default["default"](item, _excluded);
55
56
 
@@ -78,6 +79,12 @@ const ToolbarItems = () => {
78
79
  componentProps: componentProps
79
80
  }, otherProps), "".concat(instanceUID, "-ds-search-toggle-").concat(id));
80
81
 
82
+ case 'custom':
83
+ if (CustomComponent) return /*#__PURE__*/_jsx__default["default"](CustomComponent, {
84
+ item: item
85
+ });
86
+ return null;
87
+
81
88
  default:
82
89
  return /*#__PURE__*/jsxRuntime.jsx(styles.Button, _objectSpread(_objectSpread({
83
90
  onClick: onClick,
@@ -80,7 +80,9 @@ const useValidateProps = props => {
80
80
 
81
81
  if (toolbarItem.type === 'ds-popup-menu') {
82
82
  validatePopupItem(toolbarItem.componentProps);
83
- } else {
83
+ }
84
+
85
+ if (toolbarItem.type === 'ds-app-picker') {
84
86
  validateAppPickerItem(toolbarItem.componentProps);
85
87
  }
86
88
  }
@@ -28,7 +28,7 @@ const getVariableType = arg => {
28
28
  if (arg === undefined) return 'undefined';
29
29
  return typeof arg;
30
30
  };
31
- const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle';
31
+ const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';
32
32
  const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
33
33
  throw new Error("You are trying to pass a not valid \"".concat(validPropKey, "\" property for a breadcrumb item, please provide a valid type.\n\n Received: ").concat(invalidProp, " (").concat(typeof invalidProp, ")\n Expected: (").concat(breadcrumbProps[validPropKey], ")\n "));
34
34
  };
@@ -15,8 +15,8 @@ var React = require('react');
15
15
  var dsAppPicker = require('@elliemae/ds-app-picker');
16
16
  var dsUtilities = require('@elliemae/ds-utilities');
17
17
  var dsIcons = require('@elliemae/ds-icons');
18
- var styles = require('../../components/Toolbar/styles.js');
19
18
  var dsPropsHelpers = require('@elliemae/ds-props-helpers');
19
+ var styles = require('../../components/Toolbar/styles.js');
20
20
  var jsxRuntime = require('react/jsx-runtime');
21
21
 
22
22
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
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')
@@ -17,7 +17,7 @@ import { GlobalHeaderContext } from '../../GlobalHeaderContext.js';
17
17
  import { getDataProps } from '@elliemae/ds-props-helpers';
18
18
  import { jsx, Fragment } from 'react/jsx-runtime';
19
19
 
20
- const _excluded = ["Icon", "type", "onClick", "componentProps", "label", "onKeyPress", "id"];
20
+ const _excluded = ["Icon", "type", "onClick", "componentProps", "label", "onKeyPress", "id", "CustomComponent"];
21
21
 
22
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
23
 
@@ -39,7 +39,8 @@ const ToolbarItems = () => {
39
39
  componentProps,
40
40
  label,
41
41
  onKeyPress,
42
- id
42
+ id,
43
+ CustomComponent
43
44
  } = item,
44
45
  otherProps = _objectWithoutProperties(item, _excluded);
45
46
 
@@ -68,6 +69,12 @@ const ToolbarItems = () => {
68
69
  componentProps: componentProps
69
70
  }, otherProps), "".concat(instanceUID, "-ds-search-toggle-").concat(id));
70
71
 
72
+ case 'custom':
73
+ if (CustomComponent) return /*#__PURE__*/_jsx(CustomComponent, {
74
+ item: item
75
+ });
76
+ return null;
77
+
71
78
  default:
72
79
  return /*#__PURE__*/jsx(Button, _objectSpread(_objectSpread({
73
80
  onClick: onClick,
@@ -76,7 +76,9 @@ const useValidateProps = props => {
76
76
 
77
77
  if (toolbarItem.type === 'ds-popup-menu') {
78
78
  validatePopupItem(toolbarItem.componentProps);
79
- } else {
79
+ }
80
+
81
+ if (toolbarItem.type === 'ds-app-picker') {
80
82
  validateAppPickerItem(toolbarItem.componentProps);
81
83
  }
82
84
  }
@@ -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' || string === 'ds-search-toggle';
27
+ const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu' || string === 'ds-search-toggle' || string === 'custom';
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
  };
@@ -11,8 +11,8 @@ import { useState, useRef, useCallback, useMemo } from 'react';
11
11
  import { DSAppPicker } from '@elliemae/ds-app-picker';
12
12
  import { mergeRefs } from '@elliemae/ds-utilities';
13
13
  import { MenuPicker } from '@elliemae/ds-icons';
14
- import { Button } from '../../components/Toolbar/styles.js';
15
14
  import { getDataProps } from '@elliemae/ds-props-helpers';
15
+ import { Button } from '../../components/Toolbar/styles.js';
16
16
  import { jsx } from 'react/jsx-runtime';
17
17
 
18
18
  var _MenuPicker;
package/esm/propTypes.js CHANGED
@@ -8,7 +8,7 @@ const breadcrumbItem = PropTypes.shape({
8
8
  });
9
9
  const toolbarItem = PropTypes.shape({
10
10
  label: PropTypes.string.description('title tag description'),
11
- type: PropTypes.oneOf(['ds-app-picker', 'ds-popup-menu']).description('use to select one of the out-of-the-box types of items'),
11
+ type: 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'),
12
12
  componentProps: PropTypes.object.description('props of out-of-the-box component'),
13
13
  Icon: PropTypes.func.description('Icon to display'),
14
14
  onClick: PropTypes.func.description('Callback executed on click')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-global-header",
3
- "version": "2.1.0-rc.4",
3
+ "version": "2.2.0-alpha.1",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Global Header",
6
6
  "module": "./esm/index.js",
@@ -132,12 +132,12 @@
132
132
  "build": "node ../../scripts/build/build.js"
133
133
  },
134
134
  "dependencies": {
135
- "@elliemae/ds-app-picker": "2.1.0-rc.4",
136
- "@elliemae/ds-grid": "2.1.0-rc.4",
137
- "@elliemae/ds-icons": "2.1.0-rc.4",
138
- "@elliemae/ds-popperjs": "2.1.0-rc.4",
139
- "@elliemae/ds-props-helpers": "2.1.0-rc.4",
140
- "@elliemae/ds-utilities": "2.1.0-rc.4",
135
+ "@elliemae/ds-app-picker": "2.2.0-alpha.1",
136
+ "@elliemae/ds-grid": "2.2.0-alpha.1",
137
+ "@elliemae/ds-icons": "2.2.0-alpha.1",
138
+ "@elliemae/ds-popperjs": "2.2.0-alpha.1",
139
+ "@elliemae/ds-props-helpers": "2.2.0-alpha.1",
140
+ "@elliemae/ds-utilities": "2.2.0-alpha.1",
141
141
  "react-desc": "~4.1.3",
142
142
  "uid": "~2.0.0"
143
143
  },
@@ -27,11 +27,14 @@ export interface BreadcrumbItemT {
27
27
  length: number;
28
28
  }
29
29
  export interface ToolbarItemT {
30
- type?: 'ds-app-picker' | 'ds-popup-menu' | 'ds-search-toggle';
30
+ type?: 'ds-app-picker' | 'ds-popup-menu' | 'ds-search-toggle' | 'custom';
31
31
  label: string;
32
32
  Icon: React.ComponentType<Record<string, unknown>>;
33
33
  onClick: (event: React.MouseEvent<HTMLElement>) => void;
34
34
  componentProps?: PopupPropsT | AppPickerProps | SearchTogglePropsT;
35
+ CustomComponent?: React.ComponentType<{
36
+ item: ToolbarItemT;
37
+ }>;
35
38
  }
36
39
  export interface PopupPropsT {
37
40
  Icon?: React.ComponentType<Record<string, unknown>>;