@spaced-out/ui-design-system 0.1.94-beta.6 → 0.1.94-beta.8

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 (44) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/design-tokens/size/base-size.json +3 -0
  3. package/lib/components/ButtonDropdown/ButtonDropdown.js +3 -1
  4. package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +4 -2
  5. package/lib/components/ButtonDropdown/SimpleButtonDropdown.js +9 -1
  6. package/lib/components/ButtonDropdown/SimpleButtonDropdown.js.flow +14 -2
  7. package/lib/components/Dropdown/Dropdown.js +3 -1
  8. package/lib/components/Dropdown/Dropdown.js.flow +4 -2
  9. package/lib/components/Dropdown/SimpleDropdown.js +7 -1
  10. package/lib/components/Dropdown/SimpleDropdown.js.flow +10 -1
  11. package/lib/components/InlineDropdown/InlineDropdown.js +3 -1
  12. package/lib/components/InlineDropdown/InlineDropdown.js.flow +4 -2
  13. package/lib/components/InlineDropdown/SimpleInlineDropdown.js +9 -1
  14. package/lib/components/InlineDropdown/SimpleInlineDropdown.js.flow +14 -1
  15. package/lib/components/Menu/Menu.js +20 -4
  16. package/lib/components/Menu/Menu.js.flow +24 -0
  17. package/lib/components/Menu/Menu.module.css +70 -4
  18. package/lib/components/OptionButton/OptionButton.js +4 -2
  19. package/lib/components/OptionButton/OptionButton.js.flow +4 -0
  20. package/lib/components/OptionButton/SimpleOptionButton.js +9 -1
  21. package/lib/components/OptionButton/SimpleOptionButton.js.flow +14 -2
  22. package/lib/components/PageTitle/PageTitle.js +15 -3
  23. package/lib/components/PageTitle/PageTitle.js.flow +33 -14
  24. package/lib/components/PageTitle/PageTitle.module.css +10 -4
  25. package/lib/components/SideMenuLink/SideMenuLink.js +26 -6
  26. package/lib/components/SideMenuLink/SideMenuLink.js.flow +62 -34
  27. package/lib/components/Typeahead/SimpleTypeahead.js +10 -2
  28. package/lib/components/Typeahead/SimpleTypeahead.js.flow +14 -1
  29. package/lib/components/Typeahead/Typeahead.js +3 -1
  30. package/lib/components/Typeahead/Typeahead.js.flow +4 -2
  31. package/lib/styles/index.css +2 -0
  32. package/lib/styles/index.js +3 -1
  33. package/lib/styles/index.js.flow +2 -0
  34. package/lib/styles/variables/_size.css +2 -0
  35. package/lib/styles/variables/_size.js +3 -1
  36. package/lib/styles/variables/_size.js.flow +2 -0
  37. package/lib/types/charts.js.flow +30 -0
  38. package/lib/utils/charts/charts.js +17 -4
  39. package/lib/utils/charts/charts.js.flow +17 -3
  40. package/lib/utils/charts/columnChart.js +1 -0
  41. package/lib/utils/charts/columnChart.js.flow +1 -0
  42. package/lib/utils/click-away/click-away.js +9 -0
  43. package/lib/utils/click-away/click-away.js.flow +16 -0
  44. package/package.json +1 -1
@@ -22,6 +22,7 @@
22
22
  size160,
23
23
  size42,
24
24
  size34,
25
+ size50,
25
26
  size300,
26
27
  size240,
27
28
  size228,
@@ -34,12 +35,12 @@
34
35
  spaceSmall,
35
36
  spaceXSmall,
36
37
  spaceXXSmall,
37
- spaceMedium,
38
- spaceNone
38
+ spaceMedium
39
39
  ) from '../../styles/variables/_space.css';
40
40
 
41
41
  @value (
42
- elevationMenu
42
+ elevationMenu,
43
+ elevationCard
43
44
  ) from '../../styles/variables/_elevation.css';
44
45
 
