@spaced-out/ui-design-system 0.1.94-beta.7 → 0.1.94
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/CHANGELOG.md +16 -0
- package/lib/components/ButtonDropdown/ButtonDropdown.js +3 -1
- package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +4 -2
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.js +9 -1
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.js.flow +14 -2
- package/lib/components/Dropdown/Dropdown.js +3 -1
- package/lib/components/Dropdown/Dropdown.js.flow +4 -2
- package/lib/components/Dropdown/SimpleDropdown.js +7 -1
- package/lib/components/Dropdown/SimpleDropdown.js.flow +10 -1
- package/lib/components/InlineDropdown/InlineDropdown.js +3 -1
- package/lib/components/InlineDropdown/InlineDropdown.js.flow +4 -2
- package/lib/components/InlineDropdown/SimpleInlineDropdown.js +9 -1
- package/lib/components/InlineDropdown/SimpleInlineDropdown.js.flow +14 -1
- package/lib/components/Menu/Menu.js +20 -4
- package/lib/components/Menu/Menu.js.flow +24 -0
- package/lib/components/Menu/Menu.module.css +70 -4
- package/lib/components/OptionButton/OptionButton.js +4 -2
- package/lib/components/OptionButton/OptionButton.js.flow +4 -0
- package/lib/components/OptionButton/SimpleOptionButton.js +9 -1
- package/lib/components/OptionButton/SimpleOptionButton.js.flow +14 -2
- package/lib/components/PageTitle/PageTitle.js +15 -3
- package/lib/components/PageTitle/PageTitle.js.flow +33 -14
- package/lib/components/PageTitle/PageTitle.module.css +9 -3
- package/lib/components/SideMenuLink/SideMenuLink.js +4 -3
- package/lib/components/SideMenuLink/SideMenuLink.js.flow +3 -2
- package/lib/components/Typeahead/SimpleTypeahead.js +10 -2
- package/lib/components/Typeahead/SimpleTypeahead.js.flow +14 -1
- package/lib/components/Typeahead/Typeahead.js +3 -1
- package/lib/components/Typeahead/Typeahead.js.flow +4 -2
- package/lib/types/charts.js.flow +30 -0
- package/lib/utils/charts/charts.js +17 -4
- package/lib/utils/charts/charts.js.flow +17 -3
- package/lib/utils/charts/columnChart.js +1 -0
- package/lib/utils/charts/columnChart.js.flow +1 -0
- package/lib/utils/click-away/click-away.js +9 -0
- package/lib/utils/click-away/click-away.js.flow +16 -0
- package/package.json +1 -1
|
@@ -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
|
-
},
|
|
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
|
-
(
|
|
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
|
-
{
|
|
230
|
-
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
type=
|
|
234
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
2
|
@value (spaceNone, spaceXSmall, spaceSmall, spaceMedium) from '../../styles/variables/_space.css';
|
|
3
3
|
|
|
4
|
-
@value (sizeFluid
|
|
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 spaceMedium
|
|
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
|
+
}
|
|
@@ -43,7 +43,7 @@ const MENU_NAME_LIST = Object.freeze({
|
|
|
43
43
|
iconType: 'duotone'
|
|
44
44
|
},
|
|
45
45
|
analytics: {
|
|
46
|
-
title: 'Analytics',
|
|
46
|
+
title: 'Analytics & Data',
|
|
47
47
|
iconName: 'chart-column',
|
|
48
48
|
iconType: 'duotone'
|
|
49
49
|
},
|
|
@@ -163,7 +163,7 @@ const MENU_NAME_LIST = Object.freeze({
|
|
|
163
163
|
iconType: 'duotone'
|
|
164
164
|
},
|
|
165
165
|
settings: {
|
|
166
|
-
title: '
|
|
166
|
+
title: 'Configuration',
|
|
167
167
|
iconName: 'gear',
|
|
168
168
|
iconType: 'duotone'
|
|
169
169
|
}
|
|
@@ -200,7 +200,8 @@ const SideMenuLink = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
200
200
|
}, classNames?.wrapper),
|
|
201
201
|
onClick: onChangeHandler,
|
|
202
202
|
ref: ref,
|
|
203
|
-
tabIndex: disabled ? -1 : tabIndex
|
|
203
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
204
|
+
disabled: disabled
|
|
204
205
|
}), pageNameKey && MENU_NAME_LIST[pageNameKey] ? /*#__PURE__*/React.createElement(_Icon.Icon, {
|
|
205
206
|
type: MENU_NAME_LIST[pageNameKey].iconType,
|
|
206
207
|
name: MENU_NAME_LIST[pageNameKey].iconName,
|
|
@@ -40,7 +40,7 @@ export const MENU_NAME_LIST = Object.freeze({
|
|
|
40
40
|
iconType: 'duotone',
|
|
41
41
|
},
|
|
42
42
|
analytics: {
|
|
43
|
-
title: 'Analytics',
|
|
43
|
+
title: 'Analytics & Data',
|
|
44
44
|
iconName: 'chart-column',
|
|
45
45
|
iconType: 'duotone',
|
|
46
46
|
},
|
|
@@ -160,7 +160,7 @@ export const MENU_NAME_LIST = Object.freeze({
|
|
|
160
160
|
iconType: 'duotone',
|
|
161
161
|
},
|
|
162
162
|
settings: {
|
|
163
|
-
title: '
|
|
163
|
+
title: 'Configuration',
|
|
164
164
|
iconName: 'gear',
|
|
165
165
|
iconType: 'duotone',
|
|
166
166
|
},
|
|
@@ -230,6 +230,7 @@ export const SideMenuLink: React$AbstractComponent<
|
|
|
230
230
|
onClick={onChangeHandler}
|
|
231
231
|
ref={ref}
|
|
232
232
|
tabIndex={disabled ? -1 : tabIndex}
|
|
233
|
+
disabled={disabled}
|
|
233
234
|
>
|
|
234
235
|
{pageNameKey && MENU_NAME_LIST[pageNameKey] ? (
|
|
235
236
|
<Icon
|
|
@@ -24,6 +24,10 @@ const SimpleTypeaheadBase = (props, ref) => {
|
|
|
24
24
|
resolveSecondaryLabel,
|
|
25
25
|
onClear,
|
|
26
26
|
onSearch,
|
|
27
|
+
menuVirtualization,
|
|
28
|
+
header,
|
|
29
|
+
footer,
|
|
30
|
+
clickAwayRef,
|
|
27
31
|
...inputProps
|
|
28
32
|
} = props;
|
|
29
33
|
const [typeaheadInputText, setTypeaheadInputText] = React.useState('');
|
|
@@ -68,8 +72,12 @@ const SimpleTypeaheadBase = (props, ref) => {
|
|
|
68
72
|
selectedKeys: typeaheadSelectedKeys,
|
|
69
73
|
resolveLabel,
|
|
70
74
|
resolveSecondaryLabel,
|
|
71
|
-
size
|
|
72
|
-
|
|
75
|
+
size,
|
|
76
|
+
virtualization: menuVirtualization,
|
|
77
|
+
header,
|
|
78
|
+
footer
|
|
79
|
+
},
|
|
80
|
+
clickAwayRef: clickAwayRef
|
|
73
81
|
}));
|
|
74
82
|
};
|
|
75
83
|
const SimpleTypeahead = /*#__PURE__*/React.forwardRef(SimpleTypeaheadBase);
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
|
+
import type {ClickAwayRefType} from '../../utils/click-away';
|
|
5
6
|
import {getTextLabelFromSelectedKeys} from '../../utils/menu';
|
|
6
7
|
import type {InputProps} from '../Input';
|
|
7
|
-
import type {MenuOption} from '../Menu';
|
|
8
|
+
import type {MenuOption, Virtualization} from '../Menu';
|
|
8
9
|
|
|
9
10
|
import {Typeahead} from './Typeahead';
|
|
10
11
|
|
|
@@ -30,6 +31,9 @@ export type SimpleTypeaheadProps = {
|
|
|
30
31
|
// Menu props
|
|
31
32
|
options?: Array<MenuOption>,
|
|
32
33
|
selectedKeys?: Array<string>,
|
|
34
|
+
menuVirtualization?: Virtualization,
|
|
35
|
+
header?: React.Node,
|
|
36
|
+
footer?: React.Node,
|
|
33
37
|
|
|
34
38
|
// events
|
|
35
39
|
onSelect?: (option: MenuOption, ?SyntheticEvent<HTMLElement>) => mixed,
|
|
@@ -41,6 +45,7 @@ export type SimpleTypeaheadProps = {
|
|
|
41
45
|
// Resolvers
|
|
42
46
|
resolveLabel?: (option: MenuOption) => string | React.Node,
|
|
43
47
|
resolveSecondaryLabel?: (option: MenuOption) => string | React.Node,
|
|
48
|
+
clickAwayRef?: ClickAwayRefType,
|
|
44
49
|
...
|
|
45
50
|
};
|
|
46
51
|
|
|
@@ -58,6 +63,10 @@ const SimpleTypeaheadBase = (props: SimpleTypeaheadProps, ref) => {
|
|
|
58
63
|
resolveSecondaryLabel,
|
|
59
64
|
onClear,
|
|
60
65
|
onSearch,
|
|
66
|
+
menuVirtualization,
|
|
67
|
+
header,
|
|
68
|
+
footer,
|
|
69
|
+
clickAwayRef,
|
|
61
70
|
...inputProps
|
|
62
71
|
} = props;
|
|
63
72
|
|
|
@@ -121,7 +130,11 @@ const SimpleTypeaheadBase = (props: SimpleTypeaheadProps, ref) => {
|
|
|
121
130
|
resolveLabel,
|
|
122
131
|
resolveSecondaryLabel,
|
|
123
132
|
size,
|
|
133
|
+
virtualization: menuVirtualization,
|
|
134
|
+
header,
|
|
135
|
+
footer,
|
|
124
136
|
}}
|
|
137
|
+
clickAwayRef={clickAwayRef}
|
|
125
138
|
/>
|
|
126
139
|
);
|
|
127
140
|
};
|
|
@@ -32,6 +32,7 @@ const Typeahead = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
32
32
|
isLoading,
|
|
33
33
|
menuOpenOffset = 1,
|
|
34
34
|
onFocus,
|
|
35
|
+
clickAwayRef,
|
|
35
36
|
...inputProps
|
|
36
37
|
} = _ref;
|
|
37
38
|
const [filteredOptions, setFilteredOptions] = React.useState(menu?.options);
|
|
@@ -61,7 +62,8 @@ const Typeahead = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
61
62
|
setFilteredOptions(optionsFiltered || []);
|
|
62
63
|
}, [typeaheadInputText, menu?.options]);
|
|
63
64
|
return /*#__PURE__*/React.createElement(_clickAway.ClickAway, {
|
|
64
|
-
onChange: onMenuToggle
|
|
65
|
+
onChange: onMenuToggle,
|
|
66
|
+
clickAwayRef: clickAwayRef
|
|
65
67
|
}, _ref2 => {
|
|
66
68
|
let {
|
|
67
69
|
isOpen,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {sizeFluid} from '../../styles/variables/_size';
|
|
16
16
|
import {spaceNone, spaceXXSmall} from '../../styles/variables/_space';
|
|
17
17
|
import {classify} from '../../utils/classify';
|
|
18
|
-
import {ClickAway} from '../../utils/click-away';
|
|
18
|
+
import {type ClickAwayRefType, ClickAway} from '../../utils/click-away';
|
|
19
19
|
import type {InputProps} from '../Input';
|
|
20
20
|
import type {MenuOption, MenuProps} from '../Menu';
|
|
21
21
|
import {Menu} from '../Menu';
|
|
@@ -38,6 +38,7 @@ export type TypeaheadProps = {
|
|
|
38
38
|
onClear?: () => void,
|
|
39
39
|
isLoading?: boolean,
|
|
40
40
|
menuOpenOffset?: number,
|
|
41
|
+
clickAwayRef?: ClickAwayRefType,
|
|
41
42
|
...
|
|
42
43
|
};
|
|
43
44
|
|
|
@@ -60,6 +61,7 @@ export const Typeahead: React$AbstractComponent<
|
|
|
60
61
|
isLoading,
|
|
61
62
|
menuOpenOffset = 1,
|
|
62
63
|
onFocus,
|
|
64
|
+
clickAwayRef,
|
|
63
65
|
...inputProps
|
|
64
66
|
}: TypeaheadProps,
|
|
65
67
|
ref,
|
|
@@ -95,7 +97,7 @@ export const Typeahead: React$AbstractComponent<
|
|
|
95
97
|
}, [typeaheadInputText, menu?.options]);
|
|
96
98
|
|
|
97
99
|
return (
|
|
98
|
-
<ClickAway onChange={onMenuToggle}>
|
|
100
|
+
<ClickAway onChange={onMenuToggle} clickAwayRef={clickAwayRef}>
|
|
99
101
|
{({isOpen, onOpen, cancelNext, clickAway}) => (
|
|
100
102
|
<div
|
|
101
103
|
data-testid="Typeahead"
|
package/lib/types/charts.js.flow
CHANGED
|
@@ -7,6 +7,11 @@ export type ChartOptions = {
|
|
|
7
7
|
spacing?: Array<number>,
|
|
8
8
|
margin?: Array<number>,
|
|
9
9
|
style?: CSSObject,
|
|
10
|
+
spacing?: [number, number, number, number],
|
|
11
|
+
spacingBottom?: number,
|
|
12
|
+
spacingLeft?: number,
|
|
13
|
+
spacingRight?: number,
|
|
14
|
+
spacingTop?: number,
|
|
10
15
|
...
|
|
11
16
|
},
|
|
12
17
|
title?: {
|
|
@@ -66,6 +71,7 @@ export type ChartOptions = {
|
|
|
66
71
|
...
|
|
67
72
|
},
|
|
68
73
|
legend?: Legend,
|
|
74
|
+
navigation?: Navigation,
|
|
69
75
|
...
|
|
70
76
|
};
|
|
71
77
|
|
|
@@ -223,3 +229,27 @@ export type Credits = {
|
|
|
223
229
|
},
|
|
224
230
|
...
|
|
225
231
|
};
|
|
232
|
+
|
|
233
|
+
export type Navigation = {
|
|
234
|
+
breadcrumbs?: Breadcrumbs,
|
|
235
|
+
...
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
export type Breadcrumbs = {
|
|
239
|
+
position?: Position,
|
|
240
|
+
style?: CSSObject,
|
|
241
|
+
buttonTheme?: ButtonTheme,
|
|
242
|
+
...
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export type ButtonTheme = {
|
|
246
|
+
style?: CSSObject,
|
|
247
|
+
...
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
export type Position = {
|
|
251
|
+
align?: string,
|
|
252
|
+
verticalAlign?: string,
|
|
253
|
+
x?: number,
|
|
254
|
+
y?: number,
|
|
255
|
+
};
|
|
@@ -25,9 +25,9 @@ const breadcrumbStyle = {
|
|
|
25
25
|
exports.breadcrumbStyle = breadcrumbStyle;
|
|
26
26
|
const commonChartOptions = {
|
|
27
27
|
chart: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
spacingBottom: 0,
|
|
29
|
+
spacingLeft: 0,
|
|
30
|
+
spacingRight: 0
|
|
31
31
|
},
|
|
32
32
|
title: {
|
|
33
33
|
text: null
|
|
@@ -71,7 +71,20 @@ const commonChartOptions = {
|
|
|
71
71
|
enabled: true
|
|
72
72
|
},
|
|
73
73
|
xAxis: {
|
|
74
|
-
type: 'category'
|
|
74
|
+
type: 'category',
|
|
75
|
+
padding: 0
|
|
76
|
+
},
|
|
77
|
+
navigation: {
|
|
78
|
+
breadcrumbs: {
|
|
79
|
+
buttonTheme: {
|
|
80
|
+
style: {
|
|
81
|
+
color: _color.colorFillInversePrimary
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
separator: {
|
|
85
|
+
text: '>'
|
|
86
|
+
}
|
|
87
|
+
}
|
|
75
88
|
}
|
|
76
89
|
};
|
|
77
90
|
exports.commonChartOptions = commonChartOptions;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
colorDataViz6,
|
|
10
10
|
colorDataViz7,
|
|
11
11
|
colorDataViz8,
|
|
12
|
+
colorFillInversePrimary,
|
|
12
13
|
colorTextSecondary,
|
|
13
14
|
colorTooltipFill,
|
|
14
15
|
} from '../../styles/variables/_color';
|
|
@@ -44,9 +45,9 @@ export const breadcrumbStyle = {
|
|
|
44
45
|
|
|
45
46
|
export const commonChartOptions: $Shape<ChartOptions> = {
|
|
46
47
|
chart: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
spacingBottom: 0,
|
|
49
|
+
spacingLeft: 0,
|
|
50
|
+
spacingRight: 0,
|
|
50
51
|
},
|
|
51
52
|
title: {
|
|
52
53
|
text: null,
|
|
@@ -88,6 +89,19 @@ export const commonChartOptions: $Shape<ChartOptions> = {
|
|
|
88
89
|
},
|
|
89
90
|
xAxis: {
|
|
90
91
|
type: 'category',
|
|
92
|
+
padding: 0,
|
|
93
|
+
},
|
|
94
|
+
navigation: {
|
|
95
|
+
breadcrumbs: {
|
|
96
|
+
buttonTheme: {
|
|
97
|
+
style: {
|
|
98
|
+
color: colorFillInversePrimary,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
separator: {
|
|
102
|
+
text: '>',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
91
105
|
},
|
|
92
106
|
};
|
|
93
107
|
|
|
@@ -98,6 +98,15 @@ class ClickAway extends React.Component {
|
|
|
98
98
|
isOpen,
|
|
99
99
|
pageBottom
|
|
100
100
|
} = this.state;
|
|
101
|
+
const {
|
|
102
|
+
clickAwayRef
|
|
103
|
+
} = this.props;
|
|
104
|
+
if (clickAwayRef) {
|
|
105
|
+
clickAwayRef.current = {
|
|
106
|
+
forceClose: this.forceClose,
|
|
107
|
+
forceOpen: this.handleOpenClick
|
|
108
|
+
};
|
|
109
|
+
}
|
|
101
110
|
return this.props.children({
|
|
102
111
|
onOpen: this.handleOpenClick,
|
|
103
112
|
isOpen,
|