@elliemae/ds-global-header 2.0.0-alpha.1 → 2.0.0-alpha.13

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.
Files changed (48) hide show
  1. package/cjs/GlobalHeader.js +2 -2
  2. package/cjs/GlobalHeaderContainer.js +10 -7
  3. package/cjs/components/Breadcrumb/GlobalHeaderBreadcrumb.js +14 -12
  4. package/cjs/components/Breadcrumb/PureBreadcrumb.js +22 -20
  5. package/cjs/components/Breadcrumb/styles.js +44 -23
  6. package/cjs/components/Title/GlobalHeaderTitle.js +2 -2
  7. package/cjs/components/Toolbar/GlobalHeaderToolbar.js +2 -2
  8. package/cjs/components/Toolbar/ToolbarItems.js +20 -19
  9. package/cjs/components/Toolbar/styles.js +17 -8
  10. package/cjs/config/useGetPropsWithDefaults.js +6 -1
  11. package/cjs/config/useGlobalHeader.js +12 -3
  12. package/cjs/config/useValidateProps.js +5 -2
  13. package/cjs/config/validateHelpers.js +5 -28
  14. package/cjs/defaultProps.js +4 -2
  15. package/cjs/index.js +1 -1
  16. package/cjs/outOfTheBox/AppPicker/AppPicker.js +62 -41
  17. package/cjs/outOfTheBox/PopupMenu/PopupMenu.js +22 -36
  18. package/cjs/outOfTheBox/PopupMenu/PopupMenuContent.js +34 -16
  19. package/cjs/outOfTheBox/PopupMenu/styles.js +10 -7
  20. package/cjs/styles.js +7 -4
  21. package/esm/GlobalHeaderContainer.js +10 -7
  22. package/esm/components/Breadcrumb/GlobalHeaderBreadcrumb.js +11 -9
  23. package/esm/components/Breadcrumb/PureBreadcrumb.js +22 -19
  24. package/esm/components/Breadcrumb/styles.js +40 -19
  25. package/esm/components/Toolbar/ToolbarItems.js +17 -17
  26. package/esm/components/Toolbar/styles.js +16 -7
  27. package/esm/config/useGetPropsWithDefaults.js +5 -0
  28. package/esm/config/useGlobalHeader.js +11 -2
  29. package/esm/config/useValidateProps.js +5 -2
  30. package/esm/config/validateHelpers.js +5 -28
  31. package/esm/defaultProps.js +4 -2
  32. package/esm/outOfTheBox/AppPicker/AppPicker.js +62 -40
  33. package/esm/outOfTheBox/PopupMenu/PopupMenu.js +22 -35
  34. package/esm/outOfTheBox/PopupMenu/PopupMenuContent.js +35 -18
  35. package/esm/outOfTheBox/PopupMenu/styles.js +6 -3
  36. package/esm/styles.js +6 -3
  37. package/package.json +9 -9
  38. package/types/GlobalHeader.d.ts +30 -5
  39. package/types/components/Breadcrumb/styles.d.ts +4 -4
  40. package/types/components/Toolbar/styles.d.ts +1 -1
  41. package/types/config/validateHelpers.d.ts +4 -4
  42. package/types/index.d.d.ts +10 -16
  43. package/types/outOfTheBox/AppPicker/AppPicker.d.ts +8 -3
  44. package/types/outOfTheBox/PopupMenu/styles.d.ts +4 -4
  45. package/types/propTypes.d.ts +27 -6
  46. package/types/styles.d.ts +1 -1
  47. package/cjs/package.json +0 -7
  48. package/esm/package.json +0 -7