45
46
  .menuCard {
@@ -49,13 +50,21 @@
49
50
  background-color: colorBackgroundTertiary;
50
51
  display: flex;
51
52
  flex-flow: column;
52
- padding: spaceSmall spaceXSmall;
53
+ padding: spaceXSmall;
53
54
  min-width: size160;
54
55
  border-radius: borderRadiusMedium;
55
56
  overflow: auto;
56
57
  z-index: elevationMenu;
57
58
  }
58
59
 
60
+ .menuCardTopPaddingZero {
61
+ padding-top: spaceNone;
62
+ }
63
+
64
+ .menuCardBottomPaddingZero {
65
+ padding-bottom: spaceNone;
66
+ }
67
+
59
68
  .menuCard:empty {
60
69
  padding: spaceNone;
61
70
  border: none;
@@ -67,12 +76,30 @@
67
76
  max-height: size276;
68
77
  }
69
78
 
79
+ .mediumWithHeader,
80
+ .mediumWithFooter {
81
+ max-height: calc(size276 + size50);
82
+ }
83
+
84
+ .mediumWithHeaderAndFooter {
85
+ max-height: calc(size276 + size50 + size50);
86
+ }
87
+
70
88
  .small {
71
89
  width: size240;
72
90
  min-width: size240;
73
91
  max-height: size228;
74
92
  }
75
93
 
94
+ .smallWithHeader,
95
+ .smallWithHeaderAndFooter {
96
+ max-height: calc(size228 + size50);
97
+ }
98
+
99
+ .smallWithHeaderAndFooter {
100
+ max-height: calc(size228 + size50 + size50);
101
+ }
102
+
76
103
  .fluid {
77
104
  width: sizeFluid;
78
105
  min-width: size160;
@@ -223,3 +250,42 @@
223
250
  margin-bottom: spaceXSmall;
224
251
  margin-left: spaceSmall;
225
252
  }
253
+
254
+ .menuHeader {
255
+ position: sticky;
256
+ background-color: colorBackgroundTertiary;
257
+ padding: spaceXSmall spaceNone;
258
+ top: spaceNone;
259
+ margin-bottom: spaceXSmall;
260
+ z-index: calc(elevationCard/4);
261
+ min-height: size50;
262
+ max-height: size50;
263
+ }
264
+
265
+ .menuHeader::after {
266
+ content: '';
267
+ position: absolute;
268
+ left: calc(spaceXSmall * -1);
269
+ right: calc(spaceXSmall * -1);
270
+ bottom: spaceNone;
271
+ border-bottom: borderWidthPrimary solid colorBorderPrimary;
272
+ }
273
+
274
+ .menuFooter {
275
+ position: sticky;
276
+ background-color: colorBackgroundTertiary;
277
+ padding: spaceXSmall spaceNone;
278
+ bottom: spaceNone;
279
+ margin-top: spaceXSmall;
280
+ min-height: size50;
281
+ max-height: size50;
282
+ }
283
+
284
+ .menuFooter::before {
285
+ content: '';
286
+ position: absolute;
287
+ left: calc(spaceXSmall * -1);
288
+ right: calc(spaceXSmall * -1);
289
+ top: spaceNone;
290
+ border-top: borderWidthPrimary solid colorBorderPrimary;
291
+ }
@@ -34,7 +34,8 @@ const OptionButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
34
34
  ariaLabel,
35
35
  actionType,
36
36
  tooltip,
37
- classNames
37
+ classNames,
38
+ clickAwayRef
38
39
  } = _ref;
39
40
  const [iconName, setIconName] = React.useState('chevron-down');
40
41
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
@@ -87,7 +88,8 @@ const OptionButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
87
88
  onMenuClose && onMenuClose();
88
89
  },
89
90
  onOptionSelect: onOptionSelect,
90
- size: size
91
+ size: size,
92
+ clickAwayRef: clickAwayRef
91
93
  }));
92
94
  });
93
95
  exports.OptionButton = OptionButton;
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
 
5
5
  import classify from '../../utils/classify';
6
+ import type {ClickAwayRefType} from '../../utils/click-away';
6
7
  import type {ButtonProps} from '../Button';
7
8
  import {Button} from '../Button';
8
9
  import type {AnchorType} from '../ButtonDropdown';
@@ -39,6 +40,7 @@ export type OptionButtonProps = {
39
40
  onMenuClose?: () => mixed,
40
41
  tooltip?: OptionButtonTooltipProps,
41
42
  classNames?: ClassNames,
43
+ clickAwayRef?: ClickAwayRefType,
42
44
  ...
43
45
  };
44
46
 
@@ -66,6 +68,7 @@ export const OptionButton: React$AbstractComponent<
66
68
  actionType,
67
69
  tooltip,
68
70
  classNames,
71
+ clickAwayRef,
69
72
  }: OptionButtonProps,
70
73
  ref,
71
74
  ): React.Node => {
@@ -142,6 +145,7 @@ export const OptionButton: React$AbstractComponent<
142
145
  }}
143
146
  onOptionSelect={onOptionSelect}
144
147
  size={size}
148
+ clickAwayRef={clickAwayRef}
145
149
  />
146
150
  </div>
147
151
  );
@@ -28,6 +28,10 @@ const SimpleOptionButtonBase = (props, ref) => {
28
28
  resolveSecondaryLabel,
29
29
  children,
30
30
  menuSize = 'small',
31
+ menuVirtualization,
32
+ header,
33
+ footer,
34
+ clickAwayRef,
31
35
  ...buttonProps
32
36
  } = props;
33
37
  const [optionButtonSelectedKeys, setOptionButtonSelectedKeys] = React.useState(selectedKeys);
@@ -59,6 +63,7 @@ const SimpleOptionButtonBase = (props, ref) => {
59
63
  onOptionSelect: handleOptionChange,
60
64
  onMenuOpen: onMenuOpen,
61
65
  onMenuClose: onMenuClose,
66
+ clickAwayRef: clickAwayRef,
62
67
  menu: {
63
68
  isFluid: false,
64
69
  options,
@@ -67,7 +72,10 @@ const SimpleOptionButtonBase = (props, ref) => {
67
72
  allowSearch,
68
73
  resolveLabel,
69
74
  resolveSecondaryLabel,
70
- size: menuSize
75
+ size: menuSize,
76
+ virtualization: menuVirtualization,
77
+ header,
78
+ footer
71
79
  }
72
80
  }), children);
73
81
  };
@@ -2,10 +2,11 @@
2
2
 
3
3
  import * as React from 'react';
4
4
 
5
+ import type {ClickAwayRefType} from '../../utils/click-away';
5
6
  import {getSelectedKeysFromSelectedOption} from '../../utils/menu';
6
7
  import type {ButtonProps} from '../Button';
7
8
  import type {AnchorType} from '../ButtonDropdown';
8
- import type {MenuOption, MenuOptionsVariant} from '../Menu';
9
+ import type {MenuOption, MenuOptionsVariant, Virtualization} from '../Menu';
9
10
 
10
11
  import type {OptionButtonTooltipProps} from './OptionButton';
11
12
  import {OptionButton} from './OptionButton';