@@ -24,9 +24,9 @@ var _GlobalHeaderTitle, _GlobalHeaderBreadcru, _GlobalHeaderToolbar;
24
24
  const GlobalHeader = props => {
25
25
  useValidateProps.useValidateProps(props);
26
26
  const ctx = useGlobalHeader.useGlobalHeader(props);
27
- return /*#__PURE__*/_jsx__default['default'](GlobalHeaderContainer.GlobalHeaderContainer, {}, void 0, /*#__PURE__*/_jsx__default['default'](GlobalHeaderContext.GlobalHeaderContext.Provider, {
27
+ return /*#__PURE__*/_jsx__default["default"](GlobalHeaderContainer.GlobalHeaderContainer, {}, void 0, /*#__PURE__*/_jsx__default["default"](GlobalHeaderContext.GlobalHeaderContext.Provider, {
28
28
  value: ctx
29
- }, void 0, _GlobalHeaderTitle || (_GlobalHeaderTitle = /*#__PURE__*/_jsx__default['default'](GlobalHeaderTitle.GlobalHeaderTitle, {})), _GlobalHeaderBreadcru || (_GlobalHeaderBreadcru = /*#__PURE__*/_jsx__default['default'](GlobalHeaderBreadcrumb.GlobalHeaderBreadcrumb, {})), _GlobalHeaderToolbar || (_GlobalHeaderToolbar = /*#__PURE__*/_jsx__default['default'](GlobalHeaderToolbar.GlobalHeaderToolbar, {}))));
29
+ }, void 0, _GlobalHeaderTitle || (_GlobalHeaderTitle = /*#__PURE__*/_jsx__default["default"](GlobalHeaderTitle.GlobalHeaderTitle, {})), _GlobalHeaderBreadcru || (_GlobalHeaderBreadcru = /*#__PURE__*/_jsx__default["default"](GlobalHeaderBreadcrumb.GlobalHeaderBreadcrumb, {})), _GlobalHeaderToolbar || (_GlobalHeaderToolbar = /*#__PURE__*/_jsx__default["default"](GlobalHeaderToolbar.GlobalHeaderToolbar, {}))));
30
30
  };
31
31
 
32
32
  GlobalHeader.defaultProps = defaultProps.defaultProps;
@@ -10,12 +10,15 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
12
12
 
13
- const GlobalHeaderContainer = ({
14
- children
15
- }) => /*#__PURE__*/_jsx__default['default']("header", {
16
- "data-testid": "ds-global-header"
17
- }, void 0, /*#__PURE__*/_jsx__default['default'](styles.Wrapper, {
18
- cols: ['auto', '1fr', 'auto']
19
- }, void 0, children));
13
+ const GlobalHeaderContainer = _ref => {
14
+ let {
15
+ children
16
+ } = _ref;
17
+ return /*#__PURE__*/_jsx__default["default"]("header", {
18
+ "data-testid": "ds-global-header"
19
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styles.Wrapper, {
20
+ cols: ['auto', '1fr', 'auto']
21
+ }, void 0, children));
22
+ };
20
23
 
21
24
  exports.GlobalHeaderContainer = GlobalHeaderContainer;
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
+ require('core-js/modules/esnext.async-iterator.map.js');
7
+ require('core-js/modules/esnext.iterator.map.js');
6
8
  var React = require('react');
7
9
  var dsGrid = require('@elliemae/ds-grid');
8
10
  var styles = require('./styles.js');
@@ -24,14 +26,14 @@ const GlobalHeaderBreadcrumb = () => {
24
26
  setShowIconOnly,
25
27
  globalHeaderBreadcrumbGrid
26
28
  } = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