@@ -36,10 +37,12 @@ export type SimpleOptionButtonProps = {
36
37
 
37
38
  // Menu props
38
39
  options?: Array<MenuOption>,
39
-
40
40
  optionsVariant?: MenuOptionsVariant,
41
41
  allowSearch?: boolean,
42
42
  selectedKeys?: Array<string>,
43
+ menuVirtualization?: Virtualization,
44
+ header?: React.Node,
45
+ footer?: React.Node,
43
46
 
44
47
  // events
45
48
  onOptionSelect?: (option: MenuOption, ?SyntheticEvent<HTMLElement>) => mixed,
@@ -50,6 +53,7 @@ export type SimpleOptionButtonProps = {
50
53
  // Resolvers
51
54
  resolveLabel?: (option: MenuOption) => string | React.Node,
52
55
  resolveSecondaryLabel?: (option: MenuOption) => string | React.Node,
56
+ clickAwayRef?: ClickAwayRefType,
53
57
  ...
54
58
  };
55
59
 
@@ -71,6 +75,10 @@ const SimpleOptionButtonBase = (props: SimpleOptionButtonProps, ref) => {
71
75
  resolveSecondaryLabel,
72
76
  children,
73
77
  menuSize = 'small',
78
+ menuVirtualization,
79
+ header,
80
+ footer,
81
+ clickAwayRef,
74
82
  ...buttonProps
75
83
  } = props;
76
84
 
@@ -116,6 +124,7 @@ const SimpleOptionButtonBase = (props: SimpleOptionButtonProps, ref) => {
116
124
  onOptionSelect={handleOptionChange}
117
125
  onMenuOpen={onMenuOpen}
118
126
  onMenuClose={onMenuClose}
127
+ clickAwayRef={clickAwayRef}
119
128
  menu={{
120
129
  isFluid: false,
121
130
  options,
@@ -125,6 +134,9 @@ const SimpleOptionButtonBase = (props: SimpleOptionButtonProps, ref) => {
125
134
  resolveLabel,
126
135
  resolveSecondaryLabel,
127
136
  size: menuSize,
137
+ virtualization: menuVirtualization,
138
+ header,
139
+ footer,
128
140
  }}
129
141
  >
130
142
  {children}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.TabSlot = exports.RightSlot = exports.PageTitle = exports.PageName = exports.PAGE_NAME_LIST = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = _interopRequireDefault(require("../../utils/classify"));
9
+ var _Button = require("../Button");
9
10
  var _Icon = require("../Icon");
10
11
  var _Text = require("../Text");
11
12
  var _PageTitleModule = _interopRequireDefault(require("./PageTitle.module.css"));
@@ -187,7 +188,9 @@ const PageTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
187
188
  let {
188
189
  classNames,
189
190
  children,
190
- pageNameKey
191
+ pageNameKey,
192
+ showBackButton,
193
+ onBack
191
194
  } = _ref4;
192
195
  const getNamedComp = comp => {
193
196
  const childrenArray = React.Children.toArray(children);
@@ -202,19 +205,28 @@ const PageTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
202
205
  }
203
206
  return null;
204
207
  };
208
+ const handleBack = () => {
209
+ onBack && onBack();
210
+ };
205
211
  return /*#__PURE__*/React.createElement("div", {
206
212
  "data-testid": "PageTitle",
207
213
  className: (0, _classify.default)(_PageTitleModule.default.pageTitleWrapper, classNames?.wrapper),
208
214
  ref: ref
209
215
  }, /*#__PURE__*/React.createElement("div", {
210
216
  className: (0, _classify.default)(_PageTitleModule.default.leftSlot, classNames?.leftSlot)
211
- }, pageNameKey && PAGE_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(PageName, null, /*#__PURE__*/React.createElement(_Text.TitleMedium, null, PAGE_NAME_LIST[pageNameKey].title, " "), /*#__PURE__*/React.createElement(_Icon.Icon, {
217
+ }, /*#__PURE__*/React.createElement("div", {
218
+ className: _PageTitleModule.default.headerWithBackBtn
219
+ }, showBackButton && /*#__PURE__*/React.createElement(_Button.Button, {
220
+ onClick: handleBack,
221
+ type: "tertiary",
222
+ iconLeftName: "chevron-left"
223
+ }), pageNameKey && PAGE_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(PageName, null, /*#__PURE__*/React.createElement(_Text.TitleMedium, null, PAGE_NAME_LIST[pageNameKey].title, " "), /*#__PURE__*/React.createElement(_Icon.Icon, {
212
224
  type: PAGE_NAME_LIST[pageNameKey].iconType,
213
225
  name: PAGE_NAME_LIST[pageNameKey].iconName,
214
226
  size: "medium",
215
227
  color: _Text.TEXT_COLORS.primary,
216
228
  swapOpacity: PAGE_NAME_LIST[pageNameKey].iconSwapOpacity
217
- })) : getNamedComp('PageName'), getNamedComp('TabSlot')), /*#__PURE__*/React.createElement("div", {
229
+ })) : getNamedComp('PageName')), getNamedComp('TabSlot')), /*#__PURE__*/React.createElement("div", {
218
230
  className: (0, _classify.default)(_PageTitleModule.default.rightSlot, classNames?.rightSlot)
219
231
  }, getNamedComp('RightSlot')));
220
232
  });
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
 