27
- const breakpoint = React.useRef();
28
- const flexRegion = React.useRef();
29
+ const breakpoint = React.useRef(null);
30
+ const flexRegion = React.useRef(null);
29
31
  React.useEffect(() => {
30
32
  const evaluateShowIconOnly = () => {
31
- if ((flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
33
+ if (flexRegion && flexRegion.current && (flexRegion === null || flexRegion === void 0 ? void 0 : flexRegion.current.offsetWidth) <= 0 && !breakpoint.current) {
32
34
  setShowIconOnly(true);
33
35
  breakpoint.current = window.innerWidth;
34
- } else if (window.innerWidth >= breakpoint.current) {
36
+ } else if (breakpoint && breakpoint.current !== null && window.innerWidth >= breakpoint.current) {
35
37
  setShowIconOnly(false);
36
38
  breakpoint.current = null;
37
39
  }
@@ -41,29 +43,29 @@ const GlobalHeaderBreadcrumb = () => {
41
43
  window.addEventListener('resize', evaluateShowIconOnly);
42
44
  return () => window.removeEventListener('resize', evaluateShowIconOnly);
43
45
  }, [breakpoint, flexRegion, setShowIconOnly]);
44
- return /*#__PURE__*/_jsx__default['default'](dsGrid.Grid, {
46
+ return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
45
47
  height: "100%",
46
48
  alignItems: "center",
47
- justifyContent: "left",
48
- role: "navigation",
49
+ justifyContent: "flex-start",
49
50
  "aria-label": "breadcrumbs",
50
- cols: globalHeaderBreadcrumbGrid
51
- }, void 0, /*#__PURE__*/_jsx__default['default'](styles.Pipe, {
51
+ cols: globalHeaderBreadcrumbGrid,
52
+ role: "navigation"
53
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styles.Pipe, {
52
54
  showIconOnly: showIconOnly
53
- }), breadcrumb.map(item => {
55
+ }), breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.map(item => {
54
56
  const {
55
57
  label,
56
58
  hasNext,
57
59
  isSelected,
58
60
  onClick
59
61
  } = item;
60
- return /*#__PURE__*/_jsx__default['default'](PureBreadcrumb.PureBreadcrumb, {
62
+ return /*#__PURE__*/_jsx__default["default"](PureBreadcrumb.PureBreadcrumb, {
61
63
  label: label,
62
64
  hasNext: hasNext,
63
65
  isSelected: isSelected,
64
66
  onClick: onClick,
65
67
  length: breadcrumb.length
66
- }, `${instanceUID}-breadcrumb-item-${label}`);
68
+ }, "".concat(instanceUID, "-breadcrumb-item-").concat(label));
67
69
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
68
70
  id: "global-header-flex-region",
69
71
  ref: flexRegion
@@ -4,32 +4,34 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _jsx = require('@babel/runtime/helpers/jsx');
6
6
  var React = require('react');
7
- var Chevron = require('@elliemae/ds-icons/ChevronSmallRight');
7
+ var dsIcons = require('@elliemae/ds-icons');
8
8
  var styles = require('./styles.js');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
11
 
12
12
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
13
13
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
14
- var Chevron__default = /*#__PURE__*/_interopDefaultLegacy(Chevron);
15
14
 
16
- var _Chevron;
17
- const PureBreadcrumb = /*#__PURE__*/React__default['default'].memo(({
18
- onClick,
19
- isSelected,
20
- length,
21
- label,
22
- hasNext
23
- }) => /*#__PURE__*/_jsx__default['default'](styles.BreadcrumbItem, {}, void 0, /*#__PURE__*/_jsx__default['default'](styles.LabelButton, {
24
- onClick: onClick,
25
- "aria-selected": isSelected,
26
- "data-testid": "gh-breadcrumb-btn"
27
- }, void 0, /*#__PURE__*/_jsx__default['default'](styles.Label, {
28
- isSelected: isSelected,
29
- isOnlyItem: length === 1
30
- }, void 0, label)), hasNext && (_Chevron || (_Chevron = /*#__PURE__*/_jsx__default['default'](Chevron__default['default'], {
31
- size: "m",
32
- fill: "#FFF"
33
- })))));
15
+ var _ChevronSmallRight;
16
+ const PureBreadcrumb = /*#__PURE__*/React__default["default"].memo(_ref => {
17
+ let {
18
+ onClick,
19
+ isSelected,
20
+ length,
21
+ label,
22
+ hasNext
23
+ } = _ref;
24
+ return /*#__PURE__*/_jsx__default["default"](styles.BreadcrumbItem, {}, void 0, /*#__PURE__*/_jsx__default["default"](styles.LabelButton, {
25
+ onClick: onClick,
26
+ "aria-selected": isSelected,
27
+ "data-testid": "gh-breadcrumb-btn"
28
+ }, void 0, /*#__PURE__*/_jsx__default["default"](styles.Label, {
29
+ isSelected: !!isSelected,
30
+ isOnlyItem: length === 1
31
+ }, void 0, label)), hasNext && (_ChevronSmallRight || (_ChevronSmallRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallRight, {
32
+ size: "m",
33
+ fill: "#FFF"
34
+ }))));
35
+ });
34
36
 
35
37
  exports.PureBreadcrumb = PureBreadcrumb;
@@ -8,34 +8,55 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
10
 
11
- const Pipe = /*#__PURE__*/styled__default['default'].span.withConfig({
11
+ const Pipe = /*#__PURE__*/styled__default["default"].span.withConfig({
12
12
  componentId: "sc-1n5l527-0"
13
- })(["margin:0 7px 0 0;border-left:", ";height:20px;"], ({
14
- showIconOnly
15
- }) => showIconOnly ? 'none' : '1px solid #fff');
16
- const BreadcrumbItem = /*#__PURE__*/styled__default['default'].div.withConfig({
13
+ })(["margin:0 7px 0 0;border-left:", ";height:20px;"], _ref => {
14
+ let {
15
+ showIconOnly
16
+ } = _ref;
17
+ return showIconOnly ? 'none' : '1px solid #fff';
18
+ });
19
+ const BreadcrumbItem = /*#__PURE__*/styled__default["default"].div.withConfig({
17
20
  componentId: "sc-1n5l527-1"
18
21
  })(["display:flex;align-items:center;height:100%;"]);
19
- const LabelButton = /*#__PURE__*/styled__default['default'].button.withConfig({
22
+ const LabelButton = /*#__PURE__*/styled__default["default"].button.withConfig({
20
23
  componentId: "sc-1n5l527-2"
21
- })(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{:after{content:'';position:absolute;top:0;left:-7px;width:calc(100% + 14px);height:100%;border:4px solid ", ";border-radius:6px;}:before{content:'';position:absolute;z-index:2;top:2px;left:-5px;width:calc(100% + 10px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], ({
22
- theme
23
- }) => theme.colors.brand[700], ({
24
- theme
25
- }) => theme.colors.neutral['000']);
26
- const Label = /*#__PURE__*/styled__default['default'].p.withConfig({
24
+ })(["width:fit-content;height:100%;margin:0;padding:0;border:1px solid transparent;background-color:transparent;outline:none;cursor:pointer;position:relative;&:focus{:after{content:'';position:absolute;top:0;left:-7px;width:calc(100% + 14px);height:100%;border:4px solid ", ";border-radius:6px;}:before{content:'';position:absolute;z-index:2;top:2px;left:-5px;width:calc(100% + 10px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], _ref2 => {
25
+ let {
26
+ theme
27
+ } = _ref2;
28
+ return theme.colors.brand[700];
29
+ }, _ref3 => {
30
+ let {
31
+ theme
32
+ } = _ref3;
33
+ return theme.colors.neutral['000'];
34
+ });
35
+ const Label = /*#__PURE__*/styled__default["default"].p.withConfig({
27
36
  componentId: "sc-1n5l527-3"
28
- })(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"], ({
29
- theme
30
- }) => theme.colors.neutral['000'], ({
31
- theme,
32
- isSelected
33
- }) => `-webkit-text-stroke: 0.4px ${isSelected ? theme.colors.neutral['000'] : 'transparent'}`, ({
34
- isSelected,
35
- isOnlyItem
36
- }) => `2px solid ${isSelected && !isOnlyItem ? '#FFF' : 'transparent'}`, ({
37
- theme
38
- }) => `-webkit-text-stroke: 0.4px ${theme.colors.neutral['000']}`);
37
+ })(["color:", ";", ";font-size:16px;text-transform:uppercase;border-bottom:", ";margin:3px 5px 0 5px;:hover{", ";}"], _ref4 => {
38
+ let {
39
+ theme
40
+ } = _ref4;
41
+ return theme.colors.neutral['000'];
42
+ }, _ref5 => {
43
+ let {
44
+ theme,
45
+ isSelected
46
+ } = _ref5;
47
+ return "-webkit-text-stroke: 0.4px ".concat(isSelected ? theme.colors.neutral['000'] : 'transparent');
48
+ }, _ref6 => {
49
+ let {
50
+ isSelected,
51
+ isOnlyItem
52
+ } = _ref6;
53
+ return "2px solid ".concat(isSelected && !isOnlyItem ? '#FFF' : 'transparent');
54
+ }, _ref7 => {
55
+ let {
56
+ theme
57
+ } = _ref7;
58
+ return "-webkit-text-stroke: 0.4px ".concat(theme.colors.neutral['000']);
59
+ });
39
60
 
40
61
  exports.BreadcrumbItem = BreadcrumbItem;
41
62
  exports.Label = Label;
@@ -19,11 +19,11 @@ const GlobalHeaderTitle = () => {
19
19
  },
20
20
  showIconOnly
21
21
  } = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
22
- return /*#__PURE__*/_jsx__default['default'](dsGrid.Grid, {
22
+ return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
23
23
  alignItems: "center",
24
24
  pr: showIconOnly ? '0px' : '36px',
25
25
  cols: showIconOnly ? ['auto'] : ['auto', '1fr']
26
- }, void 0, Logo && showIconOnly && /*#__PURE__*/_jsx__default['default'](Logo, {}), LogoWithBrand && !showIconOnly && /*#__PURE__*/_jsx__default['default'](LogoWithBrand, {}));
26
+ }, void 0, Logo && showIconOnly && /*#__PURE__*/_jsx__default["default"](Logo, {}), LogoWithBrand && !showIconOnly && /*#__PURE__*/_jsx__default["default"](LogoWithBrand, {}));
27
27
  };
28
28
 
29
29
  exports.GlobalHeaderTitle = GlobalHeaderTitle;
@@ -17,14 +17,14 @@ const GlobalHeaderToolbar = () => {
17
17
  const {
18
18
  globalHeaderToolbarGrid
19
19
  } = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
20
- return /*#__PURE__*/_jsx__default['default'](dsGrid.Grid, {
20
+ return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
21
21
  height: "100%",
22
22
  alignItems: "center",
23
23
  justifyContent: "center",
24
24
  gutter: "xxs",
25
25
  cols: globalHeaderToolbarGrid,
26
26
  role: "toolbar"
27
- }, void 0, _ToolbarItems || (_ToolbarItems = /*#__PURE__*/_jsx__default['default'](ToolbarItems.ToolbarItems, {})));
27
+ }, void 0, _ToolbarItems || (_ToolbarItems = /*#__PURE__*/_jsx__default["default"](ToolbarItems.ToolbarItems, {})));
28
28
  };
29
29
 
30
30
  exports.GlobalHeaderToolbar = GlobalHeaderToolbar;
@@ -2,7 +2,15 @@
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
+ require('core-js/modules/esnext.async-iterator.map.js');
8
+ require('core-js/modules/esnext.iterator.map.js');
9
+ require('core-js/modules/esnext.async-iterator.filter.js');
10
+ require('core-js/modules/esnext.iterator.constructor.js');
11
+ require('core-js/modules/esnext.iterator.filter.js');
12
+ require('core-js/modules/esnext.async-iterator.for-each.js');
13
+ require('core-js/modules/esnext.iterator.for-each.js');
6
14
  var React = require('react');
7
15
  var AppPicker = require('../../outOfTheBox/AppPicker/AppPicker.js');
8
16
  var PopupMenu = require('../../outOfTheBox/PopupMenu/PopupMenu.js');
@@ -12,8 +20,12 @@ 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
25
 
26
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
27
+
28
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
29
  const ToolbarItems = () => {
18
30
  const {
19
31
  props: {
@@ -21,7 +33,7 @@ const ToolbarItems = () => {
21
33
  },
22
34
  instanceUID
23
35
  } = React.useContext(GlobalHeaderContext.GlobalHeaderContext);
24
- const itemsList = React.useMemo(() => toolbar.map(item => {
36
+ const itemsList = React.useMemo(() => toolbar === null || toolbar === void 0 ? void 0 : toolbar.map(item => {
25
37
  var _Icon;
26
38
 
27
39
  const {
@@ -38,36 +50,25 @@ const ToolbarItems = () => {
38
50
  options,
39
51
  closeOnClick
40
52
  } = componentProps;
41
- return /*#__PURE__*/_jsx__default['default'](PopupMenu.PopupMenu, {
53
+ return /*#__PURE__*/_jsx__default["default"](PopupMenu.PopupMenu, {
42
54
  onClick: onClick,
43
55
  title: label,
44
56
  Icon: Icon,
45
57
  options: options,
46
58
  closeOnClick: closeOnClick
47
- }, `${instanceUID}-ds-popup-menu-${label}`);
59
+ }, "".concat(instanceUID, "-ds-popup-menu-").concat(label));
48
60
 
49
61
  case 'ds-app-picker':
50
- const {
51
- apps,
52
- customApps,
53
- sectionTitle,
54
- customSectionTitle
55
- } = componentProps;
56
- return /*#__PURE__*/_jsx__default['default'](AppPicker.AppPicker, {
57
- onClick: onClick,
58
- label: label,
59
- apps: apps,
60
- customApps: customApps,
61
- sectionTitle: sectionTitle,
62
- customSectionTitle: customSectionTitle
63
- }, `${instanceUID}-ds-app-picker-${label}`);
62
+ return /*#__PURE__*/jsxRuntime.jsx(AppPicker.AppPicker, _objectSpread({
63
+ label: label
64
+ }, componentProps), "".concat(instanceUID, "-ds-app-picker-").concat(label));
64
65
 
65
66
  default:
66
- return /*#__PURE__*/_jsx__default['default'](styles.Button, {
67
+ return /*#__PURE__*/_jsx__default["default"](styles.Button, {
67
68
  onClick: onClick,
68
69
  title: label,
69
70
  "data-testid": "gh-toolbar-item"
70
- }, `${instanceUID}-ds-toolbar-button-${label}`, _Icon || (_Icon = /*#__PURE__*/_jsx__default['default'](Icon, {
71
+ }, "".concat(instanceUID, "-ds-toolbar-button-").concat(label), _Icon || (_Icon = /*#__PURE__*/_jsx__default["default"](Icon, {
71
72
  fill: "#FFF",
72
73
  size: "m"
73
74
  })));
@@ -8,14 +8,23 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
8
8
 
9
9
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
10
 
11
- const Button = /*#__PURE__*/styled__default['default'].button.withConfig({
11
+ const Button = /*#__PURE__*/styled__default["default"].button.withConfig({
12
12
  componentId: "sc-1gqj0i3-0"
13
- })(["height:40px;width:40px;border:none;background-color:transparent;cursor:pointer;position:relative;outline:none;&:hover:not(:focus){background-color:", ";outline:none;}&:focus{:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;border:4px solid ", ";border-radius:4px;}:before{content:'';position:absolute;z-index:2;top:2px;left:2px;width:calc(100% - 4px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], ({
14
- theme
15
- }) => theme.colors.brand[700], ({
16
- theme
17
- }) => theme.colors.brand[700], ({
18
- theme
19
- }) => theme.colors.neutral['000']);
13
+ })(["height:40px;width:40px;border:none;background-color:transparent;cursor:pointer;position:relative;outline:none;&:hover:not(:focus){background-color:", ";outline:none;}&:focus{:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;border:4px solid ", ";border-radius:4px;}:before{content:'';position:absolute;z-index:2;top:2px;left:2px;width:calc(100% - 4px);height:calc(100% - 4px);border:2px solid ", ";border-radius:4px;}}"], _ref => {
14
+ let {
15
+ theme
16
+ } = _ref;
17
+ return theme.colors.brand[700];
18
+ }, _ref2 => {
19
+ let {
20
+ theme
21
+ } = _ref2;
22
+ return theme.colors.brand[700];
23
+ }, _ref3 => {
24
+ let {
25
+ theme
26
+ } = _ref3;
27
+ return theme.colors.neutral['000'];
28
+ });
20
29
 
21
30
  exports.Button = Button;
@@ -2,6 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/esnext.async-iterator.filter.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.filter.js');
8
+ require('core-js/modules/esnext.async-iterator.for-each.js');
9
+ require('core-js/modules/esnext.iterator.for-each.js');
5
10
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
11
  var React = require('react');
7
12
  var defaultProps = require('../defaultProps.js');
@@ -12,7 +17,7 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
12
17
 
13
18
  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; }
14
19
 
15
- 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; }
20
+ 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; }
16
21
  const useGetPropsWithDefaults = props => {
17
22
  const {
18
23
  toolbar,
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/web.dom-collections.iterator.js');
5
6
  var React = require('react');
6
7
  var uid = require('uid');
7
8
  var useGetPropsWithDefaults = require('./useGetPropsWithDefaults.js');
@@ -13,10 +14,18 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
14
  const useGlobalHeader = props => {
14
15
  const [showIconOnly, setShowIconOnly] = React.useState(false);
15
16
  const instanceUID = React.useMemo(() => uid.uid(5), []);
16
- const globalHeaderToolbarGrid = React.useMemo(() => props.toolbar.map(() => '1fr'), [props.toolbar]);
17
- const globalHeaderBreadcrumbGrid = React.useMemo(() => ['auto', ...props.breadcrumb.map(() => 'auto'), '1fr'], [props.breadcrumb]);
17
+ const globalHeaderToolbarGrid = React.useMemo(() => {
18
+ var _props$toolbar$length, _props$toolbar;
19
+
20
+ return new Array((_props$toolbar$length = props === null || props === void 0 ? void 0 : (_props$toolbar = props.toolbar) === null || _props$toolbar === void 0 ? void 0 : _props$toolbar.length) !== null && _props$toolbar$length !== void 0 ? _props$toolbar$length : 0).fill('1fr');
21
+ }, [props.toolbar]);
22
+ const globalHeaderBreadcrumbGrid = React.useMemo(() => {
23
+ var _props$breadcrumb$len, _props$breadcrumb;
24
+
25
+ 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'];
26
+ }, [props.breadcrumb]);
18
27
  const propsWithDefaults = useGetPropsWithDefaults.useGetPropsWithDefaults(props);
19
- const ctx = React__default['default'].useMemo(() => ({
28
+ const ctx = React__default["default"].useMemo(() => ({
20
29
  props: propsWithDefaults,
21
30
  showIconOnly,
22
31
  setShowIconOnly,
@@ -2,6 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/esnext.async-iterator.for-each.js');
6
+ require('core-js/modules/esnext.iterator.constructor.js');
7
+ require('core-js/modules/esnext.iterator.for-each.js');
5
8
  var validateHelpers = require('./validateHelpers.js');
6
9
 
7
10
  const validatePopupItem = componentProps => {
@@ -63,7 +66,7 @@ const useValidateProps = props => {
63
66
  validateHelpers.throwLogoError('LogoWithBrand', LogoWithBrand);
64
67
  }
65
68
 
66
- breadcrumb.forEach(breadcrumbItem => {
69
+ breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.forEach(breadcrumbItem => {
67
70
  if (breadcrumbItem.label && typeof breadcrumbItem.label !== 'string') {
68
71
  validateHelpers.throwBreadcrumbItemError('label', breadcrumbItem.label);
69
72
  }
@@ -80,7 +83,7 @@ const useValidateProps = props => {
80
83
  validateHelpers.throwBreadcrumbItemError('isSelected', breadcrumbItem.isSelected);
81
84
  }
82
85
  });
83
- toolbar.forEach(toolbarItem => {
86
+ toolbar === null || toolbar === void 0 ? void 0 : toolbar.forEach(toolbarItem => {
84
87
  validateGenericToolbarItem(toolbarItem);
85
88
 
86
89
  if (toolbarItem.type) {
@@ -30,42 +30,19 @@ const getVariableType = arg => {
30
30
  };
31
31
  const isValidToolbarType = string => string === 'ds-app-picker' || string === 'ds-popup-menu';
32
32
  const throwBreadcrumbItemError = (validPropKey, invalidProp) => {
33
- throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a breadcrumb item, please provide a valid type.
34
-
35
- Received: ${invalidProp} (${typeof invalidProp})
36
- Expected: (${breadcrumbProps[validPropKey]})
37
- `);
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 "));
38
34
  };
39
35
  const throwToolbarPopupItemError = (validPropKey, invalidProp) => {
40
- throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-popup-menu
41
- toolbar item, please provide a valid type.
42
-
43
- Received: ${invalidProp} (${getVariableType(invalidProp)})
44
- Expected: (${toolbarProps[validPropKey]})
45
- `);
36
+ 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
37
  };
47
38
  const throwToolbarAppPickerItemError = (validPropKey, invalidProp) => {
48
- throw new Error(`You are trying to pass a not valid "${validPropKey}" property inside componentProps for a ds-app-picker
49
- toolbar item, please provide a valid type.
50
-
51
- Received: ${invalidProp} (${getVariableType(invalidProp)})
52
- Expected: (${toolbarProps[validPropKey]})
53
- `);
39
+ 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
40
  };
55
41
  const throwToolbarItemGenericError = (validPropKey, invalidProp) => {
56
- throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a toolbar item, please provide a valid type.
57
-
58
- Received: ${invalidProp} (${getVariableType(invalidProp)})
59
- Expected: (${toolbarProps[validPropKey]})
60
- `);
42
+ 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
43
  };
62
44
  const throwLogoError = (validPropKey, invalidProp) => {
63
- throw new Error(`You are trying to pass a not valid "${validPropKey}" property for a global header,
64
- remember to provide both Logo and LogoWithBrand properties with a valid type.
65
-
66
- Received: ${invalidProp} (${getVariableType(invalidProp)}).
67
- Expected: (react component).
68
- `);
45
+ 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
46
  };
70
47
 
71
48
  exports.breadcrumbProps = breadcrumbProps;
@@ -2,11 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ const emptyComp = () => null;
6
+
5
7
  const defaultProps = {
6
8
  breadcrumb: [],
7
9
  toolbar: [],
8
- LogoWithBrand: null,
9
- Logo: null
10
+ LogoWithBrand: emptyComp,
11
+ Logo: emptyComp
10
12
  };
11
13
 
12
14
  exports.defaultProps = defaultProps;
package/cjs/index.js CHANGED
@@ -8,4 +8,4 @@ var GlobalHeader = require('./GlobalHeader.js');
8
8
 
9
9
  exports.GlobalHeader = GlobalHeader.GlobalHeader;
10
10
  exports.GlobalHeaderWithSchema = GlobalHeader.GlobalHeaderWithSchema;
11
- exports.default = GlobalHeader.GlobalHeader;
11
+ exports["default"] = GlobalHeader.GlobalHeader;