5
5
  import classify from '../../utils/classify';
6
+ import {Button} from '../Button';
6
7
  import {Icon} from '../Icon';
7
8
  import {TEXT_COLORS, TitleMedium} from '../Text';
8
9
 
@@ -19,6 +20,8 @@ export type PageTitleProps = {
19
20
  classNames?: ClassNames,
20
21
  children?: React.Node,
21
22
  pageNameKey?: string,
23
+ showBackButton?: boolean,
24
+ onBack?: () => void,
22
25
  };
23
26
 
24
27
  export const PAGE_NAME_LIST = Object.freeze({
@@ -204,7 +207,10 @@ export const PageTitle: React$AbstractComponent<
204
207
  PageTitleProps,
205
208
  HTMLDivElement,
206
209
  > = React.forwardRef<PageTitleProps, HTMLDivElement>(
207
- ({classNames, children, pageNameKey}: PageTitleProps, ref): React.Node => {
210
+ (
211
+ {classNames, children, pageNameKey, showBackButton, onBack}: PageTitleProps,
212
+ ref,
213
+ ): React.Node => {
208
214
  const getNamedComp = (comp: string) => {
209
215
  const childrenArray = React.Children.toArray(children);
210
216
  if (childrenArray.length) {
@@ -219,6 +225,10 @@ export const PageTitle: React$AbstractComponent<
219
225
  return null;
220
226
  };
221
227
 
228
+ const handleBack = () => {
229
+ onBack && onBack();
230
+ };
231
+
222
232
  return (
223
233
  <div
224
234
  data-testid="PageTitle"
@@ -226,20 +236,29 @@ export const PageTitle: React$AbstractComponent<
226
236
  ref={ref}
227
237
  >
228
238
  <div className={classify(css.leftSlot, classNames?.leftSlot)}>
229
- {pageNameKey && PAGE_NAME_LIST[pageNameKey] ? (
230
- <PageName>
231
- <TitleMedium>{PAGE_NAME_LIST[pageNameKey].title} </TitleMedium>
232
- <Icon
233
- type={PAGE_NAME_LIST[pageNameKey].iconType}
234
- name={PAGE_NAME_LIST[pageNameKey].iconName}
235
- size="medium"
236
- color={TEXT_COLORS.primary}
237
- swapOpacity={PAGE_NAME_LIST[pageNameKey].iconSwapOpacity}
239
+ <div className={css.headerWithBackBtn}>
240
+ {showBackButton && (
241
+ <Button
242
+ onClick={handleBack}
243
+ type="tertiary"
244
+ iconLeftName="chevron-left"
238
245
  />
239
- </PageName>
240
- ) : (
241
- getNamedComp('PageName')
242
- )}
246
+ )}
247
+ {pageNameKey && PAGE_NAME_LIST[pageNameKey] ? (
248
+ <PageName>
249
+ <TitleMedium>{PAGE_NAME_LIST[pageNameKey].title} </TitleMedium>
250
+ <Icon
251
+ type={PAGE_NAME_LIST[pageNameKey].iconType}
252
+ name={PAGE_NAME_LIST[pageNameKey].iconName}
253
+ size="medium"
254
+ color={TEXT_COLORS.primary}
255
+ swapOpacity={PAGE_NAME_LIST[pageNameKey].iconSwapOpacity}
256
+ />
257
+ </PageName>
258
+ ) : (
259
+ getNamedComp('PageName')
260
+ )}
261
+ </div>
243
262
  {getNamedComp('TabSlot')}
244
263
  </div>
245
264
  <div className={classify(css.rightSlot, classNames?.rightSlot)}>
@@ -1,7 +1,7 @@
1
1
  @value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
2
- @value (spaceNone, spaceXSmall, spaceSmall, spaceMedium, spaceLarge) from '../../styles/variables/_space.css';
2
+ @value (spaceNone, spaceXSmall, spaceSmall, spaceMedium) from '../../styles/variables/_space.css';
3
3
 
4
- @value (sizeFluid, size60) from '../../styles/variables/_size.css';
4
+ @value (sizeFluid) from '../../styles/variables/_size.css';
5
5
 
6
6
  .pageTitleWrapper {
7
7
  composes: borderBottomPrimary from '../../styles/border.module.css';
@@ -10,9 +10,8 @@
10
10
  flex-direction: row;
11
11
  justify-content: space-between;
12
12
  box-sizing: border-box;
13
- padding: spaceSmall spaceLarge spaceXSmall spaceLarge;
13
+ padding: spaceSmall spaceMedium;
14
14
  width: sizeFluid;
15
- min-height: size60;
16
15
  gap: spaceMedium;
17
16
  height: fit-content;
18
17
  }
@@ -21,6 +20,7 @@
21
20
  display: flex;
22
21
  flex-direction: column;
23
22
  gap: spaceXSmall;
23
+ justify-content: center;
24
24
  }
25
25
 
26
26
  .pageTitle {
@@ -36,3 +36,9 @@
36
36
  flex-direction: column;
37
37
  justify-content: flex-end;
38
38
  }
39
+
40
+ .headerWithBackBtn {
41
+ display: flex;
42
+ gap: spaceXSmall;
43
+ align-items: center;
44
+ }
@@ -7,8 +7,10 @@ exports.SideMenuLink = exports.MENU_NAME_LIST = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = _interopRequireDefault(require("../../utils/classify"));
9
9
  var _Button = require("../Button");
10
+ var _ConditionalWrapper = require("../ConditionalWrapper");
10
11
  var _Icon = require("../Icon");
11
12
  var _Text = require("../Text");
13
+ var _Tooltip = require("../Tooltip");
12
14
  var _SideMenuLinkModule = _interopRequireDefault(require("./SideMenuLink.module.css"));
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -41,7 +43,7 @@ const MENU_NAME_LIST = Object.freeze({
41
43
  iconType: 'duotone'
42
44
  },
43
45
  analytics: {
44
- title: 'Analytics',
46
+ title: 'Analytics & Data',
45
47
  iconName: 'chart-column',
46
48
  iconType: 'duotone'
47
49
  },
@@ -50,6 +52,11 @@ const MENU_NAME_LIST = Object.freeze({
50
52
  iconName: 'messages',
51
53
  iconType: 'duotone'
52
54
  },
55
+ messages: {
56
+ title: 'Messaging',
57
+ iconName: 'messages',
58
+ iconType: 'duotone'
59
+ },
53
60
  chatbot: {
54
61
  title: 'Chatbot',
55
62
  iconName: 'message-bot',
@@ -145,13 +152,18 @@ const MENU_NAME_LIST = Object.freeze({
145
152
  iconName: 'pager',
146
153
  iconType: 'duotone'
147
154
  },
155
+ sourcing: {
156
+ title: 'Sourcing',
157
+ iconName: 'browser',
158
+ iconType: 'duotone'
159
+ },
148
160
  earnings: {
149
161
  title: 'Earnings',
150
162
  iconName: 'wallet',
151
163
  iconType: 'duotone'
152
164
  },
153
165
  settings: {
154
- title: 'Settings',
166
+ title: 'Configuration',
155
167
  iconName: 'gear',
156
168
  iconType: 'duotone'
157
169
  }
@@ -166,6 +178,7 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
166
178
  selectedValue,
167
179
  onChange,
168
180
  tabIndex = 0,
181
+ tooltip,
169
182
  ...restButtonProps
170
183
  } = _ref;
171
184
  const selected = selectedValue === pageNameKey;
@@ -173,7 +186,12 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
173
186
  const onChangeHandler = e => {
174
187
  onChange && onChange(e, pageNameKey);
175
188
  };
176
- return /*#__PURE__*/React.createElement(_Button.UnstyledButton, _extends({}, restButtonProps, {
189
+ return /*#__PURE__*/React.createElement(_ConditionalWrapper.ConditionalWrapper, {
190
+ condition: Boolean(!opened && !inActive),
191
+ wrapper: children => /*#__PURE__*/React.createElement(_Tooltip.Tooltip, _extends({
192
+ body: MENU_NAME_LIST[pageNameKey].title
193
+ }, tooltip), children)
194
+ }, /*#__PURE__*/React.createElement(_Button.UnstyledButton, _extends({}, restButtonProps, {
177
195
  className: (0, _classify.default)(_SideMenuLinkModule.default.linkWrapper, {
178
196
  [_SideMenuLinkModule.default.selected]: selected,
179
197
  [_SideMenuLinkModule.default.disabled]: disabled,
@@ -182,7 +200,8 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
182
200
  }, classNames?.wrapper),
183
201
  onClick: onChangeHandler,
184
202
  ref: ref,
185
- tabIndex: disabled ? -1 : tabIndex
203
+ tabIndex: disabled ? -1 : tabIndex,
204
+ disabled: disabled
186
205
  }), pageNameKey && MENU_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(_Icon.Icon, {
187
206
  type: MENU_NAME_LIST[pageNameKey].iconType,
188
207
  name: MENU_NAME_LIST[pageNameKey].iconName,
@@ -192,6 +211,7 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
192
211
  }) : null, pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? /*#__PURE__*/React.createElement(_Text.SubTitleSmall, {
193
212
  color: _Text.TEXT_COLORS.inverseSecondary,
194
213
  className: _SideMenuLinkModule.default.menuText
195
- }, MENU_NAME_LIST[pageNameKey].title) : null);
214
+ }, MENU_NAME_LIST[pageNameKey].title) : null));
196
215
  });
197
- exports.SideMenuLink = SideMenuLink;
216
+ exports.SideMenuLink = SideMenuLink;
217
+ SideMenuLink.displayName = 'SideMenuLink';
@@ -4,8 +4,11 @@ import * as React from 'react';
4
4
 
5
5
  import classify from '../../utils/classify';
6
6
  import {UnstyledButton} from '../Button';
7
+ import {ConditionalWrapper} from '../ConditionalWrapper';
7
8
  import {Icon} from '../Icon';
8
9
  import {SubTitleSmall, TEXT_COLORS} from '../Text';
10
+ import type {BaseTooltipProps} from '../Tooltip';
11
+ import {Tooltip} from '../Tooltip';
9
12
 
10
13
  import css from './SideMenuLink.module.css';
11
14
 
@@ -37,7 +40,7 @@ export const MENU_NAME_LIST = Object.freeze({
37
40
  iconType: 'duotone',
38
41
  },
39
42
  analytics: {
40
- title: 'Analytics',
43
+ title: 'Analytics & Data',
41
44
  iconName: 'chart-column',
42
45
  iconType: 'duotone',
43
46
  },
@@ -46,6 +49,11 @@ export const MENU_NAME_LIST = Object.freeze({
46
49
  iconName: 'messages',
47
50
  iconType: 'duotone',
48
51
  },
52
+ messages: {
53
+ title: 'Messaging',
54
+ iconName: 'messages',
55
+ iconType: 'duotone',
56
+ },
49
57
  chatbot: {
50
58
  title: 'Chatbot',
51
59
  iconName: 'message-bot',
@@ -141,13 +149,18 @@ export const MENU_NAME_LIST = Object.freeze({
141
149
  iconName: 'pager',
142
150
  iconType: 'duotone',
143
151
  },
152
+ sourcing: {
153
+ title: 'Sourcing',
154
+ iconName: 'browser',
155
+ iconType: 'duotone',
156
+ },
144
157
  earnings: {
145
158
  title: 'Earnings',
146
159
  iconName: 'wallet',
147
160
  iconType: 'duotone',
148
161
  },
149
162
  settings: {
150
- title: 'Settings',
163
+ title: 'Configuration',
151
164
  iconName: 'gear',
152
165
  iconType: 'duotone',
153
166
  },
@@ -165,6 +178,7 @@ export type SideMenuLinkProps = {
165
178
  opened?: boolean,
166
179
  onChange?: (e: SyntheticEvent<HTMLElement>, newValue: string) => mixed,
167
180
  tabIndex?: number,
181
+ tooltip?: BaseTooltipProps,
168
182
  ...
169
183
  };
170
184
 
@@ -181,6 +195,7 @@ export const SideMenuLink: React$AbstractComponent<
181
195
  selectedValue,
182
196
  onChange,
183
197
  tabIndex = 0,
198
+ tooltip,
184
199
  ...restButtonProps
185
200
  }: SideMenuLinkProps,
186
201
  ref,
@@ -190,41 +205,54 @@ export const SideMenuLink: React$AbstractComponent<
190
205
  const onChangeHandler = (e: SyntheticEvent<HTMLElement>) => {
191
206
  onChange && onChange(e, pageNameKey);
192
207
  };
208
+
193
209
  return (
194
- <UnstyledButton
195
- {...restButtonProps}
196
- className={classify(
197
- css.linkWrapper,
198
- {
199
- [css.selected]: selected,
200
- [css.disabled]: disabled,
201
- [css.inActive]: inActive,
202
- [css.closed]: !opened,
203
- },
204
- classNames?.wrapper,
210
+ <ConditionalWrapper
211
+ condition={Boolean(!opened && !inActive)}
212
+ wrapper={(children) => (
213
+ <Tooltip body={MENU_NAME_LIST[pageNameKey].title} {...tooltip}>
214
+ {children}
215
+ </Tooltip>
205
216
  )}
206
- onClick={onChangeHandler}
207
- ref={ref}
208
- tabIndex={disabled ? -1 : tabIndex}
209
217
  >
210
- {pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
211
- <Icon
212
- type={MENU_NAME_LIST[pageNameKey].iconType}
213
- name={MENU_NAME_LIST[pageNameKey].iconName}
214
- size="medium"
215
- color={TEXT_COLORS.inverseSecondary}
216
- className={css.menuIcon}
217
- />
218
- ) : null}
219
- {pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? (
220
- <SubTitleSmall
221
- color={TEXT_COLORS.inverseSecondary}
222
- className={css.menuText}
223
- >
224
- {MENU_NAME_LIST[pageNameKey].title}
225
- </SubTitleSmall>
226
- ) : null}
227
- </UnstyledButton>
218
+ <UnstyledButton
219
+ {...restButtonProps}
220
+ className={classify(
221
+ css.linkWrapper,
222
+ {
223
+ [css.selected]: selected,
224
+ [css.disabled]: disabled,
225
+ [css.inActive]: inActive,
226
+ [css.closed]: !opened,
227
+ },
228
+ classNames?.wrapper,
229
+ )}
230
+ onClick={onChangeHandler}
231
+ ref={ref}
232
+ tabIndex={disabled ? -1 : tabIndex}
233
+ disabled={disabled}
234
+ >
235
+ {pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
236
+ <Icon
237
+ type={MENU_NAME_LIST[pageNameKey].iconType}
238
+ name={MENU_NAME_LIST[pageNameKey].iconName}
239
+ size="medium"
240
+ color={TEXT_COLORS.inverseSecondary}
241
+ className={css.menuIcon}
242
+ />
243
+ ) : null}
244
+ {pageNameKey && MENU_NAME_LIST[pageNameKey] && opened ? (
245
+ <SubTitleSmall
246
+ color={TEXT_COLORS.inverseSecondary}
247
+ className={css.menuText}
248
+ >
249
+ {MENU_NAME_LIST[pageNameKey].title}
250
+ </SubTitleSmall>
251
+ ) : null}
252
+ </UnstyledButton>
253
+ </ConditionalWrapper>
228
254
  );
229
255
  },
230
256
  );
257
+
258
+ SideMenuLink.displayName = 'SideMenuLink';